diff options
Diffstat (limited to 'src-qt5/core/libLumina')
-rw-r--r-- | src-qt5/core/libLumina/LuminaOS-Debian.cpp | 2 | ||||
-rw-r--r-- | src-qt5/core/libLumina/LuminaOS-DragonFly.cpp | 6 | ||||
-rw-r--r-- | src-qt5/core/libLumina/LuminaOS-FreeBSD.cpp | 7 | ||||
-rw-r--r-- | src-qt5/core/libLumina/LuminaOS-Gentoo.cpp | 2 | ||||
-rw-r--r-- | src-qt5/core/libLumina/LuminaOS-Linux.cpp | 2 | ||||
-rw-r--r-- | src-qt5/core/libLumina/LuminaOS-NetBSD.cpp | 8 | ||||
-rw-r--r-- | src-qt5/core/libLumina/LuminaOS-OpenBSD.cpp | 2 | ||||
-rw-r--r-- | src-qt5/core/libLumina/LuminaOS-kFreeBSD.cpp | 2 | ||||
-rw-r--r-- | src-qt5/core/libLumina/LuminaOS-template.cpp | 4 | ||||
-rw-r--r-- | src-qt5/core/libLumina/LuminaOS.h | 3 | ||||
-rw-r--r-- | src-qt5/core/libLumina/LuminaUtils.cpp | 77 | ||||
-rw-r--r-- | src-qt5/core/libLumina/LuminaUtils.h | 5 | ||||
-rw-r--r-- | src-qt5/core/libLumina/LuminaX11.h | 14 | ||||
-rw-r--r-- | src-qt5/core/libLumina/LuminaXDG.cpp | 34 |
14 files changed, 134 insertions, 34 deletions
diff --git a/src-qt5/core/libLumina/LuminaOS-Debian.cpp b/src-qt5/core/libLumina/LuminaOS-Debian.cpp index 75aad108..cb8e9cdd 100644 --- a/src-qt5/core/libLumina/LuminaOS-Debian.cpp +++ b/src-qt5/core/libLumina/LuminaOS-Debian.cpp @@ -24,6 +24,8 @@ QString LOS::SysPrefix(){ return "/"; } //Prefix for system //OS-specific application shortcuts (*.desktop files) QString LOS::ControlPanelShortcut(){ return ""; } //system control panel QString LOS::AppStoreShortcut(){ return LOS::AppPrefix() + "/share/applications/synaptic.desktop"; } //graphical app/pkg manager +//OS-specific RSS feeds (Format: QStringList[ <name>::::<url> ]; ) +QStringList LOS::RSSFeeds(){ return QStringList(); } // ==== ExternalDevicePaths() ==== QStringList LOS::ExternalDevicePaths(){ diff --git a/src-qt5/core/libLumina/LuminaOS-DragonFly.cpp b/src-qt5/core/libLumina/LuminaOS-DragonFly.cpp index b98a36ee..919c88e5 100644 --- a/src-qt5/core/libLumina/LuminaOS-DragonFly.cpp +++ b/src-qt5/core/libLumina/LuminaOS-DragonFly.cpp @@ -74,6 +74,12 @@ QString LOS::SysPrefix(){ return "/usr/"; } //Prefix for system //OS-specific application shortcuts (*.desktop files) QString LOS::ControlPanelShortcut(){ return ""; } //system control panel QString LOS::AppStoreShortcut(){ return ""; } //graphical app/pkg manager +//OS-specific RSS feeds (Format: QStringList[ <name>::::<url> ]; ) +QStringList LOS::RSSFeeds(){ + QStringList feeds; + feeds << "DragonFly BSD Feed::::http://www.dragonflybsd.org/recentchanges/index.rss"; + return feeds; +} // ==== ExternalDevicePaths() ==== QStringList LOS::ExternalDevicePaths(){ diff --git a/src-qt5/core/libLumina/LuminaOS-FreeBSD.cpp b/src-qt5/core/libLumina/LuminaOS-FreeBSD.cpp index fb405cb5..6f03767b 100644 --- a/src-qt5/core/libLumina/LuminaOS-FreeBSD.cpp +++ b/src-qt5/core/libLumina/LuminaOS-FreeBSD.cpp @@ -26,6 +26,13 @@ QString LOS::SysPrefix(){ return "/usr/"; } //Prefix for system //OS-specific application shortcuts (*.desktop files) QString LOS::ControlPanelShortcut(){ return "/usr/local/share/applications/pccontrol.desktop"; } //system control panel QString LOS::AppStoreShortcut(){ return "/usr/local/share/applications/appcafe.desktop"; } //graphical app/pkg manager +//OS-specific RSS feeds (Format: QStringList[ <name>::::<url> ]; ) +QStringList LOS::RSSFeeds(){ + QStringList feeds; + feeds << "FreeBSD News Feed::::https://www.freebsd.org/news/rss.xml"; + feeds << "PC-BSD News Feed::::https://blog.pcbsd.org/?feed=rss2"; + return feeds; + } // ==== ExternalDevicePaths() ==== QStringList LOS::ExternalDevicePaths(){ diff --git a/src-qt5/core/libLumina/LuminaOS-Gentoo.cpp b/src-qt5/core/libLumina/LuminaOS-Gentoo.cpp index e3d5fe56..3a9c7320 100644 --- a/src-qt5/core/libLumina/LuminaOS-Gentoo.cpp +++ b/src-qt5/core/libLumina/LuminaOS-Gentoo.cpp @@ -24,6 +24,8 @@ QString LOS::SysPrefix(){ return "/"; } //Prefix for system //OS-specific application shortcuts (*.desktop files) QString LOS::ControlPanelShortcut(){ return ""; } //system control panel QString LOS::AppStoreShortcut(){ return LOS::AppPrefix() + "/share/applications/porthole.desktop"; } //graphical app/pkg manager +//OS-specific RSS feeds (Format: QStringList[ <name>::::<url> ]; ) +QStringList LOS::RSSFeeds(){ return QStringList(); } // ==== ExternalDevicePaths() ==== QStringList LOS::ExternalDevicePaths(){ diff --git a/src-qt5/core/libLumina/LuminaOS-Linux.cpp b/src-qt5/core/libLumina/LuminaOS-Linux.cpp index 5939c9d1..c40cbd60 100644 --- a/src-qt5/core/libLumina/LuminaOS-Linux.cpp +++ b/src-qt5/core/libLumina/LuminaOS-Linux.cpp @@ -24,6 +24,8 @@ QString LOS::SysPrefix(){ return "/usr/"; } //Prefix for system //OS-specific application shortcuts (*.desktop files) QString LOS::ControlPanelShortcut(){ return ""; } //system control panel QString LOS::AppStoreShortcut(){ return ""; } //graphical app/pkg manager +//OS-specific RSS feeds (Format: QStringList[ <name>::::<url> ]; ) +QStringList LOS::RSSFeeds(){ return QStringList(); } // ==== ExternalDevicePaths() ==== QStringList LOS::ExternalDevicePaths(){ diff --git a/src-qt5/core/libLumina/LuminaOS-NetBSD.cpp b/src-qt5/core/libLumina/LuminaOS-NetBSD.cpp index 866ccc5c..e1152527 100644 --- a/src-qt5/core/libLumina/LuminaOS-NetBSD.cpp +++ b/src-qt5/core/libLumina/LuminaOS-NetBSD.cpp @@ -20,7 +20,13 @@ QString LOS::SysPrefix(){ return "/usr/"; } //Prefix for system //OS-specific application shortcuts (*.desktop files) QString LOS::ControlPanelShortcut(){ return ""; } //system control panel QString LOS::AppStoreShortcut(){ return ""; } //graphical app/pkg manager - +//OS-specific RSS feeds (Format: QStringList[ <name>::::<url> ]; ) +QStringList LOS::RSSFeeds(){ + QStringList feeds; + feeds << "NetBSD News::::http://www.netbsd.org/changes/rss-netbsd.xml"; + return feeds; +} + // ==== ExternalDevicePaths() ==== QStringList LOS::ExternalDevicePaths(){ //Returns: QStringList[<type>::::<filesystem>::::<path>] diff --git a/src-qt5/core/libLumina/LuminaOS-OpenBSD.cpp b/src-qt5/core/libLumina/LuminaOS-OpenBSD.cpp index c0fdafd4..30a02078 100644 --- a/src-qt5/core/libLumina/LuminaOS-OpenBSD.cpp +++ b/src-qt5/core/libLumina/LuminaOS-OpenBSD.cpp @@ -23,6 +23,8 @@ QString LOS::SysPrefix(){ return "/usr/"; } //Prefix for system //OS-specific application shortcuts (*.desktop files) QString LOS::ControlPanelShortcut(){ return ""; } //system control panel QString LOS::AppStoreShortcut(){ return ""; } //graphical app/pkg manager +//OS-specific RSS feeds (Format: QStringList[ <name>::::<url> ]; ) +QStringList LOS::RSSFeeds(){ return QStringList(); } // ==== ExternalDevicePaths() ==== QStringList LOS::ExternalDevicePaths(){ diff --git a/src-qt5/core/libLumina/LuminaOS-kFreeBSD.cpp b/src-qt5/core/libLumina/LuminaOS-kFreeBSD.cpp index 4fe62686..8414db1a 100644 --- a/src-qt5/core/libLumina/LuminaOS-kFreeBSD.cpp +++ b/src-qt5/core/libLumina/LuminaOS-kFreeBSD.cpp @@ -28,6 +28,8 @@ QString LOS::SysPrefix(){ return "/usr/"; } //Prefix for system //OS-specific application shortcuts (*.desktop files) QString LOS::ControlPanelShortcut(){ return ""; } //system control panel QString LOS::AppStoreShortcut(){ return ""; } //graphical app/pkg manager +//OS-specific RSS feeds (Format: QStringList[ <name>::::<url> ]; ) +QStringList LOS::RSSFeeds(){ return QStringList(); } // ==== ExternalDevicePaths() ==== QStringList LOS::ExternalDevicePaths(){ diff --git a/src-qt5/core/libLumina/LuminaOS-template.cpp b/src-qt5/core/libLumina/LuminaOS-template.cpp index 5969bf3a..7aea0edd 100644 --- a/src-qt5/core/libLumina/LuminaOS-template.cpp +++ b/src-qt5/core/libLumina/LuminaOS-template.cpp @@ -20,7 +20,9 @@ QString LOS::SysPrefix(){ return "/usr/"; } //Prefix for system //OS-specific application shortcuts (*.desktop files) QString LOS::ControlPanelShortcut(){ return ""; } //system control panel QString LOS::AppStoreShortcut(){ return ""; } //graphical app/pkg manager - +//OS-specific RSS feeds (Format: QStringList[ <name>::::<url> ]; ) +QStringList LOS::RSSFeeds(){ return QStringList(); } + // ==== ExternalDevicePaths() ==== QStringList LOS::ExternalDevicePaths(){ //Returns: QStringList[<type>::::<filesystem>::::<path>] diff --git a/src-qt5/core/libLumina/LuminaOS.h b/src-qt5/core/libLumina/LuminaOS.h index c305277a..a18f2909 100644 --- a/src-qt5/core/libLumina/LuminaOS.h +++ b/src-qt5/core/libLumina/LuminaOS.h @@ -34,6 +34,9 @@ public: static QString ControlPanelShortcut(); static QString AppStoreShortcut(); + //OS-specific RSS feeds + static QStringList RSSFeeds(); //Return Format: QStringList[ <name>::::<url> ]; + //Scan for mounted external devices static QStringList ExternalDevicePaths(); //Returns: QStringList[<type>::::<filesystem>::::<path>] //Note: <type> = [USB, HDRIVE, DVD, SDCARD, UNKNOWN] diff --git a/src-qt5/core/libLumina/LuminaUtils.cpp b/src-qt5/core/libLumina/LuminaUtils.cpp index 12dcf0be..4911b9fa 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!! @@ -472,6 +489,7 @@ QStringList LUtils::listFavorites(){ if(lastRead.isNull() || lastRead<QFileInfo(QDir::homePath()+"/.lumina/favorites/fav.list").lastModified()){ fav = LUtils::readFile(QDir::homePath()+"/.lumina/favorites/fav.list"); fav.removeAll(""); //remove any empty lines + fav.removeDuplicates(); lastRead = cur; if(fav.isEmpty()){ //Make sure the favorites dir exists, and create it if necessary @@ -484,6 +502,7 @@ QStringList LUtils::listFavorites(){ } bool LUtils::saveFavorites(QStringList list){ + list.removeDuplicates(); bool ok = LUtils::writeFile(QDir::homePath()+"/.lumina/favorites/fav.list", list, true); if(ok){ fav = list; } //also save internally in case of rapid write/read of the file return ok; @@ -576,7 +595,7 @@ void LUtils::LoadSystemDefaults(bool skipOS){ } } //Now setup the default "desktopsettings.conf" and "sessionsettings.conf" files - QStringList deskset, sesset, lopenset; + QStringList deskset, sesset;//, lopenset; // -- SESSION SETTINGS -- QStringList tmp = sysDefaults.filter("session_"); @@ -593,38 +612,71 @@ 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 + QString sset; //temporary strings if(var=="session_enablenumlock"){ sset = "EnableNumlock="+ istrue; } else if(var=="session_playloginaudio"){ sset = "PlayStartupAudio="+istrue; } else if(var=="session_playlogoutaudio"){ sset = "PlayLogoutAudio="+istrue; } - else if(var=="session_default_terminal"){ sset = "default-terminal="+val; } - else if(var=="session_default_filemanager"){ - sset = "default-filemanager="+val; - loset = "directory="+val; + else if(var=="session_default_terminal"){ + LXDG::setDefaultAppForMime("application/terminal", val); + //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"){ + LXDG::setDefaultAppForMime("application/email",val); + //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()){ + /*if(!loset.isEmpty()){ int index = lopenset.indexOf(QRegExp(loset.section("=",0,0)+"=*", Qt::CaseSensitive, QRegExp::Wildcard)); qDebug() << "loset line:" << loset << index << lopenset; if(index<0){ lopenset << loset; } //new line else{ lopenset[index] = loset; } //overwrite the other line - } + }*/ if(!sset.isEmpty()){ int index = sesset.indexOf(QRegExp(sset.section("=",0,0)+"=*", Qt::CaseSensitive, QRegExp::Wildcard)); if(index<0){ sesset << sset; } //new line else{ sesset[index] = sset; } //overwrite the other line } } - if(!lopenset.isEmpty()){ lopenset.prepend("[default]"); } //the session options exist within this set + //if(!lopenset.isEmpty()){ lopenset.prepend("[default]"); } //the session options exist within this set + + // -- MIMETYPE DEFAULTS -- + tmp = sysDefaults.filter("mime_default_"); + for(int i=0; i<tmp.length(); i++){ + if(tmp[i].startsWith("#") || !tmp[i].contains("=") ){ continue; } + QString var = tmp[i].section("=",0,0).toLower().simplified(); + QString val = tmp[i].section("=",1,1).section("#",0,0).simplified(); + if(val.isEmpty()){ continue; } + QString istrue = (val.toLower()=="true") ? "true": "false"; + //Change in 0.8.5 - use "_" instead of "." within variables names - need backwards compat for a little while + if(var.contains(".")){ var.replace(".","_"); } + //Now parse the variable and put the value in the proper file + val = AppToAbsolute(val); + //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 + } + //Now turn this variable into the mimetype only + var = var.section("_default_",1,-1); + LXDG::setDefaultAppForMime(var, val); + } // -- DESKTOP SETTINGS -- //(only works for the primary desktop at the moment) @@ -710,6 +762,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); } @@ -780,7 +833,7 @@ void LUtils::LoadSystemDefaults(bool skipOS){ if(setTheme){ LTHEME::setCurrentSettings( themesettings[0], themesettings[1], themesettings[2], themesettings[3], themesettings[4]); } LUtils::writeFile(setdir+"/sessionsettings.conf", sesset, true); LUtils::writeFile(setdir+"/desktopsettings.conf", deskset, true); - LUtils::writeFile(setdir+"/lumina-open.conf", lopenset, true); + //LUtils::writeFile(setdir+"/lumina-open.conf", lopenset, true); } bool LUtils::checkUserFiles(QString lastversion){ 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/libLumina/LuminaX11.h b/src-qt5/core/libLumina/LuminaX11.h index b0a5d588..b7310abd 100644 --- a/src-qt5/core/libLumina/LuminaX11.h +++ b/src-qt5/core/libLumina/LuminaX11.h @@ -69,6 +69,14 @@ public: } }; +//simple data structure for passing around the XRANDR information +/*class monitor_info{ +public: + QString ID; + bool active; + QRect geometry; +};*/ + //XCB Library replacement for LX11 (Qt5 uses XCB instead of XLib) class LXCB{ @@ -393,6 +401,12 @@ public: WId WM_Get_CM_Owner(); void WM_Set_CM_Owner(WId win); + //============ + // RANDR Functions (directly reading changing monitor outputs) + //============ + //QList<monitor_info> RR_List_Monitors(); + //void RR_Set_Monitors(QList<monitor_info> monitors); + private: QList<xcb_atom_t> ATOMS; QStringList atoms; diff --git a/src-qt5/core/libLumina/LuminaXDG.cpp b/src-qt5/core/libLumina/LuminaXDG.cpp index bfca4f71..8f6ada37 100644 --- a/src-qt5/core/libLumina/LuminaXDG.cpp +++ b/src-qt5/core/libLumina/LuminaXDG.cpp @@ -854,20 +854,27 @@ QString LXDG::findDefaultAppForMime(QString mime){ //Now go through all the files in order of priority until a default is found QString cdefault; - QStringList white; //lists to keep track of during the search (black unused at the moment) for(int i=0; i<dirs.length() && cdefault.isEmpty(); i++){ if(!QFile::exists(dirs[i])){ continue; } QStringList info = LUtils::readFile(dirs[i]); if(info.isEmpty()){ continue; } - QString workdir = dirs[i].section("/",0,-1); //just the directory + QStringList white; //lists to keep track of during the search (black unused at the moment) + QString workdir = dirs[i].section("/",0,-2); //just the directory + // qDebug() << "Check File:" << mime << dirs[i] << workdir; int def = info.indexOf("[Default Applications]"); //find this line to start on if(def>=0){ for(int d=def+1; d<info.length(); d++){ + //qDebug() << "Check Line:" << info[d]; if(info[d].startsWith("[")){ break; } //starting a new section now - finished with defaults - if(info[d].contains(mime+"=")){ - white << info[d].section("=",1,50).split(";"); - break; - } + if(info[d].contains(mime+"=") ){ + white = info[d].section("=",1,-1).split(";") + white; //exact mime match - put at front of list + break; //already found exact match + }else if(info[d].contains("*") && info[d].contains("=") ){ + QRegExp rg(info[d].section("=",0,0), Qt::CaseSensitive, QRegExp::WildcardUnix); + if(rg.exactMatch(mime)){ + white << info[d].section("=",1,-1).split(";"); //partial mime match - put at end of list + } + } } } // Now check for any white-listed files in this work dir @@ -884,19 +891,10 @@ QString LXDG::findDefaultAppForMime(QString mime){ else if( QFile::exists(workdir+"/"+white[w]) ){ cdefault=workdir+"/"+white[w]; break; } //Now go through the XDG DATA dirs and see if the file is in there else{ - QStringList xdirs; - xdirs << QString(getenv("XDG_DATA_HOME"))+"/applications/"; - tmp = QString(getenv("XDG_DATA_DIRS")).split(":"); - for(int t=0; t<tmp.length(); t++){ xdirs << tmp[t]+"/applications/"; } - //Now scan these dirs - bool found = false; - //qDebug() << "Scan dirs:" << white[w] << xdirs; - for(int x=0; x<xdirs.length() && !found; x++){ - if(QFile::exists(xdirs[x]+white[w])){cdefault=xdirs[x]+white[w]; found = true; } - } - if(found){ break; } + white[w] = LUtils::AppToAbsolute(white[w]); + if(QFile::exists(white[w])){ cdefault = white[w]; } } - } + } /* WRITTEN BUT UNUSED CODE FOR MIMETYPE ASSOCIATIONS //Skip using this because it is simply an alternate/unsupported standard that conflicts with the current mimetype database standards. It is better/faster to parse 1 or 2 database glob files |