示例#1
0
int CApplication::SaveNote(CNote const& note, UINT nMask)
{
	CNote nt = note;
	if (nMask & NM_MODIFIED)
	{
		nt.SetModifiedDate(dateutils::GetCurrentDateTime());
	}
	return m_datafile->SaveNote(nt, nMask);
}
示例#2
0
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);
	}
}
示例#3
0
void CApplication::SetNoteLabel(int nNoteId, LPCTSTR label)
{
	CNote note = FindNote(nNoteId);
	note.SetLabel(label);
	note.SetModifiedDate(dateutils::GetCurrentDateTime());
	m_datafile->SaveNote(note, NM_LABEL | NM_MODIFIED);

	CNoteWnd* pWnd = FindNoteWnd(nNoteId);
	if (pWnd)
	{
		pWnd->SetLabel(label);
	}
}
示例#4
0
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);
}
示例#5
0
void CApplication::MoveToNotebook(int nNoteId, LPCTSTR sFileName)
{
	if (GetDataFileName() != sFileName)
	{
		CNote note = m_datafile->GetNote(nNoteId);
		note.SetId(0);
		note.SetModifiedDate(dateutils::GetCurrentDateTime());
		CStorage target;
		target.SetDataFile(sFileName);
		target.SaveNote(note, NM_ALL);
		target.Release();
		m_state.SetLastDataFile(sFileName);
		m_local_storage.Write(m_state);
		DeleteNote(nNoteId, true);
	}
}
示例#6
0
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);
		}
	}
}