Fix "Play Next" functionality invoked from grid delegate
Reason for the change
This MR consists of two commits, the second of which fixes https://bugs.kde.org/423007, and the first of which prevents that fix from regressing the "Play Next" functionality invoked from a grid delegate due to another bug.
Here are the commits:
Fix "Play Next" functionality invoked from grid delegate
This was mistakenly triggering play and relying implicitly on a bug that
the trigger play behavior wasn't actualy working. Also handle the
signals in a more conventional way, like we do other signals in the
file.
Fix ElisaUtils::TriggerPlay not actually always triggering play
MediaPlayListProxyModel::enqueue was relying on some implicit fallback
behaviors to make sure that newly enqueued tracks got played when
needed. This failed in the case where a file was added externally; it
would be added, and ElisaUtils::TriggerPlay was sent as intended, but
this was ignored ignored so the newly-added track didn't get played.
In addition, the index of the newly-added track was being calculated
incorectly; -1 isn't a valid way of asking for the final item of the
playlist.
Fixing those issues resolves the bug of externally-opened files not
starting playback immediately.
BUG: 423007
FIXED-IN: 24.08.0
Test plan
Find a music file in Dolphin, right-click, Open in Elisa +> now it gets played after being appended to the playlist
Open Elisa, add some stuff to the playlist, play a song in the middle, show a grid view, click "play next" on something => it's added next but not played
Beyond these, test other forms of normal enqueue behaviors by using the app for a bit => everything still works as expected
Bugs fixed
BUG: 423007 FIXED-IN: 24.08.0