ark
jobs.h
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025 #ifndef JOBS_H
00026 #define JOBS_H
00027
00028 #include "kerfuffle_export.h"
00029 #include "archiveinterface.h"
00030 #include "archive.h"
00031 #include "queries.h"
00032
00033 #include <KJob>
00034 #include <QList>
00035 #include <QVariant>
00036 #include <QString>
00037
00038 namespace ThreadWeaver
00039 {
00040 class Job;
00041 }
00042
00043 namespace Kerfuffle
00044 {
00045 class KERFUFFLE_EXPORT ListJob: public KJob
00046 {
00047 Q_OBJECT
00048 public:
00049 explicit ListJob( ReadOnlyArchiveInterface *interface, QObject *parent = 0 );
00050
00051 void start();
00052 bool isSingleFolderArchive() { return m_isSingleFolderArchive; }
00053 bool isPasswordProtected() { return m_isPasswordProtected; }
00054 QString subfolderName() { return m_subfolderName; }
00055 qlonglong extractedFilesSize() { return m_extractedFilesSize; }
00056
00057 signals:
00058 void newEntry( const ArchiveEntry & );
00059 void error( const QString& errorMessage, const QString& details );
00060
00061 private slots:
00062 void done( ThreadWeaver::Job* );
00063 void progress( double );
00064 void onNewEntry(const ArchiveEntry&);
00065 void onError(const QString& errorMessage, const QString& details);
00066
00067 private:
00068 ReadOnlyArchiveInterface *m_archive;
00069 bool m_isSingleFolderArchive;
00070 bool m_isPasswordProtected;
00071 QString m_subfolderName;
00072 QString m_previousEntry;
00073 qlonglong m_extractedFilesSize;
00074 };
00075
00076 class KERFUFFLE_EXPORT ExtractJob: public KJob
00077 {
00078 Q_OBJECT
00079 public:
00080 ExtractJob( const QList<QVariant> & files, const QString& destinationDir, Archive::CopyFlags flags, ReadOnlyArchiveInterface *interface, QObject *parent = 0 );
00081
00082 void start();
00083
00084 signals:
00085 void userQuery( Query* );
00086
00087 private slots:
00088 void done( ThreadWeaver::Job * );
00089 void progress( double );
00090 void error( const QString&, const QString& );
00091
00092 private:
00093 QList<QVariant> m_files;
00094 QString m_destinationDir;
00095 Archive::CopyFlags m_flags;
00096 ReadOnlyArchiveInterface *m_archive;
00097 };
00098
00099 class KERFUFFLE_EXPORT AddJob: public KJob
00100 {
00101 Q_OBJECT
00102 public:
00103 AddJob(const QString& path, const QStringList & files, ReadWriteArchiveInterface *interface, QObject *parent = 0 );
00104
00105 void start();
00106
00107 signals:
00108 void newEntry( const ArchiveEntry & );
00109 void userQuery( Query* );
00110
00111 private slots:
00112 void done( ThreadWeaver::Job * );
00113 void progress( double );
00114 void error( const QString&, const QString& );
00115
00116 private:
00117 QStringList m_files;
00118 QString m_path;
00119 ReadWriteArchiveInterface *m_archive;
00120
00121 };
00122
00123 class KERFUFFLE_EXPORT DeleteJob: public KJob
00124 {
00125 Q_OBJECT
00126 public:
00127 DeleteJob( const QList<QVariant>& files, ReadWriteArchiveInterface *interface, QObject *parent = 0 );
00128
00129 void start();
00130
00131 signals:
00132 void entryRemoved( const QString & entry );
00133 void error( const QString& errorMessage, const QString& details );
00134 void userQuery( Query* );
00135
00136 private slots:
00137 void done( ThreadWeaver::Job * );
00138 void progress( double );
00139
00140 private:
00141 QList<QVariant> m_files;
00142 ReadWriteArchiveInterface *m_archive;
00143 };
00144 }
00145
00146 #endif // JOBS_H