From d5fd357af9f14fb61011d5dbebd9a9fb7f11824a Mon Sep 17 00:00:00 2001 From: Andrea Diamantini Date: Tue, 29 May 2012 00:13:34 +0200 Subject: Let Opera sync handler being optional --- CMakeLists.txt | 95 +++++++++++++++++++++++++--------- FindQtOAuth.cmake | 38 -------------- cmake/FindQtOAuth.cmake | 38 ++++++++++++++ config-qca2.h.cmake | 1 + config-qtoauth.h.cmake | 1 + config-version.h.cmake | 2 + src/CMakeLists.txt | 38 ++++++++++++-- src/bookmarks/bookmarkowner.cpp | 2 +- src/bookmarks/bookmarkowner.h | 2 +- src/bookmarks/bookmarkscontextmenu.cpp | 2 +- src/main.cpp | 2 +- src/sync/operasynchandler.cpp | 62 +++++++++++----------- src/sync/synccheckwidget.cpp | 22 +++++--- src/sync/syncdatawidget.cpp | 8 +-- src/sync/synchosttypewidget.cpp | 14 ++--- src/sync/syncmanager.cpp | 9 ++++ src/sync/syncoperasettingswidget.cpp | 27 +++++++++- src/sync/syncoperasettingswidget.h | 4 +- src/urlbar/bookmarkwidget.cpp | 2 +- src/urlbar/bookmarkwidget.h | 2 +- src/urlbar/newresourcedialog.h | 24 ++++----- src/urlbar/resourcelinkdialog.h | 48 ++++++++--------- version.h.cmake | 2 - 23 files changed, 283 insertions(+), 162 deletions(-) delete mode 100644 FindQtOAuth.cmake create mode 100644 cmake/FindQtOAuth.cmake create mode 100644 config-qca2.h.cmake create mode 100644 config-qtoauth.h.cmake create mode 100644 config-version.h.cmake delete mode 100644 version.h.cmake diff --git a/CMakeLists.txt b/CMakeLists.txt index 5d24751b..ba9c3c8c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -9,7 +9,7 @@ PROJECT( rekonq ) # rekonq info SET(REKONQ_VERSION "0.9.60" ) -configure_file(${CMAKE_CURRENT_SOURCE_DIR}/version.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/version.h ) +configure_file(${CMAKE_CURRENT_SOURCE_DIR}/config-version.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/src/config-version.h ) SET(REKONQ_SITE "http://rekonq.kde.org") @@ -18,9 +18,11 @@ SET(REKONQ_SITE "http://rekonq.kde.org") CMAKE_MINIMUM_REQUIRED(VERSION 2.6.4) + +SET(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake ${CMAKE_MODULE_PATH}) + # ================================================================================== -set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_MODULE_PATH}) FIND_PACKAGE(Qt4 4.8.0 COMPONENTS QtCore QtGui QtNetwork QtWebKit REQUIRED) @@ -40,19 +42,33 @@ INCLUDE(MacroOptionalFindPackage) INCLUDE(FindPackageHandleStandardArgs) INCLUDE(KDE4Defaults) INCLUDE(MacroLibrary) + ADD_DEFINITIONS(-DQT_USE_FAST_CONCATENATION -DQT_USE_FAST_OPERATOR_PLUS) + # ================================================================================== # optional nepomuk requirements MACRO_OPTIONAL_FIND_PACKAGE(Nepomuk) MACRO_BOOL_TO_01(Nepomuk_FOUND HAVE_NEPOMUK) -configure_file(${CMAKE_CURRENT_SOURCE_DIR}/config-nepomuk.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config-nepomuk.h ) +configure_file(${CMAKE_CURRENT_SOURCE_DIR}/config-nepomuk.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/src/config-nepomuk.h ) + + +# ================================================================================== +# optional QCA2 & QtOAuth requirements + +MACRO_OPTIONAL_FIND_PACKAGE(QCA2) +MACRO_BOOL_TO_01(QCA2_FOUND HAVE_QCA2) + +configure_file(${CMAKE_CURRENT_SOURCE_DIR}/config-qca2.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/src/config-qca2.h ) + + +MACRO_OPTIONAL_FIND_PACKAGE(QtOAuth) +MACRO_BOOL_TO_01(QTOAUTH_FOUND HAVE_QTOAUTH) -FIND_PACKAGE(QCA2 REQUIRED) +configure_file(${CMAKE_CURRENT_SOURCE_DIR}/config-qtoauth.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/src/config-qtoauth.h ) -FIND_PACKAGE(QtOAuth REQUIRED) # ================================================================================== # Log messages @@ -98,23 +114,6 @@ ELSE(KDE4_FOUND) MESSAGE(STATUS "") ENDIF(KDE4_FOUND) - -# ----------------------- Optional Deps -------------------------------------- -MESSAGE(STATUS "") -MESSAGE(STATUS "") -MESSAGE(STATUS " rekonq ${REKONQ_VERSION} OPTIONAL dependencies") -MESSAGE(STATUS "") - -# Nepomuk - -IF(HAVE_NEPOMUK) - MESSAGE(STATUS " Nepomuk Libraries..................... YES") - MESSAGE(STATUS " Rekonq will be compiled with support for bookmarks nepomuk tagging") -ELSE(HAVE_NEPOMUK) - MESSAGE(STATUS " Nepomuk Libraries..................... NO") - MESSAGE(STATUS " Rekonq will be compiled WITHOUT support for bookmarks tagging") -ENDIF(HAVE_NEPOMUK) - ##### FINAL RESULTS ##### # create suspance.. @@ -129,9 +128,55 @@ ELSE(QT4_FOUND AND KDE4_FOUND) SET(REKONQ_CAN_BE_COMPILED false) ENDIF(QT4_FOUND AND KDE4_FOUND) -MESSAGE(STATUS "") -MESSAGE(STATUS "-----------------------------------------------------------------------") -MESSAGE(STATUS "") +# ----------------------- Optional Deps -------------------------------------- + +IF(REKONQ_CAN_BE_COMPILED) + MESSAGE(STATUS "") + MESSAGE(STATUS "") + MESSAGE(STATUS " ----- Optional Features") + MESSAGE(STATUS "") + + # Nepomuk + + IF(HAVE_NEPOMUK) + MESSAGE(STATUS " Nepomuk Libraries..................... YES") + MESSAGE(STATUS " Rekonq will be compiled with support for bookmarks nepomuk tagging") + ELSE(HAVE_NEPOMUK) + MESSAGE(STATUS " Nepomuk Libraries..................... NO") + MESSAGE(STATUS " Rekonq will be compiled WITHOUT support for bookmarks tagging") + ENDIF(HAVE_NEPOMUK) + + MESSAGE(STATUS "") + + # QCA2 + + IF(HAVE_QCA2) + MESSAGE(STATUS " QCA2 Libraries........................ YES") + ELSE(HAVE_QCA2) + MESSAGE(STATUS " QCA2 Libraries........................ NO") + ENDIF(HAVE_QCA2) + + # QTOAUTH + + IF(HAVE_QTOAUTH) + MESSAGE(STATUS " QtOAuth Libraries..................... YES") + ELSE(HAVE_QTOAUTH) + MESSAGE(STATUS " QtOAuth Libraries..................... NO") + ENDIF(HAVE_QTOAUTH) + + + IF(HAVE_QCA2 AND HAVE_QTOAUTH) + MESSAGE(STATUS " Rekonq will be compiled with support for opera sync handler") + ELSE(HAVE_QCA2 AND HAVE_QTOAUTH) + MESSAGE(STATUS " Rekonq will be compiled WITHOUT support for opera sync handler") + ENDIF(HAVE_QCA2 AND HAVE_QTOAUTH) + + + MESSAGE(STATUS "") + MESSAGE(STATUS "-----------------------------------------------------------------------") + MESSAGE(STATUS "") + +ENDIF(REKONQ_CAN_BE_COMPILED) # =============================================================================== diff --git a/FindQtOAuth.cmake b/FindQtOAuth.cmake deleted file mode 100644 index a9578ea2..00000000 --- a/FindQtOAuth.cmake +++ /dev/null @@ -1,38 +0,0 @@ -# - Try to find the QtOAuth library -# Once done this will define -# -# QTOAUTH_FOUND - system has the QtOAuth library -# QTOAUTH_INCLUDE_DIR - the QtOAuth include directory -# QTOAUTH_LIBRARY - Link this to use the QtOAuth -# QTOAUTH_DEFINITIONS - Compiler switches required for using QOAuth -# -# Copyright © 2010, Mehrdad Momeny -# Copyright © 2010, Harald Sitter -# -# Redistribution and use is allowed according to the terms of the BSD license. -# For details see the accompanying COPYING-CMAKE-SCRIPTS file. - -if (QTOAUTH_INCLUDE_DIR AND QTOAUTH_LIBRARY) - # in cache already - set(QTOAUTH_FOUND TRUE) -else (QTOAUTH_INCLUDE_DIR AND QTOAUTH_LIBRARY) - if (NOT WIN32) - find_package(PkgConfig) - pkg_check_modules(PC_QTOAUTH QUIET qoauth) - set(QTOAUTH_DEFINITIONS ${PC_QTOAUTH_CFLAGS_OTHER}) - endif(NOT WIN32) - - find_library(QTOAUTH_LIBRARY NAMES qoauth - HINTS ${PC_QTOAUTH_LIBDIR} ${PC_QTOAUTH_LIBRARY_DIRS} - ) - - find_path(QTOAUTH_INCLUDE_DIR QtOAuth/interface.h - HINTS ${PC_QTOAUTH_INCLUDEDIR} ${PC_QTOAUTH_INCLUDE_DIRS} - ) - - include(FindPackageHandleStandardArgs) - find_package_handle_standard_args(QtOAuth DEFAULT_MSG QTOAUTH_LIBRARY QTOAUTH_INCLUDE_DIR) - - mark_as_advanced(QTOAUTH_INCLUDE_DIR QTOAUTH_LIBRARY) -endif (QTOAUTH_INCLUDE_DIR AND QTOAUTH_LIBRARY) - diff --git a/cmake/FindQtOAuth.cmake b/cmake/FindQtOAuth.cmake new file mode 100644 index 00000000..a9578ea2 --- /dev/null +++ b/cmake/FindQtOAuth.cmake @@ -0,0 +1,38 @@ +# - Try to find the QtOAuth library +# Once done this will define +# +# QTOAUTH_FOUND - system has the QtOAuth library +# QTOAUTH_INCLUDE_DIR - the QtOAuth include directory +# QTOAUTH_LIBRARY - Link this to use the QtOAuth +# QTOAUTH_DEFINITIONS - Compiler switches required for using QOAuth +# +# Copyright © 2010, Mehrdad Momeny +# Copyright © 2010, Harald Sitter +# +# Redistribution and use is allowed according to the terms of the BSD license. +# For details see the accompanying COPYING-CMAKE-SCRIPTS file. + +if (QTOAUTH_INCLUDE_DIR AND QTOAUTH_LIBRARY) + # in cache already + set(QTOAUTH_FOUND TRUE) +else (QTOAUTH_INCLUDE_DIR AND QTOAUTH_LIBRARY) + if (NOT WIN32) + find_package(PkgConfig) + pkg_check_modules(PC_QTOAUTH QUIET qoauth) + set(QTOAUTH_DEFINITIONS ${PC_QTOAUTH_CFLAGS_OTHER}) + endif(NOT WIN32) + + find_library(QTOAUTH_LIBRARY NAMES qoauth + HINTS ${PC_QTOAUTH_LIBDIR} ${PC_QTOAUTH_LIBRARY_DIRS} + ) + + find_path(QTOAUTH_INCLUDE_DIR QtOAuth/interface.h + HINTS ${PC_QTOAUTH_INCLUDEDIR} ${PC_QTOAUTH_INCLUDE_DIRS} + ) + + include(FindPackageHandleStandardArgs) + find_package_handle_standard_args(QtOAuth DEFAULT_MSG QTOAUTH_LIBRARY QTOAUTH_INCLUDE_DIR) + + mark_as_advanced(QTOAUTH_INCLUDE_DIR QTOAUTH_LIBRARY) +endif (QTOAUTH_INCLUDE_DIR AND QTOAUTH_LIBRARY) + diff --git a/config-qca2.h.cmake b/config-qca2.h.cmake new file mode 100644 index 00000000..db503b24 --- /dev/null +++ b/config-qca2.h.cmake @@ -0,0 +1 @@ +#cmakedefine HAVE_QCA2 diff --git a/config-qtoauth.h.cmake b/config-qtoauth.h.cmake new file mode 100644 index 00000000..05a5b2b9 --- /dev/null +++ b/config-qtoauth.h.cmake @@ -0,0 +1 @@ +#cmakedefine HAVE_QTOAUTH diff --git a/config-version.h.cmake b/config-version.h.cmake new file mode 100644 index 00000000..cbc6492b --- /dev/null +++ b/config-version.h.cmake @@ -0,0 +1,2 @@ +#define REKONQ_VERSION "${REKONQ_VERSION}" + diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 763f02d7..c7945398 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -101,7 +101,6 @@ SET( rekonq_KDEINIT_SRCS #---------------------------------------- sync/ftpsynchandler.cpp sync/googlesynchandler.cpp - sync/operasynchandler.cpp sync/syncassistant.cpp sync/synchandler.cpp sync/syncmanager.cpp @@ -114,6 +113,7 @@ SET( rekonq_KDEINIT_SRCS sync/syncoperasettingswidget.cpp ) +# Nepomuk OPTIONAL src files IF(HAVE_NEPOMUK) SET( rekonq_KDEINIT_SRCS ${rekonq_KDEINIT_SRCS} @@ -122,6 +122,16 @@ IF(HAVE_NEPOMUK) ) ENDIF(HAVE_NEPOMUK) + +# Opera sync optional src files +IF(HAVE_QCA2 AND HAVE_QTOAUTH) + SET( rekonq_KDEINIT_SRCS + ${rekonq_KDEINIT_SRCS} + sync/operasynchandler.cpp + ) +ENDIF(HAVE_QCA2 AND HAVE_QTOAUTH) + + KDE4_ADD_UI_FILES( rekonq_KDEINIT_SRCS settings/settings_general.ui settings/settings_tabs.ui @@ -168,24 +178,33 @@ INCLUDE_DIRECTORIES ( ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR} ${KDE4_INCLUDES} ${QT4_INCLUDES} - ${QCA2_INCLUDE_DIR} - ${QTOAUTH_INCLUDE_DIR} ) +# Nepomuk optional include directories IF(HAVE_NEPOMUK) INCLUDE_DIRECTORIES(${SOPRANO_INCLUDE_DIR} ${NEPOMUK_INCLUDE_DIR} ) ENDIF(HAVE_NEPOMUK) +# Opera sync optional include directories +IF(HAVE_QCA2 AND HAVE_QTOAUTH) + INCLUDE_DIRECTORIES(${QCA2_INCLUDE_DIR} + ${QTOAUTH_INCLUDE_DIR} + ) +ENDIF(HAVE_QCA2 AND HAVE_QTOAUTH) + + ### -------------- ADDING DEFINITIONS... ADD_DEFINITIONS ( ${KDE4_DEFINITIONS} ) + ### -------------- ADDING APPLICATION ICON... KDE4_ADD_APP_ICON( rekonq_KDEINIT_SRCS ${CMAKE_CURRENT_SOURCE_DIR}/../icons/hi*-app-rekonq.png ) + ### --------------- ADDING EXECUTABLE... KDE4_ADD_KDEINIT_EXECUTABLE( rekonq ${rekonq_KDEINIT_SRCS} main.cpp ) @@ -202,10 +221,10 @@ TARGET_LINK_LIBRARIES ( kdeinit_rekonq ${KDE4_KDEUI_LIBS} ${KDE4_KIO_LIBS} ${KDE4_KPARTS_LIBS} - ${QCA2_LIBRARY} - ${QTOAUTH_LIBRARY} ) + +# Nepomuk optional target link libraries IF(HAVE_NEPOMUK) TARGET_LINK_LIBRARIES( kdeinit_rekonq ${NEPOMUK_LIBRARIES} @@ -214,6 +233,15 @@ IF(HAVE_NEPOMUK) ) ENDIF(HAVE_NEPOMUK) +# Opera sync optional link libraries +IF(HAVE_QCA2 AND HAVE_QTOAUTH) + TARGET_LINK_LIBRARIES( kdeinit_rekonq + ${QCA2_LIBRARY} + ${QTOAUTH_LIBRARY} + ) +ENDIF(HAVE_QCA2 AND HAVE_QTOAUTH) + + ### ------------ INSTALL FILES... INSTALL( TARGETS rekonq ${INSTALL_TARGETS_DEFAULT_ARGS} ) diff --git a/src/bookmarks/bookmarkowner.cpp b/src/bookmarks/bookmarkowner.cpp index 3aa3b8d3..430ec5c3 100644 --- a/src/bookmarks/bookmarkowner.cpp +++ b/src/bookmarks/bookmarkowner.cpp @@ -47,7 +47,7 @@ #include // Nepomuk config include -#include "../config-nepomuk.h" +#include "config-nepomuk.h" #ifdef HAVE_NEPOMUK // Local Nepomuk Includes diff --git a/src/bookmarks/bookmarkowner.h b/src/bookmarks/bookmarkowner.h index 01a5c480..f0b238b9 100644 --- a/src/bookmarks/bookmarkowner.h +++ b/src/bookmarks/bookmarkowner.h @@ -35,7 +35,7 @@ #include "rekonq_defines.h" // Nepomuk config include -#include "../config-nepomuk.h" +#include "config-nepomuk.h" // KDE Includes #include diff --git a/src/bookmarks/bookmarkscontextmenu.cpp b/src/bookmarks/bookmarkscontextmenu.cpp index cd2ab5c7..65f7994f 100644 --- a/src/bookmarks/bookmarkscontextmenu.cpp +++ b/src/bookmarks/bookmarkscontextmenu.cpp @@ -29,7 +29,7 @@ #include "bookmarkscontextmenu.h" // Nepomuk config include -#include "../config-nepomuk.h" +#include "config-nepomuk.h" // Local Includes #include "bookmarkowner.h" diff --git a/src/main.cpp b/src/main.cpp index b73dbc92..7a23172c 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -25,7 +25,7 @@ // version include -#include "../version.h" +#include "config-version.h" // Local Includes #include "application.h" diff --git a/src/sync/operasynchandler.cpp b/src/sync/operasynchandler.cpp index 25656b10..50d671f8 100644 --- a/src/sync/operasynchandler.cpp +++ b/src/sync/operasynchandler.cpp @@ -183,7 +183,7 @@ void OperaSyncHandler::startLogin() kDebug() << QUrl("https://auth.opera.com/service/oauth/authorize?oauth_token=" + QString(_requestToken) + "&oauth_callback=oob"); - _webPage.mainFrame()->load(QUrl("https://auth.opera.com/service/oauth/authorize?oauth_token=" + QString(_requestToken) + "&oauth_callback=oob" )); + _webPage.mainFrame()->load(QUrl("https://auth.opera.com/service/oauth/authorize?oauth_token=" + QString(_requestToken) + "&oauth_callback=oob")); } else { @@ -199,7 +199,7 @@ void OperaSyncHandler::loadFinished(bool ok) if (!ok) { kDebug() << "Error loading: " << _webPage.mainFrame()->url(); - emit syncStatus(Rekonq::Bookmarks, false, i18n( "Error loading: " + _webPage.mainFrame()->url().toEncoded())); + emit syncStatus(Rekonq::Bookmarks, false, i18n("Error loading: " + _webPage.mainFrame()->url().toEncoded())); _isSyncing = false; return; @@ -350,7 +350,7 @@ void OperaSyncHandler::fetchBookmarksResultSlot(KJob* job) QDomElement item = responseList.at(0).toElement(); KBookmark current = root.first(); - while(!current.isNull()) + while (!current.isNull()) { if (current.isGroup()) { @@ -377,7 +377,8 @@ void OperaSyncHandler::fetchBookmarksResultSlot(KJob* job) kDebug() << "Grand child is null"; handleLocalGroup(current.toGroup(), grandChild, id); } - else{ + else + { handleLocalGroup(current.toGroup(), grandChild, id); } } @@ -395,11 +396,11 @@ void OperaSyncHandler::fetchBookmarksResultSlot(KJob* job) kDebug() << "Add bookmark :" << url; addBookmarkOnServer(current.fullText(), current.url().url()); } -/* else - { - kDebug() << "Bookmark exists :" << url; - } -*/ + /* else + { + kDebug() << "Bookmark exists :" << url; + } + */ } current = root.next(current); @@ -591,7 +592,8 @@ void OperaSyncHandler::handleResponse(const QDomNodeList &responseList, KBookmar { handleResource(item, root); item = item.nextSibling(); - }while (!item.isNull()); + } + while (!item.isNull()); } } @@ -600,7 +602,7 @@ void OperaSyncHandler::handleLocalGroup(const KBookmarkGroup &root, const QDomEl { KBookmark current = root.first(); - while(!current.isNull()) + while (!current.isNull()) { if (current.isGroup()) { @@ -641,11 +643,11 @@ void OperaSyncHandler::handleLocalGroup(const KBookmarkGroup &root, const QDomEl addBookmarkOnServer(current.fullText(), current.url().url(), parentId); } -/* else - { - kDebug() << "Bookmark exists :" << url; - } -*/ + /* else + { + kDebug() << "Bookmark exists :" << url; + } + */ } current = root.next(current); @@ -657,8 +659,8 @@ void OperaSyncHandler::addBookmarkOnServer(QString title, QString url, QString p { QOAuth::ParamMap requestMap; requestMap.insert("api_output", "xml"); - requestMap.insert("api_method","create"); - requestMap.insert("item_type","bookmark"); + requestMap.insert("api_method", "create"); + requestMap.insert("item_type", "bookmark"); requestMap.insert("title", QUrl::toPercentEncoding(title.toUtf8())); requestMap.insert("uri", QUrl::toPercentEncoding(url.toUtf8())); @@ -671,8 +673,8 @@ void OperaSyncHandler::addBookmarkOnServer(QString title, QString url, QString p QByteArray postData = _qoauth.createParametersString(requestUrl, QOAuth::POST, _authToken, _authTokenSecret, QOAuth::HMAC_SHA1, requestMap, QOAuth::ParseForRequestContent); - KIO::TransferJob *job = KIO::http_post( KUrl(requestUrl), postData, KIO::HideProgressInfo ); - job->addMetaData("Content-Type", "application/x-www-form-urlencoded" ); + KIO::TransferJob *job = KIO::http_post(KUrl(requestUrl), postData, KIO::HideProgressInfo); + job->addMetaData("Content-Type", "application/x-www-form-urlencoded"); connect(job, SIGNAL(result(KJob*)), this, SLOT(createBookmarkResultSlot(KJob*))); connect(job, SIGNAL(data(KIO::Job*, QByteArray)), this, SLOT(createBookmarkDataSlot(KIO::Job*, QByteArray))); @@ -685,8 +687,8 @@ KJob *OperaSyncHandler::addBookmarkFolderOnServer(QString title, QString parent) { QOAuth::ParamMap requestMap; requestMap.insert("api_output", "xml"); - requestMap.insert("api_method","create"); - requestMap.insert("item_type","bookmark_folder"); + requestMap.insert("api_method", "create"); + requestMap.insert("item_type", "bookmark_folder"); requestMap.insert("title", QUrl::toPercentEncoding(title.toUtf8())); QByteArray requestUrl = "https://link.api.opera.com/rest/bookmark/"; @@ -697,8 +699,8 @@ KJob *OperaSyncHandler::addBookmarkFolderOnServer(QString title, QString parent) QByteArray postData = _qoauth.createParametersString(requestUrl, QOAuth::POST, _authToken, _authTokenSecret, QOAuth::HMAC_SHA1, requestMap, QOAuth::ParseForRequestContent); - KIO::TransferJob *job = KIO::http_post( KUrl(requestUrl), postData, KIO::HideProgressInfo ); - job->addMetaData("Content-Type", "application/x-www-form-urlencoded" ); + KIO::TransferJob *job = KIO::http_post(KUrl(requestUrl), postData, KIO::HideProgressInfo); + job->addMetaData("Content-Type", "application/x-www-form-urlencoded"); _jobToResponseMap.insert(job, ""); connect(job, SIGNAL(result(KJob*)), this, SLOT(createBookmarkFolderResultSlot(KJob*))); @@ -712,7 +714,7 @@ KJob *OperaSyncHandler::addBookmarkFolderOnServer(QString title, QString parent) void OperaSyncHandler::deleteResourceOnServer(QString id) { QOAuth::ParamMap requestMap; - requestMap.insert("api_method","delete"); + requestMap.insert("api_method", "delete"); QByteArray requestUrl = "https://link.api.opera.com/rest/bookmark/"; @@ -727,8 +729,8 @@ void OperaSyncHandler::deleteResourceOnServer(QString id) kDebug() << "Deleting Resource : " << id; - KIO::TransferJob *job = KIO::http_post( KUrl(requestUrl), postData, KIO::HideProgressInfo ); - job->addMetaData("Content-Type", "application/x-www-form-urlencoded" ); + KIO::TransferJob *job = KIO::http_post(KUrl(requestUrl), postData, KIO::HideProgressInfo); + job->addMetaData("Content-Type", "application/x-www-form-urlencoded"); connect(job, SIGNAL(result(KJob*)), this, SLOT(deleteResourceResultSlot(KJob*))); connect(job, SIGNAL(data(KIO::Job*, QByteArray)), this, SLOT(deleteResourceDataSlot(KIO::Job*, QByteArray))); @@ -791,7 +793,7 @@ QString OperaSyncHandler::getChildString(const QDomNode &node, const QString &na { QDomNodeList nodes = node.childNodes(); - for (int j=0; jsyncManager()->loadSettings(); + + SyncHandler *h = rApp->syncManager()->handler(); + + if (!h) + { + bkLabel->setPixmap(notSyncedIcon.pixmap(16)); + hsLabel->setPixmap(notSyncedIcon.pixmap(16)); + psLabel->setPixmap(notSyncedIcon.pixmap(16)); + return; + } + + connect(h, SIGNAL(syncStatus(Rekonq::SyncData, bool, QString)), this, SLOT(updateWidget(Rekonq::SyncData, bool, QString))); + + // bookmarks if (ReKonfig::syncBookmarks()) { @@ -130,12 +146,6 @@ void SyncCheckWidget::initializePage() { psLabel->setPixmap(notSyncedIcon.pixmap(16)); } - - // Now, load syncManager settings... - rApp->syncManager()->loadSettings(); - - SyncHandler *h = rApp->syncManager()->handler(); - connect(h, SIGNAL(syncStatus(Rekonq::SyncData, bool, QString)), this, SLOT(updateWidget(Rekonq::SyncData, bool, QString))); } diff --git a/src/sync/syncdatawidget.cpp b/src/sync/syncdatawidget.cpp index 9b415ad2..635c6239 100644 --- a/src/sync/syncdatawidget.cpp +++ b/src/sync/syncdatawidget.cpp @@ -49,17 +49,17 @@ void SyncDataWidget::initializePage() kcfg_syncHistory->setDisabled(true); kcfg_syncPasswords->setDisabled(true); - switch(ReKonfig::syncType()) + switch (ReKonfig::syncType()) { - //Ftp Sync Handler + //Ftp Sync Handler case 0: kcfg_syncBookmarks->setEnabled(true); kcfg_syncHistory->setEnabled(true); kcfg_syncPasswords->setEnabled(true); break; - //Google Sync Handler + //Google Sync Handler case 1: - //Opera Sync Handler + //Opera Sync Handler case 2: kcfg_syncBookmarks->setEnabled(true); break; diff --git a/src/sync/synchosttypewidget.cpp b/src/sync/synchosttypewidget.cpp index cece6e2c..289f5e5e 100644 --- a/src/sync/synchosttypewidget.cpp +++ b/src/sync/synchosttypewidget.cpp @@ -45,9 +45,9 @@ SyncHostTypeWidget::SyncHostTypeWidget(QWidget *parent) kcfg_syncEnabled->setChecked(ReKonfig::syncEnabled()); if (ReKonfig::syncType() == 0) ftpRadioButton->setChecked(true); - else if(ReKonfig::syncType() == 1) + else if (ReKonfig::syncType() == 1) googleRadioButton->setChecked(true); - else if(ReKonfig::syncType() == 2) + else if (ReKonfig::syncType() == 2) operaRadioButton->setChecked(true); else nullRadioButton->setChecked(true); @@ -83,11 +83,11 @@ int SyncHostTypeWidget::nextId() const ReKonfig::setSyncType(0); return SyncAssistant::Page_FTP_Settings; } - else if (googleRadioButton->isChecked()) - { - ReKonfig::setSyncType(1); - return SyncAssistant::Page_Google_Settings; - } + else if (googleRadioButton->isChecked()) + { + ReKonfig::setSyncType(1); + return SyncAssistant::Page_Google_Settings; + } else if (operaRadioButton->isChecked()) { ReKonfig::setSyncType(2); diff --git a/src/sync/syncmanager.cpp b/src/sync/syncmanager.cpp index 67b23054..78cc4b4e 100644 --- a/src/sync/syncmanager.cpp +++ b/src/sync/syncmanager.cpp @@ -31,6 +31,10 @@ // Auto Includes #include "rekonq.h" +// Config Includes +#include "config-qca2.h" +#include "config-qtoauth.h" + // Local Includes #include "application.h" #include "bookmarkmanager.h" @@ -39,7 +43,10 @@ #include "syncassistant.h" #include "ftpsynchandler.h" #include "googlesynchandler.h" + +#if (defined HAVE_QCA2 && defined HAVE_QTOAUTH) #include "operasynchandler.h" +#endif // KDE Includes #include @@ -84,9 +91,11 @@ void SyncManager::loadSettings() case 1: _syncImplementation = new GoogleSyncHandler(this); break; +#if (defined HAVE_QCA2 && defined HAVE_QTOAUTH) case 2: _syncImplementation = new OperaSyncHandler(this); break; +#endif default: kDebug() << "/dev/null"; return; diff --git a/src/sync/syncoperasettingswidget.cpp b/src/sync/syncoperasettingswidget.cpp index 7cef9e24..a45ae70c 100644 --- a/src/sync/syncoperasettingswidget.cpp +++ b/src/sync/syncoperasettingswidget.cpp @@ -1,8 +1,9 @@ /* ============================================================ * * This file is a part of the rekonq project +* * Copyright (C) 2012 by Siteshwar Vashisht -* Copyright (C) 2011 by Andrea Diamantini +* Copyright (C) 2011-2012 by Andrea Diamantini * * * This program is free software; you can redistribute it and/or @@ -31,6 +32,10 @@ // Auto Includes #include "rekonq.h" +// Config Includes +#include "config-qca2.h" +#include "config-qtoauth.h" + // Local Includes #include "syncassistant.h" @@ -39,15 +44,29 @@ SyncOperaSettingsWidget::SyncOperaSettingsWidget(QWidget *parent) : QWizardPage(parent) { setupUi(this); + +#if (defined HAVE_QCA2 && defined HAVE_QTOAUTH) + kcfg_syncUser->setText(ReKonfig::syncUser()); kcfg_syncPass->setText(ReKonfig::syncPass()); kcfg_syncPass->setPasswordMode(true); + +#else + + kcfg_syncUser->setEnabled(false); + kcfg_syncPass->setEnabled(false); + + infoLabel->setText(i18n("Rekonq has been compiled without support for Opera Sync")); + +#endif } int SyncOperaSettingsWidget::nextId() const { +#if (defined HAVE_QCA2 && defined HAVE_QTOAUTH) + // save ReKonfig::setSyncHost("http://link.opera.com/"); ReKonfig::setSyncUser(kcfg_syncUser->text()); @@ -57,4 +76,10 @@ int SyncOperaSettingsWidget::nextId() const ReKonfig::setSyncPasswords(false); return SyncAssistant::Page_Data; + +#else + + return SyncAssistant::Page_Check; + +#endif } diff --git a/src/sync/syncoperasettingswidget.h b/src/sync/syncoperasettingswidget.h index 5eb608d3..53e95699 100644 --- a/src/sync/syncoperasettingswidget.h +++ b/src/sync/syncoperasettingswidget.h @@ -2,8 +2,8 @@ * * This file is a part of the rekonq project * -* Copyright (C) 2011 by Siteshwar Vashisht -* Copyright (C) 2011 by Andrea Diamantini +* Copyright (C) 2011-2012 by Siteshwar Vashisht +* Copyright (C) 2011-2012 by Andrea Diamantini * * * This program is free software; you can redistribute it and/or diff --git a/src/urlbar/bookmarkwidget.cpp b/src/urlbar/bookmarkwidget.cpp index 2b76073e..b3658dd9 100644 --- a/src/urlbar/bookmarkwidget.cpp +++ b/src/urlbar/bookmarkwidget.cpp @@ -53,7 +53,7 @@ #include // Nepomuk config include -#include "../config-nepomuk.h" +#include "config-nepomuk.h" #ifdef HAVE_NEPOMUK // Local Nepomuk Includes diff --git a/src/urlbar/bookmarkwidget.h b/src/urlbar/bookmarkwidget.h index 6dc1b761..e5f25d37 100644 --- a/src/urlbar/bookmarkwidget.h +++ b/src/urlbar/bookmarkwidget.h @@ -35,7 +35,7 @@ #include // Nepomuk config include -#include "../config-nepomuk.h" +#include "config-nepomuk.h" #ifdef HAVE_NEPOMUK diff --git a/src/urlbar/newresourcedialog.h b/src/urlbar/newresourcedialog.h index f8aa5f48..651c631c 100644 --- a/src/urlbar/newresourcedialog.h +++ b/src/urlbar/newresourcedialog.h @@ -37,21 +37,21 @@ namespace Nepomuk { - class NewResourceDialog : public KDialog - { - Q_OBJECT +class NewResourceDialog : public KDialog +{ + Q_OBJECT - public: - explicit NewResourceDialog(int index, Nepomuk::Resource& nfoResource, QWidget* parent = 0); - virtual ~NewResourceDialog(); +public: + explicit NewResourceDialog(int index, Nepomuk::Resource& nfoResource, QWidget* parent = 0); + virtual ~NewResourceDialog(); - private Q_SLOTS: - void newResourceSlot(); +private Q_SLOTS: + void newResourceSlot(); - private: - class Private; - Private* const d; - }; +private: + class Private; + Private* const d; +}; } #endif // NEWRESOURCEDIALOG_H diff --git a/src/urlbar/resourcelinkdialog.h b/src/urlbar/resourcelinkdialog.h index 8846d0a0..e628aa10 100644 --- a/src/urlbar/resourcelinkdialog.h +++ b/src/urlbar/resourcelinkdialog.h @@ -1,7 +1,7 @@ /* ============================================================ * * This is a part of the GSoC project 2011 - Fancy Bookmarking -* +* * Copyright (c) 2011-2012 by Phaneendra Hegde * * @@ -38,36 +38,36 @@ namespace Nepomuk { - class Resource; +class Resource; - namespace Query - { - class Query; - } +namespace Query +{ +class Query; +} - class ResourceLinkDialog : public KDialog - { - Q_OBJECT +class ResourceLinkDialog : public KDialog +{ + Q_OBJECT - public: - explicit ResourceLinkDialog(Nepomuk::Resource& nfoResource, QWidget* parent = 0); - virtual ~ResourceLinkDialog(); - void setRelatedResources(); +public: + explicit ResourceLinkDialog(Nepomuk::Resource& nfoResource, QWidget* parent = 0); + virtual ~ResourceLinkDialog(); + void setRelatedResources(); - private Q_SLOTS: - void dynamicSearchingSlot(); - void resourceSelectedSlot(int); - void linkResourceSlot(); - void unlinkResourceSlot(); - void createNewResourceSlot(); - void showContextMenu(const QPoint&); +private Q_SLOTS: + void dynamicSearchingSlot(); + void resourceSelectedSlot(int); + void linkResourceSlot(); + void unlinkResourceSlot(); + void createNewResourceSlot(); + void showContextMenu(const QPoint&); - private: - class Private; - Private* const d; +private: + class Private; + Private* const d; - }; +}; } #endif // RESOURCELINKDIALOG_H diff --git a/version.h.cmake b/version.h.cmake deleted file mode 100644 index cbc6492b..00000000 --- a/version.h.cmake +++ /dev/null @@ -1,2 +0,0 @@ -#define REKONQ_VERSION "${REKONQ_VERSION}" - -- cgit v1.2.1