Source Code (Use browser search to find items of interest.)
Class Index
kdelibs'MainWindow (./kdelibs/kparts/mainwindow.h:47)
class MainWindow : public KTMainWindow, virtual public PartBase
{
Q_OBJECT
public:
/**
* Constructor, same signature as @ref KTMainWindow.
*/
MainWindow( const char *name = 0L, WFlags f = WDestructiveClose );
/**
* Destructor.
*/
virtual ~MainWindow();
protected slots:
/**
* Create the GUI (by merging the host's and the active part's)
*
* Called on startup and whenever the active part changes
* For this you need to connect this slot to the
* @ref KPartManager::activePartChanged() signal
* @param part The active part (set to 0L if no part).
*/
virtual void createGUI( KParts::Part * part );
/**
* Called when the active part wants to change the statusbar message
* Reimplement if your mainwindow has a complex statusbar
* (with several items)
*/
virtual void slotSetStatusBarText( const QString & );
private:
MainWindowPrivate *d;
};
};
kdelibs'MainWindow::MainWindow() (./kdelibs/kparts/mainwindow.cpp:51)
MainWindow::MainWindow( const char *name, WFlags f )
: KTMainWindow( name, f )
{
d = new MainWindowPrivate();
PartBase::setObject( this );
}
kdelibs'MainWindow::~MainWindow() (./kdelibs/kparts/mainwindow.cpp:58)
MainWindow::~MainWindow()
{
delete d;
}
kdelibs'MainWindow::createGUI() (./kdelibs/kparts/mainwindow.cpp:63)
void MainWindow::createGUI( Part * part )
{
kdDebug(1000) << QString("MainWindow::createGUI for %1").arg(part?part->name():"0L") << endl;
KXMLGUIFactory *factory = guiFactory();
setUpdatesEnabled( false );
QValueList<KXMLGUIClient *> plugins;
QValueList<KXMLGUIClient *>::ConstIterator pIt, pBegin, pEnd;
if ( d->m_activePart )
{
kdDebug(1000) << QString("deactivating GUI for %1").arg(d->m_activePart->name()) << endl;
GUIActivateEvent ev( false );
QApplication::sendEvent( d->m_activePart, &ev );
plugins = Plugin::pluginClients( d->m_activePart );
pIt = plugins.fromLast();
pBegin = plugins.begin();
for (; pIt != pBegin ; --pIt )
factory->removeClient( *pIt );
if ( pIt != plugins.end() )
factory->removeClient( *pIt );
factory->removeClient( d->m_activePart );
disconnect( d->m_activePart, SIGNAL( setWindowCaption( const QString & ) ),
this, SLOT( setCaption( const QString & ) ) );
disconnect( d->m_activePart, SIGNAL( setStatusBarText( const QString & ) ),
this, SLOT( slotSetStatusBarText( const QString & ) ) );
}
if ( !d->m_bShellGUIActivated )
{
GUIActivateEvent ev( true );
QApplication::sendEvent( this, &ev );
factory->addClient( this );
plugins = Plugin::pluginClients( this );
pIt = plugins.begin();
pEnd = plugins.end();
for (; pIt != pEnd; ++pIt )
factory->addClient( *pIt );
d->m_bShellGUIActivated = true;
}
if ( part )
{
// do this before sending the activate event
connect( part, SIGNAL( setWindowCaption( const QString & ) ),
this, SLOT( setCaption( const QString & ) ) );
connect( part, SIGNAL( setStatusBarText( const QString & ) ),
this, SLOT( slotSetStatusBarText( const QString & ) ) );
GUIActivateEvent ev( true );
QApplication::sendEvent( part, &ev );
factory->addClient( part );
plugins = Plugin::pluginClients( part );
pIt = plugins.begin();
pEnd = plugins.end();
for (; pIt != pEnd; ++pIt )
factory->addClient( *pIt );
}
setUpdatesEnabled( true );
updateRects();
d->m_activePart = part;
}
kdelibs'MainWindow::slotSetStatusBarText() (./kdelibs/kparts/mainwindow.cpp:142)
void MainWindow::slotSetStatusBarText( const QString & text )
{
statusBar()->message( text );
}