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

Method saveCompressedAttachmentData

src/database/WizDatabase.cpp:4253–4280  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4251}
4252
4253bool WizDatabase::saveCompressedAttachmentData(const CString& strGUID, const QByteArray& arrayData)
4254{
4255 CString strTempZipFileName = Utils::WizPathResolve::tempPath() + WizIntToStr(WizGetTickCount()) + ".tmp";
4256 if (!WizSaveDataToFile(strTempZipFileName, arrayData))
4257 {
4258 Q_EMIT updateError("Failed to save attachment data to temp file: " + strTempZipFileName);
4259 return false;
4260 }
4261 WizUnzipFile zip;
4262 if (!zip.open(strTempZipFileName))
4263 {
4264 Q_EMIT updateError("Failed to open temp zip file: " + strTempZipFileName);
4265 return false;
4266 }
4267
4268 CString strFileName = getAttachmentFileName(strGUID);
4269 if (!zip.extractFile(0, strFileName))
4270 {
4271 Q_EMIT updateError("Failed to extract attachment file: " + strFileName);
4272 return false;
4273 }
4274
4275 zip.close();
4276 //
4277 QFile::remove(strTempZipFileName);
4278 //
4279 return true;
4280}
4281
4282bool WizDatabase::emptyProtectedAbstract(const QString &docGuid)
4283{

Callers

nothing calls this directly

Calls 6

WizIntToStrFunction · 0.85
WizGetTickCountFunction · 0.85
WizSaveDataToFileFunction · 0.85
extractFileMethod · 0.80
openMethod · 0.45
closeMethod · 0.45

Tested by

no test coverage detected