Commit a2b683a1 authored by Phuong Nguyen's avatar Phuong Nguyen Committed by David Edmundson

Implement option to toggle page navigation wraps around for pager plasmoid

Summary:
BUG: 361672

This patch implement an option to disable navigation wraps around for the pager plasmoid, which potentially cause inconveniences for user who switch desktop using mouse wheel or touchpad scroll.

The patch is implemented since "Desktop navigation wraps around" option in "System Settings -> Desktop Behavior -> Virtual Desktops -> Switching" only affects keyboard shortcut mapping.

{F6209076}

Reviewers: #plasma, #vdg, davidedmundson

Reviewed By: #plasma, davidedmundson

Subscribers: hein, zzag, ngraham, abetts, davidedmundson, broulik, plasma-devel

Tags: #plasma

Differential Revision: https://phabricator.kde.org/D14988
parent a44d3039
......@@ -23,6 +23,10 @@
<label>Whether to limit the Pager to the set of windows and the geometry of the screen the widget resides on.</label>
<default>false</default>
</entry>
<entry name="wrapPage" type="Bool">
<label>Whether to wrap page when navigating with pager</label>
<default>false</default>
</entry>
<entry name="currentDesktopSelected" type="Enum">
<label>What to do on left-mouse click on a desktop rectangle.</label>
<choices>
......
......@@ -40,6 +40,7 @@ Item {
property int cfg_currentDesktopSelected
property alias cfg_pagerLayout: pagerLayout.currentIndex
property alias cfg_showOnlyCurrentScreen: showOnlyCurrentScreen.checked
property alias cfg_wrapPage: wrapPage.checked
onCfg_displayedTextChanged: {
switch (cfg_displayedText) {
......@@ -132,6 +133,16 @@ Item {
text: i18n("Only the current screen")
}
Item {
width: 2
height: 2
} //spacer
QtControls.CheckBox {
id: wrapPage
text: i18n("Page navigation wraps around")
}
QtControls.Label {
text: i18n("Layout:")
Layouts.Layout.alignment: Qt.AlignVCenter|Qt.AlignRight
......
......@@ -125,9 +125,15 @@ MouseArea {
while (increment != 0) {
if (increment < 0) {
pagerModel.changePage((pagerModel.currentPage + 1) % repeater.count);
var nextPage = plasmoid.configuration.wrapPage?
(pagerModel.currentPage + 1) % repeater.count :
Math.min(pagerModel.currentPage + 1, repeater.count - 1);
pagerModel.changePage(nextPage);
} else {
pagerModel.changePage((repeater.count + pagerModel.currentPage - 1) % repeater.count);
var previousPage = plasmoid.configuration.wrapPage ?
(repeater.count + pagerModel.currentPage - 1) % repeater.count :
Math.max(pagerModel.currentPage - 1, 0);
pagerModel.changePage(previousPage);
}
increment += (increment < 0) ? 1 : -1;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment