2 This file is part of libkdepim.
4 Copyright (c) 2003 Tobias Koenig <tokoe@kde.org>
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.
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.
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.
22 #ifndef KDEPIM_ADDRESSEEVIEW_H
23 #define KDEPIM_ADDRESSEEVIEW_H
25 #include "kdepim_export.h"
27 #include <kabc/addressee.h>
30 #include <KTextBrowser>
45 class KDEPIM_EXPORT AddresseeView
: public KTextBrowser
52 @param config The config object where the settings are stored
53 which fields will be shown.
55 explicit AddresseeView( QWidget
*parent
= 0, KConfig
*config
= 0 );
60 Sets the addressee object. The addressee is displayed immediately.
62 @param addr The addressee object.
64 void setAddressee( const KABC::Addressee
& addr
);
67 Returns the current addressee object.
69 KABC::Addressee
addressee() const;
73 This enums are used by enableLinks to set which kind of links shall
83 DefaultLinks
= AddressLinks
| EmailLinks
| PhoneLinks
| URLLinks
| IMLinks
87 Sets which parts of the contact shall be presented as links.
88 The mask can be OR'ed LinkMask. By default all links are enabled.
90 void enableLinks( int linkMask
);
93 This enums are used by vCardAsHTML to decide which fields shall be
105 DefaultFields
= AddressFields
| EmailFields
| PhoneFields
| URLFields
109 Returns the HTML representation of a contact.
110 The HTML code looks like
117 @param addr The addressee object.
118 @param linkMask The mask for which parts of the contact will
119 be displayed as links.
120 The links looks like this:
121 "addr://<addr id>" for addresses
122 "mailto:<email address>" for emails
123 "phone://<phone number>" for phone numbers
124 "http://<url>" for urls
125 "im:<im addrss>" for instant messaging addresses
126 "sms://<phone number>" for sending a sms
127 @param internalLoading If true, the loading of internal pictures is done automatically.
128 @param fieldMask The mask for which fields of the contact will
131 static QString
vCardAsHTML( const KABC::Addressee
& addr
, ::KIMProxy
*proxy
, LinkMask linkMask
= DefaultLinks
,
132 bool internalLoading
= true, FieldMask fieldMask
= DefaultFields
);
135 * Encodes a QPixmap as a PNG into a data: URL (rfc2397), readable by the data kio protocol
136 * @param pixmap the pixmap to encode
137 * @return a data: URL
139 static QString
pixmapAsDataUrl( const QPixmap
& pixmap
);
142 void urlHighlighted( const QString
&url
);
143 void emailHighlighted( const QString
&email
);
144 void phoneNumberHighlighted( const QString
&number
);
145 void faxNumberHighlighted( const QString
&number
);
147 void highlightedMessage( const QString
&message
);
149 void addressClicked( const QString
&uid
);
152 virtual void urlClicked( const QString
&url
);
153 virtual void emailClicked( const QString
&mail
);
154 virtual void phoneNumberClicked( const QString
&number
);
155 virtual void smsTextClicked( const QString
&number
);
156 virtual void sendSMS( const QString
&number
, const QString
&msg
);
157 virtual void faxNumberClicked( const QString
&number
);
158 virtual void imAddressClicked();
159 virtual void contextMenuEvent( QContextMenuEvent
*e
);
163 void slotMailClicked( const QString
&, const QString
& );
164 void slotUrlClicked( const QString
& );
165 void slotHighlighted( const QString
& );
166 void slotPresenceChanged( const QString
& );
167 void slotPresenceInfoExpired();
168 void configChanged();
170 void data( KIO::Job
*, const QByteArray
& );
171 void result( KJob
* );
179 QString
strippedNumber( const QString
&number
);
184 QByteArray mImageData
;
187 KToggleAction
*mActionShowBirthday
;
188 KToggleAction
*mActionShowAddresses
;
189 KToggleAction
*mActionShowEmails
;
190 KToggleAction
*mActionShowPhones
;
191 KToggleAction
*mActionShowURLs
;
192 KToggleAction
*mActionShowIMAddresses
;
193 KToggleAction
*mActionShowCustomFields
;
195 KABC::Addressee mAddressee
;
198 class AddresseeViewPrivate
;
199 AddresseeViewPrivate
*d
;
200 ::KIMProxy
*mKIMProxy
;