kontact
mainwindow.h
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023 #ifndef KONTACT_MAINWINDOW_H
00024 #define KONTACT_MAINWINDOW_H
00025
00026 #include "kontact_export.h"
00027 #include <kontactinterfaces/core.h>
00028
00029 #include <kparts/part.h>
00030 #include <kparts/partmanager.h>
00031
00032 #include <QPointer>
00033
00034 class QFrame;
00035 class QSplitter;
00036 class QStackedWidget;
00037
00038 class KConfig;
00039 class KPluginInfo;
00040 class KSqueezedTextLabel;
00041 class KHTMLPart;
00042 class KToolBarPopupAction;
00043
00044 namespace KPIM {
00045 class StatusbarProgressWidget;
00046 }
00047
00048 namespace Kontact {
00049
00050 class Plugin;
00051 class SidePaneBase;
00052 class AboutDialog;
00053
00054 typedef QList<Kontact::Plugin*> PluginList;
00055 typedef QList<QAction*> ActionPluginList;
00056
00057 class KONTACT_EXPORT MainWindow : public Kontact::Core
00058 {
00059 Q_OBJECT
00060 Q_CLASSINFO( "D-Bus Interface", "org.kde.kontact.KontactInterface" )
00061
00062 public:
00063 MainWindow();
00064 ~MainWindow();
00065
00066 virtual PluginList pluginList() const { return mPlugins; }
00067 void setActivePluginModule( const QString & );
00068
00069 static bool pluginActionWeightLessThan( const QAction *left, const QAction *right );
00070 static bool pluginWeightLessThan( const Kontact::Plugin *left, const Kontact::Plugin *right );
00071
00072 public slots:
00073 virtual void selectPlugin( Kontact::Plugin *plugin );
00074 Q_SCRIPTABLE virtual void selectPlugin( const QString &pluginName );
00075 void slotActionTriggered();
00076
00077 void updateConfig();
00078
00079 protected slots:
00080 void initObject();
00081 void initGUI();
00082 void slotActivePartChanged( KParts::Part *part );
00083 void slotPreferences();
00084 void slotNewClicked();
00085 void slotSyncClicked();
00086 void slotQuit();
00087 void slotShowTip();
00088 void slotShowTipOnStart();
00089 void slotNewToolbarConfig();
00090 void slotShowIntroduction();
00091 void showAboutDialog();
00092 void slotShowStatusMsg( const QString & );
00093 void activatePluginModule();
00094 void slotOpenUrl( const KUrl &url );
00095
00096 private:
00097 void initWidgets();
00098 void initAboutScreen();
00099 void loadSettings();
00100 void saveSettings();
00101
00102 bool isPluginLoaded( const KPluginInfo & );
00103 Kontact::Plugin *pluginFromInfo( const KPluginInfo & );
00104 void loadPlugins();
00105 void unloadPlugins();
00106 void updateShortcuts();
00107 bool removePlugin( const KPluginInfo & );
00108 void addPlugin( Kontact::Plugin *plugin );
00109 void partLoaded( Kontact::Plugin *plugin, KParts::ReadOnlyPart *part );
00110 void setupActions();
00111 void showTip( bool );
00112 virtual bool queryClose();
00113 virtual void readProperties( const KConfigGroup &config );
00114 virtual void saveProperties( KConfigGroup &config );
00115 void paintAboutScreen( const QString &msg );
00116 static QString introductionString();
00117 KToolBar *findToolBar( const char *name );
00118
00119 private slots:
00120 void pluginsChanged();
00121
00122 void configureShortcuts();
00123 void configureToolbars();
00124
00125 private:
00126 QFrame *mTopWidget;
00127
00128 QSplitter *mSplitter;
00129
00130 KToolBarPopupAction *mNewActions;
00131 KToolBarPopupAction *mSyncActions;
00132 SidePaneBase *mSidePane;
00133 QStackedWidget *mPartsStack;
00134 Plugin *mCurrentPlugin;
00135 KParts::PartManager *mPartManager;
00136 PluginList mPlugins;
00137 PluginList mDelayedPreload;
00138 ActionPluginList mActionPlugins;
00139 QList<KPluginInfo> mPluginInfos;
00140 KHTMLPart *mIntroPart;
00141
00142 KSqueezedTextLabel *mStatusMsgLabel;
00143 KPIM::StatusbarProgressWidget *mLittleProgress;
00144
00145 QString mActiveModule;
00146
00147 QMap<QString, QPointer<QWidget> > mFocusWidgets;
00148 QMap<Plugin*, KAction*> mPluginAction;
00149
00150 AboutDialog *mAboutDialog;
00151 bool mReallyClose;
00152 bool mSyncActionsEnabled;
00153 };
00154
00155 }
00156
00157 Q_DECLARE_METATYPE( Kontact::Plugin * )
00158
00159 #endif
00160