mirror of
https://github.com/tuxbox-fork-migrations/recycled-ni-neutrino.git
synced 2025-09-02 10:21:04 +02:00
add find weather location by postcode
todo: add country
Origin commit data
------------------
Commit: b2b2d605dc
Author: TangoCash <eric@loxat.de>
Date: 2022-01-20 (Thu, 20 Jan 2022)
This commit is contained in:
@@ -63,6 +63,10 @@ int CWeatherSetup::exec(CMenuTarget *parent, const std::string &actionKey)
|
||||
{
|
||||
return showSelectWeatherLocation();
|
||||
}
|
||||
else if (actionKey == "find_location")
|
||||
{
|
||||
return findLocation();
|
||||
}
|
||||
|
||||
res = showWeatherSetup();
|
||||
|
||||
@@ -90,6 +94,10 @@ int CWeatherSetup::showWeatherSetup()
|
||||
mf_wl->setHint(NEUTRINO_ICON_HINT_SETTINGS, LOCALE_MENU_HINT_WEATHER_LOCATION);
|
||||
ms_oservices->addItem(mf_wl);
|
||||
|
||||
CMenuForwarder *mf_zip = new CMenuForwarder(LOCALE_WEATHER_LOCATION_POSTCODE, g_settings.weather_enabled, NULL, this, "find_location");
|
||||
mf_zip->setHint(NEUTRINO_ICON_HINT_SETTINGS, LOCALE_MENU_HINT_WEATHER_LOCATION_POSTCODE);
|
||||
ms_oservices->addItem(mf_zip);
|
||||
|
||||
int res = ms_oservices->exec(NULL, "");
|
||||
selected = ms_oservices->getSelected();
|
||||
delete ms_oservices;
|
||||
@@ -146,6 +154,22 @@ int CWeatherSetup::showSelectWeatherLocation()
|
||||
return res;
|
||||
}
|
||||
|
||||
int CWeatherSetup::findLocation()
|
||||
{
|
||||
int ret = menu_return::RETURN_REPAINT;
|
||||
int postcode = 10178;
|
||||
CIntInput zipcode(LOCALE_WEATHER_LOCATION_POSTCODE, &postcode, (unsigned int)5);
|
||||
ret = zipcode.exec(NULL, "");
|
||||
zipcode.hide();
|
||||
|
||||
if (CWeather::getInstance()->FindCoords(postcode))
|
||||
{
|
||||
CWeather::getInstance()->setCoords(g_settings.weather_location, g_settings.weather_city);
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
bool CWeatherSetup::changeNotify(const neutrino_locale_t OptionName, void */*data*/)
|
||||
{
|
||||
int ret = menu_return::RETURN_NONE;
|
||||
|
Reference in New Issue
Block a user