| 3737 | } |
| 3738 | |
| 3739 | bool WizDatabase::updateSyncObjectLocalData(const WIZOBJECTDATA& data) |
| 3740 | { |
| 3741 | qDebug() << "update object data, name: " << data.strDisplayName << "guid: " << data.strObjectGUID; |
| 3742 | |
| 3743 | if (data.eObjectType == wizobjectDocumentAttachment) |
| 3744 | { |
| 3745 | if (!saveCompressedAttachmentData(data.strObjectGUID, data.arrayData)) |
| 3746 | { |
| 3747 | Q_EMIT updateError("Failed to save attachment data: " + data.strDisplayName); |
| 3748 | return false; |
| 3749 | } |
| 3750 | } |
| 3751 | else if (data.eObjectType == wizobjectDocument) |
| 3752 | { |
| 3753 | WIZDOCUMENTDATA document; |
| 3754 | if (!documentFromGuid(data.strObjectGUID, document)) { |
| 3755 | qCritical() << "Update object data failed, can't find database record!\n"; |
| 3756 | return false; |
| 3757 | } |
| 3758 | |
| 3759 | CString strFileName = getObjectFileName(data); |
| 3760 | if (!::WizSaveDataToFile(strFileName, data.arrayData)) |
| 3761 | { |
| 3762 | Q_EMIT updateError("Failed to save document data: " + data.strDisplayName); |
| 3763 | return false; |
| 3764 | } |
| 3765 | |
| 3766 | Q_EMIT documentDataModified(document); |
| 3767 | updateDocumentAbstract(data.strObjectGUID); |
| 3768 | setDocumentSearchIndexed(data.strObjectGUID, false); |
| 3769 | } else { |
| 3770 | Q_ASSERT(0); |
| 3771 | } |
| 3772 | |
| 3773 | setObjectDataDownloaded(data.strObjectGUID, WIZOBJECTDATA::objectTypeToTypeString(data.eObjectType), true); |
| 3774 | |
| 3775 | return true; |
| 3776 | } |
| 3777 | |
| 3778 | |
| 3779 | CString WizDatabase::getObjectFileName(const WIZOBJECTDATA& data) |
nothing calls this directly
no test coverage detected