Files
08dde7f79a add: Cellular Network support (rebase of #2765) (#3096)
* feat: add cellular support

* fix(settings): resolve cellular tab index collision

* fix: address review feedback for cellular support

Bump the network API version, drop the deleted term freeze file,
regenerate the settings search index, and reuse existing translation
terms where they already cover the new cellular UI.

* fix: do not assign readonly userPreference when switching network type

Assigning SettingsData.networkPreference through the readonly alias
threw on click, so the Cellular segment in Control Center did nothing.

* fix: make Cellular selectable and the modem row clickable

The Control Center type switcher was bound only to preference, so
Cellular snapped back to Ethernet. The settings modem row highlighted
on hover but had no click handler. Show the modem as a connect target
when no APN profiles exist.

* fix: create a GSM profile when connecting cellular with none saved

Clicking Mobile broadband only activated an existing profile, so a
modem with no APN did nothing useful. Fall back to AddAndActivate
like ethernet connect.

* fix: address second round of cellular review feedback

- Guard cellularDevices map with devMutex via snapshot/by-iface/set/remove
  helpers, mirroring the existing ethernet and wifi accessors
- Regenerate mocks with mockery v3 instead of hand-editing mock_Backend.go
- Reuse refreshCellularState() in SetCellularEnabled, DisconnectCellular,
  DisconnectCellularDevice, ActivateCellularConnection and device removal
- Wrap retryErr rather than the first error when the auto-config retry fails
- Use Theme.surfaceTextSecondary/primaryHover/primaryHoverLight in the
  cellular-off state instead of hand-rolled Qt.rgba values
- Drop the duplicate "No devices found" label so it can no longer render
  twice with no modem and no saved config

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>

* fix: address remaining cellular review comments

- Toast "Failed to toggle cellular" instead of always "enable"
- Remove unused enableCellularRadio() wrappers
- Store Control Center network type as a value, not a list index

* fix: pass nmcli connection selector as separate argument

`nmcli con mod uuid:<UUID>` is not valid syntax -- nmcli expects the
selector keyword as its own argument, so every priority update failed
with "no such connection profile". Because practically every NM profile
has a UUID, this silently disabled autoconnect-priority and route-metric
updates for ethernet and WiFi as well as cellular.

Also fix the Cellular settings status text, which said "Connecting..."
for a flag that only tracks radio enable/disable, and add the seven
cellular terms that were missing from the translation catalogs.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>

* apply review comments

* fix lints

* update debug doc

* fix style inconsistencies

---------

Co-authored-by: Yechiel Worenklein <[email protected]>
Co-authored-by: Claude Opus 5 (1M context) <[email protected]>
Co-authored-by: bbedward <[email protected]>
2026-08-29 15:37:36 -04:00

810 lines
21 KiB
QML

import QtQuick
import qs.Common
import qs.Modules.Settings
import qs.Services
import qs.Widgets
FocusScope {
id: root
LayoutMirroring.enabled: I18n.isRtl
LayoutMirroring.childrenInherit: true
property int currentIndex: 0
property var parentModal: null
property string pendingPluginId: ""
focus: true
function openPluginSettings(pluginId) {
pendingPluginId = pluginId || "";
if (currentIndex === 12)
Qt.callLater(applyPendingPluginSettings);
}
function applyPendingPluginSettings() {
if (!pendingPluginId || !pluginsLoader.item)
return;
pluginsLoader.item.openPluginSettings(pendingPluginId);
pendingPluginId = "";
}
onCurrentIndexChanged: {
if (currentIndex === 12 && pendingPluginId)
Qt.callLater(applyPendingPluginSettings);
}
Rectangle {
anchors.fill: parent
anchors.leftMargin: Theme.spacingS
anchors.rightMargin: (parentModal && parentModal.isCompactMode) ? Theme.spacingS : (32 + Theme.spacingS)
anchors.bottomMargin: 0
anchors.topMargin: 0
color: "transparent"
Loader {
id: wallpaperLoader
anchors.fill: parent
active: root.currentIndex === 0
visible: active
focus: active
sourceComponent: Component {
WallpaperTab {
parentModal: root.parentModal
}
}
onActiveChanged: {
if (active && item)
Qt.callLater(() => item.forceActiveFocus());
}
}
Loader {
id: timeWeatherLoader
anchors.fill: parent
active: root.currentIndex === 1
visible: active
focus: active
sourceComponent: TimeWeatherTab {}
onActiveChanged: {
if (active && item)
Qt.callLater(() => item.forceActiveFocus());
}
}
Loader {
id: keybindsLoader
anchors.fill: parent
active: root.currentIndex === 2
visible: active
focus: active
sourceComponent: KeybindsTab {
parentModal: root.parentModal
requestedSearchQuery: root.parentModal?.keybindSearchQuery ?? ""
}
onActiveChanged: {
if (active && item)
Qt.callLater(() => item.forceActiveFocus());
}
}
Loader {
id: topBarLoader
anchors.fill: parent
active: root.currentIndex === 3
visible: active
focus: active
sourceComponent: DankBarTab {
parentModal: root.parentModal
}
onActiveChanged: {
if (active && item)
Qt.callLater(() => item.forceActiveFocus());
}
}
Loader {
id: workspacesLoader
anchors.fill: parent
active: root.currentIndex === 4
visible: active
focus: active
sourceComponent: WorkspacesTab {}
onActiveChanged: {
if (active && item)
Qt.callLater(() => item.forceActiveFocus());
}
}
Loader {
id: compositorLayoutLoader
anchors.fill: parent
active: root.currentIndex === 37
visible: active
focus: active
sourceComponent: CompositorLayoutTab {}
onActiveChanged: {
if (active && item)
Qt.callLater(() => item.forceActiveFocus());
}
}
Loader {
id: windowRulesLoader
property bool loadedOnce: false
anchors.fill: parent
active: root.currentIndex === 38 || loadedOnce
visible: root.currentIndex === 38 && status === Loader.Ready
focus: visible
asynchronous: true
sourceComponent: WindowRulesTab {
pageActive: root.currentIndex === 38
}
onLoaded: loadedOnce = true
}
DankSpinner {
anchors.centerIn: parent
visible: root.currentIndex === 38 && windowRulesLoader.status === Loader.Loading
}
Loader {
id: dankBarAppearanceLoader
anchors.fill: parent
active: root.currentIndex === 6
visible: active
focus: active
sourceComponent: DankBarAppearanceTab {
parentModal: root.parentModal
}
onActiveChanged: {
if (active && item)
Qt.callLater(() => item.forceActiveFocus());
}
}
Loader {
id: dockLoader
anchors.fill: parent
active: root.currentIndex === 5
visible: active
focus: active
sourceComponent: Component {
DockTab {
parentModal: root.parentModal
}
}
onActiveChanged: {
if (active && item)
Qt.callLater(() => item.forceActiveFocus());
}
}
Loader {
id: displayConfigLoader
anchors.fill: parent
active: root.currentIndex === 24
visible: active
focus: active
sourceComponent: DisplayConfigTab {}
onActiveChanged: {
if (active && item)
Qt.callLater(() => item.forceActiveFocus());
}
}
Loader {
id: gammaControlLoader
anchors.fill: parent
active: root.currentIndex === 25
visible: active
focus: active
sourceComponent: GammaControlTab {}
onActiveChanged: {
if (active && item)
Qt.callLater(() => item.forceActiveFocus());
}
}
Loader {
id: displayWidgetsLoader
anchors.fill: parent
active: root.currentIndex === 26
visible: active
focus: active
sourceComponent: DisplayWidgetsTab {}
onActiveChanged: {
if (active && item)
Qt.callLater(() => item.forceActiveFocus());
}
}
Loader {
id: networkLoader
anchors.fill: parent
active: root.currentIndex === 7
visible: active
focus: active
sourceComponent: NetworkStatusTab {}
onActiveChanged: {
if (active && item)
Qt.callLater(() => item.forceActiveFocus());
}
}
Loader {
id: networkEthernetLoader
anchors.fill: parent
active: root.currentIndex === 39
visible: active
focus: active
sourceComponent: NetworkEthernetTab {}
onActiveChanged: {
if (active && item)
Qt.callLater(() => item.forceActiveFocus());
}
}
Loader {
id: networkWifiLoader
anchors.fill: parent
active: root.currentIndex === 40
visible: active
focus: active
sourceComponent: NetworkWifiTab {}
onActiveChanged: {
if (active && item)
Qt.callLater(() => item.forceActiveFocus());
}
}
Loader {
id: networkVpnLoader
anchors.fill: parent
active: root.currentIndex === 41
visible: active
focus: active
sourceComponent: NetworkVpnTab {}
onActiveChanged: {
if (active && item)
Qt.callLater(() => item.forceActiveFocus());
}
}
Loader {
id: networkCellularLoader
anchors.fill: parent
active: root.currentIndex === 47
visible: active
focus: active
sourceComponent: NetworkCellularTab {}
onActiveChanged: {
if (active && item)
Qt.callLater(() => item.forceActiveFocus());
}
}
Loader {
id: printerLoader
anchors.fill: parent
active: root.currentIndex === 8
visible: active
focus: active
sourceComponent: PrinterTab {}
onActiveChanged: {
if (active && item)
Qt.callLater(() => item.forceActiveFocus());
}
}
Loader {
id: launcherLoader
anchors.fill: parent
active: root.currentIndex === 9
visible: active
focus: active
sourceComponent: LauncherTab {
parentModal: root.parentModal
}
onActiveChanged: {
if (active && item)
Qt.callLater(() => item.forceActiveFocus());
}
}
Loader {
id: themeColorsLoader
anchors.fill: parent
active: root.currentIndex === 10
visible: active
focus: active
sourceComponent: ThemeColorsTab {
parentModal: root.parentModal
}
onActiveChanged: {
if (active && item)
Qt.callLater(() => item.forceActiveFocus());
}
}
Loader {
id: lockScreenLoader
anchors.fill: parent
active: root.currentIndex === 11
visible: active
focus: active
sourceComponent: LockScreenTab {}
onActiveChanged: {
if (active && item)
Qt.callLater(() => item.forceActiveFocus());
}
}
Loader {
id: greeterLoader
anchors.fill: parent
active: root.currentIndex === 31
visible: active
focus: active
sourceComponent: GreeterTab {}
onActiveChanged: {
if (active && item)
Qt.callLater(() => item.forceActiveFocus());
}
}
Loader {
id: pluginsLoader
anchors.fill: parent
active: root.currentIndex === 12
visible: active
focus: active
sourceComponent: PluginsTab {
parentModal: root.parentModal
}
onActiveChanged: {
if (active && item)
Qt.callLater(() => item.forceActiveFocus());
if (active)
Qt.callLater(root.applyPendingPluginSettings);
}
onLoaded: {
if (visible)
Qt.callLater(root.applyPendingPluginSettings);
}
}
Loader {
id: aboutLoader
anchors.fill: parent
active: root.currentIndex === 13
visible: active
focus: active
sourceComponent: AboutTab {}
onActiveChanged: {
if (active && item)
Qt.callLater(() => item.forceActiveFocus());
}
}
Loader {
id: typographyMotionLoader
anchors.fill: parent
active: root.currentIndex === 14
visible: active
focus: active
sourceComponent: TypographyMotionTab {}
onActiveChanged: {
if (active && item)
Qt.callLater(() => item.forceActiveFocus());
}
}
Loader {
id: soundsLoader
anchors.fill: parent
active: root.currentIndex === 15
visible: active
focus: active
sourceComponent: SoundsTab {}
onActiveChanged: {
if (active && item)
Qt.callLater(() => item.forceActiveFocus());
}
}
Loader {
id: mediaPlayerLoader
anchors.fill: parent
active: root.currentIndex === 16
visible: active
focus: active
sourceComponent: MediaPlayerTab {
parentModal: root.parentModal
}
onActiveChanged: {
if (active && item)
Qt.callLater(() => item.forceActiveFocus());
}
}
Loader {
id: notificationsLoader
anchors.fill: parent
active: root.currentIndex === 17
visible: active
focus: active
sourceComponent: NotificationsTab {}
onActiveChanged: {
if (active && item)
Qt.callLater(() => item.forceActiveFocus());
}
}
Loader {
id: osdLoader
anchors.fill: parent
active: root.currentIndex === 18
visible: active
focus: active
sourceComponent: OSDTab {}
onActiveChanged: {
if (active && item)
Qt.callLater(() => item.forceActiveFocus());
}
}
Loader {
id: defaultAppsLoader
anchors.fill: parent
active: root.currentIndex === 34
visible: active
focus: active
sourceComponent: DefaultAppsTab {}
onActiveChanged: {
if (active && item)
Qt.callLater(() => item.forceActiveFocus());
}
}
Loader {
id: runningAppsLoader
anchors.fill: parent
active: root.currentIndex === 19
visible: active
focus: active
sourceComponent: RunningAppsTab {}
onActiveChanged: {
if (active && item)
Qt.callLater(() => item.forceActiveFocus());
}
}
Loader {
id: systemUpdaterLoader
anchors.fill: parent
active: root.currentIndex === 20
visible: active
focus: active
sourceComponent: SystemUpdaterTab {}
onActiveChanged: {
if (active && item)
Qt.callLater(() => item.forceActiveFocus());
}
}
Loader {
id: powerSleepLoader
anchors.fill: parent
active: root.currentIndex === 21
visible: active
focus: active
sourceComponent: PowerSleepTab {}
onActiveChanged: {
if (active && item)
Qt.callLater(() => item.forceActiveFocus());
}
}
Loader {
id: widgetsLoader
property bool loadedOnce: false
anchors.fill: parent
active: root.currentIndex === 22 || loadedOnce
visible: root.currentIndex === 22 && status === Loader.Ready
focus: visible
asynchronous: true
sourceComponent: WidgetsTab {
parentModal: root.parentModal
}
onLoaded: {
loadedOnce = true;
if (visible && item)
Qt.callLater(() => item.forceActiveFocus());
}
onVisibleChanged: {
if (visible && item)
Qt.callLater(() => item.forceActiveFocus());
}
}
DankSpinner {
anchors.centerIn: parent
visible: root.currentIndex === 22 && widgetsLoader.status === Loader.Loading
}
Loader {
id: clipboardLoader
anchors.fill: parent
active: root.currentIndex === 23
visible: active
focus: active
sourceComponent: ClipboardTab {}
onActiveChanged: {
if (active && item)
Qt.callLater(() => item.forceActiveFocus());
}
}
Loader {
id: desktopWidgetsLoader
anchors.fill: parent
active: root.currentIndex === 27
visible: active
focus: active
sourceComponent: DesktopWidgetsTab {
parentModal: root.parentModal
}
onActiveChanged: {
if (active && item)
Qt.callLater(() => item.forceActiveFocus());
}
}
Loader {
id: audioLoader
anchors.fill: parent
active: root.currentIndex === 29
visible: active
focus: active
sourceComponent: AudioTab {}
onActiveChanged: {
if (active && item)
Qt.callLater(() => item.forceActiveFocus());
}
}
Loader {
id: localeLoader
anchors.fill: parent
active: root.currentIndex === 30
visible: active
focus: active
sourceComponent: LocaleTab {}
onActiveChanged: {
if (active && item)
Qt.callLater(() => item.forceActiveFocus());
}
}
Loader {
id: muxLoader
anchors.fill: parent
active: root.currentIndex === 32
visible: active
focus: active
sourceComponent: MuxTab {}
onActiveChanged: {
if (active && item)
Qt.callLater(() => item.forceActiveFocus());
}
}
Loader {
id: frameLoader
anchors.fill: parent
active: root.currentIndex === 33
visible: active
focus: active
sourceComponent: FrameTab {}
onActiveChanged: {
if (active && item)
Qt.callLater(() => item.forceActiveFocus());
}
}
Loader {
id: dankIslandLoader
anchors.fill: parent
active: root.currentIndex === 46
visible: active
focus: active
sourceComponent: DankIslandTab {
parentModal: root.parentModal
}
onActiveChanged: {
if (active && item)
Qt.callLater(() => item.forceActiveFocus());
}
}
Loader {
id: usersLoader
anchors.fill: parent
active: root.currentIndex === 35
visible: active
focus: active
sourceComponent: UsersTab {}
onActiveChanged: {
if (active && item)
Qt.callLater(() => item.forceActiveFocus());
}
}
Loader {
id: autoStartLoader
anchors.fill: parent
active: root.currentIndex === 36
visible: active
focus: active
sourceComponent: AutoStartTab {
parentModal: root.parentModal
}
onActiveChanged: {
if (active && item)
Qt.callLater(() => item.forceActiveFocus());
}
}
Loader {
id: batteryLoader
anchors.fill: parent
active: root.currentIndex === 42
visible: active
focus: active
sourceComponent: BatteryTab {}
onActiveChanged: {
if (active && item)
Qt.callLater(() => item.forceActiveFocus());
}
}
Loader {
id: dankDashLoader
anchors.fill: parent
active: root.currentIndex === 43
visible: active
focus: active
sourceComponent: DankDashTab {}
onActiveChanged: {
if (active && item)
Qt.callLater(() => item.forceActiveFocus());
}
}
Loader {
id: mouseTouchpadLoader
anchors.fill: parent
active: root.currentIndex === 44
visible: active
focus: active
sourceComponent: MouseTouchpadTab {}
onActiveChanged: {
if (active && item)
Qt.callLater(() => item.forceActiveFocus());
}
}
Loader {
id: keyboardLoader
anchors.fill: parent
active: root.currentIndex === 45
visible: active
focus: active
sourceComponent: KeyboardTab {}
onActiveChanged: {
if (active && item)
Qt.callLater(() => item.forceActiveFocus());
}
}
}
}