summaryrefslogtreecommitdiff
path: root/net-im/psi/files/9f0f3d083f025cdd501ef6e2b5e74442182e4fdf.diff
blob: c8898a5d3cc2044b630f6430c5e441a480a6ece4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
diff --git a/src/main.cpp b/src/main.cpp
index ddcc756d..c3664b64 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -555,7 +555,22 @@ int main(int argc, char *argv[])
 	QCA::setProperty("pgp-always-trust", true);
 	QCA::KeyStoreManager keystoremgr;
 	QCA::KeyStoreManager::start();
-	keystoremgr.waitForBusyFinished(); // FIXME get rid of this
+	QTimer keystoremgrTimeout;
+	if(keystoremgr.isBusy()) {
+		keystoremgrTimeout.setTimerType(Qt::VeryCoarseTimer);
+		keystoremgrTimeout.setSingleShot(true);
+		keystoremgrTimeout.setInterval(7500);
+		keystoremgrTimeout.start();
+		QObject::connect(&keystoremgr, &QCA::KeyStoreManager::busyFinished, &keystoremgrTimeout, &QTimer::stop);
+		QObject::connect(&keystoremgrTimeout, &QTimer::timeout, [] {
+			QMessageBox::warning(nullptr,
+								 QApplication::applicationName(),
+								 QApplication::translate("main",
+														 "The keystore manager provided by QCA takes longer to load than usual."
+														 " Maybe <i>gpg</i> hangs.<br><br>"
+														 "Note that login via TLS and OpenPGP related features require the keystore manager."));
+		});
+	}
 
 #ifdef USE_CRASH
 	int useCrash = !cmdline.contains("nocrash");
diff --git a/src/pgputil.cpp b/src/pgputil.cpp
index 5ae4be18..866d3510 100644
--- a/src/pgputil.cpp
+++ b/src/pgputil.cpp
@@ -15,12 +15,9 @@ PGPUtil::PGPUtil() : qcaEventHandler_(NULL), passphraseDlg_(NULL), cache_no_pgp_
 	qcaEventHandler_ = new QCA::EventHandler(this);
 	connect(qcaEventHandler_,SIGNAL(eventReady(int,const QCA::Event&)),SLOT(handleEvent(int,const QCA::Event&)));
 	qcaEventHandler_->start();
-	qcaKeyStoreManager_.waitForBusyFinished(); // FIXME get rid of this
 	connect(&qcaKeyStoreManager_, SIGNAL(keyStoreAvailable(const QString&)), SLOT(keyStoreAvailable(const QString&)));
-	foreach(QString k, qcaKeyStoreManager_.keyStores()) {
-		QCA::KeyStore* ks = new QCA::KeyStore(k, &qcaKeyStoreManager_);
-		connect(ks, SIGNAL(updated()), SIGNAL(pgpKeysUpdated()));
-		keystores_ += ks;
+	foreach(const QString& k, qcaKeyStoreManager_.keyStores()) {
+		keyStoreAvailable(k);
 	}
 
 	connect(QCoreApplication::instance(),SIGNAL(aboutToQuit()),SLOT(deleteLater()));