From 6cd65ae9a7cb563de70e35ea7fe8dfdbd265fa60 Mon Sep 17 00:00:00 2001 From: Florian Geyer Date: Sun, 27 May 2012 20:29:15 +0200 Subject: [PATCH] Add edit finished signal to settings widget. --- src/gui/MainWindow.cpp | 3 +-- src/gui/SettingsWidget.cpp | 8 ++++++++ src/gui/SettingsWidget.h | 4 ++++ 3 files changed, 13 insertions(+), 2 deletions(-) diff --git a/src/gui/MainWindow.cpp b/src/gui/MainWindow.cpp index 8316b6ed1..86cf39338 100644 --- a/src/gui/MainWindow.cpp +++ b/src/gui/MainWindow.cpp @@ -77,8 +77,7 @@ MainWindow::MainWindow() connect(m_ui->tabWidget, SIGNAL(currentChanged(int)), SLOT(updateWindowTitle())); connect(m_ui->stackedWidget, SIGNAL(currentChanged(int)), SLOT(setMenuActionState())); - connect(m_ui->settingsWidget, SIGNAL(accepted()), SLOT(switchToDatabases())); - connect(m_ui->settingsWidget, SIGNAL(rejected()), SLOT(switchToDatabases())); + connect(m_ui->settingsWidget, SIGNAL(editFinished(bool)), SLOT(switchToDatabases())); connect(m_ui->actionDatabaseNew, SIGNAL(triggered()), SLOT(switchToDatabases())); connect(m_ui->actionDatabaseNew, SIGNAL(triggered()), m_ui->tabWidget, diff --git a/src/gui/SettingsWidget.cpp b/src/gui/SettingsWidget.cpp index 222228e3d..0932bbdde 100644 --- a/src/gui/SettingsWidget.cpp +++ b/src/gui/SettingsWidget.cpp @@ -31,6 +31,7 @@ SettingsWidget::SettingsWidget(QWidget* parent) add(tr("Security"), m_secWidget); connect(this, SIGNAL(accepted()), SLOT(saveSettings())); + connect(this, SIGNAL(rejected()), SLOT(reject())); connect(m_secUi->clearClipboardCheckBox, SIGNAL(toggled(bool)), m_secUi->clearClipboardSpinBox, SLOT(setEnabled(bool))); @@ -52,4 +53,11 @@ void SettingsWidget::saveSettings() { config()->set("security/clearclipboard", m_secUi->clearClipboardCheckBox->isChecked()); config()->set("security/clearclipboardtimeout", m_secUi->clearClipboardSpinBox->value()); + + Q_EMIT editFinished(true); +} + +void SettingsWidget::reject() +{ + Q_EMIT editFinished(false); } diff --git a/src/gui/SettingsWidget.h b/src/gui/SettingsWidget.h index eea5920ac..0e339c92f 100644 --- a/src/gui/SettingsWidget.h +++ b/src/gui/SettingsWidget.h @@ -33,8 +33,12 @@ public: ~SettingsWidget(); void loadSettings(); +Q_SIGNALS: + void editFinished(bool accepted); + private Q_SLOTS: void saveSettings(); + void reject(); private: QWidget* const m_secWidget;