kaddressbook

contactlistview.h
1 /*
2  This file is part of KAddressBook.
3  Copyright (c) 2002 Mike Pilone <mpilone@slac.com>
4 
5  This program is free software; you can redistribute it and/or modify
6  it under the terms of the GNU General Public License as published by
7  the Free Software Foundation; either version 2 of the License, or
8  (at your option) any later version.
9 
10  This program is distributed in the hope that it will be useful,
11  but WITHOUT ANY WARRANTY; without even the implied warranty of
12  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  GNU General Public License for more details.
14 
15  You should have received a copy of the GNU General Public License
16  along with this program; if not, write to the Free Software
17  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18 
19  As a special exception, permission is given to link this program
20  with any edition of TQt, and distribute the resulting executable,
21  without including the source code for TQt in the source distribution.
22 */
23 
24 #ifndef CONTACTLISTVIEW_H
25 #define CONTACTLISTVIEW_H
26 
27 #include <tqcolor.h>
28 #include <tqpixmap.h>
29 #include <tqtooltip.h>
30 #include <tqstring.h>
31 
32 #include <tdelistview.h>
33 
34 #include <tdeabc/field.h>
35 
36 class TQDropEvent;
38 class ContactListView;
39 class KIMProxy;
40 
44 class DynamicTip : public TQToolTip
45 {
46  public:
47  DynamicTip( ContactListView * parent );
48 
49  protected:
50  void maybeTip( const TQPoint & );
51 
52  private:
53 };
54 
55 class ContactListViewItem : public TDEListViewItem
56 {
57 
58 public:
59  ContactListViewItem(const TDEABC::Addressee &a, ContactListView* parent,
60  TDEABC::AddressBook *doc, const TDEABC::Field::List &fields, KIMProxy *proxy );
61  const TDEABC::Addressee &addressee() const { return mAddressee; }
62  virtual void refresh();
63  virtual ContactListView* parent();
64  virtual TQString key ( int, bool ) const;
65  void setHasIM( bool hasIM );
69  virtual void paintCell(TQPainter * p, const TQColorGroup & cg,
70  int column, int width, int align );
71 
72 private:
73  TDEABC::Addressee mAddressee;
74  TDEABC::Field::List mFields;
75  ContactListView *parentListView;
76  TDEABC::AddressBook *mDocument;
77  KIMProxy *mIMProxy;
78  bool mHasIM;
79 };
80 
81 
83 // ContactListView
84 
85 class ContactListView : public TDEListView
86 {
87  TQ_OBJECT
88 
89 
90 public:
91  ContactListView(KAddressBookTableView *view,
92  TDEABC::AddressBook *doc,
93  TQWidget *parent,
94  const char *name = 0L );
95  virtual ~ContactListView() {}
96  //void resort();
97 
100  bool tooltips() const { return mToolTips; }
101  void setToolTipsEnabled(bool enabled) { mToolTips = enabled; }
102 
103  bool alternateBackground() const { return mABackground; }
104  void setAlternateBackgroundEnabled(bool enabled);
105 
106  bool singleLine() const { return mSingleLine; }
107  void setSingleLineEnabled(bool enabled) { mSingleLine = enabled; }
108 
109  const TQColor &alternateColor() const { return mAlternateColor; }
110 
115  void setBackgroundPixmap(const TQString &filename);
116 
120  void setShowIM( bool enabled );
121 
125  bool showIM();
126 
133  void setIMColumn( int column );
134 
138  int imColumn();
139 
140 protected:
144  virtual void paintEmptyArea( TQPainter * p, const TQRect & rect );
145  virtual void contentsMousePressEvent(TQMouseEvent*);
146  void contentsMouseMoveEvent( TQMouseEvent *e );
147  void contentsDropEvent( TQDropEvent *e );
148  virtual bool acceptDrag(TQDropEvent *e) const;
149 
150 protected slots:
151  void itemDropped(TQDropEvent *e);
152 
153 public slots:
154 
155 signals:
156  void startAddresseeDrag();
157  void addresseeDropped(TQDropEvent *);
158 
159 private:
160  KAddressBookTableView *pabWidget;
161  int oldColumn;
162  int column;
163  bool ascending;
164 
165  bool mABackground;
166  bool mSingleLine;
167  bool mToolTips;
168  bool mShowIM;
169 
170  TQColor mAlternateColor;
171 
172  TQPoint presspos;
173  int mInstantMsgColumn;
174 };
175 
176 
177 #endif
The whole tooltip design needs a lot of work.
This class is the table view for kaddressbook.