aboutsummaryrefslogtreecommitdiffstats
path: root/keylist.cpp
diff options
context:
space:
mode:
authorubbo <ubbo@34ebc366-c3a9-4b3c-9f84-69acf7962910>2008-09-29 15:00:38 +0000
committerubbo <ubbo@34ebc366-c3a9-4b3c-9f84-69acf7962910>2008-09-29 15:00:38 +0000
commitaf01d3404fa1d8d340e0ab45dc9202f933407fad (patch)
tree0ac8857c843c5ed2894b47da8afc53e79b9878e1 /keylist.cpp
parentsome code-reorganisation in keylist.cpp (diff)
downloadgpg4usb-af01d3404fa1d8d340e0ab45dc9202f933407fad.tar.gz
gpg4usb-af01d3404fa1d8d340e0ab45dc9202f933407fad.zip
moved keydelete-action from keylist to gpgwin
git-svn-id: http://cpunk.de/svn/src/gpg4usb/trunk@176 34ebc366-c3a9-4b3c-9f84-69acf7962910
Diffstat (limited to 'keylist.cpp')
-rw-r--r--keylist.cpp36
1 files changed, 9 insertions, 27 deletions
diff --git a/keylist.cpp b/keylist.cpp
index 22903c5..e6606ec 100644
--- a/keylist.cpp
+++ b/keylist.cpp
@@ -46,17 +46,13 @@ KeyList::KeyList(QWidget *parent)
m_keyList->setHorizontalHeaderLabels(labels);
m_keyList->horizontalHeader()->setStretchLastSection(true);
- m_deleteButton = new QPushButton(tr("Delete Checked Keys"));
-
- connect(m_deleteButton, SIGNAL(clicked()), this, SLOT(deleteCheckedKeys()));
-
QVBoxLayout *layout = new QVBoxLayout;
layout->addWidget(m_keyList);
- layout->addWidget(m_deleteButton);
layout->setContentsMargins(0, 0, 0, 0);
layout->setSpacing(3);
setLayout(layout);
- createActions();
+
+ popupMenu = new QMenu(this);
}
@@ -71,13 +67,6 @@ void KeyList::setIconPath(QString path)
this->iconPath = path;
}
-void KeyList::contextMenuEvent(QContextMenuEvent *event)
-{
- QMenu menu(this);
- menu.addAction(deleteSelectedKeysAct);
- menu.exec(event->globalPos());
-}
-
void KeyList::refresh()
{
// while filling the table, sort enabled causes errors
@@ -120,6 +109,7 @@ QList<QString> *KeyList::getChecked()
QList<QString> *ret = new QList<QString>();
for (int i = 0; i < m_keyList->rowCount(); i++) {
if (m_keyList->item(i,0)->checkState() == Qt::Checked) {
+ qDebug() << m_keyList->item(i,4)->text();
*ret << m_keyList->item(i,4)->text();
}
}
@@ -138,25 +128,17 @@ QList<QString> *KeyList::getSelected()
return ret;
}
-void KeyList::deleteCheckedKeys()
+void KeyList::setColumnWidth(int row, int size)
{
-
- m_ctx->deleteKeys(getChecked());
- refresh();
-
+ m_keyList->setColumnWidth(row, size);
}
-void KeyList::deleteSelectedKeys()
+void KeyList::contextMenuEvent(QContextMenuEvent *event)
{
-
- m_ctx->deleteKeys(getSelected());
- refresh();
-
+ popupMenu->exec(event->globalPos());
}
-void KeyList::createActions()
+void KeyList::addMenuAction(QAction *act)
{
- deleteSelectedKeysAct = new QAction(tr("Delete Key"), this);
- deleteSelectedKeysAct->setStatusTip(tr("Delete the selected keys"));
- connect(deleteSelectedKeysAct, SIGNAL(triggered()), this, SLOT(deleteSelectedKeys()));
+ popupMenu->addAction(act);
}