| 4213 | } |
| 4214 | |
| 4215 | bool WizDatabase::loadCompressedAttachmentData(const QString& strGUID, QByteArray& arrayData) |
| 4216 | { |
| 4217 | CString strFileName = getAttachmentFileName(strGUID); |
| 4218 | if (!WizPathFileExists(strFileName)) |
| 4219 | { |
| 4220 | return false; |
| 4221 | } |
| 4222 | CString strTempZipFileName = Utils::WizPathResolve::tempPath() + WizIntToStr(WizGetTickCount()) + ".tmp"; |
| 4223 | WizZipFile zip; |
| 4224 | if (!zip.open(strTempZipFileName)) |
| 4225 | { |
| 4226 | Q_EMIT updateError("Failed to create temp zip file: " + strTempZipFileName); |
| 4227 | return false; |
| 4228 | } |
| 4229 | |
| 4230 | WIZDOCUMENTATTACHMENTDATA attach; |
| 4231 | attachmentFromGuid(strGUID, attach); |
| 4232 | if (!zip.compressFile(strFileName, attach.strName)) |
| 4233 | { |
| 4234 | Q_EMIT updateError("Failed to compress file: " + strFileName); |
| 4235 | return false; |
| 4236 | } |
| 4237 | |
| 4238 | zip.close(); |
| 4239 | |
| 4240 | QFile file(strTempZipFileName); |
| 4241 | if (!file.open(QFile::ReadOnly)) |
| 4242 | return false; |
| 4243 | |
| 4244 | arrayData = file.readAll(); |
| 4245 | // |
| 4246 | file.close(); |
| 4247 | // |
| 4248 | QFile::remove(strTempZipFileName); |
| 4249 | |
| 4250 | return !arrayData.isEmpty(); |
| 4251 | } |
| 4252 | |
| 4253 | bool WizDatabase::saveCompressedAttachmentData(const CString& strGUID, const QByteArray& arrayData) |
| 4254 | { |
nothing calls this directly
no test coverage detected