[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: [kdevplatform] 8a2ab12: Propagate shortcuts setting to all the opened
From: Mantia Andras <amantia () kde ! org>
Date: 2010-07-07 17:36:06
Message-ID: 201007071736.o67Ha6jd009775 () kore ! kollide ! net
[Download RAW message or body]
commit 8a2ab12875f3030a8f0551b13635acd082dc3228
Author: Mantia Andras <amantia@kde.org>
Date: Wed Jul 7 11:29:16 2010 +0300
Propagate shortcuts setting to all the opened editor views.
diff --git a/shell/mainwindow.cpp b/shell/mainwindow.cpp
index f7c50b3..6d0369e 100644
--- a/shell/mainwindow.cpp
+++ b/shell/mainwindow.cpp
@@ -37,7 +37,9 @@ Boston, MA 02110-1301, USA.
#include <ktemporaryfile.h>
#include <kactioncollection.h>
#include <kdebug.h>
+#include <ktexteditor/document.h>
#include <ktexteditor/view.h>
+#include <kshortcutsdialog.h>
#include <kxmlguifactory.h>
#include <ktoggleaction.h>
@@ -219,7 +221,21 @@ void MainWindow::configureShortcuts()
{
///Workaround for a problem with the actions: Always start the \
shortcut-configuration in the first mainwindow, then propagate the updated \
///settings into the other windows
- Core::self()->uiControllerInternal()->mainWindows()[0]->guiFactory()->configureShortcuts();
+
+
+// We need to bring up the shortcut dialog ourself instead of
+// Core::self()->uiControllerInternal()->mainWindows()[0]->guiFactory()->configureShortcuts();
+// so we can connect to the saved() signal to propagate changes in the editor \
shortcuts +
+ KShortcutsDialog dlg(KShortcutsEditor::AllActions, \
KShortcutsEditor::LetterShortcutsAllowed, this); + foreach (KXMLGUIClient *client, \
Core::self()->uiControllerInternal()->mainWindows()[0]->guiFactory()->clients()) + \
{ + if(client && !client->xmlFile().isEmpty())
+ dlg.addCollection( client->actionCollection() );
+ }
+
+ connect(&dlg, SIGNAL(saved()), SLOT(shortcutsChanged()));
+ dlg.configure(true);
QMap<QString, QKeySequence> shortcuts;
foreach(KXMLGUIClient* client, \
Core::self()->uiControllerInternal()->mainWindows()[0]->guiFactory()->clients()) { @@ \
-240,8 +256,29 @@ void MainWindow::configureShortcuts() }
}
}
+
}
+void MainWindow::shortcutsChanged()
+{
+ //propagate shortcut changes to all the opened text documents by reloading the \
UI XML file + KTextEditor::Document *activeDocument = \
Core::self()->documentController()->activeDocument()->textDocument(); + if \
(activeDocument) { +
+ KTextEditor::View *activeClient = activeDocument->activeView();
+
+ foreach(IDocument * doc, \
Core::self()->documentController()->openDocuments()) { + \
KTextEditor::Document *textDocument = doc->textDocument(); + \
foreach(KTextEditor::View *client, textDocument->views()) { + if \
(client != activeClient) { + client->reloadXML();
+ }
+ }
+ }
+ }
+}
+
+
void MainWindow::initialize()
{
KStandardAction::keyBindings(this, SLOT(configureShortcuts()), \
actionCollection());
diff --git a/shell/mainwindow.h b/shell/mainwindow.h
index e8c18df..584f289 100644
--- a/shell/mainwindow.h
+++ b/shell/mainwindow.h
@@ -97,6 +97,7 @@ protected Q_SLOTS:
private Q_SLOTS:
void updateCaption();
+ void shortcutsChanged();
private:
class MainWindowPrivate *d;
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic