Improve Plasmoid's connections menu further
This commit is contained in:
parent
50a3299254
commit
8971f294e8
|
@ -392,6 +392,7 @@ ColumnLayout {
|
|||
text: plasmoid.nativeInterface.currentConnectionConfigName
|
||||
icon: "network-connect"
|
||||
paddingEnabled: true
|
||||
enforceMenuArrow: true
|
||||
onClicked: connectionConfigsMenu.toggle(x, y + height)
|
||||
Shortcut {
|
||||
sequence: "Ctrl+Shift+C"
|
||||
|
@ -400,9 +401,8 @@ ColumnLayout {
|
|||
}
|
||||
PlasmaComponents.Menu {
|
||||
id: connectionConfigsMenu
|
||||
property bool opened: false
|
||||
function toggle(x, y) {
|
||||
if (!(connectionConfigsMenu.opened = !connectionConfigsMenu.opened)) {
|
||||
if (connectionConfigsMenu.status === PlasmaComponents.DialogStatus.Open) {
|
||||
close()
|
||||
return
|
||||
}
|
||||
|
@ -419,10 +419,6 @@ ColumnLayout {
|
|||
}
|
||||
open(x, y)
|
||||
}
|
||||
function hide() {
|
||||
close()
|
||||
opened = false
|
||||
}
|
||||
}
|
||||
Component {
|
||||
id: menuItem
|
||||
|
@ -431,7 +427,7 @@ ColumnLayout {
|
|||
checkable: true
|
||||
onClicked: {
|
||||
plasmoid.nativeInterface.currentConnectionConfigIndex = index
|
||||
connectionConfigsMenu.hide()
|
||||
connectionConfigsMenu.close()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,6 +3,7 @@ import org.kde.plasma.components 2.0 as PlasmaComponents
|
|||
PlasmaComponents.ToolButton {
|
||||
property int iconSize: units.iconSizes.small
|
||||
property bool paddingEnabled: false
|
||||
property bool enforceMenuArrow: false
|
||||
|
||||
// define our own icon property and use that within the style to be able to set QIcon a directly
|
||||
// note: The iconSource alias defined in org/kde/plasma/components/ToolButton.qml seems to break
|
||||
|
|
|
@ -22,6 +22,7 @@ QtQuickControlStyle.ButtonStyle {
|
|||
property bool controlHovered: control.hovered
|
||||
&& !(QtQuickControlsPrivate.Settings.hasTouchScreen
|
||||
&& QtQuickControlsPrivate.Settings.isMobile)
|
||||
property bool needsMenuArrow: control.menu || control.enforceMenuArrow
|
||||
|
||||
label: RowLayout {
|
||||
id: buttonContent
|
||||
|
@ -65,14 +66,14 @@ QtQuickControlStyle.ButtonStyle {
|
|||
|
||||
PlasmaExtras.ConditionalLoader {
|
||||
id: arrow
|
||||
when: control.menu !== null
|
||||
when: needsMenuArrow
|
||||
visible: when
|
||||
Layout.preferredWidth: units.iconSizes.small
|
||||
Layout.preferredHeight: units.iconSizes.small
|
||||
|
||||
source: Component {
|
||||
PlasmaCore.SvgItem {
|
||||
visible: control.menu !== null
|
||||
visible: needsMenuArrow
|
||||
svg: PlasmaCore.Svg {
|
||||
imagePath: "widgets/arrows"
|
||||
colorGroup: (style.controlHovered || !style.flat)
|
||||
|
|
Loading…
Reference in New Issue