Members of the KDE Community are recommended to subscribe to the kde-community mailing list at https://mail.kde.org/mailman/listinfo/kde-community to allow them to participate in important discussions and receive other important announcements

Commit cfcd545b authored by Michael Pyne's avatar Michael Pyne

scrobbler: Don't prompt to unlock KWallet if not using scrobbler.

A prior code cleanup started trying to open the default KWallet
automatically, skipping the existing check for whether scrobbling is
enabled. Instead of reverting, add the check to the wallet opening code,
which already has to handle the possibility of failure.
parent 436b0069
......@@ -83,23 +83,24 @@ std::unique_ptr<KWallet::Wallet> Scrobbler::openKWallet() // static
{
using KWallet::Wallet;
const QString walletFolderName = "JuK";
std::unique_ptr<Wallet> wallet(Wallet::openWallet(
Wallet::LocalWallet(),
JuK::JuKInstance()->winId()));
if(wallet) {
if(!wallet->hasFolder(walletFolderName) &&
!wallet->createFolder(walletFolderName))
{
const QString walletFolderName(QStringLiteral("JuK"));
const auto walletName = Wallet::LocalWallet();
// checks without prompting to open the wallet
if (Wallet::folderDoesNotExist(walletName, walletFolderName)) {
return nullptr;
}
if(!wallet->setFolder(walletFolderName))
std::unique_ptr<Wallet> wallet(
Wallet::openWallet(walletName, JuK::JuKInstance()->winId()));
if(!wallet ||
(!wallet->hasFolder(walletFolderName) &&
!wallet->createFolder(walletFolderName)) ||
!wallet->setFolder(walletFolderName))
{
return nullptr;
}
}
return wallet;
}
......
Markdown is supported
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