summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAnne Jan Brouwer <annejan@noprotocol.com>2015-05-27 04:57:02 +0200
committerAnne Jan Brouwer <annejan@noprotocol.com>2015-05-27 04:57:02 +0200
commit5c9e3eb9d1461633fd1ffe8de11228d638859593 (patch)
tree06c0784abc779431f5d336e7100e7d1711c8ced4
parentdde484ddb77bd5d63bd1a23f489367d64ac618b2 (diff)
parent09460d379eab60890fa0fa9607694b8781c394cc (diff)
fixed visibility and saving of profiles
-rw-r--r--README.md2
-rw-r--r--mainwindow.cpp41
2 files changed, 23 insertions, 20 deletions
diff --git a/README.md b/README.md
index 4d37b387..5a063299 100644
--- a/README.md
+++ b/README.md
@@ -55,7 +55,7 @@ Planned features
* Re-encryption after users-change (optional ofcourse)
* Showing path in Add and Edit screen (currently sometimes confusing where I'm adding this password)
* Right click handlers for file/folder and content
-* ~~first use wizards to set up password-store (and decryption key, currently always the gpg default key)~~
+* ~~First use wizards to set up password-store (and decryption key, currently always the gpg default key)~~
* ~~Profiles (to allow use of multiple password stores and decryption keys) with dropdown in main screen~~
* Password generation with options for what kind you'd like
* Templates (username, url etc) in Add / Edit screen (configurable templates)
diff --git a/mainwindow.cpp b/mainwindow.cpp
index aaf76e30..a88be65f 100644
--- a/mainwindow.cpp
+++ b/mainwindow.cpp
@@ -282,24 +282,27 @@ void MainWindow::config() {
settings.setValue("hidePassword", hidePassword ? "true" : "false");
settings.setValue("hideContent", hideContent ? "true" : "false");
settings.setValue("addGPGId", addGPGId ? "true" : "false");
- settings.beginGroup("profiles");
- settings.remove("");
- bool profileExists = false;
- QHashIterator<QString, QString> i(profiles);
- while (i.hasNext()) {
- i.next();
- //qDebug() << i.key() + "|" + i.value();
- if (i.key() == profile) {
- profileExists = true;
+ if (!profiles.isEmpty()) {
+ settings.beginGroup("profiles");
+ settings.remove("");
+ bool profileExists = false;
+ QHashIterator<QString, QString> i(profiles);
+ while (i.hasNext()) {
+ i.next();
+ //qDebug() << i.key() + "|" + i.value();
+ if (i.key() == profile) {
+ profileExists = true;
+ }
+ settings.setValue(i.key(), i.value());
}
- settings.setValue(i.key(), i.value());
- }
- if (!profileExists) {
- // just take the last one
- profile = i.key();
+ if (!profileExists) {
+ // just take the last one
+ profile = i.key();
+ }
+ settings.endGroup();
+ } else {
+ settings.remove("profiles");
}
- settings.endGroup();
-
updateProfileBox();
ui->treeView->setRootIndex(proxyModel.mapFromSource(model.setRootPath(passStore)));
@@ -1045,11 +1048,11 @@ void MainWindow::genKey(QString batch, QDialog *keygenWindow)
*/
void MainWindow::updateProfileBox()
{
- qDebug() << profiles.size();
+ //qDebug() << profiles.size();
if (profiles.isEmpty()) {
- ui->profileBox->setVisible(false);
+ ui->profileBox->hide();
} else {
- ui->profileBox->setVisible(true);
+ ui->profileBox->show();
if (profiles.size() < 2) {
ui->profileBox->setEnabled(false);
} else {