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
@@ -371,6 +371,8 @@ 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
@@ -312,6 +312,7 @@ public:
virtual void setAlarmEnabled( int id, bool enable ) = 0;
virtual void setReadOnly( int id, bool enable ) = 0;
virtual void setDefaultCalendarEnabledOnly() = 0;
+ virtual void setCalendarRemove( int id ) = 0;
signals:
void calendarChanged();
void calendarSaved();
diff --git a/libkcal/calendarlocal.cpp b/libkcal/calendarlocal.cpp
index e48122a..749d9f6 100644
--- a/libkcal/calendarlocal.cpp
+++ b/libkcal/calendarlocal.cpp
@@ -85,15 +85,31 @@ void CalendarLocal::addCalendar( Calendar* cal )
QPtrList<Event> EventList = cal->rawEvents();
Event * ev = EventList.first();
while ( ev ) {
+ ev->unRegisterObserver( cal );
+ ev->registerObserver( this );
mEventList.append( ev );
ev = EventList.next();
}
}
{
+
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();
}
}
@@ -101,10 +117,13 @@ void CalendarLocal::addCalendar( Calendar* cal )
QPtrList<Journal> JournalList = cal->journals();
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 )
{
@@ -781,6 +800,42 @@ QPtrList<Journal> CalendarLocal::journals()
if ( it->calEnabled() ) el.append( it );
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 )
{
@@ -818,6 +873,7 @@ void CalendarLocal::setAlarmEnabled( int id, bool enable )
for ( Todo *it = mTodoList.first(); it; it = mTodoList.next() )
if ( it->calID() == id ) it->setAlarmEnabled( enable );
+ reInitAlarmSettings();
}
void CalendarLocal::setDefaultCalendarEnabledOnly()
diff --git a/libkcal/calendarlocal.h b/libkcal/calendarlocal.h
index 65f6aa7..5bbe55f 100644
--- a/libkcal/calendarlocal.h
+++ b/libkcal/calendarlocal.h
@@ -185,6 +185,7 @@ public slots:
void setAlarmEnabled( int id, bool enable );
void setReadOnly( int id, bool enable );
void setDefaultCalendarEnabledOnly();
+ void setCalendarRemove( int id );
protected: