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.cpp17
-rw-r--r--src-qt5/core/libLumina/LDesktopUtils.h5
2 files changed, 22 insertions, 0 deletions
diff --git a/src-qt5/core/libLumina/LDesktopUtils.cpp b/src-qt5/core/libLumina/LDesktopUtils.cpp
index a46f03d0..d76c68e9 100644
--- a/src-qt5/core/libLumina/LDesktopUtils.cpp
+++ b/src-qt5/core/libLumina/LDesktopUtils.cpp
@@ -9,6 +9,7 @@
#include <QDesktopWidget>
#include <QApplication>
#include <QScreen>
+#include <QSettings>
#include "LuminaThemes.h"
@@ -526,3 +527,19 @@ int LDesktopUtils::VersionStringToNumber(QString version){
//NOTE: This format allows numbers to be anywhere from 0->999 without conflict
return (maj*1000000 + mid*1000 + min);
}
+
+void LDesktopUtils::MigrateDesktopSettings(QSettings *settings, QString fromID, QString toID){
+ //desktop-ID
+ QStringList keys = settings->allKeys();
+ QStringList filter = keys.filter("desktop-"+fromID+"/");
+ for(int i=0; i<filter.length(); i++){
+ settings->setValue("desktop-"+toID+"/"+filter[i].section("/",1,-1), settings->value(filter[i]));
+ settings->remove(filter[i]);
+ }
+ //panel_ID.[number]
+ filter = keys.filter("panel_"+fromID+".");
+ for(int i=0; i<filter.length(); i++){
+ settings->setValue("panel_"+toID+"."+ filter[i].section("/",0,0).section(".",-1)+"/"+filter[i].section("/",1,-1), settings->value(filter[i]));
+ settings->remove(filter[i]);
+ }
+}
diff --git a/src-qt5/core/libLumina/LDesktopUtils.h b/src-qt5/core/libLumina/LDesktopUtils.h
index dbad8757..b21bc78a 100644
--- a/src-qt5/core/libLumina/LDesktopUtils.h
+++ b/src-qt5/core/libLumina/LDesktopUtils.h
@@ -12,6 +12,7 @@
#include <QFile>
#include <QDir>
#include <QDateTime>
+#include <QSettings>
//Other classes needed
#include <LUtils.h>
@@ -44,6 +45,10 @@ public:
static void LoadSystemDefaults(bool skipOS = false);
static bool checkUserFiles(QString lastversion); //returns true if something changed
static int VersionStringToNumber(QString version); //convert the lumina version string to a number for comparisons
+
+ //Migrating desktop settings from one ID to another
+ static void MigrateDesktopSettings(QSettings *settings, QString fromID, QString toID);
+
};
#endif
bgstack15