diff options
author | Anne Jan Brouwer <brouwer@annejan.com> | 2015-07-10 16:29:17 +0200 |
---|---|---|
committer | Anne Jan Brouwer <annejan@noprotocol.com> | 2015-07-10 16:29:17 +0200 |
commit | 22d00339a9f28589849e08e68492a2693150955e (patch) | |
tree | c7012c9abb1acd5a96cbb4d83aff853cc893964b | |
parent | 9b14e351090a2bf29565f8477585649b47cd9f97 (diff) |
interface tweaks and base of pwgen stuff
-rw-r--r-- | README.md | 2 | ||||
-rw-r--r-- | dialog.cpp | 57 | ||||
-rw-r--r-- | dialog.h | 6 | ||||
-rw-r--r-- | dialog.ui | 296 | ||||
-rw-r--r-- | keygendialog.ui | 24 | ||||
-rw-r--r-- | mainwindow.cpp | 25 | ||||
-rw-r--r-- | mainwindow.h | 2 | ||||
-rw-r--r-- | mainwindow.ui | 12 | ||||
-rw-r--r-- | passworddialog.ui | 14 | ||||
-rw-r--r-- | usersdialog.ui | 16 |
10 files changed, 347 insertions, 107 deletions
@@ -61,7 +61,7 @@ Planned features * WebDAV (configuration) support * Optional table view of decrypted folder contents * Opening of (basic auth) urls in default browser? Possibly with helper plugin for filling out forms? -* Some other form of remote storage that allows for accountability / auditing (web API to retreive the .gpg files?) +* Some other form of remote storage that allows for accountability / auditing (web API to retrieve the .gpg files?) Installation ------------ @@ -182,7 +182,7 @@ QString Dialog::selectFolder() { void Dialog::on_toolButtonGit_clicked() { QString git = selectExecutable(); - if (git != "") { + if (!git.isEmpty()) { ui->gitPath->setText(git); } } @@ -568,3 +568,58 @@ void Dialog::closeEvent(QCloseEvent *event) { // TODO save window size or somethign event->accept(); } + +/** + * @brief Dialog::useGit + * @param useGit + */ +void Dialog::useGit(bool useGit) +{ + ui->checkBoxUseGit->setChecked(useGit); + ui->checkBoxAddGPGId->setEnabled(useGit); +} + +/** + * @brief Dialog::useGit + * @return + */ +bool Dialog::useGit() +{ + return ui->checkBoxUseGit->isChecked(); +} + +/** + * @brief Dialog::on_checkBoxUseGit_clicked + */ +void Dialog::on_checkBoxUseGit_clicked() +{ + ui->checkBoxAddGPGId->setEnabled(ui->checkBoxUseGit->isChecked()); +} + +/** + * @brief Dialog::on_toolButtonPwgen_clicked + */ +void Dialog::on_toolButtonPwgen_clicked() +{ + QString pwgen = selectExecutable(); + if (!pwgen.isEmpty()) { + ui->pwgenPath->setText(pwgen); + } +} + +/** + * @brief Dialog::getPwgenPath + * @return + */ +QString Dialog::getPwgenPath() { + return ui->pwgenPath->text(); +} + +/** + * @brief Dialog::setPwgenPath + * @param pwgen + */ +void Dialog::setPwgenPath(QString pwgen) +{ + ui->pwgenPath->setText(pwgen); +} @@ -51,6 +51,10 @@ public: bool hideOnClose(); void useTrayIcon(bool); void hideOnClose(bool); + void useGit(bool); + bool useGit(); + QString getPwgenPath(); + void setPwgenPath(QString); protected: void closeEvent(QCloseEvent *event); @@ -60,6 +64,7 @@ private slots: void on_radioButtonPass_clicked(); void on_toolButtonGit_clicked(); void on_toolButtonGpg_clicked(); + void on_toolButtonPwgen_clicked(); void on_toolButtonPass_clicked(); void on_toolButtonStore_clicked(); void on_checkBoxClipboard_clicked(); @@ -67,6 +72,7 @@ private slots: void on_addButton_clicked(); void on_deleteButton_clicked(); void on_checkBoxUseTrayIcon_clicked(); + void on_checkBoxUseGit_clicked(); private: QScopedPointer<Ui::Dialog> ui; @@ -6,18 +6,30 @@ <rect> <x>0</x> <y>0</y> - <width>563</width> - <height>240</height> + <width>594</width> + <height>309</height> </rect> </property> <property name="windowTitle"> <string>Configuration</string> </property> <layout class="QVBoxLayout" name="verticalLayout_2"> + <property name="leftMargin"> + <number>12</number> + </property> + <property name="topMargin"> + <number>12</number> + </property> + <property name="rightMargin"> + <number>12</number> + </property> + <property name="bottomMargin"> + <number>12</number> + </property> <item> <widget class="QTabWidget" name="tabWidget"> <property name="currentIndex"> - <number>1</number> + <number>0</number> </property> <widget class="QWidget" name="tab_3"> <attribute name="title"> @@ -75,10 +87,20 @@ <string>Native</string> </property> <layout class="QGridLayout" name="gridLayout"> - <item row="0" column="0"> - <widget class="QLabel" name="labelGpgPath"> + <item row="1" column="0"> + <widget class="QLabel" name="labelGitPath"> <property name="text"> - <string>gpg</string> + <string>git</string> + </property> + </widget> + </item> + <item row="0" column="1"> + <widget class="QLineEdit" name="gpgPath"/> + </item> + <item row="0" column="2"> + <widget class="QToolButton" name="toolButtonGpg"> + <property name="text"> + <string>...</string> </property> </widget> </item> @@ -89,25 +111,32 @@ </property> </widget> </item> - <item row="1" column="0"> - <widget class="QLabel" name="labelGitPath"> + <item row="0" column="0"> + <widget class="QLabel" name="labelGpgPath"> <property name="text"> - <string>git</string> + <string>gpg</string> </property> </widget> </item> <item row="1" column="1"> <widget class="QLineEdit" name="gitPath"/> </item> - <item row="0" column="2"> - <widget class="QToolButton" name="toolButtonGpg"> + <item row="2" column="1"> + <widget class="QLineEdit" name="pwgenPath"/> + </item> + <item row="2" column="0"> + <widget class="QLabel" name="labelPwgenPath"> <property name="text"> - <string>...</string> + <string>pwgen</string> </property> </widget> </item> - <item row="0" column="1"> - <widget class="QLineEdit" name="gpgPath"/> + <item row="2" column="2"> + <widget class="QToolButton" name="toolButtonPwgen"> + <property name="text"> + <string>...</string> + </property> + </widget> </item> </layout> </widget> @@ -117,22 +146,32 @@ <property name="title"> <string>Pass</string> </property> - <layout class="QGridLayout" name="gridLayout_2"> - <item row="0" column="2"> - <widget class="QToolButton" name="toolButtonPass"> - <property name="text"> - <string>...</string> + <layout class="QVBoxLayout" name="verticalLayout_4"> + <item> + <layout class="QHBoxLayout" name="horizontalLayout_4"> + <property name="sizeConstraint"> + <enum>QLayout::SetMinimumSize</enum> </property> - </widget> + <item> + <widget class="QLabel" name="labelPassPath"> + <property name="text"> + <string>pass</string> + </property> + </widget> + </item> + <item> + <widget class="QLineEdit" name="passPath"/> + </item> + <item> + <widget class="QToolButton" name="toolButtonPass"> + <property name="text"> + <string>...</string> + </property> + </widget> + </item> + </layout> </item> - <item row="0" column="0"> - <widget class="QLabel" name="labelPassPath"> - <property name="text"> - <string>pass</string> - </property> - </widget> - </item> - <item row="1" column="0" colspan="3"> + <item> <widget class="QLabel" name="zx2c4"> <property name="text"> <string><html><head/><body><p><a href="http://www.passwordstore.org/"><span style=" text-decoration: underline; color:#0000ff;">www.passwordstore.org</span></a></p></body></html></string> @@ -142,9 +181,6 @@ </property> </widget> </item> - <item row="0" column="1"> - <widget class="QLineEdit" name="passPath"/> - </item> </layout> </widget> </item> @@ -157,7 +193,7 @@ <attribute name="title"> <string>Settings</string> </attribute> - <layout class="QGridLayout" name="gridLayout_3"> + <layout class="QVBoxLayout" name="verticalLayout_5"> <property name="leftMargin"> <number>0</number> </property> @@ -170,79 +206,141 @@ <property name="bottomMargin"> <number>0</number> </property> - <item row="0" column="0" colspan="2"> - <widget class="QCheckBox" name="checkBoxClipboard"> - <property name="text"> - <string>Use clipboard</string> - </property> - </widget> - </item> - <item row="0" column="2"> - <widget class="QCheckBox" name="checkBoxAutoclear"> - <property name="text"> - <string>Autoclear</string> - </property> - </widget> - </item> - <item row="0" column="3"> - <layout class="QHBoxLayout" name="horizontalLayout"> - <item> - <widget class="QSpinBox" name="spinBoxAutoclearSeconds"/> + <item> + <layout class="QGridLayout" name="gridLayout_2"> + <item row="3" column="3"> + <layout class="QHBoxLayout" name="horizontalLayout_6"> + <item> + <widget class="QSpinBox" name="spinBoxPasswordLength"> + <property name="enabled"> + <bool>false</bool> + </property> + </widget> + </item> + <item> + <widget class="QLabel" name="labelLength"> + <property name="enabled"> + <bool>false</bool> + </property> + <property name="text"> + <string>Characters</string> + </property> + </widget> + </item> + </layout> </item> - <item> - <widget class="QLabel" name="labelSeconds"> + <item row="2" column="1" colspan="2"> + <widget class="QCheckBox" name="checkBoxAddGPGId"> + <property name="text"> + <string>Automatically add .gpg-id files</string> + </property> + </widget> + </item> + <item row="3" column="0"> + <widget class="QCheckBox" name="checkBoxUsPwgen"> + <property name="enabled"> + <bool>false</bool> + </property> + <property name="text"> + <string>Use pwgen</string> + </property> + </widget> + </item> + <item row="0" column="0"> + <widget class="QCheckBox" name="checkBoxClipboard"> + <property name="text"> + <string>Use clipboard</string> + </property> + </widget> + </item> + <item row="0" column="3"> + <layout class="QHBoxLayout" name="horizontalLayout"> + <item> + <widget class="QSpinBox" name="spinBoxAutoclearSeconds"/> + </item> + <item> + <widget class="QLabel" name="labelSeconds"> + <property name="text"> + <string>Seconds</string> + </property> + </widget> + </item> + </layout> + </item> + <item row="1" column="0"> + <widget class="QCheckBox" name="checkBoxHidePassword"> + <property name="text"> + <string>Hide password</string> + </property> + </widget> + </item> + <item row="5" column="0"> + <widget class="QCheckBox" name="checkBoxUseTrayIcon"> + <property name="text"> + <string>Use TrayIcon</string> + </property> + </widget> + </item> + <item row="5" column="1"> + <widget class="QCheckBox" name="checkBoxHideOnClose"> <property name="text"> - <string>Seconds</string> + <string>Hide on close</string> + </property> + </widget> + </item> + <item row="2" column="0"> + <widget class="QCheckBox" name="checkBoxUseGit"> + <property name="enabled"> + <bool>true</bool> + </property> + <property name="text"> + <string>Use git</string> + </property> + </widget> + </item> + <item row="1" column="1"> + <widget class="QCheckBox" name="checkBoxHideContent"> + <property name="text"> + <string>Hide content</string> + </property> + </widget> + </item> + <item row="3" column="1"> + <widget class="QCheckBox" name="checkBoxUseSymbols"> + <property name="enabled"> + <bool>false</bool> + </property> + <property name="text"> + <string>Include special symbols </string> + </property> + </widget> + </item> + <item row="0" column="2"> + <widget class="QCheckBox" name="checkBoxAutoclear"> + <property name="text"> + <string>Autoclear</string> + </property> + </widget> + </item> + <item row="4" column="1" colspan="3"> + <widget class="QLineEdit" name="lineEditPasswordChars"> + <property name="enabled"> + <bool>false</bool> + </property> + </widget> + </item> + <item row="4" column="0"> + <widget class="QLabel" name="labelPasswordChars"> + <property name="enabled"> + <bool>false</bool> + </property> + <property name="text"> + <string>Use characters</string> </property> </widget> </item> </layout> </item> - <item row="1" column="0"> - <widget class="QCheckBox" name="checkBoxHidePassword"> - <property name="text"> - <string>Hide password</string> - </property> - </widget> - </item> - <item row="1" column="1"> - <widget class="QCheckBox" name="checkBoxHideContent"> - <property name="text"> - <string>Hide content</string> - </property> - </widget> - </item> - <item row="2" column="0"> - <widget class="QCheckBox" name="checkBoxUseGit"> - <property name="enabled"> - <bool>false</bool> - </property> - <property name="text"> - <string>Use git</string> - </property> - </widget> - </item> - <item row="2" column="1" colspan="3"> - <widget class="QCheckBox" name="checkBoxAddGPGId"> - <property name="text"> - <string>Automatically add .gpg-id files</string> - </property> - </widget> - </item> - <item row="3" column="0"> - <widget class="QCheckBox" name="checkBoxUseTrayIcon"> - <property name="text"> - <string>Use TrayIcon</string> - </property> - </widget> - </item> - <item row="3" column="1"> - <widget class="QCheckBox" name="checkBoxHideOnClose"> - <property name="text"> - <string>Hide on close</string> - </property> - </widget> - </item> </layout> </widget> <widget class="QWidget" name="tab_5"> @@ -377,6 +475,8 @@ <tabstop>toolButtonGpg</tabstop> <tabstop>gitPath</tabstop> <tabstop>toolButtonGit</tabstop> + <tabstop>pwgenPath</tabstop> + <tabstop>toolButtonPwgen</tabstop> <tabstop>passPath</tabstop> <tabstop>toolButtonPass</tabstop> <tabstop>checkBoxClipboard</tabstop> diff --git a/keygendialog.ui b/keygendialog.ui index 95165cef..f85d5b70 100644 --- a/keygendialog.ui +++ b/keygendialog.ui @@ -14,6 +14,18 @@ <string>Generate GnuPG keypair</string> </property> <layout class="QVBoxLayout" name="verticalLayout_2"> + <property name="leftMargin"> + <number>12</number> + </property> + <property name="topMargin"> + <number>12</number> + </property> + <property name="rightMargin"> + <number>12</number> + </property> + <property name="bottomMargin"> + <number>12</number> + </property> <item> <widget class="QLabel" name="label"> <property name="sizePolicy"> @@ -54,6 +66,18 @@ <item> <widget class="QWidget" name="widget" native="true"> <layout class="QGridLayout" name="gridLayout"> + <property name="leftMargin"> + <number>0</number> + </property> + <property name="topMargin"> + <number>0</number> + </property> + <property name="rightMargin"> + <number>0</number> + </property> + <property name="bottomMargin"> + <number>0</number> + </property> <item row="1" column="0" colspan="2"> <widget class="QLabel" name="labelPassphrase"> <property name="text"> diff --git a/mainwindow.cpp b/mainwindow.cpp index 78f4779d..3d769b73 100644 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -186,6 +186,12 @@ bool MainWindow::checkConfig() { if (gpgExecutable.isEmpty()) { gpgExecutable = Util::findBinaryInPath("gpg2"); } + + pwgenExecutable = settings.value("pwgenExecutable").toString(); + if (pwgenExecutable.isEmpty()) { + pwgenExecutable = Util::findBinaryInPath("pwgen"); + } + gpgHome = settings.value("gpgHome").toString(); useWebDav = (settings.value("useWebDav") == "true"); @@ -201,6 +207,8 @@ bool MainWindow::checkConfig() { } settings.endGroup(); + useGit = (settings.value("useGit") == "true"); + if (Util::checkConfig(passStore, passExecutable, gpgExecutable)) { config(); if (firstRun && Util::checkConfig(passStore, passExecutable, gpgExecutable)) { @@ -271,10 +279,13 @@ bool MainWindow::checkConfig() { updateEnv(); - if (gitExecutable.isEmpty() && passExecutable.isEmpty()) + if (!useGit || (gitExecutable.isEmpty() && passExecutable.isEmpty())) { ui->pushButton->hide(); ui->updateButton->hide(); + } else { + ui->pushButton->show(); + ui->updateButton->show(); } ui->lineEdit->setFocus(); @@ -306,6 +317,8 @@ void MainWindow::config() { d->useTrayIcon(useTrayIcon); d->hideOnClose(hideOnClose); d->setProfiles(profiles, profile); + d->useGit(useGit); + d->setPwgenPath(pwgenExecutable); d->wizard(); // does shit if (d->exec()) { @@ -324,6 +337,8 @@ void MainWindow::config() { useTrayIcon = d->useTrayIcon(); hideOnClose = d->hideOnClose(); profiles = d->getProfiles(); + useGit = d->useGit(); + pwgenExecutable = d->getPwgenPath(); QSettings &settings(getSettings()); @@ -340,6 +355,8 @@ void MainWindow::config() { settings.setValue("addGPGId", addGPGId ? "true" : "false"); settings.setValue("useTrayIcon", useTrayIcon ? "true" : "false"); settings.setValue("hideOnClose", hideOnClose ? "true" : "false"); + settings.setValue("useGit", useGit ? "true" : "false"); + settings.setValue("pwgenExecutable", pwgenExecutable); if (!profiles.isEmpty()) { settings.beginGroup("profiles"); @@ -369,14 +386,14 @@ void MainWindow::config() { config(); } updateEnv(); - if (gitExecutable.isEmpty() && passExecutable.isEmpty()) + if (!useGit || (gitExecutable.isEmpty() && passExecutable.isEmpty())) { ui->pushButton->hide(); ui->updateButton->hide(); } else { ui->pushButton->show(); ui->updateButton->show(); - } + } if (useTrayIcon && tray == NULL) { initTrayIcon(); } else if (!useTrayIcon && tray != NULL) { @@ -1098,7 +1115,7 @@ void MainWindow::on_usersButton_clicked() tr("None of the selected keys have a secret key available.\n" "You will not be able to decrypt any newly added passwords!")); } - if (!useWebDav && !gitExecutable.isEmpty()){ + if (!useWebDav && useGit && !gitExecutable.isEmpty()){ if (addFile) { executeWrapper(gitExecutable, "add \"" + gpgIdFile + '"'); } diff --git a/mainwindow.h b/mainwindow.h index b3ff1f0c..0693a576 100644 --- a/mainwindow.h +++ b/mainwindow.h @@ -91,6 +91,7 @@ private: QString passExecutable; QString gitExecutable; QString gpgExecutable; + QString pwgenExecutable; QString gpgHome; bool useWebDav; QString webDavUrl; @@ -112,6 +113,7 @@ private: trayIcon *tray; bool useTrayIcon; bool hideOnClose; + bool useGit; void updateText(); void executePass(QString, QString = QString()); void executeWrapper(QString, QString, QString = QString()); diff --git a/mainwindow.ui b/mainwindow.ui index e6ccbf02..d2099b20 100644 --- a/mainwindow.ui +++ b/mainwindow.ui @@ -15,6 +15,18 @@ </property> <widget class="QWidget" name="centralWidget"> <layout class="QVBoxLayout" name="verticalLayout_2"> + <property name="leftMargin"> + <number>12</number> + </property> + <property name="topMargin"> + <number>12</number> + </property> + <property name="rightMargin"> + <number>12</number> + </property> + <property name="bottomMargin"> + <number>12</number> + </property> <item> <widget class="QFrame" name="frame"> <property name="sizePolicy"> diff --git a/passworddialog.ui b/passworddialog.ui index db0b0dc6..ca0f2d5c 100644 --- a/passworddialog.ui +++ b/passworddialog.ui @@ -7,13 +7,25 @@ <x>0</x> <y>0</y> <width>266</width> - <height>235</height> + <height>184</height> </rect> </property> <property name="windowTitle"> <string>Password</string> </property> <layout class="QVBoxLayout" name="verticalLayout"> + <property name="leftMargin"> + <number>12</number> + </property> + <property name="topMargin"> + <number>12</number> + </property> + <property name="rightMargin"> + <number>12</number> + </property> + <property name="bottomMargin"> + <number>12</number> + </property> <item> <layout class="QHBoxLayout" name="horizontalLayout_3"> <item> diff --git a/usersdialog.ui b/usersdialog.ui index 4529a848..37b3d272 100644 --- a/usersdialog.ui +++ b/usersdialog.ui @@ -6,8 +6,8 @@ <rect> <x>0</x> <y>0</y> - <width>599</width> - <height>583</height> + <width>566</width> + <height>465</height> </rect> </property> <property name="sizePolicy"> @@ -23,6 +23,18 @@ <bool>true</bool> </property> <layout class="QVBoxLayout" name="verticalLayout"> + <property name="leftMargin"> + <number>12</number> + </property> + <property name="topMargin"> + <number>12</number> + </property> + <property name="rightMargin"> + <number>12</number> + </property> + <property name="bottomMargin"> + <number>12</number> + </property> <item> <widget class="QLabel" name="label"> <property name="text"> |