Skip to content
Snippets Groups Projects
Commit 6d2593bc authored by Jan Grulich's avatar Jan Grulich
Browse files

Do not keep trying to open KWallet if we failed before

REVIEW:120313
BUG:339223
parent 21d62fa2
No related branches found
Tags v5.0.95
No related merge requests found
......@@ -42,10 +42,11 @@
#include <KWallet/Wallet>
#include <QDebug>
SecretAgent::SecretAgent(QObject* parent):
NetworkManager::SecretAgent("org.kde.plasma.networkmanagement", parent),
m_wallet(0),
m_dialog(0)
SecretAgent::SecretAgent(QObject* parent)
: NetworkManager::SecretAgent("org.kde.plasma.networkmanagement", parent)
, m_openWalletFailed(false)
, m_wallet(0)
, m_dialog(0)
{
connect(NetworkManager::notifier(), &NetworkManager::Notifier::serviceDisappeared, this, &SecretAgent::killDialogs);
......@@ -251,9 +252,13 @@ void SecretAgent::killDialogs()
void SecretAgent::walletOpened(bool success)
{
if (!success) {
m_openWalletFailed = true;
m_wallet->deleteLater();
m_wallet = 0;
} else {
m_openWalletFailed = false;
}
processNext();
}
......@@ -453,6 +458,13 @@ bool SecretAgent::useWallet() const
return true;
}
/* If opening of KWallet failed before, we should not try to open it again and
* we should return false instead */
if (m_openWalletFailed) {
m_openWalletFailed = false;
return false;
}
if (KWallet::Wallet::isEnabled()) {
m_wallet = KWallet::Wallet::openWallet(KWallet::Wallet::LocalWallet(), 0, KWallet::Wallet::Asynchronous);
if (m_wallet) {
......
......@@ -113,6 +113,7 @@ private:
bool hasSecrets(const NMVariantMapMap &connection) const;
void sendSecrets(const NMVariantMapMap &secrets, const QDBusMessage &message) const;
mutable bool m_openWalletFailed;
mutable KWallet::Wallet *m_wallet;
mutable PasswordDialog *m_dialog;
QList<SecretsRequest> m_calls;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment