aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorubbo <ubbo@34ebc366-c3a9-4b3c-9f84-69acf7962910>2008-09-20 13:37:07 +0000
committerubbo <ubbo@34ebc366-c3a9-4b3c-9f84-69acf7962910>2008-09-20 13:37:07 +0000
commit9c9b15fb270cc39cc64742955b07bfe5dc3d80b6 (patch)
tree18f532a7e2767e0f6d2ce8a7db13045dc88a0ecd
parentported r159-r162 (QTableWidget in Keylist, fix for undefined int in keylist) ... (diff)
downloadgpg4usb-9c9b15fb270cc39cc64742955b07bfe5dc3d80b6.tar.gz
gpg4usb-9c9b15fb270cc39cc64742955b07bfe5dc3d80b6.zip
keylist.cpp: ported r169 (set items not editable / no focus) from trunk
git-svn-id: http://cpunk.de/svn/src/gpg4usb/branches/0.1@170 34ebc366-c3a9-4b3c-9f84-69acf7962910
-rw-r--r--keylist.cpp37
1 files changed, 21 insertions, 16 deletions
diff --git a/keylist.cpp b/keylist.cpp
index c4a62a0..d4a0163 100644
--- a/keylist.cpp
+++ b/keylist.cpp
@@ -38,7 +38,12 @@ KeyList::KeyList(QWidget *parent)
m_keyList->sortByColumn(2,Qt::AscendingOrder);
m_keyList->setSelectionBehavior(QAbstractItemView::SelectRows);
m_keyList->setColumnHidden(4, true);
-
+ // tableitems not editable
+ m_keyList->setEditTriggers(QAbstractItemView::NoEditTriggers);
+ // no focus (rectangle around tableitems)
+ // may be it should focus on whole row
+ m_keyList->setFocusPolicy(Qt::NoFocus);
+
m_deleteButton = new QPushButton(tr("Delete Checked Keys"));
connect(m_deleteButton, SIGNAL(clicked()), this, SLOT(deleteKeys()));
@@ -72,26 +77,26 @@ void KeyList::contextMenuEvent(QContextMenuEvent *event)
void KeyList::refresh()
{
m_keyList->clear();
-
- QStringList labels;
- labels << "" << "" << "Name" << "EMail" << "id";
- m_keyList->setHorizontalHeaderLabels(labels);
-
+
+ QStringList labels;
+ labels << "" << "" << "Name" << "EMail" << "id";
+ m_keyList->setHorizontalHeaderLabels(labels);
+
GpgKeyList keys = m_ctx->listKeys();
m_keyList->setRowCount(keys.size());
- QTableWidgetItem *tmp;
+ QTableWidgetItem *tmp;
int row=0;
GpgKeyList::iterator it = keys.begin();
while (it != keys.end()) {
-
- tmp = new QTableWidgetItem();
- tmp->setFlags(Qt::ItemIsUserCheckable | Qt::ItemIsEnabled | Qt::ItemIsSelectable);
+
+ tmp = new QTableWidgetItem();
+ tmp->setFlags(Qt::ItemIsUserCheckable | Qt::ItemIsEnabled | Qt::ItemIsSelectable);
tmp->setCheckState(Qt::Unchecked);
- m_keyList->setItem(row, 0, tmp);
-
+ m_keyList->setItem(row, 0, tmp);
+
if(it->privkey) {
- tmp = new QTableWidgetItem(QIcon(iconPath + "kgpg_key2.png"),"");
- m_keyList->setItem(row, 1, tmp);
+ tmp = new QTableWidgetItem(QIcon(iconPath + "kgpg_key2.png"),"");
+ m_keyList->setItem(row, 1, tmp);
}
tmp = new QTableWidgetItem(it->name);
tmp->setToolTip(it->name);
@@ -100,7 +105,7 @@ void KeyList::refresh()
tmp->setToolTip(it->email);
m_keyList->setItem(row, 3, tmp);
tmp = new QTableWidgetItem(it->id);
- m_keyList->setItem(row, 4, tmp);
+ m_keyList->setItem(row, 4, tmp);
it++;
++row;
}
@@ -122,7 +127,7 @@ QList<QString> *KeyList::getChecked()
QList<QString> *KeyList::getSelected()
{
QList<QString> *ret = new QList<QString>();
-
+
for (int i = 0; i < m_keyList->rowCount(); i++) {
if (m_keyList->item(i,0)->isSelected() == 1) {
*ret << m_keyList->item(i,4)->text();