Changeset View
Changeset View
Standalone View
Standalone View
libs/widgetutils/kis_action_registry.cpp
Show First 20 Lines • Show All 139 Lines • ▼ Show 20 Line(s) | |||||
140 | 140 | | |||
141 | void KisActionRegistry::addAction(QString name, QAction *a, QString category) | 141 | void KisActionRegistry::addAction(QString name, QAction *a, QString category) | ||
142 | { | 142 | { | ||
143 | KActionCollection *ac; | 143 | KActionCollection *ac; | ||
144 | if (d->actionCollections.contains(category)) { | 144 | if (d->actionCollections.contains(category)) { | ||
145 | ac = d->actionCollections.value(category); | 145 | ac = d->actionCollections.value(category); | ||
146 | } else { | 146 | } else { | ||
147 | ac = new KActionCollection(this, category); | 147 | ac = new KActionCollection(this, category); | ||
148 | d->actionCollections.insert("Krita", ac); | 148 | d->actionCollections.insert(category, ac); | ||
149 | dbgAction << "Adding a new KActionCollection - " << category; | 149 | dbgAction << "Adding a new KActionCollection - " << category; | ||
150 | } | 150 | } | ||
151 | 151 | | |||
152 | if (!ac->action(name)) { | 152 | if (!ac->action(name)) { | ||
153 | ac->addAction(name, a); | 153 | ac->addAction(name, a); | ||
154 | } | 154 | } | ||
155 | else { | 155 | else { | ||
156 | dbgAction << "duplicate action" << name << a << "in collection" << ac->componentName(); | 156 | dbgAction << "duplicate action" << name << a << "in collection" << ac->componentName(); | ||
Show All 21 Lines | |||||
178 | }; | 178 | }; | ||
179 | 179 | | |||
180 | 180 | | |||
181 | void KisActionRegistry::configureShortcuts(KActionCollection *ac) | 181 | void KisActionRegistry::configureShortcuts(KActionCollection *ac) | ||
182 | { | 182 | { | ||
183 | 183 | | |||
184 | KisShortcutsDialog dlg; | 184 | KisShortcutsDialog dlg; | ||
185 | dlg.addCollection(ac); | 185 | dlg.addCollection(ac); | ||
186 | foreach (auto collection, d->actionCollections) { | 186 | for (auto i = d->actionCollections.constBegin(); i != d->actionCollections.constEnd(); i++ ) { | ||
187 | dlg.addCollection(collection); | 187 | dlg.addCollection(i.value(), i.key()); | ||
188 | } | 188 | } | ||
189 | 189 | | |||
190 | dlg.configure(); // Show the dialog. | 190 | dlg.configure(); // Show the dialog. | ||
191 | } | 191 | } | ||
192 | 192 | | |||
193 | 193 | | |||
194 | 194 | | |||
195 | bool KisActionRegistry::propertizeAction(QAction * a, QString name) { | 195 | bool KisActionRegistry::propertizeAction(QAction * a, QString name) { | ||
▲ Show 20 Lines • Show All 134 Lines • Show Last 20 Lines |