Blokkal
an Extendable KDE Blogging Client
SourceForge.net Logo

jobs.h

00001 /***************************************************************************
00002  *   Copyright (C) 2008 by Martin Mueller                                  *
00003  *   orvio@orvio.de                                                        *
00004  *                                                                         *
00005  *   This program is free software; you can redistribute it and/or modify  *
00006  *   it under the terms of the GNU General Public License as published by  *
00007  *   the Free Software Foundation; either version 2 of the License, or     *
00008  *   (at your option) any later version.                                   *
00009  *                                                                         *
00010  *   This program is distributed in the hope that it will be useful,       *
00011  *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
00012  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
00013  *   GNU General Public License for more details.                          *
00014  *                                                                         *
00015  *   You should have received a copy of the GNU General Public License     *
00016  *   along with this program; if not, write to the                         *
00017  *   Free Software Foundation, Inc.,                                       *
00018  *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
00019  ***************************************************************************/
00020 #ifndef BLOKKALL_IOJOBS_H
00021 #define BLOKKALL_IOJOBS_H
00022 
00023 #include "../blokkal_export.h"
00024 #include <kcompositejob.h>
00025 
00026 #include <QtCore/QDate>
00027 
00028 namespace Blokkal {
00029 class Blog;
00030 class Entry;
00031 namespace Io {
00035 enum Error {
00036         UnknownError = -1, 
00037         AuthenticationError = -2, 
00038         MalformedReplyError = -3, 
00039         UserDefinedError = -100, 
00040 };
00041 
00047 class BLOKKAL_EXPORT Job : public KCompositeJob {
00048 Q_OBJECT
00049 public:
00054         Job( QObject * parent = 0 );
00055         virtual ~Job( void );
00056 
00060         virtual void start( void );
00061 
00062         virtual bool addSubjob( KJob * job );
00063 
00064 protected Q_SLOTS:
00068         virtual void slotResult( KJob * job );
00069 
00073         virtual void slotEmitPercent( void );
00074 
00075 protected:
00083         virtual void jobFinished( void );
00084 
00089         virtual void subjobFinished( KJob * job );
00090 
00095         virtual bool doKill( void );
00096 };
00097 
00103 class BLOKKAL_EXPORT EntryJob : public Blokkal::Io::Job {
00104 Q_OBJECT
00105 public:
00110         EntryJob( Blokkal::Entry * entry );
00111         virtual ~EntryJob( void );
00112         
00116         Blokkal::Entry * entry( void ) const;
00117         
00118 private:
00119         class Private;
00120         Private * const d;
00121         
00122 };
00123 
00129 class BLOKKAL_EXPORT BlogJob : public Blokkal::Io::Job {
00130 Q_OBJECT
00131 public:
00136         BlogJob( Blokkal::Blog * blog );
00137         virtual ~BlogJob( void );
00138 
00142         Blokkal::Blog * blog( void ) const;
00143 
00144 private:
00145         class Private;
00146         Private * const d;      
00147 };
00148 
00154 class BLOKKAL_EXPORT LoadEntryJob : public Blokkal::Io::BlogJob {
00155 Q_OBJECT
00156 public:
00161         LoadEntryJob( Blokkal::Blog * blog );
00162         virtual ~LoadEntryJob( void );
00163 
00167         virtual QList<Blokkal::Entry *> entries( void ) const = 0;
00168 };
00169 
00175 class BLOKKAL_EXPORT LoadIndexJob : public Blokkal::Io::BlogJob {
00176 Q_OBJECT
00177 public:
00182         LoadIndexJob( Blokkal::Blog * blog );
00183         virtual ~LoadIndexJob( void );
00184 
00188         virtual QMap<QDate, QStringList > index( void ) const = 0;
00189 };
00190 
00191 
00192 }
00193 }
00194 
00195 #endif