-rw-r--r-- | microkde/kdeui/ktoolbar.cpp | 185 |
1 files changed, 98 insertions, 87 deletions
diff --git a/microkde/kdeui/ktoolbar.cpp b/microkde/kdeui/ktoolbar.cpp index 027e5e9..02db316 100644 --- a/microkde/kdeui/ktoolbar.cpp +++ b/microkde/kdeui/ktoolbar.cpp @@ -27,5 +27,16 @@ #undef Always -#include <qdockwindow.h> +#include <q3dockwindow.h> #endif - +//Added by qt3to4: +#include <Q3ValueList> +#include <Q3PtrList> +#include <QPixmap> +#include <Q3Frame> +#include <QResizeEvent> +#include <QMouseEvent> +#include <QChildEvent> +#include <QEvent> +#include <QShowEvent> +#include <QDesktopWidget> +#include <QBoxLayout> @@ -42,3 +53,3 @@ #include <qrect.h> -#include <qobjectlist.h> +#include <qobject.h> #include <qtimer.h> @@ -71,4 +82,4 @@ -#include <qpopupmenu.h> -#include <qmainwindow.h> +#include <q3popupmenu.h> +#include <q3mainwindow.h> @@ -104,3 +115,3 @@ public: //US oldPos = Qt::DockUnmanaged; - oldPos = QMainWindow::Unmanaged; + oldPos = Qt::Unmanaged; @@ -131,3 +142,3 @@ public: - QMainWindow::ToolBarDock oldPos; + Qt::ToolBarDock oldPos; @@ -138,5 +149,5 @@ public: //US ToolBarInfo() : index( 0 ), offset( -1 ), newline( FALSE ), dock( Qt::DockTop ) {} - ToolBarInfo() : index( 0 ), offset( -1 ), newline( FALSE ), dock( QMainWindow::Top ) {} + ToolBarInfo() : index( 0 ), offset( -1 ), newline( FALSE ), dock( Qt::DockTop ) {} //US ToolBarInfo( Qt::Dock d, int i, bool n, int o ) : index( i ), offset( o ), newline( n ), dock( d ) {} - ToolBarInfo( QMainWindow::ToolBarDock d, int i, bool n, int o ) : index( i ), offset( o ), newline( n ), dock( d ) {} + ToolBarInfo( Qt::ToolBarDock d, int i, bool n, int o ) : index( i ), offset( o ), newline( n ), dock( d ) {} int index, offset; @@ -144,3 +155,3 @@ public: //US Qt::Dock dock; - QMainWindow::ToolBarDock dock; + Qt::ToolBarDock dock; }; @@ -148,3 +159,3 @@ public: ToolBarInfo toolBarInfo; - QValueList<int> iconSizes; + Q3ValueList<int> iconSizes; QTimer repaintTimer; @@ -160,11 +171,11 @@ public: - QPtrList<QWidget> idleButtons; + Q3PtrList<QWidget> idleButtons; }; -KToolBarSeparator::KToolBarSeparator(Orientation o , bool l, QToolBar *parent, +KToolBarSeparator::KToolBarSeparator(Qt::Orientation o , bool l, Q3ToolBar *parent, const char* name ) - :QFrame( parent, name ), line( l ) + :Q3Frame( parent, name ), line( l ) { - connect( parent, SIGNAL(orientationChanged(Orientation)), - this, SLOT(setOrientation(Orientation)) ); + connect( parent, SIGNAL(orientationChanged(Qt::Orientation)), + this, SLOT(setOrientation(Qt::Orientation)) ); setOrientation( o ); @@ -174,3 +185,3 @@ KToolBarSeparator::KToolBarSeparator(Orientation o , bool l, QToolBar *parent, -void KToolBarSeparator::setOrientation( Orientation o ) +void KToolBarSeparator::setOrientation( Qt::Orientation o ) { @@ -178,3 +189,3 @@ void KToolBarSeparator::setOrientation( Orientation o ) if ( line ) { - if ( orientation() == Vertical ) + if ( orientation() == Qt::Vertical ) setFrameStyle( HLine + Sunken ); @@ -194,3 +205,3 @@ QSize KToolBarSeparator::sizeHint() const { - return orientation() == Vertical ? QSize( 0, 6 ) : QSize( 6, 0 ); + return orientation() == Qt::Vertical ? QSize( 0, 6 ) : QSize( 6, 0 ); } @@ -204,4 +215,4 @@ KToolBar::KToolBar( QWidget *parent, const char *name, bool honorStyle, bool rea #ifdef DESKTOP_VERSION - : QToolBar( QString::fromLatin1( name ), - parent && parent->inherits( "QMainWindow" ) ? static_cast<QMainWindow*>(parent) : 0, + : Q3ToolBar( QString::fromLatin1( name ), + parent && parent->inherits( "Q3MainWindow" ) ? static_cast<Q3MainWindow*>(parent) : 0, parent, FALSE, @@ -209,3 +220,3 @@ KToolBar::KToolBar( QWidget *parent, const char *name, bool honorStyle, bool rea #else - : QPEToolBar( parent && parent->inherits( "QMainWindow" ) ? static_cast<QMainWindow*>(parent) : 0, + : QPEToolBar( parent && parent->inherits( "Q3MainWindow" ) ? static_cast<Q3MainWindow*>(parent) : 0, QString::fromLatin1( name )) @@ -218,5 +229,5 @@ KToolBar::KToolBar( QWidget *parent, const char *name, bool honorStyle, bool rea -KToolBar::KToolBar( QMainWindow *parentWindow, QMainWindow::ToolBarDock dock, bool newLine, const char *name, bool honorStyle, bool readConfig ) +KToolBar::KToolBar( Q3MainWindow *parentWindow, Qt::ToolBarDock dock, bool newLine, const char *name, bool honorStyle, bool readConfig ) #ifdef DESKTOP_VERSION - : QToolBar( QString::fromLatin1( name ), + : Q3ToolBar( QString::fromLatin1( name ), parentWindow, dock, newLine, @@ -233,5 +244,5 @@ KToolBar::KToolBar( QMainWindow *parentWindow, QMainWindow::ToolBarDock dock, bo -KToolBar::KToolBar( QMainWindow *parentWindow, QWidget *dock, bool newLine, const char *name, bool honorStyle, bool readConfig ) +KToolBar::KToolBar( Q3MainWindow *parentWindow, QWidget *dock, bool newLine, const char *name, bool honorStyle, bool readConfig ) #ifdef DESKTOP_VERSION - : QToolBar( QString::fromLatin1( name ), + : Q3ToolBar( QString::fromLatin1( name ), parentWindow, dock, newLine, @@ -282,4 +293,4 @@ void KToolBar::init( bool readConfig, bool honorStyle ) if ( mainWindow() ) - connect( mainWindow(), SIGNAL( toolBarPositionChanged( QToolBar * ) ), - this, SLOT( toolBarPosChanged( QToolBar * ) ) ); + connect( mainWindow(), SIGNAL( toolBarPositionChanged( Q3ToolBar * ) ), + this, SLOT( toolBarPosChanged( Q3ToolBar * ) ) ); @@ -343,3 +354,3 @@ int KToolBar::insertButton(const QPixmap& pixmap, int id, const char *signal, -int KToolBar::insertButton(const QString& icon, int id, QPopupMenu *popup, +int KToolBar::insertButton(const QString& icon, int id, Q3PopupMenu *popup, bool enabled, const QString &text, int index ) @@ -355,3 +366,3 @@ int KToolBar::insertButton(const QString& icon, int id, QPopupMenu *popup, -int KToolBar::insertButton(const QPixmap& pixmap, int id, QPopupMenu *popup, +int KToolBar::insertButton(const QPixmap& pixmap, int id, Q3PopupMenu *popup, bool enabled, const QString &text, int index ) @@ -542,3 +553,3 @@ void KToolBar::setButtonIcon( int id, const QString& _icon ) -void KToolBar::setButtonIconSet( int id, const QIconSet& iconset ) +void KToolBar::setButtonIconSet( int id, const QIcon& iconset ) { @@ -554,3 +565,3 @@ void KToolBar::setButtonIconSet( int id, const QIconSet& iconset ) -void KToolBar::setDelayedPopup (int id , QPopupMenu *_popup, bool toggle ) +void KToolBar::setDelayedPopup (int id , Q3PopupMenu *_popup, bool toggle ) { @@ -789,3 +800,3 @@ void KToolBar::clear () { - QToolBar::clear(); + Q3ToolBar::clear(); widget2id.clear(); @@ -878,3 +889,3 @@ void KToolBar::setBarPos (BarPosition bpos) //US mainWindow()->moveDockWindow( this, (Dock)bpos ); - mainWindow()->moveToolBar( this, (QMainWindow::ToolBarDock)bpos ); + mainWindow()->moveToolBar( this, (Qt::ToolBarDock)bpos ); } @@ -884,11 +895,11 @@ const KToolBar::BarPosition KToolBar::barPos() { - if ( !(QMainWindow*)mainWindow() ) + if ( !(Q3MainWindow*)mainWindow() ) return KToolBar::Top; //US Dock dock; - QMainWindow::ToolBarDock dock; + Qt::ToolBarDock dock; int dm1, dm2; bool dm3; - ((QMainWindow*)mainWindow())->getLocation( (QToolBar*)this, dock, dm1, dm3, dm2 ); + ((Q3MainWindow*)mainWindow())->getLocation( (Q3ToolBar*)this, dock, dm1, dm3, dm2 ); //US if ( dock == DockUnmanaged ) { - if ( dock == QMainWindow::Unmanaged ) { + if ( dock == Qt::Unmanaged ) { return (KToolBar::BarPosition)Top; @@ -969,3 +980,3 @@ void KToolBar::setIconText(IconText icontext, bool update) if ( mainWindow() ) { - QMainWindow *mw = mainWindow(); + Q3MainWindow *mw = mainWindow(); mw->setUpdatesEnabled( FALSE ); @@ -1006,3 +1017,3 @@ void KToolBar::setIconSize(int size, bool update) if ( mainWindow() ) { - QMainWindow *mw = mainWindow(); + Q3MainWindow *mw = mainWindow(); mw->setUpdatesEnabled( FALSE ); @@ -1064,6 +1075,6 @@ void KToolBar::setFlat (bool flag) //US mainWindow()->moveDockWindow( this, DockMinimized ); - mainWindow()->moveToolBar( this, QMainWindow::Minimized ); + mainWindow()->moveToolBar( this, Qt::Minimized ); else //US mainWindow()->moveDockWindow( this, DockTop ); - mainWindow()->moveToolBar( this, QMainWindow::Top ); + mainWindow()->moveToolBar( this, Qt::Top ); // And remember to save the new look later @@ -1251,5 +1262,5 @@ void KToolBar::mousePressEvent ( QMouseEvent *m ) return; - QMainWindow *mw = mainWindow(); + Q3MainWindow *mw = mainWindow(); if ( mw->toolBarsMovable() && d->m_enableContext ) { - if ( m->button() == RightButton ) { + if ( m->button() == Qt::RightButton ) { int i = contextMenu()->exec( m->globalPos(), 0 ); @@ -1260,3 +1271,3 @@ void KToolBar::mousePressEvent ( QMouseEvent *m ) //US mw->moveDockWindow( this, DockLeft ); - mw->moveToolBar( this, QMainWindow::Left ); + mw->moveToolBar( this, Qt::Left ); break; @@ -1264,3 +1275,3 @@ void KToolBar::mousePressEvent ( QMouseEvent *m ) //US mw->moveDockWindow( this, DockRight ); - mw->moveToolBar( this, QMainWindow::Right ); + mw->moveToolBar( this, Qt::Right ); break; @@ -1268,3 +1279,3 @@ void KToolBar::mousePressEvent ( QMouseEvent *m ) //US mw->moveDockWindow( this, DockTop ); - mw->moveToolBar( this, QMainWindow::Top ); + mw->moveToolBar( this, Qt::Top ); break; @@ -1272,3 +1283,3 @@ void KToolBar::mousePressEvent ( QMouseEvent *m ) //US mw->moveDockWindow( this, DockBottom ); - mw->moveToolBar( this, QMainWindow::Bottom ); + mw->moveToolBar( this, Qt::Bottom ); break; @@ -1278,3 +1289,3 @@ void KToolBar::mousePressEvent ( QMouseEvent *m ) //US mw->moveDockWindow( this, DockMinimized ); - mw->moveToolBar( this, QMainWindow::Minimized ); + mw->moveToolBar( this, Qt::Minimized ); break; @@ -1334,3 +1345,3 @@ void KToolBar::rebuildLayout() } - if ( w->inherits( "QPopupMenu" ) ) + if ( w->inherits( "Q3PopupMenu" ) ) continue; @@ -1366,3 +1377,3 @@ void KToolBar::childEvent( QChildEvent *e ) if ( e->type() == QEvent::ChildInserted ) { - if ( !e->child()->inherits( "QPopupMenu" ) && + if ( !e->child()->inherits( "Q3PopupMenu" ) && ::qstrcmp( "qt_dockwidget_internal", e->child()->name() ) != 0 ) { @@ -1377,6 +1388,6 @@ void KToolBar::childEvent( QChildEvent *e ) } - } else { + } else if( e->type() == QEvent::ChildRemoved ) { removeWidgetInternal( w ); } - if ( isVisibleTo( 0 ) ) + /* TODO:hacker: if ( isVisibleTo( 0 ) ) { @@ -1392,5 +1403,5 @@ void KToolBar::childEvent( QChildEvent *e ) layoutTimer->start( 50, TRUE ); - } + } */ } - QToolBar::childEvent( e ); + Q3ToolBar::childEvent( e ); } @@ -1418,3 +1429,3 @@ void KToolBar::repaintMe() setUpdatesEnabled( true ); - QToolBar::repaint( true ); + Q3ToolBar::repaint( true ); qDebug(" KToolBar::repaintMe() "); @@ -1425,3 +1436,3 @@ void KToolBar::showEvent( QShowEvent *e ) rebuildLayout(); - QToolBar::showEvent( e ); + Q3ToolBar::showEvent( e ); } @@ -1430,3 +1441,3 @@ void KToolBar::setStretchableWidget( QWidget *w ) { - QToolBar::setStretchableWidget( w ); + Q3ToolBar::setStretchableWidget( w ); stretchableWidget = w; @@ -1436,3 +1447,3 @@ QSizePolicy KToolBar::sizePolicy() const { - if ( orientation() == Horizontal ) + if ( orientation() == Qt::Horizontal ) return QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ); @@ -1444,3 +1455,3 @@ QSize KToolBar::sizeHint() const { - QSize sh = QToolBar::sizeHint(); + QSize sh = Q3ToolBar::sizeHint(); //qDebug("%x KToolBar::sizeHint() %d %d ",this, QToolBar::sizeHint().width(),QToolBar::sizeHint().height() ); @@ -1510,3 +1521,3 @@ QSize KToolBar::sizeHint() const default: - minSize = QToolBar::sizeHint(); + minSize = Q3ToolBar::sizeHint(); break; @@ -1534,3 +1545,3 @@ void KToolBar::hide() { - QToolBar::hide(); + Q3ToolBar::hide(); } @@ -1539,3 +1550,3 @@ void KToolBar::show() { - QToolBar::show(); + Q3ToolBar::show(); } @@ -1546,3 +1557,3 @@ void KToolBar::resizeEvent( QResizeEvent *e ) setUpdatesEnabled( FALSE ); - QToolBar::resizeEvent( e ); + Q3ToolBar::resizeEvent( e ); if (b) @@ -1728,3 +1739,3 @@ void KToolBar::applyAppearanceSettings(KConfig *config, const QString &_configGr - QMainWindow *mw = mainWindow(); + Q3MainWindow *mw = mainWindow(); @@ -1807,15 +1818,15 @@ void KToolBar::applySettings(KConfig *config, const QString &_configGroup) */ - QMainWindow::ToolBarDock pos(QMainWindow::Top); + Qt::ToolBarDock pos(Qt::DockTop); if ( position == "Top" ) - pos = QMainWindow::Top; + pos = Qt::Top; else if ( position == "Bottom" ) - pos = QMainWindow::Bottom; + pos = Qt::Bottom; else if ( position == "Left" ) - pos = QMainWindow::Left; + pos = Qt::Left; else if ( position == "Right" ) - pos = QMainWindow::Right; + pos = Qt::Right; else if ( position == "Floating" ) - pos = QMainWindow::TornOff; + pos = Qt::TornOff; else if ( position == "Flat" ) - pos = QMainWindow::Minimized; + pos = Qt::Minimized; @@ -1829,3 +1840,3 @@ void KToolBar::applySettings(KConfig *config, const QString &_configGroup) { - QMainWindow *mw = mainWindow(); + Q3MainWindow *mw = mainWindow(); @@ -1864,3 +1875,3 @@ bool KToolBar::event( QEvent *e ) - return QToolBar::event( e ); + return Q3ToolBar::event( e ); } @@ -1882,3 +1893,3 @@ void KToolBar::slotRepaint() -void KToolBar::toolBarPosChanged( QToolBar *tb ) +void KToolBar::toolBarPosChanged( Q3ToolBar *tb ) { @@ -1887,5 +1898,5 @@ void KToolBar::toolBarPosChanged( QToolBar *tb ) //US if ( d->oldPos == DockMinimized ) - if ( d->oldPos == QMainWindow::Minimized ) + if ( d->oldPos == Qt::Minimized ) rebuildLayout(); - d->oldPos = (QMainWindow::ToolBarDock)barPos(); + d->oldPos = (Qt::ToolBarDock)barPos(); /*US @@ -2033,3 +2044,3 @@ void KToolBar::getAttributes( QString &position, QString &icontext, int &index ) if ( mainWindow() ) { - QMainWindow::ToolBarDock dock; + Qt::ToolBarDock dock; bool newLine; @@ -2102,3 +2113,3 @@ void KToolBar::positionYourself( bool force ) //US KPopupMenu *KToolBar::contextMenu() -QPopupMenu *KToolBar::contextMenu() +Q3PopupMenu *KToolBar::contextMenu() { @@ -2110,3 +2121,3 @@ QPopupMenu *KToolBar::contextMenu() //US context = new KPopupMenu( this, "qt_dockwidget_internal" ); - context = new QPopupMenu( this, "qt_dockwidget_internal" ); + context = new Q3PopupMenu( this, "qt_dockwidget_internal" ); //US context->insertTitle(i18n("Toolbar Menu")); @@ -2114,3 +2125,3 @@ QPopupMenu *KToolBar::contextMenu() //US KPopupMenu *orient = new KPopupMenu( context, "orient" ); - QPopupMenu *orient = new QPopupMenu( context, "orient" ); + Q3PopupMenu *orient = new Q3PopupMenu( context, "orient" ); orient->insertItem( i18n("toolbar position string","Top"), CONTEXT_TOP ); @@ -2124,3 +2135,3 @@ QPopupMenu *KToolBar::contextMenu() //US KPopupMenu *mode = new KPopupMenu( context, "mode" ); - QPopupMenu *mode = new QPopupMenu( context, "mode" ); + Q3PopupMenu *mode = new Q3PopupMenu( context, "mode" ); mode->insertItem( i18n("Icons Only"), CONTEXT_ICONS ); @@ -2131,6 +2142,6 @@ QPopupMenu *KToolBar::contextMenu() //US KPopupMenu *size = new KPopupMenu( context, "size" ); - QPopupMenu *size = new QPopupMenu( context, "size" ); + Q3PopupMenu *size = new Q3PopupMenu( context, "size" ); size->insertItem( i18n("Default"), CONTEXT_ICONSIZES ); // Query the current theme for available sizes - QValueList<int> avSizes; + Q3ValueList<int> avSizes; /*US @@ -2147,3 +2158,3 @@ QPopupMenu *KToolBar::contextMenu() - QValueList<int>::Iterator it; + Q3ValueList<int>::Iterator it; for (it=avSizes.begin(); it!=avSizes.end(); it++) { @@ -2220,4 +2231,4 @@ void KToolBar::slotContextAboutToShow() - QValueList<int>::ConstIterator iIt = d->iconSizes.begin(); - QValueList<int>::ConstIterator iEnd = d->iconSizes.end(); + Q3ValueList<int>::ConstIterator iIt = d->iconSizes.begin(); + Q3ValueList<int>::ConstIterator iEnd = d->iconSizes.end(); for (; iIt != iEnd; ++iIt ) |