summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Vrátil <dvratil@kde.org>2016-07-31 13:56:13 (GMT)
committerDaniel Vrátil <dvratil@kde.org>2016-07-31 13:56:13 (GMT)
commitf848121d7b062e1cb320b56f31e51164e91d3ed2 (patch)
tree1849e2b3d216689386736ace6bd803abfc6de751
parente093a7ebb5817d956c7e3355d61c113f8f06c1b8 (diff)
AddresseeLineEdit: allow disabling completion from Akonadi
-rw-r--r--src/addressline/addresslineedit/addresseelineedit.cpp17
-rw-r--r--src/addressline/addresslineedit/addresseelineedit.h3
-rw-r--r--src/addressline/addresslineedit/addresseelineedit_p.cpp15
-rw-r--r--src/addressline/addresslineedit/addresseelineedit_p.h4
4 files changed, 37 insertions, 2 deletions
diff --git a/src/addressline/addresslineedit/addresseelineedit.cpp b/src/addressline/addresslineedit/addresseelineedit.cpp
index 3e795a1..f39c3bc 100644
--- a/src/addressline/addresslineedit/addresseelineedit.cpp
+++ b/src/addressline/addresslineedit/addresseelineedit.cpp
@@ -149,6 +149,21 @@ void AddresseeLineEdit::setEnableBalooSearch(bool enable)
d->setEnableBalooSearch(enable);
}
+bool AddresseeLineEdit::enableBalooSearch() const
+{
+ return d->enableAkonadiSearch();
+}
+
+void AddresseeLineEdit::setEnableAkonadiSearch(bool enable)
+{
+ d->setEnableAkonadiSearch(enable);
+}
+
+bool AddresseeLineEdit::enableAkonadiSearch() const
+{
+ return d->enableAkonadiSearch();
+}
+
void AddresseeLineEdit::allowSemicolonAsSeparator(bool useSemicolonAsSeparator)
{
d->setUseSemicolonAsSeparator(useSemicolonAsSeparator);
@@ -913,7 +928,7 @@ void AddresseeLineEdit::slotEditingFinished()
d->mightBeGroupJobsClear();
d->groupsClear();
- if (!text().isEmpty()) {
+ if (!text().isEmpty() && enableAkonadiSearch()) {
const QStringList addresses = KEmailAddress::splitAddressList(text());
Q_FOREACH (const QString &address, addresses) {
Akonadi::ContactGroupSearchJob *job = new Akonadi::ContactGroupSearchJob();
diff --git a/src/addressline/addresslineedit/addresseelineedit.h b/src/addressline/addresslineedit/addresseelineedit.h
index 2f8d626..d1e33ba 100644
--- a/src/addressline/addresslineedit/addresseelineedit.h
+++ b/src/addressline/addresslineedit/addresseelineedit.h
@@ -87,6 +87,9 @@ public:
void setFont(const QFont &font);
void setEnableBalooSearch(bool enable);
+ bool enableBalooSearch() const;
+ void setEnableAkonadiSearch(bool enable);
+ bool enableAkonadiSearch() const;
bool isCompletionEnabled() const;
diff --git a/src/addressline/addresslineedit/addresseelineedit_p.cpp b/src/addressline/addresslineedit/addresseelineedit_p.cpp
index fc631f9..f086c42 100644
--- a/src/addressline/addresslineedit/addresseelineedit_p.cpp
+++ b/src/addressline/addresslineedit/addresseelineedit_p.cpp
@@ -61,6 +61,7 @@ AddresseeLineEditPrivate::AddresseeLineEditPrivate(KPIM::AddresseeLineEdit *qq,
m_useSemicolonAsSeparator(false),
m_showOU(false),
m_enableBalooSearch(true),
+ m_enableAkonadiSearch(true),
mExpandIntern(true),
mAutoGroupExpand(false),
mShowRecentAddresses(true)
@@ -489,7 +490,9 @@ void AddresseeLineEditPrivate::slotTriggerDelayedQueries()
// We send a contactsearch job through akonadi.
// This not only searches baloo but also servers if remote search is enabled
- akonadiPerformSearch();
+ if (m_enableAkonadiSearch) {
+ akonadiPerformSearch();
+ }
}
void AddresseeLineEditPrivate::startSearches()
@@ -983,6 +986,16 @@ void AddresseeLineEditPrivate::setEnableBalooSearch(bool enableBalooSearch)
m_enableBalooSearch = enableBalooSearch;
}
+bool AddresseeLineEditPrivate::enableAkonadiSearch() const
+{
+ return m_enableAkonadiSearch;
+}
+
+void AddresseeLineEditPrivate::setEnableAkonadiSearch(bool enableAkonadiSearch)
+{
+ m_enableAkonadiSearch = enableAkonadiSearch;
+}
+
QString AddresseeLineEditPrivate::searchString() const
{
return m_searchString;
diff --git a/src/addressline/addresslineedit/addresseelineedit_p.h b/src/addressline/addresslineedit/addresseelineedit_p.h
index 524b95e..c589b75 100644
--- a/src/addressline/addresslineedit/addresseelineedit_p.h
+++ b/src/addressline/addresslineedit/addresseelineedit_p.h
@@ -83,6 +83,9 @@ public:
bool useSemicolonAsSeparator() const;
void setUseSemicolonAsSeparator(bool useSemicolonAsSeparator);
+ bool enableAkonadiSearch() const;
+ void setEnableAkonadiSearch(bool enableAkonadiSearch);
+
void removeCompletionSource(const QString &source);
int addCompletionSource(const QString &source, int weight);
void restartTime(const QString &searchString);
@@ -155,6 +158,7 @@ private:
bool m_useSemicolonAsSeparator;
bool m_showOU;
bool m_enableBalooSearch;
+ bool m_enableAkonadiSearch;
bool mExpandIntern;
bool mAutoGroupExpand;
bool mShowRecentAddresses;