summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAnne Jan Brouwer <brouwer@annejan.com>2015-07-17 23:40:44 +0200
committerAnne Jan Brouwer <brouwer@annejan.com>2015-07-17 23:40:44 +0200
commitd99ff70a6098a1d6fe47f96dbba0e49ebce1e951 (patch)
tree1ca3cb427f6480749e925e6226d57feba214f243
parenta1a7d70c7001bbd71eb4c1ea66183f8f2169bdc2 (diff)
rename to clear up, remove empty profiles
-rw-r--r--dialog.cpp13
-rw-r--r--mainwindow.cpp18
-rw-r--r--mainwindow.h2
3 files changed, 23 insertions, 10 deletions
diff --git a/dialog.cpp b/dialog.cpp
index cbde8540..25a02710 100644
--- a/dialog.cpp
+++ b/dialog.cpp
@@ -378,6 +378,12 @@ void Dialog::genKey(QString batch, QDialog *dialog)
*/
void Dialog::setProfiles(QHash<QString, QString> profiles, QString profile)
{
+ //qDebug() << profiles;
+ if (profiles.contains("")) {
+ profiles.remove("");
+ // remove weird "" key value pairs
+ }
+
ui->profileTable->setRowCount(profiles.count());
QHashIterator<QString, QString> i(profiles);
int n = 0;
@@ -622,6 +628,10 @@ QString Dialog::getPwgenPath() {
void Dialog::setPwgenPath(QString pwgen)
{
ui->pwgenPath->setText(pwgen);
+ if (pwgen.isEmpty()) {
+ ui->checkBoxUsePwgen->setChecked(false);
+ }
+ on_checkBoxUsePwgen_clicked();
}
/**
@@ -639,6 +649,9 @@ void Dialog::on_checkBoxUsePwgen_clicked()
* @param usePwgen
*/
void Dialog::usePwgen(bool usePwgen) {
+ if (ui->pwgenPath->text().isEmpty()) {
+ usePwgen = false;
+ }
ui->checkBoxUsePwgen->setChecked(usePwgen);
on_checkBoxUsePwgen_clicked();
}
diff --git a/mainwindow.cpp b/mainwindow.cpp
index b1e0a502..7397dbf2 100644
--- a/mainwindow.cpp
+++ b/mainwindow.cpp
@@ -41,7 +41,7 @@ MainWindow::MainWindow(QWidget *parent) :
wrapperRunning = false;
execQueue = new QQueue<execQueueItem>;
ui->statusBar->showMessage(tr("Welcome to QtPass %1").arg(VERSION), 2000);
- firstRun = true;
+ freshStart = true;
startupPhase = true;
if (!checkConfig()) {
// no working config
@@ -139,7 +139,7 @@ bool MainWindow::checkConfig() {
QString version = settings.value("version").toString();
- if (firstRun) {
+ if (freshStart) {
settings.beginGroup( "mainwindow" );
restoreGeometry(settings.value( "geometry", saveGeometry() ).toByteArray());
restoreState(settings.value( "savestate", saveState() ).toByteArray());
@@ -213,7 +213,7 @@ bool MainWindow::checkConfig() {
if (Util::checkConfig(passStore, passExecutable, gpgExecutable)) {
config();
- if (firstRun && Util::checkConfig(passStore, passExecutable, gpgExecutable)) {
+ if (freshStart && Util::checkConfig(passStore, passExecutable, gpgExecutable)) {
return false;
}
}
@@ -245,17 +245,17 @@ bool MainWindow::checkConfig() {
} else {
usePwgen = false;
}
- } else {
+ } /*else {
QStringList ver = version.split(".");
qDebug() << ver;
if (ver[0] == "0" && ver[1] == "8") {
// upgrade to 0.9
}
- }
+ }*/
settings.setValue("version", VERSION);
- firstRun = false;
+ freshStart = 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,
@@ -331,7 +331,7 @@ void MainWindow::config() {
d->setModal(true);
// Automatically default to pass if it's available
- usePass = firstRun ? QFile(passExecutable).exists() : usePass;
+ usePass = freshStart ? QFile(passExecutable).exists() : usePass;
d->setPassPath(passExecutable);
d->setGitPath(gitExecutable);
@@ -425,7 +425,7 @@ void MainWindow::config() {
updateProfileBox();
ui->treeView->setRootIndex(proxyModel.mapFromSource(model.setRootPath(passStore)));
- if (firstRun && Util::checkConfig(passStore, passExecutable, gpgExecutable)) {
+ if (freshStart && Util::checkConfig(passStore, passExecutable, gpgExecutable)) {
config();
}
updateEnv();
@@ -443,7 +443,7 @@ void MainWindow::config() {
destroyTrayIcon();
}
}
- firstRun = false;
+ freshStart = false;
}
}
diff --git a/mainwindow.h b/mainwindow.h
index 57625fdd..f33c04fb 100644
--- a/mainwindow.h
+++ b/mainwindow.h
@@ -105,7 +105,7 @@ private:
bool wrapperRunning;
QStringList env;
QQueue<execQueueItem> *execQueue;
- bool firstRun;
+ bool freshStart;
QDialog *keygen;
QString currentDir;
QHash<QString, QString> profiles;