mirror of
https://github.com/noctalia-dev/noctalia-shell.git
synced 2026-05-11 17:08:27 +08:00
autofmt+settings db
This commit is contained in:
@@ -377,6 +377,62 @@
|
||||
"subTab": 1,
|
||||
"subTabLabel": "common.templates"
|
||||
},
|
||||
{
|
||||
"labelKey": "common.bluetooth",
|
||||
"descriptionKey": null,
|
||||
"widget": "NLabel",
|
||||
"tab": 15,
|
||||
"tabLabel": "panels.connections.title",
|
||||
"subTab": null
|
||||
},
|
||||
{
|
||||
"labelKey": "panels.connections.hide-unnamed-devices-label",
|
||||
"descriptionKey": "panels.connections.hide-unnamed-devices-description",
|
||||
"widget": "NToggle",
|
||||
"tab": 15,
|
||||
"tabLabel": "panels.connections.title",
|
||||
"subTab": null
|
||||
},
|
||||
{
|
||||
"labelKey": "panels.connections.disable-discoverability-label",
|
||||
"descriptionKey": "panels.connections.disable-discoverability-description",
|
||||
"widget": "NToggle",
|
||||
"tab": 15,
|
||||
"tabLabel": "panels.connections.title",
|
||||
"subTab": null
|
||||
},
|
||||
{
|
||||
"labelKey": "panels.connections.bluetooth-rssi-polling-label",
|
||||
"descriptionKey": "panels.connections.bluetooth-rssi-polling-description",
|
||||
"widget": "NToggle",
|
||||
"tab": 15,
|
||||
"tabLabel": "panels.connections.title",
|
||||
"subTab": null
|
||||
},
|
||||
{
|
||||
"labelKey": "panels.connections.bluetooth-rssi-polling-interval-label",
|
||||
"descriptionKey": "panels.connections.bluetooth-rssi-polling-interval-description",
|
||||
"widget": "NSpinBox",
|
||||
"tab": 15,
|
||||
"tabLabel": "panels.connections.title",
|
||||
"subTab": null
|
||||
},
|
||||
{
|
||||
"labelKey": "toast.airplane-mode.title",
|
||||
"descriptionKey": null,
|
||||
"widget": "NLabel",
|
||||
"tab": 15,
|
||||
"tabLabel": "panels.connections.title",
|
||||
"subTab": null
|
||||
},
|
||||
{
|
||||
"labelKey": "common.wifi",
|
||||
"descriptionKey": null,
|
||||
"widget": "NLabel",
|
||||
"tab": 15,
|
||||
"tabLabel": "panels.connections.title",
|
||||
"subTab": null
|
||||
},
|
||||
{
|
||||
"labelKey": "common.position",
|
||||
"descriptionKey": "panels.control-center.position-description",
|
||||
@@ -1036,51 +1092,6 @@
|
||||
"subTab": 0,
|
||||
"subTabLabel": "common.appearance"
|
||||
},
|
||||
{
|
||||
"labelKey": "actions.enable-wifi",
|
||||
"descriptionKey": "panels.connections.wifi-description",
|
||||
"widget": "NToggle",
|
||||
"tab": 15,
|
||||
"tabLabel": "panels.connections.title",
|
||||
"subTab": 0,
|
||||
"subTabLabel": "common.wifi"
|
||||
},
|
||||
{
|
||||
"labelKey": "actions.enable-bluetooth",
|
||||
"descriptionKey": "panels.connections.bluetooth-description",
|
||||
"widget": "NToggle",
|
||||
"tab": 15,
|
||||
"tabLabel": "panels.connections.title",
|
||||
"subTab": 1,
|
||||
"subTabLabel": "common.bluetooth"
|
||||
},
|
||||
{
|
||||
"labelKey": "panels.connections.hide-unnamed-devices-label",
|
||||
"descriptionKey": "panels.connections.hide-unnamed-devices-description",
|
||||
"widget": "NToggle",
|
||||
"tab": 15,
|
||||
"tabLabel": "panels.connections.title",
|
||||
"subTab": 1,
|
||||
"subTabLabel": "common.bluetooth"
|
||||
},
|
||||
{
|
||||
"labelKey": "panels.connections.disable-discoverability-label",
|
||||
"descriptionKey": "panels.connections.disable-discoverability-description",
|
||||
"widget": "NToggle",
|
||||
"tab": 15,
|
||||
"tabLabel": "panels.connections.title",
|
||||
"subTab": 1,
|
||||
"subTabLabel": "common.bluetooth"
|
||||
},
|
||||
{
|
||||
"labelKey": "panels.connections.bluetooth-rssi-polling-label",
|
||||
"descriptionKey": "panels.connections.bluetooth-rssi-polling-description",
|
||||
"widget": "NToggle",
|
||||
"tab": 15,
|
||||
"tabLabel": "panels.connections.title",
|
||||
"subTab": 1,
|
||||
"subTabLabel": "common.bluetooth"
|
||||
},
|
||||
{
|
||||
"labelKey": "panels.notifications.duration-respect-expire-label",
|
||||
"descriptionKey": "panels.notifications.duration-respect-expire-description",
|
||||
|
||||
@@ -71,7 +71,7 @@ Item {
|
||||
NetworkService.setWifiEnabled(!Settings.data.network.wifiEnabled);
|
||||
} else if (action === "wifi-settings") {
|
||||
SettingsPanelService.openToTab(SettingsPanel.Tab.Connections, 0, screen);
|
||||
}else if (action === "widget-settings") {
|
||||
} else if (action === "widget-settings") {
|
||||
BarService.openWidgetSettings(screen, section, sectionWidgetIndex, widgetId, widgetSettings);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,7 +17,7 @@ NIconButtonHot {
|
||||
}
|
||||
onRightClicked: {
|
||||
if (!Settings.data.network.airplaneModeEnabled) {
|
||||
BluetoothService.setBluetoothEnabled(!BluetoothService.enabled)
|
||||
BluetoothService.setBluetoothEnabled(!BluetoothService.enabled);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -54,7 +54,7 @@ NIconButtonHot {
|
||||
}
|
||||
onRightClicked: {
|
||||
if (!Settings.data.network.airplaneModeEnabled) {
|
||||
NetworkService.setWifiEnabled(!Settings.data.network.wifiEnabled)
|
||||
NetworkService.setWifiEnabled(!Settings.data.network.wifiEnabled);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -183,7 +183,9 @@ Item {
|
||||
}
|
||||
|
||||
NText {
|
||||
text: I18n.tr("panels.connections.bluetooth-discoverable", {hostName: HostService.hostName})
|
||||
text: I18n.tr("panels.connections.bluetooth-discoverable", {
|
||||
hostName: HostService.hostName
|
||||
})
|
||||
visible: (BluetoothService.enabled && isDiscoverable)
|
||||
richTextEnabled: true
|
||||
wrapMode: Text.WordWrap
|
||||
@@ -328,9 +330,9 @@ Item {
|
||||
description: I18n.tr("panels.connections.disable-discoverability-description")
|
||||
checked: Settings.data.network.disableDiscoverability
|
||||
onToggled: checked => {
|
||||
Settings.data.network.disableDiscoverability = checked;
|
||||
BluetoothService.setDiscoverable(!checked);
|
||||
}
|
||||
Settings.data.network.disableDiscoverability = checked;
|
||||
BluetoothService.setDiscoverable(!checked);
|
||||
}
|
||||
Layout.alignment: Qt.AlignVCenter
|
||||
visible: !btprefs.showOnlyLists && BluetoothService.enabled
|
||||
}
|
||||
|
||||
@@ -100,4 +100,4 @@ Item {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -165,11 +165,17 @@ Singleton {
|
||||
}
|
||||
|
||||
function isBluetoothDevice(device) {
|
||||
if (!device) {return false;}
|
||||
if (!device) {
|
||||
return false;
|
||||
}
|
||||
// Check for Quickshell Bluetooth device property
|
||||
if (device.batteryAvailable !== undefined) {return true;}
|
||||
if (device.batteryAvailable !== undefined) {
|
||||
return true;
|
||||
}
|
||||
// Check for UPower device path indicating it's a Bluetooth device
|
||||
if (device.nativePath && (device.nativePath.includes("bluez") || device.nativePath.includes("bluetooth"))) {return true;}
|
||||
if (device.nativePath && (device.nativePath.includes("bluez") || device.nativePath.includes("bluetooth"))) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -146,8 +146,8 @@ Singleton {
|
||||
stdout: StdioCollector {
|
||||
onStreamFinished: {
|
||||
var output = this.text || "";
|
||||
var wifiBlocked = /^\d+:.*Wireless LAN[^\n]*\n\s*Soft blocked:\s*yes/im.test(output)
|
||||
var btBlocked = /^\d+:.*Bluetooth[^\n]*\n\s*Soft blocked:\s*yes/im.test(output)
|
||||
var wifiBlocked = /^\d+:.*Wireless LAN[^\n]*\n\s*Soft blocked:\s*yes/im.test(output);
|
||||
var btBlocked = /^\d+:.*Bluetooth[^\n]*\n\s*Soft blocked:\s*yes/im.test(output);
|
||||
var isAirplaneModeActive = wifiBlocked && btBlocked;
|
||||
|
||||
// Check if airplane mode has been toggled
|
||||
@@ -156,13 +156,13 @@ Singleton {
|
||||
NetworkService.setWifiEnabled(false);
|
||||
Settings.data.network.airplaneModeEnabled = true;
|
||||
ToastService.showNotice(I18n.tr("toast.airplane-mode.title"), I18n.tr("common.enabled"), "plane");
|
||||
Logger.i("AirplaneMode", "Wi-Fi & Bluetooth adapter blocked")
|
||||
Logger.i("AirplaneMode", "Wi-Fi & Bluetooth adapter blocked");
|
||||
} else if (!isAirplaneModeActive && root.airplaneModeEnabled) {
|
||||
root.airplaneModeToggled = true;
|
||||
NetworkService.setWifiEnabled(true);
|
||||
Settings.data.network.airplaneModeEnabled = false;
|
||||
ToastService.showNotice(I18n.tr("toast.airplane-mode.title"), I18n.tr("common.disabled"), "plane-off");
|
||||
Logger.i("AirplaneMode", "Wi-Fi & Bluetooth adapter unblocked")
|
||||
Logger.i("AirplaneMode", "Wi-Fi & Bluetooth adapter unblocked");
|
||||
} else {
|
||||
var isCurrentlyEnabled = (adapter && adapter.enabled) || root.ctlPowered;
|
||||
var stateChanged = isCurrentlyEnabled !== root._lastEnabledState;
|
||||
@@ -192,7 +192,9 @@ Singleton {
|
||||
Process {
|
||||
id: ctlShowProcess
|
||||
running: false
|
||||
stdout: StdioCollector { id: ctlStdout }
|
||||
stdout: StdioCollector {
|
||||
id: ctlStdout
|
||||
}
|
||||
onExited: function (exitCode, exitStatus) {
|
||||
try {
|
||||
var text = ctlStdout.text || "";
|
||||
@@ -208,13 +210,19 @@ Singleton {
|
||||
foundController = true;
|
||||
}
|
||||
var mp = line.match(/\bPowered:\s*(yes|no)\b/i);
|
||||
if (mp) { powered = (mp[1].toLowerCase() === "yes"); }
|
||||
if (mp) {
|
||||
powered = (mp[1].toLowerCase() === "yes");
|
||||
}
|
||||
|
||||
var md = line.match(/\bDiscoverable:\s*(yes|no)\b/i);
|
||||
if (md) { discoverable = (md[1].toLowerCase() === "yes"); }
|
||||
if (md) {
|
||||
discoverable = (md[1].toLowerCase() === "yes");
|
||||
}
|
||||
|
||||
var ms = line.match(/\bDiscovering:\s*(yes|no)\b/i);
|
||||
if (ms) { discovering = (ms[1].toLowerCase() === "yes"); }
|
||||
if (ms) {
|
||||
discovering = (ms[1].toLowerCase() === "yes");
|
||||
}
|
||||
}
|
||||
root.ctlAvailable = foundController; // Assign findings.
|
||||
root.ctlPowered = powered; // Assign findings.
|
||||
@@ -502,10 +510,14 @@ Singleton {
|
||||
return "";
|
||||
}
|
||||
try {
|
||||
if (device.pairing) return "pairing";
|
||||
if (device.blocked) return "blocked";
|
||||
if (device.state === BluetoothDevice.Connecting) return "connecting";
|
||||
if (device.state === BluetoothDevice.Disconnecting) return "disconnecting";
|
||||
if (device.pairing)
|
||||
return "pairing";
|
||||
if (device.blocked)
|
||||
return "blocked";
|
||||
if (device.state === BluetoothDevice.Connecting)
|
||||
return "connecting";
|
||||
if (device.state === BluetoothDevice.Disconnecting)
|
||||
return "disconnecting";
|
||||
} catch (_) {}
|
||||
return "";
|
||||
}
|
||||
|
||||
@@ -851,7 +851,7 @@ Singleton {
|
||||
for (var i = 0; i < parts.length; i++) {
|
||||
var p = parts[i];
|
||||
if (p && p.length > 0) {
|
||||
compact.push(p);
|
||||
compact.push(p);
|
||||
}
|
||||
}
|
||||
// Find a token that represents Mbit/s and use the previous number
|
||||
@@ -1270,8 +1270,8 @@ Singleton {
|
||||
root.connectingTo = "";
|
||||
Logger.i("Network", "Connected to network: '" + connectProcess.ssid + "'");
|
||||
ToastService.showNotice(I18n.tr("common.wifi"), I18n.tr("toast.wifi.connected", {
|
||||
"ssid": connectProcess.ssid
|
||||
}), "wifi");
|
||||
"ssid": connectProcess.ssid
|
||||
}), "wifi");
|
||||
|
||||
// Still do a scan to get accurate signal and security info
|
||||
delayedScanTimer.interval = 5000;
|
||||
@@ -1316,8 +1316,8 @@ Singleton {
|
||||
onStreamFinished: {
|
||||
Logger.i("Network", "Disconnected from network: '" + disconnectProcess.ssid + "'");
|
||||
ToastService.showNotice(I18n.tr("common.wifi"), I18n.tr("toast.wifi.disconnected", {
|
||||
"ssid": disconnectProcess.ssid
|
||||
}), "wifi-off");
|
||||
"ssid": disconnectProcess.ssid
|
||||
}), "wifi-off");
|
||||
|
||||
// Immediately update UI on successful disconnect
|
||||
root.updateNetworkStatus(disconnectProcess.ssid, false);
|
||||
|
||||
Reference in New Issue
Block a user