add action to disable/enable mouse tracking

wilder
Martin T. H. Sandsmark 6 years ago committed by Tomaz Canabrava
parent 3d64132545
commit fb35320cdc
  1. 4
      desktop/partui.rc
  2. 5
      desktop/sessionui.rc
  3. 19
      src/session/SessionController.cpp
  4. 1
      src/session/SessionController.h

@ -1,7 +1,7 @@
<?xml version="1.0"?>
<!DOCTYPE gui SYSTEM "kpartgui.dtd">
<gui name="konsolepart" version="13" translationDomain="konsole">
<gui name="konsolepart" version="14" translationDomain="konsole">
<Menu name="session-popup-menu">
<Action name="edit_copy_contextmenu"/>
<Action name="edit_paste"/>
@ -21,6 +21,8 @@
</Menu>
<Separator/>
<Action name="view-readonly" />
<Action name="allow-mouse-tracking" />
<Separator/>
<Action name="switch-profile"/>
<Action name="edit-current-profile"/>
<Action name="manage-profiles"/>

@ -1,7 +1,7 @@
<?xml version="1.0"?>
<!DOCTYPE gui SYSTEM "kpartgui.dtd">
<gui name="session" version="29">
<gui name="session" version="30">
<MenuBar>
<Menu name="file">
<Action name="file_save_as" group="session-operations"/>
@ -32,6 +32,7 @@
<Action name="monitor-process-finish" group="session-view-operations"/>
<Separator group="session-view-operations"/>
<Action name="view-readonly" group="session-view-operations"/>
<Action name="allow-mouse-tracking" group="session-view-operations"/>
<Separator group="session-view-operations"/>
<Action name="enlarge-font" group="session-view-operations"/>
<Action name="reset-font-size" group="session-view-operations"/>
@ -57,6 +58,8 @@
<Action name="adjust-history"/>
<Separator/>
<Action name="view-readonly" />
<Action name="allow-mouse-tracking" />
<Separator/>
<Action name="switch-profile"/>
<Action name="edit-current-profile"/>
</Menu>

@ -560,6 +560,19 @@ void SessionController::toggleReadOnly()
}
}
void SessionController::toggleAllowMouseTracking()
{
QAction *action = qobject_cast<QAction*>(sender());
if (action == nullptr) {
// Crash if running in debug build (aka. someone developing)
Q_ASSERT(false && "Invalid function called toggleAllowMouseTracking");
return;
}
_view->setAllowMouseTracking(action->isChecked());
}
void SessionController::removeSearchFilter()
{
if (_searchFilter == nullptr) {
@ -730,6 +743,12 @@ void SessionController::setupCommonActions()
#endif
&Konsole::SessionController::changeCodec);
// Mouse tracking enabled
action = collection->addAction(QStringLiteral("allow-mouse-tracking"), this, &SessionController::toggleAllowMouseTracking);
action->setText(i18nc("@item:inmenu Allows terminal applications to request mouse tracking", "Allow mouse tracking"));
action->setCheckable(true);
action->setChecked(true); // the default state
// Read-only
action = collection->addAction(QStringLiteral("view-readonly"), this, &SessionController::toggleReadOnly);
action->setText(i18nc("@item:inmenu A read only (locked) session", "Read-only"));

@ -257,6 +257,7 @@ private Q_SLOTS:
void sendForegroundColor(uint terminator);
void sendBackgroundColor(uint terminator);
void toggleReadOnly();
void toggleAllowMouseTracking();
// other
void setupSearchBar();

Loading…
Cancel
Save