Commit b2056f31 authored by Graham Littlewood's avatar Graham Littlewood
Browse files

Fix replace playlist when enqueuing directory

parent 555e011a
......@@ -851,6 +851,15 @@ void MediaPlayListProxyModel::enqueueDirectory(const QUrl &fileName, ElisaUtils:
ElisaUtils::PlayListEnqueueTriggerPlay triggerPlay, int depth)
{
if (!fileName.isLocalFile()) return;
// clear playlist if required
if (enqueueMode == ElisaUtils::ReplacePlayList) {
if (rowCount() == 0) {
Q_EMIT hideUndoNotification();
} else {
clearPlayList();
}
}
// get contents of directory
QDir dirInfo = QDir(fileName.toLocalFile());
auto files = dirInfo.entryInfoList(QDir::NoDotAndDotDot | QDir::Readable | QDir::Files | QDir::Dirs, QDir::Name);
auto newFiles = ElisaUtils::EntryDataList();
......@@ -863,10 +872,11 @@ void MediaPlayListProxyModel::enqueueDirectory(const QUrl &fileName, ElisaUtils:
}
else if (file.isDir() && depth > 1)
{
// recurse through directory
enqueueDirectory(fileUrl, databaseIdType, ElisaUtils::AppendPlayList, triggerPlay, depth-1);
}
}
if (newFiles.size() != 0) enqueue(newFiles, databaseIdType, enqueueMode, triggerPlay);
if (newFiles.size() != 0) enqueue(newFiles, databaseIdType, ElisaUtils::AppendPlayList, triggerPlay);
}
#include "moc_mediaplaylistproxymodel.cpp"
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment