kmail Library API Documentation

cachedimapjob.h

00001 /*  -*- mode: C++; c-file-style: "gnu" -*-
00002  *
00003  *  This file is part of KMail, the KDE mail client.
00004  *  Copyright (c) 2002-2003  Bo Thorsen <bo@sonofthor.dk>
00005  *                2002-2003  Steffen Hansen <hansen@kde.org>
00006  *                2002-2003  Zack Rusin <zack@kde.org>
00007  *
00008  *  KMail is free software; you can redistribute it and/or modify it
00009  *  under the terms of the GNU General Public License, version 2, as
00010  *  published by the Free Software Foundation.
00011  *
00012  *  KMail is distributed in the hope that it will be useful, but
00013  *  WITHOUT ANY WARRANTY; without even the implied warranty of
00014  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00015  *  General Public License for more details.
00016  *
00017  *  You should have received a copy of the GNU General Public License
00018  *  along with this program; if not, write to the Free Software
00019  *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00020  *
00021  *  In addition, as a special exception, the copyright holders give
00022  *  permission to link the code of this program with any edition of
00023  *  the Qt library by Trolltech AS, Norway (or with modified versions
00024  *  of Qt that use the same license as Qt), and distribute linked
00025  *  combinations including the two.  You must obey the GNU General
00026  *  Public License in all respects for all of the code used other than
00027  *  Qt.  If you modify this file, you may extend this exception to
00028  *  your version of the file, but you are not obligated to do so.  If
00029  *  you do not wish to do so, delete this exception statement from
00030  *  your version.
00031  */
00032 
00033 #ifndef CACHEDIMAPJOB_H
00034 #define CACHEDIMAPJOB_H
00035 
00036 #include "folderjob.h"
00037 #include <kio/job.h>
00038 #include <kio/global.h>
00039 
00040 #include <qptrlist.h>
00041 #include <qvaluelist.h>
00042 #include <qcstring.h>
00043 
00044 class KMFolderCachedImap;
00045 class KMAcctCachedImap;
00046 class KMMessage;
00047 
00048 namespace KMail {
00049 
00050 class CachedImapJob : public FolderJob {
00051   Q_OBJECT
00052 public:
00054   struct MsgForDownload {
00055     MsgForDownload() : uid(0),flags(0),size(0) {} // for QValueList only
00056     MsgForDownload( ulong _uid, int _flags, ulong _size )
00057       : uid(_uid), flags(_flags), size(_size) {}
00058     ulong uid;
00059     int flags;
00060     ulong size;
00061   };
00062 
00063   // Get messages
00064   CachedImapJob( const QValueList<MsgForDownload>& msgs,
00065                  JobType type = tGetMessage, KMFolderCachedImap* folder = 0 );
00066   // Put messages
00067   CachedImapJob( const QPtrList<KMMessage>& msgs,
00068                  JobType type, KMFolderCachedImap* folder=0 );
00069   CachedImapJob( const QValueList<unsigned long>& msgs,
00070                  JobType type, KMFolderCachedImap* folder=0 );
00071   // Add sub folders
00072   CachedImapJob( const QValueList<KMFolderCachedImap*>& folders,
00073                  JobType type = tAddSubfolders,
00074                  KMFolderCachedImap* folder = 0 );
00075   // Delete message ; Rename folder
00076   CachedImapJob( const QString& string1, JobType type,
00077                  KMFolderCachedImap* folder );
00078   // Delete folders
00079   CachedImapJob( const QStringList& folders, JobType type,
00080                  KMFolderCachedImap* folder = 0 );
00081   // Other jobs (expunge folder, check uid validity)
00082   CachedImapJob( JobType type, KMFolderCachedImap* folder );
00083 
00084   virtual ~CachedImapJob();
00085 
00086   void setPassiveDestructor( bool passive ) { mPassiveDestructor = passive; }
00087   bool passiveDestructor() { return mPassiveDestructor; }
00088 
00089 protected:
00090   virtual void execute();
00091   virtual void expireMessages();
00092   virtual void deleteMessages( const QString& uids );
00093   virtual void expungeFolder();
00094   virtual void checkUidValidity();
00095   virtual void renameFolder( const QString &newName );
00096 
00097 protected slots:
00098   virtual void slotGetNextMessage( KIO::Job *job = 0 );
00099   virtual void slotAddNextSubfolder( KIO::Job *job = 0 );
00100   virtual void slotPutNextMessage();
00101   virtual void slotPutMessageDataReq( KIO::Job *job, QByteArray &data );
00102   virtual void slotPutMessageResult( KIO::Job *job );
00103   virtual void slotDeleteResult( KIO::Job *job );
00104   virtual void slotDeleteNextFolder( KIO::Job *job = 0 );
00105   virtual void slotCheckUidValidityResult( KIO::Job *job );
00106   virtual void slotRenameFolderResult( KIO::Job *job );
00107   void slotProcessedSize( KIO::Job *, KIO::filesize_t processed );
00108 
00109 private:
00110   void init();
00111 
00112   KMFolderCachedImap *mFolder;
00113   KMAcctCachedImap   *mAccount;
00114   QValueList<KMFolderCachedImap*> mFolderList;
00115   QValueList<MsgForDownload> mMsgsForDownload;
00116   QValueList<unsigned long> mSerNumMsgList;
00117   ulong mSentBytes; // previous messages
00118   ulong mTotalBytes;
00119   QStringList mFolderPathList; // Used only for folder deletion
00120   KMMessage* mMsg;
00121   QString mString; // Used as uids and as rename target
00122   QByteArray mData;
00123 };
00124 
00125 }
00126 
00127 #endif
KDE Logo
This file is part of the documentation for kmail Library Version 3.2.2.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Sat May 1 11:37:13 2004 by doxygen 1.2.15 written by Dimitri van Heesch, © 1997-2003