libkdepim Library API Documentation

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., 59 Temple Place - Suite 330,
00019     Boston, MA 02111-1307, 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 
00031 namespace KIO {
00032 class Job;
00033 }
00034 class KToggleAction;
00035 
00036 class QPopupMenu;
00037 
00038 
00039 namespace KPIM {
00040 
00041 
00042 class AddresseeView : public KTextBrowser
00043 {
00044   Q_OBJECT
00045   public:
00052     AddresseeView( QWidget *parent = 0, const char *name = 0,
00053                    KConfig *config = 0 );
00054 
00055     ~AddresseeView();
00056 
00062     void setAddressee( const KABC::Addressee& addr );
00063 
00067     KABC::Addressee addressee() const;
00068 
00069 
00074     enum LinkMask { AddressLinks = 1, EmailLinks = 2, PhoneLinks = 4, URLLinks = 8, IMLinks = 16 };
00075 
00080     void enableLinks( int linkMask );
00081 
00107     static QString vCardAsHTML( const KABC::Addressee& addr, ::KIMProxy *proxy, int linkMask = true,
00108                                 bool internalLoading = true,
00109                                 bool showBirthday = true, bool showAddresses = true,
00110                                 bool showEmails = true, bool showPhones = true,
00111                                 bool showURLs = true, bool showIMAddresses = true );
00117     static QString pixmapAsDataUrl( const QPixmap& pixmap );
00118 
00119   signals:
00120     void urlHighlighted( const QString &url );
00121     void emailHighlighted( const QString &email );
00122     void phoneNumberHighlighted( const QString &number );
00123     void faxNumberHighlighted( const QString &number );
00124 
00125     void highlightedMessage( const QString &message );
00126 
00127     void addressClicked( const QString &uid );
00128 
00129   protected:
00130     virtual void urlClicked( const QString &url );
00131     virtual void emailClicked( const QString &mail );
00132     virtual void phoneNumberClicked( const QString &number );
00133     virtual void faxNumberClicked( const QString &number );
00134     virtual void imAddressClicked();
00135     
00136     virtual QPopupMenu *createPopupMenu( const QPoint& );
00137 
00138   private slots:
00139     void slotMailClicked( const QString&, const QString& );
00140     void slotUrlClicked( const QString& );
00141     void slotHighlighted( const QString& );
00142     void slotPresenceChanged( const QString & );
00143     void slotPresenceInfoExpired();
00144     void configChanged();
00145 
00146     void data( KIO::Job*, const QByteArray& );
00147     void result( KIO::Job* );
00148 
00149   private:
00150     void load();
00151     void save();
00152 
00153     void updateView();
00154 
00155     QString strippedNumber( const QString &number );
00156 
00157     KConfig *mConfig;
00158     bool mDefaultConfig;
00159 
00160     QByteArray mImageData;
00161     KIO::Job *mImageJob;
00162 
00163     KToggleAction *mActionShowBirthday;
00164     KToggleAction *mActionShowAddresses;
00165     KToggleAction *mActionShowEmails;
00166     KToggleAction *mActionShowPhones;
00167     KToggleAction *mActionShowURLs;
00168 
00169     KABC::Addressee mAddressee;
00170     int mLinkMask;
00171 
00172     class AddresseeViewPrivate;
00173     AddresseeViewPrivate *d;
00174     ::KIMProxy *mKIMProxy;
00175 };
00176 
00177 }
00178 
00179 #endif
KDE Logo
This file is part of the documentation for libkdepim Library Version 3.3.2.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Mon Apr 4 04:46:32 2005 by doxygen 1.3.9.1 written by Dimitri van Heesch, © 1997-2003