diff options
author | Ken Moore <moorekou@gmail.com> | 2016-06-02 15:26:54 -0400 |
---|---|---|
committer | Ken Moore <moorekou@gmail.com> | 2016-06-02 15:26:54 -0400 |
commit | ffcb6592bfc9a47e9c56014f955f6deb1c76db85 (patch) | |
tree | f1eedc789706b32a3805ef15e44e7c38a9cda706 | |
parent | Rename/move the new RSS reader plugin to "rssreader" in the backend/source tr... (diff) | |
download | lumina-ffcb6592bfc9a47e9c56014f955f6deb1c76db85.tar.gz lumina-ffcb6592bfc9a47e9c56014f955f6deb1c76db85.tar.bz2 lumina-ffcb6592bfc9a47e9c56014f955f6deb1c76db85.zip |
Fix a bunch of little things with the desktop:
1) Reset which dirs are watched for apps to be installed into every time the watcher updates (fixes the detection of KDE apps getting installed/removed)
2) Add a new LuminaUtils function for converting a .desktop or binary name into a full path (searching all the various system dirs until it finds the file)
3) Convert the luminaDesktop.conf parser to allow relative paths/filenames for favorite/default apps
4) Update the default luminaDesktop.conf file quite a bit so there are app actually setup out of box.
5) Update the luminaDesktop.conf parser to properly set mimetypes as needed.
6) Fix the install location of the lumina-fm icon.
-rw-r--r-- | src-qt5/core/libLumina/LuminaUtils.cpp | 29 | ||||
-rw-r--r-- | src-qt5/core/libLumina/LuminaUtils.h | 5 | ||||
-rw-r--r-- | src-qt5/core/lumina-desktop/AppMenu.cpp | 2 | ||||
-rw-r--r-- | src-qt5/core/lumina-desktop/defaults/luminaDesktop.conf | 2 | ||||
-rw-r--r-- | src-qt5/desktop-utils/lumina-fm/lumina-fm.pro | 7 |
5 files changed, 36 insertions, 9 deletions
diff --git a/src-qt5/core/libLumina/LuminaUtils.cpp b/src-qt5/core/libLumina/LuminaUtils.cpp index 12dcf0be..5340d223 100644 --- a/src-qt5/core/libLumina/LuminaUtils.cpp +++ b/src-qt5/core/libLumina/LuminaUtils.cpp @@ -211,6 +211,23 @@ QString LUtils::PathToAbsolute(QString path){ } return path; } +QString LUtils::AppToAbsolute(QString path){ + if(path.startsWith("/") || QFile::exists(path)){ return path; } + if(path.endsWith(".desktop")){ + //Look in the XDG dirs + QStringList dirs = LXDG::systemApplicationDirs(); + for(int i=0; i<dirs.length(); i++){ + if(QFile::exists(dirs[i]+"/"+path)){ return (dirs[i]+"/"+path); } + } + }else{ + //Look on $PATH for the binary + QStringList paths = QString(getenv("PATH")).split(":"); + for(int i=0; i<paths.length(); i++){ + if(QFile::exists(paths[i]+"/"+path)){ return (paths[i]+"/"+path); } + } + } + return path; +} QStringList LUtils::imageExtensions(bool wildcards){ //Note that all the image extensions are lowercase!! @@ -593,12 +610,14 @@ void LUtils::LoadSystemDefaults(bool skipOS){ if(var.contains(".")){ var.replace(".","_"); } //Now parse the variable and put the value in the proper file + if(var.contains("_default_")){ val = AppToAbsolute(val); } //got an application/binary //Special handling for values which need to exist first if(var.endsWith("_ifexists") ){ var = var.remove("_ifexists"); //remove this flag from the variable //Check if the value exists (absolute path only) if(!QFile::exists(val)){ continue; } //skip this line - value/file does not exist } + //Parse/save the value QString loset, sset; //temporary strings if(var=="session_enablenumlock"){ sset = "EnableNumlock="+ istrue; } @@ -606,11 +625,16 @@ void LUtils::LoadSystemDefaults(bool skipOS){ else if(var=="session_playlogoutaudio"){ sset = "PlayLogoutAudio="+istrue; } else if(var=="session_default_terminal"){ sset = "default-terminal="+val; } else if(var=="session_default_filemanager"){ + LXDG::setDefaultAppForMime("inode/directory", val); sset = "default-filemanager="+val; loset = "directory="+val; + }else if(var=="session_default_webbrowser"){ + loset = "webbrowser="+val; + LXDG::setDefaultAppForMime("x-scheme-handler/http", val); + LXDG::setDefaultAppForMime("x-scheme-handler/https", val); + }else if(var=="session_default_email"){ + loset = "email="+val; } - else if(var=="session_default_webbrowser"){ loset = "webbrowser="+val; } - else if(var=="session_default_email"){ loset = "email="+val; } //Put the line into the file (overwriting any previous assignment as necessary) if(!loset.isEmpty()){ int index = lopenset.indexOf(QRegExp(loset.section("=",0,0)+"=*", Qt::CaseSensitive, QRegExp::Wildcard)); @@ -710,6 +734,7 @@ void LUtils::LoadSystemDefaults(bool skipOS){ if(var.contains(".")){ var.replace(".","_"); } //Now parse the variable and put the value in the proper file qDebug() << "Favorite entry:" << var << val; + val = AppToAbsolute(val); //turn any relative files into absolute if(var=="favorites_add_ifexists" && QFile::exists(val)){ qDebug() << " - Exists/Adding:"; LUtils::addFavorite(val); } else if(var=="favorites_add"){ qDebug() << " - Adding:"; LUtils::addFavorite(val); } else if(var=="favorites_remove"){ qDebug() << " - Removing:"; LUtils::removeFavorite(val); } diff --git a/src-qt5/core/libLumina/LuminaUtils.h b/src-qt5/core/libLumina/LuminaUtils.h index 32109244..e07363ca 100644 --- a/src-qt5/core/libLumina/LuminaUtils.h +++ b/src-qt5/core/libLumina/LuminaUtils.h @@ -54,8 +54,9 @@ public: static QStringList listSubDirectories(QString dir, bool recursive = true); //Convert an input file/dir path to an absolute file path - static QString PathToAbsolute(QString path); - + static QString PathToAbsolute(QString path); //This is primarily for CLI usage (relative paths) + static QString AppToAbsolute(QString path); //This is for looking up a binary/ *.desktop path + //Get the list of all file extensions which Qt can read (lowercase) static QStringList imageExtensions(bool wildcards = false); diff --git a/src-qt5/core/lumina-desktop/AppMenu.cpp b/src-qt5/core/lumina-desktop/AppMenu.cpp index 14af988a..0b8aeace 100644 --- a/src-qt5/core/lumina-desktop/AppMenu.cpp +++ b/src-qt5/core/lumina-desktop/AppMenu.cpp @@ -32,6 +32,7 @@ QHash<QString, QList<XDGDesktop> >* AppMenu::currentAppHash(){ // PRIVATE //=========== void AppMenu::updateAppList(){ + watcher->removePaths(watcher->directories()); //Make sure the title/icon are updated as well (in case of locale/icon change) this->setTitle(tr("Applications")); this->setIcon( LXDG::findIcon("system-run","") ); @@ -111,6 +112,7 @@ void AppMenu::updateAppList(){ } this->addMenu(menu); } + watcher->addPaths(LXDG::systemApplicationDirs()); emit AppMenuUpdated(); } diff --git a/src-qt5/core/lumina-desktop/defaults/luminaDesktop.conf b/src-qt5/core/lumina-desktop/defaults/luminaDesktop.conf index 41672ab6..f88ad2d0 100644 --- a/src-qt5/core/lumina-desktop/defaults/luminaDesktop.conf +++ b/src-qt5/core/lumina-desktop/defaults/luminaDesktop.conf @@ -32,7 +32,7 @@ session_default_webbrowser_ifexists=qupzilla.desktop session_default_email_ifexists=trojita.desktop #THEME SETTINGS -#theme.themefile=<file path> #Absolute path to the theme template file to use (disable for Lumina-Default) +theme_themefile=Glass #Name of the theme to use (disable for Lumina-Default) theme_colorfile=Black #Name of the color spec file to use for theming theme_iconset=oxygen #Name of the icon theme to use theme_font=Arial #Name of the font family to use diff --git a/src-qt5/desktop-utils/lumina-fm/lumina-fm.pro b/src-qt5/desktop-utils/lumina-fm/lumina-fm.pro index 9bb90a0e..5e0717f8 100644 --- a/src-qt5/desktop-utils/lumina-fm/lumina-fm.pro +++ b/src-qt5/desktop-utils/lumina-fm/lumina-fm.pro @@ -34,12 +34,11 @@ FORMS += MainUI.ui \ widgets/SlideshowWidget.ui \ widgets/DirWidget.ui -# RESOURCES+= lumina-fm.qrc +icons.files = Insight-FileManager.png +icons.path = $${L_SHAREDIR}/pixmaps LIBS += -lLuminaUtils -DEPENDPATH += ../libLumina - TRANSLATIONS = i18n/lumina-fm_af.ts \ i18n/lumina-fm_ar.ts \ i18n/lumina-fm_az.ts \ @@ -109,7 +108,7 @@ dotrans.extra=cd i18n && $${LRELEASE} -nounfinished *.ts && cp *.qm $(INSTALL_RO desktop.files=lumina-fm.desktop desktop.path=$${L_SHAREDIR}/applications/ -INSTALLS += target dotrans desktop +INSTALLS += target dotrans desktop icons NO_I18N{ INSTALLS -= dotrans |