diff options
author | Anne Jan Brouwer <brouwer@annejan.com> | 2015-07-19 22:46:16 +0200 |
---|---|---|
committer | Anne Jan Brouwer <brouwer@annejan.com> | 2015-07-19 22:46:16 +0200 |
commit | ec90988bd96ce013132a2c2fbe520e9aac8bd88e (patch) | |
tree | c3842fc712a2c681ef80b81648ef753221438d78 | |
parent | 650d330cf1683e8198a7282dea5c199934e6086d (diff) |
Start minimized fixes https://github.com/IJHack/qtpass/issues/69
-rw-r--r-- | dialog.cpp | 20 | ||||
-rw-r--r-- | dialog.h | 2 | ||||
-rw-r--r-- | dialog.ui | 9 | ||||
-rw-r--r-- | mainwindow.cpp | 8 | ||||
-rw-r--r-- | mainwindow.h | 1 |
5 files changed, 39 insertions, 1 deletions
@@ -543,8 +543,10 @@ bool Dialog::hideOnClose() { void Dialog::useTrayIcon(bool useSystray) { ui->checkBoxUseTrayIcon->setChecked(useSystray); ui->checkBoxHideOnClose->setEnabled(useSystray); + ui->checkBoxStartMinimized->setEnabled(useSystray); if (!useSystray) { ui->checkBoxHideOnClose->setChecked(false); + ui->checkBoxStartMinimized->setChecked(false); } } @@ -562,7 +564,9 @@ void Dialog::hideOnClose(bool hideOnClose) { void Dialog::on_checkBoxUseTrayIcon_clicked() { if (ui->checkBoxUseTrayIcon->isChecked()) { ui->checkBoxHideOnClose->setEnabled(true); + ui->checkBoxStartMinimized->setEnabled(true); } else { + ui->checkBoxStartMinimized->setEnabled(false); ui->checkBoxHideOnClose->setEnabled(false); } } @@ -708,3 +712,19 @@ int Dialog::getPasswordLength() { QString Dialog::getPasswordChars() { return ui->lineEditPasswordChars->text(); } + +/** + * @brief Dialog::startMinimized + * @return + */ +bool Dialog::startMinimized() { + return ui->checkBoxStartMinimized->isChecked(); +} + +/** + * @brief Dialog::startMinimized + * @param startMinimized + */ +void Dialog::startMinimized(bool startMinimized) { + ui->checkBoxStartMinimized->setChecked(startMinimized); +} @@ -49,8 +49,10 @@ public: void genKey(QString, QDialog *); bool useTrayIcon(); bool hideOnClose(); + bool startMinimized(); void useTrayIcon(bool); void hideOnClose(bool); + void startMinimized(bool); void useGit(bool); bool useGit(); QString getPwgenPath(); @@ -29,7 +29,7 @@ <item> <widget class="QTabWidget" name="tabWidget"> <property name="currentIndex"> - <number>0</number> + <number>1</number> </property> <widget class="QWidget" name="tab_3"> <attribute name="title"> @@ -355,6 +355,13 @@ </property> </widget> </item> + <item row="5" column="2"> + <widget class="QCheckBox" name="checkBoxStartMinimized"> + <property name="text"> + <string>Start minimized</string> + </property> + </widget> + </item> </layout> </item> </layout> diff --git a/mainwindow.cpp b/mainwindow.cpp index 25d5e5ac..7b6152ec 100644 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -217,9 +217,14 @@ bool MainWindow::checkConfig() { useTrayIcon = settings.value("useTrayIcon").toBool(); hideOnClose = settings.value("hideOnClose").toBool(); + startMinimized = settings.value("startMinimized").toBool(); if (useTrayIcon && tray == NULL) { initTrayIcon(); + if (freshStart && startMinimized) { + // since we are still in constructor, can't directly hide + QTimer::singleShot(10*autoclearSeconds, this, SLOT(hide())); + } } else if (!useTrayIcon && tray != NULL) { destroyTrayIcon(); } @@ -347,6 +352,7 @@ void MainWindow::config() { d->addGPGId(addGPGId); d->useTrayIcon(useTrayIcon); d->hideOnClose(hideOnClose); + d->startMinimized(startMinimized); d->setProfiles(profiles, profile); d->useGit(useGit); d->setPwgenPath(pwgenExecutable); @@ -371,6 +377,7 @@ void MainWindow::config() { addGPGId = d->addGPGId(); useTrayIcon = d->useTrayIcon(); hideOnClose = d->hideOnClose(); + startMinimized = d->startMinimized(); profiles = d->getProfiles(); useGit = d->useGit(); pwgenExecutable = d->getPwgenPath(); @@ -395,6 +402,7 @@ void MainWindow::config() { settings.setValue("addGPGId", addGPGId ? "true" : "false"); settings.setValue("useTrayIcon", useTrayIcon ? "true" : "false"); settings.setValue("hideOnClose", hideOnClose ? "true" : "false"); + settings.setValue("startMinimized", startMinimized ? "true" : "false"); settings.setValue("useGit", useGit ? "true" : "false"); settings.setValue("pwgenExecutable", pwgenExecutable); settings.setValue("usePwgen", usePwgen ? "true" : "false"); diff --git a/mainwindow.h b/mainwindow.h index f33c04fb..ffb2093c 100644 --- a/mainwindow.h +++ b/mainwindow.h @@ -114,6 +114,7 @@ private: trayIcon *tray; bool useTrayIcon; bool hideOnClose; + bool startMinimized; bool useGit; bool usePwgen; bool useSymbols; |