1 /* -*- mode: C++; c-file-style: "gnu" -*-
3 * Copyright (c) 2001-2003 Carsten Pfeiffer <pfeiffer@kde.org>
4 * Copyright (c) 2003 Zack Rusin <zack@kde.org>
6 * KMail is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License, version 2, as
8 * published by the Free Software Foundation.
10 * KMail is distributed in the hope that it will be useful, but
11 * WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19 * In addition, as a special exception, the copyright holders give
20 * permission to link the code of this program with any edition of
21 * the Qt library by Trolltech AS, Norway (or with modified versions
22 * of Qt that use the same license as Qt), and distribute linked
23 * combinations including the two. You must obey the GNU General
24 * Public License in all respects for all of the code used other than
25 * Qt. If you modify this file, you may extend this exception to
26 * your version of the file, but you are not obligated to do so. If
27 * you do not wish to do so, delete this exception statement from
30 #ifndef KDEPIM_RECENTADDRESSES_H
31 #define KDEPIM_RECENTADDRESSES_H
33 #include "kdepim_export.h"
34 #include <kabc/addressee.h>
36 #include <QStringList>
40 class KEditListWidget
;
44 class KDEPIM_EXPORT RecentAddressDialog
: public KDialog
47 RecentAddressDialog( QWidget
*parent
);
48 void setAddresses( const QStringList
&addrs
);
49 QStringList
addresses() const;
52 KEditListWidget
*mEditor
;
56 * Handles a list of "recent email-addresses". Simply set a max-count and
57 * call @ref add() to add entries.
59 * @author Carsten Pfeiffer <pfeiffer@kde.org>
62 class KDEPIM_EXPORT RecentAddresses
67 * @returns the only possible instance of this class.
69 static RecentAddresses
*self( KConfig
*config
= 0 );
72 * @return true if self() was called, i.e. a RecentAddresses instance exists
77 * @returns the list of recent addresses.
78 * Note: an entry doesn't have to be one email address, it can be multiple,
79 * like "Foo <foo@bar.org>, Bar Baz <bar@baz.org>".
81 QStringList
addresses() const;
82 const KABC::Addressee::List
&kabcAddresses() const
83 { return m_addresseeList
; }
86 * Adds an entry to the list.
87 * Note: an entry doesn't have to be one email address, it can be multiple,
88 * like "Foo <foo@bar.org>, Bar Baz <bar@baz.org>".
90 void add( const QString
&entry
);
93 * Sets the maximum number, the list can hold. The list adjusts to this
94 * size if necessary. Default maximum is 40.
96 void setMaxCount( int count
);
99 * @returns the current maximum number of entries.
101 uint
maxCount() const { return m_maxCount
; }
104 * Loads the list of recently used addresses from the configfile.
105 * Automatically done on startup.
107 void load( KConfig
* );
110 * Saves the list of recently used addresses to the configfile.
111 * Make sure to call KGlobal::config()->sync() afterwards, to really save.
113 void save( KConfig
* );
116 * Removes all entries from the history.
121 RecentAddresses( KConfig
*config
= 0 );
123 KABC::Addressee::List m_addresseeList
;