From 015667f79a84d4a4461fd95fa9467148bfcb7298 Mon Sep 17 00:00:00 2001 From: Debian/Kubuntu Qt/KDE Maintainers Date: Thu, 18 Jan 2018 12:17:10 +0000 Subject: [PATCH] optional-qtwebengine Gbp-Pq: Name optional-qtwebengine.diff --- CMakeLists.txt | 7 ++- src/contact-editor/CMakeLists.txt | 21 +++++--- .../addresseditor/autotests/CMakeLists.txt | 32 +++++++------ .../editor/addresseditor/tests/CMakeLists.txt | 48 ++++++++++--------- .../editor/contacteditorwidget.cpp | 12 +++++ 5 files changed, 75 insertions(+), 45 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 96bc164..9c41464 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -30,7 +30,12 @@ set(KMIMELIB_VERSION "5.6.3") set(AKONADI_VERSION "5.6.3") set(QT_REQUIRED_VERSION "5.7.0") -find_package(Qt5 ${QT_REQUIRED_VERSION} CONFIG REQUIRED Widgets Test WebEngine WebEngineWidgets) +find_package(Qt5 ${QT_REQUIRED_VERSION} CONFIG REQUIRED Widgets Test) +find_package(Qt5WebEngine ${QT_REQUIRED_VERSION} CONFIG) +find_package(Qt5WebEngineWidgets ${QT_REQUIRED_VERSION} CONFIG) +if (Qt5WebEngine_FOUND) + add_definitions(-DHAVE_WEBENGINE) +endif() ########### Find packages ########### find_package(KF5KIO ${KF5_VERSION} CONFIG REQUIRED) find_package(KF5I18n ${KF5_VERSION} CONFIG REQUIRED) diff --git a/src/contact-editor/CMakeLists.txt b/src/contact-editor/CMakeLists.txt index 7ab0b09..cbc966c 100644 --- a/src/contact-editor/CMakeLists.txt +++ b/src/contact-editor/CMakeLists.txt @@ -89,10 +89,13 @@ set(contacteditor_editor_generalinfo_SRCS ${contacteditor_editor_generalinfo_mail_SRCS} ) -set(contacteditor_addresslocation_web_editor_SRCS - editor/addresseditor/webengine/addresseslocationengineviewer.cpp - editor/addresseditor/webengine/addresseslocationenginepage.cpp - ) +if (TARGET Qt5::WebEngine) + set(contacteditor_addresslocation_web_editor_SRCS + editor/addresseditor/webengine/addresseslocationengineviewer.cpp + editor/addresseditor/webengine/addresseslocationenginepage.cpp + editor/addresseditor/addresseslocationwidget.cpp + ) +endif() set(contacteditor_addresslocation_editor_SRCS ${contacteditor_addresslocation_web_editor_SRCS} @@ -100,7 +103,6 @@ set(contacteditor_addresslocation_editor_SRCS editor/addresseditor/addresseslocationgrantleeformater.cpp editor/addresseditor/addressgrantleeobject.cpp editor/addresseditor/iconnamecache.cpp - editor/addresseditor/addresseslocationwidget.cpp editor/addresseditor/selectaddresstypecombobox.cpp editor/addresseditor/addresstypedialog.cpp ) @@ -176,9 +178,14 @@ target_link_libraries(KF5ContactEditor KF5::TextWidgets KF5::WidgetsAddons Grantlee5::Templates - Qt5::WebEngine - Qt5::WebEngineWidgets ) +if (TARGET Qt5::WebEngine) + target_link_libraries(KF5ContactEditor + PRIVATE + Qt5::WebEngine + Qt5::WebEngineWidgets + ) +endif() set_target_properties(KF5ContactEditor PROPERTIES VERSION ${AKONADICONTACT_VERSION_STRING} diff --git a/src/contact-editor/editor/addresseditor/autotests/CMakeLists.txt b/src/contact-editor/editor/addresseditor/autotests/CMakeLists.txt index 55284cf..118c007 100644 --- a/src/contact-editor/editor/addresseditor/autotests/CMakeLists.txt +++ b/src/contact-editor/editor/addresseditor/autotests/CMakeLists.txt @@ -8,13 +8,15 @@ set(contacteditor_webengine_LIB Qt5::WebEngine Qt5::WebEngineWidgets) ecm_qt_declare_logging_category(contacteditor_addresslocation_web_editor_SRCS HEADER contacteditor_debug.h IDENTIFIER CONTACTEDITOR_LOG CATEGORY_NAME org.kde.pim.contacteditor) -set(addresseslocationviewer_SRCS addresseslocationviewertest.cpp ${contacteditor_addresslocation_web_editor_SRCS} ../addresseslocationgrantleeformater.cpp - ../addressgrantleeobject.cpp ../iconnamecache.cpp) -add_executable(addresseslocationviewer ${addresseslocationviewer_SRCS}) -add_test(addresseslocationviewer addresseslocationviewer) -ecm_mark_as_test(addresseslocationviewer) -target_link_libraries(addresseslocationviewer Qt5::Test Qt5::Widgets KF5::ContactEditor KF5::Contacts KF5::I18n ${contacteditor_webengine_LIB} Grantlee5::Templates - KF5::IconThemes KF5::WidgetsAddons) +if (TARGET Qt5::WebEngine) + set(addresseslocationviewer_SRCS addresseslocationviewertest.cpp ${contacteditor_addresslocation_web_editor_SRCS} ../addresseslocationgrantleeformater.cpp + ../addressgrantleeobject.cpp ../iconnamecache.cpp) + add_executable(addresseslocationviewer ${addresseslocationviewer_SRCS}) + add_test(addresseslocationviewer addresseslocationviewer) + ecm_mark_as_test(addresseslocationviewer) + target_link_libraries(addresseslocationviewer Qt5::Test Qt5::Widgets KF5::ContactEditor KF5::Contacts KF5::I18n ${contacteditor_webengine_LIB} Grantlee5::Templates + KF5::IconThemes KF5::WidgetsAddons) +endif() set(addresslocationwidget_SRCS addresslocationwidgettest.cpp ../addresslocationwidget.cpp ../selectaddresstypecombobox.cpp ../addresstypedialog.cpp) add_executable(addresslocationwidget ${addresslocationwidget_SRCS}) @@ -22,10 +24,12 @@ add_test(addresslocationwidget addresslocationwidget) ecm_mark_as_test(addresslocationwidget) target_link_libraries(addresslocationwidget Qt5::Test Qt5::Widgets KF5::ContactEditor KF5::Contacts KF5::I18n KF5::Completion) -set(addresseslocationwidget_SRCS addresseslocationwidgettest.cpp ../addresseslocationwidget.cpp ${contacteditor_addresslocation_web_editor_SRCS} ../addresseslocationgrantleeformater.cpp - ../addressgrantleeobject.cpp ../iconnamecache.cpp ../addresslocationwidget.cpp ../selectaddresstypecombobox.cpp ../addresstypedialog.cpp) -add_executable(addresseslocationwidget ${addresseslocationwidget_SRCS}) -add_test(addresseslocationwidget addresseslocationwidget) -ecm_mark_as_test(addresseslocationwidget) -target_link_libraries(addresseslocationwidget Qt5::Test Qt5::Widgets KF5::ContactEditor KF5::Contacts KF5::I18n KF5::Completion ${contacteditor_webengine_LIB} - Grantlee5::Templates KF5::IconThemes KF5::WidgetsAddons) +if (TARGET Qt5::WebEngine) + set(addresseslocationwidget_SRCS addresseslocationwidgettest.cpp ../addresseslocationwidget.cpp ${contacteditor_addresslocation_web_editor_SRCS} ../addresseslocationgrantleeformater.cpp + ../addressgrantleeobject.cpp ../iconnamecache.cpp ../addresslocationwidget.cpp ../selectaddresstypecombobox.cpp ../addresstypedialog.cpp) + add_executable(addresseslocationwidget ${addresseslocationwidget_SRCS}) + add_test(addresseslocationwidget addresseslocationwidget) + ecm_mark_as_test(addresseslocationwidget) + target_link_libraries(addresseslocationwidget Qt5::Test Qt5::Widgets KF5::ContactEditor KF5::Contacts KF5::I18n KF5::Completion ${contacteditor_webengine_LIB} + Grantlee5::Templates KF5::IconThemes KF5::WidgetsAddons) +endif() diff --git a/src/contact-editor/editor/addresseditor/tests/CMakeLists.txt b/src/contact-editor/editor/addresseditor/tests/CMakeLists.txt index 3198e47..cdfd916 100644 --- a/src/contact-editor/editor/addresseditor/tests/CMakeLists.txt +++ b/src/contact-editor/editor/addresseditor/tests/CMakeLists.txt @@ -6,29 +6,31 @@ set(akonadicontact_webengine_LIB Qt5::WebEngine Qt5::WebEngineWidgets) ecm_qt_declare_logging_category(akonadicontact_addresslocation_web_editor_SRCS HEADER contacteditor_debug.h IDENTIFIER CONTACTEDITOR_LOG CATEGORY_NAME org.kde.pim.akonadi_contact) -set(addresseditor_SRCS - ${akonadicontact_addresslocation_web_editor_SRCS} - main.cpp - ../addresseslocationwidget.cpp - ../addresseslocationgrantleeformater.cpp - ../addressgrantleeobject.cpp - ../iconnamecache.cpp - ../addresslocationwidget.cpp - ../selectaddresstypecombobox.cpp - ../addresstypedialog.cpp - ) +if (TARGET Qt5::WebEngine) + set(addresseditor_SRCS + ${akonadicontact_addresslocation_web_editor_SRCS} + main.cpp + ../addresseslocationwidget.cpp + ../addresseslocationgrantleeformater.cpp + ../addressgrantleeobject.cpp + ../iconnamecache.cpp + ../addresslocationwidget.cpp + ../selectaddresstypecombobox.cpp + ../addresstypedialog.cpp + ) -add_executable(addresseditortest ${addresseditor_SRCS}) + add_executable(addresseditortest ${addresseditor_SRCS}) -target_link_libraries(addresseditortest - Qt5::Widgets - KF5::AkonadiContact - KF5::Contacts - KF5::I18n - KF5::Completion - Grantlee5::Templates - KF5::IconThemes - KF5::WidgetsAddons - ${akonadicontact_webengine_LIB} - ) + target_link_libraries(addresseditortest + Qt5::Widgets + KF5::AkonadiContact + KF5::Contacts + KF5::I18n + KF5::Completion + Grantlee5::Templates + KF5::IconThemes + KF5::WidgetsAddons + ${akonadicontact_webengine_LIB} + ) +endif() diff --git a/src/contact-editor/editor/contacteditorwidget.cpp b/src/contact-editor/editor/contacteditorwidget.cpp index abc235d..24411b2 100644 --- a/src/contact-editor/editor/contacteditorwidget.cpp +++ b/src/contact-editor/editor/contacteditorwidget.cpp @@ -35,7 +35,9 @@ #include #include #include +#ifdef HAVE_WEBENGINE #include "addresseditor/addresseslocationwidget.h" +#endif #include "customfieldeditor/customfieldswidget.h" #include "businesseditor/businesseditorwidget.h" #include "generalinfoeditor/generalinfowidget.h" @@ -69,8 +71,10 @@ public: ContactEditor::GeneralInfoWidget *mGeneralInfoWidget; +#ifdef HAVE_WEBENGINE // widgets from addresses group ContactEditor::AddressesLocationWidget *mAddressesLocationWidget; +#endif ContactEditor::BusinessEditorWidget *mBusinessEditorWidget; @@ -113,8 +117,10 @@ void ContactEditorWidget::Private::initGuiContactTab() void ContactEditorWidget::Private::initGuiLocationTab() { +#ifdef HAVE_WEBENGINE mAddressesLocationWidget = new ContactEditor::AddressesLocationWidget; mTabWidget->addTab(mAddressesLocationWidget, i18nc("@title:tab", "Location")); +#endif } void ContactEditorWidget::Private::initGuiBusinessTab() @@ -211,8 +217,10 @@ void ContactEditorWidget::loadContact(const KContacts::Addressee &contact, const { d->mGeneralInfoWidget->loadContact(contact); +#ifdef HAVE_WEBENGINE // address group d->mAddressesLocationWidget->loadContact(contact); +#endif // general group d->mBusinessEditorWidget->loadContact(contact); @@ -237,8 +245,10 @@ void ContactEditorWidget::storeContact(KContacts::Addressee &contact, ContactEdi { d->mGeneralInfoWidget->storeContact(contact); +#ifdef HAVE_WEBENGINE // address group d->mAddressesLocationWidget->storeContact(contact); +#endif // general group d->mBusinessEditorWidget->storeContact(contact); @@ -264,8 +274,10 @@ void ContactEditorWidget::storeContact(KContacts::Addressee &contact, ContactEdi void ContactEditorWidget::setReadOnly(bool readOnly) { d->mGeneralInfoWidget->setReadOnly(readOnly); +#ifdef HAVE_WEBENGINE // widgets from addresses group d->mAddressesLocationWidget->setReadOnly(readOnly); +#endif // widgets from general group d->mBusinessEditorWidget->setReadOnly(readOnly); -- 2.30.2