From 39a84903dfd5e5e8fc6689226c3b7484e2c4345b Mon Sep 17 00:00:00 2001 From: Robert Knight Date: Fri, 25 Jul 2008 15:05:05 +0000 Subject: [PATCH] Fix tab-specific actions (eg. Copy, Paste) not appearing in Configure Shortcuts dialog. Add action collection for current controller to dialog before showing and reload UI for other controllers after the dialog is accepted. There is a known bug at the moment where changing a shortcut from a custom value to the default shortcut only updates the current tab and tabs created after the change. This is a kdelibs issue being looked into. BUG: 161021 BACKPORT: 4.1 svn path=/trunk/KDE/kdebase/apps/konsole/; revision=837726 --- src/MainWindow.cpp | 17 +++++++++++++++-- src/SessionController.cpp | 5 +++++ src/SessionController.h | 11 +++++++---- 3 files changed, 27 insertions(+), 6 deletions(-) diff --git a/src/MainWindow.cpp b/src/MainWindow.cpp index a3d959f43..00ae5513d 100644 --- a/src/MainWindow.cpp +++ b/src/MainWindow.cpp @@ -375,8 +375,21 @@ bool MainWindow::queryClose() void MainWindow::showShortcutsDialog() { - KShortcutsDialog::configure( actionCollection() , - KShortcutsEditor::LetterShortcutsDisallowed, this ); + KShortcutsDialog dialog(KShortcutsEditor::AllActions, KShortcutsEditor::LetterShortcutsDisallowed, this); + + // add actions from this window and the current session controller + foreach(KXMLGUIClient* client, guiFactory()->clients()) + dialog.addCollection(client->actionCollection()); + + if (dialog.configure()) + { + // reload session actions (defined in "sessionui.rc") in other session controllers + foreach(SessionController* controller, SessionController::allControllers()) + { + if (controller != _pluggedController) + controller->reloadXML(); + } + } } void MainWindow::newFromProfile(Profile::Ptr profile) diff --git a/src/SessionController.cpp b/src/SessionController.cpp index c37af7a53..bd8b6fd5f 100644 --- a/src/SessionController.cpp +++ b/src/SessionController.cpp @@ -67,6 +67,7 @@ using namespace Konsole; KIcon SessionController::_activityIcon; KIcon SessionController::_silenceIcon; +QSet SessionController::_allControllers; QPointer SearchHistoryTask::_thread; int SessionController::_lastControllerId; @@ -89,6 +90,8 @@ SessionController::SessionController(Session* session , TerminalDisplay* view, Q , _listenForScreenWindowUpdates(false) , _preventClose(false) { + _allControllers.insert(this); + Q_ASSERT( session ); Q_ASSERT( view ); @@ -170,6 +173,8 @@ SessionController::~SessionController() { if ( _view ) _view->setScreenWindow(0); + + _allControllers.remove(this); } void SessionController::trackOutput(QKeyEvent* event) { diff --git a/src/SessionController.h b/src/SessionController.h index 23e4bcc05..9f9c015b8 100644 --- a/src/SessionController.h +++ b/src/SessionController.h @@ -91,7 +91,6 @@ public: */ SessionController(Session* session , TerminalDisplay* view, QObject* parent); ~SessionController(); - /** Returns the session associated with this controller */ QPointer session() { return _session; } @@ -134,6 +133,10 @@ public: // Reimplemented to watch for events happening to the view virtual bool eventFilter(QObject* watched , QEvent* event); + /** Returns the set of all controllers that exist. */ + static QSet allControllers() + { return _allControllers; } + signals: /** * Emitted when the view associated with the controller is focused. @@ -225,9 +228,6 @@ private: void listenForScreenWindowUpdates(); private: - static KIcon _activityIcon; - static KIcon _silenceIcon; - QPointer _session; QPointer _view; SessionGroup* _copyToGroup; @@ -257,7 +257,10 @@ private: bool _listenForScreenWindowUpdates; bool _preventClose; + static QSet _allControllers; static int _lastControllerId; + static KIcon _activityIcon; + static KIcon _silenceIcon; }; inline bool SessionController::isValid() const {