diff --git a/applet/contents/ui/ConnectionItem.qml b/applet/contents/ui/ConnectionItem.qml index f644cd56e03a4565cd7d5272415dfb74249f153e..67c544118e6531c9cde15a01650d9a350e529c5d 100644 --- a/applet/contents/ui/ConnectionItem.qml +++ b/applet/contents/ui/ConnectionItem.qml @@ -13,7 +13,8 @@ import org.kde.kcoreaddons 1.0 as KCoreAddons import org.kde.kquickcontrolsaddons 2.0 import org.kde.plasma.core 2.0 as PlasmaCore -import org.kde.plasma.components 2.0 as PlasmaComponents // for ContextMenu+MenuItem/TabBar+TabButton +import org.kde.plasma.components 2.0 as PlasmaComponents // for ContextMenu+MenuItem +import org.kde.plasma.components 3.0 as PlasmaComponents3 // for TabBar+TabButton import org.kde.plasma.extras 2.0 as PlasmaExtras import org.kde.plasma.networkmanagement 0.2 as PlasmaNM @@ -48,6 +49,19 @@ PlasmaExtras.ExpandableListItem { onTriggered: changeState() } showDefaultActionButtonWhenBusy: true + + Keys.onPressed: { + if ((customExpandedViewContent == detailsComponent) && showSpeed) { + if (event.key == Qt.Key_Right) { + customExpandedViewContentItem.detailsTabBar.currentIndex = 1; + event.accepted = true; + } else if (event.key == Qt.Key_Left) { + customExpandedViewContentItem.detailsTabBar.currentIndex = 0; + event.accepted = true; + } + } + } + customExpandedViewContent: detailsComponent contextMenu: PlasmaComponents.Menu { id: contextMenu @@ -102,8 +116,9 @@ PlasmaExtras.ExpandableListItem { Column { spacing: PlasmaCore.Units.smallSpacing + property Item detailsTabBar: detailsTabBar - PlasmaComponents.TabBar { + PlasmaComponents3.TabBar { id: detailsTabBar anchors { @@ -111,21 +126,23 @@ PlasmaExtras.ExpandableListItem { right: parent.right } height: visible ? implicitHeight : 0 + implicitHeight: contentHeight + position: PlasmaComponents3.TabBar.Header visible: showSpeed - PlasmaComponents.TabButton { + PlasmaComponents3.TabButton { id: speedTabButton text: i18n("Speed") } - PlasmaComponents.TabButton { + PlasmaComponents3.TabButton { id: detailsTabButton text: i18n("Details") } Component.onCompleted: { if (!showSpeed) { - currentTab = detailsTabButton + currentIndex = 1; } } } @@ -137,7 +154,7 @@ PlasmaExtras.ExpandableListItem { right: parent.right } details: ConnectionDetails - visible: detailsTabBar.currentTab == detailsTabButton + visible: detailsTabBar.currentIndex == 1 } TrafficMonitor { @@ -147,7 +164,7 @@ PlasmaExtras.ExpandableListItem { } downloadSpeed: rxBytes uploadSpeed: txBytes - visible: detailsTabBar.currentTab == speedTabButton + visible: detailsTabBar.currentIndex == 0 } } } diff --git a/applet/contents/ui/PopupDialog.qml b/applet/contents/ui/PopupDialog.qml index 7f5c78b59c2d5e822ab4e059df1306bb086041c1..34ea7e1c6c68f234e186c79657c123a646decaf0 100644 --- a/applet/contents/ui/PopupDialog.qml +++ b/applet/contents/ui/PopupDialog.qml @@ -41,6 +41,34 @@ PlasmaComponents3.Page { } } + Keys.onPressed: { + function goToCurrent() { + connectionView.positionViewAtIndex(connectionView.currentIndex, ListView.Contain); + if (connectionView.currentIndex != -1) { + connectionView.currentItem.forceActiveFocus(); + } + } + if (event.modifiers & Qt.ControlModifier && event.key == Qt.Key_F) { + toolbar.searchTextField.forceActiveFocus(); + toolbar.searchTextField.selectAll(); + event.accepted = true; + } else if (event.key == Qt.Key_Down) { + connectionView.incrementCurrentIndex(); + goToCurrent() + event.accepted = true; + } else if (event.key == Qt.Key_Up) { + if (connectionView.currentIndex == 0) { + connectionView.currentIndex = -1; + toolbar.searchTextField.forceActiveFocus(); + toolbar.searchTextField.selectAll(); + } else { + connectionView.decrementCurrentIndex(); + goToCurrent(); + } + event.accepted = true; + } + } + FocusScope { anchors.fill: parent diff --git a/applet/contents/ui/Toolbar.qml b/applet/contents/ui/Toolbar.qml index e001b7ff3204dffca456d6abc6d5bf55fd1a8c3a..a91c626ea7779ee3b0063e1da5021ec0a66e5e78 100644 --- a/applet/contents/ui/Toolbar.qml +++ b/applet/contents/ui/Toolbar.qml @@ -19,6 +19,8 @@ ColumnLayout { readonly property var displayWwanMessage: !wwanSwitchButton.checked && wwanSwitchButton.visible readonly property var displayplaneModeMessage: planeModeSwitchButton.checked && planeModeSwitchButton.visible + property alias searchTextField: searchTextField + PlasmaCore.Svg { id: lineSvg imagePath: "widgets/line"