diff options
author | Ken Moore <ken@ixsystems.com> | 2018-05-21 12:16:14 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-05-21 12:16:14 -0400 |
commit | 768b334408806fde94b4b283a32e69c23f2d8b2d (patch) | |
tree | b2fdc65a7b17c5d2441b52f49886efcc3fa69fcc /src-qt5 | |
parent | Merge pull request #585 from rodlie/bsdtar (diff) | |
parent | desktop: support /run/media (user removable devices) (diff) | |
download | lumina-768b334408806fde94b4b283a32e69c23f2d8b2d.tar.gz lumina-768b334408806fde94b4b283a32e69c23f2d8b2d.tar.bz2 lumina-768b334408806fde94b4b283a32e69c23f2d8b2d.zip |
Merge pull request #584 from rodlie/media
desktop: support /run/media (user removable devices)
Diffstat (limited to 'src-qt5')
-rw-r--r-- | src-qt5/core/lumina-desktop/LDesktop.cpp | 9 | ||||
-rw-r--r-- | src-qt5/core/lumina-desktop/LSession.cpp | 6 | ||||
-rw-r--r-- | src-qt5/core/lumina-desktop/desktop-plugins/applauncher/AppLauncherPlugin.cpp | 2 |
3 files changed, 12 insertions, 5 deletions
diff --git a/src-qt5/core/lumina-desktop/LDesktop.cpp b/src-qt5/core/lumina-desktop/LDesktop.cpp index a7ab1340..861a1aac 100644 --- a/src-qt5/core/lumina-desktop/LDesktop.cpp +++ b/src-qt5/core/lumina-desktop/LDesktop.cpp @@ -389,15 +389,20 @@ void LDesktop::UpdateDesktop(){ filelist << files[i].absoluteFilePath(); } } - //Also show anything available in the /media directory + //Also show anything available in the /media directory, and /run/media/USERNAME directory if(settings->value(DPREFIX+"generateMediaIcons",true).toBool()){ QDir media("/media"); QStringList mediadirs = media.entryList(QDir::Dirs | QDir::Files | QDir::NoDotAndDotDot, QDir::Name); for(int i=0; i<mediadirs.length(); i++){ filelist << media.absoluteFilePath(mediadirs[i]); } + QDir userMedia(QString("/run/media/%1").arg(QDir::homePath().split("/").takeLast())); + QStringList userMediadirs = userMedia.entryList(QDir::Dirs | QDir::NoDotAndDotDot, QDir::Name); + for(int i=0; i<userMediadirs.length(); i++){ + filelist << userMedia.absoluteFilePath(userMediadirs[i]); + } + //qDebug() << "Found media Dirs:" << mediadirs << userMediadirs; } - //qDebug() << "Found media Dirs:" << mediadirs; UpdateDesktopPluginArea(); bgDesktop->LoadItems(plugins, filelist); } diff --git a/src-qt5/core/lumina-desktop/LSession.cpp b/src-qt5/core/lumina-desktop/LSession.cpp index 1e686e51..ea6e402b 100644 --- a/src-qt5/core/lumina-desktop/LSession.cpp +++ b/src-qt5/core/lumina-desktop/LSession.cpp @@ -229,8 +229,10 @@ 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 + //And watch the /media directory, and /run/media/USERNAME directory if(QFile::exists("/media")){ watcherChange("/media"); } + QString userMedia = QString("/run/media/%1").arg(QDir::homePath().split("/").takeLast()); + if (QFile::exists(userMedia)) { watcherChange(userMedia); } if(!QFile::exists("/tmp/.autofs_change")){ system("touch /tmp/.autofs_change"); } watcherChange("/tmp/.autofs_change"); //connect internal signals/slots @@ -422,7 +424,7 @@ 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" || changed == "/tmp/.autofs_change" ){ + }else if(changed.toLower() == "/media" || changed.toLower().startsWith("/run/media/") || changed == "/tmp/.autofs_change" ){ emit MediaFilesChanged(); }else if(changed.endsWith("favorites.list")){ emit FavoritesChanged(); } //Now ensure this file was not removed from the watcher diff --git a/src-qt5/core/lumina-desktop/desktop-plugins/applauncher/AppLauncherPlugin.cpp b/src-qt5/core/lumina-desktop/desktop-plugins/applauncher/AppLauncherPlugin.cpp index 837e3268..218bc098 100644 --- a/src-qt5/core/lumina-desktop/desktop-plugins/applauncher/AppLauncherPlugin.cpp +++ b/src-qt5/core/lumina-desktop/desktop-plugins/applauncher/AppLauncherPlugin.cpp @@ -91,7 +91,7 @@ void AppLauncherPlugin::loadButton(){ button->setWhatsThis(info.absoluteFilePath()); QString iconame; if(info.isDir()){ - if(path.startsWith("/media/")){ + if(path.startsWith("/media/") || path.startsWith("/run/media/")){ iconame = "drive-removable-media"; //Could add device ID parsing here to determine what "type" of device it is - will be OS-specific though //button->setIcon( LXDG::findIcon("drive-removable-media","") ); |