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