kontact

mainwindow.h

00001 /*
00002     This file is part of KDE Kontact.
00003 
00004     Copyright (c) 2001 Matthias Hoelzer-Kluepfel <mhk@kde.org>
00005     Copyright (c) 2002-2005 Daniel Molkentin <molkentin@kde.org>
00006     Copyright (c) 2003-2005 Cornelius Schumacher <schumacher@kde.org>
00007 
00008     This program is free software; you can redistribute it and/or modify
00009     it under the terms of the GNU General Public License as published by
00010     the Free Software Foundation; either version 2 of the License, or
00011     (at your option) any later version.
00012 
00013     This program is distributed in the hope that it will be useful,
00014     but WITHOUT ANY WARRANTY; without even the implied warranty of
00015     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
00016     GNU General Public License for more details.
00017 
00018     You should have received a copy of the GNU General Public License
00019     along with this program; if not, write to the Free Software
00020     Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
00021 */
00022 
00023 
00024 #ifndef KONTACT_MAINWINDOW_H
00025 #define KONTACT_MAINWINDOW_H
00026 
00027 #include <qguardedptr.h>
00028 #include <qptrlist.h>
00029 #include <qwidgetstack.h>
00030 
00031 #include <kparts/mainwindow.h>
00032 #include <kparts/part.h>
00033 #include <kparts/partmanager.h>
00034 #include <kdcopservicestarter.h>
00035 
00036 #include "core.h"
00037 
00038 class QHBox;
00039 class QSplitter;
00040 class QVBox;
00041 class QFrame;
00042 
00043 class KAction;
00044 class KConfig;
00045 class KPluginInfo;
00046 class KRSqueezedTextLabel;
00047 class KHTMLPart;
00048 class KeyPressEater;
00049 
00050 namespace KPIM
00051 {
00052   class StatusbarProgressWidget;
00053 }
00054 
00055 namespace Kontact
00056 {
00057 
00058 class Plugin;
00059 class SidePaneBase;
00060 class AboutDialog;
00061 
00062 typedef QValueList<Kontact::Plugin*> PluginList;
00063 
00064 class MainWindow : public Kontact::Core, public KDCOPServiceStarter
00065 {
00066   Q_OBJECT
00067 
00068   public:
00069     MainWindow();
00070     ~MainWindow();
00071 
00072     // KDCOPServiceStarter interface
00073     virtual int startServiceFor( const QString& serviceType,
00074                                  const QString& constraint = QString::null,
00075                                  const QString& preferences = QString::null,
00076                                  QString *error = 0, QCString* dcopService = 0,
00077                                  int flags = 0 );
00078 
00079     virtual PluginList pluginList() const { return mPlugins; }
00080     void setActivePluginModule( const QString & );
00081 
00082   public slots:
00083     virtual void selectPlugin( Kontact::Plugin *plugin );
00084     virtual void selectPlugin( const QString &pluginName );
00085 
00086     void updateConfig();
00087 
00088   protected slots:
00089     void initObject();
00090     void initGUI();
00091     void slotActivePartChanged( KParts::Part *part );
00092     void slotPreferences();
00093     void slotNewClicked();
00094     void slotQuit();
00095     void slotShowTip();
00096     void slotRequestFeature();
00097     void slotNewToolbarConfig();
00098     void slotShowIntroduction();
00099     void showAboutDialog();
00100     void slotShowStatusMsg( const QString& );
00101     void activatePluginModule();
00102     void slotOpenUrl( const KURL &url );
00103 
00104   protected:
00105     void initWidgets();
00106     void initAboutScreen();
00107     void loadSettings();
00108     void saveSettings();
00109 
00110     bool isPluginLoaded( const KPluginInfo * );
00111     Kontact::Plugin *pluginFromInfo( const KPluginInfo * );
00112     void loadPlugins();
00113     void unloadPlugins();
00114     bool removePlugin( const KPluginInfo * );
00115     void addPlugin( Kontact::Plugin *plugin );
00116     void partLoaded( Kontact::Plugin *plugin, KParts::ReadOnlyPart *part );
00117     void setupActions();
00118     void showTip( bool );
00119     virtual bool queryClose();
00120     virtual void readProperties( KConfig *config );
00121     virtual void saveProperties( KConfig *config );
00122     void paintAboutScreen( const QString& msg );
00123     static QString introductionString();
00124 
00125   private slots:
00126     void pluginsChanged();
00127 
00128     void configureShortcuts();
00129     void configureToolbars();
00130 
00131   private:
00132     QFrame *mTopWidget;
00133 
00134     QSplitter *mSplitter;
00135 
00136     KToolBarPopupAction *mNewActions;
00137     SidePaneBase *mSidePane;
00138     QWidgetStack *mPartsStack;
00139     Plugin *mCurrentPlugin;
00140     KParts::PartManager *mPartManager;
00141     PluginList mPlugins;
00142     PluginList mDelayedPreload;
00143     QValueList<KPluginInfo*> mPluginInfos;
00144     KHTMLPart *mIntroPart;
00145 
00146     KRSqueezedTextLabel* mStatusMsgLabel;
00147     KPIM::StatusbarProgressWidget *mLittleProgress;
00148 
00149     QString mActiveModule;
00150 
00151     QMap<QString, QGuardedPtr<QWidget> > mFocusWidgets;
00152 
00153     AboutDialog *mAboutDialog;
00154     bool mReallyClose;
00155 };
00156 
00157 }
00158 
00159 #endif
00160 // vim: sw=2 sts=2 et
KDE Home | KDE Accessibility Home | Description of Access Keys