summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAnne Jan Brouwer <annejan@noprotocol.com>2015-05-19 00:22:18 +0200
committerAnne Jan Brouwer <annejan@noprotocol.com>2015-05-19 00:22:18 +0200
commita6d7281a4d1013d024b8570f475b40b3e31d7ca3 (patch)
treeab82feb4e5cd27adac6d697d5e5d7bbba01381b1
parent540c285a65761783e7f5125ec1867813e266030c (diff)
clean quit on canceling out of wizard
-rw-r--r--main.cpp13
-rw-r--r--mainwindow.cpp16
-rw-r--r--mainwindow.h3
3 files changed, 18 insertions, 14 deletions
diff --git a/main.cpp b/main.cpp
index 7106d8c3..9def9777 100644
--- a/main.cpp
+++ b/main.cpp
@@ -41,9 +41,12 @@ int main(int argc, char *argv[])
app.setActiveWindow(&w);
app.setWindowIcon(QIcon(":artwork/icon.png"));
w.setApp(&app);
- w.checkConfig();
- w.setText(text);
- w.show();
-
- return app.exec();
+ if (w.checkConfig()) {
+ w.setText(text);
+ w.show();
+ return app.exec();
+ } else {
+ // canceled out of wizard
+ return 0;
+ }
}
diff --git a/mainwindow.cpp b/mainwindow.cpp
index 331822fb..87312c69 100644
--- a/mainwindow.cpp
+++ b/mainwindow.cpp
@@ -119,7 +119,7 @@ void MainWindow::mountWebDav() {
/**
* @brief MainWindow::checkConfig
*/
-void MainWindow::checkConfig() {
+bool MainWindow::checkConfig() {
QSettings &settings(getSettings());
@@ -162,10 +162,13 @@ void MainWindow::checkConfig() {
if (Util::checkConfig(passStore, passExecutable, gpgExecutable)) {
config();
- } else {
- firstRun = false;
+ if (firstRun && Util::checkConfig(passStore, passExecutable, gpgExecutable)) {
+ return false;
+ }
}
+ firstRun = false;
+
// TODO: this needs to be before we try to access the store,
// but it would be better to do it after the Window is shown,
// as the long delay it can cause is irritating otherwise.
@@ -212,6 +215,7 @@ void MainWindow::checkConfig() {
//QMessageBox::information(this, "env", env.join("\n"));
ui->lineEdit->setFocus();
+ return true;
}
/**
@@ -268,12 +272,8 @@ void MainWindow::config() {
config(); // loop !!
}
}
-
- } else if (firstRun) {
- // close(); // not strong enough since not opened yet ;)
- exit(0);
+ firstRun = false;
}
- firstRun = false;
}
/**
diff --git a/mainwindow.h b/mainwindow.h
index 6fecaa7d..371a20c5 100644
--- a/mainwindow.h
+++ b/mainwindow.h
@@ -38,7 +38,7 @@ public:
void setPassExecutable(QString);
void setGitExecutable(QString);
void setGpgExecutable(QString);
- void checkConfig();
+ bool checkConfig();
void setApp(SingleApplication* app);
void setText(QString);
@@ -61,6 +61,7 @@ private slots:
void messageAvailable(QString message);
private:
+ QApplication *QtPass;
QScopedPointer<QSettings> settings;
QScopedPointer<Ui::MainWindow> ui;
QFileSystemModel model;