1
mirror of https://invent.kde.org/network/falkon.git synced 2024-11-14 02:52:12 +01:00

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
This commit is contained in:
Puneeth Chanda 2020-02-15 16:02:44 +01:00 committed by Juraj Oravec
parent 0e25b116cb
commit e4b468e233
2 changed files with 17 additions and 0 deletions

View File

@ -19,6 +19,7 @@
#include "kdeframeworksintegrationplugin.h" #include "kdeframeworksintegrationplugin.h"
#include "mainapplication.h" #include "mainapplication.h"
#include "browserwindow.h" #include "browserwindow.h"
#include "desktopnotificationsfactory.h"
#include <QDateTime> #include <QDateTime>
@ -83,6 +84,7 @@ void KWalletPasswordBackend::addEntry(const PasswordEntry &entry)
initialize(); initialize();
if (!m_wallet) { if (!m_wallet) {
showErrorNotification();
return; return;
} }
@ -99,6 +101,7 @@ bool KWalletPasswordBackend::updateEntry(const PasswordEntry &entry)
initialize(); initialize();
if (!m_wallet) { if (!m_wallet) {
showErrorNotification();
return false; return false;
} }
@ -119,6 +122,7 @@ void KWalletPasswordBackend::updateLastUsed(PasswordEntry &entry)
initialize(); initialize();
if (!m_wallet) { if (!m_wallet) {
showErrorNotification();
return; return;
} }
@ -140,6 +144,7 @@ void KWalletPasswordBackend::removeEntry(const PasswordEntry &entry)
initialize(); initialize();
if (!m_wallet) { if (!m_wallet) {
showErrorNotification();
return; return;
} }
@ -157,6 +162,7 @@ void KWalletPasswordBackend::removeAll()
initialize(); initialize();
if (!m_wallet) { if (!m_wallet) {
showErrorNotification();
return; return;
} }
@ -166,6 +172,16 @@ void KWalletPasswordBackend::removeAll()
m_wallet->createFolder("Falkon"); 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() void KWalletPasswordBackend::initialize()
{ {
if (m_wallet) { if (m_wallet) {

View File

@ -47,6 +47,7 @@ public:
private: private:
void initialize(); void initialize();
void showErrorNotification();
KWallet::Wallet* m_wallet; KWallet::Wallet* m_wallet;
QVector<PasswordEntry> m_allEntries; QVector<PasswordEntry> m_allEntries;