kaddressbook

contacteditorwidgetmanager.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 CONTACTEDITORWIDGETMANAGER_H
25 #define CONTACTEDITORWIDGETMANAGER_H
26 
27 #include <tqwidget.h>
28 
29 #include "contacteditorwidget.h"
30 
31 namespace TDEABC {
32 class Addressee;
33 }
34 
35 class TQGridLayout;
36 
37 class ContactEditorWidgetManager : public TQObject
38 {
39  TQ_OBJECT
40 
41 
42  public:
43  static ContactEditorWidgetManager *self();
44 
48  int count() const;
49 
53  KAB::ContactEditorWidgetFactory *factory( int pos ) const;
54 
55  protected:
56  ContactEditorWidgetManager();
57  ~ContactEditorWidgetManager();
58 
59  private:
60  void reload();
61 
62  TQValueList<KAB::ContactEditorWidgetFactory*> mFactories;
63 
64  static ContactEditorWidgetManager *mSelf;
65 };
66 
67 class ContactEditorTabPage : public TQWidget
68 {
69  TQ_OBJECT
70 
71 
72  public:
73  ContactEditorTabPage( TQWidget *parent, const char *name = 0 );
74 
78  void addWidget( KAB::ContactEditorWidget *widget );
79 
83  void loadContact( TDEABC::Addressee *addr );
84 
89  void storeContact( TDEABC::Addressee *addr );
90 
96  void setReadOnly( bool readOnly );
97 
102  void updateLayout();
103 
104  signals:
108  void changed();
109 
110  private:
111  TQGridLayout *mLayout;
112  KAB::ContactEditorWidget::List mWidgets;
113 };
114 
115 #endif