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 <qwidgetstack.h>
00027
#include <qptrlist.h>
00028
00029
#include <kparts/mainwindow.h>
00030
#include <kparts/part.h>
00031
#include <kparts/partmanager.h>
00032
#include <kdcopservicestarter.h>
00033
00034
#include "core.h"
00035
00036
class KAction;
00037
class KPluginInfo;
00038
class QHBox;
00039
class QSplitter;
00040
class QVBox;
00041
00042
namespace KParts
00043 {
00044
class InfoExtension;
00045 }
00046
00047
namespace Kontact
00048 {
00049
00050
struct InfoExtData
00051 {
00052 QString text;
00053 QPixmap pixmap;
00054 };
00055
00056
class Plugin;
00057
class SidePaneBase;
00058
class AboutDialog;
00059
00060
class MainWindow :
public Kontact::
Core,
public KDCOPServiceStarter
00061 {
00062 Q_OBJECT
00063
00064
public:
00065 MainWindow();
00066 ~MainWindow();
00067
00068
00069
virtual int startServiceFor(
const QString& serviceType,
00070
const QString& constraint = QString::null,
00071
const QString& preferences = QString::null,
00072 QString *error = 0, QCString* dcopService = 0,
00073
int flags = 0 );
00074
00075
virtual QValueList<Kontact::Plugin*> pluginList()
const {
return mPlugins; }
00076
00077
public slots:
00078
virtual void selectPlugin(
Kontact::Plugin *plugin );
00079
virtual void selectPlugin(
const QString &pluginName );
00080
00081
void updateConfig();
00082
00083 signals:
00084
void textChanged(
const QString& );
00085
void iconChanged(
const QPixmap& );
00086
00087
protected slots:
00088
void slotActivePartChanged( KParts::Part *part );
00089
void slotPreferences();
00090
void slotNewClicked();
00091
void slotQuit();
00092
void slotShowTip();
00093
void slotNewToolbarConfig();
00094
void showAboutDialog();
00095
00096
protected:
00097
void initWidgets();
00098
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
bool removePlugin(
const KPluginInfo * );
00107
void addPlugin(
Kontact::Plugin *plugin );
00108
void partLoaded(
Kontact::Plugin *plugin, KParts::Part *part );
00109
void setupActions();
00110
void initHeaderWidget( QVBox *vBox );
00111
void showTip(
bool );
00112
00113
private slots:
00114
void pluginsChanged();
00115
void setHeaderText(
const QString& );
00116
void setHeaderPixmap(
const QPixmap& );
00117
00118
void configureShortcuts();
00119
void configureToolbars();
00120
00121
private:
00122 QWidget *mTopWidget;
00123
00124 QHBox *mHeaderFrame;
00125 QLabel *mHeaderText;
00126 QLabel *mHeaderPixmap;
00127 QSplitter *mSplitter;
00128
00129 KToolBarPopupAction *mNewActions;
00130 SidePaneBase *mSidePane;
00131 QWidgetStack *mStack;
00132 Plugin *mCurrentPlugin;
00133 KParts::PartManager *mPartManager;
00134
typedef QValueList<Kontact::Plugin*> PluginList;
00135 PluginList mPlugins;
00136 PluginList mDelayedPreload;
00137 QValueList<KPluginInfo*> mPluginInfos;
00138 KParts::InfoExtension *mLastInfoExtension;
00139
00140 QMap<KParts::InfoExtension*, InfoExtData> mInfoExtCache;
00141
00142
int mSidePaneType;
00143
00144
00145 AboutDialog *mAboutDialog;
00146 };
00147
00148 }
00149
00150
#endif
00151