kaddressbook

extensionmanager.h
1 /*
2  This file is part of KAddressbook.
3  Copyright (c) 2003 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 EXTENSIONMANAGER_H
25 #define EXTENSIONMANAGER_H
26 
27 #include "extensionwidget.h"
28 
29 #include <tqwidget.h>
30 #include <tqmap.h>
31 #include <tqptrlist.h>
32 #include <tqstringlist.h>
33 
34 class TQSignalMapper;
35 class TQWidgetStack;
36 class TDEActionCollection;
37 
38 namespace KAB {
39 class Core;
40 }
41 
42 class ExtensionData
43 {
44  public:
45  ExtensionData();
46  typedef TQValueList<ExtensionData> List;
47 
48  TDEToggleAction* action;
49  KAB::ExtensionWidget *widget;
50  TQString identifier;
51  TQString title;
52  int weight;
53  bool isDetailsExtension;
54 };
55 
56 class ExtensionManager : public TQObject
57 {
58  TQ_OBJECT
59 
60 
61  public:
62  ExtensionManager( TQWidget *extensionBar, TQWidgetStack *detailsStack, KAB::Core *core, TQObject *parent, const char *name = 0 );
63  ~ExtensionManager();
64 
68  void restoreSettings();
69 
73  void saveSettings();
74 
79  void reconfigure();
80 
84  bool isQuickEditVisible() const;
85 
86  TQWidget *activeDetailsWidget() const;
87 
88  public slots:
89  void setSelectionChanged();
90  void createActions();
91 
92  signals:
93 
94  void detailsWidgetActivated( TQWidget* widget );
95  void detailsWidgetDeactivated( TQWidget* widget );
96  void modified( const TDEABC::Addressee::List& );
97  void deleted( const TQStringList& );
98 
99  private slots:
100  void activationToggled( const TQString &extid );
101 
102  private:
103  void createExtensionWidgets();
104  void setExtensionActive( const TQString &extid, bool active );
105 
106  private:
107  TQWidget *mExtensionBar;
108  KAB::Core *mCore;
109  TQMap<TQString, ExtensionData> mExtensionMap;
110  TQStringList mActiveExtensions;
111  TQSignalMapper *mMapper;
112  TQPtrList<TDEAction> mActionList;
113  TDEActionCollection *mActionCollection;
114  TQSplitter *mSplitter;
115  TQWidgetStack *mDetailsStack;
116  TQWidget *mActiveDetailsWidget;
117 };
118 
119 #endif