MCPcopy Create free account
hub / github.com/altairwei/WizNotePlus / createDocumentAndInit

Method createDocumentAndInit

src/database/WizDatabase.cpp:3962–4010  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3960}
3961
3962bool WizDatabase::createDocumentAndInit(const CString& strHtml, \
3963 const CString& strHtmlUrl, \
3964 int nFlags, \
3965 const CString& strTitle, \
3966 const CString& strName, \
3967 const CString& strLocation, \
3968 const CString& strURL, \
3969 WIZDOCUMENTDATA& data)
3970{
3971 bool encrypt = isEncryptAllData();
3972 if (encrypt)
3973 {
3974 if (!initCert(true))
3975 return false;
3976 //
3977 if (!initZiwReaderForEncryption())
3978 return false;
3979 //
3980 data.nProtected = 1;
3981 }
3982 //
3983 bool bRet = false;
3984 try
3985 {
3986 beginUpdate();
3987
3988 data.strKbGUID = kbGUID();
3989 data.strOwner = getUserId();
3990 //FIXME: Why did it use strHtmlUrl ? strURL is really an attribute of document.
3991 // So, I made a temporary correction.
3992 bRet = createDocument(strTitle, strName, strLocation, strURL, data.nProtected, data);
3993 if (bRet)
3994 {
3995 //FIXME: Why did it use strURL? strHtmlUrl is the real local file, which can be used to
3996 // collect files in index_files folder. So, I made a temporary correction.
3997 bRet = updateDocumentData(data, strHtml, strHtmlUrl, nFlags);
3998
3999 Q_EMIT documentCreated(data);
4000 }
4001 }
4002 catch (...)
4003 {
4004
4005 }
4006
4007 endUpdate();
4008
4009 return bRet;
4010}
4011
4012bool WizDatabase::createDocumentAndInit(const WIZDOCUMENTDATA& sourceDoc, const QByteArray& baData,
4013 const QString& strLocation, const WIZTAGDATA& tag, WIZDOCUMENTDATA& newDoc)

Callers 5

copyDocumentToMethod · 0.80
CreateDocument2Method · 0.80
createNoteMethod · 0.80
CreateDocumentMethod · 0.80
createDocumentMethod · 0.80

Calls 3

encryptDataToFileMethod · 0.80
isEmptyMethod · 0.80
addTagMethod · 0.45

Tested by

no test coverage detected