kontact

mainwindow.h
1/*
2 This file is part of KDE Kontact.
3
4 Copyright (c) 2001 Matthias Hoelzer-Kluepfel <mhk@kde.org>
5 Copyright (c) 2002-2005 Daniel Molkentin <molkentin@kde.org>
6 Copyright (c) 2003-2005 Cornelius Schumacher <schumacher@kde.org>
7
8 This program is free software; you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation; either version 2 of the License, or
11 (at your option) any later version.
12
13 This program is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
17
18 You should have received a copy of the GNU General Public License
19 along with this program; if not, write to the Free Software
20 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
21*/
22
23
24#ifndef KONTACT_MAINWINDOW_H
25#define KONTACT_MAINWINDOW_H
26
27#include <tqguardedptr.h>
28#include <tqptrlist.h>
29#include <tqwidgetstack.h>
30
31#include <tdeparts/mainwindow.h>
32#include <tdeparts/part.h>
33#include <tdeparts/partmanager.h>
34#include <kdcopservicestarter.h>
35
36#include "core.h"
37#include "kontactiface.h"
38
39class TQAction;
40class TQHBox;
41class TQSplitter;
42class TQVBox;
43class TQFrame;
44
45class TDEAction;
46class TDEConfig;
47class KPluginInfo;
48class KRSqueezedTextLabel;
49class TDEHTMLPart;
50class KeyPressEater;
51
52namespace KPIM
53{
54 class StatusbarProgressWidget;
55}
56
57namespace Kontact
58{
59
60class AboutDialog;
61class IconSidePane;
62class Plugin;
63
64typedef TQValueList<Kontact::Plugin*> PluginList;
65typedef TQPtrList<TDEAction> ActionPluginList;
66
67class MainWindow : public Kontact::Core, public KDCOPServiceStarter, public KontactIface
68{
69 TQ_OBJECT
70
71
72 public:
73 MainWindow();
74 ~MainWindow();
75
76 // KDCOPServiceStarter interface
77 virtual int startServiceFor( const TQString& serviceType,
78 const TQString& constraint = TQString(),
79 const TQString& preferences = TQString(),
80 TQString *error = 0, TQCString* dcopService = 0,
81 int flags = 0 );
82
83 virtual PluginList pluginList() const { return mPlugins; }
84 void setActivePluginModule( const TQString & );
85
86 public slots:
87 virtual void selectPlugin( Kontact::Plugin *plugin );
88 virtual void selectPlugin( const TQString &pluginName );
89 void slotActionTriggered();
90
91 void updateConfig();
92
93 protected slots:
94 void initObject();
95 void initGUI();
96 void slotActivePartChanged( KParts::Part *part );
97 void slotPreferences();
98 void slotNewClicked();
99 void slotSyncClicked();
100 void slotQuit();
101 void slotShowTip();
102 void slotConfigureProfiles();
103 void slotLoadProfile( const TQString& id );
104 void slotSaveToProfile( const TQString& id );
105 void slotNewToolbarConfig();
106 void slotShowIntroduction();
107 void showAboutDialog();
108 void slotShowStatusMsg( const TQString& );
109 void activatePluginModule();
110 void slotOpenUrl( const KURL &url );
111
112 private:
113 void initWidgets();
114 void initAboutScreen();
115 void loadSettings();
116 void saveSettings();
117
118 void sortActionsByWeight();
119 bool isPluginLoaded( const KPluginInfo * );
120 bool isPluginLoadedByAction( const TDEAction *action );
121 Kontact::Plugin *pluginFromInfo( const KPluginInfo * );
122 Kontact::Plugin *pluginFromAction( const TDEAction * );
123 void loadPlugins();
124 void unloadPlugins();
125 void updateShortcuts();
126 bool removePlugin( const KPluginInfo * );
127 void addPlugin( Kontact::Plugin *plugin );
128 void partLoaded( Kontact::Plugin *plugin, KParts::ReadOnlyPart *part );
129 void setupActions();
130 void showTip( bool );
131 virtual bool queryClose();
132 virtual void readProperties( TDEConfig *config );
133 virtual void saveProperties( TDEConfig *config );
134 void paintAboutScreen( const TQString& msg );
135 static TQString introductionString();
136 TDEToolBar* findToolBar(const char* name);
137
138 private slots:
139 void pluginsChanged();
140
141 void configureShortcuts();
142 void configureToolbars();
143
144 private:
145 TQFrame *mTopWidget;
146
147 TQSplitter *mSplitter;
148
149 TDEToolBarPopupAction *mNewActions;
150 TDEToolBarPopupAction *mSyncActions;
151 IconSidePane *mSidePane;
152 TQWidgetStack *mPartsStack;
153 Plugin *mCurrentPlugin;
154 KParts::PartManager *mPartManager;
155 PluginList mPlugins;
156 PluginList mDelayedPreload;
157 ActionPluginList mActionPlugins;
158 TQValueList<KPluginInfo*> mPluginInfos;
159 TDEHTMLPart *mIntroPart;
160
161 KRSqueezedTextLabel* mStatusMsgLabel;
162 KPIM::StatusbarProgressWidget *mLittleProgress;
163
164 TQString mActiveModule;
165
166 TQMap<TQString, TQGuardedPtr<TQWidget> > mFocusWidgets;
167 TQMap<Kontact::Plugin *, TDEAction *> mPluginAction;
168
169 AboutDialog *mAboutDialog;
170 bool mReallyClose;
171 bool mSyncActionsEnabled;
172};
173
174}
175
176#endif
This class provides the interface to the Kontact core for the plugins.
Definition: core.h:42
Base class for all Plugins in Kontact.
Definition: plugin.h:59