Changeset View
Changeset View
Standalone View
Standalone View
src/kshortcutseditor.cpp
Show First 20 Lines • Show All 127 Lines • ▼ Show 20 Line(s) | 103 | { | |||
---|---|---|---|---|---|
128 | 128 | | |||
129 | // Set to remember which actions we have seen. | 129 | // Set to remember which actions we have seen. | ||
130 | QSet<QAction *> actionsSeen; | 130 | QSet<QAction *> actionsSeen; | ||
131 | 131 | | |||
132 | // Add all categories in their own subtree below the collections root node | 132 | // Add all categories in their own subtree below the collections root node | ||
133 | const QList<KActionCategory *> categories = collection->findChildren<KActionCategory *>(); | 133 | const QList<KActionCategory *> categories = collection->findChildren<KActionCategory *>(); | ||
134 | for (KActionCategory *category : categories) { | 134 | for (KActionCategory *category : categories) { | ||
135 | hier[KShortcutsEditorPrivate::Action] = d->findOrMakeItem(hier[KShortcutsEditorPrivate::Program], category->text()); | 135 | hier[KShortcutsEditorPrivate::Action] = d->findOrMakeItem(hier[KShortcutsEditorPrivate::Program], category->text()); | ||
136 | foreach (QAction *action, category->actions()) { | 136 | const auto categoryActions = category->actions(); | ||
137 | for (QAction *action : categoryActions) { | ||||
137 | // Set a marker that we have seen this action | 138 | // Set a marker that we have seen this action | ||
138 | actionsSeen.insert(action); | 139 | actionsSeen.insert(action); | ||
139 | d->addAction(action, hier, KShortcutsEditorPrivate::Action); | 140 | d->addAction(action, hier, KShortcutsEditorPrivate::Action); | ||
140 | } | 141 | } | ||
141 | } | 142 | } | ||
142 | 143 | | |||
143 | // The rest of the shortcuts is added as a direct shild of the action | 144 | // The rest of the shortcuts is added as a direct shild of the action | ||
144 | // collections root node | 145 | // collections root node | ||
145 | foreach (QAction *action, collection->actions()) { | 146 | const auto collectionActions = collection->actions(); | ||
147 | for (QAction *action : collectionActions) { | ||||
146 | if (actionsSeen.contains(action)) { | 148 | if (actionsSeen.contains(action)) { | ||
147 | continue; | 149 | continue; | ||
148 | } | 150 | } | ||
149 | 151 | | |||
150 | d->addAction(action, hier, KShortcutsEditorPrivate::Program); | 152 | d->addAction(action, hier, KShortcutsEditorPrivate::Program); | ||
151 | } | 153 | } | ||
152 | 154 | | |||
153 | // sort the list | 155 | // sort the list | ||
▲ Show 20 Lines • Show All 643 Lines • Show Last 20 Lines |