Пример #1
0
bool CWizApi::uploadDocument(const WIZDOCUMENTDATAEX& data)
{
    m_currentDocument = data;

    int nParts = m_currentDocument.nObjectPart;
    Q_ASSERT(0 != nParts);
    bool bData = (nParts & WIZKM_XMKRPC_DOCUMENT_PART_DATA) ? true : false;

    if (bData) {
        if (!m_db.LoadDocumentData(m_currentDocument.strGUID, m_currentDocument.arrayData)) {
            //skip this document
            QString info = data.strTitle;
            Q_EMIT processErrorLog(tr("could not load document data: ") + info);
            onUploadDocument(data);   //skip
            return false;
        }

        WIZOBJECTDATA obj;
        obj.strObjectGUID = m_currentDocument.strGUID;
        obj.strDisplayName = m_currentDocument.strTitle;
        obj.eObjectType = wizobjectDocument;
        obj.arrayData = m_currentDocument.arrayData;

        return uploadObjectData(obj);
    } else {
        return callDocumentPostData(m_currentDocument);
    }
}
Пример #2
0
bool CWizApi::uploadDocument(const WIZDOCUMENTDATAEX& data)
{
    Q_ASSERT(data.nObjectPart != 0);

    int nParts = data.nObjectPart;
    bool bInfo = (nParts & WIZKM_XMKRPC_DOCUMENT_PART_INFO) ? true : false;
    bool bParam = (nParts & WIZKM_XMKRPC_DOCUMENT_PART_PARAM) ? true : false;
    bool bData = (nParts & WIZKM_XMKRPC_DOCUMENT_PART_DATA) ? true : false;

    m_currentDocument = data;

    m_db->GetDocumentTags(m_currentDocument.strGUID, m_currentDocument.arrayTagGUID);
    m_db->GetDocumentParams(m_currentDocument.strGUID, m_currentDocument.arrayParam);

    if (bData) {
        if (!m_db->LoadDocumentData(m_currentDocument.strGUID, m_currentDocument.arrayData)) {
            QString info = data.strTitle;
            Q_EMIT processErrorLog(tr("could not load document data: ") + info);

            //skip
            onUploadDocument(data);
            return false;
        }

        WIZOBJECTDATA obj;
        obj.strObjectGUID = m_currentDocument.strGUID;
        obj.strDisplayName = m_currentDocument.strTitle;
        obj.eObjectType = wizobjectDocument;
        obj.arrayData = m_currentDocument.arrayData;

        return uploadObjectData(obj);
    } else {
        return callDocumentPostData(m_currentDocument);
    }
}
Пример #3
0
void CWizApi::onUploadObjectDataCompleted(const WIZOBJECTDATA& data)
{
    if (data.eObjectType == wizobjectDocument) {
        Q_ASSERT(data.strObjectGUID == m_currentDocument.strGUID);
        Q_ASSERT(m_currentDocument.nObjectPart & WIZKM_XMLRPC_OBJECT_PART_DATA);

        m_db.SetObjectDataDownloaded(m_currentDocument.strGUID, "document", true);
        callDocumentPostData(m_currentDocument);

    } else if (data.eObjectType == wizobjectDocumentAttachment) {
        Q_ASSERT(data.strObjectGUID == m_currentAttachment.strGUID);
        Q_ASSERT(m_currentAttachment.nObjectPart & WIZKM_XMLRPC_OBJECT_PART_DATA);

        m_db.SetObjectDataDownloaded(m_currentDocument.strGUID, "attachment", true);
        callAttachmentPostData(m_currentAttachment);

    } else {
        Q_ASSERT(false);
    }
}