recentaddresses.h
00001 /* -*- mode: C++; c-file-style: "gnu" -*- 00002 * 00003 * Copyright (c) 2001-2003 Carsten Pfeiffer <pfeiffer@kde.org> 00004 * Copyright (c) 2003 Zack Rusin <zack@kde.org> 00005 * 00006 * KMail is free software; you can redistribute it and/or modify it 00007 * under the terms of the GNU General Public License, version 2, as 00008 * published by the Free Software Foundation. 00009 * 00010 * KMail is distributed in the hope that it will be useful, but 00011 * WITHOUT ANY WARRANTY; without even the implied warranty of 00012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00013 * General Public License for more details. 00014 * 00015 * You should have received a copy of the GNU General Public License 00016 * along with this program; if not, write to the Free Software 00017 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 00018 * 00019 * In addition, as a special exception, the copyright holders give 00020 * permission to link the code of this program with any edition of 00021 * the TQt library by Trolltech AS, Norway (or with modified versions 00022 * of TQt that use the same license as TQt), and distribute linked 00023 * combinations including the two. You must obey the GNU General 00024 * Public License in all respects for all of the code used other than 00025 * TQt. If you modify this file, you may extend this exception to 00026 * your version of the file, but you are not obligated to do so. If 00027 * you do not wish to do so, delete this exception statement from 00028 * your version. 00029 */ 00030 #ifndef RECENTADDRESSES_H 00031 #define RECENTADDRESSES_H 00032 00033 #include <tqstringlist.h> 00034 #include <tdeabc/addressee.h> 00035 00036 #include <kdialogbase.h> 00037 00038 #include <tdepimmacros.h> 00039 00040 class TDEConfig; 00041 class KEditListBox; 00042 namespace TDERecentAddress { 00043 00044 class KDE_EXPORT RecentAddressDialog : public KDialogBase 00045 { 00046 public: 00047 RecentAddressDialog( TQWidget *parent, const char *name = 0 ); 00048 void setAddresses( const TQStringList &addrs ); 00049 TQStringList addresses() const; 00050 private: 00051 KEditListBox *mEditor; 00052 }; 00053 00061 class KDE_EXPORT RecentAddresses 00062 { 00063 public: 00064 ~RecentAddresses(); 00068 static RecentAddresses * self(TDEConfig *config = 0L); 00069 00070 /* 00071 * @return true if self() was called, i.e. a RecentAddresses instance exists 00072 */ 00073 static bool exists() { return s_self != 0; } 00074 00080 TQStringList addresses() const; 00081 const TDEABC::Addressee::List& tdeabcAddresses() const { return m_addresseeList; } 00082 00088 void add( const TQString& entry ); 00089 00094 void setMaxCount( int count ); 00095 00099 uint maxCount() const { return m_maxCount; } 00100 00105 void load( TDEConfig * ); 00106 00111 void save( TDEConfig * ); 00112 00116 void clear(); 00117 00118 private: 00119 RecentAddresses(TDEConfig *config = 0L); 00120 00121 TDEABC::Addressee::List m_addresseeList; 00122 00123 void adjustSize(); 00124 00125 uint m_maxCount; 00126 00127 static RecentAddresses *s_self; 00128 }; 00129 00130 } 00131 00132 #endif // KMRECENTADDR_H