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 @@ -21,12 +21,18 @@ the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -#include <qobjectlist.h> +#include <qobject.h> #include <qstringlist.h> #include <qtimer.h> #include <qmenubar.h> #include <qstatusbar.h> #include <qapplication.h> +//Added by qt3to4: +#include <QCloseEvent> +#include <QPaintEvent> +#include <QResizeEvent> +#include <QChildEvent> +#include <Q3PtrList> #include "kdebug.h" @@ -54,7 +60,7 @@ public: static bool no_query_exit = false; KMainWindow::KMainWindow( QWidget* parent, const char *name ) - : QMainWindow( parent, name ) /*LR, f ) with the default widget flag we cannot have fastload */ /*US, KXMLGUIBuilder( this ), helpMenu2( 0 ), factory_( 0 )*/ + : Q3MainWindow( parent, name ) /*LR, f ) with the default widget flag we cannot have fastload */ /*US, KXMLGUIBuilder( this ), helpMenu2( 0 ), factory_( 0 )*/ { mQToolBar = 0; initKMainWindow(name); @@ -276,7 +282,7 @@ void KMainWindow::setCaption( const QString &caption, bool modified ) void KMainWindow::setPlainCaption( const QString &caption ) { - QMainWindow::setCaption( caption ); + Q3MainWindow::setCaption( caption ); #ifndef Q_WS_QWS //US the following is disabled for the embedded version //US NETWinInfo info( qt_xdisplay(), winId(), qt_xrootwin(), 0 ); @@ -421,10 +427,10 @@ void KMainWindow::createStandardStatusBarAction(){ } } -QToolBar *KMainWindow::tBar( ) +Q3ToolBar *KMainWindow::tBar( ) { if ( ! mQToolBar ) - mQToolBar = new QToolBar( this ); + mQToolBar = new Q3ToolBar( this ); return mQToolBar; } @@ -443,22 +449,23 @@ KToolBar *KMainWindow::toolBar( const char * name ) return new KToolBar(this, name, honor_mode); // XMLGUI constructor else */ - return new KToolBar(this, Top, false, name, honor_mode ); // non-XMLGUI + return new KToolBar(this, Qt::Top, false, name, honor_mode ); // non-XMLGUI } -QPtrListIterator<KToolBar> KMainWindow::toolBarIterator() +Q3PtrListIterator<KToolBar> KMainWindow::toolBarIterator() { toolbarList.clear(); - QPtrList<QToolBar> lst; - for ( int i = (int)QMainWindow::Unmanaged; i <= (int)Minimized; ++i ) { - lst = toolBars( (ToolBarDock)i ); - for ( QToolBar *tb = lst.first(); tb; tb = lst.next() ) { + QList<Q3ToolBar*> lst; + for ( int i = (int)Qt::Unmanaged; i <= (int)Qt::Minimized; ++i ) { + lst = toolBars( (Qt::ToolBarDock)i ); + for(QList<Q3ToolBar*>::iterator i=lst.begin();i!=lst.end();++i) { + Q3ToolBar *tb = *i; if ( !tb->inherits( "KToolBar" ) ) continue; toolbarList.append( (KToolBar*)tb ); } } - return QPtrListIterator<KToolBar>( toolbarList ); + return Q3PtrListIterator<KToolBar>( toolbarList ); } void KMainWindow::setAutoSaveSettings( const QString & groupName, bool saveWindowSize ) @@ -469,7 +476,7 @@ void KMainWindow::setAutoSaveSettings( const QString & groupName, bool saveWindo // Get notified when the user moves a toolbar around //US connect( this, SIGNAL( dockWindowPositionChanged( QDockWindow * ) ), //US this, SLOT( setSettingsDirty() ) ); - connect( this, SIGNAL( toolBarPositionChanged(QToolBar *) ), + connect( this, SIGNAL( toolBarPositionChanged(Q3ToolBar *) ), this, SLOT( setSettingsDirty() ) ); @@ -503,7 +510,7 @@ QString KMainWindow::autoSaveGroup() const void KMainWindow::saveAutoSaveSettings() { - ASSERT( d->autoSaveSettings ); + Q_ASSERT( d->autoSaveSettings ); //kdDebug(200) << "KMainWindow::saveAutoSaveSettings -> saving settings" << endl; saveMainWindowSettings( KGlobal::config(), d->autoSaveGroup ); KGlobal::config()->sync(); @@ -639,7 +646,7 @@ void KMainWindow::saveMainWindowSettings(KConfig *config, const QString &configG int n = 1; // Toolbar counter. toolbars are counted from 1, KToolBar *toolbar = 0; - QPtrListIterator<KToolBar> it( toolBarIterator() ); + Q3PtrListIterator<KToolBar> it( toolBarIterator() ); while ( ( toolbar = it.current() ) ) { ++it; QString group; @@ -714,19 +721,21 @@ void KMainWindow::applyMainWindowSettings(KConfig *config, const QString &config entryList.clear(); //US i = config->readListEntry (QString::fromLatin1("MenuBar"), entryList, ';'); entryList = config->readListEntry (QString::fromLatin1("MenuBar")); - entry = entryList.first(); - if (entry==QString::fromLatin1("Disabled")) - { - mb->hide(); - } else - { - mb->show(); - } + if(!entryList.empty()) { + entry = entryList.first(); + if (entry==QString::fromLatin1("Disabled")) + { + mb->hide(); + } else + { + mb->show(); + } + } } int n = 1; // Toolbar counter. toolbars are counted from 1, KToolBar *toolbar; - QPtrListIterator<KToolBar> it( toolBarIterator() ); // must use own iterator + Q3PtrListIterator<KToolBar> it( toolBarIterator() ); // must use own iterator for ( ; it.current(); ++it) { toolbar= it.current(); @@ -756,7 +765,7 @@ void KMainWindow::finalizeGUI( bool force ) // we call positionYourself again for each of them, but this time // the toolbariterator should give them in the proper order. // Both the XMLGUI and applySettings call this, hence "force" for the latter. - QPtrListIterator<KToolBar> it( toolBarIterator() ); + Q3PtrListIterator<KToolBar> it( toolBarIterator() ); for ( ; it.current() ; ++ it ) it.current()->positionYourself( force ); @@ -851,7 +860,7 @@ void KMainWindow::resizeEvent( QResizeEvent * e) { if ( d->autoSaveWindowSize ) setSettingsDirty(); - QMainWindow::resizeEvent( e ); + Q3MainWindow::resizeEvent( e ); } bool KMainWindow::hasMenuBar() @@ -869,7 +878,7 @@ QMenuBar *KMainWindow::menuBar() mb = new QMenuBar( this ); // trigger a re-layout and trigger a call to the private // setMenuBar method. - QMainWindow::menuBar(); + Q3MainWindow::menuBar(); } return mb; } @@ -884,7 +893,7 @@ QStatusBar *KMainWindow::statusBar() sb = new QStatusBar( this ); // trigger a re-layout and trigger a call to the private // setStatusBar method. - QMainWindow::statusBar(); + Q3MainWindow::statusBar(); } return sb; } @@ -908,42 +917,30 @@ void KMainWindow::shuttingDown() QMenuBar *KMainWindow::internalMenuBar() { //US QObjectList *l = queryList( "KMenuBar", 0, false, false ); - QObjectList *l = queryList( "QMenuBar", 0, false, false ); - if ( !l || !l->first() ) { - delete l; - return 0; - } - -//US KMenuBar *m = (KMenuBar*)l->first(); - QMenuBar *m = (QMenuBar*)l->first(); - delete l; - return m; + QObjectList l = queryList( "QMenuBar", 0, false, false ); + if(l.empty()) + return 0; + return (QMenuBar*)l.front(); } //US KStatusBar *KMainWindow::internalStatusBar() QStatusBar *KMainWindow::internalStatusBar() { //US QObjectList *l = queryList( "KStatusBar", 0, false, false ); - QObjectList *l = queryList( "QStatusBar", 0, false, false ); - if ( !l || !l->first() ) { - delete l; - return 0; - } - -//US KStatusBar *s = (KStatusBar*)l->first(); - QStatusBar *s = (QStatusBar*)l->first(); - delete l; - return s; + QObjectList l = queryList( "QStatusBar", 0, false, false ); + if(l.empty()) + return 0; + return (QStatusBar*)l.front(); } void KMainWindow::childEvent( QChildEvent* e) { - QMainWindow::childEvent( e ); + Q3MainWindow::childEvent( e ); } void KMainWindow::paintEvent( QPaintEvent * e) { - QMainWindow::paintEvent( e ); + Q3MainWindow::paintEvent( e ); } QSize KMainWindow::sizeForCentralWidgetSize(QSize size) |