Changeset View
Changeset View
Standalone View
Standalone View
src/ktoolbar.cpp
Show First 20 Lines • Show All 348 Lines • ▼ Show 20 Line(s) | 306 | if (!context) { | |||
---|---|---|---|---|---|
349 | if (theme) { | 349 | if (theme) { | ||
350 | avSizes = theme->querySizes(isMainToolBar ? KIconLoader::MainToolbar : KIconLoader::Toolbar); | 350 | avSizes = theme->querySizes(isMainToolBar ? KIconLoader::MainToolbar : KIconLoader::Toolbar); | ||
351 | } | 351 | } | ||
352 | 352 | | |||
353 | std::sort(avSizes.begin(), avSizes.end()); | 353 | std::sort(avSizes.begin(), avSizes.end()); | ||
354 | 354 | | |||
355 | if (avSizes.count() < 10) { | 355 | if (avSizes.count() < 10) { | ||
356 | // Fixed or threshold type icons | 356 | // Fixed or threshold type icons | ||
357 | Q_FOREACH (int it, avSizes) { | 357 | for (int it : qAsConst(avSizes)) { | ||
358 | QString text; | 358 | QString text; | ||
359 | if (it < 19) { | 359 | if (it < 19) { | ||
360 | text = i18n("Small (%1x%2)", it, it); | 360 | text = i18n("Small (%1x%2)", it, it); | ||
361 | } else if (it < 25) { | 361 | } else if (it < 25) { | ||
362 | text = i18n("Medium (%1x%2)", it, it); | 362 | text = i18n("Medium (%1x%2)", it, it); | ||
363 | } else if (it < 35) { | 363 | } else if (it < 35) { | ||
364 | text = i18n("Large (%1x%2)", it, it); | 364 | text = i18n("Large (%1x%2)", it, it); | ||
365 | } else { | 365 | } else { | ||
366 | text = i18n("Huge (%1x%2)", it, it); | 366 | text = i18n("Huge (%1x%2)", it, it); | ||
367 | } | 367 | } | ||
368 | 368 | | |||
369 | // save the size in the contextIconSizes map | 369 | // save the size in the contextIconSizes map | ||
370 | contextIconSizes.insert(contextSize->addAction(text, q, SLOT(slotContextIconSize())), it); | 370 | contextIconSizes.insert(contextSize->addAction(text, q, SLOT(slotContextIconSize())), it); | ||
371 | } | 371 | } | ||
372 | } else { | 372 | } else { | ||
373 | // Scalable icons. | 373 | // Scalable icons. | ||
374 | const int progression[] = { 16, 22, 32, 48, 64, 96, 128, 192, 256 }; | 374 | const int progression[] = { 16, 22, 32, 48, 64, 96, 128, 192, 256 }; | ||
375 | 375 | | |||
376 | for (uint i = 0; i < 9; i++) { | 376 | for (uint i = 0; i < 9; i++) { | ||
377 | Q_FOREACH (int it, avSizes) { | 377 | for (int it : qAsConst(avSizes)) { | ||
378 | if (it >= progression[ i ]) { | 378 | if (it >= progression[ i ]) { | ||
379 | QString text; | 379 | QString text; | ||
380 | if (it < 19) { | 380 | if (it < 19) { | ||
381 | text = i18n("Small (%1x%2)", it, it); | 381 | text = i18n("Small (%1x%2)", it, it); | ||
382 | } else if (it < 25) { | 382 | } else if (it < 25) { | ||
383 | text = i18n("Medium (%1x%2)", it, it); | 383 | text = i18n("Medium (%1x%2)", it, it); | ||
384 | } else if (it < 35) { | 384 | } else if (it < 35) { | ||
385 | text = i18n("Large (%1x%2)", it, it); | 385 | text = i18n("Large (%1x%2)", it, it); | ||
▲ Show 20 Lines • Show All 705 Lines • ▼ Show 20 Line(s) | 1089 | if (toolBarsEditable() && event->proposedAction() & (Qt::CopyAction | Qt::MoveAction) && | |||
1091 | QByteArray data = event->mimeData()->data(QStringLiteral("application/x-kde-action-list")); | 1091 | QByteArray data = event->mimeData()->data(QStringLiteral("application/x-kde-action-list")); | ||
1092 | 1092 | | |||
1093 | QDataStream stream(data); | 1093 | QDataStream stream(data); | ||
1094 | 1094 | | |||
1095 | QStringList actionNames; | 1095 | QStringList actionNames; | ||
1096 | 1096 | | |||
1097 | stream >> actionNames; | 1097 | stream >> actionNames; | ||
1098 | 1098 | | |||
1099 | Q_FOREACH (const QString &actionName, actionNames) { | 1099 | for (const QString &actionName : qAsConst(actionNames)) { | ||
1100 | Q_FOREACH (KActionCollection *ac, KActionCollection::allCollections()) { | 1100 | Q_FOREACH (KActionCollection *ac, KActionCollection::allCollections()) { | ||
1101 | QAction *newAction = ac->action(actionName); | 1101 | QAction *newAction = ac->action(actionName); | ||
1102 | if (newAction) { | 1102 | if (newAction) { | ||
1103 | d->actionsBeingDragged.append(newAction); | 1103 | d->actionsBeingDragged.append(newAction); | ||
1104 | break; | 1104 | break; | ||
1105 | } | 1105 | } | ||
1106 | } | 1106 | } | ||
1107 | } | 1107 | } | ||
▲ Show 20 Lines • Show All 303 Lines • Show Last 20 Lines |