summaryrefslogtreecommitdiffabout
path: root/libkcal/calendarlocal.cpp
Side-by-side diff
Diffstat (limited to 'libkcal/calendarlocal.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--libkcal/calendarlocal.cpp56
1 files changed, 54 insertions, 2 deletions
diff --git a/libkcal/calendarlocal.cpp b/libkcal/calendarlocal.cpp
index c5500bf..e48122a 100644
--- a/libkcal/calendarlocal.cpp
+++ b/libkcal/calendarlocal.cpp
@@ -62,15 +62,53 @@ void CalendarLocal::init()
mNextAlarmIncidence = 0;
}
CalendarLocal::~CalendarLocal()
{
- close();
+ if ( mDeleteIncidencesOnClose )
+ close();
+}
+bool CalendarLocal::addCalendarFile( QString name, int id )
+{
+ CalendarLocal calendar( timeZoneId() );
+ calendar.setDefaultCalendar( id );
+ if ( calendar.load( name ) ) {
+ addCalendar( &calendar );
+ return true;
+ }
+ return false;
+}
+void CalendarLocal::addCalendar( Calendar* cal )
+{
+ cal->setDontDeleteIncidencesOnClose();
+ {
+ QPtrList<Event> EventList = cal->rawEvents();
+ Event * ev = EventList.first();
+ while ( ev ) {
+ mEventList.append( ev );
+ ev = EventList.next();
+ }
+ }
+ {
+ QPtrList<Todo> TodoList = cal->rawTodos();
+ Todo * ev = TodoList.first();
+ while ( ev ) {
+ mTodoList.append( ev );
+ ev = TodoList.next();
+ }
+ }
+ {
+ QPtrList<Journal> JournalList = cal->journals();
+ Journal * ev = JournalList.first();
+ while ( ev ) {
+ mJournalList.append( ev );
+ ev = JournalList.next();
+ }
+ }
}
-
bool CalendarLocal::load( const QString &fileName )
{
FileStorage storage( this, fileName );
return storage.load();
}
@@ -753,12 +791,26 @@ void CalendarLocal::setCalendarEnabled( int id, bool enable )
if ( it->calID() == id ) it->setCalEnabled( enable );
for ( Todo *it = mTodoList.first(); it; it = mTodoList.next() )
if ( it->calID() == id ) it->setCalEnabled( enable );
}
+
+void CalendarLocal::setReadOnly( int id, bool enable )
+{
+ for ( Journal *it = mJournalList.first(); it; it = mJournalList.next() )
+ if ( it->calID() == id ) it->setReadOnly( enable );
+
+ for ( Event *it = mEventList.first(); it; it = mEventList.next() )
+ if ( it->calID() == id ) it->setReadOnly( enable );
+
+ for ( Todo *it = mTodoList.first(); it; it = mTodoList.next() )
+ if ( it->calID() == id ) it->setReadOnly( enable );
+
+}
+
void CalendarLocal::setAlarmEnabled( int id, bool enable )
{
for ( Journal *it = mJournalList.first(); it; it = mJournalList.next() )
if ( it->calID() == id ) it->setAlarmEnabled( enable );
for ( Event *it = mEventList.first(); it; it = mEventList.next() )