24 #include "stdcalendar.h"
26 #include <libkcal/resourcecalendar.h>
27 #include <libtdepim/kpimprefs.h>
29 #include <tdeconfig.h>
30 #include <kstandarddirs.h>
31 #include <tdelocale.h>
36 StdCalendar::StdCalendar(
const TQString &fileName,
const TQString &resName )
37 : CalendarResources( KPimPrefs::timezone() )
39 mManager = resourceManager();
40 if ( mManager->isEmpty() ) {
41 addFileResource( fileName, resName );
43 CalendarResourceManager::ActiveIterator it;
44 for ( it = mManager->activeBegin(); it != mManager->activeEnd(); ++it ) {
50 StdCalendar::StdCalendar()
51 : CalendarResources( KPimPrefs::timezone() )
55 mManager = resourceManager();
56 if ( mManager->isEmpty() ) {
57 TDEConfig config(
"korganizerrc" );
58 config.setGroup(
"General" );
59 TQString fileName = config.readPathEntry(
"Active Calendar" );
61 if ( !fileName.isEmpty() ) {
62 addFileResource( fileName, i18n(
"Active Calendar" ) );
66 addFileResource( locateLocal(
"data",
"korganizer/std.ics" ),
67 i18n(
"Default Calendar" ) );
72 void StdCalendar::addFileResource(
const TQString &fileName,
73 const TQString &resName )
75 KCal::ResourceCalendar *resource = 0;
77 if ( !fileName.isEmpty() ) {
79 if ( url.isLocalFile() ) {
80 kdDebug() <<
"Local resource at " << url << endl;
81 resource = mManager->createResource(
"file" );
83 resource->setValue(
"File", url.path() );
85 kdDebug() <<
"Remote Resource at " << url << endl;
86 resource = mManager->createResource(
"remote" );
88 resource->setValue(
"URL", url.url() );
92 resource->setTimeZoneId( KPimPrefs::timezone() );
93 resource->setResourceName( resName );
94 mManager->add( resource );
95 mManager->setStandardResource( resource );
100 StdCalendar::~StdCalendar()