Use WA_DeleteOnClose for settings

instead of trying brain dead things
This commit is contained in:
Daniel Molkentin 2013-07-20 01:27:00 +02:00
parent f0d454b511
commit 0be0111724
4 changed files with 66 additions and 12 deletions

View File

@ -555,11 +555,10 @@ void Application::slotSettings()
{
if (_settingsDialog.isNull()) {
_settingsDialog = new SettingsDialog(this);
_settingsDialog->setAttribute( Qt::WA_DeleteOnClose, true );
_settingsDialog->open();
Utility::raiseDialog(_settingsDialog);
} else {
Utility::raiseDialog(_settingsDialog);
}
Utility::raiseDialog(_settingsDialog);
}
void Application::slotParseOptions(const QString &opts)

View File

@ -80,7 +80,7 @@ SettingsDialog::SettingsDialog(Application *app, QWidget *parent) :
_ui->stack, SLOT(setCurrentIndex(int)));
QPushButton *closeButton = _ui->buttonBox->button(QDialogButtonBox::Close);
connect(closeButton, SIGNAL(pressed()), SLOT(done()));
connect(closeButton, SIGNAL(pressed()), SLOT(accept()));
MirallConfigFile cfg;
QSettings settings(cfg.configFile(), QSettings::IniFormat);
@ -109,9 +109,4 @@ void SettingsDialog::closeEvent(QCloseEvent *event)
QWidget::closeEvent(event);
}
void SettingsDialog::done()
{
QDialog::done(0);
}
} // namespace Mirall

View File

@ -44,9 +44,6 @@ public slots:
protected:
void closeEvent(QCloseEvent *event);
private slots:
void done();
private:
Ui::SettingsDialog *_ui;
QListWidgetItem *_addItem;

View File

@ -0,0 +1,63 @@
/*
* Copyright (C) by Daniel Molkentin <danimo@owncloud.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; version 2 of the License.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* for more details.
*/
#ifndef SETTINGSDIALOG_H
#define SETTINGSDIALOG_H
#include <QDialog>
#include <QStyledItemDelegate>
class QStandardItemModel;
class QListWidgetItem;
namespace Mirall {
namespace Ui {
class SettingsDialog;
}
class AccountSettings;
class SettingsDialog : public QDialog
{
Q_OBJECT
public:
explicit SettingsDialog(QWidget *parent = 0);
~SettingsDialog();
void addAccount(const QString &title, QWidget *widget);
public slots:
// Progress, parameter is
// - filename
// - progress bytes, overall size.
void slotFolderUploadProgress( const QString&, const QString&, long, long );
private slots:
void handleItemClick(int);
void checkResetToOldItem(QListWidgetItem*, QListWidgetItem*);
void asyncSwitch(int);
<<<<<<< HEAD
>>>>>>> Add settings skeleton
=======
>>>>>>> 96bc26da77b7080335bbb3c7199e14e308364e94
private:
Ui::SettingsDialog *_ui;
QListWidgetItem *_addItem;
AccountSettings *_accountSettings;
};
}
#endif // SETTINGSDIALOG_H