kaddressbook
contactlistview.h00001
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 class KIMProxy;
00040
00044 class DynamicTip : public QToolTip
00045 {
00046 public:
00047 DynamicTip( ContactListView * parent );
00048
00049 protected:
00050 void maybeTip( const QPoint & );
00051
00052 private:
00053 };
00054
00055 class ContactListViewItem : public KListViewItem
00056 {
00057
00058 public:
00059 ContactListViewItem(const KABC::Addressee &a, ContactListView* parent,
00060 KABC::AddressBook *doc, const KABC::Field::List &fields, KIMProxy *proxy );
00061 const KABC::Addressee &addressee() const { return mAddressee; }
00062 virtual void refresh();
00063 virtual ContactListView* parent();
00064 virtual QString key ( int, bool ) const;
00065 void setHasIM( bool hasIM );
00069 virtual void paintCell(QPainter * p, const QColorGroup & cg,
00070 int column, int width, int align );
00071
00072 private:
00073 KABC::Addressee mAddressee;
00074 KABC::Field::List mFields;
00075 ContactListView *parentListView;
00076 KABC::AddressBook *mDocument;
00077 KIMProxy *mIMProxy;
00078 bool mHasIM;
00079 };
00080
00081
00083
00084
00085 class ContactListView : public KListView
00086 {
00087 Q_OBJECT
00088
00089 public:
00090 ContactListView(KAddressBookTableView *view,
00091 KABC::AddressBook *doc,
00092 QWidget *parent,
00093 const char *name = 0L );
00094 virtual ~ContactListView() {}
00095
00096
00099 bool tooltips() const { return mToolTips; }
00100 void setToolTipsEnabled(bool enabled) { mToolTips = enabled; }
00101
00102 bool alternateBackground() const { return mABackground; }
00103 void setAlternateBackgroundEnabled(bool enabled);
00104
00105 bool singleLine() const { return mSingleLine; }
00106 void setSingleLineEnabled(bool enabled) { mSingleLine = enabled; }
00107
00108 const QColor &alternateColor() const { return mAlternateColor; }
00109
00114 void setBackgroundPixmap(const QString &filename);
00115
00119 void setShowIM( bool enabled );
00120
00124 bool showIM();
00125
00132 void setIMColumn( int column );
00133
00137 int imColumn();
00138
00139 protected:
00143 virtual void paintEmptyArea( QPainter * p, const QRect & rect );
00144 virtual void contentsMousePressEvent(QMouseEvent*);
00145 void contentsMouseMoveEvent( QMouseEvent *e );
00146 void contentsDropEvent( QDropEvent *e );
00147 virtual bool acceptDrag(QDropEvent *e) const;
00148
00149 protected slots:
00150 void itemDropped(QDropEvent *e);
00151
00152 public slots:
00153
00154 signals:
00155 void startAddresseeDrag();
00156 void addresseeDropped(QDropEvent *);
00157
00158 private:
00159 KAddressBookTableView *pabWidget;
00160 int oldColumn;
00161 int column;
00162 bool ascending;
00163
00164 bool mABackground;
00165 bool mSingleLine;
00166 bool mToolTips;
00167 bool mShowIM;
00168
00169 QColor mAlternateColor;
00170
00171 QPoint presspos;
00172 int mInstantMsgColumn;
00173 };
00174
00175
00176 #endif
|