[Pkg-kde-extras] Bug#854254: Patch

John Goerzen jgoerzen at complete.org
Thu Sep 7 17:22:33 UTC 2017


tags 854254 patch
thanks

Hi folks,

The attached file patch3 solves this problem for me.  I used it by
combining the file on https://bugs.kde.org/show_bug.cgi?id=381664 with a
few bits of newer files from the kipi-plugins git.

The files patch2 and patch1 represent earlier work progress and aren't
cleaned up, but are just included for reference.  But patch3 should be
the good one.

- John
-------------- next part --------------
diff -durN orig/digikam-5.3.0/debian/patches/flickr.diff new/digikam-5.3.0/debian/patches/flickr.diff
--- orig/digikam-5.3.0/debian/patches/flickr.diff	1969-12-31 18:00:00.000000000 -0600
+++ new/digikam-5.3.0/debian/patches/flickr.diff	2017-09-07 11:46:56.197756830 -0500
@@ -0,0 +1,1925 @@
+Index: digikam-5.3.0/extra/kipi-plugins/common/libkipiplugins/CMakeLists.txt
+===================================================================
+--- digikam-5.3.0.orig/extra/kipi-plugins/common/libkipiplugins/CMakeLists.txt
++++ digikam-5.3.0/extra/kipi-plugins/common/libkipiplugins/CMakeLists.txt
+@@ -54,9 +54,9 @@ set(o2_SRCS
+     ${CMAKE_CURRENT_SOURCE_DIR}/o2/src/o0abstractstore.h
+     ${CMAKE_CURRENT_SOURCE_DIR}/o2/src/o0globals.h
+     # Enable when needed
+-    #${CMAKE_CURRENT_SOURCE_DIR}/o2/src/o1.cpp
+-    #${CMAKE_CURRENT_SOURCE_DIR}/o2/src/o1requestor.cpp
+-    #${CMAKE_CURRENT_SOURCE_DIR}/o2/src/o1timedreply.cpp
++    ${CMAKE_CURRENT_SOURCE_DIR}/o2/src/o1.cpp
++    ${CMAKE_CURRENT_SOURCE_DIR}/o2/src/o1requestor.cpp
++    ${CMAKE_CURRENT_SOURCE_DIR}/o2/src/o1timedreply.cpp
+     #${CMAKE_CURRENT_SOURCE_DIR}/o2/src/o1twitter.h
+     #${CMAKE_CURRENT_SOURCE_DIR}/o2/src/oxtwitter.cpp
+     #${CMAKE_CURRENT_SOURCE_DIR}/o2/src/o1dropbox.h
+Index: digikam-5.3.0/extra/kipi-plugins/flickr/flickrtalker.cpp
+===================================================================
+--- digikam-5.3.0.orig/extra/kipi-plugins/flickr/flickrtalker.cpp
++++ digikam-5.3.0/extra/kipi-plugins/flickr/flickrtalker.cpp
+@@ -1,13 +1,14 @@
+ /* ============================================================
+  *
+- * This file is a part of kipi-plugins project
++ * This file is a part of digiKam project
+  * http://www.digikam.org
+  *
+  * Date        : 2005-07-07
+  * Description : a kipi plugin to export images to Flickr web service
+  *
+  * Copyright (C) 2005-2009 by Vardhman Jain <vardhman at gmail dot com>
+- * Copyright (C) 2009-2016 by Gilles Caulier <caulier dot gilles at gmail dot com>
++ * Copyright (C) 2009-2017 by Gilles Caulier <caulier dot gilles at gmail dot com>
++ * Copyright (C) 2017      by Maik Qualmann <metzpinguin at gmail dot com>
+  *
+  * This program is free software; you can redistribute it
+  * and/or modify it under the terms of the GNU General
+@@ -34,7 +35,6 @@
+ #include <QMap>
+ #include <QStringList>
+ #include <QProgressDialog>
+-#include <QUrlQuery>
+ #include <QStandardPaths>
+ #include <QApplication>
+ #include <QDesktopServices>
+@@ -68,6 +68,8 @@ FlickrTalker::FlickrTalker(QWidget* cons
+     m_state           = FE_LOGOUT;
+     m_serviceName     = serviceName;
+     m_iface           = 0;
++    m_o1              = 0;
++    m_requestor       = 0;
+ 
+     PluginLoader* const pl = PluginLoader::instance();
+ 
+@@ -76,34 +78,27 @@ FlickrTalker::FlickrTalker(QWidget* cons
+         m_iface = pl->interface();
+     }
+ 
+-    if (serviceName == QString::fromLatin1("23"))
++    if (serviceName == QLatin1String("23"))
+     {
+-        m_apiUrl    = QString::fromLatin1("http://www.23hq.com/services/rest/");
+-        m_authUrl   = QString::fromLatin1("http://www.23hq.com/services/auth/");
+-        m_uploadUrl = QString::fromLatin1("http://www.23hq.com/services/upload/");
++        m_apiUrl    = QLatin1String("http://www.23hq.com/services/rest/");
++        m_authUrl   = QLatin1String("http://www.23hq.com/services/auth/");
++        m_uploadUrl = QLatin1String("http://www.23hq.com/services/upload/");
+ 
+         // bshanks: do 23 and flickr really share API keys? or does 23 not need
+         // one?
+-        m_apikey    = QString::fromLatin1("49d585bafa0758cb5c58ab67198bf632");
+-        m_secret    = QString::fromLatin1("34b39925e6273ffd");
+-    }
+-    else if (serviceName == QString::fromLatin1("Zooomr"))
+-    {
+-        m_apiUrl    = QString::fromLatin1("http://api.zooomr.com/services/rest/");
+-        m_authUrl   = QString::fromLatin1("http://www.zooomr.com/services/auth/");
+-        m_uploadUrl = QString::fromLatin1("http://upload.zooomr.com/services/upload/");
+-
+-        m_apikey    = QString::fromLatin1("18c8db5ce9ed4e15a7b484136f5080c5");
+-        m_secret    = QString::fromLatin1("1ea4af14e3");
++        m_apikey    = QLatin1String("49d585bafa0758cb5c58ab67198bf632");
++        m_secret    = QLatin1String("34b39925e6273ffd");
+     }
+     else
+     {
+-        m_apiUrl    = QString::fromLatin1("https://www.flickr.com/services/rest/");
+-        m_authUrl   = QString::fromLatin1("https://www.flickr.com/services/auth/");
+-        m_uploadUrl = QString::fromLatin1("https://api.flickr.com/services/upload/");
++        m_apiUrl    = QLatin1String("https://www.flickr.com/services/rest/");
++        m_authUrl   = QLatin1String("https://www.flickr.com/services/oauth/authorize?perms=write");
++        m_tokenUrl  = QLatin1String("https://www.flickr.com/services/oauth/request_token");
++        m_accessUrl = QLatin1String("https://www.flickr.com/services/oauth/access_token");
++        m_uploadUrl = QLatin1String("https://up.flickr.com/services/upload/");
+ 
+-        m_apikey    = QString::fromLatin1("49d585bafa0758cb5c58ab67198bf632");
+-        m_secret    = QString::fromLatin1("34b39925e6273ffd");
++        m_apikey    = QLatin1String("49d585bafa0758cb5c58ab67198bf632");
++        m_secret    = QLatin1String("34b39925e6273ffd");
+     }
+ 
+     m_netMngr = new QNetworkAccessManager(this);
+@@ -116,8 +111,24 @@ FlickrTalker::FlickrTalker(QWidget* cons
+     /* Initialize photo sets list. */
+     m_photoSetsList    = new QLinkedList<FPhotoSet>();
+ 
+-    connect(this, SIGNAL(signalAuthenticate()),
+-            this, SLOT(slotAuthenticate()));
++    m_o1 = new O1(this);
++
++    m_o1->setClientId(m_apikey);
++    m_o1->setClientSecret(m_secret);
++    m_o1->setAuthorizeUrl(QUrl(m_authUrl));
++    m_o1->setAccessTokenUrl(QUrl(m_accessUrl));
++    m_o1->setRequestTokenUrl(QUrl(m_tokenUrl));
++
++    connect(m_o1, SIGNAL(linkingFailed()),
++            this, SLOT(slotLinkingFailed()));
++
++    connect(m_o1, SIGNAL(linkingSucceeded()),
++            this, SLOT(slotLinkingSucceeded()));
++
++    connect(m_o1, SIGNAL(openBrowser(QUrl)),
++            this, SLOT(slotOpenBrowser(QUrl)));
++
++    m_requestor = new O1Requestor(m_netMngr, m_o1, this);
+ }
+ 
+ FlickrTalker::~FlickrTalker()
+@@ -132,144 +143,51 @@ FlickrTalker::~FlickrTalker()
+     removeTemporaryDir(m_serviceName.toLatin1().constData());
+ }
+ 
+-/** Compute MD5 signature using url queries keys and values following Flickr notice:
+-    http://www.flickr.com/services/api/auth.spec.html
+-*/
+-QString FlickrTalker::getApiSig(const QString& secret, const QUrl& url)
++void FlickrTalker::link()
+ {
+-    QUrlQuery urlQuery(url.query());
+-    QList<QPair<QString, QString> > temp_queries = urlQuery.queryItems();
+-    QMap<QString, QString> queries;
+-
+-    QPair<QString, QString> pair;
+-
+-    foreach(pair, temp_queries)
+-    {
+-        queries.insert(pair.first,pair.second);
+-    }
+-
+-    QString compressed(secret);
+-
+-    // NOTE: iterator QMap iterator will sort alphabetically items based on key values.
+-    for (QMap<QString, QString>::iterator it = queries.begin() ; it != queries.end(); ++it)
+-    {
+-        compressed.append(it.key());
+-        compressed.append(it.value());
+-    }
++    emit signalBusy(true);
++    m_o1->link();
++}
+ 
+-    QCryptographicHash context(QCryptographicHash::Md5);
+-    context.addData(compressed.toUtf8());
+-    return QLatin1String(context.result().toHex().data());
++void FlickrTalker::unlink()
++{
++    m_o1->unlink();
+ }
+ 
+-QString FlickrTalker::getMaxAllowedFileSize()
++void FlickrTalker::slotLinkingFailed()
+ {
+-    return m_maxSize;
++    qCDebug(KIPIPLUGINS_LOG) << "LINK to Fickr fail";
++    emit signalBusy(false);
+ }
+ 
+-void FlickrTalker::maxAllowedFileSize()
++void FlickrTalker::slotLinkingSucceeded()
+ {
+-    if (m_reply)
++    if (!m_o1->linked())
+     {
+-        m_reply->abort();
+-        m_reply = 0;
++        qCDebug(KIPIPLUGINS_LOG) << "UNLINK to Fickr ok";
++        return;
+     }
+ 
+-    QUrl url(m_apiUrl);
+-    QUrlQuery urlQuery;
+-    urlQuery.addQueryItem(QString::fromLatin1("auth_token"), m_token);
+-    urlQuery.addQueryItem(QString::fromLatin1("api_key"), m_apikey);
+-    urlQuery.addQueryItem(QString::fromLatin1("method"), QString::fromLatin1("flickr.people.getLimits"));
+-    url.setQuery(urlQuery);
+-    QString md5 = getApiSig(m_secret, url);
+-    urlQuery.addQueryItem(QString::fromLatin1("api_sig"), md5);
+-    url.setQuery(urlQuery);
+-    qCDebug(KIPIPLUGINS_LOG) << "Get max file size url: " << url;
+-
+-    if (m_serviceName == QString::fromLatin1("Zooomr"))
+-    {
+-        // Zooomr redirects the POST at this url to a GET.
+-        m_reply = m_netMngr->get(QNetworkRequest(url));
+-    }
+-    else
+-    {
+-        QNetworkRequest netRequest(url);
+-        netRequest.setHeader(QNetworkRequest::ContentTypeHeader, QLatin1String("application/x-www-form-urlencoded"));
++    qCDebug(KIPIPLUGINS_LOG) << "LINK to Fickr ok";
+ 
+-        m_reply = m_netMngr->post(netRequest, QByteArray());
+-    }
++    m_username = m_o1->extraTokens()[QLatin1String("username")].toString();
++    m_userId   = m_o1->extraTokens()[QLatin1String("user_nsid")].toString();
+ 
+-    m_state = FE_GETMAXSIZE;
+-    m_authProgressDlg->setLabelText(i18n("Getting the maximum allowed file size."));
+-    m_authProgressDlg->setMaximum(4);
+-    m_authProgressDlg->setValue(1);
+-    m_buffer.resize(0);
+-    emit signalBusy(true);
++    emit signalLinkingSucceeded();
+ }
+ 
+-// MD5 signature of the request.
+-/*
+-QString FlickrTalker::getApiSig(const QString& secret, const QStringList &headers)
++void FlickrTalker::slotOpenBrowser(const QUrl& url)
+ {
+-    QMap<QString, QString> queries = url.queryItems();
+-    QString compressed(secret);
+-
+-    // NOTE: iterator QMap iterator will sort alphabetically items based on key values.
+-    for (QMap<QString, QString>::iterator it = queries.begin() ; it != queries.end(); ++it)
+-    {
+-        compressed.append(it.key());
+-        compressed.append(it.value());
+-    }
+-
+-    QCryptographicHash context(QCryptographicHash::Md5);
+-    context.addData(compressed.toUtf8());
+-    return context.result().toHex().data();
++    qCDebug(KIPIPLUGINS_LOG) << "Open Browser...";
++    QDesktopServices::openUrl(url);
+ }
+-*/
+ 
+-/**get the API sig and send it to the server server should return a frob.
+-*/
+-void FlickrTalker::getFrob()
++QString FlickrTalker::getMaxAllowedFileSize()
+ {
+-    if (m_reply)
+-    {
+-        m_reply->abort();
+-        m_reply = 0;
+-    }
+-
+-    QUrl url(m_apiUrl);
+-    QUrlQuery urlQuery;
+-    urlQuery.addQueryItem(QString::fromLatin1("method"), QString::fromLatin1("flickr.auth.getFrob"));
+-    urlQuery.addQueryItem(QString::fromLatin1("api_key"), m_apikey);
+-    url.setQuery(urlQuery);
+-
+-    QString md5 = getApiSig(m_secret, url);
+-    urlQuery.addQueryItem(QString::fromLatin1("api_sig"), md5);
+-    url.setQuery(urlQuery);
+-    qCDebug(KIPIPLUGINS_LOG) << "Get frob url: " << url;
+-
+-    if (m_serviceName == QString::fromLatin1("Zooomr"))
+-    {
+-        // Zooomr redirects the POST at this url to a GET.
+-        m_reply = m_netMngr->get(QNetworkRequest(url));
+-    }
+-    else
+-    {
+-        QNetworkRequest netRequest(url);
+-        netRequest.setHeader(QNetworkRequest::ContentTypeHeader, QLatin1String("application/x-www-form-urlencoded"));
+-
+-        m_reply = m_netMngr->post(netRequest, QByteArray());
+-    }
+-
+-    m_state = FE_GETFROB;
+-    m_authProgressDlg->setLabelText(i18n("Getting the Frob"));
+-    m_authProgressDlg->setMaximum(4);
+-    m_authProgressDlg->setValue(1);
+-    m_buffer.resize(0);
+-    emit signalBusy(true);
++    return m_maxSize;
+ }
+ 
+-void FlickrTalker::checkToken(const QString& token)
++void FlickrTalker::maxAllowedFileSize()
+ {
+     if (m_reply)
+     {
+@@ -277,39 +195,30 @@ void FlickrTalker::checkToken(const QStr
+         m_reply = 0;
+     }
+ 
++    if (!m_o1->linked())
++        return;
++
+     QUrl url(m_apiUrl);
+-    QUrlQuery urlQuery;
+-    urlQuery.addQueryItem(QString::fromLatin1("method"), QString::fromLatin1("flickr.auth.checkToken"));
+-    urlQuery.addQueryItem(QString::fromLatin1("api_key"), m_apikey);
+-    urlQuery.addQueryItem(QString::fromLatin1("auth_token"), token);
+-    url.setQuery(urlQuery);
+-    QString md5 = getApiSig(m_secret, url);
+-    urlQuery.addQueryItem(QString::fromLatin1("api_sig"), md5);
+-    url.setQuery(urlQuery);
+-    qCDebug(KIPIPLUGINS_LOG) << "Check token url: " << url;
++    QNetworkRequest netRequest(url);
++    QList<O0RequestParameter> reqParams = QList<O0RequestParameter>();
+ 
+-    if (m_serviceName == QString::fromLatin1("Zooomr"))
+-    {
+-        // Zooomr redirects the POST at this url to a GET.
+-        m_reply = m_netMngr->get(QNetworkRequest(url));
+-    }
+-    else
+-    {
+-        QNetworkRequest netRequest(url);
+-        netRequest.setHeader(QNetworkRequest::ContentTypeHeader, QLatin1String("application/x-www-form-urlencoded"));
++    netRequest.setHeader(QNetworkRequest::ContentTypeHeader, QLatin1String(O2_MIME_TYPE_XFORM));
+ 
+-        m_reply = m_netMngr->post(netRequest, QByteArray());
+-    }
++    reqParams << O0RequestParameter("method", "flickr.people.getLimits");
++
++    QByteArray postData = O1::createQueryParameters(reqParams);
+ 
+-    m_state = FE_CHECKTOKEN;
+-    m_authProgressDlg->setLabelText(i18n("Checking if previous token is still valid"));
++    m_reply = m_requestor->post(netRequest, reqParams, postData);
++
++    m_state = FE_GETMAXSIZE;
++    m_authProgressDlg->setLabelText(i18n("Getting the maximum allowed file size."));
+     m_authProgressDlg->setMaximum(4);
+     m_authProgressDlg->setValue(1);
+     m_buffer.resize(0);
+     emit signalBusy(true);
+ }
+ 
+-void FlickrTalker::slotAuthenticate()
++void FlickrTalker::listPhotoSets()
+ {
+     if (m_reply)
+     {
+@@ -317,116 +226,22 @@ void FlickrTalker::slotAuthenticate()
+         m_reply = 0;
+     }
+ 
+-    QUrl url(m_authUrl);
+-    QUrlQuery urlQuery;
+-    urlQuery.addQueryItem(QString::fromLatin1("api_key"), m_apikey);
+-    urlQuery.addQueryItem(QString::fromLatin1("frob"), m_frob);
+-    urlQuery.addQueryItem(QString::fromLatin1("perms"), QString::fromLatin1("write"));
+-    url.setQuery(urlQuery);
+-
+-    QString md5 = getApiSig(m_secret, url);
+-    urlQuery.addQueryItem(QString::fromLatin1("api_sig"), md5);
+-    url.setQuery(urlQuery);
+-    qCDebug(KIPIPLUGINS_LOG) << "Authenticate url: " << url;
+-
+-    QDesktopServices::openUrl(url);
+-
+-    QMessageBox quest(QMessageBox::Question,
+-                      i18n("%1 Service Web Authorization", m_serviceName),
+-                      i18n("Please follow the instructions in the browser window, then "
+-                           "return to press corresponding button."),
+-                      QMessageBox::Yes | QMessageBox::No);
+-
+-    (quest.button(QMessageBox::Yes))->setText(i18n("I am authenticated"));
+-    (quest.button(QMessageBox::No))->setText(i18n("I am not authenticated"));
+-
+-    if (quest.exec() == QMessageBox::Yes)
+-    {
+-        getToken();
+-        m_authProgressDlg->setLabelText(i18n("Authenticating the User on web"));
+-        m_authProgressDlg->setMaximum(4);
+-        m_authProgressDlg->setValue(2);
+-        emit signalBusy(false);
+-    }
+-    else
+-    {
+-        qCDebug(KIPIPLUGINS_LOG) << "User didn't proceed with getToken Authorization, cannot proceed further, aborting";
+-        cancel();
+-    }
+-}
++    if (!m_o1->linked())
++        return;
+ 
+-void FlickrTalker::getToken()
+-{
+-    if (m_reply)
+-    {
+-        m_reply->abort();
+-        m_reply = 0;
+-    }
++    qCDebug(KIPIPLUGINS_LOG) << "List photoset invoked";
+ 
+     QUrl url(m_apiUrl);
+-    QUrlQuery urlQuery;
+-    urlQuery.addQueryItem(QString::fromLatin1("api_key"), m_apikey);
+-    urlQuery.addQueryItem(QString::fromLatin1("method"), QString::fromLatin1("flickr.auth.getToken"));
+-    urlQuery.addQueryItem(QString::fromLatin1("frob"), m_frob);
+-    url.setQuery(urlQuery);
+-    QString md5 = getApiSig(m_secret, url);
+-    urlQuery.addQueryItem(QString::fromLatin1("api_sig"), md5);
+-    url.setQuery(urlQuery);
+-    qCDebug(KIPIPLUGINS_LOG) << "Get token url: " << url;
++    QNetworkRequest netRequest(url);
++    QList<O0RequestParameter> reqParams = QList<O0RequestParameter>();
+ 
+-    if (m_serviceName == QString::fromLatin1("Zooomr"))
+-    {
+-        // Zooomr redirects the POST at this url to a GET.
+-        m_reply = m_netMngr->get(QNetworkRequest(url));
+-    }
+-    else
+-    {
+-        QNetworkRequest netRequest(url);
+-        netRequest.setHeader(QNetworkRequest::ContentTypeHeader, QLatin1String("application/x-www-form-urlencoded"));
++    netRequest.setHeader(QNetworkRequest::ContentTypeHeader, QLatin1String(O2_MIME_TYPE_XFORM));
+ 
+-        m_reply = m_netMngr->post(netRequest, QByteArray());
+-    }
++    reqParams << O0RequestParameter("method", "flickr.photosets.getList");
+ 
+-    m_state = FE_GETTOKEN;
+-    m_buffer.resize(0);
+-    emit signalBusy(true);
+-    m_authProgressDlg->setLabelText(i18n("Getting the Token from the server"));
+-    m_authProgressDlg->setMaximum(4);
+-    m_authProgressDlg->setValue(3);
+-}
++    QByteArray postData = O1::createQueryParameters(reqParams);
+ 
+-void FlickrTalker::listPhotoSets()
+-{
+-    if (m_reply)
+-    {
+-        m_reply->abort();
+-        m_reply = 0;
+-    }
+-
+-    qCDebug(KIPIPLUGINS_LOG) << "List photoset invoked";
+-    QUrl url(m_apiUrl);
+-    QUrlQuery urlQuery;
+-    urlQuery.addQueryItem(QString::fromLatin1("auth_token"), m_token);
+-    urlQuery.addQueryItem(QString::fromLatin1("api_key"), m_apikey);
+-    urlQuery.addQueryItem(QString::fromLatin1("method"), QString::fromLatin1("flickr.photosets.getList"));
+-    url.setQuery(urlQuery);
+-    QString md5 = getApiSig(m_secret, url);
+-    urlQuery.addQueryItem(QString::fromLatin1("api_sig"), md5);
+-    url.setQuery(urlQuery);
+-    qCDebug(KIPIPLUGINS_LOG) << "List photoset URL" << url;
+-
+-    if (m_serviceName == QString::fromLatin1("Zooomr"))
+-    {
+-        // Zooomr redirects the POST at this url to a GET.
+-        m_reply = m_netMngr->get(QNetworkRequest(url));
+-    }
+-    else
+-    {
+-        QNetworkRequest netRequest(url);
+-        netRequest.setHeader(QNetworkRequest::ContentTypeHeader, QLatin1String("application/x-www-form-urlencoded"));
+-
+-        m_reply = m_netMngr->post(netRequest, QByteArray());
+-    }
++    m_reply = m_requestor->post(netRequest, reqParams, postData);
+ 
+     m_state = FE_LISTPHOTOSETS;
+     m_buffer.resize(0);
+@@ -441,43 +256,30 @@ void FlickrTalker::getPhotoProperty(cons
+         m_reply = 0;
+     }
+ 
++    if (!m_o1->linked())
++        return;
++
+     QUrl url(m_apiUrl);
+-    QUrlQuery urlQuery;
+-    urlQuery.addQueryItem(QString::fromLatin1("api_key"), m_apikey);
+-    urlQuery.addQueryItem(QString::fromLatin1("method"), method);
+-    urlQuery.addQueryItem(QString::fromLatin1("frob"), m_frob);
++    QNetworkRequest netRequest(url);
++    QList<O0RequestParameter> reqParams = QList<O0RequestParameter>();
++
++    netRequest.setHeader(QNetworkRequest::ContentTypeHeader, QLatin1String(O2_MIME_TYPE_XFORM));
++
++    reqParams << O0RequestParameter("method", method.toLatin1());
+ 
+     for (QStringList::const_iterator it = argList.constBegin(); it != argList.constEnd(); ++it)
+     {
+         QStringList str = (*it).split(QLatin1Char('='), QString::SkipEmptyParts);
+-        urlQuery.addQueryItem(str[0], str[1]);
++        reqParams << O0RequestParameter(str[0].toLatin1(), str[1].toLatin1());
+     }
+ 
+-    url.setQuery(urlQuery);
+-    QString md5 = getApiSig(m_secret, url);
+-    urlQuery.addQueryItem(QString::fromLatin1("api_sig"), md5);
+-    url.setQuery(urlQuery);
+-    qCDebug(KIPIPLUGINS_LOG) << "Get photo property url: " << url;
+-
+-    if (m_serviceName == QString::fromLatin1("Zooomr"))
+-    {
+-        // Zooomr redirects the POST at this url to a GET.
+-        m_reply = m_netMngr->get(QNetworkRequest(url));
+-    }
+-    else
+-    {
+-        QNetworkRequest netRequest(url);
+-        netRequest.setHeader(QNetworkRequest::ContentTypeHeader, QLatin1String("application/x-www-form-urlencoded"));
++    QByteArray postData = O1::createQueryParameters(reqParams);
+ 
+-        m_reply = m_netMngr->post(netRequest, QByteArray());
+-    }
++    m_reply = m_requestor->post(netRequest, reqParams, postData);
+ 
+     m_state = FE_GETPHOTOPROPERTY;
+     m_buffer.resize(0);
+     emit signalBusy(true);
+-
+-    //  m_authProgressDlg->setLabelText("Getting the Token from the server");
+-    //  m_authProgressDlg->setProgress(3,4);
+ }
+ 
+ void FlickrTalker::listPhotos(const QString& /*albumName*/)
+@@ -494,34 +296,25 @@ void FlickrTalker::createPhotoSet(const
+         m_reply = 0;
+     }
+ 
+-    qCDebug(KIPIPLUGINS_LOG) << "create photoset invoked";
++    if (!m_o1->linked())
++        return;
++
++    qCDebug(KIPIPLUGINS_LOG) << "Create photoset invoked";
++
+     QUrl url(m_apiUrl);
+-    QUrlQuery urlQuery;
+-    urlQuery.addQueryItem(QString::fromLatin1("auth_token"), m_token);
+-    urlQuery.addQueryItem(QString::fromLatin1("api_key"), m_apikey);
+-    urlQuery.addQueryItem(QString::fromLatin1("method"), QString::fromLatin1("flickr.photosets.create"));
+-    urlQuery.addQueryItem(QString::fromLatin1("title"), albumTitle);
+-    urlQuery.addQueryItem(QString::fromLatin1("description"), albumDescription);
+-    urlQuery.addQueryItem(QString::fromLatin1("primary_photo_id"), primaryPhotoId);
+-    url.setQuery(urlQuery);
+-
+-    QString md5 = getApiSig(m_secret, url);
+-    urlQuery.addQueryItem(QString::fromLatin1("api_sig"), md5);
+-    url.setQuery(urlQuery);
+-    qCDebug(KIPIPLUGINS_LOG) << "List photo sets url: " << url;
++    QNetworkRequest netRequest(url);
++    QList<O0RequestParameter> reqParams = QList<O0RequestParameter>();
+ 
+-    if (m_serviceName == QString::fromLatin1("Zooomr"))
+-    {
+-        // Zooomr redirects the POST at this url to a GET.
+-        m_reply = m_netMngr->get(QNetworkRequest(url));
+-    }
+-    else
+-    {
+-        QNetworkRequest netRequest(url);
+-        netRequest.setHeader(QNetworkRequest::ContentTypeHeader, QLatin1String("application/x-www-form-urlencoded"));
++    netRequest.setHeader(QNetworkRequest::ContentTypeHeader, QLatin1String(O2_MIME_TYPE_XFORM));
+ 
+-        m_reply = m_netMngr->post(netRequest, QByteArray());
+-    }
++    reqParams << O0RequestParameter("method", "flickr.photosets.create");
++    reqParams << O0RequestParameter("title", albumTitle.toLatin1());
++    reqParams << O0RequestParameter("description", albumDescription.toLatin1());
++    reqParams << O0RequestParameter("primary_photo_id", primaryPhotoId.toLatin1());
++
++    QByteArray postData = O1::createQueryParameters(reqParams);
++
++    m_reply = m_requestor->post(netRequest, reqParams, postData);
+ 
+     m_state = FE_CREATEPHOTOSET;
+     m_buffer.resize(0);
+@@ -537,9 +330,10 @@ void FlickrTalker::addPhotoToPhotoSet(co
+         m_reply = 0;
+     }
+ 
+-    qCDebug(KIPIPLUGINS_LOG) << "addPhotoToPhotoSet invoked";
+-    QUrl url(m_apiUrl);
+-    QUrlQuery urlQuery;
++    if (!m_o1->linked())
++        return;
++
++    qCDebug(KIPIPLUGINS_LOG) << "AddPhotoToPhotoSet invoked";
+ 
+     /* If the photoset id starts with the special string "UNDEFINED_", it means
+      * it doesn't exist yet on Flickr and needs to be created. Note that it's
+@@ -547,26 +341,23 @@ void FlickrTalker::addPhotoToPhotoSet(co
+      * is done in the set creation call to Flickr. */
+     if (photoSetId.startsWith(QLatin1String("UNDEFINED_")))
+     {
+-        createPhotoSet(QString::fromLatin1(""), m_selectedPhotoSet.title, m_selectedPhotoSet.description, photoId);
++        createPhotoSet(QLatin1String(""), m_selectedPhotoSet.title, m_selectedPhotoSet.description, photoId);
+     }
+     else
+     {
+-        urlQuery.addQueryItem(QString::fromLatin1("auth_token"), m_token);
+-        urlQuery.addQueryItem(QString::fromLatin1("photoset_id"), photoSetId);
+-        urlQuery.addQueryItem(QString::fromLatin1("api_key"), m_apikey);
+-        urlQuery.addQueryItem(QString::fromLatin1("method"), QString::fromLatin1("flickr.photosets.addPhoto"));
+-        urlQuery.addQueryItem(QString::fromLatin1("photo_id"), photoId);
+-        url.setQuery(urlQuery);
+-
+-        QString md5 = getApiSig(m_secret, url);
+-        urlQuery.addQueryItem(QString::fromLatin1("api_sig"), md5);
+-        url.setQuery(urlQuery);
+-        qCDebug(KIPIPLUGINS_LOG) << "Add photo to Photo set url: " << url;
+-
++        QUrl url(m_apiUrl);
+         QNetworkRequest netRequest(url);
+-        netRequest.setHeader(QNetworkRequest::ContentTypeHeader, QLatin1String("application/x-www-form-urlencoded"));
++        QList<O0RequestParameter> reqParams = QList<O0RequestParameter>();
++
++        netRequest.setHeader(QNetworkRequest::ContentTypeHeader, QLatin1String(O2_MIME_TYPE_XFORM));
+ 
+-        m_reply = m_netMngr->post(netRequest, QByteArray());
++        reqParams << O0RequestParameter("method", "flickr.photosets.addPhoto");
++        reqParams << O0RequestParameter("photoset_id", photoSetId.toLatin1());
++        reqParams << O0RequestParameter("photo_id", photoId.toLatin1());
++
++        QByteArray postData = O1::createQueryParameters(reqParams);
++
++        m_reply = m_requestor->post(netRequest, reqParams, postData);
+ 
+         m_state = FE_ADDPHOTOTOPHOTOSET;
+         m_buffer.resize(0);
+@@ -575,7 +366,7 @@ void FlickrTalker::addPhotoToPhotoSet(co
+ }
+ 
+ bool FlickrTalker::addPhoto(const QString& photoPath, const FPhotoInfo& info,
+-                            bool rescale, int maxDim, int imageQuality)
++                            bool original, bool rescale, int maxDim, int imageQuality)
+ {
+     if (m_reply)
+     {
+@@ -583,123 +374,120 @@ bool FlickrTalker::addPhoto(const QStrin
+         m_reply = 0;
+     }
+ 
++    if (!m_o1->linked())
++        return false;
++
+     QUrl url(m_uploadUrl);
++    QNetworkRequest netRequest(url);
++    QList<O0RequestParameter> reqParams = QList<O0RequestParameter>();
+ 
+-    // We dont' want to modify url as such, we just used the QUrl object for storing the query items.
+-    QUrl url2(QString::fromLatin1(""));
+-    QUrlQuery urlQuery;
+     QString path = photoPath;
+     MPForm  form;
+ 
+-    form.addPair(QString::fromLatin1("auth_token"), m_token, QString::fromLatin1("text/plain"));
+-    urlQuery.addQueryItem(QString::fromLatin1("auth_token"), m_token);
+-
+-    form.addPair(QString::fromLatin1("api_key"), m_apikey, QString::fromLatin1("text/plain"));
+-    urlQuery.addQueryItem(QString::fromLatin1("api_key"), m_apikey);
+-
+-    QString ispublic = (info.is_public == 1) ? QString::fromLatin1("1") : QString::fromLatin1("0");
+-    form.addPair(QString::fromLatin1("is_public"), ispublic, QString::fromLatin1("text/plain"));
+-    urlQuery.addQueryItem(QString::fromLatin1("is_public"), ispublic);
+-
+-    QString isfamily = (info.is_family == 1) ? QString::fromLatin1("1") : QString::fromLatin1("0");
+-    form.addPair(QString::fromLatin1("is_family"), isfamily, QString::fromLatin1("text/plain"));
+-    urlQuery.addQueryItem(QString::fromLatin1("is_family"), isfamily);
+-
+-    QString isfriend = (info.is_friend == 1) ? QString::fromLatin1("1") : QString::fromLatin1("0");
+-    form.addPair(QString::fromLatin1("is_friend"), isfriend, QString::fromLatin1("text/plain"));
+-    urlQuery.addQueryItem(QString::fromLatin1("is_friend"), isfriend);
++    QString ispublic = (info.is_public == 1) ? QLatin1String("1") : QLatin1String("0");
++    form.addPair(QLatin1String("is_public"), ispublic, QLatin1String("text/plain"));
++    reqParams << O0RequestParameter("is_public", ispublic.toLatin1());
++
++    QString isfamily = (info.is_family == 1) ? QLatin1String("1") : QLatin1String("0");
++    form.addPair(QLatin1String("is_family"), isfamily, QLatin1String("text/plain"));
++    reqParams << O0RequestParameter("is_family", isfamily.toLatin1());
++
++    QString isfriend = (info.is_friend == 1) ? QLatin1String("1") : QLatin1String("0");
++    form.addPair(QLatin1String("is_friend"), isfriend, QLatin1String("text/plain"));
++    reqParams << O0RequestParameter("is_friend", isfriend.toLatin1());
+ 
+     QString safetyLevel = QString::number(static_cast<int>(info.safety_level));
+-    form.addPair(QString::fromLatin1("safety_level"), safetyLevel, QString::fromLatin1("text/plain"));
+-    urlQuery.addQueryItem(QString::fromLatin1("safety_level"), safetyLevel);
++    form.addPair(QLatin1String("safety_level"), safetyLevel, QLatin1String("text/plain"));
++    reqParams << O0RequestParameter("safety_level", safetyLevel.toLatin1());
+ 
+     QString contentType = QString::number(static_cast<int>(info.content_type));
+-    form.addPair(QString::fromLatin1("content_type"), contentType, QString::fromLatin1("text/plain"));
+-    urlQuery.addQueryItem(QString::fromLatin1("content_type"), contentType);
++    form.addPair(QLatin1String("content_type"), contentType, QLatin1String("text/plain"));
++    reqParams << O0RequestParameter("content_type", contentType.toLatin1());
+ 
+-    QString tags = QString::fromLatin1("\"") + info.tags.join(QString::fromLatin1("\" \"")) + QString::fromLatin1("\"");
++    QString tags = QLatin1String("\"") + info.tags.join(QLatin1String("\" \"")) + QLatin1String("\"");
+ 
+     if (tags.length() > 0)
+     {
+-        form.addPair(QString::fromLatin1("tags"), tags, QString::fromLatin1("text/plain"));
+-        urlQuery.addQueryItem(QString::fromLatin1("tags"), tags);
++        form.addPair(QLatin1String("tags"), tags, QLatin1String("text/plain"));
++        reqParams << O0RequestParameter("tags", tags.toLatin1());
+     }
+ 
+     if (!info.title.isEmpty())
+     {
+-        form.addPair(QString::fromLatin1("title"), info.title, QString::fromLatin1("text/plain"));
+-        urlQuery.addQueryItem(QString::fromLatin1("title"), info.title);
++        form.addPair(QLatin1String("title"), info.title, QLatin1String("text/plain"));
++        reqParams << O0RequestParameter("title", info.title.toLatin1());
+     }
+ 
+     if (!info.description.isEmpty())
+     {
+-        form.addPair(QString::fromLatin1("description"), info.description, QString::fromLatin1("text/plain"));
+-        urlQuery.addQueryItem(QString::fromLatin1("description"), info.description);
+-    }
+-
+-    url2.setQuery(urlQuery);
+-    QString md5 = getApiSig(m_secret, url2);
+-    form.addPair(QString::fromLatin1("api_sig"), md5, QString::fromLatin1("text/plain"));
+-    QImage image;
+-
+-    if (m_iface)
+-    {
+-        image = m_iface->preview(QUrl::fromLocalFile(photoPath));
++        form.addPair(QLatin1String("description"), info.description, QLatin1String("text/plain"));
++        reqParams << O0RequestParameter("description", info.description.toLatin1());
+     }
+ 
+-    if (image.isNull())
++    if (!original)
+     {
+-        image.load(photoPath);
+-    }
++        QImage image;
+ 
+-    if (!image.isNull())
+-    {
+-        if (!m_lastTmpFile.isEmpty())
++        if (m_iface)
+         {
+-            QFile::remove(m_lastTmpFile);
++            image = m_iface->preview(QUrl::fromLocalFile(photoPath));
+         }
+ 
+-        path = makeTemporaryDir(m_serviceName.toLatin1().constData()).filePath(QFileInfo(photoPath)
+-                                                                     .baseName().trimmed() + QLatin1String(".jpg"));
+-
+-        if (rescale)
++        if (image.isNull())
+         {
+-            if (image.width() > maxDim || image.height() > maxDim)
+-                image = image.scaled(maxDim, maxDim, Qt::KeepAspectRatio, Qt::SmoothTransformation);
++            image.load(photoPath);
+         }
+ 
+-        image.save(path, "JPEG", imageQuality);
+-        m_lastTmpFile = path;
+-
+-        // Restore all metadata.
+-
+-        if (m_iface)
++        if (!image.isNull())
+         {
+-            QPointer<MetadataProcessor> meta = m_iface->createMetadataProcessor();
+-
+-            if (meta && meta->load(QUrl::fromLocalFile(photoPath)))
++            if (!m_lastTmpFile.isEmpty())
+             {
+-                meta->setImageDimensions(image.size());
++                QFile::remove(m_lastTmpFile);
++            }
+ 
+-                // NOTE: see bug #153207: Flickr use IPTC keywords to create Tags in web interface
+-                //       As IPTC do not support UTF-8, we need to remove it.
+-                meta->removeIptcTags(QStringList() << QLatin1String("Iptc.Application2.Keywords"));
++            path = makeTemporaryDir(m_serviceName.toLatin1().constData()).filePath(QFileInfo(photoPath)
++                                                                         .baseName().trimmed() + QLatin1String(".jpg"));
+ 
+-                meta->setImageProgramId(QString::fromLatin1("Kipi-plugins"), kipipluginsVersion());
+-                meta->save(QUrl::fromLocalFile(path));
++            if (rescale)
++            {
++                if (image.width() > maxDim || image.height() > maxDim)
++                    image = image.scaled(maxDim, maxDim, Qt::KeepAspectRatio, Qt::SmoothTransformation);
+             }
+-            else
++
++            image.save(path, "JPEG", imageQuality);
++            m_lastTmpFile = path;
++
++            // Restore all metadata.
++
++            if (m_iface)
+             {
+-                qCWarning(KIPIPLUGINS_LOG) << "flickrExport::Image doesn't have metadata";
++                QPointer<MetadataProcessor> meta = m_iface->createMetadataProcessor();
++
++                if (meta && meta->load(QUrl::fromLocalFile(photoPath)))
++                {
++                    meta->setImageDimensions(image.size());
++                    meta->setImageOrientation(MetadataProcessor::NORMAL);
++
++                    // NOTE: see bug #153207: Flickr use IPTC keywords to create Tags in web interface
++                    //       As IPTC do not support UTF-8, we need to remove it.
++                    meta->removeIptcTags(QStringList() << QLatin1String("Iptc.Application2.Keywords"));
++
++                    meta->setImageProgramId(QLatin1String("Kipi-plugins"), kipipluginsVersion());
++                    meta->save(QUrl::fromLocalFile(path), true);
++                }
++                else
++                {
++                    qCWarning(KIPIPLUGINS_LOG) << "flickrExport::Image doesn't have metadata";
++                }
+             }
+-        }
+ 
+-        qCDebug(KIPIPLUGINS_LOG) << "Resizing and saving to temp file: " << path;
++            qCDebug(KIPIPLUGINS_LOG) << "Resizing and saving to temp file: " << path;
++        }
+     }
+ 
+     QFileInfo tempFileInfo(path);
+ 
+-    qCDebug(KIPIPLUGINS_LOG) << "QUrl path is " << QUrl::fromLocalFile(path) << "Image size after resizing (in bytes) is "<< tempFileInfo.size();
++    qCDebug(KIPIPLUGINS_LOG) << "QUrl path is " << QUrl::fromLocalFile(path) << "Image size (in bytes) is "<< tempFileInfo.size();
+ 
+     if (tempFileInfo.size() > (getMaxAllowedFileSize().toLongLong()))
+     {
+@@ -707,17 +495,16 @@ bool FlickrTalker::addPhoto(const QStrin
+         return false;
+     }
+ 
+-    if (!form.addFile(QString::fromLatin1("photo"), path))
++    if (!form.addFile(QLatin1String("photo"), path))
+     {
+         return false;
+     }
+ 
+     form.finish();
+ 
+-    QNetworkRequest netRequest(url);
+     netRequest.setHeader(QNetworkRequest::ContentTypeHeader, form.contentType());
+ 
+-    m_reply = m_netMngr->post(netRequest, form.formData());
++    m_reply = m_requestor->post(netRequest, reqParams, form.formData());
+ 
+     m_state = FE_ADDPHOTO;
+     m_buffer.resize(0);
+@@ -869,22 +656,6 @@ void FlickrTalker::slotFinished(QNetwork
+             parseResponseListPhotoSets(m_buffer);
+             break;
+ 
+-        case (FE_GETFROB):
+-            parseResponseGetFrob(m_buffer);
+-            break;
+-
+-        case (FE_GETTOKEN):
+-            parseResponseGetToken(m_buffer);
+-            break;
+-
+-        case (FE_CHECKTOKEN):
+-            parseResponseCheckToken(m_buffer);
+-            break;
+-
+-        case (FE_GETAUTHORIZED):
+-            //parseResponseGetToken(m_buffer);
+-            break;
+-
+         case (FE_LISTPHOTOS):
+             parseResponseListPhotos(m_buffer);
+             break;
+@@ -919,7 +690,7 @@ void FlickrTalker::slotFinished(QNetwork
+ void FlickrTalker::parseResponseMaxSize(const QByteArray& data)
+ {
+     QString errorString;
+-    QDomDocument doc(QString::fromLatin1("mydocument"));
++    QDomDocument doc(QLatin1String("mydocument"));
+ 
+     if (!doc.setContent(data))
+     {
+@@ -933,7 +704,7 @@ void FlickrTalker::parseResponseMaxSize(
+ 
+     while (!node.isNull())
+     {
+-        if (node.isElement() && node.nodeName() == QString::fromLatin1("person"))
++        if (node.isElement() && node.nodeName() == QLatin1String("person"))
+         {
+             e                = node.toElement();
+             QDomNode details = e.firstChild();
+@@ -944,9 +715,9 @@ void FlickrTalker::parseResponseMaxSize(
+                 {
+                     e = details.toElement();
+ 
+-                    if (details.nodeName() == QString::fromLatin1("photos"))
++                    if (details.nodeName() == QLatin1String("photos"))
+                     {
+-                        QDomAttr a = e.attributeNode(QString::fromLatin1("maxupload"));
++                        QDomAttr a = e.attributeNode(QLatin1String("maxupload"));
+                         m_maxSize = a.value();
+                         qCDebug(KIPIPLUGINS_LOG) << "Max upload size is"<<m_maxSize;
+                     }
+@@ -956,255 +727,18 @@ void FlickrTalker::parseResponseMaxSize(
+             }
+         }
+ 
+-        if (node.isElement() && node.nodeName() == QString::fromLatin1("err"))
+-        {
+-            qCDebug(KIPIPLUGINS_LOG) << "Checking Error in response";
+-            errorString = node.toElement().attribute(QString::fromLatin1("code"));
+-            qCDebug(KIPIPLUGINS_LOG) << "Error code=" << errorString;
+-            qCDebug(KIPIPLUGINS_LOG) << "Msg=" << node.toElement().attribute(QString::fromLatin1("msg"));
+-        }
+-
+-        node = node.nextSibling();
+-    }
+-}
+-
+-void FlickrTalker::parseResponseGetFrob(const QByteArray& data)
+-{
+-    bool success = false;
+-    QString errorString;
+-    QDomDocument doc(QString::fromLatin1("mydocument"));
+-
+-    if (!doc.setContent(data))
+-    {
+-        return;
+-    }
+-
+-    QDomElement docElem = doc.documentElement();
+-    QDomNode node       = docElem.firstChild();
+-
+-    while (!node.isNull())
+-    {
+-        if (node.isElement() && node.nodeName() == QString::fromLatin1("frob"))
+-        {
+-            QDomElement e = node.toElement();    // try to convert the node to an element.
+-            qCDebug(KIPIPLUGINS_LOG) << "Frob is" << e.text();
+-            m_frob        = e.text();            // this is what is obtained from data.
+-            success       = true;
+-        }
+-
+-        if (node.isElement() && node.nodeName() == QString::fromLatin1("err"))
++        if (node.isElement() && node.nodeName() == QLatin1String("err"))
+         {
+             qCDebug(KIPIPLUGINS_LOG) << "Checking Error in response";
+-            errorString = node.toElement().attribute(QString::fromLatin1("code"));
++            errorString = node.toElement().attribute(QLatin1String("code"));
+             qCDebug(KIPIPLUGINS_LOG) << "Error code=" << errorString;
+-            qCDebug(KIPIPLUGINS_LOG) << "Msg=" << node.toElement().attribute(QString::fromLatin1("msg"));
++            qCDebug(KIPIPLUGINS_LOG) << "Msg=" << node.toElement().attribute(QLatin1String("msg"));
+         }
+ 
+         node = node.nextSibling();
+     }
+ 
+-    qCDebug(KIPIPLUGINS_LOG) << "GetFrob finished";
+-    m_authProgressDlg->setMaximum(4);
+-    m_authProgressDlg->setValue(2);
+-    m_state = FE_GETAUTHORIZED;
+-
+-    if (success)
+-    {
+-        emit signalAuthenticate();
+-    }
+-    else
+-    {
+-        emit signalError(errorString);
+-    }
+-}
+-
+-void FlickrTalker::parseResponseCheckToken(const QByteArray& data)
+-{
+-    bool         success = false;
+-    QString      errorString;
+-    QString      username;
+-    QString      transReturn;
+-    QDomDocument doc(QString::fromLatin1("checktoken"));
+-
+-    if (!doc.setContent(data))
+-    {
+-        return;
+-    }
+-
+-    QDomElement docElem = doc.documentElement();
+-    QDomNode node       = docElem.firstChild();
+-    QDomElement e;
+-
+-    while (!node.isNull())
+-    {
+-        if (node.isElement() && node.nodeName() == QString::fromLatin1("auth"))
+-        {
+-            e                = node.toElement(); // try to convert the node to an element.
+-            QDomNode details = e.firstChild();
+-
+-            while (!details.isNull())
+-            {
+-                if (details.isElement())
+-                {
+-                    e = details.toElement();
+-
+-                    if (details.nodeName() == QString::fromLatin1("token"))
+-                    {
+-                        qCDebug(KIPIPLUGINS_LOG) << "Token=" << e.text();
+-                        m_token = e.text();//this is what is obtained from data.
+-                    }
+-
+-                    if (details.nodeName() == QString::fromLatin1("perms"))
+-                    {
+-                        qCDebug(KIPIPLUGINS_LOG) << "Perms=" << e.text();
+-                        QString perms = e.text();//this is what is obtained from data.
+-
+-                        if (perms == QString::fromLatin1("write"))
+-                        {
+-                            transReturn = i18nc("As in the permission to", "write");
+-                        }
+-                        else if (perms == QString::fromLatin1("read"))
+-                        {
+-                            transReturn = i18nc("As in the permission to", "read");
+-                        }
+-                        else if (perms == QString::fromLatin1("delete"))
+-                        {
+-                            transReturn = i18nc("As in the permission to", "delete");
+-                        }
+-                    }
+-
+-                    if (details.nodeName() == QString::fromLatin1("user"))
+-                    {
+-                        qCDebug(KIPIPLUGINS_LOG) << "nsid=" << e.attribute(QString::fromLatin1("nsid"));
+-                        m_userId   = e.attribute(QString::fromLatin1("nsid"));
+-                        username   = e.attribute(QString::fromLatin1("username"));
+-                        m_username = username;
+-                        qCDebug(KIPIPLUGINS_LOG) << "username=" << e.attribute(QString::fromLatin1("username"));
+-                        qCDebug(KIPIPLUGINS_LOG) << "fullname=" << e.attribute(QString::fromLatin1("fullname"));
+-                    }
+-                }
+-
+-                details = details.nextSibling();
+-            }
+-
+-            m_authProgressDlg->hide();
+-            emit signalTokenObtained(m_token);
+-            success = true;
+-        }
+-
+-        if (node.isElement() && node.nodeName() == QString::fromLatin1("err"))
+-        {
+-            qCDebug(KIPIPLUGINS_LOG) << "Checking Error in response";
+-            errorString = node.toElement().attribute(QString::fromLatin1("code"));
+-            qCDebug(KIPIPLUGINS_LOG) << "Error code=" << errorString;
+-            qCDebug(KIPIPLUGINS_LOG) << "Msg=" << node.toElement().attribute(QString::fromLatin1("msg"));
+-
+-            int valueOk = QMessageBox::question(QApplication::activeWindow(),
+-                                                i18n("Invalid Token"),
+-                                                i18n("Your token is invalid. Would you like to "
+-                                                      "get a new token to proceed?\n"));
+-
+-            if (valueOk == QMessageBox::Yes)
+-            {
+-                getFrob();
+-                return;
+-            }
+-            else
+-            {
+-                m_authProgressDlg->hide(); //will popup the result for the checktoken failure below
+-            }
+-
+-        }
+-
+-        node = node.nextSibling();
+-    }
+-
+-    if (!success)
+-    {
+-        emit signalError(errorString);
+-    }
+-
+-    qCDebug(KIPIPLUGINS_LOG) << "CheckToken finished";
+-}
+-
+-void FlickrTalker::parseResponseGetToken(const QByteArray& data)
+-{
+-    bool success = false;
+-    QString errorString;
+-    QDomDocument doc(QString::fromLatin1("gettoken"));
+-
+-    if (!doc.setContent(data))
+-    {
+-        return;
+-    }
+-
+-    QDomElement docElem = doc.documentElement();
+-    QDomNode    node    = docElem.firstChild();
+-    QDomElement e;
+-
+-    while (!node.isNull())
+-    {
+-        if (node.isElement() && node.nodeName() == QString::fromLatin1("auth"))
+-        {
+-            e                = node.toElement(); // try to convert the node to an element.
+-            QDomNode details = e.firstChild();
+-
+-            while (!details.isNull())
+-            {
+-                if (details.isElement())
+-                {
+-                    e = details.toElement();
+-
+-                    if (details.nodeName() == QString::fromLatin1("token"))
+-                    {
+-                        qCDebug(KIPIPLUGINS_LOG) << "Token=" << e.text();
+-                        m_token = e.text();      //this is what is obtained from data.
+-                    }
+-
+-                    if (details.nodeName() == QString::fromLatin1("perms"))
+-                    {
+-                        qCDebug(KIPIPLUGINS_LOG) << "Perms=" << e.text();
+-                    }
+-
+-                    if (details.nodeName() == QString::fromLatin1("user"))
+-                    {
+-                        qCDebug(KIPIPLUGINS_LOG) << "nsid=" << e.attribute(QString::fromLatin1("nsid"));
+-                        qCDebug(KIPIPLUGINS_LOG) << "username=" << e.attribute(QString::fromLatin1("username"));
+-                        qCDebug(KIPIPLUGINS_LOG) << "fullname=" << e.attribute(QString::fromLatin1("fullname"));
+-                        m_username = e.attribute(QString::fromLatin1("username"));
+-                        m_userId   = e.attribute(QString::fromLatin1("nsid"));
+-                    }
+-                }
+-
+-                details = details.nextSibling();
+-            }
+-
+-            success = true;
+-        }
+-        else if (node.isElement() && node.nodeName() == QString::fromLatin1("err"))
+-        {
+-            qCDebug(KIPIPLUGINS_LOG) << "Checking Error in response";
+-            errorString = node.toElement().attribute(QString::fromLatin1("code"));
+-            qCDebug(KIPIPLUGINS_LOG) << "Error code=" << errorString;
+-            qCDebug(KIPIPLUGINS_LOG) << "Msg=" << node.toElement().attribute(QString::fromLatin1("msg"));
+-            //emit signalError(code);
+-        }
+-
+-        node = node.nextSibling();
+-    }
+-
+-    qCDebug(KIPIPLUGINS_LOG) << "GetToken finished";
+-    //emit signalBusy( false );
+     m_authProgressDlg->hide();
+-
+-    if (success)
+-    {
+-        emit signalTokenObtained(m_token);
+-    }
+-    else
+-    {
+-        emit signalError(errorString);
+-    }
+ }
+ 
+ void FlickrTalker::parseResponseCreatePhotoSet(const QByteArray& data)
+@@ -1213,7 +747,7 @@ void FlickrTalker::parseResponseCreatePh
+ 
+     //bool success = false;
+ 
+-    QDomDocument doc(QString::fromLatin1("getListPhotoSets"));
++    QDomDocument doc(QLatin1String("getListPhotoSets"));
+ 
+     if (!doc.setContent(data))
+     {
+@@ -1226,10 +760,10 @@ void FlickrTalker::parseResponseCreatePh
+ 
+     while (!node.isNull())
+     {
+-        if (node.isElement() && node.nodeName() == QString::fromLatin1("photoset"))
++        if (node.isElement() && node.nodeName() == QLatin1String("photoset"))
+         {
+             // Parse the id from the response.
+-            QString new_id = node.toElement().attribute(QString::fromLatin1("id"));
++            QString new_id = node.toElement().attribute(QLatin1String("id"));
+ 
+             // Set the new id in the photo sets list.
+             QLinkedList<FPhotoSet>::iterator it = m_photoSetsList->begin();
+@@ -1252,12 +786,12 @@ void FlickrTalker::parseResponseCreatePh
+             emit signalAddPhotoSetSucceeded();
+         }
+ 
+-        if (node.isElement() && node.nodeName() == QString::fromLatin1("err"))
++        if (node.isElement() && node.nodeName() == QLatin1String("err"))
+         {
+             qCDebug(KIPIPLUGINS_LOG) << "Checking Error in response";
+-            QString code = node.toElement().attribute(QString::fromLatin1("code"));
++            QString code = node.toElement().attribute(QLatin1String("code"));
+             qCDebug(KIPIPLUGINS_LOG) << "Error code=" << code;
+-            QString msg = node.toElement().attribute(QString::fromLatin1("msg"));
++            QString msg = node.toElement().attribute(QLatin1String("msg"));
+             qCDebug(KIPIPLUGINS_LOG) << "Msg=" << msg;
+             QMessageBox::critical(QApplication::activeWindow(), i18n("Error"), i18n("PhotoSet creation failed: ") + msg);
+         }
+@@ -1270,7 +804,7 @@ void FlickrTalker::parseResponseListPhot
+ {
+     qCDebug(KIPIPLUGINS_LOG) << "parseResponseListPhotosets" << data;
+     bool success = false;
+-    QDomDocument doc(QString::fromLatin1("getListPhotoSets"));
++    QDomDocument doc(QLatin1String("getListPhotoSets"));
+ 
+     if (!doc.setContent(data))
+     {
+@@ -1286,7 +820,7 @@ void FlickrTalker::parseResponseListPhot
+ 
+     while (!node.isNull())
+     {
+-        if (node.isElement() && node.nodeName() == QString::fromLatin1("photosets"))
++        if (node.isElement() && node.nodeName() == QLatin1String("photosets"))
+         {
+             e                    = node.toElement();
+             QDomNode details     = e.firstChild();
+@@ -1299,10 +833,10 @@ void FlickrTalker::parseResponseListPhot
+                 {
+                     e = detailsNode.toElement();
+ 
+-                    if (detailsNode.nodeName() == QString::fromLatin1("photoset"))
++                    if (detailsNode.nodeName() == QLatin1String("photoset"))
+                     {
+-                        qCDebug(KIPIPLUGINS_LOG) << "id=" << e.attribute(QString::fromLatin1("id"));
+-                        photoSet_id              = e.attribute(QString::fromLatin1("id"));     // this is what is obtained from data.
++                        qCDebug(KIPIPLUGINS_LOG) << "id=" << e.attribute(QLatin1String("id"));
++                        photoSet_id              = e.attribute(QLatin1String("id"));     // this is what is obtained from data.
+                         fps.id                   = photoSet_id;
+                         QDomNode photoSetDetails = detailsNode.firstChild();
+                         QDomElement e_detail;
+@@ -1311,13 +845,13 @@ void FlickrTalker::parseResponseListPhot
+                         {
+                             e_detail = photoSetDetails.toElement();
+ 
+-                            if (photoSetDetails.nodeName() == QString::fromLatin1("title"))
++                            if (photoSetDetails.nodeName() == QLatin1String("title"))
+                             {
+                                 qCDebug(KIPIPLUGINS_LOG) << "Title=" << e_detail.text();
+                                 photoSet_title = e_detail.text();
+                                 fps.title      = photoSet_title;
+                             }
+-                            else if (photoSetDetails.nodeName() == QString::fromLatin1("description"))
++                            else if (photoSetDetails.nodeName() == QLatin1String("description"))
+                             {
+                                 qCDebug(KIPIPLUGINS_LOG) << "Description =" << e_detail.text();
+                                 photoSet_description = e_detail.text();
+@@ -1338,12 +872,12 @@ void FlickrTalker::parseResponseListPhot
+             success = true;
+         }
+ 
+-        if (node.isElement() && node.nodeName() == QString::fromLatin1("err"))
++        if (node.isElement() && node.nodeName() == QLatin1String("err"))
+         {
+             qCDebug(KIPIPLUGINS_LOG) << "Checking Error in response";
+-            QString code = node.toElement().attribute(QString::fromLatin1("code"));
++            QString code = node.toElement().attribute(QLatin1String("code"));
+             qCDebug(KIPIPLUGINS_LOG) << "Error code=" << code;
+-            qCDebug(KIPIPLUGINS_LOG) << "Msg=" << node.toElement().attribute(QString::fromLatin1("msg"));
++            qCDebug(KIPIPLUGINS_LOG) << "Msg=" << node.toElement().attribute(QLatin1String("msg"));
+             emit signalError(code);
+         }
+ 
+@@ -1365,7 +899,7 @@ void FlickrTalker::parseResponseListPhot
+ 
+ void FlickrTalker::parseResponseListPhotos(const QByteArray& data)
+ {
+-    QDomDocument doc(QString::fromLatin1("getPhotosList"));
++    QDomDocument doc(QLatin1String("getPhotosList"));
+ 
+     if (!doc.setContent(data))
+     {
+@@ -1380,7 +914,7 @@ void FlickrTalker::parseResponseListPhot
+ 
+ void FlickrTalker::parseResponseCreateAlbum(const QByteArray& data)
+ {
+-    QDomDocument doc(QString::fromLatin1("getCreateAlbum"));
++    QDomDocument doc(QLatin1String("getCreateAlbum"));
+ 
+     if (!doc.setContent(data))
+     {
+@@ -1397,7 +931,7 @@ void FlickrTalker::parseResponseAddPhoto
+ {
+     bool    success = false;
+     QString line;
+-    QDomDocument doc(QString::fromLatin1("AddPhoto Response"));
++    QDomDocument doc(QLatin1String("AddPhoto Response"));
+ 
+     if (!doc.setContent(data))
+     {
+@@ -1411,7 +945,7 @@ void FlickrTalker::parseResponseAddPhoto
+ 
+     while (!node.isNull())
+     {
+-        if (node.isElement() && node.nodeName() == QString::fromLatin1("photoid"))
++        if (node.isElement() && node.nodeName() == QLatin1String("photoid"))
+         {
+             e                = node.toElement();           // try to convert the node to an element.
+             QDomNode details = e.firstChild();
+@@ -1420,12 +954,12 @@ void FlickrTalker::parseResponseAddPhoto
+             success          = true;
+         }
+ 
+-        if (node.isElement() && node.nodeName() == QString::fromLatin1("err"))
++        if (node.isElement() && node.nodeName() == QLatin1String("err"))
+         {
+             qCDebug(KIPIPLUGINS_LOG) << "Checking Error in response";
+-            QString code = node.toElement().attribute(QString::fromLatin1("code"));
++            QString code = node.toElement().attribute(QLatin1String("code"));
+             qCDebug(KIPIPLUGINS_LOG) << "Error code=" << code;
+-            qCDebug(KIPIPLUGINS_LOG) << "Msg=" << node.toElement().attribute(QString::fromLatin1("msg"));
++            qCDebug(KIPIPLUGINS_LOG) << "Msg=" << node.toElement().attribute(QLatin1String("msg"));
+             emit signalError(code);
+         }
+ 
+@@ -1440,23 +974,14 @@ void FlickrTalker::parseResponseAddPhoto
+     {
+         QString photoSetId = m_selectedPhotoSet.id;
+ 
+-        if (photoSetId == QString::fromLatin1("-1"))
++        if (photoSetId == QLatin1String("-1"))
+         {
+             qCDebug(KIPIPLUGINS_LOG) << "PhotoSet Id not set, not adding the photo to any photoset";
+             emit signalAddPhotoSucceeded();
+         }
+         else
+         {
+-            if (m_serviceName == QString::fromLatin1("Zooomr"))
+-            {
+-                // addPhotoToPhotoSet not supported by Zooomr (Zooomr only has
+-                // smart folder-type photosets); silently fail
+-                emit signalAddPhotoSucceeded();
+-            }
+-            else
+-            {
+-                addPhotoToPhotoSet(photoId, photoSetId);
+-            }
++            addPhotoToPhotoSet(photoId, photoSetId);
+         }
+     }
+ }
+@@ -1465,7 +990,7 @@ void FlickrTalker::parseResponsePhotoPro
+ {
+     bool         success = false;
+     QString      line;
+-    QDomDocument doc(QString::fromLatin1("Photos Properties"));
++    QDomDocument doc(QLatin1String("Photos Properties"));
+ 
+     if (!doc.setContent(data))
+     {
+@@ -1478,7 +1003,7 @@ void FlickrTalker::parseResponsePhotoPro
+ 
+     while (!node.isNull())
+     {
+-        if (node.isElement() && node.nodeName() == QString::fromLatin1("photoid"))
++        if (node.isElement() && node.nodeName() == QLatin1String("photoid"))
+         {
+             e                = node.toElement();                 // try to convert the node to an element.
+             QDomNode details = e.firstChild();
+@@ -1486,12 +1011,12 @@ void FlickrTalker::parseResponsePhotoPro
+             qCDebug(KIPIPLUGINS_LOG) << "Photoid=" << e.text();
+         }
+ 
+-        if (node.isElement() && node.nodeName() == QString::fromLatin1("err"))
++        if (node.isElement() && node.nodeName() == QLatin1String("err"))
+         {
+             qCDebug(KIPIPLUGINS_LOG) << "Checking Error in response";
+-            QString code = node.toElement().attribute(QString::fromLatin1("code"));
++            QString code = node.toElement().attribute(QLatin1String("code"));
+             qCDebug(KIPIPLUGINS_LOG) << "Error code=" << code;
+-            qCDebug(KIPIPLUGINS_LOG) << "Msg=" << node.toElement().attribute(QString::fromLatin1("msg"));
++            qCDebug(KIPIPLUGINS_LOG) << "Msg=" << node.toElement().attribute(QLatin1String("msg"));
+             emit signalError(code);
+         }
+ 
+Index: digikam-5.3.0/extra/kipi-plugins/flickr/flickrtalker.h
+===================================================================
+--- digikam-5.3.0.orig/extra/kipi-plugins/flickr/flickrtalker.h
++++ digikam-5.3.0/extra/kipi-plugins/flickr/flickrtalker.h
+@@ -1,13 +1,14 @@
+ /* ============================================================
+  *
+- * This file is a part of kipi-plugins project
++ * This file is a part of digiKam project
+  * http://www.digikam.org
+  *
+  * Date        : 2005-07-07
+  * Description : a kipi plugin to export images to Flickr web service
+  *
+  * Copyright (C) 2005-2009 by Vardhman Jain <vardhman at gmail dot com>
+- * Copyright (C) 2009-2016 by Gilles Caulier <caulier dot gilles at gmail dot com>
++ * Copyright (C) 2009-2017 by Gilles Caulier <caulier dot gilles at gmail dot com>
++ * Copyright (C) 2017      by Maik Qualmann <metzpinguin at gmail dot com>
+  *
+  * This program is free software; you can redistribute it
+  * and/or modify it under the terms of the GNU General
+@@ -32,7 +33,6 @@
+ #include <QString>
+ #include <QObject>
+ #include <QNetworkReply>
+-#include <QCryptographicHash>
+ #include <QNetworkAccessManager>
+ 
+ // Libkipi includes
+@@ -42,6 +42,9 @@
+ // Local includes
+ 
+ #include "flickritem.h"
++#include "o1.h"
++#include "o0globals.h"
++#include "o1requestor.h"
+ 
+ class QProgressDialog;
+ 
+@@ -69,10 +72,6 @@ public:
+         FE_LISTPHOTOS,
+         FE_GETPHOTOPROPERTY,
+         FE_ADDPHOTO,
+-        FE_GETFROB,
+-        FE_CHECKTOKEN,
+-        FE_GETTOKEN,
+-        FE_GETAUTHORIZED,
+         FE_CREATEPHOTOSET,
+         FE_ADDPHOTOTOPHOTOSET,
+         FE_GETMAXSIZE
+@@ -83,13 +82,12 @@ public:
+     FlickrTalker(QWidget* const parent, const QString& serviceName);
+     ~FlickrTalker();
+ 
++    void    link();
++    void    unlink();
+     QString getUserName() const;
+     QString getUserId() const;
+     void    maxAllowedFileSize();
+     QString getMaxAllowedFileSize();
+-    void    getFrob();
+-    void    getToken();
+-    void    checkToken(const QString& token);
+     void    getPhotoProperty(const QString& method, const QStringList& argList);
+     void    cancel();
+ 
+@@ -102,7 +100,8 @@ public:
+ 
+     void    addPhotoToPhotoSet(const QString& photoId, const QString& photoSetId);
+     bool    addPhoto(const QString& photoPath, const FPhotoInfo& info,
+-                     bool rescale=false, int maxDim=600, int imageQuality=85);
++                     bool original = false, bool rescale = false,
++                     int maxDim = 600, int imageQuality = 85);
+ 
+ public:
+ 
+@@ -123,8 +122,7 @@ Q_SIGNALS:
+     void signalListPhotoSetsFailed(QString& msg);
+     void signalAddPhotoFailed(const QString& msg);
+     void signalListPhotoSetsFailed(const QString& msg);
+-    void signalAuthenticate();
+-    void signalTokenObtained(const QString& token);
++    void signalLinkingSucceeded();
+ 
+ private:
+ 
+@@ -134,36 +132,32 @@ private:
+     void parseResponseListPhotos(const QByteArray& data);
+     void parseResponseCreateAlbum(const QByteArray& data);
+     void parseResponseAddPhoto(const QByteArray& data);
+-    void parseResponseGetFrob(const QByteArray& data);
+-    void parseResponseGetToken(const QByteArray& data);
+-    void parseResponseCheckToken(const QByteArray& data);
+     void parseResponsePhotoProperty(const QByteArray& data);
+     void parseResponseCreatePhotoSet(const QByteArray& data);
+     void parseResponseAddPhotoToPhotoSet(const QByteArray& data);
+ 
+-    QString getApiSig(const QString& secret, const QUrl& url);
+-
+ private Q_SLOTS:
+ 
++    void slotLinkingFailed();
++    void slotLinkingSucceeded();
++    void slotOpenBrowser(const QUrl& url); 
+     void slotError(const QString& msg);
+-    void slotAuthenticate();
+     void slotFinished(QNetworkReply* reply);
+ 
+ private:
+ 
+     QWidget*               m_parent;
+-//  QString                m_cookie;
+     QByteArray             m_buffer;
+ 
+     QString                m_serviceName;
+     QString                m_apiUrl;
+     QString                m_authUrl;
++    QString                m_tokenUrl;
++    QString                m_accessUrl;
+     QString                m_uploadUrl;
+     QString                m_apikey;
+     QString                m_secret;
+-    QString                m_frob;
+     QString                m_maxSize;
+-    QString                m_token;
+     QString                m_username;
+     QString                m_userId;
+     QString                m_lastTmpFile;
+@@ -174,6 +168,9 @@ private:
+     State                  m_state;
+ 
+     Interface*             m_iface;
++
++    O1*                    m_o1;
++    O1Requestor*           m_requestor;
+ };
+ 
+ } // namespace KIPIFlickrPlugin
+Index: digikam-5.3.0/extra/kipi-plugins/flickr/flickrwidget.cpp
+===================================================================
+--- digikam-5.3.0.orig/extra/kipi-plugins/flickr/flickrwidget.cpp
++++ digikam-5.3.0/extra/kipi-plugins/flickr/flickrwidget.cpp
+@@ -61,7 +61,8 @@ FlickrWidget::FlickrWidget(QWidget* cons
+     //Adding Remove Account button
+     m_removeAccount              = new QPushButton(getAccountBox());
+     m_removeAccount->setText(i18n("Remove Account"));
+-    getAccountBoxLayout()->addWidget(m_removeAccount, 2,0,1,4);
++    m_removeAccount->hide();
++    getAccountBoxLayout()->addWidget(m_removeAccount, 2, 0, 1, 4);
+ 
+     // -- The image list --------------------------------------------------
+ 
+Index: digikam-5.3.0/extra/kipi-plugins/flickr/flickrwindow.cpp
+===================================================================
+--- digikam-5.3.0.orig/extra/kipi-plugins/flickr/flickrwindow.cpp
++++ digikam-5.3.0/extra/kipi-plugins/flickr/flickrwindow.cpp
+@@ -77,10 +77,6 @@ FlickrWindow::FlickrWindow(QWidget* cons
+     {
+         setWindowIcon(QIcon::fromTheme(QString::fromLatin1("kipi-hq")));
+     }
+-    else if (serviceName == QLatin1String("Zooomr"))
+-    {
+-        setWindowIcon(QIcon::fromTheme(QString::fromLatin1("kipi-zooomr")));
+-    }
+     else
+     {
+         setWindowIcon(QIcon::fromTheme(QString::fromLatin1("kipi-flickr")));
+@@ -136,9 +132,9 @@ FlickrWindow::FlickrWindow(QWidget* cons
+     // --------------------------------------------------------------------------
+     // About data and help button.
+ 
+-    KPAboutData* const about = new KPAboutData(ki18n("Flickr/23/Zooomr Export"),
++    KPAboutData* const about = new KPAboutData(ki18n("Flickr/23 Export"),
+                                                ki18n("A tool to export an image collection to a "
+-                                                     "Flickr / 23 / Zooomr web service."),
++                                                     "Flickr / 23 web service."),
+                                                ki18n("(c) 2005-2008, Vardhman Jain\n"
+                                                      "(c) 2008-2015, Gilles Caulier\n"
+                                                      "(c) 2009, Luka Renko\n"
+@@ -181,8 +177,8 @@ FlickrWindow::FlickrWindow(QWidget* cons
+     connect(m_talker, SIGNAL(signalListPhotoSetsFailed(QString)),
+             this, SLOT(slotListPhotoSetsFailed(QString)));
+ 
+-    connect(m_talker, SIGNAL(signalTokenObtained(QString)),
+-            this, SLOT(slotTokenObtained(QString)));
++    connect(m_talker, SIGNAL(signalLinkingSucceeded()),
++            this, SLOT(slotLinkingSucceeded()));
+ 
+     connect(m_widget->progressBar(), SIGNAL(signalProgressCanceled()),
+             this, SLOT(slotAddPhotoCancelAndClose()));
+@@ -304,17 +300,8 @@ void FlickrWindow::slotAddPhotoCancelAnd
+ void FlickrWindow::reactivate()
+ {
+     m_userNameDisplayLabel->setText(QString());
+-    readSettings(m_select->getUname());
+-    qCDebug(KIPIPLUGINS_LOG) << "Calling auth methods";
+-
+-    if (m_token.length() < 1)
+-    {
+-        m_talker->getFrob();
+-    }
+-    else
+-    {
+-        m_talker->checkToken(m_token);
+-    }
++    //readSettings(m_select->getUname());
++    m_talker->link();
+ 
+     m_widget->m_imglst->loadImagesFromCurrentSelection();
+     show();
+@@ -323,10 +310,8 @@ void FlickrWindow::reactivate()
+ void FlickrWindow::readSettings(QString uname)
+ {
+     KConfig config(QString::fromLatin1("kipirc"));
+-    qCDebug(KIPIPLUGINS_LOG) << "Group name is : "<<QString::fromLatin1("%1%2Export Settings").arg(m_serviceName,uname);
+-    KConfigGroup grp = config.group(QString::fromLatin1("%1%2Export Settings").arg(m_serviceName,uname));
+-    m_token          = grp.readEntry("token");
+-    qCDebug(KIPIPLUGINS_LOG) << "Token is : "<<m_token;
++    qCDebug(KIPIPLUGINS_LOG) << "Group name is : "<<QString::fromLatin1("%1%2Export Settings").arg(m_serviceName, uname);
++    KConfigGroup grp = config.group(QString::fromLatin1("%1%2Export Settings").arg(m_serviceName, uname));
+     m_exportHostTagsCheckBox->setChecked(grp.readEntry("Export Host Tags",      false));
+     m_extendedTagsButton->setChecked(grp.readEntry("Show Extended Tag Options", false));
+     m_addExtraTagsCheckBox->setChecked(grp.readEntry("Add Extra Tags",          false));
+@@ -392,16 +377,14 @@ void FlickrWindow::writeSettings()
+     qCDebug(KIPIPLUGINS_LOG) << "Group name is : "<<QString::fromLatin1("%1%2Export Settings").arg(m_serviceName,m_username);
+ 
+     if (QString::compare(QString::fromLatin1("%1Export Settings").arg(m_serviceName),
+-        QString::fromLatin1("%1%2Export Settings").arg(m_serviceName,m_username), Qt::CaseInsensitive) == 0)
++        QString::fromLatin1("%1%2Export Settings").arg(m_serviceName, m_username), Qt::CaseInsensitive) == 0)
+     {
+         qCDebug(KIPIPLUGINS_LOG) << "Not writing entry of group " << QString::fromLatin1("%1%2Export Settings").arg(m_serviceName,m_username);
+         return;
+     }
+ 
+-    KConfigGroup grp = config.group(QString::fromLatin1("%1%2Export Settings").arg(m_serviceName,m_username));
+-    grp.writeEntry("username",m_username);
+-    qCDebug(KIPIPLUGINS_LOG) << "Token written of group "<<QString::fromLatin1("%1%2Export Settings").arg(m_serviceName,m_username)<<" is "<<m_token;
+-    grp.writeEntry("token", m_token);
++    KConfigGroup grp = config.group(QString::fromLatin1("%1%2Export Settings").arg(m_serviceName, m_username));
++    grp.writeEntry("username",                          m_username);
+     grp.writeEntry("Export Host Tags",                  m_exportHostTagsCheckBox->isChecked());
+     grp.writeEntry("Show Extended Tag Options",         m_extendedTagsButton->isChecked());
+     grp.writeEntry("Add Extra Tags",                    m_addExtraTagsCheckBox->isChecked());
+@@ -427,39 +410,31 @@ void FlickrWindow::slotDoLogin()
+ {
+ }
+ 
+-void FlickrWindow::slotTokenObtained(const QString& token)
++void FlickrWindow::slotLinkingSucceeded()
+ {
+-    qCDebug(KIPIPLUGINS_LOG) << "Token Obtained is : "<<token;
+     m_username = m_talker->getUserName();
+     m_userId   = m_talker->getUserId();
+-    qCDebug(KIPIPLUGINS_LOG) << "SlotTokenObtained invoked setting user Display name to " << m_username;
++    qCDebug(KIPIPLUGINS_LOG) << "SlotLinkingSucceeded invoked setting user Display name to " << m_username;
+     m_userNameDisplayLabel->setText(QString::fromLatin1("<b>%1</b>").arg(m_username));
+ 
+     KConfig config(QString::fromLatin1("kipirc"));
+ 
+-    foreach ( const QString& group, config.groupList() )
++    foreach (const QString& group, config.groupList())
+     {
+-        if(!(group.contains(m_serviceName)))
++        if (!(group.contains(m_serviceName)))
+             continue;
+ 
+         KConfigGroup grp = config.group(group);
+ 
+-        if(group.contains(m_username))
++        if (group.contains(m_username))
+         {
+             readSettings(m_username);
+             break;
+         }
+     }
+ 
+-    m_token    = token;
+     writeSettings();
+-
+-    // Mutable photosets are not supported by Zooomr (Zooomr only has smart
+-    // folder-type photosets).
+-    if (m_serviceName != QString::fromLatin1("Zooomr"))
+-    {
+-        m_talker->listPhotoSets();
+-    }
++    m_talker->listPhotoSets();
+ }
+ 
+ void FlickrWindow::slotBusy(bool val)
+@@ -488,18 +463,11 @@ void FlickrWindow::slotUserChangeRequest
+ {
+     writeSettings();
+     qCDebug(KIPIPLUGINS_LOG) << "Slot Change User Request ";
+-    m_select->reactivate();
+-    readSettings(m_select->getUname());
+-    if (m_token.length() < 1)
+-    {
+-        m_talker->getFrob();
+-    }
+-    else
+-    {
+-        m_talker->checkToken(m_token);
+-    }
+-    //m_talker->getFrob();
+-    //  m_addPhotoButton->setEnabled(m_selectImagesButton->isChecked());
++    //m_select->reactivate();
++    //readSettings(m_select->getUname());
++
++     m_talker->unlink();
++     m_talker->link();
+ }
+ 
+ void FlickrWindow::slotRemoveAccount()
+@@ -507,7 +475,7 @@ void FlickrWindow::slotRemoveAccount()
+     KConfig config(QString::fromLatin1("kipirc"));
+     KConfigGroup grp = config.group(QString::fromLatin1("%1%2Export Settings").arg(m_serviceName).arg(m_username));
+ 
+-    if(grp.exists())
++    if (grp.exists())
+     {
+         qCDebug(KIPIPLUGINS_LOG) << "Removing Account having group"<<QString::fromLatin1("%1%2Export Settings").arg(m_serviceName);
+         grp.deleteGroup();
+@@ -545,8 +513,8 @@ QString FlickrWindow::guessSensibleSetNa
+     int totalCount = 0;
+     QString name;
+ 
+-    for(QMap<QString,int>::const_iterator it=nrFolderOccurences.constBegin();
+-        it!=nrFolderOccurences.constEnd(); ++it)
++    for (QMap<QString,int>::const_iterator it=nrFolderOccurences.constBegin();
++         it!=nrFolderOccurences.constEnd(); ++it)
+     {
+         totalCount += it.value();
+ 
+@@ -788,30 +756,25 @@ void FlickrWindow::slotAddPhotoNext()
+     Pair pathComments = m_uploadQueue.first();
+     FPhotoInfo info   = pathComments.second;
+ 
+-    // Find out the selected photo set.
+-    if (m_serviceName != QString::fromLatin1("Zooomr"))
++    QString selectedPhotoSetId = m_albumsListComboBox->itemData(m_albumsListComboBox->currentIndex()).toString();
++
++    if (selectedPhotoSetId.isEmpty())
++    {
++        m_talker->m_selectedPhotoSet = FPhotoSet();
++    }
++    else
+     {
+-        // mutable photosets are not supported by Zooomr (Zooomr only has smart folder-type photosets)
+-        QString selectedPhotoSetId = m_albumsListComboBox->itemData(m_albumsListComboBox->currentIndex()).toString();
++        QLinkedList<FPhotoSet>::iterator it = m_talker->m_photoSetsList->begin();
+ 
+-        if (selectedPhotoSetId.isEmpty())
+-        {
+-            m_talker->m_selectedPhotoSet = FPhotoSet();
+-        }
+-        else
++        while (it != m_talker->m_photoSetsList->end())
+         {
+-            QLinkedList<FPhotoSet>::iterator it = m_talker->m_photoSetsList->begin();
+-
+-            while (it != m_talker->m_photoSetsList->end())
++            if (it->id == selectedPhotoSetId)
+             {
+-                if (it->id == selectedPhotoSetId)
+-                {
+-                    m_talker->m_selectedPhotoSet = *it;
+-                    break;
+-                }
+-
+-                ++it;
++                m_talker->m_selectedPhotoSet = *it;
++                break;
+             }
++
++            ++it;
+         }
+     }
+ 
+Index: digikam-5.3.0/extra/kipi-plugins/flickr/flickrwindow.h
+===================================================================
+--- digikam-5.3.0.orig/extra/kipi-plugins/flickr/flickrwindow.h
++++ digikam-5.3.0/extra/kipi-plugins/flickr/flickrwindow.h
+@@ -95,7 +95,7 @@ public:
+ 
+ private Q_SLOTS:
+ 
+-    void slotTokenObtained(const QString& token);
++    void slotLinkingSucceeded();
+     void slotDoLogin();
+     void slotBusy(bool val);
+     void slotError(const QString& msg);
+@@ -165,7 +165,6 @@ private:
+ 
+ //  QHash<int, GAlbumViewItem>             m_albumDict;
+ 
+-    QString                                m_token;
+     QString                                m_username;
+     QString                                m_userId;
+     QString                                m_lastSelectedAlbum;
+Index: digikam-5.3.0/extra/kipi-plugins/flickr/plugin_flickr.cpp
+===================================================================
+--- digikam-5.3.0.orig/extra/kipi-plugins/flickr/plugin_flickr.cpp
++++ digikam-5.3.0/extra/kipi-plugins/flickr/plugin_flickr.cpp
+@@ -59,33 +59,27 @@ Plugin_Flickr::Plugin_Flickr(QObject* co
+ 
+     m_actionFlickr = 0;
+     m_action23     = 0;
+-    m_actionZooomr = 0;
+ 
+     m_dlgFlickr    = 0;
+     m_dlg23        = 0;
+-    m_dlgZooomr    = 0;
+ 
+     selectFlickr   = 0;
+     select23       = 0;
+-    selectZoomr    = 0;
+ }
+ 
+ Plugin_Flickr::~Plugin_Flickr()
+ {
+     delete m_dlgFlickr;
+     delete m_dlg23;
+-    delete m_dlgZooomr;
+ 
+     delete selectFlickr;
+     delete select23;
+-    delete selectZoomr;
+ }
+ 
+ void Plugin_Flickr::setup(QWidget* const widget)
+ {
+     m_dlgFlickr = 0;
+     m_dlg23     = 0;
+-    m_dlgZooomr = 0;
+ 
+     Plugin::setup(widget);
+ 
+@@ -107,13 +101,13 @@ void Plugin_Flickr::setupActions()
+     m_actionFlickr->setIcon(QIcon::fromTheme(QString::fromLatin1("kipi-flickr")));
+     actionCollection()->setDefaultShortcut(m_actionFlickr, Qt::ALT + Qt::SHIFT + Qt::Key_R);
+ 
+-    selectFlickr = new SelectUserDlg(0,QString::fromLatin1("Flickr"));
++    //selectFlickr = new SelectUserDlg(0,QString::fromLatin1("Flickr"));
+ 
+     connect(m_actionFlickr, SIGNAL(triggered(bool)),
+             this, SLOT(slotActivateFlickr()));
+ 
+     addAction(QString::fromLatin1("flickrexport"), m_actionFlickr);
+-
++/*
+     m_action23 = new QAction(this);
+     m_action23->setText(i18n("Export to &23..."));
+     m_action23->setIcon(QIcon::fromTheme(QString::fromLatin1("kipi-hq")));
+@@ -125,23 +119,12 @@ void Plugin_Flickr::setupActions()
+             this, SLOT(slotActivate23()));
+ 
+     addAction(QString::fromLatin1("23export"), m_action23);
+-
+-    m_actionZooomr = new QAction(this);
+-    m_actionZooomr->setText(i18n("Export to &Zooomr..."));
+-    m_actionZooomr->setIcon(QIcon::fromTheme(QString::fromLatin1("kipi-zooomr")));
+-    actionCollection()->setDefaultShortcut(m_actionZooomr, Qt::ALT + Qt::SHIFT + Qt::Key_Z);
+-
+-    selectZoomr = new SelectUserDlg(0,QString::fromLatin1("Zooomr"));
+-
+-    connect(m_actionZooomr, SIGNAL(triggered(bool)),
+-            this, SLOT(slotActivateZooomr()));
+-
+-    addAction(QString::fromLatin1("Zooomrexport"), m_actionZooomr);
++*/
+ }
+ 
+ void Plugin_Flickr::slotActivateFlickr()
+ {
+-    selectFlickr->reactivate();
++    //selectFlickr->reactivate();
+ 
+     if (!m_dlgFlickr)
+     {
+@@ -183,28 +166,6 @@ void Plugin_Flickr::slotActivate23()
+     m_dlg23->reactivate();
+ }
+ 
+-void Plugin_Flickr::slotActivateZooomr()
+-{
+-    selectZoomr->reactivate();
+-
+-    if (!m_dlgZooomr)
+-    {
+-        // We clean it up in the close button
+-        m_dlgZooomr = new FlickrWindow(QApplication::activeWindow(), QString::fromLatin1("Zooomr"), selectZoomr);
+-    }
+-    else
+-    {
+-        if (m_dlgZooomr->isMinimized())
+-        {
+-            KWindowSystem::unminimizeWindow(m_dlgZooomr->winId());
+-        }
+-
+-        KWindowSystem::activateWindow(m_dlgZooomr->winId());
+-    }
+-
+-    m_dlgZooomr->reactivate();
+-}
+-
+ } // namespace KIPIFlickrPlugin
+ 
+ #include "plugin_flickr.moc"
+Index: digikam-5.3.0/extra/kipi-plugins/flickr/plugin_flickr.h
+===================================================================
+--- digikam-5.3.0.orig/extra/kipi-plugins/flickr/plugin_flickr.h
++++ digikam-5.3.0/extra/kipi-plugins/flickr/plugin_flickr.h
+@@ -56,7 +56,6 @@ public Q_SLOTS:
+ 
+     void slotActivateFlickr();
+     void slotActivate23();
+-    void slotActivateZooomr();
+ 
+ private:
+ 
+@@ -66,15 +65,12 @@ private:
+ 
+     QAction*       m_actionFlickr;
+     QAction*       m_action23;
+-    QAction*       m_actionZooomr;
+ 
+     FlickrWindow*  m_dlgFlickr;
+     FlickrWindow*  m_dlg23;
+-    FlickrWindow*  m_dlgZooomr;
+ 
+     SelectUserDlg* selectFlickr;
+     SelectUserDlg* select23;
+-    SelectUserDlg* selectZoomr;
+ };
+ 
+ } //namespace KIPIFlickrPlugin
diff -durN orig/digikam-5.3.0/debian/patches/series new/digikam-5.3.0/debian/patches/series
--- orig/digikam-5.3.0/debian/patches/series	2016-11-12 13:44:51.000000000 -0600
+++ new/digikam-5.3.0/debian/patches/series	2017-09-07 11:47:09.725648304 -0500
@@ -1 +1,2 @@
 cmake-disable-jasper.patch
+flickr.diff
-------------- next part --------------
diff -durN orig/digikam-5.3.0/core/CMakeLists.txt digikam-5.3.0/core/CMakeLists.txt
--- orig/digikam-5.3.0/core/CMakeLists.txt	2017-09-07 11:42:00.000000000 -0500
+++ digikam-5.3.0/core/CMakeLists.txt	2017-09-07 11:44:58.000000000 -0500
@@ -270,7 +270,7 @@
 find_package(Marble)
 
 find_package(PkgConfig)
-#find_package(Jasper) -- disabled by Debian
+find_package(Jasper)
 find_package(Eigen3)                               # For Refocus tool.
 find_package(OpenGL)                               # For Presentation tool.
 
diff -durN orig/digikam-5.3.0/debian/patches/flickr.diff digikam-5.3.0/debian/patches/flickr.diff
--- orig/digikam-5.3.0/debian/patches/flickr.diff	1969-12-31 18:00:00.000000000 -0600
+++ digikam-5.3.0/debian/patches/flickr.diff	2017-09-07 11:17:46.344112879 -0500
@@ -0,0 +1,1925 @@
+Index: digikam-5.3.0/extra/kipi-plugins/common/libkipiplugins/CMakeLists.txt
+===================================================================
+--- digikam-5.3.0.orig/extra/kipi-plugins/common/libkipiplugins/CMakeLists.txt
++++ digikam-5.3.0/extra/kipi-plugins/common/libkipiplugins/CMakeLists.txt
+@@ -54,9 +54,9 @@ set(o2_SRCS
+     ${CMAKE_CURRENT_SOURCE_DIR}/o2/src/o0abstractstore.h
+     ${CMAKE_CURRENT_SOURCE_DIR}/o2/src/o0globals.h
+     # Enable when needed
+-    #${CMAKE_CURRENT_SOURCE_DIR}/o2/src/o1.cpp
+-    #${CMAKE_CURRENT_SOURCE_DIR}/o2/src/o1requestor.cpp
+-    #${CMAKE_CURRENT_SOURCE_DIR}/o2/src/o1timedreply.cpp
++    ${CMAKE_CURRENT_SOURCE_DIR}/o2/src/o1.cpp
++    ${CMAKE_CURRENT_SOURCE_DIR}/o2/src/o1requestor.cpp
++    ${CMAKE_CURRENT_SOURCE_DIR}/o2/src/o1timedreply.cpp
+     #${CMAKE_CURRENT_SOURCE_DIR}/o2/src/o1twitter.h
+     #${CMAKE_CURRENT_SOURCE_DIR}/o2/src/oxtwitter.cpp
+     #${CMAKE_CURRENT_SOURCE_DIR}/o2/src/o1dropbox.h
+Index: digikam-5.3.0/extra/kipi-plugins/flickr/flickrtalker.cpp
+===================================================================
+--- digikam-5.3.0.orig/extra/kipi-plugins/flickr/flickrtalker.cpp
++++ digikam-5.3.0/extra/kipi-plugins/flickr/flickrtalker.cpp
+@@ -1,13 +1,14 @@
+ /* ============================================================
+  *
+- * This file is a part of kipi-plugins project
++ * This file is a part of digiKam project
+  * http://www.digikam.org
+  *
+  * Date        : 2005-07-07
+  * Description : a kipi plugin to export images to Flickr web service
+  *
+  * Copyright (C) 2005-2009 by Vardhman Jain <vardhman at gmail dot com>
+- * Copyright (C) 2009-2016 by Gilles Caulier <caulier dot gilles at gmail dot com>
++ * Copyright (C) 2009-2017 by Gilles Caulier <caulier dot gilles at gmail dot com>
++ * Copyright (C) 2017      by Maik Qualmann <metzpinguin at gmail dot com>
+  *
+  * This program is free software; you can redistribute it
+  * and/or modify it under the terms of the GNU General
+@@ -34,7 +35,6 @@
+ #include <QMap>
+ #include <QStringList>
+ #include <QProgressDialog>
+-#include <QUrlQuery>
+ #include <QStandardPaths>
+ #include <QApplication>
+ #include <QDesktopServices>
+@@ -68,6 +68,8 @@ FlickrTalker::FlickrTalker(QWidget* cons
+     m_state           = FE_LOGOUT;
+     m_serviceName     = serviceName;
+     m_iface           = 0;
++    m_o1              = 0;
++    m_requestor       = 0;
+ 
+     PluginLoader* const pl = PluginLoader::instance();
+ 
+@@ -76,34 +78,27 @@ FlickrTalker::FlickrTalker(QWidget* cons
+         m_iface = pl->interface();
+     }
+ 
+-    if (serviceName == QString::fromLatin1("23"))
++    if (serviceName == QLatin1String("23"))
+     {
+-        m_apiUrl    = QString::fromLatin1("http://www.23hq.com/services/rest/");
+-        m_authUrl   = QString::fromLatin1("http://www.23hq.com/services/auth/");
+-        m_uploadUrl = QString::fromLatin1("http://www.23hq.com/services/upload/");
++        m_apiUrl    = QLatin1String("http://www.23hq.com/services/rest/");
++        m_authUrl   = QLatin1String("http://www.23hq.com/services/auth/");
++        m_uploadUrl = QLatin1String("http://www.23hq.com/services/upload/");
+ 
+         // bshanks: do 23 and flickr really share API keys? or does 23 not need
+         // one?
+-        m_apikey    = QString::fromLatin1("49d585bafa0758cb5c58ab67198bf632");
+-        m_secret    = QString::fromLatin1("34b39925e6273ffd");
+-    }
+-    else if (serviceName == QString::fromLatin1("Zooomr"))
+-    {
+-        m_apiUrl    = QString::fromLatin1("http://api.zooomr.com/services/rest/");
+-        m_authUrl   = QString::fromLatin1("http://www.zooomr.com/services/auth/");
+-        m_uploadUrl = QString::fromLatin1("http://upload.zooomr.com/services/upload/");
+-
+-        m_apikey    = QString::fromLatin1("18c8db5ce9ed4e15a7b484136f5080c5");
+-        m_secret    = QString::fromLatin1("1ea4af14e3");
++        m_apikey    = QLatin1String("49d585bafa0758cb5c58ab67198bf632");
++        m_secret    = QLatin1String("34b39925e6273ffd");
+     }
+     else
+     {
+-        m_apiUrl    = QString::fromLatin1("https://www.flickr.com/services/rest/");
+-        m_authUrl   = QString::fromLatin1("https://www.flickr.com/services/auth/");
+-        m_uploadUrl = QString::fromLatin1("https://api.flickr.com/services/upload/");
++        m_apiUrl    = QLatin1String("https://www.flickr.com/services/rest/");
++        m_authUrl   = QLatin1String("https://www.flickr.com/services/oauth/authorize?perms=write");
++        m_tokenUrl  = QLatin1String("https://www.flickr.com/services/oauth/request_token");
++        m_accessUrl = QLatin1String("https://www.flickr.com/services/oauth/access_token");
++        m_uploadUrl = QLatin1String("https://up.flickr.com/services/upload/");
+ 
+-        m_apikey    = QString::fromLatin1("49d585bafa0758cb5c58ab67198bf632");
+-        m_secret    = QString::fromLatin1("34b39925e6273ffd");
++        m_apikey    = QLatin1String("49d585bafa0758cb5c58ab67198bf632");
++        m_secret    = QLatin1String("34b39925e6273ffd");
+     }
+ 
+     m_netMngr = new QNetworkAccessManager(this);
+@@ -116,8 +111,24 @@ FlickrTalker::FlickrTalker(QWidget* cons
+     /* Initialize photo sets list. */
+     m_photoSetsList    = new QLinkedList<FPhotoSet>();
+ 
+-    connect(this, SIGNAL(signalAuthenticate()),
+-            this, SLOT(slotAuthenticate()));
++    m_o1 = new O1(this);
++
++    m_o1->setClientId(m_apikey);
++    m_o1->setClientSecret(m_secret);
++    m_o1->setAuthorizeUrl(QUrl(m_authUrl));
++    m_o1->setAccessTokenUrl(QUrl(m_accessUrl));
++    m_o1->setRequestTokenUrl(QUrl(m_tokenUrl));
++
++    connect(m_o1, SIGNAL(linkingFailed()),
++            this, SLOT(slotLinkingFailed()));
++
++    connect(m_o1, SIGNAL(linkingSucceeded()),
++            this, SLOT(slotLinkingSucceeded()));
++
++    connect(m_o1, SIGNAL(openBrowser(QUrl)),
++            this, SLOT(slotOpenBrowser(QUrl)));
++
++    m_requestor = new O1Requestor(m_netMngr, m_o1, this);
+ }
+ 
+ FlickrTalker::~FlickrTalker()
+@@ -132,144 +143,51 @@ FlickrTalker::~FlickrTalker()
+     removeTemporaryDir(m_serviceName.toLatin1().constData());
+ }
+ 
+-/** Compute MD5 signature using url queries keys and values following Flickr notice:
+-    http://www.flickr.com/services/api/auth.spec.html
+-*/
+-QString FlickrTalker::getApiSig(const QString& secret, const QUrl& url)
++void FlickrTalker::link()
+ {
+-    QUrlQuery urlQuery(url.query());
+-    QList<QPair<QString, QString> > temp_queries = urlQuery.queryItems();
+-    QMap<QString, QString> queries;
+-
+-    QPair<QString, QString> pair;
+-
+-    foreach(pair, temp_queries)
+-    {
+-        queries.insert(pair.first,pair.second);
+-    }
+-
+-    QString compressed(secret);
+-
+-    // NOTE: iterator QMap iterator will sort alphabetically items based on key values.
+-    for (QMap<QString, QString>::iterator it = queries.begin() ; it != queries.end(); ++it)
+-    {
+-        compressed.append(it.key());
+-        compressed.append(it.value());
+-    }
++    emit signalBusy(true);
++    m_o1->link();
++}
+ 
+-    QCryptographicHash context(QCryptographicHash::Md5);
+-    context.addData(compressed.toUtf8());
+-    return QLatin1String(context.result().toHex().data());
++void FlickrTalker::unlink()
++{
++    m_o1->unlink();
+ }
+ 
+-QString FlickrTalker::getMaxAllowedFileSize()
++void FlickrTalker::slotLinkingFailed()
+ {
+-    return m_maxSize;
++    qCDebug(KIPIPLUGINS_LOG) << "LINK to Fickr fail";
++    emit signalBusy(false);
+ }
+ 
+-void FlickrTalker::maxAllowedFileSize()
++void FlickrTalker::slotLinkingSucceeded()
+ {
+-    if (m_reply)
++    if (!m_o1->linked())
+     {
+-        m_reply->abort();
+-        m_reply = 0;
++        qCDebug(KIPIPLUGINS_LOG) << "UNLINK to Fickr ok";
++        return;
+     }
+ 
+-    QUrl url(m_apiUrl);
+-    QUrlQuery urlQuery;
+-    urlQuery.addQueryItem(QString::fromLatin1("auth_token"), m_token);
+-    urlQuery.addQueryItem(QString::fromLatin1("api_key"), m_apikey);
+-    urlQuery.addQueryItem(QString::fromLatin1("method"), QString::fromLatin1("flickr.people.getLimits"));
+-    url.setQuery(urlQuery);
+-    QString md5 = getApiSig(m_secret, url);
+-    urlQuery.addQueryItem(QString::fromLatin1("api_sig"), md5);
+-    url.setQuery(urlQuery);
+-    qCDebug(KIPIPLUGINS_LOG) << "Get max file size url: " << url;
+-
+-    if (m_serviceName == QString::fromLatin1("Zooomr"))
+-    {
+-        // Zooomr redirects the POST at this url to a GET.
+-        m_reply = m_netMngr->get(QNetworkRequest(url));
+-    }
+-    else
+-    {
+-        QNetworkRequest netRequest(url);
+-        netRequest.setHeader(QNetworkRequest::ContentTypeHeader, QLatin1String("application/x-www-form-urlencoded"));
++    qCDebug(KIPIPLUGINS_LOG) << "LINK to Fickr ok";
+ 
+-        m_reply = m_netMngr->post(netRequest, QByteArray());
+-    }
++    m_username = m_o1->extraTokens()[QLatin1String("username")].toString();
++    m_userId   = m_o1->extraTokens()[QLatin1String("user_nsid")].toString();
+ 
+-    m_state = FE_GETMAXSIZE;
+-    m_authProgressDlg->setLabelText(i18n("Getting the maximum allowed file size."));
+-    m_authProgressDlg->setMaximum(4);
+-    m_authProgressDlg->setValue(1);
+-    m_buffer.resize(0);
+-    emit signalBusy(true);
++    emit signalLinkingSucceeded();
+ }
+ 
+-// MD5 signature of the request.
+-/*
+-QString FlickrTalker::getApiSig(const QString& secret, const QStringList &headers)
++void FlickrTalker::slotOpenBrowser(const QUrl& url)
+ {
+-    QMap<QString, QString> queries = url.queryItems();
+-    QString compressed(secret);
+-
+-    // NOTE: iterator QMap iterator will sort alphabetically items based on key values.
+-    for (QMap<QString, QString>::iterator it = queries.begin() ; it != queries.end(); ++it)
+-    {
+-        compressed.append(it.key());
+-        compressed.append(it.value());
+-    }
+-
+-    QCryptographicHash context(QCryptographicHash::Md5);
+-    context.addData(compressed.toUtf8());
+-    return context.result().toHex().data();
++    qCDebug(KIPIPLUGINS_LOG) << "Open Browser...";
++    QDesktopServices::openUrl(url);
+ }
+-*/
+ 
+-/**get the API sig and send it to the server server should return a frob.
+-*/
+-void FlickrTalker::getFrob()
++QString FlickrTalker::getMaxAllowedFileSize()
+ {
+-    if (m_reply)
+-    {
+-        m_reply->abort();
+-        m_reply = 0;
+-    }
+-
+-    QUrl url(m_apiUrl);
+-    QUrlQuery urlQuery;
+-    urlQuery.addQueryItem(QString::fromLatin1("method"), QString::fromLatin1("flickr.auth.getFrob"));
+-    urlQuery.addQueryItem(QString::fromLatin1("api_key"), m_apikey);
+-    url.setQuery(urlQuery);
+-
+-    QString md5 = getApiSig(m_secret, url);
+-    urlQuery.addQueryItem(QString::fromLatin1("api_sig"), md5);
+-    url.setQuery(urlQuery);
+-    qCDebug(KIPIPLUGINS_LOG) << "Get frob url: " << url;
+-
+-    if (m_serviceName == QString::fromLatin1("Zooomr"))
+-    {
+-        // Zooomr redirects the POST at this url to a GET.
+-        m_reply = m_netMngr->get(QNetworkRequest(url));
+-    }
+-    else
+-    {
+-        QNetworkRequest netRequest(url);
+-        netRequest.setHeader(QNetworkRequest::ContentTypeHeader, QLatin1String("application/x-www-form-urlencoded"));
+-
+-        m_reply = m_netMngr->post(netRequest, QByteArray());
+-    }
+-
+-    m_state = FE_GETFROB;
+-    m_authProgressDlg->setLabelText(i18n("Getting the Frob"));
+-    m_authProgressDlg->setMaximum(4);
+-    m_authProgressDlg->setValue(1);
+-    m_buffer.resize(0);
+-    emit signalBusy(true);
++    return m_maxSize;
+ }
+ 
+-void FlickrTalker::checkToken(const QString& token)
++void FlickrTalker::maxAllowedFileSize()
+ {
+     if (m_reply)
+     {
+@@ -277,39 +195,30 @@ void FlickrTalker::checkToken(const QStr
+         m_reply = 0;
+     }
+ 
++    if (!m_o1->linked())
++        return;
++
+     QUrl url(m_apiUrl);
+-    QUrlQuery urlQuery;
+-    urlQuery.addQueryItem(QString::fromLatin1("method"), QString::fromLatin1("flickr.auth.checkToken"));
+-    urlQuery.addQueryItem(QString::fromLatin1("api_key"), m_apikey);
+-    urlQuery.addQueryItem(QString::fromLatin1("auth_token"), token);
+-    url.setQuery(urlQuery);
+-    QString md5 = getApiSig(m_secret, url);
+-    urlQuery.addQueryItem(QString::fromLatin1("api_sig"), md5);
+-    url.setQuery(urlQuery);
+-    qCDebug(KIPIPLUGINS_LOG) << "Check token url: " << url;
++    QNetworkRequest netRequest(url);
++    QList<O0RequestParameter> reqParams = QList<O0RequestParameter>();
+ 
+-    if (m_serviceName == QString::fromLatin1("Zooomr"))
+-    {
+-        // Zooomr redirects the POST at this url to a GET.
+-        m_reply = m_netMngr->get(QNetworkRequest(url));
+-    }
+-    else
+-    {
+-        QNetworkRequest netRequest(url);
+-        netRequest.setHeader(QNetworkRequest::ContentTypeHeader, QLatin1String("application/x-www-form-urlencoded"));
++    netRequest.setHeader(QNetworkRequest::ContentTypeHeader, QLatin1String(O2_MIME_TYPE_XFORM));
+ 
+-        m_reply = m_netMngr->post(netRequest, QByteArray());
+-    }
++    reqParams << O0RequestParameter("method", "flickr.people.getLimits");
++
++    QByteArray postData = O1::createQueryParameters(reqParams);
+ 
+-    m_state = FE_CHECKTOKEN;
+-    m_authProgressDlg->setLabelText(i18n("Checking if previous token is still valid"));
++    m_reply = m_requestor->post(netRequest, reqParams, postData);
++
++    m_state = FE_GETMAXSIZE;
++    m_authProgressDlg->setLabelText(i18n("Getting the maximum allowed file size."));
+     m_authProgressDlg->setMaximum(4);
+     m_authProgressDlg->setValue(1);
+     m_buffer.resize(0);
+     emit signalBusy(true);
+ }
+ 
+-void FlickrTalker::slotAuthenticate()
++void FlickrTalker::listPhotoSets()
+ {
+     if (m_reply)
+     {
+@@ -317,116 +226,22 @@ void FlickrTalker::slotAuthenticate()
+         m_reply = 0;
+     }
+ 
+-    QUrl url(m_authUrl);
+-    QUrlQuery urlQuery;
+-    urlQuery.addQueryItem(QString::fromLatin1("api_key"), m_apikey);
+-    urlQuery.addQueryItem(QString::fromLatin1("frob"), m_frob);
+-    urlQuery.addQueryItem(QString::fromLatin1("perms"), QString::fromLatin1("write"));
+-    url.setQuery(urlQuery);
+-
+-    QString md5 = getApiSig(m_secret, url);
+-    urlQuery.addQueryItem(QString::fromLatin1("api_sig"), md5);
+-    url.setQuery(urlQuery);
+-    qCDebug(KIPIPLUGINS_LOG) << "Authenticate url: " << url;
+-
+-    QDesktopServices::openUrl(url);
+-
+-    QMessageBox quest(QMessageBox::Question,
+-                      i18n("%1 Service Web Authorization", m_serviceName),
+-                      i18n("Please follow the instructions in the browser window, then "
+-                           "return to press corresponding button."),
+-                      QMessageBox::Yes | QMessageBox::No);
+-
+-    (quest.button(QMessageBox::Yes))->setText(i18n("I am authenticated"));
+-    (quest.button(QMessageBox::No))->setText(i18n("I am not authenticated"));
+-
+-    if (quest.exec() == QMessageBox::Yes)
+-    {
+-        getToken();
+-        m_authProgressDlg->setLabelText(i18n("Authenticating the User on web"));
+-        m_authProgressDlg->setMaximum(4);
+-        m_authProgressDlg->setValue(2);
+-        emit signalBusy(false);
+-    }
+-    else
+-    {
+-        qCDebug(KIPIPLUGINS_LOG) << "User didn't proceed with getToken Authorization, cannot proceed further, aborting";
+-        cancel();
+-    }
+-}
++    if (!m_o1->linked())
++        return;
+ 
+-void FlickrTalker::getToken()
+-{
+-    if (m_reply)
+-    {
+-        m_reply->abort();
+-        m_reply = 0;
+-    }
++    qCDebug(KIPIPLUGINS_LOG) << "List photoset invoked";
+ 
+     QUrl url(m_apiUrl);
+-    QUrlQuery urlQuery;
+-    urlQuery.addQueryItem(QString::fromLatin1("api_key"), m_apikey);
+-    urlQuery.addQueryItem(QString::fromLatin1("method"), QString::fromLatin1("flickr.auth.getToken"));
+-    urlQuery.addQueryItem(QString::fromLatin1("frob"), m_frob);
+-    url.setQuery(urlQuery);
+-    QString md5 = getApiSig(m_secret, url);
+-    urlQuery.addQueryItem(QString::fromLatin1("api_sig"), md5);
+-    url.setQuery(urlQuery);
+-    qCDebug(KIPIPLUGINS_LOG) << "Get token url: " << url;
++    QNetworkRequest netRequest(url);
++    QList<O0RequestParameter> reqParams = QList<O0RequestParameter>();
+ 
+-    if (m_serviceName == QString::fromLatin1("Zooomr"))
+-    {
+-        // Zooomr redirects the POST at this url to a GET.
+-        m_reply = m_netMngr->get(QNetworkRequest(url));
+-    }
+-    else
+-    {
+-        QNetworkRequest netRequest(url);
+-        netRequest.setHeader(QNetworkRequest::ContentTypeHeader, QLatin1String("application/x-www-form-urlencoded"));
++    netRequest.setHeader(QNetworkRequest::ContentTypeHeader, QLatin1String(O2_MIME_TYPE_XFORM));
+ 
+-        m_reply = m_netMngr->post(netRequest, QByteArray());
+-    }
++    reqParams << O0RequestParameter("method", "flickr.photosets.getList");
+ 
+-    m_state = FE_GETTOKEN;
+-    m_buffer.resize(0);
+-    emit signalBusy(true);
+-    m_authProgressDlg->setLabelText(i18n("Getting the Token from the server"));
+-    m_authProgressDlg->setMaximum(4);
+-    m_authProgressDlg->setValue(3);
+-}
++    QByteArray postData = O1::createQueryParameters(reqParams);
+ 
+-void FlickrTalker::listPhotoSets()
+-{
+-    if (m_reply)
+-    {
+-        m_reply->abort();
+-        m_reply = 0;
+-    }
+-
+-    qCDebug(KIPIPLUGINS_LOG) << "List photoset invoked";
+-    QUrl url(m_apiUrl);
+-    QUrlQuery urlQuery;
+-    urlQuery.addQueryItem(QString::fromLatin1("auth_token"), m_token);
+-    urlQuery.addQueryItem(QString::fromLatin1("api_key"), m_apikey);
+-    urlQuery.addQueryItem(QString::fromLatin1("method"), QString::fromLatin1("flickr.photosets.getList"));
+-    url.setQuery(urlQuery);
+-    QString md5 = getApiSig(m_secret, url);
+-    urlQuery.addQueryItem(QString::fromLatin1("api_sig"), md5);
+-    url.setQuery(urlQuery);
+-    qCDebug(KIPIPLUGINS_LOG) << "List photoset URL" << url;
+-
+-    if (m_serviceName == QString::fromLatin1("Zooomr"))
+-    {
+-        // Zooomr redirects the POST at this url to a GET.
+-        m_reply = m_netMngr->get(QNetworkRequest(url));
+-    }
+-    else
+-    {
+-        QNetworkRequest netRequest(url);
+-        netRequest.setHeader(QNetworkRequest::ContentTypeHeader, QLatin1String("application/x-www-form-urlencoded"));
+-
+-        m_reply = m_netMngr->post(netRequest, QByteArray());
+-    }
++    m_reply = m_requestor->post(netRequest, reqParams, postData);
+ 
+     m_state = FE_LISTPHOTOSETS;
+     m_buffer.resize(0);
+@@ -441,43 +256,30 @@ void FlickrTalker::getPhotoProperty(cons
+         m_reply = 0;
+     }
+ 
++    if (!m_o1->linked())
++        return;
++
+     QUrl url(m_apiUrl);
+-    QUrlQuery urlQuery;
+-    urlQuery.addQueryItem(QString::fromLatin1("api_key"), m_apikey);
+-    urlQuery.addQueryItem(QString::fromLatin1("method"), method);
+-    urlQuery.addQueryItem(QString::fromLatin1("frob"), m_frob);
++    QNetworkRequest netRequest(url);
++    QList<O0RequestParameter> reqParams = QList<O0RequestParameter>();
++
++    netRequest.setHeader(QNetworkRequest::ContentTypeHeader, QLatin1String(O2_MIME_TYPE_XFORM));
++
++    reqParams << O0RequestParameter("method", method.toLatin1());
+ 
+     for (QStringList::const_iterator it = argList.constBegin(); it != argList.constEnd(); ++it)
+     {
+         QStringList str = (*it).split(QLatin1Char('='), QString::SkipEmptyParts);
+-        urlQuery.addQueryItem(str[0], str[1]);
++        reqParams << O0RequestParameter(str[0].toLatin1(), str[1].toLatin1());
+     }
+ 
+-    url.setQuery(urlQuery);
+-    QString md5 = getApiSig(m_secret, url);
+-    urlQuery.addQueryItem(QString::fromLatin1("api_sig"), md5);
+-    url.setQuery(urlQuery);
+-    qCDebug(KIPIPLUGINS_LOG) << "Get photo property url: " << url;
+-
+-    if (m_serviceName == QString::fromLatin1("Zooomr"))
+-    {
+-        // Zooomr redirects the POST at this url to a GET.
+-        m_reply = m_netMngr->get(QNetworkRequest(url));
+-    }
+-    else
+-    {
+-        QNetworkRequest netRequest(url);
+-        netRequest.setHeader(QNetworkRequest::ContentTypeHeader, QLatin1String("application/x-www-form-urlencoded"));
++    QByteArray postData = O1::createQueryParameters(reqParams);
+ 
+-        m_reply = m_netMngr->post(netRequest, QByteArray());
+-    }
++    m_reply = m_requestor->post(netRequest, reqParams, postData);
+ 
+     m_state = FE_GETPHOTOPROPERTY;
+     m_buffer.resize(0);
+     emit signalBusy(true);
+-
+-    //  m_authProgressDlg->setLabelText("Getting the Token from the server");
+-    //  m_authProgressDlg->setProgress(3,4);
+ }
+ 
+ void FlickrTalker::listPhotos(const QString& /*albumName*/)
+@@ -494,34 +296,25 @@ void FlickrTalker::createPhotoSet(const
+         m_reply = 0;
+     }
+ 
+-    qCDebug(KIPIPLUGINS_LOG) << "create photoset invoked";
++    if (!m_o1->linked())
++        return;
++
++    qCDebug(KIPIPLUGINS_LOG) << "Create photoset invoked";
++
+     QUrl url(m_apiUrl);
+-    QUrlQuery urlQuery;
+-    urlQuery.addQueryItem(QString::fromLatin1("auth_token"), m_token);
+-    urlQuery.addQueryItem(QString::fromLatin1("api_key"), m_apikey);
+-    urlQuery.addQueryItem(QString::fromLatin1("method"), QString::fromLatin1("flickr.photosets.create"));
+-    urlQuery.addQueryItem(QString::fromLatin1("title"), albumTitle);
+-    urlQuery.addQueryItem(QString::fromLatin1("description"), albumDescription);
+-    urlQuery.addQueryItem(QString::fromLatin1("primary_photo_id"), primaryPhotoId);
+-    url.setQuery(urlQuery);
+-
+-    QString md5 = getApiSig(m_secret, url);
+-    urlQuery.addQueryItem(QString::fromLatin1("api_sig"), md5);
+-    url.setQuery(urlQuery);
+-    qCDebug(KIPIPLUGINS_LOG) << "List photo sets url: " << url;
++    QNetworkRequest netRequest(url);
++    QList<O0RequestParameter> reqParams = QList<O0RequestParameter>();
+ 
+-    if (m_serviceName == QString::fromLatin1("Zooomr"))
+-    {
+-        // Zooomr redirects the POST at this url to a GET.
+-        m_reply = m_netMngr->get(QNetworkRequest(url));
+-    }
+-    else
+-    {
+-        QNetworkRequest netRequest(url);
+-        netRequest.setHeader(QNetworkRequest::ContentTypeHeader, QLatin1String("application/x-www-form-urlencoded"));
++    netRequest.setHeader(QNetworkRequest::ContentTypeHeader, QLatin1String(O2_MIME_TYPE_XFORM));
+ 
+-        m_reply = m_netMngr->post(netRequest, QByteArray());
+-    }
++    reqParams << O0RequestParameter("method", "flickr.photosets.create");
++    reqParams << O0RequestParameter("title", albumTitle.toLatin1());
++    reqParams << O0RequestParameter("description", albumDescription.toLatin1());
++    reqParams << O0RequestParameter("primary_photo_id", primaryPhotoId.toLatin1());
++
++    QByteArray postData = O1::createQueryParameters(reqParams);
++
++    m_reply = m_requestor->post(netRequest, reqParams, postData);
+ 
+     m_state = FE_CREATEPHOTOSET;
+     m_buffer.resize(0);
+@@ -537,9 +330,10 @@ void FlickrTalker::addPhotoToPhotoSet(co
+         m_reply = 0;
+     }
+ 
+-    qCDebug(KIPIPLUGINS_LOG) << "addPhotoToPhotoSet invoked";
+-    QUrl url(m_apiUrl);
+-    QUrlQuery urlQuery;
++    if (!m_o1->linked())
++        return;
++
++    qCDebug(KIPIPLUGINS_LOG) << "AddPhotoToPhotoSet invoked";
+ 
+     /* If the photoset id starts with the special string "UNDEFINED_", it means
+      * it doesn't exist yet on Flickr and needs to be created. Note that it's
+@@ -547,26 +341,23 @@ void FlickrTalker::addPhotoToPhotoSet(co
+      * is done in the set creation call to Flickr. */
+     if (photoSetId.startsWith(QLatin1String("UNDEFINED_")))
+     {
+-        createPhotoSet(QString::fromLatin1(""), m_selectedPhotoSet.title, m_selectedPhotoSet.description, photoId);
++        createPhotoSet(QLatin1String(""), m_selectedPhotoSet.title, m_selectedPhotoSet.description, photoId);
+     }
+     else
+     {
+-        urlQuery.addQueryItem(QString::fromLatin1("auth_token"), m_token);
+-        urlQuery.addQueryItem(QString::fromLatin1("photoset_id"), photoSetId);
+-        urlQuery.addQueryItem(QString::fromLatin1("api_key"), m_apikey);
+-        urlQuery.addQueryItem(QString::fromLatin1("method"), QString::fromLatin1("flickr.photosets.addPhoto"));
+-        urlQuery.addQueryItem(QString::fromLatin1("photo_id"), photoId);
+-        url.setQuery(urlQuery);
+-
+-        QString md5 = getApiSig(m_secret, url);
+-        urlQuery.addQueryItem(QString::fromLatin1("api_sig"), md5);
+-        url.setQuery(urlQuery);
+-        qCDebug(KIPIPLUGINS_LOG) << "Add photo to Photo set url: " << url;
+-
++        QUrl url(m_apiUrl);
+         QNetworkRequest netRequest(url);
+-        netRequest.setHeader(QNetworkRequest::ContentTypeHeader, QLatin1String("application/x-www-form-urlencoded"));
++        QList<O0RequestParameter> reqParams = QList<O0RequestParameter>();
++
++        netRequest.setHeader(QNetworkRequest::ContentTypeHeader, QLatin1String(O2_MIME_TYPE_XFORM));
+ 
+-        m_reply = m_netMngr->post(netRequest, QByteArray());
++        reqParams << O0RequestParameter("method", "flickr.photosets.addPhoto");
++        reqParams << O0RequestParameter("photoset_id", photoSetId.toLatin1());
++        reqParams << O0RequestParameter("photo_id", photoId.toLatin1());
++
++        QByteArray postData = O1::createQueryParameters(reqParams);
++
++        m_reply = m_requestor->post(netRequest, reqParams, postData);
+ 
+         m_state = FE_ADDPHOTOTOPHOTOSET;
+         m_buffer.resize(0);
+@@ -575,7 +366,7 @@ void FlickrTalker::addPhotoToPhotoSet(co
+ }
+ 
+ bool FlickrTalker::addPhoto(const QString& photoPath, const FPhotoInfo& info,
+-                            bool rescale, int maxDim, int imageQuality)
++                            bool original, bool rescale, int maxDim, int imageQuality)
+ {
+     if (m_reply)
+     {
+@@ -583,123 +374,120 @@ bool FlickrTalker::addPhoto(const QStrin
+         m_reply = 0;
+     }
+ 
++    if (!m_o1->linked())
++        return false;
++
+     QUrl url(m_uploadUrl);
++    QNetworkRequest netRequest(url);
++    QList<O0RequestParameter> reqParams = QList<O0RequestParameter>();
+ 
+-    // We dont' want to modify url as such, we just used the QUrl object for storing the query items.
+-    QUrl url2(QString::fromLatin1(""));
+-    QUrlQuery urlQuery;
+     QString path = photoPath;
+     MPForm  form;
+ 
+-    form.addPair(QString::fromLatin1("auth_token"), m_token, QString::fromLatin1("text/plain"));
+-    urlQuery.addQueryItem(QString::fromLatin1("auth_token"), m_token);
+-
+-    form.addPair(QString::fromLatin1("api_key"), m_apikey, QString::fromLatin1("text/plain"));
+-    urlQuery.addQueryItem(QString::fromLatin1("api_key"), m_apikey);
+-
+-    QString ispublic = (info.is_public == 1) ? QString::fromLatin1("1") : QString::fromLatin1("0");
+-    form.addPair(QString::fromLatin1("is_public"), ispublic, QString::fromLatin1("text/plain"));
+-    urlQuery.addQueryItem(QString::fromLatin1("is_public"), ispublic);
+-
+-    QString isfamily = (info.is_family == 1) ? QString::fromLatin1("1") : QString::fromLatin1("0");
+-    form.addPair(QString::fromLatin1("is_family"), isfamily, QString::fromLatin1("text/plain"));
+-    urlQuery.addQueryItem(QString::fromLatin1("is_family"), isfamily);
+-
+-    QString isfriend = (info.is_friend == 1) ? QString::fromLatin1("1") : QString::fromLatin1("0");
+-    form.addPair(QString::fromLatin1("is_friend"), isfriend, QString::fromLatin1("text/plain"));
+-    urlQuery.addQueryItem(QString::fromLatin1("is_friend"), isfriend);
++    QString ispublic = (info.is_public == 1) ? QLatin1String("1") : QLatin1String("0");
++    form.addPair(QLatin1String("is_public"), ispublic, QLatin1String("text/plain"));
++    reqParams << O0RequestParameter("is_public", ispublic.toLatin1());
++
++    QString isfamily = (info.is_family == 1) ? QLatin1String("1") : QLatin1String("0");
++    form.addPair(QLatin1String("is_family"), isfamily, QLatin1String("text/plain"));
++    reqParams << O0RequestParameter("is_family", isfamily.toLatin1());
++
++    QString isfriend = (info.is_friend == 1) ? QLatin1String("1") : QLatin1String("0");
++    form.addPair(QLatin1String("is_friend"), isfriend, QLatin1String("text/plain"));
++    reqParams << O0RequestParameter("is_friend", isfriend.toLatin1());
+ 
+     QString safetyLevel = QString::number(static_cast<int>(info.safety_level));
+-    form.addPair(QString::fromLatin1("safety_level"), safetyLevel, QString::fromLatin1("text/plain"));
+-    urlQuery.addQueryItem(QString::fromLatin1("safety_level"), safetyLevel);
++    form.addPair(QLatin1String("safety_level"), safetyLevel, QLatin1String("text/plain"));
++    reqParams << O0RequestParameter("safety_level", safetyLevel.toLatin1());
+ 
+     QString contentType = QString::number(static_cast<int>(info.content_type));
+-    form.addPair(QString::fromLatin1("content_type"), contentType, QString::fromLatin1("text/plain"));
+-    urlQuery.addQueryItem(QString::fromLatin1("content_type"), contentType);
++    form.addPair(QLatin1String("content_type"), contentType, QLatin1String("text/plain"));
++    reqParams << O0RequestParameter("content_type", contentType.toLatin1());
+ 
+-    QString tags = QString::fromLatin1("\"") + info.tags.join(QString::fromLatin1("\" \"")) + QString::fromLatin1("\"");
++    QString tags = QLatin1String("\"") + info.tags.join(QLatin1String("\" \"")) + QLatin1String("\"");
+ 
+     if (tags.length() > 0)
+     {
+-        form.addPair(QString::fromLatin1("tags"), tags, QString::fromLatin1("text/plain"));
+-        urlQuery.addQueryItem(QString::fromLatin1("tags"), tags);
++        form.addPair(QLatin1String("tags"), tags, QLatin1String("text/plain"));
++        reqParams << O0RequestParameter("tags", tags.toLatin1());
+     }
+ 
+     if (!info.title.isEmpty())
+     {
+-        form.addPair(QString::fromLatin1("title"), info.title, QString::fromLatin1("text/plain"));
+-        urlQuery.addQueryItem(QString::fromLatin1("title"), info.title);
++        form.addPair(QLatin1String("title"), info.title, QLatin1String("text/plain"));
++        reqParams << O0RequestParameter("title", info.title.toLatin1());
+     }
+ 
+     if (!info.description.isEmpty())
+     {
+-        form.addPair(QString::fromLatin1("description"), info.description, QString::fromLatin1("text/plain"));
+-        urlQuery.addQueryItem(QString::fromLatin1("description"), info.description);
+-    }
+-
+-    url2.setQuery(urlQuery);
+-    QString md5 = getApiSig(m_secret, url2);
+-    form.addPair(QString::fromLatin1("api_sig"), md5, QString::fromLatin1("text/plain"));
+-    QImage image;
+-
+-    if (m_iface)
+-    {
+-        image = m_iface->preview(QUrl::fromLocalFile(photoPath));
++        form.addPair(QLatin1String("description"), info.description, QLatin1String("text/plain"));
++        reqParams << O0RequestParameter("description", info.description.toLatin1());
+     }
+ 
+-    if (image.isNull())
++    if (!original)
+     {
+-        image.load(photoPath);
+-    }
++        QImage image;
+ 
+-    if (!image.isNull())
+-    {
+-        if (!m_lastTmpFile.isEmpty())
++        if (m_iface)
+         {
+-            QFile::remove(m_lastTmpFile);
++            image = m_iface->preview(QUrl::fromLocalFile(photoPath));
+         }
+ 
+-        path = makeTemporaryDir(m_serviceName.toLatin1().constData()).filePath(QFileInfo(photoPath)
+-                                                                     .baseName().trimmed() + QLatin1String(".jpg"));
+-
+-        if (rescale)
++        if (image.isNull())
+         {
+-            if (image.width() > maxDim || image.height() > maxDim)
+-                image = image.scaled(maxDim, maxDim, Qt::KeepAspectRatio, Qt::SmoothTransformation);
++            image.load(photoPath);
+         }
+ 
+-        image.save(path, "JPEG", imageQuality);
+-        m_lastTmpFile = path;
+-
+-        // Restore all metadata.
+-
+-        if (m_iface)
++        if (!image.isNull())
+         {
+-            QPointer<MetadataProcessor> meta = m_iface->createMetadataProcessor();
+-
+-            if (meta && meta->load(QUrl::fromLocalFile(photoPath)))
++            if (!m_lastTmpFile.isEmpty())
+             {
+-                meta->setImageDimensions(image.size());
++                QFile::remove(m_lastTmpFile);
++            }
+ 
+-                // NOTE: see bug #153207: Flickr use IPTC keywords to create Tags in web interface
+-                //       As IPTC do not support UTF-8, we need to remove it.
+-                meta->removeIptcTags(QStringList() << QLatin1String("Iptc.Application2.Keywords"));
++            path = makeTemporaryDir(m_serviceName.toLatin1().constData()).filePath(QFileInfo(photoPath)
++                                                                         .baseName().trimmed() + QLatin1String(".jpg"));
+ 
+-                meta->setImageProgramId(QString::fromLatin1("Kipi-plugins"), kipipluginsVersion());
+-                meta->save(QUrl::fromLocalFile(path));
++            if (rescale)
++            {
++                if (image.width() > maxDim || image.height() > maxDim)
++                    image = image.scaled(maxDim, maxDim, Qt::KeepAspectRatio, Qt::SmoothTransformation);
+             }
+-            else
++
++            image.save(path, "JPEG", imageQuality);
++            m_lastTmpFile = path;
++
++            // Restore all metadata.
++
++            if (m_iface)
+             {
+-                qCWarning(KIPIPLUGINS_LOG) << "flickrExport::Image doesn't have metadata";
++                QPointer<MetadataProcessor> meta = m_iface->createMetadataProcessor();
++
++                if (meta && meta->load(QUrl::fromLocalFile(photoPath)))
++                {
++                    meta->setImageDimensions(image.size());
++                    meta->setImageOrientation(MetadataProcessor::NORMAL);
++
++                    // NOTE: see bug #153207: Flickr use IPTC keywords to create Tags in web interface
++                    //       As IPTC do not support UTF-8, we need to remove it.
++                    meta->removeIptcTags(QStringList() << QLatin1String("Iptc.Application2.Keywords"));
++
++                    meta->setImageProgramId(QLatin1String("Kipi-plugins"), kipipluginsVersion());
++                    meta->save(QUrl::fromLocalFile(path), true);
++                }
++                else
++                {
++                    qCWarning(KIPIPLUGINS_LOG) << "flickrExport::Image doesn't have metadata";
++                }
+             }
+-        }
+ 
+-        qCDebug(KIPIPLUGINS_LOG) << "Resizing and saving to temp file: " << path;
++            qCDebug(KIPIPLUGINS_LOG) << "Resizing and saving to temp file: " << path;
++        }
+     }
+ 
+     QFileInfo tempFileInfo(path);
+ 
+-    qCDebug(KIPIPLUGINS_LOG) << "QUrl path is " << QUrl::fromLocalFile(path) << "Image size after resizing (in bytes) is "<< tempFileInfo.size();
++    qCDebug(KIPIPLUGINS_LOG) << "QUrl path is " << QUrl::fromLocalFile(path) << "Image size (in bytes) is "<< tempFileInfo.size();
+ 
+     if (tempFileInfo.size() > (getMaxAllowedFileSize().toLongLong()))
+     {
+@@ -707,17 +495,16 @@ bool FlickrTalker::addPhoto(const QStrin
+         return false;
+     }
+ 
+-    if (!form.addFile(QString::fromLatin1("photo"), path))
++    if (!form.addFile(QLatin1String("photo"), path))
+     {
+         return false;
+     }
+ 
+     form.finish();
+ 
+-    QNetworkRequest netRequest(url);
+     netRequest.setHeader(QNetworkRequest::ContentTypeHeader, form.contentType());
+ 
+-    m_reply = m_netMngr->post(netRequest, form.formData());
++    m_reply = m_requestor->post(netRequest, reqParams, form.formData());
+ 
+     m_state = FE_ADDPHOTO;
+     m_buffer.resize(0);
+@@ -869,22 +656,6 @@ void FlickrTalker::slotFinished(QNetwork
+             parseResponseListPhotoSets(m_buffer);
+             break;
+ 
+-        case (FE_GETFROB):
+-            parseResponseGetFrob(m_buffer);
+-            break;
+-
+-        case (FE_GETTOKEN):
+-            parseResponseGetToken(m_buffer);
+-            break;
+-
+-        case (FE_CHECKTOKEN):
+-            parseResponseCheckToken(m_buffer);
+-            break;
+-
+-        case (FE_GETAUTHORIZED):
+-            //parseResponseGetToken(m_buffer);
+-            break;
+-
+         case (FE_LISTPHOTOS):
+             parseResponseListPhotos(m_buffer);
+             break;
+@@ -919,7 +690,7 @@ void FlickrTalker::slotFinished(QNetwork
+ void FlickrTalker::parseResponseMaxSize(const QByteArray& data)
+ {
+     QString errorString;
+-    QDomDocument doc(QString::fromLatin1("mydocument"));
++    QDomDocument doc(QLatin1String("mydocument"));
+ 
+     if (!doc.setContent(data))
+     {
+@@ -933,7 +704,7 @@ void FlickrTalker::parseResponseMaxSize(
+ 
+     while (!node.isNull())
+     {
+-        if (node.isElement() && node.nodeName() == QString::fromLatin1("person"))
++        if (node.isElement() && node.nodeName() == QLatin1String("person"))
+         {
+             e                = node.toElement();
+             QDomNode details = e.firstChild();
+@@ -944,9 +715,9 @@ void FlickrTalker::parseResponseMaxSize(
+                 {
+                     e = details.toElement();
+ 
+-                    if (details.nodeName() == QString::fromLatin1("photos"))
++                    if (details.nodeName() == QLatin1String("photos"))
+                     {
+-                        QDomAttr a = e.attributeNode(QString::fromLatin1("maxupload"));
++                        QDomAttr a = e.attributeNode(QLatin1String("maxupload"));
+                         m_maxSize = a.value();
+                         qCDebug(KIPIPLUGINS_LOG) << "Max upload size is"<<m_maxSize;
+                     }
+@@ -956,255 +727,18 @@ void FlickrTalker::parseResponseMaxSize(
+             }
+         }
+ 
+-        if (node.isElement() && node.nodeName() == QString::fromLatin1("err"))
+-        {
+-            qCDebug(KIPIPLUGINS_LOG) << "Checking Error in response";
+-            errorString = node.toElement().attribute(QString::fromLatin1("code"));
+-            qCDebug(KIPIPLUGINS_LOG) << "Error code=" << errorString;
+-            qCDebug(KIPIPLUGINS_LOG) << "Msg=" << node.toElement().attribute(QString::fromLatin1("msg"));
+-        }
+-
+-        node = node.nextSibling();
+-    }
+-}
+-
+-void FlickrTalker::parseResponseGetFrob(const QByteArray& data)
+-{
+-    bool success = false;
+-    QString errorString;
+-    QDomDocument doc(QString::fromLatin1("mydocument"));
+-
+-    if (!doc.setContent(data))
+-    {
+-        return;
+-    }
+-
+-    QDomElement docElem = doc.documentElement();
+-    QDomNode node       = docElem.firstChild();
+-
+-    while (!node.isNull())
+-    {
+-        if (node.isElement() && node.nodeName() == QString::fromLatin1("frob"))
+-        {
+-            QDomElement e = node.toElement();    // try to convert the node to an element.
+-            qCDebug(KIPIPLUGINS_LOG) << "Frob is" << e.text();
+-            m_frob        = e.text();            // this is what is obtained from data.
+-            success       = true;
+-        }
+-
+-        if (node.isElement() && node.nodeName() == QString::fromLatin1("err"))
++        if (node.isElement() && node.nodeName() == QLatin1String("err"))
+         {
+             qCDebug(KIPIPLUGINS_LOG) << "Checking Error in response";
+-            errorString = node.toElement().attribute(QString::fromLatin1("code"));
++            errorString = node.toElement().attribute(QLatin1String("code"));
+             qCDebug(KIPIPLUGINS_LOG) << "Error code=" << errorString;
+-            qCDebug(KIPIPLUGINS_LOG) << "Msg=" << node.toElement().attribute(QString::fromLatin1("msg"));
++            qCDebug(KIPIPLUGINS_LOG) << "Msg=" << node.toElement().attribute(QLatin1String("msg"));
+         }
+ 
+         node = node.nextSibling();
+     }
+ 
+-    qCDebug(KIPIPLUGINS_LOG) << "GetFrob finished";
+-    m_authProgressDlg->setMaximum(4);
+-    m_authProgressDlg->setValue(2);
+-    m_state = FE_GETAUTHORIZED;
+-
+-    if (success)
+-    {
+-        emit signalAuthenticate();
+-    }
+-    else
+-    {
+-        emit signalError(errorString);
+-    }
+-}
+-
+-void FlickrTalker::parseResponseCheckToken(const QByteArray& data)
+-{
+-    bool         success = false;
+-    QString      errorString;
+-    QString      username;
+-    QString      transReturn;
+-    QDomDocument doc(QString::fromLatin1("checktoken"));
+-
+-    if (!doc.setContent(data))
+-    {
+-        return;
+-    }
+-
+-    QDomElement docElem = doc.documentElement();
+-    QDomNode node       = docElem.firstChild();
+-    QDomElement e;
+-
+-    while (!node.isNull())
+-    {
+-        if (node.isElement() && node.nodeName() == QString::fromLatin1("auth"))
+-        {
+-            e                = node.toElement(); // try to convert the node to an element.
+-            QDomNode details = e.firstChild();
+-
+-            while (!details.isNull())
+-            {
+-                if (details.isElement())
+-                {
+-                    e = details.toElement();
+-
+-                    if (details.nodeName() == QString::fromLatin1("token"))
+-                    {
+-                        qCDebug(KIPIPLUGINS_LOG) << "Token=" << e.text();
+-                        m_token = e.text();//this is what is obtained from data.
+-                    }
+-
+-                    if (details.nodeName() == QString::fromLatin1("perms"))
+-                    {
+-                        qCDebug(KIPIPLUGINS_LOG) << "Perms=" << e.text();
+-                        QString perms = e.text();//this is what is obtained from data.
+-
+-                        if (perms == QString::fromLatin1("write"))
+-                        {
+-                            transReturn = i18nc("As in the permission to", "write");
+-                        }
+-                        else if (perms == QString::fromLatin1("read"))
+-                        {
+-                            transReturn = i18nc("As in the permission to", "read");
+-                        }
+-                        else if (perms == QString::fromLatin1("delete"))
+-                        {
+-                            transReturn = i18nc("As in the permission to", "delete");
+-                        }
+-                    }
+-
+-                    if (details.nodeName() == QString::fromLatin1("user"))
+-                    {
+-                        qCDebug(KIPIPLUGINS_LOG) << "nsid=" << e.attribute(QString::fromLatin1("nsid"));
+-                        m_userId   = e.attribute(QString::fromLatin1("nsid"));
+-                        username   = e.attribute(QString::fromLatin1("username"));
+-                        m_username = username;
+-                        qCDebug(KIPIPLUGINS_LOG) << "username=" << e.attribute(QString::fromLatin1("username"));
+-                        qCDebug(KIPIPLUGINS_LOG) << "fullname=" << e.attribute(QString::fromLatin1("fullname"));
+-                    }
+-                }
+-
+-                details = details.nextSibling();
+-            }
+-
+-            m_authProgressDlg->hide();
+-            emit signalTokenObtained(m_token);
+-            success = true;
+-        }
+-
+-        if (node.isElement() && node.nodeName() == QString::fromLatin1("err"))
+-        {
+-            qCDebug(KIPIPLUGINS_LOG) << "Checking Error in response";
+-            errorString = node.toElement().attribute(QString::fromLatin1("code"));
+-            qCDebug(KIPIPLUGINS_LOG) << "Error code=" << errorString;
+-            qCDebug(KIPIPLUGINS_LOG) << "Msg=" << node.toElement().attribute(QString::fromLatin1("msg"));
+-
+-            int valueOk = QMessageBox::question(QApplication::activeWindow(),
+-                                                i18n("Invalid Token"),
+-                                                i18n("Your token is invalid. Would you like to "
+-                                                      "get a new token to proceed?\n"));
+-
+-            if (valueOk == QMessageBox::Yes)
+-            {
+-                getFrob();
+-                return;
+-            }
+-            else
+-            {
+-                m_authProgressDlg->hide(); //will popup the result for the checktoken failure below
+-            }
+-
+-        }
+-
+-        node = node.nextSibling();
+-    }
+-
+-    if (!success)
+-    {
+-        emit signalError(errorString);
+-    }
+-
+-    qCDebug(KIPIPLUGINS_LOG) << "CheckToken finished";
+-}
+-
+-void FlickrTalker::parseResponseGetToken(const QByteArray& data)
+-{
+-    bool success = false;
+-    QString errorString;
+-    QDomDocument doc(QString::fromLatin1("gettoken"));
+-
+-    if (!doc.setContent(data))
+-    {
+-        return;
+-    }
+-
+-    QDomElement docElem = doc.documentElement();
+-    QDomNode    node    = docElem.firstChild();
+-    QDomElement e;
+-
+-    while (!node.isNull())
+-    {
+-        if (node.isElement() && node.nodeName() == QString::fromLatin1("auth"))
+-        {
+-            e                = node.toElement(); // try to convert the node to an element.
+-            QDomNode details = e.firstChild();
+-
+-            while (!details.isNull())
+-            {
+-                if (details.isElement())
+-                {
+-                    e = details.toElement();
+-
+-                    if (details.nodeName() == QString::fromLatin1("token"))
+-                    {
+-                        qCDebug(KIPIPLUGINS_LOG) << "Token=" << e.text();
+-                        m_token = e.text();      //this is what is obtained from data.
+-                    }
+-
+-                    if (details.nodeName() == QString::fromLatin1("perms"))
+-                    {
+-                        qCDebug(KIPIPLUGINS_LOG) << "Perms=" << e.text();
+-                    }
+-
+-                    if (details.nodeName() == QString::fromLatin1("user"))
+-                    {
+-                        qCDebug(KIPIPLUGINS_LOG) << "nsid=" << e.attribute(QString::fromLatin1("nsid"));
+-                        qCDebug(KIPIPLUGINS_LOG) << "username=" << e.attribute(QString::fromLatin1("username"));
+-                        qCDebug(KIPIPLUGINS_LOG) << "fullname=" << e.attribute(QString::fromLatin1("fullname"));
+-                        m_username = e.attribute(QString::fromLatin1("username"));
+-                        m_userId   = e.attribute(QString::fromLatin1("nsid"));
+-                    }
+-                }
+-
+-                details = details.nextSibling();
+-            }
+-
+-            success = true;
+-        }
+-        else if (node.isElement() && node.nodeName() == QString::fromLatin1("err"))
+-        {
+-            qCDebug(KIPIPLUGINS_LOG) << "Checking Error in response";
+-            errorString = node.toElement().attribute(QString::fromLatin1("code"));
+-            qCDebug(KIPIPLUGINS_LOG) << "Error code=" << errorString;
+-            qCDebug(KIPIPLUGINS_LOG) << "Msg=" << node.toElement().attribute(QString::fromLatin1("msg"));
+-            //emit signalError(code);
+-        }
+-
+-        node = node.nextSibling();
+-    }
+-
+-    qCDebug(KIPIPLUGINS_LOG) << "GetToken finished";
+-    //emit signalBusy( false );
+     m_authProgressDlg->hide();
+-
+-    if (success)
+-    {
+-        emit signalTokenObtained(m_token);
+-    }
+-    else
+-    {
+-        emit signalError(errorString);
+-    }
+ }
+ 
+ void FlickrTalker::parseResponseCreatePhotoSet(const QByteArray& data)
+@@ -1213,7 +747,7 @@ void FlickrTalker::parseResponseCreatePh
+ 
+     //bool success = false;
+ 
+-    QDomDocument doc(QString::fromLatin1("getListPhotoSets"));
++    QDomDocument doc(QLatin1String("getListPhotoSets"));
+ 
+     if (!doc.setContent(data))
+     {
+@@ -1226,10 +760,10 @@ void FlickrTalker::parseResponseCreatePh
+ 
+     while (!node.isNull())
+     {
+-        if (node.isElement() && node.nodeName() == QString::fromLatin1("photoset"))
++        if (node.isElement() && node.nodeName() == QLatin1String("photoset"))
+         {
+             // Parse the id from the response.
+-            QString new_id = node.toElement().attribute(QString::fromLatin1("id"));
++            QString new_id = node.toElement().attribute(QLatin1String("id"));
+ 
+             // Set the new id in the photo sets list.
+             QLinkedList<FPhotoSet>::iterator it = m_photoSetsList->begin();
+@@ -1252,12 +786,12 @@ void FlickrTalker::parseResponseCreatePh
+             emit signalAddPhotoSetSucceeded();
+         }
+ 
+-        if (node.isElement() && node.nodeName() == QString::fromLatin1("err"))
++        if (node.isElement() && node.nodeName() == QLatin1String("err"))
+         {
+             qCDebug(KIPIPLUGINS_LOG) << "Checking Error in response";
+-            QString code = node.toElement().attribute(QString::fromLatin1("code"));
++            QString code = node.toElement().attribute(QLatin1String("code"));
+             qCDebug(KIPIPLUGINS_LOG) << "Error code=" << code;
+-            QString msg = node.toElement().attribute(QString::fromLatin1("msg"));
++            QString msg = node.toElement().attribute(QLatin1String("msg"));
+             qCDebug(KIPIPLUGINS_LOG) << "Msg=" << msg;
+             QMessageBox::critical(QApplication::activeWindow(), i18n("Error"), i18n("PhotoSet creation failed: ") + msg);
+         }
+@@ -1270,7 +804,7 @@ void FlickrTalker::parseResponseListPhot
+ {
+     qCDebug(KIPIPLUGINS_LOG) << "parseResponseListPhotosets" << data;
+     bool success = false;
+-    QDomDocument doc(QString::fromLatin1("getListPhotoSets"));
++    QDomDocument doc(QLatin1String("getListPhotoSets"));
+ 
+     if (!doc.setContent(data))
+     {
+@@ -1286,7 +820,7 @@ void FlickrTalker::parseResponseListPhot
+ 
+     while (!node.isNull())
+     {
+-        if (node.isElement() && node.nodeName() == QString::fromLatin1("photosets"))
++        if (node.isElement() && node.nodeName() == QLatin1String("photosets"))
+         {
+             e                    = node.toElement();
+             QDomNode details     = e.firstChild();
+@@ -1299,10 +833,10 @@ void FlickrTalker::parseResponseListPhot
+                 {
+                     e = detailsNode.toElement();
+ 
+-                    if (detailsNode.nodeName() == QString::fromLatin1("photoset"))
++                    if (detailsNode.nodeName() == QLatin1String("photoset"))
+                     {
+-                        qCDebug(KIPIPLUGINS_LOG) << "id=" << e.attribute(QString::fromLatin1("id"));
+-                        photoSet_id              = e.attribute(QString::fromLatin1("id"));     // this is what is obtained from data.
++                        qCDebug(KIPIPLUGINS_LOG) << "id=" << e.attribute(QLatin1String("id"));
++                        photoSet_id              = e.attribute(QLatin1String("id"));     // this is what is obtained from data.
+                         fps.id                   = photoSet_id;
+                         QDomNode photoSetDetails = detailsNode.firstChild();
+                         QDomElement e_detail;
+@@ -1311,13 +845,13 @@ void FlickrTalker::parseResponseListPhot
+                         {
+                             e_detail = photoSetDetails.toElement();
+ 
+-                            if (photoSetDetails.nodeName() == QString::fromLatin1("title"))
++                            if (photoSetDetails.nodeName() == QLatin1String("title"))
+                             {
+                                 qCDebug(KIPIPLUGINS_LOG) << "Title=" << e_detail.text();
+                                 photoSet_title = e_detail.text();
+                                 fps.title      = photoSet_title;
+                             }
+-                            else if (photoSetDetails.nodeName() == QString::fromLatin1("description"))
++                            else if (photoSetDetails.nodeName() == QLatin1String("description"))
+                             {
+                                 qCDebug(KIPIPLUGINS_LOG) << "Description =" << e_detail.text();
+                                 photoSet_description = e_detail.text();
+@@ -1338,12 +872,12 @@ void FlickrTalker::parseResponseListPhot
+             success = true;
+         }
+ 
+-        if (node.isElement() && node.nodeName() == QString::fromLatin1("err"))
++        if (node.isElement() && node.nodeName() == QLatin1String("err"))
+         {
+             qCDebug(KIPIPLUGINS_LOG) << "Checking Error in response";
+-            QString code = node.toElement().attribute(QString::fromLatin1("code"));
++            QString code = node.toElement().attribute(QLatin1String("code"));
+             qCDebug(KIPIPLUGINS_LOG) << "Error code=" << code;
+-            qCDebug(KIPIPLUGINS_LOG) << "Msg=" << node.toElement().attribute(QString::fromLatin1("msg"));
++            qCDebug(KIPIPLUGINS_LOG) << "Msg=" << node.toElement().attribute(QLatin1String("msg"));
+             emit signalError(code);
+         }
+ 
+@@ -1365,7 +899,7 @@ void FlickrTalker::parseResponseListPhot
+ 
+ void FlickrTalker::parseResponseListPhotos(const QByteArray& data)
+ {
+-    QDomDocument doc(QString::fromLatin1("getPhotosList"));
++    QDomDocument doc(QLatin1String("getPhotosList"));
+ 
+     if (!doc.setContent(data))
+     {
+@@ -1380,7 +914,7 @@ void FlickrTalker::parseResponseListPhot
+ 
+ void FlickrTalker::parseResponseCreateAlbum(const QByteArray& data)
+ {
+-    QDomDocument doc(QString::fromLatin1("getCreateAlbum"));
++    QDomDocument doc(QLatin1String("getCreateAlbum"));
+ 
+     if (!doc.setContent(data))
+     {
+@@ -1397,7 +931,7 @@ void FlickrTalker::parseResponseAddPhoto
+ {
+     bool    success = false;
+     QString line;
+-    QDomDocument doc(QString::fromLatin1("AddPhoto Response"));
++    QDomDocument doc(QLatin1String("AddPhoto Response"));
+ 
+     if (!doc.setContent(data))
+     {
+@@ -1411,7 +945,7 @@ void FlickrTalker::parseResponseAddPhoto
+ 
+     while (!node.isNull())
+     {
+-        if (node.isElement() && node.nodeName() == QString::fromLatin1("photoid"))
++        if (node.isElement() && node.nodeName() == QLatin1String("photoid"))
+         {
+             e                = node.toElement();           // try to convert the node to an element.
+             QDomNode details = e.firstChild();
+@@ -1420,12 +954,12 @@ void FlickrTalker::parseResponseAddPhoto
+             success          = true;
+         }
+ 
+-        if (node.isElement() && node.nodeName() == QString::fromLatin1("err"))
++        if (node.isElement() && node.nodeName() == QLatin1String("err"))
+         {
+             qCDebug(KIPIPLUGINS_LOG) << "Checking Error in response";
+-            QString code = node.toElement().attribute(QString::fromLatin1("code"));
++            QString code = node.toElement().attribute(QLatin1String("code"));
+             qCDebug(KIPIPLUGINS_LOG) << "Error code=" << code;
+-            qCDebug(KIPIPLUGINS_LOG) << "Msg=" << node.toElement().attribute(QString::fromLatin1("msg"));
++            qCDebug(KIPIPLUGINS_LOG) << "Msg=" << node.toElement().attribute(QLatin1String("msg"));
+             emit signalError(code);
+         }
+ 
+@@ -1440,23 +974,14 @@ void FlickrTalker::parseResponseAddPhoto
+     {
+         QString photoSetId = m_selectedPhotoSet.id;
+ 
+-        if (photoSetId == QString::fromLatin1("-1"))
++        if (photoSetId == QLatin1String("-1"))
+         {
+             qCDebug(KIPIPLUGINS_LOG) << "PhotoSet Id not set, not adding the photo to any photoset";
+             emit signalAddPhotoSucceeded();
+         }
+         else
+         {
+-            if (m_serviceName == QString::fromLatin1("Zooomr"))
+-            {
+-                // addPhotoToPhotoSet not supported by Zooomr (Zooomr only has
+-                // smart folder-type photosets); silently fail
+-                emit signalAddPhotoSucceeded();
+-            }
+-            else
+-            {
+-                addPhotoToPhotoSet(photoId, photoSetId);
+-            }
++            addPhotoToPhotoSet(photoId, photoSetId);
+         }
+     }
+ }
+@@ -1465,7 +990,7 @@ void FlickrTalker::parseResponsePhotoPro
+ {
+     bool         success = false;
+     QString      line;
+-    QDomDocument doc(QString::fromLatin1("Photos Properties"));
++    QDomDocument doc(QLatin1String("Photos Properties"));
+ 
+     if (!doc.setContent(data))
+     {
+@@ -1478,7 +1003,7 @@ void FlickrTalker::parseResponsePhotoPro
+ 
+     while (!node.isNull())
+     {
+-        if (node.isElement() && node.nodeName() == QString::fromLatin1("photoid"))
++        if (node.isElement() && node.nodeName() == QLatin1String("photoid"))
+         {
+             e                = node.toElement();                 // try to convert the node to an element.
+             QDomNode details = e.firstChild();
+@@ -1486,12 +1011,12 @@ void FlickrTalker::parseResponsePhotoPro
+             qCDebug(KIPIPLUGINS_LOG) << "Photoid=" << e.text();
+         }
+ 
+-        if (node.isElement() && node.nodeName() == QString::fromLatin1("err"))
++        if (node.isElement() && node.nodeName() == QLatin1String("err"))
+         {
+             qCDebug(KIPIPLUGINS_LOG) << "Checking Error in response";
+-            QString code = node.toElement().attribute(QString::fromLatin1("code"));
++            QString code = node.toElement().attribute(QLatin1String("code"));
+             qCDebug(KIPIPLUGINS_LOG) << "Error code=" << code;
+-            qCDebug(KIPIPLUGINS_LOG) << "Msg=" << node.toElement().attribute(QString::fromLatin1("msg"));
++            qCDebug(KIPIPLUGINS_LOG) << "Msg=" << node.toElement().attribute(QLatin1String("msg"));
+             emit signalError(code);
+         }
+ 
+Index: digikam-5.3.0/extra/kipi-plugins/flickr/flickrtalker.h
+===================================================================
+--- digikam-5.3.0.orig/extra/kipi-plugins/flickr/flickrtalker.h
++++ digikam-5.3.0/extra/kipi-plugins/flickr/flickrtalker.h
+@@ -1,13 +1,14 @@
+ /* ============================================================
+  *
+- * This file is a part of kipi-plugins project
++ * This file is a part of digiKam project
+  * http://www.digikam.org
+  *
+  * Date        : 2005-07-07
+  * Description : a kipi plugin to export images to Flickr web service
+  *
+  * Copyright (C) 2005-2009 by Vardhman Jain <vardhman at gmail dot com>
+- * Copyright (C) 2009-2016 by Gilles Caulier <caulier dot gilles at gmail dot com>
++ * Copyright (C) 2009-2017 by Gilles Caulier <caulier dot gilles at gmail dot com>
++ * Copyright (C) 2017      by Maik Qualmann <metzpinguin at gmail dot com>
+  *
+  * This program is free software; you can redistribute it
+  * and/or modify it under the terms of the GNU General
+@@ -32,7 +33,6 @@
+ #include <QString>
+ #include <QObject>
+ #include <QNetworkReply>
+-#include <QCryptographicHash>
+ #include <QNetworkAccessManager>
+ 
+ // Libkipi includes
+@@ -42,6 +42,9 @@
+ // Local includes
+ 
+ #include "flickritem.h"
++#include "o1.h"
++#include "o0globals.h"
++#include "o1requestor.h"
+ 
+ class QProgressDialog;
+ 
+@@ -69,10 +72,6 @@ public:
+         FE_LISTPHOTOS,
+         FE_GETPHOTOPROPERTY,
+         FE_ADDPHOTO,
+-        FE_GETFROB,
+-        FE_CHECKTOKEN,
+-        FE_GETTOKEN,
+-        FE_GETAUTHORIZED,
+         FE_CREATEPHOTOSET,
+         FE_ADDPHOTOTOPHOTOSET,
+         FE_GETMAXSIZE
+@@ -83,13 +82,12 @@ public:
+     FlickrTalker(QWidget* const parent, const QString& serviceName);
+     ~FlickrTalker();
+ 
++    void    link();
++    void    unlink();
+     QString getUserName() const;
+     QString getUserId() const;
+     void    maxAllowedFileSize();
+     QString getMaxAllowedFileSize();
+-    void    getFrob();
+-    void    getToken();
+-    void    checkToken(const QString& token);
+     void    getPhotoProperty(const QString& method, const QStringList& argList);
+     void    cancel();
+ 
+@@ -102,7 +100,8 @@ public:
+ 
+     void    addPhotoToPhotoSet(const QString& photoId, const QString& photoSetId);
+     bool    addPhoto(const QString& photoPath, const FPhotoInfo& info,
+-                     bool rescale=false, int maxDim=600, int imageQuality=85);
++                     bool original = false, bool rescale = false,
++                     int maxDim = 600, int imageQuality = 85);
+ 
+ public:
+ 
+@@ -123,8 +122,7 @@ Q_SIGNALS:
+     void signalListPhotoSetsFailed(QString& msg);
+     void signalAddPhotoFailed(const QString& msg);
+     void signalListPhotoSetsFailed(const QString& msg);
+-    void signalAuthenticate();
+-    void signalTokenObtained(const QString& token);
++    void signalLinkingSucceeded();
+ 
+ private:
+ 
+@@ -134,36 +132,32 @@ private:
+     void parseResponseListPhotos(const QByteArray& data);
+     void parseResponseCreateAlbum(const QByteArray& data);
+     void parseResponseAddPhoto(const QByteArray& data);
+-    void parseResponseGetFrob(const QByteArray& data);
+-    void parseResponseGetToken(const QByteArray& data);
+-    void parseResponseCheckToken(const QByteArray& data);
+     void parseResponsePhotoProperty(const QByteArray& data);
+     void parseResponseCreatePhotoSet(const QByteArray& data);
+     void parseResponseAddPhotoToPhotoSet(const QByteArray& data);
+ 
+-    QString getApiSig(const QString& secret, const QUrl& url);
+-
+ private Q_SLOTS:
+ 
++    void slotLinkingFailed();
++    void slotLinkingSucceeded();
++    void slotOpenBrowser(const QUrl& url); 
+     void slotError(const QString& msg);
+-    void slotAuthenticate();
+     void slotFinished(QNetworkReply* reply);
+ 
+ private:
+ 
+     QWidget*               m_parent;
+-//  QString                m_cookie;
+     QByteArray             m_buffer;
+ 
+     QString                m_serviceName;
+     QString                m_apiUrl;
+     QString                m_authUrl;
++    QString                m_tokenUrl;
++    QString                m_accessUrl;
+     QString                m_uploadUrl;
+     QString                m_apikey;
+     QString                m_secret;
+-    QString                m_frob;
+     QString                m_maxSize;
+-    QString                m_token;
+     QString                m_username;
+     QString                m_userId;
+     QString                m_lastTmpFile;
+@@ -174,6 +168,9 @@ private:
+     State                  m_state;
+ 
+     Interface*             m_iface;
++
++    O1*                    m_o1;
++    O1Requestor*           m_requestor;
+ };
+ 
+ } // namespace KIPIFlickrPlugin
+Index: digikam-5.3.0/extra/kipi-plugins/flickr/flickrwidget.cpp
+===================================================================
+--- digikam-5.3.0.orig/extra/kipi-plugins/flickr/flickrwidget.cpp
++++ digikam-5.3.0/extra/kipi-plugins/flickr/flickrwidget.cpp
+@@ -61,7 +61,8 @@ FlickrWidget::FlickrWidget(QWidget* cons
+     //Adding Remove Account button
+     m_removeAccount              = new QPushButton(getAccountBox());
+     m_removeAccount->setText(i18n("Remove Account"));
+-    getAccountBoxLayout()->addWidget(m_removeAccount, 2,0,1,4);
++    m_removeAccount->hide();
++    getAccountBoxLayout()->addWidget(m_removeAccount, 2, 0, 1, 4);
+ 
+     // -- The image list --------------------------------------------------
+ 
+Index: digikam-5.3.0/extra/kipi-plugins/flickr/flickrwindow.cpp
+===================================================================
+--- digikam-5.3.0.orig/extra/kipi-plugins/flickr/flickrwindow.cpp
++++ digikam-5.3.0/extra/kipi-plugins/flickr/flickrwindow.cpp
+@@ -77,10 +77,6 @@ FlickrWindow::FlickrWindow(QWidget* cons
+     {
+         setWindowIcon(QIcon::fromTheme(QString::fromLatin1("kipi-hq")));
+     }
+-    else if (serviceName == QLatin1String("Zooomr"))
+-    {
+-        setWindowIcon(QIcon::fromTheme(QString::fromLatin1("kipi-zooomr")));
+-    }
+     else
+     {
+         setWindowIcon(QIcon::fromTheme(QString::fromLatin1("kipi-flickr")));
+@@ -136,9 +132,9 @@ FlickrWindow::FlickrWindow(QWidget* cons
+     // --------------------------------------------------------------------------
+     // About data and help button.
+ 
+-    KPAboutData* const about = new KPAboutData(ki18n("Flickr/23/Zooomr Export"),
++    KPAboutData* const about = new KPAboutData(ki18n("Flickr/23 Export"),
+                                                ki18n("A tool to export an image collection to a "
+-                                                     "Flickr / 23 / Zooomr web service."),
++                                                     "Flickr / 23 web service."),
+                                                ki18n("(c) 2005-2008, Vardhman Jain\n"
+                                                      "(c) 2008-2015, Gilles Caulier\n"
+                                                      "(c) 2009, Luka Renko\n"
+@@ -181,8 +177,8 @@ FlickrWindow::FlickrWindow(QWidget* cons
+     connect(m_talker, SIGNAL(signalListPhotoSetsFailed(QString)),
+             this, SLOT(slotListPhotoSetsFailed(QString)));
+ 
+-    connect(m_talker, SIGNAL(signalTokenObtained(QString)),
+-            this, SLOT(slotTokenObtained(QString)));
++    connect(m_talker, SIGNAL(signalLinkingSucceeded()),
++            this, SLOT(slotLinkingSucceeded()));
+ 
+     connect(m_widget->progressBar(), SIGNAL(signalProgressCanceled()),
+             this, SLOT(slotAddPhotoCancelAndClose()));
+@@ -304,17 +300,8 @@ void FlickrWindow::slotAddPhotoCancelAnd
+ void FlickrWindow::reactivate()
+ {
+     m_userNameDisplayLabel->setText(QString());
+-    readSettings(m_select->getUname());
+-    qCDebug(KIPIPLUGINS_LOG) << "Calling auth methods";
+-
+-    if (m_token.length() < 1)
+-    {
+-        m_talker->getFrob();
+-    }
+-    else
+-    {
+-        m_talker->checkToken(m_token);
+-    }
++    //readSettings(m_select->getUname());
++    m_talker->link();
+ 
+     m_widget->m_imglst->loadImagesFromCurrentSelection();
+     show();
+@@ -323,10 +310,8 @@ void FlickrWindow::reactivate()
+ void FlickrWindow::readSettings(QString uname)
+ {
+     KConfig config(QString::fromLatin1("kipirc"));
+-    qCDebug(KIPIPLUGINS_LOG) << "Group name is : "<<QString::fromLatin1("%1%2Export Settings").arg(m_serviceName,uname);
+-    KConfigGroup grp = config.group(QString::fromLatin1("%1%2Export Settings").arg(m_serviceName,uname));
+-    m_token          = grp.readEntry("token");
+-    qCDebug(KIPIPLUGINS_LOG) << "Token is : "<<m_token;
++    qCDebug(KIPIPLUGINS_LOG) << "Group name is : "<<QString::fromLatin1("%1%2Export Settings").arg(m_serviceName, uname);
++    KConfigGroup grp = config.group(QString::fromLatin1("%1%2Export Settings").arg(m_serviceName, uname));
+     m_exportHostTagsCheckBox->setChecked(grp.readEntry("Export Host Tags",      false));
+     m_extendedTagsButton->setChecked(grp.readEntry("Show Extended Tag Options", false));
+     m_addExtraTagsCheckBox->setChecked(grp.readEntry("Add Extra Tags",          false));
+@@ -392,16 +377,14 @@ void FlickrWindow::writeSettings()
+     qCDebug(KIPIPLUGINS_LOG) << "Group name is : "<<QString::fromLatin1("%1%2Export Settings").arg(m_serviceName,m_username);
+ 
+     if (QString::compare(QString::fromLatin1("%1Export Settings").arg(m_serviceName),
+-        QString::fromLatin1("%1%2Export Settings").arg(m_serviceName,m_username), Qt::CaseInsensitive) == 0)
++        QString::fromLatin1("%1%2Export Settings").arg(m_serviceName, m_username), Qt::CaseInsensitive) == 0)
+     {
+         qCDebug(KIPIPLUGINS_LOG) << "Not writing entry of group " << QString::fromLatin1("%1%2Export Settings").arg(m_serviceName,m_username);
+         return;
+     }
+ 
+-    KConfigGroup grp = config.group(QString::fromLatin1("%1%2Export Settings").arg(m_serviceName,m_username));
+-    grp.writeEntry("username",m_username);
+-    qCDebug(KIPIPLUGINS_LOG) << "Token written of group "<<QString::fromLatin1("%1%2Export Settings").arg(m_serviceName,m_username)<<" is "<<m_token;
+-    grp.writeEntry("token", m_token);
++    KConfigGroup grp = config.group(QString::fromLatin1("%1%2Export Settings").arg(m_serviceName, m_username));
++    grp.writeEntry("username",                          m_username);
+     grp.writeEntry("Export Host Tags",                  m_exportHostTagsCheckBox->isChecked());
+     grp.writeEntry("Show Extended Tag Options",         m_extendedTagsButton->isChecked());
+     grp.writeEntry("Add Extra Tags",                    m_addExtraTagsCheckBox->isChecked());
+@@ -427,39 +410,31 @@ void FlickrWindow::slotDoLogin()
+ {
+ }
+ 
+-void FlickrWindow::slotTokenObtained(const QString& token)
++void FlickrWindow::slotLinkingSucceeded()
+ {
+-    qCDebug(KIPIPLUGINS_LOG) << "Token Obtained is : "<<token;
+     m_username = m_talker->getUserName();
+     m_userId   = m_talker->getUserId();
+-    qCDebug(KIPIPLUGINS_LOG) << "SlotTokenObtained invoked setting user Display name to " << m_username;
++    qCDebug(KIPIPLUGINS_LOG) << "SlotLinkingSucceeded invoked setting user Display name to " << m_username;
+     m_userNameDisplayLabel->setText(QString::fromLatin1("<b>%1</b>").arg(m_username));
+ 
+     KConfig config(QString::fromLatin1("kipirc"));
+ 
+-    foreach ( const QString& group, config.groupList() )
++    foreach (const QString& group, config.groupList())
+     {
+-        if(!(group.contains(m_serviceName)))
++        if (!(group.contains(m_serviceName)))
+             continue;
+ 
+         KConfigGroup grp = config.group(group);
+ 
+-        if(group.contains(m_username))
++        if (group.contains(m_username))
+         {
+             readSettings(m_username);
+             break;
+         }
+     }
+ 
+-    m_token    = token;
+     writeSettings();
+-
+-    // Mutable photosets are not supported by Zooomr (Zooomr only has smart
+-    // folder-type photosets).
+-    if (m_serviceName != QString::fromLatin1("Zooomr"))
+-    {
+-        m_talker->listPhotoSets();
+-    }
++    m_talker->listPhotoSets();
+ }
+ 
+ void FlickrWindow::slotBusy(bool val)
+@@ -488,18 +463,11 @@ void FlickrWindow::slotUserChangeRequest
+ {
+     writeSettings();
+     qCDebug(KIPIPLUGINS_LOG) << "Slot Change User Request ";
+-    m_select->reactivate();
+-    readSettings(m_select->getUname());
+-    if (m_token.length() < 1)
+-    {
+-        m_talker->getFrob();
+-    }
+-    else
+-    {
+-        m_talker->checkToken(m_token);
+-    }
+-    //m_talker->getFrob();
+-    //  m_addPhotoButton->setEnabled(m_selectImagesButton->isChecked());
++    //m_select->reactivate();
++    //readSettings(m_select->getUname());
++
++     m_talker->unlink();
++     m_talker->link();
+ }
+ 
+ void FlickrWindow::slotRemoveAccount()
+@@ -507,7 +475,7 @@ void FlickrWindow::slotRemoveAccount()
+     KConfig config(QString::fromLatin1("kipirc"));
+     KConfigGroup grp = config.group(QString::fromLatin1("%1%2Export Settings").arg(m_serviceName).arg(m_username));
+ 
+-    if(grp.exists())
++    if (grp.exists())
+     {
+         qCDebug(KIPIPLUGINS_LOG) << "Removing Account having group"<<QString::fromLatin1("%1%2Export Settings").arg(m_serviceName);
+         grp.deleteGroup();
+@@ -545,8 +513,8 @@ QString FlickrWindow::guessSensibleSetNa
+     int totalCount = 0;
+     QString name;
+ 
+-    for(QMap<QString,int>::const_iterator it=nrFolderOccurences.constBegin();
+-        it!=nrFolderOccurences.constEnd(); ++it)
++    for (QMap<QString,int>::const_iterator it=nrFolderOccurences.constBegin();
++         it!=nrFolderOccurences.constEnd(); ++it)
+     {
+         totalCount += it.value();
+ 
+@@ -788,30 +756,25 @@ void FlickrWindow::slotAddPhotoNext()
+     Pair pathComments = m_uploadQueue.first();
+     FPhotoInfo info   = pathComments.second;
+ 
+-    // Find out the selected photo set.
+-    if (m_serviceName != QString::fromLatin1("Zooomr"))
++    QString selectedPhotoSetId = m_albumsListComboBox->itemData(m_albumsListComboBox->currentIndex()).toString();
++
++    if (selectedPhotoSetId.isEmpty())
++    {
++        m_talker->m_selectedPhotoSet = FPhotoSet();
++    }
++    else
+     {
+-        // mutable photosets are not supported by Zooomr (Zooomr only has smart folder-type photosets)
+-        QString selectedPhotoSetId = m_albumsListComboBox->itemData(m_albumsListComboBox->currentIndex()).toString();
++        QLinkedList<FPhotoSet>::iterator it = m_talker->m_photoSetsList->begin();
+ 
+-        if (selectedPhotoSetId.isEmpty())
+-        {
+-            m_talker->m_selectedPhotoSet = FPhotoSet();
+-        }
+-        else
++        while (it != m_talker->m_photoSetsList->end())
+         {
+-            QLinkedList<FPhotoSet>::iterator it = m_talker->m_photoSetsList->begin();
+-
+-            while (it != m_talker->m_photoSetsList->end())
++            if (it->id == selectedPhotoSetId)
+             {
+-                if (it->id == selectedPhotoSetId)
+-                {
+-                    m_talker->m_selectedPhotoSet = *it;
+-                    break;
+-                }
+-
+-                ++it;
++                m_talker->m_selectedPhotoSet = *it;
++                break;
+             }
++
++            ++it;
+         }
+     }
+ 
+Index: digikam-5.3.0/extra/kipi-plugins/flickr/flickrwindow.h
+===================================================================
+--- digikam-5.3.0.orig/extra/kipi-plugins/flickr/flickrwindow.h
++++ digikam-5.3.0/extra/kipi-plugins/flickr/flickrwindow.h
+@@ -95,7 +95,7 @@ public:
+ 
+ private Q_SLOTS:
+ 
+-    void slotTokenObtained(const QString& token);
++    void slotLinkingSucceeded();
+     void slotDoLogin();
+     void slotBusy(bool val);
+     void slotError(const QString& msg);
+@@ -165,7 +165,6 @@ private:
+ 
+ //  QHash<int, GAlbumViewItem>             m_albumDict;
+ 
+-    QString                                m_token;
+     QString                                m_username;
+     QString                                m_userId;
+     QString                                m_lastSelectedAlbum;
+Index: digikam-5.3.0/extra/kipi-plugins/flickr/plugin_flickr.cpp
+===================================================================
+--- digikam-5.3.0.orig/extra/kipi-plugins/flickr/plugin_flickr.cpp
++++ digikam-5.3.0/extra/kipi-plugins/flickr/plugin_flickr.cpp
+@@ -59,33 +59,27 @@ Plugin_Flickr::Plugin_Flickr(QObject* co
+ 
+     m_actionFlickr = 0;
+     m_action23     = 0;
+-    m_actionZooomr = 0;
+ 
+     m_dlgFlickr    = 0;
+     m_dlg23        = 0;
+-    m_dlgZooomr    = 0;
+ 
+     selectFlickr   = 0;
+     select23       = 0;
+-    selectZoomr    = 0;
+ }
+ 
+ Plugin_Flickr::~Plugin_Flickr()
+ {
+     delete m_dlgFlickr;
+     delete m_dlg23;
+-    delete m_dlgZooomr;
+ 
+     delete selectFlickr;
+     delete select23;
+-    delete selectZoomr;
+ }
+ 
+ void Plugin_Flickr::setup(QWidget* const widget)
+ {
+     m_dlgFlickr = 0;
+     m_dlg23     = 0;
+-    m_dlgZooomr = 0;
+ 
+     Plugin::setup(widget);
+ 
+@@ -107,13 +101,13 @@ void Plugin_Flickr::setupActions()
+     m_actionFlickr->setIcon(QIcon::fromTheme(QString::fromLatin1("kipi-flickr")));
+     actionCollection()->setDefaultShortcut(m_actionFlickr, Qt::ALT + Qt::SHIFT + Qt::Key_R);
+ 
+-    selectFlickr = new SelectUserDlg(0,QString::fromLatin1("Flickr"));
++    //selectFlickr = new SelectUserDlg(0,QString::fromLatin1("Flickr"));
+ 
+     connect(m_actionFlickr, SIGNAL(triggered(bool)),
+             this, SLOT(slotActivateFlickr()));
+ 
+     addAction(QString::fromLatin1("flickrexport"), m_actionFlickr);
+-
++/*
+     m_action23 = new QAction(this);
+     m_action23->setText(i18n("Export to &23..."));
+     m_action23->setIcon(QIcon::fromTheme(QString::fromLatin1("kipi-hq")));
+@@ -125,23 +119,12 @@ void Plugin_Flickr::setupActions()
+             this, SLOT(slotActivate23()));
+ 
+     addAction(QString::fromLatin1("23export"), m_action23);
+-
+-    m_actionZooomr = new QAction(this);
+-    m_actionZooomr->setText(i18n("Export to &Zooomr..."));
+-    m_actionZooomr->setIcon(QIcon::fromTheme(QString::fromLatin1("kipi-zooomr")));
+-    actionCollection()->setDefaultShortcut(m_actionZooomr, Qt::ALT + Qt::SHIFT + Qt::Key_Z);
+-
+-    selectZoomr = new SelectUserDlg(0,QString::fromLatin1("Zooomr"));
+-
+-    connect(m_actionZooomr, SIGNAL(triggered(bool)),
+-            this, SLOT(slotActivateZooomr()));
+-
+-    addAction(QString::fromLatin1("Zooomrexport"), m_actionZooomr);
++*/
+ }
+ 
+ void Plugin_Flickr::slotActivateFlickr()
+ {
+-    selectFlickr->reactivate();
++    //selectFlickr->reactivate();
+ 
+     if (!m_dlgFlickr)
+     {
+@@ -183,28 +166,6 @@ void Plugin_Flickr::slotActivate23()
+     m_dlg23->reactivate();
+ }
+ 
+-void Plugin_Flickr::slotActivateZooomr()
+-{
+-    selectZoomr->reactivate();
+-
+-    if (!m_dlgZooomr)
+-    {
+-        // We clean it up in the close button
+-        m_dlgZooomr = new FlickrWindow(QApplication::activeWindow(), QString::fromLatin1("Zooomr"), selectZoomr);
+-    }
+-    else
+-    {
+-        if (m_dlgZooomr->isMinimized())
+-        {
+-            KWindowSystem::unminimizeWindow(m_dlgZooomr->winId());
+-        }
+-
+-        KWindowSystem::activateWindow(m_dlgZooomr->winId());
+-    }
+-
+-    m_dlgZooomr->reactivate();
+-}
+-
+ } // namespace KIPIFlickrPlugin
+ 
+ #include "plugin_flickr.moc"
+Index: digikam-5.3.0/extra/kipi-plugins/flickr/plugin_flickr.h
+===================================================================
+--- digikam-5.3.0.orig/extra/kipi-plugins/flickr/plugin_flickr.h
++++ digikam-5.3.0/extra/kipi-plugins/flickr/plugin_flickr.h
+@@ -56,7 +56,6 @@ public Q_SLOTS:
+ 
+     void slotActivateFlickr();
+     void slotActivate23();
+-    void slotActivateZooomr();
+ 
+ private:
+ 
+@@ -66,15 +65,12 @@ private:
+ 
+     QAction*       m_actionFlickr;
+     QAction*       m_action23;
+-    QAction*       m_actionZooomr;
+ 
+     FlickrWindow*  m_dlgFlickr;
+     FlickrWindow*  m_dlg23;
+-    FlickrWindow*  m_dlgZooomr;
+ 
+     SelectUserDlg* selectFlickr;
+     SelectUserDlg* select23;
+-    SelectUserDlg* selectZoomr;
+ };
+ 
+ } //namespace KIPIFlickrPlugin
diff -durN orig/digikam-5.3.0/debian/patches/flickr.diff~ digikam-5.3.0/debian/patches/flickr.diff~
--- orig/digikam-5.3.0/debian/patches/flickr.diff~	1969-12-31 18:00:00.000000000 -0600
+++ digikam-5.3.0/debian/patches/flickr.diff~	2017-09-07 10:05:36.067808539 -0500
@@ -0,0 +1,1895 @@
+Index: digikam-5.3.0/extra/kipi-plugins/common/libkipiplugins/CMakeLists.txt
+===================================================================
+--- digikam-5.3.0.orig/extra/kipi-plugins/common/libkipiplugins/CMakeLists.txt
++++ digikam-5.3.0/extra/kipi-plugins/common/libkipiplugins/CMakeLists.txt
+@@ -54,9 +54,9 @@ set(o2_SRCS
+     ${CMAKE_CURRENT_SOURCE_DIR}/o2/src/o0abstractstore.h
+     ${CMAKE_CURRENT_SOURCE_DIR}/o2/src/o0globals.h
+     # Enable when needed
+-    #${CMAKE_CURRENT_SOURCE_DIR}/o2/src/o1.cpp
+-    #${CMAKE_CURRENT_SOURCE_DIR}/o2/src/o1requestor.cpp
+-    #${CMAKE_CURRENT_SOURCE_DIR}/o2/src/o1timedreply.cpp
++    ${CMAKE_CURRENT_SOURCE_DIR}/o2/src/o1.cpp
++    ${CMAKE_CURRENT_SOURCE_DIR}/o2/src/o1requestor.cpp
++    ${CMAKE_CURRENT_SOURCE_DIR}/o2/src/o1timedreply.cpp
+     #${CMAKE_CURRENT_SOURCE_DIR}/o2/src/o1twitter.h
+     #${CMAKE_CURRENT_SOURCE_DIR}/o2/src/oxtwitter.cpp
+     #${CMAKE_CURRENT_SOURCE_DIR}/o2/src/o1dropbox.h
+Index: digikam-5.3.0/extra/kipi-plugins/flickr/flickrtalker.cpp
+===================================================================
+--- digikam-5.3.0.orig/extra/kipi-plugins/flickr/flickrtalker.cpp
++++ digikam-5.3.0/extra/kipi-plugins/flickr/flickrtalker.cpp
+@@ -1,13 +1,14 @@
+ /* ============================================================
+  *
+- * This file is a part of kipi-plugins project
++ * This file is a part of digiKam project
+  * http://www.digikam.org
+  *
+  * Date        : 2005-07-07
+  * Description : a kipi plugin to export images to Flickr web service
+  *
+  * Copyright (C) 2005-2009 by Vardhman Jain <vardhman at gmail dot com>
+- * Copyright (C) 2009-2016 by Gilles Caulier <caulier dot gilles at gmail dot com>
++ * Copyright (C) 2009-2017 by Gilles Caulier <caulier dot gilles at gmail dot com>
++ * Copyright (C) 2017      by Maik Qualmann <metzpinguin at gmail dot com>
+  *
+  * This program is free software; you can redistribute it
+  * and/or modify it under the terms of the GNU General
+@@ -34,7 +35,6 @@
+ #include <QMap>
+ #include <QStringList>
+ #include <QProgressDialog>
+-#include <QUrlQuery>
+ #include <QStandardPaths>
+ #include <QApplication>
+ #include <QDesktopServices>
+@@ -68,6 +68,8 @@ FlickrTalker::FlickrTalker(QWidget* cons
+     m_state           = FE_LOGOUT;
+     m_serviceName     = serviceName;
+     m_iface           = 0;
++    m_o1              = 0;
++    m_requestor       = 0;
+ 
+     PluginLoader* const pl = PluginLoader::instance();
+ 
+@@ -76,34 +78,27 @@ FlickrTalker::FlickrTalker(QWidget* cons
+         m_iface = pl->interface();
+     }
+ 
+-    if (serviceName == QString::fromLatin1("23"))
++    if (serviceName == QLatin1String("23"))
+     {
+-        m_apiUrl    = QString::fromLatin1("http://www.23hq.com/services/rest/");
+-        m_authUrl   = QString::fromLatin1("http://www.23hq.com/services/auth/");
+-        m_uploadUrl = QString::fromLatin1("http://www.23hq.com/services/upload/");
++        m_apiUrl    = QLatin1String("http://www.23hq.com/services/rest/");
++        m_authUrl   = QLatin1String("http://www.23hq.com/services/auth/");
++        m_uploadUrl = QLatin1String("http://www.23hq.com/services/upload/");
+ 
+         // bshanks: do 23 and flickr really share API keys? or does 23 not need
+         // one?
+-        m_apikey    = QString::fromLatin1("49d585bafa0758cb5c58ab67198bf632");
+-        m_secret    = QString::fromLatin1("34b39925e6273ffd");
+-    }
+-    else if (serviceName == QString::fromLatin1("Zooomr"))
+-    {
+-        m_apiUrl    = QString::fromLatin1("http://api.zooomr.com/services/rest/");
+-        m_authUrl   = QString::fromLatin1("http://www.zooomr.com/services/auth/");
+-        m_uploadUrl = QString::fromLatin1("http://upload.zooomr.com/services/upload/");
+-
+-        m_apikey    = QString::fromLatin1("18c8db5ce9ed4e15a7b484136f5080c5");
+-        m_secret    = QString::fromLatin1("1ea4af14e3");
++        m_apikey    = QLatin1String("49d585bafa0758cb5c58ab67198bf632");
++        m_secret    = QLatin1String("34b39925e6273ffd");
+     }
+     else
+     {
+-        m_apiUrl    = QString::fromLatin1("https://www.flickr.com/services/rest/");
+-        m_authUrl   = QString::fromLatin1("https://www.flickr.com/services/auth/");
+-        m_uploadUrl = QString::fromLatin1("https://api.flickr.com/services/upload/");
++        m_apiUrl    = QLatin1String("https://www.flickr.com/services/rest/");
++        m_authUrl   = QLatin1String("https://www.flickr.com/services/oauth/authorize?perms=write");
++        m_tokenUrl  = QLatin1String("https://www.flickr.com/services/oauth/request_token");
++        m_accessUrl = QLatin1String("https://www.flickr.com/services/oauth/access_token");
++        m_uploadUrl = QLatin1String("https://up.flickr.com/services/upload/");
+ 
+-        m_apikey    = QString::fromLatin1("49d585bafa0758cb5c58ab67198bf632");
+-        m_secret    = QString::fromLatin1("34b39925e6273ffd");
++        m_apikey    = QLatin1String("49d585bafa0758cb5c58ab67198bf632");
++        m_secret    = QLatin1String("34b39925e6273ffd");
+     }
+ 
+     m_netMngr = new QNetworkAccessManager(this);
+@@ -116,8 +111,24 @@ FlickrTalker::FlickrTalker(QWidget* cons
+     /* Initialize photo sets list. */
+     m_photoSetsList    = new QLinkedList<FPhotoSet>();
+ 
+-    connect(this, SIGNAL(signalAuthenticate()),
+-            this, SLOT(slotAuthenticate()));
++    m_o1 = new O1(this);
++
++    m_o1->setClientId(m_apikey);
++    m_o1->setClientSecret(m_secret);
++    m_o1->setAuthorizeUrl(QUrl(m_authUrl));
++    m_o1->setAccessTokenUrl(QUrl(m_accessUrl));
++    m_o1->setRequestTokenUrl(QUrl(m_tokenUrl));
++
++    connect(m_o1, SIGNAL(linkingFailed()),
++            this, SLOT(slotLinkingFailed()));
++
++    connect(m_o1, SIGNAL(linkingSucceeded()),
++            this, SLOT(slotLinkingSucceeded()));
++
++    connect(m_o1, SIGNAL(openBrowser(QUrl)),
++            this, SLOT(slotOpenBrowser(QUrl)));
++
++    m_requestor = new O1Requestor(m_netMngr, m_o1, this);
+ }
+ 
+ FlickrTalker::~FlickrTalker()
+@@ -132,144 +143,51 @@ FlickrTalker::~FlickrTalker()
+     removeTemporaryDir(m_serviceName.toLatin1().constData());
+ }
+ 
+-/** Compute MD5 signature using url queries keys and values following Flickr notice:
+-    http://www.flickr.com/services/api/auth.spec.html
+-*/
+-QString FlickrTalker::getApiSig(const QString& secret, const QUrl& url)
++void FlickrTalker::link()
+ {
+-    QUrlQuery urlQuery(url.query());
+-    QList<QPair<QString, QString> > temp_queries = urlQuery.queryItems();
+-    QMap<QString, QString> queries;
+-
+-    QPair<QString, QString> pair;
+-
+-    foreach(pair, temp_queries)
+-    {
+-        queries.insert(pair.first,pair.second);
+-    }
+-
+-    QString compressed(secret);
+-
+-    // NOTE: iterator QMap iterator will sort alphabetically items based on key values.
+-    for (QMap<QString, QString>::iterator it = queries.begin() ; it != queries.end(); ++it)
+-    {
+-        compressed.append(it.key());
+-        compressed.append(it.value());
+-    }
++    emit signalBusy(true);
++    m_o1->link();
++}
+ 
+-    QCryptographicHash context(QCryptographicHash::Md5);
+-    context.addData(compressed.toUtf8());
+-    return QLatin1String(context.result().toHex().data());
++void FlickrTalker::unLink()
++{
++    m_o1->unlink();
+ }
+ 
+-QString FlickrTalker::getMaxAllowedFileSize()
++void FlickrTalker::slotLinkingFailed()
+ {
+-    return m_maxSize;
++    qCDebug(KIPIPLUGINS_LOG) << "LINK to Fickr fail";
++    emit signalBusy(false);
+ }
+ 
+-void FlickrTalker::maxAllowedFileSize()
++void FlickrTalker::slotLinkingSucceeded()
+ {
+-    if (m_reply)
++    if (!m_o1->linked())
+     {
+-        m_reply->abort();
+-        m_reply = 0;
++        qCDebug(KIPIPLUGINS_LOG) << "UNLINK to Fickr ok";
++        return;
+     }
+ 
+-    QUrl url(m_apiUrl);
+-    QUrlQuery urlQuery;
+-    urlQuery.addQueryItem(QString::fromLatin1("auth_token"), m_token);
+-    urlQuery.addQueryItem(QString::fromLatin1("api_key"), m_apikey);
+-    urlQuery.addQueryItem(QString::fromLatin1("method"), QString::fromLatin1("flickr.people.getLimits"));
+-    url.setQuery(urlQuery);
+-    QString md5 = getApiSig(m_secret, url);
+-    urlQuery.addQueryItem(QString::fromLatin1("api_sig"), md5);
+-    url.setQuery(urlQuery);
+-    qCDebug(KIPIPLUGINS_LOG) << "Get max file size url: " << url;
+-
+-    if (m_serviceName == QString::fromLatin1("Zooomr"))
+-    {
+-        // Zooomr redirects the POST at this url to a GET.
+-        m_reply = m_netMngr->get(QNetworkRequest(url));
+-    }
+-    else
+-    {
+-        QNetworkRequest netRequest(url);
+-        netRequest.setHeader(QNetworkRequest::ContentTypeHeader, QLatin1String("application/x-www-form-urlencoded"));
++    qCDebug(KIPIPLUGINS_LOG) << "LINK to Fickr ok";
+ 
+-        m_reply = m_netMngr->post(netRequest, QByteArray());
+-    }
++    m_username = m_o1->extraTokens()[QLatin1String("username")].toString();
++    m_userId   = m_o1->extraTokens()[QLatin1String("user_nsid")].toString();
+ 
+-    m_state = FE_GETMAXSIZE;
+-    m_authProgressDlg->setLabelText(i18n("Getting the maximum allowed file size."));
+-    m_authProgressDlg->setMaximum(4);
+-    m_authProgressDlg->setValue(1);
+-    m_buffer.resize(0);
+-    emit signalBusy(true);
++    emit signalLinkingSucceeded();
+ }
+ 
+-// MD5 signature of the request.
+-/*
+-QString FlickrTalker::getApiSig(const QString& secret, const QStringList &headers)
++void FlickrTalker::slotOpenBrowser(const QUrl& url)
+ {
+-    QMap<QString, QString> queries = url.queryItems();
+-    QString compressed(secret);
+-
+-    // NOTE: iterator QMap iterator will sort alphabetically items based on key values.
+-    for (QMap<QString, QString>::iterator it = queries.begin() ; it != queries.end(); ++it)
+-    {
+-        compressed.append(it.key());
+-        compressed.append(it.value());
+-    }
+-
+-    QCryptographicHash context(QCryptographicHash::Md5);
+-    context.addData(compressed.toUtf8());
+-    return context.result().toHex().data();
++    qCDebug(KIPIPLUGINS_LOG) << "Open Browser...";
++    QDesktopServices::openUrl(url);
+ }
+-*/
+ 
+-/**get the API sig and send it to the server server should return a frob.
+-*/
+-void FlickrTalker::getFrob()
++QString FlickrTalker::getMaxAllowedFileSize()
+ {
+-    if (m_reply)
+-    {
+-        m_reply->abort();
+-        m_reply = 0;
+-    }
+-
+-    QUrl url(m_apiUrl);
+-    QUrlQuery urlQuery;
+-    urlQuery.addQueryItem(QString::fromLatin1("method"), QString::fromLatin1("flickr.auth.getFrob"));
+-    urlQuery.addQueryItem(QString::fromLatin1("api_key"), m_apikey);
+-    url.setQuery(urlQuery);
+-
+-    QString md5 = getApiSig(m_secret, url);
+-    urlQuery.addQueryItem(QString::fromLatin1("api_sig"), md5);
+-    url.setQuery(urlQuery);
+-    qCDebug(KIPIPLUGINS_LOG) << "Get frob url: " << url;
+-
+-    if (m_serviceName == QString::fromLatin1("Zooomr"))
+-    {
+-        // Zooomr redirects the POST at this url to a GET.
+-        m_reply = m_netMngr->get(QNetworkRequest(url));
+-    }
+-    else
+-    {
+-        QNetworkRequest netRequest(url);
+-        netRequest.setHeader(QNetworkRequest::ContentTypeHeader, QLatin1String("application/x-www-form-urlencoded"));
+-
+-        m_reply = m_netMngr->post(netRequest, QByteArray());
+-    }
+-
+-    m_state = FE_GETFROB;
+-    m_authProgressDlg->setLabelText(i18n("Getting the Frob"));
+-    m_authProgressDlg->setMaximum(4);
+-    m_authProgressDlg->setValue(1);
+-    m_buffer.resize(0);
+-    emit signalBusy(true);
++    return m_maxSize;
+ }
+ 
+-void FlickrTalker::checkToken(const QString& token)
++void FlickrTalker::maxAllowedFileSize()
+ {
+     if (m_reply)
+     {
+@@ -277,39 +195,30 @@ void FlickrTalker::checkToken(const QStr
+         m_reply = 0;
+     }
+ 
++    if (!m_o1->linked())
++        return;
++
+     QUrl url(m_apiUrl);
+-    QUrlQuery urlQuery;
+-    urlQuery.addQueryItem(QString::fromLatin1("method"), QString::fromLatin1("flickr.auth.checkToken"));
+-    urlQuery.addQueryItem(QString::fromLatin1("api_key"), m_apikey);
+-    urlQuery.addQueryItem(QString::fromLatin1("auth_token"), token);
+-    url.setQuery(urlQuery);
+-    QString md5 = getApiSig(m_secret, url);
+-    urlQuery.addQueryItem(QString::fromLatin1("api_sig"), md5);
+-    url.setQuery(urlQuery);
+-    qCDebug(KIPIPLUGINS_LOG) << "Check token url: " << url;
++    QNetworkRequest netRequest(url);
++    QList<O0RequestParameter> reqParams = QList<O0RequestParameter>();
+ 
+-    if (m_serviceName == QString::fromLatin1("Zooomr"))
+-    {
+-        // Zooomr redirects the POST at this url to a GET.
+-        m_reply = m_netMngr->get(QNetworkRequest(url));
+-    }
+-    else
+-    {
+-        QNetworkRequest netRequest(url);
+-        netRequest.setHeader(QNetworkRequest::ContentTypeHeader, QLatin1String("application/x-www-form-urlencoded"));
++    netRequest.setHeader(QNetworkRequest::ContentTypeHeader, QLatin1String(O2_MIME_TYPE_XFORM));
+ 
+-        m_reply = m_netMngr->post(netRequest, QByteArray());
+-    }
++    reqParams << O0RequestParameter("method", "flickr.people.getLimits");
++
++    QByteArray postData = O1::createQueryParameters(reqParams);
+ 
+-    m_state = FE_CHECKTOKEN;
+-    m_authProgressDlg->setLabelText(i18n("Checking if previous token is still valid"));
++    m_reply = m_requestor->post(netRequest, reqParams, postData);
++
++    m_state = FE_GETMAXSIZE;
++    m_authProgressDlg->setLabelText(i18n("Getting the maximum allowed file size."));
+     m_authProgressDlg->setMaximum(4);
+     m_authProgressDlg->setValue(1);
+     m_buffer.resize(0);
+     emit signalBusy(true);
+ }
+ 
+-void FlickrTalker::slotAuthenticate()
++void FlickrTalker::listPhotoSets()
+ {
+     if (m_reply)
+     {
+@@ -317,116 +226,22 @@ void FlickrTalker::slotAuthenticate()
+         m_reply = 0;
+     }
+ 
+-    QUrl url(m_authUrl);
+-    QUrlQuery urlQuery;
+-    urlQuery.addQueryItem(QString::fromLatin1("api_key"), m_apikey);
+-    urlQuery.addQueryItem(QString::fromLatin1("frob"), m_frob);
+-    urlQuery.addQueryItem(QString::fromLatin1("perms"), QString::fromLatin1("write"));
+-    url.setQuery(urlQuery);
+-
+-    QString md5 = getApiSig(m_secret, url);
+-    urlQuery.addQueryItem(QString::fromLatin1("api_sig"), md5);
+-    url.setQuery(urlQuery);
+-    qCDebug(KIPIPLUGINS_LOG) << "Authenticate url: " << url;
+-
+-    QDesktopServices::openUrl(url);
+-
+-    QMessageBox quest(QMessageBox::Question,
+-                      i18n("%1 Service Web Authorization", m_serviceName),
+-                      i18n("Please follow the instructions in the browser window, then "
+-                           "return to press corresponding button."),
+-                      QMessageBox::Yes | QMessageBox::No);
+-
+-    (quest.button(QMessageBox::Yes))->setText(i18n("I am authenticated"));
+-    (quest.button(QMessageBox::No))->setText(i18n("I am not authenticated"));
+-
+-    if (quest.exec() == QMessageBox::Yes)
+-    {
+-        getToken();
+-        m_authProgressDlg->setLabelText(i18n("Authenticating the User on web"));
+-        m_authProgressDlg->setMaximum(4);
+-        m_authProgressDlg->setValue(2);
+-        emit signalBusy(false);
+-    }
+-    else
+-    {
+-        qCDebug(KIPIPLUGINS_LOG) << "User didn't proceed with getToken Authorization, cannot proceed further, aborting";
+-        cancel();
+-    }
+-}
++    if (!m_o1->linked())
++        return;
+ 
+-void FlickrTalker::getToken()
+-{
+-    if (m_reply)
+-    {
+-        m_reply->abort();
+-        m_reply = 0;
+-    }
++    qCDebug(KIPIPLUGINS_LOG) << "List photoset invoked";
+ 
+     QUrl url(m_apiUrl);
+-    QUrlQuery urlQuery;
+-    urlQuery.addQueryItem(QString::fromLatin1("api_key"), m_apikey);
+-    urlQuery.addQueryItem(QString::fromLatin1("method"), QString::fromLatin1("flickr.auth.getToken"));
+-    urlQuery.addQueryItem(QString::fromLatin1("frob"), m_frob);
+-    url.setQuery(urlQuery);
+-    QString md5 = getApiSig(m_secret, url);
+-    urlQuery.addQueryItem(QString::fromLatin1("api_sig"), md5);
+-    url.setQuery(urlQuery);
+-    qCDebug(KIPIPLUGINS_LOG) << "Get token url: " << url;
++    QNetworkRequest netRequest(url);
++    QList<O0RequestParameter> reqParams = QList<O0RequestParameter>();
+ 
+-    if (m_serviceName == QString::fromLatin1("Zooomr"))
+-    {
+-        // Zooomr redirects the POST at this url to a GET.
+-        m_reply = m_netMngr->get(QNetworkRequest(url));
+-    }
+-    else
+-    {
+-        QNetworkRequest netRequest(url);
+-        netRequest.setHeader(QNetworkRequest::ContentTypeHeader, QLatin1String("application/x-www-form-urlencoded"));
++    netRequest.setHeader(QNetworkRequest::ContentTypeHeader, QLatin1String(O2_MIME_TYPE_XFORM));
+ 
+-        m_reply = m_netMngr->post(netRequest, QByteArray());
+-    }
++    reqParams << O0RequestParameter("method", "flickr.photosets.getList");
+ 
+-    m_state = FE_GETTOKEN;
+-    m_buffer.resize(0);
+-    emit signalBusy(true);
+-    m_authProgressDlg->setLabelText(i18n("Getting the Token from the server"));
+-    m_authProgressDlg->setMaximum(4);
+-    m_authProgressDlg->setValue(3);
+-}
++    QByteArray postData = O1::createQueryParameters(reqParams);
+ 
+-void FlickrTalker::listPhotoSets()
+-{
+-    if (m_reply)
+-    {
+-        m_reply->abort();
+-        m_reply = 0;
+-    }
+-
+-    qCDebug(KIPIPLUGINS_LOG) << "List photoset invoked";
+-    QUrl url(m_apiUrl);
+-    QUrlQuery urlQuery;
+-    urlQuery.addQueryItem(QString::fromLatin1("auth_token"), m_token);
+-    urlQuery.addQueryItem(QString::fromLatin1("api_key"), m_apikey);
+-    urlQuery.addQueryItem(QString::fromLatin1("method"), QString::fromLatin1("flickr.photosets.getList"));
+-    url.setQuery(urlQuery);
+-    QString md5 = getApiSig(m_secret, url);
+-    urlQuery.addQueryItem(QString::fromLatin1("api_sig"), md5);
+-    url.setQuery(urlQuery);
+-    qCDebug(KIPIPLUGINS_LOG) << "List photoset URL" << url;
+-
+-    if (m_serviceName == QString::fromLatin1("Zooomr"))
+-    {
+-        // Zooomr redirects the POST at this url to a GET.
+-        m_reply = m_netMngr->get(QNetworkRequest(url));
+-    }
+-    else
+-    {
+-        QNetworkRequest netRequest(url);
+-        netRequest.setHeader(QNetworkRequest::ContentTypeHeader, QLatin1String("application/x-www-form-urlencoded"));
+-
+-        m_reply = m_netMngr->post(netRequest, QByteArray());
+-    }
++    m_reply = m_requestor->post(netRequest, reqParams, postData);
+ 
+     m_state = FE_LISTPHOTOSETS;
+     m_buffer.resize(0);
+@@ -441,43 +256,30 @@ void FlickrTalker::getPhotoProperty(cons
+         m_reply = 0;
+     }
+ 
++    if (!m_o1->linked())
++        return;
++
+     QUrl url(m_apiUrl);
+-    QUrlQuery urlQuery;
+-    urlQuery.addQueryItem(QString::fromLatin1("api_key"), m_apikey);
+-    urlQuery.addQueryItem(QString::fromLatin1("method"), method);
+-    urlQuery.addQueryItem(QString::fromLatin1("frob"), m_frob);
++    QNetworkRequest netRequest(url);
++    QList<O0RequestParameter> reqParams = QList<O0RequestParameter>();
++
++    netRequest.setHeader(QNetworkRequest::ContentTypeHeader, QLatin1String(O2_MIME_TYPE_XFORM));
++
++    reqParams << O0RequestParameter("method", method.toLatin1());
+ 
+     for (QStringList::const_iterator it = argList.constBegin(); it != argList.constEnd(); ++it)
+     {
+         QStringList str = (*it).split(QLatin1Char('='), QString::SkipEmptyParts);
+-        urlQuery.addQueryItem(str[0], str[1]);
++        reqParams << O0RequestParameter(str[0].toLatin1(), str[1].toLatin1());
+     }
+ 
+-    url.setQuery(urlQuery);
+-    QString md5 = getApiSig(m_secret, url);
+-    urlQuery.addQueryItem(QString::fromLatin1("api_sig"), md5);
+-    url.setQuery(urlQuery);
+-    qCDebug(KIPIPLUGINS_LOG) << "Get photo property url: " << url;
+-
+-    if (m_serviceName == QString::fromLatin1("Zooomr"))
+-    {
+-        // Zooomr redirects the POST at this url to a GET.
+-        m_reply = m_netMngr->get(QNetworkRequest(url));
+-    }
+-    else
+-    {
+-        QNetworkRequest netRequest(url);
+-        netRequest.setHeader(QNetworkRequest::ContentTypeHeader, QLatin1String("application/x-www-form-urlencoded"));
++    QByteArray postData = O1::createQueryParameters(reqParams);
+ 
+-        m_reply = m_netMngr->post(netRequest, QByteArray());
+-    }
++    m_reply = m_requestor->post(netRequest, reqParams, postData);
+ 
+     m_state = FE_GETPHOTOPROPERTY;
+     m_buffer.resize(0);
+     emit signalBusy(true);
+-
+-    //  m_authProgressDlg->setLabelText("Getting the Token from the server");
+-    //  m_authProgressDlg->setProgress(3,4);
+ }
+ 
+ void FlickrTalker::listPhotos(const QString& /*albumName*/)
+@@ -494,34 +296,25 @@ void FlickrTalker::createPhotoSet(const
+         m_reply = 0;
+     }
+ 
+-    qCDebug(KIPIPLUGINS_LOG) << "create photoset invoked";
++    if (!m_o1->linked())
++        return;
++
++    qCDebug(KIPIPLUGINS_LOG) << "Create photoset invoked";
++
+     QUrl url(m_apiUrl);
+-    QUrlQuery urlQuery;
+-    urlQuery.addQueryItem(QString::fromLatin1("auth_token"), m_token);
+-    urlQuery.addQueryItem(QString::fromLatin1("api_key"), m_apikey);
+-    urlQuery.addQueryItem(QString::fromLatin1("method"), QString::fromLatin1("flickr.photosets.create"));
+-    urlQuery.addQueryItem(QString::fromLatin1("title"), albumTitle);
+-    urlQuery.addQueryItem(QString::fromLatin1("description"), albumDescription);
+-    urlQuery.addQueryItem(QString::fromLatin1("primary_photo_id"), primaryPhotoId);
+-    url.setQuery(urlQuery);
+-
+-    QString md5 = getApiSig(m_secret, url);
+-    urlQuery.addQueryItem(QString::fromLatin1("api_sig"), md5);
+-    url.setQuery(urlQuery);
+-    qCDebug(KIPIPLUGINS_LOG) << "List photo sets url: " << url;
++    QNetworkRequest netRequest(url);
++    QList<O0RequestParameter> reqParams = QList<O0RequestParameter>();
+ 
+-    if (m_serviceName == QString::fromLatin1("Zooomr"))
+-    {
+-        // Zooomr redirects the POST at this url to a GET.
+-        m_reply = m_netMngr->get(QNetworkRequest(url));
+-    }
+-    else
+-    {
+-        QNetworkRequest netRequest(url);
+-        netRequest.setHeader(QNetworkRequest::ContentTypeHeader, QLatin1String("application/x-www-form-urlencoded"));
++    netRequest.setHeader(QNetworkRequest::ContentTypeHeader, QLatin1String(O2_MIME_TYPE_XFORM));
+ 
+-        m_reply = m_netMngr->post(netRequest, QByteArray());
+-    }
++    reqParams << O0RequestParameter("method", "flickr.photosets.create");
++    reqParams << O0RequestParameter("title", albumTitle.toLatin1());
++    reqParams << O0RequestParameter("description", albumDescription.toLatin1());
++    reqParams << O0RequestParameter("primary_photo_id", primaryPhotoId.toLatin1());
++
++    QByteArray postData = O1::createQueryParameters(reqParams);
++
++    m_reply = m_requestor->post(netRequest, reqParams, postData);
+ 
+     m_state = FE_CREATEPHOTOSET;
+     m_buffer.resize(0);
+@@ -537,9 +330,10 @@ void FlickrTalker::addPhotoToPhotoSet(co
+         m_reply = 0;
+     }
+ 
+-    qCDebug(KIPIPLUGINS_LOG) << "addPhotoToPhotoSet invoked";
+-    QUrl url(m_apiUrl);
+-    QUrlQuery urlQuery;
++    if (!m_o1->linked())
++        return;
++
++    qCDebug(KIPIPLUGINS_LOG) << "AddPhotoToPhotoSet invoked";
+ 
+     /* If the photoset id starts with the special string "UNDEFINED_", it means
+      * it doesn't exist yet on Flickr and needs to be created. Note that it's
+@@ -547,26 +341,23 @@ void FlickrTalker::addPhotoToPhotoSet(co
+      * is done in the set creation call to Flickr. */
+     if (photoSetId.startsWith(QLatin1String("UNDEFINED_")))
+     {
+-        createPhotoSet(QString::fromLatin1(""), m_selectedPhotoSet.title, m_selectedPhotoSet.description, photoId);
++        createPhotoSet(QLatin1String(""), m_selectedPhotoSet.title, m_selectedPhotoSet.description, photoId);
+     }
+     else
+     {
+-        urlQuery.addQueryItem(QString::fromLatin1("auth_token"), m_token);
+-        urlQuery.addQueryItem(QString::fromLatin1("photoset_id"), photoSetId);
+-        urlQuery.addQueryItem(QString::fromLatin1("api_key"), m_apikey);
+-        urlQuery.addQueryItem(QString::fromLatin1("method"), QString::fromLatin1("flickr.photosets.addPhoto"));
+-        urlQuery.addQueryItem(QString::fromLatin1("photo_id"), photoId);
+-        url.setQuery(urlQuery);
+-
+-        QString md5 = getApiSig(m_secret, url);
+-        urlQuery.addQueryItem(QString::fromLatin1("api_sig"), md5);
+-        url.setQuery(urlQuery);
+-        qCDebug(KIPIPLUGINS_LOG) << "Add photo to Photo set url: " << url;
+-
++        QUrl url(m_apiUrl);
+         QNetworkRequest netRequest(url);
+-        netRequest.setHeader(QNetworkRequest::ContentTypeHeader, QLatin1String("application/x-www-form-urlencoded"));
++        QList<O0RequestParameter> reqParams = QList<O0RequestParameter>();
++
++        netRequest.setHeader(QNetworkRequest::ContentTypeHeader, QLatin1String(O2_MIME_TYPE_XFORM));
+ 
+-        m_reply = m_netMngr->post(netRequest, QByteArray());
++        reqParams << O0RequestParameter("method", "flickr.photosets.addPhoto");
++        reqParams << O0RequestParameter("photoset_id", photoSetId.toLatin1());
++        reqParams << O0RequestParameter("photo_id", photoId.toLatin1());
++
++        QByteArray postData = O1::createQueryParameters(reqParams);
++
++        m_reply = m_requestor->post(netRequest, reqParams, postData);
+ 
+         m_state = FE_ADDPHOTOTOPHOTOSET;
+         m_buffer.resize(0);
+@@ -575,7 +366,7 @@ void FlickrTalker::addPhotoToPhotoSet(co
+ }
+ 
+ bool FlickrTalker::addPhoto(const QString& photoPath, const FPhotoInfo& info,
+-                            bool rescale, int maxDim, int imageQuality)
++                            bool original, bool rescale, int maxDim, int imageQuality)
+ {
+     if (m_reply)
+     {
+@@ -583,123 +374,125 @@ bool FlickrTalker::addPhoto(const QStrin
+         m_reply = 0;
+     }
+ 
++    if (!m_o1->linked())
++        return false;
++
+     QUrl url(m_uploadUrl);
++    QNetworkRequest netRequest(url);
++    QList<O0RequestParameter> reqParams = QList<O0RequestParameter>();
+ 
+-    // We dont' want to modify url as such, we just used the QUrl object for storing the query items.
+-    QUrl url2(QString::fromLatin1(""));
+-    QUrlQuery urlQuery;
+     QString path = photoPath;
+     MPForm  form;
+ 
+-    form.addPair(QString::fromLatin1("auth_token"), m_token, QString::fromLatin1("text/plain"));
+-    urlQuery.addQueryItem(QString::fromLatin1("auth_token"), m_token);
+-
+-    form.addPair(QString::fromLatin1("api_key"), m_apikey, QString::fromLatin1("text/plain"));
+-    urlQuery.addQueryItem(QString::fromLatin1("api_key"), m_apikey);
+-
+-    QString ispublic = (info.is_public == 1) ? QString::fromLatin1("1") : QString::fromLatin1("0");
+-    form.addPair(QString::fromLatin1("is_public"), ispublic, QString::fromLatin1("text/plain"));
+-    urlQuery.addQueryItem(QString::fromLatin1("is_public"), ispublic);
+-
+-    QString isfamily = (info.is_family == 1) ? QString::fromLatin1("1") : QString::fromLatin1("0");
+-    form.addPair(QString::fromLatin1("is_family"), isfamily, QString::fromLatin1("text/plain"));
+-    urlQuery.addQueryItem(QString::fromLatin1("is_family"), isfamily);
+-
+-    QString isfriend = (info.is_friend == 1) ? QString::fromLatin1("1") : QString::fromLatin1("0");
+-    form.addPair(QString::fromLatin1("is_friend"), isfriend, QString::fromLatin1("text/plain"));
+-    urlQuery.addQueryItem(QString::fromLatin1("is_friend"), isfriend);
++    QString ispublic = (info.is_public == 1) ? QLatin1String("1") : QLatin1String("0");
++    form.addPair(QLatin1String("is_public"), ispublic, QLatin1String("text/plain"));
++    reqParams << O0RequestParameter("is_public", ispublic.toLatin1());
++
++    QString isfamily = (info.is_family == 1) ? QLatin1String("1") : QLatin1String("0");
++    form.addPair(QLatin1String("is_family"), isfamily, QLatin1String("text/plain"));
++    reqParams << O0RequestParameter("is_family", isfamily.toLatin1());
++
++    QString isfriend = (info.is_friend == 1) ? QLatin1String("1") : QLatin1String("0");
++    form.addPair(QLatin1String("is_friend"), isfriend, QLatin1String("text/plain"));
++    reqParams << O0RequestParameter("is_friend", isfriend.toLatin1());
+ 
+     QString safetyLevel = QString::number(static_cast<int>(info.safety_level));
+-    form.addPair(QString::fromLatin1("safety_level"), safetyLevel, QString::fromLatin1("text/plain"));
+-    urlQuery.addQueryItem(QString::fromLatin1("safety_level"), safetyLevel);
++    form.addPair(QLatin1String("safety_level"), safetyLevel, QLatin1String("text/plain"));
++    reqParams << O0RequestParameter("safety_level", safetyLevel.toLatin1());
+ 
+     QString contentType = QString::number(static_cast<int>(info.content_type));
+-    form.addPair(QString::fromLatin1("content_type"), contentType, QString::fromLatin1("text/plain"));
+-    urlQuery.addQueryItem(QString::fromLatin1("content_type"), contentType);
++    form.addPair(QLatin1String("content_type"), contentType, QLatin1String("text/plain"));
++    reqParams << O0RequestParameter("content_type", contentType.toLatin1());
+ 
+-    QString tags = QString::fromLatin1("\"") + info.tags.join(QString::fromLatin1("\" \"")) + QString::fromLatin1("\"");
++    QString tags = QLatin1String("\"") + info.tags.join(QLatin1String("\" \"")) + QLatin1String("\"");
+ 
+     if (tags.length() > 0)
+     {
+-        form.addPair(QString::fromLatin1("tags"), tags, QString::fromLatin1("text/plain"));
+-        urlQuery.addQueryItem(QString::fromLatin1("tags"), tags);
++        form.addPair(QLatin1String("tags"), tags, QLatin1String("text/plain"));
++        reqParams << O0RequestParameter("tags", tags.toUtf8());
+     }
+ 
+     if (!info.title.isEmpty())
+     {
+-        form.addPair(QString::fromLatin1("title"), info.title, QString::fromLatin1("text/plain"));
+-        urlQuery.addQueryItem(QString::fromLatin1("title"), info.title);
++        form.addPair(QLatin1String("title"), info.title, QLatin1String("text/plain"));
++        reqParams << O0RequestParameter("title", info.title.toUtf8());
+     }
+ 
+     if (!info.description.isEmpty())
+     {
+-        form.addPair(QString::fromLatin1("description"), info.description, QString::fromLatin1("text/plain"));
+-        urlQuery.addQueryItem(QString::fromLatin1("description"), info.description);
+-    }
+-
+-    url2.setQuery(urlQuery);
+-    QString md5 = getApiSig(m_secret, url2);
+-    form.addPair(QString::fromLatin1("api_sig"), md5, QString::fromLatin1("text/plain"));
+-    QImage image;
+-
+-    if (m_iface)
+-    {
+-        image = m_iface->preview(QUrl::fromLocalFile(photoPath));
++        form.addPair(QLatin1String("description"), info.description, QLatin1String("text/plain"));
++        reqParams << O0RequestParameter("description", info.description.toUtf8());
+     }
+ 
+-    if (image.isNull())
++    if (!original)
+     {
+-        image.load(photoPath);
+-    }
++        QImage image;
+ 
+-    if (!image.isNull())
+-    {
+-        if (!m_lastTmpFile.isEmpty())
++        if (m_iface)
+         {
+-            QFile::remove(m_lastTmpFile);
++            image = m_iface->preview(QUrl::fromLocalFile(photoPath));
+         }
+ 
+-        path = makeTemporaryDir(m_serviceName.toLatin1().constData()).filePath(QFileInfo(photoPath)
+-                                                                     .baseName().trimmed() + QLatin1String(".jpg"));
+-
+-        if (rescale)
++        if (image.isNull())
+         {
+-            if (image.width() > maxDim || image.height() > maxDim)
+-                image = image.scaled(maxDim, maxDim, Qt::KeepAspectRatio, Qt::SmoothTransformation);
++            image.load(photoPath);
+         }
+ 
+-        image.save(path, "JPEG", imageQuality);
+-        m_lastTmpFile = path;
+-
+-        // Restore all metadata.
+-
+-        if (m_iface)
++        if (!image.isNull())
+         {
+-            QPointer<MetadataProcessor> meta = m_iface->createMetadataProcessor();
+-
+-            if (meta && meta->load(QUrl::fromLocalFile(photoPath)))
++            if (!m_lastTmpFile.isEmpty())
+             {
+-                meta->setImageDimensions(image.size());
++                QFile::remove(m_lastTmpFile);
++            }
+ 
+-                // NOTE: see bug #153207: Flickr use IPTC keywords to create Tags in web interface
+-                //       As IPTC do not support UTF-8, we need to remove it.
+-                meta->removeIptcTags(QStringList() << QLatin1String("Iptc.Application2.Keywords"));
++            path = makeTemporaryDir(m_serviceName.toLatin1().constData()).filePath(QFileInfo(photoPath)
++                                                                         .baseName().trimmed() + QLatin1String(".jpg"));
+ 
+-                meta->setImageProgramId(QString::fromLatin1("Kipi-plugins"), kipipluginsVersion());
+-                meta->save(QUrl::fromLocalFile(path));
++            if (rescale)
++            {
++                if (image.width() > maxDim || image.height() > maxDim)
++                    image = image.scaled(maxDim, maxDim, Qt::KeepAspectRatio, Qt::SmoothTransformation);
+             }
+-            else
++
++            image.save(path, "JPEG", imageQuality);
++            m_lastTmpFile = path;
++
++            // Restore all metadata.
++
++            if (m_iface)
+             {
+-                qCWarning(KIPIPLUGINS_LOG) << "flickrExport::Image doesn't have metadata";
++                QPointer<MetadataProcessor> meta = m_iface->createMetadataProcessor();
++
++                if (meta && meta->load(QUrl::fromLocalFile(photoPath)))
++                {
++                    meta->setImageDimensions(image.size());
++                    meta->setImageOrientation(MetadataProcessor::NORMAL);
++
++                    // NOTE: see bug #153207: Flickr use IPTC keywords to create Tags in web interface
++                    //       As IPTC do not support UTF-8, we need to remove it.
++                    //       This function call remove all Application2 Tags.
++                    meta->removeIptcTags(QStringList() << QLatin1String("Application2"));
++                    // NOTE: see bug # 384260: Flickr use Xmp.dc.subject to create Tags
++                    //       in web interface, we need to remove it.
++                    //       This function call remove all Dublin Core Tags.
++                    meta->removeXmpTags(QStringList() << QLatin1String("dc"));
++
++                    meta->setImageProgramId(QLatin1String("Kipi-plugins"), kipipluginsVersion());
++                    meta->save(QUrl::fromLocalFile(path), true);
++                }
++                else
++                {
++                    qCWarning(KIPIPLUGINS_LOG) << "flickrExport::Image doesn't have metadata";
++                }
+             }
+-        }
+ 
+-        qCDebug(KIPIPLUGINS_LOG) << "Resizing and saving to temp file: " << path;
++            qCDebug(KIPIPLUGINS_LOG) << "Resizing and saving to temp file: " << path;
++        }
+     }
+ 
+     QFileInfo tempFileInfo(path);
+ 
+-    qCDebug(KIPIPLUGINS_LOG) << "QUrl path is " << QUrl::fromLocalFile(path) << "Image size after resizing (in bytes) is "<< tempFileInfo.size();
++    qCDebug(KIPIPLUGINS_LOG) << "QUrl path is " << QUrl::fromLocalFile(path) << "Image size (in bytes) is "<< tempFileInfo.size();
+ 
+     if (tempFileInfo.size() > (getMaxAllowedFileSize().toLongLong()))
+     {
+@@ -707,17 +500,16 @@ bool FlickrTalker::addPhoto(const QStrin
+         return false;
+     }
+ 
+-    if (!form.addFile(QString::fromLatin1("photo"), path))
++    if (!form.addFile(QLatin1String("photo"), path))
+     {
+         return false;
+     }
+ 
+     form.finish();
+ 
+-    QNetworkRequest netRequest(url);
+     netRequest.setHeader(QNetworkRequest::ContentTypeHeader, form.contentType());
+ 
+-    m_reply = m_netMngr->post(netRequest, form.formData());
++    m_reply = m_requestor->post(netRequest, reqParams, form.formData());
+ 
+     m_state = FE_ADDPHOTO;
+     m_buffer.resize(0);
+@@ -869,22 +661,6 @@ void FlickrTalker::slotFinished(QNetwork
+             parseResponseListPhotoSets(m_buffer);
+             break;
+ 
+-        case (FE_GETFROB):
+-            parseResponseGetFrob(m_buffer);
+-            break;
+-
+-        case (FE_GETTOKEN):
+-            parseResponseGetToken(m_buffer);
+-            break;
+-
+-        case (FE_CHECKTOKEN):
+-            parseResponseCheckToken(m_buffer);
+-            break;
+-
+-        case (FE_GETAUTHORIZED):
+-            //parseResponseGetToken(m_buffer);
+-            break;
+-
+         case (FE_LISTPHOTOS):
+             parseResponseListPhotos(m_buffer);
+             break;
+@@ -919,7 +695,7 @@ void FlickrTalker::slotFinished(QNetwork
+ void FlickrTalker::parseResponseMaxSize(const QByteArray& data)
+ {
+     QString errorString;
+-    QDomDocument doc(QString::fromLatin1("mydocument"));
++    QDomDocument doc(QLatin1String("mydocument"));
+ 
+     if (!doc.setContent(data))
+     {
+@@ -933,7 +709,7 @@ void FlickrTalker::parseResponseMaxSize(
+ 
+     while (!node.isNull())
+     {
+-        if (node.isElement() && node.nodeName() == QString::fromLatin1("person"))
++        if (node.isElement() && node.nodeName() == QLatin1String("person"))
+         {
+             e                = node.toElement();
+             QDomNode details = e.firstChild();
+@@ -944,9 +720,9 @@ void FlickrTalker::parseResponseMaxSize(
+                 {
+                     e = details.toElement();
+ 
+-                    if (details.nodeName() == QString::fromLatin1("photos"))
++                    if (details.nodeName() == QLatin1String("photos"))
+                     {
+-                        QDomAttr a = e.attributeNode(QString::fromLatin1("maxupload"));
++                        QDomAttr a = e.attributeNode(QLatin1String("maxupload"));
+                         m_maxSize = a.value();
+                         qCDebug(KIPIPLUGINS_LOG) << "Max upload size is"<<m_maxSize;
+                     }
+@@ -956,255 +732,18 @@ void FlickrTalker::parseResponseMaxSize(
+             }
+         }
+ 
+-        if (node.isElement() && node.nodeName() == QString::fromLatin1("err"))
+-        {
+-            qCDebug(KIPIPLUGINS_LOG) << "Checking Error in response";
+-            errorString = node.toElement().attribute(QString::fromLatin1("code"));
+-            qCDebug(KIPIPLUGINS_LOG) << "Error code=" << errorString;
+-            qCDebug(KIPIPLUGINS_LOG) << "Msg=" << node.toElement().attribute(QString::fromLatin1("msg"));
+-        }
+-
+-        node = node.nextSibling();
+-    }
+-}
+-
+-void FlickrTalker::parseResponseGetFrob(const QByteArray& data)
+-{
+-    bool success = false;
+-    QString errorString;
+-    QDomDocument doc(QString::fromLatin1("mydocument"));
+-
+-    if (!doc.setContent(data))
+-    {
+-        return;
+-    }
+-
+-    QDomElement docElem = doc.documentElement();
+-    QDomNode node       = docElem.firstChild();
+-
+-    while (!node.isNull())
+-    {
+-        if (node.isElement() && node.nodeName() == QString::fromLatin1("frob"))
+-        {
+-            QDomElement e = node.toElement();    // try to convert the node to an element.
+-            qCDebug(KIPIPLUGINS_LOG) << "Frob is" << e.text();
+-            m_frob        = e.text();            // this is what is obtained from data.
+-            success       = true;
+-        }
+-
+-        if (node.isElement() && node.nodeName() == QString::fromLatin1("err"))
++        if (node.isElement() && node.nodeName() == QLatin1String("err"))
+         {
+             qCDebug(KIPIPLUGINS_LOG) << "Checking Error in response";
+-            errorString = node.toElement().attribute(QString::fromLatin1("code"));
++            errorString = node.toElement().attribute(QLatin1String("code"));
+             qCDebug(KIPIPLUGINS_LOG) << "Error code=" << errorString;
+-            qCDebug(KIPIPLUGINS_LOG) << "Msg=" << node.toElement().attribute(QString::fromLatin1("msg"));
++            qCDebug(KIPIPLUGINS_LOG) << "Msg=" << node.toElement().attribute(QLatin1String("msg"));
+         }
+ 
+         node = node.nextSibling();
+     }
+ 
+-    qCDebug(KIPIPLUGINS_LOG) << "GetFrob finished";
+-    m_authProgressDlg->setMaximum(4);
+-    m_authProgressDlg->setValue(2);
+-    m_state = FE_GETAUTHORIZED;
+-
+-    if (success)
+-    {
+-        emit signalAuthenticate();
+-    }
+-    else
+-    {
+-        emit signalError(errorString);
+-    }
+-}
+-
+-void FlickrTalker::parseResponseCheckToken(const QByteArray& data)
+-{
+-    bool         success = false;
+-    QString      errorString;
+-    QString      username;
+-    QString      transReturn;
+-    QDomDocument doc(QString::fromLatin1("checktoken"));
+-
+-    if (!doc.setContent(data))
+-    {
+-        return;
+-    }
+-
+-    QDomElement docElem = doc.documentElement();
+-    QDomNode node       = docElem.firstChild();
+-    QDomElement e;
+-
+-    while (!node.isNull())
+-    {
+-        if (node.isElement() && node.nodeName() == QString::fromLatin1("auth"))
+-        {
+-            e                = node.toElement(); // try to convert the node to an element.
+-            QDomNode details = e.firstChild();
+-
+-            while (!details.isNull())
+-            {
+-                if (details.isElement())
+-                {
+-                    e = details.toElement();
+-
+-                    if (details.nodeName() == QString::fromLatin1("token"))
+-                    {
+-                        qCDebug(KIPIPLUGINS_LOG) << "Token=" << e.text();
+-                        m_token = e.text();//this is what is obtained from data.
+-                    }
+-
+-                    if (details.nodeName() == QString::fromLatin1("perms"))
+-                    {
+-                        qCDebug(KIPIPLUGINS_LOG) << "Perms=" << e.text();
+-                        QString perms = e.text();//this is what is obtained from data.
+-
+-                        if (perms == QString::fromLatin1("write"))
+-                        {
+-                            transReturn = i18nc("As in the permission to", "write");
+-                        }
+-                        else if (perms == QString::fromLatin1("read"))
+-                        {
+-                            transReturn = i18nc("As in the permission to", "read");
+-                        }
+-                        else if (perms == QString::fromLatin1("delete"))
+-                        {
+-                            transReturn = i18nc("As in the permission to", "delete");
+-                        }
+-                    }
+-
+-                    if (details.nodeName() == QString::fromLatin1("user"))
+-                    {
+-                        qCDebug(KIPIPLUGINS_LOG) << "nsid=" << e.attribute(QString::fromLatin1("nsid"));
+-                        m_userId   = e.attribute(QString::fromLatin1("nsid"));
+-                        username   = e.attribute(QString::fromLatin1("username"));
+-                        m_username = username;
+-                        qCDebug(KIPIPLUGINS_LOG) << "username=" << e.attribute(QString::fromLatin1("username"));
+-                        qCDebug(KIPIPLUGINS_LOG) << "fullname=" << e.attribute(QString::fromLatin1("fullname"));
+-                    }
+-                }
+-
+-                details = details.nextSibling();
+-            }
+-
+-            m_authProgressDlg->hide();
+-            emit signalTokenObtained(m_token);
+-            success = true;
+-        }
+-
+-        if (node.isElement() && node.nodeName() == QString::fromLatin1("err"))
+-        {
+-            qCDebug(KIPIPLUGINS_LOG) << "Checking Error in response";
+-            errorString = node.toElement().attribute(QString::fromLatin1("code"));
+-            qCDebug(KIPIPLUGINS_LOG) << "Error code=" << errorString;
+-            qCDebug(KIPIPLUGINS_LOG) << "Msg=" << node.toElement().attribute(QString::fromLatin1("msg"));
+-
+-            int valueOk = QMessageBox::question(QApplication::activeWindow(),
+-                                                i18n("Invalid Token"),
+-                                                i18n("Your token is invalid. Would you like to "
+-                                                      "get a new token to proceed?\n"));
+-
+-            if (valueOk == QMessageBox::Yes)
+-            {
+-                getFrob();
+-                return;
+-            }
+-            else
+-            {
+-                m_authProgressDlg->hide(); //will popup the result for the checktoken failure below
+-            }
+-
+-        }
+-
+-        node = node.nextSibling();
+-    }
+-
+-    if (!success)
+-    {
+-        emit signalError(errorString);
+-    }
+-
+-    qCDebug(KIPIPLUGINS_LOG) << "CheckToken finished";
+-}
+-
+-void FlickrTalker::parseResponseGetToken(const QByteArray& data)
+-{
+-    bool success = false;
+-    QString errorString;
+-    QDomDocument doc(QString::fromLatin1("gettoken"));
+-
+-    if (!doc.setContent(data))
+-    {
+-        return;
+-    }
+-
+-    QDomElement docElem = doc.documentElement();
+-    QDomNode    node    = docElem.firstChild();
+-    QDomElement e;
+-
+-    while (!node.isNull())
+-    {
+-        if (node.isElement() && node.nodeName() == QString::fromLatin1("auth"))
+-        {
+-            e                = node.toElement(); // try to convert the node to an element.
+-            QDomNode details = e.firstChild();
+-
+-            while (!details.isNull())
+-            {
+-                if (details.isElement())
+-                {
+-                    e = details.toElement();
+-
+-                    if (details.nodeName() == QString::fromLatin1("token"))
+-                    {
+-                        qCDebug(KIPIPLUGINS_LOG) << "Token=" << e.text();
+-                        m_token = e.text();      //this is what is obtained from data.
+-                    }
+-
+-                    if (details.nodeName() == QString::fromLatin1("perms"))
+-                    {
+-                        qCDebug(KIPIPLUGINS_LOG) << "Perms=" << e.text();
+-                    }
+-
+-                    if (details.nodeName() == QString::fromLatin1("user"))
+-                    {
+-                        qCDebug(KIPIPLUGINS_LOG) << "nsid=" << e.attribute(QString::fromLatin1("nsid"));
+-                        qCDebug(KIPIPLUGINS_LOG) << "username=" << e.attribute(QString::fromLatin1("username"));
+-                        qCDebug(KIPIPLUGINS_LOG) << "fullname=" << e.attribute(QString::fromLatin1("fullname"));
+-                        m_username = e.attribute(QString::fromLatin1("username"));
+-                        m_userId   = e.attribute(QString::fromLatin1("nsid"));
+-                    }
+-                }
+-
+-                details = details.nextSibling();
+-            }
+-
+-            success = true;
+-        }
+-        else if (node.isElement() && node.nodeName() == QString::fromLatin1("err"))
+-        {
+-            qCDebug(KIPIPLUGINS_LOG) << "Checking Error in response";
+-            errorString = node.toElement().attribute(QString::fromLatin1("code"));
+-            qCDebug(KIPIPLUGINS_LOG) << "Error code=" << errorString;
+-            qCDebug(KIPIPLUGINS_LOG) << "Msg=" << node.toElement().attribute(QString::fromLatin1("msg"));
+-            //emit signalError(code);
+-        }
+-
+-        node = node.nextSibling();
+-    }
+-
+-    qCDebug(KIPIPLUGINS_LOG) << "GetToken finished";
+-    //emit signalBusy( false );
+     m_authProgressDlg->hide();
+-
+-    if (success)
+-    {
+-        emit signalTokenObtained(m_token);
+-    }
+-    else
+-    {
+-        emit signalError(errorString);
+-    }
+ }
+ 
+ void FlickrTalker::parseResponseCreatePhotoSet(const QByteArray& data)
+@@ -1213,7 +752,7 @@ void FlickrTalker::parseResponseCreatePh
+ 
+     //bool success = false;
+ 
+-    QDomDocument doc(QString::fromLatin1("getListPhotoSets"));
++    QDomDocument doc(QLatin1String("getListPhotoSets"));
+ 
+     if (!doc.setContent(data))
+     {
+@@ -1226,10 +765,10 @@ void FlickrTalker::parseResponseCreatePh
+ 
+     while (!node.isNull())
+     {
+-        if (node.isElement() && node.nodeName() == QString::fromLatin1("photoset"))
++        if (node.isElement() && node.nodeName() == QLatin1String("photoset"))
+         {
+             // Parse the id from the response.
+-            QString new_id = node.toElement().attribute(QString::fromLatin1("id"));
++            QString new_id = node.toElement().attribute(QLatin1String("id"));
+ 
+             // Set the new id in the photo sets list.
+             QLinkedList<FPhotoSet>::iterator it = m_photoSetsList->begin();
+@@ -1252,12 +791,12 @@ void FlickrTalker::parseResponseCreatePh
+             emit signalAddPhotoSetSucceeded();
+         }
+ 
+-        if (node.isElement() && node.nodeName() == QString::fromLatin1("err"))
++        if (node.isElement() && node.nodeName() == QLatin1String("err"))
+         {
+             qCDebug(KIPIPLUGINS_LOG) << "Checking Error in response";
+-            QString code = node.toElement().attribute(QString::fromLatin1("code"));
++            QString code = node.toElement().attribute(QLatin1String("code"));
+             qCDebug(KIPIPLUGINS_LOG) << "Error code=" << code;
+-            QString msg = node.toElement().attribute(QString::fromLatin1("msg"));
++            QString msg = node.toElement().attribute(QLatin1String("msg"));
+             qCDebug(KIPIPLUGINS_LOG) << "Msg=" << msg;
+             QMessageBox::critical(QApplication::activeWindow(), i18n("Error"), i18n("PhotoSet creation failed: ") + msg);
+         }
+@@ -1270,7 +809,7 @@ void FlickrTalker::parseResponseListPhot
+ {
+     qCDebug(KIPIPLUGINS_LOG) << "parseResponseListPhotosets" << data;
+     bool success = false;
+-    QDomDocument doc(QString::fromLatin1("getListPhotoSets"));
++    QDomDocument doc(QLatin1String("getListPhotoSets"));
+ 
+     if (!doc.setContent(data))
+     {
+@@ -1286,7 +825,7 @@ void FlickrTalker::parseResponseListPhot
+ 
+     while (!node.isNull())
+     {
+-        if (node.isElement() && node.nodeName() == QString::fromLatin1("photosets"))
++        if (node.isElement() && node.nodeName() == QLatin1String("photosets"))
+         {
+             e                    = node.toElement();
+             QDomNode details     = e.firstChild();
+@@ -1299,10 +838,10 @@ void FlickrTalker::parseResponseListPhot
+                 {
+                     e = detailsNode.toElement();
+ 
+-                    if (detailsNode.nodeName() == QString::fromLatin1("photoset"))
++                    if (detailsNode.nodeName() == QLatin1String("photoset"))
+                     {
+-                        qCDebug(KIPIPLUGINS_LOG) << "id=" << e.attribute(QString::fromLatin1("id"));
+-                        photoSet_id              = e.attribute(QString::fromLatin1("id"));     // this is what is obtained from data.
++                        qCDebug(KIPIPLUGINS_LOG) << "id=" << e.attribute(QLatin1String("id"));
++                        photoSet_id              = e.attribute(QLatin1String("id"));     // this is what is obtained from data.
+                         fps.id                   = photoSet_id;
+                         QDomNode photoSetDetails = detailsNode.firstChild();
+                         QDomElement e_detail;
+@@ -1311,13 +850,13 @@ void FlickrTalker::parseResponseListPhot
+                         {
+                             e_detail = photoSetDetails.toElement();
+ 
+-                            if (photoSetDetails.nodeName() == QString::fromLatin1("title"))
++                            if (photoSetDetails.nodeName() == QLatin1String("title"))
+                             {
+                                 qCDebug(KIPIPLUGINS_LOG) << "Title=" << e_detail.text();
+                                 photoSet_title = e_detail.text();
+                                 fps.title      = photoSet_title;
+                             }
+-                            else if (photoSetDetails.nodeName() == QString::fromLatin1("description"))
++                            else if (photoSetDetails.nodeName() == QLatin1String("description"))
+                             {
+                                 qCDebug(KIPIPLUGINS_LOG) << "Description =" << e_detail.text();
+                                 photoSet_description = e_detail.text();
+@@ -1338,12 +877,12 @@ void FlickrTalker::parseResponseListPhot
+             success = true;
+         }
+ 
+-        if (node.isElement() && node.nodeName() == QString::fromLatin1("err"))
++        if (node.isElement() && node.nodeName() == QLatin1String("err"))
+         {
+             qCDebug(KIPIPLUGINS_LOG) << "Checking Error in response";
+-            QString code = node.toElement().attribute(QString::fromLatin1("code"));
++            QString code = node.toElement().attribute(QLatin1String("code"));
+             qCDebug(KIPIPLUGINS_LOG) << "Error code=" << code;
+-            qCDebug(KIPIPLUGINS_LOG) << "Msg=" << node.toElement().attribute(QString::fromLatin1("msg"));
++            qCDebug(KIPIPLUGINS_LOG) << "Msg=" << node.toElement().attribute(QLatin1String("msg"));
+             emit signalError(code);
+         }
+ 
+@@ -1365,7 +904,7 @@ void FlickrTalker::parseResponseListPhot
+ 
+ void FlickrTalker::parseResponseListPhotos(const QByteArray& data)
+ {
+-    QDomDocument doc(QString::fromLatin1("getPhotosList"));
++    QDomDocument doc(QLatin1String("getPhotosList"));
+ 
+     if (!doc.setContent(data))
+     {
+@@ -1380,7 +919,7 @@ void FlickrTalker::parseResponseListPhot
+ 
+ void FlickrTalker::parseResponseCreateAlbum(const QByteArray& data)
+ {
+-    QDomDocument doc(QString::fromLatin1("getCreateAlbum"));
++    QDomDocument doc(QLatin1String("getCreateAlbum"));
+ 
+     if (!doc.setContent(data))
+     {
+@@ -1397,7 +936,7 @@ void FlickrTalker::parseResponseAddPhoto
+ {
+     bool    success = false;
+     QString line;
+-    QDomDocument doc(QString::fromLatin1("AddPhoto Response"));
++    QDomDocument doc(QLatin1String("AddPhoto Response"));
+ 
+     if (!doc.setContent(data))
+     {
+@@ -1411,7 +950,7 @@ void FlickrTalker::parseResponseAddPhoto
+ 
+     while (!node.isNull())
+     {
+-        if (node.isElement() && node.nodeName() == QString::fromLatin1("photoid"))
++        if (node.isElement() && node.nodeName() == QLatin1String("photoid"))
+         {
+             e                = node.toElement();           // try to convert the node to an element.
+             QDomNode details = e.firstChild();
+@@ -1420,12 +959,12 @@ void FlickrTalker::parseResponseAddPhoto
+             success          = true;
+         }
+ 
+-        if (node.isElement() && node.nodeName() == QString::fromLatin1("err"))
++        if (node.isElement() && node.nodeName() == QLatin1String("err"))
+         {
+             qCDebug(KIPIPLUGINS_LOG) << "Checking Error in response";
+-            QString code = node.toElement().attribute(QString::fromLatin1("code"));
++            QString code = node.toElement().attribute(QLatin1String("code"));
+             qCDebug(KIPIPLUGINS_LOG) << "Error code=" << code;
+-            qCDebug(KIPIPLUGINS_LOG) << "Msg=" << node.toElement().attribute(QString::fromLatin1("msg"));
++            qCDebug(KIPIPLUGINS_LOG) << "Msg=" << node.toElement().attribute(QLatin1String("msg"));
+             emit signalError(code);
+         }
+ 
+@@ -1440,23 +979,14 @@ void FlickrTalker::parseResponseAddPhoto
+     {
+         QString photoSetId = m_selectedPhotoSet.id;
+ 
+-        if (photoSetId == QString::fromLatin1("-1"))
++        if (photoSetId == QLatin1String("-1"))
+         {
+             qCDebug(KIPIPLUGINS_LOG) << "PhotoSet Id not set, not adding the photo to any photoset";
+             emit signalAddPhotoSucceeded();
+         }
+         else
+         {
+-            if (m_serviceName == QString::fromLatin1("Zooomr"))
+-            {
+-                // addPhotoToPhotoSet not supported by Zooomr (Zooomr only has
+-                // smart folder-type photosets); silently fail
+-                emit signalAddPhotoSucceeded();
+-            }
+-            else
+-            {
+-                addPhotoToPhotoSet(photoId, photoSetId);
+-            }
++            addPhotoToPhotoSet(photoId, photoSetId);
+         }
+     }
+ }
+@@ -1465,7 +995,7 @@ void FlickrTalker::parseResponsePhotoPro
+ {
+     bool         success = false;
+     QString      line;
+-    QDomDocument doc(QString::fromLatin1("Photos Properties"));
++    QDomDocument doc(QLatin1String("Photos Properties"));
+ 
+     if (!doc.setContent(data))
+     {
+@@ -1478,7 +1008,7 @@ void FlickrTalker::parseResponsePhotoPro
+ 
+     while (!node.isNull())
+     {
+-        if (node.isElement() && node.nodeName() == QString::fromLatin1("photoid"))
++        if (node.isElement() && node.nodeName() == QLatin1String("photoid"))
+         {
+             e                = node.toElement();                 // try to convert the node to an element.
+             QDomNode details = e.firstChild();
+@@ -1486,12 +1016,12 @@ void FlickrTalker::parseResponsePhotoPro
+             qCDebug(KIPIPLUGINS_LOG) << "Photoid=" << e.text();
+         }
+ 
+-        if (node.isElement() && node.nodeName() == QString::fromLatin1("err"))
++        if (node.isElement() && node.nodeName() == QLatin1String("err"))
+         {
+             qCDebug(KIPIPLUGINS_LOG) << "Checking Error in response";
+-            QString code = node.toElement().attribute(QString::fromLatin1("code"));
++            QString code = node.toElement().attribute(QLatin1String("code"));
+             qCDebug(KIPIPLUGINS_LOG) << "Error code=" << code;
+-            qCDebug(KIPIPLUGINS_LOG) << "Msg=" << node.toElement().attribute(QString::fromLatin1("msg"));
++            qCDebug(KIPIPLUGINS_LOG) << "Msg=" << node.toElement().attribute(QLatin1String("msg"));
+             emit signalError(code);
+         }
+ 
+Index: digikam-5.3.0/extra/kipi-plugins/flickr/flickrtalker.h
+===================================================================
+--- digikam-5.3.0.orig/extra/kipi-plugins/flickr/flickrtalker.h
++++ digikam-5.3.0/extra/kipi-plugins/flickr/flickrtalker.h
+@@ -42,6 +42,9 @@
+ // Local includes
+ 
+ #include "flickritem.h"
++#include "o1.h"
++#include "o0globals.h"
++#include "o1requestor.h"
+ 
+ class QProgressDialog;
+ 
+@@ -69,10 +72,6 @@ public:
+         FE_LISTPHOTOS,
+         FE_GETPHOTOPROPERTY,
+         FE_ADDPHOTO,
+-        FE_GETFROB,
+-        FE_CHECKTOKEN,
+-        FE_GETTOKEN,
+-        FE_GETAUTHORIZED,
+         FE_CREATEPHOTOSET,
+         FE_ADDPHOTOTOPHOTOSET,
+         FE_GETMAXSIZE
+@@ -83,13 +82,12 @@ public:
+     FlickrTalker(QWidget* const parent, const QString& serviceName);
+     ~FlickrTalker();
+ 
++    void    link();
++    void    unlink();
+     QString getUserName() const;
+     QString getUserId() const;
+     void    maxAllowedFileSize();
+     QString getMaxAllowedFileSize();
+-    void    getFrob();
+-    void    getToken();
+-    void    checkToken(const QString& token);
+     void    getPhotoProperty(const QString& method, const QStringList& argList);
+     void    cancel();
+ 
+@@ -123,8 +121,7 @@ Q_SIGNALS:
+     void signalListPhotoSetsFailed(QString& msg);
+     void signalAddPhotoFailed(const QString& msg);
+     void signalListPhotoSetsFailed(const QString& msg);
+-    void signalAuthenticate();
+-    void signalTokenObtained(const QString& token);
++    void signalLinkingSucceeded();
+ 
+ private:
+ 
+@@ -134,36 +131,32 @@ private:
+     void parseResponseListPhotos(const QByteArray& data);
+     void parseResponseCreateAlbum(const QByteArray& data);
+     void parseResponseAddPhoto(const QByteArray& data);
+-    void parseResponseGetFrob(const QByteArray& data);
+-    void parseResponseGetToken(const QByteArray& data);
+-    void parseResponseCheckToken(const QByteArray& data);
+     void parseResponsePhotoProperty(const QByteArray& data);
+     void parseResponseCreatePhotoSet(const QByteArray& data);
+     void parseResponseAddPhotoToPhotoSet(const QByteArray& data);
+ 
+-    QString getApiSig(const QString& secret, const QUrl& url);
+-
+ private Q_SLOTS:
+ 
++    void slotLinkingFailed();
++    void slotLinkingSucceeded();
++    void slotOpenBrowser(const QUrl& url); 
+     void slotError(const QString& msg);
+-    void slotAuthenticate();
+     void slotFinished(QNetworkReply* reply);
+ 
+ private:
+ 
+     QWidget*               m_parent;
+-//  QString                m_cookie;
+     QByteArray             m_buffer;
+ 
+     QString                m_serviceName;
+     QString                m_apiUrl;
+     QString                m_authUrl;
++    QString                m_tokenUrl;
++    QString                m_accessUrl;
+     QString                m_uploadUrl;
+     QString                m_apikey;
+     QString                m_secret;
+-    QString                m_frob;
+     QString                m_maxSize;
+-    QString                m_token;
+     QString                m_username;
+     QString                m_userId;
+     QString                m_lastTmpFile;
+@@ -174,6 +167,9 @@ private:
+     State                  m_state;
+ 
+     Interface*             m_iface;
++
++    O1*                    m_o1;
++    O1Requestor*           m_requestor;
+ };
+ 
+ } // namespace KIPIFlickrPlugin
+Index: digikam-5.3.0/extra/kipi-plugins/flickr/flickrwidget.cpp
+===================================================================
+--- digikam-5.3.0.orig/extra/kipi-plugins/flickr/flickrwidget.cpp
++++ digikam-5.3.0/extra/kipi-plugins/flickr/flickrwidget.cpp
+@@ -61,7 +61,8 @@ FlickrWidget::FlickrWidget(QWidget* cons
+     //Adding Remove Account button
+     m_removeAccount              = new QPushButton(getAccountBox());
+     m_removeAccount->setText(i18n("Remove Account"));
+-    getAccountBoxLayout()->addWidget(m_removeAccount, 2,0,1,4);
++    m_removeAccount->hide();
++    getAccountBoxLayout()->addWidget(m_removeAccount, 2, 0, 1, 4);
+ 
+     // -- The image list --------------------------------------------------
+ 
+Index: digikam-5.3.0/extra/kipi-plugins/flickr/flickrwindow.cpp
+===================================================================
+--- digikam-5.3.0.orig/extra/kipi-plugins/flickr/flickrwindow.cpp
++++ digikam-5.3.0/extra/kipi-plugins/flickr/flickrwindow.cpp
+@@ -77,10 +77,6 @@ FlickrWindow::FlickrWindow(QWidget* cons
+     {
+         setWindowIcon(QIcon::fromTheme(QString::fromLatin1("kipi-hq")));
+     }
+-    else if (serviceName == QLatin1String("Zooomr"))
+-    {
+-        setWindowIcon(QIcon::fromTheme(QString::fromLatin1("kipi-zooomr")));
+-    }
+     else
+     {
+         setWindowIcon(QIcon::fromTheme(QString::fromLatin1("kipi-flickr")));
+@@ -136,9 +132,9 @@ FlickrWindow::FlickrWindow(QWidget* cons
+     // --------------------------------------------------------------------------
+     // About data and help button.
+ 
+-    KPAboutData* const about = new KPAboutData(ki18n("Flickr/23/Zooomr Export"),
++    KPAboutData* const about = new KPAboutData(ki18n("Flickr/23 Export"),
+                                                ki18n("A tool to export an image collection to a "
+-                                                     "Flickr / 23 / Zooomr web service."),
++                                                     "Flickr / 23 web service."),
+                                                ki18n("(c) 2005-2008, Vardhman Jain\n"
+                                                      "(c) 2008-2015, Gilles Caulier\n"
+                                                      "(c) 2009, Luka Renko\n"
+@@ -181,8 +177,8 @@ FlickrWindow::FlickrWindow(QWidget* cons
+     connect(m_talker, SIGNAL(signalListPhotoSetsFailed(QString)),
+             this, SLOT(slotListPhotoSetsFailed(QString)));
+ 
+-    connect(m_talker, SIGNAL(signalTokenObtained(QString)),
+-            this, SLOT(slotTokenObtained(QString)));
++    connect(m_talker, SIGNAL(signalLinkingSucceeded()),
++            this, SLOT(slotLinkingSucceeded()));
+ 
+     connect(m_widget->progressBar(), SIGNAL(signalProgressCanceled()),
+             this, SLOT(slotAddPhotoCancelAndClose()));
+@@ -304,17 +300,8 @@ void FlickrWindow::slotAddPhotoCancelAnd
+ void FlickrWindow::reactivate()
+ {
+     m_userNameDisplayLabel->setText(QString());
+-    readSettings(m_select->getUname());
+-    qCDebug(KIPIPLUGINS_LOG) << "Calling auth methods";
+-
+-    if (m_token.length() < 1)
+-    {
+-        m_talker->getFrob();
+-    }
+-    else
+-    {
+-        m_talker->checkToken(m_token);
+-    }
++    //readSettings(m_select->getUname());
++    m_talker->link();
+ 
+     m_widget->m_imglst->loadImagesFromCurrentSelection();
+     show();
+@@ -323,10 +310,8 @@ void FlickrWindow::reactivate()
+ void FlickrWindow::readSettings(QString uname)
+ {
+     KConfig config(QString::fromLatin1("kipirc"));
+-    qCDebug(KIPIPLUGINS_LOG) << "Group name is : "<<QString::fromLatin1("%1%2Export Settings").arg(m_serviceName,uname);
+-    KConfigGroup grp = config.group(QString::fromLatin1("%1%2Export Settings").arg(m_serviceName,uname));
+-    m_token          = grp.readEntry("token");
+-    qCDebug(KIPIPLUGINS_LOG) << "Token is : "<<m_token;
++    qCDebug(KIPIPLUGINS_LOG) << "Group name is : "<<QString::fromLatin1("%1%2Export Settings").arg(m_serviceName, uname);
++    KConfigGroup grp = config.group(QString::fromLatin1("%1%2Export Settings").arg(m_serviceName, uname));
+     m_exportHostTagsCheckBox->setChecked(grp.readEntry("Export Host Tags",      false));
+     m_extendedTagsButton->setChecked(grp.readEntry("Show Extended Tag Options", false));
+     m_addExtraTagsCheckBox->setChecked(grp.readEntry("Add Extra Tags",          false));
+@@ -392,16 +377,14 @@ void FlickrWindow::writeSettings()
+     qCDebug(KIPIPLUGINS_LOG) << "Group name is : "<<QString::fromLatin1("%1%2Export Settings").arg(m_serviceName,m_username);
+ 
+     if (QString::compare(QString::fromLatin1("%1Export Settings").arg(m_serviceName),
+-        QString::fromLatin1("%1%2Export Settings").arg(m_serviceName,m_username), Qt::CaseInsensitive) == 0)
++        QString::fromLatin1("%1%2Export Settings").arg(m_serviceName, m_username), Qt::CaseInsensitive) == 0)
+     {
+         qCDebug(KIPIPLUGINS_LOG) << "Not writing entry of group " << QString::fromLatin1("%1%2Export Settings").arg(m_serviceName,m_username);
+         return;
+     }
+ 
+-    KConfigGroup grp = config.group(QString::fromLatin1("%1%2Export Settings").arg(m_serviceName,m_username));
+-    grp.writeEntry("username",m_username);
+-    qCDebug(KIPIPLUGINS_LOG) << "Token written of group "<<QString::fromLatin1("%1%2Export Settings").arg(m_serviceName,m_username)<<" is "<<m_token;
+-    grp.writeEntry("token", m_token);
++    KConfigGroup grp = config.group(QString::fromLatin1("%1%2Export Settings").arg(m_serviceName, m_username));
++    grp.writeEntry("username",                          m_username);
+     grp.writeEntry("Export Host Tags",                  m_exportHostTagsCheckBox->isChecked());
+     grp.writeEntry("Show Extended Tag Options",         m_extendedTagsButton->isChecked());
+     grp.writeEntry("Add Extra Tags",                    m_addExtraTagsCheckBox->isChecked());
+@@ -427,39 +410,31 @@ void FlickrWindow::slotDoLogin()
+ {
+ }
+ 
+-void FlickrWindow::slotTokenObtained(const QString& token)
++void FlickrWindow::slotLinkingSucceeded()
+ {
+-    qCDebug(KIPIPLUGINS_LOG) << "Token Obtained is : "<<token;
+     m_username = m_talker->getUserName();
+     m_userId   = m_talker->getUserId();
+-    qCDebug(KIPIPLUGINS_LOG) << "SlotTokenObtained invoked setting user Display name to " << m_username;
++    qCDebug(KIPIPLUGINS_LOG) << "SlotLinkingSucceeded invoked setting user Display name to " << m_username;
+     m_userNameDisplayLabel->setText(QString::fromLatin1("<b>%1</b>").arg(m_username));
+ 
+     KConfig config(QString::fromLatin1("kipirc"));
+ 
+-    foreach ( const QString& group, config.groupList() )
++    foreach (const QString& group, config.groupList())
+     {
+-        if(!(group.contains(m_serviceName)))
++        if (!(group.contains(m_serviceName)))
+             continue;
+ 
+         KConfigGroup grp = config.group(group);
+ 
+-        if(group.contains(m_username))
++        if (group.contains(m_username))
+         {
+             readSettings(m_username);
+             break;
+         }
+     }
+ 
+-    m_token    = token;
+     writeSettings();
+-
+-    // Mutable photosets are not supported by Zooomr (Zooomr only has smart
+-    // folder-type photosets).
+-    if (m_serviceName != QString::fromLatin1("Zooomr"))
+-    {
+-        m_talker->listPhotoSets();
+-    }
++    m_talker->listPhotoSets();
+ }
+ 
+ void FlickrWindow::slotBusy(bool val)
+@@ -488,18 +463,11 @@ void FlickrWindow::slotUserChangeRequest
+ {
+     writeSettings();
+     qCDebug(KIPIPLUGINS_LOG) << "Slot Change User Request ";
+-    m_select->reactivate();
+-    readSettings(m_select->getUname());
+-    if (m_token.length() < 1)
+-    {
+-        m_talker->getFrob();
+-    }
+-    else
+-    {
+-        m_talker->checkToken(m_token);
+-    }
+-    //m_talker->getFrob();
+-    //  m_addPhotoButton->setEnabled(m_selectImagesButton->isChecked());
++    //m_select->reactivate();
++    //readSettings(m_select->getUname());
++
++     m_talker->unlink();
++     m_talker->link();
+ }
+ 
+ void FlickrWindow::slotRemoveAccount()
+@@ -507,7 +475,7 @@ void FlickrWindow::slotRemoveAccount()
+     KConfig config(QString::fromLatin1("kipirc"));
+     KConfigGroup grp = config.group(QString::fromLatin1("%1%2Export Settings").arg(m_serviceName).arg(m_username));
+ 
+-    if(grp.exists())
++    if (grp.exists())
+     {
+         qCDebug(KIPIPLUGINS_LOG) << "Removing Account having group"<<QString::fromLatin1("%1%2Export Settings").arg(m_serviceName);
+         grp.deleteGroup();
+@@ -545,8 +513,8 @@ QString FlickrWindow::guessSensibleSetNa
+     int totalCount = 0;
+     QString name;
+ 
+-    for(QMap<QString,int>::const_iterator it=nrFolderOccurences.constBegin();
+-        it!=nrFolderOccurences.constEnd(); ++it)
++    for (QMap<QString,int>::const_iterator it=nrFolderOccurences.constBegin();
++         it!=nrFolderOccurences.constEnd(); ++it)
+     {
+         totalCount += it.value();
+ 
+@@ -788,30 +756,25 @@ void FlickrWindow::slotAddPhotoNext()
+     Pair pathComments = m_uploadQueue.first();
+     FPhotoInfo info   = pathComments.second;
+ 
+-    // Find out the selected photo set.
+-    if (m_serviceName != QString::fromLatin1("Zooomr"))
++    QString selectedPhotoSetId = m_albumsListComboBox->itemData(m_albumsListComboBox->currentIndex()).toString();
++
++    if (selectedPhotoSetId.isEmpty())
++    {
++        m_talker->m_selectedPhotoSet = FPhotoSet();
++    }
++    else
+     {
+-        // mutable photosets are not supported by Zooomr (Zooomr only has smart folder-type photosets)
+-        QString selectedPhotoSetId = m_albumsListComboBox->itemData(m_albumsListComboBox->currentIndex()).toString();
++        QLinkedList<FPhotoSet>::iterator it = m_talker->m_photoSetsList->begin();
+ 
+-        if (selectedPhotoSetId.isEmpty())
+-        {
+-            m_talker->m_selectedPhotoSet = FPhotoSet();
+-        }
+-        else
++        while (it != m_talker->m_photoSetsList->end())
+         {
+-            QLinkedList<FPhotoSet>::iterator it = m_talker->m_photoSetsList->begin();
+-
+-            while (it != m_talker->m_photoSetsList->end())
++            if (it->id == selectedPhotoSetId)
+             {
+-                if (it->id == selectedPhotoSetId)
+-                {
+-                    m_talker->m_selectedPhotoSet = *it;
+-                    break;
+-                }
+-
+-                ++it;
++                m_talker->m_selectedPhotoSet = *it;
++                break;
+             }
++
++            ++it;
+         }
+     }
+ 
+Index: digikam-5.3.0/extra/kipi-plugins/flickr/flickrwindow.h
+===================================================================
+--- digikam-5.3.0.orig/extra/kipi-plugins/flickr/flickrwindow.h
++++ digikam-5.3.0/extra/kipi-plugins/flickr/flickrwindow.h
+@@ -95,7 +95,7 @@ public:
+ 
+ private Q_SLOTS:
+ 
+-    void slotTokenObtained(const QString& token);
++    void slotLinkingSucceeded();
+     void slotDoLogin();
+     void slotBusy(bool val);
+     void slotError(const QString& msg);
+@@ -165,7 +165,6 @@ private:
+ 
+ //  QHash<int, GAlbumViewItem>             m_albumDict;
+ 
+-    QString                                m_token;
+     QString                                m_username;
+     QString                                m_userId;
+     QString                                m_lastSelectedAlbum;
+Index: digikam-5.3.0/extra/kipi-plugins/flickr/plugin_flickr.cpp
+===================================================================
+--- digikam-5.3.0.orig/extra/kipi-plugins/flickr/plugin_flickr.cpp
++++ digikam-5.3.0/extra/kipi-plugins/flickr/plugin_flickr.cpp
+@@ -59,33 +59,27 @@ Plugin_Flickr::Plugin_Flickr(QObject* co
+ 
+     m_actionFlickr = 0;
+     m_action23     = 0;
+-    m_actionZooomr = 0;
+ 
+     m_dlgFlickr    = 0;
+     m_dlg23        = 0;
+-    m_dlgZooomr    = 0;
+ 
+     selectFlickr   = 0;
+     select23       = 0;
+-    selectZoomr    = 0;
+ }
+ 
+ Plugin_Flickr::~Plugin_Flickr()
+ {
+     delete m_dlgFlickr;
+     delete m_dlg23;
+-    delete m_dlgZooomr;
+ 
+     delete selectFlickr;
+     delete select23;
+-    delete selectZoomr;
+ }
+ 
+ void Plugin_Flickr::setup(QWidget* const widget)
+ {
+     m_dlgFlickr = 0;
+     m_dlg23     = 0;
+-    m_dlgZooomr = 0;
+ 
+     Plugin::setup(widget);
+ 
+@@ -107,13 +101,13 @@ void Plugin_Flickr::setupActions()
+     m_actionFlickr->setIcon(QIcon::fromTheme(QString::fromLatin1("kipi-flickr")));
+     actionCollection()->setDefaultShortcut(m_actionFlickr, Qt::ALT + Qt::SHIFT + Qt::Key_R);
+ 
+-    selectFlickr = new SelectUserDlg(0,QString::fromLatin1("Flickr"));
++    //selectFlickr = new SelectUserDlg(0,QString::fromLatin1("Flickr"));
+ 
+     connect(m_actionFlickr, SIGNAL(triggered(bool)),
+             this, SLOT(slotActivateFlickr()));
+ 
+     addAction(QString::fromLatin1("flickrexport"), m_actionFlickr);
+-
++/*
+     m_action23 = new QAction(this);
+     m_action23->setText(i18n("Export to &23..."));
+     m_action23->setIcon(QIcon::fromTheme(QString::fromLatin1("kipi-hq")));
+@@ -125,23 +119,12 @@ void Plugin_Flickr::setupActions()
+             this, SLOT(slotActivate23()));
+ 
+     addAction(QString::fromLatin1("23export"), m_action23);
+-
+-    m_actionZooomr = new QAction(this);
+-    m_actionZooomr->setText(i18n("Export to &Zooomr..."));
+-    m_actionZooomr->setIcon(QIcon::fromTheme(QString::fromLatin1("kipi-zooomr")));
+-    actionCollection()->setDefaultShortcut(m_actionZooomr, Qt::ALT + Qt::SHIFT + Qt::Key_Z);
+-
+-    selectZoomr = new SelectUserDlg(0,QString::fromLatin1("Zooomr"));
+-
+-    connect(m_actionZooomr, SIGNAL(triggered(bool)),
+-            this, SLOT(slotActivateZooomr()));
+-
+-    addAction(QString::fromLatin1("Zooomrexport"), m_actionZooomr);
++*/
+ }
+ 
+ void Plugin_Flickr::slotActivateFlickr()
+ {
+-    selectFlickr->reactivate();
++    //selectFlickr->reactivate();
+ 
+     if (!m_dlgFlickr)
+     {
+@@ -183,28 +166,6 @@ void Plugin_Flickr::slotActivate23()
+     m_dlg23->reactivate();
+ }
+ 
+-void Plugin_Flickr::slotActivateZooomr()
+-{
+-    selectZoomr->reactivate();
+-
+-    if (!m_dlgZooomr)
+-    {
+-        // We clean it up in the close button
+-        m_dlgZooomr = new FlickrWindow(QApplication::activeWindow(), QString::fromLatin1("Zooomr"), selectZoomr);
+-    }
+-    else
+-    {
+-        if (m_dlgZooomr->isMinimized())
+-        {
+-            KWindowSystem::unminimizeWindow(m_dlgZooomr->winId());
+-        }
+-
+-        KWindowSystem::activateWindow(m_dlgZooomr->winId());
+-    }
+-
+-    m_dlgZooomr->reactivate();
+-}
+-
+ } // namespace KIPIFlickrPlugin
+ 
+ #include "plugin_flickr.moc"
+Index: digikam-5.3.0/extra/kipi-plugins/flickr/plugin_flickr.h
+===================================================================
+--- digikam-5.3.0.orig/extra/kipi-plugins/flickr/plugin_flickr.h
++++ digikam-5.3.0/extra/kipi-plugins/flickr/plugin_flickr.h
+@@ -56,7 +56,6 @@ public Q_SLOTS:
+ 
+     void slotActivateFlickr();
+     void slotActivate23();
+-    void slotActivateZooomr();
+ 
+ private:
+ 
+@@ -66,15 +65,12 @@ private:
+ 
+     QAction*       m_actionFlickr;
+     QAction*       m_action23;
+-    QAction*       m_actionZooomr;
+ 
+     FlickrWindow*  m_dlgFlickr;
+     FlickrWindow*  m_dlg23;
+-    FlickrWindow*  m_dlgZooomr;
+ 
+     SelectUserDlg* selectFlickr;
+     SelectUserDlg* select23;
+-    SelectUserDlg* selectZoomr;
+ };
+ 
+ } //namespace KIPIFlickrPlugin
diff -durN orig/digikam-5.3.0/debian/patches/series digikam-5.3.0/debian/patches/series
--- orig/digikam-5.3.0/debian/patches/series	2016-11-12 13:44:51.000000000 -0600
+++ digikam-5.3.0/debian/patches/series	2017-09-07 10:04:33.536315494 -0500
@@ -1 +1,2 @@
 cmake-disable-jasper.patch
+flickr.diff
diff -durN orig/digikam-5.3.0/.pc/applied-patches digikam-5.3.0/.pc/applied-patches
--- orig/digikam-5.3.0/.pc/applied-patches	2017-09-07 11:42:00.136160191 -0500
+++ digikam-5.3.0/.pc/applied-patches	1969-12-31 18:00:00.000000000 -0600
@@ -1 +0,0 @@
-cmake-disable-jasper.patch
diff -durN orig/digikam-5.3.0/.pc/cmake-disable-jasper.patch/core/CMakeLists.txt digikam-5.3.0/.pc/cmake-disable-jasper.patch/core/CMakeLists.txt
--- orig/digikam-5.3.0/.pc/cmake-disable-jasper.patch/core/CMakeLists.txt	2016-11-06 04:43:00.000000000 -0600
+++ digikam-5.3.0/.pc/cmake-disable-jasper.patch/core/CMakeLists.txt	1969-12-31 18:00:00.000000000 -0600
@@ -1,604 +0,0 @@
-#
-# Copyright (c) 2010-2016 by Gilles Caulier, <caulier dot gilles at gmail dot com>
-# Copyright (c) 2015      by Veaceslav Munteanu, <veaceslav dot munteanu90 at gmail dot com>
-# Copyright (c) 2015      by Mohamed Anwer, <m dot anwer at gmx dot com>
-#
-# Redistribution and use is allowed according to the terms of the BSD license.
-# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
-
-project(digikam)
-
-message(STATUS "----------------------------------------------------------------------------------")
-message(STATUS "Starting CMake configuration for: ${PROJECT_NAME}")
-
-# ==================================================================================================
-# Information to update before to release this package.
-
-# digiKam version
-set(DIGIKAM_MAJOR_VERSION "5")
-set(DIGIKAM_MINOR_VERSION "3")
-set(DIGIKAM_PATCH_VERSION "0")
-
-#digiKam release date
-set(DIGIKAM_RELEASE_DATE "2016-11-06")
-
-# Suffix to add at end of version string. Usual values are:
-# "-git"   : alpha code unstable from git. Do not use in production
-# "-beta1" : beta1 release.
-# "-beta2" : beta2 release.
-# "-beta3" : beta3 release.
-# "-rc"    : release candidate.
-# ""       : final release. Can be used in production.
-set(DIGIKAM_SUFFIX_VERSION "")
-
-# ==================================================================================================
-# Set env. variables accordingly.
-
-# NOTE: This string is used to set libdigikamcore and libdigikamdatabase SO version ID
-set(DIGIKAM_VERSION_SHORT
-    "${DIGIKAM_MAJOR_VERSION}.${DIGIKAM_MINOR_VERSION}.${DIGIKAM_PATCH_VERSION}"
-)
-
-set(DIGIKAM_VERSION_STRING
-    "${DIGIKAM_VERSION_SHORT}${DIGIKAM_SUFFIX_VERSION}"
-)
-
-# Core Database XML version
-# We must set this variable here at top level because it is used in both libs/database/core and data/database
-# Version history:
-# 1 : Original database XML file, published in production.
-# 2 : 08-08-2014 : Fix Images.names field size (see bug #327646).
-# 3 : 05/11/2015 : Add Face DB schema.
-set(DBCORECONFIG_XML_VERSION "3")
-
-# =======================================================
-
-set(CMAKE_MIN_VERSION    "3.0.0")
-set(ECM_MIN_VERSION      "1.7.0")
-set(KF5_MIN_VERSION      "5.1.0")
-set(QT_MIN_VERSION       "5.2.0")
-set(KIPI_MIN_VERSION     "5.0.0")
-set(KSANE_MIN_VERSION    "5.0.0")
-set(LENSFUN_MIN_VERSION  "0.2.6.0")
-set(EXIV2_MIN_VERSION    "0.25")
-set(AKONADI_MIN_VERSION  "4.89.0")        # Akonadi Contact dependency
-set(CALENDAR_MIN_VERSION "4.81.0")        # Calendar Core dependency
-
-cmake_minimum_required(VERSION ${CMAKE_MIN_VERSION})
-
-############## ECM setup ######################
-
-find_package(ECM ${ECM_MIN_VERSION} CONFIG REQUIRED)
-set(CMAKE_MODULE_PATH ${digikam_SOURCE_DIR}/cmake/modules ${ECM_MODULE_PATH})
-
-# Cmake macros
-include(GenerateExportHeader)
-include(CheckFunctionExists)
-include(FeatureSummary)
-# ECM macros
-include(ECMOptionalAddSubdirectory)
-include(ECMAddTests)
-include(ECMMarkNonGuiExecutable)
-include(ECMGenerateHeaders)
-include(ECMGeneratePriFile)
-include(ECMPackageConfigHelpers)
-include(ECMSetupVersion)
-include(ECMInstallIcons)
-include(ECMAddAppIcon)
-include(ECMPoQmTools)
-# KDE macros
-include(KDEInstallDirs)
-include(KDECMakeSettings)
-include(KDEFrameworkCompilerSettings)
-include(KDECompilerSettings)
-# Local macros
-include(MacroUtils)
-include(MacroLocalLibs)
-include(MacroOpenCV)
-include(MacroJPEG)
-include(MacroBoolTo01)
-
-# ==================================================================================================
-
-option(ENABLE_OPENCV3               "Build digiKam with OpenCV3 instead OpenCV2 (default=OFF)"                           OFF)
-option(ENABLE_KFILEMETADATASUPPORT  "Build digiKam with KDE files indexer support (default=OFF)"                         OFF)
-option(ENABLE_AKONADICONTACTSUPPORT "Build digiKam with KDE Mail Contacts support (default=OFF)"                         OFF)
-option(ENABLE_MEDIAPLAYER           "Build digiKam with QtMultimedia support (default=OFF)"                              OFF)
-option(ENABLE_DBUS                  "Build digiKam with DBUS support (default=ON)"                                       ON)
-option(ENABLE_APPSTYLES             "Build digiKam with support for changing the widget application style (default=OFF)" OFF)
-
-# Mysql support options (experimental):
-option(ENABLE_MYSQLSUPPORT          "Build digiKam with MySQL dabatase support (default=OFF)"                            OFF)
-option(ENABLE_INTERNALMYSQL         "Build digiKam with internal MySQL server executable (default=OFF)"                  OFF)
-
-
-# Debug options:
-option(ENABLE_DIGIKAM_MODELTEST     "Enable ModelTest on some models for debugging (default=OFF)"                        OFF)
-
-############## Find Packages ###################
-
-find_package(Qt5 ${QT_MIN_VERSION}
-             REQUIRED NO_MODULE COMPONENTS
-             Core
-             Concurrent
-             Widgets
-             Gui
-             Sql
-             Xml
-             PrintSupport
-             WebKitWidgets
-             Network
-)
-
-find_package(Qt5 ${QT_MIN_VERSION}
-             OPTIONAL_COMPONENTS
-             Multimedia
-             MultimediaWidgets
-             DBus
-             OpenGL
-)
-
-if(ENABLE_MEDIAPLAYER)
-    if(NOT Qt5Multimedia_FOUND OR NOT Qt5MultimediaWidgets_FOUND)
-        set(ENABLE_MEDIAPLAYER OFF)
-    endif()
-endif()
-
-if(ENABLE_DBUS)
-    if(NOT Qt5DBus_FOUND)
-        set(ENABLE_DBUS OFF)
-    endif()
-endif()
-
-if(BUILD_TESTING)
-    find_package(Qt5 ${QT_MIN_VERSION} REQUIRED NO_MODULE COMPONENTS
-                 Test)
-endif()
-
-find_package(KF5 ${KF5_MIN_VERSION}
-             REQUIRED COMPONENTS
-             XmlGui
-             CoreAddons
-             Config
-             Service
-             WindowSystem
-             Solid
-             I18n
-)
-
-find_package(KF5 ${KF5_MIN_VERSION}
-             OPTIONAL_COMPONENTS
-             KIO                    # For Desktop integration (Widgets only).
-             IconThemes             # For Desktop integration.
-             Bookmarks              # For geolocation editor.
-             FileMetaData           # For KDE file indexer support.
-             ThreadWeaver           # For Panorama tool.
-             NotifyConfig           # KDE desktop application notify configuration.
-             Notifications          # KDE desktop notifications integration.
-)
-
-find_package(KF5 ${AKONADI_MIN_VERSION}
-             OPTIONAL_COMPONENTS
-             AkonadiContact         # For KDE Mail Contacts support.
-)
-
-find_package(KF5 ${CALENDAR_MIN_VERSION}
-             OPTIONAL_COMPONENTS
-             CalendarCore           # For Calendar tool.
-)
-
-if(ENABLE_AKONADICONTACTSUPPORT AND NOT KF5AkonadiContact_FOUND)
-    set(ENABLE_KFILEMETADATASUPPORT OFF)
-endif()
-
-if(ENABLE_KFILEMETADATASUPPORT AND NOT KF5FileMetaData_FOUND)
-    set(ENABLE_KFILEMETADATASUPPORT OFF)
-endif()
-
-# Check if KIO have been compiled with KIOWidgets. digiKam only needs this one.
-if(KF5KIO_FOUND)
-    get_target_property(KIOWidgets_INCLUDE_DIRS KF5::KIOWidgets INTERFACE_INCLUDE_DIRECTORIES)
-    message(STATUS "KF5::KIOWidgets include dirs: ${KIOWidgets_INCLUDE_DIRS}")
-
-    if(NOT KIOWidgets_INCLUDE_DIRS)
-        message(STATUS "KF5::KIOWidgets not available in shared KIO library. KIO support disabled.")
-        set(KF5KIO_FOUND FALSE)
-    endif()
-endif()
-
-# ==================================================================================================
-# Dependencies Rules
-
-# mandatory
-
-DETECT_JPEG()
-set(DIGIKAM_LIBJPEG_DIR libjpeg-${JPEG_LIB_VERSION})
-
-find_package(TIFF                       REQUIRED)
-find_package(PNG                        REQUIRED)
-find_package(Boost                      REQUIRED)
-find_package(LCMS2                      REQUIRED)
-find_package(EXPAT                      REQUIRED)  # For DNGWriter: XMP SDK need Expat library to compile.
-find_package(Threads                    REQUIRED)  # For DNGWriter and LibRaw which needs native threads support.
-find_package(Exiv2 ${EXIV2_MIN_VERSION} REQUIRED)
-
-set_package_properties("Exiv2"     PROPERTIES
-                       DESCRIPTION "Required to build digiKam"
-                       URL         "http://www.exiv2.org"
-                       TYPE        RECOMMENDED
-                       PURPOSE     "Library to manage image metadata"
-)
-
-# -- check OpenCV --------------------------------------------------------------------------------
-
-if(ENABLE_OPENCV3)
-
-    set(OPENCV_MIN_VERSION "3.1.0")
-    DETECT_OPENCV(${OPENCV_MIN_VERSION} core highgui objdetect imgproc)
-
-    if(${OpenCV_FOUND})
-        if(${OpenCV_VERSION} VERSION_LESS 3.1.0)
-            message(STATUS "ENABLE_OPENCV3 option is enabled and OpenCV < 3.1.0 have been found. Disabled ENABLE_OPENCV3")
-            set(OpenCV_FOUND FALSE)
-        endif()
-    endif()
-
-else()
-
-    set(OPENCV_MIN_VERSION "2.4.9")
-    DETECT_OPENCV(${OPENCV_MIN_VERSION} core highgui objdetect contrib legacy imgproc)
-
-    if(${OpenCV_FOUND})
-        if(${OpenCV_VERSION} VERSION_GREATER 2.4.99)
-            message(STATUS "ENABLE_OPENCV3 option is disabled and OpenCV >= 3.0.0 have been found. Enabled ENABLE_OPENCV3")
-            set(OpenCV_FOUND FALSE)
-        endif()
-    endif()
-
-endif()
-
-configure_file(${CMAKE_CURRENT_SOURCE_DIR}/app/utils/libopencv.h.cmake.in ${CMAKE_CURRENT_BINARY_DIR}/app/utils/libopencv.h)
-
-# -- optionals ----------------------------------------------------------------------------------
-
-find_package(FLEX)                                 # For Panorama tool.
-find_package(BISON)                                # For Panorama tool.
-
-DETECT_LIBKIPI(${KIPI_MIN_VERSION})
-DETECT_LIBKSANE(${KSANE_MIN_VERSION})
-
-find_package(Marble)
-
-find_package(PkgConfig)
-find_package(Jasper)
-find_package(Eigen3)                               # For Refocus tool.
-find_package(OpenGL)                               # For Presentation tool.
-
-# For Monitor Profiles management with LCMS
-find_package(X11)
-
-if(X11_FOUND)
-    find_package(Qt5 ${QT_MIN_VERSION} REQUIRED NO_MODULE COMPONENTS
-                 X11Extras
-    )
-    set(HAVE_X11 TRUE)
-else()
-    set(HAVE_X11 FALSE)
-endif()
-
-# decide if Presentation tool can be built with OpenGL
-if(OPENGL_FOUND AND OPENGL_GLU_FOUND AND Qt5OpenGL_FOUND)
-    set(HAVE_OPENGL TRUE)
-elseif()
-    set(HAVE_OPENGL FALSE)
-endif()
-
-# For LibRaw
-if(WIN32)
-    find_library(WSOCK32_LIBRARY wsock32)
-    find_library(WS2_32_LIBRARY ws2_32)
-endif()
-
-# -- To link under Solaris (see bug #274484) ------------------------------------------------------
-
-if(NOT WIN32)
-    find_library(MATH_LIBRARY m)
-endif()
-
-if(CMAKE_SYSTEM_NAME STREQUAL FreeBSD)
-    find_library(KVM_LIBRARY kvm)
-endif()
-
-# ==================================================================================================
-# More Optional Dependencies
-
-find_package(Doxygen)
-find_package(Lqr-1)
-
-# -- libgphoto2 rules --------------------------------------------------------------------------
-
-if(NOT WIN32)
-
-    find_package(Gphoto2)
-
-    if(GPHOTO2_FOUND)
-
-        if("${GPHOTO2_VERSION_STRING}" VERSION_GREATER "2.4.0")
-            set(VERSION_GPHOTO2 true)
-        else()
-            set(VERSION_GPHOTO2 false)
-        endif()
-
-        if("${GPHOTO2_VERSION_STRING}" VERSION_GREATER "2.5.0")
-            set(VERSION_GPHOTO25 true)
-            message(STATUS "libgphoto2 API version >= 2.5")
-        else()
-            set(VERSION_GPHOTO25 false)
-            message(STATUS "libgphoto2 API version < 2.5")
-        endif()
-
-        if(VERSION_GPHOTO25)
-            set(HAVE_GPHOTO25 1)
-        else()
-            set(HAVE_GPHOTO25 0)
-        endif()
-
-    endif()
-
-endif()
-
-# -- Check LensFun library for Lens auto-correction tool --------------------------------------
-
-find_package(LensFun)
-
-if(LENSFUN_VERSION)
-    message(STATUS "liblensfun: Found version ${LENSFUN_VERSION} (required: ${LENSFUN_MIN_VERSION})")
-    if(${LENSFUN_VERSION} VERSION_LESS ${LENSFUN_MIN_VERSION})
-        set(LENSFUN_FOUND FALSE)
-    endif()
-else()
-    message(STATUS "liblensfun: Version information not found, your version is probably too old.")
-    set(LENSFUN_FOUND FALSE)
-endif()
-
-# -- Check dependencies for Panorama tool -------------------------------------
-
-if(FLEX_FOUND AND BISON_FOUND AND KF5ThreadWeaver_FOUND)
-    set(HAVE_PANORAMA 1)
-else()
-    set(HAVE_PANORAMA 0)
-endif()
-
-# -- compilation options definitions -----------------------------------------------------------
-
-MACRO_BOOL_TO_01(KF5Kipi_FOUND                                          HAVE_KIPI)
-MACRO_BOOL_TO_01(KF5Sane_FOUND                                          HAVE_KSANE)
-MACRO_BOOL_TO_01(KF5FileMetaData_FOUND                                  HAVE_KFILEMETADATA)
-MACRO_BOOL_TO_01(KF5AkonadiContact_FOUND                                HAVE_AKONADICONTACT)
-MACRO_BOOL_TO_01(KF5Bookmarks_FOUND                                     HAVE_KBOOKMARKS)
-MACRO_BOOL_TO_01(KF5CalendarCore_FOUND                                  HAVE_KCALENDAR)
-MACRO_BOOL_TO_01(KF5Notifications_FOUND                                 HAVE_KNOTIFICATIONS)
-MACRO_BOOL_TO_01(KF5NotifyConfig_FOUND                                  HAVE_KNOTIFYCONFIG)
-MACRO_BOOL_TO_01(KF5KIO_FOUND                                           HAVE_KIO)
-MACRO_BOOL_TO_01(KF5IconThemes_FOUND                                    HAVE_KICONTHEMES)
-MACRO_BOOL_TO_01(LENSFUN_FOUND                                          HAVE_LENSFUN)
-MACRO_BOOL_TO_01(LQR-1_FOUND                                            HAVE_LIBLQR_1)
-MACRO_BOOL_TO_01(GPHOTO2_FOUND                                          HAVE_GPHOTO2)
-MACRO_BOOL_TO_01(JASPER_FOUND                                           HAVE_JASPER)
-MACRO_BOOL_TO_01(EIGEN3_FOUND                                           HAVE_EIGEN3)
-MACRO_BOOL_TO_01(MARBLE_FOUND                                           HAVE_MARBLE)
-MACRO_BOOL_TO_01(ENABLE_MYSQLSUPPORT                                    HAVE_MYSQLSUPPORT)
-MACRO_BOOL_TO_01(ENABLE_INTERNALMYSQL                                   HAVE_INTERNALMYSQL)
-MACRO_BOOL_TO_01(ENABLE_MEDIAPLAYER                                     HAVE_MEDIAPLAYER)
-MACRO_BOOL_TO_01(ENABLE_DBUS                                            HAVE_DBUS)
-MACRO_BOOL_TO_01(ENABLE_APPSTYLES                                       HAVE_APPSTYLE_SUPPORT)
-
-# Whether to use Qt's scaling to downscale previews. Under MacOSX, Qt
-# can make use of the higher physical resolution of Retina
-# displays. However, it seems that other Qt renderers perform badly at
-# this, so disable. If other renderers switch to coarser logical
-# pixels, one probably needs this feature on these platforms as well.
-MACRO_BOOL_TO_01(APPLE                                                  USE_QT_SCALING)
-
-# Set config files accordingly with optional dependencies
-
-configure_file(app/utils/digikam_config.h.cmake.in ${CMAKE_CURRENT_BINARY_DIR}/app/utils/digikam_config.h)
-
-# ==================================================================================================
-# Log messages
-
-message(STATUS "")
-message(STATUS "----------------------------------------------------------------------------------")
-message(STATUS " digiKam ${DIGIKAM_VERSION_STRING} dependencies results   <http://www.digikam.org>")
-message(STATUS "")
-
-PRINT_COMPONENT_COMPILE_STATUS("MySQL Database Support"     ENABLE_MYSQLSUPPORT)
-PRINT_COMPONENT_COMPILE_STATUS("MySQL Internal Support"     ENABLE_INTERNALMYSQL)
-PRINT_COMPONENT_COMPILE_STATUS("DBUS Support"               ENABLE_DBUS)
-PRINT_COMPONENT_COMPILE_STATUS("Application Style Support"  ENABLE_APPSTYLES)
-
-
-# ================================================================
-
-PRINT_LIBRARY_STATUS("libqt"                  "http://www.qtsoftware.com"                                        "(version >= ${QT_MIN_VERSION})"     Qt5_FOUND)
-PRINT_LIBRARY_STATUS("libkde"                 "http://www.kde.org"                                               "(version >= ${KF5_MIN_VERSION})"    KF5_FOUND)
-PRINT_LIBRARY_STATUS("libjpeg"                "http://www.ijg.org"                                               "(version >= 6b)"                    JPEG_FOUND)
-PRINT_LIBRARY_STATUS("libtiff"                "http://www.remotesensing.org/libtiff"                             "(version >= 3.8.2)"                 TIFF_FOUND)
-PRINT_LIBRARY_STATUS("libpng"                 "http://www.libpng.org/pub/png/libpng.html"                        "(version >= 1.2.7)"                 PNG_FOUND)
-PRINT_LIBRARY_STATUS("liblcms"                "http://www.littlecms.com"                                         "(version >= 1.0.0)"                 LCMS2_FOUND)
-PRINT_LIBRARY_STATUS("libboostgraph"          "http://www.boost.org/doc/libs"                                    "(version >= 1.43.0)"                Boost_FOUND)
-PRINT_LIBRARY_STATUS("libopencv"              "http://opencv.willowgarage.com"                                   "(version >= ${OPENCV_MIN_VERSION})" OpenCV_FOUND)
-PRINT_LIBRARY_STATUS("libexpat"               "http://expat.sourceforge.net"                                     "(version >= 2.0.0)"                 EXPAT_FOUND)
-PRINT_LIBRARY_STATUS("libpthread"             "http://www.gnu.org/software/hurd/libpthread.html"                 "(version >= 2.0.0)"                 CMAKE_USE_PTHREADS_INIT OR CMAKE_USE_WIN32_THREADS_INIT)
-
-# ================================================================
-
-PRINT_OPTIONAL_LIBRARY_STATUS("libkipi"           "https://projects.kde.org/projects/kde/kdegraphics/libs/libkipi"  "(version >= ${KIPI_MIN_VERSION})"     "digiKam will be compiled without Kipi-plugins support."                      KF5Kipi_FOUND)
-PRINT_OPTIONAL_LIBRARY_STATUS("libmarble"         "https://projects.kde.org/projects/kde/kdeedu/marble"             "(version >= 0.22.0)"                  "digiKam will be compiled without geolocation maps support."                  MARBLE_FOUND)
-PRINT_OPTIONAL_LIBRARY_STATUS("libksane"          "https://projects.kde.org/projects/kde/kdegraphics/libs/libksane" "(version >= ${KSANE_MIN_VERSION})"    "digiKam will be compiled without libksane support."                          KF5Sane_FOUND)
-PRINT_OPTIONAL_LIBRARY_STATUS("libkfilemetadata"  "https://projects.kde.org/projects/kde/kdelibs/baloo"             "(version >= ${KF5_MIN_VERSION})"      "digiKam will be compiled without KDE file metadata support."                 KF5FileMetaData_FOUND)
-PRINT_OPTIONAL_LIBRARY_STATUS("libakonadicontact" "https://projects.kde.org/projects/kde/kdepimlibs"                "(version >= ${AKONADI_MIN_VERSION})"  "digiKam will be compiled without KDE address book support."                  KF5AkonadiContact_FOUND)
-PRINT_OPTIONAL_LIBRARY_STATUS("libkcalcore"       "https://projects.kde.org/projects/kde/pim/kcalcore"              "(version >= ${CALENDAR_MIN_VERSION})" "digiKam will be compiled without KDE calendar support."                      KF5CalendarCore_FOUND)
-PRINT_OPTIONAL_LIBRARY_STATUS("libthreadweaver"   "https://projects.kde.org/projects/frameworks/threadweaver"       "(version >= ${KF5_MIN_VERSION})"      "digiKam will be compiled without Panorama support."                          KF5ThreadWeaver_FOUND)
-PRINT_OPTIONAL_LIBRARY_STATUS("libkbookmarks"     "https://projects.kde.org/projects/frameworks/kbookmarks"         "(version >= ${KF5_MIN_VERSION})"      "digiKam will be compiled without KDE desktop bookmarks support."             KF5Bookmarks_FOUND)
-PRINT_OPTIONAL_LIBRARY_STATUS("libkiconthemes"    "https://projects.kde.org/projects/frameworks/kiconthemes"        "(version >= ${KF5_MIN_VERSION})"      "digiKam will be compiled without KDE desktop icon themes support."           KF5IconThemes_FOUND)
-PRINT_OPTIONAL_LIBRARY_STATUS("libknotifications" "https://projects.kde.org/projects/frameworks/knotifications"     "(version >= ${KF5_MIN_VERSION})"      "digiKam will be compiled without KDE desktop notifications support."         KF5Notifications_FOUND)
-PRINT_OPTIONAL_LIBRARY_STATUS("libknotifyconfig"  "https://projects.kde.org/projects/frameworks/knotifyconfig"      "(version >= ${KF5_MIN_VERSION})"      "digiKam will be compiled without KDE desktop notify configuration support."  KF5NotifyConfig_FOUND)
-PRINT_OPTIONAL_LIBRARY_STATUS("libkio"            "https://projects.kde.org/projects/frameworks/kio"                "(version >= ${KF5_MIN_VERSION})"      "digiKam will be compiled without KDE desktop integration support."           KF5KIO_FOUND)
-PRINT_OPTIONAL_LIBRARY_STATUS("flex"              "http://flex.sourceforge.net/"                                    "(version >= 2.5.0)"                   "digiKam will be compiled without Panorama support."                          FLEX_FOUND)
-PRINT_OPTIONAL_LIBRARY_STATUS("bison"             "https://www.gnu.org/software/bison/"                             "(version >= 2.5.0)"                   "digiKam will be compiled without Panorama support."                          BISON_FOUND)
-PRINT_OPTIONAL_LIBRARY_STATUS("libjasper"         "http://www.ece.uvic.ca/~mdadams/jasper"                          "(version >= 1.7.0)"                   "digiKam will be compiled without JPEG2000 support."                          JASPER_FOUND)
-PRINT_OPTIONAL_LIBRARY_STATUS("liblensfun"        "http://lensfun.sourceforge.net"                                  "(version >= 0.2.6)"                   "digiKam will be compiled without Lens Auto Correction tool support."         LENSFUN_FOUND)
-PRINT_OPTIONAL_LIBRARY_STATUS("liblqr-1"          "http://liblqr.wikidot.com"                                       "(version >= 0.4.1)"                   "digiKam will be compiled without Contents Aware Resizer tool support."       LQR-1_FOUND)
-PRINT_OPTIONAL_LIBRARY_STATUS("libeigen3"         "http://eigen.tuxfamily.org"                                      "(version >= 3.0.0)"                   "digiKam will be compiled without Refocus tool support."                      EIGEN3_FOUND)
-PRINT_OPTIONAL_LIBRARY_STATUS("libgphoto2"        "http://www.gphoto.org"                                           "(version >= 2.4.0)"                   "digiKam will be compiled without GPhoto2 camera drivers support."            GPHOTO2_FOUND)
-PRINT_OPTIONAL_LIBRARY_STATUS("doxygen"           "http://www.doxygen.org"                                          "(version >= 1.8.0)"                   "digiKam will be compiled without API documentation building support."        DOXYGEN_FOUND)
-PRINT_OPTIONAL_LIBRARY_STATUS("OpenGL"            "http://www.mesa3d.org"                                           "(version >= 11.0.0)"                  "digiKam will be compiled without OpneGL support."                            HAVE_OPENGL)
-
-if(ENABLE_MEDIAPLAYER)
-    PRINT_OPTIONAL_QTMODULE_STATUS("Qt5 Multimedia"        Qt5Multimedia_FOUND)
-    PRINT_OPTIONAL_QTMODULE_STATUS("Qt5 MultimediaWidgets" Qt5MultimediaWidgets_FOUND)
-endif()
-
-# ================================================================
-
-if(Qt5_FOUND       AND
-   KF5_FOUND       AND
-   JPEG_FOUND      AND
-   TIFF_FOUND      AND
-   PNG_FOUND       AND
-   LCMS2_FOUND     AND
-   Boost_FOUND     AND
-   EXIV2_FOUND     AND
-   OpenCV_FOUND    AND
-   EXPAT_FOUND     AND
-   (CMAKE_USE_PTHREADS_INIT OR CMAKE_USE_WIN32_THREADS_INIT)
-  )
-    message(STATUS " digiKam can be compiled.................. YES")
-    set(DIGIKAM_CAN_BE_COMPILED true)
-else()
-    message(FATAL_ERROR " digiKam will be compiled................. NO  (Look README file for more details about dependencies)")
-    set(DIGIKAM_CAN_BE_COMPILED false)
-endif()
-
-message(STATUS "----------------------------------------------------------------------------------")
-message(STATUS "")
-
-if(DIGIKAM_CAN_BE_COMPILED)
-
-    # ==================================================================================================
-    # Create git version header
-
-    # We only do this IF we are in a .git dir
-    find_file(GIT_MARKER entries PATHS ${CMAKE_SOURCE_DIR}/.git)
-
-    if(NOT GIT_MARKER)
-        set(GIT_MARKER ${CMAKE_SOURCE_DIR}/CMakeLists.txt)  # Dummy file
-    endif()
-
-    # Add a custom command to drive the git script whenever the git entries
-    # file changes.
-    configure_file("${CMAKE_CURRENT_SOURCE_DIR}/cmake/templates/gitscript.cmake.in"
-                   "${CMAKE_CURRENT_BINARY_DIR}/gitscript.cmake"
-                   @ONLY)
-
-    # Add a custom target to drive the custom command.
-    add_custom_target(digikam-gitversion ALL COMMAND ${CMAKE_COMMAND} -P "${CMAKE_CURRENT_BINARY_DIR}/gitscript.cmake")
-
-    # ==================================================================================================
-    # To prevent warnings from M$ compiler
-
-    if(WIN32 AND MSVC)
-        add_definitions(-D_CRT_SECURE_NO_WARNINGS)
-        add_definitions(-D_ATL_SECURE_NO_WARNINGS)
-        add_definitions(-D_AFX_SECURE_NO_WARNINGS)
-    endif()
-
-    # ==================================================================================================
-    # Definitions rules
-
-    # Remove pedantic GCC flag which generate a lots of warnings on the console with qCDebug()
-    while(CMAKE_CXX_FLAGS MATCHES "-pedantic")
-        string(REPLACE "-pedantic" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
-    endwhile()
-
-    # translations catalog
-    add_definitions(-DTRANSLATION_DOMAIN=\"digikam\")
-
-    # NOTE: with libpgf 6.11.24 OpenMP is not very well supported. We disable it to be safe.
-    # See B.K.O #273765 for details.
-    add_definitions(-DLIBPGF_DISABLE_OPENMP)
-
-    # To force to declare as exported classes in all sub components.
-    # This will only done near to library declaration in Cmake files.
-    if(WIN32)
-        add_definitions(-Ddigikamcore_EXPORTS)
-        add_definitions(-Ddigikamdatabase_EXPORTS)
-    endif()
-
-    # Enable C++ Exceptions support, require by Greycstoration algorithm (CImg.h) and PGF codec
-    kde_enable_exceptions()
-
-    # ==================================================================================================
-    # Includes rules
-
-    # Recursively get all directories which contain header files
-    set(DK_INCLUDES_ALL "")
-
-    HEADER_DIRECTORIES(DK_LOCAL_INCLUDES_RAW)
-
-    # This macro will set all paths which do not containt libjpeg-
-    # We will add later the directory we need
-
-    foreach(var ${DK_LOCAL_INCLUDES_RAW})
-        string(REGEX MATCH "libjpeg-" item ${var})
-        if(item STREQUAL "")
-            list(APPEND DK_LOCAL_INCLUDES ${var})
-        endif()
-    endforeach()
-
-    set(DK_LOCAL_INCLUDES ${DK_LOCAL_INCLUDES}
-                          libs/jpegutils/${DIGIKAM_LIBJPEG_DIR})
-
-    include_directories(${DK_LOCAL_INCLUDES})
-
-    # for config headers digikam_version.h gitversion.h digikam_config.h digikam_dbconfig.h libopencv.h
-    include_directories(${CMAKE_CURRENT_BINARY_DIR}/app/utils)
-
-    include_directories(${OpenCV_INCLUDE_DIRS})
-
-    # ==================================================================================================
-    # Common targets parts
-
-    set(CMAKE_POSITION_INDEPENDENT_CODE ON)
-    add_subdirectory(data)
-    add_subdirectory(libs)
-    add_subdirectory(utilities)
-    add_subdirectory(app)
-    add_subdirectory(showfoto)
-
-    if(BUILD_TESTING)
-        add_subdirectory(tests)
-    endif()
-
-    if(NOT WIN32)
-        configure_file(${CMAKE_CURRENT_SOURCE_DIR}/cmake/templates/digikam.lsm.cmake.in ${CMAKE_CURRENT_BINARY_DIR}/digikam.lsm)
-    endif()
-
-endif()
-
-# ==================================================================================================
-# API documentation generation
-
-if(DOXYGEN_FOUND)
-
-    set(API_DIR    ${CMAKE_BINARY_DIR}/api)
-    set(SOURCE_DIR ${CMAKE_SOURCE_DIR})
-    set(DOXYFILE   ${CMAKE_BINARY_DIR}/Doxyfile)
-    set(WARNFILE   ${CMAKE_BINARY_DIR}/doxygen-warn.log)
-
-    configure_file(${CMAKE_CURRENT_SOURCE_DIR}/cmake/templates/Doxyfile.cmake.in ${DOXYFILE})
-
-    add_custom_target(doc ${DOXYGEN_EXECUTABLE} ${DOXYFILE}
-                      WORKING_DIRECTORY ${CMAKE_BINARY_DIR})
-endif()
-------------- next part --------------
diff -durN orig/digikam-5.3.0/debian/patches/flickr.diff digikam-5.3.0/debian/patches/flickr.diff
--- orig/digikam-5.3.0/debian/patches/flickr.diff	1969-12-31 18:00:00.000000000 -0600
+++ digikam-5.3.0/debian/patches/flickr.diff	2017-09-07 11:17:46.344112879 -0500
@@ -0,0 +1,1925 @@
+Index: digikam-5.3.0/extra/kipi-plugins/common/libkipiplugins/CMakeLists.txt
+===================================================================
+--- digikam-5.3.0.orig/extra/kipi-plugins/common/libkipiplugins/CMakeLists.txt
++++ digikam-5.3.0/extra/kipi-plugins/common/libkipiplugins/CMakeLists.txt
+@@ -54,9 +54,9 @@ set(o2_SRCS
+     ${CMAKE_CURRENT_SOURCE_DIR}/o2/src/o0abstractstore.h
+     ${CMAKE_CURRENT_SOURCE_DIR}/o2/src/o0globals.h
+     # Enable when needed
+-    #${CMAKE_CURRENT_SOURCE_DIR}/o2/src/o1.cpp
+-    #${CMAKE_CURRENT_SOURCE_DIR}/o2/src/o1requestor.cpp
+-    #${CMAKE_CURRENT_SOURCE_DIR}/o2/src/o1timedreply.cpp
++    ${CMAKE_CURRENT_SOURCE_DIR}/o2/src/o1.cpp
++    ${CMAKE_CURRENT_SOURCE_DIR}/o2/src/o1requestor.cpp
++    ${CMAKE_CURRENT_SOURCE_DIR}/o2/src/o1timedreply.cpp
+     #${CMAKE_CURRENT_SOURCE_DIR}/o2/src/o1twitter.h
+     #${CMAKE_CURRENT_SOURCE_DIR}/o2/src/oxtwitter.cpp
+     #${CMAKE_CURRENT_SOURCE_DIR}/o2/src/o1dropbox.h
+Index: digikam-5.3.0/extra/kipi-plugins/flickr/flickrtalker.cpp
+===================================================================
+--- digikam-5.3.0.orig/extra/kipi-plugins/flickr/flickrtalker.cpp
++++ digikam-5.3.0/extra/kipi-plugins/flickr/flickrtalker.cpp
+@@ -1,13 +1,14 @@
+ /* ============================================================
+  *
+- * This file is a part of kipi-plugins project
++ * This file is a part of digiKam project
+  * http://www.digikam.org
+  *
+  * Date        : 2005-07-07
+  * Description : a kipi plugin to export images to Flickr web service
+  *
+  * Copyright (C) 2005-2009 by Vardhman Jain <vardhman at gmail dot com>
+- * Copyright (C) 2009-2016 by Gilles Caulier <caulier dot gilles at gmail dot com>
++ * Copyright (C) 2009-2017 by Gilles Caulier <caulier dot gilles at gmail dot com>
++ * Copyright (C) 2017      by Maik Qualmann <metzpinguin at gmail dot com>
+  *
+  * This program is free software; you can redistribute it
+  * and/or modify it under the terms of the GNU General
+@@ -34,7 +35,6 @@
+ #include <QMap>
+ #include <QStringList>
+ #include <QProgressDialog>
+-#include <QUrlQuery>
+ #include <QStandardPaths>
+ #include <QApplication>
+ #include <QDesktopServices>
+@@ -68,6 +68,8 @@ FlickrTalker::FlickrTalker(QWidget* cons
+     m_state           = FE_LOGOUT;
+     m_serviceName     = serviceName;
+     m_iface           = 0;
++    m_o1              = 0;
++    m_requestor       = 0;
+ 
+     PluginLoader* const pl = PluginLoader::instance();
+ 
+@@ -76,34 +78,27 @@ FlickrTalker::FlickrTalker(QWidget* cons
+         m_iface = pl->interface();
+     }
+ 
+-    if (serviceName == QString::fromLatin1("23"))
++    if (serviceName == QLatin1String("23"))
+     {
+-        m_apiUrl    = QString::fromLatin1("http://www.23hq.com/services/rest/");
+-        m_authUrl   = QString::fromLatin1("http://www.23hq.com/services/auth/");
+-        m_uploadUrl = QString::fromLatin1("http://www.23hq.com/services/upload/");
++        m_apiUrl    = QLatin1String("http://www.23hq.com/services/rest/");
++        m_authUrl   = QLatin1String("http://www.23hq.com/services/auth/");
++        m_uploadUrl = QLatin1String("http://www.23hq.com/services/upload/");
+ 
+         // bshanks: do 23 and flickr really share API keys? or does 23 not need
+         // one?
+-        m_apikey    = QString::fromLatin1("49d585bafa0758cb5c58ab67198bf632");
+-        m_secret    = QString::fromLatin1("34b39925e6273ffd");
+-    }
+-    else if (serviceName == QString::fromLatin1("Zooomr"))
+-    {
+-        m_apiUrl    = QString::fromLatin1("http://api.zooomr.com/services/rest/");
+-        m_authUrl   = QString::fromLatin1("http://www.zooomr.com/services/auth/");
+-        m_uploadUrl = QString::fromLatin1("http://upload.zooomr.com/services/upload/");
+-
+-        m_apikey    = QString::fromLatin1("18c8db5ce9ed4e15a7b484136f5080c5");
+-        m_secret    = QString::fromLatin1("1ea4af14e3");
++        m_apikey    = QLatin1String("49d585bafa0758cb5c58ab67198bf632");
++        m_secret    = QLatin1String("34b39925e6273ffd");
+     }
+     else
+     {
+-        m_apiUrl    = QString::fromLatin1("https://www.flickr.com/services/rest/");
+-        m_authUrl   = QString::fromLatin1("https://www.flickr.com/services/auth/");
+-        m_uploadUrl = QString::fromLatin1("https://api.flickr.com/services/upload/");
++        m_apiUrl    = QLatin1String("https://www.flickr.com/services/rest/");
++        m_authUrl   = QLatin1String("https://www.flickr.com/services/oauth/authorize?perms=write");
++        m_tokenUrl  = QLatin1String("https://www.flickr.com/services/oauth/request_token");
++        m_accessUrl = QLatin1String("https://www.flickr.com/services/oauth/access_token");
++        m_uploadUrl = QLatin1String("https://up.flickr.com/services/upload/");
+ 
+-        m_apikey    = QString::fromLatin1("49d585bafa0758cb5c58ab67198bf632");
+-        m_secret    = QString::fromLatin1("34b39925e6273ffd");
++        m_apikey    = QLatin1String("49d585bafa0758cb5c58ab67198bf632");
++        m_secret    = QLatin1String("34b39925e6273ffd");
+     }
+ 
+     m_netMngr = new QNetworkAccessManager(this);
+@@ -116,8 +111,24 @@ FlickrTalker::FlickrTalker(QWidget* cons
+     /* Initialize photo sets list. */
+     m_photoSetsList    = new QLinkedList<FPhotoSet>();
+ 
+-    connect(this, SIGNAL(signalAuthenticate()),
+-            this, SLOT(slotAuthenticate()));
++    m_o1 = new O1(this);
++
++    m_o1->setClientId(m_apikey);
++    m_o1->setClientSecret(m_secret);
++    m_o1->setAuthorizeUrl(QUrl(m_authUrl));
++    m_o1->setAccessTokenUrl(QUrl(m_accessUrl));
++    m_o1->setRequestTokenUrl(QUrl(m_tokenUrl));
++
++    connect(m_o1, SIGNAL(linkingFailed()),
++            this, SLOT(slotLinkingFailed()));
++
++    connect(m_o1, SIGNAL(linkingSucceeded()),
++            this, SLOT(slotLinkingSucceeded()));
++
++    connect(m_o1, SIGNAL(openBrowser(QUrl)),
++            this, SLOT(slotOpenBrowser(QUrl)));
++
++    m_requestor = new O1Requestor(m_netMngr, m_o1, this);
+ }
+ 
+ FlickrTalker::~FlickrTalker()
+@@ -132,144 +143,51 @@ FlickrTalker::~FlickrTalker()
+     removeTemporaryDir(m_serviceName.toLatin1().constData());
+ }
+ 
+-/** Compute MD5 signature using url queries keys and values following Flickr notice:
+-    http://www.flickr.com/services/api/auth.spec.html
+-*/
+-QString FlickrTalker::getApiSig(const QString& secret, const QUrl& url)
++void FlickrTalker::link()
+ {
+-    QUrlQuery urlQuery(url.query());
+-    QList<QPair<QString, QString> > temp_queries = urlQuery.queryItems();
+-    QMap<QString, QString> queries;
+-
+-    QPair<QString, QString> pair;
+-
+-    foreach(pair, temp_queries)
+-    {
+-        queries.insert(pair.first,pair.second);
+-    }
+-
+-    QString compressed(secret);
+-
+-    // NOTE: iterator QMap iterator will sort alphabetically items based on key values.
+-    for (QMap<QString, QString>::iterator it = queries.begin() ; it != queries.end(); ++it)
+-    {
+-        compressed.append(it.key());
+-        compressed.append(it.value());
+-    }
++    emit signalBusy(true);
++    m_o1->link();
++}
+ 
+-    QCryptographicHash context(QCryptographicHash::Md5);
+-    context.addData(compressed.toUtf8());
+-    return QLatin1String(context.result().toHex().data());
++void FlickrTalker::unlink()
++{
++    m_o1->unlink();
+ }
+ 
+-QString FlickrTalker::getMaxAllowedFileSize()
++void FlickrTalker::slotLinkingFailed()
+ {
+-    return m_maxSize;
++    qCDebug(KIPIPLUGINS_LOG) << "LINK to Fickr fail";
++    emit signalBusy(false);
+ }
+ 
+-void FlickrTalker::maxAllowedFileSize()
++void FlickrTalker::slotLinkingSucceeded()
+ {
+-    if (m_reply)
++    if (!m_o1->linked())
+     {
+-        m_reply->abort();
+-        m_reply = 0;
++        qCDebug(KIPIPLUGINS_LOG) << "UNLINK to Fickr ok";
++        return;
+     }
+ 
+-    QUrl url(m_apiUrl);
+-    QUrlQuery urlQuery;
+-    urlQuery.addQueryItem(QString::fromLatin1("auth_token"), m_token);
+-    urlQuery.addQueryItem(QString::fromLatin1("api_key"), m_apikey);
+-    urlQuery.addQueryItem(QString::fromLatin1("method"), QString::fromLatin1("flickr.people.getLimits"));
+-    url.setQuery(urlQuery);
+-    QString md5 = getApiSig(m_secret, url);
+-    urlQuery.addQueryItem(QString::fromLatin1("api_sig"), md5);
+-    url.setQuery(urlQuery);
+-    qCDebug(KIPIPLUGINS_LOG) << "Get max file size url: " << url;
+-
+-    if (m_serviceName == QString::fromLatin1("Zooomr"))
+-    {
+-        // Zooomr redirects the POST at this url to a GET.
+-        m_reply = m_netMngr->get(QNetworkRequest(url));
+-    }
+-    else
+-    {
+-        QNetworkRequest netRequest(url);
+-        netRequest.setHeader(QNetworkRequest::ContentTypeHeader, QLatin1String("application/x-www-form-urlencoded"));
++    qCDebug(KIPIPLUGINS_LOG) << "LINK to Fickr ok";
+ 
+-        m_reply = m_netMngr->post(netRequest, QByteArray());
+-    }
++    m_username = m_o1->extraTokens()[QLatin1String("username")].toString();
++    m_userId   = m_o1->extraTokens()[QLatin1String("user_nsid")].toString();
+ 
+-    m_state = FE_GETMAXSIZE;
+-    m_authProgressDlg->setLabelText(i18n("Getting the maximum allowed file size."));
+-    m_authProgressDlg->setMaximum(4);
+-    m_authProgressDlg->setValue(1);
+-    m_buffer.resize(0);
+-    emit signalBusy(true);
++    emit signalLinkingSucceeded();
+ }
+ 
+-// MD5 signature of the request.
+-/*
+-QString FlickrTalker::getApiSig(const QString& secret, const QStringList &headers)
++void FlickrTalker::slotOpenBrowser(const QUrl& url)
+ {
+-    QMap<QString, QString> queries = url.queryItems();
+-    QString compressed(secret);
+-
+-    // NOTE: iterator QMap iterator will sort alphabetically items based on key values.
+-    for (QMap<QString, QString>::iterator it = queries.begin() ; it != queries.end(); ++it)
+-    {
+-        compressed.append(it.key());
+-        compressed.append(it.value());
+-    }
+-
+-    QCryptographicHash context(QCryptographicHash::Md5);
+-    context.addData(compressed.toUtf8());
+-    return context.result().toHex().data();
++    qCDebug(KIPIPLUGINS_LOG) << "Open Browser...";
++    QDesktopServices::openUrl(url);
+ }
+-*/
+ 
+-/**get the API sig and send it to the server server should return a frob.
+-*/
+-void FlickrTalker::getFrob()
++QString FlickrTalker::getMaxAllowedFileSize()
+ {
+-    if (m_reply)
+-    {
+-        m_reply->abort();
+-        m_reply = 0;
+-    }
+-
+-    QUrl url(m_apiUrl);
+-    QUrlQuery urlQuery;
+-    urlQuery.addQueryItem(QString::fromLatin1("method"), QString::fromLatin1("flickr.auth.getFrob"));
+-    urlQuery.addQueryItem(QString::fromLatin1("api_key"), m_apikey);
+-    url.setQuery(urlQuery);
+-
+-    QString md5 = getApiSig(m_secret, url);
+-    urlQuery.addQueryItem(QString::fromLatin1("api_sig"), md5);
+-    url.setQuery(urlQuery);
+-    qCDebug(KIPIPLUGINS_LOG) << "Get frob url: " << url;
+-
+-    if (m_serviceName == QString::fromLatin1("Zooomr"))
+-    {
+-        // Zooomr redirects the POST at this url to a GET.
+-        m_reply = m_netMngr->get(QNetworkRequest(url));
+-    }
+-    else
+-    {
+-        QNetworkRequest netRequest(url);
+-        netRequest.setHeader(QNetworkRequest::ContentTypeHeader, QLatin1String("application/x-www-form-urlencoded"));
+-
+-        m_reply = m_netMngr->post(netRequest, QByteArray());
+-    }
+-
+-    m_state = FE_GETFROB;
+-    m_authProgressDlg->setLabelText(i18n("Getting the Frob"));
+-    m_authProgressDlg->setMaximum(4);
+-    m_authProgressDlg->setValue(1);
+-    m_buffer.resize(0);
+-    emit signalBusy(true);
++    return m_maxSize;
+ }
+ 
+-void FlickrTalker::checkToken(const QString& token)
++void FlickrTalker::maxAllowedFileSize()
+ {
+     if (m_reply)
+     {
+@@ -277,39 +195,30 @@ void FlickrTalker::checkToken(const QStr
+         m_reply = 0;
+     }
+ 
++    if (!m_o1->linked())
++        return;
++
+     QUrl url(m_apiUrl);
+-    QUrlQuery urlQuery;
+-    urlQuery.addQueryItem(QString::fromLatin1("method"), QString::fromLatin1("flickr.auth.checkToken"));
+-    urlQuery.addQueryItem(QString::fromLatin1("api_key"), m_apikey);
+-    urlQuery.addQueryItem(QString::fromLatin1("auth_token"), token);
+-    url.setQuery(urlQuery);
+-    QString md5 = getApiSig(m_secret, url);
+-    urlQuery.addQueryItem(QString::fromLatin1("api_sig"), md5);
+-    url.setQuery(urlQuery);
+-    qCDebug(KIPIPLUGINS_LOG) << "Check token url: " << url;
++    QNetworkRequest netRequest(url);
++    QList<O0RequestParameter> reqParams = QList<O0RequestParameter>();
+ 
+-    if (m_serviceName == QString::fromLatin1("Zooomr"))
+-    {
+-        // Zooomr redirects the POST at this url to a GET.
+-        m_reply = m_netMngr->get(QNetworkRequest(url));
+-    }
+-    else
+-    {
+-        QNetworkRequest netRequest(url);
+-        netRequest.setHeader(QNetworkRequest::ContentTypeHeader, QLatin1String("application/x-www-form-urlencoded"));
++    netRequest.setHeader(QNetworkRequest::ContentTypeHeader, QLatin1String(O2_MIME_TYPE_XFORM));
+ 
+-        m_reply = m_netMngr->post(netRequest, QByteArray());
+-    }
++    reqParams << O0RequestParameter("method", "flickr.people.getLimits");
++
++    QByteArray postData = O1::createQueryParameters(reqParams);
+ 
+-    m_state = FE_CHECKTOKEN;
+-    m_authProgressDlg->setLabelText(i18n("Checking if previous token is still valid"));
++    m_reply = m_requestor->post(netRequest, reqParams, postData);
++
++    m_state = FE_GETMAXSIZE;
++    m_authProgressDlg->setLabelText(i18n("Getting the maximum allowed file size."));
+     m_authProgressDlg->setMaximum(4);
+     m_authProgressDlg->setValue(1);
+     m_buffer.resize(0);
+     emit signalBusy(true);
+ }
+ 
+-void FlickrTalker::slotAuthenticate()
++void FlickrTalker::listPhotoSets()
+ {
+     if (m_reply)
+     {
+@@ -317,116 +226,22 @@ void FlickrTalker::slotAuthenticate()
+         m_reply = 0;
+     }
+ 
+-    QUrl url(m_authUrl);
+-    QUrlQuery urlQuery;
+-    urlQuery.addQueryItem(QString::fromLatin1("api_key"), m_apikey);
+-    urlQuery.addQueryItem(QString::fromLatin1("frob"), m_frob);
+-    urlQuery.addQueryItem(QString::fromLatin1("perms"), QString::fromLatin1("write"));
+-    url.setQuery(urlQuery);
+-
+-    QString md5 = getApiSig(m_secret, url);
+-    urlQuery.addQueryItem(QString::fromLatin1("api_sig"), md5);
+-    url.setQuery(urlQuery);
+-    qCDebug(KIPIPLUGINS_LOG) << "Authenticate url: " << url;
+-
+-    QDesktopServices::openUrl(url);
+-
+-    QMessageBox quest(QMessageBox::Question,
+-                      i18n("%1 Service Web Authorization", m_serviceName),
+-                      i18n("Please follow the instructions in the browser window, then "
+-                           "return to press corresponding button."),
+-                      QMessageBox::Yes | QMessageBox::No);
+-
+-    (quest.button(QMessageBox::Yes))->setText(i18n("I am authenticated"));
+-    (quest.button(QMessageBox::No))->setText(i18n("I am not authenticated"));
+-
+-    if (quest.exec() == QMessageBox::Yes)
+-    {
+-        getToken();
+-        m_authProgressDlg->setLabelText(i18n("Authenticating the User on web"));
+-        m_authProgressDlg->setMaximum(4);
+-        m_authProgressDlg->setValue(2);
+-        emit signalBusy(false);
+-    }
+-    else
+-    {
+-        qCDebug(KIPIPLUGINS_LOG) << "User didn't proceed with getToken Authorization, cannot proceed further, aborting";
+-        cancel();
+-    }
+-}
++    if (!m_o1->linked())
++        return;
+ 
+-void FlickrTalker::getToken()
+-{
+-    if (m_reply)
+-    {
+-        m_reply->abort();
+-        m_reply = 0;
+-    }
++    qCDebug(KIPIPLUGINS_LOG) << "List photoset invoked";
+ 
+     QUrl url(m_apiUrl);
+-    QUrlQuery urlQuery;
+-    urlQuery.addQueryItem(QString::fromLatin1("api_key"), m_apikey);
+-    urlQuery.addQueryItem(QString::fromLatin1("method"), QString::fromLatin1("flickr.auth.getToken"));
+-    urlQuery.addQueryItem(QString::fromLatin1("frob"), m_frob);
+-    url.setQuery(urlQuery);
+-    QString md5 = getApiSig(m_secret, url);
+-    urlQuery.addQueryItem(QString::fromLatin1("api_sig"), md5);
+-    url.setQuery(urlQuery);
+-    qCDebug(KIPIPLUGINS_LOG) << "Get token url: " << url;
++    QNetworkRequest netRequest(url);
++    QList<O0RequestParameter> reqParams = QList<O0RequestParameter>();
+ 
+-    if (m_serviceName == QString::fromLatin1("Zooomr"))
+-    {
+-        // Zooomr redirects the POST at this url to a GET.
+-        m_reply = m_netMngr->get(QNetworkRequest(url));
+-    }
+-    else
+-    {
+-        QNetworkRequest netRequest(url);
+-        netRequest.setHeader(QNetworkRequest::ContentTypeHeader, QLatin1String("application/x-www-form-urlencoded"));
++    netRequest.setHeader(QNetworkRequest::ContentTypeHeader, QLatin1String(O2_MIME_TYPE_XFORM));
+ 
+-        m_reply = m_netMngr->post(netRequest, QByteArray());
+-    }
++    reqParams << O0RequestParameter("method", "flickr.photosets.getList");
+ 
+-    m_state = FE_GETTOKEN;
+-    m_buffer.resize(0);
+-    emit signalBusy(true);
+-    m_authProgressDlg->setLabelText(i18n("Getting the Token from the server"));
+-    m_authProgressDlg->setMaximum(4);
+-    m_authProgressDlg->setValue(3);
+-}
++    QByteArray postData = O1::createQueryParameters(reqParams);
+ 
+-void FlickrTalker::listPhotoSets()
+-{
+-    if (m_reply)
+-    {
+-        m_reply->abort();
+-        m_reply = 0;
+-    }
+-
+-    qCDebug(KIPIPLUGINS_LOG) << "List photoset invoked";
+-    QUrl url(m_apiUrl);
+-    QUrlQuery urlQuery;
+-    urlQuery.addQueryItem(QString::fromLatin1("auth_token"), m_token);
+-    urlQuery.addQueryItem(QString::fromLatin1("api_key"), m_apikey);
+-    urlQuery.addQueryItem(QString::fromLatin1("method"), QString::fromLatin1("flickr.photosets.getList"));
+-    url.setQuery(urlQuery);
+-    QString md5 = getApiSig(m_secret, url);
+-    urlQuery.addQueryItem(QString::fromLatin1("api_sig"), md5);
+-    url.setQuery(urlQuery);
+-    qCDebug(KIPIPLUGINS_LOG) << "List photoset URL" << url;
+-
+-    if (m_serviceName == QString::fromLatin1("Zooomr"))
+-    {
+-        // Zooomr redirects the POST at this url to a GET.
+-        m_reply = m_netMngr->get(QNetworkRequest(url));
+-    }
+-    else
+-    {
+-        QNetworkRequest netRequest(url);
+-        netRequest.setHeader(QNetworkRequest::ContentTypeHeader, QLatin1String("application/x-www-form-urlencoded"));
+-
+-        m_reply = m_netMngr->post(netRequest, QByteArray());
+-    }
++    m_reply = m_requestor->post(netRequest, reqParams, postData);
+ 
+     m_state = FE_LISTPHOTOSETS;
+     m_buffer.resize(0);
+@@ -441,43 +256,30 @@ void FlickrTalker::getPhotoProperty(cons
+         m_reply = 0;
+     }
+ 
++    if (!m_o1->linked())
++        return;
++
+     QUrl url(m_apiUrl);
+-    QUrlQuery urlQuery;
+-    urlQuery.addQueryItem(QString::fromLatin1("api_key"), m_apikey);
+-    urlQuery.addQueryItem(QString::fromLatin1("method"), method);
+-    urlQuery.addQueryItem(QString::fromLatin1("frob"), m_frob);
++    QNetworkRequest netRequest(url);
++    QList<O0RequestParameter> reqParams = QList<O0RequestParameter>();
++
++    netRequest.setHeader(QNetworkRequest::ContentTypeHeader, QLatin1String(O2_MIME_TYPE_XFORM));
++
++    reqParams << O0RequestParameter("method", method.toLatin1());
+ 
+     for (QStringList::const_iterator it = argList.constBegin(); it != argList.constEnd(); ++it)
+     {
+         QStringList str = (*it).split(QLatin1Char('='), QString::SkipEmptyParts);
+-        urlQuery.addQueryItem(str[0], str[1]);
++        reqParams << O0RequestParameter(str[0].toLatin1(), str[1].toLatin1());
+     }
+ 
+-    url.setQuery(urlQuery);
+-    QString md5 = getApiSig(m_secret, url);
+-    urlQuery.addQueryItem(QString::fromLatin1("api_sig"), md5);
+-    url.setQuery(urlQuery);
+-    qCDebug(KIPIPLUGINS_LOG) << "Get photo property url: " << url;
+-
+-    if (m_serviceName == QString::fromLatin1("Zooomr"))
+-    {
+-        // Zooomr redirects the POST at this url to a GET.
+-        m_reply = m_netMngr->get(QNetworkRequest(url));
+-    }
+-    else
+-    {
+-        QNetworkRequest netRequest(url);
+-        netRequest.setHeader(QNetworkRequest::ContentTypeHeader, QLatin1String("application/x-www-form-urlencoded"));
++    QByteArray postData = O1::createQueryParameters(reqParams);
+ 
+-        m_reply = m_netMngr->post(netRequest, QByteArray());
+-    }
++    m_reply = m_requestor->post(netRequest, reqParams, postData);
+ 
+     m_state = FE_GETPHOTOPROPERTY;
+     m_buffer.resize(0);
+     emit signalBusy(true);
+-
+-    //  m_authProgressDlg->setLabelText("Getting the Token from the server");
+-    //  m_authProgressDlg->setProgress(3,4);
+ }
+ 
+ void FlickrTalker::listPhotos(const QString& /*albumName*/)
+@@ -494,34 +296,25 @@ void FlickrTalker::createPhotoSet(const
+         m_reply = 0;
+     }
+ 
+-    qCDebug(KIPIPLUGINS_LOG) << "create photoset invoked";
++    if (!m_o1->linked())
++        return;
++
++    qCDebug(KIPIPLUGINS_LOG) << "Create photoset invoked";
++
+     QUrl url(m_apiUrl);
+-    QUrlQuery urlQuery;
+-    urlQuery.addQueryItem(QString::fromLatin1("auth_token"), m_token);
+-    urlQuery.addQueryItem(QString::fromLatin1("api_key"), m_apikey);
+-    urlQuery.addQueryItem(QString::fromLatin1("method"), QString::fromLatin1("flickr.photosets.create"));
+-    urlQuery.addQueryItem(QString::fromLatin1("title"), albumTitle);
+-    urlQuery.addQueryItem(QString::fromLatin1("description"), albumDescription);
+-    urlQuery.addQueryItem(QString::fromLatin1("primary_photo_id"), primaryPhotoId);
+-    url.setQuery(urlQuery);
+-
+-    QString md5 = getApiSig(m_secret, url);
+-    urlQuery.addQueryItem(QString::fromLatin1("api_sig"), md5);
+-    url.setQuery(urlQuery);
+-    qCDebug(KIPIPLUGINS_LOG) << "List photo sets url: " << url;
++    QNetworkRequest netRequest(url);
++    QList<O0RequestParameter> reqParams = QList<O0RequestParameter>();
+ 
+-    if (m_serviceName == QString::fromLatin1("Zooomr"))
+-    {
+-        // Zooomr redirects the POST at this url to a GET.
+-        m_reply = m_netMngr->get(QNetworkRequest(url));
+-    }
+-    else
+-    {
+-        QNetworkRequest netRequest(url);
+-        netRequest.setHeader(QNetworkRequest::ContentTypeHeader, QLatin1String("application/x-www-form-urlencoded"));
++    netRequest.setHeader(QNetworkRequest::ContentTypeHeader, QLatin1String(O2_MIME_TYPE_XFORM));
+ 
+-        m_reply = m_netMngr->post(netRequest, QByteArray());
+-    }
++    reqParams << O0RequestParameter("method", "flickr.photosets.create");
++    reqParams << O0RequestParameter("title", albumTitle.toLatin1());
++    reqParams << O0RequestParameter("description", albumDescription.toLatin1());
++    reqParams << O0RequestParameter("primary_photo_id", primaryPhotoId.toLatin1());
++
++    QByteArray postData = O1::createQueryParameters(reqParams);
++
++    m_reply = m_requestor->post(netRequest, reqParams, postData);
+ 
+     m_state = FE_CREATEPHOTOSET;
+     m_buffer.resize(0);
+@@ -537,9 +330,10 @@ void FlickrTalker::addPhotoToPhotoSet(co
+         m_reply = 0;
+     }
+ 
+-    qCDebug(KIPIPLUGINS_LOG) << "addPhotoToPhotoSet invoked";
+-    QUrl url(m_apiUrl);
+-    QUrlQuery urlQuery;
++    if (!m_o1->linked())
++        return;
++
++    qCDebug(KIPIPLUGINS_LOG) << "AddPhotoToPhotoSet invoked";
+ 
+     /* If the photoset id starts with the special string "UNDEFINED_", it means
+      * it doesn't exist yet on Flickr and needs to be created. Note that it's
+@@ -547,26 +341,23 @@ void FlickrTalker::addPhotoToPhotoSet(co
+      * is done in the set creation call to Flickr. */
+     if (photoSetId.startsWith(QLatin1String("UNDEFINED_")))
+     {
+-        createPhotoSet(QString::fromLatin1(""), m_selectedPhotoSet.title, m_selectedPhotoSet.description, photoId);
++        createPhotoSet(QLatin1String(""), m_selectedPhotoSet.title, m_selectedPhotoSet.description, photoId);
+     }
+     else
+     {
+-        urlQuery.addQueryItem(QString::fromLatin1("auth_token"), m_token);
+-        urlQuery.addQueryItem(QString::fromLatin1("photoset_id"), photoSetId);
+-        urlQuery.addQueryItem(QString::fromLatin1("api_key"), m_apikey);
+-        urlQuery.addQueryItem(QString::fromLatin1("method"), QString::fromLatin1("flickr.photosets.addPhoto"));
+-        urlQuery.addQueryItem(QString::fromLatin1("photo_id"), photoId);
+-        url.setQuery(urlQuery);
+-
+-        QString md5 = getApiSig(m_secret, url);
+-        urlQuery.addQueryItem(QString::fromLatin1("api_sig"), md5);
+-        url.setQuery(urlQuery);
+-        qCDebug(KIPIPLUGINS_LOG) << "Add photo to Photo set url: " << url;
+-
++        QUrl url(m_apiUrl);
+         QNetworkRequest netRequest(url);
+-        netRequest.setHeader(QNetworkRequest::ContentTypeHeader, QLatin1String("application/x-www-form-urlencoded"));
++        QList<O0RequestParameter> reqParams = QList<O0RequestParameter>();
++
++        netRequest.setHeader(QNetworkRequest::ContentTypeHeader, QLatin1String(O2_MIME_TYPE_XFORM));
+ 
+-        m_reply = m_netMngr->post(netRequest, QByteArray());
++        reqParams << O0RequestParameter("method", "flickr.photosets.addPhoto");
++        reqParams << O0RequestParameter("photoset_id", photoSetId.toLatin1());
++        reqParams << O0RequestParameter("photo_id", photoId.toLatin1());
++
++        QByteArray postData = O1::createQueryParameters(reqParams);
++
++        m_reply = m_requestor->post(netRequest, reqParams, postData);
+ 
+         m_state = FE_ADDPHOTOTOPHOTOSET;
+         m_buffer.resize(0);
+@@ -575,7 +366,7 @@ void FlickrTalker::addPhotoToPhotoSet(co
+ }
+ 
+ bool FlickrTalker::addPhoto(const QString& photoPath, const FPhotoInfo& info,
+-                            bool rescale, int maxDim, int imageQuality)
++                            bool original, bool rescale, int maxDim, int imageQuality)
+ {
+     if (m_reply)
+     {
+@@ -583,123 +374,120 @@ bool FlickrTalker::addPhoto(const QStrin
+         m_reply = 0;
+     }
+ 
++    if (!m_o1->linked())
++        return false;
++
+     QUrl url(m_uploadUrl);
++    QNetworkRequest netRequest(url);
++    QList<O0RequestParameter> reqParams = QList<O0RequestParameter>();
+ 
+-    // We dont' want to modify url as such, we just used the QUrl object for storing the query items.
+-    QUrl url2(QString::fromLatin1(""));
+-    QUrlQuery urlQuery;
+     QString path = photoPath;
+     MPForm  form;
+ 
+-    form.addPair(QString::fromLatin1("auth_token"), m_token, QString::fromLatin1("text/plain"));
+-    urlQuery.addQueryItem(QString::fromLatin1("auth_token"), m_token);
+-
+-    form.addPair(QString::fromLatin1("api_key"), m_apikey, QString::fromLatin1("text/plain"));
+-    urlQuery.addQueryItem(QString::fromLatin1("api_key"), m_apikey);
+-
+-    QString ispublic = (info.is_public == 1) ? QString::fromLatin1("1") : QString::fromLatin1("0");
+-    form.addPair(QString::fromLatin1("is_public"), ispublic, QString::fromLatin1("text/plain"));
+-    urlQuery.addQueryItem(QString::fromLatin1("is_public"), ispublic);
+-
+-    QString isfamily = (info.is_family == 1) ? QString::fromLatin1("1") : QString::fromLatin1("0");
+-    form.addPair(QString::fromLatin1("is_family"), isfamily, QString::fromLatin1("text/plain"));
+-    urlQuery.addQueryItem(QString::fromLatin1("is_family"), isfamily);
+-
+-    QString isfriend = (info.is_friend == 1) ? QString::fromLatin1("1") : QString::fromLatin1("0");
+-    form.addPair(QString::fromLatin1("is_friend"), isfriend, QString::fromLatin1("text/plain"));
+-    urlQuery.addQueryItem(QString::fromLatin1("is_friend"), isfriend);
++    QString ispublic = (info.is_public == 1) ? QLatin1String("1") : QLatin1String("0");
++    form.addPair(QLatin1String("is_public"), ispublic, QLatin1String("text/plain"));
++    reqParams << O0RequestParameter("is_public", ispublic.toLatin1());
++
++    QString isfamily = (info.is_family == 1) ? QLatin1String("1") : QLatin1String("0");
++    form.addPair(QLatin1String("is_family"), isfamily, QLatin1String("text/plain"));
++    reqParams << O0RequestParameter("is_family", isfamily.toLatin1());
++
++    QString isfriend = (info.is_friend == 1) ? QLatin1String("1") : QLatin1String("0");
++    form.addPair(QLatin1String("is_friend"), isfriend, QLatin1String("text/plain"));
++    reqParams << O0RequestParameter("is_friend", isfriend.toLatin1());
+ 
+     QString safetyLevel = QString::number(static_cast<int>(info.safety_level));
+-    form.addPair(QString::fromLatin1("safety_level"), safetyLevel, QString::fromLatin1("text/plain"));
+-    urlQuery.addQueryItem(QString::fromLatin1("safety_level"), safetyLevel);
++    form.addPair(QLatin1String("safety_level"), safetyLevel, QLatin1String("text/plain"));
++    reqParams << O0RequestParameter("safety_level", safetyLevel.toLatin1());
+ 
+     QString contentType = QString::number(static_cast<int>(info.content_type));
+-    form.addPair(QString::fromLatin1("content_type"), contentType, QString::fromLatin1("text/plain"));
+-    urlQuery.addQueryItem(QString::fromLatin1("content_type"), contentType);
++    form.addPair(QLatin1String("content_type"), contentType, QLatin1String("text/plain"));
++    reqParams << O0RequestParameter("content_type", contentType.toLatin1());
+ 
+-    QString tags = QString::fromLatin1("\"") + info.tags.join(QString::fromLatin1("\" \"")) + QString::fromLatin1("\"");
++    QString tags = QLatin1String("\"") + info.tags.join(QLatin1String("\" \"")) + QLatin1String("\"");
+ 
+     if (tags.length() > 0)
+     {
+-        form.addPair(QString::fromLatin1("tags"), tags, QString::fromLatin1("text/plain"));
+-        urlQuery.addQueryItem(QString::fromLatin1("tags"), tags);
++        form.addPair(QLatin1String("tags"), tags, QLatin1String("text/plain"));
++        reqParams << O0RequestParameter("tags", tags.toLatin1());
+     }
+ 
+     if (!info.title.isEmpty())
+     {
+-        form.addPair(QString::fromLatin1("title"), info.title, QString::fromLatin1("text/plain"));
+-        urlQuery.addQueryItem(QString::fromLatin1("title"), info.title);
++        form.addPair(QLatin1String("title"), info.title, QLatin1String("text/plain"));
++        reqParams << O0RequestParameter("title", info.title.toLatin1());
+     }
+ 
+     if (!info.description.isEmpty())
+     {
+-        form.addPair(QString::fromLatin1("description"), info.description, QString::fromLatin1("text/plain"));
+-        urlQuery.addQueryItem(QString::fromLatin1("description"), info.description);
+-    }
+-
+-    url2.setQuery(urlQuery);
+-    QString md5 = getApiSig(m_secret, url2);
+-    form.addPair(QString::fromLatin1("api_sig"), md5, QString::fromLatin1("text/plain"));
+-    QImage image;
+-
+-    if (m_iface)
+-    {
+-        image = m_iface->preview(QUrl::fromLocalFile(photoPath));
++        form.addPair(QLatin1String("description"), info.description, QLatin1String("text/plain"));
++        reqParams << O0RequestParameter("description", info.description.toLatin1());
+     }
+ 
+-    if (image.isNull())
++    if (!original)
+     {
+-        image.load(photoPath);
+-    }
++        QImage image;
+ 
+-    if (!image.isNull())
+-    {
+-        if (!m_lastTmpFile.isEmpty())
++        if (m_iface)
+         {
+-            QFile::remove(m_lastTmpFile);
++            image = m_iface->preview(QUrl::fromLocalFile(photoPath));
+         }
+ 
+-        path = makeTemporaryDir(m_serviceName.toLatin1().constData()).filePath(QFileInfo(photoPath)
+-                                                                     .baseName().trimmed() + QLatin1String(".jpg"));
+-
+-        if (rescale)
++        if (image.isNull())
+         {
+-            if (image.width() > maxDim || image.height() > maxDim)
+-                image = image.scaled(maxDim, maxDim, Qt::KeepAspectRatio, Qt::SmoothTransformation);
++            image.load(photoPath);
+         }
+ 
+-        image.save(path, "JPEG", imageQuality);
+-        m_lastTmpFile = path;
+-
+-        // Restore all metadata.
+-
+-        if (m_iface)
++        if (!image.isNull())
+         {
+-            QPointer<MetadataProcessor> meta = m_iface->createMetadataProcessor();
+-
+-            if (meta && meta->load(QUrl::fromLocalFile(photoPath)))
++            if (!m_lastTmpFile.isEmpty())
+             {
+-                meta->setImageDimensions(image.size());
++                QFile::remove(m_lastTmpFile);
++            }
+ 
+-                // NOTE: see bug #153207: Flickr use IPTC keywords to create Tags in web interface
+-                //       As IPTC do not support UTF-8, we need to remove it.
+-                meta->removeIptcTags(QStringList() << QLatin1String("Iptc.Application2.Keywords"));
++            path = makeTemporaryDir(m_serviceName.toLatin1().constData()).filePath(QFileInfo(photoPath)
++                                                                         .baseName().trimmed() + QLatin1String(".jpg"));
+ 
+-                meta->setImageProgramId(QString::fromLatin1("Kipi-plugins"), kipipluginsVersion());
+-                meta->save(QUrl::fromLocalFile(path));
++            if (rescale)
++            {
++                if (image.width() > maxDim || image.height() > maxDim)
++                    image = image.scaled(maxDim, maxDim, Qt::KeepAspectRatio, Qt::SmoothTransformation);
+             }
+-            else
++
++            image.save(path, "JPEG", imageQuality);
++            m_lastTmpFile = path;
++
++            // Restore all metadata.
++
++            if (m_iface)
+             {
+-                qCWarning(KIPIPLUGINS_LOG) << "flickrExport::Image doesn't have metadata";
++                QPointer<MetadataProcessor> meta = m_iface->createMetadataProcessor();
++
++                if (meta && meta->load(QUrl::fromLocalFile(photoPath)))
++                {
++                    meta->setImageDimensions(image.size());
++                    meta->setImageOrientation(MetadataProcessor::NORMAL);
++
++                    // NOTE: see bug #153207: Flickr use IPTC keywords to create Tags in web interface
++                    //       As IPTC do not support UTF-8, we need to remove it.
++                    meta->removeIptcTags(QStringList() << QLatin1String("Iptc.Application2.Keywords"));
++
++                    meta->setImageProgramId(QLatin1String("Kipi-plugins"), kipipluginsVersion());
++                    meta->save(QUrl::fromLocalFile(path), true);
++                }
++                else
++                {
++                    qCWarning(KIPIPLUGINS_LOG) << "flickrExport::Image doesn't have metadata";
++                }
+             }
+-        }
+ 
+-        qCDebug(KIPIPLUGINS_LOG) << "Resizing and saving to temp file: " << path;
++            qCDebug(KIPIPLUGINS_LOG) << "Resizing and saving to temp file: " << path;
++        }
+     }
+ 
+     QFileInfo tempFileInfo(path);
+ 
+-    qCDebug(KIPIPLUGINS_LOG) << "QUrl path is " << QUrl::fromLocalFile(path) << "Image size after resizing (in bytes) is "<< tempFileInfo.size();
++    qCDebug(KIPIPLUGINS_LOG) << "QUrl path is " << QUrl::fromLocalFile(path) << "Image size (in bytes) is "<< tempFileInfo.size();
+ 
+     if (tempFileInfo.size() > (getMaxAllowedFileSize().toLongLong()))
+     {
+@@ -707,17 +495,16 @@ bool FlickrTalker::addPhoto(const QStrin
+         return false;
+     }
+ 
+-    if (!form.addFile(QString::fromLatin1("photo"), path))
++    if (!form.addFile(QLatin1String("photo"), path))
+     {
+         return false;
+     }
+ 
+     form.finish();
+ 
+-    QNetworkRequest netRequest(url);
+     netRequest.setHeader(QNetworkRequest::ContentTypeHeader, form.contentType());
+ 
+-    m_reply = m_netMngr->post(netRequest, form.formData());
++    m_reply = m_requestor->post(netRequest, reqParams, form.formData());
+ 
+     m_state = FE_ADDPHOTO;
+     m_buffer.resize(0);
+@@ -869,22 +656,6 @@ void FlickrTalker::slotFinished(QNetwork
+             parseResponseListPhotoSets(m_buffer);
+             break;
+ 
+-        case (FE_GETFROB):
+-            parseResponseGetFrob(m_buffer);
+-            break;
+-
+-        case (FE_GETTOKEN):
+-            parseResponseGetToken(m_buffer);
+-            break;
+-
+-        case (FE_CHECKTOKEN):
+-            parseResponseCheckToken(m_buffer);
+-            break;
+-
+-        case (FE_GETAUTHORIZED):
+-            //parseResponseGetToken(m_buffer);
+-            break;
+-
+         case (FE_LISTPHOTOS):
+             parseResponseListPhotos(m_buffer);
+             break;
+@@ -919,7 +690,7 @@ void FlickrTalker::slotFinished(QNetwork
+ void FlickrTalker::parseResponseMaxSize(const QByteArray& data)
+ {
+     QString errorString;
+-    QDomDocument doc(QString::fromLatin1("mydocument"));
++    QDomDocument doc(QLatin1String("mydocument"));
+ 
+     if (!doc.setContent(data))
+     {
+@@ -933,7 +704,7 @@ void FlickrTalker::parseResponseMaxSize(
+ 
+     while (!node.isNull())
+     {
+-        if (node.isElement() && node.nodeName() == QString::fromLatin1("person"))
++        if (node.isElement() && node.nodeName() == QLatin1String("person"))
+         {
+             e                = node.toElement();
+             QDomNode details = e.firstChild();
+@@ -944,9 +715,9 @@ void FlickrTalker::parseResponseMaxSize(
+                 {
+                     e = details.toElement();
+ 
+-                    if (details.nodeName() == QString::fromLatin1("photos"))
++                    if (details.nodeName() == QLatin1String("photos"))
+                     {
+-                        QDomAttr a = e.attributeNode(QString::fromLatin1("maxupload"));
++                        QDomAttr a = e.attributeNode(QLatin1String("maxupload"));
+                         m_maxSize = a.value();
+                         qCDebug(KIPIPLUGINS_LOG) << "Max upload size is"<<m_maxSize;
+                     }
+@@ -956,255 +727,18 @@ void FlickrTalker::parseResponseMaxSize(
+             }
+         }
+ 
+-        if (node.isElement() && node.nodeName() == QString::fromLatin1("err"))
+-        {
+-            qCDebug(KIPIPLUGINS_LOG) << "Checking Error in response";
+-            errorString = node.toElement().attribute(QString::fromLatin1("code"));
+-            qCDebug(KIPIPLUGINS_LOG) << "Error code=" << errorString;
+-            qCDebug(KIPIPLUGINS_LOG) << "Msg=" << node.toElement().attribute(QString::fromLatin1("msg"));
+-        }
+-
+-        node = node.nextSibling();
+-    }
+-}
+-
+-void FlickrTalker::parseResponseGetFrob(const QByteArray& data)
+-{
+-    bool success = false;
+-    QString errorString;
+-    QDomDocument doc(QString::fromLatin1("mydocument"));
+-
+-    if (!doc.setContent(data))
+-    {
+-        return;
+-    }
+-
+-    QDomElement docElem = doc.documentElement();
+-    QDomNode node       = docElem.firstChild();
+-
+-    while (!node.isNull())
+-    {
+-        if (node.isElement() && node.nodeName() == QString::fromLatin1("frob"))
+-        {
+-            QDomElement e = node.toElement();    // try to convert the node to an element.
+-            qCDebug(KIPIPLUGINS_LOG) << "Frob is" << e.text();
+-            m_frob        = e.text();            // this is what is obtained from data.
+-            success       = true;
+-        }
+-
+-        if (node.isElement() && node.nodeName() == QString::fromLatin1("err"))
++        if (node.isElement() && node.nodeName() == QLatin1String("err"))
+         {
+             qCDebug(KIPIPLUGINS_LOG) << "Checking Error in response";
+-            errorString = node.toElement().attribute(QString::fromLatin1("code"));
++            errorString = node.toElement().attribute(QLatin1String("code"));
+             qCDebug(KIPIPLUGINS_LOG) << "Error code=" << errorString;
+-            qCDebug(KIPIPLUGINS_LOG) << "Msg=" << node.toElement().attribute(QString::fromLatin1("msg"));
++            qCDebug(KIPIPLUGINS_LOG) << "Msg=" << node.toElement().attribute(QLatin1String("msg"));
+         }
+ 
+         node = node.nextSibling();
+     }
+ 
+-    qCDebug(KIPIPLUGINS_LOG) << "GetFrob finished";
+-    m_authProgressDlg->setMaximum(4);
+-    m_authProgressDlg->setValue(2);
+-    m_state = FE_GETAUTHORIZED;
+-
+-    if (success)
+-    {
+-        emit signalAuthenticate();
+-    }
+-    else
+-    {
+-        emit signalError(errorString);
+-    }
+-}
+-
+-void FlickrTalker::parseResponseCheckToken(const QByteArray& data)
+-{
+-    bool         success = false;
+-    QString      errorString;
+-    QString      username;
+-    QString      transReturn;
+-    QDomDocument doc(QString::fromLatin1("checktoken"));
+-
+-    if (!doc.setContent(data))
+-    {
+-        return;
+-    }
+-
+-    QDomElement docElem = doc.documentElement();
+-    QDomNode node       = docElem.firstChild();
+-    QDomElement e;
+-
+-    while (!node.isNull())
+-    {
+-        if (node.isElement() && node.nodeName() == QString::fromLatin1("auth"))
+-        {
+-            e                = node.toElement(); // try to convert the node to an element.
+-            QDomNode details = e.firstChild();
+-
+-            while (!details.isNull())
+-            {
+-                if (details.isElement())
+-                {
+-                    e = details.toElement();
+-
+-                    if (details.nodeName() == QString::fromLatin1("token"))
+-                    {
+-                        qCDebug(KIPIPLUGINS_LOG) << "Token=" << e.text();
+-                        m_token = e.text();//this is what is obtained from data.
+-                    }
+-
+-                    if (details.nodeName() == QString::fromLatin1("perms"))
+-                    {
+-                        qCDebug(KIPIPLUGINS_LOG) << "Perms=" << e.text();
+-                        QString perms = e.text();//this is what is obtained from data.
+-
+-                        if (perms == QString::fromLatin1("write"))
+-                        {
+-                            transReturn = i18nc("As in the permission to", "write");
+-                        }
+-                        else if (perms == QString::fromLatin1("read"))
+-                        {
+-                            transReturn = i18nc("As in the permission to", "read");
+-                        }
+-                        else if (perms == QString::fromLatin1("delete"))
+-                        {
+-                            transReturn = i18nc("As in the permission to", "delete");
+-                        }
+-                    }
+-
+-                    if (details.nodeName() == QString::fromLatin1("user"))
+-                    {
+-                        qCDebug(KIPIPLUGINS_LOG) << "nsid=" << e.attribute(QString::fromLatin1("nsid"));
+-                        m_userId   = e.attribute(QString::fromLatin1("nsid"));
+-                        username   = e.attribute(QString::fromLatin1("username"));
+-                        m_username = username;
+-                        qCDebug(KIPIPLUGINS_LOG) << "username=" << e.attribute(QString::fromLatin1("username"));
+-                        qCDebug(KIPIPLUGINS_LOG) << "fullname=" << e.attribute(QString::fromLatin1("fullname"));
+-                    }
+-                }
+-
+-                details = details.nextSibling();
+-            }
+-
+-            m_authProgressDlg->hide();
+-            emit signalTokenObtained(m_token);
+-            success = true;
+-        }
+-
+-        if (node.isElement() && node.nodeName() == QString::fromLatin1("err"))
+-        {
+-            qCDebug(KIPIPLUGINS_LOG) << "Checking Error in response";
+-            errorString = node.toElement().attribute(QString::fromLatin1("code"));
+-            qCDebug(KIPIPLUGINS_LOG) << "Error code=" << errorString;
+-            qCDebug(KIPIPLUGINS_LOG) << "Msg=" << node.toElement().attribute(QString::fromLatin1("msg"));
+-
+-            int valueOk = QMessageBox::question(QApplication::activeWindow(),
+-                                                i18n("Invalid Token"),
+-                                                i18n("Your token is invalid. Would you like to "
+-                                                      "get a new token to proceed?\n"));
+-
+-            if (valueOk == QMessageBox::Yes)
+-            {
+-                getFrob();
+-                return;
+-            }
+-            else
+-            {
+-                m_authProgressDlg->hide(); //will popup the result for the checktoken failure below
+-            }
+-
+-        }
+-
+-        node = node.nextSibling();
+-    }
+-
+-    if (!success)
+-    {
+-        emit signalError(errorString);
+-    }
+-
+-    qCDebug(KIPIPLUGINS_LOG) << "CheckToken finished";
+-}
+-
+-void FlickrTalker::parseResponseGetToken(const QByteArray& data)
+-{
+-    bool success = false;
+-    QString errorString;
+-    QDomDocument doc(QString::fromLatin1("gettoken"));
+-
+-    if (!doc.setContent(data))
+-    {
+-        return;
+-    }
+-
+-    QDomElement docElem = doc.documentElement();
+-    QDomNode    node    = docElem.firstChild();
+-    QDomElement e;
+-
+-    while (!node.isNull())
+-    {
+-        if (node.isElement() && node.nodeName() == QString::fromLatin1("auth"))
+-        {
+-            e                = node.toElement(); // try to convert the node to an element.
+-            QDomNode details = e.firstChild();
+-
+-            while (!details.isNull())
+-            {
+-                if (details.isElement())
+-                {
+-                    e = details.toElement();
+-
+-                    if (details.nodeName() == QString::fromLatin1("token"))
+-                    {
+-                        qCDebug(KIPIPLUGINS_LOG) << "Token=" << e.text();
+-                        m_token = e.text();      //this is what is obtained from data.
+-                    }
+-
+-                    if (details.nodeName() == QString::fromLatin1("perms"))
+-                    {
+-                        qCDebug(KIPIPLUGINS_LOG) << "Perms=" << e.text();
+-                    }
+-
+-                    if (details.nodeName() == QString::fromLatin1("user"))
+-                    {
+-                        qCDebug(KIPIPLUGINS_LOG) << "nsid=" << e.attribute(QString::fromLatin1("nsid"));
+-                        qCDebug(KIPIPLUGINS_LOG) << "username=" << e.attribute(QString::fromLatin1("username"));
+-                        qCDebug(KIPIPLUGINS_LOG) << "fullname=" << e.attribute(QString::fromLatin1("fullname"));
+-                        m_username = e.attribute(QString::fromLatin1("username"));
+-                        m_userId   = e.attribute(QString::fromLatin1("nsid"));
+-                    }
+-                }
+-
+-                details = details.nextSibling();
+-            }
+-
+-            success = true;
+-        }
+-        else if (node.isElement() && node.nodeName() == QString::fromLatin1("err"))
+-        {
+-            qCDebug(KIPIPLUGINS_LOG) << "Checking Error in response";
+-            errorString = node.toElement().attribute(QString::fromLatin1("code"));
+-            qCDebug(KIPIPLUGINS_LOG) << "Error code=" << errorString;
+-            qCDebug(KIPIPLUGINS_LOG) << "Msg=" << node.toElement().attribute(QString::fromLatin1("msg"));
+-            //emit signalError(code);
+-        }
+-
+-        node = node.nextSibling();
+-    }
+-
+-    qCDebug(KIPIPLUGINS_LOG) << "GetToken finished";
+-    //emit signalBusy( false );
+     m_authProgressDlg->hide();
+-
+-    if (success)
+-    {
+-        emit signalTokenObtained(m_token);
+-    }
+-    else
+-    {
+-        emit signalError(errorString);
+-    }
+ }
+ 
+ void FlickrTalker::parseResponseCreatePhotoSet(const QByteArray& data)
+@@ -1213,7 +747,7 @@ void FlickrTalker::parseResponseCreatePh
+ 
+     //bool success = false;
+ 
+-    QDomDocument doc(QString::fromLatin1("getListPhotoSets"));
++    QDomDocument doc(QLatin1String("getListPhotoSets"));
+ 
+     if (!doc.setContent(data))
+     {
+@@ -1226,10 +760,10 @@ void FlickrTalker::parseResponseCreatePh
+ 
+     while (!node.isNull())
+     {
+-        if (node.isElement() && node.nodeName() == QString::fromLatin1("photoset"))
++        if (node.isElement() && node.nodeName() == QLatin1String("photoset"))
+         {
+             // Parse the id from the response.
+-            QString new_id = node.toElement().attribute(QString::fromLatin1("id"));
++            QString new_id = node.toElement().attribute(QLatin1String("id"));
+ 
+             // Set the new id in the photo sets list.
+             QLinkedList<FPhotoSet>::iterator it = m_photoSetsList->begin();
+@@ -1252,12 +786,12 @@ void FlickrTalker::parseResponseCreatePh
+             emit signalAddPhotoSetSucceeded();
+         }
+ 
+-        if (node.isElement() && node.nodeName() == QString::fromLatin1("err"))
++        if (node.isElement() && node.nodeName() == QLatin1String("err"))
+         {
+             qCDebug(KIPIPLUGINS_LOG) << "Checking Error in response";
+-            QString code = node.toElement().attribute(QString::fromLatin1("code"));
++            QString code = node.toElement().attribute(QLatin1String("code"));
+             qCDebug(KIPIPLUGINS_LOG) << "Error code=" << code;
+-            QString msg = node.toElement().attribute(QString::fromLatin1("msg"));
++            QString msg = node.toElement().attribute(QLatin1String("msg"));
+             qCDebug(KIPIPLUGINS_LOG) << "Msg=" << msg;
+             QMessageBox::critical(QApplication::activeWindow(), i18n("Error"), i18n("PhotoSet creation failed: ") + msg);
+         }
+@@ -1270,7 +804,7 @@ void FlickrTalker::parseResponseListPhot
+ {
+     qCDebug(KIPIPLUGINS_LOG) << "parseResponseListPhotosets" << data;
+     bool success = false;
+-    QDomDocument doc(QString::fromLatin1("getListPhotoSets"));
++    QDomDocument doc(QLatin1String("getListPhotoSets"));
+ 
+     if (!doc.setContent(data))
+     {
+@@ -1286,7 +820,7 @@ void FlickrTalker::parseResponseListPhot
+ 
+     while (!node.isNull())
+     {
+-        if (node.isElement() && node.nodeName() == QString::fromLatin1("photosets"))
++        if (node.isElement() && node.nodeName() == QLatin1String("photosets"))
+         {
+             e                    = node.toElement();
+             QDomNode details     = e.firstChild();
+@@ -1299,10 +833,10 @@ void FlickrTalker::parseResponseListPhot
+                 {
+                     e = detailsNode.toElement();
+ 
+-                    if (detailsNode.nodeName() == QString::fromLatin1("photoset"))
++                    if (detailsNode.nodeName() == QLatin1String("photoset"))
+                     {
+-                        qCDebug(KIPIPLUGINS_LOG) << "id=" << e.attribute(QString::fromLatin1("id"));
+-                        photoSet_id              = e.attribute(QString::fromLatin1("id"));     // this is what is obtained from data.
++                        qCDebug(KIPIPLUGINS_LOG) << "id=" << e.attribute(QLatin1String("id"));
++                        photoSet_id              = e.attribute(QLatin1String("id"));     // this is what is obtained from data.
+                         fps.id                   = photoSet_id;
+                         QDomNode photoSetDetails = detailsNode.firstChild();
+                         QDomElement e_detail;
+@@ -1311,13 +845,13 @@ void FlickrTalker::parseResponseListPhot
+                         {
+                             e_detail = photoSetDetails.toElement();
+ 
+-                            if (photoSetDetails.nodeName() == QString::fromLatin1("title"))
++                            if (photoSetDetails.nodeName() == QLatin1String("title"))
+                             {
+                                 qCDebug(KIPIPLUGINS_LOG) << "Title=" << e_detail.text();
+                                 photoSet_title = e_detail.text();
+                                 fps.title      = photoSet_title;
+                             }
+-                            else if (photoSetDetails.nodeName() == QString::fromLatin1("description"))
++                            else if (photoSetDetails.nodeName() == QLatin1String("description"))
+                             {
+                                 qCDebug(KIPIPLUGINS_LOG) << "Description =" << e_detail.text();
+                                 photoSet_description = e_detail.text();
+@@ -1338,12 +872,12 @@ void FlickrTalker::parseResponseListPhot
+             success = true;
+         }
+ 
+-        if (node.isElement() && node.nodeName() == QString::fromLatin1("err"))
++        if (node.isElement() && node.nodeName() == QLatin1String("err"))
+         {
+             qCDebug(KIPIPLUGINS_LOG) << "Checking Error in response";
+-            QString code = node.toElement().attribute(QString::fromLatin1("code"));
++            QString code = node.toElement().attribute(QLatin1String("code"));
+             qCDebug(KIPIPLUGINS_LOG) << "Error code=" << code;
+-            qCDebug(KIPIPLUGINS_LOG) << "Msg=" << node.toElement().attribute(QString::fromLatin1("msg"));
++            qCDebug(KIPIPLUGINS_LOG) << "Msg=" << node.toElement().attribute(QLatin1String("msg"));
+             emit signalError(code);
+         }
+ 
+@@ -1365,7 +899,7 @@ void FlickrTalker::parseResponseListPhot
+ 
+ void FlickrTalker::parseResponseListPhotos(const QByteArray& data)
+ {
+-    QDomDocument doc(QString::fromLatin1("getPhotosList"));
++    QDomDocument doc(QLatin1String("getPhotosList"));
+ 
+     if (!doc.setContent(data))
+     {
+@@ -1380,7 +914,7 @@ void FlickrTalker::parseResponseListPhot
+ 
+ void FlickrTalker::parseResponseCreateAlbum(const QByteArray& data)
+ {
+-    QDomDocument doc(QString::fromLatin1("getCreateAlbum"));
++    QDomDocument doc(QLatin1String("getCreateAlbum"));
+ 
+     if (!doc.setContent(data))
+     {
+@@ -1397,7 +931,7 @@ void FlickrTalker::parseResponseAddPhoto
+ {
+     bool    success = false;
+     QString line;
+-    QDomDocument doc(QString::fromLatin1("AddPhoto Response"));
++    QDomDocument doc(QLatin1String("AddPhoto Response"));
+ 
+     if (!doc.setContent(data))
+     {
+@@ -1411,7 +945,7 @@ void FlickrTalker::parseResponseAddPhoto
+ 
+     while (!node.isNull())
+     {
+-        if (node.isElement() && node.nodeName() == QString::fromLatin1("photoid"))
++        if (node.isElement() && node.nodeName() == QLatin1String("photoid"))
+         {
+             e                = node.toElement();           // try to convert the node to an element.
+             QDomNode details = e.firstChild();
+@@ -1420,12 +954,12 @@ void FlickrTalker::parseResponseAddPhoto
+             success          = true;
+         }
+ 
+-        if (node.isElement() && node.nodeName() == QString::fromLatin1("err"))
++        if (node.isElement() && node.nodeName() == QLatin1String("err"))
+         {
+             qCDebug(KIPIPLUGINS_LOG) << "Checking Error in response";
+-            QString code = node.toElement().attribute(QString::fromLatin1("code"));
++            QString code = node.toElement().attribute(QLatin1String("code"));
+             qCDebug(KIPIPLUGINS_LOG) << "Error code=" << code;
+-            qCDebug(KIPIPLUGINS_LOG) << "Msg=" << node.toElement().attribute(QString::fromLatin1("msg"));
++            qCDebug(KIPIPLUGINS_LOG) << "Msg=" << node.toElement().attribute(QLatin1String("msg"));
+             emit signalError(code);
+         }
+ 
+@@ -1440,23 +974,14 @@ void FlickrTalker::parseResponseAddPhoto
+     {
+         QString photoSetId = m_selectedPhotoSet.id;
+ 
+-        if (photoSetId == QString::fromLatin1("-1"))
++        if (photoSetId == QLatin1String("-1"))
+         {
+             qCDebug(KIPIPLUGINS_LOG) << "PhotoSet Id not set, not adding the photo to any photoset";
+             emit signalAddPhotoSucceeded();
+         }
+         else
+         {
+-            if (m_serviceName == QString::fromLatin1("Zooomr"))
+-            {
+-                // addPhotoToPhotoSet not supported by Zooomr (Zooomr only has
+-                // smart folder-type photosets); silently fail
+-                emit signalAddPhotoSucceeded();
+-            }
+-            else
+-            {
+-                addPhotoToPhotoSet(photoId, photoSetId);
+-            }
++            addPhotoToPhotoSet(photoId, photoSetId);
+         }
+     }
+ }
+@@ -1465,7 +990,7 @@ void FlickrTalker::parseResponsePhotoPro
+ {
+     bool         success = false;
+     QString      line;
+-    QDomDocument doc(QString::fromLatin1("Photos Properties"));
++    QDomDocument doc(QLatin1String("Photos Properties"));
+ 
+     if (!doc.setContent(data))
+     {
+@@ -1478,7 +1003,7 @@ void FlickrTalker::parseResponsePhotoPro
+ 
+     while (!node.isNull())
+     {
+-        if (node.isElement() && node.nodeName() == QString::fromLatin1("photoid"))
++        if (node.isElement() && node.nodeName() == QLatin1String("photoid"))
+         {
+             e                = node.toElement();                 // try to convert the node to an element.
+             QDomNode details = e.firstChild();
+@@ -1486,12 +1011,12 @@ void FlickrTalker::parseResponsePhotoPro
+             qCDebug(KIPIPLUGINS_LOG) << "Photoid=" << e.text();
+         }
+ 
+-        if (node.isElement() && node.nodeName() == QString::fromLatin1("err"))
++        if (node.isElement() && node.nodeName() == QLatin1String("err"))
+         {
+             qCDebug(KIPIPLUGINS_LOG) << "Checking Error in response";
+-            QString code = node.toElement().attribute(QString::fromLatin1("code"));
++            QString code = node.toElement().attribute(QLatin1String("code"));
+             qCDebug(KIPIPLUGINS_LOG) << "Error code=" << code;
+-            qCDebug(KIPIPLUGINS_LOG) << "Msg=" << node.toElement().attribute(QString::fromLatin1("msg"));
++            qCDebug(KIPIPLUGINS_LOG) << "Msg=" << node.toElement().attribute(QLatin1String("msg"));
+             emit signalError(code);
+         }
+ 
+Index: digikam-5.3.0/extra/kipi-plugins/flickr/flickrtalker.h
+===================================================================
+--- digikam-5.3.0.orig/extra/kipi-plugins/flickr/flickrtalker.h
++++ digikam-5.3.0/extra/kipi-plugins/flickr/flickrtalker.h
+@@ -1,13 +1,14 @@
+ /* ============================================================
+  *
+- * This file is a part of kipi-plugins project
++ * This file is a part of digiKam project
+  * http://www.digikam.org
+  *
+  * Date        : 2005-07-07
+  * Description : a kipi plugin to export images to Flickr web service
+  *
+  * Copyright (C) 2005-2009 by Vardhman Jain <vardhman at gmail dot com>
+- * Copyright (C) 2009-2016 by Gilles Caulier <caulier dot gilles at gmail dot com>
++ * Copyright (C) 2009-2017 by Gilles Caulier <caulier dot gilles at gmail dot com>
++ * Copyright (C) 2017      by Maik Qualmann <metzpinguin at gmail dot com>
+  *
+  * This program is free software; you can redistribute it
+  * and/or modify it under the terms of the GNU General
+@@ -32,7 +33,6 @@
+ #include <QString>
+ #include <QObject>
+ #include <QNetworkReply>
+-#include <QCryptographicHash>
+ #include <QNetworkAccessManager>
+ 
+ // Libkipi includes
+@@ -42,6 +42,9 @@
+ // Local includes
+ 
+ #include "flickritem.h"
++#include "o1.h"
++#include "o0globals.h"
++#include "o1requestor.h"
+ 
+ class QProgressDialog;
+ 
+@@ -69,10 +72,6 @@ public:
+         FE_LISTPHOTOS,
+         FE_GETPHOTOPROPERTY,
+         FE_ADDPHOTO,
+-        FE_GETFROB,
+-        FE_CHECKTOKEN,
+-        FE_GETTOKEN,
+-        FE_GETAUTHORIZED,
+         FE_CREATEPHOTOSET,
+         FE_ADDPHOTOTOPHOTOSET,
+         FE_GETMAXSIZE
+@@ -83,13 +82,12 @@ public:
+     FlickrTalker(QWidget* const parent, const QString& serviceName);
+     ~FlickrTalker();
+ 
++    void    link();
++    void    unlink();
+     QString getUserName() const;
+     QString getUserId() const;
+     void    maxAllowedFileSize();
+     QString getMaxAllowedFileSize();
+-    void    getFrob();
+-    void    getToken();
+-    void    checkToken(const QString& token);
+     void    getPhotoProperty(const QString& method, const QStringList& argList);
+     void    cancel();
+ 
+@@ -102,7 +100,8 @@ public:
+ 
+     void    addPhotoToPhotoSet(const QString& photoId, const QString& photoSetId);
+     bool    addPhoto(const QString& photoPath, const FPhotoInfo& info,
+-                     bool rescale=false, int maxDim=600, int imageQuality=85);
++                     bool original = false, bool rescale = false,
++                     int maxDim = 600, int imageQuality = 85);
+ 
+ public:
+ 
+@@ -123,8 +122,7 @@ Q_SIGNALS:
+     void signalListPhotoSetsFailed(QString& msg);
+     void signalAddPhotoFailed(const QString& msg);
+     void signalListPhotoSetsFailed(const QString& msg);
+-    void signalAuthenticate();
+-    void signalTokenObtained(const QString& token);
++    void signalLinkingSucceeded();
+ 
+ private:
+ 
+@@ -134,36 +132,32 @@ private:
+     void parseResponseListPhotos(const QByteArray& data);
+     void parseResponseCreateAlbum(const QByteArray& data);
+     void parseResponseAddPhoto(const QByteArray& data);
+-    void parseResponseGetFrob(const QByteArray& data);
+-    void parseResponseGetToken(const QByteArray& data);
+-    void parseResponseCheckToken(const QByteArray& data);
+     void parseResponsePhotoProperty(const QByteArray& data);
+     void parseResponseCreatePhotoSet(const QByteArray& data);
+     void parseResponseAddPhotoToPhotoSet(const QByteArray& data);
+ 
+-    QString getApiSig(const QString& secret, const QUrl& url);
+-
+ private Q_SLOTS:
+ 
++    void slotLinkingFailed();
++    void slotLinkingSucceeded();
++    void slotOpenBrowser(const QUrl& url); 
+     void slotError(const QString& msg);
+-    void slotAuthenticate();
+     void slotFinished(QNetworkReply* reply);
+ 
+ private:
+ 
+     QWidget*               m_parent;
+-//  QString                m_cookie;
+     QByteArray             m_buffer;
+ 
+     QString                m_serviceName;
+     QString                m_apiUrl;
+     QString                m_authUrl;
++    QString                m_tokenUrl;
++    QString                m_accessUrl;
+     QString                m_uploadUrl;
+     QString                m_apikey;
+     QString                m_secret;
+-    QString                m_frob;
+     QString                m_maxSize;
+-    QString                m_token;
+     QString                m_username;
+     QString                m_userId;
+     QString                m_lastTmpFile;
+@@ -174,6 +168,9 @@ private:
+     State                  m_state;
+ 
+     Interface*             m_iface;
++
++    O1*                    m_o1;
++    O1Requestor*           m_requestor;
+ };
+ 
+ } // namespace KIPIFlickrPlugin
+Index: digikam-5.3.0/extra/kipi-plugins/flickr/flickrwidget.cpp
+===================================================================
+--- digikam-5.3.0.orig/extra/kipi-plugins/flickr/flickrwidget.cpp
++++ digikam-5.3.0/extra/kipi-plugins/flickr/flickrwidget.cpp
+@@ -61,7 +61,8 @@ FlickrWidget::FlickrWidget(QWidget* cons
+     //Adding Remove Account button
+     m_removeAccount              = new QPushButton(getAccountBox());
+     m_removeAccount->setText(i18n("Remove Account"));
+-    getAccountBoxLayout()->addWidget(m_removeAccount, 2,0,1,4);
++    m_removeAccount->hide();
++    getAccountBoxLayout()->addWidget(m_removeAccount, 2, 0, 1, 4);
+ 
+     // -- The image list --------------------------------------------------
+ 
+Index: digikam-5.3.0/extra/kipi-plugins/flickr/flickrwindow.cpp
+===================================================================
+--- digikam-5.3.0.orig/extra/kipi-plugins/flickr/flickrwindow.cpp
++++ digikam-5.3.0/extra/kipi-plugins/flickr/flickrwindow.cpp
+@@ -77,10 +77,6 @@ FlickrWindow::FlickrWindow(QWidget* cons
+     {
+         setWindowIcon(QIcon::fromTheme(QString::fromLatin1("kipi-hq")));
+     }
+-    else if (serviceName == QLatin1String("Zooomr"))
+-    {
+-        setWindowIcon(QIcon::fromTheme(QString::fromLatin1("kipi-zooomr")));
+-    }
+     else
+     {
+         setWindowIcon(QIcon::fromTheme(QString::fromLatin1("kipi-flickr")));
+@@ -136,9 +132,9 @@ FlickrWindow::FlickrWindow(QWidget* cons
+     // --------------------------------------------------------------------------
+     // About data and help button.
+ 
+-    KPAboutData* const about = new KPAboutData(ki18n("Flickr/23/Zooomr Export"),
++    KPAboutData* const about = new KPAboutData(ki18n("Flickr/23 Export"),
+                                                ki18n("A tool to export an image collection to a "
+-                                                     "Flickr / 23 / Zooomr web service."),
++                                                     "Flickr / 23 web service."),
+                                                ki18n("(c) 2005-2008, Vardhman Jain\n"
+                                                      "(c) 2008-2015, Gilles Caulier\n"
+                                                      "(c) 2009, Luka Renko\n"
+@@ -181,8 +177,8 @@ FlickrWindow::FlickrWindow(QWidget* cons
+     connect(m_talker, SIGNAL(signalListPhotoSetsFailed(QString)),
+             this, SLOT(slotListPhotoSetsFailed(QString)));
+ 
+-    connect(m_talker, SIGNAL(signalTokenObtained(QString)),
+-            this, SLOT(slotTokenObtained(QString)));
++    connect(m_talker, SIGNAL(signalLinkingSucceeded()),
++            this, SLOT(slotLinkingSucceeded()));
+ 
+     connect(m_widget->progressBar(), SIGNAL(signalProgressCanceled()),
+             this, SLOT(slotAddPhotoCancelAndClose()));
+@@ -304,17 +300,8 @@ void FlickrWindow::slotAddPhotoCancelAnd
+ void FlickrWindow::reactivate()
+ {
+     m_userNameDisplayLabel->setText(QString());
+-    readSettings(m_select->getUname());
+-    qCDebug(KIPIPLUGINS_LOG) << "Calling auth methods";
+-
+-    if (m_token.length() < 1)
+-    {
+-        m_talker->getFrob();
+-    }
+-    else
+-    {
+-        m_talker->checkToken(m_token);
+-    }
++    //readSettings(m_select->getUname());
++    m_talker->link();
+ 
+     m_widget->m_imglst->loadImagesFromCurrentSelection();
+     show();
+@@ -323,10 +310,8 @@ void FlickrWindow::reactivate()
+ void FlickrWindow::readSettings(QString uname)
+ {
+     KConfig config(QString::fromLatin1("kipirc"));
+-    qCDebug(KIPIPLUGINS_LOG) << "Group name is : "<<QString::fromLatin1("%1%2Export Settings").arg(m_serviceName,uname);
+-    KConfigGroup grp = config.group(QString::fromLatin1("%1%2Export Settings").arg(m_serviceName,uname));
+-    m_token          = grp.readEntry("token");
+-    qCDebug(KIPIPLUGINS_LOG) << "Token is : "<<m_token;
++    qCDebug(KIPIPLUGINS_LOG) << "Group name is : "<<QString::fromLatin1("%1%2Export Settings").arg(m_serviceName, uname);
++    KConfigGroup grp = config.group(QString::fromLatin1("%1%2Export Settings").arg(m_serviceName, uname));
+     m_exportHostTagsCheckBox->setChecked(grp.readEntry("Export Host Tags",      false));
+     m_extendedTagsButton->setChecked(grp.readEntry("Show Extended Tag Options", false));
+     m_addExtraTagsCheckBox->setChecked(grp.readEntry("Add Extra Tags",          false));
+@@ -392,16 +377,14 @@ void FlickrWindow::writeSettings()
+     qCDebug(KIPIPLUGINS_LOG) << "Group name is : "<<QString::fromLatin1("%1%2Export Settings").arg(m_serviceName,m_username);
+ 
+     if (QString::compare(QString::fromLatin1("%1Export Settings").arg(m_serviceName),
+-        QString::fromLatin1("%1%2Export Settings").arg(m_serviceName,m_username), Qt::CaseInsensitive) == 0)
++        QString::fromLatin1("%1%2Export Settings").arg(m_serviceName, m_username), Qt::CaseInsensitive) == 0)
+     {
+         qCDebug(KIPIPLUGINS_LOG) << "Not writing entry of group " << QString::fromLatin1("%1%2Export Settings").arg(m_serviceName,m_username);
+         return;
+     }
+ 
+-    KConfigGroup grp = config.group(QString::fromLatin1("%1%2Export Settings").arg(m_serviceName,m_username));
+-    grp.writeEntry("username",m_username);
+-    qCDebug(KIPIPLUGINS_LOG) << "Token written of group "<<QString::fromLatin1("%1%2Export Settings").arg(m_serviceName,m_username)<<" is "<<m_token;
+-    grp.writeEntry("token", m_token);
++    KConfigGroup grp = config.group(QString::fromLatin1("%1%2Export Settings").arg(m_serviceName, m_username));
++    grp.writeEntry("username",                          m_username);
+     grp.writeEntry("Export Host Tags",                  m_exportHostTagsCheckBox->isChecked());
+     grp.writeEntry("Show Extended Tag Options",         m_extendedTagsButton->isChecked());
+     grp.writeEntry("Add Extra Tags",                    m_addExtraTagsCheckBox->isChecked());
+@@ -427,39 +410,31 @@ void FlickrWindow::slotDoLogin()
+ {
+ }
+ 
+-void FlickrWindow::slotTokenObtained(const QString& token)
++void FlickrWindow::slotLinkingSucceeded()
+ {
+-    qCDebug(KIPIPLUGINS_LOG) << "Token Obtained is : "<<token;
+     m_username = m_talker->getUserName();
+     m_userId   = m_talker->getUserId();
+-    qCDebug(KIPIPLUGINS_LOG) << "SlotTokenObtained invoked setting user Display name to " << m_username;
++    qCDebug(KIPIPLUGINS_LOG) << "SlotLinkingSucceeded invoked setting user Display name to " << m_username;
+     m_userNameDisplayLabel->setText(QString::fromLatin1("<b>%1</b>").arg(m_username));
+ 
+     KConfig config(QString::fromLatin1("kipirc"));
+ 
+-    foreach ( const QString& group, config.groupList() )
++    foreach (const QString& group, config.groupList())
+     {
+-        if(!(group.contains(m_serviceName)))
++        if (!(group.contains(m_serviceName)))
+             continue;
+ 
+         KConfigGroup grp = config.group(group);
+ 
+-        if(group.contains(m_username))
++        if (group.contains(m_username))
+         {
+             readSettings(m_username);
+             break;
+         }
+     }
+ 
+-    m_token    = token;
+     writeSettings();
+-
+-    // Mutable photosets are not supported by Zooomr (Zooomr only has smart
+-    // folder-type photosets).
+-    if (m_serviceName != QString::fromLatin1("Zooomr"))
+-    {
+-        m_talker->listPhotoSets();
+-    }
++    m_talker->listPhotoSets();
+ }
+ 
+ void FlickrWindow::slotBusy(bool val)
+@@ -488,18 +463,11 @@ void FlickrWindow::slotUserChangeRequest
+ {
+     writeSettings();
+     qCDebug(KIPIPLUGINS_LOG) << "Slot Change User Request ";
+-    m_select->reactivate();
+-    readSettings(m_select->getUname());
+-    if (m_token.length() < 1)
+-    {
+-        m_talker->getFrob();
+-    }
+-    else
+-    {
+-        m_talker->checkToken(m_token);
+-    }
+-    //m_talker->getFrob();
+-    //  m_addPhotoButton->setEnabled(m_selectImagesButton->isChecked());
++    //m_select->reactivate();
++    //readSettings(m_select->getUname());
++
++     m_talker->unlink();
++     m_talker->link();
+ }
+ 
+ void FlickrWindow::slotRemoveAccount()
+@@ -507,7 +475,7 @@ void FlickrWindow::slotRemoveAccount()
+     KConfig config(QString::fromLatin1("kipirc"));
+     KConfigGroup grp = config.group(QString::fromLatin1("%1%2Export Settings").arg(m_serviceName).arg(m_username));
+ 
+-    if(grp.exists())
++    if (grp.exists())
+     {
+         qCDebug(KIPIPLUGINS_LOG) << "Removing Account having group"<<QString::fromLatin1("%1%2Export Settings").arg(m_serviceName);
+         grp.deleteGroup();
+@@ -545,8 +513,8 @@ QString FlickrWindow::guessSensibleSetNa
+     int totalCount = 0;
+     QString name;
+ 
+-    for(QMap<QString,int>::const_iterator it=nrFolderOccurences.constBegin();
+-        it!=nrFolderOccurences.constEnd(); ++it)
++    for (QMap<QString,int>::const_iterator it=nrFolderOccurences.constBegin();
++         it!=nrFolderOccurences.constEnd(); ++it)
+     {
+         totalCount += it.value();
+ 
+@@ -788,30 +756,25 @@ void FlickrWindow::slotAddPhotoNext()
+     Pair pathComments = m_uploadQueue.first();
+     FPhotoInfo info   = pathComments.second;
+ 
+-    // Find out the selected photo set.
+-    if (m_serviceName != QString::fromLatin1("Zooomr"))
++    QString selectedPhotoSetId = m_albumsListComboBox->itemData(m_albumsListComboBox->currentIndex()).toString();
++
++    if (selectedPhotoSetId.isEmpty())
++    {
++        m_talker->m_selectedPhotoSet = FPhotoSet();
++    }
++    else
+     {
+-        // mutable photosets are not supported by Zooomr (Zooomr only has smart folder-type photosets)
+-        QString selectedPhotoSetId = m_albumsListComboBox->itemData(m_albumsListComboBox->currentIndex()).toString();
++        QLinkedList<FPhotoSet>::iterator it = m_talker->m_photoSetsList->begin();
+ 
+-        if (selectedPhotoSetId.isEmpty())
+-        {
+-            m_talker->m_selectedPhotoSet = FPhotoSet();
+-        }
+-        else
++        while (it != m_talker->m_photoSetsList->end())
+         {
+-            QLinkedList<FPhotoSet>::iterator it = m_talker->m_photoSetsList->begin();
+-
+-            while (it != m_talker->m_photoSetsList->end())
++            if (it->id == selectedPhotoSetId)
+             {
+-                if (it->id == selectedPhotoSetId)
+-                {
+-                    m_talker->m_selectedPhotoSet = *it;
+-                    break;
+-                }
+-
+-                ++it;
++                m_talker->m_selectedPhotoSet = *it;
++                break;
+             }
++
++            ++it;
+         }
+     }
+ 
+Index: digikam-5.3.0/extra/kipi-plugins/flickr/flickrwindow.h
+===================================================================
+--- digikam-5.3.0.orig/extra/kipi-plugins/flickr/flickrwindow.h
++++ digikam-5.3.0/extra/kipi-plugins/flickr/flickrwindow.h
+@@ -95,7 +95,7 @@ public:
+ 
+ private Q_SLOTS:
+ 
+-    void slotTokenObtained(const QString& token);
++    void slotLinkingSucceeded();
+     void slotDoLogin();
+     void slotBusy(bool val);
+     void slotError(const QString& msg);
+@@ -165,7 +165,6 @@ private:
+ 
+ //  QHash<int, GAlbumViewItem>             m_albumDict;
+ 
+-    QString                                m_token;
+     QString                                m_username;
+     QString                                m_userId;
+     QString                                m_lastSelectedAlbum;
+Index: digikam-5.3.0/extra/kipi-plugins/flickr/plugin_flickr.cpp
+===================================================================
+--- digikam-5.3.0.orig/extra/kipi-plugins/flickr/plugin_flickr.cpp
++++ digikam-5.3.0/extra/kipi-plugins/flickr/plugin_flickr.cpp
+@@ -59,33 +59,27 @@ Plugin_Flickr::Plugin_Flickr(QObject* co
+ 
+     m_actionFlickr = 0;
+     m_action23     = 0;
+-    m_actionZooomr = 0;
+ 
+     m_dlgFlickr    = 0;
+     m_dlg23        = 0;
+-    m_dlgZooomr    = 0;
+ 
+     selectFlickr   = 0;
+     select23       = 0;
+-    selectZoomr    = 0;
+ }
+ 
+ Plugin_Flickr::~Plugin_Flickr()
+ {
+     delete m_dlgFlickr;
+     delete m_dlg23;
+-    delete m_dlgZooomr;
+ 
+     delete selectFlickr;
+     delete select23;
+-    delete selectZoomr;
+ }
+ 
+ void Plugin_Flickr::setup(QWidget* const widget)
+ {
+     m_dlgFlickr = 0;
+     m_dlg23     = 0;
+-    m_dlgZooomr = 0;
+ 
+     Plugin::setup(widget);
+ 
+@@ -107,13 +101,13 @@ void Plugin_Flickr::setupActions()
+     m_actionFlickr->setIcon(QIcon::fromTheme(QString::fromLatin1("kipi-flickr")));
+     actionCollection()->setDefaultShortcut(m_actionFlickr, Qt::ALT + Qt::SHIFT + Qt::Key_R);
+ 
+-    selectFlickr = new SelectUserDlg(0,QString::fromLatin1("Flickr"));
++    //selectFlickr = new SelectUserDlg(0,QString::fromLatin1("Flickr"));
+ 
+     connect(m_actionFlickr, SIGNAL(triggered(bool)),
+             this, SLOT(slotActivateFlickr()));
+ 
+     addAction(QString::fromLatin1("flickrexport"), m_actionFlickr);
+-
++/*
+     m_action23 = new QAction(this);
+     m_action23->setText(i18n("Export to &23..."));
+     m_action23->setIcon(QIcon::fromTheme(QString::fromLatin1("kipi-hq")));
+@@ -125,23 +119,12 @@ void Plugin_Flickr::setupActions()
+             this, SLOT(slotActivate23()));
+ 
+     addAction(QString::fromLatin1("23export"), m_action23);
+-
+-    m_actionZooomr = new QAction(this);
+-    m_actionZooomr->setText(i18n("Export to &Zooomr..."));
+-    m_actionZooomr->setIcon(QIcon::fromTheme(QString::fromLatin1("kipi-zooomr")));
+-    actionCollection()->setDefaultShortcut(m_actionZooomr, Qt::ALT + Qt::SHIFT + Qt::Key_Z);
+-
+-    selectZoomr = new SelectUserDlg(0,QString::fromLatin1("Zooomr"));
+-
+-    connect(m_actionZooomr, SIGNAL(triggered(bool)),
+-            this, SLOT(slotActivateZooomr()));
+-
+-    addAction(QString::fromLatin1("Zooomrexport"), m_actionZooomr);
++*/
+ }
+ 
+ void Plugin_Flickr::slotActivateFlickr()
+ {
+-    selectFlickr->reactivate();
++    //selectFlickr->reactivate();
+ 
+     if (!m_dlgFlickr)
+     {
+@@ -183,28 +166,6 @@ void Plugin_Flickr::slotActivate23()
+     m_dlg23->reactivate();
+ }
+ 
+-void Plugin_Flickr::slotActivateZooomr()
+-{
+-    selectZoomr->reactivate();
+-
+-    if (!m_dlgZooomr)
+-    {
+-        // We clean it up in the close button
+-        m_dlgZooomr = new FlickrWindow(QApplication::activeWindow(), QString::fromLatin1("Zooomr"), selectZoomr);
+-    }
+-    else
+-    {
+-        if (m_dlgZooomr->isMinimized())
+-        {
+-            KWindowSystem::unminimizeWindow(m_dlgZooomr->winId());
+-        }
+-
+-        KWindowSystem::activateWindow(m_dlgZooomr->winId());
+-    }
+-
+-    m_dlgZooomr->reactivate();
+-}
+-
+ } // namespace KIPIFlickrPlugin
+ 
+ #include "plugin_flickr.moc"
+Index: digikam-5.3.0/extra/kipi-plugins/flickr/plugin_flickr.h
+===================================================================
+--- digikam-5.3.0.orig/extra/kipi-plugins/flickr/plugin_flickr.h
++++ digikam-5.3.0/extra/kipi-plugins/flickr/plugin_flickr.h
+@@ -56,7 +56,6 @@ public Q_SLOTS:
+ 
+     void slotActivateFlickr();
+     void slotActivate23();
+-    void slotActivateZooomr();
+ 
+ private:
+ 
+@@ -66,15 +65,12 @@ private:
+ 
+     QAction*       m_actionFlickr;
+     QAction*       m_action23;
+-    QAction*       m_actionZooomr;
+ 
+     FlickrWindow*  m_dlgFlickr;
+     FlickrWindow*  m_dlg23;
+-    FlickrWindow*  m_dlgZooomr;
+ 
+     SelectUserDlg* selectFlickr;
+     SelectUserDlg* select23;
+-    SelectUserDlg* selectZoomr;
+ };
+ 
+ } //namespace KIPIFlickrPlugin
diff -durN orig/digikam-5.3.0/debian/patches/flickr.diff~ digikam-5.3.0/debian/patches/flickr.diff~
--- orig/digikam-5.3.0/debian/patches/flickr.diff~	1969-12-31 18:00:00.000000000 -0600
+++ digikam-5.3.0/debian/patches/flickr.diff~	2017-09-07 10:05:36.067808539 -0500
@@ -0,0 +1,1895 @@
+Index: digikam-5.3.0/extra/kipi-plugins/common/libkipiplugins/CMakeLists.txt
+===================================================================
+--- digikam-5.3.0.orig/extra/kipi-plugins/common/libkipiplugins/CMakeLists.txt
++++ digikam-5.3.0/extra/kipi-plugins/common/libkipiplugins/CMakeLists.txt
+@@ -54,9 +54,9 @@ set(o2_SRCS
+     ${CMAKE_CURRENT_SOURCE_DIR}/o2/src/o0abstractstore.h
+     ${CMAKE_CURRENT_SOURCE_DIR}/o2/src/o0globals.h
+     # Enable when needed
+-    #${CMAKE_CURRENT_SOURCE_DIR}/o2/src/o1.cpp
+-    #${CMAKE_CURRENT_SOURCE_DIR}/o2/src/o1requestor.cpp
+-    #${CMAKE_CURRENT_SOURCE_DIR}/o2/src/o1timedreply.cpp
++    ${CMAKE_CURRENT_SOURCE_DIR}/o2/src/o1.cpp
++    ${CMAKE_CURRENT_SOURCE_DIR}/o2/src/o1requestor.cpp
++    ${CMAKE_CURRENT_SOURCE_DIR}/o2/src/o1timedreply.cpp
+     #${CMAKE_CURRENT_SOURCE_DIR}/o2/src/o1twitter.h
+     #${CMAKE_CURRENT_SOURCE_DIR}/o2/src/oxtwitter.cpp
+     #${CMAKE_CURRENT_SOURCE_DIR}/o2/src/o1dropbox.h
+Index: digikam-5.3.0/extra/kipi-plugins/flickr/flickrtalker.cpp
+===================================================================
+--- digikam-5.3.0.orig/extra/kipi-plugins/flickr/flickrtalker.cpp
++++ digikam-5.3.0/extra/kipi-plugins/flickr/flickrtalker.cpp
+@@ -1,13 +1,14 @@
+ /* ============================================================
+  *
+- * This file is a part of kipi-plugins project
++ * This file is a part of digiKam project
+  * http://www.digikam.org
+  *
+  * Date        : 2005-07-07
+  * Description : a kipi plugin to export images to Flickr web service
+  *
+  * Copyright (C) 2005-2009 by Vardhman Jain <vardhman at gmail dot com>
+- * Copyright (C) 2009-2016 by Gilles Caulier <caulier dot gilles at gmail dot com>
++ * Copyright (C) 2009-2017 by Gilles Caulier <caulier dot gilles at gmail dot com>
++ * Copyright (C) 2017      by Maik Qualmann <metzpinguin at gmail dot com>
+  *
+  * This program is free software; you can redistribute it
+  * and/or modify it under the terms of the GNU General
+@@ -34,7 +35,6 @@
+ #include <QMap>
+ #include <QStringList>
+ #include <QProgressDialog>
+-#include <QUrlQuery>
+ #include <QStandardPaths>
+ #include <QApplication>
+ #include <QDesktopServices>
+@@ -68,6 +68,8 @@ FlickrTalker::FlickrTalker(QWidget* cons
+     m_state           = FE_LOGOUT;
+     m_serviceName     = serviceName;
+     m_iface           = 0;
++    m_o1              = 0;
++    m_requestor       = 0;
+ 
+     PluginLoader* const pl = PluginLoader::instance();
+ 
+@@ -76,34 +78,27 @@ FlickrTalker::FlickrTalker(QWidget* cons
+         m_iface = pl->interface();
+     }
+ 
+-    if (serviceName == QString::fromLatin1("23"))
++    if (serviceName == QLatin1String("23"))
+     {
+-        m_apiUrl    = QString::fromLatin1("http://www.23hq.com/services/rest/");
+-        m_authUrl   = QString::fromLatin1("http://www.23hq.com/services/auth/");
+-        m_uploadUrl = QString::fromLatin1("http://www.23hq.com/services/upload/");
++        m_apiUrl    = QLatin1String("http://www.23hq.com/services/rest/");
++        m_authUrl   = QLatin1String("http://www.23hq.com/services/auth/");
++        m_uploadUrl = QLatin1String("http://www.23hq.com/services/upload/");
+ 
+         // bshanks: do 23 and flickr really share API keys? or does 23 not need
+         // one?
+-        m_apikey    = QString::fromLatin1("49d585bafa0758cb5c58ab67198bf632");
+-        m_secret    = QString::fromLatin1("34b39925e6273ffd");
+-    }
+-    else if (serviceName == QString::fromLatin1("Zooomr"))
+-    {
+-        m_apiUrl    = QString::fromLatin1("http://api.zooomr.com/services/rest/");
+-        m_authUrl   = QString::fromLatin1("http://www.zooomr.com/services/auth/");
+-        m_uploadUrl = QString::fromLatin1("http://upload.zooomr.com/services/upload/");
+-
+-        m_apikey    = QString::fromLatin1("18c8db5ce9ed4e15a7b484136f5080c5");
+-        m_secret    = QString::fromLatin1("1ea4af14e3");
++        m_apikey    = QLatin1String("49d585bafa0758cb5c58ab67198bf632");
++        m_secret    = QLatin1String("34b39925e6273ffd");
+     }
+     else
+     {
+-        m_apiUrl    = QString::fromLatin1("https://www.flickr.com/services/rest/");
+-        m_authUrl   = QString::fromLatin1("https://www.flickr.com/services/auth/");
+-        m_uploadUrl = QString::fromLatin1("https://api.flickr.com/services/upload/");
++        m_apiUrl    = QLatin1String("https://www.flickr.com/services/rest/");
++        m_authUrl   = QLatin1String("https://www.flickr.com/services/oauth/authorize?perms=write");
++        m_tokenUrl  = QLatin1String("https://www.flickr.com/services/oauth/request_token");
++        m_accessUrl = QLatin1String("https://www.flickr.com/services/oauth/access_token");
++        m_uploadUrl = QLatin1String("https://up.flickr.com/services/upload/");
+ 
+-        m_apikey    = QString::fromLatin1("49d585bafa0758cb5c58ab67198bf632");
+-        m_secret    = QString::fromLatin1("34b39925e6273ffd");
++        m_apikey    = QLatin1String("49d585bafa0758cb5c58ab67198bf632");
++        m_secret    = QLatin1String("34b39925e6273ffd");
+     }
+ 
+     m_netMngr = new QNetworkAccessManager(this);
+@@ -116,8 +111,24 @@ FlickrTalker::FlickrTalker(QWidget* cons
+     /* Initialize photo sets list. */
+     m_photoSetsList    = new QLinkedList<FPhotoSet>();
+ 
+-    connect(this, SIGNAL(signalAuthenticate()),
+-            this, SLOT(slotAuthenticate()));
++    m_o1 = new O1(this);
++
++    m_o1->setClientId(m_apikey);
++    m_o1->setClientSecret(m_secret);
++    m_o1->setAuthorizeUrl(QUrl(m_authUrl));
++    m_o1->setAccessTokenUrl(QUrl(m_accessUrl));
++    m_o1->setRequestTokenUrl(QUrl(m_tokenUrl));
++
++    connect(m_o1, SIGNAL(linkingFailed()),
++            this, SLOT(slotLinkingFailed()));
++
++    connect(m_o1, SIGNAL(linkingSucceeded()),
++            this, SLOT(slotLinkingSucceeded()));
++
++    connect(m_o1, SIGNAL(openBrowser(QUrl)),
++            this, SLOT(slotOpenBrowser(QUrl)));
++
++    m_requestor = new O1Requestor(m_netMngr, m_o1, this);
+ }
+ 
+ FlickrTalker::~FlickrTalker()
+@@ -132,144 +143,51 @@ FlickrTalker::~FlickrTalker()
+     removeTemporaryDir(m_serviceName.toLatin1().constData());
+ }
+ 
+-/** Compute MD5 signature using url queries keys and values following Flickr notice:
+-    http://www.flickr.com/services/api/auth.spec.html
+-*/
+-QString FlickrTalker::getApiSig(const QString& secret, const QUrl& url)
++void FlickrTalker::link()
+ {
+-    QUrlQuery urlQuery(url.query());
+-    QList<QPair<QString, QString> > temp_queries = urlQuery.queryItems();
+-    QMap<QString, QString> queries;
+-
+-    QPair<QString, QString> pair;
+-
+-    foreach(pair, temp_queries)
+-    {
+-        queries.insert(pair.first,pair.second);
+-    }
+-
+-    QString compressed(secret);
+-
+-    // NOTE: iterator QMap iterator will sort alphabetically items based on key values.
+-    for (QMap<QString, QString>::iterator it = queries.begin() ; it != queries.end(); ++it)
+-    {
+-        compressed.append(it.key());
+-        compressed.append(it.value());
+-    }
++    emit signalBusy(true);
++    m_o1->link();
++}
+ 
+-    QCryptographicHash context(QCryptographicHash::Md5);
+-    context.addData(compressed.toUtf8());
+-    return QLatin1String(context.result().toHex().data());
++void FlickrTalker::unLink()
++{
++    m_o1->unlink();
+ }
+ 
+-QString FlickrTalker::getMaxAllowedFileSize()
++void FlickrTalker::slotLinkingFailed()
+ {
+-    return m_maxSize;
++    qCDebug(KIPIPLUGINS_LOG) << "LINK to Fickr fail";
++    emit signalBusy(false);
+ }
+ 
+-void FlickrTalker::maxAllowedFileSize()
++void FlickrTalker::slotLinkingSucceeded()
+ {
+-    if (m_reply)
++    if (!m_o1->linked())
+     {
+-        m_reply->abort();
+-        m_reply = 0;
++        qCDebug(KIPIPLUGINS_LOG) << "UNLINK to Fickr ok";
++        return;
+     }
+ 
+-    QUrl url(m_apiUrl);
+-    QUrlQuery urlQuery;
+-    urlQuery.addQueryItem(QString::fromLatin1("auth_token"), m_token);
+-    urlQuery.addQueryItem(QString::fromLatin1("api_key"), m_apikey);
+-    urlQuery.addQueryItem(QString::fromLatin1("method"), QString::fromLatin1("flickr.people.getLimits"));
+-    url.setQuery(urlQuery);
+-    QString md5 = getApiSig(m_secret, url);
+-    urlQuery.addQueryItem(QString::fromLatin1("api_sig"), md5);
+-    url.setQuery(urlQuery);
+-    qCDebug(KIPIPLUGINS_LOG) << "Get max file size url: " << url;
+-
+-    if (m_serviceName == QString::fromLatin1("Zooomr"))
+-    {
+-        // Zooomr redirects the POST at this url to a GET.
+-        m_reply = m_netMngr->get(QNetworkRequest(url));
+-    }
+-    else
+-    {
+-        QNetworkRequest netRequest(url);
+-        netRequest.setHeader(QNetworkRequest::ContentTypeHeader, QLatin1String("application/x-www-form-urlencoded"));
++    qCDebug(KIPIPLUGINS_LOG) << "LINK to Fickr ok";
+ 
+-        m_reply = m_netMngr->post(netRequest, QByteArray());
+-    }
++    m_username = m_o1->extraTokens()[QLatin1String("username")].toString();
++    m_userId   = m_o1->extraTokens()[QLatin1String("user_nsid")].toString();
+ 
+-    m_state = FE_GETMAXSIZE;
+-    m_authProgressDlg->setLabelText(i18n("Getting the maximum allowed file size."));
+-    m_authProgressDlg->setMaximum(4);
+-    m_authProgressDlg->setValue(1);
+-    m_buffer.resize(0);
+-    emit signalBusy(true);
++    emit signalLinkingSucceeded();
+ }
+ 
+-// MD5 signature of the request.
+-/*
+-QString FlickrTalker::getApiSig(const QString& secret, const QStringList &headers)
++void FlickrTalker::slotOpenBrowser(const QUrl& url)
+ {
+-    QMap<QString, QString> queries = url.queryItems();
+-    QString compressed(secret);
+-
+-    // NOTE: iterator QMap iterator will sort alphabetically items based on key values.
+-    for (QMap<QString, QString>::iterator it = queries.begin() ; it != queries.end(); ++it)
+-    {
+-        compressed.append(it.key());
+-        compressed.append(it.value());
+-    }
+-
+-    QCryptographicHash context(QCryptographicHash::Md5);
+-    context.addData(compressed.toUtf8());
+-    return context.result().toHex().data();
++    qCDebug(KIPIPLUGINS_LOG) << "Open Browser...";
++    QDesktopServices::openUrl(url);
+ }
+-*/
+ 
+-/**get the API sig and send it to the server server should return a frob.
+-*/
+-void FlickrTalker::getFrob()
++QString FlickrTalker::getMaxAllowedFileSize()
+ {
+-    if (m_reply)
+-    {
+-        m_reply->abort();
+-        m_reply = 0;
+-    }
+-
+-    QUrl url(m_apiUrl);
+-    QUrlQuery urlQuery;
+-    urlQuery.addQueryItem(QString::fromLatin1("method"), QString::fromLatin1("flickr.auth.getFrob"));
+-    urlQuery.addQueryItem(QString::fromLatin1("api_key"), m_apikey);
+-    url.setQuery(urlQuery);
+-
+-    QString md5 = getApiSig(m_secret, url);
+-    urlQuery.addQueryItem(QString::fromLatin1("api_sig"), md5);
+-    url.setQuery(urlQuery);
+-    qCDebug(KIPIPLUGINS_LOG) << "Get frob url: " << url;
+-
+-    if (m_serviceName == QString::fromLatin1("Zooomr"))
+-    {
+-        // Zooomr redirects the POST at this url to a GET.
+-        m_reply = m_netMngr->get(QNetworkRequest(url));
+-    }
+-    else
+-    {
+-        QNetworkRequest netRequest(url);
+-        netRequest.setHeader(QNetworkRequest::ContentTypeHeader, QLatin1String("application/x-www-form-urlencoded"));
+-
+-        m_reply = m_netMngr->post(netRequest, QByteArray());
+-    }
+-
+-    m_state = FE_GETFROB;
+-    m_authProgressDlg->setLabelText(i18n("Getting the Frob"));
+-    m_authProgressDlg->setMaximum(4);
+-    m_authProgressDlg->setValue(1);
+-    m_buffer.resize(0);
+-    emit signalBusy(true);
++    return m_maxSize;
+ }
+ 
+-void FlickrTalker::checkToken(const QString& token)
++void FlickrTalker::maxAllowedFileSize()
+ {
+     if (m_reply)
+     {
+@@ -277,39 +195,30 @@ void FlickrTalker::checkToken(const QStr
+         m_reply = 0;
+     }
+ 
++    if (!m_o1->linked())
++        return;
++
+     QUrl url(m_apiUrl);
+-    QUrlQuery urlQuery;
+-    urlQuery.addQueryItem(QString::fromLatin1("method"), QString::fromLatin1("flickr.auth.checkToken"));
+-    urlQuery.addQueryItem(QString::fromLatin1("api_key"), m_apikey);
+-    urlQuery.addQueryItem(QString::fromLatin1("auth_token"), token);
+-    url.setQuery(urlQuery);
+-    QString md5 = getApiSig(m_secret, url);
+-    urlQuery.addQueryItem(QString::fromLatin1("api_sig"), md5);
+-    url.setQuery(urlQuery);
+-    qCDebug(KIPIPLUGINS_LOG) << "Check token url: " << url;
++    QNetworkRequest netRequest(url);
++    QList<O0RequestParameter> reqParams = QList<O0RequestParameter>();
+ 
+-    if (m_serviceName == QString::fromLatin1("Zooomr"))
+-    {
+-        // Zooomr redirects the POST at this url to a GET.
+-        m_reply = m_netMngr->get(QNetworkRequest(url));
+-    }
+-    else
+-    {
+-        QNetworkRequest netRequest(url);
+-        netRequest.setHeader(QNetworkRequest::ContentTypeHeader, QLatin1String("application/x-www-form-urlencoded"));
++    netRequest.setHeader(QNetworkRequest::ContentTypeHeader, QLatin1String(O2_MIME_TYPE_XFORM));
+ 
+-        m_reply = m_netMngr->post(netRequest, QByteArray());
+-    }
++    reqParams << O0RequestParameter("method", "flickr.people.getLimits");
++
++    QByteArray postData = O1::createQueryParameters(reqParams);
+ 
+-    m_state = FE_CHECKTOKEN;
+-    m_authProgressDlg->setLabelText(i18n("Checking if previous token is still valid"));
++    m_reply = m_requestor->post(netRequest, reqParams, postData);
++
++    m_state = FE_GETMAXSIZE;
++    m_authProgressDlg->setLabelText(i18n("Getting the maximum allowed file size."));
+     m_authProgressDlg->setMaximum(4);
+     m_authProgressDlg->setValue(1);
+     m_buffer.resize(0);
+     emit signalBusy(true);
+ }
+ 
+-void FlickrTalker::slotAuthenticate()
++void FlickrTalker::listPhotoSets()
+ {
+     if (m_reply)
+     {
+@@ -317,116 +226,22 @@ void FlickrTalker::slotAuthenticate()
+         m_reply = 0;
+     }
+ 
+-    QUrl url(m_authUrl);
+-    QUrlQuery urlQuery;
+-    urlQuery.addQueryItem(QString::fromLatin1("api_key"), m_apikey);
+-    urlQuery.addQueryItem(QString::fromLatin1("frob"), m_frob);
+-    urlQuery.addQueryItem(QString::fromLatin1("perms"), QString::fromLatin1("write"));
+-    url.setQuery(urlQuery);
+-
+-    QString md5 = getApiSig(m_secret, url);
+-    urlQuery.addQueryItem(QString::fromLatin1("api_sig"), md5);
+-    url.setQuery(urlQuery);
+-    qCDebug(KIPIPLUGINS_LOG) << "Authenticate url: " << url;
+-
+-    QDesktopServices::openUrl(url);
+-
+-    QMessageBox quest(QMessageBox::Question,
+-                      i18n("%1 Service Web Authorization", m_serviceName),
+-                      i18n("Please follow the instructions in the browser window, then "
+-                           "return to press corresponding button."),
+-                      QMessageBox::Yes | QMessageBox::No);
+-
+-    (quest.button(QMessageBox::Yes))->setText(i18n("I am authenticated"));
+-    (quest.button(QMessageBox::No))->setText(i18n("I am not authenticated"));
+-
+-    if (quest.exec() == QMessageBox::Yes)
+-    {
+-        getToken();
+-        m_authProgressDlg->setLabelText(i18n("Authenticating the User on web"));
+-        m_authProgressDlg->setMaximum(4);
+-        m_authProgressDlg->setValue(2);
+-        emit signalBusy(false);
+-    }
+-    else
+-    {
+-        qCDebug(KIPIPLUGINS_LOG) << "User didn't proceed with getToken Authorization, cannot proceed further, aborting";
+-        cancel();
+-    }
+-}
++    if (!m_o1->linked())
++        return;
+ 
+-void FlickrTalker::getToken()
+-{
+-    if (m_reply)
+-    {
+-        m_reply->abort();
+-        m_reply = 0;
+-    }
++    qCDebug(KIPIPLUGINS_LOG) << "List photoset invoked";
+ 
+     QUrl url(m_apiUrl);
+-    QUrlQuery urlQuery;
+-    urlQuery.addQueryItem(QString::fromLatin1("api_key"), m_apikey);
+-    urlQuery.addQueryItem(QString::fromLatin1("method"), QString::fromLatin1("flickr.auth.getToken"));
+-    urlQuery.addQueryItem(QString::fromLatin1("frob"), m_frob);
+-    url.setQuery(urlQuery);
+-    QString md5 = getApiSig(m_secret, url);
+-    urlQuery.addQueryItem(QString::fromLatin1("api_sig"), md5);
+-    url.setQuery(urlQuery);
+-    qCDebug(KIPIPLUGINS_LOG) << "Get token url: " << url;
++    QNetworkRequest netRequest(url);
++    QList<O0RequestParameter> reqParams = QList<O0RequestParameter>();
+ 
+-    if (m_serviceName == QString::fromLatin1("Zooomr"))
+-    {
+-        // Zooomr redirects the POST at this url to a GET.
+-        m_reply = m_netMngr->get(QNetworkRequest(url));
+-    }
+-    else
+-    {
+-        QNetworkRequest netRequest(url);
+-        netRequest.setHeader(QNetworkRequest::ContentTypeHeader, QLatin1String("application/x-www-form-urlencoded"));
++    netRequest.setHeader(QNetworkRequest::ContentTypeHeader, QLatin1String(O2_MIME_TYPE_XFORM));
+ 
+-        m_reply = m_netMngr->post(netRequest, QByteArray());
+-    }
++    reqParams << O0RequestParameter("method", "flickr.photosets.getList");
+ 
+-    m_state = FE_GETTOKEN;
+-    m_buffer.resize(0);
+-    emit signalBusy(true);
+-    m_authProgressDlg->setLabelText(i18n("Getting the Token from the server"));
+-    m_authProgressDlg->setMaximum(4);
+-    m_authProgressDlg->setValue(3);
+-}
++    QByteArray postData = O1::createQueryParameters(reqParams);
+ 
+-void FlickrTalker::listPhotoSets()
+-{
+-    if (m_reply)
+-    {
+-        m_reply->abort();
+-        m_reply = 0;
+-    }
+-
+-    qCDebug(KIPIPLUGINS_LOG) << "List photoset invoked";
+-    QUrl url(m_apiUrl);
+-    QUrlQuery urlQuery;
+-    urlQuery.addQueryItem(QString::fromLatin1("auth_token"), m_token);
+-    urlQuery.addQueryItem(QString::fromLatin1("api_key"), m_apikey);
+-    urlQuery.addQueryItem(QString::fromLatin1("method"), QString::fromLatin1("flickr.photosets.getList"));
+-    url.setQuery(urlQuery);
+-    QString md5 = getApiSig(m_secret, url);
+-    urlQuery.addQueryItem(QString::fromLatin1("api_sig"), md5);
+-    url.setQuery(urlQuery);
+-    qCDebug(KIPIPLUGINS_LOG) << "List photoset URL" << url;
+-
+-    if (m_serviceName == QString::fromLatin1("Zooomr"))
+-    {
+-        // Zooomr redirects the POST at this url to a GET.
+-        m_reply = m_netMngr->get(QNetworkRequest(url));
+-    }
+-    else
+-    {
+-        QNetworkRequest netRequest(url);
+-        netRequest.setHeader(QNetworkRequest::ContentTypeHeader, QLatin1String("application/x-www-form-urlencoded"));
+-
+-        m_reply = m_netMngr->post(netRequest, QByteArray());
+-    }
++    m_reply = m_requestor->post(netRequest, reqParams, postData);
+ 
+     m_state = FE_LISTPHOTOSETS;
+     m_buffer.resize(0);
+@@ -441,43 +256,30 @@ void FlickrTalker::getPhotoProperty(cons
+         m_reply = 0;
+     }
+ 
++    if (!m_o1->linked())
++        return;
++
+     QUrl url(m_apiUrl);
+-    QUrlQuery urlQuery;
+-    urlQuery.addQueryItem(QString::fromLatin1("api_key"), m_apikey);
+-    urlQuery.addQueryItem(QString::fromLatin1("method"), method);
+-    urlQuery.addQueryItem(QString::fromLatin1("frob"), m_frob);
++    QNetworkRequest netRequest(url);
++    QList<O0RequestParameter> reqParams = QList<O0RequestParameter>();
++
++    netRequest.setHeader(QNetworkRequest::ContentTypeHeader, QLatin1String(O2_MIME_TYPE_XFORM));
++
++    reqParams << O0RequestParameter("method", method.toLatin1());
+ 
+     for (QStringList::const_iterator it = argList.constBegin(); it != argList.constEnd(); ++it)
+     {
+         QStringList str = (*it).split(QLatin1Char('='), QString::SkipEmptyParts);
+-        urlQuery.addQueryItem(str[0], str[1]);
++        reqParams << O0RequestParameter(str[0].toLatin1(), str[1].toLatin1());
+     }
+ 
+-    url.setQuery(urlQuery);
+-    QString md5 = getApiSig(m_secret, url);
+-    urlQuery.addQueryItem(QString::fromLatin1("api_sig"), md5);
+-    url.setQuery(urlQuery);
+-    qCDebug(KIPIPLUGINS_LOG) << "Get photo property url: " << url;
+-
+-    if (m_serviceName == QString::fromLatin1("Zooomr"))
+-    {
+-        // Zooomr redirects the POST at this url to a GET.
+-        m_reply = m_netMngr->get(QNetworkRequest(url));
+-    }
+-    else
+-    {
+-        QNetworkRequest netRequest(url);
+-        netRequest.setHeader(QNetworkRequest::ContentTypeHeader, QLatin1String("application/x-www-form-urlencoded"));
++    QByteArray postData = O1::createQueryParameters(reqParams);
+ 
+-        m_reply = m_netMngr->post(netRequest, QByteArray());
+-    }
++    m_reply = m_requestor->post(netRequest, reqParams, postData);
+ 
+     m_state = FE_GETPHOTOPROPERTY;
+     m_buffer.resize(0);
+     emit signalBusy(true);
+-
+-    //  m_authProgressDlg->setLabelText("Getting the Token from the server");
+-    //  m_authProgressDlg->setProgress(3,4);
+ }
+ 
+ void FlickrTalker::listPhotos(const QString& /*albumName*/)
+@@ -494,34 +296,25 @@ void FlickrTalker::createPhotoSet(const
+         m_reply = 0;
+     }
+ 
+-    qCDebug(KIPIPLUGINS_LOG) << "create photoset invoked";
++    if (!m_o1->linked())
++        return;
++
++    qCDebug(KIPIPLUGINS_LOG) << "Create photoset invoked";
++
+     QUrl url(m_apiUrl);
+-    QUrlQuery urlQuery;
+-    urlQuery.addQueryItem(QString::fromLatin1("auth_token"), m_token);
+-    urlQuery.addQueryItem(QString::fromLatin1("api_key"), m_apikey);
+-    urlQuery.addQueryItem(QString::fromLatin1("method"), QString::fromLatin1("flickr.photosets.create"));
+-    urlQuery.addQueryItem(QString::fromLatin1("title"), albumTitle);
+-    urlQuery.addQueryItem(QString::fromLatin1("description"), albumDescription);
+-    urlQuery.addQueryItem(QString::fromLatin1("primary_photo_id"), primaryPhotoId);
+-    url.setQuery(urlQuery);
+-
+-    QString md5 = getApiSig(m_secret, url);
+-    urlQuery.addQueryItem(QString::fromLatin1("api_sig"), md5);
+-    url.setQuery(urlQuery);
+-    qCDebug(KIPIPLUGINS_LOG) << "List photo sets url: " << url;
++    QNetworkRequest netRequest(url);
++    QList<O0RequestParameter> reqParams = QList<O0RequestParameter>();
+ 
+-    if (m_serviceName == QString::fromLatin1("Zooomr"))
+-    {
+-        // Zooomr redirects the POST at this url to a GET.
+-        m_reply = m_netMngr->get(QNetworkRequest(url));
+-    }
+-    else
+-    {
+-        QNetworkRequest netRequest(url);
+-        netRequest.setHeader(QNetworkRequest::ContentTypeHeader, QLatin1String("application/x-www-form-urlencoded"));
++    netRequest.setHeader(QNetworkRequest::ContentTypeHeader, QLatin1String(O2_MIME_TYPE_XFORM));
+ 
+-        m_reply = m_netMngr->post(netRequest, QByteArray());
+-    }
++    reqParams << O0RequestParameter("method", "flickr.photosets.create");
++    reqParams << O0RequestParameter("title", albumTitle.toLatin1());
++    reqParams << O0RequestParameter("description", albumDescription.toLatin1());
++    reqParams << O0RequestParameter("primary_photo_id", primaryPhotoId.toLatin1());
++
++    QByteArray postData = O1::createQueryParameters(reqParams);
++
++    m_reply = m_requestor->post(netRequest, reqParams, postData);
+ 
+     m_state = FE_CREATEPHOTOSET;
+     m_buffer.resize(0);
+@@ -537,9 +330,10 @@ void FlickrTalker::addPhotoToPhotoSet(co
+         m_reply = 0;
+     }
+ 
+-    qCDebug(KIPIPLUGINS_LOG) << "addPhotoToPhotoSet invoked";
+-    QUrl url(m_apiUrl);
+-    QUrlQuery urlQuery;
++    if (!m_o1->linked())
++        return;
++
++    qCDebug(KIPIPLUGINS_LOG) << "AddPhotoToPhotoSet invoked";
+ 
+     /* If the photoset id starts with the special string "UNDEFINED_", it means
+      * it doesn't exist yet on Flickr and needs to be created. Note that it's
+@@ -547,26 +341,23 @@ void FlickrTalker::addPhotoToPhotoSet(co
+      * is done in the set creation call to Flickr. */
+     if (photoSetId.startsWith(QLatin1String("UNDEFINED_")))
+     {
+-        createPhotoSet(QString::fromLatin1(""), m_selectedPhotoSet.title, m_selectedPhotoSet.description, photoId);
++        createPhotoSet(QLatin1String(""), m_selectedPhotoSet.title, m_selectedPhotoSet.description, photoId);
+     }
+     else
+     {
+-        urlQuery.addQueryItem(QString::fromLatin1("auth_token"), m_token);
+-        urlQuery.addQueryItem(QString::fromLatin1("photoset_id"), photoSetId);
+-        urlQuery.addQueryItem(QString::fromLatin1("api_key"), m_apikey);
+-        urlQuery.addQueryItem(QString::fromLatin1("method"), QString::fromLatin1("flickr.photosets.addPhoto"));
+-        urlQuery.addQueryItem(QString::fromLatin1("photo_id"), photoId);
+-        url.setQuery(urlQuery);
+-
+-        QString md5 = getApiSig(m_secret, url);
+-        urlQuery.addQueryItem(QString::fromLatin1("api_sig"), md5);
+-        url.setQuery(urlQuery);
+-        qCDebug(KIPIPLUGINS_LOG) << "Add photo to Photo set url: " << url;
+-
++        QUrl url(m_apiUrl);
+         QNetworkRequest netRequest(url);
+-        netRequest.setHeader(QNetworkRequest::ContentTypeHeader, QLatin1String("application/x-www-form-urlencoded"));
++        QList<O0RequestParameter> reqParams = QList<O0RequestParameter>();
++
++        netRequest.setHeader(QNetworkRequest::ContentTypeHeader, QLatin1String(O2_MIME_TYPE_XFORM));
+ 
+-        m_reply = m_netMngr->post(netRequest, QByteArray());
++        reqParams << O0RequestParameter("method", "flickr.photosets.addPhoto");
++        reqParams << O0RequestParameter("photoset_id", photoSetId.toLatin1());
++        reqParams << O0RequestParameter("photo_id", photoId.toLatin1());
++
++        QByteArray postData = O1::createQueryParameters(reqParams);
++
++        m_reply = m_requestor->post(netRequest, reqParams, postData);
+ 
+         m_state = FE_ADDPHOTOTOPHOTOSET;
+         m_buffer.resize(0);
+@@ -575,7 +366,7 @@ void FlickrTalker::addPhotoToPhotoSet(co
+ }
+ 
+ bool FlickrTalker::addPhoto(const QString& photoPath, const FPhotoInfo& info,
+-                            bool rescale, int maxDim, int imageQuality)
++                            bool original, bool rescale, int maxDim, int imageQuality)
+ {
+     if (m_reply)
+     {
+@@ -583,123 +374,125 @@ bool FlickrTalker::addPhoto(const QStrin
+         m_reply = 0;
+     }
+ 
++    if (!m_o1->linked())
++        return false;
++
+     QUrl url(m_uploadUrl);
++    QNetworkRequest netRequest(url);
++    QList<O0RequestParameter> reqParams = QList<O0RequestParameter>();
+ 
+-    // We dont' want to modify url as such, we just used the QUrl object for storing the query items.
+-    QUrl url2(QString::fromLatin1(""));
+-    QUrlQuery urlQuery;
+     QString path = photoPath;
+     MPForm  form;
+ 
+-    form.addPair(QString::fromLatin1("auth_token"), m_token, QString::fromLatin1("text/plain"));
+-    urlQuery.addQueryItem(QString::fromLatin1("auth_token"), m_token);
+-
+-    form.addPair(QString::fromLatin1("api_key"), m_apikey, QString::fromLatin1("text/plain"));
+-    urlQuery.addQueryItem(QString::fromLatin1("api_key"), m_apikey);
+-
+-    QString ispublic = (info.is_public == 1) ? QString::fromLatin1("1") : QString::fromLatin1("0");
+-    form.addPair(QString::fromLatin1("is_public"), ispublic, QString::fromLatin1("text/plain"));
+-    urlQuery.addQueryItem(QString::fromLatin1("is_public"), ispublic);
+-
+-    QString isfamily = (info.is_family == 1) ? QString::fromLatin1("1") : QString::fromLatin1("0");
+-    form.addPair(QString::fromLatin1("is_family"), isfamily, QString::fromLatin1("text/plain"));
+-    urlQuery.addQueryItem(QString::fromLatin1("is_family"), isfamily);
+-
+-    QString isfriend = (info.is_friend == 1) ? QString::fromLatin1("1") : QString::fromLatin1("0");
+-    form.addPair(QString::fromLatin1("is_friend"), isfriend, QString::fromLatin1("text/plain"));
+-    urlQuery.addQueryItem(QString::fromLatin1("is_friend"), isfriend);
++    QString ispublic = (info.is_public == 1) ? QLatin1String("1") : QLatin1String("0");
++    form.addPair(QLatin1String("is_public"), ispublic, QLatin1String("text/plain"));
++    reqParams << O0RequestParameter("is_public", ispublic.toLatin1());
++
++    QString isfamily = (info.is_family == 1) ? QLatin1String("1") : QLatin1String("0");
++    form.addPair(QLatin1String("is_family"), isfamily, QLatin1String("text/plain"));
++    reqParams << O0RequestParameter("is_family", isfamily.toLatin1());
++
++    QString isfriend = (info.is_friend == 1) ? QLatin1String("1") : QLatin1String("0");
++    form.addPair(QLatin1String("is_friend"), isfriend, QLatin1String("text/plain"));
++    reqParams << O0RequestParameter("is_friend", isfriend.toLatin1());
+ 
+     QString safetyLevel = QString::number(static_cast<int>(info.safety_level));
+-    form.addPair(QString::fromLatin1("safety_level"), safetyLevel, QString::fromLatin1("text/plain"));
+-    urlQuery.addQueryItem(QString::fromLatin1("safety_level"), safetyLevel);
++    form.addPair(QLatin1String("safety_level"), safetyLevel, QLatin1String("text/plain"));
++    reqParams << O0RequestParameter("safety_level", safetyLevel.toLatin1());
+ 
+     QString contentType = QString::number(static_cast<int>(info.content_type));
+-    form.addPair(QString::fromLatin1("content_type"), contentType, QString::fromLatin1("text/plain"));
+-    urlQuery.addQueryItem(QString::fromLatin1("content_type"), contentType);
++    form.addPair(QLatin1String("content_type"), contentType, QLatin1String("text/plain"));
++    reqParams << O0RequestParameter("content_type", contentType.toLatin1());
+ 
+-    QString tags = QString::fromLatin1("\"") + info.tags.join(QString::fromLatin1("\" \"")) + QString::fromLatin1("\"");
++    QString tags = QLatin1String("\"") + info.tags.join(QLatin1String("\" \"")) + QLatin1String("\"");
+ 
+     if (tags.length() > 0)
+     {
+-        form.addPair(QString::fromLatin1("tags"), tags, QString::fromLatin1("text/plain"));
+-        urlQuery.addQueryItem(QString::fromLatin1("tags"), tags);
++        form.addPair(QLatin1String("tags"), tags, QLatin1String("text/plain"));
++        reqParams << O0RequestParameter("tags", tags.toUtf8());
+     }
+ 
+     if (!info.title.isEmpty())
+     {
+-        form.addPair(QString::fromLatin1("title"), info.title, QString::fromLatin1("text/plain"));
+-        urlQuery.addQueryItem(QString::fromLatin1("title"), info.title);
++        form.addPair(QLatin1String("title"), info.title, QLatin1String("text/plain"));
++        reqParams << O0RequestParameter("title", info.title.toUtf8());
+     }
+ 
+     if (!info.description.isEmpty())
+     {
+-        form.addPair(QString::fromLatin1("description"), info.description, QString::fromLatin1("text/plain"));
+-        urlQuery.addQueryItem(QString::fromLatin1("description"), info.description);
+-    }
+-
+-    url2.setQuery(urlQuery);
+-    QString md5 = getApiSig(m_secret, url2);
+-    form.addPair(QString::fromLatin1("api_sig"), md5, QString::fromLatin1("text/plain"));
+-    QImage image;
+-
+-    if (m_iface)
+-    {
+-        image = m_iface->preview(QUrl::fromLocalFile(photoPath));
++        form.addPair(QLatin1String("description"), info.description, QLatin1String("text/plain"));
++        reqParams << O0RequestParameter("description", info.description.toUtf8());
+     }
+ 
+-    if (image.isNull())
++    if (!original)
+     {
+-        image.load(photoPath);
+-    }
++        QImage image;
+ 
+-    if (!image.isNull())
+-    {
+-        if (!m_lastTmpFile.isEmpty())
++        if (m_iface)
+         {
+-            QFile::remove(m_lastTmpFile);
++            image = m_iface->preview(QUrl::fromLocalFile(photoPath));
+         }
+ 
+-        path = makeTemporaryDir(m_serviceName.toLatin1().constData()).filePath(QFileInfo(photoPath)
+-                                                                     .baseName().trimmed() + QLatin1String(".jpg"));
+-
+-        if (rescale)
++        if (image.isNull())
+         {
+-            if (image.width() > maxDim || image.height() > maxDim)
+-                image = image.scaled(maxDim, maxDim, Qt::KeepAspectRatio, Qt::SmoothTransformation);
++            image.load(photoPath);
+         }
+ 
+-        image.save(path, "JPEG", imageQuality);
+-        m_lastTmpFile = path;
+-
+-        // Restore all metadata.
+-
+-        if (m_iface)
++        if (!image.isNull())
+         {
+-            QPointer<MetadataProcessor> meta = m_iface->createMetadataProcessor();
+-
+-            if (meta && meta->load(QUrl::fromLocalFile(photoPath)))
++            if (!m_lastTmpFile.isEmpty())
+             {
+-                meta->setImageDimensions(image.size());
++                QFile::remove(m_lastTmpFile);
++            }
+ 
+-                // NOTE: see bug #153207: Flickr use IPTC keywords to create Tags in web interface
+-                //       As IPTC do not support UTF-8, we need to remove it.
+-                meta->removeIptcTags(QStringList() << QLatin1String("Iptc.Application2.Keywords"));
++            path = makeTemporaryDir(m_serviceName.toLatin1().constData()).filePath(QFileInfo(photoPath)
++                                                                         .baseName().trimmed() + QLatin1String(".jpg"));
+ 
+-                meta->setImageProgramId(QString::fromLatin1("Kipi-plugins"), kipipluginsVersion());
+-                meta->save(QUrl::fromLocalFile(path));
++            if (rescale)
++            {
++                if (image.width() > maxDim || image.height() > maxDim)
++                    image = image.scaled(maxDim, maxDim, Qt::KeepAspectRatio, Qt::SmoothTransformation);
+             }
+-            else
++
++            image.save(path, "JPEG", imageQuality);
++            m_lastTmpFile = path;
++
++            // Restore all metadata.
++
++            if (m_iface)
+             {
+-                qCWarning(KIPIPLUGINS_LOG) << "flickrExport::Image doesn't have metadata";
++                QPointer<MetadataProcessor> meta = m_iface->createMetadataProcessor();
++
++                if (meta && meta->load(QUrl::fromLocalFile(photoPath)))
++                {
++                    meta->setImageDimensions(image.size());
++                    meta->setImageOrientation(MetadataProcessor::NORMAL);
++
++                    // NOTE: see bug #153207: Flickr use IPTC keywords to create Tags in web interface
++                    //       As IPTC do not support UTF-8, we need to remove it.
++                    //       This function call remove all Application2 Tags.
++                    meta->removeIptcTags(QStringList() << QLatin1String("Application2"));
++                    // NOTE: see bug # 384260: Flickr use Xmp.dc.subject to create Tags
++                    //       in web interface, we need to remove it.
++                    //       This function call remove all Dublin Core Tags.
++                    meta->removeXmpTags(QStringList() << QLatin1String("dc"));
++
++                    meta->setImageProgramId(QLatin1String("Kipi-plugins"), kipipluginsVersion());
++                    meta->save(QUrl::fromLocalFile(path), true);
++                }
++                else
++                {
++                    qCWarning(KIPIPLUGINS_LOG) << "flickrExport::Image doesn't have metadata";
++                }
+             }
+-        }
+ 
+-        qCDebug(KIPIPLUGINS_LOG) << "Resizing and saving to temp file: " << path;
++            qCDebug(KIPIPLUGINS_LOG) << "Resizing and saving to temp file: " << path;
++        }
+     }
+ 
+     QFileInfo tempFileInfo(path);
+ 
+-    qCDebug(KIPIPLUGINS_LOG) << "QUrl path is " << QUrl::fromLocalFile(path) << "Image size after resizing (in bytes) is "<< tempFileInfo.size();
++    qCDebug(KIPIPLUGINS_LOG) << "QUrl path is " << QUrl::fromLocalFile(path) << "Image size (in bytes) is "<< tempFileInfo.size();
+ 
+     if (tempFileInfo.size() > (getMaxAllowedFileSize().toLongLong()))
+     {
+@@ -707,17 +500,16 @@ bool FlickrTalker::addPhoto(const QStrin
+         return false;
+     }
+ 
+-    if (!form.addFile(QString::fromLatin1("photo"), path))
++    if (!form.addFile(QLatin1String("photo"), path))
+     {
+         return false;
+     }
+ 
+     form.finish();
+ 
+-    QNetworkRequest netRequest(url);
+     netRequest.setHeader(QNetworkRequest::ContentTypeHeader, form.contentType());
+ 
+-    m_reply = m_netMngr->post(netRequest, form.formData());
++    m_reply = m_requestor->post(netRequest, reqParams, form.formData());
+ 
+     m_state = FE_ADDPHOTO;
+     m_buffer.resize(0);
+@@ -869,22 +661,6 @@ void FlickrTalker::slotFinished(QNetwork
+             parseResponseListPhotoSets(m_buffer);
+             break;
+ 
+-        case (FE_GETFROB):
+-            parseResponseGetFrob(m_buffer);
+-            break;
+-
+-        case (FE_GETTOKEN):
+-            parseResponseGetToken(m_buffer);
+-            break;
+-
+-        case (FE_CHECKTOKEN):
+-            parseResponseCheckToken(m_buffer);
+-            break;
+-
+-        case (FE_GETAUTHORIZED):
+-            //parseResponseGetToken(m_buffer);
+-            break;
+-
+         case (FE_LISTPHOTOS):
+             parseResponseListPhotos(m_buffer);
+             break;
+@@ -919,7 +695,7 @@ void FlickrTalker::slotFinished(QNetwork
+ void FlickrTalker::parseResponseMaxSize(const QByteArray& data)
+ {
+     QString errorString;
+-    QDomDocument doc(QString::fromLatin1("mydocument"));
++    QDomDocument doc(QLatin1String("mydocument"));
+ 
+     if (!doc.setContent(data))
+     {
+@@ -933,7 +709,7 @@ void FlickrTalker::parseResponseMaxSize(
+ 
+     while (!node.isNull())
+     {
+-        if (node.isElement() && node.nodeName() == QString::fromLatin1("person"))
++        if (node.isElement() && node.nodeName() == QLatin1String("person"))
+         {
+             e                = node.toElement();
+             QDomNode details = e.firstChild();
+@@ -944,9 +720,9 @@ void FlickrTalker::parseResponseMaxSize(
+                 {
+                     e = details.toElement();
+ 
+-                    if (details.nodeName() == QString::fromLatin1("photos"))
++                    if (details.nodeName() == QLatin1String("photos"))
+                     {
+-                        QDomAttr a = e.attributeNode(QString::fromLatin1("maxupload"));
++                        QDomAttr a = e.attributeNode(QLatin1String("maxupload"));
+                         m_maxSize = a.value();
+                         qCDebug(KIPIPLUGINS_LOG) << "Max upload size is"<<m_maxSize;
+                     }
+@@ -956,255 +732,18 @@ void FlickrTalker::parseResponseMaxSize(
+             }
+         }
+ 
+-        if (node.isElement() && node.nodeName() == QString::fromLatin1("err"))
+-        {
+-            qCDebug(KIPIPLUGINS_LOG) << "Checking Error in response";
+-            errorString = node.toElement().attribute(QString::fromLatin1("code"));
+-            qCDebug(KIPIPLUGINS_LOG) << "Error code=" << errorString;
+-            qCDebug(KIPIPLUGINS_LOG) << "Msg=" << node.toElement().attribute(QString::fromLatin1("msg"));
+-        }
+-
+-        node = node.nextSibling();
+-    }
+-}
+-
+-void FlickrTalker::parseResponseGetFrob(const QByteArray& data)
+-{
+-    bool success = false;
+-    QString errorString;
+-    QDomDocument doc(QString::fromLatin1("mydocument"));
+-
+-    if (!doc.setContent(data))
+-    {
+-        return;
+-    }
+-
+-    QDomElement docElem = doc.documentElement();
+-    QDomNode node       = docElem.firstChild();
+-
+-    while (!node.isNull())
+-    {
+-        if (node.isElement() && node.nodeName() == QString::fromLatin1("frob"))
+-        {
+-            QDomElement e = node.toElement();    // try to convert the node to an element.
+-            qCDebug(KIPIPLUGINS_LOG) << "Frob is" << e.text();
+-            m_frob        = e.text();            // this is what is obtained from data.
+-            success       = true;
+-        }
+-
+-        if (node.isElement() && node.nodeName() == QString::fromLatin1("err"))
++        if (node.isElement() && node.nodeName() == QLatin1String("err"))
+         {
+             qCDebug(KIPIPLUGINS_LOG) << "Checking Error in response";
+-            errorString = node.toElement().attribute(QString::fromLatin1("code"));
++            errorString = node.toElement().attribute(QLatin1String("code"));
+             qCDebug(KIPIPLUGINS_LOG) << "Error code=" << errorString;
+-            qCDebug(KIPIPLUGINS_LOG) << "Msg=" << node.toElement().attribute(QString::fromLatin1("msg"));
++            qCDebug(KIPIPLUGINS_LOG) << "Msg=" << node.toElement().attribute(QLatin1String("msg"));
+         }
+ 
+         node = node.nextSibling();
+     }
+ 
+-    qCDebug(KIPIPLUGINS_LOG) << "GetFrob finished";
+-    m_authProgressDlg->setMaximum(4);
+-    m_authProgressDlg->setValue(2);
+-    m_state = FE_GETAUTHORIZED;
+-
+-    if (success)
+-    {
+-        emit signalAuthenticate();
+-    }
+-    else
+-    {
+-        emit signalError(errorString);
+-    }
+-}
+-
+-void FlickrTalker::parseResponseCheckToken(const QByteArray& data)
+-{
+-    bool         success = false;
+-    QString      errorString;
+-    QString      username;
+-    QString      transReturn;
+-    QDomDocument doc(QString::fromLatin1("checktoken"));
+-
+-    if (!doc.setContent(data))
+-    {
+-        return;
+-    }
+-
+-    QDomElement docElem = doc.documentElement();
+-    QDomNode node       = docElem.firstChild();
+-    QDomElement e;
+-
+-    while (!node.isNull())
+-    {
+-        if (node.isElement() && node.nodeName() == QString::fromLatin1("auth"))
+-        {
+-            e                = node.toElement(); // try to convert the node to an element.
+-            QDomNode details = e.firstChild();
+-
+-            while (!details.isNull())
+-            {
+-                if (details.isElement())
+-                {
+-                    e = details.toElement();
+-
+-                    if (details.nodeName() == QString::fromLatin1("token"))
+-                    {
+-                        qCDebug(KIPIPLUGINS_LOG) << "Token=" << e.text();
+-                        m_token = e.text();//this is what is obtained from data.
+-                    }
+-
+-                    if (details.nodeName() == QString::fromLatin1("perms"))
+-                    {
+-                        qCDebug(KIPIPLUGINS_LOG) << "Perms=" << e.text();
+-                        QString perms = e.text();//this is what is obtained from data.
+-
+-                        if (perms == QString::fromLatin1("write"))
+-                        {
+-                            transReturn = i18nc("As in the permission to", "write");
+-                        }
+-                        else if (perms == QString::fromLatin1("read"))
+-                        {
+-                            transReturn = i18nc("As in the permission to", "read");
+-                        }
+-                        else if (perms == QString::fromLatin1("delete"))
+-                        {
+-                            transReturn = i18nc("As in the permission to", "delete");
+-                        }
+-                    }
+-
+-                    if (details.nodeName() == QString::fromLatin1("user"))
+-                    {
+-                        qCDebug(KIPIPLUGINS_LOG) << "nsid=" << e.attribute(QString::fromLatin1("nsid"));
+-                        m_userId   = e.attribute(QString::fromLatin1("nsid"));
+-                        username   = e.attribute(QString::fromLatin1("username"));
+-                        m_username = username;
+-                        qCDebug(KIPIPLUGINS_LOG) << "username=" << e.attribute(QString::fromLatin1("username"));
+-                        qCDebug(KIPIPLUGINS_LOG) << "fullname=" << e.attribute(QString::fromLatin1("fullname"));
+-                    }
+-                }
+-
+-                details = details.nextSibling();
+-            }
+-
+-            m_authProgressDlg->hide();
+-            emit signalTokenObtained(m_token);
+-            success = true;
+-        }
+-
+-        if (node.isElement() && node.nodeName() == QString::fromLatin1("err"))
+-        {
+-            qCDebug(KIPIPLUGINS_LOG) << "Checking Error in response";
+-            errorString = node.toElement().attribute(QString::fromLatin1("code"));
+-            qCDebug(KIPIPLUGINS_LOG) << "Error code=" << errorString;
+-            qCDebug(KIPIPLUGINS_LOG) << "Msg=" << node.toElement().attribute(QString::fromLatin1("msg"));
+-
+-            int valueOk = QMessageBox::question(QApplication::activeWindow(),
+-                                                i18n("Invalid Token"),
+-                                                i18n("Your token is invalid. Would you like to "
+-                                                      "get a new token to proceed?\n"));
+-
+-            if (valueOk == QMessageBox::Yes)
+-            {
+-                getFrob();
+-                return;
+-            }
+-            else
+-            {
+-                m_authProgressDlg->hide(); //will popup the result for the checktoken failure below
+-            }
+-
+-        }
+-
+-        node = node.nextSibling();
+-    }
+-
+-    if (!success)
+-    {
+-        emit signalError(errorString);
+-    }
+-
+-    qCDebug(KIPIPLUGINS_LOG) << "CheckToken finished";
+-}
+-
+-void FlickrTalker::parseResponseGetToken(const QByteArray& data)
+-{
+-    bool success = false;
+-    QString errorString;
+-    QDomDocument doc(QString::fromLatin1("gettoken"));
+-
+-    if (!doc.setContent(data))
+-    {
+-        return;
+-    }
+-
+-    QDomElement docElem = doc.documentElement();
+-    QDomNode    node    = docElem.firstChild();
+-    QDomElement e;
+-
+-    while (!node.isNull())
+-    {
+-        if (node.isElement() && node.nodeName() == QString::fromLatin1("auth"))
+-        {
+-            e                = node.toElement(); // try to convert the node to an element.
+-            QDomNode details = e.firstChild();
+-
+-            while (!details.isNull())
+-            {
+-                if (details.isElement())
+-                {
+-                    e = details.toElement();
+-
+-                    if (details.nodeName() == QString::fromLatin1("token"))
+-                    {
+-                        qCDebug(KIPIPLUGINS_LOG) << "Token=" << e.text();
+-                        m_token = e.text();      //this is what is obtained from data.
+-                    }
+-
+-                    if (details.nodeName() == QString::fromLatin1("perms"))
+-                    {
+-                        qCDebug(KIPIPLUGINS_LOG) << "Perms=" << e.text();
+-                    }
+-
+-                    if (details.nodeName() == QString::fromLatin1("user"))
+-                    {
+-                        qCDebug(KIPIPLUGINS_LOG) << "nsid=" << e.attribute(QString::fromLatin1("nsid"));
+-                        qCDebug(KIPIPLUGINS_LOG) << "username=" << e.attribute(QString::fromLatin1("username"));
+-                        qCDebug(KIPIPLUGINS_LOG) << "fullname=" << e.attribute(QString::fromLatin1("fullname"));
+-                        m_username = e.attribute(QString::fromLatin1("username"));
+-                        m_userId   = e.attribute(QString::fromLatin1("nsid"));
+-                    }
+-                }
+-
+-                details = details.nextSibling();
+-            }
+-
+-            success = true;
+-        }
+-        else if (node.isElement() && node.nodeName() == QString::fromLatin1("err"))
+-        {
+-            qCDebug(KIPIPLUGINS_LOG) << "Checking Error in response";
+-            errorString = node.toElement().attribute(QString::fromLatin1("code"));
+-            qCDebug(KIPIPLUGINS_LOG) << "Error code=" << errorString;
+-            qCDebug(KIPIPLUGINS_LOG) << "Msg=" << node.toElement().attribute(QString::fromLatin1("msg"));
+-            //emit signalError(code);
+-        }
+-
+-        node = node.nextSibling();
+-    }
+-
+-    qCDebug(KIPIPLUGINS_LOG) << "GetToken finished";
+-    //emit signalBusy( false );
+     m_authProgressDlg->hide();
+-
+-    if (success)
+-    {
+-        emit signalTokenObtained(m_token);
+-    }
+-    else
+-    {
+-        emit signalError(errorString);
+-    }
+ }
+ 
+ void FlickrTalker::parseResponseCreatePhotoSet(const QByteArray& data)
+@@ -1213,7 +752,7 @@ void FlickrTalker::parseResponseCreatePh
+ 
+     //bool success = false;
+ 
+-    QDomDocument doc(QString::fromLatin1("getListPhotoSets"));
++    QDomDocument doc(QLatin1String("getListPhotoSets"));
+ 
+     if (!doc.setContent(data))
+     {
+@@ -1226,10 +765,10 @@ void FlickrTalker::parseResponseCreatePh
+ 
+     while (!node.isNull())
+     {
+-        if (node.isElement() && node.nodeName() == QString::fromLatin1("photoset"))
++        if (node.isElement() && node.nodeName() == QLatin1String("photoset"))
+         {
+             // Parse the id from the response.
+-            QString new_id = node.toElement().attribute(QString::fromLatin1("id"));
++            QString new_id = node.toElement().attribute(QLatin1String("id"));
+ 
+             // Set the new id in the photo sets list.
+             QLinkedList<FPhotoSet>::iterator it = m_photoSetsList->begin();
+@@ -1252,12 +791,12 @@ void FlickrTalker::parseResponseCreatePh
+             emit signalAddPhotoSetSucceeded();
+         }
+ 
+-        if (node.isElement() && node.nodeName() == QString::fromLatin1("err"))
++        if (node.isElement() && node.nodeName() == QLatin1String("err"))
+         {
+             qCDebug(KIPIPLUGINS_LOG) << "Checking Error in response";
+-            QString code = node.toElement().attribute(QString::fromLatin1("code"));
++            QString code = node.toElement().attribute(QLatin1String("code"));
+             qCDebug(KIPIPLUGINS_LOG) << "Error code=" << code;
+-            QString msg = node.toElement().attribute(QString::fromLatin1("msg"));
++            QString msg = node.toElement().attribute(QLatin1String("msg"));
+             qCDebug(KIPIPLUGINS_LOG) << "Msg=" << msg;
+             QMessageBox::critical(QApplication::activeWindow(), i18n("Error"), i18n("PhotoSet creation failed: ") + msg);
+         }
+@@ -1270,7 +809,7 @@ void FlickrTalker::parseResponseListPhot
+ {
+     qCDebug(KIPIPLUGINS_LOG) << "parseResponseListPhotosets" << data;
+     bool success = false;
+-    QDomDocument doc(QString::fromLatin1("getListPhotoSets"));
++    QDomDocument doc(QLatin1String("getListPhotoSets"));
+ 
+     if (!doc.setContent(data))
+     {
+@@ -1286,7 +825,7 @@ void FlickrTalker::parseResponseListPhot
+ 
+     while (!node.isNull())
+     {
+-        if (node.isElement() && node.nodeName() == QString::fromLatin1("photosets"))
++        if (node.isElement() && node.nodeName() == QLatin1String("photosets"))
+         {
+             e                    = node.toElement();
+             QDomNode details     = e.firstChild();
+@@ -1299,10 +838,10 @@ void FlickrTalker::parseResponseListPhot
+                 {
+                     e = detailsNode.toElement();
+ 
+-                    if (detailsNode.nodeName() == QString::fromLatin1("photoset"))
++                    if (detailsNode.nodeName() == QLatin1String("photoset"))
+                     {
+-                        qCDebug(KIPIPLUGINS_LOG) << "id=" << e.attribute(QString::fromLatin1("id"));
+-                        photoSet_id              = e.attribute(QString::fromLatin1("id"));     // this is what is obtained from data.
++                        qCDebug(KIPIPLUGINS_LOG) << "id=" << e.attribute(QLatin1String("id"));
++                        photoSet_id              = e.attribute(QLatin1String("id"));     // this is what is obtained from data.
+                         fps.id                   = photoSet_id;
+                         QDomNode photoSetDetails = detailsNode.firstChild();
+                         QDomElement e_detail;
+@@ -1311,13 +850,13 @@ void FlickrTalker::parseResponseListPhot
+                         {
+                             e_detail = photoSetDetails.toElement();
+ 
+-                            if (photoSetDetails.nodeName() == QString::fromLatin1("title"))
++                            if (photoSetDetails.nodeName() == QLatin1String("title"))
+                             {
+                                 qCDebug(KIPIPLUGINS_LOG) << "Title=" << e_detail.text();
+                                 photoSet_title = e_detail.text();
+                                 fps.title      = photoSet_title;
+                             }
+-                            else if (photoSetDetails.nodeName() == QString::fromLatin1("description"))
++                            else if (photoSetDetails.nodeName() == QLatin1String("description"))
+                             {
+                                 qCDebug(KIPIPLUGINS_LOG) << "Description =" << e_detail.text();
+                                 photoSet_description = e_detail.text();
+@@ -1338,12 +877,12 @@ void FlickrTalker::parseResponseListPhot
+             success = true;
+         }
+ 
+-        if (node.isElement() && node.nodeName() == QString::fromLatin1("err"))
++        if (node.isElement() && node.nodeName() == QLatin1String("err"))
+         {
+             qCDebug(KIPIPLUGINS_LOG) << "Checking Error in response";
+-            QString code = node.toElement().attribute(QString::fromLatin1("code"));
++            QString code = node.toElement().attribute(QLatin1String("code"));
+             qCDebug(KIPIPLUGINS_LOG) << "Error code=" << code;
+-            qCDebug(KIPIPLUGINS_LOG) << "Msg=" << node.toElement().attribute(QString::fromLatin1("msg"));
++            qCDebug(KIPIPLUGINS_LOG) << "Msg=" << node.toElement().attribute(QLatin1String("msg"));
+             emit signalError(code);
+         }
+ 
+@@ -1365,7 +904,7 @@ void FlickrTalker::parseResponseListPhot
+ 
+ void FlickrTalker::parseResponseListPhotos(const QByteArray& data)
+ {
+-    QDomDocument doc(QString::fromLatin1("getPhotosList"));
++    QDomDocument doc(QLatin1String("getPhotosList"));
+ 
+     if (!doc.setContent(data))
+     {
+@@ -1380,7 +919,7 @@ void FlickrTalker::parseResponseListPhot
+ 
+ void FlickrTalker::parseResponseCreateAlbum(const QByteArray& data)
+ {
+-    QDomDocument doc(QString::fromLatin1("getCreateAlbum"));
++    QDomDocument doc(QLatin1String("getCreateAlbum"));
+ 
+     if (!doc.setContent(data))
+     {
+@@ -1397,7 +936,7 @@ void FlickrTalker::parseResponseAddPhoto
+ {
+     bool    success = false;
+     QString line;
+-    QDomDocument doc(QString::fromLatin1("AddPhoto Response"));
++    QDomDocument doc(QLatin1String("AddPhoto Response"));
+ 
+     if (!doc.setContent(data))
+     {
+@@ -1411,7 +950,7 @@ void FlickrTalker::parseResponseAddPhoto
+ 
+     while (!node.isNull())
+     {
+-        if (node.isElement() && node.nodeName() == QString::fromLatin1("photoid"))
++        if (node.isElement() && node.nodeName() == QLatin1String("photoid"))
+         {
+             e                = node.toElement();           // try to convert the node to an element.
+             QDomNode details = e.firstChild();
+@@ -1420,12 +959,12 @@ void FlickrTalker::parseResponseAddPhoto
+             success          = true;
+         }
+ 
+-        if (node.isElement() && node.nodeName() == QString::fromLatin1("err"))
++        if (node.isElement() && node.nodeName() == QLatin1String("err"))
+         {
+             qCDebug(KIPIPLUGINS_LOG) << "Checking Error in response";
+-            QString code = node.toElement().attribute(QString::fromLatin1("code"));
++            QString code = node.toElement().attribute(QLatin1String("code"));
+             qCDebug(KIPIPLUGINS_LOG) << "Error code=" << code;
+-            qCDebug(KIPIPLUGINS_LOG) << "Msg=" << node.toElement().attribute(QString::fromLatin1("msg"));
++            qCDebug(KIPIPLUGINS_LOG) << "Msg=" << node.toElement().attribute(QLatin1String("msg"));
+             emit signalError(code);
+         }
+ 
+@@ -1440,23 +979,14 @@ void FlickrTalker::parseResponseAddPhoto
+     {
+         QString photoSetId = m_selectedPhotoSet.id;
+ 
+-        if (photoSetId == QString::fromLatin1("-1"))
++        if (photoSetId == QLatin1String("-1"))
+         {
+             qCDebug(KIPIPLUGINS_LOG) << "PhotoSet Id not set, not adding the photo to any photoset";
+             emit signalAddPhotoSucceeded();
+         }
+         else
+         {
+-            if (m_serviceName == QString::fromLatin1("Zooomr"))
+-            {
+-                // addPhotoToPhotoSet not supported by Zooomr (Zooomr only has
+-                // smart folder-type photosets); silently fail
+-                emit signalAddPhotoSucceeded();
+-            }
+-            else
+-            {
+-                addPhotoToPhotoSet(photoId, photoSetId);
+-            }
++            addPhotoToPhotoSet(photoId, photoSetId);
+         }
+     }
+ }
+@@ -1465,7 +995,7 @@ void FlickrTalker::parseResponsePhotoPro
+ {
+     bool         success = false;
+     QString      line;
+-    QDomDocument doc(QString::fromLatin1("Photos Properties"));
++    QDomDocument doc(QLatin1String("Photos Properties"));
+ 
+     if (!doc.setContent(data))
+     {
+@@ -1478,7 +1008,7 @@ void FlickrTalker::parseResponsePhotoPro
+ 
+     while (!node.isNull())
+     {
+-        if (node.isElement() && node.nodeName() == QString::fromLatin1("photoid"))
++        if (node.isElement() && node.nodeName() == QLatin1String("photoid"))
+         {
+             e                = node.toElement();                 // try to convert the node to an element.
+             QDomNode details = e.firstChild();
+@@ -1486,12 +1016,12 @@ void FlickrTalker::parseResponsePhotoPro
+             qCDebug(KIPIPLUGINS_LOG) << "Photoid=" << e.text();
+         }
+ 
+-        if (node.isElement() && node.nodeName() == QString::fromLatin1("err"))
++        if (node.isElement() && node.nodeName() == QLatin1String("err"))
+         {
+             qCDebug(KIPIPLUGINS_LOG) << "Checking Error in response";
+-            QString code = node.toElement().attribute(QString::fromLatin1("code"));
++            QString code = node.toElement().attribute(QLatin1String("code"));
+             qCDebug(KIPIPLUGINS_LOG) << "Error code=" << code;
+-            qCDebug(KIPIPLUGINS_LOG) << "Msg=" << node.toElement().attribute(QString::fromLatin1("msg"));
++            qCDebug(KIPIPLUGINS_LOG) << "Msg=" << node.toElement().attribute(QLatin1String("msg"));
+             emit signalError(code);
+         }
+ 
+Index: digikam-5.3.0/extra/kipi-plugins/flickr/flickrtalker.h
+===================================================================
+--- digikam-5.3.0.orig/extra/kipi-plugins/flickr/flickrtalker.h
++++ digikam-5.3.0/extra/kipi-plugins/flickr/flickrtalker.h
+@@ -42,6 +42,9 @@
+ // Local includes
+ 
+ #include "flickritem.h"
++#include "o1.h"
++#include "o0globals.h"
++#include "o1requestor.h"
+ 
+ class QProgressDialog;
+ 
+@@ -69,10 +72,6 @@ public:
+         FE_LISTPHOTOS,
+         FE_GETPHOTOPROPERTY,
+         FE_ADDPHOTO,
+-        FE_GETFROB,
+-        FE_CHECKTOKEN,
+-        FE_GETTOKEN,
+-        FE_GETAUTHORIZED,
+         FE_CREATEPHOTOSET,
+         FE_ADDPHOTOTOPHOTOSET,
+         FE_GETMAXSIZE
+@@ -83,13 +82,12 @@ public:
+     FlickrTalker(QWidget* const parent, const QString& serviceName);
+     ~FlickrTalker();
+ 
++    void    link();
++    void    unlink();
+     QString getUserName() const;
+     QString getUserId() const;
+     void    maxAllowedFileSize();
+     QString getMaxAllowedFileSize();
+-    void    getFrob();
+-    void    getToken();
+-    void    checkToken(const QString& token);
+     void    getPhotoProperty(const QString& method, const QStringList& argList);
+     void    cancel();
+ 
+@@ -123,8 +121,7 @@ Q_SIGNALS:
+     void signalListPhotoSetsFailed(QString& msg);
+     void signalAddPhotoFailed(const QString& msg);
+     void signalListPhotoSetsFailed(const QString& msg);
+-    void signalAuthenticate();
+-    void signalTokenObtained(const QString& token);
++    void signalLinkingSucceeded();
+ 
+ private:
+ 
+@@ -134,36 +131,32 @@ private:
+     void parseResponseListPhotos(const QByteArray& data);
+     void parseResponseCreateAlbum(const QByteArray& data);
+     void parseResponseAddPhoto(const QByteArray& data);
+-    void parseResponseGetFrob(const QByteArray& data);
+-    void parseResponseGetToken(const QByteArray& data);
+-    void parseResponseCheckToken(const QByteArray& data);
+     void parseResponsePhotoProperty(const QByteArray& data);
+     void parseResponseCreatePhotoSet(const QByteArray& data);
+     void parseResponseAddPhotoToPhotoSet(const QByteArray& data);
+ 
+-    QString getApiSig(const QString& secret, const QUrl& url);
+-
+ private Q_SLOTS:
+ 
++    void slotLinkingFailed();
++    void slotLinkingSucceeded();
++    void slotOpenBrowser(const QUrl& url); 
+     void slotError(const QString& msg);
+-    void slotAuthenticate();
+     void slotFinished(QNetworkReply* reply);
+ 
+ private:
+ 
+     QWidget*               m_parent;
+-//  QString                m_cookie;
+     QByteArray             m_buffer;
+ 
+     QString                m_serviceName;
+     QString                m_apiUrl;
+     QString                m_authUrl;
++    QString                m_tokenUrl;
++    QString                m_accessUrl;
+     QString                m_uploadUrl;
+     QString                m_apikey;
+     QString                m_secret;
+-    QString                m_frob;
+     QString                m_maxSize;
+-    QString                m_token;
+     QString                m_username;
+     QString                m_userId;
+     QString                m_lastTmpFile;
+@@ -174,6 +167,9 @@ private:
+     State                  m_state;
+ 
+     Interface*             m_iface;
++
++    O1*                    m_o1;
++    O1Requestor*           m_requestor;
+ };
+ 
+ } // namespace KIPIFlickrPlugin
+Index: digikam-5.3.0/extra/kipi-plugins/flickr/flickrwidget.cpp
+===================================================================
+--- digikam-5.3.0.orig/extra/kipi-plugins/flickr/flickrwidget.cpp
++++ digikam-5.3.0/extra/kipi-plugins/flickr/flickrwidget.cpp
+@@ -61,7 +61,8 @@ FlickrWidget::FlickrWidget(QWidget* cons
+     //Adding Remove Account button
+     m_removeAccount              = new QPushButton(getAccountBox());
+     m_removeAccount->setText(i18n("Remove Account"));
+-    getAccountBoxLayout()->addWidget(m_removeAccount, 2,0,1,4);
++    m_removeAccount->hide();
++    getAccountBoxLayout()->addWidget(m_removeAccount, 2, 0, 1, 4);
+ 
+     // -- The image list --------------------------------------------------
+ 
+Index: digikam-5.3.0/extra/kipi-plugins/flickr/flickrwindow.cpp
+===================================================================
+--- digikam-5.3.0.orig/extra/kipi-plugins/flickr/flickrwindow.cpp
++++ digikam-5.3.0/extra/kipi-plugins/flickr/flickrwindow.cpp
+@@ -77,10 +77,6 @@ FlickrWindow::FlickrWindow(QWidget* cons
+     {
+         setWindowIcon(QIcon::fromTheme(QString::fromLatin1("kipi-hq")));
+     }
+-    else if (serviceName == QLatin1String("Zooomr"))
+-    {
+-        setWindowIcon(QIcon::fromTheme(QString::fromLatin1("kipi-zooomr")));
+-    }
+     else
+     {
+         setWindowIcon(QIcon::fromTheme(QString::fromLatin1("kipi-flickr")));
+@@ -136,9 +132,9 @@ FlickrWindow::FlickrWindow(QWidget* cons
+     // --------------------------------------------------------------------------
+     // About data and help button.
+ 
+-    KPAboutData* const about = new KPAboutData(ki18n("Flickr/23/Zooomr Export"),
++    KPAboutData* const about = new KPAboutData(ki18n("Flickr/23 Export"),
+                                                ki18n("A tool to export an image collection to a "
+-                                                     "Flickr / 23 / Zooomr web service."),
++                                                     "Flickr / 23 web service."),
+                                                ki18n("(c) 2005-2008, Vardhman Jain\n"
+                                                      "(c) 2008-2015, Gilles Caulier\n"
+                                                      "(c) 2009, Luka Renko\n"
+@@ -181,8 +177,8 @@ FlickrWindow::FlickrWindow(QWidget* cons
+     connect(m_talker, SIGNAL(signalListPhotoSetsFailed(QString)),
+             this, SLOT(slotListPhotoSetsFailed(QString)));
+ 
+-    connect(m_talker, SIGNAL(signalTokenObtained(QString)),
+-            this, SLOT(slotTokenObtained(QString)));
++    connect(m_talker, SIGNAL(signalLinkingSucceeded()),
++            this, SLOT(slotLinkingSucceeded()));
+ 
+     connect(m_widget->progressBar(), SIGNAL(signalProgressCanceled()),
+             this, SLOT(slotAddPhotoCancelAndClose()));
+@@ -304,17 +300,8 @@ void FlickrWindow::slotAddPhotoCancelAnd
+ void FlickrWindow::reactivate()
+ {
+     m_userNameDisplayLabel->setText(QString());
+-    readSettings(m_select->getUname());
+-    qCDebug(KIPIPLUGINS_LOG) << "Calling auth methods";
+-
+-    if (m_token.length() < 1)
+-    {
+-        m_talker->getFrob();
+-    }
+-    else
+-    {
+-        m_talker->checkToken(m_token);
+-    }
++    //readSettings(m_select->getUname());
++    m_talker->link();
+ 
+     m_widget->m_imglst->loadImagesFromCurrentSelection();
+     show();
+@@ -323,10 +310,8 @@ void FlickrWindow::reactivate()
+ void FlickrWindow::readSettings(QString uname)
+ {
+     KConfig config(QString::fromLatin1("kipirc"));
+-    qCDebug(KIPIPLUGINS_LOG) << "Group name is : "<<QString::fromLatin1("%1%2Export Settings").arg(m_serviceName,uname);
+-    KConfigGroup grp = config.group(QString::fromLatin1("%1%2Export Settings").arg(m_serviceName,uname));
+-    m_token          = grp.readEntry("token");
+-    qCDebug(KIPIPLUGINS_LOG) << "Token is : "<<m_token;
++    qCDebug(KIPIPLUGINS_LOG) << "Group name is : "<<QString::fromLatin1("%1%2Export Settings").arg(m_serviceName, uname);
++    KConfigGroup grp = config.group(QString::fromLatin1("%1%2Export Settings").arg(m_serviceName, uname));
+     m_exportHostTagsCheckBox->setChecked(grp.readEntry("Export Host Tags",      false));
+     m_extendedTagsButton->setChecked(grp.readEntry("Show Extended Tag Options", false));
+     m_addExtraTagsCheckBox->setChecked(grp.readEntry("Add Extra Tags",          false));
+@@ -392,16 +377,14 @@ void FlickrWindow::writeSettings()
+     qCDebug(KIPIPLUGINS_LOG) << "Group name is : "<<QString::fromLatin1("%1%2Export Settings").arg(m_serviceName,m_username);
+ 
+     if (QString::compare(QString::fromLatin1("%1Export Settings").arg(m_serviceName),
+-        QString::fromLatin1("%1%2Export Settings").arg(m_serviceName,m_username), Qt::CaseInsensitive) == 0)
++        QString::fromLatin1("%1%2Export Settings").arg(m_serviceName, m_username), Qt::CaseInsensitive) == 0)
+     {
+         qCDebug(KIPIPLUGINS_LOG) << "Not writing entry of group " << QString::fromLatin1("%1%2Export Settings").arg(m_serviceName,m_username);
+         return;
+     }
+ 
+-    KConfigGroup grp = config.group(QString::fromLatin1("%1%2Export Settings").arg(m_serviceName,m_username));
+-    grp.writeEntry("username",m_username);
+-    qCDebug(KIPIPLUGINS_LOG) << "Token written of group "<<QString::fromLatin1("%1%2Export Settings").arg(m_serviceName,m_username)<<" is "<<m_token;
+-    grp.writeEntry("token", m_token);
++    KConfigGroup grp = config.group(QString::fromLatin1("%1%2Export Settings").arg(m_serviceName, m_username));
++    grp.writeEntry("username",                          m_username);
+     grp.writeEntry("Export Host Tags",                  m_exportHostTagsCheckBox->isChecked());
+     grp.writeEntry("Show Extended Tag Options",         m_extendedTagsButton->isChecked());
+     grp.writeEntry("Add Extra Tags",                    m_addExtraTagsCheckBox->isChecked());
+@@ -427,39 +410,31 @@ void FlickrWindow::slotDoLogin()
+ {
+ }
+ 
+-void FlickrWindow::slotTokenObtained(const QString& token)
++void FlickrWindow::slotLinkingSucceeded()
+ {
+-    qCDebug(KIPIPLUGINS_LOG) << "Token Obtained is : "<<token;
+     m_username = m_talker->getUserName();
+     m_userId   = m_talker->getUserId();
+-    qCDebug(KIPIPLUGINS_LOG) << "SlotTokenObtained invoked setting user Display name to " << m_username;
++    qCDebug(KIPIPLUGINS_LOG) << "SlotLinkingSucceeded invoked setting user Display name to " << m_username;
+     m_userNameDisplayLabel->setText(QString::fromLatin1("<b>%1</b>").arg(m_username));
+ 
+     KConfig config(QString::fromLatin1("kipirc"));
+ 
+-    foreach ( const QString& group, config.groupList() )
++    foreach (const QString& group, config.groupList())
+     {
+-        if(!(group.contains(m_serviceName)))
++        if (!(group.contains(m_serviceName)))
+             continue;
+ 
+         KConfigGroup grp = config.group(group);
+ 
+-        if(group.contains(m_username))
++        if (group.contains(m_username))
+         {
+             readSettings(m_username);
+             break;
+         }
+     }
+ 
+-    m_token    = token;
+     writeSettings();
+-
+-    // Mutable photosets are not supported by Zooomr (Zooomr only has smart
+-    // folder-type photosets).
+-    if (m_serviceName != QString::fromLatin1("Zooomr"))
+-    {
+-        m_talker->listPhotoSets();
+-    }
++    m_talker->listPhotoSets();
+ }
+ 
+ void FlickrWindow::slotBusy(bool val)
+@@ -488,18 +463,11 @@ void FlickrWindow::slotUserChangeRequest
+ {
+     writeSettings();
+     qCDebug(KIPIPLUGINS_LOG) << "Slot Change User Request ";
+-    m_select->reactivate();
+-    readSettings(m_select->getUname());
+-    if (m_token.length() < 1)
+-    {
+-        m_talker->getFrob();
+-    }
+-    else
+-    {
+-        m_talker->checkToken(m_token);
+-    }
+-    //m_talker->getFrob();
+-    //  m_addPhotoButton->setEnabled(m_selectImagesButton->isChecked());
++    //m_select->reactivate();
++    //readSettings(m_select->getUname());
++
++     m_talker->unlink();
++     m_talker->link();
+ }
+ 
+ void FlickrWindow::slotRemoveAccount()
+@@ -507,7 +475,7 @@ void FlickrWindow::slotRemoveAccount()
+     KConfig config(QString::fromLatin1("kipirc"));
+     KConfigGroup grp = config.group(QString::fromLatin1("%1%2Export Settings").arg(m_serviceName).arg(m_username));
+ 
+-    if(grp.exists())
++    if (grp.exists())
+     {
+         qCDebug(KIPIPLUGINS_LOG) << "Removing Account having group"<<QString::fromLatin1("%1%2Export Settings").arg(m_serviceName);
+         grp.deleteGroup();
+@@ -545,8 +513,8 @@ QString FlickrWindow::guessSensibleSetNa
+     int totalCount = 0;
+     QString name;
+ 
+-    for(QMap<QString,int>::const_iterator it=nrFolderOccurences.constBegin();
+-        it!=nrFolderOccurences.constEnd(); ++it)
++    for (QMap<QString,int>::const_iterator it=nrFolderOccurences.constBegin();
++         it!=nrFolderOccurences.constEnd(); ++it)
+     {
+         totalCount += it.value();
+ 
+@@ -788,30 +756,25 @@ void FlickrWindow::slotAddPhotoNext()
+     Pair pathComments = m_uploadQueue.first();
+     FPhotoInfo info   = pathComments.second;
+ 
+-    // Find out the selected photo set.
+-    if (m_serviceName != QString::fromLatin1("Zooomr"))
++    QString selectedPhotoSetId = m_albumsListComboBox->itemData(m_albumsListComboBox->currentIndex()).toString();
++
++    if (selectedPhotoSetId.isEmpty())
++    {
++        m_talker->m_selectedPhotoSet = FPhotoSet();
++    }
++    else
+     {
+-        // mutable photosets are not supported by Zooomr (Zooomr only has smart folder-type photosets)
+-        QString selectedPhotoSetId = m_albumsListComboBox->itemData(m_albumsListComboBox->currentIndex()).toString();
++        QLinkedList<FPhotoSet>::iterator it = m_talker->m_photoSetsList->begin();
+ 
+-        if (selectedPhotoSetId.isEmpty())
+-        {
+-            m_talker->m_selectedPhotoSet = FPhotoSet();
+-        }
+-        else
++        while (it != m_talker->m_photoSetsList->end())
+         {
+-            QLinkedList<FPhotoSet>::iterator it = m_talker->m_photoSetsList->begin();
+-
+-            while (it != m_talker->m_photoSetsList->end())
++            if (it->id == selectedPhotoSetId)
+             {
+-                if (it->id == selectedPhotoSetId)
+-                {
+-                    m_talker->m_selectedPhotoSet = *it;
+-                    break;
+-                }
+-
+-                ++it;
++                m_talker->m_selectedPhotoSet = *it;
++                break;
+             }
++
++            ++it;
+         }
+     }
+ 
+Index: digikam-5.3.0/extra/kipi-plugins/flickr/flickrwindow.h
+===================================================================
+--- digikam-5.3.0.orig/extra/kipi-plugins/flickr/flickrwindow.h
++++ digikam-5.3.0/extra/kipi-plugins/flickr/flickrwindow.h
+@@ -95,7 +95,7 @@ public:
+ 
+ private Q_SLOTS:
+ 
+-    void slotTokenObtained(const QString& token);
++    void slotLinkingSucceeded();
+     void slotDoLogin();
+     void slotBusy(bool val);
+     void slotError(const QString& msg);
+@@ -165,7 +165,6 @@ private:
+ 
+ //  QHash<int, GAlbumViewItem>             m_albumDict;
+ 
+-    QString                                m_token;
+     QString                                m_username;
+     QString                                m_userId;
+     QString                                m_lastSelectedAlbum;
+Index: digikam-5.3.0/extra/kipi-plugins/flickr/plugin_flickr.cpp
+===================================================================
+--- digikam-5.3.0.orig/extra/kipi-plugins/flickr/plugin_flickr.cpp
++++ digikam-5.3.0/extra/kipi-plugins/flickr/plugin_flickr.cpp
+@@ -59,33 +59,27 @@ Plugin_Flickr::Plugin_Flickr(QObject* co
+ 
+     m_actionFlickr = 0;
+     m_action23     = 0;
+-    m_actionZooomr = 0;
+ 
+     m_dlgFlickr    = 0;
+     m_dlg23        = 0;
+-    m_dlgZooomr    = 0;
+ 
+     selectFlickr   = 0;
+     select23       = 0;
+-    selectZoomr    = 0;
+ }
+ 
+ Plugin_Flickr::~Plugin_Flickr()
+ {
+     delete m_dlgFlickr;
+     delete m_dlg23;
+-    delete m_dlgZooomr;
+ 
+     delete selectFlickr;
+     delete select23;
+-    delete selectZoomr;
+ }
+ 
+ void Plugin_Flickr::setup(QWidget* const widget)
+ {
+     m_dlgFlickr = 0;
+     m_dlg23     = 0;
+-    m_dlgZooomr = 0;
+ 
+     Plugin::setup(widget);
+ 
+@@ -107,13 +101,13 @@ void Plugin_Flickr::setupActions()
+     m_actionFlickr->setIcon(QIcon::fromTheme(QString::fromLatin1("kipi-flickr")));
+     actionCollection()->setDefaultShortcut(m_actionFlickr, Qt::ALT + Qt::SHIFT + Qt::Key_R);
+ 
+-    selectFlickr = new SelectUserDlg(0,QString::fromLatin1("Flickr"));
++    //selectFlickr = new SelectUserDlg(0,QString::fromLatin1("Flickr"));
+ 
+     connect(m_actionFlickr, SIGNAL(triggered(bool)),
+             this, SLOT(slotActivateFlickr()));
+ 
+     addAction(QString::fromLatin1("flickrexport"), m_actionFlickr);
+-
++/*
+     m_action23 = new QAction(this);
+     m_action23->setText(i18n("Export to &23..."));
+     m_action23->setIcon(QIcon::fromTheme(QString::fromLatin1("kipi-hq")));
+@@ -125,23 +119,12 @@ void Plugin_Flickr::setupActions()
+             this, SLOT(slotActivate23()));
+ 
+     addAction(QString::fromLatin1("23export"), m_action23);
+-
+-    m_actionZooomr = new QAction(this);
+-    m_actionZooomr->setText(i18n("Export to &Zooomr..."));
+-    m_actionZooomr->setIcon(QIcon::fromTheme(QString::fromLatin1("kipi-zooomr")));
+-    actionCollection()->setDefaultShortcut(m_actionZooomr, Qt::ALT + Qt::SHIFT + Qt::Key_Z);
+-
+-    selectZoomr = new SelectUserDlg(0,QString::fromLatin1("Zooomr"));
+-
+-    connect(m_actionZooomr, SIGNAL(triggered(bool)),
+-            this, SLOT(slotActivateZooomr()));
+-
+-    addAction(QString::fromLatin1("Zooomrexport"), m_actionZooomr);
++*/
+ }
+ 
+ void Plugin_Flickr::slotActivateFlickr()
+ {
+-    selectFlickr->reactivate();
++    //selectFlickr->reactivate();
+ 
+     if (!m_dlgFlickr)
+     {
+@@ -183,28 +166,6 @@ void Plugin_Flickr::slotActivate23()
+     m_dlg23->reactivate();
+ }
+ 
+-void Plugin_Flickr::slotActivateZooomr()
+-{
+-    selectZoomr->reactivate();
+-
+-    if (!m_dlgZooomr)
+-    {
+-        // We clean it up in the close button
+-        m_dlgZooomr = new FlickrWindow(QApplication::activeWindow(), QString::fromLatin1("Zooomr"), selectZoomr);
+-    }
+-    else
+-    {
+-        if (m_dlgZooomr->isMinimized())
+-        {
+-            KWindowSystem::unminimizeWindow(m_dlgZooomr->winId());
+-        }
+-
+-        KWindowSystem::activateWindow(m_dlgZooomr->winId());
+-    }
+-
+-    m_dlgZooomr->reactivate();
+-}
+-
+ } // namespace KIPIFlickrPlugin
+ 
+ #include "plugin_flickr.moc"
+Index: digikam-5.3.0/extra/kipi-plugins/flickr/plugin_flickr.h
+===================================================================
+--- digikam-5.3.0.orig/extra/kipi-plugins/flickr/plugin_flickr.h
++++ digikam-5.3.0/extra/kipi-plugins/flickr/plugin_flickr.h
+@@ -56,7 +56,6 @@ public Q_SLOTS:
+ 
+     void slotActivateFlickr();
+     void slotActivate23();
+-    void slotActivateZooomr();
+ 
+ private:
+ 
+@@ -66,15 +65,12 @@ private:
+ 
+     QAction*       m_actionFlickr;
+     QAction*       m_action23;
+-    QAction*       m_actionZooomr;
+ 
+     FlickrWindow*  m_dlgFlickr;
+     FlickrWindow*  m_dlg23;
+-    FlickrWindow*  m_dlgZooomr;
+ 
+     SelectUserDlg* selectFlickr;
+     SelectUserDlg* select23;
+-    SelectUserDlg* selectZoomr;
+ };
+ 
+ } //namespace KIPIFlickrPlugin
diff -durN orig/digikam-5.3.0/debian/patches/series digikam-5.3.0/debian/patches/series
--- orig/digikam-5.3.0/debian/patches/series	2016-11-12 13:44:51.000000000 -0600
+++ digikam-5.3.0/debian/patches/series	2017-09-07 10:04:33.536315494 -0500
@@ -1 +1,2 @@
 cmake-disable-jasper.patch
+flickr.diff
diff -durN orig/digikam-5.3.0/extra/kipi-plugins/common/libkipiplugins/CMakeLists.txt digikam-5.3.0/extra/kipi-plugins/common/libkipiplugins/CMakeLists.txt
--- orig/digikam-5.3.0/extra/kipi-plugins/common/libkipiplugins/CMakeLists.txt	2016-11-06 04:43:00.000000000 -0600
+++ digikam-5.3.0/extra/kipi-plugins/common/libkipiplugins/CMakeLists.txt	2017-09-07 11:43:00.427659076 -0500
@@ -54,9 +54,9 @@
     ${CMAKE_CURRENT_SOURCE_DIR}/o2/src/o0abstractstore.h
     ${CMAKE_CURRENT_SOURCE_DIR}/o2/src/o0globals.h
     # Enable when needed
-    #${CMAKE_CURRENT_SOURCE_DIR}/o2/src/o1.cpp
-    #${CMAKE_CURRENT_SOURCE_DIR}/o2/src/o1requestor.cpp
-    #${CMAKE_CURRENT_SOURCE_DIR}/o2/src/o1timedreply.cpp
+    ${CMAKE_CURRENT_SOURCE_DIR}/o2/src/o1.cpp
+    ${CMAKE_CURRENT_SOURCE_DIR}/o2/src/o1requestor.cpp
+    ${CMAKE_CURRENT_SOURCE_DIR}/o2/src/o1timedreply.cpp
     #${CMAKE_CURRENT_SOURCE_DIR}/o2/src/o1twitter.h
     #${CMAKE_CURRENT_SOURCE_DIR}/o2/src/oxtwitter.cpp
     #${CMAKE_CURRENT_SOURCE_DIR}/o2/src/o1dropbox.h
diff -durN orig/digikam-5.3.0/extra/kipi-plugins/flickr/flickrtalker.cpp digikam-5.3.0/extra/kipi-plugins/flickr/flickrtalker.cpp
--- orig/digikam-5.3.0/extra/kipi-plugins/flickr/flickrtalker.cpp	2016-11-06 04:43:00.000000000 -0600
+++ digikam-5.3.0/extra/kipi-plugins/flickr/flickrtalker.cpp	2017-09-07 11:43:00.427659076 -0500
@@ -1,13 +1,14 @@
 /* ============================================================
  *
- * This file is a part of kipi-plugins project
+ * This file is a part of digiKam project
  * http://www.digikam.org
  *
  * Date        : 2005-07-07
  * Description : a kipi plugin to export images to Flickr web service
  *
  * Copyright (C) 2005-2009 by Vardhman Jain <vardhman at gmail dot com>
- * Copyright (C) 2009-2016 by Gilles Caulier <caulier dot gilles at gmail dot com>
+ * Copyright (C) 2009-2017 by Gilles Caulier <caulier dot gilles at gmail dot com>
+ * Copyright (C) 2017      by Maik Qualmann <metzpinguin at gmail dot com>
  *
  * This program is free software; you can redistribute it
  * and/or modify it under the terms of the GNU General
@@ -34,7 +35,6 @@
 #include <QMap>
 #include <QStringList>
 #include <QProgressDialog>
-#include <QUrlQuery>
 #include <QStandardPaths>
 #include <QApplication>
 #include <QDesktopServices>
@@ -68,6 +68,8 @@
     m_state           = FE_LOGOUT;
     m_serviceName     = serviceName;
     m_iface           = 0;
+    m_o1              = 0;
+    m_requestor       = 0;
 
     PluginLoader* const pl = PluginLoader::instance();
 
@@ -76,34 +78,27 @@
         m_iface = pl->interface();
     }
 
-    if (serviceName == QString::fromLatin1("23"))
+    if (serviceName == QLatin1String("23"))
     {
-        m_apiUrl    = QString::fromLatin1("http://www.23hq.com/services/rest/");
-        m_authUrl   = QString::fromLatin1("http://www.23hq.com/services/auth/");
-        m_uploadUrl = QString::fromLatin1("http://www.23hq.com/services/upload/");
+        m_apiUrl    = QLatin1String("http://www.23hq.com/services/rest/");
+        m_authUrl   = QLatin1String("http://www.23hq.com/services/auth/");
+        m_uploadUrl = QLatin1String("http://www.23hq.com/services/upload/");
 
         // bshanks: do 23 and flickr really share API keys? or does 23 not need
         // one?
-        m_apikey    = QString::fromLatin1("49d585bafa0758cb5c58ab67198bf632");
-        m_secret    = QString::fromLatin1("34b39925e6273ffd");
-    }
-    else if (serviceName == QString::fromLatin1("Zooomr"))
-    {
-        m_apiUrl    = QString::fromLatin1("http://api.zooomr.com/services/rest/");
-        m_authUrl   = QString::fromLatin1("http://www.zooomr.com/services/auth/");
-        m_uploadUrl = QString::fromLatin1("http://upload.zooomr.com/services/upload/");
-
-        m_apikey    = QString::fromLatin1("18c8db5ce9ed4e15a7b484136f5080c5");
-        m_secret    = QString::fromLatin1("1ea4af14e3");
+        m_apikey    = QLatin1String("49d585bafa0758cb5c58ab67198bf632");
+        m_secret    = QLatin1String("34b39925e6273ffd");
     }
     else
     {
-        m_apiUrl    = QString::fromLatin1("https://www.flickr.com/services/rest/");
-        m_authUrl   = QString::fromLatin1("https://www.flickr.com/services/auth/");
-        m_uploadUrl = QString::fromLatin1("https://api.flickr.com/services/upload/");
+        m_apiUrl    = QLatin1String("https://www.flickr.com/services/rest/");
+        m_authUrl   = QLatin1String("https://www.flickr.com/services/oauth/authorize?perms=write");
+        m_tokenUrl  = QLatin1String("https://www.flickr.com/services/oauth/request_token");
+        m_accessUrl = QLatin1String("https://www.flickr.com/services/oauth/access_token");
+        m_uploadUrl = QLatin1String("https://up.flickr.com/services/upload/");
 
-        m_apikey    = QString::fromLatin1("49d585bafa0758cb5c58ab67198bf632");
-        m_secret    = QString::fromLatin1("34b39925e6273ffd");
+        m_apikey    = QLatin1String("49d585bafa0758cb5c58ab67198bf632");
+        m_secret    = QLatin1String("34b39925e6273ffd");
     }
 
     m_netMngr = new QNetworkAccessManager(this);
@@ -116,8 +111,24 @@
     /* Initialize photo sets list. */
     m_photoSetsList    = new QLinkedList<FPhotoSet>();
 
-    connect(this, SIGNAL(signalAuthenticate()),
-            this, SLOT(slotAuthenticate()));
+    m_o1 = new O1(this);
+
+    m_o1->setClientId(m_apikey);
+    m_o1->setClientSecret(m_secret);
+    m_o1->setAuthorizeUrl(QUrl(m_authUrl));
+    m_o1->setAccessTokenUrl(QUrl(m_accessUrl));
+    m_o1->setRequestTokenUrl(QUrl(m_tokenUrl));
+
+    connect(m_o1, SIGNAL(linkingFailed()),
+            this, SLOT(slotLinkingFailed()));
+
+    connect(m_o1, SIGNAL(linkingSucceeded()),
+            this, SLOT(slotLinkingSucceeded()));
+
+    connect(m_o1, SIGNAL(openBrowser(QUrl)),
+            this, SLOT(slotOpenBrowser(QUrl)));
+
+    m_requestor = new O1Requestor(m_netMngr, m_o1, this);
 }
 
 FlickrTalker::~FlickrTalker()
@@ -132,144 +143,51 @@
     removeTemporaryDir(m_serviceName.toLatin1().constData());
 }
 
-/** Compute MD5 signature using url queries keys and values following Flickr notice:
-    http://www.flickr.com/services/api/auth.spec.html
-*/
-QString FlickrTalker::getApiSig(const QString& secret, const QUrl& url)
+void FlickrTalker::link()
 {
-    QUrlQuery urlQuery(url.query());
-    QList<QPair<QString, QString> > temp_queries = urlQuery.queryItems();
-    QMap<QString, QString> queries;
-
-    QPair<QString, QString> pair;
-
-    foreach(pair, temp_queries)
-    {
-        queries.insert(pair.first,pair.second);
-    }
-
-    QString compressed(secret);
-
-    // NOTE: iterator QMap iterator will sort alphabetically items based on key values.
-    for (QMap<QString, QString>::iterator it = queries.begin() ; it != queries.end(); ++it)
-    {
-        compressed.append(it.key());
-        compressed.append(it.value());
-    }
+    emit signalBusy(true);
+    m_o1->link();
+}
 
-    QCryptographicHash context(QCryptographicHash::Md5);
-    context.addData(compressed.toUtf8());
-    return QLatin1String(context.result().toHex().data());
+void FlickrTalker::unlink()
+{
+    m_o1->unlink();
 }
 
-QString FlickrTalker::getMaxAllowedFileSize()
+void FlickrTalker::slotLinkingFailed()
 {
-    return m_maxSize;
+    qCDebug(KIPIPLUGINS_LOG) << "LINK to Fickr fail";
+    emit signalBusy(false);
 }
 
-void FlickrTalker::maxAllowedFileSize()
+void FlickrTalker::slotLinkingSucceeded()
 {
-    if (m_reply)
+    if (!m_o1->linked())
     {
-        m_reply->abort();
-        m_reply = 0;
+        qCDebug(KIPIPLUGINS_LOG) << "UNLINK to Fickr ok";
+        return;
     }
 
-    QUrl url(m_apiUrl);
-    QUrlQuery urlQuery;
-    urlQuery.addQueryItem(QString::fromLatin1("auth_token"), m_token);
-    urlQuery.addQueryItem(QString::fromLatin1("api_key"), m_apikey);
-    urlQuery.addQueryItem(QString::fromLatin1("method"), QString::fromLatin1("flickr.people.getLimits"));
-    url.setQuery(urlQuery);
-    QString md5 = getApiSig(m_secret, url);
-    urlQuery.addQueryItem(QString::fromLatin1("api_sig"), md5);
-    url.setQuery(urlQuery);
-    qCDebug(KIPIPLUGINS_LOG) << "Get max file size url: " << url;
-
-    if (m_serviceName == QString::fromLatin1("Zooomr"))
-    {
-        // Zooomr redirects the POST at this url to a GET.
-        m_reply = m_netMngr->get(QNetworkRequest(url));
-    }
-    else
-    {
-        QNetworkRequest netRequest(url);
-        netRequest.setHeader(QNetworkRequest::ContentTypeHeader, QLatin1String("application/x-www-form-urlencoded"));
+    qCDebug(KIPIPLUGINS_LOG) << "LINK to Fickr ok";
 
-        m_reply = m_netMngr->post(netRequest, QByteArray());
-    }
+    m_username = m_o1->extraTokens()[QLatin1String("username")].toString();
+    m_userId   = m_o1->extraTokens()[QLatin1String("user_nsid")].toString();
 
-    m_state = FE_GETMAXSIZE;
-    m_authProgressDlg->setLabelText(i18n("Getting the maximum allowed file size."));
-    m_authProgressDlg->setMaximum(4);
-    m_authProgressDlg->setValue(1);
-    m_buffer.resize(0);
-    emit signalBusy(true);
+    emit signalLinkingSucceeded();
 }
 
-// MD5 signature of the request.
-/*
-QString FlickrTalker::getApiSig(const QString& secret, const QStringList &headers)
+void FlickrTalker::slotOpenBrowser(const QUrl& url)
 {
-    QMap<QString, QString> queries = url.queryItems();
-    QString compressed(secret);
-
-    // NOTE: iterator QMap iterator will sort alphabetically items based on key values.
-    for (QMap<QString, QString>::iterator it = queries.begin() ; it != queries.end(); ++it)
-    {
-        compressed.append(it.key());
-        compressed.append(it.value());
-    }
-
-    QCryptographicHash context(QCryptographicHash::Md5);
-    context.addData(compressed.toUtf8());
-    return context.result().toHex().data();
+    qCDebug(KIPIPLUGINS_LOG) << "Open Browser...";
+    QDesktopServices::openUrl(url);
 }
-*/
 
-/**get the API sig and send it to the server server should return a frob.
-*/
-void FlickrTalker::getFrob()
+QString FlickrTalker::getMaxAllowedFileSize()
 {
-    if (m_reply)
-    {
-        m_reply->abort();
-        m_reply = 0;
-    }
-
-    QUrl url(m_apiUrl);
-    QUrlQuery urlQuery;
-    urlQuery.addQueryItem(QString::fromLatin1("method"), QString::fromLatin1("flickr.auth.getFrob"));
-    urlQuery.addQueryItem(QString::fromLatin1("api_key"), m_apikey);
-    url.setQuery(urlQuery);
-
-    QString md5 = getApiSig(m_secret, url);
-    urlQuery.addQueryItem(QString::fromLatin1("api_sig"), md5);
-    url.setQuery(urlQuery);
-    qCDebug(KIPIPLUGINS_LOG) << "Get frob url: " << url;
-
-    if (m_serviceName == QString::fromLatin1("Zooomr"))
-    {
-        // Zooomr redirects the POST at this url to a GET.
-        m_reply = m_netMngr->get(QNetworkRequest(url));
-    }
-    else
-    {
-        QNetworkRequest netRequest(url);
-        netRequest.setHeader(QNetworkRequest::ContentTypeHeader, QLatin1String("application/x-www-form-urlencoded"));
-
-        m_reply = m_netMngr->post(netRequest, QByteArray());
-    }
-
-    m_state = FE_GETFROB;
-    m_authProgressDlg->setLabelText(i18n("Getting the Frob"));
-    m_authProgressDlg->setMaximum(4);
-    m_authProgressDlg->setValue(1);
-    m_buffer.resize(0);
-    emit signalBusy(true);
+    return m_maxSize;
 }
 
-void FlickrTalker::checkToken(const QString& token)
+void FlickrTalker::maxAllowedFileSize()
 {
     if (m_reply)
     {
@@ -277,39 +195,30 @@
         m_reply = 0;
     }
 
+    if (!m_o1->linked())
+        return;
+
     QUrl url(m_apiUrl);
-    QUrlQuery urlQuery;
-    urlQuery.addQueryItem(QString::fromLatin1("method"), QString::fromLatin1("flickr.auth.checkToken"));
-    urlQuery.addQueryItem(QString::fromLatin1("api_key"), m_apikey);
-    urlQuery.addQueryItem(QString::fromLatin1("auth_token"), token);
-    url.setQuery(urlQuery);
-    QString md5 = getApiSig(m_secret, url);
-    urlQuery.addQueryItem(QString::fromLatin1("api_sig"), md5);
-    url.setQuery(urlQuery);
-    qCDebug(KIPIPLUGINS_LOG) << "Check token url: " << url;
+    QNetworkRequest netRequest(url);
+    QList<O0RequestParameter> reqParams = QList<O0RequestParameter>();
 
-    if (m_serviceName == QString::fromLatin1("Zooomr"))
-    {
-        // Zooomr redirects the POST at this url to a GET.
-        m_reply = m_netMngr->get(QNetworkRequest(url));
-    }
-    else
-    {
-        QNetworkRequest netRequest(url);
-        netRequest.setHeader(QNetworkRequest::ContentTypeHeader, QLatin1String("application/x-www-form-urlencoded"));
+    netRequest.setHeader(QNetworkRequest::ContentTypeHeader, QLatin1String(O2_MIME_TYPE_XFORM));
 
-        m_reply = m_netMngr->post(netRequest, QByteArray());
-    }
+    reqParams << O0RequestParameter("method", "flickr.people.getLimits");
 
-    m_state = FE_CHECKTOKEN;
-    m_authProgressDlg->setLabelText(i18n("Checking if previous token is still valid"));
+    QByteArray postData = O1::createQueryParameters(reqParams);
+
+    m_reply = m_requestor->post(netRequest, reqParams, postData);
+
+    m_state = FE_GETMAXSIZE;
+    m_authProgressDlg->setLabelText(i18n("Getting the maximum allowed file size."));
     m_authProgressDlg->setMaximum(4);
     m_authProgressDlg->setValue(1);
     m_buffer.resize(0);
     emit signalBusy(true);
 }
 
-void FlickrTalker::slotAuthenticate()
+void FlickrTalker::listPhotoSets()
 {
     if (m_reply)
     {
@@ -317,116 +226,22 @@
         m_reply = 0;
     }
 
-    QUrl url(m_authUrl);
-    QUrlQuery urlQuery;
-    urlQuery.addQueryItem(QString::fromLatin1("api_key"), m_apikey);
-    urlQuery.addQueryItem(QString::fromLatin1("frob"), m_frob);
-    urlQuery.addQueryItem(QString::fromLatin1("perms"), QString::fromLatin1("write"));
-    url.setQuery(urlQuery);
-
-    QString md5 = getApiSig(m_secret, url);
-    urlQuery.addQueryItem(QString::fromLatin1("api_sig"), md5);
-    url.setQuery(urlQuery);
-    qCDebug(KIPIPLUGINS_LOG) << "Authenticate url: " << url;
-
-    QDesktopServices::openUrl(url);
-
-    QMessageBox quest(QMessageBox::Question,
-                      i18n("%1 Service Web Authorization", m_serviceName),
-                      i18n("Please follow the instructions in the browser window, then "
-                           "return to press corresponding button."),
-                      QMessageBox::Yes | QMessageBox::No);
-
-    (quest.button(QMessageBox::Yes))->setText(i18n("I am authenticated"));
-    (quest.button(QMessageBox::No))->setText(i18n("I am not authenticated"));
-
-    if (quest.exec() == QMessageBox::Yes)
-    {
-        getToken();
-        m_authProgressDlg->setLabelText(i18n("Authenticating the User on web"));
-        m_authProgressDlg->setMaximum(4);
-        m_authProgressDlg->setValue(2);
-        emit signalBusy(false);
-    }
-    else
-    {
-        qCDebug(KIPIPLUGINS_LOG) << "User didn't proceed with getToken Authorization, cannot proceed further, aborting";
-        cancel();
-    }
-}
+    if (!m_o1->linked())
+        return;
 
-void FlickrTalker::getToken()
-{
-    if (m_reply)
-    {
-        m_reply->abort();
-        m_reply = 0;
-    }
+    qCDebug(KIPIPLUGINS_LOG) << "List photoset invoked";
 
     QUrl url(m_apiUrl);
-    QUrlQuery urlQuery;
-    urlQuery.addQueryItem(QString::fromLatin1("api_key"), m_apikey);
-    urlQuery.addQueryItem(QString::fromLatin1("method"), QString::fromLatin1("flickr.auth.getToken"));
-    urlQuery.addQueryItem(QString::fromLatin1("frob"), m_frob);
-    url.setQuery(urlQuery);
-    QString md5 = getApiSig(m_secret, url);
-    urlQuery.addQueryItem(QString::fromLatin1("api_sig"), md5);
-    url.setQuery(urlQuery);
-    qCDebug(KIPIPLUGINS_LOG) << "Get token url: " << url;
-
-    if (m_serviceName == QString::fromLatin1("Zooomr"))
-    {
-        // Zooomr redirects the POST at this url to a GET.
-        m_reply = m_netMngr->get(QNetworkRequest(url));
-    }
-    else
-    {
-        QNetworkRequest netRequest(url);
-        netRequest.setHeader(QNetworkRequest::ContentTypeHeader, QLatin1String("application/x-www-form-urlencoded"));
-
-        m_reply = m_netMngr->post(netRequest, QByteArray());
-    }
-
-    m_state = FE_GETTOKEN;
-    m_buffer.resize(0);
-    emit signalBusy(true);
-    m_authProgressDlg->setLabelText(i18n("Getting the Token from the server"));
-    m_authProgressDlg->setMaximum(4);
-    m_authProgressDlg->setValue(3);
-}
+    QNetworkRequest netRequest(url);
+    QList<O0RequestParameter> reqParams = QList<O0RequestParameter>();
 
-void FlickrTalker::listPhotoSets()
-{
-    if (m_reply)
-    {
-        m_reply->abort();
-        m_reply = 0;
-    }
+    netRequest.setHeader(QNetworkRequest::ContentTypeHeader, QLatin1String(O2_MIME_TYPE_XFORM));
 
-    qCDebug(KIPIPLUGINS_LOG) << "List photoset invoked";
-    QUrl url(m_apiUrl);
-    QUrlQuery urlQuery;
-    urlQuery.addQueryItem(QString::fromLatin1("auth_token"), m_token);
-    urlQuery.addQueryItem(QString::fromLatin1("api_key"), m_apikey);
-    urlQuery.addQueryItem(QString::fromLatin1("method"), QString::fromLatin1("flickr.photosets.getList"));
-    url.setQuery(urlQuery);
-    QString md5 = getApiSig(m_secret, url);
-    urlQuery.addQueryItem(QString::fromLatin1("api_sig"), md5);
-    url.setQuery(urlQuery);
-    qCDebug(KIPIPLUGINS_LOG) << "List photoset URL" << url;
+    reqParams << O0RequestParameter("method", "flickr.photosets.getList");
 
-    if (m_serviceName == QString::fromLatin1("Zooomr"))
-    {
-        // Zooomr redirects the POST at this url to a GET.
-        m_reply = m_netMngr->get(QNetworkRequest(url));
-    }
-    else
-    {
-        QNetworkRequest netRequest(url);
-        netRequest.setHeader(QNetworkRequest::ContentTypeHeader, QLatin1String("application/x-www-form-urlencoded"));
+    QByteArray postData = O1::createQueryParameters(reqParams);
 
-        m_reply = m_netMngr->post(netRequest, QByteArray());
-    }
+    m_reply = m_requestor->post(netRequest, reqParams, postData);
 
     m_state = FE_LISTPHOTOSETS;
     m_buffer.resize(0);
@@ -441,43 +256,30 @@
         m_reply = 0;
     }
 
+    if (!m_o1->linked())
+        return;
+
     QUrl url(m_apiUrl);
-    QUrlQuery urlQuery;
-    urlQuery.addQueryItem(QString::fromLatin1("api_key"), m_apikey);
-    urlQuery.addQueryItem(QString::fromLatin1("method"), method);
-    urlQuery.addQueryItem(QString::fromLatin1("frob"), m_frob);
+    QNetworkRequest netRequest(url);
+    QList<O0RequestParameter> reqParams = QList<O0RequestParameter>();
+
+    netRequest.setHeader(QNetworkRequest::ContentTypeHeader, QLatin1String(O2_MIME_TYPE_XFORM));
+
+    reqParams << O0RequestParameter("method", method.toLatin1());
 
     for (QStringList::const_iterator it = argList.constBegin(); it != argList.constEnd(); ++it)
     {
         QStringList str = (*it).split(QLatin1Char('='), QString::SkipEmptyParts);
-        urlQuery.addQueryItem(str[0], str[1]);
+        reqParams << O0RequestParameter(str[0].toLatin1(), str[1].toLatin1());
     }
 
-    url.setQuery(urlQuery);
-    QString md5 = getApiSig(m_secret, url);
-    urlQuery.addQueryItem(QString::fromLatin1("api_sig"), md5);
-    url.setQuery(urlQuery);
-    qCDebug(KIPIPLUGINS_LOG) << "Get photo property url: " << url;
-
-    if (m_serviceName == QString::fromLatin1("Zooomr"))
-    {
-        // Zooomr redirects the POST at this url to a GET.
-        m_reply = m_netMngr->get(QNetworkRequest(url));
-    }
-    else
-    {
-        QNetworkRequest netRequest(url);
-        netRequest.setHeader(QNetworkRequest::ContentTypeHeader, QLatin1String("application/x-www-form-urlencoded"));
+    QByteArray postData = O1::createQueryParameters(reqParams);
 
-        m_reply = m_netMngr->post(netRequest, QByteArray());
-    }
+    m_reply = m_requestor->post(netRequest, reqParams, postData);
 
     m_state = FE_GETPHOTOPROPERTY;
     m_buffer.resize(0);
     emit signalBusy(true);
-
-    //  m_authProgressDlg->setLabelText("Getting the Token from the server");
-    //  m_authProgressDlg->setProgress(3,4);
 }
 
 void FlickrTalker::listPhotos(const QString& /*albumName*/)
@@ -494,34 +296,25 @@
         m_reply = 0;
     }
 
-    qCDebug(KIPIPLUGINS_LOG) << "create photoset invoked";
+    if (!m_o1->linked())
+        return;
+
+    qCDebug(KIPIPLUGINS_LOG) << "Create photoset invoked";
+
     QUrl url(m_apiUrl);
-    QUrlQuery urlQuery;
-    urlQuery.addQueryItem(QString::fromLatin1("auth_token"), m_token);
-    urlQuery.addQueryItem(QString::fromLatin1("api_key"), m_apikey);
-    urlQuery.addQueryItem(QString::fromLatin1("method"), QString::fromLatin1("flickr.photosets.create"));
-    urlQuery.addQueryItem(QString::fromLatin1("title"), albumTitle);
-    urlQuery.addQueryItem(QString::fromLatin1("description"), albumDescription);
-    urlQuery.addQueryItem(QString::fromLatin1("primary_photo_id"), primaryPhotoId);
-    url.setQuery(urlQuery);
+    QNetworkRequest netRequest(url);
+    QList<O0RequestParameter> reqParams = QList<O0RequestParameter>();
 
-    QString md5 = getApiSig(m_secret, url);
-    urlQuery.addQueryItem(QString::fromLatin1("api_sig"), md5);
-    url.setQuery(urlQuery);
-    qCDebug(KIPIPLUGINS_LOG) << "List photo sets url: " << url;
+    netRequest.setHeader(QNetworkRequest::ContentTypeHeader, QLatin1String(O2_MIME_TYPE_XFORM));
 
-    if (m_serviceName == QString::fromLatin1("Zooomr"))
-    {
-        // Zooomr redirects the POST at this url to a GET.
-        m_reply = m_netMngr->get(QNetworkRequest(url));
-    }
-    else
-    {
-        QNetworkRequest netRequest(url);
-        netRequest.setHeader(QNetworkRequest::ContentTypeHeader, QLatin1String("application/x-www-form-urlencoded"));
+    reqParams << O0RequestParameter("method", "flickr.photosets.create");
+    reqParams << O0RequestParameter("title", albumTitle.toLatin1());
+    reqParams << O0RequestParameter("description", albumDescription.toLatin1());
+    reqParams << O0RequestParameter("primary_photo_id", primaryPhotoId.toLatin1());
 
-        m_reply = m_netMngr->post(netRequest, QByteArray());
-    }
+    QByteArray postData = O1::createQueryParameters(reqParams);
+
+    m_reply = m_requestor->post(netRequest, reqParams, postData);
 
     m_state = FE_CREATEPHOTOSET;
     m_buffer.resize(0);
@@ -537,9 +330,10 @@
         m_reply = 0;
     }
 
-    qCDebug(KIPIPLUGINS_LOG) << "addPhotoToPhotoSet invoked";
-    QUrl url(m_apiUrl);
-    QUrlQuery urlQuery;
+    if (!m_o1->linked())
+        return;
+
+    qCDebug(KIPIPLUGINS_LOG) << "AddPhotoToPhotoSet invoked";
 
     /* If the photoset id starts with the special string "UNDEFINED_", it means
      * it doesn't exist yet on Flickr and needs to be created. Note that it's
@@ -547,26 +341,23 @@
      * is done in the set creation call to Flickr. */
     if (photoSetId.startsWith(QLatin1String("UNDEFINED_")))
     {
-        createPhotoSet(QString::fromLatin1(""), m_selectedPhotoSet.title, m_selectedPhotoSet.description, photoId);
+        createPhotoSet(QLatin1String(""), m_selectedPhotoSet.title, m_selectedPhotoSet.description, photoId);
     }
     else
     {
-        urlQuery.addQueryItem(QString::fromLatin1("auth_token"), m_token);
-        urlQuery.addQueryItem(QString::fromLatin1("photoset_id"), photoSetId);
-        urlQuery.addQueryItem(QString::fromLatin1("api_key"), m_apikey);
-        urlQuery.addQueryItem(QString::fromLatin1("method"), QString::fromLatin1("flickr.photosets.addPhoto"));
-        urlQuery.addQueryItem(QString::fromLatin1("photo_id"), photoId);
-        url.setQuery(urlQuery);
+        QUrl url(m_apiUrl);
+        QNetworkRequest netRequest(url);
+        QList<O0RequestParameter> reqParams = QList<O0RequestParameter>();
 
-        QString md5 = getApiSig(m_secret, url);
-        urlQuery.addQueryItem(QString::fromLatin1("api_sig"), md5);
-        url.setQuery(urlQuery);
-        qCDebug(KIPIPLUGINS_LOG) << "Add photo to Photo set url: " << url;
+        netRequest.setHeader(QNetworkRequest::ContentTypeHeader, QLatin1String(O2_MIME_TYPE_XFORM));
 
-        QNetworkRequest netRequest(url);
-        netRequest.setHeader(QNetworkRequest::ContentTypeHeader, QLatin1String("application/x-www-form-urlencoded"));
+        reqParams << O0RequestParameter("method", "flickr.photosets.addPhoto");
+        reqParams << O0RequestParameter("photoset_id", photoSetId.toLatin1());
+        reqParams << O0RequestParameter("photo_id", photoId.toLatin1());
 
-        m_reply = m_netMngr->post(netRequest, QByteArray());
+        QByteArray postData = O1::createQueryParameters(reqParams);
+
+        m_reply = m_requestor->post(netRequest, reqParams, postData);
 
         m_state = FE_ADDPHOTOTOPHOTOSET;
         m_buffer.resize(0);
@@ -575,7 +366,7 @@
 }
 
 bool FlickrTalker::addPhoto(const QString& photoPath, const FPhotoInfo& info,
-                            bool rescale, int maxDim, int imageQuality)
+                            bool original, bool rescale, int maxDim, int imageQuality)
 {
     if (m_reply)
     {
@@ -583,123 +374,120 @@
         m_reply = 0;
     }
 
+    if (!m_o1->linked())
+        return false;
+
     QUrl url(m_uploadUrl);
+    QNetworkRequest netRequest(url);
+    QList<O0RequestParameter> reqParams = QList<O0RequestParameter>();
 
-    // We dont' want to modify url as such, we just used the QUrl object for storing the query items.
-    QUrl url2(QString::fromLatin1(""));
-    QUrlQuery urlQuery;
     QString path = photoPath;
     MPForm  form;
 
-    form.addPair(QString::fromLatin1("auth_token"), m_token, QString::fromLatin1("text/plain"));
-    urlQuery.addQueryItem(QString::fromLatin1("auth_token"), m_token);
-
-    form.addPair(QString::fromLatin1("api_key"), m_apikey, QString::fromLatin1("text/plain"));
-    urlQuery.addQueryItem(QString::fromLatin1("api_key"), m_apikey);
-
-    QString ispublic = (info.is_public == 1) ? QString::fromLatin1("1") : QString::fromLatin1("0");
-    form.addPair(QString::fromLatin1("is_public"), ispublic, QString::fromLatin1("text/plain"));
-    urlQuery.addQueryItem(QString::fromLatin1("is_public"), ispublic);
+    QString ispublic = (info.is_public == 1) ? QLatin1String("1") : QLatin1String("0");
+    form.addPair(QLatin1String("is_public"), ispublic, QLatin1String("text/plain"));
+    reqParams << O0RequestParameter("is_public", ispublic.toLatin1());
 
-    QString isfamily = (info.is_family == 1) ? QString::fromLatin1("1") : QString::fromLatin1("0");
-    form.addPair(QString::fromLatin1("is_family"), isfamily, QString::fromLatin1("text/plain"));
-    urlQuery.addQueryItem(QString::fromLatin1("is_family"), isfamily);
+    QString isfamily = (info.is_family == 1) ? QLatin1String("1") : QLatin1String("0");
+    form.addPair(QLatin1String("is_family"), isfamily, QLatin1String("text/plain"));
+    reqParams << O0RequestParameter("is_family", isfamily.toLatin1());
 
-    QString isfriend = (info.is_friend == 1) ? QString::fromLatin1("1") : QString::fromLatin1("0");
-    form.addPair(QString::fromLatin1("is_friend"), isfriend, QString::fromLatin1("text/plain"));
-    urlQuery.addQueryItem(QString::fromLatin1("is_friend"), isfriend);
+    QString isfriend = (info.is_friend == 1) ? QLatin1String("1") : QLatin1String("0");
+    form.addPair(QLatin1String("is_friend"), isfriend, QLatin1String("text/plain"));
+    reqParams << O0RequestParameter("is_friend", isfriend.toLatin1());
 
     QString safetyLevel = QString::number(static_cast<int>(info.safety_level));
-    form.addPair(QString::fromLatin1("safety_level"), safetyLevel, QString::fromLatin1("text/plain"));
-    urlQuery.addQueryItem(QString::fromLatin1("safety_level"), safetyLevel);
+    form.addPair(QLatin1String("safety_level"), safetyLevel, QLatin1String("text/plain"));
+    reqParams << O0RequestParameter("safety_level", safetyLevel.toLatin1());
 
     QString contentType = QString::number(static_cast<int>(info.content_type));
-    form.addPair(QString::fromLatin1("content_type"), contentType, QString::fromLatin1("text/plain"));
-    urlQuery.addQueryItem(QString::fromLatin1("content_type"), contentType);
+    form.addPair(QLatin1String("content_type"), contentType, QLatin1String("text/plain"));
+    reqParams << O0RequestParameter("content_type", contentType.toLatin1());
 
-    QString tags = QString::fromLatin1("\"") + info.tags.join(QString::fromLatin1("\" \"")) + QString::fromLatin1("\"");
+    QString tags = QLatin1String("\"") + info.tags.join(QLatin1String("\" \"")) + QLatin1String("\"");
 
     if (tags.length() > 0)
     {
-        form.addPair(QString::fromLatin1("tags"), tags, QString::fromLatin1("text/plain"));
-        urlQuery.addQueryItem(QString::fromLatin1("tags"), tags);
+        form.addPair(QLatin1String("tags"), tags, QLatin1String("text/plain"));
+        reqParams << O0RequestParameter("tags", tags.toLatin1());
     }
 
     if (!info.title.isEmpty())
     {
-        form.addPair(QString::fromLatin1("title"), info.title, QString::fromLatin1("text/plain"));
-        urlQuery.addQueryItem(QString::fromLatin1("title"), info.title);
+        form.addPair(QLatin1String("title"), info.title, QLatin1String("text/plain"));
+        reqParams << O0RequestParameter("title", info.title.toLatin1());
     }
 
     if (!info.description.isEmpty())
     {
-        form.addPair(QString::fromLatin1("description"), info.description, QString::fromLatin1("text/plain"));
-        urlQuery.addQueryItem(QString::fromLatin1("description"), info.description);
-    }
-
-    url2.setQuery(urlQuery);
-    QString md5 = getApiSig(m_secret, url2);
-    form.addPair(QString::fromLatin1("api_sig"), md5, QString::fromLatin1("text/plain"));
-    QImage image;
-
-    if (m_iface)
-    {
-        image = m_iface->preview(QUrl::fromLocalFile(photoPath));
+        form.addPair(QLatin1String("description"), info.description, QLatin1String("text/plain"));
+        reqParams << O0RequestParameter("description", info.description.toLatin1());
     }
 
-    if (image.isNull())
+    if (!original)
     {
-        image.load(photoPath);
-    }
+        QImage image;
 
-    if (!image.isNull())
-    {
-        if (!m_lastTmpFile.isEmpty())
+        if (m_iface)
         {
-            QFile::remove(m_lastTmpFile);
+            image = m_iface->preview(QUrl::fromLocalFile(photoPath));
         }
 
-        path = makeTemporaryDir(m_serviceName.toLatin1().constData()).filePath(QFileInfo(photoPath)
-                                                                     .baseName().trimmed() + QLatin1String(".jpg"));
-
-        if (rescale)
+        if (image.isNull())
         {
-            if (image.width() > maxDim || image.height() > maxDim)
-                image = image.scaled(maxDim, maxDim, Qt::KeepAspectRatio, Qt::SmoothTransformation);
+            image.load(photoPath);
         }
 
-        image.save(path, "JPEG", imageQuality);
-        m_lastTmpFile = path;
-
-        // Restore all metadata.
-
-        if (m_iface)
+        if (!image.isNull())
         {
-            QPointer<MetadataProcessor> meta = m_iface->createMetadataProcessor();
-
-            if (meta && meta->load(QUrl::fromLocalFile(photoPath)))
+            if (!m_lastTmpFile.isEmpty())
             {
-                meta->setImageDimensions(image.size());
+                QFile::remove(m_lastTmpFile);
+            }
 
-                // NOTE: see bug #153207: Flickr use IPTC keywords to create Tags in web interface
-                //       As IPTC do not support UTF-8, we need to remove it.
-                meta->removeIptcTags(QStringList() << QLatin1String("Iptc.Application2.Keywords"));
+            path = makeTemporaryDir(m_serviceName.toLatin1().constData()).filePath(QFileInfo(photoPath)
+                                                                         .baseName().trimmed() + QLatin1String(".jpg"));
 
-                meta->setImageProgramId(QString::fromLatin1("Kipi-plugins"), kipipluginsVersion());
-                meta->save(QUrl::fromLocalFile(path));
+            if (rescale)
+            {
+                if (image.width() > maxDim || image.height() > maxDim)
+                    image = image.scaled(maxDim, maxDim, Qt::KeepAspectRatio, Qt::SmoothTransformation);
             }
-            else
+
+            image.save(path, "JPEG", imageQuality);
+            m_lastTmpFile = path;
+
+            // Restore all metadata.
+
+            if (m_iface)
             {
-                qCWarning(KIPIPLUGINS_LOG) << "flickrExport::Image doesn't have metadata";
+                QPointer<MetadataProcessor> meta = m_iface->createMetadataProcessor();
+
+                if (meta && meta->load(QUrl::fromLocalFile(photoPath)))
+                {
+                    meta->setImageDimensions(image.size());
+                    meta->setImageOrientation(MetadataProcessor::NORMAL);
+
+                    // NOTE: see bug #153207: Flickr use IPTC keywords to create Tags in web interface
+                    //       As IPTC do not support UTF-8, we need to remove it.
+                    meta->removeIptcTags(QStringList() << QLatin1String("Iptc.Application2.Keywords"));
+
+                    meta->setImageProgramId(QLatin1String("Kipi-plugins"), kipipluginsVersion());
+                    meta->save(QUrl::fromLocalFile(path), true);
+                }
+                else
+                {
+                    qCWarning(KIPIPLUGINS_LOG) << "flickrExport::Image doesn't have metadata";
+                }
             }
-        }
 
-        qCDebug(KIPIPLUGINS_LOG) << "Resizing and saving to temp file: " << path;
+            qCDebug(KIPIPLUGINS_LOG) << "Resizing and saving to temp file: " << path;
+        }
     }
 
     QFileInfo tempFileInfo(path);
 
-    qCDebug(KIPIPLUGINS_LOG) << "QUrl path is " << QUrl::fromLocalFile(path) << "Image size after resizing (in bytes) is "<< tempFileInfo.size();
+    qCDebug(KIPIPLUGINS_LOG) << "QUrl path is " << QUrl::fromLocalFile(path) << "Image size (in bytes) is "<< tempFileInfo.size();
 
     if (tempFileInfo.size() > (getMaxAllowedFileSize().toLongLong()))
     {
@@ -707,17 +495,16 @@
         return false;
     }
 
-    if (!form.addFile(QString::fromLatin1("photo"), path))
+    if (!form.addFile(QLatin1String("photo"), path))
     {
         return false;
     }
 
     form.finish();
 
-    QNetworkRequest netRequest(url);
     netRequest.setHeader(QNetworkRequest::ContentTypeHeader, form.contentType());
 
-    m_reply = m_netMngr->post(netRequest, form.formData());
+    m_reply = m_requestor->post(netRequest, reqParams, form.formData());
 
     m_state = FE_ADDPHOTO;
     m_buffer.resize(0);
@@ -869,22 +656,6 @@
             parseResponseListPhotoSets(m_buffer);
             break;
 
-        case (FE_GETFROB):
-            parseResponseGetFrob(m_buffer);
-            break;
-
-        case (FE_GETTOKEN):
-            parseResponseGetToken(m_buffer);
-            break;
-
-        case (FE_CHECKTOKEN):
-            parseResponseCheckToken(m_buffer);
-            break;
-
-        case (FE_GETAUTHORIZED):
-            //parseResponseGetToken(m_buffer);
-            break;
-
         case (FE_LISTPHOTOS):
             parseResponseListPhotos(m_buffer);
             break;
@@ -919,7 +690,7 @@
 void FlickrTalker::parseResponseMaxSize(const QByteArray& data)
 {
     QString errorString;
-    QDomDocument doc(QString::fromLatin1("mydocument"));
+    QDomDocument doc(QLatin1String("mydocument"));
 
     if (!doc.setContent(data))
     {
@@ -933,7 +704,7 @@
 
     while (!node.isNull())
     {
-        if (node.isElement() && node.nodeName() == QString::fromLatin1("person"))
+        if (node.isElement() && node.nodeName() == QLatin1String("person"))
         {
             e                = node.toElement();
             QDomNode details = e.firstChild();
@@ -944,9 +715,9 @@
                 {
                     e = details.toElement();
 
-                    if (details.nodeName() == QString::fromLatin1("photos"))
+                    if (details.nodeName() == QLatin1String("photos"))
                     {
-                        QDomAttr a = e.attributeNode(QString::fromLatin1("maxupload"));
+                        QDomAttr a = e.attributeNode(QLatin1String("maxupload"));
                         m_maxSize = a.value();
                         qCDebug(KIPIPLUGINS_LOG) << "Max upload size is"<<m_maxSize;
                     }
@@ -956,255 +727,18 @@
             }
         }
 
-        if (node.isElement() && node.nodeName() == QString::fromLatin1("err"))
-        {
-            qCDebug(KIPIPLUGINS_LOG) << "Checking Error in response";
-            errorString = node.toElement().attribute(QString::fromLatin1("code"));
-            qCDebug(KIPIPLUGINS_LOG) << "Error code=" << errorString;
-            qCDebug(KIPIPLUGINS_LOG) << "Msg=" << node.toElement().attribute(QString::fromLatin1("msg"));
-        }
-
-        node = node.nextSibling();
-    }
-}
-
-void FlickrTalker::parseResponseGetFrob(const QByteArray& data)
-{
-    bool success = false;
-    QString errorString;
-    QDomDocument doc(QString::fromLatin1("mydocument"));
-
-    if (!doc.setContent(data))
-    {
-        return;
-    }
-
-    QDomElement docElem = doc.documentElement();
-    QDomNode node       = docElem.firstChild();
-
-    while (!node.isNull())
-    {
-        if (node.isElement() && node.nodeName() == QString::fromLatin1("frob"))
-        {
-            QDomElement e = node.toElement();    // try to convert the node to an element.
-            qCDebug(KIPIPLUGINS_LOG) << "Frob is" << e.text();
-            m_frob        = e.text();            // this is what is obtained from data.
-            success       = true;
-        }
-
-        if (node.isElement() && node.nodeName() == QString::fromLatin1("err"))
-        {
-            qCDebug(KIPIPLUGINS_LOG) << "Checking Error in response";
-            errorString = node.toElement().attribute(QString::fromLatin1("code"));
-            qCDebug(KIPIPLUGINS_LOG) << "Error code=" << errorString;
-            qCDebug(KIPIPLUGINS_LOG) << "Msg=" << node.toElement().attribute(QString::fromLatin1("msg"));
-        }
-
-        node = node.nextSibling();
-    }
-
-    qCDebug(KIPIPLUGINS_LOG) << "GetFrob finished";
-    m_authProgressDlg->setMaximum(4);
-    m_authProgressDlg->setValue(2);
-    m_state = FE_GETAUTHORIZED;
-
-    if (success)
-    {
-        emit signalAuthenticate();
-    }
-    else
-    {
-        emit signalError(errorString);
-    }
-}
-
-void FlickrTalker::parseResponseCheckToken(const QByteArray& data)
-{
-    bool         success = false;
-    QString      errorString;
-    QString      username;
-    QString      transReturn;
-    QDomDocument doc(QString::fromLatin1("checktoken"));
-
-    if (!doc.setContent(data))
-    {
-        return;
-    }
-
-    QDomElement docElem = doc.documentElement();
-    QDomNode node       = docElem.firstChild();
-    QDomElement e;
-
-    while (!node.isNull())
-    {
-        if (node.isElement() && node.nodeName() == QString::fromLatin1("auth"))
-        {
-            e                = node.toElement(); // try to convert the node to an element.
-            QDomNode details = e.firstChild();
-
-            while (!details.isNull())
-            {
-                if (details.isElement())
-                {
-                    e = details.toElement();
-
-                    if (details.nodeName() == QString::fromLatin1("token"))
-                    {
-                        qCDebug(KIPIPLUGINS_LOG) << "Token=" << e.text();
-                        m_token = e.text();//this is what is obtained from data.
-                    }
-
-                    if (details.nodeName() == QString::fromLatin1("perms"))
-                    {
-                        qCDebug(KIPIPLUGINS_LOG) << "Perms=" << e.text();
-                        QString perms = e.text();//this is what is obtained from data.
-
-                        if (perms == QString::fromLatin1("write"))
-                        {
-                            transReturn = i18nc("As in the permission to", "write");
-                        }
-                        else if (perms == QString::fromLatin1("read"))
-                        {
-                            transReturn = i18nc("As in the permission to", "read");
-                        }
-                        else if (perms == QString::fromLatin1("delete"))
-                        {
-                            transReturn = i18nc("As in the permission to", "delete");
-                        }
-                    }
-
-                    if (details.nodeName() == QString::fromLatin1("user"))
-                    {
-                        qCDebug(KIPIPLUGINS_LOG) << "nsid=" << e.attribute(QString::fromLatin1("nsid"));
-                        m_userId   = e.attribute(QString::fromLatin1("nsid"));
-                        username   = e.attribute(QString::fromLatin1("username"));
-                        m_username = username;
-                        qCDebug(KIPIPLUGINS_LOG) << "username=" << e.attribute(QString::fromLatin1("username"));
-                        qCDebug(KIPIPLUGINS_LOG) << "fullname=" << e.attribute(QString::fromLatin1("fullname"));
-                    }
-                }
-
-                details = details.nextSibling();
-            }
-
-            m_authProgressDlg->hide();
-            emit signalTokenObtained(m_token);
-            success = true;
-        }
-
-        if (node.isElement() && node.nodeName() == QString::fromLatin1("err"))
-        {
-            qCDebug(KIPIPLUGINS_LOG) << "Checking Error in response";
-            errorString = node.toElement().attribute(QString::fromLatin1("code"));
-            qCDebug(KIPIPLUGINS_LOG) << "Error code=" << errorString;
-            qCDebug(KIPIPLUGINS_LOG) << "Msg=" << node.toElement().attribute(QString::fromLatin1("msg"));
-
-            int valueOk = QMessageBox::question(QApplication::activeWindow(),
-                                                i18n("Invalid Token"),
-                                                i18n("Your token is invalid. Would you like to "
-                                                      "get a new token to proceed?\n"));
-
-            if (valueOk == QMessageBox::Yes)
-            {
-                getFrob();
-                return;
-            }
-            else
-            {
-                m_authProgressDlg->hide(); //will popup the result for the checktoken failure below
-            }
-
-        }
-
-        node = node.nextSibling();
-    }
-
-    if (!success)
-    {
-        emit signalError(errorString);
-    }
-
-    qCDebug(KIPIPLUGINS_LOG) << "CheckToken finished";
-}
-
-void FlickrTalker::parseResponseGetToken(const QByteArray& data)
-{
-    bool success = false;
-    QString errorString;
-    QDomDocument doc(QString::fromLatin1("gettoken"));
-
-    if (!doc.setContent(data))
-    {
-        return;
-    }
-
-    QDomElement docElem = doc.documentElement();
-    QDomNode    node    = docElem.firstChild();
-    QDomElement e;
-
-    while (!node.isNull())
-    {
-        if (node.isElement() && node.nodeName() == QString::fromLatin1("auth"))
-        {
-            e                = node.toElement(); // try to convert the node to an element.
-            QDomNode details = e.firstChild();
-
-            while (!details.isNull())
-            {
-                if (details.isElement())
-                {
-                    e = details.toElement();
-
-                    if (details.nodeName() == QString::fromLatin1("token"))
-                    {
-                        qCDebug(KIPIPLUGINS_LOG) << "Token=" << e.text();
-                        m_token = e.text();      //this is what is obtained from data.
-                    }
-
-                    if (details.nodeName() == QString::fromLatin1("perms"))
-                    {
-                        qCDebug(KIPIPLUGINS_LOG) << "Perms=" << e.text();
-                    }
-
-                    if (details.nodeName() == QString::fromLatin1("user"))
-                    {
-                        qCDebug(KIPIPLUGINS_LOG) << "nsid=" << e.attribute(QString::fromLatin1("nsid"));
-                        qCDebug(KIPIPLUGINS_LOG) << "username=" << e.attribute(QString::fromLatin1("username"));
-                        qCDebug(KIPIPLUGINS_LOG) << "fullname=" << e.attribute(QString::fromLatin1("fullname"));
-                        m_username = e.attribute(QString::fromLatin1("username"));
-                        m_userId   = e.attribute(QString::fromLatin1("nsid"));
-                    }
-                }
-
-                details = details.nextSibling();
-            }
-
-            success = true;
-        }
-        else if (node.isElement() && node.nodeName() == QString::fromLatin1("err"))
+        if (node.isElement() && node.nodeName() == QLatin1String("err"))
         {
             qCDebug(KIPIPLUGINS_LOG) << "Checking Error in response";
-            errorString = node.toElement().attribute(QString::fromLatin1("code"));
+            errorString = node.toElement().attribute(QLatin1String("code"));
             qCDebug(KIPIPLUGINS_LOG) << "Error code=" << errorString;
-            qCDebug(KIPIPLUGINS_LOG) << "Msg=" << node.toElement().attribute(QString::fromLatin1("msg"));
-            //emit signalError(code);
+            qCDebug(KIPIPLUGINS_LOG) << "Msg=" << node.toElement().attribute(QLatin1String("msg"));
         }
 
         node = node.nextSibling();
     }
 
-    qCDebug(KIPIPLUGINS_LOG) << "GetToken finished";
-    //emit signalBusy( false );
     m_authProgressDlg->hide();
-
-    if (success)
-    {
-        emit signalTokenObtained(m_token);
-    }
-    else
-    {
-        emit signalError(errorString);
-    }
 }
 
 void FlickrTalker::parseResponseCreatePhotoSet(const QByteArray& data)
@@ -1213,7 +747,7 @@
 
     //bool success = false;
 
-    QDomDocument doc(QString::fromLatin1("getListPhotoSets"));
+    QDomDocument doc(QLatin1String("getListPhotoSets"));
 
     if (!doc.setContent(data))
     {
@@ -1226,10 +760,10 @@
 
     while (!node.isNull())
     {
-        if (node.isElement() && node.nodeName() == QString::fromLatin1("photoset"))
+        if (node.isElement() && node.nodeName() == QLatin1String("photoset"))
         {
             // Parse the id from the response.
-            QString new_id = node.toElement().attribute(QString::fromLatin1("id"));
+            QString new_id = node.toElement().attribute(QLatin1String("id"));
 
             // Set the new id in the photo sets list.
             QLinkedList<FPhotoSet>::iterator it = m_photoSetsList->begin();
@@ -1252,12 +786,12 @@
             emit signalAddPhotoSetSucceeded();
         }
 
-        if (node.isElement() && node.nodeName() == QString::fromLatin1("err"))
+        if (node.isElement() && node.nodeName() == QLatin1String("err"))
         {
             qCDebug(KIPIPLUGINS_LOG) << "Checking Error in response";
-            QString code = node.toElement().attribute(QString::fromLatin1("code"));
+            QString code = node.toElement().attribute(QLatin1String("code"));
             qCDebug(KIPIPLUGINS_LOG) << "Error code=" << code;
-            QString msg = node.toElement().attribute(QString::fromLatin1("msg"));
+            QString msg = node.toElement().attribute(QLatin1String("msg"));
             qCDebug(KIPIPLUGINS_LOG) << "Msg=" << msg;
             QMessageBox::critical(QApplication::activeWindow(), i18n("Error"), i18n("PhotoSet creation failed: ") + msg);
         }
@@ -1270,7 +804,7 @@
 {
     qCDebug(KIPIPLUGINS_LOG) << "parseResponseListPhotosets" << data;
     bool success = false;
-    QDomDocument doc(QString::fromLatin1("getListPhotoSets"));
+    QDomDocument doc(QLatin1String("getListPhotoSets"));
 
     if (!doc.setContent(data))
     {
@@ -1286,7 +820,7 @@
 
     while (!node.isNull())
     {
-        if (node.isElement() && node.nodeName() == QString::fromLatin1("photosets"))
+        if (node.isElement() && node.nodeName() == QLatin1String("photosets"))
         {
             e                    = node.toElement();
             QDomNode details     = e.firstChild();
@@ -1299,10 +833,10 @@
                 {
                     e = detailsNode.toElement();
 
-                    if (detailsNode.nodeName() == QString::fromLatin1("photoset"))
+                    if (detailsNode.nodeName() == QLatin1String("photoset"))
                     {
-                        qCDebug(KIPIPLUGINS_LOG) << "id=" << e.attribute(QString::fromLatin1("id"));
-                        photoSet_id              = e.attribute(QString::fromLatin1("id"));     // this is what is obtained from data.
+                        qCDebug(KIPIPLUGINS_LOG) << "id=" << e.attribute(QLatin1String("id"));
+                        photoSet_id              = e.attribute(QLatin1String("id"));     // this is what is obtained from data.
                         fps.id                   = photoSet_id;
                         QDomNode photoSetDetails = detailsNode.firstChild();
                         QDomElement e_detail;
@@ -1311,13 +845,13 @@
                         {
                             e_detail = photoSetDetails.toElement();
 
-                            if (photoSetDetails.nodeName() == QString::fromLatin1("title"))
+                            if (photoSetDetails.nodeName() == QLatin1String("title"))
                             {
                                 qCDebug(KIPIPLUGINS_LOG) << "Title=" << e_detail.text();
                                 photoSet_title = e_detail.text();
                                 fps.title      = photoSet_title;
                             }
-                            else if (photoSetDetails.nodeName() == QString::fromLatin1("description"))
+                            else if (photoSetDetails.nodeName() == QLatin1String("description"))
                             {
                                 qCDebug(KIPIPLUGINS_LOG) << "Description =" << e_detail.text();
                                 photoSet_description = e_detail.text();
@@ -1338,12 +872,12 @@
             success = true;
         }
 
-        if (node.isElement() && node.nodeName() == QString::fromLatin1("err"))
+        if (node.isElement() && node.nodeName() == QLatin1String("err"))
         {
             qCDebug(KIPIPLUGINS_LOG) << "Checking Error in response";
-            QString code = node.toElement().attribute(QString::fromLatin1("code"));
+            QString code = node.toElement().attribute(QLatin1String("code"));
             qCDebug(KIPIPLUGINS_LOG) << "Error code=" << code;
-            qCDebug(KIPIPLUGINS_LOG) << "Msg=" << node.toElement().attribute(QString::fromLatin1("msg"));
+            qCDebug(KIPIPLUGINS_LOG) << "Msg=" << node.toElement().attribute(QLatin1String("msg"));
             emit signalError(code);
         }
 
@@ -1365,7 +899,7 @@
 
 void FlickrTalker::parseResponseListPhotos(const QByteArray& data)
 {
-    QDomDocument doc(QString::fromLatin1("getPhotosList"));
+    QDomDocument doc(QLatin1String("getPhotosList"));
 
     if (!doc.setContent(data))
     {
@@ -1380,7 +914,7 @@
 
 void FlickrTalker::parseResponseCreateAlbum(const QByteArray& data)
 {
-    QDomDocument doc(QString::fromLatin1("getCreateAlbum"));
+    QDomDocument doc(QLatin1String("getCreateAlbum"));
 
     if (!doc.setContent(data))
     {
@@ -1397,7 +931,7 @@
 {
     bool    success = false;
     QString line;
-    QDomDocument doc(QString::fromLatin1("AddPhoto Response"));
+    QDomDocument doc(QLatin1String("AddPhoto Response"));
 
     if (!doc.setContent(data))
     {
@@ -1411,7 +945,7 @@
 
     while (!node.isNull())
     {
-        if (node.isElement() && node.nodeName() == QString::fromLatin1("photoid"))
+        if (node.isElement() && node.nodeName() == QLatin1String("photoid"))
         {
             e                = node.toElement();           // try to convert the node to an element.
             QDomNode details = e.firstChild();
@@ -1420,12 +954,12 @@
             success          = true;
         }
 
-        if (node.isElement() && node.nodeName() == QString::fromLatin1("err"))
+        if (node.isElement() && node.nodeName() == QLatin1String("err"))
         {
             qCDebug(KIPIPLUGINS_LOG) << "Checking Error in response";
-            QString code = node.toElement().attribute(QString::fromLatin1("code"));
+            QString code = node.toElement().attribute(QLatin1String("code"));
             qCDebug(KIPIPLUGINS_LOG) << "Error code=" << code;
-            qCDebug(KIPIPLUGINS_LOG) << "Msg=" << node.toElement().attribute(QString::fromLatin1("msg"));
+            qCDebug(KIPIPLUGINS_LOG) << "Msg=" << node.toElement().attribute(QLatin1String("msg"));
             emit signalError(code);
         }
 
@@ -1440,23 +974,14 @@
     {
         QString photoSetId = m_selectedPhotoSet.id;
 
-        if (photoSetId == QString::fromLatin1("-1"))
+        if (photoSetId == QLatin1String("-1"))
         {
             qCDebug(KIPIPLUGINS_LOG) << "PhotoSet Id not set, not adding the photo to any photoset";
             emit signalAddPhotoSucceeded();
         }
         else
         {
-            if (m_serviceName == QString::fromLatin1("Zooomr"))
-            {
-                // addPhotoToPhotoSet not supported by Zooomr (Zooomr only has
-                // smart folder-type photosets); silently fail
-                emit signalAddPhotoSucceeded();
-            }
-            else
-            {
-                addPhotoToPhotoSet(photoId, photoSetId);
-            }
+            addPhotoToPhotoSet(photoId, photoSetId);
         }
     }
 }
@@ -1465,7 +990,7 @@
 {
     bool         success = false;
     QString      line;
-    QDomDocument doc(QString::fromLatin1("Photos Properties"));
+    QDomDocument doc(QLatin1String("Photos Properties"));
 
     if (!doc.setContent(data))
     {
@@ -1478,7 +1003,7 @@
 
     while (!node.isNull())
     {
-        if (node.isElement() && node.nodeName() == QString::fromLatin1("photoid"))
+        if (node.isElement() && node.nodeName() == QLatin1String("photoid"))
         {
             e                = node.toElement();                 // try to convert the node to an element.
             QDomNode details = e.firstChild();
@@ -1486,12 +1011,12 @@
             qCDebug(KIPIPLUGINS_LOG) << "Photoid=" << e.text();
         }
 
-        if (node.isElement() && node.nodeName() == QString::fromLatin1("err"))
+        if (node.isElement() && node.nodeName() == QLatin1String("err"))
         {
             qCDebug(KIPIPLUGINS_LOG) << "Checking Error in response";
-            QString code = node.toElement().attribute(QString::fromLatin1("code"));
+            QString code = node.toElement().attribute(QLatin1String("code"));
             qCDebug(KIPIPLUGINS_LOG) << "Error code=" << code;
-            qCDebug(KIPIPLUGINS_LOG) << "Msg=" << node.toElement().attribute(QString::fromLatin1("msg"));
+            qCDebug(KIPIPLUGINS_LOG) << "Msg=" << node.toElement().attribute(QLatin1String("msg"));
             emit signalError(code);
         }
 
diff -durN orig/digikam-5.3.0/extra/kipi-plugins/flickr/flickrtalker.h digikam-5.3.0/extra/kipi-plugins/flickr/flickrtalker.h
--- orig/digikam-5.3.0/extra/kipi-plugins/flickr/flickrtalker.h	2016-11-06 04:43:00.000000000 -0600
+++ digikam-5.3.0/extra/kipi-plugins/flickr/flickrtalker.h	2017-09-07 11:43:00.427659076 -0500
@@ -1,13 +1,14 @@
 /* ============================================================
  *
- * This file is a part of kipi-plugins project
+ * This file is a part of digiKam project
  * http://www.digikam.org
  *
  * Date        : 2005-07-07
  * Description : a kipi plugin to export images to Flickr web service
  *
  * Copyright (C) 2005-2009 by Vardhman Jain <vardhman at gmail dot com>
- * Copyright (C) 2009-2016 by Gilles Caulier <caulier dot gilles at gmail dot com>
+ * Copyright (C) 2009-2017 by Gilles Caulier <caulier dot gilles at gmail dot com>
+ * Copyright (C) 2017      by Maik Qualmann <metzpinguin at gmail dot com>
  *
  * This program is free software; you can redistribute it
  * and/or modify it under the terms of the GNU General
@@ -32,7 +33,6 @@
 #include <QString>
 #include <QObject>
 #include <QNetworkReply>
-#include <QCryptographicHash>
 #include <QNetworkAccessManager>
 
 // Libkipi includes
@@ -42,6 +42,9 @@
 // Local includes
 
 #include "flickritem.h"
+#include "o1.h"
+#include "o0globals.h"
+#include "o1requestor.h"
 
 class QProgressDialog;
 
@@ -69,10 +72,6 @@
         FE_LISTPHOTOS,
         FE_GETPHOTOPROPERTY,
         FE_ADDPHOTO,
-        FE_GETFROB,
-        FE_CHECKTOKEN,
-        FE_GETTOKEN,
-        FE_GETAUTHORIZED,
         FE_CREATEPHOTOSET,
         FE_ADDPHOTOTOPHOTOSET,
         FE_GETMAXSIZE
@@ -83,13 +82,12 @@
     FlickrTalker(QWidget* const parent, const QString& serviceName);
     ~FlickrTalker();
 
+    void    link();
+    void    unlink();
     QString getUserName() const;
     QString getUserId() const;
     void    maxAllowedFileSize();
     QString getMaxAllowedFileSize();
-    void    getFrob();
-    void    getToken();
-    void    checkToken(const QString& token);
     void    getPhotoProperty(const QString& method, const QStringList& argList);
     void    cancel();
 
@@ -102,7 +100,8 @@
 
     void    addPhotoToPhotoSet(const QString& photoId, const QString& photoSetId);
     bool    addPhoto(const QString& photoPath, const FPhotoInfo& info,
-                     bool rescale=false, int maxDim=600, int imageQuality=85);
+                     bool original = false, bool rescale = false,
+                     int maxDim = 600, int imageQuality = 85);
 
 public:
 
@@ -123,8 +122,7 @@
     void signalListPhotoSetsFailed(QString& msg);
     void signalAddPhotoFailed(const QString& msg);
     void signalListPhotoSetsFailed(const QString& msg);
-    void signalAuthenticate();
-    void signalTokenObtained(const QString& token);
+    void signalLinkingSucceeded();
 
 private:
 
@@ -134,36 +132,32 @@
     void parseResponseListPhotos(const QByteArray& data);
     void parseResponseCreateAlbum(const QByteArray& data);
     void parseResponseAddPhoto(const QByteArray& data);
-    void parseResponseGetFrob(const QByteArray& data);
-    void parseResponseGetToken(const QByteArray& data);
-    void parseResponseCheckToken(const QByteArray& data);
     void parseResponsePhotoProperty(const QByteArray& data);
     void parseResponseCreatePhotoSet(const QByteArray& data);
     void parseResponseAddPhotoToPhotoSet(const QByteArray& data);
 
-    QString getApiSig(const QString& secret, const QUrl& url);
-
 private Q_SLOTS:
 
+    void slotLinkingFailed();
+    void slotLinkingSucceeded();
+    void slotOpenBrowser(const QUrl& url); 
     void slotError(const QString& msg);
-    void slotAuthenticate();
     void slotFinished(QNetworkReply* reply);
 
 private:
 
     QWidget*               m_parent;
-//  QString                m_cookie;
     QByteArray             m_buffer;
 
     QString                m_serviceName;
     QString                m_apiUrl;
     QString                m_authUrl;
+    QString                m_tokenUrl;
+    QString                m_accessUrl;
     QString                m_uploadUrl;
     QString                m_apikey;
     QString                m_secret;
-    QString                m_frob;
     QString                m_maxSize;
-    QString                m_token;
     QString                m_username;
     QString                m_userId;
     QString                m_lastTmpFile;
@@ -174,6 +168,9 @@
     State                  m_state;
 
     Interface*             m_iface;
+
+    O1*                    m_o1;
+    O1Requestor*           m_requestor;
 };
 
 } // namespace KIPIFlickrPlugin
diff -durN orig/digikam-5.3.0/extra/kipi-plugins/flickr/flickrwidget.cpp digikam-5.3.0/extra/kipi-plugins/flickr/flickrwidget.cpp
--- orig/digikam-5.3.0/extra/kipi-plugins/flickr/flickrwidget.cpp	2016-11-06 04:43:00.000000000 -0600
+++ digikam-5.3.0/extra/kipi-plugins/flickr/flickrwidget.cpp	2017-09-07 11:43:00.427659076 -0500
@@ -61,7 +61,8 @@
     //Adding Remove Account button
     m_removeAccount              = new QPushButton(getAccountBox());
     m_removeAccount->setText(i18n("Remove Account"));
-    getAccountBoxLayout()->addWidget(m_removeAccount, 2,0,1,4);
+    m_removeAccount->hide();
+    getAccountBoxLayout()->addWidget(m_removeAccount, 2, 0, 1, 4);
 
     // -- The image list --------------------------------------------------
 
diff -durN orig/digikam-5.3.0/extra/kipi-plugins/flickr/flickrwindow.cpp digikam-5.3.0/extra/kipi-plugins/flickr/flickrwindow.cpp
--- orig/digikam-5.3.0/extra/kipi-plugins/flickr/flickrwindow.cpp	2016-11-06 04:43:00.000000000 -0600
+++ digikam-5.3.0/extra/kipi-plugins/flickr/flickrwindow.cpp	2017-09-07 11:43:00.427659076 -0500
@@ -77,10 +77,6 @@
     {
         setWindowIcon(QIcon::fromTheme(QString::fromLatin1("kipi-hq")));
     }
-    else if (serviceName == QLatin1String("Zooomr"))
-    {
-        setWindowIcon(QIcon::fromTheme(QString::fromLatin1("kipi-zooomr")));
-    }
     else
     {
         setWindowIcon(QIcon::fromTheme(QString::fromLatin1("kipi-flickr")));
@@ -136,9 +132,9 @@
     // --------------------------------------------------------------------------
     // About data and help button.
 
-    KPAboutData* const about = new KPAboutData(ki18n("Flickr/23/Zooomr Export"),
+    KPAboutData* const about = new KPAboutData(ki18n("Flickr/23 Export"),
                                                ki18n("A tool to export an image collection to a "
-                                                     "Flickr / 23 / Zooomr web service."),
+                                                     "Flickr / 23 web service."),
                                                ki18n("(c) 2005-2008, Vardhman Jain\n"
                                                      "(c) 2008-2015, Gilles Caulier\n"
                                                      "(c) 2009, Luka Renko\n"
@@ -181,8 +177,8 @@
     connect(m_talker, SIGNAL(signalListPhotoSetsFailed(QString)),
             this, SLOT(slotListPhotoSetsFailed(QString)));
 
-    connect(m_talker, SIGNAL(signalTokenObtained(QString)),
-            this, SLOT(slotTokenObtained(QString)));
+    connect(m_talker, SIGNAL(signalLinkingSucceeded()),
+            this, SLOT(slotLinkingSucceeded()));
 
     connect(m_widget->progressBar(), SIGNAL(signalProgressCanceled()),
             this, SLOT(slotAddPhotoCancelAndClose()));
@@ -304,17 +300,8 @@
 void FlickrWindow::reactivate()
 {
     m_userNameDisplayLabel->setText(QString());
-    readSettings(m_select->getUname());
-    qCDebug(KIPIPLUGINS_LOG) << "Calling auth methods";
-
-    if (m_token.length() < 1)
-    {
-        m_talker->getFrob();
-    }
-    else
-    {
-        m_talker->checkToken(m_token);
-    }
+    //readSettings(m_select->getUname());
+    m_talker->link();
 
     m_widget->m_imglst->loadImagesFromCurrentSelection();
     show();
@@ -323,10 +310,8 @@
 void FlickrWindow::readSettings(QString uname)
 {
     KConfig config(QString::fromLatin1("kipirc"));
-    qCDebug(KIPIPLUGINS_LOG) << "Group name is : "<<QString::fromLatin1("%1%2Export Settings").arg(m_serviceName,uname);
-    KConfigGroup grp = config.group(QString::fromLatin1("%1%2Export Settings").arg(m_serviceName,uname));
-    m_token          = grp.readEntry("token");
-    qCDebug(KIPIPLUGINS_LOG) << "Token is : "<<m_token;
+    qCDebug(KIPIPLUGINS_LOG) << "Group name is : "<<QString::fromLatin1("%1%2Export Settings").arg(m_serviceName, uname);
+    KConfigGroup grp = config.group(QString::fromLatin1("%1%2Export Settings").arg(m_serviceName, uname));
     m_exportHostTagsCheckBox->setChecked(grp.readEntry("Export Host Tags",      false));
     m_extendedTagsButton->setChecked(grp.readEntry("Show Extended Tag Options", false));
     m_addExtraTagsCheckBox->setChecked(grp.readEntry("Add Extra Tags",          false));
@@ -392,16 +377,14 @@
     qCDebug(KIPIPLUGINS_LOG) << "Group name is : "<<QString::fromLatin1("%1%2Export Settings").arg(m_serviceName,m_username);
 
     if (QString::compare(QString::fromLatin1("%1Export Settings").arg(m_serviceName),
-        QString::fromLatin1("%1%2Export Settings").arg(m_serviceName,m_username), Qt::CaseInsensitive) == 0)
+        QString::fromLatin1("%1%2Export Settings").arg(m_serviceName, m_username), Qt::CaseInsensitive) == 0)
     {
         qCDebug(KIPIPLUGINS_LOG) << "Not writing entry of group " << QString::fromLatin1("%1%2Export Settings").arg(m_serviceName,m_username);
         return;
     }
 
-    KConfigGroup grp = config.group(QString::fromLatin1("%1%2Export Settings").arg(m_serviceName,m_username));
-    grp.writeEntry("username",m_username);
-    qCDebug(KIPIPLUGINS_LOG) << "Token written of group "<<QString::fromLatin1("%1%2Export Settings").arg(m_serviceName,m_username)<<" is "<<m_token;
-    grp.writeEntry("token", m_token);
+    KConfigGroup grp = config.group(QString::fromLatin1("%1%2Export Settings").arg(m_serviceName, m_username));
+    grp.writeEntry("username",                          m_username);
     grp.writeEntry("Export Host Tags",                  m_exportHostTagsCheckBox->isChecked());
     grp.writeEntry("Show Extended Tag Options",         m_extendedTagsButton->isChecked());
     grp.writeEntry("Add Extra Tags",                    m_addExtraTagsCheckBox->isChecked());
@@ -427,39 +410,31 @@
 {
 }
 
-void FlickrWindow::slotTokenObtained(const QString& token)
+void FlickrWindow::slotLinkingSucceeded()
 {
-    qCDebug(KIPIPLUGINS_LOG) << "Token Obtained is : "<<token;
     m_username = m_talker->getUserName();
     m_userId   = m_talker->getUserId();
-    qCDebug(KIPIPLUGINS_LOG) << "SlotTokenObtained invoked setting user Display name to " << m_username;
+    qCDebug(KIPIPLUGINS_LOG) << "SlotLinkingSucceeded invoked setting user Display name to " << m_username;
     m_userNameDisplayLabel->setText(QString::fromLatin1("<b>%1</b>").arg(m_username));
 
     KConfig config(QString::fromLatin1("kipirc"));
 
-    foreach ( const QString& group, config.groupList() )
+    foreach (const QString& group, config.groupList())
     {
-        if(!(group.contains(m_serviceName)))
+        if (!(group.contains(m_serviceName)))
             continue;
 
         KConfigGroup grp = config.group(group);
 
-        if(group.contains(m_username))
+        if (group.contains(m_username))
         {
             readSettings(m_username);
             break;
         }
     }
 
-    m_token    = token;
     writeSettings();
-
-    // Mutable photosets are not supported by Zooomr (Zooomr only has smart
-    // folder-type photosets).
-    if (m_serviceName != QString::fromLatin1("Zooomr"))
-    {
-        m_talker->listPhotoSets();
-    }
+    m_talker->listPhotoSets();
 }
 
 void FlickrWindow::slotBusy(bool val)
@@ -488,18 +463,11 @@
 {
     writeSettings();
     qCDebug(KIPIPLUGINS_LOG) << "Slot Change User Request ";
-    m_select->reactivate();
-    readSettings(m_select->getUname());
-    if (m_token.length() < 1)
-    {
-        m_talker->getFrob();
-    }
-    else
-    {
-        m_talker->checkToken(m_token);
-    }
-    //m_talker->getFrob();
-    //  m_addPhotoButton->setEnabled(m_selectImagesButton->isChecked());
+    //m_select->reactivate();
+    //readSettings(m_select->getUname());
+
+     m_talker->unlink();
+     m_talker->link();
 }
 
 void FlickrWindow::slotRemoveAccount()
@@ -507,7 +475,7 @@
     KConfig config(QString::fromLatin1("kipirc"));
     KConfigGroup grp = config.group(QString::fromLatin1("%1%2Export Settings").arg(m_serviceName).arg(m_username));
 
-    if(grp.exists())
+    if (grp.exists())
     {
         qCDebug(KIPIPLUGINS_LOG) << "Removing Account having group"<<QString::fromLatin1("%1%2Export Settings").arg(m_serviceName);
         grp.deleteGroup();
@@ -545,8 +513,8 @@
     int totalCount = 0;
     QString name;
 
-    for(QMap<QString,int>::const_iterator it=nrFolderOccurences.constBegin();
-        it!=nrFolderOccurences.constEnd(); ++it)
+    for (QMap<QString,int>::const_iterator it=nrFolderOccurences.constBegin();
+         it!=nrFolderOccurences.constEnd(); ++it)
     {
         totalCount += it.value();
 
@@ -788,30 +756,25 @@
     Pair pathComments = m_uploadQueue.first();
     FPhotoInfo info   = pathComments.second;
 
-    // Find out the selected photo set.
-    if (m_serviceName != QString::fromLatin1("Zooomr"))
+    QString selectedPhotoSetId = m_albumsListComboBox->itemData(m_albumsListComboBox->currentIndex()).toString();
+
+    if (selectedPhotoSetId.isEmpty())
     {
-        // mutable photosets are not supported by Zooomr (Zooomr only has smart folder-type photosets)
-        QString selectedPhotoSetId = m_albumsListComboBox->itemData(m_albumsListComboBox->currentIndex()).toString();
+        m_talker->m_selectedPhotoSet = FPhotoSet();
+    }
+    else
+    {
+        QLinkedList<FPhotoSet>::iterator it = m_talker->m_photoSetsList->begin();
 
-        if (selectedPhotoSetId.isEmpty())
-        {
-            m_talker->m_selectedPhotoSet = FPhotoSet();
-        }
-        else
+        while (it != m_talker->m_photoSetsList->end())
         {
-            QLinkedList<FPhotoSet>::iterator it = m_talker->m_photoSetsList->begin();
-
-            while (it != m_talker->m_photoSetsList->end())
+            if (it->id == selectedPhotoSetId)
             {
-                if (it->id == selectedPhotoSetId)
-                {
-                    m_talker->m_selectedPhotoSet = *it;
-                    break;
-                }
-
-                ++it;
+                m_talker->m_selectedPhotoSet = *it;
+                break;
             }
+
+            ++it;
         }
     }
 
diff -durN orig/digikam-5.3.0/extra/kipi-plugins/flickr/flickrwindow.h digikam-5.3.0/extra/kipi-plugins/flickr/flickrwindow.h
--- orig/digikam-5.3.0/extra/kipi-plugins/flickr/flickrwindow.h	2016-11-06 04:43:00.000000000 -0600
+++ digikam-5.3.0/extra/kipi-plugins/flickr/flickrwindow.h	2017-09-07 11:43:00.427659076 -0500
@@ -95,7 +95,7 @@
 
 private Q_SLOTS:
 
-    void slotTokenObtained(const QString& token);
+    void slotLinkingSucceeded();
     void slotDoLogin();
     void slotBusy(bool val);
     void slotError(const QString& msg);
@@ -165,7 +165,6 @@
 
 //  QHash<int, GAlbumViewItem>             m_albumDict;
 
-    QString                                m_token;
     QString                                m_username;
     QString                                m_userId;
     QString                                m_lastSelectedAlbum;
diff -durN orig/digikam-5.3.0/extra/kipi-plugins/flickr/plugin_flickr.cpp digikam-5.3.0/extra/kipi-plugins/flickr/plugin_flickr.cpp
--- orig/digikam-5.3.0/extra/kipi-plugins/flickr/plugin_flickr.cpp	2016-11-06 04:43:00.000000000 -0600
+++ digikam-5.3.0/extra/kipi-plugins/flickr/plugin_flickr.cpp	2017-09-07 11:43:00.427659076 -0500
@@ -59,33 +59,27 @@
 
     m_actionFlickr = 0;
     m_action23     = 0;
-    m_actionZooomr = 0;
 
     m_dlgFlickr    = 0;
     m_dlg23        = 0;
-    m_dlgZooomr    = 0;
 
     selectFlickr   = 0;
     select23       = 0;
-    selectZoomr    = 0;
 }
 
 Plugin_Flickr::~Plugin_Flickr()
 {
     delete m_dlgFlickr;
     delete m_dlg23;
-    delete m_dlgZooomr;
 
     delete selectFlickr;
     delete select23;
-    delete selectZoomr;
 }
 
 void Plugin_Flickr::setup(QWidget* const widget)
 {
     m_dlgFlickr = 0;
     m_dlg23     = 0;
-    m_dlgZooomr = 0;
 
     Plugin::setup(widget);
 
@@ -107,13 +101,13 @@
     m_actionFlickr->setIcon(QIcon::fromTheme(QString::fromLatin1("kipi-flickr")));
     actionCollection()->setDefaultShortcut(m_actionFlickr, Qt::ALT + Qt::SHIFT + Qt::Key_R);
 
-    selectFlickr = new SelectUserDlg(0,QString::fromLatin1("Flickr"));
+    //selectFlickr = new SelectUserDlg(0,QString::fromLatin1("Flickr"));
 
     connect(m_actionFlickr, SIGNAL(triggered(bool)),
             this, SLOT(slotActivateFlickr()));
 
     addAction(QString::fromLatin1("flickrexport"), m_actionFlickr);
-
+/*
     m_action23 = new QAction(this);
     m_action23->setText(i18n("Export to &23..."));
     m_action23->setIcon(QIcon::fromTheme(QString::fromLatin1("kipi-hq")));
@@ -125,23 +119,12 @@
             this, SLOT(slotActivate23()));
 
     addAction(QString::fromLatin1("23export"), m_action23);
-
-    m_actionZooomr = new QAction(this);
-    m_actionZooomr->setText(i18n("Export to &Zooomr..."));
-    m_actionZooomr->setIcon(QIcon::fromTheme(QString::fromLatin1("kipi-zooomr")));
-    actionCollection()->setDefaultShortcut(m_actionZooomr, Qt::ALT + Qt::SHIFT + Qt::Key_Z);
-
-    selectZoomr = new SelectUserDlg(0,QString::fromLatin1("Zooomr"));
-
-    connect(m_actionZooomr, SIGNAL(triggered(bool)),
-            this, SLOT(slotActivateZooomr()));
-
-    addAction(QString::fromLatin1("Zooomrexport"), m_actionZooomr);
+*/
 }
 
 void Plugin_Flickr::slotActivateFlickr()
 {
-    selectFlickr->reactivate();
+    //selectFlickr->reactivate();
 
     if (!m_dlgFlickr)
     {
@@ -183,28 +166,6 @@
     m_dlg23->reactivate();
 }
 
-void Plugin_Flickr::slotActivateZooomr()
-{
-    selectZoomr->reactivate();
-
-    if (!m_dlgZooomr)
-    {
-        // We clean it up in the close button
-        m_dlgZooomr = new FlickrWindow(QApplication::activeWindow(), QString::fromLatin1("Zooomr"), selectZoomr);
-    }
-    else
-    {
-        if (m_dlgZooomr->isMinimized())
-        {
-            KWindowSystem::unminimizeWindow(m_dlgZooomr->winId());
-        }
-
-        KWindowSystem::activateWindow(m_dlgZooomr->winId());
-    }
-
-    m_dlgZooomr->reactivate();
-}
-
 } // namespace KIPIFlickrPlugin
 
 #include "plugin_flickr.moc"
diff -durN orig/digikam-5.3.0/extra/kipi-plugins/flickr/plugin_flickr.h digikam-5.3.0/extra/kipi-plugins/flickr/plugin_flickr.h
--- orig/digikam-5.3.0/extra/kipi-plugins/flickr/plugin_flickr.h	2016-11-06 04:43:00.000000000 -0600
+++ digikam-5.3.0/extra/kipi-plugins/flickr/plugin_flickr.h	2017-09-07 11:43:00.427659076 -0500
@@ -56,7 +56,6 @@
 
     void slotActivateFlickr();
     void slotActivate23();
-    void slotActivateZooomr();
 
 private:
 
@@ -66,15 +65,12 @@
 
     QAction*       m_actionFlickr;
     QAction*       m_action23;
-    QAction*       m_actionZooomr;
 
     FlickrWindow*  m_dlgFlickr;
     FlickrWindow*  m_dlg23;
-    FlickrWindow*  m_dlgZooomr;
 
     SelectUserDlg* selectFlickr;
     SelectUserDlg* select23;
-    SelectUserDlg* selectZoomr;
 };
 
 } //namespace KIPIFlickrPlugin
diff -durN orig/digikam-5.3.0/.pc/applied-patches digikam-5.3.0/.pc/applied-patches
--- orig/digikam-5.3.0/.pc/applied-patches	2017-09-07 11:42:00.136160191 -0500
+++ digikam-5.3.0/.pc/applied-patches	2017-09-07 11:43:00.435659009 -0500
@@ -1 +1,2 @@
 cmake-disable-jasper.patch
+flickr.diff
diff -durN orig/digikam-5.3.0/.pc/flickr.diff/extra/kipi-plugins/common/libkipiplugins/CMakeLists.txt digikam-5.3.0/.pc/flickr.diff/extra/kipi-plugins/common/libkipiplugins/CMakeLists.txt
--- orig/digikam-5.3.0/.pc/flickr.diff/extra/kipi-plugins/common/libkipiplugins/CMakeLists.txt	1969-12-31 18:00:00.000000000 -0600
+++ digikam-5.3.0/.pc/flickr.diff/extra/kipi-plugins/common/libkipiplugins/CMakeLists.txt	2017-09-07 11:43:00.443658943 -0500
@@ -0,0 +1,97 @@
+#
+# Copyright (c) 2010-2016, Gilles Caulier, <caulier dot gilles at gmail dot com>
+#
+# Redistribution and use is allowed according to the terms of the BSD license.
+# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
+
+configure_file(${CMAKE_CURRENT_SOURCE_DIR}/tools/kpversion.h.cmake.in              ${CMAKE_CURRENT_BINARY_DIR}/kpversion.h)
+configure_file(${CMAKE_CURRENT_SOURCE_DIR}/../../cmake/templates/Doxyfile.cmake.in ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile)
+
+include_directories(${JPEG_INCLUDE_DIR} ${PNG_INCLUDE_DIR} ${TIFF_INCLUDE_DIR})
+
+qt5_add_resources(libkipipluginsresources_SRCS ${CMAKE_CURRENT_SOURCE_DIR}/../data/libkipiplugins.qrc)
+
+set(kipiplugins_LIB_SRCS ${CMAKE_CURRENT_SOURCE_DIR}/tools/kipiplugins_debug.cpp
+                         ${CMAKE_CURRENT_SOURCE_DIR}/tools/kputil.cpp
+                         ${CMAKE_CURRENT_SOURCE_DIR}/tools/kpimageinfo.cpp
+                         ${CMAKE_CURRENT_SOURCE_DIR}/tools/kpversion.cpp
+                         ${CMAKE_CURRENT_SOURCE_DIR}/tools/kpaboutdata.cpp
+                         ${CMAKE_CURRENT_SOURCE_DIR}/tools/kpthreadmanager.cpp
+                         ${CMAKE_CURRENT_SOURCE_DIR}/widgets/kpprogresswidget.cpp
+                         ${CMAKE_CURRENT_SOURCE_DIR}/widgets/kpsavesettingswidget.cpp
+                         ${CMAKE_CURRENT_SOURCE_DIR}/widgets/kpimageslist.cpp
+                         ${CMAKE_CURRENT_SOURCE_DIR}/widgets/kpsettingswidget.cpp
+                         ${CMAKE_CURRENT_SOURCE_DIR}/dialogs/kpwizardpage.cpp
+                         ${CMAKE_CURRENT_SOURCE_DIR}/dialogs/kpimagedialog.cpp
+                         ${CMAKE_CURRENT_SOURCE_DIR}/dialogs/kpbatchprogressdialog.cpp
+                         ${CMAKE_CURRENT_SOURCE_DIR}/dialogs/kptooldialog.cpp
+                         ${CMAKE_CURRENT_SOURCE_DIR}/dialogs/kpnewalbumdialog.cpp
+                         ${CMAKE_CURRENT_SOURCE_DIR}/dialogs/kplogindialog.cpp
+
+                         ${libkipipluginsresources_SRCS}
+)
+
+# The o2 library does not adhere to the flags we use
+remove_definitions(
+    -DQT_NO_CAST_FROM_ASCII
+    -DQT_NO_CAST_TO_ASCII
+    -DQT_NO_URL_CAST_FROM_STRING
+    -DQT_NO_CAST_FROM_BYTEARRAY)
+# It also does not export symbols, so export all by default
+unset(CMAKE_CXX_VISIBILITY_PRESET)
+
+# Copied from o2/src/CMakeLists.txt
+set(CMAKE_AUTOMOC ON)
+set(CMAKE_INCLUDE_CURRENT_DIR ON)
+set(o2_SRCS
+    ${CMAKE_CURRENT_SOURCE_DIR}/o2/src/o2.cpp
+    ${CMAKE_CURRENT_SOURCE_DIR}/o2/src/o2reply.cpp
+    ${CMAKE_CURRENT_SOURCE_DIR}/o2/src/o2replyserver.cpp
+    ${CMAKE_CURRENT_SOURCE_DIR}/o2/src/o2requestor.cpp
+    ${CMAKE_CURRENT_SOURCE_DIR}/o2/src/o2simplecrypt.cpp
+    ${CMAKE_CURRENT_SOURCE_DIR}/o2/src/o0settingsstore.cpp
+    ${CMAKE_CURRENT_SOURCE_DIR}/o2/src/o0baseauth.cpp
+    ${CMAKE_CURRENT_SOURCE_DIR}/o2/src/o0abstractstore.h
+    ${CMAKE_CURRENT_SOURCE_DIR}/o2/src/o0globals.h
+    # Enable when needed
+    #${CMAKE_CURRENT_SOURCE_DIR}/o2/src/o1.cpp
+    #${CMAKE_CURRENT_SOURCE_DIR}/o2/src/o1requestor.cpp
+    #${CMAKE_CURRENT_SOURCE_DIR}/o2/src/o1timedreply.cpp
+    #${CMAKE_CURRENT_SOURCE_DIR}/o2/src/o1twitter.h
+    #${CMAKE_CURRENT_SOURCE_DIR}/o2/src/oxtwitter.cpp
+    #${CMAKE_CURRENT_SOURCE_DIR}/o2/src/o1dropbox.h
+    #${CMAKE_CURRENT_SOURCE_DIR}/o2/src/o2gft.cpp
+    #${CMAKE_CURRENT_SOURCE_DIR}/o2/src/o2facebook.cpp
+    #${CMAKE_CURRENT_SOURCE_DIR}/o2/src/o2skydrive.cpp
+    #${CMAKE_CURRENT_SOURCE_DIR}/o2/src/o1flickr.h
+    #${CMAKE_CURRENT_SOURCE_DIR}/o2/src/o2hubic.cpp
+)
+
+add_library(KF5kipiplugins SHARED ${kipiplugins_LIB_SRCS} ${o2_SRCS})
+add_dependencies(KF5kipiplugins kipiplugins-gitversion)
+
+generate_export_header(KF5kipiplugins BASE_NAME kipiplugins EXPORT_MACRO_NAME KIPIPLUGINS_EXPORT)
+
+target_link_libraries(KF5kipiplugins
+
+                      PUBLIC
+                      Qt5::Gui
+                      Qt5::Network
+
+                      PRIVATE
+
+                      KF5::I18n
+                      KF5::ConfigCore
+
+                      KF5::Kipi
+)
+
+set_target_properties(KF5kipiplugins PROPERTIES
+                      VERSION     ${KIPIPLUGINS_LIB_SO_VERSION_STRING}
+                      SOVERSION   ${KIPIPLUGINS_LIB_SO_VERSION_STRING}
+                      EXPORT_NAME KIPIPlugins
+)
+
+install(TARGETS KF5kipiplugins
+        EXPORT  KF5kipipluginsTargets ${KF5_INSTALL_TARGETS_DEFAULT_ARGS}
+)
diff -durN orig/digikam-5.3.0/.pc/flickr.diff/extra/kipi-plugins/flickr/flickrtalker.cpp digikam-5.3.0/.pc/flickr.diff/extra/kipi-plugins/flickr/flickrtalker.cpp
--- orig/digikam-5.3.0/.pc/flickr.diff/extra/kipi-plugins/flickr/flickrtalker.cpp	1969-12-31 18:00:00.000000000 -0600
+++ digikam-5.3.0/.pc/flickr.diff/extra/kipi-plugins/flickr/flickrtalker.cpp	2017-09-07 11:43:00.443658943 -0500
@@ -0,0 +1,1519 @@
+/* ============================================================
+ *
+ * This file is a part of kipi-plugins project
+ * http://www.digikam.org
+ *
+ * Date        : 2005-07-07
+ * Description : a kipi plugin to export images to Flickr web service
+ *
+ * Copyright (C) 2005-2009 by Vardhman Jain <vardhman at gmail dot com>
+ * Copyright (C) 2009-2016 by Gilles Caulier <caulier dot gilles at gmail dot com>
+ *
+ * This program is free software; you can redistribute it
+ * and/or modify it under the terms of the GNU General
+ * Public License as published by the Free Software Foundation;
+ * either version 2, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * ============================================================ */
+
+#include "flickrtalker.h"
+
+// Qt includes
+
+#include <QByteArray>
+#include <QDomDocument>
+#include <QDomElement>
+#include <QFile>
+#include <QFileInfo>
+#include <QImage>
+#include <QMap>
+#include <QStringList>
+#include <QProgressDialog>
+#include <QUrlQuery>
+#include <QStandardPaths>
+#include <QApplication>
+#include <QDesktopServices>
+#include <QMessageBox>
+
+// Libkipi includes
+
+#include <KIPI/PluginLoader>
+
+// Local includes
+
+#include "kputil.h"
+#include "kpversion.h"
+#include "mpform.h"
+#include "flickritem.h"
+#include "flickrwindow.h"
+#include "kipiplugins_debug.h"
+
+using namespace KIPIPlugins;
+
+namespace KIPIFlickrPlugin
+{
+
+FlickrTalker::FlickrTalker(QWidget* const parent, const QString& serviceName)
+{
+    m_parent          = parent;
+    m_netMngr         = 0;
+    m_reply           = 0;
+    m_photoSetsList   = 0;
+    m_authProgressDlg = 0;
+    m_state           = FE_LOGOUT;
+    m_serviceName     = serviceName;
+    m_iface           = 0;
+
+    PluginLoader* const pl = PluginLoader::instance();
+
+    if (pl)
+    {
+        m_iface = pl->interface();
+    }
+
+    if (serviceName == QString::fromLatin1("23"))
+    {
+        m_apiUrl    = QString::fromLatin1("http://www.23hq.com/services/rest/");
+        m_authUrl   = QString::fromLatin1("http://www.23hq.com/services/auth/");
+        m_uploadUrl = QString::fromLatin1("http://www.23hq.com/services/upload/");
+
+        // bshanks: do 23 and flickr really share API keys? or does 23 not need
+        // one?
+        m_apikey    = QString::fromLatin1("49d585bafa0758cb5c58ab67198bf632");
+        m_secret    = QString::fromLatin1("34b39925e6273ffd");
+    }
+    else if (serviceName == QString::fromLatin1("Zooomr"))
+    {
+        m_apiUrl    = QString::fromLatin1("http://api.zooomr.com/services/rest/");
+        m_authUrl   = QString::fromLatin1("http://www.zooomr.com/services/auth/");
+        m_uploadUrl = QString::fromLatin1("http://upload.zooomr.com/services/upload/");
+
+        m_apikey    = QString::fromLatin1("18c8db5ce9ed4e15a7b484136f5080c5");
+        m_secret    = QString::fromLatin1("1ea4af14e3");
+    }
+    else
+    {
+        m_apiUrl    = QString::fromLatin1("https://www.flickr.com/services/rest/");
+        m_authUrl   = QString::fromLatin1("https://www.flickr.com/services/auth/");
+        m_uploadUrl = QString::fromLatin1("https://api.flickr.com/services/upload/");
+
+        m_apikey    = QString::fromLatin1("49d585bafa0758cb5c58ab67198bf632");
+        m_secret    = QString::fromLatin1("34b39925e6273ffd");
+    }
+
+    m_netMngr = new QNetworkAccessManager(this);
+
+    connect(m_netMngr, SIGNAL(finished(QNetworkReply*)),
+            this, SLOT(slotFinished(QNetworkReply*)));
+
+    /* Initialize selected photo set as empty. */
+    m_selectedPhotoSet = FPhotoSet();
+    /* Initialize photo sets list. */
+    m_photoSetsList    = new QLinkedList<FPhotoSet>();
+
+    connect(this, SIGNAL(signalAuthenticate()),
+            this, SLOT(slotAuthenticate()));
+}
+
+FlickrTalker::~FlickrTalker()
+{
+    if (m_reply)
+    {
+        m_reply->abort();
+    }
+
+    delete m_photoSetsList;
+
+    removeTemporaryDir(m_serviceName.toLatin1().constData());
+}
+
+/** Compute MD5 signature using url queries keys and values following Flickr notice:
+    http://www.flickr.com/services/api/auth.spec.html
+*/
+QString FlickrTalker::getApiSig(const QString& secret, const QUrl& url)
+{
+    QUrlQuery urlQuery(url.query());
+    QList<QPair<QString, QString> > temp_queries = urlQuery.queryItems();
+    QMap<QString, QString> queries;
+
+    QPair<QString, QString> pair;
+
+    foreach(pair, temp_queries)
+    {
+        queries.insert(pair.first,pair.second);
+    }
+
+    QString compressed(secret);
+
+    // NOTE: iterator QMap iterator will sort alphabetically items based on key values.
+    for (QMap<QString, QString>::iterator it = queries.begin() ; it != queries.end(); ++it)
+    {
+        compressed.append(it.key());
+        compressed.append(it.value());
+    }
+
+    QCryptographicHash context(QCryptographicHash::Md5);
+    context.addData(compressed.toUtf8());
+    return QLatin1String(context.result().toHex().data());
+}
+
+QString FlickrTalker::getMaxAllowedFileSize()
+{
+    return m_maxSize;
+}
+
+void FlickrTalker::maxAllowedFileSize()
+{
+    if (m_reply)
+    {
+        m_reply->abort();
+        m_reply = 0;
+    }
+
+    QUrl url(m_apiUrl);
+    QUrlQuery urlQuery;
+    urlQuery.addQueryItem(QString::fromLatin1("auth_token"), m_token);
+    urlQuery.addQueryItem(QString::fromLatin1("api_key"), m_apikey);
+    urlQuery.addQueryItem(QString::fromLatin1("method"), QString::fromLatin1("flickr.people.getLimits"));
+    url.setQuery(urlQuery);
+    QString md5 = getApiSig(m_secret, url);
+    urlQuery.addQueryItem(QString::fromLatin1("api_sig"), md5);
+    url.setQuery(urlQuery);
+    qCDebug(KIPIPLUGINS_LOG) << "Get max file size url: " << url;
+
+    if (m_serviceName == QString::fromLatin1("Zooomr"))
+    {
+        // Zooomr redirects the POST at this url to a GET.
+        m_reply = m_netMngr->get(QNetworkRequest(url));
+    }
+    else
+    {
+        QNetworkRequest netRequest(url);
+        netRequest.setHeader(QNetworkRequest::ContentTypeHeader, QLatin1String("application/x-www-form-urlencoded"));
+
+        m_reply = m_netMngr->post(netRequest, QByteArray());
+    }
+
+    m_state = FE_GETMAXSIZE;
+    m_authProgressDlg->setLabelText(i18n("Getting the maximum allowed file size."));
+    m_authProgressDlg->setMaximum(4);
+    m_authProgressDlg->setValue(1);
+    m_buffer.resize(0);
+    emit signalBusy(true);
+}
+
+// MD5 signature of the request.
+/*
+QString FlickrTalker::getApiSig(const QString& secret, const QStringList &headers)
+{
+    QMap<QString, QString> queries = url.queryItems();
+    QString compressed(secret);
+
+    // NOTE: iterator QMap iterator will sort alphabetically items based on key values.
+    for (QMap<QString, QString>::iterator it = queries.begin() ; it != queries.end(); ++it)
+    {
+        compressed.append(it.key());
+        compressed.append(it.value());
+    }
+
+    QCryptographicHash context(QCryptographicHash::Md5);
+    context.addData(compressed.toUtf8());
+    return context.result().toHex().data();
+}
+*/
+
+/**get the API sig and send it to the server server should return a frob.
+*/
+void FlickrTalker::getFrob()
+{
+    if (m_reply)
+    {
+        m_reply->abort();
+        m_reply = 0;
+    }
+
+    QUrl url(m_apiUrl);
+    QUrlQuery urlQuery;
+    urlQuery.addQueryItem(QString::fromLatin1("method"), QString::fromLatin1("flickr.auth.getFrob"));
+    urlQuery.addQueryItem(QString::fromLatin1("api_key"), m_apikey);
+    url.setQuery(urlQuery);
+
+    QString md5 = getApiSig(m_secret, url);
+    urlQuery.addQueryItem(QString::fromLatin1("api_sig"), md5);
+    url.setQuery(urlQuery);
+    qCDebug(KIPIPLUGINS_LOG) << "Get frob url: " << url;
+
+    if (m_serviceName == QString::fromLatin1("Zooomr"))
+    {
+        // Zooomr redirects the POST at this url to a GET.
+        m_reply = m_netMngr->get(QNetworkRequest(url));
+    }
+    else
+    {
+        QNetworkRequest netRequest(url);
+        netRequest.setHeader(QNetworkRequest::ContentTypeHeader, QLatin1String("application/x-www-form-urlencoded"));
+
+        m_reply = m_netMngr->post(netRequest, QByteArray());
+    }
+
+    m_state = FE_GETFROB;
+    m_authProgressDlg->setLabelText(i18n("Getting the Frob"));
+    m_authProgressDlg->setMaximum(4);
+    m_authProgressDlg->setValue(1);
+    m_buffer.resize(0);
+    emit signalBusy(true);
+}
+
+void FlickrTalker::checkToken(const QString& token)
+{
+    if (m_reply)
+    {
+        m_reply->abort();
+        m_reply = 0;
+    }
+
+    QUrl url(m_apiUrl);
+    QUrlQuery urlQuery;
+    urlQuery.addQueryItem(QString::fromLatin1("method"), QString::fromLatin1("flickr.auth.checkToken"));
+    urlQuery.addQueryItem(QString::fromLatin1("api_key"), m_apikey);
+    urlQuery.addQueryItem(QString::fromLatin1("auth_token"), token);
+    url.setQuery(urlQuery);
+    QString md5 = getApiSig(m_secret, url);
+    urlQuery.addQueryItem(QString::fromLatin1("api_sig"), md5);
+    url.setQuery(urlQuery);
+    qCDebug(KIPIPLUGINS_LOG) << "Check token url: " << url;
+
+    if (m_serviceName == QString::fromLatin1("Zooomr"))
+    {
+        // Zooomr redirects the POST at this url to a GET.
+        m_reply = m_netMngr->get(QNetworkRequest(url));
+    }
+    else
+    {
+        QNetworkRequest netRequest(url);
+        netRequest.setHeader(QNetworkRequest::ContentTypeHeader, QLatin1String("application/x-www-form-urlencoded"));
+
+        m_reply = m_netMngr->post(netRequest, QByteArray());
+    }
+
+    m_state = FE_CHECKTOKEN;
+    m_authProgressDlg->setLabelText(i18n("Checking if previous token is still valid"));
+    m_authProgressDlg->setMaximum(4);
+    m_authProgressDlg->setValue(1);
+    m_buffer.resize(0);
+    emit signalBusy(true);
+}
+
+void FlickrTalker::slotAuthenticate()
+{
+    if (m_reply)
+    {
+        m_reply->abort();
+        m_reply = 0;
+    }
+
+    QUrl url(m_authUrl);
+    QUrlQuery urlQuery;
+    urlQuery.addQueryItem(QString::fromLatin1("api_key"), m_apikey);
+    urlQuery.addQueryItem(QString::fromLatin1("frob"), m_frob);
+    urlQuery.addQueryItem(QString::fromLatin1("perms"), QString::fromLatin1("write"));
+    url.setQuery(urlQuery);
+
+    QString md5 = getApiSig(m_secret, url);
+    urlQuery.addQueryItem(QString::fromLatin1("api_sig"), md5);
+    url.setQuery(urlQuery);
+    qCDebug(KIPIPLUGINS_LOG) << "Authenticate url: " << url;
+
+    QDesktopServices::openUrl(url);
+
+    QMessageBox quest(QMessageBox::Question,
+                      i18n("%1 Service Web Authorization", m_serviceName),
+                      i18n("Please follow the instructions in the browser window, then "
+                           "return to press corresponding button."),
+                      QMessageBox::Yes | QMessageBox::No);
+
+    (quest.button(QMessageBox::Yes))->setText(i18n("I am authenticated"));
+    (quest.button(QMessageBox::No))->setText(i18n("I am not authenticated"));
+
+    if (quest.exec() == QMessageBox::Yes)
+    {
+        getToken();
+        m_authProgressDlg->setLabelText(i18n("Authenticating the User on web"));
+        m_authProgressDlg->setMaximum(4);
+        m_authProgressDlg->setValue(2);
+        emit signalBusy(false);
+    }
+    else
+    {
+        qCDebug(KIPIPLUGINS_LOG) << "User didn't proceed with getToken Authorization, cannot proceed further, aborting";
+        cancel();
+    }
+}
+
+void FlickrTalker::getToken()
+{
+    if (m_reply)
+    {
+        m_reply->abort();
+        m_reply = 0;
+    }
+
+    QUrl url(m_apiUrl);
+    QUrlQuery urlQuery;
+    urlQuery.addQueryItem(QString::fromLatin1("api_key"), m_apikey);
+    urlQuery.addQueryItem(QString::fromLatin1("method"), QString::fromLatin1("flickr.auth.getToken"));
+    urlQuery.addQueryItem(QString::fromLatin1("frob"), m_frob);
+    url.setQuery(urlQuery);
+    QString md5 = getApiSig(m_secret, url);
+    urlQuery.addQueryItem(QString::fromLatin1("api_sig"), md5);
+    url.setQuery(urlQuery);
+    qCDebug(KIPIPLUGINS_LOG) << "Get token url: " << url;
+
+    if (m_serviceName == QString::fromLatin1("Zooomr"))
+    {
+        // Zooomr redirects the POST at this url to a GET.
+        m_reply = m_netMngr->get(QNetworkRequest(url));
+    }
+    else
+    {
+        QNetworkRequest netRequest(url);
+        netRequest.setHeader(QNetworkRequest::ContentTypeHeader, QLatin1String("application/x-www-form-urlencoded"));
+
+        m_reply = m_netMngr->post(netRequest, QByteArray());
+    }
+
+    m_state = FE_GETTOKEN;
+    m_buffer.resize(0);
+    emit signalBusy(true);
+    m_authProgressDlg->setLabelText(i18n("Getting the Token from the server"));
+    m_authProgressDlg->setMaximum(4);
+    m_authProgressDlg->setValue(3);
+}
+
+void FlickrTalker::listPhotoSets()
+{
+    if (m_reply)
+    {
+        m_reply->abort();
+        m_reply = 0;
+    }
+
+    qCDebug(KIPIPLUGINS_LOG) << "List photoset invoked";
+    QUrl url(m_apiUrl);
+    QUrlQuery urlQuery;
+    urlQuery.addQueryItem(QString::fromLatin1("auth_token"), m_token);
+    urlQuery.addQueryItem(QString::fromLatin1("api_key"), m_apikey);
+    urlQuery.addQueryItem(QString::fromLatin1("method"), QString::fromLatin1("flickr.photosets.getList"));
+    url.setQuery(urlQuery);
+    QString md5 = getApiSig(m_secret, url);
+    urlQuery.addQueryItem(QString::fromLatin1("api_sig"), md5);
+    url.setQuery(urlQuery);
+    qCDebug(KIPIPLUGINS_LOG) << "List photoset URL" << url;
+
+    if (m_serviceName == QString::fromLatin1("Zooomr"))
+    {
+        // Zooomr redirects the POST at this url to a GET.
+        m_reply = m_netMngr->get(QNetworkRequest(url));
+    }
+    else
+    {
+        QNetworkRequest netRequest(url);
+        netRequest.setHeader(QNetworkRequest::ContentTypeHeader, QLatin1String("application/x-www-form-urlencoded"));
+
+        m_reply = m_netMngr->post(netRequest, QByteArray());
+    }
+
+    m_state = FE_LISTPHOTOSETS;
+    m_buffer.resize(0);
+    emit signalBusy(true);
+}
+
+void FlickrTalker::getPhotoProperty(const QString& method, const QStringList& argList)
+{
+    if (m_reply)
+    {
+        m_reply->abort();
+        m_reply = 0;
+    }
+
+    QUrl url(m_apiUrl);
+    QUrlQuery urlQuery;
+    urlQuery.addQueryItem(QString::fromLatin1("api_key"), m_apikey);
+    urlQuery.addQueryItem(QString::fromLatin1("method"), method);
+    urlQuery.addQueryItem(QString::fromLatin1("frob"), m_frob);
+
+    for (QStringList::const_iterator it = argList.constBegin(); it != argList.constEnd(); ++it)
+    {
+        QStringList str = (*it).split(QLatin1Char('='), QString::SkipEmptyParts);
+        urlQuery.addQueryItem(str[0], str[1]);
+    }
+
+    url.setQuery(urlQuery);
+    QString md5 = getApiSig(m_secret, url);
+    urlQuery.addQueryItem(QString::fromLatin1("api_sig"), md5);
+    url.setQuery(urlQuery);
+    qCDebug(KIPIPLUGINS_LOG) << "Get photo property url: " << url;
+
+    if (m_serviceName == QString::fromLatin1("Zooomr"))
+    {
+        // Zooomr redirects the POST at this url to a GET.
+        m_reply = m_netMngr->get(QNetworkRequest(url));
+    }
+    else
+    {
+        QNetworkRequest netRequest(url);
+        netRequest.setHeader(QNetworkRequest::ContentTypeHeader, QLatin1String("application/x-www-form-urlencoded"));
+
+        m_reply = m_netMngr->post(netRequest, QByteArray());
+    }
+
+    m_state = FE_GETPHOTOPROPERTY;
+    m_buffer.resize(0);
+    emit signalBusy(true);
+
+    //  m_authProgressDlg->setLabelText("Getting the Token from the server");
+    //  m_authProgressDlg->setProgress(3,4);
+}
+
+void FlickrTalker::listPhotos(const QString& /*albumName*/)
+{
+    // TODO
+}
+
+void FlickrTalker::createPhotoSet(const QString& /*albumName*/, const QString& albumTitle,
+                                  const QString& albumDescription, const QString& primaryPhotoId)
+{
+    if (m_reply)
+    {
+        m_reply->abort();
+        m_reply = 0;
+    }
+
+    qCDebug(KIPIPLUGINS_LOG) << "create photoset invoked";
+    QUrl url(m_apiUrl);
+    QUrlQuery urlQuery;
+    urlQuery.addQueryItem(QString::fromLatin1("auth_token"), m_token);
+    urlQuery.addQueryItem(QString::fromLatin1("api_key"), m_apikey);
+    urlQuery.addQueryItem(QString::fromLatin1("method"), QString::fromLatin1("flickr.photosets.create"));
+    urlQuery.addQueryItem(QString::fromLatin1("title"), albumTitle);
+    urlQuery.addQueryItem(QString::fromLatin1("description"), albumDescription);
+    urlQuery.addQueryItem(QString::fromLatin1("primary_photo_id"), primaryPhotoId);
+    url.setQuery(urlQuery);
+
+    QString md5 = getApiSig(m_secret, url);
+    urlQuery.addQueryItem(QString::fromLatin1("api_sig"), md5);
+    url.setQuery(urlQuery);
+    qCDebug(KIPIPLUGINS_LOG) << "List photo sets url: " << url;
+
+    if (m_serviceName == QString::fromLatin1("Zooomr"))
+    {
+        // Zooomr redirects the POST at this url to a GET.
+        m_reply = m_netMngr->get(QNetworkRequest(url));
+    }
+    else
+    {
+        QNetworkRequest netRequest(url);
+        netRequest.setHeader(QNetworkRequest::ContentTypeHeader, QLatin1String("application/x-www-form-urlencoded"));
+
+        m_reply = m_netMngr->post(netRequest, QByteArray());
+    }
+
+    m_state = FE_CREATEPHOTOSET;
+    m_buffer.resize(0);
+    emit signalBusy(true);
+}
+
+void FlickrTalker::addPhotoToPhotoSet(const QString& photoId,
+                                      const QString& photoSetId)
+{
+    if (m_reply)
+    {
+        m_reply->abort();
+        m_reply = 0;
+    }
+
+    qCDebug(KIPIPLUGINS_LOG) << "addPhotoToPhotoSet invoked";
+    QUrl url(m_apiUrl);
+    QUrlQuery urlQuery;
+
+    /* If the photoset id starts with the special string "UNDEFINED_", it means
+     * it doesn't exist yet on Flickr and needs to be created. Note that it's
+     * not necessary to subsequently add the photo to the photo set, as this
+     * is done in the set creation call to Flickr. */
+    if (photoSetId.startsWith(QLatin1String("UNDEFINED_")))
+    {
+        createPhotoSet(QString::fromLatin1(""), m_selectedPhotoSet.title, m_selectedPhotoSet.description, photoId);
+    }
+    else
+    {
+        urlQuery.addQueryItem(QString::fromLatin1("auth_token"), m_token);
+        urlQuery.addQueryItem(QString::fromLatin1("photoset_id"), photoSetId);
+        urlQuery.addQueryItem(QString::fromLatin1("api_key"), m_apikey);
+        urlQuery.addQueryItem(QString::fromLatin1("method"), QString::fromLatin1("flickr.photosets.addPhoto"));
+        urlQuery.addQueryItem(QString::fromLatin1("photo_id"), photoId);
+        url.setQuery(urlQuery);
+
+        QString md5 = getApiSig(m_secret, url);
+        urlQuery.addQueryItem(QString::fromLatin1("api_sig"), md5);
+        url.setQuery(urlQuery);
+        qCDebug(KIPIPLUGINS_LOG) << "Add photo to Photo set url: " << url;
+
+        QNetworkRequest netRequest(url);
+        netRequest.setHeader(QNetworkRequest::ContentTypeHeader, QLatin1String("application/x-www-form-urlencoded"));
+
+        m_reply = m_netMngr->post(netRequest, QByteArray());
+
+        m_state = FE_ADDPHOTOTOPHOTOSET;
+        m_buffer.resize(0);
+        emit signalBusy(true);
+    }
+}
+
+bool FlickrTalker::addPhoto(const QString& photoPath, const FPhotoInfo& info,
+                            bool rescale, int maxDim, int imageQuality)
+{
+    if (m_reply)
+    {
+        m_reply->abort();
+        m_reply = 0;
+    }
+
+    QUrl url(m_uploadUrl);
+
+    // We dont' want to modify url as such, we just used the QUrl object for storing the query items.
+    QUrl url2(QString::fromLatin1(""));
+    QUrlQuery urlQuery;
+    QString path = photoPath;
+    MPForm  form;
+
+    form.addPair(QString::fromLatin1("auth_token"), m_token, QString::fromLatin1("text/plain"));
+    urlQuery.addQueryItem(QString::fromLatin1("auth_token"), m_token);
+
+    form.addPair(QString::fromLatin1("api_key"), m_apikey, QString::fromLatin1("text/plain"));
+    urlQuery.addQueryItem(QString::fromLatin1("api_key"), m_apikey);
+
+    QString ispublic = (info.is_public == 1) ? QString::fromLatin1("1") : QString::fromLatin1("0");
+    form.addPair(QString::fromLatin1("is_public"), ispublic, QString::fromLatin1("text/plain"));
+    urlQuery.addQueryItem(QString::fromLatin1("is_public"), ispublic);
+
+    QString isfamily = (info.is_family == 1) ? QString::fromLatin1("1") : QString::fromLatin1("0");
+    form.addPair(QString::fromLatin1("is_family"), isfamily, QString::fromLatin1("text/plain"));
+    urlQuery.addQueryItem(QString::fromLatin1("is_family"), isfamily);
+
+    QString isfriend = (info.is_friend == 1) ? QString::fromLatin1("1") : QString::fromLatin1("0");
+    form.addPair(QString::fromLatin1("is_friend"), isfriend, QString::fromLatin1("text/plain"));
+    urlQuery.addQueryItem(QString::fromLatin1("is_friend"), isfriend);
+
+    QString safetyLevel = QString::number(static_cast<int>(info.safety_level));
+    form.addPair(QString::fromLatin1("safety_level"), safetyLevel, QString::fromLatin1("text/plain"));
+    urlQuery.addQueryItem(QString::fromLatin1("safety_level"), safetyLevel);
+
+    QString contentType = QString::number(static_cast<int>(info.content_type));
+    form.addPair(QString::fromLatin1("content_type"), contentType, QString::fromLatin1("text/plain"));
+    urlQuery.addQueryItem(QString::fromLatin1("content_type"), contentType);
+
+    QString tags = QString::fromLatin1("\"") + info.tags.join(QString::fromLatin1("\" \"")) + QString::fromLatin1("\"");
+
+    if (tags.length() > 0)
+    {
+        form.addPair(QString::fromLatin1("tags"), tags, QString::fromLatin1("text/plain"));
+        urlQuery.addQueryItem(QString::fromLatin1("tags"), tags);
+    }
+
+    if (!info.title.isEmpty())
+    {
+        form.addPair(QString::fromLatin1("title"), info.title, QString::fromLatin1("text/plain"));
+        urlQuery.addQueryItem(QString::fromLatin1("title"), info.title);
+    }
+
+    if (!info.description.isEmpty())
+    {
+        form.addPair(QString::fromLatin1("description"), info.description, QString::fromLatin1("text/plain"));
+        urlQuery.addQueryItem(QString::fromLatin1("description"), info.description);
+    }
+
+    url2.setQuery(urlQuery);
+    QString md5 = getApiSig(m_secret, url2);
+    form.addPair(QString::fromLatin1("api_sig"), md5, QString::fromLatin1("text/plain"));
+    QImage image;
+
+    if (m_iface)
+    {
+        image = m_iface->preview(QUrl::fromLocalFile(photoPath));
+    }
+
+    if (image.isNull())
+    {
+        image.load(photoPath);
+    }
+
+    if (!image.isNull())
+    {
+        if (!m_lastTmpFile.isEmpty())
+        {
+            QFile::remove(m_lastTmpFile);
+        }
+
+        path = makeTemporaryDir(m_serviceName.toLatin1().constData()).filePath(QFileInfo(photoPath)
+                                                                     .baseName().trimmed() + QLatin1String(".jpg"));
+
+        if (rescale)
+        {
+            if (image.width() > maxDim || image.height() > maxDim)
+                image = image.scaled(maxDim, maxDim, Qt::KeepAspectRatio, Qt::SmoothTransformation);
+        }
+
+        image.save(path, "JPEG", imageQuality);
+        m_lastTmpFile = path;
+
+        // Restore all metadata.
+
+        if (m_iface)
+        {
+            QPointer<MetadataProcessor> meta = m_iface->createMetadataProcessor();
+
+            if (meta && meta->load(QUrl::fromLocalFile(photoPath)))
+            {
+                meta->setImageDimensions(image.size());
+
+                // NOTE: see bug #153207: Flickr use IPTC keywords to create Tags in web interface
+                //       As IPTC do not support UTF-8, we need to remove it.
+                meta->removeIptcTags(QStringList() << QLatin1String("Iptc.Application2.Keywords"));
+
+                meta->setImageProgramId(QString::fromLatin1("Kipi-plugins"), kipipluginsVersion());
+                meta->save(QUrl::fromLocalFile(path));
+            }
+            else
+            {
+                qCWarning(KIPIPLUGINS_LOG) << "flickrExport::Image doesn't have metadata";
+            }
+        }
+
+        qCDebug(KIPIPLUGINS_LOG) << "Resizing and saving to temp file: " << path;
+    }
+
+    QFileInfo tempFileInfo(path);
+
+    qCDebug(KIPIPLUGINS_LOG) << "QUrl path is " << QUrl::fromLocalFile(path) << "Image size after resizing (in bytes) is "<< tempFileInfo.size();
+
+    if (tempFileInfo.size() > (getMaxAllowedFileSize().toLongLong()))
+    {
+        emit signalAddPhotoFailed(i18n("File Size exceeds maximum allowed file size."));
+        return false;
+    }
+
+    if (!form.addFile(QString::fromLatin1("photo"), path))
+    {
+        return false;
+    }
+
+    form.finish();
+
+    QNetworkRequest netRequest(url);
+    netRequest.setHeader(QNetworkRequest::ContentTypeHeader, form.contentType());
+
+    m_reply = m_netMngr->post(netRequest, form.formData());
+
+    m_state = FE_ADDPHOTO;
+    m_buffer.resize(0);
+    emit signalBusy(true);
+    return true;
+}
+
+QString FlickrTalker::getUserName() const
+{
+    return m_username;
+}
+
+QString FlickrTalker::getUserId() const
+{
+    return m_userId;
+}
+
+void FlickrTalker::cancel()
+{
+    if (m_reply)
+    {
+        m_reply->abort();
+        m_reply = 0;
+    }
+
+    if (m_authProgressDlg && !m_authProgressDlg->isHidden())
+    {
+        m_authProgressDlg->hide();
+    }
+}
+
+void FlickrTalker::slotError(const QString& error)
+{
+    QString transError;
+    int errorNo = error.toInt();
+
+    switch (errorNo)
+    {
+        case 2:
+            transError = i18n("No photo specified");
+            break;
+
+        case 3:
+            transError = i18n("General upload failure");
+            break;
+
+        case 4:
+            transError = i18n("Filesize was zero");
+            break;
+
+        case 5:
+            transError = i18n("Filetype was not recognized");
+            break;
+
+        case 6:
+            transError = i18n("User exceeded upload limit");
+            break;
+
+        case 96:
+            transError = i18n("Invalid signature");
+            break;
+
+        case 97:
+            transError = i18n("Missing signature");
+            break;
+
+        case 98:
+            transError = i18n("Login Failed / Invalid auth token");
+            break;
+
+        case 100:
+            transError = i18n("Invalid API Key");
+            break;
+
+        case 105:
+            transError = i18n("Service currently unavailable");
+            break;
+
+        case 108:
+            transError = i18n("Invalid Frob");
+            break;
+
+        case 111:
+            transError = i18n("Format \"xxx\" not found");
+            break;
+
+        case 112:
+            transError = i18n("Method \"xxx\" not found");
+            break;
+
+        case 114:
+            transError = i18n("Invalid SOAP envelope");
+            break;
+
+        case 115:
+            transError = i18n("Invalid XML-RPC Method Call");
+            break;
+
+        case 116:
+            transError = i18n("The POST method is now required for all setters");
+            break;
+
+        default:
+            transError = i18n("Unknown error");
+            break;
+    };
+
+    QMessageBox::critical(QApplication::activeWindow(),
+                          i18n("Error"),
+                          i18n("Error Occurred: %1\nCannot proceed any further.", transError));
+}
+
+void FlickrTalker::slotFinished(QNetworkReply* reply)
+{
+    emit signalBusy(false);
+
+    if (reply != m_reply)
+    {
+        return;
+    }
+
+    m_reply = 0;
+
+    if (reply->error() != QNetworkReply::NoError)
+    {
+        if (m_state == FE_ADDPHOTO)
+        {
+            emit signalAddPhotoFailed(reply->errorString());
+        }
+        else
+        {
+            QMessageBox::critical(QApplication::activeWindow(),
+                                  i18n("Error"), reply->errorString());
+        }
+
+        reply->deleteLater();
+        return;
+    }
+
+    m_buffer.append(reply->readAll());
+
+    switch (m_state)
+    {
+        case (FE_LOGIN):
+            //parseResponseLogin(m_buffer);
+            break;
+
+        case (FE_LISTPHOTOSETS):
+            parseResponseListPhotoSets(m_buffer);
+            break;
+
+        case (FE_GETFROB):
+            parseResponseGetFrob(m_buffer);
+            break;
+
+        case (FE_GETTOKEN):
+            parseResponseGetToken(m_buffer);
+            break;
+
+        case (FE_CHECKTOKEN):
+            parseResponseCheckToken(m_buffer);
+            break;
+
+        case (FE_GETAUTHORIZED):
+            //parseResponseGetToken(m_buffer);
+            break;
+
+        case (FE_LISTPHOTOS):
+            parseResponseListPhotos(m_buffer);
+            break;
+
+        case (FE_GETPHOTOPROPERTY):
+            parseResponsePhotoProperty(m_buffer);
+            break;
+
+        case (FE_ADDPHOTO):
+            parseResponseAddPhoto(m_buffer);
+            break;
+
+        case (FE_ADDPHOTOTOPHOTOSET):
+            parseResponseAddPhotoToPhotoSet(m_buffer);
+            break;
+
+        case (FE_CREATEPHOTOSET):
+            parseResponseCreatePhotoSet(m_buffer);
+            break;
+
+        case (FE_GETMAXSIZE):
+            parseResponseMaxSize(m_buffer);
+            break;
+
+        default:  // FR_LOGOUT
+            break;
+    }
+
+    reply->deleteLater();
+}
+
+void FlickrTalker::parseResponseMaxSize(const QByteArray& data)
+{
+    QString errorString;
+    QDomDocument doc(QString::fromLatin1("mydocument"));
+
+    if (!doc.setContent(data))
+    {
+        return;
+    }
+
+    QDomElement docElem = doc.documentElement();
+    QDomNode node       = docElem.firstChild();
+
+    QDomElement e;
+
+    while (!node.isNull())
+    {
+        if (node.isElement() && node.nodeName() == QString::fromLatin1("person"))
+        {
+            e                = node.toElement();
+            QDomNode details = e.firstChild();
+
+            while (!details.isNull())
+            {
+                if (details.isElement())
+                {
+                    e = details.toElement();
+
+                    if (details.nodeName() == QString::fromLatin1("photos"))
+                    {
+                        QDomAttr a = e.attributeNode(QString::fromLatin1("maxupload"));
+                        m_maxSize = a.value();
+                        qCDebug(KIPIPLUGINS_LOG) << "Max upload size is"<<m_maxSize;
+                    }
+                }
+
+                details = details.nextSibling();
+            }
+        }
+
+        if (node.isElement() && node.nodeName() == QString::fromLatin1("err"))
+        {
+            qCDebug(KIPIPLUGINS_LOG) << "Checking Error in response";
+            errorString = node.toElement().attribute(QString::fromLatin1("code"));
+            qCDebug(KIPIPLUGINS_LOG) << "Error code=" << errorString;
+            qCDebug(KIPIPLUGINS_LOG) << "Msg=" << node.toElement().attribute(QString::fromLatin1("msg"));
+        }
+
+        node = node.nextSibling();
+    }
+}
+
+void FlickrTalker::parseResponseGetFrob(const QByteArray& data)
+{
+    bool success = false;
+    QString errorString;
+    QDomDocument doc(QString::fromLatin1("mydocument"));
+
+    if (!doc.setContent(data))
+    {
+        return;
+    }
+
+    QDomElement docElem = doc.documentElement();
+    QDomNode node       = docElem.firstChild();
+
+    while (!node.isNull())
+    {
+        if (node.isElement() && node.nodeName() == QString::fromLatin1("frob"))
+        {
+            QDomElement e = node.toElement();    // try to convert the node to an element.
+            qCDebug(KIPIPLUGINS_LOG) << "Frob is" << e.text();
+            m_frob        = e.text();            // this is what is obtained from data.
+            success       = true;
+        }
+
+        if (node.isElement() && node.nodeName() == QString::fromLatin1("err"))
+        {
+            qCDebug(KIPIPLUGINS_LOG) << "Checking Error in response";
+            errorString = node.toElement().attribute(QString::fromLatin1("code"));
+            qCDebug(KIPIPLUGINS_LOG) << "Error code=" << errorString;
+            qCDebug(KIPIPLUGINS_LOG) << "Msg=" << node.toElement().attribute(QString::fromLatin1("msg"));
+        }
+
+        node = node.nextSibling();
+    }
+
+    qCDebug(KIPIPLUGINS_LOG) << "GetFrob finished";
+    m_authProgressDlg->setMaximum(4);
+    m_authProgressDlg->setValue(2);
+    m_state = FE_GETAUTHORIZED;
+
+    if (success)
+    {
+        emit signalAuthenticate();
+    }
+    else
+    {
+        emit signalError(errorString);
+    }
+}
+
+void FlickrTalker::parseResponseCheckToken(const QByteArray& data)
+{
+    bool         success = false;
+    QString      errorString;
+    QString      username;
+    QString      transReturn;
+    QDomDocument doc(QString::fromLatin1("checktoken"));
+
+    if (!doc.setContent(data))
+    {
+        return;
+    }
+
+    QDomElement docElem = doc.documentElement();
+    QDomNode node       = docElem.firstChild();
+    QDomElement e;
+
+    while (!node.isNull())
+    {
+        if (node.isElement() && node.nodeName() == QString::fromLatin1("auth"))
+        {
+            e                = node.toElement(); // try to convert the node to an element.
+            QDomNode details = e.firstChild();
+
+            while (!details.isNull())
+            {
+                if (details.isElement())
+                {
+                    e = details.toElement();
+
+                    if (details.nodeName() == QString::fromLatin1("token"))
+                    {
+                        qCDebug(KIPIPLUGINS_LOG) << "Token=" << e.text();
+                        m_token = e.text();//this is what is obtained from data.
+                    }
+
+                    if (details.nodeName() == QString::fromLatin1("perms"))
+                    {
+                        qCDebug(KIPIPLUGINS_LOG) << "Perms=" << e.text();
+                        QString perms = e.text();//this is what is obtained from data.
+
+                        if (perms == QString::fromLatin1("write"))
+                        {
+                            transReturn = i18nc("As in the permission to", "write");
+                        }
+                        else if (perms == QString::fromLatin1("read"))
+                        {
+                            transReturn = i18nc("As in the permission to", "read");
+                        }
+                        else if (perms == QString::fromLatin1("delete"))
+                        {
+                            transReturn = i18nc("As in the permission to", "delete");
+                        }
+                    }
+
+                    if (details.nodeName() == QString::fromLatin1("user"))
+                    {
+                        qCDebug(KIPIPLUGINS_LOG) << "nsid=" << e.attribute(QString::fromLatin1("nsid"));
+                        m_userId   = e.attribute(QString::fromLatin1("nsid"));
+                        username   = e.attribute(QString::fromLatin1("username"));
+                        m_username = username;
+                        qCDebug(KIPIPLUGINS_LOG) << "username=" << e.attribute(QString::fromLatin1("username"));
+                        qCDebug(KIPIPLUGINS_LOG) << "fullname=" << e.attribute(QString::fromLatin1("fullname"));
+                    }
+                }
+
+                details = details.nextSibling();
+            }
+
+            m_authProgressDlg->hide();
+            emit signalTokenObtained(m_token);
+            success = true;
+        }
+
+        if (node.isElement() && node.nodeName() == QString::fromLatin1("err"))
+        {
+            qCDebug(KIPIPLUGINS_LOG) << "Checking Error in response";
+            errorString = node.toElement().attribute(QString::fromLatin1("code"));
+            qCDebug(KIPIPLUGINS_LOG) << "Error code=" << errorString;
+            qCDebug(KIPIPLUGINS_LOG) << "Msg=" << node.toElement().attribute(QString::fromLatin1("msg"));
+
+            int valueOk = QMessageBox::question(QApplication::activeWindow(),
+                                                i18n("Invalid Token"),
+                                                i18n("Your token is invalid. Would you like to "
+                                                      "get a new token to proceed?\n"));
+
+            if (valueOk == QMessageBox::Yes)
+            {
+                getFrob();
+                return;
+            }
+            else
+            {
+                m_authProgressDlg->hide(); //will popup the result for the checktoken failure below
+            }
+
+        }
+
+        node = node.nextSibling();
+    }
+
+    if (!success)
+    {
+        emit signalError(errorString);
+    }
+
+    qCDebug(KIPIPLUGINS_LOG) << "CheckToken finished";
+}
+
+void FlickrTalker::parseResponseGetToken(const QByteArray& data)
+{
+    bool success = false;
+    QString errorString;
+    QDomDocument doc(QString::fromLatin1("gettoken"));
+
+    if (!doc.setContent(data))
+    {
+        return;
+    }
+
+    QDomElement docElem = doc.documentElement();
+    QDomNode    node    = docElem.firstChild();
+    QDomElement e;
+
+    while (!node.isNull())
+    {
+        if (node.isElement() && node.nodeName() == QString::fromLatin1("auth"))
+        {
+            e                = node.toElement(); // try to convert the node to an element.
+            QDomNode details = e.firstChild();
+
+            while (!details.isNull())
+            {
+                if (details.isElement())
+                {
+                    e = details.toElement();
+
+                    if (details.nodeName() == QString::fromLatin1("token"))
+                    {
+                        qCDebug(KIPIPLUGINS_LOG) << "Token=" << e.text();
+                        m_token = e.text();      //this is what is obtained from data.
+                    }
+
+                    if (details.nodeName() == QString::fromLatin1("perms"))
+                    {
+                        qCDebug(KIPIPLUGINS_LOG) << "Perms=" << e.text();
+                    }
+
+                    if (details.nodeName() == QString::fromLatin1("user"))
+                    {
+                        qCDebug(KIPIPLUGINS_LOG) << "nsid=" << e.attribute(QString::fromLatin1("nsid"));
+                        qCDebug(KIPIPLUGINS_LOG) << "username=" << e.attribute(QString::fromLatin1("username"));
+                        qCDebug(KIPIPLUGINS_LOG) << "fullname=" << e.attribute(QString::fromLatin1("fullname"));
+                        m_username = e.attribute(QString::fromLatin1("username"));
+                        m_userId   = e.attribute(QString::fromLatin1("nsid"));
+                    }
+                }
+
+                details = details.nextSibling();
+            }
+
+            success = true;
+        }
+        else if (node.isElement() && node.nodeName() == QString::fromLatin1("err"))
+        {
+            qCDebug(KIPIPLUGINS_LOG) << "Checking Error in response";
+            errorString = node.toElement().attribute(QString::fromLatin1("code"));
+            qCDebug(KIPIPLUGINS_LOG) << "Error code=" << errorString;
+            qCDebug(KIPIPLUGINS_LOG) << "Msg=" << node.toElement().attribute(QString::fromLatin1("msg"));
+            //emit signalError(code);
+        }
+
+        node = node.nextSibling();
+    }
+
+    qCDebug(KIPIPLUGINS_LOG) << "GetToken finished";
+    //emit signalBusy( false );
+    m_authProgressDlg->hide();
+
+    if (success)
+    {
+        emit signalTokenObtained(m_token);
+    }
+    else
+    {
+        emit signalError(errorString);
+    }
+}
+
+void FlickrTalker::parseResponseCreatePhotoSet(const QByteArray& data)
+{
+    qCDebug(KIPIPLUGINS_LOG) << "Parse response create photoset received " << data;
+
+    //bool success = false;
+
+    QDomDocument doc(QString::fromLatin1("getListPhotoSets"));
+
+    if (!doc.setContent(data))
+    {
+        return;
+    }
+
+    QDomElement docElem = doc.documentElement();
+    QDomNode    node    = docElem.firstChild();
+    QDomElement e;
+
+    while (!node.isNull())
+    {
+        if (node.isElement() && node.nodeName() == QString::fromLatin1("photoset"))
+        {
+            // Parse the id from the response.
+            QString new_id = node.toElement().attribute(QString::fromLatin1("id"));
+
+            // Set the new id in the photo sets list.
+            QLinkedList<FPhotoSet>::iterator it = m_photoSetsList->begin();
+
+            while (it != m_photoSetsList->end())
+            {
+                if (it->id == m_selectedPhotoSet.id)
+                {
+                    it->id = new_id;
+                    break;
+                }
+
+                ++it;
+            }
+
+            // Set the new id in the selected photo set.
+            m_selectedPhotoSet.id = new_id;
+
+            qCDebug(KIPIPLUGINS_LOG) << "PhotoSet created successfully with id" << new_id;
+            emit signalAddPhotoSetSucceeded();
+        }
+
+        if (node.isElement() && node.nodeName() == QString::fromLatin1("err"))
+        {
+            qCDebug(KIPIPLUGINS_LOG) << "Checking Error in response";
+            QString code = node.toElement().attribute(QString::fromLatin1("code"));
+            qCDebug(KIPIPLUGINS_LOG) << "Error code=" << code;
+            QString msg = node.toElement().attribute(QString::fromLatin1("msg"));
+            qCDebug(KIPIPLUGINS_LOG) << "Msg=" << msg;
+            QMessageBox::critical(QApplication::activeWindow(), i18n("Error"), i18n("PhotoSet creation failed: ") + msg);
+        }
+
+        node = node.nextSibling();
+    }
+}
+
+void FlickrTalker::parseResponseListPhotoSets(const QByteArray& data)
+{
+    qCDebug(KIPIPLUGINS_LOG) << "parseResponseListPhotosets" << data;
+    bool success = false;
+    QDomDocument doc(QString::fromLatin1("getListPhotoSets"));
+
+    if (!doc.setContent(data))
+    {
+        return;
+    }
+
+    QDomElement docElem = doc.documentElement();
+    QDomNode    node    = docElem.firstChild();
+    QDomElement e;
+
+    QString photoSet_id, photoSet_title, photoSet_description;
+    m_photoSetsList->clear();
+
+    while (!node.isNull())
+    {
+        if (node.isElement() && node.nodeName() == QString::fromLatin1("photosets"))
+        {
+            e                    = node.toElement();
+            QDomNode details     = e.firstChild();
+            FPhotoSet fps;
+            QDomNode detailsNode = details;
+
+            while (!detailsNode.isNull())
+            {
+                if (detailsNode.isElement())
+                {
+                    e = detailsNode.toElement();
+
+                    if (detailsNode.nodeName() == QString::fromLatin1("photoset"))
+                    {
+                        qCDebug(KIPIPLUGINS_LOG) << "id=" << e.attribute(QString::fromLatin1("id"));
+                        photoSet_id              = e.attribute(QString::fromLatin1("id"));     // this is what is obtained from data.
+                        fps.id                   = photoSet_id;
+                        QDomNode photoSetDetails = detailsNode.firstChild();
+                        QDomElement e_detail;
+
+                        while (!photoSetDetails.isNull())
+                        {
+                            e_detail = photoSetDetails.toElement();
+
+                            if (photoSetDetails.nodeName() == QString::fromLatin1("title"))
+                            {
+                                qCDebug(KIPIPLUGINS_LOG) << "Title=" << e_detail.text();
+                                photoSet_title = e_detail.text();
+                                fps.title      = photoSet_title;
+                            }
+                            else if (photoSetDetails.nodeName() == QString::fromLatin1("description"))
+                            {
+                                qCDebug(KIPIPLUGINS_LOG) << "Description =" << e_detail.text();
+                                photoSet_description = e_detail.text();
+                                fps.description      = photoSet_description;
+                            }
+
+                            photoSetDetails = photoSetDetails.nextSibling();
+                        }
+
+                        m_photoSetsList->append(fps);
+                    }
+                }
+
+                detailsNode = detailsNode.nextSibling();
+            }
+
+            details = details.nextSibling();
+            success = true;
+        }
+
+        if (node.isElement() && node.nodeName() == QString::fromLatin1("err"))
+        {
+            qCDebug(KIPIPLUGINS_LOG) << "Checking Error in response";
+            QString code = node.toElement().attribute(QString::fromLatin1("code"));
+            qCDebug(KIPIPLUGINS_LOG) << "Error code=" << code;
+            qCDebug(KIPIPLUGINS_LOG) << "Msg=" << node.toElement().attribute(QString::fromLatin1("msg"));
+            emit signalError(code);
+        }
+
+        node = node.nextSibling();
+    }
+
+    qCDebug(KIPIPLUGINS_LOG) << "GetPhotoList finished";
+
+    if (!success)
+    {
+        emit signalListPhotoSetsFailed(i18n("Failed to fetch list of photo sets."));
+    }
+    else
+    {
+        emit signalListPhotoSetsSucceeded();
+        maxAllowedFileSize();
+    }
+}
+
+void FlickrTalker::parseResponseListPhotos(const QByteArray& data)
+{
+    QDomDocument doc(QString::fromLatin1("getPhotosList"));
+
+    if (!doc.setContent(data))
+    {
+        return;
+    }
+
+    QDomElement docElem = doc.documentElement();
+    QDomNode node       = docElem.firstChild();
+    //QDomElement e;
+    //TODO
+}
+
+void FlickrTalker::parseResponseCreateAlbum(const QByteArray& data)
+{
+    QDomDocument doc(QString::fromLatin1("getCreateAlbum"));
+
+    if (!doc.setContent(data))
+    {
+        return;
+    }
+
+    QDomElement docElem = doc.documentElement();
+    QDomNode node       = docElem.firstChild();
+
+    //TODO
+}
+
+void FlickrTalker::parseResponseAddPhoto(const QByteArray& data)
+{
+    bool    success = false;
+    QString line;
+    QDomDocument doc(QString::fromLatin1("AddPhoto Response"));
+
+    if (!doc.setContent(data))
+    {
+        return;
+    }
+
+    QDomElement docElem = doc.documentElement();
+    QDomNode node       = docElem.firstChild();
+    QDomElement e;
+    QString photoId;
+
+    while (!node.isNull())
+    {
+        if (node.isElement() && node.nodeName() == QString::fromLatin1("photoid"))
+        {
+            e                = node.toElement();           // try to convert the node to an element.
+            QDomNode details = e.firstChild();
+            photoId          = e.text();
+            qCDebug(KIPIPLUGINS_LOG) << "Photoid= " << photoId;
+            success          = true;
+        }
+
+        if (node.isElement() && node.nodeName() == QString::fromLatin1("err"))
+        {
+            qCDebug(KIPIPLUGINS_LOG) << "Checking Error in response";
+            QString code = node.toElement().attribute(QString::fromLatin1("code"));
+            qCDebug(KIPIPLUGINS_LOG) << "Error code=" << code;
+            qCDebug(KIPIPLUGINS_LOG) << "Msg=" << node.toElement().attribute(QString::fromLatin1("msg"));
+            emit signalError(code);
+        }
+
+        node = node.nextSibling();
+    }
+
+    if (!success)
+    {
+        emit signalAddPhotoFailed(i18n("Failed to upload photo"));
+    }
+    else
+    {
+        QString photoSetId = m_selectedPhotoSet.id;
+
+        if (photoSetId == QString::fromLatin1("-1"))
+        {
+            qCDebug(KIPIPLUGINS_LOG) << "PhotoSet Id not set, not adding the photo to any photoset";
+            emit signalAddPhotoSucceeded();
+        }
+        else
+        {
+            if (m_serviceName == QString::fromLatin1("Zooomr"))
+            {
+                // addPhotoToPhotoSet not supported by Zooomr (Zooomr only has
+                // smart folder-type photosets); silently fail
+                emit signalAddPhotoSucceeded();
+            }
+            else
+            {
+                addPhotoToPhotoSet(photoId, photoSetId);
+            }
+        }
+    }
+}
+
+void FlickrTalker::parseResponsePhotoProperty(const QByteArray& data)
+{
+    bool         success = false;
+    QString      line;
+    QDomDocument doc(QString::fromLatin1("Photos Properties"));
+
+    if (!doc.setContent(data))
+    {
+        return;
+    }
+
+    QDomElement docElem = doc.documentElement();
+    QDomNode    node    = docElem.firstChild();
+    QDomElement e;
+
+    while (!node.isNull())
+    {
+        if (node.isElement() && node.nodeName() == QString::fromLatin1("photoid"))
+        {
+            e                = node.toElement();                 // try to convert the node to an element.
+            QDomNode details = e.firstChild();
+            success          = true;
+            qCDebug(KIPIPLUGINS_LOG) << "Photoid=" << e.text();
+        }
+
+        if (node.isElement() && node.nodeName() == QString::fromLatin1("err"))
+        {
+            qCDebug(KIPIPLUGINS_LOG) << "Checking Error in response";
+            QString code = node.toElement().attribute(QString::fromLatin1("code"));
+            qCDebug(KIPIPLUGINS_LOG) << "Error code=" << code;
+            qCDebug(KIPIPLUGINS_LOG) << "Msg=" << node.toElement().attribute(QString::fromLatin1("msg"));
+            emit signalError(code);
+        }
+
+        node = node.nextSibling();
+    }
+
+    qCDebug(KIPIPLUGINS_LOG) << "GetToken finished";
+
+    if (!success)
+    {
+        emit signalAddPhotoFailed(i18n("Failed to query photo information"));
+    }
+    else
+    {
+        emit signalAddPhotoSucceeded();
+    }
+}
+
+void FlickrTalker::parseResponseAddPhotoToPhotoSet(const QByteArray& data)
+{
+    qCDebug(KIPIPLUGINS_LOG) << "parseResponseListPhotosets" << data;
+    emit signalAddPhotoSucceeded();
+}
+
+} // namespace KIPIFlickrPlugin
diff -durN orig/digikam-5.3.0/.pc/flickr.diff/extra/kipi-plugins/flickr/flickrtalker.h digikam-5.3.0/.pc/flickr.diff/extra/kipi-plugins/flickr/flickrtalker.h
--- orig/digikam-5.3.0/.pc/flickr.diff/extra/kipi-plugins/flickr/flickrtalker.h	1969-12-31 18:00:00.000000000 -0600
+++ digikam-5.3.0/.pc/flickr.diff/extra/kipi-plugins/flickr/flickrtalker.h	2017-09-07 11:43:00.443658943 -0500
@@ -0,0 +1,181 @@
+/* ============================================================
+ *
+ * This file is a part of kipi-plugins project
+ * http://www.digikam.org
+ *
+ * Date        : 2005-07-07
+ * Description : a kipi plugin to export images to Flickr web service
+ *
+ * Copyright (C) 2005-2009 by Vardhman Jain <vardhman at gmail dot com>
+ * Copyright (C) 2009-2016 by Gilles Caulier <caulier dot gilles at gmail dot com>
+ *
+ * This program is free software; you can redistribute it
+ * and/or modify it under the terms of the GNU General
+ * Public License as published by the Free Software Foundation;
+ * either version 2, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * ============================================================ */
+
+#ifndef FLICKRTALKER_H
+#define FLICKRTALKER_H
+
+// Qt includes
+
+#include <QUrl>
+#include <QList>
+#include <QPair>
+#include <QString>
+#include <QObject>
+#include <QNetworkReply>
+#include <QCryptographicHash>
+#include <QNetworkAccessManager>
+
+// Libkipi includes
+
+#include <KIPI/Interface>
+
+// Local includes
+
+#include "flickritem.h"
+
+class QProgressDialog;
+
+using namespace KIPI;
+
+namespace KIPIFlickrPlugin
+{
+
+class GAlbum;
+class GPhoto;
+class FPhotoInfo;
+class FPhotoSet;
+
+class FlickrTalker : public QObject
+{
+    Q_OBJECT
+
+public:
+
+    enum State
+    {
+        FE_LOGOUT = -1,
+        FE_LOGIN  = 0,
+        FE_LISTPHOTOSETS,
+        FE_LISTPHOTOS,
+        FE_GETPHOTOPROPERTY,
+        FE_ADDPHOTO,
+        FE_GETFROB,
+        FE_CHECKTOKEN,
+        FE_GETTOKEN,
+        FE_GETAUTHORIZED,
+        FE_CREATEPHOTOSET,
+        FE_ADDPHOTOTOPHOTOSET,
+        FE_GETMAXSIZE
+    };
+
+public:
+
+    FlickrTalker(QWidget* const parent, const QString& serviceName);
+    ~FlickrTalker();
+
+    QString getUserName() const;
+    QString getUserId() const;
+    void    maxAllowedFileSize();
+    QString getMaxAllowedFileSize();
+    void    getFrob();
+    void    getToken();
+    void    checkToken(const QString& token);
+    void    getPhotoProperty(const QString& method, const QStringList& argList);
+    void    cancel();
+
+    void    listPhotoSets();
+    void    listPhotos(const QString& albumName);
+    void    createPhotoSet(const QString& name,
+                           const QString& title,
+                           const QString& desc,
+                           const QString& primaryPhotoId);
+
+    void    addPhotoToPhotoSet(const QString& photoId, const QString& photoSetId);
+    bool    addPhoto(const QString& photoPath, const FPhotoInfo& info,
+                     bool rescale=false, int maxDim=600, int imageQuality=85);
+
+public:
+
+    QProgressDialog*         m_authProgressDlg;
+    QLinkedList <FPhotoSet>* m_photoSetsList;
+    FPhotoSet                m_selectedPhotoSet;
+
+Q_SIGNALS:
+
+    void signalError(const QString& msg);
+    //  void signalLoginFailed( const QString& msg );
+    void signalBusy(bool val);
+    void signalAlbums(const QList<GAlbum>& albumList);
+    void signalPhotos(const QList<GPhoto>& photoList);
+    void signalAddPhotoSucceeded();
+    void signalAddPhotoSetSucceeded();
+    void signalListPhotoSetsSucceeded();
+    void signalListPhotoSetsFailed(QString& msg);
+    void signalAddPhotoFailed(const QString& msg);
+    void signalListPhotoSetsFailed(const QString& msg);
+    void signalAuthenticate();
+    void signalTokenObtained(const QString& token);
+
+private:
+
+    //  void parseResponseLogin(const QByteArray& data);
+    void parseResponseMaxSize(const QByteArray& data);
+    void parseResponseListPhotoSets(const QByteArray& data);
+    void parseResponseListPhotos(const QByteArray& data);
+    void parseResponseCreateAlbum(const QByteArray& data);
+    void parseResponseAddPhoto(const QByteArray& data);
+    void parseResponseGetFrob(const QByteArray& data);
+    void parseResponseGetToken(const QByteArray& data);
+    void parseResponseCheckToken(const QByteArray& data);
+    void parseResponsePhotoProperty(const QByteArray& data);
+    void parseResponseCreatePhotoSet(const QByteArray& data);
+    void parseResponseAddPhotoToPhotoSet(const QByteArray& data);
+
+    QString getApiSig(const QString& secret, const QUrl& url);
+
+private Q_SLOTS:
+
+    void slotError(const QString& msg);
+    void slotAuthenticate();
+    void slotFinished(QNetworkReply* reply);
+
+private:
+
+    QWidget*               m_parent;
+//  QString                m_cookie;
+    QByteArray             m_buffer;
+
+    QString                m_serviceName;
+    QString                m_apiUrl;
+    QString                m_authUrl;
+    QString                m_uploadUrl;
+    QString                m_apikey;
+    QString                m_secret;
+    QString                m_frob;
+    QString                m_maxSize;
+    QString                m_token;
+    QString                m_username;
+    QString                m_userId;
+    QString                m_lastTmpFile;
+
+    QNetworkAccessManager* m_netMngr;
+    QNetworkReply*         m_reply;
+
+    State                  m_state;
+
+    Interface*             m_iface;
+};
+
+} // namespace KIPIFlickrPlugin
+
+#endif /* FLICKRTALKER_H */
diff -durN orig/digikam-5.3.0/.pc/flickr.diff/extra/kipi-plugins/flickr/flickrwidget.cpp digikam-5.3.0/.pc/flickr.diff/extra/kipi-plugins/flickr/flickrwidget.cpp
--- orig/digikam-5.3.0/.pc/flickr.diff/extra/kipi-plugins/flickr/flickrwidget.cpp	1969-12-31 18:00:00.000000000 -0600
+++ digikam-5.3.0/.pc/flickr.diff/extra/kipi-plugins/flickr/flickrwidget.cpp	2017-09-07 11:43:00.443658943 -0500
@@ -0,0 +1,527 @@
+/* ============================================================
+ *
+ * This file is a part of kipi-plugins project
+ * http://www.digikam.org
+ *
+ * Date        : 2005-07-07
+ * Description : a kipi plugin to export images to Flickr web service
+ *
+ * Copyright (C) 2005-2008 by Vardhman Jain <vardhman at gmail dot com>
+ * Copyright (C) 2008-2016 by Gilles Caulier <caulier dot gilles at gmail dot com>
+ * Copyright (C) 2009      by Luka Renko <lure at kubuntu dot org>
+ *
+ * This program is free software; you can redistribute it
+ * and/or modify it under the terms of the GNU General
+ * Public License as published by the Free Software Foundation;
+ * either version 2, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * ============================================================ */
+
+#include "flickrwidget.h"
+
+// Qt includes
+
+#include <QCheckBox>
+#include <QGridLayout>
+#include <QGroupBox>
+#include <QHeaderView>
+#include <QLabel>
+#include <QPushButton>
+#include <QScrollArea>
+#include <QSpinBox>
+#include <QVBoxLayout>
+#include <QTreeWidget>
+#include <QApplication>
+#include <QStyle>
+#include <QDialog>
+
+// LibKIPI includes
+
+#include <KIPI/Interface>
+
+// Local includes
+
+#include "comboboxdelegate.h"
+#include "comboboxintermediate.h"
+#include "flickrlist.h"
+
+namespace KIPIFlickrPlugin
+{
+
+FlickrWidget::FlickrWidget(QWidget* const parent, KIPI::Interface* const iface, const QString& serviceName)
+    : KPSettingsWidget(parent,iface,serviceName)
+{
+    m_serviceName = serviceName;
+
+    //Adding Remove Account button
+    m_removeAccount              = new QPushButton(getAccountBox());
+    m_removeAccount->setText(i18n("Remove Account"));
+    getAccountBoxLayout()->addWidget(m_removeAccount, 2,0,1,4);
+
+    // -- The image list --------------------------------------------------
+
+    m_imglst               = new FlickrList(this, (serviceName == QString::fromLatin1("23")));
+
+    // For figuring out the width of the permission columns.
+    QHeaderView* const hdr = m_imglst->listView()->header();
+    QFontMetrics hdrFont   = QFontMetrics(hdr->font());
+    int permColWidth       = hdrFont.width(i18nc("photo permissions", "Public"));
+
+    m_imglst->setAllowRAW(true);
+    m_imglst->loadImagesFromCurrentSelection();
+    m_imglst->listView()->setWhatsThis(i18n("This is the list of images to upload to your Flickr account."));
+    m_imglst->listView()->setColumn(static_cast<KPImagesListView::ColumnType>(FlickrList::PUBLIC), i18nc("photo permissions", "Public"), true);
+
+    // Handle extra tags per image.
+    m_imglst->listView()->setColumn(static_cast<KPImagesListView::ColumnType>(FlickrList::TAGS),
+                                    i18n("Extra tags"), true);
+
+    if (serviceName != QString::fromLatin1("23"))
+    {
+        int tmpWidth;
+
+        if ((tmpWidth = hdrFont.width(i18nc("photo permissions", "Family"))) > permColWidth)
+        {
+            permColWidth = tmpWidth;
+        }
+
+        if ((tmpWidth = hdrFont.width(i18nc("photo permissions", "Friends"))) > permColWidth)
+        {
+            permColWidth = tmpWidth;
+        }
+
+        m_imglst->listView()->setColumn(static_cast<KPImagesListView::ColumnType>(FlickrList::FAMILY),
+                                        i18nc("photo permissions", "Family"), true);
+        m_imglst->listView()->setColumn(static_cast<KPImagesListView::ColumnType>(FlickrList::FRIENDS),
+                                        i18nc("photo permissions", "Friends"), true);
+        hdr->setSectionResizeMode(FlickrList::FAMILY,  QHeaderView::Interactive);
+        hdr->setSectionResizeMode(FlickrList::FRIENDS, QHeaderView::Interactive);
+        hdr->resizeSection(FlickrList::FAMILY,  permColWidth);
+        hdr->resizeSection(FlickrList::FRIENDS, permColWidth);
+
+        m_imglst->listView()->setColumn(static_cast<KPImagesListView::ColumnType>(FlickrList::SAFETYLEVEL),
+                                        i18n("Safety level"), true);
+        m_imglst->listView()->setColumn(static_cast<KPImagesListView::ColumnType>(FlickrList::CONTENTTYPE),
+                                        i18n("Content type"), true);
+        QMap<int, QString> safetyLevelItems;
+        QMap<int, QString> contentTypeItems;
+        safetyLevelItems[FlickrList::SAFE]       = i18nc("photo safety level", "Safe");
+        safetyLevelItems[FlickrList::MODERATE]   = i18nc("photo safety level", "Moderate");
+        safetyLevelItems[FlickrList::RESTRICTED] = i18nc("photo safety level", "Restricted");
+        contentTypeItems[FlickrList::PHOTO]      = i18nc("photo content type", "Photo");
+        contentTypeItems[FlickrList::SCREENSHOT] = i18nc("photo content type", "Screenshot");
+        contentTypeItems[FlickrList::OTHER]      = i18nc("photo content type", "Other");
+        ComboBoxDelegate* const safetyLevelDelegate = new ComboBoxDelegate(m_imglst, safetyLevelItems);
+        ComboBoxDelegate* const contentTypeDelegate = new ComboBoxDelegate(m_imglst, contentTypeItems);
+        m_imglst->listView()->setItemDelegateForColumn(static_cast<KPImagesListView::ColumnType>(FlickrList::SAFETYLEVEL), safetyLevelDelegate);
+        m_imglst->listView()->setItemDelegateForColumn(static_cast<KPImagesListView::ColumnType>(FlickrList::CONTENTTYPE), contentTypeDelegate);
+
+    }
+
+    hdr->setSectionResizeMode(FlickrList::PUBLIC, QHeaderView::Interactive);
+    hdr->resizeSection(FlickrList::PUBLIC, permColWidth);
+
+    // -- Layout for the tags -------------------------------------------------
+
+    QGroupBox* const tagsBox         = new QGroupBox(i18n("Tag options"), getSettingsBox());
+    QGridLayout* const tagsBoxLayout = new QGridLayout(tagsBox);
+
+    m_exportHostTagsCheckBox         = new QCheckBox(tagsBox);
+    m_exportHostTagsCheckBox->setText(i18n("Use Host Application Tags"));
+
+    m_extendedTagsButton             = new QPushButton(i18n("More tag options"));
+    m_extendedTagsButton->setCheckable(true);
+    // Initialize this button to checked, so extended options are shown.
+    // FlickrWindow::readSettings can change this, but if checked is false it
+    // cannot uncheck and subsequently hide the extended options (the toggled
+    // signal won't be emitted).
+    m_extendedTagsButton->setChecked(true);
+    m_extendedTagsButton->setSizePolicy(QSizePolicy::Maximum,
+                                        QSizePolicy::Preferred);
+
+    m_extendedTagsBox               = new QGroupBox(QString::fromLatin1(""), getSettingsBox());
+    m_extendedTagsBox->setFlat(true);
+    QGridLayout* extendedTagsLayout = new QGridLayout(m_extendedTagsBox);
+
+    QLabel* const tagsLabel         = new QLabel(i18n("Added Tags: "), m_extendedTagsBox);
+    m_tagsLineEdit                  = new QLineEdit(m_extendedTagsBox);
+    m_tagsLineEdit->setToolTip(i18n("Enter new tags here, separated by commas."));
+    m_addExtraTagsCheckBox          = new QCheckBox(m_extendedTagsBox);
+    m_addExtraTagsCheckBox->setText(i18n("Add tags per image"));
+    m_addExtraTagsCheckBox->setToolTip(i18n("If checked, you can set extra tags for "
+                                            "each image in the File List tab"));
+    m_addExtraTagsCheckBox->setChecked(true);
+    m_stripSpaceTagsCheckBox        = new QCheckBox(m_extendedTagsBox);
+    m_stripSpaceTagsCheckBox->setText(i18n("Strip Spaces From Tags"));
+
+    extendedTagsLayout->addWidget(tagsLabel,                0, 0);
+    extendedTagsLayout->addWidget(m_tagsLineEdit,           0, 1);
+    extendedTagsLayout->addWidget(m_stripSpaceTagsCheckBox, 1, 0, 1, 2);
+    extendedTagsLayout->addWidget(m_addExtraTagsCheckBox,   2, 0, 1, 2);
+
+    tagsBoxLayout->addWidget(m_exportHostTagsCheckBox, 0, 0);
+    tagsBoxLayout->addWidget(m_extendedTagsButton,     0, 1);
+    tagsBoxLayout->addWidget(m_extendedTagsBox,        1, 0, 1, 2);
+
+    // -- Layout for the publication options ----------------------------------
+
+    QGroupBox* const publicationBox         = new QGroupBox(i18n("Publication Options"), getSettingsBox());
+    QGridLayout* const publicationBoxLayout = new QGridLayout;
+    publicationBox->setLayout(publicationBoxLayout);
+
+    m_publicCheckBox = new QCheckBox(publicationBox);
+    m_publicCheckBox->setText(i18nc("As in accessible for people", "Public (anyone can see them)"));
+
+    m_familyCheckBox = new QCheckBox(publicationBox);
+    m_familyCheckBox->setText(i18n("Visible to Family"));
+
+    m_friendsCheckBox = new QCheckBox(publicationBox);
+    m_friendsCheckBox->setText(i18n("Visible to Friends"));
+
+    // Extended publication settings
+    m_extendedPublicationButton = new QPushButton(i18n("More publication options"));
+    m_extendedPublicationButton->setCheckable(true);
+    // Initialize this button to checked, so extended options are shown.
+    // FlickrWindow::readSettings can change this, but if checked is false it
+    // cannot uncheck and subsequently hide the extended options (the toggled
+    // signal won't be emitted).
+    m_extendedPublicationButton->setChecked(true);
+    m_extendedPublicationButton->setSizePolicy(QSizePolicy::Maximum, QSizePolicy::Preferred);
+
+    m_extendedPublicationBox                  = new QGroupBox(QString::fromLatin1(""), publicationBox);
+    m_extendedPublicationBox->setFlat(true);
+    QGridLayout* const extendedSettingsLayout = new QGridLayout(m_extendedPublicationBox);
+
+    QLabel* const imageSafetyLabel = new QLabel(i18n("Safety level:"));
+    m_safetyLevelComboBox          = new ComboBoxIntermediate();
+    m_safetyLevelComboBox->addItem(i18n("Safe"),       QVariant(FlickrList::SAFE));
+    m_safetyLevelComboBox->addItem(i18n("Moderate"),   QVariant(FlickrList::MODERATE));
+    m_safetyLevelComboBox->addItem(i18n("Restricted"), QVariant(FlickrList::RESTRICTED));
+
+    QLabel* const imageTypeLabel = new QLabel(i18n("Content type:"));
+    m_contentTypeComboBox        = new ComboBoxIntermediate();
+    m_contentTypeComboBox->addItem(i18nc("photo content type", "Photo"),      QVariant(FlickrList::PHOTO));
+    m_contentTypeComboBox->addItem(i18nc("photo content type", "Screenshot"), QVariant(FlickrList::SCREENSHOT));
+    m_contentTypeComboBox->addItem(i18nc("photo content type", "Other"),      QVariant(FlickrList::OTHER));
+
+    extendedSettingsLayout->addWidget(imageSafetyLabel,      1, 0, Qt::AlignLeft);
+    extendedSettingsLayout->addWidget(m_safetyLevelComboBox, 1, 1, Qt::AlignLeft);
+    extendedSettingsLayout->addWidget(imageTypeLabel,        0, 0, Qt::AlignLeft);
+    extendedSettingsLayout->addWidget(m_contentTypeComboBox, 0, 1, Qt::AlignLeft);
+    extendedSettingsLayout->setColumnStretch(0, 0);
+    extendedSettingsLayout->setColumnStretch(1, 1);
+
+    publicationBoxLayout->addWidget(m_publicCheckBox,            0, 0);
+    publicationBoxLayout->addWidget(m_familyCheckBox,            1, 0);
+    publicationBoxLayout->addWidget(m_friendsCheckBox,           2, 0);
+    publicationBoxLayout->addWidget(m_extendedPublicationButton, 2, 1);
+    publicationBoxLayout->addWidget(m_extendedPublicationBox,    3, 0, 1, 2);
+
+    // -- Add these extra widgets to settings box -------------------------------------------------
+
+    addWidgetToSettingsBox(publicationBox);
+    addWidgetToSettingsBox(tagsBox);
+
+    //hiding widgets not required.
+    getUploadBox()->hide();
+    getSizeBox()->hide();
+
+    //Removing KPImageLists inherited from KPSettingsWidget and replacing it with more specific FlickrList
+    replaceImageList(m_imglst);
+
+    updateLabels();
+
+    connect(m_imglst, SIGNAL(signalPermissionChanged(FlickrList::FieldType,Qt::CheckState)),
+            this, SLOT(slotPermissionChanged(FlickrList::FieldType,Qt::CheckState)));
+
+    connect(m_publicCheckBox, SIGNAL(stateChanged(int)),
+            this, SLOT(slotMainPublicToggled(int)));
+
+    connect(m_extendedTagsButton, SIGNAL(toggled(bool)),
+            this, SLOT(slotExtendedTagsToggled(bool)));
+
+    connect(m_addExtraTagsCheckBox, SIGNAL(toggled(bool)),
+            this, SLOT(slotAddExtraTagsToggled(bool)));
+
+    // Zooomr doesn't support explicit Photosets.
+    if (serviceName == QString::fromLatin1("Zooomr"))
+    {
+        getAlbumBox()->hide();
+    }
+
+    // 23HQ doesn't support the Family and Friends concept.
+    if (serviceName != QString::fromLatin1("23"))
+    {
+        connect(m_familyCheckBox, SIGNAL(stateChanged(int)),
+                this, SLOT(slotMainFamilyToggled(int)));
+
+        connect(m_friendsCheckBox, SIGNAL(stateChanged(int)),
+                this, SLOT(slotMainFriendsToggled(int)));
+    }
+    else
+    {
+        m_familyCheckBox->hide();
+        m_friendsCheckBox->hide();
+    }
+
+    // 23HQ and Zooomr don't support the Safety Level and Content Type concept.
+    if ((serviceName != QString::fromLatin1("23")) && (serviceName != QString::fromLatin1("Zooomr")))
+    {
+        connect(m_safetyLevelComboBox, SIGNAL(currentIndexChanged(int)),
+                this, SLOT(slotMainSafetyLevelChanged(int)));
+
+        connect(m_contentTypeComboBox, SIGNAL(currentIndexChanged(int)),
+                this, SLOT(slotMainContentTypeChanged(int)));
+
+        connect(m_extendedPublicationButton, SIGNAL(toggled(bool)),
+                this, SLOT(slotExtendedPublicationToggled(bool)));
+
+        connect(m_imglst, SIGNAL(signalSafetyLevelChanged(FlickrList::SafetyLevel)),
+                this, SLOT(slotSafetyLevelChanged(FlickrList::SafetyLevel)));
+
+        connect(m_imglst, SIGNAL(signalContentTypeChanged(FlickrList::ContentType)),
+                this, SLOT(slotContentTypeChanged(FlickrList::ContentType)));
+    }
+    else
+    {
+        m_extendedPublicationBox->hide();
+        m_extendedPublicationButton->hide();
+        m_imglst->listView()->setColumnEnabled(static_cast<KPImagesListView::ColumnType>(FlickrList::SAFETYLEVEL), false);
+        m_imglst->listView()->setColumnEnabled(static_cast<KPImagesListView::ColumnType>(FlickrList::CONTENTTYPE), false);
+    }
+}
+
+FlickrWidget::~FlickrWidget()
+{
+}
+
+void FlickrWidget::updateLabels(const QString& /*name*/, const QString& /*url*/)
+{
+    if (m_serviceName == QString::fromLatin1("23"))
+        getHeaderLbl()->setText(i18n("<b><h2><a href='http://www.23hq.com'>"
+                                  "<font color=\"#7CD164\">23</font></a>"
+                                  " Export"
+                                  "</h2></b>"));
+    else if (m_serviceName == QString::fromLatin1("Zooomr"))
+        getHeaderLbl()->setText(i18n("<b><h2><a href='http://www.zooomr.com'>"
+                                  "<font color=\"#7CD164\">zooomr</font></a>"
+                                  " Export"
+                                  "</h2></b>"));
+    else
+        getHeaderLbl()->setText(i18n("<b><h2><a href='http://www.flickr.com'>"
+                                  "<font color=\"#0065DE\">flick</font>"
+                                  "<font color=\"#FF0084\">r</font></a>"
+                                  " Export"
+                                  "</h2></b>"));
+}
+
+void FlickrWidget::slotPermissionChanged(FlickrList::FieldType checkbox, Qt::CheckState state)
+{
+    /* Slot for handling the signal from the FlickrList that the general
+     * permissions have changed, considering the clicks in the checkboxes next
+     * to each image. In response, the main permission checkboxes should be set
+     * to the proper state.
+     * The checkbox variable determines which of the checkboxes should be
+     * changed. */
+
+    // Select the proper checkbox.
+    QCheckBox* currBox = 0;
+
+    if (checkbox == FlickrList::PUBLIC)
+    {
+        currBox = m_publicCheckBox;
+    }
+    else if (checkbox == FlickrList::FAMILY)
+    {
+        currBox = m_familyCheckBox;
+    }
+    else
+    {
+        currBox = m_friendsCheckBox;
+    }
+
+    // If the checkbox should be set in the intermediate state, the tristate
+    // property of the checkbox should be manually set to true, otherwise, it
+    // has to be set to false so that the user cannot select it.
+    currBox->setCheckState(state);
+
+    if ((state == Qt::Checked) || (state == Qt::Unchecked))
+    {
+        currBox->setTristate(false);
+    }
+    else
+    {
+        currBox->setTristate(true);
+    }
+}
+
+void FlickrWidget::slotSafetyLevelChanged(FlickrList::SafetyLevel safetyLevel)
+{
+    /* Called when the general safety level of the FlickrList has changed,
+     * considering the individual comboboxes next to the photos. Used to set the
+     * main safety level combobox appropriately. */
+    if (safetyLevel == FlickrList::MIXEDLEVELS)
+    {
+        m_safetyLevelComboBox->setIntermediate(true);
+    }
+    else
+    {
+        int index = m_safetyLevelComboBox->findData(QVariant(static_cast<int>(safetyLevel)));
+        m_safetyLevelComboBox->setCurrentIndex(index);
+    }
+}
+
+void FlickrWidget::slotContentTypeChanged(FlickrList::ContentType contentType)
+{
+    /* Called when the general content type of the FlickrList has changed,
+     * considering the individual comboboxes next to the photos. Used to set the
+     * main content type combobox appropriately. */
+    if (contentType == FlickrList::MIXEDTYPES)
+    {
+        m_contentTypeComboBox->setIntermediate(true);
+    }
+    else
+    {
+        int index = m_contentTypeComboBox->findData(QVariant(static_cast<int>(contentType)));
+        m_contentTypeComboBox->setCurrentIndex(index);
+    }
+}
+
+void FlickrWidget::slotMainPublicToggled(int state)
+{
+    mainPermissionToggled(FlickrList::PUBLIC, static_cast<Qt::CheckState>(state));
+}
+
+void FlickrWidget::slotMainFamilyToggled(int state)
+{
+    mainPermissionToggled(FlickrList::FAMILY, static_cast<Qt::CheckState>(state));
+}
+
+void FlickrWidget::slotMainFriendsToggled(int state)
+{
+    mainPermissionToggled(FlickrList::FRIENDS, static_cast<Qt::CheckState>(state));
+}
+
+void FlickrWidget::mainPermissionToggled(FlickrList::FieldType checkbox, Qt::CheckState state)
+{
+    /* Callback for when one of the main permission checkboxes is toggled.
+     * checkbox specifies which of the checkboxes is toggled. */
+
+    if (state != Qt::PartiallyChecked)
+    {
+        // Set the states for the image list.
+        if (checkbox == FlickrList::PUBLIC)
+        {
+            m_imglst->setPublic(state);
+        }
+        else if (checkbox == FlickrList::FAMILY)
+        {
+            m_imglst->setFamily(state);
+        }
+        else if (checkbox == FlickrList::FRIENDS)
+        {
+            m_imglst->setFriends(state);
+        }
+
+        // Dis- or enable the family and friends checkboxes if the public
+        // checkbox is clicked.
+        if (checkbox == 0)
+        {
+            if (state == Qt::Checked)
+            {
+                m_familyCheckBox->setEnabled(false);
+                m_friendsCheckBox->setEnabled(false);
+            }
+            else if (state == Qt::Unchecked)
+            {
+                m_familyCheckBox->setEnabled(true);
+                m_friendsCheckBox->setEnabled(true);
+            }
+        }
+
+        // Set the main checkbox tristate state to false, so that the user
+        // cannot select the intermediate state.
+        if (checkbox == FlickrList::PUBLIC)
+        {
+            m_publicCheckBox->setTristate(false);
+        }
+        else if (checkbox == FlickrList::FAMILY)
+        {
+            m_familyCheckBox->setTristate(false);
+        }
+        else if (checkbox == FlickrList::FRIENDS)
+        {
+            m_friendsCheckBox->setTristate(false);
+        }
+    }
+}
+
+void FlickrWidget::slotMainSafetyLevelChanged(int index)
+{
+    int currValue = (m_safetyLevelComboBox->itemData(index)).value<int>();
+//     int currValue = qVariantValue<int>(m_safetyLevelComboBox->itemData(index));
+    m_imglst->setSafetyLevels(static_cast<FlickrList::SafetyLevel>(currValue));
+}
+
+void FlickrWidget::slotMainContentTypeChanged(int index)
+{
+    int currValue = (m_contentTypeComboBox->itemData(index)).value<int>();
+//     int currValue = qVariantValue<int>(m_contentTypeComboBox->itemData(index));
+    m_imglst->setContentTypes(static_cast<FlickrList::ContentType>(currValue));
+}
+
+void FlickrWidget::slotExtendedPublicationToggled(bool status)
+{
+    // Show or hide the extended settings when the extended settings button
+    // is toggled.
+    m_extendedPublicationBox->setVisible(status);
+    m_imglst->listView()->setColumnHidden(FlickrList::SAFETYLEVEL, !status);
+    m_imglst->listView()->setColumnHidden(FlickrList::CONTENTTYPE, !status);
+
+    if (status)
+    {
+        m_extendedPublicationButton->setText(i18n("Fewer publication options"));
+    }
+    else
+    {
+        m_extendedPublicationButton->setText(i18n("More publication options"));
+    }
+}
+
+void FlickrWidget::slotExtendedTagsToggled(bool status)
+{
+    // Show or hide the extended tag settings when the extended tag option
+    // button is toggled.
+    m_extendedTagsBox->setVisible(status);
+
+    if (!status)
+    {
+        m_imglst->listView()->setColumnHidden(FlickrList::TAGS, true);
+        m_extendedTagsButton->setText(i18n("More tag options"));
+    }
+    else
+    {
+        m_imglst->listView()->setColumnHidden(FlickrList::TAGS, !m_addExtraTagsCheckBox->isChecked());
+        m_extendedTagsButton->setText(i18n("Fewer tag options"));
+    }
+}
+
+void FlickrWidget::slotAddExtraTagsToggled(bool status)
+{
+    if (m_extendedTagsButton->isChecked())
+    {
+        m_imglst->listView()->setColumnHidden(FlickrList::TAGS, !status);
+    }
+}
+
+// void FlickrWidget::showEvent(QShowEvent*)
+// {
+//     slotOriginalChecked();
+// }
+
+} // namespace KIPIFlickrPlugin
diff -durN orig/digikam-5.3.0/.pc/flickr.diff/extra/kipi-plugins/flickr/flickrwindow.cpp digikam-5.3.0/.pc/flickr.diff/extra/kipi-plugins/flickr/flickrwindow.cpp
--- orig/digikam-5.3.0/.pc/flickr.diff/extra/kipi-plugins/flickr/flickrwindow.cpp	1969-12-31 18:00:00.000000000 -0600
+++ digikam-5.3.0/.pc/flickr.diff/extra/kipi-plugins/flickr/flickrwindow.cpp	2017-09-07 11:43:00.443658943 -0500
@@ -0,0 +1,903 @@
+/* ============================================================
+ *
+ * This file is a part of kipi-plugins project
+ * http://www.digikam.org
+ *
+ * Date        : 2005-17-06
+ * Description : a kipi plugin to export images to Flickr web service
+ *
+ * Copyright (C) 2005-2008 by Vardhman Jain <vardhman at gmail dot com>
+ * Copyright (C) 2008-2016 by Gilles Caulier <caulier dot gilles at gmail dot com>
+ * Copyright (C) 2009      by Luka Renko <lure at kubuntu dot org>
+ *
+ * This program is free software; you can redistribute it
+ * and/or modify it under the terms of the GNU General
+ * Public License as published by the Free Software Foundation;
+ * either version 2, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * ============================================================ */
+
+#include "flickrwindow.h"
+
+// Qt includes
+
+#include <QPushButton>
+#include <QProgressDialog>
+#include <QPixmap>
+#include <QCheckBox>
+#include <QStringList>
+#include <QSpinBox>
+#include <QPointer>
+#include <QDebug>
+#include <QApplication>
+#include <QMenu>
+#include <QMessageBox>
+#include <QWindow>
+
+// KDE includes
+
+#include <kconfig.h>
+#include <kwindowconfig.h>
+
+// LibKIPI includes
+
+#include <KIPI/Interface>
+
+// Local includes
+
+#include "kpaboutdata.h"
+#include "kpimageinfo.h"
+#include "kpversion.h"
+#include "kpprogresswidget.h"
+#include "login.h"
+#include "flickrtalker.h"
+#include "flickritem.h"
+#include "flickrlist.h"
+#include "flickrwidget.h"
+#include "selectuserdlg.h"
+#include "kipiplugins_debug.h"
+#include "newalbum.h"
+
+namespace KIPIFlickrPlugin
+{
+
+FlickrWindow::FlickrWindow(QWidget* const /*parent*/, const QString& serviceName, SelectUserDlg* const dlg)
+    : KPToolDialog(0)
+{
+    m_serviceName = serviceName;
+    setWindowTitle(i18n("Export to %1 Web Service", m_serviceName));
+    setModal(false);
+
+    if (serviceName == QLatin1String("23"))
+    {
+        setWindowIcon(QIcon::fromTheme(QString::fromLatin1("kipi-hq")));
+    }
+    else if (serviceName == QLatin1String("Zooomr"))
+    {
+        setWindowIcon(QIcon::fromTheme(QString::fromLatin1("kipi-zooomr")));
+    }
+    else
+    {
+        setWindowIcon(QIcon::fromTheme(QString::fromLatin1("kipi-flickr")));
+    }
+
+    KConfig config(QString::fromLatin1("kipirc"));
+    KConfigGroup grp = config.group(QString::fromLatin1("%1Export Settings").arg(m_serviceName));
+
+    if(grp.exists())
+    {
+        qCDebug(KIPIPLUGINS_LOG) << QString::fromLatin1("%1Export Settings").arg(m_serviceName) << " exists, deleting it";
+        grp.deleteGroup();
+    }
+
+    m_select                    = dlg;
+    m_uploadCount               = 0;
+    m_uploadTotal               = 0;
+    m_widget                    = new FlickrWidget(this, iface(), serviceName);
+    m_albumDlg                  = new NewAlbum(this,QString::fromLatin1("Flickr"));
+    m_albumsListComboBox        = m_widget->getAlbumsCoB();
+    m_newAlbumBtn               = m_widget->getNewAlbmBtn();
+    //m_sendOriginalCheckBox      = m_widget->m_sendOriginalCheckBox;
+    m_resizeCheckBox            = m_widget->getResizeCheckBox();
+    m_publicCheckBox            = m_widget->m_publicCheckBox;
+    m_familyCheckBox            = m_widget->m_familyCheckBox;
+    m_friendsCheckBox           = m_widget->m_friendsCheckBox;
+    m_dimensionSpinBox          = m_widget->getDimensionSpB();
+    m_imageQualitySpinBox       = m_widget->getImgQualitySpB();
+    m_extendedTagsButton        = m_widget->m_extendedTagsButton;
+    m_addExtraTagsCheckBox      = m_widget->m_addExtraTagsCheckBox;
+    m_extendedPublicationButton = m_widget->m_extendedPublicationButton;
+    m_safetyLevelComboBox       = m_widget->m_safetyLevelComboBox;
+    m_contentTypeComboBox       = m_widget->m_contentTypeComboBox;
+    m_tagsLineEdit              = m_widget->m_tagsLineEdit;
+    m_exportHostTagsCheckBox    = m_widget->m_exportHostTagsCheckBox;
+    m_stripSpaceTagsCheckBox    = m_widget->m_stripSpaceTagsCheckBox;
+    m_changeUserButton          = m_widget->getChangeUserBtn();
+    m_removeAccount             = m_widget->m_removeAccount;
+    m_userNameDisplayLabel      = m_widget->getUserNameLabel();
+    m_imglst                    = m_widget->m_imglst;
+
+    startButton()->setText(i18n("Start Uploading"));
+    startButton()->setToolTip(QString());
+
+    setMainWidget(m_widget);
+    m_widget->setMinimumSize(800, 600);
+
+    connect(m_imglst, SIGNAL(signalImageListChanged()),
+            this, SLOT(slotImageListChanged()));
+
+    //m_startUploadButton->setEnabled(false);
+
+    // --------------------------------------------------------------------------
+    // About data and help button.
+
+    KPAboutData* const about = new KPAboutData(ki18n("Flickr/23/Zooomr Export"),
+                                               ki18n("A tool to export an image collection to a "
+                                                     "Flickr / 23 / Zooomr web service."),
+                                               ki18n("(c) 2005-2008, Vardhman Jain\n"
+                                                     "(c) 2008-2015, Gilles Caulier\n"
+                                                     "(c) 2009, Luka Renko\n"
+                                                     "(c) 2015, Shourya Singh Gupta"));
+
+    about->addAuthor(i18n("Vardhman Jain"), i18n("Author and maintainer"),
+                     QString::fromLatin1("Vardhman at gmail dot com"));
+
+    about->addAuthor(i18n("Gilles Caulier"), i18n("Developer"),
+                     QString::fromLatin1("caulier dot gilles at gmail dot com"));
+
+    about->addAuthor(i18n("Shourya Singh Gupta"), i18n("Developer"),
+                     QString::fromLatin1("shouryasgupta at gmail dot com"));
+
+    about->setHandbookEntry(QString::fromLatin1("tool-flickrexport"));
+    setAboutData(about);
+
+    // --------------------------------------------------------------------------
+
+    m_talker = new FlickrTalker(this, serviceName);
+
+    connect(m_talker, SIGNAL(signalError(QString)),
+            m_talker, SLOT(slotError(QString)));
+
+    connect(m_talker, SIGNAL(signalBusy(bool)),
+            this, SLOT(slotBusy(bool)));
+
+    connect(m_talker, SIGNAL(signalAddPhotoSucceeded()),
+            this, SLOT(slotAddPhotoSucceeded()));
+
+    connect(m_talker, SIGNAL(signalAddPhotoFailed(QString)),
+            this, SLOT(slotAddPhotoFailed(QString)));
+
+    connect(m_talker, SIGNAL(signalAddPhotoSetSucceeded()),
+            this, SLOT(slotAddPhotoSetSucceeded()));
+
+    connect(m_talker, SIGNAL(signalListPhotoSetsSucceeded()),
+            this, SLOT(slotPopulatePhotoSetComboBox()));
+
+    connect(m_talker, SIGNAL(signalListPhotoSetsFailed(QString)),
+            this, SLOT(slotListPhotoSetsFailed(QString)));
+
+    connect(m_talker, SIGNAL(signalTokenObtained(QString)),
+            this, SLOT(slotTokenObtained(QString)));
+
+    connect(m_widget->progressBar(), SIGNAL(signalProgressCanceled()),
+            this, SLOT(slotAddPhotoCancelAndClose()));
+
+    connect(m_widget->getReloadBtn(), SIGNAL(clicked()),
+            this, SLOT(slotReloadPhotoSetRequest()));
+
+    //connect( m_talker, SIGNAL(signalAlbums(QValueList<GAlbum>)),
+    //         SLOT(slotAlbums(QValueList<GAlbum>)) );
+
+    //connect( m_talker, SIGNAL(signalPhotos(QValueList<GPhoto>)),
+    //         SLOT(slotPhotos(QValueList<GPhoto>)) );
+
+    // --------------------------------------------------------------------------
+
+
+    connect(m_changeUserButton, SIGNAL(clicked()),
+            this, SLOT(slotUserChangeRequest()));
+
+    connect(m_removeAccount, SIGNAL(clicked()),
+            this, SLOT(slotRemoveAccount()));
+
+    connect(m_newAlbumBtn, SIGNAL(clicked()),
+            this, SLOT(slotCreateNewPhotoSet()));
+
+
+    //connect( m_tagView, SIGNAL(selectionChanged()),
+    //         SLOT(slotTagSelected()) );
+
+    //connect( m_photoView->browserExtension(), SIGNAL(openURLRequest(KUrl,KParts::URLArgs)),
+    //         SLOT(slotOpenPhoto(KUrl)) );
+
+    // --------------------------------------------------------------------------
+
+    m_authProgressDlg = new QProgressDialog(this);
+    m_authProgressDlg->setModal(true);
+    m_authProgressDlg->setAutoReset(true);
+    m_authProgressDlg->setAutoClose(true);
+    m_authProgressDlg->setMaximum(0);
+    m_authProgressDlg->reset();
+
+    connect(m_authProgressDlg, SIGNAL(canceled()),
+            this, SLOT(slotAuthCancel()));
+
+    m_talker->m_authProgressDlg = m_authProgressDlg;
+
+    // --------------------------------------------------------------------------
+
+    connect(this, &QDialog::finished,
+            this, &FlickrWindow::slotFinished);
+
+    connect(this, SIGNAL(cancelClicked()),
+            this, SLOT(slotCancelClicked()));
+
+    connect(startButton(), &QPushButton::clicked,
+            this, &FlickrWindow::slotUser1);
+}
+
+FlickrWindow::~FlickrWindow()
+{
+    delete m_authProgressDlg;
+    delete m_talker;
+    delete m_widget;
+}
+
+void FlickrWindow::closeEvent(QCloseEvent* e)
+{
+    if (!e)
+    {
+        return;
+    }
+
+    slotFinished();
+    e->accept();
+}
+
+void FlickrWindow::slotFinished()
+{
+    writeSettings();
+    m_imglst->listView()->clear();
+}
+
+void FlickrWindow::setUiInProgressState(bool inProgress)
+{
+    setRejectButtonMode(inProgress ? QDialogButtonBox::Cancel : QDialogButtonBox::Close);
+
+    if (inProgress)
+    {
+        m_widget->progressBar()->show();
+    }
+    else
+    {
+        m_widget->progressBar()->hide();
+        m_widget->progressBar()->progressCompleted();
+    }
+}
+
+void FlickrWindow::slotCancelClicked()
+{
+    m_talker->cancel();
+    m_uploadQueue.clear();
+    setUiInProgressState(false);
+}
+
+void FlickrWindow::slotAddPhotoCancelAndClose()
+{
+    writeSettings();
+    m_imglst->listView()->clear();
+    m_uploadQueue.clear();
+    m_widget->progressBar()->reset();
+    setUiInProgressState(false);
+    m_talker->cancel();
+    reject();
+
+    // refresh the thumbnails
+    //slotTagSelected();
+}
+
+void FlickrWindow::reactivate()
+{
+    m_userNameDisplayLabel->setText(QString());
+    readSettings(m_select->getUname());
+    qCDebug(KIPIPLUGINS_LOG) << "Calling auth methods";
+
+    if (m_token.length() < 1)
+    {
+        m_talker->getFrob();
+    }
+    else
+    {
+        m_talker->checkToken(m_token);
+    }
+
+    m_widget->m_imglst->loadImagesFromCurrentSelection();
+    show();
+}
+
+void FlickrWindow::readSettings(QString uname)
+{
+    KConfig config(QString::fromLatin1("kipirc"));
+    qCDebug(KIPIPLUGINS_LOG) << "Group name is : "<<QString::fromLatin1("%1%2Export Settings").arg(m_serviceName,uname);
+    KConfigGroup grp = config.group(QString::fromLatin1("%1%2Export Settings").arg(m_serviceName,uname));
+    m_token          = grp.readEntry("token");
+    qCDebug(KIPIPLUGINS_LOG) << "Token is : "<<m_token;
+    m_exportHostTagsCheckBox->setChecked(grp.readEntry("Export Host Tags",      false));
+    m_extendedTagsButton->setChecked(grp.readEntry("Show Extended Tag Options", false));
+    m_addExtraTagsCheckBox->setChecked(grp.readEntry("Add Extra Tags",          false));
+    m_stripSpaceTagsCheckBox->setChecked(grp.readEntry("Strip Space From Tags", false));
+    m_stripSpaceTagsCheckBox->setEnabled(m_exportHostTagsCheckBox->isChecked());
+
+    if (!iface()->hasFeature(KIPI::HostSupportsTags))
+    {
+        m_exportHostTagsCheckBox->setEnabled(false);
+        m_stripSpaceTagsCheckBox->setEnabled(false);
+    }
+
+    m_publicCheckBox->setChecked(grp.readEntry("Public Sharing",                               false));
+    m_familyCheckBox->setChecked(grp.readEntry("Family Sharing",                               false));
+    m_friendsCheckBox->setChecked(grp.readEntry("Friends Sharing",                             false));
+    m_extendedPublicationButton->setChecked(grp.readEntry("Show Extended Publication Options", false));
+
+    int safetyLevel = m_safetyLevelComboBox->findData(QVariant(grp.readEntry("Safety Level", 0)));
+
+    if (safetyLevel == -1)
+    {
+        safetyLevel = 0;
+    }
+
+    m_safetyLevelComboBox->setCurrentIndex(safetyLevel);
+
+    int contentType = m_contentTypeComboBox->findData(QVariant(grp.readEntry("Content Type", 0)));
+
+    if (contentType == -1)
+    {
+        contentType = 0;
+    }
+
+    m_contentTypeComboBox->setCurrentIndex(contentType);
+
+    if (grp.readEntry("Resize", false))
+    {
+        m_resizeCheckBox->setChecked(true);
+        m_dimensionSpinBox->setEnabled(true);
+        m_imageQualitySpinBox->setEnabled(true);
+    }
+    else
+    {
+        m_resizeCheckBox->setChecked(false);
+        m_dimensionSpinBox->setEnabled(false);
+        m_imageQualitySpinBox->setEnabled(false);
+    }
+
+    //m_sendOriginalCheckBox->setChecked(grp.readEntry("Send original", false));
+
+    m_dimensionSpinBox->setValue(grp.readEntry("Maximum Width",       1600));
+    m_imageQualitySpinBox->setValue(grp.readEntry("Image Quality",    85));
+
+    winId();
+    KConfigGroup dialogGroup = config.group(QString::fromLatin1("%1Export Dialog").arg(m_serviceName));
+    KWindowConfig::restoreWindowSize(windowHandle(), dialogGroup);
+    resize(windowHandle()->size());
+}
+
+void FlickrWindow::writeSettings()
+{
+    KConfig config(QString::fromLatin1("kipirc"));
+    qCDebug(KIPIPLUGINS_LOG) << "Group name is : "<<QString::fromLatin1("%1%2Export Settings").arg(m_serviceName,m_username);
+
+    if (QString::compare(QString::fromLatin1("%1Export Settings").arg(m_serviceName),
+        QString::fromLatin1("%1%2Export Settings").arg(m_serviceName,m_username), Qt::CaseInsensitive) == 0)
+    {
+        qCDebug(KIPIPLUGINS_LOG) << "Not writing entry of group " << QString::fromLatin1("%1%2Export Settings").arg(m_serviceName,m_username);
+        return;
+    }
+
+    KConfigGroup grp = config.group(QString::fromLatin1("%1%2Export Settings").arg(m_serviceName,m_username));
+    grp.writeEntry("username",m_username);
+    qCDebug(KIPIPLUGINS_LOG) << "Token written of group "<<QString::fromLatin1("%1%2Export Settings").arg(m_serviceName,m_username)<<" is "<<m_token;
+    grp.writeEntry("token", m_token);
+    grp.writeEntry("Export Host Tags",                  m_exportHostTagsCheckBox->isChecked());
+    grp.writeEntry("Show Extended Tag Options",         m_extendedTagsButton->isChecked());
+    grp.writeEntry("Add Extra Tags",                    m_addExtraTagsCheckBox->isChecked());
+    grp.writeEntry("Strip Space From Tags",             m_stripSpaceTagsCheckBox->isChecked());
+    grp.writeEntry("Public Sharing",                    m_publicCheckBox->isChecked());
+    grp.writeEntry("Family Sharing",                    m_familyCheckBox->isChecked());
+    grp.writeEntry("Friends Sharing",                   m_friendsCheckBox->isChecked());
+    grp.writeEntry("Show Extended Publication Options", m_extendedPublicationButton->isChecked());
+    int safetyLevel = m_safetyLevelComboBox->itemData(m_safetyLevelComboBox->currentIndex()).toInt();
+    grp.writeEntry("Safety Level",                      safetyLevel);
+    int contentType = m_contentTypeComboBox->itemData(m_contentTypeComboBox->currentIndex()).toInt();
+    grp.writeEntry("Content Type",                      contentType);
+    grp.writeEntry("Resize",                            m_resizeCheckBox->isChecked());
+    //grp.writeEntry("Send original",                     m_sendOriginalCheckBox->isChecked());
+    grp.writeEntry("Maximum Width",                     m_dimensionSpinBox->value());
+    grp.writeEntry("Image Quality",                     m_imageQualitySpinBox->value());
+    KConfigGroup dialogGroup = config.group(QString::fromLatin1("%1Export Dialog").arg(m_serviceName));
+    KWindowConfig::saveWindowSize(windowHandle(), dialogGroup);
+    config.sync();
+}
+
+void FlickrWindow::slotDoLogin()
+{
+}
+
+void FlickrWindow::slotTokenObtained(const QString& token)
+{
+    qCDebug(KIPIPLUGINS_LOG) << "Token Obtained is : "<<token;
+    m_username = m_talker->getUserName();
+    m_userId   = m_talker->getUserId();
+    qCDebug(KIPIPLUGINS_LOG) << "SlotTokenObtained invoked setting user Display name to " << m_username;
+    m_userNameDisplayLabel->setText(QString::fromLatin1("<b>%1</b>").arg(m_username));
+
+    KConfig config(QString::fromLatin1("kipirc"));
+
+    foreach ( const QString& group, config.groupList() )
+    {
+        if(!(group.contains(m_serviceName)))
+            continue;
+
+        KConfigGroup grp = config.group(group);
+
+        if(group.contains(m_username))
+        {
+            readSettings(m_username);
+            break;
+        }
+    }
+
+    m_token    = token;
+    writeSettings();
+
+    // Mutable photosets are not supported by Zooomr (Zooomr only has smart
+    // folder-type photosets).
+    if (m_serviceName != QString::fromLatin1("Zooomr"))
+    {
+        m_talker->listPhotoSets();
+    }
+}
+
+void FlickrWindow::slotBusy(bool val)
+{
+    if (val)
+    {
+        setCursor(Qt::WaitCursor);
+        //      m_newAlbumBtn->setEnabled( false );
+        //      m_addPhotoButton->setEnabled( false );
+    }
+    else
+    {
+        setCursor(Qt::ArrowCursor);
+        //      m_newAlbumBtn->setEnabled( loggedIn );
+        //      m_addPhotoButton->setEnabled( loggedIn && m_albumView->selectedItem() );
+    }
+}
+
+void FlickrWindow::slotError(const QString& msg)
+{
+    //m_talker->slotError(msg);
+    QMessageBox::critical(this, i18n("Error"), msg);
+}
+
+void FlickrWindow::slotUserChangeRequest()
+{
+    writeSettings();
+    qCDebug(KIPIPLUGINS_LOG) << "Slot Change User Request ";
+    m_select->reactivate();
+    readSettings(m_select->getUname());
+    if (m_token.length() < 1)
+    {
+        m_talker->getFrob();
+    }
+    else
+    {
+        m_talker->checkToken(m_token);
+    }
+    //m_talker->getFrob();
+    //  m_addPhotoButton->setEnabled(m_selectImagesButton->isChecked());
+}
+
+void FlickrWindow::slotRemoveAccount()
+{
+    KConfig config(QString::fromLatin1("kipirc"));
+    KConfigGroup grp = config.group(QString::fromLatin1("%1%2Export Settings").arg(m_serviceName).arg(m_username));
+
+    if(grp.exists())
+    {
+        qCDebug(KIPIPLUGINS_LOG) << "Removing Account having group"<<QString::fromLatin1("%1%2Export Settings").arg(m_serviceName);
+        grp.deleteGroup();
+    }
+
+    m_username = QString();
+    qCDebug(KIPIPLUGINS_LOG) << "SlotTokenObtained invoked setting user Display name to " << m_username;
+    m_userNameDisplayLabel->setText(QString::fromLatin1("<b>%1</b>").arg(m_username));
+}
+
+/**
+ * Try to guess a sensible set name from the urls given.
+ * Currently, it extracs the last path name component, and returns the most
+ * frequently seen. The function could be expanded to, for example, only
+ * accept the path if it occurs at least 50% of the time. It could also look
+ * further up in the path name.
+ */
+QString FlickrWindow::guessSensibleSetName(const QList<QUrl>& urlList)
+{
+    QMap<QString,int> nrFolderOccurences;
+
+    // Extract last component of directory
+    foreach(const QUrl& url, urlList)
+    {
+        QString dir      = url.adjusted(QUrl::RemoveFilename|QUrl::StripTrailingSlash).toLocalFile();
+        QStringList list = dir.split(QLatin1Char('/'));
+
+        if (list.isEmpty())
+            continue;
+
+        nrFolderOccurences[list.last()]++;
+    }
+
+    int maxCount   = 0;
+    int totalCount = 0;
+    QString name;
+
+    for(QMap<QString,int>::const_iterator it=nrFolderOccurences.constBegin();
+        it!=nrFolderOccurences.constEnd(); ++it)
+    {
+        totalCount += it.value();
+
+        if (it.value() > maxCount)
+        {
+            maxCount = it.value();
+            name     = it.key();
+        }
+    }
+
+    // If there is only one entry or one name appears at least twice, return the suggestion
+    if (totalCount == 1 || maxCount > 1)
+        return name;
+
+    return QString();
+}
+
+/** This method is called when the photo set creation button is pressed. It
+ * summons a creation dialog for user input. When that is closed, it
+ * creates a new photo set in the local list. The id gets the form of
+ * UNDEFINED_ followed by a number, to indicate that it doesn't exist on
+ * Flickr yet.
+ */
+void FlickrWindow::slotCreateNewPhotoSet()
+{
+    if (m_albumDlg->exec() == QDialog::Accepted)
+    {
+        FPhotoSet fps;
+        m_albumDlg->getFolderProperties(fps);
+        qCDebug(KIPIPLUGINS_LOG) << "in slotCreateNewPhotoSet() " << fps.title;
+
+        // Lets find an UNDEFINED_ style id that isn't taken yet.s
+        QString id;
+        int i                               = 0;
+        id                                  = QString::fromLatin1("UNDEFINED_") + QString::number(i);
+        QLinkedList<FPhotoSet>::iterator it = m_talker->m_photoSetsList->begin();
+
+        while (it != m_talker->m_photoSetsList->end())
+        {
+            FPhotoSet fps = *it;
+
+            if (fps.id == id)
+            {
+                id = QString::fromLatin1("UNDEFINED_") + QString::number(++i);
+                it = m_talker->m_photoSetsList->begin();
+            }
+
+            ++it;
+        }
+
+        fps.id = id;
+
+        qCDebug(KIPIPLUGINS_LOG) << "Created new photoset with temporary id " << id;
+        // Append the new photoset to the list.
+        m_talker->m_photoSetsList->prepend(fps);
+        m_talker->m_selectedPhotoSet = fps;
+
+        // Re-populate the photo sets combo box.
+        slotPopulatePhotoSetComboBox();
+    }
+    else
+    {
+        qCDebug(KIPIPLUGINS_LOG) << "New Photoset creation aborted ";
+    }
+}
+
+void FlickrWindow::slotAuthCancel()
+{
+    m_talker->cancel();
+    m_authProgressDlg->hide();
+}
+
+/*
+void FlickrWindow::slotPhotos( const QValueList<GPhoto>& photoList)
+{
+    // TODO
+}
+
+void FlickrWindow::slotTagSelected()
+{
+    // TODO
+}
+void FlickrWindow::slotOpenPhoto( const QUrl &url )
+{
+    new KRun(url);
+}
+*/
+
+void FlickrWindow::slotPopulatePhotoSetComboBox()
+{
+    qCDebug(KIPIPLUGINS_LOG) << "slotPopulatePhotoSetComboBox invoked";
+
+    if (m_talker && m_talker->m_photoSetsList)
+    {
+        QLinkedList <FPhotoSet>* const list = m_talker->m_photoSetsList;
+        m_albumsListComboBox->clear();
+        m_albumsListComboBox->insertItem(0, i18n("<Photostream Only>"));
+        m_albumsListComboBox->insertSeparator(1);
+        QLinkedList<FPhotoSet>::iterator it = list->begin();
+        int index = 2, curr_index = 0;
+
+        while (it != list->end())
+        {
+            FPhotoSet photoSet = *it;
+            QString name       = photoSet.title;
+            // Store the id as user data, because the title is not unique.
+            QVariant id        = QVariant(photoSet.id);
+
+            if (id == m_talker->m_selectedPhotoSet.id)
+            {
+                curr_index = index;
+            }
+
+            m_albumsListComboBox->insertItem(index++, name, id);
+            ++it;
+        }
+
+        m_albumsListComboBox->setCurrentIndex(curr_index);
+    }
+}
+
+/** This slot is call when 'Start Uploading' button is pressed.
+*/
+void FlickrWindow::slotUser1()
+{
+    qCDebug(KIPIPLUGINS_LOG) << "SlotUploadImages invoked";
+
+    //m_widget->m_tab->setCurrentIndex(FlickrWidget::FILELIST);
+
+    if (m_imglst->imageUrls().isEmpty())
+    {
+        return;
+    }
+
+    typedef QPair<QUrl, FPhotoInfo> Pair;
+
+    m_uploadQueue.clear();
+
+    for (int i = 0; i < m_imglst->listView()->topLevelItemCount(); ++i)
+    {
+        FlickrListViewItem* const lvItem = dynamic_cast<FlickrListViewItem*>(m_imglst->listView()->topLevelItem(i));
+
+        if (lvItem)
+        {
+            KPImageInfo info(lvItem->url());
+            qCDebug(KIPIPLUGINS_LOG) << "Adding images"<<lvItem->url()<<" to the list";
+            FPhotoInfo temp;
+
+            temp.title                 = info.title();
+            temp.description           = info.description();
+            temp.size                  = info.fileSize();
+            temp.is_public             = lvItem->isPublic()  ? 1 : 0;
+            temp.is_family             = lvItem->isFamily()  ? 1 : 0;
+            temp.is_friend             = lvItem->isFriends() ? 1 : 0;
+            temp.safety_level          = lvItem->safetyLevel();
+            temp.content_type          = lvItem->contentType();
+            QStringList tagsFromDialog = m_tagsLineEdit->text().split(QLatin1Char(','), QString::SkipEmptyParts);
+            QStringList tagsFromList   = lvItem->extraTags();
+
+            QStringList           allTags;
+            QStringList::Iterator itTags;
+
+            // Tags from the dialog
+            itTags = tagsFromDialog.begin();
+
+            while (itTags != tagsFromDialog.end())
+            {
+                allTags.append(*itTags);
+                ++itTags;
+            }
+
+            // Tags from the database
+            if (m_exportHostTagsCheckBox->isChecked())
+            {
+                QStringList tagsFromDatabase;
+
+                tagsFromDatabase = info.keywords();
+                itTags           = tagsFromDatabase.begin();
+
+                while (itTags != tagsFromDatabase.end())
+                {
+                    allTags.append(*itTags);
+                    ++itTags;
+                }
+            }
+
+            // Tags from the list view.
+            itTags = tagsFromList.begin();
+
+            while (itTags != tagsFromList.end())
+            {
+                allTags.append(*itTags);
+                ++itTags;
+            }
+
+            // Remove spaces if the user doesn't like them.
+            if (m_stripSpaceTagsCheckBox->isChecked())
+            {
+                for (QStringList::iterator it = allTags.begin();
+                    it != allTags.end();
+                    ++it)
+                {
+                    *it = (*it).trimmed().remove(QLatin1Char(' '));
+                }
+            }
+
+            // Debug the tag list.
+            itTags = allTags.begin();
+
+            while (itTags != allTags.end())
+            {
+                qCDebug(KIPIPLUGINS_LOG) << "Tags list: " << (*itTags);
+                ++itTags;
+            }
+
+            temp.tags = allTags;
+            m_uploadQueue.append(Pair(lvItem->url(), temp));
+        }
+    }
+
+    m_uploadTotal = m_uploadQueue.count();
+    m_uploadCount = 0;
+    m_widget->progressBar()->reset();
+    slotAddPhotoNext();
+    qCDebug(KIPIPLUGINS_LOG) << "SlotUploadImages done";
+}
+
+void FlickrWindow::slotAddPhotoNext()
+{
+    if (m_uploadQueue.isEmpty())
+    {
+        m_widget->progressBar()->reset();
+        setUiInProgressState(false);
+        //slotAlbumSelected();
+        return;
+    }
+
+    typedef QPair<QUrl, FPhotoInfo> Pair;
+    Pair pathComments = m_uploadQueue.first();
+    FPhotoInfo info   = pathComments.second;
+
+    // Find out the selected photo set.
+    if (m_serviceName != QString::fromLatin1("Zooomr"))
+    {
+        // mutable photosets are not supported by Zooomr (Zooomr only has smart folder-type photosets)
+        QString selectedPhotoSetId = m_albumsListComboBox->itemData(m_albumsListComboBox->currentIndex()).toString();
+
+        if (selectedPhotoSetId.isEmpty())
+        {
+            m_talker->m_selectedPhotoSet = FPhotoSet();
+        }
+        else
+        {
+            QLinkedList<FPhotoSet>::iterator it = m_talker->m_photoSetsList->begin();
+
+            while (it != m_talker->m_photoSetsList->end())
+            {
+                if (it->id == selectedPhotoSetId)
+                {
+                    m_talker->m_selectedPhotoSet = *it;
+                    break;
+                }
+
+                ++it;
+            }
+        }
+    }
+
+    qCDebug(KIPIPLUGINS_LOG) << "Max allowed file size is : "<<((m_talker->getMaxAllowedFileSize()).toLongLong())<<"File Size is "<<info.size;
+
+    bool res = m_talker->addPhoto(pathComments.first.toLocalFile(), //the file path
+                                  info,
+                                  m_resizeCheckBox->isChecked(),
+                                  m_dimensionSpinBox->value(),
+                                  m_imageQualitySpinBox->value());
+
+    if (!res)
+    {
+        slotAddPhotoFailed(QString::fromLatin1(""));
+        return;
+    }
+
+    if (m_widget->progressBar()->isHidden())
+    {
+        setUiInProgressState(true);
+        m_widget->progressBar()->progressScheduled(i18n("Flickr Export"), true, true);
+        m_widget->progressBar()->progressThumbnailChanged(QIcon(QLatin1String(":/icons/kipi-icon.svg")).pixmap(22, 22));
+    }
+}
+
+void FlickrWindow::slotAddPhotoSucceeded()
+{
+    // Remove photo uploaded from the list
+    m_imglst->removeItemByUrl(m_uploadQueue.first().first);
+    m_uploadQueue.pop_front();
+    m_uploadCount++;
+    m_widget->progressBar()->setMaximum(m_uploadTotal);
+    m_widget->progressBar()->setValue(m_uploadCount);
+    slotAddPhotoNext();
+}
+
+void FlickrWindow::slotListPhotoSetsFailed(const QString& msg)
+{
+    QMessageBox::critical(this, QString::fromLatin1("Error"), i18n("Failed to Fetch Photoset information from %1. %2\n", m_serviceName, msg));
+}
+
+void FlickrWindow::slotAddPhotoFailed(const QString& msg)
+{
+    QMessageBox warn(QMessageBox::Warning,
+                     i18n("Warning"),
+                     i18n("Failed to upload photo into %1. %2\nDo you want to continue?", m_serviceName, msg),
+                     QMessageBox::Yes | QMessageBox::No);
+
+    (warn.button(QMessageBox::Yes))->setText(i18n("Continue"));
+    (warn.button(QMessageBox::No))->setText(i18n("Cancel"));
+
+    if (warn.exec() != QMessageBox::Yes)
+    {
+        m_uploadQueue.clear();
+        m_widget->progressBar()->reset();
+        setUiInProgressState(false);
+        // refresh the thumbnails
+        //slotTagSelected();
+    }
+    else
+    {
+        m_uploadQueue.pop_front();
+        m_uploadTotal--;
+        m_widget->progressBar()->setMaximum(m_uploadTotal);
+        m_widget->progressBar()->setValue(m_uploadCount);
+        slotAddPhotoNext();
+    }
+}
+
+void FlickrWindow::slotAddPhotoSetSucceeded()
+{
+    /* Method called when a photo set has been successfully created on Flickr.
+     * It functions to restart the normal flow after a photo set has been created
+     * on Flickr. */
+    slotPopulatePhotoSetComboBox();
+    slotAddPhotoSucceeded();
+}
+
+void FlickrWindow::slotImageListChanged()
+{
+    startButton()->setEnabled(!(m_widget->m_imglst->imageUrls().isEmpty()));
+}
+
+void FlickrWindow::slotReloadPhotoSetRequest()
+{
+    m_talker->listPhotoSets();
+}
+
+} // namespace KIPIFlickrPlugin
diff -durN orig/digikam-5.3.0/.pc/flickr.diff/extra/kipi-plugins/flickr/flickrwindow.h digikam-5.3.0/.pc/flickr.diff/extra/kipi-plugins/flickr/flickrwindow.h
--- orig/digikam-5.3.0/.pc/flickr.diff/extra/kipi-plugins/flickr/flickrwindow.h	1969-12-31 18:00:00.000000000 -0600
+++ digikam-5.3.0/.pc/flickr.diff/extra/kipi-plugins/flickr/flickrwindow.h	2017-09-07 11:43:00.443658943 -0500
@@ -0,0 +1,191 @@
+/* ============================================================
+ *
+ * This file is a part of kipi-plugins project
+ * http://www.digikam.org
+ *
+ * Date        : 2005-17-06
+ * Description : a kipi plugin to export images to Flickr web service
+ *
+ * Copyright (C) 2005-2008 by Vardhman Jain <vardhman at gmail dot com>
+ * Copyright (C) 2008-2016 by Gilles Caulier <caulier dot gilles at gmail dot com>
+ *
+ * This program is free software; you can redistribute it
+ * and/or modify it under the terms of the GNU General
+ * Public License as published by the Free Software Foundation;
+ * either version 2, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * ============================================================ */
+
+#ifndef FLICKRWINDOW_H
+#define FLICKRWINDOW_H
+
+// Qt includes
+
+#include <QHash>
+#include <QList>
+#include <QPair>
+#include <QLabel>
+#include <QLinkedList>
+#include <QLineEdit>
+#include <QUrl>
+#include <QComboBox>
+
+// Libkipi includes
+
+#include <KIPI/Interface>
+
+// Local includes
+
+#include "kptooldialog.h"
+#include "comboboxintermediate.h"
+
+class QProgressDialog;
+class QPushButton;
+class QSpinBox;
+class QCheckBox;
+class QUrl;
+
+namespace KIPI
+{
+    class Interface;
+}
+
+namespace KIPIPlugins
+{
+    class KPAboutData;
+}
+
+using namespace KIPI;
+using namespace KIPIPlugins;
+
+namespace KIPIFlickrPlugin
+{
+class SelectUserDlg;
+class FlickrWidget;
+class FlickrTalker;
+class FlickrList;
+class FPhotoInfo;
+class GPhoto;
+class GAlbum;
+class NewAlbum;
+//class GAlbumViewItem;
+
+using namespace KIPI;
+using namespace KIPIPlugins;
+
+class FlickrWindow : public KPToolDialog
+{
+    Q_OBJECT
+
+public:
+
+    FlickrWindow(QWidget* const parent, const QString& serviceName, SelectUserDlg* const dlg);
+    ~FlickrWindow();
+
+    /**
+     * Use this method to (re-)activate the dialog after it has been created
+     * to display it. This also loads the currently selected images.
+     */
+    void reactivate();
+
+private Q_SLOTS:
+
+    void slotTokenObtained(const QString& token);
+    void slotDoLogin();
+    void slotBusy(bool val);
+    void slotError(const QString& msg);
+
+    //  void slotLoginFailed( const QString& msg );
+    //  void slotAlbums( const QValueList<GAlbum>& albumList );
+    //  void slotPhotos( const QValueList<GPhoto>& photoList );
+    //  void slotTagSelected();
+    //  void slotOpenPhoto( const KUrl &url );
+
+    void slotFinished();
+    void slotUser1();
+    void slotCancelClicked();
+
+    void slotCreateNewPhotoSet();
+    void slotUserChangeRequest();
+    void slotRemoveAccount();
+    void slotPopulatePhotoSetComboBox();
+    void slotAddPhotoNext();
+    void slotAddPhotoSucceeded();
+    void slotAddPhotoFailed(const QString& msg);
+    void slotAddPhotoSetSucceeded();
+    void slotListPhotoSetsFailed(const QString& msg);
+    void slotAddPhotoCancelAndClose();
+    void slotAuthCancel();
+    void slotImageListChanged();
+    void slotReloadPhotoSetRequest();
+
+private:
+
+    QString guessSensibleSetName(const QList<QUrl>& urlList);
+
+    void closeEvent(QCloseEvent*);
+    void readSettings(QString uname);
+    void writeSettings();
+
+    void setUiInProgressState(bool inProgress);
+
+private:
+
+    unsigned int                           m_uploadCount;
+    unsigned int                           m_uploadTotal;
+
+    QString                                m_serviceName;
+
+    QPushButton*                           m_newAlbumBtn;
+    QPushButton*                           m_changeUserButton;
+    QPushButton*                           m_removeAccount;
+
+    QComboBox*                             m_albumsListComboBox;
+    QCheckBox*                             m_publicCheckBox;
+    QCheckBox*                             m_familyCheckBox;
+    QCheckBox*                             m_friendsCheckBox;
+    QCheckBox*                             m_exportHostTagsCheckBox;
+    QCheckBox*                             m_stripSpaceTagsCheckBox;
+    QCheckBox*                             m_addExtraTagsCheckBox;
+    QCheckBox*                             m_resizeCheckBox;
+//  QCheckBox*                             m_sendOriginalCheckBox;
+
+    QSpinBox*                              m_dimensionSpinBox;
+    QSpinBox*                              m_imageQualitySpinBox;
+
+    QPushButton*                           m_extendedPublicationButton;
+    QPushButton*                           m_extendedTagsButton;
+    ComboBoxIntermediate*                  m_contentTypeComboBox;
+    ComboBoxIntermediate*                  m_safetyLevelComboBox;
+
+//  QHash<int, GAlbumViewItem>             m_albumDict;
+
+    QString                                m_token;
+    QString                                m_username;
+    QString                                m_userId;
+    QString                                m_lastSelectedAlbum;
+
+    QLabel*                                m_userNameDisplayLabel;
+
+    QProgressDialog*                       m_authProgressDlg;
+
+    QList< QPair<QUrl, FPhotoInfo> >       m_uploadQueue;
+
+    QLineEdit*                             m_tagsLineEdit;
+
+    FlickrWidget*                          m_widget;
+    FlickrTalker*                          m_talker;
+
+    FlickrList*                            m_imglst;
+    SelectUserDlg*                         m_select;
+    NewAlbum*                              m_albumDlg;
+};
+
+} // namespace KIPIFlickrPlugin
+
+#endif /* FLICKRWINDOW_H */
diff -durN orig/digikam-5.3.0/.pc/flickr.diff/extra/kipi-plugins/flickr/plugin_flickr.cpp digikam-5.3.0/.pc/flickr.diff/extra/kipi-plugins/flickr/plugin_flickr.cpp
--- orig/digikam-5.3.0/.pc/flickr.diff/extra/kipi-plugins/flickr/plugin_flickr.cpp	1969-12-31 18:00:00.000000000 -0600
+++ digikam-5.3.0/.pc/flickr.diff/extra/kipi-plugins/flickr/plugin_flickr.cpp	2017-09-07 11:43:00.443658943 -0500
@@ -0,0 +1,210 @@
+/* ============================================================
+ *
+ * This file is a part of kipi-plugins project
+ * http://www.digikam.org
+ *
+ * Date        : 2005-17-06
+ * Description : a kipi plugin to export images to Flickr web service
+ *
+ * Copyright (C) 2005-2008 by Vardhman Jain <vardhman at gmail dot com>
+ * Copyright (C) 2008-2016 by Gilles Caulier <caulier dot gilles at gmail dot com>
+ * Copyright (C) 2009      by Luka Renko <lure at kubuntu dot org>
+ *
+ * This program is free software; you can redistribute it
+ * and/or modify it under the terms of the GNU General
+ * Public License as published by the Free Software Foundation;
+ * either version 2, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * ============================================================ */
+
+#include "plugin_flickr.h"
+
+//Qt includes
+
+#include <QApplication>
+
+// KDE includes
+
+#include <kactioncollection.h>
+#include <kpluginfactory.h>
+#include <kwindowsystem.h>
+
+// LibKIPI includes
+
+#include <KIPI/Interface>
+
+// Local includes
+
+#include "flickrwindow.h"
+#include "selectuserdlg.h"
+#include "kipiplugins_debug.h"
+
+namespace KIPIFlickrPlugin
+{
+
+K_PLUGIN_FACTORY(FlickrExportFactory, registerPlugin<Plugin_Flickr>();)
+
+Plugin_Flickr::Plugin_Flickr(QObject* const parent, const QVariantList& /*args*/)
+    : Plugin(parent, "Flickr")
+{
+    qCDebug(KIPIPLUGINS_LOG) << "Plugin_Flickr plugin loaded";
+
+    setUiBaseName("kipiplugin_flickrui.rc");
+    setupXML();
+
+    m_actionFlickr = 0;
+    m_action23     = 0;
+    m_actionZooomr = 0;
+
+    m_dlgFlickr    = 0;
+    m_dlg23        = 0;
+    m_dlgZooomr    = 0;
+
+    selectFlickr   = 0;
+    select23       = 0;
+    selectZoomr    = 0;
+}
+
+Plugin_Flickr::~Plugin_Flickr()
+{
+    delete m_dlgFlickr;
+    delete m_dlg23;
+    delete m_dlgZooomr;
+
+    delete selectFlickr;
+    delete select23;
+    delete selectZoomr;
+}
+
+void Plugin_Flickr::setup(QWidget* const widget)
+{
+    m_dlgFlickr = 0;
+    m_dlg23     = 0;
+    m_dlgZooomr = 0;
+
+    Plugin::setup(widget);
+
+    if (!interface())
+    {
+        qCCritical(KIPIPLUGINS_LOG) << "Kipi interface is null!";
+        return;
+    }
+
+    setupActions();
+}
+
+void Plugin_Flickr::setupActions()
+{
+    setDefaultCategory(ExportPlugin);
+
+    m_actionFlickr = new QAction(this);
+    m_actionFlickr->setText(i18n("Export to Flick&r..."));
+    m_actionFlickr->setIcon(QIcon::fromTheme(QString::fromLatin1("kipi-flickr")));
+    actionCollection()->setDefaultShortcut(m_actionFlickr, Qt::ALT + Qt::SHIFT + Qt::Key_R);
+
+    selectFlickr = new SelectUserDlg(0,QString::fromLatin1("Flickr"));
+
+    connect(m_actionFlickr, SIGNAL(triggered(bool)),
+            this, SLOT(slotActivateFlickr()));
+
+    addAction(QString::fromLatin1("flickrexport"), m_actionFlickr);
+
+    m_action23 = new QAction(this);
+    m_action23->setText(i18n("Export to &23..."));
+    m_action23->setIcon(QIcon::fromTheme(QString::fromLatin1("kipi-hq")));
+    actionCollection()->setDefaultShortcut(m_action23, Qt::ALT + Qt::SHIFT + Qt::Key_2);
+
+    select23 = new SelectUserDlg(0,QString::fromLatin1("23"));
+
+    connect(m_action23, SIGNAL(triggered(bool)),
+            this, SLOT(slotActivate23()));
+
+    addAction(QString::fromLatin1("23export"), m_action23);
+
+    m_actionZooomr = new QAction(this);
+    m_actionZooomr->setText(i18n("Export to &Zooomr..."));
+    m_actionZooomr->setIcon(QIcon::fromTheme(QString::fromLatin1("kipi-zooomr")));
+    actionCollection()->setDefaultShortcut(m_actionZooomr, Qt::ALT + Qt::SHIFT + Qt::Key_Z);
+
+    selectZoomr = new SelectUserDlg(0,QString::fromLatin1("Zooomr"));
+
+    connect(m_actionZooomr, SIGNAL(triggered(bool)),
+            this, SLOT(slotActivateZooomr()));
+
+    addAction(QString::fromLatin1("Zooomrexport"), m_actionZooomr);
+}
+
+void Plugin_Flickr::slotActivateFlickr()
+{
+    selectFlickr->reactivate();
+
+    if (!m_dlgFlickr)
+    {
+        // We clean it up in the close button
+        m_dlgFlickr = new FlickrWindow(QApplication::activeWindow(), QString::fromLatin1("Flickr"), selectFlickr);
+    }
+    else
+    {
+        if (m_dlgFlickr->isMinimized())
+        {
+            KWindowSystem::unminimizeWindow(m_dlgFlickr->winId());
+        }
+
+        KWindowSystem::activateWindow(m_dlgFlickr->winId());
+    }
+
+    m_dlgFlickr->reactivate();
+}
+
+void Plugin_Flickr::slotActivate23()
+{
+    select23->reactivate();
+
+    if (!m_dlg23)
+    {
+        // We clean it up in the close button
+        m_dlg23 = new FlickrWindow(QApplication::activeWindow(), QString::fromLatin1("23"), select23);
+    }
+    else
+    {
+        if (m_dlg23->isMinimized())
+        {
+            KWindowSystem::unminimizeWindow(m_dlg23->winId());
+        }
+
+        KWindowSystem::activateWindow(m_dlg23->winId());
+    }
+
+    m_dlg23->reactivate();
+}
+
+void Plugin_Flickr::slotActivateZooomr()
+{
+    selectZoomr->reactivate();
+
+    if (!m_dlgZooomr)
+    {
+        // We clean it up in the close button
+        m_dlgZooomr = new FlickrWindow(QApplication::activeWindow(), QString::fromLatin1("Zooomr"), selectZoomr);
+    }
+    else
+    {
+        if (m_dlgZooomr->isMinimized())
+        {
+            KWindowSystem::unminimizeWindow(m_dlgZooomr->winId());
+        }
+
+        KWindowSystem::activateWindow(m_dlgZooomr->winId());
+    }
+
+    m_dlgZooomr->reactivate();
+}
+
+} // namespace KIPIFlickrPlugin
+
+#include "plugin_flickr.moc"
diff -durN orig/digikam-5.3.0/.pc/flickr.diff/extra/kipi-plugins/flickr/plugin_flickr.h digikam-5.3.0/.pc/flickr.diff/extra/kipi-plugins/flickr/plugin_flickr.h
--- orig/digikam-5.3.0/.pc/flickr.diff/extra/kipi-plugins/flickr/plugin_flickr.h	1969-12-31 18:00:00.000000000 -0600
+++ digikam-5.3.0/.pc/flickr.diff/extra/kipi-plugins/flickr/plugin_flickr.h	2017-09-07 11:43:00.443658943 -0500
@@ -0,0 +1,82 @@
+/* ============================================================
+ *
+ * This file is a part of kipi-plugins project
+ * http://www.digikam.org
+ *
+ * Date        : 2005-17-06
+ * Description : a kipi plugin to export images to Flickr web service
+ *
+ * Copyright (C) 2005-2008 by Vardhman Jain <vardhman at gmail dot com>
+ * Copyright (C) 2008-2016 by Gilles Caulier <caulier dot gilles at gmail dot com>
+ *
+ * This program is free software; you can redistribute it
+ * and/or modify it under the terms of the GNU General
+ * Public License as published by the Free Software Foundation;
+ * either version 2, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * ============================================================ */
+
+#ifndef PLUGIN_FLICKR_H
+#define PLUGIN_FLICKR_H
+
+// Qt includes
+
+#include <QVariant>
+#include <QAction>
+
+// LibKIPI includes
+
+#include <KIPI/Plugin>
+
+using namespace KIPI;
+
+namespace KIPIFlickrPlugin
+{
+
+class FlickrWindow;
+class SelectUserDlg;
+
+class Plugin_Flickr : public Plugin
+{
+    Q_OBJECT
+
+public:
+
+    Plugin_Flickr(QObject* const parent, const QVariantList& args);
+    ~Plugin_Flickr();
+
+    void setup(QWidget* const);
+
+public Q_SLOTS:
+
+    void slotActivateFlickr();
+    void slotActivate23();
+    void slotActivateZooomr();
+
+private:
+
+    void setupActions();
+
+private:
+
+    QAction*       m_actionFlickr;
+    QAction*       m_action23;
+    QAction*       m_actionZooomr;
+
+    FlickrWindow*  m_dlgFlickr;
+    FlickrWindow*  m_dlg23;
+    FlickrWindow*  m_dlgZooomr;
+
+    SelectUserDlg* selectFlickr;
+    SelectUserDlg* select23;
+    SelectUserDlg* selectZoomr;
+};
+
+} //namespace KIPIFlickrPlugin
+
+#endif // PLUGIN_FLICKR_H


More information about the pkg-kde-extras mailing list