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

Method extractZiwFileToFolder

src/database/WizDatabase.cpp:4730–4759  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4728}
4729
4730bool WizDatabase::extractZiwFileToFolder(const WIZDOCUMENTDATA& document,
4731 const QString& strFolder)
4732{
4733 CString strZipFileName = getDocumentFileName(document.strGUID);
4734 if (!WizPathFileExists(strZipFileName)) {
4735 return false;
4736 }
4737 //
4738 bool isProtected = WizZiwReader::isEncryptedFile(strZipFileName);
4739
4740 if (!isProtected) {
4741 return WizUnzipFile::extractZip(strZipFileName, strFolder);
4742 }
4743 //
4744 QString password = WizUserCertPassword::Instance().getPassword(bizGuid());
4745 if (password.isEmpty()) {
4746 return false;
4747 }
4748
4749 QString strDecryptedFileName = Utils::WizPathResolve::tempPath() + document.strGUID + "-decrypted";
4750 QFile::remove(strDecryptedFileName);
4751
4752 if (!m_ziwReader->decryptFileToFile(strZipFileName, strDecryptedFileName)) {
4753 // force clear usercipher
4754 WizUserCertPassword::Instance().setPassword(bizGuid(), "");
4755 return false;
4756 }
4757 //
4758 return WizUnzipFile::extractZip(strDecryptedFileName, strFolder);
4759}
4760
4761bool WizDatabase::encryptDocument(WIZDOCUMENTDATA& document)
4762{

Callers

nothing calls this directly

Calls 5

WizPathFileExistsFunction · 0.85
isEmptyMethod · 0.80
decryptFileToFileMethod · 0.80
getPasswordMethod · 0.45
setPasswordMethod · 0.45

Tested by

no test coverage detected