Commit b48fad8e authored by Bernd Wachter's avatar Bernd Wachter

Merge pull request #24 from kananoja/store_credentials

[jolla] Resolve store credentials from store-client via dbus
parents be3f8805 603c68bd
......@@ -7,6 +7,9 @@
#include <QtNetwork>
#include <QtXml/QDomDocument>
#include <QDBusConnection>
#include <QDBusMessage>
#include <QDBusPendingReply>
#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
#include <QUrlQuery>
......@@ -586,18 +589,22 @@ void Ssu::updateCredentials(bool force){
}
void Ssu::updateStoreCredentials(){
SsuCoreConfig *settings = SsuCoreConfig::instance();
QString username, password;
// TODO:
// - get values for username/password from store
// - use setError() to set error state if credentials can't be received
settings->beginGroup("credentials-store");
settings->setValue("username", username);
settings->setValue("password", password);
settings->endGroup();
settings->sync();
QDBusMessage message = QDBusMessage::createMethodCall("com.jolla.jollastore",
"/StoreClient",
"com.jolla.jollastore",
"storeCredentials");
QDBusPendingReply<QString, QString> 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::unregister(){
......
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