libtdepim

recentaddresses.h
1 /*
2  *
3  * Copyright (c) 2001-2003 Carsten Pfeiffer <pfeiffer@kde.org>
4  * Copyright (c) 2003 Zack Rusin <zack@kde.org>
5  *
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.
9  *
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.
14  *
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
18  *
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 TQt library by Trolltech AS, Norway (or with modified versions
22  * of TQt that use the same license as TQt), 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  * TQt. 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
28  * your version.
29  */
30 #ifndef RECENTADDRESSES_H
31 #define RECENTADDRESSES_H
32 
33 #include <tqstringlist.h>
34 #include <tdeabc/addressee.h>
35 
36 #include <kdialogbase.h>
37 
38 #include <tdemacros.h>
39 
40 class TDEConfig;
41 class KEditListBox;
42 namespace TDERecentAddress {
43 
44 class TDE_EXPORT RecentAddressDialog : public KDialogBase
45 {
46  public:
47  RecentAddressDialog( TQWidget *parent, const char *name = 0 );
48  void setAddresses( const TQStringList &addrs );
49  TQStringList addresses() const;
50  private:
51  KEditListBox *mEditor;
52 };
53 
61 class TDE_EXPORT RecentAddresses
62 {
63 public:
64  ~RecentAddresses();
68  static RecentAddresses * self(TDEConfig *config = 0L);
69 
70  /*
71  * @return true if self() was called, i.e. a RecentAddresses instance exists
72  */
73  static bool exists() { return s_self != 0; }
74 
80  TQStringList addresses() const;
81  const TDEABC::Addressee::List& tdeabcAddresses() const { return m_addresseeList; }
82 
88  void add( const TQString& entry );
89 
94  void setMaxCount( int count );
95 
99  uint maxCount() const { return m_maxCount; }
100 
105  void load( TDEConfig * );
106 
111  void save( TDEConfig * );
112 
116  void clear();
117 
118 private:
119  RecentAddresses(TDEConfig *config = 0L);
120 
121  TDEABC::Addressee::List m_addresseeList;
122 
123  void adjustSize();
124 
125  uint m_maxCount;
126 
127  static RecentAddresses *s_self;
128 };
129 
130 }
131 
132 #endif // KMRECENTADDR_H
Handles a list of "recent email-addresses".