summaryrefslogtreecommitdiffstats
path: root/desktop-widgets
diff options
context:
space:
mode:
authorGravatar Tomaz Canabrava <tcanabrava@kde.org>2017-10-02 14:20:53 +0200
committerGravatar Dirk Hohndel <dirk@hohndel.org>2017-10-02 08:54:03 -0700
commit1d8eb0d78a31209f182b1e660bed679d071b3c25 (patch)
treec57d4ae70fc8bb61536ddde8426dd8559249a8eb /desktop-widgets
parentdf166247af6ebdc6a77e9266bd8922bac786a2aa (diff)
downloadsubsurface-1d8eb0d78a31209f182b1e660bed679d071b3c25.tar.gz
[Facebook] Code organization
Create the variable near its use. 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.cpp11
1 files changed, 6 insertions, 5 deletions
diff --git a/desktop-widgets/plugins/facebook/facebookconnectwidget.cpp b/desktop-widgets/plugins/facebook/facebookconnectwidget.cpp
index 27807cadc..c1d42c2b4 100644
--- a/desktop-widgets/plugins/facebook/facebookconnectwidget.cpp
+++ b/desktop-widgets/plugins/facebook/facebookconnectwidget.cpp
@@ -204,11 +204,6 @@ void FacebookManager::sendDive()
setDesiredAlbumName(dialog.album());
requestAlbumId();
- QPixmap pix = grabProfilePixmap();
- QByteArray bytes;
- QBuffer buffer(&bytes);
- buffer.open(QIODevice::WriteOnly);
- pix.save(&buffer, "PNG");
QUrl url(graphApi + QString(prefs.facebook.album_id) + "/photos?" +
"&access_token=" + QString(prefs.facebook.access_token) +
"&source=image" +
@@ -227,6 +222,12 @@ void FacebookManager::sendDive()
//name of the input is "uploaded" in my form, next one is a file name.
data.append("Content-Disposition: form-data; name=\"uploaded\"; filename=\"" + QString::number(qrand()) + ".png\"\r\n");
data.append("Content-Type: image/jpeg\r\n\r\n"); //data type
+
+ QPixmap pix = grabProfilePixmap();
+ QByteArray bytes;
+ QBuffer buffer(&bytes);
+ buffer.open(QIODevice::WriteOnly);
+ pix.save(&buffer, "PNG");
data.append(bytes); //let's read the file
data.append("\r\n");
data.append("--" + bound + "--\r\n"); //closing boundary according to rfc 1867