From 621c798c8beaf3099ee1071bbd48950a9ce151ad Mon Sep 17 00:00:00 2001 From: Lemmy Date: Thu, 2 Apr 2026 16:58:25 -0400 Subject: [PATCH] fix(location): autolocate off by default for privacy, improved UI when no location is set. Fix #2388 --- Assets/Translations/en.json | 1 + Commons/Settings.qml | 2 +- Modules/Cards/CalendarHeaderCard.qml | 2 ++ Modules/Cards/WeatherCard.qml | 30 +++++++++++++------ .../DesktopWidgets/Widgets/DesktopWeather.qml | 6 ++-- Services/Location/LocationService.qml | 3 ++ 6 files changed, 31 insertions(+), 13 deletions(-) diff --git a/Assets/Translations/en.json b/Assets/Translations/en.json index ece80bc7d..c28ee3718 100644 --- a/Assets/Translations/en.json +++ b/Assets/Translations/en.json @@ -550,6 +550,7 @@ "wallpaper": "Wallpaper", "weather": "Weather", "weather-loading": "Loading weather...", + "weather-no-location": "Set a location in Settings to see weather", "week": "Week", "widgets": "Widgets", "width": "Width", diff --git a/Commons/Settings.qml b/Commons/Settings.qml index da1a4fb92..d4deed9e8 100644 --- a/Commons/Settings.qml +++ b/Commons/Settings.qml @@ -352,7 +352,7 @@ Singleton { property int firstDayOfWeek: -1 // -1 = auto (use locale), 0 = Sunday, 1 = Monday, 6 = Saturday property bool hideWeatherTimezone: false property bool hideWeatherCityName: false - property bool autoLocate: true + property bool autoLocate: false } // calendar diff --git a/Modules/Cards/CalendarHeaderCard.qml b/Modules/Cards/CalendarHeaderCard.qml index cd07cf3b5..23c5fbe6d 100644 --- a/Modules/Cards/CalendarHeaderCard.qml +++ b/Modules/Cards/CalendarHeaderCard.qml @@ -90,6 +90,8 @@ Rectangle { text: { if (!Settings.data.location.weatherEnabled) return ""; + if (!LocationService.locationConfigured) + return I18n.tr("common.weather-no-location"); if (!root.weatherReady) return I18n.tr("common.weather-loading"); if (Settings.data.location.hideWeatherCityName) diff --git a/Modules/Cards/WeatherCard.qml b/Modules/Cards/WeatherCard.qml index ba6686f80..0dd5cb42d 100644 --- a/Modules/Cards/WeatherCard.qml +++ b/Modules/Cards/WeatherCard.qml @@ -97,6 +97,7 @@ NBox { clip: true RowLayout { + visible: weatherReady Layout.fillWidth: true spacing: Style.marginS @@ -115,14 +116,14 @@ NBox { readonly property int mainWeatherIconSide: Math.round(Style.fontSizeXXXL * 1.75 * Style.uiScaleRatio * 1.6) NIcon { - visible: !LocationService.taliaWeatherMascotActive || !weatherReady + visible: !LocationService.taliaWeatherMascotActive anchors.centerIn: parent - icon: weatherReady ? LocationService.weatherSymbolFromCode(LocationService.data.weather.current_weather.weathercode) : "weather-cloud-off" + icon: weatherReady ? LocationService.weatherSymbolFromCode(LocationService.data.weather.current_weather.weathercode) : "" pointSize: Style.fontSizeXXXL * 1.75 color: Color.mPrimary } Loader { - active: LocationService.taliaWeatherMascotActive && weatherReady + active: LocationService.taliaWeatherMascotActive anchors.fill: parent asynchronous: true sourceComponent: Component { @@ -153,11 +154,9 @@ NBox { RowLayout { NText { - visible: weatherReady text: { - if (!weatherReady) { + if (!weatherReady) return ""; - } var temp = LocationService.data.weather.current_weather.temperature; var suffix = "C"; if (Settings.data.location.useFahrenheit) { @@ -258,10 +257,23 @@ NBox { } } - Loader { - active: !weatherReady + ColumnLayout { + visible: !weatherReady Layout.alignment: Qt.AlignCenter - sourceComponent: NBusyIndicator {} + spacing: Style.marginS + + NBusyIndicator { + Layout.alignment: Qt.AlignCenter + visible: LocationService.locationConfigured + } + + NText { + visible: !LocationService.locationConfigured + Layout.alignment: Qt.AlignCenter + text: I18n.tr("common.weather-no-location") + pointSize: Style.fontSizeS + color: Color.mOnSurfaceVariant + } } } } diff --git a/Modules/DesktopWidgets/Widgets/DesktopWeather.qml b/Modules/DesktopWidgets/Widgets/DesktopWeather.qml index eb7906b46..21a11eb14 100644 --- a/Modules/DesktopWidgets/Widgets/DesktopWeather.qml +++ b/Modules/DesktopWidgets/Widgets/DesktopWeather.qml @@ -64,7 +64,7 @@ DraggableDesktopWidget { NIcon { visible: !LocationService.taliaWeatherMascotActive || !weatherReady anchors.centerIn: parent - icon: weatherReady ? LocationService.weatherSymbolFromCode(currentWeatherCode) : "weather-cloud-off" + icon: weatherReady ? LocationService.weatherSymbolFromCode(currentWeatherCode) : (LocationService.locationConfigured ? "weather-cloud-off" : "map-pin-off") pointSize: Math.round(Style.fontSizeXXXL * 2 * widgetScale) color: weatherReady ? Color.mPrimary : Color.mOnSurfaceVariant } @@ -86,7 +86,7 @@ DraggableDesktopWidget { } NText { - text: weatherReady ? `${currentTemp}°${tempUnit}` : "---" + text: weatherReady ? `${currentTemp}°${tempUnit}` : "--" pointSize: Math.round(Style.fontSizeXXXL * widgetScale) font.weight: Style.fontWeightBold color: Color.mOnSurface @@ -99,7 +99,7 @@ DraggableDesktopWidget { NText { Layout.fillWidth: true - text: locationName || "No location" + text: locationName || I18n.tr("common.weather-no-location") pointSize: Math.round(Style.fontSizeS * widgetScale) font.weight: Style.fontWeightRegular color: Color.mOnSurfaceVariant diff --git a/Services/Location/LocationService.qml b/Services/Location/LocationService.qml index e87d9dc37..b48baf81f 100644 --- a/Services/Location/LocationService.qml +++ b/Services/Location/LocationService.qml @@ -26,6 +26,9 @@ Singleton { readonly property alias data: adapter + // True when the user has set a location name or enabled auto-locate + readonly property bool locationConfigured: Settings.data.location.name !== "" || Settings.data.location.autoLocate + // Stable UI properties - only updated when location is successfully geocoded property bool coordinatesReady: false property string stableLatitude: ""