summaryrefslogtreecommitdiffabout
path: root/microkde/kdeui/ktoolbar.cpp
Unidiff
Diffstat (limited to 'microkde/kdeui/ktoolbar.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--microkde/kdeui/ktoolbar.cpp185
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
@@ -25,9 +25,20 @@
25 25
26#ifdef KDE_USE_FINAL 26#ifdef KDE_USE_FINAL
27#undef Always 27#undef Always
28#include <qdockwindow.h> 28#include <q3dockwindow.h>
29#endif 29#endif
30 30//Added by qt3to4:
31#include <Q3ValueList>
32#include <Q3PtrList>
33#include <QPixmap>
34#include <Q3Frame>
35#include <QResizeEvent>
36#include <QMouseEvent>
37#include <QChildEvent>
38#include <QEvent>
39#include <QShowEvent>
40#include <QDesktopWidget>
41#include <QBoxLayout>
31 42
32 43
33#include "ktoolbar.h" 44#include "ktoolbar.h"
@@ -40,7 +51,7 @@
40#include <qdrawutil.h> 51#include <qdrawutil.h>
41#include <qstring.h> 52#include <qstring.h>
42#include <qrect.h> 53#include <qrect.h>
43#include <qobjectlist.h> 54#include <qobject.h>
44#include <qtimer.h> 55#include <qtimer.h>
45#include <qstyle.h> 56#include <qstyle.h>
46#include <qapplication.h> 57#include <qapplication.h>
@@ -69,8 +80,8 @@
69//US 80//US
70#include "kconfigbase.h" 81#include "kconfigbase.h"
71 82
72#include <qpopupmenu.h> 83#include <q3popupmenu.h>
73#include <qmainwindow.h> 84#include <q3mainwindow.h>
74 85
75enum { 86enum {
76 CONTEXT_TOP = 0, 87 CONTEXT_TOP = 0,
@@ -102,7 +113,7 @@ public:
102 m_configurePlugged = false; 113 m_configurePlugged = false;
103 114
104//US oldPos = Qt::DockUnmanaged; 115//US oldPos = Qt::DockUnmanaged;
105 oldPos = QMainWindow::Unmanaged; 116 oldPos = Qt::Unmanaged;
106 117
107 modified = m_isHorizontal = positioned = FALSE; 118 modified = m_isHorizontal = positioned = FALSE;
108 119
@@ -129,24 +140,24 @@ public:
129 140
130 QWidget *m_parent; 141 QWidget *m_parent;
131 142
132 QMainWindow::ToolBarDock oldPos; 143 Qt::ToolBarDock oldPos;
133 144
134 KXMLGUIClient *m_xmlguiClient; 145 KXMLGUIClient *m_xmlguiClient;
135 146
136 struct ToolBarInfo 147 struct ToolBarInfo
137 { 148 {
138//US ToolBarInfo() : index( 0 ), offset( -1 ), newline( FALSE ), dock( Qt::DockTop ) {} 149//US ToolBarInfo() : index( 0 ), offset( -1 ), newline( FALSE ), dock( Qt::DockTop ) {}
139 ToolBarInfo() : index( 0 ), offset( -1 ), newline( FALSE ), dock( QMainWindow::Top ) {} 150 ToolBarInfo() : index( 0 ), offset( -1 ), newline( FALSE ), dock( Qt::DockTop ) {}
140//US ToolBarInfo( Qt::Dock d, int i, bool n, int o ) : index( i ), offset( o ), newline( n ), dock( d ) {} 151//US ToolBarInfo( Qt::Dock d, int i, bool n, int o ) : index( i ), offset( o ), newline( n ), dock( d ) {}
141 ToolBarInfo( QMainWindow::ToolBarDock d, int i, bool n, int o ) : index( i ), offset( o ), newline( n ), dock( d ) {} 152 ToolBarInfo( Qt::ToolBarDock d, int i, bool n, int o ) : index( i ), offset( o ), newline( n ), dock( d ) {}
142 int index, offset; 153 int index, offset;
143 bool newline; 154 bool newline;
144//US Qt::Dock dock; 155//US Qt::Dock dock;
145 QMainWindow::ToolBarDock dock; 156 Qt::ToolBarDock dock;
146 }; 157 };
147 158
148 ToolBarInfo toolBarInfo; 159 ToolBarInfo toolBarInfo;
149 QValueList<int> iconSizes; 160 Q3ValueList<int> iconSizes;
150 QTimer repaintTimer; 161 QTimer repaintTimer;
151 162
152 // Default Values. 163 // Default Values.
@@ -158,25 +169,25 @@ public:
158 int OffsetDefault; 169 int OffsetDefault;
159 QString PositionDefault; 170 QString PositionDefault;
160 171
161 QPtrList<QWidget> idleButtons; 172 Q3PtrList<QWidget> idleButtons;
162}; 173};
163 174
164KToolBarSeparator::KToolBarSeparator(Orientation o , bool l, QToolBar *parent, 175KToolBarSeparator::KToolBarSeparator(Qt::Orientation o , bool l, Q3ToolBar *parent,
165 const char* name ) 176 const char* name )
166 :QFrame( parent, name ), line( l ) 177 :Q3Frame( parent, name ), line( l )
167{ 178{
168 connect( parent, SIGNAL(orientationChanged(Orientation)), 179 connect( parent, SIGNAL(orientationChanged(Qt::Orientation)),
169 this, SLOT(setOrientation(Orientation)) ); 180 this, SLOT(setOrientation(Qt::Orientation)) );
170 setOrientation( o ); 181 setOrientation( o );
171 setBackgroundMode( parent->backgroundMode() ); 182 setBackgroundMode( parent->backgroundMode() );
172 setBackgroundOrigin( ParentOrigin ); 183 setBackgroundOrigin( ParentOrigin );
173} 184}
174 185
175void KToolBarSeparator::setOrientation( Orientation o ) 186void KToolBarSeparator::setOrientation( Qt::Orientation o )
176{ 187{
177 orient = o; 188 orient = o;
178 if ( line ) { 189 if ( line ) {
179 if ( orientation() == Vertical ) 190 if ( orientation() == Qt::Vertical )
180 setFrameStyle( HLine + Sunken ); 191 setFrameStyle( HLine + Sunken );
181 else 192 else
182 setFrameStyle( VLine + Sunken ); 193 setFrameStyle( VLine + Sunken );
@@ -192,7 +203,7 @@ void KToolBarSeparator::styleChange( QStyle& )
192 203
193QSize KToolBarSeparator::sizeHint() const 204QSize KToolBarSeparator::sizeHint() const
194{ 205{
195 return orientation() == Vertical ? QSize( 0, 6 ) : QSize( 6, 0 ); 206 return orientation() == Qt::Vertical ? QSize( 0, 6 ) : QSize( 6, 0 );
196} 207}
197 208
198QSizePolicy KToolBarSeparator::sizePolicy() const 209QSizePolicy KToolBarSeparator::sizePolicy() const
@@ -202,12 +213,12 @@ QSizePolicy KToolBarSeparator::sizePolicy() const
202 213
203KToolBar::KToolBar( QWidget *parent, const char *name, bool honorStyle, bool readConfig ) 214KToolBar::KToolBar( QWidget *parent, const char *name, bool honorStyle, bool readConfig )
204#ifdef DESKTOP_VERSION 215#ifdef DESKTOP_VERSION
205 : QToolBar( QString::fromLatin1( name ), 216 : Q3ToolBar( QString::fromLatin1( name ),
206 parent && parent->inherits( "QMainWindow" ) ? static_cast<QMainWindow*>(parent) : 0, 217 parent && parent->inherits( "Q3MainWindow" ) ? static_cast<Q3MainWindow*>(parent) : 0,
207 parent, FALSE, 218 parent, FALSE,
208 name ? name : "mainToolBar") 219 name ? name : "mainToolBar")
209#else 220#else
210 : QPEToolBar( parent && parent->inherits( "QMainWindow" ) ? static_cast<QMainWindow*>(parent) : 0, 221 : QPEToolBar( parent && parent->inherits( "Q3MainWindow" ) ? static_cast<Q3MainWindow*>(parent) : 0,
211 QString::fromLatin1( name )) 222 QString::fromLatin1( name ))
212 223
213 224
@@ -216,9 +227,9 @@ KToolBar::KToolBar( QWidget *parent, const char *name, bool honorStyle, bool rea
216 init( readConfig, honorStyle ); 227 init( readConfig, honorStyle );
217} 228}
218 229
219KToolBar::KToolBar( QMainWindow *parentWindow, QMainWindow::ToolBarDock dock, bool newLine, const char *name, bool honorStyle, bool readConfig ) 230KToolBar::KToolBar( Q3MainWindow *parentWindow, Qt::ToolBarDock dock, bool newLine, const char *name, bool honorStyle, bool readConfig )
220#ifdef DESKTOP_VERSION 231#ifdef DESKTOP_VERSION
221 : QToolBar( QString::fromLatin1( name ), 232 : Q3ToolBar( QString::fromLatin1( name ),
222 parentWindow, dock, newLine, 233 parentWindow, dock, newLine,
223 name ? name : "mainToolBar") 234 name ? name : "mainToolBar")
224#else 235#else
@@ -231,9 +242,9 @@ KToolBar::KToolBar( QMainWindow *parentWindow, QMainWindow::ToolBarDock dock, bo
231 init( readConfig, honorStyle ); 242 init( readConfig, honorStyle );
232} 243}
233 244
234KToolBar::KToolBar( QMainWindow *parentWindow, QWidget *dock, bool newLine, const char *name, bool honorStyle, bool readConfig ) 245KToolBar::KToolBar( Q3MainWindow *parentWindow, QWidget *dock, bool newLine, const char *name, bool honorStyle, bool readConfig )
235#ifdef DESKTOP_VERSION 246#ifdef DESKTOP_VERSION
236 : QToolBar( QString::fromLatin1( name ), 247 : Q3ToolBar( QString::fromLatin1( name ),
237 parentWindow, dock, newLine, 248 parentWindow, dock, newLine,
238 name ? name : "mainToolBar") 249 name ? name : "mainToolBar")
239#else 250#else
@@ -280,8 +291,8 @@ void KToolBar::init( bool readConfig, bool honorStyle )
280 slotReadConfig(); 291 slotReadConfig();
281 292
282 if ( mainWindow() ) 293 if ( mainWindow() )
283 connect( mainWindow(), SIGNAL( toolBarPositionChanged( QToolBar * ) ), 294 connect( mainWindow(), SIGNAL( toolBarPositionChanged( Q3ToolBar * ) ),
284 this, SLOT( toolBarPosChanged( QToolBar * ) ) ); 295 this, SLOT( toolBarPosChanged( Q3ToolBar * ) ) );
285 296
286 // Hack to make sure we recalculate our size when we dock. 297 // Hack to make sure we recalculate our size when we dock.
287//US connect( this, SIGNAL(placeChanged(QDockWindow::Place)), SLOT(rebuildLayout()) ); 298//US connect( this, SIGNAL(placeChanged(QDockWindow::Place)), SLOT(rebuildLayout()) );
@@ -341,7 +352,7 @@ int KToolBar::insertButton(const QPixmap& pixmap, int id, const char *signal,
341} 352}
342 353
343 354
344int KToolBar::insertButton(const QString& icon, int id, QPopupMenu *popup, 355int KToolBar::insertButton(const QString& icon, int id, Q3PopupMenu *popup,
345 bool enabled, const QString &text, int index ) 356 bool enabled, const QString &text, int index )
346{ 357{
347 KToolBarButton *button = new KToolBarButton( icon, id, this, 0, text ); 358 KToolBarButton *button = new KToolBarButton( icon, id, this, 0, text );
@@ -353,7 +364,7 @@ int KToolBar::insertButton(const QString& icon, int id, QPopupMenu *popup,
353} 364}
354 365
355 366
356int KToolBar::insertButton(const QPixmap& pixmap, int id, QPopupMenu *popup, 367int KToolBar::insertButton(const QPixmap& pixmap, int id, Q3PopupMenu *popup,
357 bool enabled, const QString &text, int index ) 368 bool enabled, const QString &text, int index )
358{ 369{
359 KToolBarButton *button = new KToolBarButton( pixmap, id, this, 0, text ); 370 KToolBarButton *button = new KToolBarButton( pixmap, id, this, 0, text );
@@ -540,7 +551,7 @@ void KToolBar::setButtonIcon( int id, const QString& _icon )
540 button->setIcon( _icon ); 551 button->setIcon( _icon );
541} 552}
542 553
543void KToolBar::setButtonIconSet( int id, const QIconSet& iconset ) 554void KToolBar::setButtonIconSet( int id, const QIcon& iconset )
544{ 555{
545 Id2WidgetMap::Iterator it = id2widget.find( id ); 556 Id2WidgetMap::Iterator it = id2widget.find( id );
546 if ( it == id2widget.end() ) 557 if ( it == id2widget.end() )
@@ -552,7 +563,7 @@ void KToolBar::setButtonIconSet( int id, const QIconSet& iconset )
552} 563}
553 564
554 565
555void KToolBar::setDelayedPopup (int id , QPopupMenu *_popup, bool toggle ) 566void KToolBar::setDelayedPopup (int id , Q3PopupMenu *_popup, bool toggle )
556{ 567{
557 Id2WidgetMap::Iterator it = id2widget.find( id ); 568 Id2WidgetMap::Iterator it = id2widget.find( id );
558 if ( it == id2widget.end() ) 569 if ( it == id2widget.end() )
@@ -787,7 +798,7 @@ void KToolBar::setItemAutoSized (int id, bool yes )
787 798
788void KToolBar::clear () 799void KToolBar::clear ()
789{ 800{
790 QToolBar::clear(); 801 Q3ToolBar::clear();
791 widget2id.clear(); 802 widget2id.clear();
792 id2widget.clear(); 803 id2widget.clear();
793} 804}
@@ -876,21 +887,21 @@ void KToolBar::setBarPos (BarPosition bpos)
876 if ( !mainWindow() ) 887 if ( !mainWindow() )
877 return; 888 return;
878//US mainWindow()->moveDockWindow( this, (Dock)bpos ); 889//US mainWindow()->moveDockWindow( this, (Dock)bpos );
879 mainWindow()->moveToolBar( this, (QMainWindow::ToolBarDock)bpos ); 890 mainWindow()->moveToolBar( this, (Qt::ToolBarDock)bpos );
880} 891}
881 892
882 893
883const KToolBar::BarPosition KToolBar::barPos() 894const KToolBar::BarPosition KToolBar::barPos()
884{ 895{
885 if ( !(QMainWindow*)mainWindow() ) 896 if ( !(Q3MainWindow*)mainWindow() )
886 return KToolBar::Top; 897 return KToolBar::Top;
887//US Dock dock; 898//US Dock dock;
888 QMainWindow::ToolBarDock dock; 899 Qt::ToolBarDock dock;
889 int dm1, dm2; 900 int dm1, dm2;
890 bool dm3; 901 bool dm3;
891 ((QMainWindow*)mainWindow())->getLocation( (QToolBar*)this, dock, dm1, dm3, dm2 ); 902 ((Q3MainWindow*)mainWindow())->getLocation( (Q3ToolBar*)this, dock, dm1, dm3, dm2 );
892//US if ( dock == DockUnmanaged ) { 903//US if ( dock == DockUnmanaged ) {
893 if ( dock == QMainWindow::Unmanaged ) { 904 if ( dock == Qt::Unmanaged ) {
894 return (KToolBar::BarPosition)Top; 905 return (KToolBar::BarPosition)Top;
895 } 906 }
896 return (BarPosition)dock; 907 return (BarPosition)dock;
@@ -967,7 +978,7 @@ void KToolBar::setIconText(IconText icontext, bool update)
967 978
968 // ugly hack to force a QMainWindow::triggerLayout( TRUE ) 979 // ugly hack to force a QMainWindow::triggerLayout( TRUE )
969 if ( mainWindow() ) { 980 if ( mainWindow() ) {
970 QMainWindow *mw = mainWindow(); 981 Q3MainWindow *mw = mainWindow();
971 mw->setUpdatesEnabled( FALSE ); 982 mw->setUpdatesEnabled( FALSE );
972 mw->setToolBarsMovable( !mw->toolBarsMovable() ); 983 mw->setToolBarsMovable( !mw->toolBarsMovable() );
973 mw->setToolBarsMovable( !mw->toolBarsMovable() ); 984 mw->setToolBarsMovable( !mw->toolBarsMovable() );
@@ -1004,7 +1015,7 @@ void KToolBar::setIconSize(int size, bool update)
1004 1015
1005 // ugly hack to force a QMainWindow::triggerLayout( TRUE ) 1016 // ugly hack to force a QMainWindow::triggerLayout( TRUE )
1006 if ( mainWindow() ) { 1017 if ( mainWindow() ) {
1007 QMainWindow *mw = mainWindow(); 1018 Q3MainWindow *mw = mainWindow();
1008 mw->setUpdatesEnabled( FALSE ); 1019 mw->setUpdatesEnabled( FALSE );
1009 mw->setToolBarsMovable( !mw->toolBarsMovable() ); 1020 mw->setToolBarsMovable( !mw->toolBarsMovable() );
1010 mw->setToolBarsMovable( !mw->toolBarsMovable() ); 1021 mw->setToolBarsMovable( !mw->toolBarsMovable() );
@@ -1062,10 +1073,10 @@ void KToolBar::setFlat (bool flag)
1062 return; 1073 return;
1063 if ( flag ) 1074 if ( flag )
1064//US mainWindow()->moveDockWindow( this, DockMinimized ); 1075//US mainWindow()->moveDockWindow( this, DockMinimized );
1065 mainWindow()->moveToolBar( this, QMainWindow::Minimized ); 1076 mainWindow()->moveToolBar( this, Qt::Minimized );
1066 else 1077 else
1067//US mainWindow()->moveDockWindow( this, DockTop ); 1078//US mainWindow()->moveDockWindow( this, DockTop );
1068 mainWindow()->moveToolBar( this, QMainWindow::Top ); 1079 mainWindow()->moveToolBar( this, Qt::Top );
1069 // And remember to save the new look later 1080 // And remember to save the new look later
1070/*US 1081/*US
1071 if ( mainWindow()->inherits( "KMainWindow" ) ) 1082 if ( mainWindow()->inherits( "KMainWindow" ) )
@@ -1249,34 +1260,34 @@ void KToolBar::mousePressEvent ( QMouseEvent *m )
1249{ 1260{
1250 if ( !mainWindow() ) 1261 if ( !mainWindow() )
1251 return; 1262 return;
1252 QMainWindow *mw = mainWindow(); 1263 Q3MainWindow *mw = mainWindow();
1253 if ( mw->toolBarsMovable() && d->m_enableContext ) { 1264 if ( mw->toolBarsMovable() && d->m_enableContext ) {
1254 if ( m->button() == RightButton ) { 1265 if ( m->button() == Qt::RightButton ) {
1255 int i = contextMenu()->exec( m->globalPos(), 0 ); 1266 int i = contextMenu()->exec( m->globalPos(), 0 );
1256 switch ( i ) { 1267 switch ( i ) {
1257 case -1: 1268 case -1:
1258 return; // popup cancelled 1269 return; // popup cancelled
1259 case CONTEXT_LEFT: 1270 case CONTEXT_LEFT:
1260//US mw->moveDockWindow( this, DockLeft ); 1271//US mw->moveDockWindow( this, DockLeft );
1261 mw->moveToolBar( this, QMainWindow::Left ); 1272 mw->moveToolBar( this, Qt::Left );
1262 break; 1273 break;
1263 case CONTEXT_RIGHT: 1274 case CONTEXT_RIGHT:
1264//US mw->moveDockWindow( this, DockRight ); 1275//US mw->moveDockWindow( this, DockRight );
1265 mw->moveToolBar( this, QMainWindow::Right ); 1276 mw->moveToolBar( this, Qt::Right );
1266 break; 1277 break;
1267 case CONTEXT_TOP: 1278 case CONTEXT_TOP:
1268//US mw->moveDockWindow( this, DockTop ); 1279//US mw->moveDockWindow( this, DockTop );
1269 mw->moveToolBar( this, QMainWindow::Top ); 1280 mw->moveToolBar( this, Qt::Top );
1270 break; 1281 break;
1271 case CONTEXT_BOTTOM: 1282 case CONTEXT_BOTTOM:
1272//US mw->moveDockWindow( this, DockBottom ); 1283//US mw->moveDockWindow( this, DockBottom );
1273 mw->moveToolBar( this, QMainWindow::Bottom ); 1284 mw->moveToolBar( this, Qt::Bottom );
1274 break; 1285 break;
1275 case CONTEXT_FLOAT: 1286 case CONTEXT_FLOAT:
1276 break; 1287 break;
1277 case CONTEXT_FLAT: 1288 case CONTEXT_FLAT:
1278//US mw->moveDockWindow( this, DockMinimized ); 1289//US mw->moveDockWindow( this, DockMinimized );
1279 mw->moveToolBar( this, QMainWindow::Minimized ); 1290 mw->moveToolBar( this, Qt::Minimized );
1280 break; 1291 break;
1281 case CONTEXT_ICONS: 1292 case CONTEXT_ICONS:
1282 setIconText( IconOnly ); 1293 setIconText( IconOnly );
@@ -1332,7 +1343,7 @@ void KToolBar::rebuildLayout()
1332 w->hide(); 1343 w->hide();
1333 continue; 1344 continue;
1334 } 1345 }
1335 if ( w->inherits( "QPopupMenu" ) ) 1346 if ( w->inherits( "Q3PopupMenu" ) )
1336 continue; 1347 continue;
1337 l->addWidget( w ); 1348 l->addWidget( w );
1338 w->show(); 1349 w->show();
@@ -1364,7 +1375,7 @@ void KToolBar::childEvent( QChildEvent *e )
1364 if ( e->child()->isWidgetType() ) { 1375 if ( e->child()->isWidgetType() ) {
1365 QWidget * w = (QWidget*)e->child(); 1376 QWidget * w = (QWidget*)e->child();
1366 if ( e->type() == QEvent::ChildInserted ) { 1377 if ( e->type() == QEvent::ChildInserted ) {
1367 if ( !e->child()->inherits( "QPopupMenu" ) && 1378 if ( !e->child()->inherits( "Q3PopupMenu" ) &&
1368 ::qstrcmp( "qt_dockwidget_internal", e->child()->name() ) != 0 ) { 1379 ::qstrcmp( "qt_dockwidget_internal", e->child()->name() ) != 0 ) {
1369 1380
1370 // prevent items that have been explicitly inserted by insert*() from 1381 // prevent items that have been explicitly inserted by insert*() from
@@ -1375,10 +1386,10 @@ void KToolBar::childEvent( QChildEvent *e )
1375 insertWidgetInternal( w, dummy, -1 ); 1386 insertWidgetInternal( w, dummy, -1 );
1376 } 1387 }
1377 } 1388 }
1378 } else { 1389 } else if( e->type() == QEvent::ChildRemoved ) {
1379 removeWidgetInternal( w ); 1390 removeWidgetInternal( w );
1380 } 1391 }
1381 if ( isVisibleTo( 0 ) ) 1392 /* TODO:hacker: if ( isVisibleTo( 0 ) )
1382 { 1393 {
1383 QBoxLayout *l = boxLayout(); 1394 QBoxLayout *l = boxLayout();
1384 // QLayout *l = layout(); 1395 // QLayout *l = layout();
@@ -1390,9 +1401,9 @@ void KToolBar::childEvent( QChildEvent *e )
1390 it.deleteCurrent(); 1401 it.deleteCurrent();
1391 } 1402 }
1392 layoutTimer->start( 50, TRUE ); 1403 layoutTimer->start( 50, TRUE );
1393 } 1404 } */
1394 } 1405 }
1395 QToolBar::childEvent( e ); 1406 Q3ToolBar::childEvent( e );
1396} 1407}
1397 1408
1398void KToolBar::insertWidgetInternal( QWidget *w, int &index, int id ) 1409void KToolBar::insertWidgetInternal( QWidget *w, int &index, int id )
@@ -1416,25 +1427,25 @@ void KToolBar::insertWidgetInternal( QWidget *w, int &index, int id )
1416void KToolBar::repaintMe() 1427void KToolBar::repaintMe()
1417{ 1428{
1418 setUpdatesEnabled( true ); 1429 setUpdatesEnabled( true );
1419 QToolBar::repaint( true ); 1430 Q3ToolBar::repaint( true );
1420 qDebug(" KToolBar::repaintMe() "); 1431 qDebug(" KToolBar::repaintMe() ");
1421} 1432}
1422 1433
1423void KToolBar::showEvent( QShowEvent *e ) 1434void KToolBar::showEvent( QShowEvent *e )
1424{ 1435{
1425 rebuildLayout(); 1436 rebuildLayout();
1426 QToolBar::showEvent( e ); 1437 Q3ToolBar::showEvent( e );
1427} 1438}
1428 1439
1429void KToolBar::setStretchableWidget( QWidget *w ) 1440void KToolBar::setStretchableWidget( QWidget *w )
1430{ 1441{
1431 QToolBar::setStretchableWidget( w ); 1442 Q3ToolBar::setStretchableWidget( w );
1432 stretchableWidget = w; 1443 stretchableWidget = w;
1433} 1444}
1434 1445
1435QSizePolicy KToolBar::sizePolicy() const 1446QSizePolicy KToolBar::sizePolicy() const
1436{ 1447{
1437 if ( orientation() == Horizontal ) 1448 if ( orientation() == Qt::Horizontal )
1438 return QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ); 1449 return QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed );
1439 else 1450 else
1440 return QSizePolicy( QSizePolicy::Fixed, QSizePolicy::Expanding ); 1451 return QSizePolicy( QSizePolicy::Fixed, QSizePolicy::Expanding );
@@ -1442,7 +1453,7 @@ QSizePolicy KToolBar::sizePolicy() const
1442 1453
1443QSize KToolBar::sizeHint() const 1454QSize KToolBar::sizeHint() const
1444{ 1455{
1445 QSize sh = QToolBar::sizeHint(); 1456 QSize sh = Q3ToolBar::sizeHint();
1446 //qDebug("%x KToolBar::sizeHint() %d %d ",this, QToolBar::sizeHint().width(),QToolBar::sizeHint().height() ); 1457 //qDebug("%x KToolBar::sizeHint() %d %d ",this, QToolBar::sizeHint().width(),QToolBar::sizeHint().height() );
1447 if ( sh.height() <= 20 || sh.width() < 60 ) 1458 if ( sh.height() <= 20 || sh.width() < 60 )
1448 return QSize( sizeHintW, sizeHintH ); 1459 return QSize( sizeHintW, sizeHintH );
@@ -1508,7 +1519,7 @@ QSize KToolBar::sizeHint() const
1508 break; 1519 break;
1509 1520
1510 default: 1521 default:
1511 minSize = QToolBar::sizeHint(); 1522 minSize = Q3ToolBar::sizeHint();
1512 break; 1523 break;
1513 } 1524 }
1514 return minSize; 1525 return minSize;
@@ -1532,19 +1543,19 @@ bool KToolBar::highlight() const
1532 1543
1533void KToolBar::hide() 1544void KToolBar::hide()
1534{ 1545{
1535 QToolBar::hide(); 1546 Q3ToolBar::hide();
1536} 1547}
1537 1548
1538void KToolBar::show() 1549void KToolBar::show()
1539{ 1550{
1540 QToolBar::show(); 1551 Q3ToolBar::show();
1541} 1552}
1542 1553
1543void KToolBar::resizeEvent( QResizeEvent *e ) 1554void KToolBar::resizeEvent( QResizeEvent *e )
1544{ 1555{
1545 bool b = isUpdatesEnabled(); 1556 bool b = isUpdatesEnabled();
1546 setUpdatesEnabled( FALSE ); 1557 setUpdatesEnabled( FALSE );
1547 QToolBar::resizeEvent( e ); 1558 Q3ToolBar::resizeEvent( e );
1548 if (b) 1559 if (b)
1549 d->repaintTimer.start( 100, true ); 1560 d->repaintTimer.start( 100, true );
1550} 1561}
@@ -1726,7 +1737,7 @@ void KToolBar::applyAppearanceSettings(KConfig *config, const QString &_configGr
1726 doUpdate = true; 1737 doUpdate = true;
1727 } 1738 }
1728 1739
1729 QMainWindow *mw = mainWindow(); 1740 Q3MainWindow *mw = mainWindow();
1730 1741
1731 // ...and if we should highlight 1742 // ...and if we should highlight
1732 if ( highlight != d->m_highlight ) { 1743 if ( highlight != d->m_highlight ) {
@@ -1805,19 +1816,19 @@ void KToolBar::applySettings(KConfig *config, const QString &_configGroup)
1805 else if ( position == "Flat" ) 1816 else if ( position == "Flat" )
1806 pos = DockMinimized; 1817 pos = DockMinimized;
1807*/ 1818*/
1808 QMainWindow::ToolBarDock pos(QMainWindow::Top); 1819 Qt::ToolBarDock pos(Qt::DockTop);
1809 if ( position == "Top" ) 1820 if ( position == "Top" )
1810 pos = QMainWindow::Top; 1821 pos = Qt::Top;
1811 else if ( position == "Bottom" ) 1822 else if ( position == "Bottom" )
1812 pos = QMainWindow::Bottom; 1823 pos = Qt::Bottom;
1813 else if ( position == "Left" ) 1824 else if ( position == "Left" )
1814 pos = QMainWindow::Left; 1825 pos = Qt::Left;
1815 else if ( position == "Right" ) 1826 else if ( position == "Right" )
1816 pos = QMainWindow::Right; 1827 pos = Qt::Right;
1817 else if ( position == "Floating" ) 1828 else if ( position == "Floating" )
1818 pos = QMainWindow::TornOff; 1829 pos = Qt::TornOff;
1819 else if ( position == "Flat" ) 1830 else if ( position == "Flat" )
1820 pos = QMainWindow::Minimized; 1831 pos = Qt::Minimized;
1821 1832
1822 //kdDebug(220) << "KToolBar::applySettings hidden=" << hidden << endl; 1833 //kdDebug(220) << "KToolBar::applySettings hidden=" << hidden << endl;
1823 if (hidden) 1834 if (hidden)
@@ -1827,7 +1838,7 @@ void KToolBar::applySettings(KConfig *config, const QString &_configGroup)
1827 1838
1828 if ( mainWindow() ) 1839 if ( mainWindow() )
1829 { 1840 {
1830 QMainWindow *mw = mainWindow(); 1841 Q3MainWindow *mw = mainWindow();
1831 1842
1832 //kdDebug(220) << "KToolBar::applySettings updating ToolbarInfo" << endl; 1843 //kdDebug(220) << "KToolBar::applySettings updating ToolbarInfo" << endl;
1833 d->toolBarInfo = KToolBarPrivate::ToolBarInfo( pos, index, newLine, offset ); 1844 d->toolBarInfo = KToolBarPrivate::ToolBarInfo( pos, index, newLine, offset );
@@ -1862,7 +1873,7 @@ bool KToolBar::event( QEvent *e )
1862 return true; 1873 return true;
1863 } 1874 }
1864 1875
1865 return QToolBar::event( e ); 1876 return Q3ToolBar::event( e );
1866} 1877}
1867 1878
1868void KToolBar::slotRepaint() 1879void KToolBar::slotRepaint()
@@ -1880,14 +1891,14 @@ void KToolBar::slotRepaint()
1880 repaint( TRUE ); 1891 repaint( TRUE );
1881} 1892}
1882 1893
1883void KToolBar::toolBarPosChanged( QToolBar *tb ) 1894void KToolBar::toolBarPosChanged( Q3ToolBar *tb )
1884{ 1895{
1885 if ( tb != this ) 1896 if ( tb != this )
1886 return; 1897 return;
1887//US if ( d->oldPos == DockMinimized ) 1898//US if ( d->oldPos == DockMinimized )
1888 if ( d->oldPos == QMainWindow::Minimized ) 1899 if ( d->oldPos == Qt::Minimized )
1889 rebuildLayout(); 1900 rebuildLayout();
1890 d->oldPos = (QMainWindow::ToolBarDock)barPos(); 1901 d->oldPos = (Qt::ToolBarDock)barPos();
1891/*US 1902/*US
1892 if ( mainWindow() && mainWindow()->inherits( "KMainWindow" ) ) 1903 if ( mainWindow() && mainWindow()->inherits( "KMainWindow" ) )
1893 static_cast<KMainWindow *>(mainWindow())->setSettingsDirty(); 1904 static_cast<KMainWindow *>(mainWindow())->setSettingsDirty();
@@ -2031,7 +2042,7 @@ void KToolBar::getAttributes( QString &position, QString &icontext, int &index )
2031 } 2042 }
2032 2043
2033 if ( mainWindow() ) { 2044 if ( mainWindow() ) {
2034 QMainWindow::ToolBarDock dock; 2045 Qt::ToolBarDock dock;
2035 bool newLine; 2046 bool newLine;
2036 int offset; 2047 int offset;
2037 mainWindow()->getLocation( this, dock, index, newLine, offset ); 2048 mainWindow()->getLocation( this, dock, index, newLine, offset );
@@ -2100,7 +2111,7 @@ void KToolBar::positionYourself( bool force )
2100} 2111}
2101 2112
2102//US KPopupMenu *KToolBar::contextMenu() 2113//US KPopupMenu *KToolBar::contextMenu()
2103QPopupMenu *KToolBar::contextMenu() 2114Q3PopupMenu *KToolBar::contextMenu()
2104{ 2115{
2105 if ( context ) 2116 if ( context )
2106 return context; 2117 return context;
@@ -2108,11 +2119,11 @@ QPopupMenu *KToolBar::contextMenu()
2108 // Construct our context popup menu. Name it qt_dockwidget_internal so it 2119 // Construct our context popup menu. Name it qt_dockwidget_internal so it
2109 // won't be deleted by QToolBar::clear(). 2120 // won't be deleted by QToolBar::clear().
2110//US context = new KPopupMenu( this, "qt_dockwidget_internal" ); 2121//US context = new KPopupMenu( this, "qt_dockwidget_internal" );
2111 context = new QPopupMenu( this, "qt_dockwidget_internal" ); 2122 context = new Q3PopupMenu( this, "qt_dockwidget_internal" );
2112//US context->insertTitle(i18n("Toolbar Menu")); 2123//US context->insertTitle(i18n("Toolbar Menu"));
2113 2124
2114//US KPopupMenu *orient = new KPopupMenu( context, "orient" ); 2125//US KPopupMenu *orient = new KPopupMenu( context, "orient" );
2115 QPopupMenu *orient = new QPopupMenu( context, "orient" ); 2126 Q3PopupMenu *orient = new Q3PopupMenu( context, "orient" );
2116 orient->insertItem( i18n("toolbar position string","Top"), CONTEXT_TOP ); 2127 orient->insertItem( i18n("toolbar position string","Top"), CONTEXT_TOP );
2117 orient->insertItem( i18n("toolbar position string","Left"), CONTEXT_LEFT ); 2128 orient->insertItem( i18n("toolbar position string","Left"), CONTEXT_LEFT );
2118 orient->insertItem( i18n("toolbar position string","Right"), CONTEXT_RIGHT ); 2129 orient->insertItem( i18n("toolbar position string","Right"), CONTEXT_RIGHT );
@@ -2122,17 +2133,17 @@ QPopupMenu *KToolBar::contextMenu()
2122 orient->insertItem( i18n("min toolbar", "Flat"), CONTEXT_FLAT ); 2133 orient->insertItem( i18n("min toolbar", "Flat"), CONTEXT_FLAT );
2123 2134
2124//US KPopupMenu *mode = new KPopupMenu( context, "mode" ); 2135//US KPopupMenu *mode = new KPopupMenu( context, "mode" );
2125 QPopupMenu *mode = new QPopupMenu( context, "mode" ); 2136 Q3PopupMenu *mode = new Q3PopupMenu( context, "mode" );
2126 mode->insertItem( i18n("Icons Only"), CONTEXT_ICONS ); 2137 mode->insertItem( i18n("Icons Only"), CONTEXT_ICONS );
2127 mode->insertItem( i18n("Text Only"), CONTEXT_TEXT ); 2138 mode->insertItem( i18n("Text Only"), CONTEXT_TEXT );
2128 mode->insertItem( i18n("Text Alongside Icons"), CONTEXT_TEXTRIGHT ); 2139 mode->insertItem( i18n("Text Alongside Icons"), CONTEXT_TEXTRIGHT );
2129 mode->insertItem( i18n("Text Under Icons"), CONTEXT_TEXTUNDER ); 2140 mode->insertItem( i18n("Text Under Icons"), CONTEXT_TEXTUNDER );
2130 2141
2131//US KPopupMenu *size = new KPopupMenu( context, "size" ); 2142//US KPopupMenu *size = new KPopupMenu( context, "size" );
2132 QPopupMenu *size = new QPopupMenu( context, "size" ); 2143 Q3PopupMenu *size = new Q3PopupMenu( context, "size" );
2133 size->insertItem( i18n("Default"), CONTEXT_ICONSIZES ); 2144 size->insertItem( i18n("Default"), CONTEXT_ICONSIZES );
2134 // Query the current theme for available sizes 2145 // Query the current theme for available sizes
2135 QValueList<int> avSizes; 2146 Q3ValueList<int> avSizes;
2136/*US 2147/*US
2137 KIconTheme *theme = KGlobal::instance()->iconLoader()->theme(); 2148 KIconTheme *theme = KGlobal::instance()->iconLoader()->theme();
2138 if (!::qstrcmp(QObject::name(), "mainToolBar")) 2149 if (!::qstrcmp(QObject::name(), "mainToolBar"))
@@ -2145,7 +2156,7 @@ QPopupMenu *KToolBar::contextMenu()
2145 2156
2146 d->iconSizes = avSizes; 2157 d->iconSizes = avSizes;
2147 2158
2148 QValueList<int>::Iterator it; 2159 Q3ValueList<int>::Iterator it;
2149 for (it=avSizes.begin(); it!=avSizes.end(); it++) { 2160 for (it=avSizes.begin(); it!=avSizes.end(); it++) {
2150 QString text; 2161 QString text;
2151 if ( *it < 19 ) 2162 if ( *it < 19 )
@@ -2218,8 +2229,8 @@ void KToolBar::slotContextAboutToShow()
2218 break; 2229 break;
2219 } 2230 }
2220 2231
2221 QValueList<int>::ConstIterator iIt = d->iconSizes.begin(); 2232 Q3ValueList<int>::ConstIterator iIt = d->iconSizes.begin();
2222 QValueList<int>::ConstIterator iEnd = d->iconSizes.end(); 2233 Q3ValueList<int>::ConstIterator iEnd = d->iconSizes.end();
2223 for (; iIt != iEnd; ++iIt ) 2234 for (; iIt != iEnd; ++iIt )
2224 context->setItemChecked( CONTEXT_ICONSIZES + *iIt, false ); 2235 context->setItemChecked( CONTEXT_ICONSIZES + *iIt, false );
2225 2236