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 KPluginInfo;
00045 class KRSqueezedTextLabel;
00046 class KHTMLPart;
00047 class KeyPressEater;
00048 
00049 namespace KPIM
00050 {
00051   class StatusbarProgressWidget;
00052 }
00053 
00054 namespace Kontact
00055 {
00056 
00057 class Plugin;
00058 class SidePaneBase;
00059 class AboutDialog;
00060 
00061 typedef QValueList<Kontact::Plugin*> PluginList;
00062 
00063 class MainWindow : public Kontact::Core, public KDCOPServiceStarter
00064 {
00065   Q_OBJECT
00066 
00067   public:
00068     MainWindow();
00069     ~MainWindow();
00070 
00071     // KDCOPServiceStarter interface
00072     virtual int startServiceFor( const QString& serviceType,
00073                                  const QString& constraint = QString::null,
00074                                  const QString& preferences = QString::null,
00075                                  QString *error = 0, QCString* dcopService = 0,
00076                                  int flags = 0 );
00077 
00078     virtual PluginList pluginList() const { return mPlugins; }
00079     void setActivePluginModule( const QString & );
00080 
00081   public slots:
00082     virtual void selectPlugin( Kontact::Plugin *plugin );
00083     virtual void selectPlugin( const QString &pluginName );
00084 
00085     void updateConfig();
00086 
00087   protected slots:
00088     void initObject();
00089     void initGUI();
00090     void slotActivePartChanged( KParts::Part *part );
00091     void slotPreferences();
00092     void slotNewClicked();
00093     void slotQuit();
00094     void slotShowTip();
00095     void slotRequestFeature();
00096     void slotNewToolbarConfig();
00097     void slotShowIntroduction();
00098     void showAboutDialog();
00099     void slotShowStatusMsg( const QString& );
00100     void activatePluginModule();
00101     void slotOpenUrl( const KURL &url );
00102 
00103   protected:
00104     void initWidgets();
00105     void initAboutScreen();
00106     void loadSettings();
00107     void saveSettings();
00108 
00109     bool isPluginLoaded( const KPluginInfo * );
00110     Kontact::Plugin *pluginFromInfo( const KPluginInfo * );
00111     void loadPlugins();
00112     void unloadPlugins();
00113     bool removePlugin( const KPluginInfo * );
00114     void addPlugin( Kontact::Plugin *plugin );
00115     void partLoaded( Kontact::Plugin *plugin, KParts::ReadOnlyPart *part );
00116     void setupActions();
00117     void showTip( bool );
00118     virtual bool queryClose();
00119     void paintAboutScreen( const QString& msg );
00120     static QString introductionString();
00121 
00122   private slots:
00123     void pluginsChanged();
00124 
00125     void configureShortcuts();
00126     void configureToolbars();
00127 
00128   private:
00129     QFrame *mTopWidget;
00130 
00131     QSplitter *mSplitter;
00132 
00133     KToolBarPopupAction *mNewActions;
00134     SidePaneBase *mSidePane;
00135     QWidgetStack *mPartsStack;
00136     Plugin *mCurrentPlugin;
00137     KParts::PartManager *mPartManager;
00138     PluginList mPlugins;
00139     PluginList mDelayedPreload;
00140     QValueList<KPluginInfo*> mPluginInfos;
00141     KHTMLPart *mIntroPart;
00142 
00143     KRSqueezedTextLabel* mStatusMsgLabel;
00144     KPIM::StatusbarProgressWidget *mLittleProgress;
00145 
00146     QString mActiveModule;
00147 
00148     QMap<QString, QGuardedPtr<QWidget> > mFocusWidgets;
00149 
00150     AboutDialog *mAboutDialog;
00151     bool mReallyClose;
00152 };
00153 
00154 }
00155 
00156 #endif
00157 // vim: sw=2 sts=2 et
KDE Home | KDE Accessibility Home | Description of Access Keys