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