From 6e04912b716a5fd8d17575cd098a4f1117442ca0 Mon Sep 17 00:00:00 2001
From: George Hazan <ghazan@miranda.im>
Date: Thu, 18 Mar 2021 22:05:47 +0300
Subject: =?UTF-8?q?fixes=20#2780=20(Notes=20and=20Reminders:=20=D0=BD?=
 =?UTF-8?q?=D0=B5=D0=BF=D1=80=D0=B0=D0=B2=D0=B8=D0=BB=D1=8C=D0=BD=D0=BE=20?=
 =?UTF-8?q?=D1=80=D0=B0=D0=B1=D0=BE=D1=82=D0=B0=D0=B5=D1=82=20=D0=BF=D1=80?=
 =?UTF-8?q?=D0=BE=D0=B4=D0=BB=D0=B5=D0=BD=D0=B8=D0=B5=20=D1=81=D1=80=D0=B0?=
 =?UTF-8?q?=D0=B1=D0=BE=D1=82=D0=B0=D0=B2=D1=88=D0=B5=D0=B3=D0=BE=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)?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 plugins/NotesAndReminders/src/reminders.cpp | 57 ++++++++++++++---------------
 1 file changed, 28 insertions(+), 29 deletions(-)

(limited to 'plugins')

diff --git a/plugins/NotesAndReminders/src/reminders.cpp b/plugins/NotesAndReminders/src/reminders.cpp
index 5ccefc77b3..a139f25aa0 100644
--- a/plugins/NotesAndReminders/src/reminders.cpp
+++ b/plugins/NotesAndReminders/src/reminders.cpp
@@ -1068,14 +1068,9 @@ public:
 
 		PopulateTimeOffsetCombo();
 
-		cmbRemindAgainIn.Show();
-		dateAgain.Hide();
-		cmbTimeAgain.Hide();
-		ShowWindow(GetDlgItem(m_hwnd, IDC_STATIC_DATE), SW_HIDE);
-		ShowWindow(GetDlgItem(m_hwnd, IDC_STATIC_TIME), SW_HIDE);
+		cmbRemindAgainIn.SetCurSel(0);
 		chkAfter.SetState(true);
 		chkOnDate.SetState(false);
-		cmbRemindAgainIn.SetCurSel(0);
 
 		if (m_pReminder->bRepeat) {
 			chkOnDate.Hide();
@@ -1124,6 +1119,9 @@ public:
 
 	void onChange_OnDate(CCtrlCheck*)
 	{
+		if (!m_bInitialized)
+			return;
+
 		dateAgain.Show();
 		cmbTimeAgain.Show();
 		ShowWindow(GetDlgItem(m_hwnd, IDC_STATIC_DATE), SW_SHOW);
@@ -1808,31 +1806,32 @@ bool CheckRemindersAndStart(void)
 		if (!bHasQueuedReminders && pReminder->When > curT)
 			break;
 
-		if (!pReminder->bVisible) {
-			if (pReminder->bSystemEventQueued) {
-				UpdateReminderEvent(pReminder, REMINDER_UPDATE_INTERVAL_SHORT / 1000, &bHasPlayedSound);
+		if (pReminder->bVisible)
+			continue;
 
-				QueuedReminderCount++;
-				bResult = true;
-			}
-			else if (pReminder->When <= curT) {
-				if (!g_RemindSMS) {
-					FireReminder(pReminder, &bHasPlayedSound);
+		if (pReminder->bSystemEventQueued) {
+			UpdateReminderEvent(pReminder, REMINDER_UPDATE_INTERVAL_SHORT / 1000, &bHasPlayedSound);
 
-					if (pReminder->bSystemEventQueued)
-						bResult = true;
-				}
-				else {
-					char *p = strchr(g_RemindSMS, '@');
-					if (p) {
-						Send(g_RemindSMS, p + 1, _T2A(pReminder->wszText), NULL);
-						*p = '@';
-
-						DeleteReminder(pReminder);
-						JustSaveReminders();
-						if (pListDialog)
-							pListDialog->Reload();
-					}
+			QueuedReminderCount++;
+			bResult = true;
+		}
+		else if (pReminder->When <= curT) {
+			if (!mir_strlen(g_RemindSMS)) {
+				FireReminder(pReminder, &bHasPlayedSound);
+
+				if (pReminder->bSystemEventQueued)
+					bResult = true;
+			}
+			else {
+				char *p = strchr(g_RemindSMS, '@');
+				if (p) {
+					Send(g_RemindSMS, p + 1, _T2A(pReminder->wszText), NULL);
+					*p = '@';
+
+					DeleteReminder(pReminder);
+					JustSaveReminders();
+					if (pListDialog)
+						pListDialog->Reload();
 				}
 			}
 		}
-- 
cgit v1.2.3