diff options
author | Olivier Goffart <ogoffart@woboq.com> | 2013-08-23 14:25:16 +0400 |
---|---|---|
committer | Olivier Goffart <ogoffart@woboq.com> | 2013-08-23 14:25:16 +0400 |
commit | 19a08f8d5eb1d53953bdc0752972b3749b83e8f6 (patch) | |
tree | af1481e1d7c2e0f652fc03533b4f0ec9b3355371 /src | |
parent | c6319117fde3ab7aa80044536cc90c46d51cd8f9 (diff) |
Make remember the size of the settings dialog
Before, we saved the geometry in the closeEvent which is only called if
the user press the [x] in the title bar. But it is not called when the
user accept the dialog (by pressing the close button or the enter key)
So save the geometry in the destructor of the dialog instead.
One also must call delete from the Application destructor because it was
leaking
Diffstat (limited to 'src')
-rw-r--r-- | src/mirall/application.cpp | 4 | ||||
-rw-r--r-- | src/mirall/settingsdialog.cpp | 10 | ||||
-rw-r--r-- | src/mirall/settingsdialog.h | 3 |
3 files changed, 7 insertions, 10 deletions
diff --git a/src/mirall/application.cpp b/src/mirall/application.cpp index 8b4a79b50..0cb044dc7 100644 --- a/src/mirall/application.cpp +++ b/src/mirall/application.cpp @@ -184,6 +184,10 @@ Application::Application(int &argc, char **argv) : Application::~Application() { + if (_settingsDialog) { + delete _settingsDialog.data(); + } + delete _tray; // needed, see ctor qDebug() << "* Mirall shutdown"; diff --git a/src/mirall/settingsdialog.cpp b/src/mirall/settingsdialog.cpp index 78f6c5db2..b892932c8 100644 --- a/src/mirall/settingsdialog.cpp +++ b/src/mirall/settingsdialog.cpp @@ -102,6 +102,9 @@ SettingsDialog::SettingsDialog(Application *app, QWidget *parent) : SettingsDialog::~SettingsDialog() { + MirallConfigFile cfg; + cfg.saveGeometry(this); + delete _ui; } @@ -114,13 +117,6 @@ void SettingsDialog::addAccount(const QString &title, QWidget *widget) } -void SettingsDialog::closeEvent(QCloseEvent *event) -{ - MirallConfigFile cfg; - cfg.saveGeometry(this); - QWidget::closeEvent(event); -} - void SettingsDialog::slotUpdateAccountState() { FolderMan *folderMan = FolderMan::instance(); diff --git a/src/mirall/settingsdialog.h b/src/mirall/settingsdialog.h index 4bc65b291..05a1a620b 100644 --- a/src/mirall/settingsdialog.h +++ b/src/mirall/settingsdialog.h @@ -41,9 +41,6 @@ public: void addAccount(const QString &title, QWidget *widget); -protected: - void closeEvent(QCloseEvent *event); - protected slots: void slotUpdateAccountState(); |