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

ark

  • sources
  • kde-4.14
  • kdeutils
  • ark
  • kerfuffle
jobs.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2007 Henrique Pinto <henrique.pinto@kdemail.net>
3  * Copyright (c) 2008-2009 Harald Hvaal <haraldhv@stud.ntnu.no>
4  * Copyright (c) 2009-2012 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 JOBS_H
29 #define JOBS_H
30 
31 #include "kerfuffle_export.h"
32 #include "archiveinterface.h"
33 #include "archive.h"
34 #include "queries.h"
35 
36 #include <KJob>
37 #include <QList>
38 #include <QVariant>
39 #include <QString>
40 
41 namespace Kerfuffle
42 {
43 
44 class ThreadExecution;
45 
46 class KERFUFFLE_EXPORT Job : public KJob
47 {
48  Q_OBJECT
49 
50 public:
51  void start();
52 
53  bool isRunning() const;
54 
55 protected:
56  Job(ReadOnlyArchiveInterface *interface, QObject *parent = 0);
57  virtual ~Job();
58  virtual bool doKill();
59  virtual void emitResult();
60 
61  ReadOnlyArchiveInterface *archiveInterface();
62 
63  void connectToArchiveInterfaceSignals();
64 
65 public slots:
66  virtual void doWork() = 0;
67 
68 protected slots:
69  virtual void onError(const QString &message, const QString &details);
70  virtual void onInfo(const QString &info);
71  virtual void onEntry(const ArchiveEntry &archiveEntry);
72  virtual void onProgress(double progress);
73  virtual void onEntryRemoved(const QString &path);
74  virtual void onFinished(bool result);
75  virtual void onUserQuery(Query *query);
76 
77 signals:
78  void entryRemoved(const QString & entry);
79  void error(const QString& errorMessage, const QString& details);
80  void newEntry(const ArchiveEntry &);
81  void userQuery(Kerfuffle::Query*);
82 
83 private:
84  ReadOnlyArchiveInterface *m_archiveInterface;
85 
86  bool m_isRunning;
87 
88  class Private;
89  Private * const d;
90 };
91 
92 class KERFUFFLE_EXPORT ListJob : public Job
93 {
94  Q_OBJECT
95 
96 public:
97  explicit ListJob(ReadOnlyArchiveInterface *interface, QObject *parent = 0);
98 
99  qlonglong extractedFilesSize() const;
100  bool isPasswordProtected() const;
101  bool isSingleFolderArchive() const;
102  QString subfolderName() const;
103 
104 public slots:
105  virtual void doWork();
106 
107 private:
108  bool m_isSingleFolderArchive;
109  bool m_isPasswordProtected;
110  QString m_subfolderName;
111  QString m_basePath;
112  qlonglong m_extractedFilesSize;
113 
114 private slots:
115  void onNewEntry(const ArchiveEntry&);
116 };
117 
118 class KERFUFFLE_EXPORT ExtractJob : public Job
119 {
120  Q_OBJECT
121 
122 public:
123  ExtractJob(const QVariantList& files, const QString& destinationDir, ExtractionOptions options, ReadOnlyArchiveInterface *interface, QObject *parent = 0);
124 
125  QString destinationDirectory() const;
126  ExtractionOptions extractionOptions() const;
127 
128 public slots:
129  virtual void doWork();
130 
131 private:
132  // TODO: Maybe this should be a method if ExtractionOptions were a class?
133  void setDefaultOptions();
134 
135  QVariantList m_files;
136  QString m_destinationDir;
137  ExtractionOptions m_options;
138 };
139 
140 class KERFUFFLE_EXPORT AddJob : public Job
141 {
142  Q_OBJECT
143 
144 public:
145  AddJob(const QStringList& files, const CompressionOptions& options, ReadWriteArchiveInterface *interface, QObject *parent = 0);
146 
147 public slots:
148  virtual void doWork();
149 
150 private:
151  QStringList m_files;
152  CompressionOptions m_options;
153 };
154 
155 class KERFUFFLE_EXPORT DeleteJob : public Job
156 {
157  Q_OBJECT
158 
159 public:
160  DeleteJob(const QVariantList& files, ReadWriteArchiveInterface *interface, QObject *parent = 0);
161 
162 public slots:
163  virtual void doWork();
164 
165 private:
166  QVariantList m_files;
167 };
168 
169 } // namespace Kerfuffle
170 
171 #endif // JOBS_H
Kerfuffle::Query
Definition: queries.h:44
Kerfuffle::DeleteJob
Definition: jobs.h:155
kerfuffle_export.h
Kerfuffle::AddJob
Definition: jobs.h:140
archive.h
queries.h
Kerfuffle::ReadOnlyArchiveInterface
Definition: archiveinterface.h:43
Kerfuffle::ListJob
Definition: jobs.h:92
Kerfuffle::ReadWriteArchiveInterface
Definition: archiveinterface.h:121
archiveinterface.h
QHash
QObject
QString
KERFUFFLE_EXPORT
#define KERFUFFLE_EXPORT
Definition: kerfuffle_export.h:41
QStringList
Kerfuffle::ExtractJob
Definition: jobs.h:118
Kerfuffle::Job
Definition: jobs.h:46
KJob
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Jun 22 2020 13:42:37 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
  • ktimer
  • kwallet
  • 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