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

ark

archiveinterface.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 ARCHIVEINTERFACE_H
00027 #define ARCHIVEINTERFACE_H
00028 
00029 #include <QObject>
00030 #include <QStringList>
00031 #include <QString>
00032 
00033 #include "archive.h"
00034 #include "queries.h"
00035 #include "kerfuffle_export.h"
00036 
00037 #include <kio/job.h>
00038 #include <kio/jobclasses.h>
00039 
00040 namespace Kerfuffle
00041 {
00042     class ArchiveObserver;
00043 
00044     class KERFUFFLE_EXPORT ReadOnlyArchiveInterface: public QObject
00045     {
00046         Q_OBJECT
00047         public:
00048             explicit ReadOnlyArchiveInterface( const QString & filename, QObject *parent = 0 );
00049             virtual ~ReadOnlyArchiveInterface();
00050 
00051             QString filename() const { return m_filename; }
00052             virtual bool isReadOnly() const { return true; }
00053 
00054             void KDE_NO_EXPORT registerObserver( ArchiveObserver *observer );
00055             void KDE_NO_EXPORT removeObserver( ArchiveObserver *observer );
00056 
00057             virtual bool open() { return true; }
00058             virtual bool list() = 0;
00059             virtual bool copyFiles( const QList<QVariant> & files, const QString & destinationDirectory, Archive::CopyFlags flags ) = 0;
00060             void setPassword(QString password) { m_password = password; }
00061 
00062         protected:
00063             void error( const QString & message, const QString & details = QString() );
00064             void entry( const ArchiveEntry & archiveEntry );
00065             void progress( double );
00066             void entryRemoved( const QString& path );
00067             QString password() { return m_password; }
00068             QString findCommonBase(const QVariantList& files);
00069             QString findCommonBase(const QStringList& files);
00070             void expandDirectories( QStringList &files );
00071 
00072         signals:
00073             void userQuery( Query* );
00074 
00075 
00076         private:
00077             QList<ArchiveObserver*> m_observers;
00078             QString m_filename;
00079             QString m_password;
00080     };
00081 
00082     //used by the expandDirectories function
00083     class RecursiveListHelper : public QObject
00084     {
00085         Q_OBJECT
00086 
00087         public:
00088             RecursiveListHelper() :
00089                 QObject(NULL) {}
00090             QStringList results;
00091 
00092         public slots:
00093             void entries (KIO::Job *job, const KIO::UDSEntryList &list);
00094 
00095     };
00096 
00097     class KERFUFFLE_EXPORT ReadWriteArchiveInterface: public ReadOnlyArchiveInterface
00098     {
00099         Q_OBJECT
00100         public:
00101             explicit ReadWriteArchiveInterface( const QString & filename, QObject *parent = 0 );
00102             virtual ~ReadWriteArchiveInterface();
00103 
00104             virtual bool isReadOnly() const;
00105 
00106             //see archive.h for a list of what the compressionoptions might
00107             //contain
00108             virtual bool addFiles( const QStringList & files, const CompressionOptions& options ) = 0;
00109             virtual bool deleteFiles( const QList<QVariant> & files ) = 0;
00110     };
00111 
00112 } // namespace Kerfuffle
00113 
00114 #endif // ARCHIVEINTERFACE_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
  • kdessh
  • kdf
  • kfloppy
  • kgpg
  • ktimer
  • kwallet
  • okteta
  • printer-applet
  • superkaramba
  • sweeper
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