libkcal Library API Documentation

resourceimap.h

00001  /*
00002     This file is part of libkcal.
00003 
00004     Copyright (c) 2003 Steffen Hansen <steffen@klaralvdalens-datakonsult.se>
00005     Copyright (c) 2003 - 2004 Bo Thorsen <bo@klaralvdalens-datakonsult.se>
00006 
00007     This library is free software; you can redistribute it and/or
00008     modify it under the terms of the GNU Library General Public
00009     License as published by the Free Software Foundation; either
00010     version 2 of the License, or (at your option) any later version.
00011 
00012     This library is distributed in the hope that it will be useful,
00013     but WITHOUT ANY WARRANTY; without even the implied warranty of
00014     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00015     Library General Public License for more details.
00016 
00017     You should have received a copy of the GNU Library General Public License
00018     along with this library; see the file COPYING.LIB.  If not, write to
00019     the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
00020     Boston, MA 02111-1307, USA.
00021 */
00022 #ifndef KCAL_RESOURCEIMAP_H
00023 #define KCAL_RESOURCEIMAP_H
00024 
00025 #include <qptrlist.h>
00026 #include <qstring.h>
00027 #include <qdatetime.h>
00028 
00029 #include <dcopobject.h>
00030 #include <kconfig.h>
00031 
00032 #include <libkcal/incidence.h>
00033 #include <libkcal/icalformat.h>
00034 #include <libkcal/calendarlocal.h>
00035 
00036 #include "resourcecalendar.h"
00037 
00038 class DCOPClient;
00039 class KMailICalIface_stub;
00040 
00041 namespace KCal {
00042 
00046 class ResourceIMAP : public ResourceCalendar, public IncidenceBase::Observer,
00047                      virtual public DCOPObject
00048 {
00049   Q_OBJECT
00050   K_DCOP
00051 
00052   k_dcop:
00053     virtual bool addIncidence( const QString& type, const QString& ical );
00054     virtual void deleteIncidence( const QString& type, const QString& uid );
00055     virtual void slotRefresh( const QString& type );
00056 
00057   public:
00058     ResourceIMAP( const KConfig * );
00059     virtual ~ResourceIMAP();
00060 
00061     virtual void writeConfig( KConfig* config );
00062 
00063     bool load();
00064 
00065     bool save();
00066 
00067     KABC::Lock *lock();
00068 
00070     bool addEvent(Event *anEvent);
00072     void deleteEvent(Event *);
00073 
00077     Event *event(const QString &UniqueStr);
00081 //    Event::List events();
00085     Event::List rawEvents();
00090     Event::List rawEventsForDate( const QDate &date, bool sorted = false );
00094     Event::List rawEventsForDate( const QDateTime &qdt );
00099     Event::List rawEvents( const QDate &start, const QDate &end,
00100                                bool inclusive = false );
00101 
00102     /*
00103       Returns a QString with the text of the holiday (if any) that falls
00104       on the specified date.
00105     */
00106     // QString getHolidayForDate(const QDate &qd);
00107     
00111     bool addTodo( Todo *todo );
00115     void deleteTodo( Todo * );
00120     Todo *todo( const QString &uid );
00124     Todo::List rawTodos();
00128     Todo::List todos( const QDate &date );
00130     virtual bool addJournal(Journal *);
00134     void deleteJournal( Journal * );
00136     virtual Journal *journal(const QDate &);
00138     virtual Journal *journal(const QString &UID);
00140     Journal::List journals();
00141 
00143     Alarm::List alarms( const QDateTime &from, const QDateTime &to );
00144 
00146     Alarm::List alarmsTo( const QDateTime &to );
00147 
00148     
00152     void update(IncidenceBase *incidence);
00153  
00154     friend class ResourceIMAPConfig;
00155 
00156     // Public because needed in MultiCalendar::load()
00157     bool doOpen();
00158 
00159 
00160     void setTimeZoneId( const QString& tzid );
00161   
00162   protected:
00164     virtual void incidenceUpdated( IncidenceBase *i ) { update( i ); }
00167   protected slots:
00168     void unregisteredFromDCOP( const QCString& );
00169 
00170   private:
00171     void init();
00172     bool getIncidenceList( QStringList& lst, const QString& type );
00173     bool connectKMailSignal( const QCString&, const QCString& ) const;
00174 
00175     bool loadAllEvents();
00176     bool loadAllTasks();
00177     bool loadAllJournals();
00178 
00179     bool connectToKMail() const;
00180 
00181     KCal::Incidence* parseIncidence( const QString& str );
00182 
00183     QString mServer;
00184     ICalFormat mFormat;
00185     CalendarLocal mCalendar;
00186     DCOPClient* mDCOPClient;
00187     bool mSilent;
00188     QString mCurrentUID;
00189 
00190     mutable KMailICalIface_stub* mKMailIcalIfaceStub;
00191 };  
00192 
00193 }
00194 
00195 #endif
KDE Logo
This file is part of the documentation for libkcal Library Version 3.2.2.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Sat May 1 11:36:23 2004 by doxygen 1.2.15 written by Dimitri van Heesch, © 1997-2003