libkpimexchange Library API Documentation

exchangemonitor.h

00001 /*
00002     This file is part of libkpimexchange
00003     Copyright (c) 2002 Jan-Pascal van Best <janpascal@vanbest.org>
00004 
00005     This library is free software; you can redistribute it and/or
00006     modify it under the terms of the GNU Library General Public
00007     License as published by the Free Software Foundation; either
00008     version 2 of the License, or (at your option) any later version.
00009 
00010     This library 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 GNU
00013     Library General Public License for more details.
00014 
00015     You should have received a copy of the GNU Library General Public License
00016     along with this library; see the file COPYING.LIB.  If not, write to
00017     the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
00018     Boston, MA 02111-1307, USA.
00019 */
00020 #ifndef KDEPIM_EXCHANGE_MONITOR_H
00021 #define KDEPIM_EXCHANGE_MONITOR_H
00022 
00023 #include <qstring.h>
00024 #include <qmap.h>
00025 //#include <qwidget.h>
00026 #include <qhostaddress.h>
00027 
00028 #include <kurl.h>
00029 #include <kio/job.h>
00030 
00031 #include <libkcal/calendar.h>
00032 #include <libkcal/event.h>
00033 
00034 class QSocketDevice;
00035 class QSocketNotifier;
00036 class QTextStream;
00037 
00038 namespace KPIM {
00039 
00040 class ExchangeAccount;
00041 
00042 class ExchangeMonitor : public QObject {
00043     Q_OBJECT
00044   public:
00045     typedef long ID;
00046     typedef QValueList<ID> IDList;
00047 
00048     enum { CallBack, Poll };
00049     enum { Delete,  
00051            Move,    
00053            Newmail, 
00055            Update,  
00060            UpdateNewMember, 
00063            Any      
00064     };
00065 
00066     ExchangeMonitor( ExchangeAccount* account, int pollMode, const QHostAddress& ownInterface  );
00067     ~ExchangeMonitor();
00068     void addWatch( const KURL &url, int mode, int depth );
00069     void removeWatch( const KURL &url );
00070     void removeWatch( ID id );
00071 
00072   signals:
00073     void notify( const QValueList<long>& IDs, const QValueList<KURL>& urls );
00074 //    void added( ID id, const KURL& url );
00075 //    void removed( ID id, const KURL& url );
00076 
00077     void error( int result, const QString& moreInfo );
00078 
00079   private slots:
00080     void slotSubscribeResult( KIO::Job * );
00081     void slotUnsubscribeResult( KIO::Job * );
00082     void slotPollTimer();
00083     void poll( const IDList& IDs );
00084     void slotPollResult( KIO::Job * );
00085     void slotRenewTimer();
00086     void slotRenewResult( KIO::Job * );
00087     void slotActivated(int socket);
00088 
00089   private:
00090 //    void init();
00091 
00092     QMap<ID,KURL> mSubscriptionMap;
00093     QSocketDevice *mSocket;
00094     QSocketNotifier* mNotifier;
00095     QTextStream *mStream;
00096     ExchangeAccount* mAccount;
00097     int mSubscriptionLifetime;
00098     // QString mSubscriptionId;
00099     QTimer* mPollTimer;
00100     QTimer* mRenewTimer;
00101     int mPollMode;
00102 };
00103 
00104 }
00105 
00106 #endif
KDE Logo
This file is part of the documentation for libkpimexchange Library Version 3.2.2.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Sat May 1 11:38:09 2004 by doxygen 1.2.15 written by Dimitri van Heesch, © 1997-2003