diff options
author | Anne Jan Brouwer <annejan@noprotocol.com> | 2015-06-11 22:40:24 +0200 |
---|---|---|
committer | Anne Jan Brouwer <annejan@noprotocol.com> | 2015-06-11 22:40:24 +0200 |
commit | 1e99c98063d4069999c0e6f6ed58a55ed5d21a61 (patch) | |
tree | 15c64bf80b32ce787d3f21109e2cd955b20adaff | |
parent | 11d5a5673fa0af50d1cd74fdf13d07841c9ec4b3 (diff) | |
parent | 0b9b4682214c6394af99e47f28242a93f57898f0 (diff) |
Merge branch 'develop'
-rw-r--r-- | dialog.cpp | 41 | ||||
-rw-r--r-- | dialog.h | 1 | ||||
-rw-r--r-- | dialog.ui | 42 |
3 files changed, 20 insertions, 64 deletions
@@ -388,8 +388,7 @@ void Dialog::setProfiles(QHash<QString, QString> profiles, QString profile) 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()); + ui->profileTable->selectRow(n); } } n++; @@ -419,43 +418,11 @@ QHash<QString, QString> Dialog::getProfiles() */ 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)); + int n = ui->profileTable->rowCount(); + ui->profileTable->insertRow(n); ui->profileTable->setItem(n, 1, new QTableWidgetItem(ui->storePath->text())); - //qDebug() << ui->profileName->text(); ui->profileTable->selectRow(n); - if (ui->profileTable->rowCount() > 0) { - 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()); + ui->deleteButton->setEnabled(true); } /** @@ -61,7 +61,6 @@ private slots: void on_checkBoxClipboard_clicked(); void on_checkBoxAutoclear_clicked(); void on_addButton_clicked(); - void on_profileTable_currentItemChanged(QTableWidgetItem*); void on_deleteButton_clicked(); void on_checkBoxUseTrayIcon_clicked(); @@ -6,8 +6,8 @@ <rect> <x>0</x> <y>0</y> - <width>495</width> - <height>501</height> + <width>497</width> + <height>527</height> </rect> </property> <property name="windowTitle"> @@ -138,7 +138,7 @@ <item> <widget class="QTableWidget" name="profileTable"> <property name="editTriggers"> - <set>QAbstractItemView::NoEditTriggers</set> + <set>QAbstractItemView::DoubleClicked|QAbstractItemView::EditKeyPressed|QAbstractItemView::SelectedClicked</set> </property> <property name="alternatingRowColors"> <bool>true</bool> @@ -166,27 +166,10 @@ </item> <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="QToolButton" name="addButton"> <property name="text"> - <string>Add/Edit</string> + <string>Add</string> </property> </widget> </item> @@ -197,16 +180,23 @@ </property> </widget> </item> - <item row="2" column="3"> - <widget class="QLineEdit" name="storePath"/> - </item> - <item row="2" column="2"> + <item row="0" column="2"> <widget class="QLabel" name="labelStorePath"> <property name="text"> - <string>password-store</string> + <string>Current password-store</string> + </property> + </widget> + </item> + <item row="0" column="4"> + <widget class="QToolButton" name="toolButtonStore"> + <property name="text"> + <string>...</string> </property> </widget> </item> + <item row="0" column="3"> + <widget class="QLineEdit" name="storePath"/> + </item> </layout> </item> </layout> |