Ejemplo n.º 1
0
void CWizSync::processObjectData(const WIZOBJECTDATA& data)
{
    WIZOBJECTDATA conflictObjectData(data);
    conflictObjectData.strObjectGUID = WizGenGUIDLowerCaseLetterOnly();
    conflictObjectData.strDisplayName += tr("(conflict backup)");

    // set dirty flag, uploaded needed
    m_conflictDownloadedInfo.nVersion = -1;
    m_conflictDownloadedInfo.strGUID = conflictObjectData.strObjectGUID;
    m_conflictDownloadedInfo.strTitle += tr("(conflict backup)");
    m_conflictDownloadedInfo.strInfoMD5 = m_db.CalDocumentInfoMD5(m_conflictDownloadedInfo);

    if (m_db.CreateDocumentEx(m_conflictDownloadedInfo)) {
        m_db.UpdateSyncObjectLocalData(conflictObjectData);
        TOLOG1(tr("Conflict backup created: %1"), m_conflictDownloadedInfo.strTitle);
    } else {
        TOLOG("unable to create conflict backup while create document");
    }

    std::deque<WIZDOCUMENTDATABASE>::iterator it;
    for (it = m_arrayAllDocumentsNeedToBeDownloaded.begin(); \
            it != m_arrayAllDocumentsNeedToBeDownloaded.end();
            it++) {
        WIZDOCUMENTDATABASE data = *it;

        if (data.strGUID == m_conflictedDocument.strGUID) {
            m_arrayAllDocumentsNeedToBeDownloaded.erase(it);
            break;
        }
    }

    // chain back
    onQueryDocumentInfo(m_conflictedDocument);
}
Ejemplo n.º 2
0
void CWizKbSync::processConflictObjectData(const WIZOBJECTDATA& data)
{
    WIZOBJECTDATA conflictObjectData(data);
    conflictObjectData.strObjectGUID = WizGenGUIDLowerCaseLetterOnly();
    conflictObjectData.strDisplayName += tr("(conflict backup)");

    // set dirty flag, upload needed
    m_conflictDownloadedInfo.nVersion = -1;
    m_conflictDownloadedInfo.strKbGUID = kbGUID();
    m_conflictDownloadedInfo.strGUID = conflictObjectData.strObjectGUID;
    m_conflictDownloadedInfo.strTitle += tr("(conflict backup)");
    m_conflictDownloadedInfo.strInfoMD5 = m_db->CalDocumentInfoMD5(m_conflictDownloadedInfo);

    if (m_db->CreateDocumentEx(m_conflictDownloadedInfo)) {
        m_db->UpdateSyncObjectLocalData(conflictObjectData);
        Q_EMIT processLog(WizFormatString1(tr("Conflict backup created: %1"), m_conflictDownloadedInfo.strTitle));
    } else {
        Q_EMIT processLog("unable to create conflict backup while create document");
    }

    // chain back
    onQueryDocumentInfo(m_conflictDownloadedInfo);
}