diff options
author | Anne Jan Brouwer <annejan@noprotocol.com> | 2015-05-27 05:22:58 +0200 |
---|---|---|
committer | Anne Jan Brouwer <annejan@noprotocol.com> | 2015-05-27 05:22:58 +0200 |
commit | c38fc6ee62feb3ac3b3c2e9ac7328343249cd513 (patch) | |
tree | dfadeebc848986d9b48256d12b5d30db6ea2de5c | |
parent | 09460d379eab60890fa0fa9607694b8781c394cc (diff) | |
parent | 21649ba8f2b468c668539670ad2ca16fd2ffbfd4 (diff) |
Merge branch 'feature/profiles' into develop
25 files changed, 2164 insertions, 619 deletions
@@ -56,7 +56,7 @@ Planned features * 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)~~ -* Profiles (to allow use of multiple password stores and decryption keys) with dropdown in main screen +* ~~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) * Colour coding or disabling of people you can't encrypt for (trust settings) in User management @@ -16,6 +16,9 @@ Dialog::Dialog(MainWindow *parent) : { mainWindow = parent; ui->setupUi(this); + ui->profileTable->verticalHeader()->hide(); + ui->profileTable->horizontalHeader()->setStretchLastSection(true); + ui->label->setText(ui->label->text() + VERSION); } /** @@ -358,6 +361,122 @@ void Dialog::addGPGId(bool addGPGId) { ui->checkBoxAddGPGId->setChecked(addGPGId); } + +/** + * @brief Dialog::genKey + * @param QString batch + */ +void Dialog::genKey(QString batch, QDialog *dialog) +{ + mainWindow->genKey(batch, dialog); +} + +/** + * @brief Dialog::setProfiles + * @param profiles + * @param profile + */ +void Dialog::setProfiles(QHash<QString, QString> profiles, QString profile) +{ + ui->profileTable->setRowCount(profiles.count()); + QHashIterator<QString, QString> i(profiles); + int n = 0; + while (i.hasNext()) { + i.next(); + if (!i.value().isEmpty()) { + ui->profileTable->setItem(n, 0, new QTableWidgetItem(i.key())); + ui->profileTable->setItem(n, 1, new QTableWidgetItem(i.value())); + //qDebug() << "naam:" + i.key(); + if (i.key() == profile) { + ui->profileName->setText(i.key()); + ui->storePath->setText(i.value()); + } + } + n++; + } +} + +/** + * @brief Dialog::getProfiles + * @return + */ +QHash<QString, QString> Dialog::getProfiles() +{ + QHash<QString, QString> profiles; + for (int i = 0; i < ui->profileTable->rowCount(); i++) { + QString path = ui->profileTable->item(i, 1)->text(); + if (!path.isEmpty()) { + profiles.insert(ui->profileTable->item(i, 0)->text(), + path); + } + } + return profiles; +} + +/** + * @brief Dialog::on_addButton_clicked + */ +void Dialog::on_addButton_clicked() +{ + QString name = ui->profileName->text(); + int n = 0; + bool newItem = true; + QAbstractItemModel *model = ui->profileTable->model(); + QModelIndexList matches = model->match( model->index(0,0), Qt::DisplayRole, name); + foreach(const QModelIndex &index, matches) + { + QTableWidgetItem *item = ui->profileTable->item(index.row(), index.column()); + n = item->row(); + qDebug() << "overwrite:" << item->text(); + newItem = false; + } + if (newItem) { + n = ui->profileTable->rowCount(); + ui->profileTable->insertRow(n); + } + ui->profileTable->setItem(n, 0, new QTableWidgetItem(name)); + ui->profileTable->setItem(n, 1, new QTableWidgetItem(ui->storePath->text())); + //qDebug() << ui->profileName->text(); + ui->profileTable->selectRow(n); + if (ui->profileTable->rowCount() < 1) { + ui->deleteButton->setEnabled(true); + } +} + +/** + * @brief Dialog::on_profileTable_currentItemChanged + * @param current + */ +void Dialog::on_profileTable_currentItemChanged(QTableWidgetItem *current) +{ + if (current == 0) { + return; + } + int n = current->row(); + ui->profileName->setText(ui->profileTable->item(n, 0)->text()); + ui->storePath->setText(ui->profileTable->item(n, 1)->text()); +} + +/** + * @brief Dialog::on_deleteButton_clicked + */ +void Dialog::on_deleteButton_clicked() +{ + QList<QTableWidgetItem*> selected = ui->profileTable->selectedItems(); + if (selected.count() == 0) { + QMessageBox::warning(this, tr("No profile selected"), + tr("No profile selected to delete")); + return; + } + for (int i = 0; i < selected.size(); ++i) { + QTableWidgetItem* item = selected.at(i); + ui->profileTable->removeRow(item->row()); + } + if (ui->profileTable->rowCount() < 1) { + ui->deleteButton->setEnabled(false); + } +} + /** * @brief Dialog::wizard */ @@ -401,12 +520,3 @@ void Dialog::wizard() //ui->gpgPath->setText(gpg); } - -/** - * @brief Dialog::genKey - * @param QString batch - */ -void Dialog::genKey(QString batch, QDialog *dialog) -{ - mainWindow->genKey(batch, dialog); -} @@ -4,6 +4,7 @@ #include <QDialog> #include <QFileDialog> #include "mainwindow.h" +#include <QTableWidgetItem> namespace Ui { @@ -23,6 +24,7 @@ public: void setGitPath(QString); void setGpgPath(QString); void setStorePath(QString); + void setProfiles(QHash<QString, QString>, QString); void usePass(bool); void useClipboard(bool); void useAutoclear(bool); @@ -34,6 +36,7 @@ public: QString getGitPath(); QString getGpgPath(); QString getStorePath(); + QHash<QString,QString> getProfiles(); bool usePass(); bool useClipboard(); bool useAutoclear(); @@ -53,6 +56,9 @@ private slots: void on_toolButtonStore_clicked(); void on_checkBoxClipboard_clicked(); void on_checkBoxAutoclear_clicked(); + void on_addButton_clicked(); + void on_profileTable_currentItemChanged(QTableWidgetItem*); + void on_deleteButton_clicked(); private: QScopedPointer<Ui::Dialog> ui; @@ -6,8 +6,8 @@ <rect> <x>0</x> <y>0</y> - <width>507</width> - <height>446</height> + <width>491</width> + <height>501</height> </rect> </property> <property name="windowTitle"> @@ -33,102 +33,192 @@ </layout> </item> <item> - <widget class="QGroupBox" name="groupBoxNative"> - <property name="title"> - <string>Native</string> - </property> - <layout class="QGridLayout" name="gridLayout"> - <item row="1" column="1"> - <widget class="QLineEdit" name="gpgPath"/> - </item> - <item row="0" column="1"> - <widget class="QLineEdit" name="gitPath"/> - </item> - <item row="0" column="0"> - <widget class="QLabel" name="labelGitPath"> - <property name="text"> - <string>Executable git</string> + <widget class="QWidget" name="widget" native="true"> + <layout class="QHBoxLayout" name="horizontalLayout_2"> + <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> + <widget class="QGroupBox" name="groupBoxNative"> + <property name="title"> + <string>Native</string> </property> + <layout class="QGridLayout" name="gridLayout"> + <item row="0" column="0"> + <widget class="QLabel" name="labelGpgPath"> + <property name="text"> + <string>gpg</string> + </property> + </widget> + </item> + <item row="1" column="2"> + <widget class="QToolButton" name="toolButtonGit"> + <property name="text"> + <string>...</string> + </property> + </widget> + </item> + <item row="1" column="0"> + <widget class="QLabel" name="labelGitPath"> + <property name="text"> + <string>git</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"> + <property name="text"> + <string>...</string> + </property> + </widget> + </item> + <item row="0" column="1"> + <widget class="QLineEdit" name="gpgPath"/> + </item> + </layout> </widget> </item> - <item row="1" column="0"> - <widget class="QLabel" name="labelGpgPath"> - <property name="text"> - <string>Executable gpg</string> - </property> - </widget> - </item> - <item row="1" column="2"> - <widget class="QToolButton" name="toolButtonGpg"> - <property name="text"> - <string>...</string> - </property> - </widget> - </item> - <item row="0" column="2"> - <widget class="QToolButton" name="toolButtonGit"> - <property name="text"> - <string>...</string> + <item> + <widget class="QGroupBox" name="groupBoxPass"> + <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> + </property> + </widget> + </item> + <item row="0" column="0"> + <widget class="QLabel" name="labelPassPath"> + <property name="text"> + <string>pass</string> + </property> + </widget> + </item> + <item row="0" column="1"> + <widget class="QLineEdit" name="passPath"/> + </item> + <item row="1" column="0" colspan="3"> + <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> + </property> + <property name="openExternalLinks"> + <bool>true</bool> + </property> + </widget> + </item> + </layout> </widget> </item> </layout> </widget> </item> <item> - <widget class="QGroupBox" name="groupBoxPass"> + <widget class="QGroupBox" name="groupBoxProfiles"> <property name="title"> - <string>Pass</string> + <string>Profiles</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> + <widget class="QTableWidget" name="profileTable"> + <property name="editTriggers"> + <set>QAbstractItemView::NoEditTriggers</set> </property> - </widget> - </item> - <item row="0" column="0"> - <widget class="QLabel" name="labelPassPath"> - <property name="text"> - <string>Executable pass</string> + <property name="alternatingRowColors"> + <bool>true</bool> + </property> + <property name="selectionMode"> + <enum>QAbstractItemView::SingleSelection</enum> + </property> + <property name="selectionBehavior"> + <enum>QAbstractItemView::SelectRows</enum> </property> + <property name="sortingEnabled"> + <bool>true</bool> + </property> + <column> + <property name="text"> + <string>Name</string> + </property> + </column> + <column> + <property name="text"> + <string>Path</string> + </property> + </column> </widget> </item> - <item row="0" column="1"> - <widget class="QLineEdit" name="passPath"/> - </item> - </layout> - </widget> - </item> - <item> - <widget class="QGroupBox" name="groupBox"> - <property name="title"> - <string>Other</string> - </property> - <layout class="QGridLayout" name="gridLayout_6"> - <item row="0" column="0"> - <layout class="QGridLayout" name="gridLayout_5"> + <item> + <layout class="QGridLayout" name="gridLayout_11"> + <item row="2" column="4"> + <widget class="QToolButton" name="toolButtonStore"> + <property name="text"> + <string>...</string> + </property> + </widget> + </item> + <item row="2" column="1"> + <widget class="QLineEdit" name="profileName"/> + </item> + <item row="2" column="0"> + <widget class="QLabel" name="labelName"> + <property name="text"> + <string>Profile name</string> + </property> + </widget> + </item> <item row="0" column="0"> - <widget class="QLabel" name="labelStorePath"> + <widget class="QToolButton" name="addButton"> <property name="text"> - <string>Folder password-store</string> + <string>Add/Edit</string> </property> </widget> </item> <item row="0" column="1"> + <widget class="QToolButton" name="deleteButton"> + <property name="text"> + <string>Delete</string> + </property> + </widget> + </item> + <item row="2" column="3"> <widget class="QLineEdit" name="storePath"/> </item> - <item row="0" column="2"> - <widget class="QToolButton" name="toolButtonStore"> + <item row="2" column="2"> + <widget class="QLabel" name="labelStorePath"> <property name="text"> - <string>...</string> + <string>password-store</string> </property> </widget> </item> </layout> </item> - <item row="1" column="0"> + </layout> + </widget> + </item> + <item> + <widget class="QGroupBox" name="groupBox"> + <property name="title"> + <string>Other</string> + </property> + <layout class="QGridLayout" name="gridLayout_6"> + <item row="0" column="0"> <layout class="QGridLayout" name="gridLayout_7"> <item row="0" column="0"> <widget class="QCheckBox" name="checkBoxClipboard"> @@ -185,14 +275,41 @@ </widget> </item> <item> - <widget class="QDialogButtonBox" name="buttonBox"> - <property name="orientation"> - <enum>Qt::Horizontal</enum> - </property> - <property name="standardButtons"> - <set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set> - </property> - </widget> + <layout class="QHBoxLayout" name="horizontalLayout_3"> + <item> + <widget class="QLabel" name="label"> + <property name="text"> + <string><a href="http://QtPass.org/">QtPass</a> version </string> + </property> + <property name="openExternalLinks"> + <bool>true</bool> + </property> + </widget> + </item> + <item> + <spacer name="horizontalSpacer"> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>40</width> + <height>20</height> + </size> + </property> + </spacer> + </item> + <item> + <widget class="QDialogButtonBox" name="buttonBox"> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + <property name="standardButtons"> + <set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set> + </property> + </widget> + </item> + </layout> </item> </layout> </widget> @@ -200,32 +317,32 @@ <connections> <connection> <sender>buttonBox</sender> - <signal>accepted()</signal> + <signal>rejected()</signal> <receiver>Dialog</receiver> - <slot>accept()</slot> + <slot>reject()</slot> <hints> <hint type="sourcelabel"> - <x>248</x> - <y>254</y> + <x>316</x> + <y>260</y> </hint> <hint type="destinationlabel"> - <x>157</x> + <x>286</x> <y>274</y> </hint> </hints> </connection> <connection> <sender>buttonBox</sender> - <signal>rejected()</signal> + <signal>accepted()</signal> <receiver>Dialog</receiver> - <slot>reject()</slot> + <slot>accept()</slot> <hints> <hint type="sourcelabel"> - <x>316</x> - <y>260</y> + <x>248</x> + <y>254</y> </hint> <hint type="destinationlabel"> - <x>286</x> + <x>157</x> <y>274</y> </hint> </hints> diff --git a/keygendialog.cpp b/keygendialog.cpp index 9932ea26..4c5b2c5a 100644 --- a/keygendialog.cpp +++ b/keygendialog.cpp @@ -123,9 +123,10 @@ void KeygenDialog::done(int r) pi->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); ui->frame->hide(); - ui->label->setText(QString("We need to generate a lot of random bytes. It is a good idea to perform<br/>") + - "some other action (type on the keyboard, move the mouse, utilize the<br/>" + - "disks) during the prime generation; this gives the random number<br/>" + + ui->label->setText(QString("This operation can take some minutes.<br />") + + "We need to generate a lot of random bytes. It is a good idea to perform " + + "some other action (type on the keyboard, move the mouse, utilize the " + + "disks) during the prime generation; this gives the random number " + "generator a better chance to gain enough entropy."); this->layout()->addWidget(pi); diff --git a/keygendialog.ui b/keygendialog.ui index 740e80e2..95165cef 100644 --- a/keygendialog.ui +++ b/keygendialog.ui @@ -25,6 +25,9 @@ <property name="text"> <string>Generate a new key pair</string> </property> + <property name="wordWrap"> + <bool>true</bool> + </property> </widget> </item> <item> diff --git a/localization/localization_de_DE.qm b/localization/localization_de_DE.qm Binary files differindex 841b292a..8c5cbf37 100644 --- a/localization/localization_de_DE.qm +++ b/localization/localization_de_DE.qm diff --git a/localization/localization_de_DE.ts b/localization/localization_de_DE.ts index 9f78b6ad..43191548 100644 --- a/localization/localization_de_DE.ts +++ b/localization/localization_de_DE.ts @@ -9,22 +9,31 @@ <translation>Einstellungen</translation> </message> <message> + <location filename="../dialog.ui" line="44"/> + <source>gpg</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="../dialog.ui" line="58"/> + <source>git</source> + <translation type="unfinished"></translation> + </message> + <message> <location filename="../dialog.ui" line="81"/> <source>Pass</source> <translation>Pass</translation> </message> <message> - <location filename="../dialog.ui" line="64"/> + <location filename="../dialog.ui" line="51"/> <location filename="../dialog.ui" line="71"/> <location filename="../dialog.ui" line="87"/> - <location filename="../dialog.ui" line="125"/> + <location filename="../dialog.ui" line="144"/> <source>...</source> <translation type="unfinished"></translation> </message> <message> - <location filename="../dialog.ui" line="94"/> <source>Executable pass</source> - <translation>Ausführbares pass</translation> + <translation type="vanished">Ausführbares pass</translation> </message> <message> <location filename="../dialog.ui" line="38"/> @@ -42,14 +51,12 @@ <translation type="unfinished"></translation> </message> <message> - <location filename="../dialog.ui" line="50"/> <source>Executable git</source> - <translation>Ausführbares git</translation> + <translation type="vanished">Ausführbares git</translation> </message> <message> - <location filename="../dialog.ui" line="57"/> <source>Executable gpg</source> - <translation>Ausführbares gpg</translation> + <translation type="vanished">Ausführbares gpg</translation> </message> <message> <source>Native git/gpg</source> @@ -60,45 +67,176 @@ <translation type="vanished">Pass benutzen</translation> </message> <message> - <location filename="../dialog.ui" line="107"/> + <location filename="../dialog.ui" line="190"/> <source>Other</source> <translation>Weiteres</translation> </message> <message> - <location filename="../dialog.ui" line="115"/> <source>Folder password-store</source> - <translation>Ordner für Passwortspeicher</translation> + <translation type="vanished">Ordner für Passwortspeicher</translation> </message> <message> - <location filename="../dialog.ui" line="136"/> + <location filename="../dialog.ui" line="198"/> <source>Clipboard</source> <translation>Zwischenablage</translation> </message> <message> - <location filename="../dialog.ui" line="143"/> + <location filename="../dialog.ui" line="205"/> <source>Autoclear</source> <translation>Automatisch löschen</translation> </message> <message> - <location filename="../dialog.ui" line="164"/> + <location filename="../dialog.ui" line="226"/> <source>Automatically add .gpg-id files</source> <translation type="unfinished"></translation> </message> <message> - <location filename="../dialog.ui" line="176"/> + <location filename="../dialog.ui" line="238"/> <source>Seconds</source> <translation>Sekunden</translation> </message> <message> - <location filename="../dialog.ui" line="150"/> + <location filename="../dialog.ui" line="212"/> <source>Hide password</source> <translation type="unfinished"></translation> </message> <message> - <location filename="../dialog.ui" line="157"/> + <location filename="../dialog.ui" line="94"/> + <source>pass</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="../dialog.ui" line="107"/> + <source>Profiles</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="../dialog.ui" line="129"/> + <source>Name</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="../dialog.ui" line="134"/> + <source>Path</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="../dialog.ui" line="154"/> + <source>Profile name</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="../dialog.ui" line="161"/> + <source>Add/Edit</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="../dialog.ui" line="168"/> + <source>Delete</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="../dialog.ui" line="178"/> + <source>password-store</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="../dialog.ui" line="219"/> <source>Hide content</source> <translation type="unfinished"></translation> </message> + <message> + <location filename="../dialog.cpp" line="373"/> + <source>GnuPG not found</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="../dialog.cpp" line="374"/> + <source>Please install GnuPG on your system.<br>Install <strong>gpg</strong> using your favorite package manager<br>or <a href="https://www.gnupg.org/download/#sec-1-2">download</a> it from GnuPG.org</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="../dialog.cpp" line="388"/> + <source>Password store not initialised</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="../dialog.cpp" line="389"/> + <source>The folder %1 doesn't seem to be a password store or is not yet initialised.</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="../dialog.cpp" line="509"/> + <source>No profile selected</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="../dialog.cpp" line="510"/> + <source>No profile selected to delete</source> + <translation type="unfinished"></translation> + </message> +</context> +<context> + <name>KeygenDialog</name> + <message> + <location filename="../keygendialog.ui" line="14"/> + <source>Generate GnuPG keypair</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="../keygendialog.ui" line="26"/> + <source>Generate a new key pair</source> + <translation type="unfinished"></translation> + </message> |