summaryrefslogtreecommitdiffabout
path: root/microkde
Unidiff
Diffstat (limited to 'microkde') (more/less context) (ignore whitespace changes)
-rw-r--r--microkde/kdeui/kmainwindow.cpp1
-rw-r--r--microkde/kdeui/kmainwindow.h5
2 files changed, 4 insertions, 2 deletions
diff --git a/microkde/kdeui/kmainwindow.cpp b/microkde/kdeui/kmainwindow.cpp
index bd5a2cc..3ae4c87 100644
--- a/microkde/kdeui/kmainwindow.cpp
+++ b/microkde/kdeui/kmainwindow.cpp
@@ -47,512 +47,513 @@ public:
47//US KMainWindowInterface *m_interface; 47//US KMainWindowInterface *m_interface;
48 KDEPrivate::ToolBarHandler *toolBarHandler; 48 KDEPrivate::ToolBarHandler *toolBarHandler;
49 QTimer* settingsTimer; 49 QTimer* settingsTimer;
50 KToggleAction *showStatusBarAction; 50 KToggleAction *showStatusBarAction;
51 QRect defaultWindowSize; 51 QRect defaultWindowSize;
52}; 52};
53 53
54static bool no_query_exit = false; 54static bool no_query_exit = false;
55 55
56KMainWindow::KMainWindow( QWidget* parent, const char *name, WFlags f ) 56KMainWindow::KMainWindow( QWidget* parent, const char *name, WFlags f )
57 : QMainWindow( parent, name ) /*LR, f ) with the default widget flag we cannot have fastload */ /*US, KXMLGUIBuilder( this ), helpMenu2( 0 ), factory_( 0 )*/ 57 : QMainWindow( parent, name ) /*LR, f ) with the default widget flag we cannot have fastload */ /*US, KXMLGUIBuilder( this ), helpMenu2( 0 ), factory_( 0 )*/
58{ 58{
59 mQToolBar = 0; 59 mQToolBar = 0;
60 initKMainWindow(name); 60 initKMainWindow(name);
61} 61}
62 62
63void KMainWindow::parseGeometry(bool parsewidth) 63void KMainWindow::parseGeometry(bool parsewidth)
64{ 64{
65//US the following code is not getting used in the embedded version !! So disable it for now 65//US the following code is not getting used in the embedded version !! So disable it for now
66/*US 66/*US
67 67
68 assert ( !kapp->geometryArgument().isNull() ); 68 assert ( !kapp->geometryArgument().isNull() );
69 assert ( d->care_about_geometry ); 69 assert ( d->care_about_geometry );
70 70
71#ifndef Q_WS_QWS 71#ifndef Q_WS_QWS
72 // FIXME: (E) Implement something similar for Qt Embedded (or decide we don't need it) 72 // FIXME: (E) Implement something similar for Qt Embedded (or decide we don't need it)
73 int x, y; 73 int x, y;
74 int w, h; 74 int w, h;
75 int m = XParseGeometry( kapp->geometryArgument().latin1(), &x, &y, (unsigned int*)&w, (unsigned int*)&h); 75 int m = XParseGeometry( kapp->geometryArgument().latin1(), &x, &y, (unsigned int*)&w, (unsigned int*)&h);
76 if (parsewidth) { 76 if (parsewidth) {
77 QSize minSize = minimumSize(); 77 QSize minSize = minimumSize();
78 QSize maxSize = maximumSize(); 78 QSize maxSize = maximumSize();
79 if ( (m & WidthValue) == 0 ) 79 if ( (m & WidthValue) == 0 )
80 w = width(); 80 w = width();
81 if ( (m & HeightValue) == 0 ) 81 if ( (m & HeightValue) == 0 )
82 h = height(); 82 h = height();
83 w = QMIN(w,maxSize.width()); 83 w = QMIN(w,maxSize.width());
84 h = QMIN(h,maxSize.height()); 84 h = QMIN(h,maxSize.height());
85 w = QMAX(w,minSize.width()); 85 w = QMAX(w,minSize.width());
86 h = QMAX(h,minSize.height()); 86 h = QMAX(h,minSize.height());
87 resize(w, h); 87 resize(w, h);
88 } else { 88 } else {
89 if ( parsewidth && (m & XValue) == 0 ) 89 if ( parsewidth && (m & XValue) == 0 )
90 x = geometry().x(); 90 x = geometry().x();
91 if ( parsewidth && (m & YValue) == 0 ) 91 if ( parsewidth && (m & YValue) == 0 )
92 y = geometry().y(); 92 y = geometry().y();
93 if ( (m & XNegative) ) 93 if ( (m & XNegative) )
94 x = KApplication::desktop()->width() + x - w; 94 x = KApplication::desktop()->width() + x - w;
95 if ( (m & YNegative) ) 95 if ( (m & YNegative) )
96 y = KApplication::desktop()->height() + y - h; 96 y = KApplication::desktop()->height() + y - h;
97 move(x, y); 97 move(x, y);
98 } 98 }
99#endif 99#endif
100*/ 100*/
101} 101}
102 102
103KMainWindow::~KMainWindow() 103KMainWindow::~KMainWindow()
104{ 104{
105 delete d->settingsTimer; 105 delete d->settingsTimer;
106 QMenuBar* mb = internalMenuBar(); 106 QMenuBar* mb = internalMenuBar();
107 delete mb; 107 delete mb;
108//US delete d->m_interface; 108//US delete d->m_interface;
109 109
110 delete d; 110 delete d;
111//US memberList->remove( this ); 111//US memberList->remove( this );
112} 112}
113 113
114void KMainWindow::initKMainWindow(const char *name) 114void KMainWindow::initKMainWindow(const char *name)
115{ 115{
116 setDockMenuEnabled( FALSE ); 116 setDockMenuEnabled( FALSE );
117//US mHelpMenu = 0; 117//US mHelpMenu = 0;
118 118
119//US kapp->setTopWidget( this ); 119//US kapp->setTopWidget( this );
120 actionCollection()->setWidget( this ); 120 actionCollection()->setWidget( this );
121//US connect(kapp, SIGNAL(shutDown()), this, SLOT(shuttingDown())); 121//US connect(kapp, SIGNAL(shutDown()), this, SLOT(shuttingDown()));
122//US if( !memberList ) 122//US if( !memberList )
123//US memberList = new QPtrList<KMainWindow>; 123//US memberList = new QPtrList<KMainWindow>;
124/*US 124/*US
125 125
126 if ( !ksm ) 126 if ( !ksm )
127 ksm = ksmd.setObject(new KMWSessionManaged()); 127 ksm = ksmd.setObject(new KMWSessionManaged());
128 // set a unique object name. Required by session management. 128 // set a unique object name. Required by session management.
129 QCString objname; 129 QCString objname;
130 QCString s; 130 QCString s;
131 int unusedNumber; 131 int unusedNumber;
132 if ( !name ) 132 if ( !name )
133 { // no name given 133 { // no name given
134 objname = kapp->instanceName() + "-mainwindow#"; 134 objname = kapp->instanceName() + "-mainwindow#";
135 s = objname + '1'; // start adding number immediately 135 s = objname + '1'; // start adding number immediately
136 unusedNumber = 1; 136 unusedNumber = 1;
137 } 137 }
138 else if( name[ strlen( name ) - 1 ] == '#' ) 138 else if( name[ strlen( name ) - 1 ] == '#' )
139 { // trailing # - always add a number 139 { // trailing # - always add a number
140 objname = name; 140 objname = name;
141 s = objname + '1'; // start adding number immediately 141 s = objname + '1'; // start adding number immediately
142 unusedNumber = 1; 142 unusedNumber = 1;
143 } 143 }
144 else 144 else
145 { 145 {
146 objname = name; 146 objname = name;
147 s = objname; 147 s = objname;
148 unusedNumber = 0; // add numbers only when needed 148 unusedNumber = 0; // add numbers only when needed
149 } 149 }
150 for(;;) { 150 for(;;) {
151 QWidgetList* list = kapp->topLevelWidgets(); 151 QWidgetList* list = kapp->topLevelWidgets();
152 QWidgetListIt it( *list ); 152 QWidgetListIt it( *list );
153 bool found = false; 153 bool found = false;
154 for( QWidget* w = it.current(); 154 for( QWidget* w = it.current();
155 w != NULL; 155 w != NULL;
156 ++it, w = it.current()) 156 ++it, w = it.current())
157 if( w != this && w->name() == s ) 157 if( w != this && w->name() == s )
158 { 158 {
159 found = true; 159 found = true;
160 break; 160 break;
161 } 161 }
162 delete list; 162 delete list;
163 if( !found ) 163 if( !found )
164 break; 164 break;
165 s.setNum( ++unusedNumber ); 165 s.setNum( ++unusedNumber );
166 s = objname + s; 166 s = objname + s;
167 } 167 }
168 setName( s ); 168 setName( s );
169 memberList->append( this ); 169 memberList->append( this );
170*/ 170*/
171 171
172 d = new KMainWindowPrivate; 172 d = new KMainWindowPrivate;
173//US d->showHelpMenu = true; 173//US d->showHelpMenu = true;
174 d->settingsDirty = false; 174 d->settingsDirty = false;
175 d->autoSaveSettings = false; 175 d->autoSaveSettings = false;
176 d->autoSaveWindowSize = true; // for compatibility 176 d->autoSaveWindowSize = true; // for compatibility
177//US d->kaccel = actionCollection()->kaccel(); 177//US d->kaccel = actionCollection()->kaccel();
178 d->toolBarHandler = 0; 178 d->toolBarHandler = 0;
179 d->settingsTimer = 0; 179 d->settingsTimer = 0;
180 d->showStatusBarAction = NULL; 180 d->showStatusBarAction = NULL;
181/*US 181/*US
182 if ((d->care_about_geometry == beeing_first)) { 182 if ((d->care_about_geometry == beeing_first)) {
183 beeing_first = false; 183 beeing_first = false;
184 if ( kapp->geometryArgument().isNull() ) // if there is no geometry, it doesn't mater 184 if ( kapp->geometryArgument().isNull() ) // if there is no geometry, it doesn't mater
185 d->care_about_geometry = false; 185 d->care_about_geometry = false;
186 else 186 else
187 parseGeometry(false); 187 parseGeometry(false);
188 } 188 }
189*/ 189*/
190 d->care_about_geometry = false; 190 d->care_about_geometry = false;
191 191
192//US setCaption( kapp->caption() ); 192//US setCaption( kapp->caption() );
193 // attach dcop interface 193 // attach dcop interface
194//US d->m_interface = new KMainWindowInterface(this); 194//US d->m_interface = new KMainWindowInterface(this);
195 195
196//US if (!kapp->authorize("movable_toolbars")) 196//US if (!kapp->authorize("movable_toolbars"))
197//US setDockWindowsMovable(false); 197//US setDockWindowsMovable(false);
198} 198}
199 199
200KAction *KMainWindow::toolBarMenuAction() 200KAction *KMainWindow::toolBarMenuAction()
201{ 201{
202 if ( !d->toolBarHandler ) 202 if ( !d->toolBarHandler )
203 return 0; 203 return 0;
204 204
205 return d->toolBarHandler->toolBarMenuAction(); 205 return d->toolBarHandler->toolBarMenuAction();
206} 206}
207 207
208bool KMainWindow::canBeRestored( int number ) 208bool KMainWindow::canBeRestored( int number )
209{ 209{
210/*US we do not have and want to save sessioninformation. Use info from the default 210/*US we do not have and want to save sessioninformation. Use info from the default
211application config. 211application config.
212*/ 212*/
213//US if ( !kapp->isRestored() ) 213//US if ( !kapp->isRestored() )
214//US return FALSE; 214//US return FALSE;
215//US KConfig *config = kapp->sessionConfig(); 215//US KConfig *config = kapp->sessionConfig();
216 KConfig *config = KGlobal::config(); 216 KConfig *config = KGlobal::config();
217 if ( !config ) 217 if ( !config )
218 return FALSE; 218 return FALSE;
219 config->setGroup( QString::fromLatin1("Number") ); 219 config->setGroup( QString::fromLatin1("Number") );
220 int n = config->readNumEntry( QString::fromLatin1("NumberOfWindows") , 1 ); 220 int n = config->readNumEntry( QString::fromLatin1("NumberOfWindows") , 1 );
221 return number >= 1 && number <= n; 221 return number >= 1 && number <= n;
222 222
223} 223}
224 224
225const QString KMainWindow::classNameOfToplevel( int number ) 225const QString KMainWindow::classNameOfToplevel( int number )
226{ 226{
227/*US we do not have and want to save sessioninformation. Use info from the default 227/*US we do not have and want to save sessioninformation. Use info from the default
228application config. 228application config.
229*/ 229*/
230//US if ( !kapp->isRestored() ) 230//US if ( !kapp->isRestored() )
231//US return QString::null; 231//US return QString::null;
232//US KConfig *config = kapp->sessionConfig(); 232//US KConfig *config = kapp->sessionConfig();
233 KConfig *config = KGlobal::config(); 233 KConfig *config = KGlobal::config();
234 if ( !config ) 234 if ( !config )
235 return QString::null; 235 return QString::null;
236 QString s; 236 QString s;
237 s.setNum( number ); 237 s.setNum( number );
238 s.prepend( QString::fromLatin1("WindowProperties") ); 238 s.prepend( QString::fromLatin1("WindowProperties") );
239 config->setGroup( s ); 239 config->setGroup( s );
240 if ( !config->hasKey( QString::fromLatin1("ClassName") ) ) 240 if ( !config->hasKey( QString::fromLatin1("ClassName") ) )
241 return QString::null; 241 return QString::null;
242 else 242 else
243 return config->readEntry( QString::fromLatin1("ClassName") ); 243 return config->readEntry( QString::fromLatin1("ClassName") );
244} 244}
245 245
246bool KMainWindow::restore( int number, bool show ) 246bool KMainWindow::restore( int number, bool show )
247{ 247{
248/*US we do not have and want to save sessioninformation. Use info from the default 248/*US we do not have and want to save sessioninformation. Use info from the default
249application config. 249application config.
250*/ 250*/
251 if ( !canBeRestored( number ) ) 251 if ( !canBeRestored( number ) )
252 return FALSE; 252 return FALSE;
253//US KConfig *config = kapp->sessionConfig(); 253//US KConfig *config = kapp->sessionConfig();
254 KConfig *config = KGlobal::config(); 254 KConfig *config = KGlobal::config();
255 255
256 if ( readPropertiesInternal( config, number ) ){ 256 if ( readPropertiesInternal( config, number ) ){
257 if ( show ) 257 if ( show )
258 KMainWindow::show(); 258 KMainWindow::show();
259 return FALSE; 259 return FALSE;
260 } 260 }
261 return FALSE; 261 return FALSE;
262 262
263} 263}
264 264
265void KMainWindow::setCaption( const QString &caption ) 265void KMainWindow::setCaption( const QString &caption )
266{ 266{
267//US setPlainCaption( kapp->makeStdCaption(caption) ); 267//US setPlainCaption( kapp->makeStdCaption(caption) );
268 setPlainCaption( caption ); 268 setPlainCaption( caption );
269} 269}
270 270
271void KMainWindow::setCaption( const QString &caption, bool modified ) 271void KMainWindow::setCaption( const QString &caption, bool modified )
272{ 272{
273//US setPlainCaption( kapp->makeStdCaption(caption, true, modified) ); 273//US setPlainCaption( kapp->makeStdCaption(caption, true, modified) );
274 setPlainCaption( caption + "modified:" ); 274 setPlainCaption( caption + "modified:" );
275} 275}
276 276
277void KMainWindow::setPlainCaption( const QString &caption ) 277void KMainWindow::setPlainCaption( const QString &caption )
278{ 278{
279 QMainWindow::setCaption( caption ); 279 QMainWindow::setCaption( caption );
280#ifndef Q_WS_QWS 280#ifndef Q_WS_QWS
281//US the following is disabled for the embedded version 281//US the following is disabled for the embedded version
282//US NETWinInfo info( qt_xdisplay(), winId(), qt_xrootwin(), 0 ); 282//US NETWinInfo info( qt_xdisplay(), winId(), qt_xrootwin(), 0 );
283//US info.setName( caption.utf8().data() ); 283//US info.setName( caption.utf8().data() );
284#endif 284#endif
285} 285}
286 286
287void KMainWindow::slotStateChanged(const QString &newstate) 287void KMainWindow::slotStateChanged(const QString &newstate)
288{ 288{
289 stateChanged(newstate, KXMLGUIClient::StateNoReverse); 289 stateChanged(newstate, KXMLGUIClient::StateNoReverse);
290} 290}
291 291
292/* 292/*
293 * Get rid of this for KDE 4.0 293 * Get rid of this for KDE 4.0
294 */ 294 */
295void KMainWindow::slotStateChanged(const QString &newstate, 295void KMainWindow::slotStateChanged(const QString &newstate,
296 KXMLGUIClient::ReverseStateChange reverse) 296 KXMLGUIClient::ReverseStateChange reverse)
297{ 297{
298 stateChanged(newstate, reverse); 298 stateChanged(newstate, reverse);
299} 299}
300 300
301void KMainWindow::closeEvent ( QCloseEvent *e ) 301void KMainWindow::closeEvent ( QCloseEvent *e )
302{ 302{
303 //qDebug("MainWindow::closeEvent ");
303 // Save settings if auto-save is enabled, and settings have changed 304 // Save settings if auto-save is enabled, and settings have changed
304 if (d->settingsDirty && d->autoSaveSettings) 305 if (d->settingsDirty && d->autoSaveSettings)
305 saveAutoSaveSettings(); 306 saveAutoSaveSettings();
306 307
307 if (queryClose()) { 308 if (queryClose()) {
308 e->accept(); 309 e->accept();
309 310
310 int not_withdrawn = 0; 311 int not_withdrawn = 0;
311/*US 312/*US
312 QPtrListIterator<KMainWindow> it(*KMainWindow::memberList); 313 QPtrListIterator<KMainWindow> it(*KMainWindow::memberList);
313 for (it.toFirst(); it.current(); ++it){ 314 for (it.toFirst(); it.current(); ++it){
314 if ( !it.current()->isHidden() && it.current()->isTopLevel() && it.current() != this ) 315 if ( !it.current()->isHidden() && it.current()->isTopLevel() && it.current() != this )
315 not_withdrawn++; 316 not_withdrawn++;
316 } 317 }
317*/ 318*/
318 if ( !no_query_exit && not_withdrawn <= 0 ) { // last window close accepted? 319 if ( !no_query_exit && not_withdrawn <= 0 ) { // last window close accepted?
319/*US 320/*US
320 if ( queryExit() && !kapp->sessionSaving()) { // Yes, Quit app? 321 if ( queryExit() && !kapp->sessionSaving()) { // Yes, Quit app?
321 // don't call queryExit() twice 322 // don't call queryExit() twice
322 disconnect(kapp, SIGNAL(shutDown()), this, SLOT(shuttingDown())); 323 disconnect(kapp, SIGNAL(shutDown()), this, SLOT(shuttingDown()));
323 kapp->deref(); // ...and quit aplication. 324 kapp->deref(); // ...and quit aplication.
324 } else { 325 } else {
325 // cancel closing, it's stupid to end up with no windows at all.... 326 // cancel closing, it's stupid to end up with no windows at all....
326 e->ignore(); 327 e->ignore();
327 } 328 }
328*/ 329*/
329//US we have no sessionmanagement. Simply close app. 330//US we have no sessionmanagement. Simply close app.
330 if ( queryExit() ) { // Yes, Quit app? 331 if ( queryExit() ) { // Yes, Quit app?
331 qDebug("KMainWindow::closeEvent: Exit application ???"); 332 qDebug("KMainWindow::closeEvent: Exit application ???");
332 // don't call queryExit() twice 333 // don't call queryExit() twice
333//US disconnect(kapp, SIGNAL(shutDown()), this, SLOT(shuttingDown())); 334//US disconnect(kapp, SIGNAL(shutDown()), this, SLOT(shuttingDown()));
334 } 335 }
335 336
336 } 337 }
337 } 338 }
338} 339}
339 340
340bool KMainWindow::queryExit() 341bool KMainWindow::queryExit()
341{ 342{
342 return TRUE; 343 return TRUE;
343} 344}
344 345
345bool KMainWindow::queryClose() 346bool KMainWindow::queryClose()
346{ 347{
347 return TRUE; 348 return TRUE;
348} 349}
349 350
350void KMainWindow::saveGlobalProperties( KConfig* ) 351void KMainWindow::saveGlobalProperties( KConfig* )
351{ 352{
352} 353}
353 354
354void KMainWindow::readGlobalProperties( KConfig* ) 355void KMainWindow::readGlobalProperties( KConfig* )
355{ 356{
356} 357}
357 358
358void KMainWindow::savePropertiesInternal( KConfig *config, int number ) 359void KMainWindow::savePropertiesInternal( KConfig *config, int number )
359{ 360{
360 bool oldASWS = d->autoSaveWindowSize; 361 bool oldASWS = d->autoSaveWindowSize;
361 d->autoSaveWindowSize = true; // make saveMainWindowSettings save the window size 362 d->autoSaveWindowSize = true; // make saveMainWindowSettings save the window size
362 363
363 QString s; 364 QString s;
364 s.setNum(number); 365 s.setNum(number);
365 s.prepend(QString::fromLatin1("WindowProperties")); 366 s.prepend(QString::fromLatin1("WindowProperties"));
366 config->setGroup(s); 367 config->setGroup(s);
367 368
368 // store objectName, className, Width and Height for later restoring 369 // store objectName, className, Width and Height for later restoring
369 // (Only useful for session management) 370 // (Only useful for session management)
370 config->writeEntry(QString::fromLatin1("ObjectName"), name()); 371 config->writeEntry(QString::fromLatin1("ObjectName"), name());
371 config->writeEntry(QString::fromLatin1("ClassName"), className()); 372 config->writeEntry(QString::fromLatin1("ClassName"), className());
372 373
373 saveMainWindowSettings(config); // Menubar, statusbar and Toolbar settings. 374 saveMainWindowSettings(config); // Menubar, statusbar and Toolbar settings.
374 375
375 s.setNum(number); 376 s.setNum(number);
376 config->setGroup(s); 377 config->setGroup(s);
377 saveProperties(config); 378 saveProperties(config);
378 379
379 d->autoSaveWindowSize = oldASWS; 380 d->autoSaveWindowSize = oldASWS;
380} 381}
381 382
382void KMainWindow::setStandardToolBarMenuEnabled( bool enable ) 383void KMainWindow::setStandardToolBarMenuEnabled( bool enable )
383{ 384{
384 if ( enable ) 385 if ( enable )
385 { 386 {
386 if ( d->toolBarHandler ) 387 if ( d->toolBarHandler )
387 return; 388 return;
388 389
389 d->toolBarHandler = new KDEPrivate::ToolBarHandler( this ); 390 d->toolBarHandler = new KDEPrivate::ToolBarHandler( this );
390 391
391/*US if ( factory() ) 392/*US if ( factory() )
392 factory()->addClient( d->toolBarHandler ); 393 factory()->addClient( d->toolBarHandler );
393*/ 394*/
394 } 395 }
395 else 396 else
396 { 397 {
397 if ( !d->toolBarHandler ) 398 if ( !d->toolBarHandler )
398 return; 399 return;
399/*US 400/*US
400 if ( factory() ) 401 if ( factory() )
401 factory()->removeClient( d->toolBarHandler ); 402 factory()->removeClient( d->toolBarHandler );
402*/ 403*/
403 delete d->toolBarHandler; 404 delete d->toolBarHandler;
404 d->toolBarHandler = 0; 405 d->toolBarHandler = 0;
405 } 406 }
406 407
407} 408}
408 409
409bool KMainWindow::isStandardToolBarMenuEnabled() const 410bool KMainWindow::isStandardToolBarMenuEnabled() const
410{ 411{
411 return ( d->toolBarHandler != 0 ); 412 return ( d->toolBarHandler != 0 );
412} 413}
413 414
414void KMainWindow::createStandardStatusBarAction(){ 415void KMainWindow::createStandardStatusBarAction(){
415 if(!d->showStatusBarAction){ 416 if(!d->showStatusBarAction){
416 d->showStatusBarAction = KStdAction::showStatusbar(this, SLOT(setSettingsDirty()), actionCollection()); 417 d->showStatusBarAction = KStdAction::showStatusbar(this, SLOT(setSettingsDirty()), actionCollection());
417 connect(d->showStatusBarAction, SIGNAL(toggled(bool)), statusBar(), SLOT(setShown(bool))); 418 connect(d->showStatusBarAction, SIGNAL(toggled(bool)), statusBar(), SLOT(setShown(bool)));
418 if(internalStatusBar()) 419 if(internalStatusBar())
419 d->showStatusBarAction->setChecked(!internalStatusBar()->isHidden()); 420 d->showStatusBarAction->setChecked(!internalStatusBar()->isHidden());
420 } 421 }
421} 422}
422 423
423QToolBar *KMainWindow::tBar( ) 424QToolBar *KMainWindow::tBar( )
424{ 425{
425 if ( ! mQToolBar ) 426 if ( ! mQToolBar )
426 mQToolBar = new QToolBar( this ); 427 mQToolBar = new QToolBar( this );
427 return mQToolBar; 428 return mQToolBar;
428} 429}
429 430
430KToolBar *KMainWindow::toolBar( const char * name ) 431KToolBar *KMainWindow::toolBar( const char * name )
431{ 432{
432 433
433 if (!name) 434 if (!name)
434 name = "mainToolBar"; 435 name = "mainToolBar";
435 KToolBar *tb = (KToolBar*)child( name, "KToolBar" ); 436 KToolBar *tb = (KToolBar*)child( name, "KToolBar" );
436 if ( tb ) 437 if ( tb )
437 return tb; 438 return tb;
438 bool honor_mode = (name == "mainToolBar"); 439 bool honor_mode = (name == "mainToolBar");
439 440
440/*US 441/*US
441 if ( builderClient() ) 442 if ( builderClient() )
442 return new KToolBar(this, name, honor_mode); // XMLGUI constructor 443 return new KToolBar(this, name, honor_mode); // XMLGUI constructor
443 else 444 else
444*/ 445*/
445 return new KToolBar(this, Top, false, name, honor_mode ); // non-XMLGUI 446 return new KToolBar(this, Top, false, name, honor_mode ); // non-XMLGUI
446} 447}
447 448
448QPtrListIterator<KToolBar> KMainWindow::toolBarIterator() 449QPtrListIterator<KToolBar> KMainWindow::toolBarIterator()
449{ 450{
450 toolbarList.clear(); 451 toolbarList.clear();
451 QPtrList<QToolBar> lst; 452 QPtrList<QToolBar> lst;
452 for ( int i = (int)QMainWindow::Unmanaged; i <= (int)Minimized; ++i ) { 453 for ( int i = (int)QMainWindow::Unmanaged; i <= (int)Minimized; ++i ) {
453 lst = toolBars( (ToolBarDock)i ); 454 lst = toolBars( (ToolBarDock)i );
454 for ( QToolBar *tb = lst.first(); tb; tb = lst.next() ) { 455 for ( QToolBar *tb = lst.first(); tb; tb = lst.next() ) {
455 if ( !tb->inherits( "KToolBar" ) ) 456 if ( !tb->inherits( "KToolBar" ) )
456 continue; 457 continue;
457 toolbarList.append( (KToolBar*)tb ); 458 toolbarList.append( (KToolBar*)tb );
458 } 459 }
459 } 460 }
460 return QPtrListIterator<KToolBar>( toolbarList ); 461 return QPtrListIterator<KToolBar>( toolbarList );
461} 462}
462 463
463void KMainWindow::setAutoSaveSettings( const QString & groupName, bool saveWindowSize ) 464void KMainWindow::setAutoSaveSettings( const QString & groupName, bool saveWindowSize )
464{ 465{
465 d->autoSaveSettings = true; 466 d->autoSaveSettings = true;
466 d->autoSaveGroup = groupName; 467 d->autoSaveGroup = groupName;
467 d->autoSaveWindowSize = saveWindowSize; 468 d->autoSaveWindowSize = saveWindowSize;
468 // Get notified when the user moves a toolbar around 469 // Get notified when the user moves a toolbar around
469//US connect( this, SIGNAL( dockWindowPositionChanged( QDockWindow * ) ), 470//US connect( this, SIGNAL( dockWindowPositionChanged( QDockWindow * ) ),
470//US this, SLOT( setSettingsDirty() ) ); 471//US this, SLOT( setSettingsDirty() ) );
471 connect( this, SIGNAL( toolBarPositionChanged(QToolBar *) ), 472 connect( this, SIGNAL( toolBarPositionChanged(QToolBar *) ),
472 this, SLOT( setSettingsDirty() ) ); 473 this, SLOT( setSettingsDirty() ) );
473 474
474 475
475 // Get default values 476 // Get default values
476//US int scnum = QApplication::desktop()->screenNumber(parentWidget()); 477//US int scnum = QApplication::desktop()->screenNumber(parentWidget());
477//US QRect desk = QApplication::desktop()->screenGeometry(scnum); 478//US QRect desk = QApplication::desktop()->screenGeometry(scnum);
478 QRect desk = KGlobalSettings::desktopGeometry(0); 479 QRect desk = KGlobalSettings::desktopGeometry(0);
479 480
480 d->defaultWindowSize = QRect(desk.width(), width(), desk.height(), height()); 481 d->defaultWindowSize = QRect(desk.width(), width(), desk.height(), height());
481 // Now read the previously saved settings 482 // Now read the previously saved settings
482 applyMainWindowSettings( KGlobal::config(), groupName ); 483 applyMainWindowSettings( KGlobal::config(), groupName );
483} 484}
484 485
485 486
486void KMainWindow::resetAutoSaveSettings() 487void KMainWindow::resetAutoSaveSettings()
487{ 488{
488 d->autoSaveSettings = false; 489 d->autoSaveSettings = false;
489 if ( d->settingsTimer ) 490 if ( d->settingsTimer )
490 d->settingsTimer->stop(); 491 d->settingsTimer->stop();
491} 492}
492 493
493bool KMainWindow::autoSaveSettings() const 494bool KMainWindow::autoSaveSettings() const
494{ 495{
495 return d->autoSaveSettings; 496 return d->autoSaveSettings;
496} 497}
497 498
498QString KMainWindow::autoSaveGroup() const 499QString KMainWindow::autoSaveGroup() const
499{ 500{
500 return d->autoSaveGroup; 501 return d->autoSaveGroup;
501} 502}
502 503
503void KMainWindow::saveAutoSaveSettings() 504void KMainWindow::saveAutoSaveSettings()
504{ 505{
505 ASSERT( d->autoSaveSettings ); 506 ASSERT( d->autoSaveSettings );
506 //kdDebug(200) << "KMainWindow::saveAutoSaveSettings -> saving settings" << endl; 507 //kdDebug(200) << "KMainWindow::saveAutoSaveSettings -> saving settings" << endl;
507 saveMainWindowSettings( KGlobal::config(), d->autoSaveGroup ); 508 saveMainWindowSettings( KGlobal::config(), d->autoSaveGroup );
508 KGlobal::config()->sync(); 509 KGlobal::config()->sync();
509 d->settingsDirty = false; 510 d->settingsDirty = false;
510 if ( d->settingsTimer ) 511 if ( d->settingsTimer )
511 d->settingsTimer->stop(); 512 d->settingsTimer->stop();
512} 513}
513 514
514void KMainWindow::createGUI( const QString &xmlfile, bool _conserveMemory ) 515void KMainWindow::createGUI( const QString &xmlfile, bool _conserveMemory )
515{ 516{
516 // disabling the updates prevents unnecessary redraws 517 // disabling the updates prevents unnecessary redraws
517 setUpdatesEnabled( false ); 518 setUpdatesEnabled( false );
518 519
519 // just in case we are rebuilding, let's remove our old client 520 // just in case we are rebuilding, let's remove our old client
520//US guiFactory()->removeClient( this ); 521//US guiFactory()->removeClient( this );
521 522
522 // make sure to have an empty GUI 523 // make sure to have an empty GUI
523 QMenuBar* mb = internalMenuBar(); 524 QMenuBar* mb = internalMenuBar();
524 if ( mb ) 525 if ( mb )
525 mb->clear(); 526 mb->clear();
526 527
527 (void)toolBarIterator(); // make sure toolbarList is most-up-to-date 528 (void)toolBarIterator(); // make sure toolbarList is most-up-to-date
528 toolbarList.setAutoDelete( true ); 529 toolbarList.setAutoDelete( true );
529 toolbarList.clear(); 530 toolbarList.clear();
530 toolbarList.setAutoDelete( false ); 531 toolbarList.setAutoDelete( false );
531/*US 532/*US
532 // don't build a help menu unless the user ask for it 533 // don't build a help menu unless the user ask for it
533 if (d->showHelpMenu) { 534 if (d->showHelpMenu) {
534 // we always want a help menu 535 // we always want a help menu
535 if (helpMenu2 == 0) 536 if (helpMenu2 == 0)
536 helpMenu2 = new KHelpMenu(this, instance()->aboutData(), true, 537 helpMenu2 = new KHelpMenu(this, instance()->aboutData(), true,
537 actionCollection()); 538 actionCollection());
538 } 539 }
539 540
540 // we always want to load in our global standards file 541 // we always want to load in our global standards file
541 setXMLFile( locate( "config", "ui/ui_standards.rc", instance() ) ); 542 setXMLFile( locate( "config", "ui/ui_standards.rc", instance() ) );
542 543
543 // now, merge in our local xml file. if this is null, then that 544 // now, merge in our local xml file. if this is null, then that
544 // means that we will be only using the global file 545 // means that we will be only using the global file
545 if ( !xmlfile.isNull() ) { 546 if ( !xmlfile.isNull() ) {
546 setXMLFile( xmlfile, true ); 547 setXMLFile( xmlfile, true );
547 } else { 548 } else {
548 QString auto_file(instance()->instanceName() + "ui.rc"); 549 QString auto_file(instance()->instanceName() + "ui.rc");
549 setXMLFile( auto_file, true ); 550 setXMLFile( auto_file, true );
550 } 551 }
551 552
552 // make sure we don't have any state saved already 553 // make sure we don't have any state saved already
553 setXMLGUIBuildDocument( QDomDocument() ); 554 setXMLGUIBuildDocument( QDomDocument() );
554 555
555 // do the actual GUI building 556 // do the actual GUI building
556 guiFactory()->addClient( this ); 557 guiFactory()->addClient( this );
557 558
558 // try and get back *some* of our memory 559 // try and get back *some* of our memory
diff --git a/microkde/kdeui/kmainwindow.h b/microkde/kdeui/kmainwindow.h
index e76e732..2aafb9d 100644
--- a/microkde/kdeui/kmainwindow.h
+++ b/microkde/kdeui/kmainwindow.h
@@ -1,352 +1,353 @@
1/* 1/*
2 This file is part of the KDE libraries 2 This file is part of the KDE libraries
3 3
4 This library is free software; you can redistribute it and/or 4 This library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Library General Public 5 modify it under the terms of the GNU Library General Public
6 License version 2 as published by the Free Software Foundation. 6 License version 2 as published by the Free Software Foundation.
7 7
8 This library is distributed in the hope that it will be useful, 8 This library is distributed in the hope that it will be useful,
9 but WITHOUT ANY WARRANTY; without even the implied warranty of 9 but WITHOUT ANY WARRANTY; without even the implied warranty of
10 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 10 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 Library General Public License for more details. 11 Library General Public License for more details.
12 12
13 You should have received a copy of the GNU Library General Public License 13 You should have received a copy of the GNU Library General Public License
14 along with this library; see the file COPYING.LIB. If not, write to 14 along with this library; see the file COPYING.LIB. If not, write to
15 the Free Software Foundation, Inc., 59 Temple Place - Suite 330, 15 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
16 Boston, MA 02111-1307, USA. 16 Boston, MA 02111-1307, USA.
17 17
18 $Id$ 18 $Id$
19 19
20*/ 20*/
21 21
22 22
23 23
24#ifndef KMAINWINDOW_H 24#ifndef KMAINWINDOW_H
25#define KMAINWINDOW_H 25#define KMAINWINDOW_H
26 26
27/*US 27/*US
28#include "kxmlguifactory.h" 28#include "kxmlguifactory.h"
29#include "kxmlguiclient.h" 29#include "kxmlguiclient.h"
30#include "kxmlguibuilder.h" 30#include "kxmlguibuilder.h"
31#include <qmetaobject.h> 31#include <qmetaobject.h>
32 32
33class KPopupMenu; 33class KPopupMenu;
34class KXMLGUIFactory; 34class KXMLGUIFactory;
35class KConfig; 35class KConfig;
36class KHelpMenu; 36class KHelpMenu;
37class KStatusBar; 37class KStatusBar;
38class QStatusBar; 38class QStatusBar;
39class KMenuBar; 39class KMenuBar;
40class KMWSessionManaged; 40class KMWSessionManaged;
41class KAccel; 41class KAccel;
42class KToolBarMenuAction; 42class KToolBarMenuAction;
43*/ 43*/
44 44
45class QMenuBar; 45class QMenuBar;
46class QStatusBar; 46class QStatusBar;
47class KMainWindowPrivate; 47class KMainWindowPrivate;
48class KAction; 48class KAction;
49 49
50#include <ktoolbar.h> 50#include <ktoolbar.h>
51#include <ktoolbarhandler.h> 51#include <ktoolbarhandler.h>
52#include <kxmlguiclient.h> 52#include <kxmlguiclient.h>
53#include <qmainwindow.h> 53#include <qmainwindow.h>
54#include <qptrlist.h> 54#include <qptrlist.h>
55 55
56class KActionCollection; 56class KActionCollection;
57 57
58class KMainWindow : public QMainWindow, virtual public KXMLGUIClient 58class KMainWindow : public QMainWindow, virtual public KXMLGUIClient
59{ 59{
60 Q_OBJECT 60 Q_OBJECT
61 61
62private: 62private:
63//US create private defaultconstructor 63//US create private defaultconstructor
64 KMainWindow() {;}; 64 KMainWindow() {;};
65 65
66public: 66
67public: 67public:
68 /** 68 /**
69 * Construct a main window. 69 * Construct a main window.
70 * 70 *
71 * @param parent The widget parent. This is usually 0 but it may also be the window 71 * @param parent The widget parent. This is usually 0 but it may also be the window
72 * group leader. In that case, the KMainWindow becomes sort of a 72 * group leader. In that case, the KMainWindow becomes sort of a
73 * secondary window. 73 * secondary window.
74 * 74 *
75 * @param name The object name. For session management and window management to work 75 * @param name The object name. For session management and window management to work
76 * properly, all main windows in the application should have a 76 * properly, all main windows in the application should have a
77 * different name. When passing 0 (the default), KMainWindow will create 77 * different name. When passing 0 (the default), KMainWindow will create
78 * a unique name, but it's recommended to explicitly pass a window name that will 78 * a unique name, but it's recommended to explicitly pass a window name that will
79 * also describe the type of the window. If there can be several windows of the same 79 * also describe the type of the window. If there can be several windows of the same
80 * type, append '#' (hash) to the name, and KMainWindow will append numbers to make 80 * type, append '#' (hash) to the name, and KMainWindow will append numbers to make
81 * the names unique. For example, for a mail client which has one main window showing 81 * the names unique. For example, for a mail client which has one main window showing
82 * the mails and folders, and which can also have one or more windows for composing 82 * the mails and folders, and which can also have one or more windows for composing
83 * mails, the name for the folders window should be e.g. "mainwindow" and 83 * mails, the name for the folders window should be e.g. "mainwindow" and
84 * for the composer windows "composer#". 84 * for the composer windows "composer#".
85 * 85 *
86 * @param f Specify the widget flags. The default is 86 * @param f Specify the widget flags. The default is
87 * WType_TopLevel and WDestructiveClose. TopLevel indicates that a 87 * WType_TopLevel and WDestructiveClose. TopLevel indicates that a
88 * main window is a toplevel window, regardless of whether it has a 88 * main window is a toplevel window, regardless of whether it has a
89 * parent or not. DestructiveClose indicates that a main window is 89 * parent or not. DestructiveClose indicates that a main window is
90 * automatically destroyed when its window is closed. Pass 0 if 90 * automatically destroyed when its window is closed. Pass 0 if
91 * you do not want this behavior. 91 * you do not want this behavior.
92 * 92 *
93 * KMainWindows must be created on the heap with 'new', like: 93 * KMainWindows must be created on the heap with 'new', like:
94 * <pre> KMainWindow *kmw = new KMainWindow (...</pre> 94 * <pre> KMainWindow *kmw = new KMainWindow (...</pre>
95 **/ 95 **/
96 KMainWindow( QWidget* parent = 0, const char *name = 0, WFlags f = WType_TopLevel | WDestructiveClose ); 96 //LR remove WDestructiveClose
97 KMainWindow( QWidget* parent = 0, const char *name = 0, WFlags f = WType_TopLevel /*| WDestructiveClose*/ );
97 98
98 99
99 /** 100 /**
100 * Destructor. 101 * Destructor.
101 * 102 *
102 * Will also destroy the toolbars, and menubar if 103 * Will also destroy the toolbars, and menubar if
103 * needed. 104 * needed.
104 */ 105 */
105 virtual ~KMainWindow(); 106 virtual ~KMainWindow();
106 107
107 /** 108 /**
108 * Retrieve the standard help menu. 109 * Retrieve the standard help menu.
109 * 110 *
110 * It contains entires for the 111 * It contains entires for the
111 * help system (activated by F1), an optional "What's This?" entry 112 * help system (activated by F1), an optional "What's This?" entry
112 * (activated by Shift F1), an application specific dialog box, 113 * (activated by Shift F1), an application specific dialog box,
113 * and an "About KDE" dialog box. 114 * and an "About KDE" dialog box.
114 * 115 *
115 * Example (adding a standard help menu to your application): 116 * Example (adding a standard help menu to your application):
116 * <pre> 117 * <pre>
117 * KPopupMenu *help = helpMenu( <myTextString> ); 118 * KPopupMenu *help = helpMenu( <myTextString> );
118 * menuBar()->insertItem( i18n("&Help"), help ); 119 * menuBar()->insertItem( i18n("&Help"), help );
119 * </pre> 120 * </pre>
120 * 121 *
121 * @param aboutAppText The string that is used in the application 122 * @param aboutAppText The string that is used in the application
122 * specific dialog box. If you leave this string empty the 123 * specific dialog box. If you leave this string empty the
123 * information in the global @ref KAboutData of the 124 * information in the global @ref KAboutData of the
124 * application will be used to make a standard dialog box. 125 * application will be used to make a standard dialog box.
125 * 126 *
126 * @param showWhatsThis Set this to false if you do not want to include 127 * @param showWhatsThis Set this to false if you do not want to include
127 * the "What's This" menu entry. 128 * the "What's This" menu entry.
128 * 129 *
129 * @return A standard help menu. 130 * @return A standard help menu.
130 */ 131 */
131//US KPopupMenu* helpMenu( const QString &aboutAppText = QString::null, 132//US KPopupMenu* helpMenu( const QString &aboutAppText = QString::null,
132//US bool showWhatsThis = TRUE ); 133//US bool showWhatsThis = TRUE );
133 134
134 /** 135 /**
135 * Returns the help menu. Creates a standard help menu if none exists yet. 136 * Returns the help menu. Creates a standard help menu if none exists yet.
136 * 137 *
137 * It contains entries for the 138 * It contains entries for the
138 * help system (activated by F1), an optional "What's This?" entry 139 * help system (activated by F1), an optional "What's This?" entry
139 * (activated by Shift F1), an application specific dialog box, 140 * (activated by Shift F1), an application specific dialog box,
140 * and an "About KDE" dialog box. You must create the application 141 * and an "About KDE" dialog box. You must create the application
141 * specific dialog box yourself. When the "About application" 142 * specific dialog box yourself. When the "About application"
142 * menu entry is activated, a signal will trigger the 143 * menu entry is activated, a signal will trigger the
143 * @ref showAboutApplication slot. See @ref showAboutApplication for more 144 * @ref showAboutApplication slot. See @ref showAboutApplication for more
144 * information. 145 * information.
145 * 146 *
146 * Example (adding a help menu to your application): 147 * Example (adding a help menu to your application):
147 * <pre> 148 * <pre>
148 * menuBar()->insertItem( i18n("&Help"), customHelpMenu() ); 149 * menuBar()->insertItem( i18n("&Help"), customHelpMenu() );
149 * </pre> 150 * </pre>
150 * 151 *
151 * @param showWhatsThis Set this to @p false if you do not want to include 152 * @param showWhatsThis Set this to @p false if you do not want to include
152 * the "What's This" menu entry. 153 * the "What's This" menu entry.
153 * 154 *
154 * @return A standard help menu. 155 * @return A standard help menu.
155 */ 156 */
156//US KPopupMenu* customHelpMenu( bool showWhatsThis = TRUE ); 157//US KPopupMenu* customHelpMenu( bool showWhatsThis = TRUE );
157 158
158 /** 159 /**
159 * @sect Session Management 160 * @sect Session Management
160 * 161 *
161 * Try to restore the toplevel widget as defined by the number (1..X). 162 * Try to restore the toplevel widget as defined by the number (1..X).
162 * 163 *
163 * If the session did not contain so high a number, the configuration 164 * If the session did not contain so high a number, the configuration
164 * is not changed and @p false returned. 165 * is not changed and @p false returned.
165 * 166 *
166 * That means clients could simply do the following: 167 * That means clients could simply do the following:
167 * <pre> 168 * <pre>
168 * if (kapp->isRestored()){ 169 * if (kapp->isRestored()){
169 * int n = 1; 170 * int n = 1;
170 * while (KMainWindow::canBeRestored(n)){ 171 * while (KMainWindow::canBeRestored(n)){
171 * (new childMW)->restore(n); 172 * (new childMW)->restore(n);
172 * n++; 173 * n++;
173 * } 174 * }
174 * } else { 175 * } else {
175 * // create default application as usual 176 * // create default application as usual
176 * } 177 * }
177 * </pre> 178 * </pre>
178 * Note that @ref QWidget::show() is called implicitly in restore. 179 * Note that @ref QWidget::show() is called implicitly in restore.
179 * 180 *
180 * With this you can easily restore all toplevel windows of your 181 * With this you can easily restore all toplevel windows of your
181 * application. 182 * application.
182 * 183 *
183 * If your application uses different kinds of toplevel 184 * If your application uses different kinds of toplevel
184 * windows, then you can use @ref KMainWindow::classNameOfToplevel(n) 185 * windows, then you can use @ref KMainWindow::classNameOfToplevel(n)
185 * to determine the exact type before calling the childMW 186 * to determine the exact type before calling the childMW
186 * constructor in the example from above. 187 * constructor in the example from above.
187 * 188 *
188 * If your client has only one kind of toplevel widgets (which 189 * If your client has only one kind of toplevel widgets (which
189 * should be pretty usual) then you should use the RESTORE-macro 190 * should be pretty usual) then you should use the RESTORE-macro
190 * for backwards compatibility with 3.1 and 3.0 branches: 191 * for backwards compatibility with 3.1 and 3.0 branches:
191 * 192 *
192 * <pre> 193 * <pre>
193 * if (kapp->isRestored()) 194 * if (kapp->isRestored())
194 * RESTORE(childMW) 195 * RESTORE(childMW)
195 * else { 196 * else {
196 * // create default application as usual 197 * // create default application as usual
197 * } 198 * }
198 * </pre> 199 * </pre>
199 * 200 *
200 * The macro expands to the term above but is easier to use and 201 * The macro expands to the term above but is easier to use and
201 * less code to write. 202 * less code to write.
202 * 203 *
203 * For new code or if you have more than one kind of toplevel 204 * For new code or if you have more than one kind of toplevel
204 * widget (each derived from @ref KMainWindow, of course), you can 205 * widget (each derived from @ref KMainWindow, of course), you can
205 * use the templated @ref kRestoreMainWindows global functions: 206 * use the templated @ref kRestoreMainWindows global functions:
206 * 207 *
207 * <pre> 208 * <pre>
208 * if (kapp->isRestored()) 209 * if (kapp->isRestored())
209 * kRestoreMainWindows< childMW1, childMW2, childMW3 >(); 210 * kRestoreMainWindows< childMW1, childMW2, childMW3 >();
210 * else { 211 * else {
211 * // create default application as usual 212 * // create default application as usual
212 * } 213 * }
213 * </pre> 214 * </pre>
214 * 215 *
215 * Currently, these functions are provided for up to three 216 * Currently, these functions are provided for up to three
216 * template arguments. If you need more, tell us. To help you in 217 * template arguments. If you need more, tell us. To help you in
217 * deciding whether or not you can use @ref kRestoreMainWindows, a 218 * deciding whether or not you can use @ref kRestoreMainWindows, a
218 * define KDE_RESTORE_MAIN_WINDOWS_NUM_TEMPLATE_ARGS is provided. 219 * define KDE_RESTORE_MAIN_WINDOWS_NUM_TEMPLATE_ARGS is provided.
219 * 220 *
220 * @see restore() 221 * @see restore()
221 * @see classNameOfToplevel() 222 * @see classNameOfToplevel()
222 * 223 *
223 **/ 224 **/
224 static bool canBeRestored( int number ); 225 static bool canBeRestored( int number );
225 226
226 /** 227 /**
227 * Returns the @ref className() of the @p number of the toplevel window which 228 * Returns the @ref className() of the @p number of the toplevel window which
228 * should be restored. 229 * should be restored.
229 * 230 *
230 * This is only useful if your application uses 231 * This is only useful if your application uses
231 * different kinds of toplevel windows. 232 * different kinds of toplevel windows.
232 */ 233 */
233 static const QString classNameOfToplevel( int number ); 234 static const QString classNameOfToplevel( int number );
234 235
235 /** 236 /**
236 * Restore the session specified by @p number. 237 * Restore the session specified by @p number.
237 * 238 *
238 * Returns @p false if this 239 * Returns @p false if this
239 * fails, otherwise returns @p true and shows the window. 240 * fails, otherwise returns @p true and shows the window.
240 * You should call @ref canBeRestored() first. 241 * You should call @ref canBeRestored() first.
241 * If @p show is true (default), this widget will be shown automatically. 242 * If @p show is true (default), this widget will be shown automatically.
242 */ 243 */
243 bool restore( int number, bool show = TRUE ); 244 bool restore( int number, bool show = TRUE );
244 245
245//US virtual KXMLGUIFactory *guiFactory(); 246//US virtual KXMLGUIFactory *guiFactory();
246 247
247 /** 248 /**
248 * Create a GUI given a local XML file. 249 * Create a GUI given a local XML file.
249 * 250 *
250 * If @p xmlfile is NULL, 251 * If @p xmlfile is NULL,
251 * then it will try to construct a local XML filename like 252 * then it will try to construct a local XML filename like
252 * appnameui.rc where 'appname' is your app's name. If that file 253 * appnameui.rc where 'appname' is your app's name. If that file
253 * does not exist, then the XML UI code will only use the global 254 * does not exist, then the XML UI code will only use the global
254 * (standard) XML file for the layout purposes. 255 * (standard) XML file for the layout purposes.
255 * 256 *
256 * Note that when passing true for the conserveMemory argument subsequent 257 * Note that when passing true for the conserveMemory argument subsequent
257 * calls to guiFactory()->addClient/removeClient may not work as expected. 258 * calls to guiFactory()->addClient/removeClient may not work as expected.
258 * Also retrieving references to containers like popup menus or toolbars using 259 * Also retrieving references to containers like popup menus or toolbars using
259 * the container method will not work. 260 * the container method will not work.
260 * 261 *
261 * @param xmlfile The local xmlfile (relative or absolute) 262 * @param xmlfile The local xmlfile (relative or absolute)
262 * @param _conserveMemory Specify whether createGUI() should call 263 * @param _conserveMemory Specify whether createGUI() should call
263 * @ref KXMLGuiClient::conserveMemory() to free all memory 264 * @ref KXMLGuiClient::conserveMemory() to free all memory
264 * allocated by the @ref QDomDocument and by the KXMLGUIFactory. 265 * allocated by the @ref QDomDocument and by the KXMLGUIFactory.
265 */ 266 */
266 void createGUI( const QString &xmlfile = QString::null, bool _conserveMemory = TRUE ); 267 void createGUI( const QString &xmlfile = QString::null, bool _conserveMemory = TRUE );
267 268
268 /** 269 /**
269 * Enables the build of a standard help menu when calling createGUI(). 270 * Enables the build of a standard help menu when calling createGUI().
270 * 271 *
271 * The default behavior is to build one, you must call this function 272 * The default behavior is to build one, you must call this function
272 * to disable it 273 * to disable it
273 */ 274 */
274 void setHelpMenuEnabled(bool showHelpMenu = true); 275 void setHelpMenuEnabled(bool showHelpMenu = true);
275 276
276 /** 277 /**
277 * Return @p true when the help menu is enabled 278 * Return @p true when the help menu is enabled
278 */ 279 */
279 bool isHelpMenuEnabled(); 280 bool isHelpMenuEnabled();
280 281
281 282
282 /** 283 /**
283 * Returns true, if there is a menubar 284 * Returns true, if there is a menubar
284 * @since 3.1 285 * @since 3.1
285 */ 286 */
286 bool hasMenuBar(); 287 bool hasMenuBar();
287 288
288 /** 289 /**
289 * Returns a pointer to the menu bar. 290 * Returns a pointer to the menu bar.
290 * 291 *
291 * If there is no menu bar yet one will be created. 292 * If there is no menu bar yet one will be created.
292 **/ 293 **/
293//US KMenuBar *menuBar(); 294//US KMenuBar *menuBar();
294 QMenuBar *menuBar(); 295 QMenuBar *menuBar();
295 296
296 /** 297 /**
297 * Returns a pointer to the status bar. 298 * Returns a pointer to the status bar.
298 * 299 *
299 * If there is no 300 * If there is no
300 * status bar yet one will be created. 301 * status bar yet one will be created.
301 */ 302 */
302//US KStatusBar *statusBar(); 303//US KStatusBar *statusBar();
303 QStatusBar *statusBar(); 304 QStatusBar *statusBar();
304 305
305 /** 306 /**
306 * List of members of KMainWindow class. 307 * List of members of KMainWindow class.
307 */ 308 */
308//US static QPtrList<KMainWindow>* memberList; 309//US static QPtrList<KMainWindow>* memberList;
309 310
310 /** 311 /**
311 * Returns a pointer to the toolbar with the specified name. 312 * Returns a pointer to the toolbar with the specified name.
312 * This refers to toolbars created dynamically from the XML UI 313 * This refers to toolbars created dynamically from the XML UI
313 * framework. If the toolbar does not exist one will be created. 314 * framework. If the toolbar does not exist one will be created.
314 * 315 *
315 * @param name The internal name of the toolbar. If no name is 316 * @param name The internal name of the toolbar. If no name is
316 * specified "mainToolBar" is assumed. 317 * specified "mainToolBar" is assumed.
317 * 318 *
318 * @return A pointer to the toolbar 319 * @return A pointer to the toolbar
319 **/ 320 **/
320 KToolBar *toolBar( const char *name=0 ); 321 KToolBar *toolBar( const char *name=0 );
321 // method for getting rid of KDE-Crap 322 // method for getting rid of KDE-Crap
322 QToolBar *tBar( ); 323 QToolBar *tBar( );
323 324
324 /** 325 /**
325 * @return An iterator over the list of all toolbars for this window. 326 * @return An iterator over the list of all toolbars for this window.
326 */ 327 */
327 QPtrListIterator<KToolBar> toolBarIterator(); 328 QPtrListIterator<KToolBar> toolBarIterator();
328 329
329 /** 330 /**
330 * @return A KAccel instance bound to this mainwindow. Used automatically 331 * @return A KAccel instance bound to this mainwindow. Used automatically
331 * by KAction to make keybindings work in all cases. 332 * by KAction to make keybindings work in all cases.
332 */ 333 */
333 KAccel *accel(); 334 KAccel *accel();
334 335
335 void setFrameBorderWidth( int ) {} 336 void setFrameBorderWidth( int ) {}
336 337
337 /** 338 /**
338 * Call this to enable "auto-save" of toolbar/menubar/statusbar settings 339 * Call this to enable "auto-save" of toolbar/menubar/statusbar settings
339 * (and optionally window size). 340 * (and optionally window size).
340 * If the *bars were moved around/shown/hidden when the window is closed, 341 * If the *bars were moved around/shown/hidden when the window is closed,
341 * saveMainWindowSettings( KGlobal::config(), groupName ) will be called. 342 * saveMainWindowSettings( KGlobal::config(), groupName ) will be called.
342 * 343 *
343 * @param groupName a name that identifies this "type of window". 344 * @param groupName a name that identifies this "type of window".
344 * You can have several types of window in the same application. 345 * You can have several types of window in the same application.
345 * 346 *
346 * @param saveWindowSize set it to true to include the window size 347 * @param saveWindowSize set it to true to include the window size
347 * when saving. 348 * when saving.
348 * 349 *
349 * Typically, you will call setAutoSaveSettings() in your 350 * Typically, you will call setAutoSaveSettings() in your
350 * KMainWindow-inherited class constructor, and it will take care 351 * KMainWindow-inherited class constructor, and it will take care
351 * of restoring and saving automatically. Make sure you call this 352 * of restoring and saving automatically. Make sure you call this
352 * _after all_ your *bars have been created. 353 * _after all_ your *bars have been created.