Commit 43ce76a8 authored by Carl Schwan's avatar Carl Schwan 🚴
Browse files

Handle kwallet not being enabled

If kwallet is disabled, we notify the user instead of silently failing.
This is done by ensuring that the kwallet !== null check send a signal
and that we send this signal after having connected the slots

Fix: kalendar#207
BUG: 450693



Signed-off-by: Carl Schwan's avatarCarl Schwan <carl@carlschwan.eu>
parent 42684d04
Pipeline #244175 passed with stage
in 17 minutes and 13 seconds
......@@ -72,6 +72,8 @@ GoogleResource::GoogleResource(const QString &id)
changeRecorder()->fetchCollection(true);
changeRecorder()->collectionFetchScope().setAncestorRetrieval(CollectionFetchScope::All);
Q_EMIT status(NotConfigured, i18n("Waiting for KWallet..."));
m_settings = new GoogleSettings();
m_settings->setWindowId(winIdForDialogs());
connect(m_settings, &GoogleSettings::accountReady, this, [this](bool ready) {
......@@ -96,8 +98,8 @@ GoogleResource::GoogleResource(const QString &id)
synchronize();
}
});
m_settings->init();
Q_EMIT status(NotConfigured, i18n("Waiting for KWallet..."));
updateResourceName();
m_freeBusyHandler = std::make_unique<FreeBusyHandler>(m_iface, m_settings);
......
......@@ -9,6 +9,8 @@
#include "googleresource_debug.h"
#include <KGAPI/Account>
#include <KLocalizedString>
#include <KMessageBox>
#include <KWallet>
using namespace KWallet;
......@@ -19,9 +21,14 @@ static const QString googleWalletFolder = QStringLiteral("Akonadi Google");
GoogleSettings::GoogleSettings()
{
m_wallet = Wallet::openWallet(Wallet::NetworkWallet(), m_winId, Wallet::Asynchronous);
}
void GoogleSettings::init()
{
if (m_wallet) {
connect(m_wallet.data(), &Wallet::walletOpened, this, &GoogleSettings::slotWalletOpened);
} else {
Q_EMIT accountReady(false);
qCWarning(GOOGLE_LOG) << "Failed to open wallet!";
}
}
......
......@@ -33,6 +33,7 @@ class GoogleSettings : public SettingsBase
public:
GoogleSettings();
void init();
void setWindowId(WId id);
void setResourceId(const QString &resourceIdentifier);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment