libtdepim

addresseeview.h
1 /*
2  This file is part of libtdepim.
3 
4  Copyright (c) 2003 Tobias Koenig <tokoe@kde.org>
5 
6  This library is free software; you can redistribute it and/or
7  modify it under the terms of the GNU Library General Public
8  License as published by the Free Software Foundation; either
9  version 2 of the License, or (at your option) any later version.
10 
11  This library is distributed in the hope that it will be useful,
12  but WITHOUT ANY WARRANTY; without even the implied warranty of
13  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14  Library General Public License for more details.
15 
16  You should have received a copy of the GNU Library General Public License
17  along with this library; see the file COPYING.LIB. If not, write to
18  the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
19  Boston, MA 02110-1301, USA.
20 */
21 
22 #ifndef KPIM_ADDRESSEEVIEW_H
23 #define KPIM_ADDRESSEEVIEW_H
24 
25 #include <tqcstring.h>
26 
27 #include <tdeabc/addressee.h>
28 #include <ktextbrowser.h>
29 #include <tdeimproxy.h>
30 #include <kdemacros.h>
31 
32 namespace TDEIO {
33 class Job;
34 }
35 class TDEToggleAction;
36 
37 class TQPopupMenu;
38 
39 
40 namespace KPIM {
41 
42 
43 class TDE_EXPORT AddresseeView : public KTextBrowser
44 {
45  TQ_OBJECT
46 
47  public:
54  AddresseeView( TQWidget *parent = 0, const char *name = 0,
55  TDEConfig *config = 0 );
56 
57  ~AddresseeView();
58 
64  void setAddressee( const TDEABC::Addressee& addr );
65 
69  TDEABC::Addressee addressee() const;
70 
71 
76  enum LinkMask {
77  NoLinks = 0,
78  AddressLinks = 1,
79  EmailLinks = 2,
80  PhoneLinks = 4,
81  URLLinks = 8,
82  IMLinks = 16,
83  DefaultLinks = AddressLinks | EmailLinks | PhoneLinks | URLLinks | IMLinks
84  };
85 
90  void enableLinks( int linkMask );
91 
96  enum FieldMask {
97  NoFields = 0,
98  BirthdayFields = 1,
99  AddressFields = 2,
100  EmailFields = 4,
101  PhoneFields = 8,
102  URLFields = 16,
103  IMFields = 32,
104  CustomFields = 64,
105  DefaultFields = AddressFields | EmailFields | PhoneFields | URLFields
106  };
107 
131  static TQString vCardAsHTML( const TDEABC::Addressee& addr, ::KIMProxy *proxy, LinkMask linkMask = DefaultLinks,
132  bool internalLoading = true, FieldMask fieldMask = DefaultFields );
133 
139  static TQString pixmapAsDataUrl( const TQPixmap& pixmap );
140 
141  signals:
142  void urlHighlighted( const TQString &url );
143  void emailHighlighted( const TQString &email );
144  void phoneNumberHighlighted( const TQString &number );
145  void faxNumberHighlighted( const TQString &number );
146 
147  void highlightedMessage( const TQString &message );
148 
149  void addressClicked( const TQString &uid );
150 
151  protected:
152  virtual void urlClicked( const TQString &url );
153  virtual void emailClicked( const TQString &mail );
154  virtual void phoneNumberClicked( const TQString &number );
155  virtual void smsTextClicked( const TQString &number );
156  virtual void sendSMS( const TQString &number, const TQString &msg );
157  virtual void faxNumberClicked( const TQString &number );
158  virtual void imAddressClicked();
159 
160  virtual TQPopupMenu *createPopupMenu( const TQPoint& );
161 
162  private slots:
163  void slotMailClicked( const TQString&, const TQString& );
164  void slotUrlClicked( const TQString& );
165  void slotHighlighted( const TQString& );
166  void slotPresenceChanged( const TQString & );
167  void slotPresenceInfoExpired();
168  void configChanged();
169 
170  void data( TDEIO::Job*, const TQByteArray& );
171  void result( TDEIO::Job* );
172 
173  private:
174  void load();
175  void save();
176 
177  void updateView();
178 
179  TQString strippedNumber( const TQString &number );
180 
181  TDEConfig *mConfig;
182  bool mDefaultConfig;
183 
184  TQByteArray mImageData;
185  TDEIO::Job *mImageJob;
186 
187  TDEToggleAction *mActionShowBirthday;
188  TDEToggleAction *mActionShowAddresses;
189  TDEToggleAction *mActionShowEmails;
190  TDEToggleAction *mActionShowPhones;
191  TDEToggleAction *mActionShowURLs;
192  TDEToggleAction *mActionShowIMAddresses;
193  TDEToggleAction *mActionShowCustomFields;
194 
195  TDEABC::Addressee mAddressee;
196  int mLinkMask;
197 
198  class AddresseeViewPrivate;
199  AddresseeViewPrivate *d;
200  ::KIMProxy *mKIMProxy;
201 };
202 
203 }
204 
205 #endif
TDEPIM classes for drag and drop of mails.