summaryrefslogtreecommitdiffstats
path: root/mainwindow.cpp
diff options
context:
space:
mode:
authorAnne Jan Brouwer <brouwer@annejan.com>2015-05-27 04:57:02 +0200
committerAnne Jan Brouwer <annejan@noprotocol.com>2015-05-27 04:57:02 +0200
commit205626dbe38ce16e2c2f0fa96055f7c2233fda81 (patch)
tree06c0784abc779431f5d336e7100e7d1711c8ced4 /mainwindow.cpp
parentcbb0559d359f87e3ae7f97ea2c44dea39c93ff47 (diff)
parent617b015dbc9b5ceffde0c0028e12d1f6b8177261 (diff)
fixed visibility and saving of profiles
Diffstat (limited to 'mainwindow.cpp')
-rw-r--r--mainwindow.cpp41
1 files changed, 22 insertions, 19 deletions
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 {