aboutsummaryrefslogtreecommitdiff
path: root/src-qt5/core/libLumina
diff options
context:
space:
mode:
Diffstat (limited to 'src-qt5/core/libLumina')
-rw-r--r--src-qt5/core/libLumina/LDesktopUtils.cpp50
-rw-r--r--src-qt5/core/libLumina/LuminaSingleApplication.cpp2
-rw-r--r--src-qt5/core/libLumina/LuminaXDG.cpp1
3 files changed, 31 insertions, 22 deletions
diff --git a/src-qt5/core/libLumina/LDesktopUtils.cpp b/src-qt5/core/libLumina/LDesktopUtils.cpp
index 69d4ba52..92268672 100644
--- a/src-qt5/core/libLumina/LDesktopUtils.cpp
+++ b/src-qt5/core/libLumina/LDesktopUtils.cpp
@@ -13,10 +13,8 @@
#include "LuminaThemes.h"
-static QStringList fav;
-
QString LDesktopUtils::LuminaDesktopVersion(){
- QString ver = "1.4.0";
+ QString ver = "1.4.1";
#ifdef GIT_VERSION
ver.append( QString(" (Git Revision: %1)").arg(GIT_VERSION) );
#endif
@@ -80,22 +78,23 @@ QStringList LDesktopUtils::infoQuickPlugin(QString ID){ //Returns: [Name, Descri
}
QStringList LDesktopUtils::listFavorites(){
- static QDateTime lastRead;
- QDateTime cur = QDateTime::currentDateTime();
- if(lastRead.isNull() || lastRead<QFileInfo( QString(getenv("XDG_CONFIG_HOME"))+"/lumina-desktop/favorites.list").lastModified()){
+ //static QDateTime lastRead;
+ QStringList fav;
+ //QDateTime cur = QDateTime::currentDateTime();
+ //if(lastRead.isNull() || fav.isEmpty() || lastRead<QFileInfo( QString(getenv("XDG_CONFIG_HOME"))+"/lumina-desktop/favorites.list").lastModified()){
fav = LUtils::readFile(QString(getenv("XDG_CONFIG_HOME"))+"/lumina-desktop/favorites.list");
fav.removeAll(""); //remove any empty lines
fav.removeDuplicates();
- lastRead = cur;
- }
-
+ //lastRead = cur;
+ //}
return fav;
}
bool LDesktopUtils::saveFavorites(QStringList list){
list.removeDuplicates();
+ //qDebug() << "Save Favorites:" << list;
bool ok = LUtils::writeFile(QString(getenv("XDG_CONFIG_HOME"))+"/lumina-desktop/favorites.list", list, true);
- if(ok){ fav = list; } //also save internally in case of rapid write/read of the file
+ //if(ok){ fav = list; } //also save internally in case of rapid write/read of the file
return ok;
}
@@ -116,11 +115,13 @@ bool LDesktopUtils::addFavorite(QString path, QString name){
else{ type = LXDG::findAppMimeForFile(path); }
//Assign a name if none given
if(name.isEmpty()){ name = info.fileName(); }
+ //qDebug() << "Add Favorite:" << path << type << name;
//Now add it to the list
QStringList favs = LDesktopUtils::listFavorites();
+ //qDebug() << "Current Favorites:" << favs;
bool found = false;
for(int i=0; i<favs.length(); i++){
- if(favs[i].endsWith("::::"+path)){ favs[i] = name+"::::"+type+"::::"+path; }
+ if(favs[i].endsWith("::::"+path)){ favs[i] = name+"::::"+type+"::::"+path; found = true; }
}
if(!found){ favs << name+"::::"+type+"::::"+path; }
return LDesktopUtils::saveFavorites(favs);
@@ -143,8 +144,15 @@ void LDesktopUtils::upgradeFavorites(int){ //fromoldversionnumber
void LDesktopUtils::LoadSystemDefaults(bool skipOS){
//Will create the Lumina configuration files based on the current system template (if any)
qDebug() << "Loading System Defaults";
+ //Ensure that the settings directory exists
+ QString setdir = QString(getenv("XDG_CONFIG_HOME"))+"/lumina-desktop";
+ if(!QFile::exists(setdir)){
+ QDir dir;
+ dir.mkpath(setdir);
+ }
+
bool skipmime = QFile::exists( QString(getenv("XDG_CONFIG_HOME"))+"/lumina-mimapps.list" );
- qDebug() << " - Skipping mimetype default apps" << skipmime;
+ //qDebug() << " - Skipping mimetype default apps" << skipmime;
QStringList sysDefaults;
if(!skipOS){ sysDefaults = LUtils::readFile(LOS::AppPrefix()+"etc/luminaDesktop.conf"); }
if(sysDefaults.isEmpty() && !skipOS){ sysDefaults = LUtils::readFile(LOS::AppPrefix()+"etc/luminaDesktop.conf.dist"); }
@@ -187,6 +195,8 @@ void LDesktopUtils::LoadSystemDefaults(bool skipOS){
if(var.endsWith("_ifexists") ){
var = var.remove("_ifexists"); //remove this flag from the variable
//Check if the value exists (absolute path only)
+ val = LUtils::AppToAbsolute(val);
+ //qDebug() << "Checking if favorite app exists:" << val;
if(!QFile::exists(val)){ continue; } //skip this line - value/file does not exist
}
@@ -231,20 +241,23 @@ void LDesktopUtils::LoadSystemDefaults(bool skipOS){
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();
+ qDebug() << "Mime entry:" << var << val;
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 = LUtils::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
+ val = LUtils::AppToAbsolute(val);
+ //qDebug() << "Checking if Mime app exists:" << val;
//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);
+ //qDebug() << " - Set Default Mime:" << var << val;
LXDG::setDefaultAppForMime(var, val);
}
@@ -326,6 +339,7 @@ void LDesktopUtils::LoadSystemDefaults(bool skipOS){
tmp = sysDefaults.filter("favorites_");
if(tmp.isEmpty()){ tmp = sysDefaults.filter("favorites."); }
for(int i=0; i<tmp.length(); i++){
+ //qDebug() << "Found Favorite Entry:" << tmp[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();
@@ -334,7 +348,7 @@ void LDesktopUtils::LoadSystemDefaults(bool skipOS){
//Now parse the variable and put the value in the proper file
qDebug() << "Favorite entry:" << var << val;
val = LUtils::AppToAbsolute(val); //turn any relative files into absolute
- if(var=="favorites_add_ifexists" && QFile::exists(val)){ qDebug() << " - Exists/Adding:"; LDesktopUtils::addFavorite(val); }
+ if(var=="favorites_add_ifexists" && QFile::exists(val)){ qDebug() << " - Exists/Adding:" << val; LDesktopUtils::addFavorite(val); }
else if(var=="favorites_add"){ qDebug() << " - Adding:"; LDesktopUtils::addFavorite(val); }
else if(var=="favorites_remove"){ qDebug() << " - Removing:"; LDesktopUtils::removeFavorite(val); }
}
@@ -425,12 +439,6 @@ void LDesktopUtils::LoadSystemDefaults(bool skipOS){
}
//qDebug() << " - Final Theme Color:" << themesettings[1];
- //Ensure that the settings directory exists
- QString setdir = QString(getenv("XDG_CONFIG_HOME"))+"/lumina-desktop";
- if(!QFile::exists(setdir)){
- QDir dir;
- dir.mkpath(setdir);
- }
//Now save the settings files
if(setTheme){
LTHEME::setCurrentSettings( themesettings[0], themesettings[1], themesettings[2], themesettings[3], themesettings[4]);
@@ -569,7 +577,7 @@ bool LDesktopUtils::checkUserFiles(QString lastversion, QString currentversion){
}
int LDesktopUtils::VersionStringToNumber(QString version){
- version = version.section("-",0,0); //trim any extra labels off the end
+ version = version.section("_",0,0).section("-",0,0); //trim any extra labels off the end
int maj, mid, min; //major/middle/minor version numbers (<Major>.<Middle>.<Minor>)
maj = mid = min = 0;
bool ok = true;
diff --git a/src-qt5/core/libLumina/LuminaSingleApplication.cpp b/src-qt5/core/libLumina/LuminaSingleApplication.cpp
index f328be36..6107aff8 100644
--- a/src-qt5/core/libLumina/LuminaSingleApplication.cpp
+++ b/src-qt5/core/libLumina/LuminaSingleApplication.cpp
@@ -19,7 +19,7 @@ LSingleApplication::LSingleApplication(int &argc, char **argv, QString appname)
if(appname!="lumina-desktop"){ cTrans = LUtils::LoadTranslation(this, appname); }//save the translator for later
//Initialize a couple convenience internal variables
cfile = QDir::tempPath()+"/.LSingleApp-%1-%2-%3";
- QString username = QString::fromNumber(getuid());
+ QString username = QString::number(getuid());
//For locking the process use the official process name - not the user input (no masking)
appname = this->applicationName();
cfile = cfile.arg( username, appname, QString::number(QX11Info::appScreen()) );
diff --git a/src-qt5/core/libLumina/LuminaXDG.cpp b/src-qt5/core/libLumina/LuminaXDG.cpp
index 1933ba93..e1c582d9 100644
--- a/src-qt5/core/libLumina/LuminaXDG.cpp
+++ b/src-qt5/core/libLumina/LuminaXDG.cpp
@@ -1294,6 +1294,7 @@ QStringList LXDG::findAvailableAppsForMime(QString mime){
}
void LXDG::setDefaultAppForMime(QString mime, QString app){
+ //qDebug() << "Set Default App For Mime:" << mime << app;
QString filepath = QString(getenv("XDG_CONFIG_HOME"))+"/lumina-mimeapps.list";
QStringList cinfo = LUtils::readFile(filepath);
//If this is a new file, make sure to add the header appropriately
bgstack15