24 #include <K3StaticDeleter>
25 #include <KConfigGroup>
26 #include <KStandardDirs>
27 #include <KSystemTimeZone>
44 StdCalendar::StdCalendar()
45 : CalendarResources( KSystemTimeZones::local() )
49 KCal::CalendarResourceManager *manager = resourceManager();
50 if ( manager->isEmpty() ) {
51 KConfig _config(
"korganizerrc" );
52 KConfigGroup config(&_config,
"General" );
53 QString fileName = config.readPathEntry(
"Active Calendar", QString() );
57 KCal::ResourceCalendar *defaultResource = 0;
58 if ( !fileName.isEmpty() ) {
60 if ( url.isLocalFile() ) {
61 kDebug() <<
"Local resource at" << url;
62 defaultResource = manager->createResource(
"file" );
63 if ( defaultResource ) {
64 defaultResource->setValue(
"File", url.toLocalFile() );
67 kDebug() <<
"Remote Resource at" << url;
68 defaultResource = manager->createResource(
"remote" );
69 if ( defaultResource ) {
70 defaultResource->setValue(
"URL", url.url() );
73 resourceName = i18n(
"Active Calendar" );
76 if ( !defaultResource ) {
77 fileName = KStandardDirs::locateLocal(
"data",
"korganizer/std.ics" );
78 kDebug() <<
"Creating new default local resource at" << fileName;
79 defaultResource = manager->createResource(
"file" );
80 if ( defaultResource ) {
81 defaultResource->setValue(
"File", fileName );
83 resourceName = i18n(
"Default Calendar" );
86 if ( defaultResource ) {
87 defaultResource->setTimeSpec( KSystemTimeZones::local() );
88 defaultResource->setResourceName( resourceName );
89 manager->add( defaultResource );
90 manager->setStandardResource( defaultResource );
94 KCal::ResourceCalendar *bdayResource = manager->createResource(
"birthdays" );
96 kDebug() <<
"Adding Birthdays resource";
97 bdayResource->setTimeSpec( KSystemTimeZones::local() );
98 bdayResource->setResourceName( i18n(
"Birthdays" ) );
99 manager->add( bdayResource );
101 kDebug() <<
"Unable to add a Birthdays calendar";
static StdCalendar * self()
static K3StaticDeleter< StdCalendar > selfDeleter