diff --git a/gui/localfolderpage.cpp b/gui/localfolderpage.cpp index 96d920c04..5e74de2be 100644 --- a/gui/localfolderpage.cpp +++ b/gui/localfolderpage.cpp @@ -24,6 +24,7 @@ #include "localfolderpage.h" #include "gui/stdactions.h" #include "gui/customactions.h" +#include "models/playqueuemodel.h" #include "widgets/menubutton.h" LocalFolderBrowsePage::LocalFolderBrowsePage(bool isHome, QWidget *p) @@ -58,8 +59,6 @@ void LocalFolderBrowsePage::headerClicked(int level) } } -#include - void LocalFolderBrowsePage::itemDoubleClicked(const QModelIndex &) { const QModelIndexList selected = view->selectedIndexes(false); // Dont need sorted selection here... @@ -71,7 +70,16 @@ void LocalFolderBrowsePage::itemDoubleClicked(const QModelIndex &) void LocalFolderBrowsePage::addSelectionToPlaylist(const QString &name, int action, quint8 priority, bool decreasePriority) { - qWarning() << name << action; + Q_UNUSED(priority) + Q_UNUSED(decreasePriority) + + const QModelIndexList selected = view->selectedIndexes(true); + QStringList paths; + + for (const auto &idx: selected) { + paths.append(model->filePath(proxy->mapToSource(idx))); + } + PlayQueueModel::self()->load(paths, action); } void LocalFolderBrowsePage::controlActions() diff --git a/models/playqueuemodel.cpp b/models/playqueuemodel.cpp index 5380ffa38..a3f70075d 100644 --- a/models/playqueuemodel.cpp +++ b/models/playqueuemodel.cpp @@ -25,7 +25,6 @@ */ #include "playqueuemodel.h" -#include "mpd-interface/mpdconnection.h" #include "mpd-interface/mpdparseutils.h" #include "mpd-interface/mpdstats.h" #include "mpd-interface/cuefile.h" @@ -724,11 +723,11 @@ bool PlayQueueModel::dropMimeData(const QMimeData *data, return false; } -void PlayQueueModel::load(const QStringList &urls) +void PlayQueueModel::load(const QStringList &urls, int action) { QStringList useable=parseUrls(urls, false); if (useable.count()) { - addItems(useable, songs.count(), songs.isEmpty(), 0, false); + addItems(useable, songs.count(), action, 0, false); } } diff --git a/models/playqueuemodel.h b/models/playqueuemodel.h index b26641b6a..eb3725cbe 100644 --- a/models/playqueuemodel.h +++ b/models/playqueuemodel.h @@ -27,6 +27,7 @@ #ifndef PLAYQUEUEMODEL_H #define PLAYQUEUEMODEL_H +#include "mpd-interface/mpdconnection.h" #include "mpd-interface/song.h" #include "mpd-interface/mpdstatus.h" #include "config.h" @@ -138,7 +139,7 @@ private: void addSortAction(const QString &name, const QString &key); public Q_SLOTS: - void load(const QStringList &urls); + void load(const QStringList &urls, int action=MPDConnection::Append); void addItems(const QStringList &items, int row, int action, quint8 priority, bool decreasePriority); void addItems(const QStringList &items, int action, quint8 priority, bool decreasePriority) { addItems(items, -1, action, priority, decreasePriority); } void addFiles(const QStringList &filenames, int row, int action, quint8 priority, bool decreasePriority=false);