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>
37 using namespace KParts;
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 );
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 & ) ),
134 TQApplication::sendEvent( part, &ev );
140 setUpdatesEnabled(
true );
142 d->m_activePart = part;
150 void MainWindow::createShellGUI(
bool create )
153 assert( d->m_bShellGUIActivated != create );
154 d->m_bShellGUIActivated = create;
166 TQString auto_file(
instance()->instanceName() +
"ui.rc" );
171 TQApplication::sendEvent(
this, &ev );
173 guiFactory()->addClient(
this );
178 TQApplication::sendEvent(
this, &ev );
180 guiFactory()->removeClient(
this );
187 createGUI( d->m_activePart );
191 #include "mainwindow.moc"
virtual void setXMLFile(const TQString &file, bool merge=false, bool setXMLDoc=true)
static TDEConfig * config()
void loadPlugins(TQObject *parent, KXMLGUIClient *parentGUIClient, TDEInstance *instance)
Load the Plugins honoring the PluginLoadingMode.
void removeClient(KXMLGUIClient *client)
void setPartObject(TQObject *object)
Internal method.
This event is sent to a Part when its GUI has been activated or deactivated.
TQString locate(const char *type, const TQString &filename, const TDEInstance *instance=TDEGlobal::instance())
kndbgstream & endl(kndbgstream &s)
TQString autoSaveGroup() const
virtual void setCaption(const TQString &caption)
virtual TQString xmlFile() const
kdbgstream kdDebug(int area=0)
KXMLGUIFactory * factory() const
void applyMainWindowSettings(TDEConfig *config, const TQString &groupName, bool force)
bool autoSaveSettings() const
void addClient(KXMLGUIClient *client)
virtual TDEInstance * instance() const
void saveNewToolbarConfig()
Rebuilds the GUI after KEditToolbar changed the toolbar layout.
static TDEInstance * instance()
virtual void slotSetStatusBarText(const TQString &)
Called when the active part wants to change the statusbar message Reimplement if your mainwindow has ...
virtual ~MainWindow()
Destructor.
virtual TDEActionCollection * actionCollection() const
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...
MainWindow(TQWidget *parent, const char *name=0L, WFlags f=(WFlags)(WType_TopLevel|WDestructiveClose))
Constructor, same signature as TDEMainWindow.
bool setAutoUpdate(bool bAuto)