Commit 59ddfa43 authored by Dan Leinir Turthra Jensen's avatar Dan Leinir Turthra Jensen 🌈

gemini: Make sure we sync the action shortcuts when they're changed

parent ac107822
......@@ -590,6 +590,7 @@ void MainWindow::setSketchKisView(QObject* newView)
{
d->sketchKisView = qobject_cast<KisView2*>(newView);
if(d->sketchKisView) {
d->sketchView->addActions(d->sketchKisView->actions());
d->sketchKisView->setQtMainWindow(this);
connect(d->sketchKisView, SIGNAL(sigLoadingFinished()), d->centerer, SLOT(start()));
connect(d->sketchKisView->canvasBase()->resourceManager(), SIGNAL(canvasResourceChanged(int, const QVariant&)),
......
......@@ -99,6 +99,8 @@ DesktopViewProxy::DesktopViewProxy(MainWindow* mainWindow, KoMainWindow* parent)
recent->loadEntries(KGlobal::config()->group("RecentFiles"));
connect(d->desktopView, SIGNAL(documentSaved()), this, SIGNAL(documentSaved()));
connect(d->desktopView, SIGNAL(keyBindingsChanged()), this, SLOT(updateKeyBindings()));
}
DesktopViewProxy::~DesktopViewProxy()
......@@ -221,4 +223,19 @@ void DesktopViewProxy::documentChanged()
connect(toggleJustTheCanvasAction, SIGNAL(toggled(bool)), this, SLOT(toggleShowJustTheCanvas(bool)));
}
void DesktopViewProxy::updateKeyBindings()
{
KisView2* view = qobject_cast<KisView2*>(d->mainWindow->sketchKisView());
foreach(QAction* action, d->desktopView->actions()) {
QAction* otherAction = view->action(action->objectName().toLatin1());
if(otherAction) {
otherAction->setShortcut(action->shortcut());
}
else {
// That's ok - there are some actions that are not truly actions and don't have shortcuts,
// so we'll just not bother with those, and we're fine with that :)
}
}
}
#include "desktopviewproxy.moc"
......@@ -48,6 +48,8 @@ public Q_SLOTS:
void toggleShowJustTheCanvas(bool toggled);
void updateKeyBindings();
Q_SIGNALS:
void documentSaved();
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment