From f6edbc3d9ca5f244c6d5cd8b2e8be26bb98159a4 Mon Sep 17 00:00:00 2001 From: Ken Moore Date: Tue, 17 Feb 2015 11:09:49 -0500 Subject: 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. --- lumina-config/AppDialog.h | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) (limited to 'lumina-config/AppDialog.h') 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 applist = QList()) : 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; icomboBox->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 -- cgit