From 9855075377ffc2d417855d574f7bce4d1b57d1ec Mon Sep 17 00:00:00 2001 From: Ken Moore Date: Thu, 12 Jan 2017 09:01:36 -0500 Subject: Add the ability to show "/media/*" shortcuts on the Lumina desktop. This will be very useful for systems that auto-create dirs in /media when devices are attached to the system, and mount-on-demand when browsing into that directory (*SPOILERS*). --- src-qt5/core/lumina-desktop/LSession.cpp | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src-qt5/core/lumina-desktop/LSession.cpp') diff --git a/src-qt5/core/lumina-desktop/LSession.cpp b/src-qt5/core/lumina-desktop/LSession.cpp index a4cc12a7..8143f260 100644 --- a/src-qt5/core/lumina-desktop/LSession.cpp +++ b/src-qt5/core/lumina-desktop/LSession.cpp @@ -159,6 +159,8 @@ void LSession::setupSession(){ //Try to watch the localized desktop folder too if(QFile::exists(QDir::homePath()+"/"+tr("Desktop"))){ watcherChange( QDir::homePath()+"/"+tr("Desktop") ); } watcherChange( QDir::homePath()+"/Desktop" ); + //And watch the /media directory + if(QFile::exists("/media")){ watcherChange("/media"); } //connect internal signals/slots connect(watcher, SIGNAL(directoryChanged(QString)), this, SLOT(watcherChange(QString)) ); @@ -339,6 +341,8 @@ void LSession::watcherChange(QString changed){ desktopFiles = QDir(changed).entryInfoList(QDir::NoDotAndDotDot | QDir::Files | QDir::Dirs ,QDir::Name | QDir::IgnoreCase | QDir::DirsFirst); if(DEBUG){ qDebug() << "New Desktop Files:" << desktopFiles.length(); } emit DesktopFilesChanged(); + }else if(changed.toLower() == "/media"){ + emit MediaFilesChanged(); }else if(changed.endsWith("favorites.list")){ emit FavoritesChanged(); } //Now ensure this file was not removed from the watcher if(!watcher->files().contains(changed) && !watcher->directories().contains(changed)){ -- cgit