diff options
author | Ole-André Rodlie <ole.andre.rodlie@gmail.com> | 2018-05-11 02:00:13 +0200 |
---|---|---|
committer | Ole-André Rodlie <ole.andre.rodlie@gmail.com> | 2018-05-11 02:00:13 +0200 |
commit | 7884e95b010b928b410fb787e5aaaefd2a7295ce (patch) | |
tree | e0f50add12b766354ca7a235847b8a3be795da36 /src-qt5/core/lumina-desktop/LSession.cpp | |
parent | Fix the view-presentation icon in lumina-pdf (diff) | |
download | lumina-7884e95b010b928b410fb787e5aaaefd2a7295ce.tar.gz lumina-7884e95b010b928b410fb787e5aaaefd2a7295ce.tar.bz2 lumina-7884e95b010b928b410fb787e5aaaefd2a7295ce.zip |
desktop: support /run/media (user removable devices)
Diffstat (limited to 'src-qt5/core/lumina-desktop/LSession.cpp')
-rw-r--r-- | src-qt5/core/lumina-desktop/LSession.cpp | 6 |
1 files changed, 4 insertions, 2 deletions
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 |