kaddressbook Library API Documentation

contactlistview.h

00001 /* 00002 This file is part of KAddressBook. 00003 Copyright (c) 2002 Mike Pilone <mpilone@slac.com> 00004 00005 This program is free software; you can redistribute it and/or modify 00006 it under the terms of the GNU General Public License as published by 00007 the Free Software Foundation; either version 2 of the License, or 00008 (at your option) any later version. 00009 00010 This program is distributed in the hope that it will be useful, 00011 but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00013 GNU General Public License for more details. 00014 00015 You should have received a copy of the GNU General Public License 00016 along with this program; if not, write to the Free Software 00017 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 00018 00019 As a special exception, permission is given to link this program 00020 with any edition of Qt, and distribute the resulting executable, 00021 without including the source code for Qt in the source distribution. 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 // ContactListView 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 //void resort(); 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
KDE Logo
This file is part of the documentation for kaddressbook Library Version 3.2.2.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Wed Jul 28 23:58:08 2004 by doxygen 1.3.7 written by Dimitri van Heesch, © 1997-2003