From 7c868a3010cdc5a6b00821943ecae66db7489277 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Thu, 17 Apr 2025 13:01:49 +0300 Subject: =?UTF-8?q?fixes=20#4955=20(Notes=20and=20Reminders:=20=D0=BF?= =?UTF-8?q?=D1=80=D0=BE=D0=B1=D0=BB=D0=B5=D0=BC=D0=B0=20=D1=81=20=D0=BD?= =?UTF-8?q?=D0=B0=D0=BF=D0=BE=D0=BC=D0=B8=D0=BD=D0=B0=D0=BD=D0=B8=D1=8F?= =?UTF-8?q?=D0=BC=D0=B8,=20=D1=83=D1=81=D1=82=D0=B0=D0=BD=D0=BE=D0=B2?= =?UTF-8?q?=D0=BB=D0=B5=D0=BD=D0=BD=D1=8B=D0=BC=D0=B8=20=D0=B2=20=D0=BF?= =?UTF-8?q?=D1=80=D0=BE=D1=88=D0=BB=D0=BE=D0=B5)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- plugins/NotesAndReminders/src/reminders.cpp | 42 ++++++++++++++++------------- 1 file changed, 23 insertions(+), 19 deletions(-) (limited to 'plugins/NotesAndReminders/src') diff --git a/plugins/NotesAndReminders/src/reminders.cpp b/plugins/NotesAndReminders/src/reminders.cpp index f4990a7299..a54d392418 100644 --- a/plugins/NotesAndReminders/src/reminders.cpp +++ b/plugins/NotesAndReminders/src/reminders.cpp @@ -704,31 +704,35 @@ protected: FileTimeToSystemTime((FILETIME*)&savedLi, &pDate); } - return true; } + else { + // user entered a custom value + wchar_t buf[32]; + cmbTime.GetText(buf, _countof(buf)); - // user entered a custom value - wchar_t buf[32]; - cmbTime.GetText(buf, _countof(buf)); + int h, m; + if (!ParseTime(buf, &h, &m, FALSE, m_bRelativeCombo)) { + MessageBoxW(m_hwnd, TranslateT("The specified time is invalid."), _A2W(SECTIONNAME), MB_OK | MB_ICONWARNING); + return false; + } - int h, m; - if (!ParseTime(buf, &h, &m, FALSE, m_bRelativeCombo)) { - MessageBoxW(m_hwnd, TranslateT("The specified time is invalid."), _A2W(SECTIONNAME), MB_OK | MB_ICONWARNING); - return false; - } + // absolute time (on pDate) + if (ReformatTimeInput(savedLi, h, m, &pDate, nullptr)) + return false; - // absolute time (on pDate) - if (ReformatTimeInput(savedLi, h, m, &pDate, nullptr)) - return false; + bool bTomorrow = (h * 60 + m) < (pDate.wHour * 60 + pDate.wMinute); - pDate.wHour = h; - pDate.wMinute = m; - pDate.wSecond = 0; - pDate.wMilliseconds = 0; + pDate.wHour = h; + pDate.wMinute = m; + pDate.wSecond = 0; + pDate.wMilliseconds = 0; - ULONGLONG li; - TzLocalSTToFileTime(&pDate, (FILETIME*)&li); - FileTimeToSystemTime((FILETIME*)&li, &pDate); + ULONGLONG li; + TzLocalSTToFileTime(&pDate, (FILETIME *)&li); + if (bTomorrow) + li += (ULONGLONG)(24 * 3600) * FILETIME_TICKS_PER_SEC; + FileTimeToSystemTime((FILETIME *)&li, &pDate); + } return true; } -- cgit v1.2.3