/** * Positions child widgets into their docking stations, and performs some * other main window initialisation. */ void KScope::initMainWindow() { KStatusBar* pStatus; KDockWidget* pMainDock; QPopupMenu* pPopup; // Create the status bar pStatus = statusBar(); pStatus->insertItem(i18n(" Line: N/A Col: N/A "), 0, 0, true); // Create the main dock for the editor tabs widget pMainDock = createDockWidget("Editors Window", QPixmap()); pMainDock->setWidget(m_pEditTabs); pMainDock->setDockSite(KDockWidget::DockCorner); setMainDockWidget(pMainDock); setView(pMainDock); pMainDock->setEnableDocking(KDockWidget::DockNone); // Create the query window dock m_pQueryDock->setWidget(m_pQueryWidget); m_pQueryDock->manualDock(pMainDock, KDockWidget::DockBottom, 65); // Update the relevant shell action when the dock is hidden through its // close button connect(m_pQueryDock, SIGNAL(headerCloseButtonClicked()), m_pActions, SLOT(slotQueryDockClosed())); // Create the file view dock m_pFileViewDock->setWidget(m_pFileView); m_pFileViewDock->manualDock(pMainDock, KDockWidget::DockRight, 80); // Update the relevant shell action when the dock is hidden through its // close button connect(m_pFileViewDock, SIGNAL(headerCloseButtonClicked()), m_pActions, SLOT(slotFileViewDockClosed())); // Associate the "Window" menu with the editor tabs widdget pPopup = (QPopupMenu*)factory()->container("window", this); m_pEditTabs->setWindowMenu(pPopup); // Associate the "Query" popup menu with the query widget pPopup = (QPopupMenu*)factory()->container("query_popup", this); m_pQueryWidget->setPageMenu(pPopup, m_pActions->getLockAction()); // Restore dock configuration Config().loadWorkspace(this); m_bHideQueryOnSelection = m_pQueryDock->isHidden(); m_pActions->initLayoutActions(); }
PMDockWidget* PMShell::createView( const QString& t, PMViewOptions* o, bool initPosition ) { PMDockWidget* dock = 0; PMViewBase* contents = 0; PMViewTypeFactory* factory = PMViewFactory::theFactory( )->viewFactory( t ); m_viewNumber++; QString name = QString( "View (%1)" ).arg( m_viewNumber ); if( factory ) { QString desc; // Create the appropriate dock widget if( o ) desc = factory->description( o ); else desc = factory->description( ); dock = createDockWidget( name, SmallIcon( factory->iconName( ) ), 0L, desc, desc ); contents = factory->newInstance( dock, m_pPart ); if( o ) contents->restoreViewConfig( o ); } else { // unknown view type dock = createDockWidget( name, SmallIcon( "unknown" ), 0L, i18n( "Unknown" ), i18n( "Unknown" ) ); contents = new PMUnknownView( t, dock ); } dock->setWidget( contents ); connect( dock, SIGNAL( headerCloseButtonClicked( ) ), SLOT( slotDockWidgetClosed( ) ) ); if( initPosition ) { dock->resize( 300, 400 ); dock->manualDock( 0, PMDockWidget::DockDesktop, 50, mapToGlobal( QPoint( 50, 50 ) ) ); } return dock; }