diff options
author | Ken Moore <ken@ixsystems.com> | 2017-06-07 20:37:50 -0400 |
---|---|---|
committer | Ken Moore <ken@ixsystems.com> | 2017-06-07 20:37:50 -0400 |
commit | f4ed12f28bd437fbe4907b6f473687fc3d418307 (patch) | |
tree | 9c63b6dcb256dda222598ba35cef9722267ed10e | |
parent | Add a new backend function to LUtils for opening a QSettings file. (diff) | |
download | lumina-f4ed12f28bd437fbe4907b6f473687fc3d418307.tar.gz lumina-f4ed12f28bd437fbe4907b6f473687fc3d418307.tar.bz2 lumina-f4ed12f28bd437fbe4907b6f473687fc3d418307.zip |
Make all the desktop utilities use the new LUtils::openSettings() function so they can be launched as the root user without clobbering the user-permissioned settings file.
-rw-r--r-- | src-qt5/desktop-utils/lumina-fm/MainUI.cpp | 22 | ||||
-rw-r--r-- | src-qt5/desktop-utils/lumina-mediaplayer/mainUI.cpp | 2 | ||||
-rw-r--r-- | src-qt5/desktop-utils/lumina-screenshot/MainUI.cpp | 2 | ||||
-rw-r--r-- | src-qt5/desktop-utils/lumina-textedit/MainUI.cpp | 2 |
4 files changed, 13 insertions, 15 deletions
diff --git a/src-qt5/desktop-utils/lumina-fm/MainUI.cpp b/src-qt5/desktop-utils/lumina-fm/MainUI.cpp index 79a99d15..d4dfe1eb 100644 --- a/src-qt5/desktop-utils/lumina-fm/MainUI.cpp +++ b/src-qt5/desktop-utils/lumina-fm/MainUI.cpp @@ -12,6 +12,7 @@ #include "gitCompat.h" #include "gitWizard.h" +#include <LUtils.h> #include <LDesktopUtils.h> #define DEBUG 0 @@ -27,7 +28,7 @@ MainUI::MainUI() : QMainWindow(), ui(new Ui::MainUI){ ui->setupUi(this); if(DEBUG){ qDebug() << "Initilization:"; } - settings = new QSettings( QSettings::UserScope, "lumina-desktop", "lumina-fm", this); + settings = LUtils::openSettings("lumina-desktop", "lumina-fm", this); //Reset the UI to the previously used size (if possible) QSize orig = settings->value("preferences/MainWindowSize", QSize()).toSize(); @@ -271,19 +272,18 @@ void MainUI::togglehiddenfiles() void MainUI::loadSettings(){ //Note: make sure this is run after all the UI elements are created and connected to slots // but before the first directory gets loaded - QSettings SET("lumina-desktop","lumina-fm"); - ui->actionView_Hidden_Files->setChecked( SET.value("showhidden", false).toBool() ); + ui->actionView_Hidden_Files->setChecked( settings->value("showhidden", false).toBool() ); on_actionView_Hidden_Files_triggered(); //make sure to update the models too //ui->actionShow_Action_Buttons->setChecked(settings->value("showactions", true).toBool() ); //on_actionShow_Action_Buttons_triggered(); //make sure to update the UI //ui->actionShow_Thumbnails->setChecked( settings->value("showthumbnails", true).toBool() ); //View Type - //qDebug() << "View Mode:" << SET.value("viewmode","details").toString(); - bool showDetails = (SET.value("viewmode","details").toString()=="details"); + //qDebug() << "View Mode:" << settings->value("viewmode","details").toString(); + bool showDetails = (settings->value("viewmode","details").toString()=="details"); if(showDetails){ radio_view_details->setChecked(true); } else{ radio_view_list->setChecked(true); } //Grouping type - //bool usetabs = (SET.value("groupmode","tabs").toString()=="tabs"); + //bool usetabs = (settings->value("groupmode","tabs").toString()=="tabs"); //if(usetabs){ radio_view_tabs->setChecked(true); } // else{ radio_view_cols->setChecked(true); } @@ -291,8 +291,7 @@ void MainUI::loadSettings(){ void MainUI::RebuildBookmarksMenu(){ //Create the bookmarks menu - QSettings SET("lumina-desktop","lumina-fm"); - QStringList BM = SET.value("bookmarks", QStringList()).toStringList(); + QStringList BM = settings->value("bookmarks", QStringList()).toStringList(); ui->menuBookmarks->clear(); ui->menuBookmarks->addAction(ui->actionManage_Bookmarks); ui->menuBookmarks->addAction(ui->actionAdd_Bookmark); @@ -312,7 +311,7 @@ void MainUI::RebuildBookmarksMenu(){ changed = true; }*/ } - if(changed){ SET.setValue("bookmarks",BM); } + if(changed){ settings->setValue("bookmarks",BM); } ui->actionManage_Bookmarks->setEnabled(BM.length()>0); } @@ -524,9 +523,8 @@ void MainUI::goToDevice(QAction *act){ void MainUI::viewModeChanged(bool active){ if(!active){ return; } //on every view change, all radio buttons will call this function - only run this once though bool showDetails = radio_view_details->isChecked(); - QSettings SET("lumina-desktop","lumina-fm"); - if(showDetails){ SET.setValue("viewmode","details"); } - else{ SET.setValue("viewmode","list"); } + if(showDetails){ settings->setValue("viewmode","details"); } + else{ settings->setValue("viewmode","list"); } //Re-load the view widgets for(int i=0; i<DWLIST.length(); i++){ diff --git a/src-qt5/desktop-utils/lumina-mediaplayer/mainUI.cpp b/src-qt5/desktop-utils/lumina-mediaplayer/mainUI.cpp index ad5fc833..cf7a41cb 100644 --- a/src-qt5/desktop-utils/lumina-mediaplayer/mainUI.cpp +++ b/src-qt5/desktop-utils/lumina-mediaplayer/mainUI.cpp @@ -20,7 +20,7 @@ MainUI::MainUI() : QMainWindow(), ui(new Ui::MainUI()){ ui->setupUi(this); - SETTINGS = new QSettings("lumina-desktop","lumina-mediaplayer"); + SETTINGS = LUtils::openSettings("lumina-desktop","lumina-mediaplayer",this); closing = false; DISABLE_VIDEO = true; //add a toggle in the UI for this later //Any special UI changes diff --git a/src-qt5/desktop-utils/lumina-screenshot/MainUI.cpp b/src-qt5/desktop-utils/lumina-screenshot/MainUI.cpp index be0fc02b..bdfbbfec 100644 --- a/src-qt5/desktop-utils/lumina-screenshot/MainUI.cpp +++ b/src-qt5/desktop-utils/lumina-screenshot/MainUI.cpp @@ -59,7 +59,7 @@ MainUI::MainUI() connect(scaleTimer, SIGNAL(timeout()), this, SLOT(imgScalingChanged()) ); connect(tabbar, SIGNAL(currentChanged(int)), this, SLOT(tabChanged(int)) ); connect(ui->check_show_popups, SIGNAL(toggled(bool)), this, SLOT(showPopupsChanged(bool)) ); - settings = new QSettings("lumina-desktop", "lumina-screenshot",this); + settings = LUtils::openSettings("lumina-desktop", "lumina-screenshot",this); QString opt = settings->value("screenshot-target", "window").toString(); if( opt == "window") {ui->radio_window->setChecked(true); } else if(opt=="area"){ ui->radio_area->setChecked(true); } diff --git a/src-qt5/desktop-utils/lumina-textedit/MainUI.cpp b/src-qt5/desktop-utils/lumina-textedit/MainUI.cpp index 1aed7407..ec2d7d0d 100644 --- a/src-qt5/desktop-utils/lumina-textedit/MainUI.cpp +++ b/src-qt5/desktop-utils/lumina-textedit/MainUI.cpp @@ -48,7 +48,7 @@ MainUI::MainUI() : QMainWindow(), ui(new Ui::MainUI){ agrp->addAction(ui->action_tabsLeft); agrp->addAction(ui->action_tabsRight); //Load settings - settings = new QSettings("lumina-desktop","lumina-textedit"); + settings = LUtils::openSettings("lumina-desktop","lumina-textedit", this); if(settings->contains("lastfont")){ QFont oldfont; if(oldfont.fromString(settings->value("lastfont").toString() ) ){ |