Pages
API Documentation
On this page

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

List of all members, including inherited members

Public Functions

Protected Functions

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(QIODevice::OpenMode mode)

Reimplements: KArchive::openArchive(QIODevice::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 Qt 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 Qt 6.13.

We use cookies to personalize content and to analyze our traffic. Please decide if you are willing to accept cookies from our website.