LRESULT CToDoCtrlReminders::SendParentReminder(const TDCREMINDER& rem) { if (m_bUseStickies && InitStickiesAPI(m_sStickiesPath)) { CString sContent(rem.GetTaskTitle()), sWhen(rem.FormatWhenString()), sComments(rem.GetTaskComments()), sDummy; if (!sComments.IsEmpty()) { sContent += _T("\n\n"); sContent += sComments; } if (!sWhen.IsEmpty()) { sContent += _T("\n\n"); sContent += sWhen; } if (CreateSticky(CEnString(IDS_STICKIES_TITLE), sDummy, sContent)) { return 1L; // delete reminder as Stickies takes over } } // all else (fallback) ASSERT (m_pWndNotify); return m_pWndNotify->SendMessage(WM_TD_REMINDER, 0, (LPARAM)&rem); }
void CToDoCtrlReminders::SaveAndRemoveReminders(const CFilteredToDoCtrl& tdc) { CPreferences prefs; // nRem is the total number of reminders for all tasklists // nRemCount is the number of reminders for 'tdc' int nRemCount = 0, nRem = m_aReminders.GetSize(); CString sFileKey = tdc.GetPreferencesKey(_T("Reminders")); while (nRem--) { TDCREMINDER rem = m_aReminders[nRem]; if (rem.pTDC == &tdc) { // verify that the task for this reminder still exists if (!tdc.HasTask(rem.dwTaskID)) continue; CString sKey = sFileKey + Misc::MakeKey(_T("\\Reminder%d"), nRemCount); rem.Save(&prefs, sKey); nRemCount++; m_aReminders.RemoveAt(nRem); } } prefs.WriteProfileInt(sFileKey, _T("NumReminders"), nRemCount); // kill timer if no reminders if (GetSafeHwnd() && m_aReminders.GetSize() == 0) KillTimer(1); }
int CTDLShowReminderDlg::DoModal(const TDCREMINDER& rem) { m_sWhen = rem.FormatWhenString(); m_sTaskTitle = rem.GetTaskTitle(); m_sSoundFile = rem.sSoundFile; return CDialog::DoModal(); }
void CToDoCtrlReminders::LoadReminders(const CFilteredToDoCtrl& tdc) { CPreferences prefs; CString sFileKey = tdc.GetPreferencesKey(_T("Reminders")); int nRemCount = prefs.GetProfileInt(sFileKey, _T("NumReminders")); for (int nRem = 0; nRem < nRemCount; nRem++) { CString sKey = Misc::MakeKey(_T("\\Reminder%d"), nRem, sFileKey); TDCREMINDER rem; rem.pTDC = &tdc; rem.Load(&prefs, sKey); m_aReminders.Add(rem); } // start timer if some reminders and not using Stickies if (!m_stickies.IsValid()) StartTimer(); }