summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJekyll Wu <adaptee@gmail.com>2012-03-01 00:58:14 (GMT)
committerJekyll Wu <adaptee@gmail.com>2012-03-01 00:58:37 (GMT)
commit08de49da1cf4c89c375d7eea267bce3b46c05527 (patch)
tree28b31118129d389b0b084527f1225aab4b71c462
parent66a2c5e7822417c2cfbfd6fcda060f1a67d72b50 (diff)
konsolepart should not expose actions only meaningful to Konsole
Note: some actions, such as enlarging/shrinking font and setting encoding, might actually be also useful in konsolepart. But since konsolepart currently always use the default shortcut, the general idea now is to expose actions as few as possible in konsolepart. BUG: 248469 FIXED-IN: 4.9.0 REVIEW: 104034 CCMAIL: hein@kde.org
-rw-r--r--src/SessionController.cpp75
-rw-r--r--src/SessionController.h3
2 files changed, 45 insertions, 33 deletions
diff --git a/src/SessionController.cpp b/src/SessionController.cpp
index d109690..0b6b0cb 100644
--- a/src/SessionController.cpp
+++ b/src/SessionController.cpp
@@ -88,6 +88,7 @@ SessionController::SessionController(Session* session , TerminalDisplay* view, Q
, _previousState(-1)
, _viewUrlFilter(0)
, _searchFilter(0)
+ , _copyToAllTabsAction(0)
, _searchToggleAction(0)
, _findNextAction(0)
, _findPreviousAction(0)
@@ -103,12 +104,15 @@ SessionController::SessionController(Session* session , TerminalDisplay* view, Q
Q_ASSERT(view);
// handle user interface related to session (menus etc.)
- if (isKonsolePart())
+ if (isKonsolePart()) {
setXMLFile("konsole/partui.rc");
- else
+ setupCommonActions();
+ } else {
setXMLFile("konsole/sessionui.rc");
+ setupCommonActions();
+ setupExtraActions();
+ }
- setupActions();
actionCollection()->addAssociatedWidget(view);
foreach(QAction * action, actionCollection()->actions()) {
action->setShortcutContext(Qt::WidgetWithChildrenShortcut);
@@ -350,7 +354,7 @@ bool SessionController::eventFilter(QObject* watched , QEvent* event)
connect(_session, SIGNAL(bellRequest(QString)),
_view, SLOT(bell(QString)));
- if (_copyToAllTabsAction->isChecked()) {
+ if(_copyToAllTabsAction && _copyToAllTabsAction->isChecked()) {
// A session with "Copy To All Tabs" has come into focus:
// Ensure that newly created sessions are included in _copyToGroup!
copyInputToAllTabs();
@@ -429,10 +433,10 @@ void SessionController::setShowMenuAction(QAction* action)
actionCollection()->addAction("show-menubar", action);
}
-void SessionController::setupActions()
+
+void SessionController::setupCommonActions()
{
KAction* action = 0;
- KToggleAction* toggleAction = 0;
KActionCollection* collection = actionCollection();
// Close Session
@@ -468,6 +472,39 @@ void SessionController::setupActions()
// TODO: this shortcut conflict with the 'close-active-view' action
//action->setShortcut(QKeySequence(Qt::CTRL + Qt::SHIFT + Qt::Key_S));
+ action = KStandardAction::saveAs(this, SLOT(saveHistory()), collection);
+ action->setText(i18n("Save Output &As..."));
+
+ action = collection->addAction("adjust-history", this, SLOT(showHistoryOptions()));
+ action->setText(i18n("Adjust Scrollback..."));
+ action->setIcon(KIcon("configure"));
+
+ action = collection->addAction("clear-history", this, SLOT(clearHistory()));
+ action->setText(i18n("Clear Scrollback"));
+ action->setIcon(KIcon("edit-clear-history"));
+
+ action = collection->addAction("clear-history-and-reset", this, SLOT(clearHistoryAndReset()));
+ action->setText(i18n("Clear Scrollback and Reset"));
+ action->setIcon(KIcon("edit-clear-history"));
+ action->setShortcut(QKeySequence(Qt::CTRL + Qt::SHIFT + Qt::Key_X));
+
+ // Profile Options
+ action = collection->addAction("edit-current-profile", this, SLOT(editCurrentProfile()));
+ action->setText(i18n("Configure Current Profile..."));
+ action->setIcon(KIcon("document-properties") );
+
+ _switchProfileMenu = new KActionMenu(i18n("Switch Profile"), _view);
+ collection->addAction("switch-profile", _switchProfileMenu);
+ connect(_switchProfileMenu->menu(), SIGNAL(aboutToShow()), this, SLOT(prepareSwitchProfileMenu()));
+
+}
+
+void SessionController::setupExtraActions()
+{
+ KAction* action = 0;
+ KToggleAction* toggleAction = 0;
+ KActionCollection* collection = actionCollection();
+
// Rename Session
action = collection->addAction("rename-session", this, SLOT(renameSession()));
action->setText(i18n("&Rename Tab..."));
@@ -541,32 +578,6 @@ void SessionController::setupActions()
_findPreviousAction = KStandardAction::findPrev(this, SLOT(findPreviousInHistory()), collection);
_findPreviousAction->setShortcut(QKeySequence(Qt::SHIFT + Qt::Key_F3));
_findPreviousAction->setEnabled(false);
-
- action = KStandardAction::saveAs(this, SLOT(saveHistory()), collection);
- action->setText(i18n("Save Output &As..."));
-
- action = collection->addAction("adjust-history", this, SLOT(showHistoryOptions()));
- action->setText(i18n("Adjust Scrollback..."));
- // TODO: find a suitable icon which matches this action and not misleading
- action->setIcon(KIcon("configure"));
-
- action = collection->addAction("clear-history", this, SLOT(clearHistory()));
- action->setText(i18n("Clear Scrollback"));
- action->setIcon(KIcon("edit-clear-history"));
-
- action = collection->addAction("clear-history-and-reset", this, SLOT(clearHistoryAndReset()));
- action->setText(i18n("Clear Scrollback and Reset"));
- action->setIcon(KIcon("edit-clear-history"));
- action->setShortcut(QKeySequence(Qt::CTRL + Qt::SHIFT + Qt::Key_K));
-
- // Profile Options
- action = collection->addAction("edit-current-profile", this, SLOT(editCurrentProfile()));
- action->setText(i18n("Edit Current Profile..."));
- action->setIcon(KIcon("document-properties"));
-
- _switchProfileMenu = new KActionMenu(i18n("Switch Profile"), _view);
- collection->addAction("switch-profile", _switchProfileMenu);
- connect(_switchProfileMenu->menu(), SIGNAL(aboutToShow()), this, SLOT(prepareSwitchProfileMenu()));
}
void SessionController::switchProfile(Profile::Ptr profile)
diff --git a/src/SessionController.h b/src/SessionController.h
index 7de6b20..46714c0 100644
--- a/src/SessionController.h
+++ b/src/SessionController.h
@@ -259,7 +259,8 @@ private:
// direction - value from SearchHistoryTask::SearchDirection enum to specify
// the search direction
void beginSearch(const QString& text , int direction);
- void setupActions();
+ void setupCommonActions();
+ void setupExtraActions();
void removeSearchFilter(); // remove and delete the current search filter if set
void setFindNextPrevEnabled(bool enabled);
void listenForScreenWindowUpdates();