00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #ifndef __konq_viewmgr_h__
00021 #define __konq_viewmgr_h__
00022
00023 #include "konq_factory.h"
00024
00025 #include <tqnamespace.h>
00026 #include <tqobject.h>
00027 #include <tqmap.h>
00028 #include <tqguardedptr.h>
00029
00030 #include <ktrader.h>
00031
00032 #include <kparts/partmanager.h>
00033 #include "konq_openurlrequest.h"
00034
00035 class TQString;
00036 class TQStringList;
00037 class TQTimer;
00038 class KConfig;
00039 class KonqMainWindow;
00040 class KonqFrameBase;
00041 class KonqFrameContainer;
00042 class KonqFrameContainerBase;
00043 class KonqFrameTabs;
00044 class KonqView;
00045 class BrowserView;
00046 class KActionMenu;
00047
00048 namespace KParts
00049 {
00050 class ReadOnlyPart;
00051 }
00052
00053 class KonqViewManager : public KParts::PartManager
00054 {
00055 Q_OBJECT
00056 public:
00057 KonqViewManager( KonqMainWindow *mainWindow );
00058 ~KonqViewManager();
00059
00060 KonqView* Initialize( const TQString &serviceType, const TQString &serviceName );
00061
00072 KonqView* splitView( Qt::Orientation orientation,
00073 const TQString & serviceType = TQString::null,
00074 const TQString & serviceName = TQString::null,
00075 bool newOneFirst = false, bool forceAutoEmbed = false );
00076
00084 KonqView* splitWindow( Qt::Orientation orientation,
00085 const TQString & serviceType = TQString::null,
00086 const TQString & serviceName = TQString::null,
00087 bool newOneFirst = false);
00088
00092 void convertDocContainer();
00093
00094
00098 KonqView* addTab(const TQString &serviceType = TQString::null,
00099 const TQString &serviceName = TQString::null,
00100 bool passiveMode = false, bool openAfterCurrentPage = false );
00101
00102
00103
00107 void duplicateTab( KonqFrameBase* tab = 0L, bool openAfterCurrentPage = false );
00108
00113 KonqView* addTabFromHistory( int steps, bool openAfterCurrentPage );
00114
00119 void breakOffTab( KonqFrameBase* tab = 0L );
00120
00125 void removeView( KonqView *view );
00126
00131 void removeTab( KonqFrameBase* tab = 0L );
00132
00137 void removeOtherTabs( KonqFrameBase* tab = 0L );
00138
00143 void activateNextTab();
00144
00149 void activatePrevTab();
00150
00155 void activateTab(int position);
00156
00157 void moveTabBackward();
00158 void moveTabForward();
00159
00160 void reloadAllTabs();
00161
00166 void showTab( KonqView *view );
00167
00172 void updatePixmaps();
00173
00181 void saveViewProfile( KConfig & cfg, bool saveURLs, bool saveWindowSize );
00182
00191 void saveViewProfile( const TQString & fileName, const TQString & profileName,
00192 bool saveURLs, bool saveWindowSize );
00193
00204 void loadViewProfile( KConfig &cfg, const TQString & filename,
00205 const KURL & forcedURL = KURL(),
00206 const KonqOpenURLRequest &req = KonqOpenURLRequest(),
00207 bool resetWindow = false, bool openURL = true );
00208
00219 void loadViewProfile( const TQString & path, const TQString & filename,
00220 const KURL & forcedURL = KURL(),
00221 const KonqOpenURLRequest &req = KonqOpenURLRequest(),
00222 bool resetWindow = false, bool openURL = true );
00227 TQString currentProfile() const { return m_currentProfile; }
00232 TQString currentProfileText() const { return m_currentProfileText; }
00233
00237 bool isLoadingProfile() const { return m_bLoadingProfile; }
00238
00239 void clear();
00240
00241 KonqView *chooseNextView( KonqView *view );
00242
00249 void viewCountChanged();
00250
00251 void setProfiles( KActionMenu *profiles );
00252
00253 void profileListDirty( bool broadcast = true );
00254
00255 KonqFrameBase *docContainer() const { return m_pDocContainer; }
00256 void setDocContainer( KonqFrameBase* docContainer ) { m_pDocContainer = docContainer; }
00257
00258 KonqMainWindow *mainWindow() const { return m_pMainWindow; }
00259
00263 virtual void removePart( KParts::Part * part );
00264
00268 virtual void setActivePart( KParts::Part *part, TQWidget *widget = 0L );
00269
00270 void setActivePart( KParts::Part *part, bool immediate );
00271
00272 void showProfileDlg( const TQString & preselectProfile );
00273
00277 static TQSize readConfigSize( KConfig &cfg, TQWidget *widget = NULL);
00278
00279 #ifndef NDEBUG
00280 void printFullHierarchy( KonqFrameContainerBase * container );
00281 #endif
00282
00283 void setLoading( KonqView *view, bool loading );
00284
00285 void showHTML(bool b);
00286
00287 TQString profileHomeURL() const { return m_profileHomeURL; }
00288
00289 protected slots:
00290 void emitActivePartChanged();
00291
00292 void slotProfileDlg();
00293
00294 void slotProfileActivated( int id );
00295
00296 void slotProfileListAboutToShow();
00297
00298 void slotPassiveModePartDeleted();
00299
00300 void slotActivePartChanged ( KParts::Part *newPart );
00301
00302 protected:
00303
00312 void loadItem( KConfig &cfg, KonqFrameContainerBase *parent,
00313 const TQString &name, const KURL & defaultURL, bool openURL, bool openAfterCurrentPage = false );
00314
00315
00316 virtual void setActiveInstance( KInstance * ) {}
00317
00318 private:
00319
00325 KonqViewFactory createView( const TQString &serviceType,
00326 const TQString &serviceName,
00327 KService::Ptr &service,
00328 KTrader::OfferList &partServiceOffers,
00329 KTrader::OfferList &appServiceOffers,
00330 bool forceAutoEmbed = false );
00331
00336 KonqView *setupView( KonqFrameContainerBase *parentContainer,
00337 KonqViewFactory &viewFactory,
00338 const KService::Ptr &service,
00339 const KTrader::OfferList &partServiceOffers,
00340 const KTrader::OfferList &appServiceOffers,
00341 const TQString &serviceType,
00342 bool passiveMode, bool openAfterCurrentPage = false);
00343
00344 #ifndef NDEBUG
00345
00346 void printSizeInfo( KonqFrameBase* frame,
00347 KonqFrameContainerBase* parent,
00348 const char* msg );
00349 #endif
00350
00351 KonqMainWindow *m_pMainWindow;
00352
00353 KonqFrameBase *m_pDocContainer;
00354
00355 TQGuardedPtr<KActionMenu> m_pamProfiles;
00356 bool m_bProfileListDirty;
00357 bool m_bLoadingProfile;
00358 TQString m_currentProfile;
00359 TQString m_currentProfileText;
00360 TQString m_profileHomeURL;
00361
00362 TQMap<TQString, TQString> m_mapProfileNames;
00363
00364 TQTimer *m_activePartChangedTimer;
00365 };
00366
00367 #endif