diff options
author | nils <nils@34ebc366-c3a9-4b3c-9f84-69acf7962910> | 2013-02-11 22:41:56 +0000 |
---|---|---|
committer | nils <nils@34ebc366-c3a9-4b3c-9f84-69acf7962910> | 2013-02-11 22:41:56 +0000 |
commit | fad039f680d6eb05d4fcda7fadacf86a027661a4 (patch) | |
tree | b6b57a1c0596372a95bbb017a56a34f04a27e62c /settingsdialog.cpp | |
parent | updated TODO and minor beautifying in settings dialog (diff) | |
download | gpg4usb-fad039f680d6eb05d4fcda7fadacf86a027661a4.tar.gz gpg4usb-fad039f680d6eb05d4fcda7fadacf86a027661a4.zip |
added signals signalRestartNeeded to settingsdialog to handle a needed restart
git-svn-id: http://cpunk.de/svn/src/gpg4usb/trunk@1009 34ebc366-c3a9-4b3c-9f84-69acf7962910
Diffstat (limited to 'settingsdialog.cpp')
-rwxr-xr-x | settingsdialog.cpp | 38 |
1 files changed, 33 insertions, 5 deletions
diff --git a/settingsdialog.cpp b/settingsdialog.cpp index 690d9d2..c75b40a 100755 --- a/settingsdialog.cpp +++ b/settingsdialog.cpp @@ -45,7 +45,6 @@ SettingsDialog::SettingsDialog(GpgME::GpgContext *ctx, QWidget *parent) connect(buttonBox, SIGNAL(accepted()), this, SLOT(slotAccept())); connect(buttonBox, SIGNAL(rejected()), this, SLOT(reject())); - QVBoxLayout *mainLayout = new QVBoxLayout; mainLayout->addWidget(tabWidget); mainLayout->addWidget(buttonBox); @@ -53,9 +52,29 @@ SettingsDialog::SettingsDialog(GpgME::GpgContext *ctx, QWidget *parent) setWindowTitle(tr("Settings")); + // slots for handling the restartneeded member + this->slotSetRestartNeeded(false); + connect(generalTab, SIGNAL(signalRestartNeeded(bool)), this, SLOT(slotSetRestartNeeded(bool))); + connect(appearanceTab, SIGNAL(signalRestartNeeded(bool)), this, SLOT(slotSetRestartNeeded(bool))); + connect(mimeTab, SIGNAL(signalRestartNeeded(bool)), this, SLOT(slotSetRestartNeeded(bool))); + connect(keyserverTab, SIGNAL(signalRestartNeeded(bool)), this, SLOT(slotSetRestartNeeded(bool))); + connect(gpgPathsTab, SIGNAL(signalRestartNeeded(bool)), this, SLOT(slotSetRestartNeeded(bool))); + connect(advancedTab, SIGNAL(signalRestartNeeded(bool)), this, SLOT(slotSetRestartNeeded(bool))); + exec(); } +bool SettingsDialog::getRestartNeeded() +{ + return this->restartNeeded; +} + +void SettingsDialog::slotSetRestartNeeded(bool needed) +{ + qDebug() << "slot restart needed (settingsdialog): " << needed; + this->restartNeeded = needed; +} + void SettingsDialog::slotAccept() { generalTab->applySettings(); @@ -64,6 +83,9 @@ void SettingsDialog::slotAccept() keyserverTab->applySettings(); advancedTab->applySettings(); gpgPathsTab->applySettings(); + if (getRestartNeeded()) { + emit signalRestartNeeded(true); + } close(); } @@ -146,6 +168,7 @@ GeneralTab::GeneralTab(GpgME::GpgContext *ctx,QWidget *parent) langBoxLayout->addWidget(langSelectBox); langBoxLayout->addWidget(new QLabel(tr("<b>NOTE: </b> Gpg4usb will restart automatically if you change the language!"))); langBox->setLayout(langBoxLayout); + connect(langSelectBox,SIGNAL(currentIndexChanged(int)),this,SLOT(slotLanguageChanged())); /***************************************** * Own Key Select Box @@ -180,7 +203,6 @@ GeneralTab::GeneralTab(GpgME::GpgContext *ctx,QWidget *parent) ownKeyBoxLayout->addWidget(ownKeySelectBox); ownKeyBoxLayout->addWidget(new QLabel(tr("<b>NOTE: </b> Gpg4usb will restart automatically if you change the own key!"))); - /***************************************** * Mainlayout *****************************************/ @@ -243,10 +265,8 @@ void GeneralTab::setSettings() ownKeySelectBox->setCurrentIndex(ownKeySelectBox->findText("none", Qt::MatchContains)); } else { ownKeySelectBox->setCurrentIndex(ownKeySelectBox->findText(ownKeyId, Qt::MatchContains)); - qDebug() << ownKeySelectBox->findText(ownKeyId); } - if (settings.value("general/confirmImportKeys",Qt::Checked).toBool()){ importConfirmationCheckBox->setCheckState(Qt::Checked); } @@ -266,6 +286,12 @@ void GeneralTab::applySettings() settings.setValue("general/confirmImportKeys", importConfirmationCheckBox->isChecked()); } +void GeneralTab::slotLanguageChanged() +{ + qDebug() << "slot language changed"; + emit signalRestartNeeded(true); +} + void GeneralTab::slotOwnKeyIdChanged() { // Set ownKeyId to currently selected @@ -310,6 +336,9 @@ void GeneralTab::slotOwnKeyIdChanged() gpgConfFile.remove(); gpgConfTempFile.copy(gpgConfTempFile.fileName(),gpgConfFile.fileName()); gpgConfTempFile.remove(); + + // emit signal, thta application has to be restarted + emit signalRestartNeeded(true); } MimeTab::MimeTab(QWidget *parent) @@ -674,7 +703,6 @@ QString GpgPathsTab::getRelativePath(const QString dir1,const QString dir2) QString s; s = dir.relativeFilePath(dir2); - qDebug() << "relative path: " << s; if (s.isEmpty()) { s = "."; } |