void CApplication::RestoreNote(int nNoteId) { if (nNoteId > 0) { CNote note = m_datafile->GetNote(nNoteId); note.SetDeletedDate(timebn::getempty()); note.SetModifiedDate(dateutils::GetCurrentDateTime()); // note.SetLabel(_tstring()); m_datafile->SaveNote(note, NM_DELETED | NM_MODIFIED | NM_LABEL); ShowNote(nNoteId); } }
int CApplication::SaveNote(CNoteWnd* pWnd, UINT nMask) { CNote note; note.SetId(pWnd->GetId()); note.SetText(pWnd->GetText()); note.SetPos(pWnd->GetRealNoteRect() /*CWindowRect(pWnd->m_hWnd)*/); note.SetCreatedDate(pWnd->GetCreatedDate()); if (nMask & NM_MODIFIED) { note.SetModifiedDate(dateutils::GetCurrentDateTime()); } note.SetDeletedDate(pWnd->GetDeletedDate()); note.SetLabel(pWnd->GetLabel().c_str()); return m_datafile->SaveNote(note, nMask); }
void CApplication::DeleteFromStorage(int nNoteId, bool forever /*= false*/) { if (nNoteId > 0) { CNote note = m_datafile->GetNote(nNoteId); if (note.GetDeletedDate().time == 0 && !forever) { note.SetDeletedDate(dateutils::GetCurrentDateTime()); note.SetModifiedDate(dateutils::GetCurrentDateTime()); m_datafile->SaveNote(note, NM_DELETED | NM_LABEL | NM_MODIFIED); } else { m_datafile->DeleteNote(nNoteId); } } }