libkdepim

addresseeview.h

00001 /*
00002     This file is part of libkdepim.
00003 
00004     Copyright (c) 2003 Tobias Koenig <tokoe@kde.org>
00005 
00006     This library is free software; you can redistribute it and/or
00007     modify it under the terms of the GNU Library General Public
00008     License as published by the Free Software Foundation; either
00009     version 2 of the License, or (at your option) any later version.
00010 
00011     This library is distributed in the hope that it will be useful,
00012     but WITHOUT ANY WARRANTY; without even the implied warranty of
00013     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00014     Library General Public License for more details.
00015 
00016     You should have received a copy of the GNU Library General Public License
00017     along with this library; see the file COPYING.LIB.  If not, write to
00018     the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
00019     Boston, MA 02110-1301, USA.
00020 */
00021 
00022 #ifndef KPIM_ADDRESSEEVIEW_H
00023 #define KPIM_ADDRESSEEVIEW_H
00024 
00025 #include <qcstring.h>
00026 
00027 #include <kabc/addressee.h>
00028 #include <ktextbrowser.h>
00029 #include <kimproxy.h>
00030 #include <kdepimmacros.h>
00031 
00032 namespace KIO {
00033 class Job;
00034 }
00035 class KToggleAction;
00036 
00037 class QPopupMenu;
00038 
00039 
00040 namespace KPIM {
00041 
00042 
00043 class KDE_EXPORT AddresseeView : public KTextBrowser
00044 {
00045   Q_OBJECT
00046   public:
00053     AddresseeView( QWidget *parent = 0, const char *name = 0,
00054                    KConfig *config = 0 );
00055 
00056     ~AddresseeView();
00057 
00063     void setAddressee( const KABC::Addressee& addr );
00064 
00068     KABC::Addressee addressee() const;
00069 
00070 
00075     enum LinkMask {
00076       NoLinks = 0,
00077       AddressLinks = 1,
00078       EmailLinks = 2,
00079       PhoneLinks = 4,
00080       URLLinks = 8,
00081       IMLinks = 16,
00082       DefaultLinks = AddressLinks | EmailLinks | PhoneLinks | URLLinks | IMLinks
00083     };
00084 
00089     void enableLinks( int linkMask );
00090 
00095     enum FieldMask {
00096       NoFields = 0,
00097       BirthdayFields = 1,
00098       AddressFields = 2,
00099       EmailFields = 4,
00100       PhoneFields = 8,
00101       URLFields = 16,
00102       IMFields = 32,
00103       CustomFields = 64,
00104       DefaultFields = AddressFields | EmailFields | PhoneFields | URLFields
00105     };
00106 
00130     static QString vCardAsHTML( const KABC::Addressee& addr, ::KIMProxy *proxy, LinkMask linkMask = DefaultLinks,
00131                                 bool internalLoading = true, FieldMask fieldMask = DefaultFields );
00132 
00138     static QString pixmapAsDataUrl( const QPixmap& pixmap );
00139 
00140   signals:
00141     void urlHighlighted( const QString &url );
00142     void emailHighlighted( const QString &email );
00143     void phoneNumberHighlighted( const QString &number );
00144     void faxNumberHighlighted( const QString &number );
00145 
00146     void highlightedMessage( const QString &message );
00147 
00148     void addressClicked( const QString &uid );
00149 
00150   protected:
00151     virtual void urlClicked( const QString &url );
00152     virtual void emailClicked( const QString &mail );
00153     virtual void phoneNumberClicked( const QString &number );
00154     virtual void smsTextClicked( const QString &number );
00155     virtual void sendSMS( const QString &number, const QString &msg );
00156     virtual void faxNumberClicked( const QString &number );
00157     virtual void imAddressClicked();
00158 
00159     virtual QPopupMenu *createPopupMenu( const QPoint& );
00160 
00161   private slots:
00162     void slotMailClicked( const QString&, const QString& );
00163     void slotUrlClicked( const QString& );
00164     void slotHighlighted( const QString& );
00165     void slotPresenceChanged( const QString & );
00166     void slotPresenceInfoExpired();
00167     void configChanged();
00168 
00169     void data( KIO::Job*, const QByteArray& );
00170     void result( KIO::Job* );
00171 
00172   private:
00173     void load();
00174     void save();
00175 
00176     void updateView();
00177 
00178     QString strippedNumber( const QString &number );
00179 
00180     KConfig *mConfig;
00181     bool mDefaultConfig;
00182 
00183     QByteArray mImageData;
00184     KIO::Job *mImageJob;
00185 
00186     KToggleAction *mActionShowBirthday;
00187     KToggleAction *mActionShowAddresses;
00188     KToggleAction *mActionShowEmails;
00189     KToggleAction *mActionShowPhones;
00190     KToggleAction *mActionShowURLs;
00191     KToggleAction *mActionShowIMAddresses;
00192     KToggleAction *mActionShowCustomFields;
00193 
00194     KABC::Addressee mAddressee;
00195     int mLinkMask;
00196 
00197     class AddresseeViewPrivate;
00198     AddresseeViewPrivate *d;
00199     ::KIMProxy *mKIMProxy;
00200 };
00201 
00202 }
00203 
00204 #endif
KDE Home | KDE Accessibility Home | Description of Access Keys