use common.enabled/disabled for toasts

This commit is contained in:
notiant
2026-01-20 18:41:05 +01:00
committed by GitHub
parent 1ef5c0eb30
commit df41a1fd6e
7 changed files with 14 additions and 14 deletions
@@ -40,7 +40,7 @@ ColumnLayout {
if (exitCode === 0) { if (exitCode === 0) {
Settings.data.nightLight.enabled = true; Settings.data.nightLight.enabled = true;
NightLightService.apply(); NightLightService.apply();
ToastService.showNotice(I18n.tr("common.night-light"), I18n.tr("toast.wifi.enabled"), "nightlight-on"); ToastService.showNotice(I18n.tr("common.night-light"), I18n.tr("common.enabled"), "nightlight-on");
} else { } else {
Settings.data.nightLight.enabled = false; Settings.data.nightLight.enabled = false;
ToastService.showWarning(I18n.tr("common.night-light"), I18n.tr("toast.night-light.not-installed")); ToastService.showWarning(I18n.tr("common.night-light"), I18n.tr("toast.night-light.not-installed"));
@@ -26,7 +26,7 @@ ColumnLayout {
Settings.data.nightLight.enabled = false; Settings.data.nightLight.enabled = false;
Settings.data.nightLight.forced = false; Settings.data.nightLight.forced = false;
NightLightService.apply(); NightLightService.apply();
ToastService.showNotice(I18n.tr("common.night-light"), I18n.tr("toast.wifi.disabled"), "nightlight-off"); ToastService.showNotice(I18n.tr("common.night-light"), I18n.tr("common.disabled"), "nightlight-off");
} }
} }
} }
+1 -1
View File
@@ -65,7 +65,7 @@ Singleton {
apply(); apply();
// Toast: night light toggled // Toast: night light toggled
const enabled = !!Settings.data.nightLight.enabled; const enabled = !!Settings.data.nightLight.enabled;
ToastService.showNotice(I18n.tr("common.night-light"), enabled ? I18n.tr("toast.wifi.enabled") : I18n.tr("toast.wifi.disabled"), enabled ? "nightlight-on" : "nightlight-off"); ToastService.showNotice(I18n.tr("common.night-light"), enabled ? I18n.tr("common.enabled") : I18n.tr("common.disabled"), enabled ? "nightlight-on" : "nightlight-off");
} }
function onForcedChanged() { function onForcedChanged() {
apply(); apply();
+6 -6
View File
@@ -233,10 +233,10 @@ Singleton {
if (bluetoothBlockedToggled) { if (bluetoothBlockedToggled) {
checkWifiBlocked.running = true; checkWifiBlocked.running = true;
} else if (adapter.state === BluetoothAdapter.Enabled) { } else if (adapter.state === BluetoothAdapter.Enabled) {
ToastService.showNotice(I18n.tr("common.bluetooth"), I18n.tr("toast.wifi.enabled"), "bluetooth"); ToastService.showNotice(I18n.tr("common.bluetooth"), I18n.tr("common.enabled"), "bluetooth");
Logger.d("Bluetooth", "Adapter enabled"); Logger.d("Bluetooth", "Adapter enabled");
} else if (adapter.state === BluetoothAdapter.Disabled) { } else if (adapter.state === BluetoothAdapter.Disabled) {
ToastService.showNotice(I18n.tr("common.bluetooth"), I18n.tr("toast.wifi.disabled"), "bluetooth-off"); ToastService.showNotice(I18n.tr("common.bluetooth"), I18n.tr("common.disabled"), "bluetooth-off");
Logger.d("Bluetooth", "Adapter disabled"); Logger.d("Bluetooth", "Adapter disabled");
} }
} }
@@ -255,17 +255,17 @@ Singleton {
root.airplaneModeToggled = true; root.airplaneModeToggled = true;
root.lastWifiBlocked = true; root.lastWifiBlocked = true;
NetworkService.setWifiEnabled(false); NetworkService.setWifiEnabled(false);
ToastService.showNotice(I18n.tr("toast.airplane-mode.title"), I18n.tr("toast.wifi.enabled"), "plane"); ToastService.showNotice(I18n.tr("toast.airplane-mode.title"), I18n.tr("common.enabled"), "plane");
} else if (!wifiBlocked && lastWifiBlocked) { } else if (!wifiBlocked && lastWifiBlocked) {
root.airplaneModeToggled = true; root.airplaneModeToggled = true;
root.lastWifiBlocked = false; root.lastWifiBlocked = false;
NetworkService.setWifiEnabled(true); NetworkService.setWifiEnabled(true);
ToastService.showNotice(I18n.tr("toast.airplane-mode.title"), I18n.tr("toast.wifi.disabled"), "plane-off"); ToastService.showNotice(I18n.tr("toast.airplane-mode.title"), I18n.tr("common.disabled"), "plane-off");
} else if (adapter.enabled) { } else if (adapter.enabled) {
ToastService.showNotice(I18n.tr("common.bluetooth"), I18n.tr("toast.wifi.enabled"), "bluetooth"); ToastService.showNotice(I18n.tr("common.bluetooth"), I18n.tr("common.enabled"), "bluetooth");
Logger.d("Bluetooth", "Adapter enabled"); Logger.d("Bluetooth", "Adapter enabled");
} else { } else {
ToastService.showNotice(I18n.tr("common.bluetooth"), I18n.tr("toast.wifi.disabled"), "bluetooth-off"); ToastService.showNotice(I18n.tr("common.bluetooth"), I18n.tr("common.disabled"), "bluetooth-off");
Logger.d("Bluetooth", "Adapter disabled"); Logger.d("Bluetooth", "Adapter disabled");
} }
root.airplaneModeToggled = false; root.airplaneModeToggled = false;
+2 -2
View File
@@ -69,14 +69,14 @@ Singleton {
function onWifiEnabledChanged() { function onWifiEnabledChanged() {
if (Settings.data.network.wifiEnabled) { if (Settings.data.network.wifiEnabled) {
if (!BluetoothService.airplaneModeToggled) { if (!BluetoothService.airplaneModeToggled) {
ToastService.showNotice(I18n.tr("wifi.panel.title"), I18n.tr("toast.wifi.enabled"), "wifi"); ToastService.showNotice(I18n.tr("wifi.panel.title"), I18n.tr("common.enabled"), "wifi");
} }
// Perform a scan to update the UI // Perform a scan to update the UI
delayedScanTimer.interval = 3000; delayedScanTimer.interval = 3000;
delayedScanTimer.restart(); delayedScanTimer.restart();
} else { } else {
if (!BluetoothService.airplaneModeToggled) { if (!BluetoothService.airplaneModeToggled) {
ToastService.showNotice(I18n.tr("wifi.panel.title"), I18n.tr("toast.wifi.disabled"), "wifi-off"); ToastService.showNotice(I18n.tr("wifi.panel.title"), I18n.tr("common.disabled"), "wifi-off");
} }
// Clear networks so the widget icon changes // Clear networks so the widget icon changes
root.networks = ({}); root.networks = ({});
+2 -2
View File
@@ -218,7 +218,7 @@ Singleton {
if (activeInhibitors.includes("manual")) { if (activeInhibitors.includes("manual")) {
removeInhibitor("manual"); removeInhibitor("manual");
ToastService.showNotice(I18n.tr("tooltips.keep-awake"), I18n.tr("toast.wifi.disabled"), "keep-awake-off"); ToastService.showNotice(I18n.tr("tooltips.keep-awake"), I18n.tr("common.disabled"), "keep-awake-off");
Logger.i("IdleInhibitor", "Manual inhibition disabled"); Logger.i("IdleInhibitor", "Manual inhibition disabled");
} }
} }
@@ -226,7 +226,7 @@ Singleton {
function addManualInhibitor(timeoutSec) { function addManualInhibitor(timeoutSec) {
if (!activeInhibitors.includes("manual")) { if (!activeInhibitors.includes("manual")) {
addInhibitor("manual", "Manually activated by user"); addInhibitor("manual", "Manually activated by user");
ToastService.showNotice(I18n.tr("tooltips.keep-awake"), I18n.tr("toast.wifi.enabled"), "keep-awake-on"); ToastService.showNotice(I18n.tr("tooltips.keep-awake"), I18n.tr("common.enabled"), "keep-awake-on");
} }
if (timeoutSec === null && timeout === null) { if (timeoutSec === null && timeout === null) {
+1 -1
View File
@@ -27,7 +27,7 @@ Singleton {
// Toast: dark/light mode switched // Toast: dark/light mode switched
const enabled = !!Settings.data.colorSchemes.darkMode; const enabled = !!Settings.data.colorSchemes.darkMode;
const label = enabled ? I18n.tr("tooltips.switch-to-dark-mode") : I18n.tr("tooltips.switch-to-light-mode"); const label = enabled ? I18n.tr("tooltips.switch-to-dark-mode") : I18n.tr("tooltips.switch-to-light-mode");
const description = I18n.tr("toast.wifi.enabled"); const description = I18n.tr("common.enabled");
ToastService.showNotice(label, description, "dark-mode"); ToastService.showNotice(label, description, "dark-mode");
} }
} }