isEncrypted() convenience method

This commit is contained in:
alqualos 2014-08-10 17:20:38 +00:00
parent 565ca76509
commit 9c9b252eb1
2 changed files with 11 additions and 2 deletions

View file

@ -32,7 +32,11 @@ see quazip/(un)zip.h files for details. Basically it's the zlib license.
#include "quazip_global.h"
/// Information about a file inside archive.
/** Call QuaZip::getCurrentFileInfo() or QuaZipFile::getFileInfo() to
/**
* \deprecated Use QuaZipFileInfo64 instead. Not only it supports large files,
* but also more convenience methods as well.
*
* Call QuaZip::getCurrentFileInfo() or QuaZipFile::getFileInfo() to
* fill this structure. */
struct QUAZIP_EXPORT QuaZipFileInfo {
/// File name.
@ -167,6 +171,8 @@ struct QUAZIP_EXPORT QuaZipFileInfo64 {
* @return The NTFS creation time, UTC
*/
QDateTime getNTFScTime(int *fineTicks = NULL) const;
/// Checks whether the file is encrypted.
bool isEncrypted() const {return (flags & 1) != 0;}
};
#endif

View file

@ -121,7 +121,10 @@ void TestQuaZipFile::zipUnzip()
QCOMPARE(testUnzip.getComment(), comment);
QVERIFY(testUnzip.goToFirstFile());
foreach (QString fileName, fileNames) {
QCOMPARE(testUnzip.getCurrentFileName(), fileName);
QuaZipFileInfo64 info;
QVERIFY(testUnzip.getCurrentFileInfo(&info));
QCOMPARE(info.name, fileName);
QCOMPARE(info.isEncrypted(), !password.isEmpty());
QFile original("tmp/" + fileName);
QVERIFY(original.open(QIODevice::ReadOnly));
QuaZipFile archived(&testUnzip);