contactlistview.h
00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024 #ifndef CONTACTLISTVIEW_H
00025 #define CONTACTLISTVIEW_H
00026
00027 #include <qcolor.h>
00028 #include <qpixmap.h>
00029 #include <qtooltip.h>
00030 #include <qstring.h>
00031
00032 #include <klistview.h>
00033
00034 #include <kabc/field.h>
00035
00036 class QDropEvent;
00037 class KAddressBookTableView;
00038 class ContactListView;
00039
00043 class DynamicTip : public QToolTip
00044 {
00045 public:
00046 DynamicTip( ContactListView * parent );
00047
00048 protected:
00049 void maybeTip( const QPoint & );
00050
00051 private:
00052 };
00053
00054 class ContactListViewItem : public KListViewItem
00055 {
00056
00057 public:
00058 ContactListViewItem(const KABC::Addressee &a, ContactListView* parent,
00059 KABC::AddressBook *doc, const KABC::Field::List &fields );
00060 const KABC::Addressee &addressee() const { return mAddressee; }
00061 virtual void refresh();
00062 virtual ContactListView* parent();
00063 virtual QString key ( int, bool ) const;
00064
00068 virtual void paintCell(QPainter * p, const QColorGroup & cg,
00069 int column, int width, int align );
00070
00071 private:
00072 KABC::Addressee mAddressee;
00073 KABC::Field::List mFields;
00074 ContactListView *parentListView;
00075 KABC::AddressBook *mDocument;
00076 };
00077
00078
00080
00081
00082 class ContactListView : public KListView
00083 {
00084 Q_OBJECT
00085
00086 public:
00087 ContactListView(KAddressBookTableView *view,
00088 KABC::AddressBook *doc,
00089 QWidget *parent,
00090 const char *name = 0L );
00091 virtual ~ContactListView() {}
00092
00093
00096 bool tooltips() const { return mToolTips; }
00097 void setToolTipsEnabled(bool enabled) { mToolTips = enabled; }
00098
00099 bool alternateBackground() const { return mABackground; }
00100 void setAlternateBackgroundEnabled(bool enabled);
00101
00102 bool singleLine() const { return mSingleLine; }
00103 void setSingleLineEnabled(bool enabled) { mSingleLine = enabled; }
00104
00105 const QColor &alternateColor() const { return mAlternateColor; }
00106
00111 void setBackgroundPixmap(const QString &filename);
00112
00113 protected:
00117 virtual void paintEmptyArea( QPainter * p, const QRect & rect );
00118 virtual void contentsMousePressEvent(QMouseEvent*);
00119 void contentsMouseMoveEvent( QMouseEvent *e );
00120 void contentsDropEvent( QDropEvent *e );
00121 virtual bool acceptDrag(QDropEvent *e) const;
00122
00123 protected slots:
00124 void itemDropped(QDropEvent *e);
00125
00126 public slots:
00127
00128 signals:
00129 void startAddresseeDrag();
00130 void addresseeDropped(QDropEvent *);
00131
00132 private:
00133 KAddressBookTableView *pabWidget;
00134 int oldColumn;
00135 int column;
00136 bool ascending;
00137
00138 bool mABackground;
00139 bool mSingleLine;
00140 bool mToolTips;
00141
00142 QColor mAlternateColor;
00143
00144 QPoint presspos;
00145 };
00146
00147
00148 #endif
This file is part of the documentation for kaddressbook Library Version 3.2.2.