mirror of
https://github.com/AvengeMedia/DankMaterialShell.git
synced 2026-01-29 16:02:51 -05:00
Add proxy service for legacy nmcli version
This commit is contained in:
@@ -17,7 +17,7 @@ DankModal {
|
|||||||
networkData = data
|
networkData = data
|
||||||
networkInfoModalVisible = true
|
networkInfoModalVisible = true
|
||||||
open()
|
open()
|
||||||
NetworkManagerService.fetchNetworkInfo(ssid)
|
NetworkService.fetchNetworkInfo(ssid)
|
||||||
}
|
}
|
||||||
|
|
||||||
function hideDialog() {
|
function hideDialog() {
|
||||||
@@ -101,7 +101,7 @@ DankModal {
|
|||||||
id: detailsText
|
id: detailsText
|
||||||
|
|
||||||
width: parent.width
|
width: parent.width
|
||||||
text: NetworkManagerService.networkInfoDetails && NetworkManagerService.networkInfoDetails.replace(/\\n/g, '\n') || "No information available"
|
text: NetworkService.networkInfoDetails && NetworkService.networkInfoDetails.replace(/\\n/g, '\n') || "No information available"
|
||||||
font.pixelSize: Theme.fontSizeMedium
|
font.pixelSize: Theme.fontSizeMedium
|
||||||
color: Theme.surfaceText
|
color: Theme.surfaceText
|
||||||
wrapMode: Text.WordWrap
|
wrapMode: Text.WordWrap
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ DankModal {
|
|||||||
wifiPasswordInput = ""
|
wifiPasswordInput = ""
|
||||||
wifiUsernameInput = ""
|
wifiUsernameInput = ""
|
||||||
|
|
||||||
const network = NetworkManagerService.wifiNetworks.find(n => n.ssid === ssid)
|
const network = NetworkService.wifiNetworks.find(n => n.ssid === ssid)
|
||||||
requiresEnterprise = network?.enterprise || false
|
requiresEnterprise = network?.enterprise || false
|
||||||
|
|
||||||
open()
|
open()
|
||||||
@@ -59,14 +59,14 @@ DankModal {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Connections {
|
Connections {
|
||||||
target: NetworkManagerService
|
target: NetworkService
|
||||||
|
|
||||||
function onPasswordDialogShouldReopenChanged() {
|
function onPasswordDialogShouldReopenChanged() {
|
||||||
if (NetworkManagerService.passwordDialogShouldReopen && NetworkManagerService.connectingSSID !== "") {
|
if (NetworkService.passwordDialogShouldReopen && NetworkService.connectingSSID !== "") {
|
||||||
wifiPasswordSSID = NetworkManagerService.connectingSSID
|
wifiPasswordSSID = NetworkService.connectingSSID
|
||||||
wifiPasswordInput = ""
|
wifiPasswordInput = ""
|
||||||
open()
|
open()
|
||||||
NetworkManagerService.passwordDialogShouldReopen = false
|
NetworkService.passwordDialogShouldReopen = false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -196,7 +196,7 @@ DankModal {
|
|||||||
}
|
}
|
||||||
onAccepted: () => {
|
onAccepted: () => {
|
||||||
const username = requiresEnterprise ? usernameInput.text : ""
|
const username = requiresEnterprise ? usernameInput.text : ""
|
||||||
NetworkManagerService.connectToWifi(wifiPasswordSSID, passwordInput.text, username)
|
NetworkService.connectToWifi(wifiPasswordSSID, passwordInput.text, username)
|
||||||
close()
|
close()
|
||||||
wifiPasswordInput = ""
|
wifiPasswordInput = ""
|
||||||
wifiUsernameInput = ""
|
wifiUsernameInput = ""
|
||||||
@@ -344,7 +344,7 @@ DankModal {
|
|||||||
enabled: parent.enabled
|
enabled: parent.enabled
|
||||||
onClicked: () => {
|
onClicked: () => {
|
||||||
const username = requiresEnterprise ? usernameInput.text : ""
|
const username = requiresEnterprise ? usernameInput.text : ""
|
||||||
NetworkManagerService.connectToWifi(wifiPasswordSSID, passwordInput.text, username)
|
NetworkService.connectToWifi(wifiPasswordSSID, passwordInput.text, username)
|
||||||
close()
|
close()
|
||||||
wifiPasswordInput = ""
|
wifiPasswordInput = ""
|
||||||
wifiUsernameInput = ""
|
wifiUsernameInput = ""
|
||||||
|
|||||||
@@ -126,15 +126,7 @@ Column {
|
|||||||
return builtinPluginWidgetComponent
|
return builtinPluginWidgetComponent
|
||||||
} else if (id.startsWith("plugin_")) {
|
} else if (id.startsWith("plugin_")) {
|
||||||
return pluginWidgetComponent
|
return pluginWidgetComponent
|
||||||
} else if (id === "wifi") {
|
} else if (id === "wifi" || id === "bluetooth" || id === "audioOutput" || id === "audioInput") {
|
||||||
if (!DMSService.dmsAvailable) {
|
|
||||||
return errorPillComponent
|
|
||||||
}
|
|
||||||
if (DMSService.dmsAvailable && !DMSService.capabilities.includes("network")) {
|
|
||||||
return errorPillComponent
|
|
||||||
}
|
|
||||||
return compoundPillComponent
|
|
||||||
} else if (id === "bluetooth" || id === "audioOutput" || id === "audioInput") {
|
|
||||||
return compoundPillComponent
|
return compoundPillComponent
|
||||||
} else if (id === "volumeSlider") {
|
} else if (id === "volumeSlider") {
|
||||||
return audioSliderComponent
|
return audioSliderComponent
|
||||||
@@ -211,13 +203,13 @@ Column {
|
|||||||
switch (widgetData.id || "") {
|
switch (widgetData.id || "") {
|
||||||
case "wifi":
|
case "wifi":
|
||||||
{
|
{
|
||||||
if (NetworkManagerService.wifiToggling)
|
if (NetworkService.wifiToggling)
|
||||||
return "sync"
|
return "sync"
|
||||||
if (NetworkManagerService.networkStatus === "ethernet")
|
if (NetworkService.networkStatus === "ethernet")
|
||||||
return "settings_ethernet"
|
return "settings_ethernet"
|
||||||
if (NetworkManagerService.networkStatus === "wifi")
|
if (NetworkService.networkStatus === "wifi")
|
||||||
return NetworkManagerService.wifiSignalIcon
|
return NetworkService.wifiSignalIcon
|
||||||
if (NetworkManagerService.wifiEnabled)
|
if (NetworkService.wifiEnabled)
|
||||||
return "wifi_off"
|
return "wifi_off"
|
||||||
return "wifi_off"
|
return "wifi_off"
|
||||||
}
|
}
|
||||||
@@ -270,13 +262,13 @@ Column {
|
|||||||
switch (widgetData.id || "") {
|
switch (widgetData.id || "") {
|
||||||
case "wifi":
|
case "wifi":
|
||||||
{
|
{
|
||||||
if (NetworkManagerService.wifiToggling)
|
if (NetworkService.wifiToggling)
|
||||||
return NetworkManagerService.wifiEnabled ? "Disabling WiFi..." : "Enabling WiFi..."
|
return NetworkService.wifiEnabled ? "Disabling WiFi..." : "Enabling WiFi..."
|
||||||
if (NetworkManagerService.networkStatus === "ethernet")
|
if (NetworkService.networkStatus === "ethernet")
|
||||||
return "Ethernet"
|
return "Ethernet"
|
||||||
if (NetworkManagerService.networkStatus === "wifi" && NetworkManagerService.currentWifiSSID)
|
if (NetworkService.networkStatus === "wifi" && NetworkService.currentWifiSSID)
|
||||||
return NetworkManagerService.currentWifiSSID
|
return NetworkService.currentWifiSSID
|
||||||
if (NetworkManagerService.wifiEnabled)
|
if (NetworkService.wifiEnabled)
|
||||||
return "Not connected"
|
return "Not connected"
|
||||||
return "WiFi off"
|
return "WiFi off"
|
||||||
}
|
}
|
||||||
@@ -302,13 +294,13 @@ Column {
|
|||||||
switch (widgetData.id || "") {
|
switch (widgetData.id || "") {
|
||||||
case "wifi":
|
case "wifi":
|
||||||
{
|
{
|
||||||
if (NetworkManagerService.wifiToggling)
|
if (NetworkService.wifiToggling)
|
||||||
return "Please wait..."
|
return "Please wait..."
|
||||||
if (NetworkManagerService.networkStatus === "ethernet")
|
if (NetworkService.networkStatus === "ethernet")
|
||||||
return "Connected"
|
return "Connected"
|
||||||
if (NetworkManagerService.networkStatus === "wifi")
|
if (NetworkService.networkStatus === "wifi")
|
||||||
return NetworkManagerService.wifiSignalStrength > 0 ? NetworkManagerService.wifiSignalStrength + "%" : "Connected"
|
return NetworkService.wifiSignalStrength > 0 ? NetworkService.wifiSignalStrength + "%" : "Connected"
|
||||||
if (NetworkManagerService.wifiEnabled)
|
if (NetworkService.wifiEnabled)
|
||||||
return "Select network"
|
return "Select network"
|
||||||
return ""
|
return ""
|
||||||
}
|
}
|
||||||
@@ -356,13 +348,13 @@ Column {
|
|||||||
switch (widgetData.id || "") {
|
switch (widgetData.id || "") {
|
||||||
case "wifi":
|
case "wifi":
|
||||||
{
|
{
|
||||||
if (NetworkManagerService.wifiToggling)
|
if (NetworkService.wifiToggling)
|
||||||
return false
|
return false
|
||||||
if (NetworkManagerService.networkStatus === "ethernet")
|
if (NetworkService.networkStatus === "ethernet")
|
||||||
return true
|
return true
|
||||||
if (NetworkManagerService.networkStatus === "wifi")
|
if (NetworkService.networkStatus === "wifi")
|
||||||
return true
|
return true
|
||||||
return NetworkManagerService.wifiEnabled
|
return NetworkService.wifiEnabled
|
||||||
}
|
}
|
||||||
case "bluetooth":
|
case "bluetooth":
|
||||||
return !!(BluetoothService.available && BluetoothService.adapter && BluetoothService.adapter.enabled)
|
return !!(BluetoothService.available && BluetoothService.adapter && BluetoothService.adapter.enabled)
|
||||||
|
|||||||
@@ -73,13 +73,17 @@ DankPopout {
|
|||||||
onShouldBeVisibleChanged: {
|
onShouldBeVisibleChanged: {
|
||||||
if (shouldBeVisible) {
|
if (shouldBeVisible) {
|
||||||
Qt.callLater(() => {
|
Qt.callLater(() => {
|
||||||
NetworkManagerService.autoRefreshEnabled = NetworkManagerService.wifiEnabled
|
if (NetworkService.activeService) {
|
||||||
|
NetworkService.activeService.autoRefreshEnabled = NetworkService.wifiEnabled
|
||||||
|
}
|
||||||
if (UserInfoService)
|
if (UserInfoService)
|
||||||
UserInfoService.getUptime()
|
UserInfoService.getUptime()
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
Qt.callLater(() => {
|
Qt.callLater(() => {
|
||||||
NetworkManagerService.autoRefreshEnabled = false
|
if (NetworkService.activeService) {
|
||||||
|
NetworkService.activeService.autoRefreshEnabled = false
|
||||||
|
}
|
||||||
if (BluetoothService.adapter && BluetoothService.adapter.discovering)
|
if (BluetoothService.adapter && BluetoothService.adapter.discovering)
|
||||||
BluetoothService.adapter.discovering = false
|
BluetoothService.adapter.discovering = false
|
||||||
editMode = false
|
editMode = false
|
||||||
|
|||||||
@@ -8,10 +8,10 @@ import qs.Modals
|
|||||||
|
|
||||||
Rectangle {
|
Rectangle {
|
||||||
implicitHeight: {
|
implicitHeight: {
|
||||||
if (NetworkManagerService.wifiToggling) {
|
if (NetworkService.wifiToggling) {
|
||||||
return headerRow.height + wifiToggleContent.height + Theme.spacingM
|
return headerRow.height + wifiToggleContent.height + Theme.spacingM
|
||||||
}
|
}
|
||||||
if (NetworkManagerService.wifiEnabled) {
|
if (NetworkService.wifiEnabled) {
|
||||||
return headerRow.height + wifiContent.height + Theme.spacingM
|
return headerRow.height + wifiContent.height + Theme.spacingM
|
||||||
}
|
}
|
||||||
return headerRow.height + wifiOffContent.height + Theme.spacingM
|
return headerRow.height + wifiOffContent.height + Theme.spacingM
|
||||||
@@ -22,11 +22,11 @@ Rectangle {
|
|||||||
border.width: 0
|
border.width: 0
|
||||||
|
|
||||||
Component.onCompleted: {
|
Component.onCompleted: {
|
||||||
NetworkManagerService.addRef()
|
NetworkService.addRef()
|
||||||
}
|
}
|
||||||
|
|
||||||
Component.onDestruction: {
|
Component.onDestruction: {
|
||||||
NetworkManagerService.removeRef()
|
NetworkService.removeRef()
|
||||||
}
|
}
|
||||||
|
|
||||||
Row {
|
Row {
|
||||||
@@ -56,11 +56,11 @@ Rectangle {
|
|||||||
DankButtonGroup {
|
DankButtonGroup {
|
||||||
id: preferenceControls
|
id: preferenceControls
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
visible: NetworkManagerService.ethernetConnected
|
visible: NetworkService.ethernetConnected
|
||||||
|
|
||||||
property int currentPreferenceIndex: {
|
property int currentPreferenceIndex: {
|
||||||
const pref = NetworkManagerService.userPreference
|
const pref = NetworkService.userPreference
|
||||||
const status = NetworkManagerService.networkStatus
|
const status = NetworkService.networkStatus
|
||||||
let index = 1
|
let index = 1
|
||||||
|
|
||||||
if (pref === "ethernet") {
|
if (pref === "ethernet") {
|
||||||
@@ -80,7 +80,7 @@ Rectangle {
|
|||||||
onSelectionChanged: (index, selected) => {
|
onSelectionChanged: (index, selected) => {
|
||||||
if (!selected) return
|
if (!selected) return
|
||||||
console.log("NetworkDetail: Setting preference to", index === 0 ? "ethernet" : "wifi")
|
console.log("NetworkDetail: Setting preference to", index === 0 ? "ethernet" : "wifi")
|
||||||
NetworkManagerService.setNetworkPreference(index === 0 ? "ethernet" : "wifi")
|
NetworkService.setNetworkPreference(index === 0 ? "ethernet" : "wifi")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -92,7 +92,7 @@ Rectangle {
|
|||||||
anchors.right: parent.right
|
anchors.right: parent.right
|
||||||
anchors.margins: Theme.spacingM
|
anchors.margins: Theme.spacingM
|
||||||
anchors.topMargin: Theme.spacingM
|
anchors.topMargin: Theme.spacingM
|
||||||
visible: NetworkManagerService.wifiToggling
|
visible: NetworkService.wifiToggling
|
||||||
height: visible ? 80 : 0
|
height: visible ? 80 : 0
|
||||||
|
|
||||||
Column {
|
Column {
|
||||||
@@ -106,7 +106,7 @@ Rectangle {
|
|||||||
color: Theme.primary
|
color: Theme.primary
|
||||||
|
|
||||||
RotationAnimation on rotation {
|
RotationAnimation on rotation {
|
||||||
running: NetworkManagerService.wifiToggling
|
running: NetworkService.wifiToggling
|
||||||
loops: Animation.Infinite
|
loops: Animation.Infinite
|
||||||
from: 0
|
from: 0
|
||||||
to: 360
|
to: 360
|
||||||
@@ -116,7 +116,7 @@ Rectangle {
|
|||||||
|
|
||||||
StyledText {
|
StyledText {
|
||||||
anchors.horizontalCenter: parent.horizontalCenter
|
anchors.horizontalCenter: parent.horizontalCenter
|
||||||
text: NetworkManagerService.wifiEnabled ? "Disabling WiFi..." : "Enabling WiFi..."
|
text: NetworkService.wifiEnabled ? "Disabling WiFi..." : "Enabling WiFi..."
|
||||||
font.pixelSize: Theme.fontSizeMedium
|
font.pixelSize: Theme.fontSizeMedium
|
||||||
color: Theme.surfaceText
|
color: Theme.surfaceText
|
||||||
horizontalAlignment: Text.AlignHCenter
|
horizontalAlignment: Text.AlignHCenter
|
||||||
@@ -131,7 +131,7 @@ Rectangle {
|
|||||||
anchors.right: parent.right
|
anchors.right: parent.right
|
||||||
anchors.margins: Theme.spacingM
|
anchors.margins: Theme.spacingM
|
||||||
anchors.topMargin: Theme.spacingM
|
anchors.topMargin: Theme.spacingM
|
||||||
visible: !NetworkManagerService.wifiEnabled && !NetworkManagerService.wifiToggling
|
visible: !NetworkService.wifiEnabled && !NetworkService.wifiToggling
|
||||||
height: visible ? 120 : 0
|
height: visible ? 120 : 0
|
||||||
|
|
||||||
Column {
|
Column {
|
||||||
@@ -177,7 +177,7 @@ Rectangle {
|
|||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
hoverEnabled: true
|
hoverEnabled: true
|
||||||
cursorShape: Qt.PointingHandCursor
|
cursorShape: Qt.PointingHandCursor
|
||||||
onClicked: NetworkManagerService.toggleWifiRadio()
|
onClicked: NetworkService.toggleWifiRadio()
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -192,7 +192,7 @@ Rectangle {
|
|||||||
anchors.bottom: parent.bottom
|
anchors.bottom: parent.bottom
|
||||||
anchors.margins: Theme.spacingM
|
anchors.margins: Theme.spacingM
|
||||||
anchors.topMargin: Theme.spacingM
|
anchors.topMargin: Theme.spacingM
|
||||||
visible: NetworkManagerService.wifiInterface && NetworkManagerService.wifiEnabled && !NetworkManagerService.wifiToggling
|
visible: NetworkService.wifiInterface && NetworkService.wifiEnabled && !NetworkService.wifiToggling
|
||||||
contentHeight: wifiColumn.height
|
contentHeight: wifiColumn.height
|
||||||
clip: true
|
clip: true
|
||||||
|
|
||||||
@@ -204,7 +204,7 @@ Rectangle {
|
|||||||
Item {
|
Item {
|
||||||
width: parent.width
|
width: parent.width
|
||||||
height: 200
|
height: 200
|
||||||
visible: NetworkManagerService.wifiInterface && NetworkManagerService.wifiNetworks?.length < 1 && !NetworkManagerService.wifiToggling && NetworkManagerService.isScanning
|
visible: NetworkService.wifiInterface && NetworkService.wifiNetworks?.length < 1 && !NetworkService.wifiToggling && NetworkService.isScanning
|
||||||
|
|
||||||
DankIcon {
|
DankIcon {
|
||||||
anchors.centerIn: parent
|
anchors.centerIn: parent
|
||||||
@@ -213,7 +213,7 @@ Rectangle {
|
|||||||
color: Qt.rgba(Theme.surfaceText.r || 0.8, Theme.surfaceText.g || 0.8, Theme.surfaceText.b || 0.8, 0.3)
|
color: Qt.rgba(Theme.surfaceText.r || 0.8, Theme.surfaceText.g || 0.8, Theme.surfaceText.b || 0.8, 0.3)
|
||||||
|
|
||||||
RotationAnimation on rotation {
|
RotationAnimation on rotation {
|
||||||
running: NetworkManagerService.isScanning
|
running: NetworkService.isScanning
|
||||||
loops: Animation.Infinite
|
loops: Animation.Infinite
|
||||||
from: 0
|
from: 0
|
||||||
to: 360
|
to: 360
|
||||||
@@ -226,8 +226,8 @@ Rectangle {
|
|||||||
model: sortedNetworks
|
model: sortedNetworks
|
||||||
|
|
||||||
property var sortedNetworks: {
|
property var sortedNetworks: {
|
||||||
const ssid = NetworkManagerService.currentWifiSSID
|
const ssid = NetworkService.currentWifiSSID
|
||||||
const networks = NetworkManagerService.wifiNetworks
|
const networks = NetworkService.wifiNetworks
|
||||||
let sorted = [...networks]
|
let sorted = [...networks]
|
||||||
sorted.sort((a, b) => {
|
sorted.sort((a, b) => {
|
||||||
if (a.ssid === ssid) return -1
|
if (a.ssid === ssid) return -1
|
||||||
@@ -244,7 +244,7 @@ Rectangle {
|
|||||||
height: 50
|
height: 50
|
||||||
radius: Theme.cornerRadius
|
radius: Theme.cornerRadius
|
||||||
color: networkMouseArea.containsMouse ? Qt.rgba(Theme.primary.r, Theme.primary.g, Theme.primary.b, 0.08) : Theme.surfaceContainerHighest
|
color: networkMouseArea.containsMouse ? Qt.rgba(Theme.primary.r, Theme.primary.g, Theme.primary.b, 0.08) : Theme.surfaceContainerHighest
|
||||||
border.color: modelData.ssid === NetworkManagerService.currentWifiSSID ? Theme.primary : Qt.rgba(Theme.outline.r, Theme.outline.g, Theme.outline.b, 0.12)
|
border.color: modelData.ssid === NetworkService.currentWifiSSID ? Theme.primary : Qt.rgba(Theme.outline.r, Theme.outline.g, Theme.outline.b, 0.12)
|
||||||
border.width: 0
|
border.width: 0
|
||||||
|
|
||||||
Row {
|
Row {
|
||||||
@@ -261,7 +261,7 @@ Rectangle {
|
|||||||
return "wifi_1_bar"
|
return "wifi_1_bar"
|
||||||
}
|
}
|
||||||
size: Theme.iconSize - 4
|
size: Theme.iconSize - 4
|
||||||
color: modelData.ssid === NetworkManagerService.currentWifiSSID ? Theme.primary : Theme.surfaceText
|
color: modelData.ssid === NetworkService.currentWifiSSID ? Theme.primary : Theme.surfaceText
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -273,7 +273,7 @@ Rectangle {
|
|||||||
text: modelData.ssid || "Unknown Network"
|
text: modelData.ssid || "Unknown Network"
|
||||||
font.pixelSize: Theme.fontSizeMedium
|
font.pixelSize: Theme.fontSizeMedium
|
||||||
color: Theme.surfaceText
|
color: Theme.surfaceText
|
||||||
font.weight: modelData.ssid === NetworkManagerService.currentWifiSSID ? Font.Medium : Font.Normal
|
font.weight: modelData.ssid === NetworkService.currentWifiSSID ? Font.Medium : Font.Normal
|
||||||
elide: Text.ElideRight
|
elide: Text.ElideRight
|
||||||
width: parent.width
|
width: parent.width
|
||||||
}
|
}
|
||||||
@@ -282,7 +282,7 @@ Rectangle {
|
|||||||
spacing: Theme.spacingXS
|
spacing: Theme.spacingXS
|
||||||
|
|
||||||
StyledText {
|
StyledText {
|
||||||
text: modelData.ssid === NetworkManagerService.currentWifiSSID ? "Connected" : (modelData.secured ? "Secured" : "Open")
|
text: modelData.ssid === NetworkService.currentWifiSSID ? "Connected" : (modelData.secured ? "Secured" : "Open")
|
||||||
font.pixelSize: Theme.fontSizeSmall
|
font.pixelSize: Theme.fontSizeSmall
|
||||||
color: Theme.surfaceVariantText
|
color: Theme.surfaceVariantText
|
||||||
}
|
}
|
||||||
@@ -316,7 +316,7 @@ Rectangle {
|
|||||||
} else {
|
} else {
|
||||||
networkContextMenu.currentSSID = modelData.ssid
|
networkContextMenu.currentSSID = modelData.ssid
|
||||||
networkContextMenu.currentSecured = modelData.secured
|
networkContextMenu.currentSecured = modelData.secured
|
||||||
networkContextMenu.currentConnected = modelData.ssid === NetworkManagerService.currentWifiSSID
|
networkContextMenu.currentConnected = modelData.ssid === NetworkService.currentWifiSSID
|
||||||
networkContextMenu.currentSaved = modelData.saved
|
networkContextMenu.currentSaved = modelData.saved
|
||||||
networkContextMenu.currentSignal = modelData.signal
|
networkContextMenu.currentSignal = modelData.signal
|
||||||
networkContextMenu.popup(optionsButton, -networkContextMenu.width + optionsButton.width, optionsButton.height + Theme.spacingXS)
|
networkContextMenu.popup(optionsButton, -networkContextMenu.width + optionsButton.width, optionsButton.height + Theme.spacingXS)
|
||||||
@@ -331,11 +331,11 @@ Rectangle {
|
|||||||
hoverEnabled: true
|
hoverEnabled: true
|
||||||
cursorShape: Qt.PointingHandCursor
|
cursorShape: Qt.PointingHandCursor
|
||||||
onClicked: function(event) {
|
onClicked: function(event) {
|
||||||
if (modelData.ssid !== NetworkManagerService.currentWifiSSID) {
|
if (modelData.ssid !== NetworkService.currentWifiSSID) {
|
||||||
if (modelData.secured && !modelData.saved) {
|
if (modelData.secured && !modelData.saved) {
|
||||||
wifiPasswordModal.show(modelData.ssid)
|
wifiPasswordModal.show(modelData.ssid)
|
||||||
} else {
|
} else {
|
||||||
NetworkManagerService.connectToWifi(modelData.ssid)
|
NetworkService.connectToWifi(modelData.ssid)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
event.accepted = true
|
event.accepted = true
|
||||||
@@ -384,12 +384,12 @@ Rectangle {
|
|||||||
|
|
||||||
onTriggered: {
|
onTriggered: {
|
||||||
if (networkContextMenu.currentConnected) {
|
if (networkContextMenu.currentConnected) {
|
||||||
NetworkManagerService.disconnectWifi()
|
NetworkService.disconnectWifi()
|
||||||
} else {
|
} else {
|
||||||
if (networkContextMenu.currentSecured && !networkContextMenu.currentSaved) {
|
if (networkContextMenu.currentSecured && !networkContextMenu.currentSaved) {
|
||||||
wifiPasswordModal.show(networkContextMenu.currentSSID)
|
wifiPasswordModal.show(networkContextMenu.currentSSID)
|
||||||
} else {
|
} else {
|
||||||
NetworkManagerService.connectToWifi(networkContextMenu.currentSSID)
|
NetworkService.connectToWifi(networkContextMenu.currentSSID)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -413,7 +413,7 @@ Rectangle {
|
|||||||
}
|
}
|
||||||
|
|
||||||
onTriggered: {
|
onTriggered: {
|
||||||
let networkData = NetworkManagerService.getNetworkInfo(networkContextMenu.currentSSID)
|
let networkData = NetworkService.getNetworkInfo(networkContextMenu.currentSSID)
|
||||||
networkInfoModal.showNetworkInfo(networkContextMenu.currentSSID, networkData)
|
networkInfoModal.showNetworkInfo(networkContextMenu.currentSSID, networkData)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -437,7 +437,7 @@ Rectangle {
|
|||||||
}
|
}
|
||||||
|
|
||||||
onTriggered: {
|
onTriggered: {
|
||||||
NetworkManagerService.forgetWifiNetwork(networkContextMenu.currentSSID)
|
NetworkService.forgetWifiNetwork(networkContextMenu.currentSSID)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -67,8 +67,8 @@ QtObject {
|
|||||||
"description": "Wi-Fi and Ethernet connection",
|
"description": "Wi-Fi and Ethernet connection",
|
||||||
"icon": "wifi",
|
"icon": "wifi",
|
||||||
"type": "connection",
|
"type": "connection",
|
||||||
"enabled": NetworkManagerService.wifiAvailable,
|
"enabled": NetworkService.wifiAvailable,
|
||||||
"warning": !NetworkManagerService.wifiAvailable ? "Wi-Fi not available" : undefined
|
"warning": !NetworkService.wifiAvailable ? "Wi-Fi not available" : undefined
|
||||||
}, {
|
}, {
|
||||||
"id": "bluetooth",
|
"id": "bluetooth",
|
||||||
"text": "Bluetooth",
|
"text": "Bluetooth",
|
||||||
|
|||||||
@@ -1003,8 +1003,8 @@ Item {
|
|||||||
}
|
}
|
||||||
controlCenterLoader.item.triggerScreen = barWindow.screen
|
controlCenterLoader.item.triggerScreen = barWindow.screen
|
||||||
controlCenterLoader.item.toggle()
|
controlCenterLoader.item.toggle()
|
||||||
if (controlCenterLoader.item.shouldBeVisible && NetworkManagerService.wifiEnabled) {
|
if (controlCenterLoader.item.shouldBeVisible && NetworkService.wifiEnabled) {
|
||||||
NetworkManagerService.scanWifi()
|
NetworkService.scanWifi()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -42,26 +42,26 @@ Rectangle {
|
|||||||
|
|
||||||
DankIcon {
|
DankIcon {
|
||||||
name: {
|
name: {
|
||||||
if (NetworkManagerService.wifiToggling) {
|
if (NetworkService.wifiToggling) {
|
||||||
return "sync"
|
return "sync"
|
||||||
}
|
}
|
||||||
|
|
||||||
if (NetworkManagerService.networkStatus === "ethernet") {
|
if (NetworkService.networkStatus === "ethernet") {
|
||||||
return "lan"
|
return "lan"
|
||||||
}
|
}
|
||||||
|
|
||||||
return NetworkManagerService.wifiSignalIcon
|
return NetworkService.wifiSignalIcon
|
||||||
}
|
}
|
||||||
size: Theme.barIconSize(barThickness)
|
size: Theme.barIconSize(barThickness)
|
||||||
color: {
|
color: {
|
||||||
if (NetworkManagerService.wifiToggling) {
|
if (NetworkService.wifiToggling) {
|
||||||
return Theme.primary
|
return Theme.primary
|
||||||
}
|
}
|
||||||
|
|
||||||
return NetworkManagerService.networkStatus !== "disconnected" ? Theme.primary : Theme.outlineButton
|
return NetworkService.networkStatus !== "disconnected" ? Theme.primary : Theme.outlineButton
|
||||||
}
|
}
|
||||||
anchors.horizontalCenter: parent.horizontalCenter
|
anchors.horizontalCenter: parent.horizontalCenter
|
||||||
visible: root.showNetworkIcon && NetworkManagerService.networkAvailable
|
visible: root.showNetworkIcon && NetworkService.networkAvailable
|
||||||
}
|
}
|
||||||
|
|
||||||
DankIcon {
|
DankIcon {
|
||||||
@@ -141,26 +141,26 @@ Rectangle {
|
|||||||
id: networkIcon
|
id: networkIcon
|
||||||
|
|
||||||
name: {
|
name: {
|
||||||
if (NetworkManagerService.wifiToggling) {
|
if (NetworkService.wifiToggling) {
|
||||||
return "sync";
|
return "sync";
|
||||||
}
|
}
|
||||||
|
|
||||||
if (NetworkManagerService.networkStatus === "ethernet") {
|
if (NetworkService.networkStatus === "ethernet") {
|
||||||
return "lan";
|
return "lan";
|
||||||
}
|
}
|
||||||
|
|
||||||
return NetworkManagerService.wifiSignalIcon;
|
return NetworkService.wifiSignalIcon;
|
||||||
}
|
}
|
||||||
size: Theme.barIconSize(barThickness)
|
size: Theme.barIconSize(barThickness)
|
||||||
color: {
|
color: {
|
||||||
if (NetworkManagerService.wifiToggling) {
|
if (NetworkService.wifiToggling) {
|
||||||
return Theme.primary;
|
return Theme.primary;
|
||||||
}
|
}
|
||||||
|
|
||||||
return NetworkManagerService.networkStatus !== "disconnected" ? Theme.primary : Theme.outlineButton;
|
return NetworkService.networkStatus !== "disconnected" ? Theme.primary : Theme.outlineButton;
|
||||||
}
|
}
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
visible: root.showNetworkIcon && NetworkManagerService.networkAvailable
|
visible: root.showNetworkIcon && NetworkService.networkAvailable
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -906,20 +906,20 @@ Item {
|
|||||||
height: 24
|
height: 24
|
||||||
color: Qt.rgba(255, 255, 255, 0.2)
|
color: Qt.rgba(255, 255, 255, 0.2)
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
visible: WeatherService.weather.available && (NetworkManagerService.networkStatus !== "disconnected" || BluetoothService.enabled || (AudioService.sink && AudioService.sink.audio) || BatteryService.batteryAvailable)
|
visible: WeatherService.weather.available && (NetworkService.networkStatus !== "disconnected" || BluetoothService.enabled || (AudioService.sink && AudioService.sink.audio) || BatteryService.batteryAvailable)
|
||||||
}
|
}
|
||||||
|
|
||||||
Row {
|
Row {
|
||||||
spacing: Theme.spacingM
|
spacing: Theme.spacingM
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
visible: NetworkManagerService.networkStatus !== "disconnected" || (BluetoothService.available && BluetoothService.enabled) || (AudioService.sink && AudioService.sink.audio)
|
visible: NetworkService.networkStatus !== "disconnected" || (BluetoothService.available && BluetoothService.enabled) || (AudioService.sink && AudioService.sink.audio)
|
||||||
|
|
||||||
DankIcon {
|
DankIcon {
|
||||||
name: NetworkManagerService.networkStatus === "ethernet" ? "lan" : NetworkManagerService.wifiSignalIcon
|
name: NetworkService.networkStatus === "ethernet" ? "lan" : NetworkService.wifiSignalIcon
|
||||||
size: Theme.iconSize - 2
|
size: Theme.iconSize - 2
|
||||||
color: NetworkManagerService.networkStatus !== "disconnected" ? "white" : Qt.rgba(255, 255, 255, 0.5)
|
color: NetworkService.networkStatus !== "disconnected" ? "white" : Qt.rgba(255, 255, 255, 0.5)
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
visible: NetworkManagerService.networkStatus !== "disconnected"
|
visible: NetworkService.networkStatus !== "disconnected"
|
||||||
}
|
}
|
||||||
|
|
||||||
DankIcon {
|
DankIcon {
|
||||||
@@ -955,7 +955,7 @@ Item {
|
|||||||
height: 24
|
height: 24
|
||||||
color: Qt.rgba(255, 255, 255, 0.2)
|
color: Qt.rgba(255, 255, 255, 0.2)
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
visible: BatteryService.batteryAvailable && (NetworkManagerService.networkStatus !== "disconnected" || BluetoothService.enabled || (AudioService.sink && AudioService.sink.audio))
|
visible: BatteryService.batteryAvailable && (NetworkService.networkStatus !== "disconnected" || BluetoothService.enabled || (AudioService.sink && AudioService.sink.audio))
|
||||||
}
|
}
|
||||||
|
|
||||||
Row {
|
Row {
|
||||||
|
|||||||
1094
Services/LegacyNetworkService.qml
Normal file
1094
Services/LegacyNetworkService.qml
Normal file
File diff suppressed because it is too large
Load Diff
236
Services/NetworkService.qml
Normal file
236
Services/NetworkService.qml
Normal file
@@ -0,0 +1,236 @@
|
|||||||
|
pragma Singleton
|
||||||
|
|
||||||
|
pragma ComponentBehavior: Bound
|
||||||
|
|
||||||
|
import QtQuick
|
||||||
|
import Quickshell
|
||||||
|
import Quickshell.Io
|
||||||
|
import qs.Common
|
||||||
|
|
||||||
|
Singleton {
|
||||||
|
id: root
|
||||||
|
|
||||||
|
property bool networkAvailable: activeService !== null
|
||||||
|
property string networkStatus: activeService?.networkStatus ?? "disconnected"
|
||||||
|
property string primaryConnection: activeService?.primaryConnection ?? ""
|
||||||
|
|
||||||
|
property string ethernetIP: activeService?.ethernetIP ?? ""
|
||||||
|
property string ethernetInterface: activeService?.ethernetInterface ?? ""
|
||||||
|
property bool ethernetConnected: activeService?.ethernetConnected ?? false
|
||||||
|
property string ethernetConnectionUuid: activeService?.ethernetConnectionUuid ?? ""
|
||||||
|
|
||||||
|
property string wifiIP: activeService?.wifiIP ?? ""
|
||||||
|
property string wifiInterface: activeService?.wifiInterface ?? ""
|
||||||
|
property bool wifiConnected: activeService?.wifiConnected ?? false
|
||||||
|
property bool wifiEnabled: activeService?.wifiEnabled ?? true
|
||||||
|
property string wifiConnectionUuid: activeService?.wifiConnectionUuid ?? ""
|
||||||
|
property string wifiDevicePath: activeService?.wifiDevicePath ?? ""
|
||||||
|
property string activeAccessPointPath: activeService?.activeAccessPointPath ?? ""
|
||||||
|
|
||||||
|
property string currentWifiSSID: activeService?.currentWifiSSID ?? ""
|
||||||
|
property int wifiSignalStrength: activeService?.wifiSignalStrength ?? 0
|
||||||
|
property var wifiNetworks: activeService?.wifiNetworks ?? []
|
||||||
|
property var savedConnections: activeService?.savedConnections ?? []
|
||||||
|
property var ssidToConnectionName: activeService?.ssidToConnectionName ?? ({})
|
||||||
|
property var wifiSignalIcon: activeService?.wifiSignalIcon ?? "wifi_off"
|
||||||
|
|
||||||
|
property string userPreference: activeService?.userPreference ?? "auto"
|
||||||
|
property bool isConnecting: activeService?.isConnecting ?? false
|
||||||
|
property string connectingSSID: activeService?.connectingSSID ?? ""
|
||||||
|
property string connectionError: activeService?.connectionError ?? ""
|
||||||
|
|
||||||
|
property bool isScanning: activeService?.isScanning ?? false
|
||||||
|
property bool autoScan: activeService?.autoScan ?? false
|
||||||
|
|
||||||
|
property bool wifiAvailable: activeService?.wifiAvailable ?? true
|
||||||
|
property bool wifiToggling: activeService?.wifiToggling ?? false
|
||||||
|
property bool changingPreference: activeService?.changingPreference ?? false
|
||||||
|
property string targetPreference: activeService?.targetPreference ?? ""
|
||||||
|
property var savedWifiNetworks: activeService?.savedWifiNetworks ?? []
|
||||||
|
property string connectionStatus: activeService?.connectionStatus ?? ""
|
||||||
|
property string lastConnectionError: activeService?.lastConnectionError ?? ""
|
||||||
|
property bool passwordDialogShouldReopen: activeService?.passwordDialogShouldReopen ?? false
|
||||||
|
property bool autoRefreshEnabled: activeService?.autoRefreshEnabled ?? false
|
||||||
|
property string wifiPassword: activeService?.wifiPassword ?? ""
|
||||||
|
property string forgetSSID: activeService?.forgetSSID ?? ""
|
||||||
|
|
||||||
|
property string networkInfoSSID: activeService?.networkInfoSSID ?? ""
|
||||||
|
property string networkInfoDetails: activeService?.networkInfoDetails ?? ""
|
||||||
|
property bool networkInfoLoading: activeService?.networkInfoLoading ?? false
|
||||||
|
|
||||||
|
property int refCount: activeService?.refCount ?? 0
|
||||||
|
property bool stateInitialized: activeService?.stateInitialized ?? false
|
||||||
|
|
||||||
|
property bool subscriptionConnected: activeService?.subscriptionConnected ?? false
|
||||||
|
|
||||||
|
signal networksUpdated
|
||||||
|
signal connectionChanged
|
||||||
|
|
||||||
|
property bool usingLegacy: false
|
||||||
|
property var activeService: null
|
||||||
|
|
||||||
|
readonly property string socketPath: Quickshell.env("DMS_SOCKET")
|
||||||
|
|
||||||
|
Component.onCompleted: {
|
||||||
|
console.log("NetworkService: Initializing...")
|
||||||
|
if (!socketPath || socketPath.length === 0) {
|
||||||
|
console.log("NetworkService: DMS_SOCKET not set, using LegacyNetworkService")
|
||||||
|
useLegacyService()
|
||||||
|
} else {
|
||||||
|
console.log("NetworkService: DMS_SOCKET found, waiting for capabilities...")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Connections {
|
||||||
|
target: NetworkManagerService
|
||||||
|
|
||||||
|
function onNetworkAvailableChanged() {
|
||||||
|
if (!activeService && NetworkManagerService.networkAvailable) {
|
||||||
|
console.log("NetworkService: Network capability detected, using NetworkManagerService")
|
||||||
|
activeService = NetworkManagerService
|
||||||
|
usingLegacy = false
|
||||||
|
console.log("NetworkService: Switched to NetworkManagerService, networkAvailable:", networkAvailable)
|
||||||
|
connectSignals()
|
||||||
|
} else if (!activeService && !NetworkManagerService.networkAvailable && socketPath && socketPath.length > 0) {
|
||||||
|
console.log("NetworkService: Network capability not available in DMS, using LegacyNetworkService")
|
||||||
|
useLegacyService()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function useLegacyService() {
|
||||||
|
activeService = LegacyNetworkService
|
||||||
|
usingLegacy = true
|
||||||
|
console.log("NetworkService: Switched to LegacyNetworkService, networkAvailable:", networkAvailable)
|
||||||
|
if (LegacyNetworkService.activate) {
|
||||||
|
LegacyNetworkService.activate()
|
||||||
|
}
|
||||||
|
connectSignals()
|
||||||
|
}
|
||||||
|
|
||||||
|
function connectSignals() {
|
||||||
|
if (activeService) {
|
||||||
|
if (activeService.networksUpdated) {
|
||||||
|
activeService.networksUpdated.connect(root.networksUpdated)
|
||||||
|
}
|
||||||
|
if (activeService.connectionChanged) {
|
||||||
|
activeService.connectionChanged.connect(root.connectionChanged)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function addRef() {
|
||||||
|
if (activeService && activeService.addRef) {
|
||||||
|
activeService.addRef()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function removeRef() {
|
||||||
|
if (activeService && activeService.removeRef) {
|
||||||
|
activeService.removeRef()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function getState() {
|
||||||
|
if (activeService && activeService.getState) {
|
||||||
|
activeService.getState()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function scanWifi() {
|
||||||
|
if (activeService && activeService.scanWifi) {
|
||||||
|
activeService.scanWifi()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function scanWifiNetworks() {
|
||||||
|
if (activeService && activeService.scanWifiNetworks) {
|
||||||
|
activeService.scanWifiNetworks()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function connectToWifi(ssid, password = "", username = "") {
|
||||||
|
if (activeService && activeService.connectToWifi) {
|
||||||
|
activeService.connectToWifi(ssid, password, username)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function disconnectWifi() {
|
||||||
|
if (activeService && activeService.disconnectWifi) {
|
||||||
|
activeService.disconnectWifi()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function forgetWifiNetwork(ssid) {
|
||||||
|
if (activeService && activeService.forgetWifiNetwork) {
|
||||||
|
activeService.forgetWifiNetwork(ssid)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function toggleWifiRadio() {
|
||||||
|
if (activeService && activeService.toggleWifiRadio) {
|
||||||
|
activeService.toggleWifiRadio()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function enableWifiDevice() {
|
||||||
|
if (activeService && activeService.enableWifiDevice) {
|
||||||
|
activeService.enableWifiDevice()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function setNetworkPreference(preference) {
|
||||||
|
if (activeService && activeService.setNetworkPreference) {
|
||||||
|
activeService.setNetworkPreference(preference)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function setConnectionPriority(type) {
|
||||||
|
if (activeService && activeService.setConnectionPriority) {
|
||||||
|
activeService.setConnectionPriority(type)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function connectToWifiAndSetPreference(ssid, password, username = "") {
|
||||||
|
if (activeService && activeService.connectToWifiAndSetPreference) {
|
||||||
|
activeService.connectToWifiAndSetPreference(ssid, password, username)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function toggleNetworkConnection(type) {
|
||||||
|
if (activeService && activeService.toggleNetworkConnection) {
|
||||||
|
activeService.toggleNetworkConnection(type)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function startAutoScan() {
|
||||||
|
if (activeService && activeService.startAutoScan) {
|
||||||
|
activeService.startAutoScan()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function stopAutoScan() {
|
||||||
|
if (activeService && activeService.stopAutoScan) {
|
||||||
|
activeService.stopAutoScan()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function fetchNetworkInfo(ssid) {
|
||||||
|
if (activeService && activeService.fetchNetworkInfo) {
|
||||||
|
activeService.fetchNetworkInfo(ssid)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function getNetworkInfo(ssid) {
|
||||||
|
if (activeService && activeService.getNetworkInfo) {
|
||||||
|
return activeService.getNetworkInfo(ssid)
|
||||||
|
}
|
||||||
|
return null
|
||||||
|
}
|
||||||
|
|
||||||
|
function refreshNetworkState() {
|
||||||
|
if (activeService && activeService.refreshNetworkState) {
|
||||||
|
activeService.refreshNetworkState()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -311,28 +311,24 @@ Singleton {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function initializeDMSConnection() {
|
function initializeDMSConnection() {
|
||||||
|
if (!socketPath || socketPath.length === 0) {
|
||||||
|
console.log("SessionService: DMS_SOCKET not set, using fallback")
|
||||||
|
initFallbackLoginctl()
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
dmsService = Qt.createQmlObject('import QtQuick; import qs.Services; QtObject { property var service: DMSService }', root)
|
dmsService = Qt.createQmlObject('import QtQuick; import qs.Services; QtObject { property var service: DMSService }', root)
|
||||||
if (dmsService && dmsService.service) {
|
if (dmsService && dmsService.service) {
|
||||||
checkCapabilities()
|
|
||||||
dmsService.service.connectionStateChanged.connect(onDMSConnectionStateChanged)
|
dmsService.service.connectionStateChanged.connect(onDMSConnectionStateChanged)
|
||||||
dmsService.service.capabilitiesChanged.connect(onDMSCapabilitiesChanged)
|
dmsService.service.capabilitiesChanged.connect(onDMSCapabilitiesChanged)
|
||||||
if (!dmsService.service.isConnected) {
|
checkCapabilities()
|
||||||
Qt.callLater(checkFallback)
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
console.warn("SessionService: Failed to get DMS service reference")
|
console.warn("SessionService: Failed to get DMS service reference, using fallback")
|
||||||
Qt.callLater(checkFallback)
|
initFallbackLoginctl()
|
||||||
}
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.warn("SessionService: Failed to initialize DMS connection:", e)
|
console.warn("SessionService: Failed to initialize DMS connection, using fallback:", e)
|
||||||
Qt.callLater(checkFallback)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function checkFallback() {
|
|
||||||
if (!loginctlAvailable) {
|
|
||||||
console.log("SessionService: DMS not available, using fallback methods")
|
|
||||||
initFallbackLoginctl()
|
initFallbackLoginctl()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -350,12 +346,17 @@ Singleton {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function onDMSCapabilitiesChanged() {
|
function onDMSCapabilitiesChanged() {
|
||||||
if (dmsService && dmsService.service && dmsService.service.capabilities.includes("loginctl")) {
|
if (dmsService && dmsService.service) {
|
||||||
loginctlAvailable = true
|
if (dmsService.service.capabilities.includes("loginctl")) {
|
||||||
if (dmsService.service.isConnected && !stateInitialized) {
|
loginctlAvailable = true
|
||||||
stateInitialized = true
|
if (dmsService.service.isConnected && !stateInitialized) {
|
||||||
getLoginctlState()
|
stateInitialized = true
|
||||||
subscriptionSocket.connected = true
|
getLoginctlState()
|
||||||
|
subscriptionSocket.connected = true
|
||||||
|
}
|
||||||
|
} else if (dmsService.service.capabilities.length > 0 && !loginctlAvailable) {
|
||||||
|
console.log("SessionService: loginctl capability not available in DMS, using fallback")
|
||||||
|
initFallbackLoginctl()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -368,6 +369,9 @@ Singleton {
|
|||||||
stateInitialized = true
|
stateInitialized = true
|
||||||
getLoginctlState()
|
getLoginctlState()
|
||||||
subscriptionSocket.connected = true
|
subscriptionSocket.connected = true
|
||||||
|
} else if (!loginctlAvailable) {
|
||||||
|
console.log("SessionService: loginctl capability not available in DMS, using fallback")
|
||||||
|
initFallbackLoginctl()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user