From e4b468e233db8364de3d7b8cd63fe99a7987a80d Mon Sep 17 00:00:00 2001 From: Puneeth Chanda Date: Sat, 15 Feb 2020 16:02:44 +0100 Subject: [PATCH] Prompt user when KWallet is disabled Summary: From now, when the user saves the password by clicking remember he will get a notification that the password is saved. Reviewers: SGOrava, drosca Reviewed By: SGOrava, drosca Subscribers: drosca, alukichev, falkon Tags: #falkon Differential Revision: https://phabricator.kde.org/D26932 --- .../kwalletpasswordbackend.cpp | 16 ++++++++++++++++ .../kwalletpasswordbackend.h | 1 + 2 files changed, 17 insertions(+) diff --git a/src/plugins/KDEFrameworksIntegration/kwalletpasswordbackend.cpp b/src/plugins/KDEFrameworksIntegration/kwalletpasswordbackend.cpp index 6b430af9c..620233936 100644 --- a/src/plugins/KDEFrameworksIntegration/kwalletpasswordbackend.cpp +++ b/src/plugins/KDEFrameworksIntegration/kwalletpasswordbackend.cpp @@ -19,6 +19,7 @@ #include "kdeframeworksintegrationplugin.h" #include "mainapplication.h" #include "browserwindow.h" +#include "desktopnotificationsfactory.h" #include @@ -83,6 +84,7 @@ void KWalletPasswordBackend::addEntry(const PasswordEntry &entry) initialize(); if (!m_wallet) { + showErrorNotification(); return; } @@ -99,6 +101,7 @@ bool KWalletPasswordBackend::updateEntry(const PasswordEntry &entry) initialize(); if (!m_wallet) { + showErrorNotification(); return false; } @@ -119,6 +122,7 @@ void KWalletPasswordBackend::updateLastUsed(PasswordEntry &entry) initialize(); if (!m_wallet) { + showErrorNotification(); return; } @@ -140,6 +144,7 @@ void KWalletPasswordBackend::removeEntry(const PasswordEntry &entry) initialize(); if (!m_wallet) { + showErrorNotification(); return; } @@ -157,6 +162,7 @@ void KWalletPasswordBackend::removeAll() initialize(); if (!m_wallet) { + showErrorNotification(); return; } @@ -166,6 +172,16 @@ void KWalletPasswordBackend::removeAll() m_wallet->createFolder("Falkon"); } +void KWalletPasswordBackend::showErrorNotification() +{ + static bool initialized; + + if (!initialized) { + initialized = true; + mApp->desktopNotifications()->showNotification(KDEFrameworksIntegrationPlugin::tr("KWallet disabled"), KDEFrameworksIntegrationPlugin::tr("Please enable KWallet to save password.")); + } +} + void KWalletPasswordBackend::initialize() { if (m_wallet) { diff --git a/src/plugins/KDEFrameworksIntegration/kwalletpasswordbackend.h b/src/plugins/KDEFrameworksIntegration/kwalletpasswordbackend.h index 1785e219c..e4ccaf287 100644 --- a/src/plugins/KDEFrameworksIntegration/kwalletpasswordbackend.h +++ b/src/plugins/KDEFrameworksIntegration/kwalletpasswordbackend.h @@ -47,6 +47,7 @@ public: private: void initialize(); + void showErrorNotification(); KWallet::Wallet* m_wallet; QVector m_allEntries;