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

Function UploadDocumentCore

src/sync/WizSync.cpp:642–757  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

640
641
642bool UploadDocumentCore(const WIZKBINFO& kbInfo, int size, int start, int total, int index, WIZDOCUMENTDATAEX& local, IWizKMSyncEvents* pEvents, IWizSyncableDatabase* pDatabase, WizKMDatabaseServer& server, const QString& strObjectType, WizKMSyncProgress progress, bool forceUploadData)
643{
644 QString strDisplayName;
645
646 strDisplayName = local.strTitle;
647
648 if (pDatabase->isGroup())
649 {
650 if (!CanEditData<WIZDOCUMENTDATAEX>(pDatabase, local))
651 {
652 //skip
653 return TRUE;
654 }
655 }
656
657 if (!InitDocumentData(pDatabase, local.strGUID, local, forceUploadData))
658 {
659 pEvents->onError(_TR("Cannot init object data!"));
660 TOLOG(QString("Cannot init object data!"));
661 return FALSE;
662 }
663
664 WizOleDateTime tLocalModified;
665 tLocalModified = local.tModified;
666
667 int maxFileSize = server.getMaxFileSize();
668 if (maxFileSize == 1)
669 {
670 pEvents->setLastErrorCode(WIZKM_XMLRPC_ERROR_FREE_SERVICE_EXPR);
671 QString error = QObject::tr("User service of has expired, please upgrade to VIP.");
672 pEvents->setLastErrorMessage(error);
673 pEvents->onFreeServiceExpr(pDatabase->getGroupInfo());
674 return FALSE;
675 }
676 else if (maxFileSize == 2)
677 {
678 pEvents->setLastErrorCode(WIZKM_XMLRPC_ERROR_VIP_SERVICE_EXPR);
679 QString error = QObject::tr("VIP service of has expired, please renew to VIP.");
680 pEvents->setLastErrorMessage(error);
681 pEvents->onVipServiceExpr(pDatabase->getGroupInfo());
682 return FALSE;
683 }
684
685 //check data size
686 if (!local.arrayData.isEmpty())
687 {
688 __int64 nDataSize = local.arrayData.size();
689 if (nDataSize > maxFileSize)
690 {
691 QString str;
692 str = local.strTitle;
693
694 pEvents->onWarning(WizFormatString2(_TR("[%1] is too large (%2), skip it"), str, QString::number(nDataSize)));
695 return FALSE;
696 }
697 }
698
699 //upload

Callers 1

UploadDocumentFunction · 0.85

Calls 15

InitDocumentDataFunction · 0.85
TOLOGFunction · 0.85
WizFormatString2Function · 0.85
WizFormatString1Function · 0.85
onErrorMethod · 0.80
setLastErrorCodeMethod · 0.80
setLastErrorMessageMethod · 0.80
getGroupInfoMethod · 0.80
isEmptyMethod · 0.80
sizeMethod · 0.80
onWarningMethod · 0.80
document_postDataMethod · 0.80

Tested by

no test coverage detected