author | zautrix <zautrix> | 2005-08-23 21:48:53 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-08-23 21:48:53 (UTC) |
commit | 2acca9aff5bd651923b5d728712a0fd80b3d54e9 (patch) (unidiff) | |
tree | c2113d441908520d86902a8a9fade08eb05ee0d0 /microkde | |
parent | 6f5464760f5fb1e4c13027464cfe4943b85d29a0 (diff) | |
download | kdepimpi-2acca9aff5bd651923b5d728712a0fd80b3d54e9.zip kdepimpi-2acca9aff5bd651923b5d728712a0fd80b3d54e9.tar.gz kdepimpi-2acca9aff5bd651923b5d728712a0fd80b3d54e9.tar.bz2 |
fastload fixes
-rw-r--r-- | microkde/kdeui/ktoolbar.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/microkde/kdeui/ktoolbar.cpp b/microkde/kdeui/ktoolbar.cpp index 36ede81..df2aad8 100644 --- a/microkde/kdeui/ktoolbar.cpp +++ b/microkde/kdeui/ktoolbar.cpp | |||
@@ -1226,391 +1226,391 @@ void KToolBar::setText( const QString & txt ) | |||
1226 | setLabel( txt + " ( " + KGlobal::getAppName() + " ) " ); | 1226 | setLabel( txt + " ( " + KGlobal::getAppName() + " ) " ); |
1227 | } | 1227 | } |
1228 | 1228 | ||
1229 | 1229 | ||
1230 | QString KToolBar::text() const | 1230 | QString KToolBar::text() const |
1231 | { | 1231 | { |
1232 | return label(); | 1232 | return label(); |
1233 | } | 1233 | } |
1234 | 1234 | ||
1235 | 1235 | ||
1236 | void KToolBar::doConnections( KToolBarButton *button ) | 1236 | void KToolBar::doConnections( KToolBarButton *button ) |
1237 | { | 1237 | { |
1238 | connect(button, SIGNAL(clicked(int)), this, SIGNAL( clicked( int ) ) ); | 1238 | connect(button, SIGNAL(clicked(int)), this, SIGNAL( clicked( int ) ) ); |
1239 | connect(button, SIGNAL(doubleClicked(int)), this, SIGNAL( doubleClicked( int ) ) ); | 1239 | connect(button, SIGNAL(doubleClicked(int)), this, SIGNAL( doubleClicked( int ) ) ); |
1240 | connect(button, SIGNAL(released(int)), this, SIGNAL( released( int ) ) ); | 1240 | connect(button, SIGNAL(released(int)), this, SIGNAL( released( int ) ) ); |
1241 | connect(button, SIGNAL(pressed(int)), this, SIGNAL( pressed( int ) ) ); | 1241 | connect(button, SIGNAL(pressed(int)), this, SIGNAL( pressed( int ) ) ); |
1242 | connect(button, SIGNAL(toggled(int)), this, SIGNAL( toggled( int ) ) ); | 1242 | connect(button, SIGNAL(toggled(int)), this, SIGNAL( toggled( int ) ) ); |
1243 | connect(button, SIGNAL(highlighted(int, bool)), this, SIGNAL( highlighted( int, bool ) ) ); | 1243 | connect(button, SIGNAL(highlighted(int, bool)), this, SIGNAL( highlighted( int, bool ) ) ); |
1244 | } | 1244 | } |
1245 | 1245 | ||
1246 | void KToolBar::mousePressEvent ( QMouseEvent *m ) | 1246 | void KToolBar::mousePressEvent ( QMouseEvent *m ) |
1247 | { | 1247 | { |
1248 | if ( !mainWindow() ) | 1248 | if ( !mainWindow() ) |
1249 | return; | 1249 | return; |
1250 | QMainWindow *mw = mainWindow(); | 1250 | QMainWindow *mw = mainWindow(); |
1251 | if ( mw->toolBarsMovable() && d->m_enableContext ) { | 1251 | if ( mw->toolBarsMovable() && d->m_enableContext ) { |
1252 | if ( m->button() == RightButton ) { | 1252 | if ( m->button() == RightButton ) { |
1253 | int i = contextMenu()->exec( m->globalPos(), 0 ); | 1253 | int i = contextMenu()->exec( m->globalPos(), 0 ); |
1254 | switch ( i ) { | 1254 | switch ( i ) { |
1255 | case -1: | 1255 | case -1: |
1256 | return; // popup cancelled | 1256 | return; // popup cancelled |
1257 | case CONTEXT_LEFT: | 1257 | case CONTEXT_LEFT: |
1258 | //US mw->moveDockWindow( this, DockLeft ); | 1258 | //US mw->moveDockWindow( this, DockLeft ); |
1259 | mw->moveToolBar( this, QMainWindow::Left ); | 1259 | mw->moveToolBar( this, QMainWindow::Left ); |
1260 | break; | 1260 | break; |
1261 | case CONTEXT_RIGHT: | 1261 | case CONTEXT_RIGHT: |
1262 | //US mw->moveDockWindow( this, DockRight ); | 1262 | //US mw->moveDockWindow( this, DockRight ); |
1263 | mw->moveToolBar( this, QMainWindow::Right ); | 1263 | mw->moveToolBar( this, QMainWindow::Right ); |
1264 | break; | 1264 | break; |
1265 | case CONTEXT_TOP: | 1265 | case CONTEXT_TOP: |
1266 | //US mw->moveDockWindow( this, DockTop ); | 1266 | //US mw->moveDockWindow( this, DockTop ); |
1267 | mw->moveToolBar( this, QMainWindow::Top ); | 1267 | mw->moveToolBar( this, QMainWindow::Top ); |
1268 | break; | 1268 | break; |
1269 | case CONTEXT_BOTTOM: | 1269 | case CONTEXT_BOTTOM: |
1270 | //US mw->moveDockWindow( this, DockBottom ); | 1270 | //US mw->moveDockWindow( this, DockBottom ); |
1271 | mw->moveToolBar( this, QMainWindow::Bottom ); | 1271 | mw->moveToolBar( this, QMainWindow::Bottom ); |
1272 | break; | 1272 | break; |
1273 | case CONTEXT_FLOAT: | 1273 | case CONTEXT_FLOAT: |
1274 | break; | 1274 | break; |
1275 | case CONTEXT_FLAT: | 1275 | case CONTEXT_FLAT: |
1276 | //US mw->moveDockWindow( this, DockMinimized ); | 1276 | //US mw->moveDockWindow( this, DockMinimized ); |
1277 | mw->moveToolBar( this, QMainWindow::Minimized ); | 1277 | mw->moveToolBar( this, QMainWindow::Minimized ); |
1278 | break; | 1278 | break; |
1279 | case CONTEXT_ICONS: | 1279 | case CONTEXT_ICONS: |
1280 | setIconText( IconOnly ); | 1280 | setIconText( IconOnly ); |
1281 | break; | 1281 | break; |
1282 | case CONTEXT_TEXTRIGHT: | 1282 | case CONTEXT_TEXTRIGHT: |
1283 | setIconText( IconTextRight ); | 1283 | setIconText( IconTextRight ); |
1284 | break; | 1284 | break; |
1285 | case CONTEXT_TEXT: | 1285 | case CONTEXT_TEXT: |
1286 | setIconText( TextOnly ); | 1286 | setIconText( TextOnly ); |
1287 | break; | 1287 | break; |
1288 | case CONTEXT_TEXTUNDER: | 1288 | case CONTEXT_TEXTUNDER: |
1289 | setIconText( IconTextBottom ); | 1289 | setIconText( IconTextBottom ); |
1290 | break; | 1290 | break; |
1291 | default: | 1291 | default: |
1292 | if ( i >= CONTEXT_ICONSIZES ) | 1292 | if ( i >= CONTEXT_ICONSIZES ) |
1293 | setIconSize( i - CONTEXT_ICONSIZES ); | 1293 | setIconSize( i - CONTEXT_ICONSIZES ); |
1294 | else | 1294 | else |
1295 | return; // assume this was an action handled elsewhere, no need for setSettingsDirty() | 1295 | return; // assume this was an action handled elsewhere, no need for setSettingsDirty() |
1296 | } | 1296 | } |
1297 | /*US | 1297 | /*US |
1298 | if ( mw->inherits("KMainWindow") ) | 1298 | if ( mw->inherits("KMainWindow") ) |
1299 | static_cast<KMainWindow *>(mw)->setSettingsDirty(); | 1299 | static_cast<KMainWindow *>(mw)->setSettingsDirty(); |
1300 | */ | 1300 | */ |
1301 | } | 1301 | } |
1302 | } | 1302 | } |
1303 | } | 1303 | } |
1304 | 1304 | ||
1305 | 1305 | ||
1306 | void KToolBar::rebuildLayout() | 1306 | void KToolBar::rebuildLayout() |
1307 | { | 1307 | { |
1308 | 1308 | ||
1309 | for(QWidget *w=d->idleButtons.first(); w; w=d->idleButtons.next()) | 1309 | for(QWidget *w=d->idleButtons.first(); w; w=d->idleButtons.next()) |
1310 | w->blockSignals(false); | 1310 | w->blockSignals(false); |
1311 | d->idleButtons.clear(); | 1311 | d->idleButtons.clear(); |
1312 | 1312 | ||
1313 | layoutTimer->stop(); | 1313 | layoutTimer->stop(); |
1314 | QApplication::sendPostedEvents( this, QEvent::ChildInserted ); | 1314 | QApplication::sendPostedEvents( this, QEvent::ChildInserted ); |
1315 | QBoxLayout *l = boxLayout(); | 1315 | QBoxLayout *l = boxLayout(); |
1316 | l->setMargin( 1 ); | 1316 | l->setMargin( 1 ); |
1317 | // clear the old layout | 1317 | // clear the old layout |
1318 | QLayoutIterator it = l->iterator(); | 1318 | QLayoutIterator it = l->iterator(); |
1319 | 1319 | ||
1320 | while ( it.current() ) { | 1320 | while ( it.current() ) { |
1321 | it.deleteCurrent(); | 1321 | it.deleteCurrent(); |
1322 | } | 1322 | } |
1323 | for ( QWidget *w = widgets.first(); w; w = widgets.next() ) { | 1323 | for ( QWidget *w = widgets.first(); w; w = widgets.next() ) { |
1324 | if ( w == rightAligned ) { | 1324 | if ( w == rightAligned ) { |
1325 | continue; | 1325 | continue; |
1326 | } | 1326 | } |
1327 | if ( w->inherits( "KToolBarSeparator" ) && | 1327 | if ( w->inherits( "KToolBarSeparator" ) && |
1328 | !( (KToolBarSeparator*)w )->showLine() ) { | 1328 | !( (KToolBarSeparator*)w )->showLine() ) { |
1329 | l->addSpacing( 6 ); | 1329 | l->addSpacing( 6 ); |
1330 | w->hide(); | 1330 | w->hide(); |
1331 | continue; | 1331 | continue; |
1332 | } | 1332 | } |
1333 | if ( w->inherits( "QPopupMenu" ) ) | 1333 | if ( w->inherits( "QPopupMenu" ) ) |
1334 | continue; | 1334 | continue; |
1335 | l->addWidget( w ); | 1335 | l->addWidget( w ); |
1336 | w->show(); | 1336 | w->show(); |
1337 | } | 1337 | } |
1338 | if ( rightAligned ) { | 1338 | if ( rightAligned ) { |
1339 | l->addStretch(); | 1339 | l->addStretch(); |
1340 | l->addWidget( rightAligned ); | 1340 | l->addWidget( rightAligned ); |
1341 | rightAligned->show(); | 1341 | rightAligned->show(); |
1342 | } | 1342 | } |
1343 | 1343 | ||
1344 | if ( fullSize() ) { | 1344 | if ( fullSize() ) { |
1345 | // This code sucks. It makes the last combo in a toolbar VERY big (e.g. zoom combo in kword). | 1345 | // This code sucks. It makes the last combo in a toolbar VERY big (e.g. zoom combo in kword). |
1346 | //if ( !stretchableWidget && widgets.last() && | 1346 | //if ( !stretchableWidget && widgets.last() && |
1347 | // !widgets.last()->inherits( "QButton" ) && !widgets.last()->inherits( "KAnimWidget" ) ) | 1347 | // !widgets.last()->inherits( "QButton" ) && !widgets.last()->inherits( "KAnimWidget" ) ) |
1348 | // setStretchableWidget( widgets.last() ); | 1348 | // setStretchableWidget( widgets.last() ); |
1349 | if ( !rightAligned ) | 1349 | if ( !rightAligned ) |
1350 | l->addStretch(); | 1350 | l->addStretch(); |
1351 | if ( stretchableWidget ) | 1351 | if ( stretchableWidget ) |
1352 | l->setStretchFactor( stretchableWidget, 10 ); | 1352 | l->setStretchFactor( stretchableWidget, 10 ); |
1353 | } | 1353 | } |
1354 | l->invalidate(); | 1354 | l->invalidate(); |
1355 | QApplication::postEvent( this, new QEvent( QEvent::LayoutHint ) ); | 1355 | QApplication::postEvent( this, new QEvent( QEvent::LayoutHint ) ); |
1356 | //#endif //DESKTOP_VERSION | 1356 | //#endif //DESKTOP_VERSION |
1357 | } | 1357 | } |
1358 | 1358 | ||
1359 | void KToolBar::childEvent( QChildEvent *e ) | 1359 | void KToolBar::childEvent( QChildEvent *e ) |
1360 | { | 1360 | { |
1361 | 1361 | ||
1362 | if ( e->child()->isWidgetType() ) { | 1362 | if ( e->child()->isWidgetType() ) { |
1363 | QWidget * w = (QWidget*)e->child(); | 1363 | QWidget * w = (QWidget*)e->child(); |
1364 | if ( e->type() == QEvent::ChildInserted ) { | 1364 | if ( e->type() == QEvent::ChildInserted ) { |
1365 | if ( !e->child()->inherits( "QPopupMenu" ) && | 1365 | if ( !e->child()->inherits( "QPopupMenu" ) && |
1366 | ::qstrcmp( "qt_dockwidget_internal", e->child()->name() ) != 0 ) { | 1366 | ::qstrcmp( "qt_dockwidget_internal", e->child()->name() ) != 0 ) { |
1367 | 1367 | ||
1368 | // prevent items that have been explicitly inserted by insert*() from | 1368 | // prevent items that have been explicitly inserted by insert*() from |
1369 | // being inserted again | 1369 | // being inserted again |
1370 | if ( !widget2id.contains( w ) ) | 1370 | if ( !widget2id.contains( w ) ) |
1371 | { | 1371 | { |
1372 | int dummy = -1; | 1372 | int dummy = -1; |
1373 | insertWidgetInternal( w, dummy, -1 ); | 1373 | insertWidgetInternal( w, dummy, -1 ); |
1374 | } | 1374 | } |
1375 | } | 1375 | } |
1376 | } else { | 1376 | } else { |
1377 | removeWidgetInternal( w ); | 1377 | removeWidgetInternal( w ); |
1378 | } | 1378 | } |
1379 | if ( isVisibleTo( 0 ) ) | 1379 | if ( isVisibleTo( 0 ) ) |
1380 | { | 1380 | { |
1381 | QBoxLayout *l = boxLayout(); | 1381 | QBoxLayout *l = boxLayout(); |
1382 | // QLayout *l = layout(); | 1382 | // QLayout *l = layout(); |
1383 | 1383 | ||
1384 | // clear the old layout so that we don't get unnecassery layout | 1384 | // clear the old layout so that we don't get unnecassery layout |
1385 | // changes till we have rebuild the thing | 1385 | // changes till we have rebuild the thing |
1386 | QLayoutIterator it = l->iterator(); | 1386 | QLayoutIterator it = l->iterator(); |
1387 | while ( it.current() ) { | 1387 | while ( it.current() ) { |
1388 | it.deleteCurrent(); | 1388 | it.deleteCurrent(); |
1389 | } | 1389 | } |
1390 | layoutTimer->start( 50, TRUE ); | 1390 | layoutTimer->start( 50, TRUE ); |
1391 | } | 1391 | } |
1392 | } | 1392 | } |
1393 | QToolBar::childEvent( e ); | 1393 | QToolBar::childEvent( e ); |
1394 | } | 1394 | } |
1395 | 1395 | ||
1396 | void KToolBar::insertWidgetInternal( QWidget *w, int &index, int id ) | 1396 | void KToolBar::insertWidgetInternal( QWidget *w, int &index, int id ) |
1397 | { | 1397 | { |
1398 | // we can't have it in widgets, or something is really wrong | 1398 | // we can't have it in widgets, or something is really wrong |
1399 | //widgets.removeRef( w ); | 1399 | //widgets.removeRef( w ); |
1400 | 1400 | ||
1401 | connect( w, SIGNAL( destroyed() ), | 1401 | connect( w, SIGNAL( destroyed() ), |
1402 | this, SLOT( widgetDestroyed() ) ); | 1402 | this, SLOT( widgetDestroyed() ) ); |
1403 | if ( index == -1 || index > (int)widgets.count() ) { | 1403 | if ( index == -1 || index > (int)widgets.count() ) { |
1404 | widgets.append( w ); | 1404 | widgets.append( w ); |
1405 | index = (int)widgets.count(); | 1405 | index = (int)widgets.count(); |
1406 | } | 1406 | } |
1407 | else | 1407 | else |
1408 | widgets.insert( index, w ); | 1408 | widgets.insert( index, w ); |
1409 | if ( id == -1 ) | 1409 | if ( id == -1 ) |
1410 | id = id2widget.count(); | 1410 | id = id2widget.count(); |
1411 | id2widget.insert( id, w ); | 1411 | id2widget.insert( id, w ); |
1412 | widget2id.insert( w, id ); | 1412 | widget2id.insert( w, id ); |
1413 | } | 1413 | } |
1414 | void KToolBar::repaintMe() | 1414 | void KToolBar::repaintMe() |
1415 | { | 1415 | { |
1416 | setUpdatesEnabled( true ); | 1416 | setUpdatesEnabled( true ); |
1417 | QToolBar::repaint( true ); | 1417 | QToolBar::repaint( true ); |
1418 | //qDebug(" KToolBar::repaintMe() "); | 1418 | qDebug(" KToolBar::repaintMe() "); |
1419 | } | 1419 | } |
1420 | 1420 | ||
1421 | void KToolBar::showEvent( QShowEvent *e ) | 1421 | void KToolBar::showEvent( QShowEvent *e ) |
1422 | { | 1422 | { |
1423 | QToolBar::showEvent( e ); | ||
1424 | rebuildLayout(); | 1423 | rebuildLayout(); |
1424 | QToolBar::showEvent( e ); | ||
1425 | } | 1425 | } |
1426 | 1426 | ||
1427 | void KToolBar::setStretchableWidget( QWidget *w ) | 1427 | void KToolBar::setStretchableWidget( QWidget *w ) |
1428 | { | 1428 | { |
1429 | QToolBar::setStretchableWidget( w ); | 1429 | QToolBar::setStretchableWidget( w ); |
1430 | stretchableWidget = w; | 1430 | stretchableWidget = w; |
1431 | } | 1431 | } |
1432 | 1432 | ||
1433 | QSizePolicy KToolBar::sizePolicy() const | 1433 | QSizePolicy KToolBar::sizePolicy() const |
1434 | { | 1434 | { |
1435 | if ( orientation() == Horizontal ) | 1435 | if ( orientation() == Horizontal ) |
1436 | return QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ); | 1436 | return QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ); |
1437 | else | 1437 | else |
1438 | return QSizePolicy( QSizePolicy::Fixed, QSizePolicy::Expanding ); | 1438 | return QSizePolicy( QSizePolicy::Fixed, QSizePolicy::Expanding ); |
1439 | } | 1439 | } |
1440 | 1440 | ||
1441 | QSize KToolBar::sizeHint() const | 1441 | QSize KToolBar::sizeHint() const |
1442 | { | 1442 | { |
1443 | return QToolBar::sizeHint(); | 1443 | return QToolBar::sizeHint(); |
1444 | #if 0 | 1444 | #if 0 |
1445 | QWidget::polish(); | 1445 | QWidget::polish(); |
1446 | static int iii = 0; | 1446 | static int iii = 0; |
1447 | ++iii; | 1447 | ++iii; |
1448 | qDebug("++++++++ KToolBar::sizeHint() %d ", iii ); | 1448 | qDebug("++++++++ KToolBar::sizeHint() %d ", iii ); |
1449 | int margin = static_cast<QWidget*>(ncThis)->layout()->margin(); | 1449 | int margin = static_cast<QWidget*>(ncThis)->layout()->margin(); |
1450 | switch( barPos() ) | 1450 | switch( barPos() ) |
1451 | { | 1451 | { |
1452 | case KToolBar::Top: | 1452 | case KToolBar::Top: |
1453 | case KToolBar::Bottom: | 1453 | case KToolBar::Bottom: |
1454 | for ( QWidget *w = widgets.first(); w; w =widgets.next() ) | 1454 | for ( QWidget *w = widgets.first(); w; w =widgets.next() ) |
1455 | { | 1455 | { |
1456 | if ( w->inherits( "KToolBarSeparator" ) && | 1456 | if ( w->inherits( "KToolBarSeparator" ) && |
1457 | !( static_cast<KToolBarSeparator*>(w)->showLine() ) ) | 1457 | !( static_cast<KToolBarSeparator*>(w)->showLine() ) ) |
1458 | { | 1458 | { |
1459 | minSize += QSize(6, 0); | 1459 | minSize += QSize(6, 0); |
1460 | } | 1460 | } |
1461 | else | 1461 | else |
1462 | { | 1462 | { |
1463 | QSize sh = w->sizeHint(); | 1463 | QSize sh = w->sizeHint(); |
1464 | if (!sh.isValid()) | 1464 | if (!sh.isValid()) |
1465 | sh = w->minimumSize(); | 1465 | sh = w->minimumSize(); |
1466 | minSize = minSize.expandedTo(QSize(0, sh.height())); | 1466 | minSize = minSize.expandedTo(QSize(0, sh.height())); |
1467 | minSize += QSize(sh.width()+1, 0); | 1467 | minSize += QSize(sh.width()+1, 0); |
1468 | } | 1468 | } |
1469 | } | 1469 | } |
1470 | /*US | 1470 | /*US |
1471 | minSize += QSize(QApplication::style().pixelMetric( QStyle::PM_DockWindowHandleExtent ), 0); | 1471 | minSize += QSize(QApplication::style().pixelMetric( QStyle::PM_DockWindowHandleExtent ), 0); |
1472 | */ | 1472 | */ |
1473 | minSize += QSize(margin*2, margin*2); | 1473 | minSize += QSize(margin*2, margin*2); |
1474 | break; | 1474 | break; |
1475 | 1475 | ||
1476 | case KToolBar::Left: | 1476 | case KToolBar::Left: |
1477 | case KToolBar::Right: | 1477 | case KToolBar::Right: |
1478 | for ( QWidget *w = widgets.first(); w; w = widgets.next() ) | 1478 | for ( QWidget *w = widgets.first(); w; w = widgets.next() ) |
1479 | { | 1479 | { |
1480 | if ( w->inherits( "KToolBarSeparator" ) && | 1480 | if ( w->inherits( "KToolBarSeparator" ) && |
1481 | !( static_cast<KToolBarSeparator*>(w)->showLine() ) ) | 1481 | !( static_cast<KToolBarSeparator*>(w)->showLine() ) ) |
1482 | { | 1482 | { |
1483 | minSize += QSize(0, 6); | 1483 | minSize += QSize(0, 6); |
1484 | } | 1484 | } |
1485 | else | 1485 | else |
1486 | { | 1486 | { |
1487 | QSize sh = w->sizeHint(); | 1487 | QSize sh = w->sizeHint(); |
1488 | if (!sh.isValid()) | 1488 | if (!sh.isValid()) |
1489 | sh = w->minimumSize(); | 1489 | sh = w->minimumSize(); |
1490 | minSize = minSize.expandedTo(QSize(sh.width(), 0)); | 1490 | minSize = minSize.expandedTo(QSize(sh.width(), 0)); |
1491 | minSize += QSize(0, sh.height()+1); | 1491 | minSize += QSize(0, sh.height()+1); |
1492 | } | 1492 | } |
1493 | } | 1493 | } |
1494 | /*US | 1494 | /*US |
1495 | minSize += QSize(0, QApplication::style().pixelMetric( QStyle::PM_DockWindowHandleExtent )); | 1495 | minSize += QSize(0, QApplication::style().pixelMetric( QStyle::PM_DockWindowHandleExtent )); |
1496 | */ | 1496 | */ |
1497 | minSize += QSize(margin*2, margin*2); | 1497 | minSize += QSize(margin*2, margin*2); |
1498 | break; | 1498 | break; |
1499 | 1499 | ||
1500 | default: | 1500 | default: |
1501 | minSize = QToolBar::sizeHint(); | 1501 | minSize = QToolBar::sizeHint(); |
1502 | break; | 1502 | break; |
1503 | } | 1503 | } |
1504 | return minSize; | 1504 | return minSize; |
1505 | #endif | 1505 | #endif |
1506 | } | 1506 | } |
1507 | 1507 | ||
1508 | QSize KToolBar::minimumSize() const | 1508 | QSize KToolBar::minimumSize() const |
1509 | { | 1509 | { |
1510 | return minimumSizeHint(); | 1510 | return minimumSizeHint(); |
1511 | } | 1511 | } |
1512 | 1512 | ||
1513 | QSize KToolBar::minimumSizeHint() const | 1513 | QSize KToolBar::minimumSizeHint() const |
1514 | { | 1514 | { |
1515 | return sizeHint(); | 1515 | return sizeHint(); |
1516 | } | 1516 | } |
1517 | 1517 | ||
1518 | bool KToolBar::highlight() const | 1518 | bool KToolBar::highlight() const |
1519 | { | 1519 | { |
1520 | return d->m_highlight; | 1520 | return d->m_highlight; |
1521 | } | 1521 | } |
1522 | 1522 | ||
1523 | void KToolBar::hide() | 1523 | void KToolBar::hide() |
1524 | { | 1524 | { |
1525 | QToolBar::hide(); | 1525 | QToolBar::hide(); |
1526 | } | 1526 | } |
1527 | 1527 | ||
1528 | void KToolBar::show() | 1528 | void KToolBar::show() |
1529 | { | 1529 | { |
1530 | QToolBar::show(); | 1530 | QToolBar::show(); |
1531 | } | 1531 | } |
1532 | 1532 | ||
1533 | void KToolBar::resizeEvent( QResizeEvent *e ) | 1533 | void KToolBar::resizeEvent( QResizeEvent *e ) |
1534 | { | 1534 | { |
1535 | bool b = isUpdatesEnabled(); | 1535 | bool b = isUpdatesEnabled(); |
1536 | setUpdatesEnabled( FALSE ); | 1536 | setUpdatesEnabled( FALSE ); |
1537 | QToolBar::resizeEvent( e ); | 1537 | QToolBar::resizeEvent( e ); |
1538 | if (b) | 1538 | if (b) |
1539 | d->repaintTimer.start( 100, true ); | 1539 | d->repaintTimer.start( 100, true ); |
1540 | } | 1540 | } |
1541 | 1541 | ||
1542 | void KToolBar::slotIconChanged(int group) | 1542 | void KToolBar::slotIconChanged(int group) |
1543 | { | 1543 | { |
1544 | if ((group != KIcon::Toolbar) && (group != KIcon::MainToolbar)) | 1544 | if ((group != KIcon::Toolbar) && (group != KIcon::MainToolbar)) |
1545 | return; | 1545 | return; |
1546 | if ((group == KIcon::MainToolbar) != !::qstrcmp(name(), "mainToolBar")) | 1546 | if ((group == KIcon::MainToolbar) != !::qstrcmp(name(), "mainToolBar")) |
1547 | return; | 1547 | return; |
1548 | 1548 | ||
1549 | emit modechange(); | 1549 | emit modechange(); |
1550 | if (isVisible()) | 1550 | if (isVisible()) |
1551 | updateGeometry(); | 1551 | updateGeometry(); |
1552 | } | 1552 | } |
1553 | 1553 | ||
1554 | void KToolBar::slotReadConfig() | 1554 | void KToolBar::slotReadConfig() |
1555 | { | 1555 | { |
1556 | //kdDebug(220) << "KToolBar::slotReadConfig" << endl; | 1556 | //kdDebug(220) << "KToolBar::slotReadConfig" << endl; |
1557 | // Read appearance settings (hmm, we used to do both here, | 1557 | // Read appearance settings (hmm, we used to do both here, |
1558 | // but a well behaved application will call applyMainWindowSettings | 1558 | // but a well behaved application will call applyMainWindowSettings |
1559 | // anyway, right ?) | 1559 | // anyway, right ?) |
1560 | applyAppearanceSettings(KGlobal::config(), QString::null ); | 1560 | applyAppearanceSettings(KGlobal::config(), QString::null ); |
1561 | } | 1561 | } |
1562 | 1562 | ||
1563 | void KToolBar::slotAppearanceChanged() | 1563 | void KToolBar::slotAppearanceChanged() |
1564 | { | 1564 | { |
1565 | // Read appearance settings from global file. | 1565 | // Read appearance settings from global file. |
1566 | applyAppearanceSettings(KGlobal::config(), QString::null, true /* lose local settings */ ); | 1566 | applyAppearanceSettings(KGlobal::config(), QString::null, true /* lose local settings */ ); |
1567 | // And remember to save the new look later | 1567 | // And remember to save the new look later |
1568 | /*US | 1568 | /*US |
1569 | if ( mainWindow() && mainWindow()->inherits( "KMainWindow" ) ) | 1569 | if ( mainWindow() && mainWindow()->inherits( "KMainWindow" ) ) |
1570 | static_cast<KMainWindow *>(mainWindow())->setSettingsDirty(); | 1570 | static_cast<KMainWindow *>(mainWindow())->setSettingsDirty(); |
1571 | */ | 1571 | */ |
1572 | } | 1572 | } |
1573 | 1573 | ||
1574 | //static | 1574 | //static |
1575 | bool KToolBar::highlightSetting() | 1575 | bool KToolBar::highlightSetting() |
1576 | { | 1576 | { |
1577 | QString grpToolbar(QString::fromLatin1("Toolbar style")); | 1577 | QString grpToolbar(QString::fromLatin1("Toolbar style")); |
1578 | KConfigGroupSaver saver(KGlobal::config(), grpToolbar); | 1578 | KConfigGroupSaver saver(KGlobal::config(), grpToolbar); |
1579 | return KGlobal::config()->readBoolEntry(QString::fromLatin1("Highlighting"),true); | 1579 | return KGlobal::config()->readBoolEntry(QString::fromLatin1("Highlighting"),true); |
1580 | } | 1580 | } |
1581 | 1581 | ||
1582 | //static | 1582 | //static |
1583 | bool KToolBar::transparentSetting() | 1583 | bool KToolBar::transparentSetting() |
1584 | { | 1584 | { |
1585 | QString grpToolbar(QString::fromLatin1("Toolbar style")); | 1585 | QString grpToolbar(QString::fromLatin1("Toolbar style")); |
1586 | KConfigGroupSaver saver(KGlobal::config(), grpToolbar); | 1586 | KConfigGroupSaver saver(KGlobal::config(), grpToolbar); |
1587 | return KGlobal::config()->readBoolEntry(QString::fromLatin1("TransparentMoving"),true); | 1587 | return KGlobal::config()->readBoolEntry(QString::fromLatin1("TransparentMoving"),true); |
1588 | } | 1588 | } |
1589 | 1589 | ||
1590 | //static | 1590 | //static |
1591 | KToolBar::IconText KToolBar::iconTextSetting() | 1591 | KToolBar::IconText KToolBar::iconTextSetting() |
1592 | { | 1592 | { |
1593 | QString grpToolbar(QString::fromLatin1("Toolbar style")); | 1593 | QString grpToolbar(QString::fromLatin1("Toolbar style")); |
1594 | KConfigGroupSaver saver(KGlobal::config(), grpToolbar); | 1594 | KConfigGroupSaver saver(KGlobal::config(), grpToolbar); |
1595 | QString icontext = KGlobal::config()->readEntry(QString::fromLatin1("IconText"),QString::fromLatin1("IconOnly")); | 1595 | QString icontext = KGlobal::config()->readEntry(QString::fromLatin1("IconText"),QString::fromLatin1("IconOnly")); |
1596 | if ( icontext == "IconTextRight" ) | 1596 | if ( icontext == "IconTextRight" ) |
1597 | return IconTextRight; | 1597 | return IconTextRight; |
1598 | else if ( icontext == "IconTextBottom" ) | 1598 | else if ( icontext == "IconTextBottom" ) |
1599 | return IconTextBottom; | 1599 | return IconTextBottom; |
1600 | else if ( icontext == "TextOnly" ) | 1600 | else if ( icontext == "TextOnly" ) |
1601 | return TextOnly; | 1601 | return TextOnly; |
1602 | else | 1602 | else |
1603 | return IconOnly; | 1603 | return IconOnly; |
1604 | } | 1604 | } |
1605 | 1605 | ||
1606 | void KToolBar::applyAppearanceSettings(KConfig *config, const QString &_configGroup, bool forceGlobal) | 1606 | void KToolBar::applyAppearanceSettings(KConfig *config, const QString &_configGroup, bool forceGlobal) |
1607 | { | 1607 | { |
1608 | return; | 1608 | return; |
1609 | QString configGroup = _configGroup.isEmpty() ? settingsGroup() : _configGroup; | 1609 | QString configGroup = _configGroup.isEmpty() ? settingsGroup() : _configGroup; |
1610 | //kdDebug(220) << "KToolBar::applyAppearanceSettings: configGroup=" << configGroup << endl; | 1610 | //kdDebug(220) << "KToolBar::applyAppearanceSettings: configGroup=" << configGroup << endl; |
1611 | // We have application-specific settings in the XML file, | 1611 | // We have application-specific settings in the XML file, |
1612 | // and nothing in the application's config file | 1612 | // and nothing in the application's config file |
1613 | // -> don't apply the global defaults, the XML ones are preferred | 1613 | // -> don't apply the global defaults, the XML ones are preferred |
1614 | // See applySettings for a full explanation | 1614 | // See applySettings for a full explanation |
1615 | /*US :we do not support xml files | 1615 | /*US :we do not support xml files |
1616 | if ( d->m_xmlguiClient && !d->m_xmlguiClient->xmlFile().isEmpty() && | 1616 | if ( d->m_xmlguiClient && !d->m_xmlguiClient->xmlFile().isEmpty() && |