distributionlist.h
00001 /* 00002 This file is part of libtdepim. 00003 Copyright (c) 2004-2005 David Faure <faure@kde.org> 00004 00005 This library is free software; you can redistribute it and/or 00006 modify it under the terms of the GNU Library General Public 00007 License as published by the Free Software Foundation; either 00008 version 2 of the License, or (at your option) any later version. 00009 00010 This library is distributed in the hope that it will be useful, 00011 but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00013 Library General Public License for more details. 00014 00015 You should have received a copy of the GNU Library General Public License 00016 along with this library; see the file COPYING.LIB. If not, write to 00017 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 00018 Boston, MA 02110-1301, USA. 00019 */ 00020 00021 #ifndef DISTRIBUTIONLIST_H 00022 #define DISTRIBUTIONLIST_H 00023 00024 #include <tdeabc/addressee.h> 00025 00026 namespace TDEABC { 00027 class AddressBook; 00028 } 00029 00030 namespace KPIM { 00031 00043 class DistributionList : public TDEABC::Addressee 00044 { 00045 public: 00053 struct Entry 00054 { 00055 typedef TQValueList<Entry> List; 00056 00057 Entry() {} 00058 Entry( const Addressee &_addressee, const TQString &_email ) : 00059 addressee( _addressee ), email( _email ) {} 00060 00061 Addressee addressee; 00062 TQString email; 00063 }; 00064 00065 typedef TQValueList<DistributionList> List; 00066 00070 DistributionList(); 00075 DistributionList( const TDEABC::Addressee& addr ); 00076 00080 ~DistributionList() {} 00081 00083 void setName( const TQString &name ); 00084 00086 TQString name() const { return formattedName(); } 00087 00092 void insertEntry( const Addressee &, const TQString &email=TQString() ); 00093 00098 void removeEntry( const Addressee &, const TQString &email=TQString() ); 00099 00101 void insertEntry( const TQString& uid, const TQString& email=TQString() ); 00103 void removeEntry( const TQString& uid, const TQString& email=TQString() ); 00104 00105 00111 TQStringList emails( TDEABC::AddressBook* book ) const; 00112 00118 Entry::List entries( TDEABC::AddressBook* book ) const; 00119 00120 // KDE4: should be a method of Addressee 00121 static bool isDistributionList( const TDEABC::Addressee& addr ); 00122 00123 // KDE4: should be a method of AddressBook 00124 static DistributionList findByName( TDEABC::AddressBook* book, 00125 const TQString& name, 00126 bool caseSensitive = true ); 00127 // KDE4: should be a method of AddressBook 00128 // A bit slow (but no more than findByName). 00129 // From KAddressbook, use Core::distributionLists() instead. 00130 static TQValueList<DistributionList> allDistributionLists( TDEABC::AddressBook* book ); 00131 00132 00133 private: 00134 // can't have any data here, use Addressee's methods instead 00135 }; 00136 00137 } 00138 00139 #endif /* DISTRIBUTIONLIST_H */ 00140