Commit 499687b4 authored by Dan Leinir Turthra Jensen's avatar Dan Leinir Turthra Jensen 🌈
Browse files

Add functionality to open the accounts kcm on saveCredentials calls

While this usurps the method and makes it do things that are perhaps
not expected, we cannot simply save credentials directly. Furthermore,
the only place this call is currently being used is the defunct
knewstuff::upload dialog. So, to avoid API changes, we usurp the method
parent c7283f61
......@@ -8,7 +8,7 @@ ecm_qt_declare_logging_category(SRCS
add_library(attica_kde MODULE kdeplatformdependent.cpp ${SRCS})
target_include_directories(attica_kde PRIVATE ${ACCOUNTSQT_INCLUDE_DIRS})
target_link_libraries(attica_kde KF5::KIOWidgets Qt5::Widgets KF5::KCMUtils KF5::Attica KF5::I18n KAccounts ${ACCOUNTSQT_LIBRARIES})
target_link_libraries(attica_kde KF5::KIOWidgets Qt5::Widgets KF5::KCMUtils KF5::Attica KF5::I18n KF5::Service KAccounts ${ACCOUNTSQT_LIBRARIES})
install(FILES opendesktop.provider DESTINATION ${KDE_INSTALL_DATADIR}/accounts/providers/kde/)
......@@ -27,12 +27,14 @@
#include "attica_plugin_debug.h"
#include <KServiceTypeTrader>
#include <KConfigGroup>
#include <KCMultiDialog>
#include <KLocalizedString>
#include <KStringHandler>
#include <KMessageBox>
#include <QNetworkDiskCache>
#include <QProcess>
#include <QStorageInfo>
#include <KAccounts/Core>
......@@ -83,18 +85,16 @@ QNetworkRequest KdePlatformDependent::removeAuthFromRequest(const QNetworkReques
bool KdePlatformDependent::saveCredentials(const QUrl& /*baseUrl*/, const QString& /*user*/, const QString& /*password*/)
return false;
// TODO This wants to be replaced by something which opens the kcm to create a new account, but for now we'll have to trust what we're given
// Currently only used by the upload dialog (which doesn't work, because we have uploading disabled on
// Accounts::Manager* accountsManager = KAccounts::accountsManager();
// if (accountsManager) {
// Accounts::AccountIdList accountIds = accountsManager->accountList(QStringLiteral("opendesktop-rating"));
// } else {
// // if no accounts manager, return false and tell user
// return false;
// }
// // if all is well, return true
// return true;
// TODO KF6 This will want replacing with a call named something that suggests calling it shows accounts (and perhaps
// directly requests the accounts kcm to start adding a new account if it's not there, maybe even pre-fills the fields...)
KService::List services = KServiceTypeTrader::self()->query(QStringLiteral("Service"), QStringLiteral("Library == 'kcm_kaccounts'"));
// If we failed to get the kcm, tell the caller we failed
if (services.count() == 0) {
return false;
KService::Ptr service = services[0];
qCDebug(ATTICA_PLUGIN_LOG) << "Launch the KAccounts control module" << service->name();
return QProcess::startDetached(service->exec());
static Accounts::Account* getAccount(const QUrl& /*baseUrl*/) {
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