• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • kdeutils API Reference
  • KDE Home
  • Contact Us
 

ark

  • sources
  • kde-4.12
  • kdeutils
  • ark
  • kerfuffle
archive.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2007 Henrique Pinto <henrique.pinto@kdemail.net>
3  * Copyright (c) 2008 Harald Hvaal <haraldhv@stud.ntnu.no>
4  * Copyright (c) 2011 Raphael Kubo da Costa <rakuco@FreeBSD.org>
5  *
6  * Redistribution and use in source and binary forms, with or without
7  * modification, are permitted provided that the following conditions
8  * are met:
9  *
10  * 1. Redistributions of source code must retain the above copyright
11  * notice, this list of conditions and the following disclaimer.
12  * 2. Redistributions in binary form must reproduce the above copyright
13  * notice, this list of conditions and the following disclaimer in the
14  * documentation and/or other materials provided with the distribution.
15  *
16  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
17  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
18  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
19  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
20  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES ( INCLUDING, BUT
21  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
22  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION ) HOWEVER CAUSED AND ON ANY
23  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24  * ( INCLUDING NEGLIGENCE OR OTHERWISE ) ARISING IN ANY WAY OUT OF THE USE OF
25  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26  */
27 
28 #ifndef ARCHIVE_H
29 #define ARCHIVE_H
30 
31 #include "kerfuffle_export.h"
32 
33 #include <QString>
34 #include <QStringList>
35 #include <QHash>
36 
37 class KJob;
38 
39 namespace Kerfuffle
40 {
41 class ListJob;
42 class ExtractJob;
43 class DeleteJob;
44 class AddJob;
45 class Query;
46 class ReadOnlyArchiveInterface;
47 
58 enum EntryMetaDataType {
59  FileName = 0,
60  InternalID,
61  Permissions,
62  Owner,
63  Group,
64  Size,
65  CompressedSize,
66  Link,
67  Ratio,
68  CRC,
69  Method,
70  Version,
71  Timestamp,
72  IsDirectory,
73  Comment,
74  IsPasswordProtected,
75  Custom = 1048576
76 };
77 
78 typedef QHash<int, QVariant> ArchiveEntry;
79 
85 typedef QHash<QString, QVariant> CompressionOptions;
86 typedef QHash<QString, QVariant> ExtractionOptions;
87 
88 class KERFUFFLE_EXPORT Archive : public QObject
89 {
90  Q_OBJECT
91 
92 public:
93  static Archive *create(const QString &fileName, QObject *parent = 0);
94  static Archive *create(const QString &fileName, const QString &fixedMimeType, QObject *parent = 0);
95  ~Archive();
96 
97  QString fileName() const;
98  bool isReadOnly() const;
99 
100  KJob* open();
101  KJob* create();
102  ListJob* list();
103  DeleteJob* deleteFiles(const QList<QVariant> & files);
104 
117  AddJob* addFiles(const QStringList & files, const CompressionOptions& options = CompressionOptions());
118 
119  ExtractJob* copyFiles(const QList<QVariant> & files, const QString & destinationDir, ExtractionOptions options = ExtractionOptions());
120 
121  bool isSingleFolderArchive();
122  QString subfolderName();
123  bool isPasswordProtected();
124 
125  void setPassword(const QString &password);
126 
127 private slots:
128  void onListFinished(KJob*);
129  void onAddFinished(KJob*);
130  void onUserQuery(Kerfuffle::Query*);
131 
132 private:
133  Archive(ReadOnlyArchiveInterface *archiveInterface, QObject *parent = 0);
134 
135  void listIfNotListed();
136  ReadOnlyArchiveInterface *m_iface;
137  bool m_hasBeenListed;
138  bool m_isPasswordProtected;
139  bool m_isSingleFolderArchive;
140  QString m_subfolderName;
141  qlonglong m_extractedFilesSize;
142 };
143 
144 KERFUFFLE_EXPORT QStringList supportedMimeTypes();
145 KERFUFFLE_EXPORT QStringList supportedWriteMimeTypes();
146 } // namespace Kerfuffle
147 
148 
149 #endif // ARCHIVE_H
Kerfuffle::Ratio
The compression ratio for the entry.
Definition: archive.h:67
Kerfuffle::Owner
The user the entry belongs to.
Definition: archive.h:62
Kerfuffle::IsPasswordProtected
The entry is password-protected.
Definition: archive.h:74
Kerfuffle::IsDirectory
The entry is a directory.
Definition: archive.h:72
Kerfuffle::Query
Definition: queries.h:44
Kerfuffle::supportedWriteMimeTypes
QStringList supportedWriteMimeTypes()
Definition: archive.cpp:306
Kerfuffle::DeleteJob
Definition: jobs.h:155
kerfuffle_export.h
Kerfuffle::AddJob
Definition: jobs.h:140
Kerfuffle::CompressedSize
The compressed size for the entry.
Definition: archive.h:65
QObject
Kerfuffle::Link
The entry is a symbolic link.
Definition: archive.h:66
Kerfuffle::ReadOnlyArchiveInterface
Definition: archiveinterface.h:43
Kerfuffle::Version
The archiver version needed to extract the entry.
Definition: archive.h:70
Kerfuffle::ListJob
Definition: jobs.h:92
Kerfuffle::ArchiveEntry
QHash< int, QVariant > ArchiveEntry
Definition: archive.h:78
Kerfuffle::supportedMimeTypes
QStringList supportedMimeTypes()
Definition: archive.cpp:279
Kerfuffle::EntryMetaDataType
EntryMetaDataType
Meta data related to one entry in a compressed archive.
Definition: archive.h:58
KERFUFFLE_EXPORT
#define KERFUFFLE_EXPORT
Definition: kerfuffle_export.h:41
Kerfuffle::CompressionOptions
QHash< QString, QVariant > CompressionOptions
These are the extra options for doing the compression.
Definition: archive.h:85
Kerfuffle::Timestamp
The timestamp for the current entry.
Definition: archive.h:71
Kerfuffle::FileName
The entry's file name.
Definition: archive.h:59
Kerfuffle::Archive
Definition: archive.h:88
Kerfuffle::CRC
The entry's CRC.
Definition: archive.h:68
Kerfuffle::ExtractJob
Definition: jobs.h:118
Kerfuffle::Custom
Definition: archive.h:75
Kerfuffle::Permissions
The entry's permissions.
Definition: archive.h:61
Kerfuffle::ExtractionOptions
QHash< QString, QVariant > ExtractionOptions
Definition: archive.h:86
Kerfuffle::Method
The compression method used on the entry.
Definition: archive.h:69
Kerfuffle::Size
The entry's original size.
Definition: archive.h:64
Kerfuffle::Comment
Definition: archive.h:73
Kerfuffle::Group
The user group the entry belongs to.
Definition: archive.h:63
Kerfuffle::InternalID
The entry's ID for Ark's internal manipulation.
Definition: archive.h:60
KJob
This file is part of the KDE documentation.
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 23:08:10 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

ark

Skip menu "ark"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members

kdeutils API Reference

Skip menu "kdeutils API Reference"
  • ark
  • filelight
  • kcalc
  • kcharselect
  • kdf
  • kfloppy
  • kgpg
  • kremotecontrol
  • ktimer
  • kwallet
  • superkaramba
  • sweeper

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal