libtdepim

distributionlist.h
1 /*
2  This file is part of libtdepim.
3  Copyright (c) 2004-2005 David Faure <faure@kde.org>
4 
5  This library is free software; you can redistribute it and/or
6  modify it under the terms of the GNU Library General Public
7  License as published by the Free Software Foundation; either
8  version 2 of the License, or (at your option) any later version.
9 
10  This library is distributed in the hope that it will be useful,
11  but WITHOUT ANY WARRANTY; without even the implied warranty of
12  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13  Library General Public License for more details.
14 
15  You should have received a copy of the GNU Library General Public License
16  along with this library; see the file COPYING.LIB. If not, write to
17  the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18  Boston, MA 02110-1301, USA.
19 */
20 
21 #ifndef DISTRIBUTIONLIST_H
22 #define DISTRIBUTIONLIST_H
23 
24 #include <tdeabc/addressee.h>
25 
26 namespace TDEABC {
27 class AddressBook;
28 }
29 
30 namespace KPIM {
31 
43 class DistributionList : public TDEABC::Addressee
44 {
45  public:
53  struct Entry
54  {
55  typedef TQValueList<Entry> List;
56 
57  Entry() {}
58  Entry( const Addressee &_addressee, const TQString &_email ) :
59  addressee( _addressee ), email( _email ) {}
60 
61  Addressee addressee;
62  TQString email;
63  };
64 
65  typedef TQValueList<DistributionList> List;
66 
75  DistributionList( const TDEABC::Addressee& addr );
76 
81 
83  void setName( const TQString &name );
84 
86  TQString name() const { return formattedName(); }
87 
92  void insertEntry( const Addressee &, const TQString &email=TQString() );
93 
98  void removeEntry( const Addressee &, const TQString &email=TQString() );
99 
101  void insertEntry( const TQString& uid, const TQString& email=TQString() );
103  void removeEntry( const TQString& uid, const TQString& email=TQString() );
104 
105 
111  TQStringList emails( TDEABC::AddressBook* book ) const;
112 
118  Entry::List entries( TDEABC::AddressBook* book ) const;
119 
120  // KDE4: should be a method of Addressee
121  static bool isDistributionList( const TDEABC::Addressee& addr );
122 
123  // KDE4: should be a method of AddressBook
124  static DistributionList findByName( TDEABC::AddressBook* book,
125  const TQString& name,
126  bool caseSensitive = true );
127  // KDE4: should be a method of AddressBook
128  // A bit slow (but no more than findByName).
129  // From KAddressbook, use Core::distributionLists() instead.
130  static TQValueList<DistributionList> allDistributionLists( TDEABC::AddressBook* book );
131 
132 
133  private:
134  // can't have any data here, use Addressee's methods instead
135 };
136 
137 }
138 
139 #endif /* DISTRIBUTIONLIST_H */
140 
Distribution list of email addresses.
void insertEntry(const Addressee &, const TQString &email=TQString())
Insert an entry into this distribution list.
void setName(const TQString &name)
HACK: reimplemented from Addressee, but it's NOT virtual there.
void removeEntry(const Addressee &, const TQString &email=TQString())
Remove an entry from this distribution list.
DistributionList()
Create a distribution list.
Entry::List entries(TDEABC::AddressBook *book) const
Return list of entries belonging to this distribution list.
~DistributionList()
Destructor.
TQString name() const
HACK: reimplemented from Addressee, but it's NOT virtual there.
TQStringList emails(TDEABC::AddressBook *book) const
Return list of email addresses, which belong to this distributon list.
TDEPIM classes for drag and drop of mails.
Distribution List Entry.