From 84dbabc772e83166f7367e2d22f32df8217bba4c Mon Sep 17 00:00:00 2001 From: jpirnay Date: Wed, 15 Apr 2026 12:52:49 +0200 Subject: [PATCH] Remaining incompatibilities --- .../home/GlobalBookmarksActivity.cpp | 2 +- .../reader/StarredPagesActivity.cpp | 2 +- .../weather/WeatherSettingsActivity.cpp | 110 +++++++++--------- 3 files changed, 57 insertions(+), 57 deletions(-) diff --git a/src/activities/home/GlobalBookmarksActivity.cpp b/src/activities/home/GlobalBookmarksActivity.cpp index d40482a9..09912068 100644 --- a/src/activities/home/GlobalBookmarksActivity.cpp +++ b/src/activities/home/GlobalBookmarksActivity.cpp @@ -183,7 +183,7 @@ void GlobalBookmarksActivity::renameSelected() { entry.bookmarks[bookmarkIndex].name.empty() ? getRowTitle(selectorIndex) : entry.bookmarks[bookmarkIndex].name; startActivityForResult(std::make_unique(renderer, mappedInput, tr(STR_RENAME), initial, - BookmarkStore::MAX_NAME_LENGTH, false), + BookmarkStore::MAX_NAME_LENGTH, InputType::Text), [this, bookIndex, bookmarkIndex](const ActivityResult& result) { if (!result.isCancelled) { const auto& kr = std::get(result.data); diff --git a/src/activities/reader/StarredPagesActivity.cpp b/src/activities/reader/StarredPagesActivity.cpp index 2a9c6123..6735a15b 100644 --- a/src/activities/reader/StarredPagesActivity.cpp +++ b/src/activities/reader/StarredPagesActivity.cpp @@ -49,7 +49,7 @@ void StarredPagesActivity::startRename() { const std::string initial = all[renamingIndex].name.empty() ? getDefaultLabel(renamingIndex) : all[renamingIndex].name; startActivityForResult(std::make_unique(renderer, mappedInput, tr(STR_RENAME), initial, - BookmarkStore::MAX_NAME_LENGTH, false), + BookmarkStore::MAX_NAME_LENGTH, InputType::Text), [this, renamingIndex](const ActivityResult& result) { if (!result.isCancelled) { const auto& kr = std::get(result.data); diff --git a/src/activities/weather/WeatherSettingsActivity.cpp b/src/activities/weather/WeatherSettingsActivity.cpp index 7550d969..8f3fdbd4 100644 --- a/src/activities/weather/WeatherSettingsActivity.cpp +++ b/src/activities/weather/WeatherSettingsActivity.cpp @@ -114,71 +114,71 @@ void WeatherSettingsActivity::handleSelection() { } void WeatherSettingsActivity::launchCitySearch() { - startActivityForResult( - std::make_unique(renderer, mappedInput, tr(STR_WEATHER_SEARCH_CITY), "", 64, false), - [this](const ActivityResult& result) { - if (result.isCancelled) return; + startActivityForResult(std::make_unique(renderer, mappedInput, tr(STR_WEATHER_SEARCH_CITY), "", + 64, InputType::Text), + [this](const ActivityResult& result) { + if (result.isCancelled) return; - const auto& kb = std::get(result.data); - if (kb.text.empty()) return; + const auto& kb = std::get(result.data); + if (kb.text.empty()) return; - // Need WiFi for geocoding - if (WiFi.status() != WL_CONNECTED || WiFi.localIP() == IPAddress(0, 0, 0, 0)) { - startActivityForResult(std::make_unique(renderer, mappedInput), - [this, query = kb.text](const ActivityResult& wifiResult) { - if (wifiResult.isCancelled) return; - searchResults = WeatherClient::searchCity(query); - showingSearchResults = !searchResults.empty(); - selectedIndex = 0; - requestUpdate(); - }); - } else { - searchResults = WeatherClient::searchCity(kb.text); - showingSearchResults = !searchResults.empty(); - selectedIndex = 0; - requestUpdate(); - } - }); + // Need WiFi for geocoding + if (WiFi.status() != WL_CONNECTED || WiFi.localIP() == IPAddress(0, 0, 0, 0)) { + startActivityForResult(std::make_unique(renderer, mappedInput), + [this, query = kb.text](const ActivityResult& wifiResult) { + if (wifiResult.isCancelled) return; + searchResults = WeatherClient::searchCity(query); + showingSearchResults = !searchResults.empty(); + selectedIndex = 0; + requestUpdate(); + }); + } else { + searchResults = WeatherClient::searchCity(kb.text); + showingSearchResults = !searchResults.empty(); + selectedIndex = 0; + requestUpdate(); + } + }); } void WeatherSettingsActivity::launchLatitudeEntry() { std::string current = std::to_string(WEATHER_SETTINGS.getLatitude()); - startActivityForResult( - std::make_unique(renderer, mappedInput, tr(STR_WEATHER_LATITUDE), current, 12, false), - [this](const ActivityResult& result) { - if (!result.isCancelled) { - const auto& kb = std::get(result.data); - char* end = nullptr; - const float lat = strtof(kb.text.c_str(), &end); - if (end != kb.text.c_str() && *end == '\0' && lat >= -90.0f && lat <= 90.0f) { - if (lat != WEATHER_SETTINGS.getLatitude()) { - WEATHER_SETTINGS.setLocation(lat, WEATHER_SETTINGS.getLongitude(), ""); - } - WEATHER_SETTINGS.saveToFile(); - requestUpdate(); - } - } - }); + startActivityForResult(std::make_unique(renderer, mappedInput, tr(STR_WEATHER_LATITUDE), + current, 12, InputType::Text), + [this](const ActivityResult& result) { + if (!result.isCancelled) { + const auto& kb = std::get(result.data); + char* end = nullptr; + const float lat = strtof(kb.text.c_str(), &end); + if (end != kb.text.c_str() && *end == '\0' && lat >= -90.0f && lat <= 90.0f) { + if (lat != WEATHER_SETTINGS.getLatitude()) { + WEATHER_SETTINGS.setLocation(lat, WEATHER_SETTINGS.getLongitude(), ""); + } + WEATHER_SETTINGS.saveToFile(); + requestUpdate(); + } + } + }); } void WeatherSettingsActivity::launchLongitudeEntry() { std::string current = std::to_string(WEATHER_SETTINGS.getLongitude()); - startActivityForResult( - std::make_unique(renderer, mappedInput, tr(STR_WEATHER_LONGITUDE), current, 12, false), - [this](const ActivityResult& result) { - if (!result.isCancelled) { - const auto& kb = std::get(result.data); - char* end = nullptr; - const float lon = strtof(kb.text.c_str(), &end); - if (end != kb.text.c_str() && *end == '\0' && lon >= -180.0f && lon <= 180.0f) { - if (lon != WEATHER_SETTINGS.getLongitude()) { - WEATHER_SETTINGS.setLocation(WEATHER_SETTINGS.getLatitude(), lon, ""); - } - WEATHER_SETTINGS.saveToFile(); - requestUpdate(); - } - } - }); + startActivityForResult(std::make_unique(renderer, mappedInput, tr(STR_WEATHER_LONGITUDE), + current, 12, InputType::Text), + [this](const ActivityResult& result) { + if (!result.isCancelled) { + const auto& kb = std::get(result.data); + char* end = nullptr; + const float lon = strtof(kb.text.c_str(), &end); + if (end != kb.text.c_str() && *end == '\0' && lon >= -180.0f && lon <= 180.0f) { + if (lon != WEATHER_SETTINGS.getLongitude()) { + WEATHER_SETTINGS.setLocation(WEATHER_SETTINGS.getLatitude(), lon, ""); + } + WEATHER_SETTINGS.saveToFile(); + requestUpdate(); + } + } + }); } void WeatherSettingsActivity::toggleTempUnit() {