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 /src-qt5/desktop-utils/lumina-fm/MainUI.cpp | |
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.
Diffstat (limited to 'src-qt5/desktop-utils/lumina-fm/MainUI.cpp')
-rw-r--r-- | src-qt5/desktop-utils/lumina-fm/MainUI.cpp | 22 |
1 files changed, 10 insertions, 12 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++){ |