kaddressbook

contacteditorwidget.h
1 /*
2  This file is part of KAddressbook.
3  Copyright (c) 2004 Tobias Koenig <tokoe@kde.org>
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 KAB_CONTACTEDITORWIDGET_H
25 #define KAB_CONTACTEDITORWIDGET_H
26 
27 #include <tqwidget.h>
28 
29 #include <tdeabc/addressbook.h>
30 #include <klibloader.h>
31 #include <tdemacros.h>
32 
33 #define KAB_CEW_PLUGIN_VERSION 1
34 
35 namespace KAB {
36 
37 class TDE_EXPORT ContactEditorWidget : public TQWidget
38 {
39  TQ_OBJECT
40 
41 
42  public:
43  typedef TQValueList<ContactEditorWidget*> List;
44 
45  ContactEditorWidget( TDEABC::AddressBook *ab, TQWidget *parent, const char *name = 0 );
46  ~ContactEditorWidget();
47 
53  virtual int logicalHeight() const { return 1; }
54 
60  virtual int logicalWidth() const { return 1; }
61 
65  virtual void loadContact( TDEABC::Addressee *addr ) = 0;
66 
71  virtual void storeContact( TDEABC::Addressee *addr ) = 0;
72 
78  virtual void setReadOnly( bool readOnly ) = 0;
79 
83  bool modified() const;
84 
85  signals:
90  void changed();
91 
92  public slots:
99  void setModified( bool modified );
100 
101  void setModified();
102 
103  protected:
107  TDEABC::AddressBook *addressBook() const;
108 
109  private:
110  TDEABC::AddressBook *mAddressBook;
111  bool mModified;
112 
113  class ContactEditorWidgetPrivate;
114  ContactEditorWidgetPrivate *d;
115 };
116 
117 class ContactEditorWidgetFactory : public KLibFactory
118 {
119  public:
120  virtual ContactEditorWidget *createWidget( TDEABC::AddressBook *ab, TQWidget *parent,
121  const char *name = 0 ) = 0;
122 
126  virtual TQString pageTitle() const { return ""; }
127 
132  virtual TQString pageIdentifier() const = 0;
133 
134  protected:
135  virtual TQObject* createObject( TQObject*, const char*, const char*,
136  const TQStringList & )
137  {
138  return 0;
139  }
140 };
141 
142 }
143 
144 #endif