summaryrefslogtreecommitdiffabout
path: root/libkcal
Side-by-side diff
Diffstat (limited to 'libkcal') (more/less context) (show whitespace changes)
-rw-r--r--libkcal/alarm.cpp2
-rw-r--r--libkcal/calendar.cpp0
-rw-r--r--libkcal/calendar.h1
-rw-r--r--libkcal/calendarlocal.cpp56
-rw-r--r--libkcal/calendarlocal.h1
5 files changed, 60 insertions, 0 deletions
diff --git a/libkcal/alarm.cpp b/libkcal/alarm.cpp
index 0afa0a7..79e0464 100644
--- a/libkcal/alarm.cpp
+++ b/libkcal/alarm.cpp
@@ -372,4 +372,6 @@ QString Alarm::offsetText()
if ( message.isEmpty() )
message = i18n("%1min").arg( 0 );
+ if ( !mParent->alarmEnabled() )
+ return "!"+message + i18n("(disabled)");
return message;
}
diff --git a/libkcal/calendar.cpp b/libkcal/calendar.cpp
index 5092d1a..a662eeb 100644
--- a/libkcal/calendar.cpp
+++ b/libkcal/calendar.cpp
diff --git a/libkcal/calendar.h b/libkcal/calendar.h
index 73f82bb..2243e28 100644
--- a/libkcal/calendar.h
+++ b/libkcal/calendar.h
@@ -313,4 +313,5 @@ public:
virtual void setReadOnly( int id, bool enable ) = 0;
virtual void setDefaultCalendarEnabledOnly() = 0;
+ virtual void setCalendarRemove( int id ) = 0;
signals:
void calendarChanged();
diff --git a/libkcal/calendarlocal.cpp b/libkcal/calendarlocal.cpp
index e48122a..749d9f6 100644
--- a/libkcal/calendarlocal.cpp
+++ b/libkcal/calendarlocal.cpp
@@ -86,4 +86,6 @@ void CalendarLocal::addCalendar( Calendar* cal )
Event * ev = EventList.first();
while ( ev ) {
+ ev->unRegisterObserver( cal );
+ ev->registerObserver( this );
mEventList.append( ev );
ev = EventList.next();
@@ -91,8 +93,22 @@ void CalendarLocal::addCalendar( Calendar* cal )
}
{
+
QPtrList<Todo> TodoList = cal->rawTodos();
Todo * ev = TodoList.first();
while ( ev ) {
+ QString rel = ev->relatedToUid();
+ if ( !rel.isEmpty() ){
+ ev->setRelatedTo ( 0 );
+ ev->setRelatedToUid( rel );
+ }
+ ev = TodoList.next();
+ }
+ //TodoList = cal->rawTodos();
+ ev = TodoList.first();
+ while ( ev ) {
+ ev->unRegisterObserver( cal );
+ ev->registerObserver( this );
mTodoList.append( ev );
+ setupRelations( ev );
ev = TodoList.next();
}
@@ -102,8 +118,11 @@ void CalendarLocal::addCalendar( Calendar* cal )
Journal * ev = JournalList.first();
while ( ev ) {
+ ev->unRegisterObserver( cal );
+ ev->registerObserver( this );
mJournalList.append( ev );
ev = JournalList.next();
}
}
+ setModified( true );
}
bool CalendarLocal::load( const QString &fileName )
@@ -782,4 +801,40 @@ QPtrList<Journal> CalendarLocal::journals()
return el;
}
+void CalendarLocal::setCalendarRemove( int id )
+{
+
+ {
+ QPtrList<Event> EventList = mEventList;
+ Event * ev = EventList.first();
+ while ( ev ) {
+ if ( ev->calID() == id )
+ deleteEvent( ev );
+ ev = EventList.next();
+ }
+ }
+ {
+
+ QPtrList<Todo> TodoList = mTodoList;
+ Todo * ev = TodoList.first();
+ while ( ev ) {
+ if ( ev->calID() == id )
+ deleteTodo( ev );
+ ev = TodoList.next();
+ }
+ }
+ {
+ QPtrList<Journal> JournalList = mJournalList;
+ Journal * ev = JournalList.first();
+ while ( ev ) {
+ if ( ev->calID() == id )
+ deleteJournal( ev );
+ ev = JournalList.next();
+ }
+ }
+
+ if ( mUndoIncidence ) delete mUndoIncidence;
+ mUndoIncidence = 0;
+
+}
void CalendarLocal::setCalendarEnabled( int id, bool enable )
@@ -819,4 +874,5 @@ void CalendarLocal::setAlarmEnabled( int id, bool enable )
for ( Todo *it = mTodoList.first(); it; it = mTodoList.next() )
if ( it->calID() == id ) it->setAlarmEnabled( enable );
+ reInitAlarmSettings();
}
diff --git a/libkcal/calendarlocal.h b/libkcal/calendarlocal.h
index 65f6aa7..5bbe55f 100644
--- a/libkcal/calendarlocal.h
+++ b/libkcal/calendarlocal.h
@@ -186,4 +186,5 @@ public slots:
void setReadOnly( int id, bool enable );
void setDefaultCalendarEnabledOnly();
+ void setCalendarRemove( int id );
protected: