~ubuntu-branches/ubuntu/quantal/ark/quantal

« back to all changes in this revision

Viewing changes to kerfuffle/archive.h

  • Committer: Package Import Robot
  • Author(s): Felix Geyer
  • Date: 2012-06-06 18:50:49 UTC
  • mfrom: (1.1.7)
  • Revision ID: package-import@ubuntu.com-20120606185049-z43lsy5wwp3wtrgt
Tags: 4:4.8.80-0ubuntu1
* Merge with Debian git repository, remaining changes:
  - Suggest instead of recommend p7zip-full
  - Add and install utilities-file-archiver.xpm
* New upstream beta release.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/*
2
2
 * Copyright (c) 2007 Henrique Pinto <henrique.pinto@kdemail.net>
3
3
 * Copyright (c) 2008 Harald Hvaal <haraldhv@stud.ntnu.no>
 
4
 * Copyright (c) 2011 Raphael Kubo da Costa <rakuco@FreeBSD.org>
4
5
 *
5
6
 * Redistribution and use in source and binary forms, with or without
6
7
 * modification, are permitted provided that the following conditions
41
42
class ExtractJob;
42
43
class DeleteJob;
43
44
class AddJob;
 
45
class Query;
 
46
class ReadOnlyArchiveInterface;
44
47
 
45
48
/**
46
49
 * Meta data related to one entry in a compressed archive.
87
90
    Q_OBJECT
88
91
 
89
92
public:
90
 
    virtual ~Archive() {}
91
 
 
92
 
    virtual QString fileName() const = 0;
93
 
    virtual bool isReadOnly()  const = 0;
94
 
 
95
 
    virtual KJob*       open() = 0;
96
 
    virtual KJob*       create() = 0;
97
 
    virtual ListJob*    list() = 0;
98
 
    virtual DeleteJob*  deleteFiles(const QList<QVariant> & files) = 0;
 
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);
99
104
 
100
105
    /**
101
106
     * Compression options that should be handled by all interfaces:
109
114
     * archive root where the files will be added under
110
115
     *
111
116
     */
112
 
    virtual AddJob*     addFiles(const QStringList & files, const CompressionOptions& options = CompressionOptions()) = 0;
113
 
 
114
 
    virtual ExtractJob* copyFiles(const QList<QVariant> & files, const QString & destinationDir, ExtractionOptions options = ExtractionOptions()) = 0;
115
 
 
116
 
    virtual bool isSingleFolderArchive() = 0;
117
 
    virtual QString subfolderName() = 0;
118
 
    virtual bool isPasswordProtected() = 0;
119
 
 
120
 
    virtual void setPassword(QString password) = 0;
121
 
 
 
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;
122
142
};
123
143
 
124
 
KERFUFFLE_EXPORT Archive* factory(const QString & filename, const QString & fixedMimeType = QString());
125
144
KERFUFFLE_EXPORT QStringList supportedMimeTypes();
126
145
KERFUFFLE_EXPORT QStringList supportedWriteMimeTypes();
127
146
} // namespace Kerfuffle