Diffstat (limited to 'microkde/kdeui/kmainwindow.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | microkde/kdeui/kmainwindow.cpp | 97 |
1 files changed, 47 insertions, 50 deletions
diff --git a/microkde/kdeui/kmainwindow.cpp b/microkde/kdeui/kmainwindow.cpp index fa678f2..bac0db8 100644 --- a/microkde/kdeui/kmainwindow.cpp +++ b/microkde/kdeui/kmainwindow.cpp | |||
@@ -1,89 +1,95 @@ | |||
1 | /* This file is part of the KDE libraries | 1 | /* This file is part of the KDE libraries |
2 | Copyright | 2 | Copyright |
3 | (C) 2000 Reginald Stadlbauer (reggie@kde.org) | 3 | (C) 2000 Reginald Stadlbauer (reggie@kde.org) |
4 | (C) 1997 Stephan Kulow (coolo@kde.org) | 4 | (C) 1997 Stephan Kulow (coolo@kde.org) |
5 | (C) 1997-2000 Sven Radej (radej@kde.org) | 5 | (C) 1997-2000 Sven Radej (radej@kde.org) |
6 | (C) 1997-2000 Matthias Ettrich (ettrich@kde.org) | 6 | (C) 1997-2000 Matthias Ettrich (ettrich@kde.org) |
7 | (C) 1999 Chris Schlaeger (cs@kde.org) | 7 | (C) 1999 Chris Schlaeger (cs@kde.org) |
8 | (C) 2002 Joseph Wenninger (jowenn@kde.org) | 8 | (C) 2002 Joseph Wenninger (jowenn@kde.org) |
9 | 9 | ||
10 | This library is free software; you can redistribute it and/or | 10 | This library is free software; you can redistribute it and/or |
11 | modify it under the terms of the GNU Library General Public | 11 | modify it under the terms of the GNU Library General Public |
12 | License version 2 as published by the Free Software Foundation. | 12 | License version 2 as published by the Free Software Foundation. |
13 | 13 | ||
14 | This library is distributed in the hope that it will be useful, | 14 | This library is distributed in the hope that it will be useful, |
15 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 15 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
17 | Library General Public License for more details. | 17 | Library General Public License for more details. |
18 | 18 | ||
19 | You should have received a copy of the GNU Library General Public License | 19 | You should have received a copy of the GNU Library General Public License |
20 | along with this library; see the file COPYING.LIB. If not, write to | 20 | along with this library; see the file COPYING.LIB. If not, write to |
21 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, | 21 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
22 | Boston, MA 02111-1307, USA. | 22 | Boston, MA 02111-1307, USA. |
23 | */ | 23 | */ |
24 | #include <qobjectlist.h> | 24 | #include <qobject.h> |
25 | #include <qstringlist.h> | 25 | #include <qstringlist.h> |
26 | #include <qtimer.h> | 26 | #include <qtimer.h> |
27 | #include <qmenubar.h> | 27 | #include <qmenubar.h> |
28 | #include <qstatusbar.h> | 28 | #include <qstatusbar.h> |
29 | #include <qapplication.h> | 29 | #include <qapplication.h> |
30 | //Added by qt3to4: | ||
31 | #include <QCloseEvent> | ||
32 | #include <QPaintEvent> | ||
33 | #include <QResizeEvent> | ||
34 | #include <QChildEvent> | ||
35 | #include <Q3PtrList> | ||
30 | 36 | ||
31 | 37 | ||
32 | #include "kdebug.h" | 38 | #include "kdebug.h" |
33 | #include "kmainwindow.h" | 39 | #include "kmainwindow.h" |
34 | #include "kglobalsettings.h" | 40 | #include "kglobalsettings.h" |
35 | #include "kactioncollection.h" | 41 | #include "kactioncollection.h" |
36 | 42 | ||
37 | class KMainWindowPrivate { | 43 | class KMainWindowPrivate { |
38 | public: | 44 | public: |
39 | //US bool showHelpMenu:1; | 45 | //US bool showHelpMenu:1; |
40 | 46 | ||
41 | bool autoSaveSettings:1; | 47 | bool autoSaveSettings:1; |
42 | bool settingsDirty:1; | 48 | bool settingsDirty:1; |
43 | bool autoSaveWindowSize:1; | 49 | bool autoSaveWindowSize:1; |
44 | bool care_about_geometry:1; | 50 | bool care_about_geometry:1; |
45 | QString autoSaveGroup; | 51 | QString autoSaveGroup; |
46 | //US KAccel * kaccel; | 52 | //US KAccel * kaccel; |
47 | //US KMainWindowInterface *m_interface; | 53 | //US KMainWindowInterface *m_interface; |
48 | KDEPrivate::ToolBarHandler *toolBarHandler; | 54 | KDEPrivate::ToolBarHandler *toolBarHandler; |
49 | QTimer* settingsTimer; | 55 | QTimer* settingsTimer; |
50 | KToggleAction *showStatusBarAction; | 56 | KToggleAction *showStatusBarAction; |
51 | QRect defaultWindowSize; | 57 | QRect defaultWindowSize; |
52 | }; | 58 | }; |
53 | 59 | ||
54 | static bool no_query_exit = false; | 60 | static bool no_query_exit = false; |
55 | 61 | ||
56 | KMainWindow::KMainWindow( QWidget* parent, const char *name ) | 62 | KMainWindow::KMainWindow( QWidget* parent, const char *name ) |
57 | : QMainWindow( parent, name ) /*LR, f ) with the default widget flag we cannot have fastload */ /*US, KXMLGUIBuilder( this ), helpMenu2( 0 ), factory_( 0 )*/ | 63 | : Q3MainWindow( parent, name ) /*LR, f ) with the default widget flag we cannot have fastload */ /*US, KXMLGUIBuilder( this ), helpMenu2( 0 ), factory_( 0 )*/ |
58 | { | 64 | { |
59 | mQToolBar = 0; | 65 | mQToolBar = 0; |
60 | initKMainWindow(name); | 66 | initKMainWindow(name); |
61 | } | 67 | } |
62 | 68 | ||
63 | void KMainWindow::parseGeometry(bool parsewidth) | 69 | void KMainWindow::parseGeometry(bool parsewidth) |
64 | { | 70 | { |
65 | //US the following code is not getting used in the embedded version !! So disable it for now | 71 | //US the following code is not getting used in the embedded version !! So disable it for now |
66 | /*US | 72 | /*US |
67 | 73 | ||
68 | assert ( !kapp->geometryArgument().isNull() ); | 74 | assert ( !kapp->geometryArgument().isNull() ); |
69 | assert ( d->care_about_geometry ); | 75 | assert ( d->care_about_geometry ); |
70 | 76 | ||
71 | #ifndef Q_WS_QWS | 77 | #ifndef Q_WS_QWS |
72 | // FIXME: (E) Implement something similar for Qt Embedded (or decide we don't need it) | 78 | // FIXME: (E) Implement something similar for Qt Embedded (or decide we don't need it) |
73 | int x, y; | 79 | int x, y; |
74 | int w, h; | 80 | int w, h; |
75 | int m = XParseGeometry( kapp->geometryArgument().latin1(), &x, &y, (unsigned int*)&w, (unsigned int*)&h); | 81 | int m = XParseGeometry( kapp->geometryArgument().latin1(), &x, &y, (unsigned int*)&w, (unsigned int*)&h); |
76 | if (parsewidth) { | 82 | if (parsewidth) { |
77 | QSize minSize = minimumSize(); | 83 | QSize minSize = minimumSize(); |
78 | QSize maxSize = maximumSize(); | 84 | QSize maxSize = maximumSize(); |
79 | if ( (m & WidthValue) == 0 ) | 85 | if ( (m & WidthValue) == 0 ) |
80 | w = width(); | 86 | w = width(); |
81 | if ( (m & HeightValue) == 0 ) | 87 | if ( (m & HeightValue) == 0 ) |
82 | h = height(); | 88 | h = height(); |
83 | w = QMIN(w,maxSize.width()); | 89 | w = QMIN(w,maxSize.width()); |
84 | h = QMIN(h,maxSize.height()); | 90 | h = QMIN(h,maxSize.height()); |
85 | w = QMAX(w,minSize.width()); | 91 | w = QMAX(w,minSize.width()); |
86 | h = QMAX(h,minSize.height()); | 92 | h = QMAX(h,minSize.height()); |
87 | resize(w, h); | 93 | resize(w, h); |
88 | } else { | 94 | } else { |
89 | if ( parsewidth && (m & XValue) == 0 ) | 95 | if ( parsewidth && (m & XValue) == 0 ) |
@@ -247,65 +253,65 @@ bool KMainWindow::restore( int number, bool show ) | |||
247 | { | 253 | { |
248 | /*US we do not have and want to save sessioninformation. Use info from the default | 254 | /*US we do not have and want to save sessioninformation. Use info from the default |
249 | application config. | 255 | application config. |
250 | */ | 256 | */ |
251 | if ( !canBeRestored( number ) ) | 257 | if ( !canBeRestored( number ) ) |
252 | return FALSE; | 258 | return FALSE; |
253 | //US KConfig *config = kapp->sessionConfig(); | 259 | //US KConfig *config = kapp->sessionConfig(); |
254 | KConfig *config = KGlobal::config(); | 260 | KConfig *config = KGlobal::config(); |
255 | 261 | ||
256 | if ( readPropertiesInternal( config, number ) ){ | 262 | if ( readPropertiesInternal( config, number ) ){ |
257 | if ( show ) | 263 | if ( show ) |
258 | KMainWindow::show(); | 264 | KMainWindow::show(); |
259 | return FALSE; | 265 | return FALSE; |
260 | } | 266 | } |
261 | return FALSE; | 267 | return FALSE; |
262 | 268 | ||
263 | } | 269 | } |
264 | 270 | ||
265 | void KMainWindow::setCaption( const QString &caption ) | 271 | void KMainWindow::setCaption( const QString &caption ) |
266 | { | 272 | { |
267 | //US setPlainCaption( kapp->makeStdCaption(caption) ); | 273 | //US setPlainCaption( kapp->makeStdCaption(caption) ); |
268 | setPlainCaption( caption ); | 274 | setPlainCaption( caption ); |
269 | } | 275 | } |
270 | 276 | ||
271 | void KMainWindow::setCaption( const QString &caption, bool modified ) | 277 | void KMainWindow::setCaption( const QString &caption, bool modified ) |
272 | { | 278 | { |
273 | //US setPlainCaption( kapp->makeStdCaption(caption, true, modified) ); | 279 | //US setPlainCaption( kapp->makeStdCaption(caption, true, modified) ); |
274 | setPlainCaption( caption + "modified:" ); | 280 | setPlainCaption( caption + "modified:" ); |
275 | } | 281 | } |
276 | 282 | ||
277 | void KMainWindow::setPlainCaption( const QString &caption ) | 283 | void KMainWindow::setPlainCaption( const QString &caption ) |
278 | { | 284 | { |
279 | QMainWindow::setCaption( caption ); | 285 | Q3MainWindow::setCaption( caption ); |
280 | #ifndef Q_WS_QWS | 286 | #ifndef Q_WS_QWS |
281 | //US the following is disabled for the embedded version | 287 | //US the following is disabled for the embedded version |
282 | //US NETWinInfo info( qt_xdisplay(), winId(), qt_xrootwin(), 0 ); | 288 | //US NETWinInfo info( qt_xdisplay(), winId(), qt_xrootwin(), 0 ); |
283 | //US info.setName( caption.utf8().data() ); | 289 | //US info.setName( caption.utf8().data() ); |
284 | #endif | 290 | #endif |
285 | } | 291 | } |
286 | 292 | ||
287 | void KMainWindow::slotStateChanged(const QString &newstate) | 293 | void KMainWindow::slotStateChanged(const QString &newstate) |
288 | { | 294 | { |
289 | stateChanged(newstate, KXMLGUIClient::StateNoReverse); | 295 | stateChanged(newstate, KXMLGUIClient::StateNoReverse); |
290 | } | 296 | } |
291 | 297 | ||
292 | /* | 298 | /* |
293 | * Get rid of this for KDE 4.0 | 299 | * Get rid of this for KDE 4.0 |
294 | */ | 300 | */ |
295 | void KMainWindow::slotStateChanged(const QString &newstate, | 301 | void KMainWindow::slotStateChanged(const QString &newstate, |
296 | KXMLGUIClient::ReverseStateChange reverse) | 302 | KXMLGUIClient::ReverseStateChange reverse) |
297 | { | 303 | { |
298 | stateChanged(newstate, reverse); | 304 | stateChanged(newstate, reverse); |
299 | } | 305 | } |
300 | 306 | ||
301 | void KMainWindow::closeEvent ( QCloseEvent *e ) | 307 | void KMainWindow::closeEvent ( QCloseEvent *e ) |
302 | { | 308 | { |
303 | //qDebug("MainWindow::closeEvent "); | 309 | //qDebug("MainWindow::closeEvent "); |
304 | // Save settings if auto-save is enabled, and settings have changed | 310 | // Save settings if auto-save is enabled, and settings have changed |
305 | if (d->settingsDirty && d->autoSaveSettings) | 311 | if (d->settingsDirty && d->autoSaveSettings) |
306 | saveAutoSaveSettings(); | 312 | saveAutoSaveSettings(); |
307 | 313 | ||
308 | if (queryClose()) { | 314 | if (queryClose()) { |
309 | e->accept(); | 315 | e->accept(); |
310 | 316 | ||
311 | int not_withdrawn = 0; | 317 | int not_withdrawn = 0; |
@@ -392,147 +398,148 @@ void KMainWindow::setStandardToolBarMenuEnabled( bool enable ) | |||
392 | /*US if ( factory() ) | 398 | /*US if ( factory() ) |
393 | factory()->addClient( d->toolBarHandler ); | 399 | factory()->addClient( d->toolBarHandler ); |
394 | */ | 400 | */ |
395 | } | 401 | } |
396 | else | 402 | else |
397 | { | 403 | { |
398 | if ( !d->toolBarHandler ) | 404 | if ( !d->toolBarHandler ) |
399 | return; | 405 | return; |
400 | /*US | 406 | /*US |
401 | if ( factory() ) | 407 | if ( factory() ) |
402 | factory()->removeClient( d->toolBarHandler ); | 408 | factory()->removeClient( d->toolBarHandler ); |
403 | */ | 409 | */ |
404 | delete d->toolBarHandler; | 410 | delete d->toolBarHandler; |
405 | d->toolBarHandler = 0; | 411 | d->toolBarHandler = 0; |
406 | } | 412 | } |
407 | 413 | ||
408 | } | 414 | } |
409 | 415 | ||
410 | bool KMainWindow::isStandardToolBarMenuEnabled() const | 416 | bool KMainWindow::isStandardToolBarMenuEnabled() const |
411 | { | 417 | { |
412 | return ( d->toolBarHandler != 0 ); | 418 | return ( d->toolBarHandler != 0 ); |
413 | } | 419 | } |
414 | 420 | ||
415 | void KMainWindow::createStandardStatusBarAction(){ | 421 | void KMainWindow::createStandardStatusBarAction(){ |
416 | if(!d->showStatusBarAction){ | 422 | if(!d->showStatusBarAction){ |
417 | d->showStatusBarAction = KStdAction::showStatusbar(this, SLOT(setSettingsDirty()), actionCollection()); | 423 | d->showStatusBarAction = KStdAction::showStatusbar(this, SLOT(setSettingsDirty()), actionCollection()); |
418 | connect(d->showStatusBarAction, SIGNAL(toggled(bool)), statusBar(), SLOT(setShown(bool))); | 424 | connect(d->showStatusBarAction, SIGNAL(toggled(bool)), statusBar(), SLOT(setShown(bool))); |
419 | if(internalStatusBar()) | 425 | if(internalStatusBar()) |
420 | d->showStatusBarAction->setChecked(!internalStatusBar()->isHidden()); | 426 | d->showStatusBarAction->setChecked(!internalStatusBar()->isHidden()); |
421 | } | 427 | } |
422 | } | 428 | } |
423 | 429 | ||
424 | QToolBar *KMainWindow::tBar( ) | 430 | Q3ToolBar *KMainWindow::tBar( ) |
425 | { | 431 | { |
426 | if ( ! mQToolBar ) | 432 | if ( ! mQToolBar ) |
427 | mQToolBar = new QToolBar( this ); | 433 | mQToolBar = new Q3ToolBar( this ); |
428 | return mQToolBar; | 434 | return mQToolBar; |
429 | } | 435 | } |
430 | 436 | ||
431 | KToolBar *KMainWindow::toolBar( const char * name ) | 437 | KToolBar *KMainWindow::toolBar( const char * name ) |
432 | { | 438 | { |
433 | 439 | ||
434 | if (!name) | 440 | if (!name) |
435 | name = "mainToolBar"; | 441 | name = "mainToolBar"; |
436 | KToolBar *tb = (KToolBar*)child( name, "KToolBar" ); | 442 | KToolBar *tb = (KToolBar*)child( name, "KToolBar" ); |
437 | if ( tb ) | 443 | if ( tb ) |
438 | return tb; | 444 | return tb; |
439 | bool honor_mode = (name == "mainToolBar"); | 445 | bool honor_mode = (name == "mainToolBar"); |
440 | 446 | ||
441 | /*US | 447 | /*US |
442 | if ( builderClient() ) | 448 | if ( builderClient() ) |
443 | return new KToolBar(this, name, honor_mode); // XMLGUI constructor | 449 | return new KToolBar(this, name, honor_mode); // XMLGUI constructor |
444 | else | 450 | else |
445 | */ | 451 | */ |
446 | return new KToolBar(this, Top, false, name, honor_mode ); // non-XMLGUI | 452 | return new KToolBar(this, Qt::Top, false, name, honor_mode ); // non-XMLGUI |
447 | } | 453 | } |
448 | 454 | ||
449 | QPtrListIterator<KToolBar> KMainWindow::toolBarIterator() | 455 | Q3PtrListIterator<KToolBar> KMainWindow::toolBarIterator() |
450 | { | 456 | { |
451 | toolbarList.clear(); | 457 | toolbarList.clear(); |
452 | QPtrList<QToolBar> lst; | 458 | QList<Q3ToolBar*> lst; |
453 | for ( int i = (int)QMainWindow::Unmanaged; i <= (int)Minimized; ++i ) { | 459 | for ( int i = (int)Qt::Unmanaged; i <= (int)Qt::Minimized; ++i ) { |
454 | lst = toolBars( (ToolBarDock)i ); | 460 | lst = toolBars( (Qt::ToolBarDock)i ); |
455 | for ( QToolBar *tb = lst.first(); tb; tb = lst.next() ) { | 461 | for(QList<Q3ToolBar*>::iterator i=lst.begin();i!=lst.end();++i) { |
462 | Q3ToolBar *tb = *i; | ||
456 | if ( !tb->inherits( "KToolBar" ) ) | 463 | if ( !tb->inherits( "KToolBar" ) ) |
457 | continue; | 464 | continue; |
458 | toolbarList.append( (KToolBar*)tb ); | 465 | toolbarList.append( (KToolBar*)tb ); |
459 | } | 466 | } |
460 | } | 467 | } |
461 | return QPtrListIterator<KToolBar>( toolbarList ); | 468 | return Q3PtrListIterator<KToolBar>( toolbarList ); |
462 | } | 469 | } |
463 | 470 | ||
464 | void KMainWindow::setAutoSaveSettings( const QString & groupName, bool saveWindowSize ) | 471 | void KMainWindow::setAutoSaveSettings( const QString & groupName, bool saveWindowSize ) |
465 | { | 472 | { |
466 | d->autoSaveSettings = true; | 473 | d->autoSaveSettings = true; |
467 | d->autoSaveGroup = groupName; | 474 | d->autoSaveGroup = groupName; |
468 | d->autoSaveWindowSize = saveWindowSize; | 475 | d->autoSaveWindowSize = saveWindowSize; |
469 | // Get notified when the user moves a toolbar around | 476 | // Get notified when the user moves a toolbar around |
470 | //US connect( this, SIGNAL( dockWindowPositionChanged( QDockWindow * ) ), | 477 | //US connect( this, SIGNAL( dockWindowPositionChanged( QDockWindow * ) ), |
471 | //US this, SLOT( setSettingsDirty() ) ); | 478 | //US this, SLOT( setSettingsDirty() ) ); |
472 | connect( this, SIGNAL( toolBarPositionChanged(QToolBar *) ), | 479 | connect( this, SIGNAL( toolBarPositionChanged(Q3ToolBar *) ), |
473 | this, SLOT( setSettingsDirty() ) ); | 480 | this, SLOT( setSettingsDirty() ) ); |
474 | 481 | ||
475 | 482 | ||
476 | // Get default values | 483 | // Get default values |
477 | //US int scnum = QApplication::desktop()->screenNumber(parentWidget()); | 484 | //US int scnum = QApplication::desktop()->screenNumber(parentWidget()); |
478 | //US QRect desk = QApplication::desktop()->screenGeometry(scnum); | 485 | //US QRect desk = QApplication::desktop()->screenGeometry(scnum); |
479 | QRect desk = KGlobalSettings::desktopGeometry(0); | 486 | QRect desk = KGlobalSettings::desktopGeometry(0); |
480 | 487 | ||
481 | d->defaultWindowSize = QRect(desk.width(), width(), desk.height(), height()); | 488 | d->defaultWindowSize = QRect(desk.width(), width(), desk.height(), height()); |
482 | // Now read the previously saved settings | 489 | // Now read the previously saved settings |
483 | applyMainWindowSettings( KGlobal::config(), groupName ); | 490 | applyMainWindowSettings( KGlobal::config(), groupName ); |
484 | } | 491 | } |
485 | 492 | ||
486 | 493 | ||
487 | void KMainWindow::resetAutoSaveSettings() | 494 | void KMainWindow::resetAutoSaveSettings() |
488 | { | 495 | { |
489 | d->autoSaveSettings = false; | 496 | d->autoSaveSettings = false; |
490 | if ( d->settingsTimer ) | 497 | if ( d->settingsTimer ) |
491 | d->settingsTimer->stop(); | 498 | d->settingsTimer->stop(); |
492 | } | 499 | } |
493 | 500 | ||
494 | bool KMainWindow::autoSaveSettings() const | 501 | bool KMainWindow::autoSaveSettings() const |
495 | { | 502 | { |
496 | return d->autoSaveSettings; | 503 | return d->autoSaveSettings; |
497 | } | 504 | } |
498 | 505 | ||
499 | QString KMainWindow::autoSaveGroup() const | 506 | QString KMainWindow::autoSaveGroup() const |
500 | { | 507 | { |
501 | return d->autoSaveGroup; | 508 | return d->autoSaveGroup; |
502 | } | 509 | } |
503 | 510 | ||
504 | void KMainWindow::saveAutoSaveSettings() | 511 | void KMainWindow::saveAutoSaveSettings() |
505 | { | 512 | { |
506 | ASSERT( d->autoSaveSettings ); | 513 | Q_ASSERT( d->autoSaveSettings ); |
507 | //kdDebug(200) << "KMainWindow::saveAutoSaveSettings -> saving settings" << endl; | 514 | //kdDebug(200) << "KMainWindow::saveAutoSaveSettings -> saving settings" << endl; |
508 | saveMainWindowSettings( KGlobal::config(), d->autoSaveGroup ); | 515 | saveMainWindowSettings( KGlobal::config(), d->autoSaveGroup ); |
509 | KGlobal::config()->sync(); | 516 | KGlobal::config()->sync(); |
510 | d->settingsDirty = false; | 517 | d->settingsDirty = false; |
511 | if ( d->settingsTimer ) | 518 | if ( d->settingsTimer ) |
512 | d->settingsTimer->stop(); | 519 | d->settingsTimer->stop(); |
513 | } | 520 | } |
514 | 521 | ||
515 | void KMainWindow::createGUI( const QString &xmlfile, bool _conserveMemory ) | 522 | void KMainWindow::createGUI( const QString &xmlfile, bool _conserveMemory ) |
516 | { | 523 | { |
517 | // disabling the updates prevents unnecessary redraws | 524 | // disabling the updates prevents unnecessary redraws |
518 | setUpdatesEnabled( false ); | 525 | setUpdatesEnabled( false ); |
519 | 526 | ||
520 | // just in case we are rebuilding, let's remove our old client | 527 | // just in case we are rebuilding, let's remove our old client |
521 | //US guiFactory()->removeClient( this ); | 528 | //US guiFactory()->removeClient( this ); |
522 | 529 | ||
523 | // make sure to have an empty GUI | 530 | // make sure to have an empty GUI |
524 | QMenuBar* mb = internalMenuBar(); | 531 | QMenuBar* mb = internalMenuBar(); |
525 | if ( mb ) | 532 | if ( mb ) |
526 | mb->clear(); | 533 | mb->clear(); |
527 | 534 | ||
528 | (void)toolBarIterator(); // make sure toolbarList is most-up-to-date | 535 | (void)toolBarIterator(); // make sure toolbarList is most-up-to-date |
529 | toolbarList.setAutoDelete( true ); | 536 | toolbarList.setAutoDelete( true ); |
530 | toolbarList.clear(); | 537 | toolbarList.clear(); |
531 | toolbarList.setAutoDelete( false ); | 538 | toolbarList.setAutoDelete( false ); |
532 | /*US | 539 | /*US |
533 | // don't build a help menu unless the user ask for it | 540 | // don't build a help menu unless the user ask for it |
534 | if (d->showHelpMenu) { | 541 | if (d->showHelpMenu) { |
535 | // we always want a help menu | 542 | // we always want a help menu |
536 | if (helpMenu2 == 0) | 543 | if (helpMenu2 == 0) |
537 | helpMenu2 = new KHelpMenu(this, instance()->aboutData(), true, | 544 | helpMenu2 = new KHelpMenu(this, instance()->aboutData(), true, |
538 | actionCollection()); | 545 | actionCollection()); |
@@ -610,65 +617,65 @@ void KMainWindow::saveMainWindowSettings(KConfig *config, const QString &configG | |||
610 | if (sb) { | 617 | if (sb) { |
611 | entryList.clear(); | 618 | entryList.clear(); |
612 | if ( sb->isHidden() ) | 619 | if ( sb->isHidden() ) |
613 | entryList.append("Disabled"); | 620 | entryList.append("Disabled"); |
614 | else | 621 | else |
615 | entryList.append("Enabled"); | 622 | entryList.append("Enabled"); |
616 | 623 | ||
617 | if(sb->isHidden()) | 624 | if(sb->isHidden()) |
618 | //US config->writeEntry(QString::fromLatin1("StatusBar"), entryList, ';'); | 625 | //US config->writeEntry(QString::fromLatin1("StatusBar"), entryList, ';'); |
619 | config->writeEntry(QString::fromLatin1("StatusBar"), entryList); | 626 | config->writeEntry(QString::fromLatin1("StatusBar"), entryList); |
620 | else | 627 | else |
621 | config->deleteEntry(QString::fromLatin1("StatusBar")); | 628 | config->deleteEntry(QString::fromLatin1("StatusBar")); |
622 | } | 629 | } |
623 | 630 | ||
624 | QMenuBar* mb = internalMenuBar(); | 631 | QMenuBar* mb = internalMenuBar(); |
625 | if (mb) { | 632 | if (mb) { |
626 | entryList.clear(); | 633 | entryList.clear(); |
627 | if ( mb->isHidden() ) | 634 | if ( mb->isHidden() ) |
628 | entryList.append("Disabled"); | 635 | entryList.append("Disabled"); |
629 | else | 636 | else |
630 | entryList.append("Enabled"); | 637 | entryList.append("Enabled"); |
631 | 638 | ||
632 | // By default we don't hide. | 639 | // By default we don't hide. |
633 | if(mb->isHidden()) | 640 | if(mb->isHidden()) |
634 | //US config->writeEntry(QString::fromLatin1("MenuBar"), entryList, ';'); | 641 | //US config->writeEntry(QString::fromLatin1("MenuBar"), entryList, ';'); |
635 | config->writeEntry(QString::fromLatin1("MenuBar"), entryList); | 642 | config->writeEntry(QString::fromLatin1("MenuBar"), entryList); |
636 | else | 643 | else |
637 | config->deleteEntry(QString::fromLatin1("MenuBar")); | 644 | config->deleteEntry(QString::fromLatin1("MenuBar")); |
638 | } | 645 | } |
639 | 646 | ||
640 | int n = 1; // Toolbar counter. toolbars are counted from 1, | 647 | int n = 1; // Toolbar counter. toolbars are counted from 1, |
641 | KToolBar *toolbar = 0; | 648 | KToolBar *toolbar = 0; |
642 | QPtrListIterator<KToolBar> it( toolBarIterator() ); | 649 | Q3PtrListIterator<KToolBar> it( toolBarIterator() ); |
643 | while ( ( toolbar = it.current() ) ) { | 650 | while ( ( toolbar = it.current() ) ) { |
644 | ++it; | 651 | ++it; |
645 | QString group; | 652 | QString group; |
646 | if (!configGroup.isEmpty()) | 653 | if (!configGroup.isEmpty()) |
647 | { | 654 | { |
648 | // Give a number to the toolbar, but prefer a name if there is one, | 655 | // Give a number to the toolbar, but prefer a name if there is one, |
649 | // because there's no real guarantee on the ordering of toolbars | 656 | // because there's no real guarantee on the ordering of toolbars |
650 | group = (!::qstrcmp(toolbar->name(), "unnamed") ? QString::number(n) : QString(" ")+toolbar->name()); | 657 | group = (!::qstrcmp(toolbar->name(), "unnamed") ? QString::number(n) : QString(" ")+toolbar->name()); |
651 | group.prepend(" Toolbar"); | 658 | group.prepend(" Toolbar"); |
652 | group.prepend(configGroup); | 659 | group.prepend(configGroup); |
653 | } | 660 | } |
654 | toolbar->saveSettings(config, group); | 661 | toolbar->saveSettings(config, group); |
655 | n++; | 662 | n++; |
656 | } | 663 | } |
657 | if (!configGroup.isEmpty()) | 664 | if (!configGroup.isEmpty()) |
658 | config->setGroup(oldGroup); | 665 | config->setGroup(oldGroup); |
659 | } | 666 | } |
660 | 667 | ||
661 | bool KMainWindow::readPropertiesInternal( KConfig *config, int number ) | 668 | bool KMainWindow::readPropertiesInternal( KConfig *config, int number ) |
662 | { | 669 | { |
663 | if ( number == 1 ) | 670 | if ( number == 1 ) |
664 | readGlobalProperties( config ); | 671 | readGlobalProperties( config ); |
665 | 672 | ||
666 | // in order they are in toolbar list | 673 | // in order they are in toolbar list |
667 | QString s; | 674 | QString s; |
668 | s.setNum(number); | 675 | s.setNum(number); |
669 | s.prepend(QString::fromLatin1("WindowProperties")); | 676 | s.prepend(QString::fromLatin1("WindowProperties")); |
670 | 677 | ||
671 | config->setGroup(s); | 678 | config->setGroup(s); |
672 | 679 | ||
673 | // restore the object name (window role) | 680 | // restore the object name (window role) |
674 | if ( config->hasKey(QString::fromLatin1("ObjectName" )) ) | 681 | if ( config->hasKey(QString::fromLatin1("ObjectName" )) ) |
@@ -685,107 +692,109 @@ bool KMainWindow::readPropertiesInternal( KConfig *config, int number ) | |||
685 | void KMainWindow::applyMainWindowSettings(KConfig *config, const QString &configGroup) | 692 | void KMainWindow::applyMainWindowSettings(KConfig *config, const QString &configGroup) |
686 | { | 693 | { |
687 | kdDebug(200) << "KMainWindow::applyMainWindowSettings" << endl; | 694 | kdDebug(200) << "KMainWindow::applyMainWindowSettings" << endl; |
688 | QString entry; | 695 | QString entry; |
689 | //US QStrList entryList; | 696 | //US QStrList entryList; |
690 | QStringList entryList; | 697 | QStringList entryList; |
691 | int i = 0; // Number of entries in list | 698 | int i = 0; // Number of entries in list |
692 | 699 | ||
693 | if (!configGroup.isEmpty()) | 700 | if (!configGroup.isEmpty()) |
694 | config->setGroup(configGroup); | 701 | config->setGroup(configGroup); |
695 | 702 | ||
696 | restoreWindowSize(config); | 703 | restoreWindowSize(config); |
697 | 704 | ||
698 | QStatusBar* sb = internalStatusBar(); | 705 | QStatusBar* sb = internalStatusBar(); |
699 | if (sb) { | 706 | if (sb) { |
700 | entryList.clear(); | 707 | entryList.clear(); |
701 | //US i = config->readListEntry (QString::fromLatin1("StatusBar"), entryList, ';'); | 708 | //US i = config->readListEntry (QString::fromLatin1("StatusBar"), entryList, ';'); |
702 | entryList = config->readListEntry (QString::fromLatin1("StatusBar")); | 709 | entryList = config->readListEntry (QString::fromLatin1("StatusBar")); |
703 | entry = entryList.first(); | 710 | entry = entryList.first(); |
704 | if (entry == QString::fromLatin1("Disabled")) | 711 | if (entry == QString::fromLatin1("Disabled")) |
705 | sb->hide(); | 712 | sb->hide(); |
706 | else | 713 | else |
707 | sb->show(); | 714 | sb->show(); |
708 | if(d->showStatusBarAction) | 715 | if(d->showStatusBarAction) |
709 | d->showStatusBarAction->setChecked(!sb->isHidden()); | 716 | d->showStatusBarAction->setChecked(!sb->isHidden()); |
710 | } | 717 | } |
711 | 718 | ||
712 | QMenuBar* mb = internalMenuBar(); | 719 | QMenuBar* mb = internalMenuBar(); |
713 | if (mb) { | 720 | if (mb) { |
714 | entryList.clear(); | 721 | entryList.clear(); |
715 | //US i = config->readListEntry (QString::fromLatin1("MenuBar"), entryList, ';'); | 722 | //US i = config->readListEntry (QString::fromLatin1("MenuBar"), entryList, ';'); |
716 | entryList = config->readListEntry (QString::fromLatin1("MenuBar")); | 723 | entryList = config->readListEntry (QString::fromLatin1("MenuBar")); |
717 | entry = entryList.first(); | 724 | if(!entryList.empty()) { |
718 | if (entry==QString::fromLatin1("Disabled")) | 725 | entry = entryList.first(); |
719 | { | 726 | if (entry==QString::fromLatin1("Disabled")) |
720 | mb->hide(); | 727 | { |
721 | } else | 728 | mb->hide(); |
722 | { | 729 | } else |
723 | mb->show(); | 730 | { |
724 | } | 731 | mb->show(); |
732 | } | ||
733 | } | ||
725 | } | 734 | } |
726 | 735 | ||
727 | int n = 1; // Toolbar counter. toolbars are counted from 1, | 736 | int n = 1; // Toolbar counter. toolbars are counted from 1, |
728 | KToolBar *toolbar; | 737 | KToolBar *toolbar; |
729 | QPtrListIterator<KToolBar> it( toolBarIterator() ); // must use own iterator | 738 | Q3PtrListIterator<KToolBar> it( toolBarIterator() ); // must use own iterator |
730 | 739 | ||
731 | for ( ; it.current(); ++it) { | 740 | for ( ; it.current(); ++it) { |
732 | toolbar= it.current(); | 741 | toolbar= it.current(); |
733 | QString group; | 742 | QString group; |
734 | if (!configGroup.isEmpty()) | 743 | if (!configGroup.isEmpty()) |
735 | { | 744 | { |
736 | // Give a number to the toolbar, but prefer a name if there is one, | 745 | // Give a number to the toolbar, but prefer a name if there is one, |
737 | // because there's no real guarantee on the ordering of toolbars | 746 | // because there's no real guarantee on the ordering of toolbars |
738 | group = (!::qstrcmp(toolbar->name(), "unnamed") ? QString::number(n) : QString(" ")+toolbar->name()); | 747 | group = (!::qstrcmp(toolbar->name(), "unnamed") ? QString::number(n) : QString(" ")+toolbar->name()); |
739 | group.prepend(" Toolbar"); | 748 | group.prepend(" Toolbar"); |
740 | group.prepend(configGroup); | 749 | group.prepend(configGroup); |
741 | } | 750 | } |
742 | toolbar->applySettings(config, group); | 751 | toolbar->applySettings(config, group); |
743 | n++; | 752 | n++; |
744 | } | 753 | } |
745 | 754 | ||
746 | finalizeGUI( true ); | 755 | finalizeGUI( true ); |
747 | } | 756 | } |
748 | 757 | ||
749 | void KMainWindow::finalizeGUI( bool force ) | 758 | void KMainWindow::finalizeGUI( bool force ) |
750 | { | 759 | { |
751 | //kdDebug(200) << "KMainWindow::finalizeGUI force=" << force << endl; | 760 | //kdDebug(200) << "KMainWindow::finalizeGUI force=" << force << endl; |
752 | // The whole reason for this is that moveToolBar relies on the indexes | 761 | // The whole reason for this is that moveToolBar relies on the indexes |
753 | // of the other toolbars, so in theory it should be called only once per | 762 | // of the other toolbars, so in theory it should be called only once per |
754 | // toolbar, but in increasing order of indexes. | 763 | // toolbar, but in increasing order of indexes. |
755 | // Since we can't do that immediately, we move them, and _then_ | 764 | // Since we can't do that immediately, we move them, and _then_ |
756 | // we call positionYourself again for each of them, but this time | 765 | // we call positionYourself again for each of them, but this time |
757 | // the toolbariterator should give them in the proper order. | 766 | // the toolbariterator should give them in the proper order. |
758 | // Both the XMLGUI and applySettings call this, hence "force" for the latter. | 767 | // Both the XMLGUI and applySettings call this, hence "force" for the latter. |
759 | QPtrListIterator<KToolBar> it( toolBarIterator() ); | 768 | Q3PtrListIterator<KToolBar> it( toolBarIterator() ); |
760 | for ( ; it.current() ; ++ it ) | 769 | for ( ; it.current() ; ++ it ) |
761 | it.current()->positionYourself( force ); | 770 | it.current()->positionYourself( force ); |
762 | 771 | ||
763 | d->settingsDirty = false; | 772 | d->settingsDirty = false; |
764 | } | 773 | } |
765 | 774 | ||
766 | void KMainWindow::saveWindowSize( KConfig * config ) const | 775 | void KMainWindow::saveWindowSize( KConfig * config ) const |
767 | { | 776 | { |
768 | /*US | 777 | /*US |
769 | int scnum = QApplication::desktop()->screenNumber(parentWidget()); | 778 | int scnum = QApplication::desktop()->screenNumber(parentWidget()); |
770 | QRect desk = QApplication::desktop()->screenGeometry(scnum); | 779 | QRect desk = QApplication::desktop()->screenGeometry(scnum); |
771 | */ | 780 | */ |
772 | QRect desk = KGlobalSettings::desktopGeometry(0); | 781 | QRect desk = KGlobalSettings::desktopGeometry(0); |
773 | 782 | ||
774 | QRect size( desk.width(), width(), desk.height(), height() ); | 783 | QRect size( desk.width(), width(), desk.height(), height() ); |
775 | if(size != d->defaultWindowSize){ | 784 | if(size != d->defaultWindowSize){ |
776 | config->writeEntry(QString::fromLatin1("Width %1").arg(desk.width()), width() ); | 785 | config->writeEntry(QString::fromLatin1("Width %1").arg(desk.width()), width() ); |
777 | config->writeEntry(QString::fromLatin1("Height %1").arg(desk.height()), height() ); | 786 | config->writeEntry(QString::fromLatin1("Height %1").arg(desk.height()), height() ); |
778 | } | 787 | } |
779 | else{ | 788 | else{ |
780 | config->deleteEntry(QString::fromLatin1("Width %1").arg(desk.width())); | 789 | config->deleteEntry(QString::fromLatin1("Width %1").arg(desk.width())); |
781 | config->deleteEntry(QString::fromLatin1("Height %1").arg(desk.height())); | 790 | config->deleteEntry(QString::fromLatin1("Height %1").arg(desk.height())); |
782 | } | 791 | } |
783 | } | 792 | } |
784 | 793 | ||
785 | void KMainWindow::restoreWindowSize( KConfig * config ) | 794 | void KMainWindow::restoreWindowSize( KConfig * config ) |
786 | { | 795 | { |
787 | if (d->care_about_geometry) { | 796 | if (d->care_about_geometry) { |
788 | parseGeometry(true); | 797 | parseGeometry(true); |
789 | } else { | 798 | } else { |
790 | // restore the size | 799 | // restore the size |
791 | /*US int scnum = QApplication::desktop()->screenNumber(parentWidget()); | 800 | /*US int scnum = QApplication::desktop()->screenNumber(parentWidget()); |
@@ -822,157 +831,145 @@ void KMainWindow::ignoreInitialGeometry() | |||
822 | 831 | ||
823 | void KMainWindow::setSettingsDirty() | 832 | void KMainWindow::setSettingsDirty() |
824 | { | 833 | { |
825 | //kdDebug(200) << "KMainWindow::setSettingsDirty" << endl; | 834 | //kdDebug(200) << "KMainWindow::setSettingsDirty" << endl; |
826 | d->settingsDirty = true; | 835 | d->settingsDirty = true; |
827 | if ( d->autoSaveSettings ) | 836 | if ( d->autoSaveSettings ) |
828 | { | 837 | { |
829 | // Use a timer to save "immediately" user-wise, but not too immediately | 838 | // Use a timer to save "immediately" user-wise, but not too immediately |
830 | // (to compress calls and save only once, in case of multiple changes) | 839 | // (to compress calls and save only once, in case of multiple changes) |
831 | if ( !d->settingsTimer ) | 840 | if ( !d->settingsTimer ) |
832 | { | 841 | { |
833 | d->settingsTimer = new QTimer( this ); | 842 | d->settingsTimer = new QTimer( this ); |
834 | connect( d->settingsTimer, SIGNAL( timeout() ), SLOT( saveAutoSaveSettings() ) ); | 843 | connect( d->settingsTimer, SIGNAL( timeout() ), SLOT( saveAutoSaveSettings() ) ); |
835 | } | 844 | } |
836 | d->settingsTimer->start( 500, true ); | 845 | d->settingsTimer->start( 500, true ); |
837 | } | 846 | } |
838 | } | 847 | } |
839 | 848 | ||
840 | bool KMainWindow::settingsDirty() const | 849 | bool KMainWindow::settingsDirty() const |
841 | { | 850 | { |
842 | return d->settingsDirty; | 851 | return d->settingsDirty; |
843 | } | 852 | } |
844 | 853 | ||
845 | QString KMainWindow::settingsGroup() const | 854 | QString KMainWindow::settingsGroup() const |
846 | { | 855 | { |
847 | return d->autoSaveGroup; | 856 | return d->autoSaveGroup; |
848 | } | 857 | } |
849 | 858 | ||
850 | void KMainWindow::resizeEvent( QResizeEvent * e) | 859 | void KMainWindow::resizeEvent( QResizeEvent * e) |
851 | { | 860 | { |
852 | if ( d->autoSaveWindowSize ) | 861 | if ( d->autoSaveWindowSize ) |
853 | setSettingsDirty(); | 862 | setSettingsDirty(); |
854 | QMainWindow::resizeEvent( e ); | 863 | Q3MainWindow::resizeEvent( e ); |
855 | } | 864 | } |
856 | 865 | ||
857 | bool KMainWindow::hasMenuBar() | 866 | bool KMainWindow::hasMenuBar() |
858 | { | 867 | { |
859 | return (internalMenuBar()); | 868 | return (internalMenuBar()); |
860 | } | 869 | } |
861 | 870 | ||
862 | //US KMenuBar *KMainWindow::menuBar() | 871 | //US KMenuBar *KMainWindow::menuBar() |
863 | QMenuBar *KMainWindow::menuBar() | 872 | QMenuBar *KMainWindow::menuBar() |
864 | { | 873 | { |
865 | //US KMenuBar * mb = internalMenuBar(); | 874 | //US KMenuBar * mb = internalMenuBar(); |
866 | QMenuBar * mb = internalMenuBar(); | 875 | QMenuBar * mb = internalMenuBar(); |
867 | if ( !mb ) { | 876 | if ( !mb ) { |
868 | //US mb = new KMenuBar( this ); | 877 | //US mb = new KMenuBar( this ); |
869 | mb = new QMenuBar( this ); | 878 | mb = new QMenuBar( this ); |
870 | // trigger a re-layout and trigger a call to the private | 879 | // trigger a re-layout and trigger a call to the private |
871 | // setMenuBar method. | 880 | // setMenuBar method. |
872 | QMainWindow::menuBar(); | 881 | Q3MainWindow::menuBar(); |
873 | } | 882 | } |
874 | return mb; | 883 | return mb; |
875 | } | 884 | } |
876 | 885 | ||
877 | //US KStatusBar *KMainWindow::statusBar() | 886 | //US KStatusBar *KMainWindow::statusBar() |
878 | QStatusBar *KMainWindow::statusBar() | 887 | QStatusBar *KMainWindow::statusBar() |
879 | { | 888 | { |
880 | //US KStatusBar * sb = internalStatusBar(); | 889 | //US KStatusBar * sb = internalStatusBar(); |
881 | QStatusBar * sb = internalStatusBar(); | 890 | QStatusBar * sb = internalStatusBar(); |
882 | if ( !sb ) { | 891 | if ( !sb ) { |
883 | //US sb = new KStatusBar( this ); | 892 | //US sb = new KStatusBar( this ); |
884 | sb = new QStatusBar( this ); | 893 | sb = new QStatusBar( this ); |
885 | // trigger a re-layout and trigger a call to the private | 894 | // trigger a re-layout and trigger a call to the private |
886 | // setStatusBar method. | 895 | // setStatusBar method. |
887 | QMainWindow::statusBar(); | 896 | Q3MainWindow::statusBar(); |
888 | } | 897 | } |
889 | return sb; | 898 | return sb; |
890 | } | 899 | } |
891 | 900 | ||
892 | void KMainWindow::shuttingDown() | 901 | void KMainWindow::shuttingDown() |
893 | { | 902 | { |
894 | // Needed for Qt <= 3.0.3 at least to prevent reentrancy | 903 | // Needed for Qt <= 3.0.3 at least to prevent reentrancy |
895 | // when queryExit() shows a dialog. Check before removing! | 904 | // when queryExit() shows a dialog. Check before removing! |
896 | static bool reentrancy_protection = false; | 905 | static bool reentrancy_protection = false; |
897 | if (!reentrancy_protection) | 906 | if (!reentrancy_protection) |
898 | { | 907 | { |
899 | reentrancy_protection = true; | 908 | reentrancy_protection = true; |
900 | // call the virtual queryExit | 909 | // call the virtual queryExit |
901 | queryExit(); | 910 | queryExit(); |
902 | reentrancy_protection = false; | 911 | reentrancy_protection = false; |
903 | } | 912 | } |
904 | 913 | ||
905 | } | 914 | } |
906 | 915 | ||
907 | //US KMenuBar *KMainWindow::internalMenuBar() | 916 | //US KMenuBar *KMainWindow::internalMenuBar() |
908 | QMenuBar *KMainWindow::internalMenuBar() | 917 | QMenuBar *KMainWindow::internalMenuBar() |
909 | { | 918 | { |
910 | //US QObjectList *l = queryList( "KMenuBar", 0, false, false ); | 919 | //US QObjectList *l = queryList( "KMenuBar", 0, false, false ); |
911 | QObjectList *l = queryList( "QMenuBar", 0, false, false ); | 920 | QObjectList l = queryList( "QMenuBar", 0, false, false ); |
912 | if ( !l || !l->first() ) { | 921 | if(l.empty()) |
913 | delete l; | 922 | return 0; |
914 | return 0; | 923 | return (QMenuBar*)l.front(); |
915 | } | ||
916 | |||
917 | //US KMenuBar *m = (KMenuBar*)l->first(); | ||
918 | QMenuBar *m = (QMenuBar*)l->first(); | ||
919 | delete l; | ||
920 | return m; | ||
921 | } | 924 | } |
922 | 925 | ||
923 | //US KStatusBar *KMainWindow::internalStatusBar() | 926 | //US KStatusBar *KMainWindow::internalStatusBar() |
924 | QStatusBar *KMainWindow::internalStatusBar() | 927 | QStatusBar *KMainWindow::internalStatusBar() |
925 | { | 928 | { |
926 | //US QObjectList *l = queryList( "KStatusBar", 0, false, false ); | 929 | //US QObjectList *l = queryList( "KStatusBar", 0, false, false ); |
927 | QObjectList *l = queryList( "QStatusBar", 0, false, false ); | 930 | QObjectList l = queryList( "QStatusBar", 0, false, false ); |
928 | if ( !l || !l->first() ) { | 931 | if(l.empty()) |
929 | delete l; | 932 | return 0; |
930 | return 0; | 933 | return (QStatusBar*)l.front(); |
931 | } | ||
932 | |||
933 | //US KStatusBar *s = (KStatusBar*)l->first(); | ||
934 | QStatusBar *s = (QStatusBar*)l->first(); | ||
935 | delete l; | ||
936 | return s; | ||
937 | } | 934 | } |
938 | 935 | ||
939 | void KMainWindow::childEvent( QChildEvent* e) | 936 | void KMainWindow::childEvent( QChildEvent* e) |
940 | { | 937 | { |
941 | QMainWindow::childEvent( e ); | 938 | Q3MainWindow::childEvent( e ); |
942 | } | 939 | } |
943 | 940 | ||
944 | void KMainWindow::paintEvent( QPaintEvent * e) | 941 | void KMainWindow::paintEvent( QPaintEvent * e) |
945 | { | 942 | { |
946 | QMainWindow::paintEvent( e ); | 943 | Q3MainWindow::paintEvent( e ); |
947 | } | 944 | } |
948 | 945 | ||
949 | QSize KMainWindow::sizeForCentralWidgetSize(QSize size) | 946 | QSize KMainWindow::sizeForCentralWidgetSize(QSize size) |
950 | { | 947 | { |
951 | KToolBar *tb = (KToolBar*)child( "mainToolBar", "KToolBar" ); | 948 | KToolBar *tb = (KToolBar*)child( "mainToolBar", "KToolBar" ); |
952 | if (tb && !tb->isHidden()) { | 949 | if (tb && !tb->isHidden()) { |
953 | switch( tb->barPos() ) | 950 | switch( tb->barPos() ) |
954 | { | 951 | { |
955 | case KToolBar::Top: | 952 | case KToolBar::Top: |
956 | case KToolBar::Bottom: | 953 | case KToolBar::Bottom: |
957 | size += QSize(0, tb->sizeHint().height()); | 954 | size += QSize(0, tb->sizeHint().height()); |
958 | break; | 955 | break; |
959 | 956 | ||
960 | case KToolBar::Left: | 957 | case KToolBar::Left: |
961 | case KToolBar::Right: | 958 | case KToolBar::Right: |
962 | size += QSize(toolBar()->sizeHint().width(), 0); | 959 | size += QSize(toolBar()->sizeHint().width(), 0); |
963 | break; | 960 | break; |
964 | 961 | ||
965 | case KToolBar::Flat: | 962 | case KToolBar::Flat: |
966 | //US size += QSize(0, 3+kapp->style().pixelMetric( QStyle::PM_DockWindowHandleExtent )); | 963 | //US size += QSize(0, 3+kapp->style().pixelMetric( QStyle::PM_DockWindowHandleExtent )); |
967 | size += QSize(0, tb->sizeHint().height()); | 964 | size += QSize(0, tb->sizeHint().height()); |
968 | break; | 965 | break; |
969 | 966 | ||
970 | default: | 967 | default: |
971 | break; | 968 | break; |
972 | } | 969 | } |
973 | } | 970 | } |
974 | //US KMenuBar *mb = menuBar(); | 971 | //US KMenuBar *mb = menuBar(); |
975 | QMenuBar *mb = menuBar(); | 972 | QMenuBar *mb = menuBar(); |
976 | if (!mb->isHidden()) { | 973 | if (!mb->isHidden()) { |
977 | size += QSize(0,mb->heightForWidth(size.width())); | 974 | size += QSize(0,mb->heightForWidth(size.width())); |
978 | /*US if (style().styleHint(QStyle::SH_MainWindow_SpaceBelowMenuBar, this)) | 975 | /*US if (style().styleHint(QStyle::SH_MainWindow_SpaceBelowMenuBar, this)) |