diff --git a/dbus/org.nemo.ssu.xml b/dbus/org.nemo.ssu.xml index 291f630..9e5a644 100644 --- a/dbus/org.nemo.ssu.xml +++ b/dbus/org.nemo.ssu.xml @@ -88,6 +88,10 @@ + + + + diff --git a/libssu/ssu.cpp b/libssu/ssu.cpp index db5cf8b..947884d 100644 --- a/libssu/ssu.cpp +++ b/libssu/ssu.cpp @@ -609,23 +609,13 @@ void Ssu::updateCredentials(bool force){ manager->get(request); } -void Ssu::updateStoreCredentials(){ - QDBusMessage message = QDBusMessage::createMethodCall("com.jolla.jollastore", - "/StoreClient", - "com.jolla.jollastore", - "storeCredentials"); - QDBusPendingReply reply = QDBusConnection::sessionBus().asyncCall(message); - reply.waitForFinished(); - if (reply.isError()) { - setError(QString("Store credentials not received. %1").arg(reply.error().message())); - } else { - SsuCoreConfig *settings = SsuCoreConfig::instance(); - settings->beginGroup("credentials-store"); - settings->setValue("username", reply.argumentAt<0>()); - settings->setValue("password", reply.argumentAt<1>()); - settings->endGroup(); - settings->sync(); - } +void Ssu::updateStoreCredentials(const QString &userName, const QString &accessToken){ + SsuCoreConfig *settings = SsuCoreConfig::instance(); + settings->beginGroup("credentials-store"); + settings->setValue("username", userName); + settings->setValue("password", accessToken); + settings->endGroup(); + settings->sync(); } void Ssu::unregister(){ diff --git a/libssu/ssu.h b/libssu/ssu.h index 816d412..8a67740 100644 --- a/libssu/ssu.h +++ b/libssu/ssu.h @@ -180,7 +180,7 @@ class Ssu: public QObject { /** * Try to update credentials for (Jolla) store */ - void updateStoreCredentials(); + void updateStoreCredentials(const QString &userName, const QString &accessToken); signals: /** diff --git a/ssud/ssud.cpp b/ssud/ssud.cpp index 2816db1..8678afe 100644 --- a/ssud/ssud.cpp +++ b/ssud/ssud.cpp @@ -194,3 +194,8 @@ void Ssud::updateRepos(){ repoManager.update(); autoclose.start(); } + +void Ssud::updateStoreCredentials(const QString &userName, const QString &accessToken){ + ssu.updateStoreCredentials(userName, accessToken); + autoclose.start(); +} diff --git a/ssud/ssud.h b/ssud/ssud.h index 5537835..1e209a7 100644 --- a/ssud/ssud.h +++ b/ssud/ssud.h @@ -42,6 +42,7 @@ class Ssud: public QObject { void modifyRepo(int action, const QString &repo); void addRepo(const QString &repo, const QString &url); void updateRepos(); + void updateStoreCredentials(const QString &userName, const QString &accessToken); bool error(); QString lastError(); diff --git a/ssuurlresolver/ssuurlresolver.cpp b/ssuurlresolver/ssuurlresolver.cpp index 7699829..43c35e1 100644 --- a/ssuurlresolver/ssuurlresolver.cpp +++ b/ssuurlresolver/ssuurlresolver.cpp @@ -139,11 +139,12 @@ void SsuUrlResolver::run(){ // store-auth-repos domain setting use store credentials. Refresh // here, as we only know after checking scope if we need to have // store credentials at all - if (credentialsScope == "store"){ - ssu.updateStoreCredentials(); - if (ssu.error()) - error (ssu.lastError()); - } + + // store-client updates the store credentials via dbus call on + // every startup (or sign in to be precise). + // TODO: Is there need to check that the credentials were really + // set by store-client? + headerList.append(QString("credentials=%1").arg(credentialsScope)); writeZyppCredentialsIfNeeded(credentialsScope); } else