Pimcommon

addresseelineeditakonadisearch.cpp
1/*
2 SPDX-FileCopyrightText: 2017-2024 Laurent Montel <montel@kde.org>
3
4 SPDX-License-Identifier: LGPL-2.0-or-later
5*/
6
7#include "addresseelineeditakonadisearch.h"
8#include "akonadisearchcompletionemail.h"
9#include <KConfigGroup>
10#include <KSharedConfig>
11
12using namespace PimCommon;
13
14AddresseeLineEditAkonadiSearch::AddresseeLineEditAkonadiSearch()
15 : mAkonadiSearchCompletionEmail(new PimCommon::AkonadiSearchCompletionEmail)
16{
17 loadAkonadiSearchBlackList();
18}
19
20AddresseeLineEditAkonadiSearch::~AddresseeLineEditAkonadiSearch()
21{
22 delete mAkonadiSearchCompletionEmail;
23}
24
25int AddresseeLineEditAkonadiSearch::akonadiSearchCompletionSource() const
26{
27 return mAkonadiSearchCompletionSource;
28}
29
30void AddresseeLineEditAkonadiSearch::setAkonadiSearchCompletionSource(int value)
31{
32 mAkonadiSearchCompletionSource = value;
33}
34
35QStringList AddresseeLineEditAkonadiSearch::akonadiSearchBlackList() const
36{
37 return mAkonadiSearchCompletionEmail->balooCompletionEmailInfo().mBlackList;
38}
39
40QStringList AddresseeLineEditAkonadiSearch::domainExcludeList() const
41{
42 return mAkonadiSearchCompletionEmail->balooCompletionEmailInfo().mExcludeDomains;
43}
44
45void AddresseeLineEditAkonadiSearch::loadAkonadiSearchBlackList()
46{
47 KSharedConfig::Ptr config = KSharedConfig::openConfig(QStringLiteral("kpimbalooblacklist"));
48 config->reparseConfiguration();
49 KConfigGroup group(config, QStringLiteral("AddressLineEdit"));
50 PimCommon::AkonadiSearchCompletionEmail::AkonadiSearchCompletionEmailInfo info;
51 const QStringList balooBlackList = group.readEntry("BalooBackList", QStringList());
52 const QStringList domainExcludeList = group.readEntry("ExcludeDomain", QStringList());
53 const QStringList lstExcludeEmailsRegularExpressions = group.readEntry("ExcludeEmailsRegexp", QStringList());
54
55 info.mExcludeEmailsRegularExpressions = lstExcludeEmailsRegularExpressions;
56 info.mBlackList = balooBlackList;
57 info.mExcludeDomains = domainExcludeList;
58 mAkonadiSearchCompletionEmail->setBalooCompletionEmailInfo(info);
59}
60
61QStringList AddresseeLineEditAkonadiSearch::cleanupEmailList(const QStringList &inputList)
62{
63 PimCommon::AkonadiSearchCompletionEmail::AkonadiSearchCompletionEmailInfo info = mAkonadiSearchCompletionEmail->balooCompletionEmailInfo();
64 info.mListEmail = inputList;
65 mAkonadiSearchCompletionEmail->setBalooCompletionEmailInfo(info);
66 return mAkonadiSearchCompletionEmail->cleanupEmailList();
67}
static KSharedConfig::Ptr openConfig(const QString &fileName=QString(), OpenFlags mode=FullConfig, QStandardPaths::StandardLocation type=QStandardPaths::GenericConfigLocation)
folderdialogacltab.h
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Sat Dec 21 2024 17:02:56 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.