Changeset View
Changeset View
Standalone View
Standalone View
src/kkeysequencewidget.cpp
Show First 20 Lines • Show All 383 Lines • ▼ Show 20 Line(s) | 383 | { | |||
---|---|---|---|---|---|
384 | setKeySequence(QKeySequence()); | 384 | setKeySequence(QKeySequence()); | ||
385 | } | 385 | } | ||
386 | 386 | | |||
387 | //slot | 387 | //slot | ||
388 | void KKeySequenceWidget::applyStealShortcut() | 388 | void KKeySequenceWidget::applyStealShortcut() | ||
389 | { | 389 | { | ||
390 | QSet<KActionCollection *> changedCollections; | 390 | QSet<KActionCollection *> changedCollections; | ||
391 | 391 | | |||
392 | Q_FOREACH (QAction *stealAction, d->stealActions) { | 392 | for (QAction *stealAction : qAsConst(d->stealActions)) { | ||
393 | 393 | | |||
394 | // Stealing a shortcut means setting it to an empty one. | 394 | // Stealing a shortcut means setting it to an empty one. | ||
395 | stealAction->setShortcuts(QList<QKeySequence>()); | 395 | stealAction->setShortcuts(QList<QKeySequence>()); | ||
396 | 396 | | |||
397 | // The following code will find the action we are about to | 397 | // The following code will find the action we are about to | ||
398 | // steal from and save it's actioncollection. | 398 | // steal from and save it's actioncollection. | ||
399 | KActionCollection *parentCollection = nullptr; | 399 | KActionCollection *parentCollection = nullptr; | ||
400 | foreach (KActionCollection *collection, d->checkActionCollections) { | 400 | for (KActionCollection *collection : qAsConst(d->checkActionCollections)) { | ||
401 | if (collection->actions().contains(stealAction)) { | 401 | if (collection->actions().contains(stealAction)) { | ||
402 | parentCollection = collection; | 402 | parentCollection = collection; | ||
403 | break; | 403 | break; | ||
404 | } | 404 | } | ||
405 | } | 405 | } | ||
406 | 406 | | |||
407 | // Remember the changed collection | 407 | // Remember the changed collection | ||
408 | if (parentCollection) { | 408 | if (parentCollection) { | ||
▲ Show 20 Lines • Show All 130 Lines • ▼ Show 20 Line(s) | 533 | { | |||
539 | // checkActionCollections list. Add all the actions to a single list to | 539 | // checkActionCollections list. Add all the actions to a single list to | ||
540 | // be able to process them in a single loop below. | 540 | // be able to process them in a single loop below. | ||
541 | // Note that this can't be done in setCheckActionCollections(), because we | 541 | // Note that this can't be done in setCheckActionCollections(), because we | ||
542 | // keep pointers to the action collections, and between the call to | 542 | // keep pointers to the action collections, and between the call to | ||
543 | // setCheckActionCollections() and this function some actions might already be | 543 | // setCheckActionCollections() and this function some actions might already be | ||
544 | // removed from the collection again. | 544 | // removed from the collection again. | ||
545 | QList<QAction *> allActions; | 545 | QList<QAction *> allActions; | ||
546 | allActions += checkList; | 546 | allActions += checkList; | ||
547 | foreach (KActionCollection *collection, checkActionCollections) { | 547 | for (KActionCollection *collection : qAsConst(checkActionCollections)) { | ||
548 | allActions += collection->actions(); | 548 | allActions += collection->actions(); | ||
549 | } | 549 | } | ||
550 | 550 | | |||
551 | // Because of multikey shortcuts we can have clashes with many shortcuts. | 551 | // Because of multikey shortcuts we can have clashes with many shortcuts. | ||
552 | // | 552 | // | ||
553 | // Example 1: | 553 | // Example 1: | ||
554 | // | 554 | // | ||
555 | // Application currently uses 'CTRL-X,a', 'CTRL-X,f' and 'CTRL-X,CTRL-F' | 555 | // Application currently uses 'CTRL-X,a', 'CTRL-X,f' and 'CTRL-X,CTRL-F' | ||
▲ Show 20 Lines • Show All 305 Lines • Show Last 20 Lines |