Pimcommon

kmailcompletion.h
1/*
2 This file is part of libkdepim.
3
4 SPDX-FileCopyrightText: 2006 Christian Schaarschmidt <schaarsc@gmx.de>
5 SPDX-FileCopyrightText: 2017-2024 Laurent Montel <montel@kde.org>
6
7 SPDX-License-Identifier: LGPL-2.0-or-later
8*/
9
10#pragma once
11
12#include <KCompletion>
13
14#include <QMap>
15#include <QString>
16#include <QStringList>
17
18namespace PimCommon
19{
20/**
21 * KMailCompletion allows lookup of email addresses by keyword.
22 * This is used for lookup by nickname, since we don't want the nickname to appear in the final email.
23 * E.g. you have a nickname "idiot" for your boss, you want to type "idiot" but you want the completion
24 * to offer "Full Name <email@domain>", without the nickname being visible.
25 */
27{
29
30public:
32
33 /**
34 * clears internal keyword map and calls KCompletion::clear.
35 */
36 void clear() override;
37
38 /**
39 * uses KCompletion::makeCompletion to find email addresses which starts
40 * with string. ignores keywords.
41 *
42 * @returns email address
43 */
44 [[nodiscard]] QString makeCompletion(const QString &string) override;
45
46 /**
47 * specify keywords for email.
48 *
49 * Items may be added with KCompletion::addItem, those will only be
50 * returned as match if they are in one of these formats:
51 * \li contains localpart@domain
52 * \li contains <email>
53 * or if they have also been added with this function.
54 */
55 void addItemWithKeys(const QString &email, int weight, const QStringList *keyWords);
56
57 /**
58 * use internal map to replace all keywords in pMatches with corresponding
59 * email addresses.
60 */
61 void postProcessMatches(QStringList *pMatches) const override;
62
63 // We are not using allWeightedMatches() anywhere, therefore we don't need
64 // to override the other postProcessMatches() function
66
67private:
69};
70}
virtual void postProcessMatches(KCompletionMatches *matches) const
KMailCompletion allows lookup of email addresses by keyword.
QString makeCompletion(const QString &string) override
uses KCompletion::makeCompletion to find email addresses which starts with string.
void postProcessMatches(QStringList *pMatches) const override
use internal map to replace all keywords in pMatches with corresponding email addresses.
void addItemWithKeys(const QString &email, int weight, const QStringList *keyWords)
specify keywords for email.
void clear() override
clears internal keyword map and calls KCompletion::clear.
folderdialogacltab.h
Q_OBJECTQ_OBJECT
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Tue Mar 26 2024 11:17:23 by doxygen 1.10.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.