Prokde35 W1-11: Let the navigator toolbar be always the last one, if it's in the...
[kdepim.git] / kontact / src / mainwindow.h
blob83a53ea0b590520ce5501d7f6832d2246a27c27d
1 /*
2 This file is part of KDE Kontact.
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>
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.
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.
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.
24 #ifndef KONTACT_MAINWINDOW_H
25 #define KONTACT_MAINWINDOW_H
27 #include <qguardedptr.h>
28 #include <qptrlist.h>
29 #include <qwidgetstack.h>
31 #include <kparts/mainwindow.h>
32 #include <kparts/part.h>
33 #include <kparts/partmanager.h>
34 #include <kdcopservicestarter.h>
36 #include "core.h"
38 class QHBox;
39 class QSplitter;
40 class QVBox;
41 class QFrame;
43 class KAction;
44 class KConfig;
45 class KPluginInfo;
46 class KRSqueezedTextLabel;
47 class KHTMLPart;
48 class KeyPressEater;
50 namespace KPIM
52 class StatusbarProgressWidget;
55 namespace Kontact
58 class Plugin;
59 class SidePaneBase;
60 class AboutDialog;
62 typedef QValueList<Kontact::Plugin*> PluginList;
64 class MainWindow : public Kontact::Core, public KDCOPServiceStarter
66 Q_OBJECT
68 public:
69 MainWindow();
70 ~MainWindow();
72 // KDCOPServiceStarter interface
73 virtual int startServiceFor( const QString& serviceType,
74 const QString& constraint = QString::null,
75 const QString& preferences = QString::null,
76 QString *error = 0, QCString* dcopService = 0,
77 int flags = 0 );
79 virtual PluginList pluginList() const { return mPlugins; }
80 void setActivePluginModule( const QString & );
82 public slots:
83 virtual void selectPlugin( Kontact::Plugin *plugin );
84 virtual void selectPlugin( const QString &pluginName );
86 void updateConfig();
88 protected slots:
89 void initObject();
90 void initGUI();
91 void slotActivePartChanged( KParts::Part *part );
92 void slotPreferences();
93 void slotNewClicked();
94 void slotSyncClicked();
95 void slotQuit();
96 void slotShowTip();
97 void slotRequestFeature();
98 void slotNewToolbarConfig();
99 void slotShowIntroduction();
100 void showAboutDialog();
101 void slotShowStatusMsg( const QString& );
102 void activatePluginModule();
103 void slotOpenUrl( const KURL &url );
105 private:
106 void initWidgets();
107 void initAboutScreen();
108 void loadSettings();
109 void saveSettings();
111 bool isPluginLoaded( const KPluginInfo * );
112 Kontact::Plugin *pluginFromInfo( const KPluginInfo * );
113 void loadPlugins();
114 void unloadPlugins();
115 bool removePlugin( const KPluginInfo * );
116 void addPlugin( Kontact::Plugin *plugin );
117 void partLoaded( Kontact::Plugin *plugin, KParts::ReadOnlyPart *part );
118 void setupActions();
119 void showTip( bool );
120 virtual bool queryClose();
121 virtual void readProperties( KConfig *config );
122 virtual void saveProperties( KConfig *config );
123 void paintAboutScreen( const QString& msg );
124 static QString introductionString();
125 KToolBar* findToolBar(const char* name);
127 private slots:
128 void pluginsChanged();
130 void configureShortcuts();
131 void configureToolbars();
133 private:
134 QFrame *mTopWidget;
136 QSplitter *mSplitter;
138 KToolBarPopupAction *mNewActions;
139 KToolBarPopupAction *mSyncActions;
140 SidePaneBase *mSidePane;
141 QWidgetStack *mPartsStack;
142 Plugin *mCurrentPlugin;
143 KParts::PartManager *mPartManager;
144 PluginList mPlugins;
145 PluginList mDelayedPreload;
146 QValueList<KPluginInfo*> mPluginInfos;
147 KHTMLPart *mIntroPart;
149 KRSqueezedTextLabel* mStatusMsgLabel;
150 KPIM::StatusbarProgressWidget *mLittleProgress;
152 QString mActiveModule;
154 QMap<QString, QGuardedPtr<QWidget> > mFocusWidgets;
156 AboutDialog *mAboutDialog;
157 bool mReallyClose;
162 #endif
163 // vim: sw=2 sts=2 et