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

ark

internaljobs.h

Go to the documentation of this file.
00001 /*
00002  * Copyright (c) 2007 Henrique Pinto <henrique.pinto@kdemail.net>
00003  *
00004  * Redistribution and use in source and binary forms, with or without
00005  * modification, are permitted provided that the following conditions
00006  * are met:
00007  *
00008  * 1. Redistributions of source code must retain the above copyright
00009  *    notice, this list of conditions and the following disclaimer.
00010  * 2. Redistributions in binary form must reproduce the above copyright
00011  *    notice, this list of conditions and the following disclaimer in the
00012  *    documentation and/or other materials provided with the distribution.
00013  *
00014  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
00015  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
00016  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
00017  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
00018  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES ( INCLUDING, BUT
00019  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
00020  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION ) HOWEVER CAUSED AND ON ANY
00021  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
00022  * ( INCLUDING NEGLIGENCE OR OTHERWISE ) ARISING IN ANY WAY OUT OF THE USE OF
00023  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
00024  */
00025 
00026 #ifndef KERFUFFLE_INTERNAL_JOBS_H
00027 #define KERFUFFLE_INTERNAL_JOBS_H
00028 
00029 #include <ThreadWeaver/Job>
00030 #include <ThreadWeaver/Weaver>
00031 
00032 #include "archiveinterface.h"
00033 #include "observer.h"
00034 #include <QList>
00035 
00036 
00037 namespace Kerfuffle
00038 {
00039     class ArchiveJobHelper;
00040 
00041     class InternalJob: public ThreadWeaver::Job
00042     {
00043         Q_OBJECT
00044         public:
00045             InternalJob( QObject *parent = 0 );
00046             ~InternalJob();
00047 
00048             bool success() const { return m_success; }
00049 
00050         protected:
00051             void setSuccess( bool success ) { m_success = success; }
00052 
00053         private:
00054             bool m_success;
00055     };
00056 
00057     class InternalListingJob: public InternalJob
00058     {
00059         Q_OBJECT
00060         public:
00061             explicit InternalListingJob( ReadOnlyArchiveInterface *archive, QObject *parent = 0 );
00062             ~InternalListingJob();
00063 
00064         protected:
00065             void run();
00066 
00067         signals:
00068             void entry( const ArchiveEntry & );
00069             void progress( double );
00070             void error( const QString& errorMessage, const QString& details );
00071 
00072         private:
00073             QList<ArchiveEntry>       m_entries;
00074             ArchiveJobHelper         *m_helper;
00075             ReadOnlyArchiveInterface *m_archive;
00076     };
00077 
00078     class InternalExtractJob: public InternalJob
00079     {
00080         Q_OBJECT
00081         public:
00082             InternalExtractJob( ReadOnlyArchiveInterface *archive, const QList<QVariant> & files, const QString & destinationDirectory, bool preservePaths = false, QObject *parent = 0 );
00083             ~InternalExtractJob();
00084 
00085         protected:
00086             void run();
00087 
00088         signals:
00089             void progress( double p );
00090             void error( const QString& errorMessage, const QString& details );
00091 
00092         private:
00093             ReadOnlyArchiveInterface *m_archive;
00094             QList<QVariant>           m_files;
00095             QString                   m_destinationDirectory;
00096             ArchiveJobHelper         *m_helper;
00097             bool                      m_preservePaths;
00098     };
00099 
00100     class InternalAddJob: public InternalJob
00101     {
00102         Q_OBJECT
00103         public:
00104             InternalAddJob( ReadWriteArchiveInterface *archive, const QStringList & files, QObject *parent = 0 );
00105             ~InternalAddJob();
00106 
00107         protected:
00108             void run();
00109 
00110         signals:
00111             void entry( const ArchiveEntry & );
00112             void progress( double );
00113             void error( const QString& errorMessage, const QString& details );
00114 
00115         private:
00116             QStringList                m_files;
00117             ReadWriteArchiveInterface *m_archive;
00118             ArchiveJobHelper          *m_helper;
00119     };
00120 
00121     class InternalDeleteJob: public InternalJob
00122     {
00123         Q_OBJECT
00124         public:
00125             InternalDeleteJob( ReadWriteArchiveInterface *archive, const QList<QVariant> & entries, QObject *parent = 0 );
00126             ~InternalDeleteJob();
00127 
00128         protected:
00129             void run();
00130 
00131         signals:
00132             void entryRemoved( const QString& path );
00133 
00134         private:
00135             QList<QVariant>            m_entries;
00136             ReadWriteArchiveInterface *m_archive;
00137             ArchiveJobHelper          *m_helper;
00138 
00139     };
00140 
00141     class ArchiveJobHelper: public QObject, public ArchiveObserver
00142     {
00143         Q_OBJECT
00144         public:
00145             explicit ArchiveJobHelper( ReadOnlyArchiveInterface *archive, QObject *parent = 0 );
00146             ~ArchiveJobHelper();
00147 
00148             bool getTheListing();
00149 
00150             void onError( const QString & message, const QString & details = QString() );
00151             void onEntry( const ArchiveEntry & archiveEntry );
00152             void onEntryRemoved( const QString & path );
00153             void onProgress( double );
00154 
00155         signals:
00156             void entry( const ArchiveEntry & );
00157             void progress( double );
00158             void error( const QString & message, const QString & details );
00159             void entryRemoved( const QString & path );
00160 
00161         private:
00162             ReadOnlyArchiveInterface *m_archive;
00163     };
00164 
00165 } // namespace Kerfuffle
00166 
00167 #endif // KERFUFFLE_INTERNAL_JOBS_H

ark

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

kdeutils

Skip menu "kdeutils"
  • ark
  • kcalc
  • kcharselect
  • kdelirc
  • kdessh
  • kdf
  • kfloppy
  • kgpg
  • kjots
  • klaptopdaemon
  • kmilo
  • ksim
  • ktimer
  • kwallet
  • superkaramba
Generated for kdeutils by doxygen 1.5.4
This website is maintained by Adriaan de Groot and Allen Winter.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal