Pimcommon

addresseelineeditbaloo.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 "addresseelineeditbaloo.h"
8#include "baloocompletionemail.h"
9#include <KConfigGroup>
10#include <KSharedConfig>
11
12using namespace PimCommon;
13
14AddresseeLineEditBaloo::AddresseeLineEditBaloo()
15 : mBalooCompletionEmail(new PimCommon::BalooCompletionEmail)
16{
17 loadBalooBlackList();
18}
19
20AddresseeLineEditBaloo::~AddresseeLineEditBaloo()
21{
22 delete mBalooCompletionEmail;
23}
24
25int AddresseeLineEditBaloo::balooCompletionSource() const
26{
27 return mBalooCompletionSource;
28}
29
30void AddresseeLineEditBaloo::setBalooCompletionSource(int value)
31{
32 mBalooCompletionSource = value;
33}
34
35QStringList AddresseeLineEditBaloo::balooBlackList() const
36{
37 return mBalooCompletionEmail->balooCompletionEmailInfo().mBlackList;
38}
39
40QStringList AddresseeLineEditBaloo::domainExcludeList() const
41{
42 return mBalooCompletionEmail->balooCompletionEmailInfo().mExcludeDomains;
43}
44
45void AddresseeLineEditBaloo::loadBalooBlackList()
46{
47 KSharedConfig::Ptr config = KSharedConfig::openConfig(QStringLiteral("kpimbalooblacklist"));
48 config->reparseConfiguration();
49 KConfigGroup group(config, QStringLiteral("AddressLineEdit"));
50 PimCommon::BalooCompletionEmail::BalooCompletionEmailInfo 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 mBalooCompletionEmail->setBalooCompletionEmailInfo(info);
59}
60
61QStringList AddresseeLineEditBaloo::cleanupEmailList(const QStringList &inputList)
62{
63 PimCommon::BalooCompletionEmail::BalooCompletionEmailInfo info = mBalooCompletionEmail->balooCompletionEmailInfo();
64 info.mListEmail = inputList;
65 mBalooCompletionEmail->setBalooCompletionEmailInfo(info);
66 return mBalooCompletionEmail->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 Mon Nov 18 2024 12:14:35 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.