STATUS SignElements(DBHANDLE hDB)
{
STATUS error = NOERROR;
// error = SignDataNotes(hDB, NOTE_ID_SPECIAL | NOTE_CLASS_DESIGN, TRUE);
error = SignDataNotes(hDB, NOTE_CLASS_PRIVATE | NOTE_CLASS_FILTER, TRUE);
error = SignDataNotes(hDB, NOTE_CLASS_ICON, TRUE);
error = SignDataNotes(hDB, NOTE_CLASS_HELP, TRUE);
error = SignDataNotes(hDB, NOTE_CLASS_DATA, TRUE);
return error;
}
/************************************************************************
FUNCTION: SignDataNotes
This function exports a set of notes based on the Note Class(es)
specified. (NOTE_CLASS_xxx)
*************************************************************************/
STATUS LNPUBLIC SignDataNotes(DBHANDLE hDB, WORD wNoteClassMask, BOOL bDesignNotes)
{
STATUS error = NOERROR;
HANDLE hNoteIDTable; /* table of Note IDs to modify */
/*
* Need to set up an ID Table which will contain a list of Note IDs that are to be exported.
*/
if (error = IDCreateTable(sizeof(NOTEID), &hNoteIDTable))
return(error);
/*
* Call NSFSearch to find the notes that match the note classes we would like to export.
* For each note found, the routine AddIdUnique is called.
*/
if (error = NSFSearch(hDB, /* database handle */
NULLHANDLE, /* selection formula */
NULL, /* title of view in selection formula */
0, /* search flags */
wNoteClassMask, /* note class to find */
NULL, /* starting date (unused) */
AddIDUnique, /* call for each note found */
&hNoteIDTable, /* argument to AddIDUnique */
NULL)) /* returned ending date (unused) */
{
IDDestroyTable(hNoteIDTable);
return(error);
}
if (error = IDEnumerate(hNoteIDTable, Processnote, hDB))
{
IDDestroyTable(hNoteIDTable);
return(error);
}
/*
* Free the memory containing the ID table
*/
IDDestroyTable(hNoteIDTable);
return (error);
}
/************************************************************************
FUNCTION: AddIDUnique
*************************************************************************/
STATUS LNPUBLIC AddIDUnique(void far * phNoteIDTable, SEARCH_MATCH far *pSearchMatch, ITEM_TABLE far *summary_info)
{
SEARCH_MATCH SearchMatch;
HANDLE hNoteIDTable;
STATUS error;
BOOL flagOK;
memcpy( (char*)&SearchMatch, (char*)pSearchMatch, sizeof(SEARCH_MATCH) );
/* if (SearchMatch.MatchesFormula != SE_FMATCH) V3 */
if (!(SearchMatch.SERetFlags & SE_FMATCH)) /* V4 */
return (NOERROR);
hNoteIDTable = *((HANDLE far *)phNoteIDTable);
error = IDInsert(hNoteIDTable, SearchMatch.ID.NoteID, &flagOK);
return (NOERROR);
}
/************************************************************************
FUNCTION: Processnote
PURPOSE:
INPUTS:
*************************************************************************/
STATUS LNCALLBACK Processnote(void far *hDB, NOTEID NoteId)
{
STATUS error = NOERROR;
NOTEHANDLE hNote = NULLHANDLE;
BOOL retfSigned = FALSE;
//Open the Note.
if (error = NSFNoteOpen(hDB, //database handle
NoteId, //Note ID
OPEN_EXPAND, //open flags
&hNote))
{
return (ERR(error));
}
error = NSFNoteUnsign(hNote);
error = NSFNoteSignHotspots(hNote, 0, &retfSigned);
printf("%i\n", retfSigned);
if (error = NSFNoteSign(hNote))
{
goto Exit0;
}
if (error = NSFNoteUpdate(hNote, UPDATE_FORCE))
return (ERR(error));
Exit0:
//close note
if (error = NSFNoteClose(hNote))
return (ERR(error));
return error;
}