K7Zip Class
A class for reading / writing p7zip archives. More...
Header: | #include <K7Zip> |
CMake: | find_package(KF6 REQUIRED COMPONENTS Archive) target_link_libraries(mytarget PRIVATE KF6::Archive) |
Inherits: | KArchive |
Public Functions
K7Zip(QIODevice *dev) | |
K7Zip(const QString &filename) | |
virtual | ~K7Zip() override |
(since 6.13) bool | passwordNeeded() const |
(since 6.13) void | setPassword(const QString &password) |
Reimplemented Protected Functions
virtual bool | openArchive(QIODeviceBase::OpenMode mode) override |
Detailed Description
Member Function Documentation
[explicit]
K7Zip::K7Zip(QIODevice *dev)
Creates an instance that operates on the given device.
The device can be compressed (KCompressionDevice) or not (QFile, etc.).
Warning: Do not assume that giving a QFile here will decompress the file, in case it's compressed!
dev the device to read from. If the source is compressed, the QIODevice must take care of decompression
[explicit]
K7Zip::K7Zip(const QString &filename)
Creates an instance that operates on the given filename using the compression filter associated to given mimetype.
filename is a local path (e.g. "/home/user/myfile.7z")
[override virtual noexcept]
K7Zip::~K7Zip()
If the archive is still opened, then it will be closed automatically by the destructor.
[override virtual protected]
bool K7Zip::openArchive(QIODeviceBase::OpenMode mode)
Reimplements: KArchive::openArchive(QIODeviceBase::OpenMode mode).
Opens the archive for reading.
Parses the directory listing of the archive and creates the KArchiveDirectory/KArchiveFile entries.
mode the mode of the file
[since 6.13]
bool K7Zip::passwordNeeded() const
Whether the archive needs a password to be opened.
Note: This can only be called after open() has been called once.
Returns true
if the archive requires a password to be opened
This function was introduced in 6.13.
[since 6.13]
void K7Zip::setPassword(const QString &password)
Sets the password to use for encrypted archives.
This method must be called before opening the archive.
Note: Currently only AES decryption is supported.
password the password to use for encrypted archive
This function was introduced in 6.13.