summaryrefslogtreecommitdiffstats
path: root/desktop-widgets
diff options
context:
space:
mode:
authorGravatar jan Iversen <jani@apache.org>2018-07-23 17:49:12 +0200
committerGravatar Dirk Hohndel <dirk@hohndel.org>2018-07-27 12:36:20 -0700
commitf175890632d5845d57066b0669c347b4c0992ff9 (patch)
treeefe856eb90e077c64f990b5ec5681c95eed7c866 /desktop-widgets
parente0f1817fdc3b0024c5e97cfa0db048384aae6d78 (diff)
downloadsubsurface-f175890632d5845d57066b0669c347b4c0992ff9.tar.gz
core: activate qPrefFacebook
remove Facebook from SettingsObjectWrapper and reference qPrefFacebook update files using SettingsObjectWrapper/Facebook to use qPrefFacebook this activated qPrefFacebook and removed the similar class from SettingsObjectWrapper. Signed-off-by: Jan Iversen <jani@apache.org>
Diffstat (limited to 'desktop-widgets')
-rw-r--r--desktop-widgets/plugins/facebook/facebookconnectwidget.cpp30
1 files changed, 15 insertions, 15 deletions
diff --git a/desktop-widgets/plugins/facebook/facebookconnectwidget.cpp b/desktop-widgets/plugins/facebook/facebookconnectwidget.cpp
index 1600556f0..d76cc88cd 100644
--- a/desktop-widgets/plugins/facebook/facebookconnectwidget.cpp
+++ b/desktop-widgets/plugins/facebook/facebookconnectwidget.cpp
@@ -88,18 +88,18 @@ void FacebookManager::tryLogin(const QUrl& loginResponse)
int to = result.indexOf("&expires_in");
QString securityToken = result.mid(from, to-from);
- auto fb = SettingsObjectWrapper::instance()->facebook;
- fb->setAccessToken(securityToken);
+ auto fb = qPrefFacebook::instance();
+ fb->set_access_token(securityToken);
qCDebug(lcFacebook) << "Got securityToken" << securityToken;
requestUserId();
}
void FacebookManager::logout()
{
- auto fb = SettingsObjectWrapper::instance()->facebook;
- fb->setAccessToken(QString());
- fb->setUserId(QString());
- fb->setAlbumId(QString());
+ auto fb = qPrefFacebook::instance();
+ fb->set_access_token(QString());
+ fb->set_user_id(QString());
+ fb->set_album_id(QString());
emit justLoggedOut(true);
}
@@ -116,15 +116,15 @@ void FacebookManager::albumListReceived()
QNetworkReply *reply = qobject_cast<QNetworkReply*>(sender());
QJsonDocument albumsDoc = QJsonDocument::fromJson(reply->readAll());
QJsonArray albumObj = albumsDoc.object().value("data").toArray();
- auto fb = SettingsObjectWrapper::instance()->facebook;
+ auto fb = qPrefFacebook::instance();
reply->deleteLater();
foreach(const QJsonValue &v, albumObj){
QJsonObject obj = v.toObject();
if (obj.value("name").toString() == fbInfo.albumName) {
- fb->setAlbumId(obj.value("id").toString());
+ fb->set_album_id(obj.value("id").toString());
qCDebug(lcFacebook) << "Album" << fbInfo.albumName << "already exists, using id" << obj.value("id").toString();
- emit albumIdReceived(fb->albumId());
+ emit albumIdReceived(fb->album_id());
return;
}
}
@@ -158,9 +158,9 @@ void FacebookManager::facebookAlbumCreated()
if (album.contains("id")) {
qCDebug(lcFacebook) << "Album" << fbInfo.albumName << "created successfully with id" << album.value("id").toString();
- auto fb = SettingsObjectWrapper::instance()->facebook;
- fb->setAlbumId(album.value("id").toString());
- emit albumIdReceived(fb->albumId());
+ auto fb = qPrefFacebook::instance();
+ fb->set_album_id(album.value("id").toString());
+ emit albumIdReceived(fb->album_id());
return;
} else {
qCDebug(lcFacebook) << "It was not possible to create the album with name" << fbInfo.albumName;
@@ -168,8 +168,8 @@ void FacebookManager::facebookAlbumCreated()
// FIXME: we are lacking 'user_photos' facebook permission to create an album,
// but we are able to upload the image to Facebook (album will be named 'Subsurface Photos')
qCDebug(lcFacebook) << "But we are still able to upload data. Album name will be 'Subsurface Photos'";
- auto fb = SettingsObjectWrapper::instance()->facebook;
- emit albumIdReceived(fb->albumId());
+ auto fb = qPrefFacebook::instance();
+ emit albumIdReceived(fb->album_id());
}
}
@@ -189,7 +189,7 @@ void FacebookManager::userIdReceived()
QJsonObject obj = jsonDoc.object();
if (obj.keys().contains("id")) {
qCDebug(lcFacebook) << "User id requested successfully:" << obj.value("id").toString();
- SettingsObjectWrapper::instance()->facebook->setUserId(obj.value("id").toString());
+ qPrefFacebook::instance()->set_user_id(obj.value("id").toString());
emit sendMessage(tr("Facebook logged in successfully"));
emit justLoggedIn(true);
} else {