kaddressbook Library API Documentation

contactlistview.h

00001 #ifndef CONTACTLISTVIEW_H
00002 #define CONTACTLISTVIEW_H
00003 
00004 #include <qcolor.h>
00005 #include <qpixmap.h>
00006 #include <qtooltip.h>
00007 #include <qstring.h>
00008 
00009 #include <klistview.h>
00010 
00011 #include <kabc/field.h>
00012 
00013 class QDropEvent;
00014 class KAddressBookTableView;
00015 class ContactListView;
00016 
00020 class DynamicTip : public QToolTip
00021 {
00022   public:
00023     DynamicTip( ContactListView * parent );
00024 
00025   protected:
00026     void maybeTip( const QPoint & );
00027     
00028   private:
00029 };
00030 
00031 class ContactListViewItem : public KListViewItem
00032 {
00033 
00034 public:
00035   ContactListViewItem(const KABC::Addressee &a, ContactListView* parent, 
00036                       KABC::AddressBook *doc, const KABC::Field::List &fields );
00037   const KABC::Addressee &addressee() const { return mAddressee; }
00038   virtual void refresh();
00039   virtual ContactListView* parent();
00040   virtual QString key ( int, bool ) const;
00041   
00045   virtual void paintCell(QPainter * p, const QColorGroup & cg, 
00046                          int column, int width, int align );
00047 
00048 private:
00049   KABC::Addressee mAddressee;
00050   KABC::Field::List mFields;
00051   ContactListView *parentListView;
00052   KABC::AddressBook *mDocument;
00053 };
00054 
00055 
00057 // ContactListView
00058 
00059 class ContactListView : public KListView
00060 {
00061   Q_OBJECT
00062 
00063 public:
00064   ContactListView(KAddressBookTableView *view, 
00065                   KABC::AddressBook *doc,
00066                   QWidget *parent, 
00067                   const char *name = 0L );
00068   virtual ~ContactListView() {}
00069   //void resort();
00070   
00073   bool tooltips() const { return mToolTips; }
00074   void setToolTipsEnabled(bool enabled) { mToolTips = enabled; }
00075   
00076   bool alternateBackground() const { return mABackground; }
00077   void setAlternateBackgroundEnabled(bool enabled);
00078   
00079   bool singleLine() const { return mSingleLine; }
00080   void setSingleLineEnabled(bool enabled) { mSingleLine = enabled; }
00081   
00082   const QColor &alternateColor() const { return mAlternateColor; }
00083   
00088   void setBackgroundPixmap(const QString &filename);
00089 
00090 protected:
00094   virtual void paintEmptyArea( QPainter * p, const QRect & rect );
00095   virtual void contentsMousePressEvent(QMouseEvent*);
00096   void contentsMouseMoveEvent( QMouseEvent *e );
00097   void contentsDropEvent( QDropEvent *e );
00098   virtual bool acceptDrag(QDropEvent *e) const;
00099 
00100 protected slots:
00101   void itemDropped(QDropEvent *e);
00102   
00103 public slots:
00104 
00105 signals:
00106   void startAddresseeDrag();
00107   void addresseeDropped(QDropEvent *);
00108   
00109 private:
00110   KAddressBookTableView *pabWidget;
00111   int oldColumn;
00112   int column;
00113   bool ascending;
00114 
00115   bool mABackground;
00116   bool mSingleLine;
00117   bool mToolTips;
00118 
00119   QColor mAlternateColor;
00120   
00121   QPoint presspos;
00122 };
00123 
00124 
00125 #endif
KDE Logo
This file is part of the documentation for kdelibs Version 3.1.5.
Documentation copyright © 1996-2002 the KDE developers.
Generated on Sun Feb 15 11:40:36 2004 by doxygen 1.3.5 written by Dimitri van Heesch, © 1997-2001