diff options
author | Anne Jan Brouwer <annejan@noprotocol.com> | 2015-06-11 00:29:20 +0200 |
---|---|---|
committer | Anne Jan Brouwer <annejan@noprotocol.com> | 2015-06-11 00:29:20 +0200 |
commit | ccda0323fdf150a70c619c5782fee3ff7c6e08c9 (patch) | |
tree | 74e8f9693d4d46d817a7e694eb015cbaa824a556 | |
parent | 183f5afb2c6339e78b67d2021af8b0b2b01a8b96 (diff) |
fixes after static analysis
-rw-r--r-- | dialog.cpp | 4 | ||||
-rw-r--r-- | main.cpp | 11 | ||||
-rw-r--r-- | mainwindow.cpp | 5 | ||||
-rw-r--r-- | qtpass.pro | 2 | ||||
-rw-r--r-- | storemodel.cpp | 17 | ||||
-rw-r--r-- | usersdialog.cpp | 1 |
6 files changed, 21 insertions, 19 deletions
@@ -510,7 +510,9 @@ void Dialog::wizard() //qDebug() << names; if (QFile(gpg).exists() && names.empty()) { KeygenDialog d(this); - d.exec(); + if (!d.exec()) { + return; + } } QString passStore = ui->storePath->text(); @@ -41,12 +41,7 @@ int main(int argc, char *argv[]) app.setActiveWindow(&w); app.setWindowIcon(QIcon(":artwork/icon.png")); w.setApp(&app); - if (w.checkConfig()) { - w.setText(text); - w.show(); - return app.exec(); - } else { - // canceled out of wizard - return 0; - } + w.setText(text); + w.show(); + return app.exec(); } diff --git a/mainwindow.cpp b/mainwindow.cpp index c106c09a..6b6a6745 100644 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -38,6 +38,11 @@ MainWindow::MainWindow(QWidget *parent) : ui->statusBar->showMessage(tr("Welcome to QtPass %1").arg(VERSION), 2000); firstRun = true; startupPhase = true; + if (!checkConfig()) { + // no working config + QApplication::quit(); + } + QtPass = NULL; } /** @@ -20,7 +20,7 @@ macx { } TEMPLATE = app -VERSION = 0.8.3 +VERSION = 0.8.4 SOURCES += main.cpp\ mainwindow.cpp \ diff --git a/storemodel.cpp b/storemodel.cpp index 213ba8c3..3738236f 100644 --- a/storemodel.cpp +++ b/storemodel.cpp @@ -6,6 +6,7 @@ */ StoreModel::StoreModel() { + fs = NULL; } /** @@ -29,14 +30,19 @@ bool StoreModel::filterAcceptsRow(int sourceRow, bool StoreModel::ShowThis(const QModelIndex index) const { bool retVal = false; + if (fs == NULL) { + return retVal; + } //Gives you the info for number of childs with a parent if ( sourceModel()->rowCount(index) > 0 ) { for( int nChild = 0; nChild < sourceModel()->rowCount(index); nChild++) { QModelIndex childIndex = sourceModel()->index(nChild,0,index); - if ( ! childIndex.isValid() ) + if (!childIndex.isValid()) + { break; + } retVal = ShowThis(childIndex); if (retVal) { @@ -50,14 +56,7 @@ bool StoreModel::ShowThis(const QModelIndex index) const QString path = fs->filePath(useIndex); path.replace(QRegExp("\\.gpg$"), ""); path.replace(QRegExp("^" + store), ""); - if ( ! path.contains(filterRegExp())) - { - retVal = false; - } - else - { - retVal = true; - } + retVal = path.contains(filterRegExp()); } return retVal; } diff --git a/usersdialog.cpp b/usersdialog.cpp index 189fd1b8..dd0b6517 100644 --- a/usersdialog.cpp +++ b/usersdialog.cpp @@ -10,6 +10,7 @@ UsersDialog::UsersDialog(QWidget *parent) : connect(ui->buttonBox, SIGNAL(accepted()), this, SLOT(accept())); connect(ui->buttonBox, SIGNAL(rejected()), this, SLOT(reject())); connect(ui->listWidget, SIGNAL(itemChanged(QListWidgetItem *)), this, SLOT(itemChange(QListWidgetItem *))); + userList = NULL; } UsersDialog::~UsersDialog() |