2 This file is part of libkdepim.
4 Copyright (c) 2006 Christian Schaarschmidt <schaarsc@gmx.de>
6 This library is free software; you can redistribute it and/or
7 modify it under the terms of the GNU Library General Public
8 License as published by the Free Software Foundation; either
9 version 2 of the License, or (at your option) any later version.
11 This library is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 Library General Public License for more details.
16 You should have received a copy of the GNU Library General Public License
17 along with this library; see the file COPYING.LIB. If not, write to
18 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
19 Boston, MA 02110-1301, USA.
22 #ifndef KDEPIM_KMAILCOMPLETION_H
23 #define KDEPIM_KMAILCOMPLETION_H
25 #include <KCompletion>
29 #include <QStringList>
34 * KMailCompletion allows lookup of email addresses by keyword.
35 * Typically a keywods would be firstname, lastname, nickname or domain.
37 class KMailCompletion
: public KCompletion
45 * clears internal keyword map and calls KCompletion::clear.
50 * uses KCompletion::makeCompletion to find email addresses which starts
51 * with string. ignores keywords.
53 * @returns email address
55 QString
makeCompletion( const QString
&string
);
58 * specify keywords for email.
60 * Items may be added with KCompletion::addItem, those will only be
61 * returned as match if they are in one of these formats:
62 * \li contains localpart@domain
63 * \li contains <email>
64 * or if they have also been added with this function.
66 void addItemWithKeys( const QString
&email
, int weight
, const QStringList
*keyWords
);
69 * use internal map to replace all keywords in pMatches with corresponding
72 virtual void postProcessMatches( QStringList
*pMatches
) const;
74 // We are not using allWeightedMatches() anywhere, therefore we don't need
75 // to override the other postProcessMatches() function
76 using KCompletion::postProcessMatches
;
79 QMap
< QString
, QStringList
> m_keyMap
;