author | Michael Krelin <hacker@klever.net> | 2007-07-04 11:23:42 (UTC) |
---|---|---|
committer | Michael Krelin <hacker@klever.net> | 2007-07-04 11:23:42 (UTC) |
commit | a08aff328d4393031d5ba7d622c2b05705a89d73 (patch) (side-by-side diff) | |
tree | 8ee90d686081c52e7c69b5ce946e9b1a7d690001 /microkde/kdeui/kmainwindow.cpp | |
parent | 11edc920afe4f274c0964436633aa632c8288a40 (diff) | |
download | kdepimpi-a08aff328d4393031d5ba7d622c2b05705a89d73.zip kdepimpi-a08aff328d4393031d5ba7d622c2b05705a89d73.tar.gz kdepimpi-a08aff328d4393031d5ba7d622c2b05705a89d73.tar.bz2 |
initial public commit of qt4 portp1
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 @@ -23,3 +23,3 @@ */ -#include <qobjectlist.h> +#include <qobject.h> #include <qstringlist.h> @@ -29,2 +29,8 @@ #include <qapplication.h> +//Added by qt3to4: +#include <QCloseEvent> +#include <QPaintEvent> +#include <QResizeEvent> +#include <QChildEvent> +#include <Q3PtrList> @@ -56,3 +62,3 @@ 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 )*/ { @@ -278,3 +284,3 @@ void KMainWindow::setPlainCaption( const QString &caption ) { - QMainWindow::setCaption( caption ); + Q3MainWindow::setCaption( caption ); #ifndef Q_WS_QWS @@ -423,6 +429,6 @@ void KMainWindow::createStandardStatusBarAction(){ -QToolBar *KMainWindow::tBar( ) +Q3ToolBar *KMainWindow::tBar( ) { if ( ! mQToolBar ) - mQToolBar = new QToolBar( this ); + mQToolBar = new Q3ToolBar( this ); return mQToolBar; @@ -445,12 +451,13 @@ KToolBar *KMainWindow::toolBar( const char * name ) */ - 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" ) ) @@ -460,3 +467,3 @@ QPtrListIterator<KToolBar> KMainWindow::toolBarIterator() } - return QPtrListIterator<KToolBar>( toolbarList ); + return Q3PtrListIterator<KToolBar>( toolbarList ); } @@ -471,3 +478,3 @@ void KMainWindow::setAutoSaveSettings( const QString & groupName, bool saveWindo //US this, SLOT( setSettingsDirty() ) ); - connect( this, SIGNAL( toolBarPositionChanged(QToolBar *) ), + connect( this, SIGNAL( toolBarPositionChanged(Q3ToolBar *) ), this, SLOT( setSettingsDirty() ) ); @@ -505,3 +512,3 @@ void KMainWindow::saveAutoSaveSettings() { - ASSERT( d->autoSaveSettings ); + Q_ASSERT( d->autoSaveSettings ); //kdDebug(200) << "KMainWindow::saveAutoSaveSettings -> saving settings" << endl; @@ -641,3 +648,3 @@ void KMainWindow::saveMainWindowSettings(KConfig *config, const QString &configG KToolBar *toolbar = 0; - QPtrListIterator<KToolBar> it( toolBarIterator() ); + Q3PtrListIterator<KToolBar> it( toolBarIterator() ); while ( ( toolbar = it.current() ) ) { @@ -716,10 +723,12 @@ void KMainWindow::applyMainWindowSettings(KConfig *config, const QString &config 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(); + } + } } @@ -728,3 +737,3 @@ void KMainWindow::applyMainWindowSettings(KConfig *config, const QString &config KToolBar *toolbar; - QPtrListIterator<KToolBar> it( toolBarIterator() ); // must use own iterator + Q3PtrListIterator<KToolBar> it( toolBarIterator() ); // must use own iterator @@ -758,3 +767,3 @@ void KMainWindow::finalizeGUI( bool force ) // Both the XMLGUI and applySettings call this, hence "force" for the latter. - QPtrListIterator<KToolBar> it( toolBarIterator() ); + Q3PtrListIterator<KToolBar> it( toolBarIterator() ); for ( ; it.current() ; ++ it ) @@ -853,3 +862,3 @@ void KMainWindow::resizeEvent( QResizeEvent * e) setSettingsDirty(); - QMainWindow::resizeEvent( e ); + Q3MainWindow::resizeEvent( e ); } @@ -871,3 +880,3 @@ QMenuBar *KMainWindow::menuBar() // setMenuBar method. - QMainWindow::menuBar(); + Q3MainWindow::menuBar(); } @@ -886,3 +895,3 @@ QStatusBar *KMainWindow::statusBar() // setStatusBar method. - QMainWindow::statusBar(); + Q3MainWindow::statusBar(); } @@ -910,12 +919,6 @@ 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(); } @@ -926,12 +929,6 @@ 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(); } @@ -940,3 +937,3 @@ void KMainWindow::childEvent( QChildEvent* e) { - QMainWindow::childEvent( e ); + Q3MainWindow::childEvent( e ); } @@ -945,3 +942,3 @@ void KMainWindow::paintEvent( QPaintEvent * e) { - QMainWindow::paintEvent( e ); + Q3MainWindow::paintEvent( e ); } |