From 781beb2c50cea2ce2a3da799d8e4a70fa21d6fab Mon Sep 17 00:00:00 2001 From: George Hazan Date: Fri, 24 Jan 2025 14:41:41 +0300 Subject: Weather: INI file list removed --- protocols/Weather/src/weather_opt.cpp | 30 +++++++++++++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-) (limited to 'protocols/Weather/src/weather_opt.cpp') diff --git a/protocols/Weather/src/weather_opt.cpp b/protocols/Weather/src/weather_opt.cpp index a5e747439f..ddda55a453 100644 --- a/protocols/Weather/src/weather_opt.cpp +++ b/protocols/Weather/src/weather_opt.cpp @@ -388,7 +388,35 @@ public: void onClick_More(CCtrlButton *) { - MoreVarList(); + // heading + CMStringW str(TranslateT("Here is a list of custom variables that are currently available")); + str += L"\n\n"; + + // loop through all weather services to find custom variables + bool bFirst = true; + for (WIDATALIST *Item = WIHead; Item != nullptr; Item = Item->next) { + // loop through all update items in a service + for (WIDATAITEMLIST *WItem = Item->Data.UpdateData; WItem != nullptr; WItem = WItem->Next) { + // the custom variable is defined as "%[]" + // ignore the "hi" item and hidden items + if (mir_wstrcmp(WItem->Item.Name, L"Ignore") && WItem->Item.Name[0] != '#') { + wchar_t tempstr[1024]; + mir_snwprintf(tempstr, L"%c[%s]", '%', WItem->Item.Name); + auto *find = wcsstr(str, tempstr); + // if the custom variable does not exist in the list, add it to the list + if (find == nullptr) { + if (bFirst) + bFirst = false; + else + str += L", "; + str += tempstr; + } + } + } + } + + // display the list in a message box + MessageBox(nullptr, str, TranslateT("More Variables"), MB_OK | MB_ICONINFORMATION | MB_TOPMOST); } void onClick_TM(CCtrlButton *pButton) -- cgit v1.2.3