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 <tqguardedptr.h> 00028 #include <tqptrlist.h> 00029 #include <tqwidgetstack.h> 00030 00031 #include <tdeparts/mainwindow.h> 00032 #include <tdeparts/part.h> 00033 #include <tdeparts/partmanager.h> 00034 #include <kdcopservicestarter.h> 00035 00036 #include "core.h" 00037 #include "kontactiface.h" 00038 00039 class TQAction; 00040 class TQHBox; 00041 class TQSplitter; 00042 class TQVBox; 00043 class TQFrame; 00044 00045 class TDEAction; 00046 class TDEConfig; 00047 class KPluginInfo; 00048 class KRSqueezedTextLabel; 00049 class TDEHTMLPart; 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 TQValueList<Kontact::Plugin*> PluginList; 00065 typedef TQPtrList<TDEAction> ActionPluginList; 00066 00067 class MainWindow : public Kontact::Core, public KDCOPServiceStarter, public KontactIface 00068 { 00069 Q_OBJECT 00070 00071 00072 public: 00073 MainWindow(); 00074 ~MainWindow(); 00075 00076 // KDCOPServiceStarter interface 00077 virtual int startServiceFor( const TQString& serviceType, 00078 const TQString& constraint = TQString(), 00079 const TQString& preferences = TQString(), 00080 TQString *error = 0, TQCString* dcopService = 0, 00081 int flags = 0 ); 00082 00083 virtual PluginList pluginList() const { return mPlugins; } 00084 void setActivePluginModule( const TQString & ); 00085 00086 public slots: 00087 virtual void selectPlugin( Kontact::Plugin *plugin ); 00088 virtual void selectPlugin( const TQString &pluginName ); 00089 void slotActionTriggered(); 00090 00091 void updateConfig(); 00092 00093 protected slots: 00094 void initObject(); 00095 void initGUI(); 00096 void slotActivePartChanged( KParts::Part *part ); 00097 void slotPreferences(); 00098 void slotNewClicked(); 00099 void slotSyncClicked(); 00100 void slotQuit(); 00101 void slotShowTip(); 00102 void slotConfigureProfiles(); 00103 void slotLoadProfile( const TQString& id ); 00104 void slotSaveToProfile( const TQString& id ); 00105 void slotNewToolbarConfig(); 00106 void slotShowIntroduction(); 00107 void showAboutDialog(); 00108 void slotShowStatusMsg( const TQString& ); 00109 void activatePluginModule(); 00110 void slotOpenUrl( const KURL &url ); 00111 00112 private: 00113 void initWidgets(); 00114 void initAboutScreen(); 00115 void loadSettings(); 00116 void saveSettings(); 00117 00118 void sortActionsByWeight(); 00119 bool isPluginLoaded( const KPluginInfo * ); 00120 bool isPluginLoadedByAction( const TDEAction *action ); 00121 Kontact::Plugin *pluginFromInfo( const KPluginInfo * ); 00122 Kontact::Plugin *pluginFromAction( const TDEAction * ); 00123 void loadPlugins(); 00124 void unloadPlugins(); 00125 void updateShortcuts(); 00126 bool removePlugin( const KPluginInfo * ); 00127 void addPlugin( Kontact::Plugin *plugin ); 00128 void partLoaded( Kontact::Plugin *plugin, KParts::ReadOnlyPart *part ); 00129 void setupActions(); 00130 void showTip( bool ); 00131 virtual bool queryClose(); 00132 virtual void readProperties( TDEConfig *config ); 00133 virtual void saveProperties( TDEConfig *config ); 00134 void paintAboutScreen( const TQString& msg ); 00135 static TQString introductionString(); 00136 TDEToolBar* findToolBar(const char* name); 00137 00138 private slots: 00139 void pluginsChanged(); 00140 00141 void configureShortcuts(); 00142 void configureToolbars(); 00143 00144 private: 00145 TQFrame *mTopWidget; 00146 00147 TQSplitter *mSplitter; 00148 00149 TDEToolBarPopupAction *mNewActions; 00150 TDEToolBarPopupAction *mSyncActions; 00151 IconSidePane *mSidePane; 00152 TQWidgetStack *mPartsStack; 00153 Plugin *mCurrentPlugin; 00154 KParts::PartManager *mPartManager; 00155 PluginList mPlugins; 00156 PluginList mDelayedPreload; 00157 ActionPluginList mActionPlugins; 00158 TQValueList<KPluginInfo*> mPluginInfos; 00159 TDEHTMLPart *mIntroPart; 00160 00161 KRSqueezedTextLabel* mStatusMsgLabel; 00162 KPIM::StatusbarProgressWidget *mLittleProgress; 00163 00164 TQString mActiveModule; 00165 00166 TQMap<TQString, TQGuardedPtr<TQWidget> > mFocusWidgets; 00167 TQMap<Kontact::Plugin *, TDEAction *> mPluginAction; 00168 00169 AboutDialog *mAboutDialog; 00170 bool mReallyClose; 00171 bool mSyncActionsEnabled; 00172 }; 00173 00174 } 00175 00176 #endif 00177 // vim: sw=2 sts=2 et