21 #include <tdeparts/mainwindow.h>
22 #include <tdeparts/event.h>
23 #include <tdeparts/part.h>
24 #include <tdeparts/plugin.h>
25 #include <kinstance.h>
26 #include <kstatusbar.h>
27 #include <khelpmenu.h>
28 #include <kstandarddirs.h>
29 #include <tqapplication.h>
30 #include <kxmlguifactory.h>
41 class MainWindowPrivate
47 m_bShellGUIActivated =
false;
54 TQGuardedPtr<Part> m_activePart;
55 bool m_bShellGUIActivated;
63 d =
new MainWindowPrivate();
70 d =
new MainWindowPrivate();
77 d =
new MainWindowPrivate();
88 kdDebug(1000) <<
"MainWindow::createGUI, part=" << part <<
" " << ( part ? part->className() :
"" )
89 <<
" " << ( part ? part->name() :
"" )
96 setUpdatesEnabled(
false );
98 TQPtrList<Plugin> plugins;
100 if ( d->m_activePart )
102 kdDebug(1000) <<
"deactivating GUI for " << d->m_activePart <<
" " << d->m_activePart->className()
103 <<
" " << d->m_activePart->name() <<
endl;
106 TQApplication::sendEvent( d->m_activePart, &ev );
108 factory->removeClient( d->m_activePart );
110 disconnect( d->m_activePart, TQT_SIGNAL( setWindowCaption(
const TQString & ) ),
111 this, TQT_SLOT( setCaption(
const TQString & ) ) );
112 disconnect( d->m_activePart, TQT_SIGNAL( setStatusBarText(
const TQString & ) ),
116 if ( !d->m_bShellGUIActivated )
120 d->m_bShellGUIActivated =
true;
126 connect( part, TQT_SIGNAL( setWindowCaption(
const TQString & ) ),
127 this, TQT_SLOT( setCaption(
const TQString & ) ) );
128 connect( part, TQT_SIGNAL( setStatusBarText(
const TQString & ) ),
131 factory->addClient( part );
134 TQApplication::sendEvent( part, &ev );
136 if ( autoSaveSettings() )
140 setUpdatesEnabled(
true );
142 d->m_activePart = part;
147 statusBar()->message( text );
150 void MainWindow::createShellGUI(
bool create )
152 bool bAccelAutoUpdate = accel()->setAutoUpdate(
false );
153 assert( d->m_bShellGUIActivated != create );
154 d->m_bShellGUIActivated = create;
157 if ( isHelpMenuEnabled() && !d->m_helpMenu )
158 d->m_helpMenu =
new KHelpMenu(
this, instance()->aboutData(),
true, actionCollection() );
160 TQString f = xmlFile();
161 setXMLFile(
locate(
"config",
"ui/ui_standards.rc", instance() ) );
163 setXMLFile( f,
true );
166 TQString auto_file( instance()->instanceName() +
"ui.rc" );
167 setXMLFile( auto_file,
true );
171 TQApplication::sendEvent(
this, &ev );
173 guiFactory()->addClient(
this );
178 TQApplication::sendEvent(
this, &ev );
180 guiFactory()->removeClient(
this );
182 accel()->setAutoUpdate( bAccelAutoUpdate );
187 createGUI( d->m_activePart );
191 #include "mainwindow.moc"
void createGUI(KParts::Part *part)
Create the GUI (by merging the host's and the active part's) You must call this in order to see any G...
kdbgstream kdDebug(int area=0)
virtual void slotSetStatusBarText(const TQString &)
Called when the active part wants to change the statusbar message Reimplement if your mainwindow has ...
virtual ~MainWindow()
Destructor.
static TDEInstance * instance()
This event is sent to a Part when its GUI has been activated or deactivated.
MainWindow(TQWidget *parent, const char *name=0L, WFlags f=(WFlags)(WType_TopLevel|WDestructiveClose))
Constructor, same signature as TDEMainWindow.
void loadPlugins(TQObject *parent, KXMLGUIClient *parentGUIClient, TDEInstance *instance)
Load the Plugins honoring the PluginLoadingMode.
static TDEConfig * config()
kndbgstream & endl(kndbgstream &s)
TQString locate(const char *type, const TQString &filename, const TDEInstance *instance=TDEGlobal::instance())
void saveNewToolbarConfig()
Rebuilds the GUI after KEditToolbar changed the toolbar layout.
void setPartObject(TQObject *object)
Internal method.