summaryrefslogtreecommitdiffabout
path: root/kaddressbook/kaddressbookview.h
Unidiff
Diffstat (limited to 'kaddressbook/kaddressbookview.h') (more/less context) (show whitespace changes)
-rw-r--r--kaddressbook/kaddressbookview.h12
1 files changed, 7 insertions, 5 deletions
diff --git a/kaddressbook/kaddressbookview.h b/kaddressbook/kaddressbookview.h
index 3a3f71a..e423cd7 100644
--- a/kaddressbook/kaddressbookview.h
+++ b/kaddressbook/kaddressbookview.h
@@ -1,91 +1,93 @@
1//Added by qt3to4:
2#include <QDropEvent>
1/* 3/*
2 This file is part of KAddressBook. 4 This file is part of KAddressBook.
3 Copyright (c) 2002 Mike Pilone <mpilone@slac.com> 5 Copyright (c) 2002 Mike Pilone <mpilone@slac.com>
4 6
5 This program is free software; you can redistribute it and/or modify 7 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 8 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 9 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version. 10 (at your option) any later version.
9 11
10 This program is distributed in the hope that it will be useful, 12 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of 13 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details. 15 GNU General Public License for more details.
14 16
15 You should have received a copy of the GNU General Public License 17 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software 18 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 19 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18 20
19 As a special exception, permission is given to link this program 21 As a special exception, permission is given to link this program
20 with any edition of Qt, and distribute the resulting executable, 22 with any edition of Qt, and distribute the resulting executable,
21 without including the source code for Qt in the source distribution. 23 without including the source code for Qt in the source distribution.
22*/ 24*/
23 25
24#ifndef KADDRESSBOOKVIEW_H 26#ifndef KADDRESSBOOKVIEW_H
25#define KADDRESSBOOKVIEW_H 27#define KADDRESSBOOKVIEW_H
26 28
27#ifndef KAB_EMBEDDED 29#ifndef KAB_EMBEDDED
28#include <klibloader.h> 30#include <klibloader.h>
29#endif //KAB_EMBEDDED 31#endif //KAB_EMBEDDED
30 32
31class KConfig; 33class KConfig;
32class QDropEvent; 34class QDropEvent;
33 35
34#include <qstringlist.h> 36#include <qstringlist.h>
35#include <kabc/field.h> 37#include <kabc/field.h>
36#include <qwidget.h> 38#include <qwidget.h>
37#include <qregexp.h> 39#include <qregexp.h>
38 40
39#include "viewconfigurewidget.h" 41#include "viewconfigurewidget.h"
40#include "filter.h" 42#include "filter.h"
41 43
42#ifdef DESKTOP_VERSION 44#ifdef DESKTOP_VERSION
43#include <qpaintdevicemetrics.h> 45#include <q3paintdevicemetrics.h>
44#include <qprinter.h> 46#include <qprinter.h>
45#include <qpainter.h> 47#include <qpainter.h>
46#endif 48#endif
47 49
48namespace KABC { class AddressBook; } 50namespace KABC { class AddressBook; }
49 51
50/** 52/**
51 Base class for all views in kaddressbook. This class implements 53 Base class for all views in kaddressbook. This class implements
52 all the common methods needed to provide a view to the user. 54 all the common methods needed to provide a view to the user.
53 55
54 To implement a specific view (table, card, etc), just inherit from 56 To implement a specific view (table, card, etc), just inherit from
55 this class and implement all the pure virtuals. 57 this class and implement all the pure virtuals.
56 58
57 @author Mike Pilone <mpilone@slac.com> 59 @author Mike Pilone <mpilone@slac.com>
58 */ 60 */
59class KAddressBookView : public QWidget 61class KAddressBookView : public QWidget
60{ 62{
61 Q_OBJECT 63 Q_OBJECT
62 64
63 public: 65 public:
64 enum DefaultFilterType { None = 0, Active = 1, Specific = 2 }; 66 enum DefaultFilterType { None = 0, Active = 1, Specific = 2 };
65 67
66 KAddressBookView( KABC::AddressBook *ab, QWidget *parent, const char *name ); 68 KAddressBookView( KABC::AddressBook *ab, QWidget *parent, const char *name );
67 virtual ~KAddressBookView(); 69 virtual ~KAddressBookView();
68 70
69 /** 71 /**
70 Must be overloaded in subclasses. Should return a list of 72 Must be overloaded in subclasses. Should return a list of
71 all the uids of selected contacts. 73 all the uids of selected contacts.
72 */ 74 */
73 virtual QStringList selectedUids() = 0; 75 virtual QStringList selectedUids() = 0;
74 virtual void doSearch( const QString& s ,KABC::Field *field ) = 0; 76 virtual void doSearch( const QString& s ,KABC::Field *field ) = 0;
75 virtual void scrollUP() = 0; 77 virtual void scrollUP() = 0;
76 virtual void scrollDOWN() = 0; 78 virtual void scrollDOWN() = 0;
77 virtual void setFocusAV() = 0; 79 virtual void setFocusAV() = 0;
78 80
79 /** 81 /**
80 Called whenever this view should read the config. This can be used 82 Called whenever this view should read the config. This can be used
81 as a sign that the config has changed, therefore the view should 83 as a sign that the config has changed, therefore the view should
82 assume the worst and rebuild itself if necessary. For example, 84 assume the worst and rebuild itself if necessary. For example,
83 in a table view this method may be called when the user adds or 85 in a table view this method may be called when the user adds or
84 removes columns from the view. 86 removes columns from the view.
85 87
86 If overloaded in the subclass, do not forget to call super class's 88 If overloaded in the subclass, do not forget to call super class's
87 method. 89 method.
88 90
89 @param config The KConfig object to read from. The group will already 91 @param config The KConfig object to read from. The group will already
90 be set, so do not change the group. 92 be set, so do not change the group.
91 */ 93 */
@@ -130,185 +132,185 @@ class KAddressBookView : public QWidget
130 */ 132 */
131 KABC::Field::List fields() const; 133 KABC::Field::List fields() const;
132 134
133 KABC::Field::List allFields() const; 135 KABC::Field::List allFields() const;
134 136
135 /** 137 /**
136 Sets the active filter. This filter will be used for filtering 138 Sets the active filter. This filter will be used for filtering
137 the list of addressees to display. The view will <b>not</b> 139 the list of addressees to display. The view will <b>not</b>
138 automatically refresh itself, so in most cases you will want to call 140 automatically refresh itself, so in most cases you will want to call
139 KAddressBookView::refresh() after this method. 141 KAddressBookView::refresh() after this method.
140 */ 142 */
141 void setFilter( const Filter& ); 143 void setFilter( const Filter& );
142 144
143 /** 145 /**
144 @return The default filter type selection. If the selection 146 @return The default filter type selection. If the selection
145 is SpecificFilter, the name of the filter can be retrieved with 147 is SpecificFilter, the name of the filter can be retrieved with
146 defaultFilterName() 148 defaultFilterName()
147 */ 149 */
148 DefaultFilterType defaultFilterType() const; 150 DefaultFilterType defaultFilterType() const;
149 151
150 /** 152 /**
151 @return The name of the default filter. This string is 153 @return The name of the default filter. This string is
152 only valid if defaultFilterType() is returning SpecificFilter. 154 only valid if defaultFilterType() is returning SpecificFilter.
153 */ 155 */
154 const QString &defaultFilterName() const; 156 const QString &defaultFilterName() const;
155 157
156 /** 158 /**
157 @return The address book. 159 @return The address book.
158 */ 160 */
159 KABC::AddressBook *addressBook() const; 161 KABC::AddressBook *addressBook() const;
160 void printMyView() { emit printView() ;} 162 void printMyView() { emit printView() ;}
161 163
162 public slots: 164 public slots:
163 /** 165 /**
164 Must be overloaded in subclasses to refresh the view. 166 Must be overloaded in subclasses to refresh the view.
165 Refreshing includes updating the view to ensure that only items 167 Refreshing includes updating the view to ensure that only items
166 in the document are visible. If <i>uid</i> is valid, only the 168 in the document are visible. If <i>uid</i> is valid, only the
167 addressee with uid needs to be refreshed. This is an optimization 169 addressee with uid needs to be refreshed. This is an optimization
168 only. 170 only.
169 */ 171 */
170 virtual void refresh( QString uid = QString::null ) = 0; 172 virtual void refresh( QString uid = QString::null ) = 0;
171 173
172 /** 174 /**
173 This method must be overloaded in subclasses. Select (highlight) 175 This method must be overloaded in subclasses. Select (highlight)
174 the addressee matching <i>uid</i>. If uid 176 the addressee matching <i>uid</i>. If uid
175 is equal to QString::null, then all addressees should be selected. 177 is equal to QString::null, then all addressees should be selected.
176 */ 178 */
177#ifndef KAB_EMBEDDED 179#ifndef KAB_EMBEDDED
178//MOC_SKIP_BEGIN 180#ifndef Q_MOC_RUN
179 virtual void setSelected( QString uid = QString::null, bool selected = true ) = 0; 181 virtual void setSelected( QString uid = QString::null, bool selected = true ) = 0;
180//MOC_SKIP_END 182#endif
181#else //KAB_EMBEDDED 183#else //KAB_EMBEDDED
182 //US my moc can not handle the default parameters. Is this a problem ??? 184 //US my moc can not handle the default parameters. Is this a problem ???
183 virtual void setSelected( QString uid, bool selected) = 0; 185 virtual void setSelected( QString uid, bool selected) = 0;
184#endif //KAB_EMBEDDED 186#endif //KAB_EMBEDDED
185 187
186 signals: 188 signals:
187 189
188 void printView(); 190 void printView();
189 /** 191 /**
190 This signal should be emitted by a subclass whenever an addressee 192 This signal should be emitted by a subclass whenever an addressee
191 is modified. 193 is modified.
192 */ 194 */
193 void modified(); 195 void modified();
194 196
195 /** 197 /**
196 This signal should be emitted by a subclass whenever an addressee 198 This signal should be emitted by a subclass whenever an addressee
197 is selected. Selected means that the addressee was given the focus. 199 is selected. Selected means that the addressee was given the focus.
198 Some widgets may call this 'highlighted'. The view is responsible for 200 Some widgets may call this 'highlighted'. The view is responsible for
199 emitting this signal multiple times if multiple items are selected, 201 emitting this signal multiple times if multiple items are selected,
200 with the last item selected being the last emit. 202 with the last item selected being the last emit.
201 203
202 @param uid The uid of the selected addressee. 204 @param uid The uid of the selected addressee.
203 205
204 @see KListView 206 @see KListView
205 */ 207 */
206 void selected( const QString &uid ); 208 void selected( const QString &uid );
207 void deleteRequest(); 209 void deleteRequest();
208 /** 210 /**
209 This signal should be emitted by a subclass whenever an addressee 211 This signal should be emitted by a subclass whenever an addressee
210 is executed. This is defined by the KDE system wide config, but it 212 is executed. This is defined by the KDE system wide config, but it
211 either means single or doubleclicked. 213 either means single or doubleclicked.
212 214
213 @param ui The uid of the selected addressee 215 @param ui The uid of the selected addressee
214 216
215 @see KListView 217 @see KListView
216 */ 218 */
217 void executed( const QString &uid ); 219 void executed( const QString &uid );
218 220
219 /** 221 /**
220 This signal is emitted whenever a user attempts to start a drag 222 This signal is emitted whenever a user attempts to start a drag
221 in the view. The slot connected to this signal would usually want 223 in the view. The slot connected to this signal would usually want
222 to create a QDragObject. 224 to create a QDragObject.
223 */ 225 */
224 void startDrag(); 226 void startDrag();
225 227
226 /** 228 /**
227 This signal is emitted whenever the user drops something on the 229 This signal is emitted whenever the user drops something on the
228 view. The individual view should handle checking if the item is 230 view. The individual view should handle checking if the item is
229 droppable (ie: if it is a vcard). 231 droppable (ie: if it is a vcard).
230 */ 232 */
231 void dropped( QDropEvent* ); 233 void dropped( QDropEvent* );
232 234
233 protected: 235 protected:
234 236
235 /** 237 /**
236 Returns a list of the addressees that should be displayed. This method 238 Returns a list of the addressees that should be displayed. This method
237 should always be used by the subclass to get a list of addressees. This 239 should always be used by the subclass to get a list of addressees. This
238 method internally takes many factors into account, including the current 240 method internally takes many factors into account, including the current
239 filter. 241 filter.
240 */ 242 */
241 KABC::Addressee::List addressees(); 243 KABC::Addressee::List addressees();
242 244
243 /** 245 /**
244 This method returns the widget that should be used as the parent for 246 This method returns the widget that should be used as the parent for
245 all view components. By using this widget as the parent and not 247 all view components. By using this widget as the parent and not
246 'this', the view subclass has the option of placing other widgets 248 'this', the view subclass has the option of placing other widgets
247 around the view (ie: search fields, etc). Do not delete this widget! 249 around the view (ie: search fields, etc). Do not delete this widget!
248 */ 250 */
249 QWidget *viewWidget(); 251 QWidget *viewWidget();
250 QRegExp getRegExp( const QString ); 252 QRegExp getRegExp( const QString );
251 253
252 private: 254 private:
253 void initGUI(); 255 void initGUI();
254 256
255 DefaultFilterType mDefaultFilterType; 257 DefaultFilterType mDefaultFilterType;
256 Filter mFilter; 258 Filter mFilter;
257 QString mDefaultFilterName; 259 QString mDefaultFilterName;
258 KABC::AddressBook *mAddressBook; 260 KABC::AddressBook *mAddressBook;
259 KABC::Field::List mFieldList; 261 KABC::Field::List mFieldList;
260 262
261 QWidget *mViewWidget; 263 QWidget *mViewWidget;
262}; 264};
263 265
264#ifndef KAB_EMBEDDED 266#ifndef KAB_EMBEDDED
265//MOC_SKIP_BEGIN 267#ifndef Q_MOC_RUN
266class ViewFactory : public KLibFactory 268class ViewFactory : public KLibFactory
267//MOC_SKIP_END 269#endif
268#else //KAB_EMBEDDED 270#else //KAB_EMBEDDED
269class ViewFactory 271class ViewFactory
270#endif //KAB_EMBEDDED 272#endif //KAB_EMBEDDED
271{ 273{
272 274
273 public: 275 public:
274 virtual KAddressBookView *view( KABC::AddressBook *ab, QWidget *parent, 276 virtual KAddressBookView *view( KABC::AddressBook *ab, QWidget *parent,
275 const char *name = 0 ) = 0; 277 const char *name = 0 ) = 0;
276 278
277 /** 279 /**
278 @return The type of the view. This is normally a small one word 280 @return The type of the view. This is normally a small one word
279 string (ie: Table, Icon, Tree, etc). 281 string (ie: Table, Icon, Tree, etc).
280 */ 282 */
281 virtual QString type() const = 0; 283 virtual QString type() const = 0;
282 284
283 /** 285 /**
284 @return The description of the view. This should be a 3 to 286 @return The description of the view. This should be a 3 to
285 4 line string (don't actually use return characters in the string) 287 4 line string (don't actually use return characters in the string)
286 describing the features offered by the view. 288 describing the features offered by the view.
287 */ 289 */
288 virtual QString description() const = 0; 290 virtual QString description() const = 0;
289 291
290 /** 292 /**
291 Creates a config dialog for the view type. The default 293 Creates a config dialog for the view type. The default
292 implementation will return a ViewConfigDialog. This default 294 implementation will return a ViewConfigDialog. This default
293 dialog will allow the user to set the visible fields only. If 295 dialog will allow the user to set the visible fields only. If
294 you need more config options (as most views will), this method 296 you need more config options (as most views will), this method
295 can be overloaded to return your sublcass of ViewConfigDialog. 297 can be overloaded to return your sublcass of ViewConfigDialog.
296 If this method is over loaded the base classes method should 298 If this method is over loaded the base classes method should
297 <B>not</B> be called. 299 <B>not</B> be called.
298 */ 300 */
299 virtual ViewConfigureWidget *configureWidget( KABC::AddressBook *ab, 301 virtual ViewConfigureWidget *configureWidget( KABC::AddressBook *ab,
300 QWidget *parent, 302 QWidget *parent,
301 const char *name = 0 ); 303 const char *name = 0 );
302 304
303 protected: 305 protected:
304 virtual QObject* createObject( QObject*, const char*, const char*, 306 virtual QObject* createObject( QObject*, const char*, const char*,
305 const QStringList & ) 307 const QStringList & )
306 { 308 {
307 return 0; 309 return 0;
308 } 310 }
309 311
310 312
311}; 313};
312 314
313 315
314#endif 316#endif