You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
254 lines
8.6 KiB
254 lines
8.6 KiB
15 years ago
|
/*
|
||
|
This file is part of libkpimexchange.
|
||
|
Copyright (c) 2002 Jan-Pascal van Best <janpascal@vanbest.org>
|
||
|
|
||
|
This library is free software; you can redistribute it and/or modify it
|
||
|
under the terms of the GNU Library General Public License as published by
|
||
|
the Free Software Foundation; either version 2 of the License, or (at your
|
||
|
option) any later version.
|
||
|
|
||
|
This library is distributed in the hope that it will be useful, but WITHOUT
|
||
|
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||
|
FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
|
||
|
License for more details.
|
||
|
|
||
|
You should have received a copy of the GNU Library General Public License
|
||
|
along with this library; see the file COPYING.LIB. If not, write to the
|
||
|
Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||
|
02110-1301, USA.
|
||
|
*/
|
||
|
#ifndef KPIM_EXCHANGECALENDAR_H
|
||
|
#define KPIM_EXCHANGECALENDAR_H
|
||
|
|
||
15 years ago
|
#include <tqmap.h>
|
||
|
#include <tqdict.h>
|
||
|
#include <tqintdict.h>
|
||
15 years ago
|
|
||
|
#include <libkcal/calendar.h>
|
||
|
#include <libkcal/calendarlocal.h>
|
||
|
#include <libkcal/resourcecalendar.h>
|
||
|
|
||
|
#include "exchangemonitor.h"
|
||
|
|
||
|
class DateSet;
|
||
|
|
||
|
namespace KPIM {
|
||
|
class ExchangeAccount;
|
||
|
class ExchangeClient;
|
||
|
}
|
||
|
|
||
|
namespace KCal {
|
||
|
class Event;
|
||
|
class CalFormat;
|
||
|
|
||
|
/**
|
||
|
This class provides a calendar stored on a Microsoft Exchange 2000 server
|
||
|
*/
|
||
|
// FIXME: Use ResourceCached
|
||
|
class ResourceExchange : public ResourceCalendar, public IncidenceBase::Observer
|
||
|
{
|
||
|
Q_OBJECT
|
||
13 years ago
|
|
||
15 years ago
|
|
||
|
public:
|
||
12 years ago
|
ResourceExchange( const TDEConfig * );
|
||
15 years ago
|
virtual ~ResourceExchange();
|
||
|
|
||
12 years ago
|
virtual void writeConfig( TDEConfig* config );
|
||
15 years ago
|
|
||
|
KABC::Lock *lock();
|
||
|
|
||
|
/** constructs a new calendar, with variables initialized to sane values. */
|
||
|
// ExchangeCalendar( KPIM::ExchangeAccount* account );
|
||
|
/** constructs a new calendar, with variables initialized to sane values. */
|
||
15 years ago
|
// ExchangeCalendar( KPIM::ExchangeAccount* account, const TQString &timeZoneId );
|
||
15 years ago
|
// virtual ~ExchangeCalendar();
|
||
|
|
||
|
/**
|
||
|
Semantics not yet defined. Should the Exchange calendar be wiped clean?
|
||
|
Should the disk calendar be copied to the Exchange calendar?
|
||
|
At the moment, does nothing.
|
||
|
@return true, if successful, false on error.
|
||
|
@param fileName the name of the calendar on disk.
|
||
|
*/
|
||
15 years ago
|
// bool load( const TQString &fileName );
|
||
15 years ago
|
/**
|
||
|
Writes out the calendar to disk in the specified \a format.
|
||
|
ExchangeCalendar takes ownership of the CalFormat object.
|
||
|
@return true, if successful, false on error.
|
||
|
@param fileName the name of the file
|
||
|
*/
|
||
15 years ago
|
// bool save( const TQString &fileName, CalFormat *format = 0 );
|
||
15 years ago
|
|
||
|
/** clears out the current calendar, freeing all used memory etc. etc. */
|
||
|
// void close();
|
||
|
|
||
|
/** Add Event to calendar. */
|
||
14 years ago
|
KDE_DEPRECATED bool addEvent( Event *event );
|
||
|
bool addEvent( Event *event, const TQString &subresource );
|
||
|
|
||
15 years ago
|
/** deletes an event from this calendar. */
|
||
|
bool deleteEvent(Event *);
|
||
|
|
||
|
// Isn't called anymore.
|
||
|
void changeIncidence( Incidence * );
|
||
|
|
||
|
/**
|
||
|
Retrieves an event on the basis of the unique string ID.
|
||
|
*/
|
||
15 years ago
|
Event *event(const TQString &UniqueStr);
|
||
15 years ago
|
/**
|
||
|
Return filtered list of all events in calendar.
|
||
|
*/
|
||
|
// Event::List events();
|
||
|
/**
|
||
|
Return unfiltered list of all events in calendar.
|
||
|
Use with care, since this causes a LOT of network activity
|
||
|
*/
|
||
|
Event::List rawEvents();
|
||
|
|
||
15 years ago
|
virtual void subscribeEvents( const TQDate& start, const TQDate& end );
|
||
15 years ago
|
|
||
|
/**
|
||
|
Stop receiving event signals for the given period (inclusive). After this call,
|
||
|
the calendar resource will no longer send eventsAdded, eventsModified or
|
||
|
eventsDeleted signals for events falling completely in this period. The resource
|
||
|
MAY delete the Events objects. The application MUST NOT dereference pointers
|
||
|
to the relevant Events after this call.
|
||
|
*/
|
||
15 years ago
|
virtual void unsubscribeEvents( const TQDate& start, const TQDate& end );
|
||
15 years ago
|
|
||
|
/**
|
||
|
Add a todo to the todolist.
|
||
|
*/
|
||
14 years ago
|
KDE_DEPRECATED bool addTodo( Todo *todo );
|
||
|
bool addTodo( Todo *todo, const TQString &subresource );
|
||
15 years ago
|
/**
|
||
|
Remove a todo from the todolist.
|
||
|
*/
|
||
|
bool deleteTodo( Todo * );
|
||
|
/**
|
||
|
Searches todolist for an event with this unique string identifier,
|
||
|
returns a pointer or null.
|
||
|
*/
|
||
15 years ago
|
Todo *todo( const TQString &uid );
|
||
15 years ago
|
/**
|
||
|
Return list of all todos.
|
||
|
*/
|
||
|
Todo::List rawTodos( TodoSortField sortField = TodoSortUnsorted, SortDirection sortDirection = SortDirectionAscending );
|
||
|
/**
|
||
|
Returns list of todos due on the specified date.
|
||
|
*/
|
||
15 years ago
|
Todo::List rawTodosForDate( const TQDate &date );
|
||
15 years ago
|
|
||
|
/** Add a Journal entry to calendar */
|
||
14 years ago
|
KDE_DEPRECATED bool addJournal( Journal *journal );
|
||
|
bool addJournal( Journal *journal, const TQString &subresource );
|
||
15 years ago
|
/** deletes an event from this calendar. */
|
||
|
virtual bool deleteJournal(Journal *);
|
||
|
/** Return Journals for given date */
|
||
15 years ago
|
virtual Journal::List journals(const TQDate &);
|
||
15 years ago
|
/** Return Journal with given UID */
|
||
15 years ago
|
virtual Journal *journal(const TQString &UID);
|
||
15 years ago
|
/** Return list of all Journals stored in calendar */
|
||
|
Journal::List rawJournals( JournalSortField sortField = JournalSortUnsorted, SortDirection sortDirection = SortDirectionAscending );
|
||
|
/** Return journals for the given date. */
|
||
15 years ago
|
Journal::List rawJournalsForDate( const TQDate & );
|
||
15 years ago
|
|
||
|
/** Return all alarms, which ocur in the given time interval. */
|
||
15 years ago
|
Alarm::List alarms( const TQDateTime &from, const TQDateTime &to );
|
||
15 years ago
|
|
||
|
/** Return all alarms, which ocur before given date. */
|
||
15 years ago
|
Alarm::List alarmsTo( const TQDateTime &to );
|
||
15 years ago
|
|
||
|
friend class ResourceExchangeConfig;
|
||
|
|
||
|
protected:
|
||
|
/**
|
||
|
Prepare the calendar for use. Load the calendar from disk,
|
||
|
open connections to the calendaring server, whatever.
|
||
|
Must be called before other methods can be called.
|
||
|
*/
|
||
|
virtual bool doOpen();
|
||
|
|
||
|
/** clears out the current calendar, freeing all used memory etc. etc. */
|
||
|
virtual void doClose();
|
||
|
|
||
|
virtual bool doLoad();
|
||
|
virtual bool doSave();
|
||
|
|
||
|
public:
|
||
|
/**
|
||
|
Builds and then returns a list of all events that match for the
|
||
|
date specified. useful for dayView, etc. etc.
|
||
|
*/
|
||
|
Event::List rawEventsForDate(
|
||
15 years ago
|
const TQDate &date,
|
||
15 years ago
|
EventSortField sortField=EventSortUnsorted,
|
||
|
SortDirection sortDirection=SortDirectionAscending );
|
||
|
|
||
|
/**
|
||
|
Get unfiltered events for date \a qdt.
|
||
|
*/
|
||
15 years ago
|
Event::List rawEventsForDate( const TQDateTime &qdt );
|
||
15 years ago
|
/**
|
||
|
Get unfiltered events in a range of dates. If inclusive is set to true,
|
||
|
only events are returned, which are completely included in the range.
|
||
|
*/
|
||
15 years ago
|
Event::List rawEvents( const TQDate &start, const TQDate &end,
|
||
15 years ago
|
bool inclusive = false );
|
||
|
/**
|
||
|
Get unfiltered events in sorted order.
|
||
|
*/
|
||
|
Event::List rawEvents( EventSortField sortField = EventSortUnsorted, SortDirection sortDirection = SortDirectionAscending );
|
||
|
|
||
|
protected:
|
||
|
/** Notification function of IncidenceBase::Observer. */
|
||
|
void incidenceUpdated( IncidenceBase *i );
|
||
|
|
||
|
/** inserts an event into its "proper place" in the calendar. */
|
||
|
// void insertEvent(const Event *anEvent);
|
||
|
|
||
|
/** Append alarms of incidence in interval to list of alarms. */
|
||
|
// void appendAlarms( Alarm::List &alarms, Incidence *incidence,
|
||
15 years ago
|
// const TQDateTime &from, const TQDateTime &to );
|
||
15 years ago
|
|
||
|
/** Append alarms of recurring events in interval to list of alarms. */
|
||
|
// void appendRecurringAlarms( Alarm::List &alarms, Incidence *incidence,
|
||
15 years ago
|
// const TQDateTime &from, const TQDateTime &to );
|
||
15 years ago
|
|
||
|
bool uploadEvent( Event *event );
|
||
|
|
||
15 years ago
|
void setTimeZoneId( const TQString &tzid );
|
||
15 years ago
|
|
||
|
protected slots:
|
||
15 years ago
|
void slotMonitorNotify( const TQValueList<long>& IDs, const TQValueList<KURL>& urls);
|
||
|
void slotMonitorError( int errorCode, const TQString& moreInfo );
|
||
|
void slotDownloadFinished( int result, const TQString& moreinfo );
|
||
15 years ago
|
void downloadedEvent( KCal::Event*, const KURL& );
|
||
|
|
||
|
private:
|
||
|
class EventInfo;
|
||
|
KPIM::ExchangeAccount* mAccount;
|
||
|
KPIM::ExchangeClient* mClient;
|
||
|
KPIM::ExchangeMonitor* mMonitor;
|
||
|
CalendarLocal* mCache;
|
||
15 years ago
|
TQDict<EventInfo> mEventDict; // maps UIDS to EventInfo records
|
||
|
TQIntDict<EventInfo> mWatchDict; // maps Watch IDs to EventInfo records
|
||
15 years ago
|
DateSet* mDates;
|
||
15 years ago
|
TQMap<Event, TQDateTime>* mEventDates;
|
||
|
TQMap<TQDate, TQDateTime>* mCacheDates;
|
||
15 years ago
|
int mCachedSeconds;
|
||
|
bool mAutoMailbox;
|
||
15 years ago
|
TQString mTimeZoneId;
|
||
15 years ago
|
|
||
|
KABC::Lock *mLock;
|
||
|
|
||
|
// FIXME: Remove variable, use ResourceCached::changedIncidences() instead.
|
||
|
Incidence::List mChangedIncidences;
|
||
|
};
|
||
|
|
||
|
}
|
||
|
|
||
|
#endif
|