aboutsummaryrefslogtreecommitdiffstats
path: root/src/ui/widgets/KeyList.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/ui/widgets/KeyList.cpp')
-rw-r--r--src/ui/widgets/KeyList.cpp17
1 files changed, 16 insertions, 1 deletions
diff --git a/src/ui/widgets/KeyList.cpp b/src/ui/widgets/KeyList.cpp
index 2082bbc9..27e57817 100644
--- a/src/ui/widgets/KeyList.cpp
+++ b/src/ui/widgets/KeyList.cpp
@@ -86,6 +86,9 @@ KeyList::KeyList(GpgME::GpgContext *ctx,
setLayout(layout);
popupMenu = new QMenu(this);
+
+ connect(mKeyList, SIGNAL(doubleClicked(const QModelIndex &)),
+ this, SLOT(slotDoubleClicked(const QModelIndex &)));
connect(mCtx, SIGNAL(signalKeyInfoChanged()), this, SLOT(slotRefresh()));
setAcceptDrops(true);
slotRefresh();
@@ -434,5 +437,17 @@ void KeyList::setExcludeKeys(std::initializer_list<QString> key_ids) {
}
void KeyList::setFilter(std::function<bool(const GpgKey &)> filter) {
- this->mFilter = filter;
+ this->mFilter = std::move(filter);
+}
+
+void KeyList::slotDoubleClicked(const QModelIndex &index) {
+ if(mAction != nullptr) {
+ const auto &key = mCtx->getKeyById(buffered_keys[index.row()].id);
+ mAction(key, this);
+ }
+
+}
+
+void KeyList::setDoubleClickedAction(std::function<void(const GpgKey &, QWidget *)> action) {
+ this->mAction = std::move(action);
}