summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndre Heinecke <aheinecke@intevation.de>2016-08-10 15:47:39 (GMT)
committerAndre Heinecke <aheinecke@intevation.de>2016-08-10 15:49:24 (GMT)
commit510c82fdac8024ff9acc84ad26ffba9219f8d227 (patch)
tree3e52dc789d3e5b4e5f3578740957a91ea240ea4f
parent22f45112022b0373b4abfa1af319fa31c5e97839 (diff)
Fix default key selection for initalized keycache
If the keycache was already initialized we now also emit keyListingFinished so that code relining on that signal works regardless of the cache state. The default key and current index selection now depends on that signal.
-rw-r--r--src/ui/keyselectioncombo.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/ui/keyselectioncombo.cpp b/src/ui/keyselectioncombo.cpp
index 184cbc9..aa21326 100644
--- a/src/ui/keyselectioncombo.cpp
+++ b/src/ui/keyselectioncombo.cpp
@@ -284,6 +284,11 @@ void KeySelectionCombo::init()
d->model->useKeyCache(true, true);
d->proxyModel->removeCustomItem(QStringLiteral("-libkleo-loading-keys"));
setEnabled(d->wasEnabled);
+ Q_EMIT keyListingFinished();
+ });
+
+ connect(this, &KeySelectionCombo::keyListingFinished,
+ this, [this]() {
bool match = false;
for (int i = 0; i < count(); ++i) {
const GpgME::Key key = itemData(i, Kleo::AbstractKeyListModel::KeyRole).value<GpgME::Key>();
@@ -296,13 +301,13 @@ void KeySelectionCombo::init()
if (!match) {
setCurrentIndex(0);
}
- Q_EMIT keyListingFinished();
});
if (!d->cache->initialized()) {
refreshKeys();
} else {
d->model->useKeyCache(true, true);
+ Q_EMIT keyListingFinished();
}
}