Commit c185b4f5 authored by David Faure's avatar David Faure
Browse files

Add an option to skip the AkonadiSearchPIM dependency, to simplify Windows build

Summary:
akonadiconsole only needs KCheckComboBox from libkdepim... which in turn
was bringing a whole lot more dependencies. Let's provide a way to build
this without xapian.

Test Plan: Builds on Linux, with and without the option set.

Reviewers: mlaurent, sengels

Reviewed By: mlaurent

Subscribers: kde-pim

Tags: #kde_pim

Differential Revision: https://phabricator.kde.org/D18613
parent 91a729c2
......@@ -51,9 +51,14 @@ find_package(KF5AkonadiContact ${AKONADICONTACT_LIB_VERSION} CONFIG REQUIRED)
find_package(KF5Contacts ${KCONTACTS_LIB_VERSION} CONFIG REQUIRED)
find_package(KF5Ldap ${KLDAP_LIB_VERSION} CONFIG REQUIRED)
option(FORCE_DISABLE_AKONADI_SEARCH "Disable features and API that require akonadi-search, e.g. because xapian isn't available" OFF)
if (NOT FORCE_DISABLE_AKONADI_SEARCH)
find_package(KF5AkonadiSearch ${AKONADISEARCH_LIB_VERSION} CONFIG REQUIRED)
set_package_properties(KF5AkonadiSearch PROPERTIES DESCRIPTION "The Akonadi Search libraries" URL "http://www.kde.org" TYPE REQUIRED PURPOSE "Provides search capabilities in KMail and Akonadi")
endif()
set(DISABLE_AKONADI_SEARCH FORCE_DISABLE_AKONADI_SEARCH)
configure_file(config-akonadi-search.h.in ${CMAKE_CURRENT_BINARY_DIR}/src/config-akonadi-search.h)
find_package(KF5DesignerPlugin ${KF5_VERSION} CONFIG)
set_package_properties(KF5DesignerPlugin PROPERTIES DESCRIPTION "KF5 designer plugin" TYPE OPTIONAL)
......
#cmakedefine01 DISABLE_AKONADI_SEARCH
......@@ -6,7 +6,9 @@ ecm_setup_version(PROJECT VARIABLE_PREFIX LIBKDEPIM
if(BUILD_TESTING)
add_subdirectory(tests)
add_subdirectory(addressline/blacklistbaloocompletion/autotests)
if (NOT FORCE_DISABLE_AKONADI_SEARCH)
add_subdirectory(addressline/blacklistbaloocompletion/autotests)
endif()
add_subdirectory(addressline/autotests/)
endif()
......@@ -27,13 +29,15 @@ set(kdepim_addressline_LIB_SRCS
addressline/completionconfiguredialog/completionconfiguredialog.cpp
)
if (NOT FORCE_DISABLE_AKONADI_SEARCH)
set(kdepim_addressline_blacklist_baloo_LIB_SRCS
addressline/blacklistbaloocompletion/blacklistbalooemaillist.cpp
addressline/blacklistbaloocompletion/blacklistbalooemailsearchjob.cpp
addressline/blacklistbaloocompletion/blacklistbalooemailutil.cpp
addressline/blacklistbaloocompletion/blacklistbalooemailcompletionwidget.cpp
addressline/blacklistbaloocompletion/blacklistbalooemailwarning.cpp
addressline/blacklistbaloocompletion/blacklistbalooemailsearchjob.cpp
)
endif()
set(kdepim_addressline_plugin_LIB_SRCS
addressline/plugins/addressesslineeditabstractplugin.cpp
......@@ -51,9 +55,13 @@ set(kdepim_job_LIB_SRCS
job/addcontactjob.cpp
job/openemailaddressjob.cpp
job/addemaildisplayjob.cpp
job/collectionsearchjob.cpp
job/personsearchjob.cpp
)
if (NOT FORCE_DISABLE_AKONADI_SEARCH)
list(APPEND kdepim_job_LIB_SRCS
job/collectionsearchjob.cpp
job/personsearchjob.cpp
)
endif()
set(kdepimakonadi_widgets_LIB_SRCS
widgets/tagwidgets.cpp
......@@ -96,7 +104,6 @@ target_link_libraries(KF5LibkdepimAkonadi
KF5::Codecs
KF5::I18n
KF5::ItemViews
KF5::AkonadiSearchPIM
KF5::KIOCore
KF5::KIOWidgets
Qt5::DBus
......@@ -105,7 +112,11 @@ target_link_libraries(KF5LibkdepimAkonadi
)
if(MINGW)
target_link_libraries(KF5LibkdepimAkonadi oleaut32)
target_link_libraries(KF5LibkdepimAkonadi PRIVATE oleaut32)
endif()
if (NOT FORCE_DISABLE_AKONADI_SEARCH)
target_link_libraries(KF5LibkdepimAkonadi PRIVATE KF5::AkonadiSearchPIM)
endif()
set_target_properties(KF5LibkdepimAkonadi PROPERTIES
......
......@@ -37,7 +37,10 @@
#include <QToolButton>
#include <KConfigGroup>
#include <KLocalizedString>
#include <config-akonadi-search.h>
#if !DISABLE_AKONADI_SEARCH
#include <AkonadiSearch/PIM/contactcompleter.h>
#endif
#include <ldap/ldapclientsearch.h>
#include <addressline/addresslineedit/baloocompletionemail.h>
......@@ -166,6 +169,7 @@ void AddresseeLineEditPrivate::setIcon(const QIcon &icon, const QString &tooltip
void AddresseeLineEditPrivate::searchInBaloo()
{
#if !DISABLE_AKONADI_SEARCH
const QString trimmedString = mSearchString.trimmed();
Akonadi::Search::PIM::ContactCompleter com(trimmedString, 20);
const QStringList listEmail = AddresseeLineEditManager::self()->cleanupEmailList(com.complete());
......@@ -173,6 +177,7 @@ void AddresseeLineEditPrivate::searchInBaloo()
addCompletionItem(email, 1, AddresseeLineEditManager::self()->balooCompletionSource());
}
doCompletion(mLastSearchMode);
#endif
}
void AddresseeLineEditPrivate::setCompletedItems(const QStringList &items, bool autoSuggest)
......
......@@ -27,7 +27,10 @@
#include <KSharedConfig>
#include <ldap/ldapclientsearch.h>
#include <addressline/completionorder/completionorderwidget.h>
#include <config-akonadi-search.h>
#if !DISABLE_AKONADI_SEARCH
#include <addressline/blacklistbaloocompletion/blacklistbalooemailcompletionwidget.h>
#endif
#include <addressline/recentaddress/recentaddresswidget.h>
using namespace KPIM;
......@@ -41,7 +44,9 @@ public:
QTabWidget *mTabWidget = nullptr;
KPIM::CompletionOrderWidget *mCompletionOrderWidget = nullptr;
#if !DISABLE_AKONADI_SEARCH
KPIM::BlackListBalooEmailCompletionWidget *mBlackListBalooWidget = nullptr;
#endif
KPIM::RecentAddressWidget *mRecentaddressWidget = nullptr;
};
......@@ -64,9 +69,11 @@ CompletionConfigureDialog::CompletionConfigureDialog(QWidget *parent)
d->mRecentaddressWidget->setObjectName(QStringLiteral("recentaddress_widget"));
d->mTabWidget->addTab(d->mRecentaddressWidget, i18n("Recent Address"));
#if !DISABLE_AKONADI_SEARCH
d->mBlackListBalooWidget = new KPIM::BlackListBalooEmailCompletionWidget;
d->mBlackListBalooWidget->setObjectName(QStringLiteral("blacklistbaloo_widget"));
d->mTabWidget->addTab(d->mBlackListBalooWidget, i18n("Blacklist Email Address"));
#endif
QDialogButtonBox *buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel, this);
buttonBox->setObjectName(QStringLiteral("buttonbox"));
......@@ -111,7 +118,9 @@ void CompletionConfigureDialog::setLdapClientSearch(KLDAP::LdapClientSearch *lda
void CompletionConfigureDialog::load()
{
d->mCompletionOrderWidget->loadCompletionItems();
#if !DISABLE_AKONADI_SEARCH
d->mBlackListBalooWidget->load();
#endif
}
bool CompletionConfigureDialog::recentAddressWasChanged() const
......@@ -126,12 +135,16 @@ void CompletionConfigureDialog::storeAddresses(KConfig *config)
void CompletionConfigureDialog::slotSave()
{
#if !DISABLE_AKONADI_SEARCH
d->mBlackListBalooWidget->save();
#endif
d->mCompletionOrderWidget->save();
accept();
}
void CompletionConfigureDialog::setEmailBlackList(const QStringList &lst)
{
#if !DISABLE_AKONADI_SEARCH
d->mBlackListBalooWidget->setEmailBlackList(lst);
#endif
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment