22 #include "stdcalendar.h"
24 #include <libkcal/resourcecalendar.h>
25 #include <libtdepim/kpimprefs.h>
27 #include <kstaticdeleter.h>
28 #include <tdeconfig.h>
29 #include <kstandarddirs.h>
30 #include <tdelocale.h>
35 static KStaticDeleter<StdCalendar> selfDeleter;
37 StdCalendar *StdCalendar::mSelf = 0;
39 StdCalendar *StdCalendar::self()
42 selfDeleter.setObject( mSelf,
new StdCalendar() );
47 StdCalendar::StdCalendar()
48 : CalendarResources( KPimPrefs::timezone() )
52 KCal::CalendarResourceManager *manager = resourceManager();
53 if ( manager->isEmpty() ) {
54 TDEConfig config(
"korganizerrc" );
55 config.setGroup(
"General" );
56 TQString fileName = config.readPathEntry(
"Active Calendar" );
58 TQString resourceName;
59 TQString resoruceType;
61 if ( !fileName.isEmpty() ) {
63 if ( url.isLocalFile() ) {
64 kdDebug(5850) <<
"Local resource at " << url << endl;
65 defaultResource = manager->createResource(
"file" );
66 if ( defaultResource )
67 defaultResource->
setValue(
"File", url.path() );
69 kdDebug(5850) <<
"Remote Resource at " << url << endl;
70 defaultResource = manager->createResource(
"remote" );
71 if ( defaultResource )
72 defaultResource->
setValue(
"URL", url.url() );
74 resourceName = i18n(
"Active Calendar" );
77 if ( !defaultResource ) {
78 fileName = locateLocal(
"data",
"korganizer/std.ics" );
79 kdDebug(5850) <<
"Creating new default local resource at " << fileName << endl;
80 defaultResource = manager->createResource(
"file" );
81 if ( defaultResource )
82 defaultResource->
setValue(
"File", fileName );
83 resourceName = i18n(
"Default Calendar" );
86 if ( defaultResource ) {
88 defaultResource->setResourceName( resourceName );
89 manager->add( defaultResource );
90 manager->setStandardResource( defaultResource );
96 kdDebug(5850) <<
"Adding Birthdays resource" << endl;
98 bdayResource->setResourceName( i18n(
"Birthdays") );
99 manager->add( bdayResource );
101 kdDebug(5850) <<
"Unable to add a Birthdays resource" << endl;
106 StdCalendar::~StdCalendar()
virtual bool setValue(const TQString &key, const TQString &value)
virtual void setTimeZoneId(const TQString &timeZoneId)=0