diff options
author | Tomaz Canabrava <tcanabrava@kde.org> | 2017-10-02 14:54:00 +0200 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2017-10-02 08:54:03 -0700 |
commit | 3a564f412cbf6e8a300bba3ec4bb7941bb3f167b (patch) | |
tree | 1c1720ad9faa8c05e17d8874a8f3782a3d2c108f /desktop-widgets | |
parent | 5595d9a8b014a71ca1d62db9e0c6562d3480d013 (diff) | |
download | subsurface-3a564f412cbf6e8a300bba3ec4bb7941bb3f167b.tar.gz |
[Facebook] Use correct albumName variable
and code cleanup
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'desktop-widgets')
-rw-r--r-- | desktop-widgets/plugins/facebook/facebookconnectwidget.cpp | 15 | ||||
-rw-r--r-- | desktop-widgets/plugins/facebook/facebookconnectwidget.h | 12 |
2 files changed, 14 insertions, 13 deletions
diff --git a/desktop-widgets/plugins/facebook/facebookconnectwidget.cpp b/desktop-widgets/plugins/facebook/facebookconnectwidget.cpp index 3e11d68f5..8da0dd20b 100644 --- a/desktop-widgets/plugins/facebook/facebookconnectwidget.cpp +++ b/desktop-widgets/plugins/facebook/facebookconnectwidget.cpp @@ -120,9 +120,9 @@ void FacebookManager::albumListReceived() reply->deleteLater(); foreach(const QJsonValue &v, albumObj){ QJsonObject obj = v.toObject(); - if (obj.value("name").toString() == albumName) { + if (obj.value("name").toString() == fbInfo.albumName) { fb->setAlbumId(obj.value("id").toString()); - qCDebug(lcFacebook) << "Album" << albumName << "already exists, using id" << obj.value("id").toString(); + qCDebug(lcFacebook) << "Album" << fbInfo.albumName << "already exists, using id" << obj.value("id").toString(); emit albumIdReceived(fb->albumId()); return; } @@ -134,9 +134,9 @@ void FacebookManager::albumListReceived() void FacebookManager::createFacebookAlbum() { - qCDebug(lcFacebook) << "Album with name" << albumName << "doesn't exists, creating it."; + qCDebug(lcFacebook) << "Album with name" << fbInfo.albumName << "doesn't exists, creating it."; QUrlQuery params; - params.addQueryItem("name", albumName ); + params.addQueryItem("name", fbInfo.albumName ); params.addQueryItem("description", "Subsurface Album"); params.addQueryItem("privacy", "{'value': 'SELF'}"); @@ -156,13 +156,13 @@ void FacebookManager::facebookAlbumCreated() reply->deleteLater(); if (album.contains("id")) { - qCDebug(lcFacebook) << "Album" << albumName << "created successfully with id" << album.value("id").toString(); + 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()); return; } else { - qCDebug(lcFacebook) << "It was not possible to create the album with name" << albumName; + qCDebug(lcFacebook) << "It was not possible to create the album with name" << fbInfo.albumName; } } @@ -226,6 +226,7 @@ void FacebookManager::sendDiveInit() fbInfo.bodyText = dialog.text(); fbInfo.profileSize = dialog.profileSize(); fbInfo.profileData = grabProfilePixmap(); + fbInfo.albumName = dialog.album(); fbInfo.albumId = QString(); // request Album Id wil handle that. // will emit albumIdReceived, that's connected to sendDiveToAlbum @@ -234,7 +235,7 @@ void FacebookManager::sendDiveInit() void FacebookManager::sendDiveToAlbum(const QString& albumId) { - qCDebug(lcFacebook) << "Starting to upload the dive to album" << albumName << "id" << albumId; + qCDebug(lcFacebook) << "Starting to upload the dive to album" << fbInfo.albumName << "id" << albumId; QUrl url(graphApi + albumId + "/photos?" + "&access_token=" + QString(prefs.facebook.access_token) + "&source=image" + diff --git a/desktop-widgets/plugins/facebook/facebookconnectwidget.h b/desktop-widgets/plugins/facebook/facebookconnectwidget.h index 226100148..1c9e56f76 100644 --- a/desktop-widgets/plugins/facebook/facebookconnectwidget.h +++ b/desktop-widgets/plugins/facebook/facebookconnectwidget.h @@ -18,12 +18,13 @@ namespace Ui { } struct FacebookInfo { - enum Size {SMALL, MEDIUM, BIG}; + enum Size {SMALL, MEDIUM, BIG}; - QString bodyText; - QString albumId; - Size profileSize; - QPixmap profileData; + QString bodyText; + QString albumId; + QString albumName; + Size profileSize; + QPixmap profileData; }; class FacebookManager : public QObject @@ -56,7 +57,6 @@ public slots: void facebookAlbumCreated(); private: explicit FacebookManager(QObject *parent = 0); - QString albumName; FacebookInfo fbInfo; QNetworkAccessManager *manager; }; |