mirror of
https://github.com/AvengeMedia/DankMaterialShell.git
synced 2026-01-24 21:42:51 -05:00
i18n: general term cleanup, add missing terms, interpolate some
This commit is contained in:
@@ -12,7 +12,7 @@ PluginComponent {
|
||||
}
|
||||
|
||||
ccWidgetIcon: DMSNetworkService.isBusy ? "sync" : (DMSNetworkService.connected ? "vpn_lock" : "vpn_key_off")
|
||||
ccWidgetPrimaryText: "VPN"
|
||||
ccWidgetPrimaryText: I18n.tr("VPN")
|
||||
ccWidgetSecondaryText: {
|
||||
if (!DMSNetworkService.connected)
|
||||
return I18n.tr("Disconnected");
|
||||
|
||||
@@ -51,13 +51,13 @@ Rectangle {
|
||||
spacing: 2
|
||||
|
||||
Typography {
|
||||
text: UserInfoService.fullName || UserInfoService.username || "User"
|
||||
text: UserInfoService.fullName || UserInfoService.username || I18n.tr("User")
|
||||
style: Typography.Style.Subtitle
|
||||
color: Theme.surfaceText
|
||||
}
|
||||
|
||||
Typography {
|
||||
text: DgopService.uptime || "Unknown"
|
||||
text: DgopService.uptime || I18n.tr("Unknown")
|
||||
style: Typography.Style.Caption
|
||||
color: Theme.surfaceVariantText
|
||||
}
|
||||
|
||||
@@ -201,7 +201,7 @@ Rectangle {
|
||||
}
|
||||
|
||||
StyledText {
|
||||
text: modelData === AudioService.source ? "Active" : "Available"
|
||||
text: modelData === AudioService.source ? I18n.tr("Active") : I18n.tr("Available")
|
||||
font.pixelSize: Theme.fontSizeSmall
|
||||
color: Theme.surfaceVariantText
|
||||
elide: Text.ElideRight
|
||||
@@ -241,7 +241,7 @@ Rectangle {
|
||||
StyledText {
|
||||
text: {
|
||||
const isThisDevicePinned = (SettingsData.audioInputDevicePins || {})["preferredInput"] === modelData.name;
|
||||
return isThisDevicePinned ? "Pinned" : "Pin";
|
||||
return isThisDevicePinned ? I18n.tr("Pinned") : I18n.tr("Pin");
|
||||
}
|
||||
font.pixelSize: Theme.fontSizeSmall
|
||||
color: {
|
||||
|
||||
@@ -211,7 +211,7 @@ Rectangle {
|
||||
}
|
||||
|
||||
StyledText {
|
||||
text: modelData === AudioService.sink ? "Active" : "Available"
|
||||
text: modelData === AudioService.sink ? I18n.tr("Active") : I18n.tr("Available")
|
||||
font.pixelSize: Theme.fontSizeSmall
|
||||
color: Theme.surfaceVariantText
|
||||
elide: Text.ElideRight
|
||||
@@ -251,7 +251,7 @@ Rectangle {
|
||||
StyledText {
|
||||
text: {
|
||||
const isThisDevicePinned = (SettingsData.audioOutputDevicePins || {})["preferredOutput"] === modelData.name;
|
||||
return isThisDevicePinned ? "Pinned" : "Pin";
|
||||
return isThisDevicePinned ? I18n.tr("Pinned") : I18n.tr("Pin");
|
||||
}
|
||||
font.pixelSize: Theme.fontSizeSmall
|
||||
color: {
|
||||
|
||||
@@ -1,6 +1,4 @@
|
||||
import QtQuick
|
||||
import QtQuick.Controls
|
||||
import Quickshell
|
||||
import Quickshell.Services.UPower
|
||||
import qs.Common
|
||||
import qs.Services
|
||||
@@ -66,7 +64,7 @@ Rectangle {
|
||||
spacing: Theme.spacingS
|
||||
|
||||
StyledText {
|
||||
text: BatteryService.batteryAvailable ? `${BatteryService.batteryLevel}%` : "Power"
|
||||
text: BatteryService.batteryAvailable ? `${BatteryService.batteryLevel}%` : I18n.tr("Power")
|
||||
font.pixelSize: Theme.fontSizeXLarge
|
||||
color: {
|
||||
if (BatteryService.isLowBattery && !BatteryService.isCharging) {
|
||||
@@ -81,7 +79,7 @@ Rectangle {
|
||||
}
|
||||
|
||||
StyledText {
|
||||
text: BatteryService.batteryAvailable ? BatteryService.batteryStatus : "Management"
|
||||
text: BatteryService.batteryAvailable ? BatteryService.batteryStatus : I18n.tr("Management")
|
||||
font.pixelSize: Theme.fontSizeLarge
|
||||
color: {
|
||||
if (BatteryService.isLowBattery && !BatteryService.isCharging) {
|
||||
@@ -100,10 +98,10 @@ Rectangle {
|
||||
StyledText {
|
||||
text: {
|
||||
if (!BatteryService.batteryAvailable)
|
||||
return "Power profile management available";
|
||||
return I18n.tr("Power profile management available");
|
||||
const time = BatteryService.formatTimeRemaining();
|
||||
if (time !== "Unknown") {
|
||||
return BatteryService.isCharging ? `Time until full: ${time}` : `Time remaining: ${time}`;
|
||||
return BatteryService.isCharging ? I18n.tr("Time until full: %1").arg(time) : I18n.tr("Time remaining: %1").arg(time);
|
||||
}
|
||||
return "";
|
||||
}
|
||||
@@ -176,7 +174,7 @@ Rectangle {
|
||||
}
|
||||
|
||||
StyledText {
|
||||
text: BatteryService.batteryCapacity > 0 ? `${BatteryService.batteryCapacity.toFixed(1)} Wh` : "Unknown"
|
||||
text: BatteryService.batteryCapacity > 0 ? `${BatteryService.batteryCapacity.toFixed(1)} Wh` : I18n.tr("Unknown")
|
||||
font.pixelSize: Theme.fontSizeLarge
|
||||
color: Theme.surfaceText
|
||||
font.weight: Font.Bold
|
||||
|
||||
@@ -1,7 +1,4 @@
|
||||
import QtQuick
|
||||
import QtQuick.Controls
|
||||
import Quickshell
|
||||
import Quickshell.Io
|
||||
import qs.Common
|
||||
import qs.Services
|
||||
import qs.Widgets
|
||||
@@ -42,7 +39,7 @@ Item {
|
||||
if (!device)
|
||||
return;
|
||||
|
||||
BluetoothService.getAvailableCodecs(device, function(codecs, current) {
|
||||
BluetoothService.getAvailableCodecs(device, function (codecs, current) {
|
||||
availableCodecs = codecs;
|
||||
currentCodec = current;
|
||||
isLoading = false;
|
||||
@@ -60,7 +57,7 @@ Item {
|
||||
}
|
||||
|
||||
isLoading = true;
|
||||
BluetoothService.switchCodec(device, profileName, function(success, message) {
|
||||
BluetoothService.switchCodec(device, profileName, function (success, message) {
|
||||
isLoading = false;
|
||||
if (success) {
|
||||
ToastService.showToast(message, ToastService.levelInfo);
|
||||
@@ -85,8 +82,12 @@ Item {
|
||||
propagateComposedEvents: false
|
||||
|
||||
onClicked: root.hide()
|
||||
onWheel: (wheel) => { wheel.accepted = true }
|
||||
onPositionChanged: (mouse) => { mouse.accepted = true }
|
||||
onWheel: wheel => {
|
||||
wheel.accepted = true;
|
||||
}
|
||||
onPositionChanged: mouse => {
|
||||
mouse.accepted = true;
|
||||
}
|
||||
}
|
||||
|
||||
Rectangle {
|
||||
@@ -111,8 +112,8 @@ Item {
|
||||
enabled: root.visible
|
||||
|
||||
Keys.onEscapePressed: {
|
||||
root.hide()
|
||||
event.accepted = true
|
||||
root.hide();
|
||||
event.accepted = true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -133,9 +134,15 @@ Item {
|
||||
hoverEnabled: true
|
||||
preventStealing: true
|
||||
propagateComposedEvents: false
|
||||
onClicked: (mouse) => { mouse.accepted = true }
|
||||
onWheel: (wheel) => { wheel.accepted = true }
|
||||
onPositionChanged: (mouse) => { mouse.accepted = true }
|
||||
onClicked: mouse => {
|
||||
mouse.accepted = true;
|
||||
}
|
||||
onWheel: wheel => {
|
||||
wheel.accepted = true;
|
||||
}
|
||||
onPositionChanged: mouse => {
|
||||
mouse.accepted = true;
|
||||
}
|
||||
}
|
||||
|
||||
Column {
|
||||
@@ -174,9 +181,7 @@ Item {
|
||||
font.pixelSize: Theme.fontSizeSmall
|
||||
color: Theme.surfaceTextMedium
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Rectangle {
|
||||
@@ -186,7 +191,7 @@ Item {
|
||||
}
|
||||
|
||||
StyledText {
|
||||
text: isLoading ? "Loading codecs..." : `Current: ${currentCodec}`
|
||||
text: isLoading ? I18n.tr("Loading codecs...") : I18n.tr("Current: %1").arg(currentCodec)
|
||||
font.pixelSize: Theme.fontSizeSmall
|
||||
color: isLoading ? Theme.primary : Theme.surfaceTextMedium
|
||||
font.weight: Font.Medium
|
||||
@@ -245,9 +250,7 @@ Item {
|
||||
font.pixelSize: Theme.fontSizeSmall
|
||||
color: Theme.surfaceTextMedium
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
DankIcon {
|
||||
@@ -271,14 +274,9 @@ Item {
|
||||
selectCodec(modelData.profile);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Behavior on opacity {
|
||||
@@ -286,7 +284,6 @@ Item {
|
||||
duration: Theme.mediumDuration
|
||||
easing.type: Theme.emphasizedEasing
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Behavior on scale {
|
||||
@@ -294,8 +291,6 @@ Item {
|
||||
duration: Theme.mediumDuration
|
||||
easing.type: Theme.emphasizedEasing
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -113,7 +113,7 @@ Rectangle {
|
||||
}
|
||||
|
||||
StyledText {
|
||||
text: BluetoothService.adapter && BluetoothService.adapter.discovering ? "Scanning" : "Scan"
|
||||
text: BluetoothService.adapter && BluetoothService.adapter.discovering ? I18n.tr("Scanning") : I18n.tr("Scan")
|
||||
color: BluetoothService.adapter && BluetoothService.adapter.enabled ? Theme.primary : Theme.surfaceVariantText
|
||||
font.pixelSize: Theme.fontSizeMedium
|
||||
font.weight: Font.Medium
|
||||
@@ -231,7 +231,7 @@ Rectangle {
|
||||
width: 200
|
||||
|
||||
StyledText {
|
||||
text: modelData.name || modelData.deviceName || "Unknown Device"
|
||||
text: modelData.name || modelData.deviceName || I18n.tr("Unknown Device")
|
||||
font.pixelSize: Theme.fontSizeMedium
|
||||
color: Theme.surfaceText
|
||||
font.weight: modelData.connected ? Font.Medium : Font.Normal
|
||||
@@ -245,15 +245,15 @@ Rectangle {
|
||||
StyledText {
|
||||
text: {
|
||||
if (modelData.state === BluetoothDeviceState.Connecting)
|
||||
return "Connecting..."
|
||||
return I18n.tr("Connecting...")
|
||||
if (modelData.connected) {
|
||||
let status = "Connected"
|
||||
let status = I18n.tr("Connected")
|
||||
if (currentCodec) {
|
||||
status += " • " + currentCodec
|
||||
}
|
||||
return status
|
||||
}
|
||||
return "Paired"
|
||||
return I18n.tr("Paired")
|
||||
}
|
||||
font.pixelSize: Theme.fontSizeSmall
|
||||
color: {
|
||||
@@ -320,7 +320,7 @@ Rectangle {
|
||||
StyledText {
|
||||
text: {
|
||||
const isThisDevicePinned = (SettingsData.bluetoothDevicePins || {})["preferredDevice"] === modelData.address
|
||||
return isThisDevicePinned ? "Pinned" : "Pin"
|
||||
return isThisDevicePinned ? I18n.tr("Pinned") : I18n.tr("Pin")
|
||||
}
|
||||
font.pixelSize: Theme.fontSizeSmall
|
||||
color: {
|
||||
@@ -458,7 +458,7 @@ Rectangle {
|
||||
width: 200
|
||||
|
||||
StyledText {
|
||||
text: modelData.name || modelData.deviceName || "Unknown Device"
|
||||
text: modelData.name || modelData.deviceName || I18n.tr("Unknown Device")
|
||||
font.pixelSize: Theme.fontSizeMedium
|
||||
color: Theme.surfaceText
|
||||
elide: Text.ElideRight
|
||||
@@ -470,8 +470,8 @@ Rectangle {
|
||||
|
||||
StyledText {
|
||||
text: {
|
||||
if (modelData.pairing || isBusy) return "Pairing..."
|
||||
if (modelData.blocked) return "Blocked"
|
||||
if (modelData.pairing || isBusy) return I18n.tr("Pairing...")
|
||||
if (modelData.blocked) return I18n.tr("Blocked")
|
||||
return BluetoothService.getSignalStrength(modelData)
|
||||
}
|
||||
font.pixelSize: Theme.fontSizeSmall
|
||||
@@ -493,9 +493,9 @@ Rectangle {
|
||||
anchors.rightMargin: Theme.spacingM
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
text: {
|
||||
if (isBusy) return "Pairing..."
|
||||
if (!canConnect) return "Cannot pair"
|
||||
return "Pair"
|
||||
if (isBusy) return I18n.tr("Pairing...")
|
||||
if (!canConnect) return I18n.tr("Cannot pair")
|
||||
return I18n.tr("Pair")
|
||||
}
|
||||
font.pixelSize: Theme.fontSizeSmall
|
||||
color: (canConnect && !isBusy) ? Theme.primary : Theme.surfaceVariantText
|
||||
@@ -546,7 +546,7 @@ Rectangle {
|
||||
}
|
||||
|
||||
MenuItem {
|
||||
text: bluetoothContextMenu.currentDevice && bluetoothContextMenu.currentDevice.connected ? "Disconnect" : "Connect"
|
||||
text: bluetoothContextMenu.currentDevice && bluetoothContextMenu.currentDevice.connected ? I18n.tr("Disconnect") : I18n.tr("Connect")
|
||||
height: 32
|
||||
|
||||
contentItem: StyledText {
|
||||
|
||||
@@ -141,7 +141,7 @@ Rectangle {
|
||||
|
||||
StyledText {
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
text: DisplayService.brightnessAvailable ? "No brightness devices available" : "Brightness control not available"
|
||||
text: DisplayService.brightnessAvailable ? I18n.tr("No brightness devices available") : I18n.tr("Brightness control not available")
|
||||
font.pixelSize: Theme.fontSizeMedium
|
||||
color: Theme.surfaceText
|
||||
horizontalAlignment: Text.AlignHCenter
|
||||
@@ -173,7 +173,7 @@ Rectangle {
|
||||
}
|
||||
|
||||
StyledText {
|
||||
text: root.getScreenPinKey() || "Unknown Monitor"
|
||||
text: root.getScreenPinKey() || I18n.tr("Unknown Monitor")
|
||||
font.pixelSize: Theme.fontSizeMedium
|
||||
color: Theme.surfaceText
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
@@ -201,7 +201,7 @@ Rectangle {
|
||||
}
|
||||
|
||||
StyledText {
|
||||
text: isPinnedToScreen ? "Pinned" : "Pin"
|
||||
text: isPinnedToScreen ? I18n.tr("Pinned") : I18n.tr("Pin")
|
||||
font.pixelSize: Theme.fontSizeSmall
|
||||
color: isPinnedToScreen ? Theme.primary : Theme.surfaceText
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
@@ -317,11 +317,11 @@ Rectangle {
|
||||
text: {
|
||||
const deviceClass = modelData.class || "";
|
||||
if (deviceClass === "backlight")
|
||||
return "Backlight device";
|
||||
return I18n.tr("Backlight device");
|
||||
if (deviceClass === "ddc")
|
||||
return "DDC/CI monitor";
|
||||
return I18n.tr("DDC/CI monitor");
|
||||
if (deviceClass === "leds")
|
||||
return "LED device";
|
||||
return I18n.tr("LED device");
|
||||
return deviceClass;
|
||||
}
|
||||
font.pixelSize: Theme.fontSizeSmall
|
||||
@@ -430,7 +430,7 @@ Rectangle {
|
||||
}
|
||||
|
||||
StyledText {
|
||||
text: SessionData.getBrightnessExponential(modelData.name) ? "Exponential" : "Linear"
|
||||
text: SessionData.getBrightnessExponential(modelData.name) ? I18n.tr("Exponential") : I18n.tr("Linear")
|
||||
font.pixelSize: Theme.fontSizeSmall
|
||||
color: SessionData.getBrightnessExponential(modelData.name) ? Theme.primary : Theme.surfaceText
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
|
||||
@@ -1,6 +1,4 @@
|
||||
import QtQuick
|
||||
import QtQuick.Controls
|
||||
import Quickshell
|
||||
import qs.Common
|
||||
import qs.Services
|
||||
import qs.Widgets
|
||||
@@ -20,11 +18,11 @@ Rectangle {
|
||||
border.width: 0
|
||||
|
||||
Component.onCompleted: {
|
||||
DgopService.addRef(["diskmounts"])
|
||||
DgopService.addRef(["diskmounts"]);
|
||||
}
|
||||
|
||||
Component.onDestruction: {
|
||||
DgopService.removeRef(["diskmounts"])
|
||||
DgopService.removeRef(["diskmounts"]);
|
||||
}
|
||||
|
||||
DankFlickable {
|
||||
@@ -61,7 +59,7 @@ Rectangle {
|
||||
|
||||
StyledText {
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
text: DgopService.dgopAvailable ? "No disk data available" : "dgop not available"
|
||||
text: DgopService.dgopAvailable ? I18n.tr("No disk data available") : I18n.tr("dgop not available")
|
||||
font.pixelSize: Theme.fontSizeMedium
|
||||
color: Theme.surfaceText
|
||||
horizontalAlignment: Text.AlignHCenter
|
||||
@@ -96,20 +94,22 @@ Rectangle {
|
||||
name: "storage"
|
||||
size: Theme.iconSize
|
||||
color: {
|
||||
const percentStr = modelData.percent?.replace("%", "") || "0"
|
||||
const percent = parseFloat(percentStr) || 0
|
||||
if (percent > 90) return Theme.error
|
||||
if (percent > 75) return Theme.warning
|
||||
return modelData.mount === currentMountPath ? Theme.primary : Theme.surfaceText
|
||||
const percentStr = modelData.percent?.replace("%", "") || "0";
|
||||
const percent = parseFloat(percentStr) || 0;
|
||||
if (percent > 90)
|
||||
return Theme.error;
|
||||
if (percent > 75)
|
||||
return Theme.warning;
|
||||
return modelData.mount === currentMountPath ? Theme.primary : Theme.surfaceText;
|
||||
}
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
}
|
||||
|
||||
StyledText {
|
||||
text: {
|
||||
const percentStr = modelData.percent?.replace("%", "") || "0"
|
||||
const percent = parseFloat(percentStr) || 0
|
||||
return percent.toFixed(0) + "%"
|
||||
const percentStr = modelData.percent?.replace("%", "") || "0";
|
||||
const percent = parseFloat(percentStr) || 0;
|
||||
return percent.toFixed(0) + "%";
|
||||
}
|
||||
font.pixelSize: Theme.fontSizeSmall
|
||||
color: Theme.surfaceText
|
||||
@@ -122,7 +122,7 @@ Rectangle {
|
||||
width: parent.parent.width - parent.parent.anchors.leftMargin - parent.spacing - 50 - Theme.spacingM
|
||||
|
||||
StyledText {
|
||||
text: modelData.mount === "/" ? "Root Filesystem" : modelData.mount
|
||||
text: modelData.mount === "/" ? I18n.tr("Root Filesystem") : modelData.mount
|
||||
font.pixelSize: Theme.fontSizeMedium
|
||||
color: Theme.surfaceText
|
||||
font.weight: modelData.mount === currentMountPath ? Font.Medium : Font.Normal
|
||||
@@ -154,11 +154,10 @@ Rectangle {
|
||||
hoverEnabled: true
|
||||
cursorShape: Qt.PointingHandCursor
|
||||
onClicked: {
|
||||
currentMountPath = modelData.mount
|
||||
mountPathChanged(modelData.mount)
|
||||
currentMountPath = modelData.mount;
|
||||
mountPathChanged(modelData.mount);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -118,7 +118,7 @@ Rectangle {
|
||||
buttonHeight: 28
|
||||
textSize: Theme.fontSizeSmall
|
||||
|
||||
model: ["Ethernet", "WiFi"]
|
||||
model: [I18n.tr("Ethernet"), I18n.tr("WiFi")]
|
||||
currentIndex: currentPreferenceIndex
|
||||
selectionMode: "single"
|
||||
onSelectionChanged: (index, selected) => {
|
||||
@@ -173,7 +173,7 @@ Rectangle {
|
||||
|
||||
StyledText {
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
text: NetworkService.wifiEnabled ? "Disabling WiFi..." : "Enabling WiFi..."
|
||||
text: NetworkService.wifiEnabled ? I18n.tr("Disabling WiFi...") : I18n.tr("Enabling WiFi...")
|
||||
font.pixelSize: Theme.fontSizeMedium
|
||||
color: Theme.surfaceText
|
||||
horizontalAlignment: Text.AlignHCenter
|
||||
@@ -303,7 +303,7 @@ Rectangle {
|
||||
width: 200
|
||||
|
||||
StyledText {
|
||||
text: modelData.id || "Unknown Config"
|
||||
text: modelData.id || I18n.tr("Unknown Config")
|
||||
font.pixelSize: Theme.fontSizeMedium
|
||||
color: modelData.isActive ? Theme.primary : Theme.surfaceText
|
||||
font.weight: modelData.isActive ? Font.Medium : Font.Normal
|
||||
@@ -549,7 +549,7 @@ Rectangle {
|
||||
width: 200
|
||||
|
||||
StyledText {
|
||||
text: modelData.ssid || "Unknown Network"
|
||||
text: modelData.ssid || I18n.tr("Unknown Network")
|
||||
font.pixelSize: Theme.fontSizeMedium
|
||||
color: Theme.surfaceText
|
||||
font.weight: modelData.ssid === NetworkService.currentWifiSSID ? Font.Medium : Font.Normal
|
||||
@@ -561,13 +561,13 @@ Rectangle {
|
||||
spacing: Theme.spacingXS
|
||||
|
||||
StyledText {
|
||||
text: modelData.ssid === NetworkService.currentWifiSSID ? "Connected •" : (modelData.secured ? "Secured •" : "Open •")
|
||||
text: modelData.ssid === NetworkService.currentWifiSSID ? I18n.tr("Connected") + " •" : (modelData.secured ? I18n.tr("Secured") + " •" : I18n.tr("Open") + " •")
|
||||
font.pixelSize: Theme.fontSizeSmall
|
||||
color: Theme.surfaceVariantText
|
||||
}
|
||||
|
||||
StyledText {
|
||||
text: modelData.saved ? "Saved" : ""
|
||||
text: modelData.saved ? I18n.tr("Saved") : ""
|
||||
font.pixelSize: Theme.fontSizeSmall
|
||||
color: Theme.primary
|
||||
visible: text.length > 0
|
||||
@@ -635,7 +635,7 @@ Rectangle {
|
||||
StyledText {
|
||||
text: {
|
||||
const isThisNetworkPinned = (SettingsData.wifiNetworkPins || {})["preferredWifi"] === modelData.ssid;
|
||||
return isThisNetworkPinned ? "Pinned" : "Pin";
|
||||
return isThisNetworkPinned ? I18n.tr("Pinned") : I18n.tr("Pin");
|
||||
}
|
||||
font.pixelSize: Theme.fontSizeSmall
|
||||
color: {
|
||||
@@ -714,7 +714,7 @@ Rectangle {
|
||||
}
|
||||
|
||||
MenuItem {
|
||||
text: networkContextMenu.currentConnected ? "Disconnect" : "Connect"
|
||||
text: networkContextMenu.currentConnected ? I18n.tr("Disconnect") : I18n.tr("Connect")
|
||||
height: 32
|
||||
|
||||
contentItem: StyledText {
|
||||
|
||||
@@ -65,141 +65,141 @@ QtObject {
|
||||
readonly property var coreWidgetDefinitions: [
|
||||
{
|
||||
"id": "nightMode",
|
||||
"text": "Night Mode",
|
||||
"description": "Blue light filter",
|
||||
"text": I18n.tr("Night Mode"),
|
||||
"description": I18n.tr("Blue light filter"),
|
||||
"icon": "nightlight",
|
||||
"type": "toggle",
|
||||
"enabled": DisplayService.automationAvailable,
|
||||
"warning": !DisplayService.automationAvailable ? "Requires night mode support" : undefined
|
||||
"warning": !DisplayService.automationAvailable ? I18n.tr("Requires night mode support") : undefined
|
||||
},
|
||||
{
|
||||
"id": "darkMode",
|
||||
"text": "Dark Mode",
|
||||
"description": "System theme toggle",
|
||||
"text": I18n.tr("Dark Mode"),
|
||||
"description": I18n.tr("System theme toggle"),
|
||||
"icon": "contrast",
|
||||
"type": "toggle",
|
||||
"enabled": true
|
||||
},
|
||||
{
|
||||
"id": "doNotDisturb",
|
||||
"text": "Do Not Disturb",
|
||||
"description": "Block notifications",
|
||||
"text": I18n.tr("Do Not Disturb"),
|
||||
"description": I18n.tr("Block notifications"),
|
||||
"icon": "do_not_disturb_on",
|
||||
"type": "toggle",
|
||||
"enabled": true
|
||||
},
|
||||
{
|
||||
"id": "idleInhibitor",
|
||||
"text": "Keep Awake",
|
||||
"description": "Prevent screen timeout",
|
||||
"text": I18n.tr("Keep Awake"),
|
||||
"description": I18n.tr("Prevent screen timeout"),
|
||||
"icon": "motion_sensor_active",
|
||||
"type": "toggle",
|
||||
"enabled": true
|
||||
},
|
||||
{
|
||||
"id": "wifi",
|
||||
"text": "Network",
|
||||
"description": "Wi-Fi and Ethernet connection",
|
||||
"text": I18n.tr("Network"),
|
||||
"description": I18n.tr("Wi-Fi and Ethernet connection"),
|
||||
"icon": "wifi",
|
||||
"type": "connection",
|
||||
"enabled": NetworkService.wifiAvailable,
|
||||
"warning": !NetworkService.wifiAvailable ? "Wi-Fi not available" : undefined
|
||||
"warning": !NetworkService.wifiAvailable ? I18n.tr("Wi-Fi not available") : undefined
|
||||
},
|
||||
{
|
||||
"id": "bluetooth",
|
||||
"text": "Bluetooth",
|
||||
"description": "Device connections",
|
||||
"text": I18n.tr("Bluetooth"),
|
||||
"description": I18n.tr("Device connections"),
|
||||
"icon": "bluetooth",
|
||||
"type": "connection",
|
||||
"enabled": BluetoothService.available,
|
||||
"warning": !BluetoothService.available ? "Bluetooth not available" : undefined
|
||||
"warning": !BluetoothService.available ? I18n.tr("Bluetooth not available") : undefined
|
||||
},
|
||||
{
|
||||
"id": "audioOutput",
|
||||
"text": "Audio Output",
|
||||
"description": "Speaker settings",
|
||||
"text": I18n.tr("Audio Output"),
|
||||
"description": I18n.tr("Speaker settings"),
|
||||
"icon": "volume_up",
|
||||
"type": "connection",
|
||||
"enabled": true
|
||||
},
|
||||
{
|
||||
"id": "audioInput",
|
||||
"text": "Audio Input",
|
||||
"description": "Microphone settings",
|
||||
"text": I18n.tr("Audio Input"),
|
||||
"description": I18n.tr("Microphone settings"),
|
||||
"icon": "mic",
|
||||
"type": "connection",
|
||||
"enabled": true
|
||||
},
|
||||
{
|
||||
"id": "volumeSlider",
|
||||
"text": "Volume Slider",
|
||||
"description": "Audio volume control",
|
||||
"text": I18n.tr("Volume Slider"),
|
||||
"description": I18n.tr("Audio volume control"),
|
||||
"icon": "volume_up",
|
||||
"type": "slider",
|
||||
"enabled": true
|
||||
},
|
||||
{
|
||||
"id": "brightnessSlider",
|
||||
"text": "Brightness Slider",
|
||||
"description": "Display brightness control",
|
||||
"text": I18n.tr("Brightness Slider"),
|
||||
"description": I18n.tr("Display brightness control"),
|
||||
"icon": "brightness_6",
|
||||
"type": "slider",
|
||||
"enabled": DisplayService.brightnessAvailable,
|
||||
"warning": !DisplayService.brightnessAvailable ? "Brightness control not available" : undefined,
|
||||
"warning": !DisplayService.brightnessAvailable ? I18n.tr("Brightness control not available") : undefined,
|
||||
"allowMultiple": true
|
||||
},
|
||||
{
|
||||
"id": "inputVolumeSlider",
|
||||
"text": "Input Volume Slider",
|
||||
"description": "Microphone volume control",
|
||||
"text": I18n.tr("Input Volume Slider"),
|
||||
"description": I18n.tr("Microphone volume control"),
|
||||
"icon": "mic",
|
||||
"type": "slider",
|
||||
"enabled": true
|
||||
},
|
||||
{
|
||||
"id": "battery",
|
||||
"text": "Battery",
|
||||
"description": "Battery and power management",
|
||||
"text": I18n.tr("Battery"),
|
||||
"description": I18n.tr("Battery and power management"),
|
||||
"icon": "battery_std",
|
||||
"type": "action",
|
||||
"enabled": true
|
||||
},
|
||||
{
|
||||
"id": "diskUsage",
|
||||
"text": "Disk Usage",
|
||||
"description": "Filesystem usage monitoring",
|
||||
"text": I18n.tr("Disk Usage"),
|
||||
"description": I18n.tr("Filesystem usage monitoring"),
|
||||
"icon": "storage",
|
||||
"type": "action",
|
||||
"enabled": DgopService.dgopAvailable,
|
||||
"warning": !DgopService.dgopAvailable ? "Requires 'dgop' tool" : undefined,
|
||||
"warning": !DgopService.dgopAvailable ? I18n.tr("Requires 'dgop' tool") : undefined,
|
||||
"allowMultiple": true
|
||||
},
|
||||
{
|
||||
"id": "colorPicker",
|
||||
"text": "Color Picker",
|
||||
"description": "Choose colors from palette",
|
||||
"text": I18n.tr("Color Picker"),
|
||||
"description": I18n.tr("Choose colors from palette"),
|
||||
"icon": "palette",
|
||||
"type": "action",
|
||||
"enabled": true
|
||||
},
|
||||
{
|
||||
"id": "builtin_vpn",
|
||||
"text": "VPN",
|
||||
"description": "VPN connections",
|
||||
"text": I18n.tr("VPN"),
|
||||
"description": I18n.tr("VPN connections"),
|
||||
"icon": "vpn_key",
|
||||
"type": "builtin_plugin",
|
||||
"enabled": DMSNetworkService.available,
|
||||
"warning": !DMSNetworkService.available ? "VPN not available" : undefined,
|
||||
"warning": !DMSNetworkService.available ? I18n.tr("VPN not available") : undefined,
|
||||
"isBuiltinPlugin": true
|
||||
},
|
||||
{
|
||||
"id": "builtin_cups",
|
||||
"text": "Printers",
|
||||
"description": "Print Server Management",
|
||||
"text": I18n.tr("Printers"),
|
||||
"description": I18n.tr("Print Server Management"),
|
||||
"icon": "Print",
|
||||
"type": "builtin_plugin",
|
||||
"enabled": CupsService.available,
|
||||
"warning": !CupsService.available ? "CUPS not available" : undefined,
|
||||
"warning": !CupsService.available ? I18n.tr("CUPS not available") : undefined,
|
||||
"isBuiltinPlugin": true
|
||||
}
|
||||
]
|
||||
@@ -235,7 +235,7 @@ QtObject {
|
||||
plugins.push({
|
||||
"id": "plugin_" + plugin.id,
|
||||
"pluginId": plugin.id,
|
||||
"text": plugin.name || "Plugin",
|
||||
"text": plugin.name || I18n.tr("Plugin"),
|
||||
"description": plugin.description || "",
|
||||
"icon": plugin.icon || "extension",
|
||||
"type": "plugin",
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
import QtQuick
|
||||
import Quickshell
|
||||
import qs.Common
|
||||
import qs.Services
|
||||
import qs.Widgets
|
||||
import qs.Modules.ControlCenter.Widgets
|
||||
|
||||
CompoundPill {
|
||||
@@ -14,35 +12,35 @@ CompoundPill {
|
||||
|
||||
primaryText: {
|
||||
if (!BatteryService.batteryAvailable) {
|
||||
return "No battery"
|
||||
return I18n.tr("No battery");
|
||||
}
|
||||
return "Battery"
|
||||
return I18n.tr("Battery");
|
||||
}
|
||||
|
||||
secondaryText: {
|
||||
if (!BatteryService.batteryAvailable) {
|
||||
return "Not available"
|
||||
return I18n.tr("Not available");
|
||||
}
|
||||
if (BatteryService.isCharging) {
|
||||
return `${BatteryService.batteryLevel}% • Charging`
|
||||
return `${BatteryService.batteryLevel}% • ` + I18n.tr("Charging");
|
||||
}
|
||||
if (BatteryService.isPluggedIn) {
|
||||
return `${BatteryService.batteryLevel}% • Plugged in`
|
||||
return `${BatteryService.batteryLevel}% • ` + I18n.tr("Plugged in");
|
||||
}
|
||||
return `${BatteryService.batteryLevel}%`
|
||||
return `${BatteryService.batteryLevel}%`;
|
||||
}
|
||||
|
||||
iconColor: {
|
||||
if (BatteryService.isLowBattery && !BatteryService.isCharging) {
|
||||
return Theme.error
|
||||
return Theme.error;
|
||||
}
|
||||
if (BatteryService.isCharging || BatteryService.isPluggedIn) {
|
||||
return Theme.primary
|
||||
return Theme.primary;
|
||||
}
|
||||
return Theme.surfaceText
|
||||
return Theme.surfaceText;
|
||||
}
|
||||
|
||||
onToggled: {
|
||||
expandClicked()
|
||||
expandClicked();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,9 +1,5 @@
|
||||
import QtQuick
|
||||
import QtQuick.Controls
|
||||
import Quickshell
|
||||
import qs.Common
|
||||
import qs.Services
|
||||
import qs.Widgets
|
||||
import qs.Modules.ControlCenter.Widgets
|
||||
|
||||
CompoundPill {
|
||||
@@ -14,20 +10,20 @@ CompoundPill {
|
||||
isActive: true
|
||||
iconName: "palette"
|
||||
iconColor: Theme.primary
|
||||
primaryText: "Color Picker"
|
||||
secondaryText: "Choose a color"
|
||||
primaryText: I18n.tr("Color Picker")
|
||||
secondaryText: I18n.tr("Choose a color")
|
||||
|
||||
onToggled: {
|
||||
console.log("ColorPickerPill toggled, modal:", colorPickerModal)
|
||||
console.log("ColorPickerPill toggled, modal:", colorPickerModal);
|
||||
if (colorPickerModal) {
|
||||
colorPickerModal.show()
|
||||
colorPickerModal.show();
|
||||
}
|
||||
}
|
||||
|
||||
onExpandClicked: {
|
||||
console.log("ColorPickerPill expandClicked, modal:", colorPickerModal)
|
||||
console.log("ColorPickerPill expandClicked, modal:", colorPickerModal);
|
||||
if (colorPickerModal) {
|
||||
colorPickerModal.show()
|
||||
colorPickerModal.show();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
import QtQuick
|
||||
import Quickshell
|
||||
import qs.Common
|
||||
import qs.Services
|
||||
import qs.Widgets
|
||||
import qs.Modules.ControlCenter.Widgets
|
||||
|
||||
CompoundPill {
|
||||
@@ -15,64 +13,64 @@ CompoundPill {
|
||||
|
||||
property var selectedMount: {
|
||||
if (!DgopService.diskMounts || DgopService.diskMounts.length === 0) {
|
||||
return null
|
||||
return null;
|
||||
}
|
||||
|
||||
const targetMount = DgopService.diskMounts.find(mount => mount.mount === mountPath)
|
||||
return targetMount || DgopService.diskMounts.find(mount => mount.mount === "/") || DgopService.diskMounts[0]
|
||||
const targetMount = DgopService.diskMounts.find(mount => mount.mount === mountPath);
|
||||
return targetMount || DgopService.diskMounts.find(mount => mount.mount === "/") || DgopService.diskMounts[0];
|
||||
}
|
||||
|
||||
property real usagePercent: {
|
||||
if (!selectedMount || !selectedMount.percent) {
|
||||
return 0
|
||||
return 0;
|
||||
}
|
||||
const percentStr = selectedMount.percent.replace("%", "")
|
||||
return parseFloat(percentStr) || 0
|
||||
const percentStr = selectedMount.percent.replace("%", "");
|
||||
return parseFloat(percentStr) || 0;
|
||||
}
|
||||
|
||||
isActive: DgopService.dgopAvailable && selectedMount !== null
|
||||
|
||||
primaryText: {
|
||||
if (!DgopService.dgopAvailable) {
|
||||
return "Disk Usage"
|
||||
return I18n.tr("Disk Usage");
|
||||
}
|
||||
if (!selectedMount) {
|
||||
return "No disk data"
|
||||
return I18n.tr("No disk data");
|
||||
}
|
||||
return selectedMount.mount
|
||||
return selectedMount.mount;
|
||||
}
|
||||
|
||||
secondaryText: {
|
||||
if (!DgopService.dgopAvailable) {
|
||||
return "dgop not available"
|
||||
return I18n.tr("dgop not available");
|
||||
}
|
||||
if (!selectedMount) {
|
||||
return "No disk data available"
|
||||
return I18n.tr("No disk data available");
|
||||
}
|
||||
return `${selectedMount.used} / ${selectedMount.size} (${usagePercent.toFixed(0)}%)`
|
||||
return `${selectedMount.used} / ${selectedMount.size} (${usagePercent.toFixed(0)}%)`;
|
||||
}
|
||||
|
||||
iconColor: {
|
||||
if (!DgopService.dgopAvailable || !selectedMount) {
|
||||
return Qt.rgba(Theme.surfaceText.r, Theme.surfaceText.g, Theme.surfaceText.b, 0.5)
|
||||
return Qt.rgba(Theme.surfaceText.r, Theme.surfaceText.g, Theme.surfaceText.b, 0.5);
|
||||
}
|
||||
if (usagePercent > 90) {
|
||||
return Theme.error
|
||||
return Theme.error;
|
||||
}
|
||||
if (usagePercent > 75) {
|
||||
return Theme.warning
|
||||
return Theme.warning;
|
||||
}
|
||||
return Theme.surfaceText
|
||||
return Theme.surfaceText;
|
||||
}
|
||||
|
||||
Component.onCompleted: {
|
||||
DgopService.addRef(["diskmounts"])
|
||||
DgopService.addRef(["diskmounts"]);
|
||||
}
|
||||
Component.onDestruction: {
|
||||
DgopService.removeRef(["diskmounts"])
|
||||
DgopService.removeRef(["diskmounts"]);
|
||||
}
|
||||
|
||||
onToggled: {
|
||||
expandClicked()
|
||||
expandClicked();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -172,7 +172,7 @@ Item {
|
||||
DMSService.sendRequest("clipboard.setConfig", params, response => {
|
||||
saving = false;
|
||||
if (response.error) {
|
||||
ToastService.showError(I18n.tr("Failed to save clipboard setting"));
|
||||
ToastService.showError(I18n.tr("Failed to save clipboard setting"), response.error);
|
||||
return;
|
||||
}
|
||||
loadConfig();
|
||||
|
||||
@@ -189,7 +189,7 @@ Item {
|
||||
spacing: Theme.spacingM
|
||||
|
||||
StyledText {
|
||||
text: I18n.tr("Available Screens (") + Quickshell.screens.length + ")"
|
||||
text: I18n.tr("Available Screens (%1)").arg(Quickshell.screens.length)
|
||||
font.pixelSize: Theme.fontSizeMedium
|
||||
font.weight: Font.Medium
|
||||
color: Theme.surfaceText
|
||||
|
||||
@@ -333,10 +333,10 @@ Item {
|
||||
visible: warningBox.showError || warningBox.showSetup
|
||||
text: {
|
||||
if (KeybindsService.fixing)
|
||||
return I18n.tr("Fixing...")
|
||||
return I18n.tr("Fixing...");
|
||||
if (warningBox.showSetup)
|
||||
return I18n.tr("Setup")
|
||||
return I18n.tr("Fix Now")
|
||||
return I18n.tr("Setup");
|
||||
return I18n.tr("Fix Now");
|
||||
}
|
||||
backgroundColor: Theme.primary
|
||||
textColor: Theme.primaryText
|
||||
@@ -510,7 +510,7 @@ Item {
|
||||
}
|
||||
|
||||
StyledText {
|
||||
text: KeybindsService.loading ? I18n.tr("Shortcuts") : I18n.tr("Shortcuts") + " (" + keybindsTab._filteredBinds.length + ")"
|
||||
text: KeybindsService.loading ? I18n.tr("Shortcuts") : I18n.tr("Shortcuts (%1)").arg(keybindsTab._filteredBinds.length)
|
||||
font.pixelSize: Theme.fontSizeMedium
|
||||
font.weight: Font.Medium
|
||||
color: Theme.surfaceText
|
||||
|
||||
@@ -1182,7 +1182,7 @@ Item {
|
||||
onClicked: {
|
||||
forgetNetworkConfirm.showWithOptions({
|
||||
title: I18n.tr("Forget Network"),
|
||||
message: I18n.tr("Forget \"") + modelData.ssid + "\"?",
|
||||
message: I18n.tr("Forget \"%1\"?").arg(modelData.ssid),
|
||||
confirmText: I18n.tr("Forget"),
|
||||
confirmColor: Theme.error,
|
||||
onConfirm: () => NetworkService.forgetWifiNetwork(modelData.ssid)
|
||||
@@ -1674,7 +1674,7 @@ Item {
|
||||
onClicked: {
|
||||
deleteVpnConfirm.showWithOptions({
|
||||
title: I18n.tr("Delete VPN"),
|
||||
message: I18n.tr("Delete \"") + modelData.name + "\"?",
|
||||
message: I18n.tr("Delete \"%1\"?").arg(modelData.name),
|
||||
confirmText: I18n.tr("Delete"),
|
||||
confirmColor: Theme.error,
|
||||
onConfirm: () => VPNService.deleteVpn(modelData.uuid)
|
||||
|
||||
@@ -125,7 +125,7 @@ StyledRect {
|
||||
hoverEnabled: true
|
||||
onEntered: {
|
||||
if (root.sharedTooltip)
|
||||
root.sharedTooltip.show(I18n.tr("Requires DMS") + " " + root.requiresDms, parent, 0, 0, "top");
|
||||
root.sharedTooltip.show(I18n.tr("Requires DMS %1").arg(root.requiresDms), parent, 0, 0, "top");
|
||||
}
|
||||
onExited: {
|
||||
if (root.sharedTooltip)
|
||||
|
||||
@@ -315,7 +315,7 @@ FocusScope {
|
||||
|
||||
StyledText {
|
||||
width: parent.width
|
||||
text: I18n.tr("No plugins found.") + "\n" + I18n.tr("Place plugins in") + " " + PluginService.pluginDirectory
|
||||
text: I18n.tr("No plugins found.") + "\n" + I18n.tr("Place plugins in %1").arg(PluginService.pluginDirectory)
|
||||
font.pixelSize: Theme.fontSizeMedium
|
||||
color: Theme.surfaceVariantText
|
||||
horizontalAlignment: Text.AlignHCenter
|
||||
|
||||
@@ -384,7 +384,7 @@ Singleton {
|
||||
|
||||
DMSService.sendRequest("cups.pausePrinter", params, response => {
|
||||
if (response.error) {
|
||||
ToastService.showError(I18n.tr("Failed to pause printer") + " - " + response.error);
|
||||
ToastService.showError(I18n.tr("Failed to pause printer"), response.error);
|
||||
} else {
|
||||
getState();
|
||||
}
|
||||
@@ -400,7 +400,7 @@ Singleton {
|
||||
|
||||
DMSService.sendRequest("cups.resumePrinter", params, response => {
|
||||
if (response.error) {
|
||||
ToastService.showError(I18n.tr("Failed to resume printer") + " - " + response.error);
|
||||
ToastService.showError(I18n.tr("Failed to resume printer"), response.error);
|
||||
} else {
|
||||
getState();
|
||||
}
|
||||
@@ -417,7 +417,7 @@ Singleton {
|
||||
|
||||
DMSService.sendRequest("cups.cancelJob", params, response => {
|
||||
if (response.error) {
|
||||
ToastService.showError(I18n.tr("Failed to cancel selected job") + " - " + response.error);
|
||||
ToastService.showError(I18n.tr("Failed to cancel selected job"), response.error);
|
||||
} else {
|
||||
fetchJobsForPrinter(printerName);
|
||||
}
|
||||
@@ -433,7 +433,7 @@ Singleton {
|
||||
|
||||
DMSService.sendRequest("cups.purgeJobs", params, response => {
|
||||
if (response.error) {
|
||||
ToastService.showError(I18n.tr("Failed to cancel all jobs") + " - " + response.error);
|
||||
ToastService.showError(I18n.tr("Failed to cancel all jobs"), response.error);
|
||||
} else {
|
||||
fetchJobsForPrinter(printerName);
|
||||
}
|
||||
@@ -499,7 +499,7 @@ Singleton {
|
||||
DMSService.sendRequest("cups.createPrinter", params, response => {
|
||||
creatingPrinter = false;
|
||||
if (response.error) {
|
||||
ToastService.showError(I18n.tr("Failed to create printer") + " - " + response.error);
|
||||
ToastService.showError(I18n.tr("Failed to create printer"), response.error);
|
||||
} else {
|
||||
ToastService.showInfo(I18n.tr("Printer created successfully"));
|
||||
getState();
|
||||
@@ -516,7 +516,7 @@ Singleton {
|
||||
|
||||
DMSService.sendRequest("cups.deletePrinter", params, response => {
|
||||
if (response.error) {
|
||||
ToastService.showError(I18n.tr("Failed to delete printer") + " - " + response.error);
|
||||
ToastService.showError(I18n.tr("Failed to delete printer"), response.error);
|
||||
} else {
|
||||
ToastService.showInfo(I18n.tr("Printer deleted"));
|
||||
if (selectedPrinter === printerName) {
|
||||
@@ -536,7 +536,7 @@ Singleton {
|
||||
|
||||
DMSService.sendRequest("cups.acceptJobs", params, response => {
|
||||
if (response.error) {
|
||||
ToastService.showError(I18n.tr("Failed to enable job acceptance") + " - " + response.error);
|
||||
ToastService.showError(I18n.tr("Failed to enable job acceptance"), response.error);
|
||||
} else {
|
||||
getState();
|
||||
}
|
||||
@@ -552,7 +552,7 @@ Singleton {
|
||||
|
||||
DMSService.sendRequest("cups.rejectJobs", params, response => {
|
||||
if (response.error) {
|
||||
ToastService.showError(I18n.tr("Failed to disable job acceptance") + " - " + response.error);
|
||||
ToastService.showError(I18n.tr("Failed to disable job acceptance"), response.error);
|
||||
} else {
|
||||
getState();
|
||||
}
|
||||
@@ -569,7 +569,7 @@ Singleton {
|
||||
|
||||
DMSService.sendRequest("cups.setPrinterShared", params, response => {
|
||||
if (response.error) {
|
||||
ToastService.showError(I18n.tr("Failed to update sharing") + " - " + response.error);
|
||||
ToastService.showError(I18n.tr("Failed to update sharing"), response.error);
|
||||
} else {
|
||||
getState();
|
||||
}
|
||||
@@ -586,7 +586,7 @@ Singleton {
|
||||
|
||||
DMSService.sendRequest("cups.setPrinterLocation", params, response => {
|
||||
if (response.error) {
|
||||
ToastService.showError(I18n.tr("Failed to update location") + " - " + response.error);
|
||||
ToastService.showError(I18n.tr("Failed to update location"), response.error);
|
||||
} else {
|
||||
getState();
|
||||
}
|
||||
@@ -603,7 +603,7 @@ Singleton {
|
||||
|
||||
DMSService.sendRequest("cups.setPrinterInfo", params, response => {
|
||||
if (response.error) {
|
||||
ToastService.showError(I18n.tr("Failed to update description") + " - " + response.error);
|
||||
ToastService.showError(I18n.tr("Failed to update description"), response.error);
|
||||
} else {
|
||||
getState();
|
||||
}
|
||||
@@ -619,7 +619,7 @@ Singleton {
|
||||
|
||||
DMSService.sendRequest("cups.printTestPage", params, response => {
|
||||
if (response.error) {
|
||||
ToastService.showError(I18n.tr("Failed to print test page") + " - " + response.error);
|
||||
ToastService.showError(I18n.tr("Failed to print test page"), response.error);
|
||||
} else {
|
||||
ToastService.showInfo(I18n.tr("Test page sent to printer"));
|
||||
fetchJobsForPrinter(printerName);
|
||||
@@ -637,7 +637,7 @@ Singleton {
|
||||
|
||||
DMSService.sendRequest("cups.moveJob", params, response => {
|
||||
if (response.error) {
|
||||
ToastService.showError(I18n.tr("Failed to move job") + " - " + response.error);
|
||||
ToastService.showError(I18n.tr("Failed to move job"), response.error);
|
||||
} else {
|
||||
fetchAllJobs();
|
||||
}
|
||||
@@ -653,7 +653,7 @@ Singleton {
|
||||
|
||||
DMSService.sendRequest("cups.restartJob", params, response => {
|
||||
if (response.error) {
|
||||
ToastService.showError(I18n.tr("Failed to restart job") + " - " + response.error);
|
||||
ToastService.showError(I18n.tr("Failed to restart job"), response.error);
|
||||
} else {
|
||||
fetchAllJobs();
|
||||
}
|
||||
@@ -672,7 +672,7 @@ Singleton {
|
||||
|
||||
DMSService.sendRequest("cups.holdJob", params, response => {
|
||||
if (response.error) {
|
||||
ToastService.showError(I18n.tr("Failed to hold job") + " - " + response.error);
|
||||
ToastService.showError(I18n.tr("Failed to hold job"), response.error);
|
||||
} else {
|
||||
fetchAllJobs();
|
||||
}
|
||||
@@ -689,7 +689,7 @@ Singleton {
|
||||
|
||||
DMSService.sendRequest("cups.addPrinterToClass", params, response => {
|
||||
if (response.error) {
|
||||
ToastService.showError(I18n.tr("Failed to add printer to class") + " - " + response.error);
|
||||
ToastService.showError(I18n.tr("Failed to add printer to class"), response.error);
|
||||
} else {
|
||||
getClasses();
|
||||
}
|
||||
@@ -706,7 +706,7 @@ Singleton {
|
||||
|
||||
DMSService.sendRequest("cups.removePrinterFromClass", params, response => {
|
||||
if (response.error) {
|
||||
ToastService.showError(I18n.tr("Failed to remove printer from class") + " - " + response.error);
|
||||
ToastService.showError(I18n.tr("Failed to remove printer from class"), response.error);
|
||||
} else {
|
||||
getClasses();
|
||||
}
|
||||
@@ -722,7 +722,7 @@ Singleton {
|
||||
|
||||
DMSService.sendRequest("cups.deleteClass", params, response => {
|
||||
if (response.error) {
|
||||
ToastService.showError(I18n.tr("Failed to delete class") + " - " + response.error);
|
||||
ToastService.showError(I18n.tr("Failed to delete class"), response.error);
|
||||
} else {
|
||||
getClasses();
|
||||
}
|
||||
|
||||
@@ -353,7 +353,7 @@ Singleton {
|
||||
pendingConnectionSSID = "";
|
||||
} else {
|
||||
if (connectionError) {
|
||||
ToastService.showError(I18n.tr("Failed to connect to ") + pendingConnectionSSID);
|
||||
ToastService.showError(I18n.tr("Failed to connect to %1").arg(pendingConnectionSSID));
|
||||
}
|
||||
connectionStatus = "failed";
|
||||
pendingConnectionSSID = "";
|
||||
@@ -382,7 +382,7 @@ Singleton {
|
||||
connectionError = response.error;
|
||||
lastConnectionError = response.error;
|
||||
connectionStatus = "failed";
|
||||
ToastService.showError(I18n.tr("Failed to activate configuration"));
|
||||
ToastService.showError(I18n.tr("Failed to activate configuration"), response.error);
|
||||
} else {
|
||||
connectionError = "";
|
||||
connectionStatus = "connected";
|
||||
@@ -461,7 +461,7 @@ Singleton {
|
||||
lastConnectionError = response.error;
|
||||
pendingConnectionSSID = "";
|
||||
connectionStatus = "failed";
|
||||
ToastService.showError(I18n.tr("Failed to start connection to ") + ssid);
|
||||
ToastService.showError(I18n.tr("Failed to start connection to %1").arg(ssid));
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -474,7 +474,7 @@ Singleton {
|
||||
} : null;
|
||||
DMSService.sendRequest("network.wifi.disconnect", params, response => {
|
||||
if (response.error) {
|
||||
ToastService.showError(I18n.tr("Failed to disconnect WiFi"));
|
||||
ToastService.showError(I18n.tr("Failed to disconnect WiFi"), response.error);
|
||||
} else {
|
||||
ToastService.showInfo(I18n.tr("Disconnected from WiFi"));
|
||||
currentWifiSSID = "";
|
||||
@@ -534,7 +534,7 @@ Singleton {
|
||||
if (response.error) {
|
||||
console.warn("Failed to forget network:", response.error);
|
||||
} else {
|
||||
ToastService.showInfo(I18n.tr("Forgot network ") + ssid);
|
||||
ToastService.showInfo(I18n.tr("Forgot network %1").arg(ssid));
|
||||
|
||||
savedConnections = savedConnections.filter(s => s.ssid !== ssid);
|
||||
savedWifiNetworks = savedWifiNetworks.filter(s => s.ssid !== ssid);
|
||||
@@ -577,7 +577,7 @@ Singleton {
|
||||
return;
|
||||
DMSService.sendRequest("network.wifi.enable", null, response => {
|
||||
if (response.error) {
|
||||
ToastService.showError(I18n.tr("Failed to enable WiFi"));
|
||||
ToastService.showError(I18n.tr("Failed to enable WiFi"), response.error);
|
||||
} else {
|
||||
ToastService.showInfo(I18n.tr("WiFi enabled"));
|
||||
}
|
||||
@@ -826,7 +826,7 @@ Singleton {
|
||||
vpnIsBusy = false;
|
||||
pendingVpnUuid = "";
|
||||
vpnBusyStartTime = 0;
|
||||
ToastService.showError(I18n.tr("Failed to connect VPN"));
|
||||
ToastService.showError(I18n.tr("Failed to connect VPN"), response.error);
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -850,7 +850,7 @@ Singleton {
|
||||
if (response.error) {
|
||||
vpnIsBusy = false;
|
||||
vpnBusyStartTime = 0;
|
||||
ToastService.showError(I18n.tr("Failed to disconnect VPN"));
|
||||
ToastService.showError(I18n.tr("Failed to disconnect VPN"), response.error);
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -868,7 +868,7 @@ Singleton {
|
||||
DMSService.sendRequest("network.vpn.disconnectAll", null, response => {
|
||||
if (response.error) {
|
||||
vpnIsBusy = false;
|
||||
ToastService.showError(I18n.tr("Failed to disconnect VPNs"));
|
||||
ToastService.showError(I18n.tr("Failed to disconnect VPNs"), response.error);
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -933,7 +933,7 @@ Singleton {
|
||||
|
||||
DMSService.sendRequest("network.wifi.setAutoconnect", params, response => {
|
||||
if (response.error) {
|
||||
ToastService.showError(I18n.tr("Failed to update autoconnect"));
|
||||
ToastService.showError(I18n.tr("Failed to update autoconnect"), response.error);
|
||||
} else {
|
||||
ToastService.showInfo(autoconnect ? I18n.tr("Autoconnect enabled") : I18n.tr("Autoconnect disabled"));
|
||||
Qt.callLater(() => getState());
|
||||
|
||||
@@ -319,7 +319,7 @@ Singleton {
|
||||
DMSService.sendRequest("brightness.setBrightness", params, response => {
|
||||
if (response.error) {
|
||||
console.error("DisplayService: Failed to set brightness:", response.error);
|
||||
ToastService.showError("Failed to set brightness: " + response.error, "", "", "brightness");
|
||||
ToastService.showError(I18n.tr("Failed to set brightness"), response.error, "", "brightness");
|
||||
} else {
|
||||
ToastService.dismissCategory("brightness");
|
||||
}
|
||||
@@ -453,7 +453,7 @@ Singleton {
|
||||
}, response => {
|
||||
if (response.error) {
|
||||
console.error("DisplayService: Failed to enable gamma control:", response.error);
|
||||
ToastService.showError("Failed to enable night mode: " + response.error, "", "", "night-mode");
|
||||
ToastService.showError(I18n.tr("Failed to enable night mode"), response.error, "", "night-mode");
|
||||
nightModeEnabled = false;
|
||||
SessionData.setNightModeEnabled(false);
|
||||
return;
|
||||
@@ -481,7 +481,7 @@ Singleton {
|
||||
}, response => {
|
||||
if (response.error) {
|
||||
console.error("DisplayService: Failed to disable gamma control:", response.error);
|
||||
ToastService.showError("Failed to disable night mode: " + response.error, "", "", "night-mode");
|
||||
ToastService.showError(I18n.tr("Failed to disable night mode"), response.error, "", "night-mode");
|
||||
} else {
|
||||
ToastService.dismissCategory("night-mode");
|
||||
}
|
||||
@@ -522,7 +522,7 @@ Singleton {
|
||||
}, response => {
|
||||
if (response.error) {
|
||||
console.error("DisplayService: Failed to set temperature:", response.error);
|
||||
ToastService.showError("Failed to set night mode temperature: " + response.error, "", "", "night-mode");
|
||||
ToastService.showError(I18n.tr("Failed to set night mode temperature"), response.error, "", "night-mode");
|
||||
} else {
|
||||
ToastService.dismissCategory("night-mode");
|
||||
}
|
||||
@@ -573,7 +573,7 @@ Singleton {
|
||||
}, response => {
|
||||
if (response.error) {
|
||||
console.error("DisplayService: Failed to set temperature:", response.error);
|
||||
ToastService.showError("Failed to set night mode temperature: " + response.error, "", "", "night-mode");
|
||||
ToastService.showError(I18n.tr("Failed to set night mode temperature"), response.error, "", "night-mode");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -583,7 +583,7 @@ Singleton {
|
||||
}, response => {
|
||||
if (response.error) {
|
||||
console.error("DisplayService: Failed to set manual times:", response.error);
|
||||
ToastService.showError("Failed to set night mode schedule: " + response.error, "", "", "night-mode");
|
||||
ToastService.showError(I18n.tr("Failed to set night mode schedule"), response.error, "", "night-mode");
|
||||
} else {
|
||||
ToastService.dismissCategory("night-mode");
|
||||
}
|
||||
@@ -611,7 +611,7 @@ Singleton {
|
||||
}, response => {
|
||||
if (response.error) {
|
||||
console.error("DisplayService: Failed to set temperature:", response.error);
|
||||
ToastService.showError("Failed to set night mode temperature: " + response.error, "", "", "night-mode");
|
||||
ToastService.showError(I18n.tr("Failed to set night mode temperature"), response.error, "", "night-mode");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -621,7 +621,7 @@ Singleton {
|
||||
}, response => {
|
||||
if (response.error) {
|
||||
console.error("DisplayService: Failed to enable IP location:", response.error);
|
||||
ToastService.showError("Failed to enable IP location: " + response.error, "", "", "night-mode");
|
||||
ToastService.showError(I18n.tr("Failed to enable IP location"), response.error, "", "night-mode");
|
||||
} else {
|
||||
ToastService.dismissCategory("night-mode");
|
||||
}
|
||||
@@ -641,7 +641,7 @@ Singleton {
|
||||
}, response => {
|
||||
if (response.error) {
|
||||
console.error("DisplayService: Failed to set location:", response.error);
|
||||
ToastService.showError("Failed to set night mode location: " + response.error, "", "", "night-mode");
|
||||
ToastService.showError(I18n.tr("Failed to set night mode location"), response.error, "", "night-mode");
|
||||
} else {
|
||||
ToastService.dismissCategory("night-mode");
|
||||
}
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
pragma Singleton
|
||||
|
||||
pragma ComponentBehavior: Bound
|
||||
|
||||
import QtQuick
|
||||
@@ -22,161 +21,157 @@ Singleton {
|
||||
|
||||
readonly property string socketPath: Quickshell.env("DMS_SOCKET")
|
||||
|
||||
function init() {}
|
||||
function init() {
|
||||
}
|
||||
|
||||
function getSystemProfileImage() {
|
||||
if (!freedeskAvailable)
|
||||
return
|
||||
|
||||
const username = Quickshell.env("USER")
|
||||
return;
|
||||
const username = Quickshell.env("USER");
|
||||
if (!username)
|
||||
return
|
||||
|
||||
return;
|
||||
DMSService.sendRequest("freedesktop.accounts.getUserIconFile", {
|
||||
"username": username
|
||||
}, response => {
|
||||
if (response.result && response.result.success) {
|
||||
const iconFile = response.result.value || ""
|
||||
if (iconFile && iconFile !== "" && iconFile !== "/var/lib/AccountsService/icons/") {
|
||||
systemProfileImage = iconFile
|
||||
if (!profileImage || profileImage === "") {
|
||||
profileImage = iconFile
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
"username": username
|
||||
}, response => {
|
||||
if (response.result && response.result.success) {
|
||||
const iconFile = response.result.value || "";
|
||||
if (iconFile && iconFile !== "" && iconFile !== "/var/lib/AccountsService/icons/") {
|
||||
systemProfileImage = iconFile;
|
||||
if (!profileImage || profileImage === "") {
|
||||
profileImage = iconFile;
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function getUserProfileImage(username) {
|
||||
if (!username) {
|
||||
profileImage = ""
|
||||
return
|
||||
profileImage = "";
|
||||
return;
|
||||
}
|
||||
if (Quickshell.env("DMS_RUN_GREETER") === "1" || Quickshell.env("DMS_RUN_GREETER") === "true") {
|
||||
profileImage = ""
|
||||
return
|
||||
profileImage = "";
|
||||
return;
|
||||
}
|
||||
|
||||
if (!freedeskAvailable) {
|
||||
profileImage = ""
|
||||
return
|
||||
profileImage = "";
|
||||
return;
|
||||
}
|
||||
|
||||
DMSService.sendRequest("freedesktop.accounts.getUserIconFile", {
|
||||
"username": username
|
||||
}, response => {
|
||||
if (response.result && response.result.success) {
|
||||
const icon = response.result.value || ""
|
||||
if (icon && icon !== "" && icon !== "/var/lib/AccountsService/icons/") {
|
||||
profileImage = icon
|
||||
} else {
|
||||
profileImage = ""
|
||||
}
|
||||
} else {
|
||||
profileImage = ""
|
||||
}
|
||||
})
|
||||
"username": username
|
||||
}, response => {
|
||||
if (response.result && response.result.success) {
|
||||
const icon = response.result.value || "";
|
||||
if (icon && icon !== "" && icon !== "/var/lib/AccountsService/icons/") {
|
||||
profileImage = icon;
|
||||
} else {
|
||||
profileImage = "";
|
||||
}
|
||||
} else {
|
||||
profileImage = "";
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function setProfileImage(imagePath) {
|
||||
if (accountsServiceAvailable) {
|
||||
pendingProfileImage = imagePath
|
||||
setSystemProfileImage(imagePath || "")
|
||||
pendingProfileImage = imagePath;
|
||||
setSystemProfileImage(imagePath || "");
|
||||
} else {
|
||||
profileImage = imagePath
|
||||
profileImage = imagePath;
|
||||
}
|
||||
}
|
||||
|
||||
function getSystemColorScheme() {
|
||||
if (typeof SettingsData !== "undefined" && SettingsData.syncModeWithPortal === false) {
|
||||
return
|
||||
return;
|
||||
}
|
||||
if (!freedeskAvailable)
|
||||
return
|
||||
|
||||
return;
|
||||
DMSService.sendRequest("freedesktop.settings.getColorScheme", null, response => {
|
||||
if (response.result) {
|
||||
systemColorScheme = response.result.value || 0
|
||||
}
|
||||
})
|
||||
if (response.result) {
|
||||
systemColorScheme = response.result.value || 0;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function setLightMode(isLightMode) {
|
||||
if (typeof SettingsData !== "undefined" && SettingsData.syncModeWithPortal === false) {
|
||||
return
|
||||
return;
|
||||
}
|
||||
setSystemColorScheme(isLightMode)
|
||||
setSystemColorScheme(isLightMode);
|
||||
}
|
||||
|
||||
function setSystemColorScheme(isLightMode) {
|
||||
if (typeof SettingsData !== "undefined" && SettingsData.syncModeWithPortal === false) {
|
||||
return
|
||||
return;
|
||||
}
|
||||
|
||||
const targetScheme = isLightMode ? "default" : "prefer-dark"
|
||||
const targetScheme = isLightMode ? "default" : "prefer-dark";
|
||||
|
||||
if (colorSchemeCommand === "gsettings") {
|
||||
Quickshell.execDetached(["gsettings", "set", "org.gnome.desktop.interface", "color-scheme", targetScheme])
|
||||
Quickshell.execDetached(["gsettings", "set", "org.gnome.desktop.interface", "color-scheme", targetScheme]);
|
||||
}
|
||||
if (colorSchemeCommand === "dconf") {
|
||||
Quickshell.execDetached(["dconf", "write", "/org/gnome/desktop/interface/color-scheme", `'${targetScheme}'`])
|
||||
Quickshell.execDetached(["dconf", "write", "/org/gnome/desktop/interface/color-scheme", `'${targetScheme}'`]);
|
||||
}
|
||||
}
|
||||
|
||||
function setSystemIconTheme(themeName) {
|
||||
if (!settingsPortalAvailable || !freedeskAvailable)
|
||||
return
|
||||
|
||||
return;
|
||||
DMSService.sendRequest("freedesktop.settings.setIconTheme", {
|
||||
"iconTheme": themeName
|
||||
}, response => {
|
||||
if (response.error) {
|
||||
console.warn("PortalService: Failed to set icon theme:", response.error)
|
||||
}
|
||||
})
|
||||
"iconTheme": themeName
|
||||
}, response => {
|
||||
if (response.error) {
|
||||
console.warn("PortalService: Failed to set icon theme:", response.error);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function setSystemProfileImage(imagePath) {
|
||||
if (!accountsServiceAvailable || !freedeskAvailable)
|
||||
return
|
||||
|
||||
return;
|
||||
DMSService.sendRequest("freedesktop.accounts.setIconFile", {
|
||||
"path": imagePath || ""
|
||||
}, response => {
|
||||
if (response.error) {
|
||||
console.warn("PortalService: Failed to set icon file:", response.error)
|
||||
"path": imagePath || ""
|
||||
}, response => {
|
||||
if (response.error) {
|
||||
console.warn("PortalService: Failed to set icon file:", response.error);
|
||||
|
||||
const errorMsg = response.error.toString()
|
||||
let userMessage = I18n.tr("Failed to set profile image")
|
||||
const errorMsg = response.error.toString();
|
||||
let userMessage = I18n.tr("Failed to set profile image");
|
||||
|
||||
if (errorMsg.includes("too large")) {
|
||||
userMessage = I18n.tr("Profile image is too large. Please use a smaller image.")
|
||||
} else if (errorMsg.includes("permission")) {
|
||||
userMessage = I18n.tr("Permission denied to set profile image.")
|
||||
} else if (errorMsg.includes("not found") || errorMsg.includes("does not exist")) {
|
||||
userMessage = I18n.tr("Selected image file not found.")
|
||||
} else {
|
||||
userMessage = I18n.tr("Failed to set profile image: ") + errorMsg.split(":").pop().trim()
|
||||
}
|
||||
if (errorMsg.includes("too large")) {
|
||||
userMessage = I18n.tr("Profile image is too large. Please use a smaller image.");
|
||||
} else if (errorMsg.includes("permission")) {
|
||||
userMessage = I18n.tr("Permission denied to set profile image.");
|
||||
} else if (errorMsg.includes("not found") || errorMsg.includes("does not exist")) {
|
||||
userMessage = I18n.tr("Selected image file not found.");
|
||||
} else {
|
||||
userMessage = I18n.tr("Failed to set profile image: %1").arg(errorMsg.split(":").pop().trim());
|
||||
}
|
||||
|
||||
Quickshell.execDetached(["notify-send", "-u", "normal", "-a", "DMS", "-i", "error", I18n.tr("Profile Image Error"), userMessage])
|
||||
Quickshell.execDetached(["notify-send", "-u", "normal", "-a", "DMS", "-i", "error", I18n.tr("Profile Image Error"), userMessage]);
|
||||
|
||||
pendingProfileImage = ""
|
||||
} else {
|
||||
profileImage = pendingProfileImage
|
||||
pendingProfileImage = ""
|
||||
Qt.callLater(() => getSystemProfileImage())
|
||||
}
|
||||
})
|
||||
pendingProfileImage = "";
|
||||
} else {
|
||||
profileImage = pendingProfileImage;
|
||||
pendingProfileImage = "";
|
||||
Qt.callLater(() => getSystemProfileImage());
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
Component.onCompleted: {
|
||||
if (socketPath && socketPath.length > 0) {
|
||||
checkDMSCapabilities()
|
||||
checkDMSCapabilities();
|
||||
} else {
|
||||
console.info("PortalService: DMS_SOCKET not set")
|
||||
console.info("PortalService: DMS_SOCKET not set");
|
||||
}
|
||||
colorSchemeDetector.running = true
|
||||
colorSchemeDetector.running = true;
|
||||
}
|
||||
|
||||
Connections {
|
||||
@@ -184,7 +179,7 @@ Singleton {
|
||||
|
||||
function onConnectionStateChanged() {
|
||||
if (DMSService.isConnected) {
|
||||
checkDMSCapabilities()
|
||||
checkDMSCapabilities();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -194,63 +189,61 @@ Singleton {
|
||||
enabled: DMSService.isConnected
|
||||
|
||||
function onCapabilitiesChanged() {
|
||||
checkDMSCapabilities()
|
||||
checkDMSCapabilities();
|
||||
}
|
||||
}
|
||||
|
||||
function checkDMSCapabilities() {
|
||||
if (!DMSService.isConnected) {
|
||||
return
|
||||
return;
|
||||
}
|
||||
|
||||
if (DMSService.capabilities.length === 0) {
|
||||
return
|
||||
return;
|
||||
}
|
||||
|
||||
freedeskAvailable = DMSService.capabilities.includes("freedesktop")
|
||||
freedeskAvailable = DMSService.capabilities.includes("freedesktop");
|
||||
if (freedeskAvailable) {
|
||||
checkAccountsService()
|
||||
checkSettingsPortal()
|
||||
checkAccountsService();
|
||||
checkSettingsPortal();
|
||||
} else {
|
||||
console.info("PortalService: freedesktop capability not available in DMS")
|
||||
console.info("PortalService: freedesktop capability not available in DMS");
|
||||
}
|
||||
}
|
||||
|
||||
function checkAccountsService() {
|
||||
if (!freedeskAvailable)
|
||||
return
|
||||
|
||||
return;
|
||||
DMSService.sendRequest("freedesktop.getState", null, response => {
|
||||
if (response.result && response.result.accounts) {
|
||||
accountsServiceAvailable = response.result.accounts.available || false
|
||||
if (accountsServiceAvailable) {
|
||||
getSystemProfileImage()
|
||||
}
|
||||
}
|
||||
})
|
||||
if (response.result && response.result.accounts) {
|
||||
accountsServiceAvailable = response.result.accounts.available || false;
|
||||
if (accountsServiceAvailable) {
|
||||
getSystemProfileImage();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function checkSettingsPortal() {
|
||||
if (!freedeskAvailable)
|
||||
return
|
||||
|
||||
return;
|
||||
DMSService.sendRequest("freedesktop.getState", null, response => {
|
||||
if (response.result && response.result.settings) {
|
||||
settingsPortalAvailable = response.result.settings.available || false
|
||||
if (settingsPortalAvailable && SettingsData.syncModeWithPortal) {
|
||||
getSystemColorScheme()
|
||||
}
|
||||
}
|
||||
})
|
||||
if (response.result && response.result.settings) {
|
||||
settingsPortalAvailable = response.result.settings.available || false;
|
||||
if (settingsPortalAvailable && SettingsData.syncModeWithPortal) {
|
||||
getSystemColorScheme();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function getGreeterUserProfileImage(username) {
|
||||
if (!username) {
|
||||
profileImage = ""
|
||||
return
|
||||
profileImage = "";
|
||||
return;
|
||||
}
|
||||
userProfileCheckProcess.command = ["bash", "-c", `uid=$(id -u ${username} 2>/dev/null) && [ -n "$uid" ] && dbus-send --system --print-reply --dest=org.freedesktop.Accounts /org/freedesktop/Accounts/User$uid org.freedesktop.DBus.Properties.Get string:org.freedesktop.Accounts.User string:IconFile 2>/dev/null | grep -oP 'string "\\K[^"]+' || echo ""`]
|
||||
userProfileCheckProcess.running = true
|
||||
userProfileCheckProcess.command = ["bash", "-c", `uid=$(id -u ${username} 2>/dev/null) && [ -n "$uid" ] && dbus-send --system --print-reply --dest=org.freedesktop.Accounts /org/freedesktop/Accounts/User$uid org.freedesktop.DBus.Properties.Get string:org.freedesktop.Accounts.User string:IconFile 2>/dev/null | grep -oP 'string "\\K[^"]+' || echo ""`];
|
||||
userProfileCheckProcess.running = true;
|
||||
}
|
||||
|
||||
Process {
|
||||
@@ -260,18 +253,18 @@ Singleton {
|
||||
|
||||
stdout: StdioCollector {
|
||||
onStreamFinished: {
|
||||
const trimmed = text.trim()
|
||||
const trimmed = text.trim();
|
||||
if (trimmed && trimmed !== "" && !trimmed.includes("Error") && trimmed !== "/var/lib/AccountsService/icons/") {
|
||||
root.profileImage = trimmed
|
||||
root.profileImage = trimmed;
|
||||
} else {
|
||||
root.profileImage = ""
|
||||
root.profileImage = "";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
onExited: exitCode => {
|
||||
if (exitCode !== 0) {
|
||||
root.profileImage = ""
|
||||
root.profileImage = "";
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -283,11 +276,11 @@ Singleton {
|
||||
|
||||
stdout: StdioCollector {
|
||||
onStreamFinished: {
|
||||
const cmd = text.trim()
|
||||
const cmd = text.trim();
|
||||
if (cmd.includes("gsettings")) {
|
||||
root.colorSchemeCommand = "gsettings"
|
||||
root.colorSchemeCommand = "gsettings";
|
||||
} else if (cmd.includes("dconf")) {
|
||||
root.colorSchemeCommand = "dconf"
|
||||
root.colorSchemeCommand = "dconf";
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -297,27 +290,27 @@ Singleton {
|
||||
target: "profile"
|
||||
|
||||
function getImage(): string {
|
||||
return root.profileImage
|
||||
return root.profileImage;
|
||||
}
|
||||
|
||||
function setImage(path: string): string {
|
||||
if (!path) {
|
||||
return "ERROR: No path provided"
|
||||
return "ERROR: No path provided";
|
||||
}
|
||||
|
||||
const absolutePath = path.startsWith("/") ? path : `${StandardPaths.writableLocation(StandardPaths.HomeLocation)}/${path}`
|
||||
const absolutePath = path.startsWith("/") ? path : `${StandardPaths.writableLocation(StandardPaths.HomeLocation)}/${path}`;
|
||||
|
||||
try {
|
||||
root.setProfileImage(absolutePath)
|
||||
return "SUCCESS: Profile image set to " + absolutePath
|
||||
root.setProfileImage(absolutePath);
|
||||
return "SUCCESS: Profile image set to " + absolutePath;
|
||||
} catch (e) {
|
||||
return "ERROR: Failed to set profile image: " + e.toString()
|
||||
return "ERROR: Failed to set profile image: " + e.toString();
|
||||
}
|
||||
}
|
||||
|
||||
function clearImage(): string {
|
||||
root.setProfileImage("")
|
||||
return "SUCCESS: Profile image cleared"
|
||||
root.setProfileImage("");
|
||||
return "SUCCESS: Profile image cleared";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -81,14 +81,14 @@ Singleton {
|
||||
|
||||
if (response.error) {
|
||||
importError = response.error;
|
||||
ToastService.showError(I18n.tr("Failed to import VPN"));
|
||||
ToastService.showError(I18n.tr("Failed to import VPN"), response.error);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!response.result)
|
||||
return;
|
||||
if (response.result.success) {
|
||||
ToastService.showInfo(I18n.tr("VPN imported: ") + (response.result.name || ""));
|
||||
ToastService.showInfo(I18n.tr("VPN imported: %1").arg(response.result.name || ""));
|
||||
DMSNetworkService.refreshVpnProfiles();
|
||||
importComplete(response.result.uuid || "", response.result.name || "");
|
||||
return;
|
||||
@@ -111,7 +111,7 @@ Singleton {
|
||||
configLoading = false;
|
||||
|
||||
if (response.error) {
|
||||
ToastService.showError(I18n.tr("Failed to load VPN config"));
|
||||
ToastService.showError(I18n.tr("Failed to load VPN config"), response.error);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -137,7 +137,7 @@ Singleton {
|
||||
|
||||
DMSService.sendRequest("network.vpn.updateConfig", params, response => {
|
||||
if (response.error) {
|
||||
ToastService.showError(I18n.tr("Failed to update VPN"));
|
||||
ToastService.showError(I18n.tr("Failed to update VPN"), response.error);
|
||||
return;
|
||||
}
|
||||
ToastService.showInfo(I18n.tr("VPN configuration updated"));
|
||||
@@ -153,7 +153,7 @@ Singleton {
|
||||
uuid: uuidOrName
|
||||
}, response => {
|
||||
if (response.error) {
|
||||
ToastService.showError(I18n.tr("Failed to delete VPN"));
|
||||
ToastService.showError(I18n.tr("Failed to delete VPN"), response.error);
|
||||
return;
|
||||
}
|
||||
ToastService.showInfo(I18n.tr("VPN deleted"));
|
||||
|
||||
@@ -51,8 +51,8 @@ Rectangle {
|
||||
return I18n.tr("Active: None");
|
||||
const names = DMSNetworkService.activeNames || [];
|
||||
if (names.length <= 1)
|
||||
return I18n.tr("Active: ") + (names[0] || "VPN");
|
||||
return I18n.tr("Active: ") + names[0] + " +" + (names.length - 1);
|
||||
return I18n.tr("Active: %1").arg(names[0] || "VPN");
|
||||
return I18n.tr("Active: %1 +%2").arg(names[0]).arg(names.length - 1);
|
||||
}
|
||||
font.pixelSize: Theme.fontSizeMedium
|
||||
color: Theme.surfaceText
|
||||
@@ -214,7 +214,7 @@ Rectangle {
|
||||
onDeleteRequested: {
|
||||
deleteConfirm.showWithOptions({
|
||||
"title": I18n.tr("Delete VPN"),
|
||||
"message": I18n.tr("Delete \"") + modelData.name + "\"?",
|
||||
"message": I18n.tr("Delete \"%1\"?").arg(modelData.name),
|
||||
"confirmText": I18n.tr("Delete"),
|
||||
"confirmColor": Theme.error,
|
||||
"onConfirm": () => VPNService.deleteVpn(modelData.uuid)
|
||||
|
||||
@@ -243,7 +243,7 @@ def save_sync_state():
|
||||
|
||||
def main():
|
||||
if len(sys.argv) < 2:
|
||||
error("Usage: i18nsync.py [check|sync|test]")
|
||||
error("Usage: i18nsync.py [check|sync|test|local]")
|
||||
|
||||
command = sys.argv[1]
|
||||
|
||||
@@ -315,6 +315,39 @@ def main():
|
||||
save_sync_state()
|
||||
info("Already in sync")
|
||||
|
||||
elif command == "local":
|
||||
info("Updating en.json locally (no POEditor sync)")
|
||||
|
||||
old_en = normalize_json(EN_JSON)
|
||||
old_terms = {entry['term']: entry for entry in old_en} if isinstance(old_en, list) else {}
|
||||
|
||||
extract_strings()
|
||||
|
||||
new_en = normalize_json(EN_JSON)
|
||||
new_terms = {entry['term']: entry for entry in new_en} if isinstance(new_en, list) else {}
|
||||
|
||||
added = set(new_terms.keys()) - set(old_terms.keys())
|
||||
removed = set(old_terms.keys()) - set(new_terms.keys())
|
||||
|
||||
if added:
|
||||
info(f"\n+{len(added)} new terms:")
|
||||
for term in sorted(added)[:20]:
|
||||
print(f" + {term[:60]}...")
|
||||
if len(added) > 20:
|
||||
print(f" ... and {len(added) - 20} more")
|
||||
|
||||
if removed:
|
||||
info(f"\n-{len(removed)} removed terms:")
|
||||
for term in sorted(removed)[:20]:
|
||||
print(f" - {term[:60]}...")
|
||||
if len(removed) > 20:
|
||||
print(f" ... and {len(removed) - 20} more")
|
||||
|
||||
success(f"\n✓ {len(new_en)} total terms")
|
||||
|
||||
if not added and not removed:
|
||||
info("No changes detected")
|
||||
|
||||
else:
|
||||
error(f"Unknown command: {command}")
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -7,23 +7,26 @@ from collections import defaultdict
|
||||
|
||||
def extract_qstr_strings(root_dir):
|
||||
translations = defaultdict(lambda: {'contexts': set(), 'occurrences': []})
|
||||
qstr_pattern = re.compile(r'qsTr\(["\']([^"\']+)["\']\)')
|
||||
i18n_pattern_with_context = re.compile(r'I18n\.tr\(["\']([^"\']+)["\']\s*,\s*["\']([^"\']+)["\']\)')
|
||||
i18n_pattern_simple = re.compile(r'I18n\.tr\(["\']([^"\']+)["\']\)')
|
||||
qstr_pattern_double = re.compile(r'qsTr\("([^"]+)"\)')
|
||||
qstr_pattern_single = re.compile(r"qsTr\('([^']+)'\)")
|
||||
i18n_pattern_with_context_double = re.compile(r'I18n\.tr\("([^"]+)"\s*,\s*"([^"]+)"\)')
|
||||
i18n_pattern_with_context_single = re.compile(r"I18n\.tr\('([^']+)'\s*,\s*'([^']+)'\)")
|
||||
i18n_pattern_simple_double = re.compile(r'I18n\.tr\("([^"]+)"\)')
|
||||
i18n_pattern_simple_single = re.compile(r"I18n\.tr\('([^']+)'\)")
|
||||
|
||||
for qml_file in Path(root_dir).rglob('*.qml'):
|
||||
relative_path = qml_file.relative_to(root_dir)
|
||||
|
||||
with open(qml_file, 'r', encoding='utf-8') as f:
|
||||
for line_num, line in enumerate(f, 1):
|
||||
qstr_matches = qstr_pattern.findall(line)
|
||||
qstr_matches = qstr_pattern_double.findall(line) + qstr_pattern_single.findall(line)
|
||||
for match in qstr_matches:
|
||||
translations[match]['occurrences'].append({
|
||||
'file': str(relative_path),
|
||||
'line': line_num
|
||||
})
|
||||
|
||||
i18n_with_context = i18n_pattern_with_context.findall(line)
|
||||
i18n_with_context = i18n_pattern_with_context_double.findall(line) + i18n_pattern_with_context_single.findall(line)
|
||||
for term, context in i18n_with_context:
|
||||
translations[term]['contexts'].add(context)
|
||||
translations[term]['occurrences'].append({
|
||||
@@ -31,9 +34,10 @@ def extract_qstr_strings(root_dir):
|
||||
'line': line_num
|
||||
})
|
||||
|
||||
i18n_simple = i18n_pattern_simple.findall(line)
|
||||
for match in i18n_simple:
|
||||
if not i18n_pattern_with_context.search(line):
|
||||
has_context = i18n_pattern_with_context_double.search(line) or i18n_pattern_with_context_single.search(line)
|
||||
if not has_context:
|
||||
i18n_simple = i18n_pattern_simple_double.findall(line) + i18n_pattern_simple_single.findall(line)
|
||||
for match in i18n_simple:
|
||||
translations[match]['occurrences'].append({
|
||||
'file': str(relative_path),
|
||||
'line': line_num
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user