Bug #179 fixed.
This commit is contained in:
parent
755eda6eff
commit
df79fc1a8a
@ -492,6 +492,10 @@ void FormMain::backupDatabaseSettings() {
|
|||||||
void FormMain::restoreDatabaseSettings() {
|
void FormMain::restoreDatabaseSettings() {
|
||||||
QScopedPointer<FormRestoreDatabaseSettings> form(new FormRestoreDatabaseSettings(this));
|
QScopedPointer<FormRestoreDatabaseSettings> form(new FormRestoreDatabaseSettings(this));
|
||||||
form->exec();
|
form->exec();
|
||||||
|
|
||||||
|
if (form->shouldRestart()) {
|
||||||
|
qApp->restart();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void FormMain::changeEvent(QEvent *event) {
|
void FormMain::changeEvent(QEvent *event) {
|
||||||
|
@ -26,7 +26,7 @@
|
|||||||
|
|
||||||
|
|
||||||
FormRestoreDatabaseSettings::FormRestoreDatabaseSettings(QWidget *parent)
|
FormRestoreDatabaseSettings::FormRestoreDatabaseSettings(QWidget *parent)
|
||||||
: QDialog(parent), m_ui(new Ui::FormRestoreDatabaseSettings) {
|
: QDialog(parent), m_ui(new Ui::FormRestoreDatabaseSettings), m_shouldRestart(false) {
|
||||||
m_ui->setupUi(this);
|
m_ui->setupUi(this);
|
||||||
|
|
||||||
m_btnRestart = m_ui->m_buttonBox->addButton(tr("Restart"), QDialogButtonBox::ActionRole);
|
m_btnRestart = m_ui->m_buttonBox->addButton(tr("Restart"), QDialogButtonBox::ActionRole);
|
||||||
@ -35,7 +35,10 @@ FormRestoreDatabaseSettings::FormRestoreDatabaseSettings(QWidget *parent)
|
|||||||
setWindowIcon(qApp->icons()->fromTheme(QSL("document-import")));
|
setWindowIcon(qApp->icons()->fromTheme(QSL("document-import")));
|
||||||
setWindowFlags(Qt::MSWindowsFixedSizeDialogHint | Qt::Dialog | Qt::WindowSystemMenuHint);
|
setWindowFlags(Qt::MSWindowsFixedSizeDialogHint | Qt::Dialog | Qt::WindowSystemMenuHint);
|
||||||
|
|
||||||
connect(m_btnRestart, SIGNAL(clicked()), qApp, SLOT(restart()));
|
connect(m_btnRestart, &QPushButton::clicked, this, [=]() {
|
||||||
|
m_shouldRestart = true;
|
||||||
|
close();
|
||||||
|
});
|
||||||
connect(m_ui->m_btnSelectFolder, SIGNAL(clicked()), this, SLOT(selectFolder()));
|
connect(m_ui->m_btnSelectFolder, SIGNAL(clicked()), this, SLOT(selectFolder()));
|
||||||
connect(m_ui->m_groupDatabase, SIGNAL(toggled(bool)), this, SLOT(checkOkButton()));
|
connect(m_ui->m_groupDatabase, SIGNAL(toggled(bool)), this, SLOT(checkOkButton()));
|
||||||
connect(m_ui->m_groupSettings, SIGNAL(toggled(bool)), this, SLOT(checkOkButton()));
|
connect(m_ui->m_groupSettings, SIGNAL(toggled(bool)), this, SLOT(checkOkButton()));
|
||||||
@ -93,11 +96,13 @@ void FormRestoreDatabaseSettings::selectFolder(QString folder) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const QDir selected_folder(folder);
|
const QDir selected_folder(folder);
|
||||||
const QFileInfoList available_databases = selected_folder.entryInfoList(QStringList() << QString("*") + BACKUP_SUFFIX_DATABASE ,
|
const QFileInfoList available_databases = selected_folder.entryInfoList(QStringList()
|
||||||
|
<< QString("*") + BACKUP_SUFFIX_DATABASE ,
|
||||||
QDir::Files | QDir::NoDotAndDotDot | QDir::Readable |
|
QDir::Files | QDir::NoDotAndDotDot | QDir::Readable |
|
||||||
QDir::CaseSensitive | QDir::NoSymLinks,
|
QDir::CaseSensitive | QDir::NoSymLinks,
|
||||||
QDir::Name);
|
QDir::Name);
|
||||||
const QFileInfoList available_settings = selected_folder.entryInfoList(QStringList() << QString("*") + BACKUP_SUFFIX_SETTINGS ,
|
const QFileInfoList available_settings = selected_folder.entryInfoList(QStringList()
|
||||||
|
<< QString("*") + BACKUP_SUFFIX_SETTINGS ,
|
||||||
QDir::Files | QDir::NoDotAndDotDot | QDir::Readable |
|
QDir::Files | QDir::NoDotAndDotDot | QDir::Readable |
|
||||||
QDir::CaseSensitive | QDir::NoSymLinks,
|
QDir::CaseSensitive | QDir::NoSymLinks,
|
||||||
QDir::Name);
|
QDir::Name);
|
||||||
|
@ -35,6 +35,10 @@ class FormRestoreDatabaseSettings : public QDialog {
|
|||||||
explicit FormRestoreDatabaseSettings(QWidget *parent = 0);
|
explicit FormRestoreDatabaseSettings(QWidget *parent = 0);
|
||||||
virtual ~FormRestoreDatabaseSettings();
|
virtual ~FormRestoreDatabaseSettings();
|
||||||
|
|
||||||
|
bool shouldRestart() const {
|
||||||
|
return m_shouldRestart;
|
||||||
|
}
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void performRestoration();
|
void performRestoration();
|
||||||
void checkOkButton();
|
void checkOkButton();
|
||||||
@ -43,6 +47,8 @@ class FormRestoreDatabaseSettings : public QDialog {
|
|||||||
private:
|
private:
|
||||||
QScopedPointer<Ui::FormRestoreDatabaseSettings> m_ui;
|
QScopedPointer<Ui::FormRestoreDatabaseSettings> m_ui;
|
||||||
QPushButton *m_btnRestart;
|
QPushButton *m_btnRestart;
|
||||||
|
|
||||||
|
bool m_shouldRestart;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // FORMRESTOREDATABASESETTINGS_H
|
#endif // FORMRESTOREDATABASESETTINGS_H
|
||||||
|
@ -35,7 +35,7 @@ TrayIconMenu::~TrayIconMenu() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool TrayIconMenu::event(QEvent *event) {
|
bool TrayIconMenu::event(QEvent *event) {
|
||||||
if (Application::activeModalWidget() != NULL && event->type() == QEvent::Show) {
|
if (event->type() == QEvent::Show && Application::activeModalWidget() != NULL) {
|
||||||
QTimer::singleShot(0, this, SLOT(hide()));
|
QTimer::singleShot(0, this, SLOT(hide()));
|
||||||
qApp->showGuiMessage(QSL(APP_LONG_NAME),
|
qApp->showGuiMessage(QSL(APP_LONG_NAME),
|
||||||
tr("Close opened modal dialogs first."),
|
tr("Close opened modal dialogs first."),
|
||||||
|
Loading…
x
Reference in New Issue
Block a user