aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKen Moore <ken@pcbsd.org>2015-02-17 11:09:49 -0500
committerKen Moore <ken@pcbsd.org>2015-02-17 11:09:49 -0500
commitf6edbc3d9ca5f244c6d5cd8b2e8be26bb98159a4 (patch)
treeb41e560717719b87f3d76dd72cdb38e2d765aebf
parentClean up a few things in Lumina: (diff)
downloadlumina-f6edbc3d9ca5f244c6d5cd8b2e8be26bb98159a4.tar.gz
lumina-f6edbc3d9ca5f244c6d5cd8b2e8be26bb98159a4.tar.bz2
lumina-f6edbc3d9ca5f244c6d5cd8b2e8be26bb98159a4.zip
Add the ability to "reset" an application back to defaults in lumina-config - and setup the web browser/email/file manager/terminal buttons to use this functionality.
-rw-r--r--lumina-config/AppDialog.h19
-rw-r--r--lumina-config/AppDialog.ui6
-rw-r--r--lumina-config/mainUI.cpp31
-rw-r--r--lumina-config/mainUI.h2
4 files changed, 46 insertions, 12 deletions
diff --git a/lumina-config/AppDialog.h b/lumina-config/AppDialog.h
index 0ea9b93a..acc6c73e 100644
--- a/lumina-config/AppDialog.h
+++ b/lumina-config/AppDialog.h
@@ -33,6 +33,7 @@ public:
AppDialog(QWidget *parent = 0, QList<XDGDesktop> applist = QList<XDGDesktop>()) : QDialog(parent), ui(new Ui::AppDialog){
ui->setupUi(this); //load the designer file
APPS = applist; //save this for later
+ appreset = false;
ui->comboBox->clear();
for(int i=0; i<APPS.length(); i++){
ui->comboBox->addItem( LXDG::findIcon(APPS[i].icon,"application-x-executable"), APPS[i].name );
@@ -44,8 +45,17 @@ public:
~AppDialog(){}
- XDGDesktop appselected;
+ void allowReset(bool allow){
+ if(allow){
+ ui->buttonBox->setStandardButtons(QDialogButtonBox::RestoreDefaults | QDialogButtonBox::Ok | QDialogButtonBox::Cancel);
+ }else{
+ ui->buttonBox->setStandardButtons(QDialogButtonBox::Ok | QDialogButtonBox::Cancel);
+ }
+ }
+ XDGDesktop appselected; //selected application (empty template for cancelled/reset)
+ bool appreset; //Did the user select to reset to defaults?
+
private slots:
void on_buttonBox_accepted(){
appselected = APPS[ ui->comboBox->currentIndex() ];
@@ -54,7 +64,12 @@ private slots:
void on_buttonBox_rejected(){
this->close();
}
-
+ void on_buttonBox_clicked(QAbstractButton *button){
+ if(ui->buttonBox->standardButton(button) == QDialogButtonBox::RestoreDefaults){
+ appreset = true;
+ this->close();
+ }
+ }
};
#endif
diff --git a/lumina-config/AppDialog.ui b/lumina-config/AppDialog.ui
index 49a1e921..63323f7d 100644
--- a/lumina-config/AppDialog.ui
+++ b/lumina-config/AppDialog.ui
@@ -6,8 +6,8 @@
<rect>
<x>0</x>
<y>0</y>
- <width>303</width>
- <height>88</height>
+ <width>348</width>
+ <height>91</height>
</rect>
</property>
<property name="windowTitle">
@@ -62,7 +62,7 @@
<enum>Qt::Horizontal</enum>
</property>
<property name="standardButtons">
- <set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
+ <set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok|QDialogButtonBox::RestoreDefaults</set>
</property>
</widget>
</item>
diff --git a/lumina-config/mainUI.cpp b/lumina-config/mainUI.cpp
index bcf2ba31..c5a0c934 100644
--- a/lumina-config/mainUI.cpp
+++ b/lumina-config/mainUI.cpp
@@ -309,10 +309,17 @@ QString MainUI::getColorStyle(QString current){
return out;
}*/
-XDGDesktop MainUI::getSysApp(){
+XDGDesktop MainUI::getSysApp(bool allowreset){
AppDialog dlg(this, sysApps);
+ dlg.allowReset(allowreset);
dlg.exec();
- return dlg.appselected;
+ XDGDesktop desk;
+ if(dlg.appreset && allowreset){
+ desk.filePath = "reset"; //special internal flag
+ }else{
+ desk = dlg.appselected;
+ }
+ return desk;
}
//Convert to/from fluxbox key codes
@@ -1170,8 +1177,11 @@ void MainUI::getKeyPress(){
//===========
void MainUI::changeDefaultBrowser(){
//Prompt for the new app
- XDGDesktop desk = getSysApp();
+ XDGDesktop desk = getSysApp(true);
if(desk.filePath.isEmpty()){ return; }//nothing selected
+ if(desk.filePath=="reset"){
+ desk.filePath="";
+ }
//save the new app setting and adjust the button appearance
appsettings->setValue("default/webbrowser", desk.filePath);
QString tmp = desk.filePath;
@@ -1198,8 +1208,11 @@ void MainUI::changeDefaultBrowser(){
void MainUI::changeDefaultEmail(){
//Prompt for the new app
- XDGDesktop desk = getSysApp();
+ XDGDesktop desk = getSysApp(true); //allow reset to default
if(desk.filePath.isEmpty()){ return; }//nothing selected
+ if(desk.filePath=="reset"){
+ desk.filePath="";
+ }
//save the new app setting and adjust the button appearance
appsettings->setValue("default/email", desk.filePath);
QString tmp = desk.filePath;
@@ -1226,8 +1239,11 @@ void MainUI::changeDefaultEmail(){
void MainUI::changeDefaultFileManager(){
//Prompt for the new app
- XDGDesktop desk = getSysApp();
+ XDGDesktop desk = getSysApp(true);
if(desk.filePath.isEmpty()){ return; }//nothing selected
+ if(desk.filePath=="reset"){
+ desk.filePath="lumina-fm";
+ }
//save the new app setting and adjust the button appearance
appsettings->setValue("default/directory", desk.filePath);
sessionsettings->setValue("default-filemanager", desk.filePath);
@@ -1255,8 +1271,11 @@ void MainUI::changeDefaultFileManager(){
void MainUI::changeDefaultTerminal(){
//Prompt for the new app
- XDGDesktop desk = getSysApp();
+ XDGDesktop desk = getSysApp(true);
if(desk.filePath.isEmpty()){ return; }//nothing selected
+ if(desk.filePath=="reset"){
+ desk.filePath="xterm";
+ }
//save the new app setting and adjust the button appearance
sessionsettings->setValue("default-terminal", desk.filePath);
QString tmp = desk.filePath;
diff --git a/lumina-config/mainUI.h b/lumina-config/mainUI.h
index 7d655476..93400d93 100644
--- a/lumina-config/mainUI.h
+++ b/lumina-config/mainUI.h
@@ -72,7 +72,7 @@ private:
//QString getNewPanelPlugin();
//Get an application on the system
- XDGDesktop getSysApp();
+ XDGDesktop getSysApp(bool allowreset = false);
//Convert to/from fluxbox keyboard shortcuts
QString dispToFluxKeys(QString);
bgstack15