Changeset View
Changeset View
Standalone View
Standalone View
src/kshortcutschemeshelper.cpp
Show First 20 Lines • Show All 51 Lines • ▼ Show 20 Line(s) | 38 | { | |||
---|---|---|---|---|---|
52 | QMap<QString, KActionCollection *> collectionsByClientName; | 52 | QMap<QString, KActionCollection *> collectionsByClientName; | ||
53 | foreach (KActionCollection *coll, collections) { | 53 | foreach (KActionCollection *coll, collections) { | ||
54 | const KXMLGUIClient *client = coll->parentGUIClient(); | 54 | const KXMLGUIClient *client = coll->parentGUIClient(); | ||
55 | if (client) { | 55 | if (client) { | ||
56 | const QString key = saveToApplicationFile ? QCoreApplication::applicationName() : client->componentName(); | 56 | const QString key = saveToApplicationFile ? QCoreApplication::applicationName() : client->componentName(); | ||
57 | collectionsByClientName.insertMulti(key, coll); | 57 | collectionsByClientName.insertMulti(key, coll); | ||
58 | } | 58 | } | ||
59 | } | 59 | } | ||
60 | foreach (const QString &componentName, collectionsByClientName.uniqueKeys()) { | 60 | const auto componentNames = collectionsByClientName.uniqueKeys(); | ||
61 | for (const QString &componentName : componentNames) { | ||||
61 | 62 | | |||
62 | qCDebug(DEBUG_KXMLGUI) << "Considering component" << componentName; | 63 | qCDebug(DEBUG_KXMLGUI) << "Considering component" << componentName; | ||
63 | QDomDocument doc; | 64 | QDomDocument doc; | ||
64 | QDomElement docElem = doc.createElement(QStringLiteral("gui")); | 65 | QDomElement docElem = doc.createElement(QStringLiteral("gui")); | ||
65 | docElem.setAttribute(QStringLiteral("version"), QStringLiteral("1")); | 66 | docElem.setAttribute(QStringLiteral("version"), QStringLiteral("1")); | ||
66 | docElem.setAttribute(QStringLiteral("name"), componentName); | 67 | docElem.setAttribute(QStringLiteral("name"), componentName); | ||
67 | doc.appendChild(docElem); | 68 | doc.appendChild(docElem); | ||
68 | QDomElement elem = doc.createElement(QStringLiteral("ActionProperties")); | 69 | QDomElement elem = doc.createElement(QStringLiteral("ActionProperties")); | ||
69 | docElem.appendChild(elem); | 70 | docElem.appendChild(elem); | ||
70 | 71 | | |||
71 | foreach (KActionCollection *collection, collectionsByClientName.values(componentName)) { | 72 | const auto componentCollections = collectionsByClientName.values(componentName); | ||
73 | for (KActionCollection *collection : componentCollections) { | ||||
72 | qCDebug(DEBUG_KXMLGUI) << "Saving shortcut scheme for action collection with" << collection->actions().count() << "actions"; | 74 | qCDebug(DEBUG_KXMLGUI) << "Saving shortcut scheme for action collection with" << collection->actions().count() << "actions"; | ||
73 | 75 | | |||
74 | foreach (QAction *action, collection->actions()) { | 76 | const auto collectionActions = collection->actions(); | ||
77 | for (QAction *action : collectionActions) { | ||||
75 | if (!action) { | 78 | if (!action) { | ||
76 | continue; | 79 | continue; | ||
77 | } | 80 | } | ||
78 | 81 | | |||
79 | const QString actionName = action->objectName(); | 82 | const QString actionName = action->objectName(); | ||
80 | const QString shortcut = QKeySequence::listToString(action->shortcuts()); | 83 | const QString shortcut = QKeySequence::listToString(action->shortcuts()); | ||
81 | //qCDebug(DEBUG_KXMLGUI) << "action" << actionName << "has shortcut" << shortcut; | 84 | //qCDebug(DEBUG_KXMLGUI) << "action" << actionName << "has shortcut" << shortcut; | ||
82 | if (!shortcut.isEmpty()) { | 85 | if (!shortcut.isEmpty()) { | ||
▲ Show 20 Lines • Show All 60 Lines • Show Last 20 Lines |