kitchensync

calendarsyncee.h

00001 /*
00002     This file is part of KitchenSync.
00003 
00004     Copyright (c) 2002 Cornelius Schumacher <schumacher@kde.org>
00005     Copyright (c) 2004 Holger Hans Peter Freyther <freyther@kde.org>
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., 51 Franklin Street, Fifth Floor,
00020     Boston, MA 02110-1301, USA.
00021 */
00022 #ifndef CALENDARSYNCEE_H
00023 #define CALENDARSYNCEE_H
00024 
00025 #include <libkcal/calendar.h>
00026 
00027 #include "syncee.h"
00028 
00029 namespace KSync {
00030 class CalendarMerger;
00031 class KDE_EXPORT CalendarSyncEntry : public SyncEntry
00032 {
00033   public:
00034     typedef QPtrList<CalendarSyncEntry> PtrList;
00035 
00036     CalendarSyncEntry( Syncee* parent );
00037     CalendarSyncEntry( KCal::Incidence *, Syncee *parent );
00038     CalendarSyncEntry( const CalendarSyncEntry& );
00039 
00040     QString name();
00041     QString id();
00042     QString timestamp();
00043 
00044     bool equals( SyncEntry *entry );
00045 
00046     CalendarSyncEntry *clone();
00047 
00048     KCal::Incidence *incidence()const;
00049     void setId(const QString &id);
00050 
00051     KPIM::DiffAlgo* diffAlgo( SyncEntry*, SyncEntry* );
00052 
00053   private:
00054     KCal::Incidence *mIncidence;
00055 };
00056 
00061 class KDE_EXPORT CalendarSyncee : public Syncee
00062 {
00063   public:
00064     CalendarSyncee( KCal::Calendar*, CalendarMerger* merger = 0);
00065     ~CalendarSyncee();
00066 
00067     void reset();
00068 
00069     CalendarSyncEntry *firstEntry();
00070     CalendarSyncEntry *nextEntry();
00071 
00072     void addEntry( SyncEntry * );
00073     void removeEntry( SyncEntry * );
00074 
00075 
00076     KCal::Calendar *calendar() const { return mCalendar; }
00077 
00078     bool writeBackup( const QString & );
00079     bool restoreBackup( const QString & );
00080 
00081     QString generateNewId() const;
00082 
00083   private:
00084     CalendarSyncEntry *createEntry( KCal::Incidence * );
00085 
00086     void clearEntries();
00087 
00088     KCal::Calendar *mCalendar;
00089     KCal::Event::List mEvents;
00090     KCal::Event::List::ConstIterator mCurrentEvent;
00091     KCal::Todo::List mTodos;
00092     KCal::Todo::List::ConstIterator mCurrentTodo;
00093     bool mIteratingEvents : 1;
00094 
00095     QMap<KCal::Incidence *,CalendarSyncEntry *> mEntries;
00096 };
00097 
00098 }
00099 
00100 #endif
KDE Home | KDE Accessibility Home | Description of Access Keys