--- kdepim-3.2.3/libkpimexchange/resources/calendar/resourceexchange.cpp-- 2004-07-05 09:58:03.284467182 +0200 +++ kdepim-3.2.3/libkpimexchange/resources/calendar/resourceexchange.cpp 2004-07-05 10:04:37.645067475 +0200 @@ -65,11 +65,10 @@ public: }; ResourceExchange::ResourceExchange( const KConfig *config ) - : ResourceCalendar( config ) + : ResourceCalendar( config ), mCache(0), mDates(0) { mLock = new KABC::LockNull( true ); - mCache = 0; mTimeZoneId = QString::fromLatin1( "UTC" ); kdDebug() << "Creating ResourceExchange" << endl; @@ -259,7 +258,10 @@ Event *ResourceExchange::event( const QS kdDebug(5800) << "ResourceExchange::event(): " << uid << endl; // FIXME: Look in exchange server for uid! - return mCache->event( uid ); + Event *event = 0; + if ( mCache ) + event = mCache->event( uid ); + return event; } void ResourceExchange::subscribeEvents( const QDate& start, const QDate& end ) @@ -318,28 +320,41 @@ void ResourceExchange::deleteTodo(Todo * Todo::List ResourceExchange::rawTodos() { - return mCache->rawTodos(); + Todo::List list; + if ( mCache ) + list = mCache->rawTodos(); + return list; } Todo *ResourceExchange::todo( const QString &uid ) { - return mCache->todo( uid ); + if ( !mCache ) + return 0; + else + return mCache->todo( uid ); } Todo::List ResourceExchange::todos( const QDate &date ) { - return mCache->todos( date ); + +return mCache->todos( date ); } Alarm::List ResourceExchange::alarmsTo( const QDateTime &to ) { - return mCache->alarmsTo( to ); + Alarm::List list; + if ( mCache ) + list = mCache->alarmsTo( to ); + return list; } Alarm::List ResourceExchange::alarms( const QDateTime &from, const QDateTime &to ) { kdDebug(5800) << "ResourceExchange::alarms(" << from.toString() << " - " << to.toString() << ")\n"; - return mCache->alarms( from, to ); + Alarm::List list; + if ( mCache ) + list = mCache->alarms( from, to ); + return list; } /****************************** PROTECTED METHODS ****************************/ @@ -378,7 +393,8 @@ Event::List ResourceExchange::rawEventsF // kdDebug() << "mDates: " << mDates << endl; // kdDebug() << "mDates->contains(qd) is " << mDates->contains( qd ) << endl; QDate start = QDate( qd.year(), qd.month(), 1 ); // First day of month - if ( !mDates->contains( start ) || (*mCacheDates)[start].secsTo( now ) > mCachedSeconds ) { + if ( mDates && ( !mDates->contains( start ) || + (*mCacheDates)[start].secsTo( now ) > mCachedSeconds ) ) { QDate end = start.addMonths( 1 ).addDays( -1 ); // Last day of month // Get events that occur in this period from the cache Event::List oldEvents = mCache->rawEvents( start, end, false ); @@ -395,9 +411,11 @@ Event::List ResourceExchange::rawEventsF } // Events are safely in the cache now, return them from cache - Event::List events = mCache->rawEventsForDate( qd, sorted ); - // kdDebug() << "Found " << events.count() << " events." << endl; - return events; + Event::List events; + if ( mCache ) + events = mCache->rawEventsForDate( qd, sorted ); + // kdDebug() << "Found " << events.count() << " events." << endl; + return events; /* if (!sorted) {