K7Zip

Search for usage in LXR

#include <K7Zip>

Inheritance diagram for K7Zip:

Public Member Functions

 K7Zip (const QString &filename)
 
 K7Zip (QIODevice *dev)
 
 ~K7Zip () override
 
bool passwordNeeded () const
 
void setPassword (const QString &password)
 
- Public Member Functions inherited from KArchive
bool addLocalDirectory (const QString &path, const QString &destName)
 
bool addLocalFile (const QString &fileName, const QString &destName)
 
virtual bool close ()
 
QIODevicedevice () const
 
const KArchiveDirectorydirectory () const
 
QString errorString () const
 
QString fileName () const
 
bool finishWriting (qint64 size)
 
bool isOpen () const
 
QIODevice::OpenMode mode () const
 
virtual bool open (QIODevice::OpenMode mode)
 
bool prepareWriting (const QString &name, const QString &user, const QString &group, qint64 size, mode_t perm=0100644, const QDateTime &atime=QDateTime(), const QDateTime &mtime=QDateTime(), const QDateTime &ctime=QDateTime())
 
bool writeData (const char *data, qint64 size)
 
bool writeData (QByteArrayView data)
 
bool writeDir (const QString &name, const QString &user=QString(), const QString &group=QString(), mode_t perm=040755, const QDateTime &atime=QDateTime(), const QDateTime &mtime=QDateTime(), const QDateTime &ctime=QDateTime())
 
bool writeFile (const QString &name, QByteArrayView data, mode_t perm=0100644, const QString &user=QString(), const QString &group=QString(), const QDateTime &atime=QDateTime(), const QDateTime &mtime=QDateTime(), const QDateTime &ctime=QDateTime())
 
bool writeSymLink (const QString &name, const QString &target, const QString &user=QString(), const QString &group=QString(), mode_t perm=0120755, const QDateTime &atime=QDateTime(), const QDateTime &mtime=QDateTime(), const QDateTime &ctime=QDateTime())
 

Protected Member Functions

bool closeArchive () override
 
bool doFinishWriting (qint64 size) override
 
bool doPrepareWriting (const QString &name, const QString &user, const QString &group, qint64 size, mode_t perm, const QDateTime &atime, const QDateTime &mtime, const QDateTime &ctime) override
 
bool doWriteData (const char *data, qint64 size) override
 
bool doWriteDir (const QString &name, const QString &user, const QString &group, mode_t perm, const QDateTime &atime, const QDateTime &mtime, const QDateTime &ctime) override
 
bool doWriteSymLink (const QString &name, const QString &target, const QString &user, const QString &group, mode_t perm, const QDateTime &atime, const QDateTime &mtime, const QDateTime &ctime) override
 
bool openArchive (QIODevice::OpenMode mode) override
 
void virtual_hook (int id, void *data) override
 
- Protected Member Functions inherited from KArchive
 KArchive (const QString &fileName)
 
 KArchive (QIODevice *dev)
 
virtual bool createDevice (QIODevice::OpenMode mode)
 
KArchiveDirectoryfindOrCreate (const QString &path)
 
virtual KArchiveDirectoryrootDir ()
 
void setDevice (QIODevice *dev)
 
void setErrorString (const QString &errorStr)
 
void setRootDir (KArchiveDirectory *rootDir)
 

Detailed Description

A class for reading / writing p7zip archives.

Author
Mario Bensi

Definition at line 18 of file k7zip.h.

Constructor & Destructor Documentation

◆ K7Zip() [1/2]

K7Zip::K7Zip ( const QString & filename)
explicit

Creates an instance that operates on the given filename using the compression filter associated to given mimetype.

Parameters
filenameis a local path (e.g. "/home/user/myfile.7z")

Definition at line 561 of file k7zip.cpp.

◆ K7Zip() [2/2]

K7Zip::K7Zip ( QIODevice * dev)
explicit

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!
Parameters
devthe device to read from. If the source is compressed, the QIODevice must take care of decompression

Definition at line 567 of file k7zip.cpp.

◆ ~K7Zip()

K7Zip::~K7Zip ( )
override

If the archive is still opened, then it will be closed automatically by the destructor.

Definition at line 574 of file k7zip.cpp.

Member Function Documentation

◆ closeArchive()

bool K7Zip::closeArchive ( )
overrideprotectedvirtual

Closes the archive.

Called by close.

Implements KArchive.

Definition at line 2941 of file k7zip.cpp.

◆ doFinishWriting()

bool K7Zip::doFinishWriting ( qint64 size)
overrideprotectedvirtual

Reimplemented from KArchive.

Implements KArchive.

Definition at line 3073 of file k7zip.cpp.

◆ doPrepareWriting()

bool K7Zip::doPrepareWriting ( const QString & name,
const QString & user,
const QString & group,
qint64 size,
mode_t perm,
const QDateTime & atime,
const QDateTime & mtime,
const QDateTime & ctime )
overrideprotectedvirtual

Reimplemented from KArchive.

Implements KArchive.

Definition at line 3098 of file k7zip.cpp.

◆ doWriteData()

bool K7Zip::doWriteData ( const char * data,
qint64 size )
overrideprotectedvirtual

Reimplemented from KArchive.

Reimplemented from KArchive.

Definition at line 3081 of file k7zip.cpp.

◆ doWriteDir()

bool K7Zip::doWriteDir ( const QString & name,
const QString & user,
const QString & group,
mode_t perm,
const QDateTime & atime,
const QDateTime & mtime,
const QDateTime & ctime )
overrideprotectedvirtual

Reimplemented from KArchive.

Implements KArchive.

Definition at line 3149 of file k7zip.cpp.

◆ doWriteSymLink()

bool K7Zip::doWriteSymLink ( const QString & name,
const QString & target,
const QString & user,
const QString & group,
mode_t perm,
const QDateTime & atime,
const QDateTime & mtime,
const QDateTime & ctime )
overrideprotectedvirtual

Reimplemented from KArchive.

Implements KArchive.

Definition at line 3188 of file k7zip.cpp.

◆ openArchive()

bool K7Zip::openArchive ( QIODevice::OpenMode mode)
overrideprotectedvirtual

Opens the archive for reading.

Parses the directory listing of the archive and creates the KArchiveDirectory/KArchiveFile entries.

Parameters
modethe mode of the file

Implements KArchive.

Definition at line 2489 of file k7zip.cpp.

◆ passwordNeeded()

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
Since
6.13

Definition at line 587 of file k7zip.cpp.

◆ setPassword()

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.
Parameters
passwordthe password to use for encrypted archive
Since
6.13

Definition at line 583 of file k7zip.cpp.

◆ virtual_hook()

void K7Zip::virtual_hook ( int id,
void * data )
overrideprotectedvirtual

Reimplemented from KArchive.

Definition at line 3233 of file k7zip.cpp.


The documentation for this class was generated from the following files:
This file is part of the KDE documentation.
Documentation copyright © 1996-2025 The KDE developers.
Generated on Fri Mar 28 2025 11:52:31 by doxygen 1.13.2 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.