[rkward-cvs] SF.net SVN: rkward:[2495] trunk/rkward
tfry at users.sourceforge.net
tfry at users.sourceforge.net
Wed May 20 17:03:16 UTC 2009
Revision: 2495
http://rkward.svn.sourceforge.net/rkward/?rev=2495&view=rev
Author: tfry
Date: 2009-05-20 17:03:16 +0000 (Wed, 20 May 2009)
Log Message:
-----------
Fix up all mdi windows, after shortcuts were changed.
Configurable keyboard shortcuts should work, now.
Modified Paths:
--------------
trunk/rkward/ChangeLog
trunk/rkward/rkward/windows/rkcommandeditorwindow.cpp
trunk/rkward/rkward/windows/rkcommandeditorwindow.h
trunk/rkward/rkward/windows/rkhtmlwindow.cpp
trunk/rkward/rkward/windows/rkhtmlwindow.h
trunk/rkward/rkward/windows/rkmdiwindow.cpp
trunk/rkward/rkward/windows/rkmdiwindow.h
trunk/rkward/rkward/windows/rktoplevelwindowgui.cpp
Modified: trunk/rkward/ChangeLog
===================================================================
--- trunk/rkward/ChangeLog 2009-05-20 16:17:32 UTC (rev 2494)
+++ trunk/rkward/ChangeLog 2009-05-20 17:03:16 UTC (rev 2495)
@@ -1,4 +1,4 @@
-- Make keyboard shorcuts configurable TODO: work in progress, this is still broken
+- Make keyboard shorcuts configurable
- Add option to add only single line commands from script editor to the console history
- Add action to change working directory to that of the current script file
- Fixed: No warning was shown, when an open script file was changed on disk, externally
Modified: trunk/rkward/rkward/windows/rkcommandeditorwindow.cpp
===================================================================
--- trunk/rkward/rkward/windows/rkcommandeditorwindow.cpp 2009-05-20 16:17:32 UTC (rev 2494)
+++ trunk/rkward/rkward/windows/rkcommandeditorwindow.cpp 2009-05-20 17:03:16 UTC (rev 2495)
@@ -94,13 +94,10 @@
setFocusProxy (m_view);
setFocusPolicy (Qt::StrongFocus);
- // strip down the khtmlpart's GUI. remove some stuff we definitely don't need.
- RKCommonFunctions::removeContainers (m_view, QString ("bookmarks,tools_spelling,tools_spelling_from_cursor,tools_spelling_selection,switch_to_cmd_line").split (','), true);
- RKCommonFunctions::moveContainer (m_view, "Menu", "tools", "edit", true);
-
RKCommandEditorWindowPart* part = new RKCommandEditorWindowPart (m_view);
part->insertChildClient (m_view);
setPart (part);
+ fixupPartGUI (false);
initializeActions (part->actionCollection ());
initializeActivationSignals ();
@@ -147,6 +144,16 @@
delete m_doc;
}
+void RKCommandEditorWindow::fixupPartGUI (bool reload) {
+ RK_TRACE (COMMANDEDITOR);
+
+ RKMDIWindow::fixupPartGUI (reload);
+
+ // strip down the katepart's GUI. remove some stuff we definitely don't need.
+ RKCommonFunctions::removeContainers (m_view, QString ("bookmarks,tools_spelling,tools_spelling_from_cursor,tools_spelling_selection,switch_to_cmd_line").split (','), true);
+ RKCommonFunctions::moveContainer (m_view, "Menu", "tools", "edit", true);
+}
+
void RKCommandEditorWindow::initializeActions (KActionCollection* ac) {
RK_TRACE (COMMANDEDITOR);
Modified: trunk/rkward/rkward/windows/rkcommandeditorwindow.h
===================================================================
--- trunk/rkward/rkward/windows/rkcommandeditorwindow.h 2009-05-20 16:17:32 UTC (rev 2494)
+++ trunk/rkward/rkward/windows/rkcommandeditorwindow.h 2009-05-20 17:03:16 UTC (rev 2495)
@@ -158,6 +158,8 @@
bool provideContext (unsigned int line_rev, QString *context, int *cursor_position);
QString currentCompletionWord () const;
+/** reimplemented from RKMDIWindow */
+ void fixupPartGUI (bool reload);
public slots:
/** update Tab caption according to the current url. Display the filename-component of the URL, or - if not available - a more elaborate description of the url. Also appends a "[modified]" if appropriate */
void updateCaption (KTextEditor::Document* = 0);
Modified: trunk/rkward/rkward/windows/rkhtmlwindow.cpp
===================================================================
--- trunk/rkward/rkward/windows/rkhtmlwindow.cpp 2009-05-20 16:17:32 UTC (rev 2494)
+++ trunk/rkward/rkward/windows/rkhtmlwindow.cpp 2009-05-20 17:03:16 UTC (rev 2495)
@@ -58,6 +58,7 @@
khtmlpart = new KHTMLPart (this, 0, KHTMLPart::BrowserViewGUI);
setPart (khtmlpart);
+ fixupPartGUI (false);
initializeActivationSignals ();
khtmlpart->setSelectable (true);
setFocusProxy (khtmlpart->widget ());
@@ -67,9 +68,6 @@
pLayout->setContentsMargins (0, 0, 0, 0);
pLayout->addWidget (khtmlpart->widget ());
- // strip down the khtmlpart's GUI. remove some stuff we definitely don't need.
- RKCommonFunctions::removeContainers (khtmlpart, QString ("tools,security,extraToolBar,saveBackground,saveFrame,printFrame,kget_menu").split (','), true);
-
// We have to connect this in order to allow browsing.
connect (khtmlpart->browserExtension (), SIGNAL (openUrlRequestDelayed (const KUrl&, const KParts::OpenUrlArguments&, const KParts::BrowserArguments&)), this, SLOT (slotOpenUrl (const KUrl&, const KParts::OpenUrlArguments&, const KParts::BrowserArguments&)));
connect (khtmlpart, SIGNAL (completed ()), this, SLOT (loadDone ()));
@@ -93,6 +91,15 @@
delete khtmlpart;
}
+void RKHTMLWindow::fixupPartGUI (bool reload) {
+ RK_TRACE (APP);
+
+ RKMDIWindow::fixupPartGUI (reload);
+
+ // strip down the khtmlpart's GUI. remove some stuff we definitely don't need.
+ RKCommonFunctions::removeContainers (khtmlpart, QString ("tools,security,extraToolBar,saveBackground,saveFrame,printFrame,kget_menu").split (','), true);
+}
+
// static
void RKHTMLWindow::initializeOutputWindow () {
RK_TRACE (APP);
Modified: trunk/rkward/rkward/windows/rkhtmlwindow.h
===================================================================
--- trunk/rkward/rkward/windows/rkhtmlwindow.h 2009-05-20 16:17:32 UTC (rev 2494)
+++ trunk/rkward/rkward/windows/rkhtmlwindow.h 2009-05-20 17:03:16 UTC (rev 2495)
@@ -75,6 +75,8 @@
@param show Show the window, if not currently shown (this actually means: it is created if not currently existant)
@param raise Raise the window (if currently shown, or show==true) */
static RKHTMLWindow* refreshOutput (bool show, bool raise, bool only_if_modified);
+/** reimplemented from RKMDIWindow */
+ void fixupPartGUI (bool reload);
public slots:
/** this is used for browsing only. Use openURL instead, when calling from outside. */
void slotOpenUrl (const KUrl & url, const KParts::OpenUrlArguments &, const KParts::BrowserArguments &);
Modified: trunk/rkward/rkward/windows/rkmdiwindow.cpp
===================================================================
--- trunk/rkward/rkward/windows/rkmdiwindow.cpp 2009-05-20 16:17:32 UTC (rev 2494)
+++ trunk/rkward/rkward/windows/rkmdiwindow.cpp 2009-05-20 17:03:16 UTC (rev 2495)
@@ -81,6 +81,20 @@
return standard_client->actionCollection ();
}
+void RKMDIWindow::fixupPartGUI (bool reload) {
+ RK_TRACE (APP);
+ RK_ASSERT (part);
+
+ if (reload) {
+ // needed esp. to apply changed shortcut settings
+ part->reloadXML ();
+ foreach (KXMLGUIClient *client, part->childClients ()) {
+ // no further recursion needed in our case
+ client->reloadXML ();
+ }
+ }
+}
+
//virtual
QString RKMDIWindow::fullCaption () {
RK_TRACE (APP);
Modified: trunk/rkward/rkward/windows/rkmdiwindow.h
===================================================================
--- trunk/rkward/rkward/windows/rkmdiwindow.h 2009-05-20 16:17:32 UTC (rev 2494)
+++ trunk/rkward/rkward/windows/rkmdiwindow.h 2009-05-20 17:03:16 UTC (rev 2495)
@@ -103,8 +103,11 @@
bool acceptsEventsFor (QObject *object);
/** Whether the window is active. This seems to be more reliable than hasFocus () */
bool isActive ();
-
+/** Returns a pointer to an action collection suitable to place RKStandardAction in. This collection (and the corresponding KXMLGUIClient) is created on the fly. */
KActionCollection *standardActionCollection ();
+/** Used to update the part gui after some aspects of it have changed (most importantly, after keyboard shortcuts were changed). This also takes care of updating the child clients. Reimplemented
+in some classes to re-apply customizations of the part GUI. */
+ virtual void fixupPartGUI (bool reload);
signals:
/** This signal is emitted, whenever the window caption was changed.
@param RKMDIWindow* a pointer to this window */
Modified: trunk/rkward/rkward/windows/rktoplevelwindowgui.cpp
===================================================================
--- trunk/rkward/rkward/windows/rktoplevelwindowgui.cpp 2009-05-20 16:17:32 UTC (rev 2494)
+++ trunk/rkward/rkward/windows/rktoplevelwindowgui.cpp 2009-05-20 17:03:16 UTC (rev 2495)
@@ -114,32 +114,14 @@
KMessageBox::information (for_window, i18n ("For technical reasons, the following dialog allows you to configure the keyboard shortcuts only for those parts of RKWard that are currently active.\n\nTherefore, if you want to configure keyboard shortcuts e.g. for use inside the script editor, you need to open a script editor window, and activate it."), i18n ("Note"), "configure_shortcuts_kparts");
-#warning TODO: improve this mess
- KShortcutsDialog dlg (KShortcutsEditor::AllActions, KShortcutsEditor::LetterShortcutsAllowed, qobject_cast<QWidget*> (parent()));
- foreach (KXMLGUIClient *client, factory ()->clients ()) {
- if (client && !client->xmlFile ().isEmpty ()) dlg.addCollection (client->actionCollection());
- }
- dlg.configure (true);
+ factory ()->configureShortcuts ();
- // WORKAROUND:
- // KXML forgets to reload the child clients as well
- // TODO: perhaps reimplement setXMLFile where needed, instead?
- // TODO: Also we need to iterate over all existing mdi windows, even if they are not in the factory at this moment
- foreach (KXMLGUIClient *client, factory ()->clients ()) {
- foreach (KXMLGUIClient *clientc, client->childClients ()) {
- // no need for deeper nesting in our usecase
- clientc->reloadXML ();
- }
- client->reloadXML ();
+ // we need to update all MDI windows, even if they are not currently in the factory.
+ // (they may share some or all shortcuts of the currently active window)
+ QList<RKMDIWindow*> list = RKWorkplace::mainWorkplace ()->getObjectList ();
+ for (int i = 0; i < list.count (); ++i) {
+ list[i]->fixupPartGUI (true);
}
- // TODO: the above causes havoc when we called RKCommonFunctions::(re)moveContainer, previously
-
-/* KConfig *config = KGlobal::config ().data ();
- KConfigGroup cg = config->group ("cuts");
- foreach (KActionCollection *ac, dlg.actionCollections ()) {
- ac->writeSettings (&cg);
- }
- config->sync (); */
}
void RKTopLevelWindowGUI::invokeRHelp () {
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
More information about the rkward-tracker
mailing list