forked from Shinonome/dots-hyprland
sidebar: add pair button to bluetooth menu
This commit is contained in:
+17
-12
@@ -1,4 +1,5 @@
|
||||
import qs.modules.common
|
||||
import qs.modules.common.functions
|
||||
import qs.modules.common.widgets
|
||||
import qs.services
|
||||
import QtQuick
|
||||
@@ -82,6 +83,22 @@ DialogListItem {
|
||||
Item {
|
||||
Layout.fillWidth: true
|
||||
}
|
||||
ActionButton {
|
||||
readonly property bool p: root.device?.paired ?? false
|
||||
colBackground: p ? Appearance.colors.colError : ColorUtils.transparentize(Appearance.colors.colLayer3, 1)
|
||||
colBackgroundHover: p ? Appearance.colors.colErrorHover : ColorUtils.transparentize(Appearance.colors.colLayer3, 1)
|
||||
colRipple: p ? Appearance.colors.colErrorActive : Appearance.colors.colLayer3Hover
|
||||
colText: p ? Appearance.colors.colOnError : Appearance.colors.colPrimary
|
||||
|
||||
buttonText: p ? Translation.tr("Forget") : Translation.tr("Always connect")
|
||||
onClicked: {
|
||||
if (root.device?.paired) {
|
||||
root.device?.forget();
|
||||
} else {
|
||||
root.device?.pair();
|
||||
}
|
||||
}
|
||||
}
|
||||
ActionButton {
|
||||
buttonText: root.device?.connected ? Translation.tr("Disconnect") : Translation.tr("Connect")
|
||||
|
||||
@@ -93,18 +110,6 @@ DialogListItem {
|
||||
}
|
||||
}
|
||||
}
|
||||
ActionButton {
|
||||
visible: root.device?.paired ?? false
|
||||
colBackground: Appearance.colors.colError
|
||||
colBackgroundHover: Appearance.colors.colErrorHover
|
||||
colRipple: Appearance.colors.colErrorActive
|
||||
colText: Appearance.colors.colOnError
|
||||
|
||||
buttonText: Translation.tr("Forget")
|
||||
onClicked: {
|
||||
root.device?.forget();
|
||||
}
|
||||
}
|
||||
}
|
||||
Item {
|
||||
Layout.fillHeight: true
|
||||
|
||||
Reference in New Issue
Block a user