kaddressbook

kaddressbookview.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 KADDRESSBOOKVIEW_H
25 #define KADDRESSBOOKVIEW_H
26 
27 #define KAB_VIEW_PLUGIN_VERSION 1
28 
29 #include <tqstringlist.h>
30 #include <tqwidget.h>
31 
32 #include <tdeabc/field.h>
33 #include <klibloader.h>
34 #include <tdemacros.h>
35 
36 #include "filter.h"
37 #include "viewconfigurewidget.h"
38 
39 class TDEConfig;
40 class KXMLGUIClient;
41 
42 class TQDropEvent;
43 
44 namespace KAB { class Core; }
45 namespace TDEABC { class AddressBook; }
46 
56 class TDE_EXPORT KAddressBookView : public TQWidget
57 {
58  TQ_OBJECT
59 
60 
61  public:
62  enum DefaultFilterType { None = 0, Active = 1, Specific = 2 };
63 
64  KAddressBookView( KAB::Core *core, TQWidget *parent, const char *name );
65  virtual ~KAddressBookView();
66 
71  virtual TQStringList selectedUids() = 0;
72 
86  virtual void readConfig( TDEConfig *config );
87 
97  // The TDEConfig object is unused so we do not document it
98  // else doxygen will complain.
99  virtual void writeConfig( TDEConfig * );
100 
105  virtual TQString selectedEmails();
106 
112  virtual TQString type() const = 0;
113 
124  TDEABC::Field::List fields() const;
125 
132  void setFilter( const Filter& );
133 
139  DefaultFilterType defaultFilterType() const;
140 
145  const TQString &defaultFilterName() const;
146 
150  KAB::Core *core() const;
151 
155  virtual TDEABC::Field *sortField() const = 0;
156 
157  virtual void scrollUp() = 0;
158  virtual void scrollDown() = 0;
159 
160  public slots:
168  virtual void refresh( const TQString &uid = TQString() ) = 0;
169 
175  virtual void setSelected( const TQString &uid = TQString(), bool selected = true ) = 0;
176 
180  virtual void setFirstSelected( bool selected = true ) = 0;
181 
187  void popup( const TQPoint &point );
188 
189  signals:
194  void modified();
195 
207  void selected( const TQString &uid );
208 
218  void executed( const TQString &uid );
219 
225  void startDrag();
226 
232  void dropped( TQDropEvent* );
233 
238 
243 
244  protected:
251  TDEABC::Addressee::List addressees();
252 
259  TQWidget *viewWidget();
260 
261  private slots:
262  void updateView();
263 
264  private:
265  void initGUI();
266 
267  DefaultFilterType mDefaultFilterType;
268  Filter mFilter;
269  TQString mDefaultFilterName;
270  KAB::Core *mCore;
271  TDEABC::Field::List mFieldList;
272 
273  TQWidget *mViewWidget;
274 };
275 
276 class TDE_EXPORT ViewFactory : public KLibFactory
277 {
278  public:
279  virtual KAddressBookView *view( KAB::Core *core, TQWidget *parent,
280  const char *name = 0 ) = 0;
285  virtual TQString type() const = 0;
286 
292  virtual TQString description() const = 0;
293 
303  virtual ViewConfigureWidget *configureWidget( TDEABC::AddressBook *ab,
304  TQWidget *parent,
305  const char *name = 0 );
306 
307  protected:
308  virtual TQObject* createObject( TQObject*, const char*, const char*,
309  const TQStringList & )
310  {
311  return 0;
312  }
313 };
314 
315 #endif
Filter for AddressBook related objects (Addressees)
Definition: filter.h:40
Base class for all views in kaddressbook.
virtual TQStringList selectedUids()=0
Must be overloaded in subclasses.
void startDrag()
This signal is emitted whenever a user attempts to start a drag in the view.
virtual TQString type() const =0
Return the type of the view: Icon, Table, etc.
void viewFieldsChanged()
Emitted whenever the view fields changed.
void dropped(TQDropEvent *)
This signal is emitted whenever the user drops something on the view.
virtual void refresh(const TQString &uid=TQString())=0
Must be overloaded in subclasses to refresh the view.
void selected(const TQString &uid)
This signal should be emitted by a subclass whenever an addressee is selected.
virtual void setSelected(const TQString &uid=TQString(), bool selected=true)=0
This method must be overloaded in subclasses.
void executed(const TQString &uid)
This signal should be emitted by a subclass whenever an addressee is executed.
virtual void setFirstSelected(bool selected=true)=0
Selects the first contact in the view.
void modified()
This signal should be emitted by a subclass whenever an addressee is modified.
void sortFieldChanged()
This signal is emitted whenever the sort field changed.
virtual TDEABC::Field * sortField() const =0
This widget is the base class for all view configuration widgets.