summaryrefslogtreecommitdiffabout
authorzautrix <zautrix>2005-06-13 13:57:22 (UTC)
committer zautrix <zautrix>2005-06-13 13:57:22 (UTC)
commit56de219c5ce910a470a01a0e5003d1a113837ef4 (patch) (side-by-side diff)
tree3393cb306cec8dcdc05d6ed0fae3ae7d374f2794
parent4f3ff02932b39bf16b9692c3cb69c101a28b4616 (diff)
downloadkdepimpi-56de219c5ce910a470a01a0e5003d1a113837ef4.zip
kdepimpi-56de219c5ce910a470a01a0e5003d1a113837ef4.tar.gz
kdepimpi-56de219c5ce910a470a01a0e5003d1a113837ef4.tar.bz2
fixxx
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--bin/kdepim/korganizer/germantranslation.txt2
-rw-r--r--korganizer/calendarview.cpp8
-rw-r--r--korganizer/calendarview.h1
-rw-r--r--korganizer/koagendaitem.cpp6
-rw-r--r--korganizer/kofilterview.cpp4
-rw-r--r--korganizer/kofilterview.h1
-rw-r--r--korganizer/komonthview.cpp4
-rw-r--r--korganizer/kotodoview.cpp52
-rw-r--r--korganizer/kotodoviewitem.cpp2
-rw-r--r--korganizer/kowhatsnextview.cpp4
-rw-r--r--libkcal/alarm.cpp2
-rw-r--r--libkcal/calendar.cpp54
-rw-r--r--libkcal/calendar.h1
-rw-r--r--libkcal/calendarlocal.cpp56
-rw-r--r--libkcal/calendarlocal.h1
15 files changed, 137 insertions, 61 deletions
diff --git a/bin/kdepim/korganizer/germantranslation.txt b/bin/kdepim/korganizer/germantranslation.txt
index acf17b2..8651a49 100644
--- a/bin/kdepim/korganizer/germantranslation.txt
+++ b/bin/kdepim/korganizer/germantranslation.txt
@@ -1377,13 +1377,13 @@
{ "One (or more) selected\ntodo has subtodos!\nDo you want to select\nall subtodos of all\nselected todos as well?","Ein (oder mehrere) ausgewähltes\nTodo hat Untertodos!\nMöchten Sie der Auswahlliste\nalle Untertodos von allen\nausgewählten Todos hinzufügen?" },
{ "Print List View...","Drucke Listenansicht..." },
{ "You can make a printout of the <b>List View</b> and the list view in the <b>Search Dialog</b>! To do this, please go to the <b>List View/Search Dialog</b>. Right click on the list. Select in the popup menu the entry <b>Print complete list</b>. That prints the list as you see it. You can remove items from the list before printing without deleting the corresponding event/todo! Simply select all items you do not want to print out. Then right click on one of the items and choose <b>Hide selected items</b>. After that you can print the list without these items.","Sie können die <b>Listenansicht</b> und die Listenansicht im <b>Suchdialog</b> ausdrucken! Um das zu machen gehen Sie bitte zur <b>Listenansicht</b> oder zum <b>Suchdialog</b>. Rechtsklicken Sie auf die Liste. Wählen Sie im Popupmenu den Eintrag <b>Drucke komplette Liste</b>. Das druckt die Liste so, wie man sie sieht. Sie können Listeneinträge entfernen ohne die korrespondierenden Ereignisse/Todos zu löschen! Selektieren sie einfach alle Einträge, die sie nicht ausdrucken möchten. Dann Rechtsklicken Sie auf einen Eintrag und wählen <b>Verstecke Selektierte</b>. Danach können Sie die Liste ohne diese Einträge ausdrucken." },
{ "Configure KO/Pi...","Konfiguriere KO/Pi..." },
{ "Global Settings...","Globale Einstellungen..." },
{ "<p><b>R</b>: Toggle Resource View |<b>F</b>: Edit filter </p>\n","<p><b>R</b>: Zeige Resource Ansicht | <b>F</b>: Editiere Filter </p>\n" },
-{ "","" },
+{ "(disabled)","(abgeschaltet)" },
{ "","" },
{ "","" },
{ "","" },
{ "","" },
{ "","" },
{ "","" },
diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp
index 07ec459..6e60c56 100644
--- a/korganizer/calendarview.cpp
+++ b/korganizer/calendarview.cpp
@@ -460,12 +460,15 @@ void CalendarView::init()
mFilterView = new KOFilterView(&mFilters,mLeftFrame,"CalendarView::FilterView");
mCalEditView = new KOCalEditView(mLeftFrame,"CalendarView::CaleditView");
connect( mCalEditView, SIGNAL( calendarEnabled (int,bool) ),mCalendar, SLOT( setCalendarEnabled(int,bool)) );
connect( mCalEditView, SIGNAL( alarmEnabled(int,bool) ),mCalendar, SLOT( setAlarmEnabled(int,bool)) );
connect( mCalEditView, SIGNAL( calendarReadonly(int,bool) ),mCalendar, SLOT( setReadOnly(int,bool)) );
connect( mCalEditView, SIGNAL( setCalendarDefault(int) ),mCalendar, SLOT( setDefaultCalendar(int)) );
+ connect( mCalEditView, SIGNAL( removeCalendar(int) ),mCalendar, SLOT( setCalendarRemove(int)) );
+ connect( mCalEditView, SIGNAL( calendarAdded(int) ),this, SLOT( addCalendarId(int)) );
+ connect( mCalEditView, SIGNAL( needsUpdate() ),this, SLOT( updateView()) );
mTodoList->setNavigator( mNavigator );
#if 0
if ( QApplication::desktop()->width() < 480 ) {
leftFrameLayout->addWidget(mFilterView);
leftFrameLayout->addWidget(mTodoList, 2 );
@@ -1866,12 +1869,17 @@ bool CalendarView::restoreCalendarSettings()
mCalendar->setReadOnly( cal->mCalNumber, cal->isReadOnly );
if ( cal->isStandard )
mCalendar->setDefaultCalendar( cal->mCalNumber );
cal = calendars.next();
}
}
+void CalendarView::addCalendarId( int id )
+{
+ KopiCalendarFile * cal = KOPrefs::instance()->getCalendar( id );
+ addCalendar( cal );
+}
bool CalendarView::addCalendar( KopiCalendarFile * cal )
{
if ( mCalendar->addCalendarFile( cal->mFileName, cal->mCalNumber ))
return true;
qDebug("KO: Error adding calendar file %1 ",cal->mFileName.latin1() );
diff --git a/korganizer/calendarview.h b/korganizer/calendarview.h
index 0144ba4..ec5b7ab 100644
--- a/korganizer/calendarview.h
+++ b/korganizer/calendarview.h
@@ -224,12 +224,13 @@ class CalendarView : public KOrg::CalendarViewBase, public KCal::Calendar::Obser
*/
bool openCalendar(QString filename, bool merge=false);
bool loadCalendars();
bool saveCalendars();
bool restoreCalendarSettings();
bool addCalendar( KopiCalendarFile * );
+ void addCalendarId( int id );
bool syncCalendar(QString filename,int mode = 0 );
/**
Save calendar data to file. Return true if calendar could be
successfully saved.
*/
diff --git a/korganizer/koagendaitem.cpp b/korganizer/koagendaitem.cpp
index 5a3c4d2..c7bc6eb 100644
--- a/korganizer/koagendaitem.cpp
+++ b/korganizer/koagendaitem.cpp
@@ -118,18 +118,18 @@ void KOAgendaItem::init ( Incidence *incidence, QDate qd )
QStringList categories = mIncidence->categories();
QString cat = categories.first();
if (cat.isEmpty()) {
if ( (incidence->typeID() == todoID ) &&((static_cast<Todo*>(incidence))->isCompleted()) )
mBackgroundColor =KOPrefs::instance()->mTodoDoneColor;
else
- mBackgroundColor =KOPrefs::instance()->mEventColor;
+ mBackgroundColor =KOPrefs::instance()->defaultColor( incidence->calID() );
} else {
mBackgroundColor = *KOPrefs::instance()->categoryColor(cat);
if ( (incidence->typeID() == todoID ) &&((static_cast<Todo*>(incidence))->isCompleted()) ) {
if ( mBackgroundColor == KOPrefs::instance()->mEventColor )
- mBackgroundColor =KOPrefs::instance()->mTodoDoneColor;
+ mBackgroundColor = KOPrefs::instance()->mTodoDoneColor;
}
}
}
mColorGroup = QColorGroup( mBackgroundColor.light(),
mBackgroundColor.dark(),mBackgroundColor.light(),
@@ -198,13 +198,13 @@ bool KOAgendaItem::updateIcons(QPainter * p, bool horLayout)
p->drawLine( xpos, ypos+AGENDA_ICON_SIZE-1, xpos+AGENDA_ICON_SIZE-1, ypos );
if ( horLayout )
++xOff;
else
++yOff;
}
- if (mIncidence->isAlarmEnabled()) {
+ if (mIncidence->isAlarmEnabled() && mIncidence->alarmEnabled()) {
p->fillRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x, yOff*( 1 +AGENDA_ICON_SIZE)+y, AGENDA_ICON_SIZE, AGENDA_ICON_SIZE, red );
if ( horLayout )
++xOff;
else
++yOff;
}
diff --git a/korganizer/kofilterview.cpp b/korganizer/kofilterview.cpp
index 29a4393..2b16347 100644
--- a/korganizer/kofilterview.cpp
+++ b/korganizer/kofilterview.cpp
@@ -155,12 +155,13 @@ KOCalEditView::~KOCalEditView()
// no need to delete child widgets, Qt does it all for us
}
void KOCalEditView::selectCal(int id ,bool b)
{
KOPrefs::instance()->getCalendar( id )->isEnabled = b;
emit calendarEnabled ( id, b );
+ emit needsUpdate();
}
void KOCalEditView::selectStdCal( int id, bool b )
{
if ( !b ) {
@@ -196,22 +197,25 @@ void KOCalEditView::selectStdCal( int id, bool b )
}
void KOCalEditView::selectCalAlarm(int id ,bool b )
{
KOPrefs::instance()->getCalendar( id )->isAlarmEnabled = b;
emit alarmEnabled ( id , b );
+ emit needsUpdate();
}
void KOCalEditView::selectReadOnly(int id ,bool b )
{
KOPrefs::instance()->getCalendar( id )->isReadOnly = b;
emit calendarReadonly ( id , b );
+ emit needsUpdate();
}
void KOCalEditView::setColor( const QColor& c, int id )
{
KOPrefs::instance()->getCalendar( id )->mDefaultColor = c;
+ emit needsUpdate();
}
void KOCalEditView::deleteCal( int id )
{
KopiCalendarFile * kkf = KOPrefs::instance()->getCalendar( id );
QString name = kkf->mName;
QString file = kkf->mFileName;
diff --git a/korganizer/kofilterview.h b/korganizer/kofilterview.h
index aaf0eb6..4a0cd8a 100644
--- a/korganizer/kofilterview.h
+++ b/korganizer/kofilterview.h
@@ -135,12 +135,13 @@ class KOCalEditView : public QWidget
void alarmEnabled ( int cal, bool enable );
void calendarEnabled ( int cal, bool enable );
void calendarReadonly ( int cal, bool readonly );
void setCalendarDefault ( int cal );
void removeCalendar ( int cal );
void calendarAdded( int );
+ void needsUpdate();
private:
QVBoxLayout* ml;
QWidget *mw;
void toggleList ( QPtrList<KOCalCheckButton> );
QPtrList<KOCalCheckButton> mStdandardB;
diff --git a/korganizer/komonthview.cpp b/korganizer/komonthview.cpp
index c868270..96f2502 100644
--- a/korganizer/komonthview.cpp
+++ b/korganizer/komonthview.cpp
@@ -745,13 +745,13 @@ int MonthViewCell::insertEvent(Event *event)
} else {
pal = mStandardPalette ;
}
item->setPalette( pal );
item->setRecur( event->recurrence()->doesRecur() );
- item->setAlarm( event->isAlarmEnabled() && multiday < 2 );
+ item->setAlarm( event->isAlarmEnabled() && multiday < 2 && event->alarmEnabled() );
item->setMoreInfo( event->description().length() > 0 );
#ifdef DESKTOP_VERSION
Attendee *me = event->attendeeByMails(KOPrefs::instance()->mAdditionalMails,
KOPrefs::instance()->email());
if ( me != 0 ) {
if ( me->status() == Attendee::NeedsAction && me->RSVP())
@@ -826,13 +826,13 @@ void MonthViewCell::insertTodo(Todo *todo)
} else {
pal = mStandardPalette ;
}
item->setPalette( pal );
item->setRecur( todo->recurrence()->doesRecur() );
- item->setAlarm( todo->isAlarmEnabled() );
+ item->setAlarm( todo->isAlarmEnabled() && todo->alarmEnabled() );
item->setMoreInfo( todo->description().length() > 0 );
insertItem( item , count());
#ifdef DESKTOP_VERSION
mToolTip.append( text );
#endif
}
diff --git a/korganizer/kotodoview.cpp b/korganizer/kotodoview.cpp
index 2602487..35c2a9f 100644
--- a/korganizer/kotodoview.cpp
+++ b/korganizer/kotodoview.cpp
@@ -698,16 +698,16 @@ void KOTodoView::updateView()
Todo *todo;
todo = todoList.first();// todo; todo = todoList.next()) {
while ( todo ) {
bool next = true;
// qDebug("todo %s ", todo->summary().latin1());
Incidence *incidence = todo->relatedTo();
- while ( incidence ) {
+ while ( incidence ) {
if ( incidence->typeID() == todoID ) {
//qDebug("related %s ",incidence->summary().latin1() );
- if ( !(todoList.contains ( ((Todo* )incidence ) ) )) {
+ if ( !(todoList.contains ( ((Todo* )incidence ) ) ) && incidence->calEnabled() ) {
//qDebug("related not found ");
todoList.remove( );
todo = todoList.current();
next = false;
incidence = 0;
@@ -833,40 +833,42 @@ void KOTodoView::restoreItemState( QListViewItem *item )
item = item->nextSibling();
}
}
QMap<Todo *,KOTodoViewItem *>::ConstIterator
- KOTodoView::insertTodoItem(Todo *todo)
+KOTodoView::insertTodoItem(Todo *todo)
{
-// kdDebug() << "KOTodoView::insertTodoItem(): " << todo->getSummary() << endl;
- // TODO: Check, if dynmaic cast is necessary
+ // kdDebug() << "KOTodoView::insertTodoItem(): " << todo->getSummary() << endl;
+ // TODO: Check, if dynmaic cast is necessary
pendingSubtodo = 0;
- Incidence *incidence = todo->relatedTo();
- if (incidence && incidence->typeID() == todoID ) {
- Todo *relatedTodo = static_cast<Todo *>(incidence);
-
-// kdDebug() << " has Related" << endl;
- QMap<Todo *,KOTodoViewItem *>::ConstIterator itemIterator;
- itemIterator = mTodoMap.find(relatedTodo);
- if (itemIterator == mTodoMap.end()) {
-// kdDebug() << " related not yet in list" << endl;
- itemIterator = insertTodoItem (relatedTodo);
+ Incidence *incidence = todo->relatedTo();
+ while ( incidence && !incidence->calEnabled() )
+ incidence = incidence->relatedTo();
+ if (incidence && incidence->typeID() == todoID ) {
+ Todo *relatedTodo = static_cast<Todo *>(incidence);
+
+ // kdDebug() << " has Related" << endl;
+ QMap<Todo *,KOTodoViewItem *>::ConstIterator itemIterator;
+ itemIterator = mTodoMap.find(relatedTodo);
+ if (itemIterator == mTodoMap.end()) {
+ // kdDebug() << " related not yet in list" << endl;
+ itemIterator = insertTodoItem (relatedTodo);
+ }
+ // isn't this pretty stupid? We give one Todo to the KOTodoViewItem
+ // and one into the map. Sure finding is more easy but why? -zecke
+ KOTodoViewItem *todoItem = new KOTodoViewItem(*itemIterator,todo,this);
+ return mTodoMap.insert(todo,todoItem);
+ } else {
+ // kdDebug() << " no Related" << endl;
+ // see above -zecke
+ KOTodoViewItem *todoItem = new KOTodoViewItem(mTodoListView,todo,this);
+ return mTodoMap.insert(todo,todoItem);
}
- // isn't this pretty stupid? We give one Todo to the KOTodoViewItem
- // and one into the map. Sure finding is more easy but why? -zecke
- KOTodoViewItem *todoItem = new KOTodoViewItem(*itemIterator,todo,this);
- return mTodoMap.insert(todo,todoItem);
- } else {
-// kdDebug() << " no Related" << endl;
- // see above -zecke
- KOTodoViewItem *todoItem = new KOTodoViewItem(mTodoListView,todo,this);
- return mTodoMap.insert(todo,todoItem);
- }
}
void KOTodoView::updateConfig()
{
updateView();
diff --git a/korganizer/kotodoviewitem.cpp b/korganizer/kotodoviewitem.cpp
index 8cb6b83..f987b63 100644
--- a/korganizer/kotodoviewitem.cpp
+++ b/korganizer/kotodoviewitem.cpp
@@ -192,13 +192,13 @@ void KOTodoViewItem::setMyPixmap()
pPix.fill( Qt::darkGreen );
p.begin( &pixi );
p. drawPixmap ( 0, pixSize, pPix);
p.end();
pixSize += size;
}
- if ( mTodo->isAlarmEnabled() ) {
+ if ( mTodo->isAlarmEnabled() && mTodo->alarmEnabled()) {
pixi.resize(size, pixSize+size);
pPix.fill( Qt::red );
p.begin( &pixi );
p. drawPixmap ( 0, pixSize, pPix);
p.end();
pixSize += size;
diff --git a/korganizer/kowhatsnextview.cpp b/korganizer/kowhatsnextview.cpp
index e8574a0..221debc 100644
--- a/korganizer/kowhatsnextview.cpp
+++ b/korganizer/kowhatsnextview.cpp
@@ -592,13 +592,13 @@ bool KOWhatsNextView::appendEvent(Incidence *ev, bool reply, bool notRed, bool a
bool needClose = false;
if ( ev->cancelled() ) {
tempText += "<font color=\"#F00000\">[c";
needClose =true;
}
- if ( ev->isAlarmEnabled() ) {
+ if ( ev->isAlarmEnabled() && ev->alarmEnabled()) {
if ( !needClose)
tempText +="[";
tempText += "a";
needClose =true;
}
@@ -666,13 +666,13 @@ bool KOWhatsNextView::appendTodo(Incidence *ev, QString ind , bool isSub )
bool needClose = false;
if ( ev->cancelled() ) {
mText += "<font color=\"#F00000\">[c";
needClose =true;
}
- if ( ev->isAlarmEnabled() ) {
+ if ( ev->isAlarmEnabled() && ev->alarmEnabled() ) {
if ( !needClose)
mText +="[";
mText += "a";
needClose =true;
}
diff --git a/libkcal/alarm.cpp b/libkcal/alarm.cpp
index 0afa0a7..79e0464 100644
--- a/libkcal/alarm.cpp
+++ b/libkcal/alarm.cpp
@@ -368,12 +368,14 @@ QString Alarm::offsetText()
if ( min > 0 ) {
if ( !message.isEmpty() ) message += "/";
message += i18n("%1min").arg( min );
}
if ( message.isEmpty() )
message = i18n("%1min").arg( 0 );
+ if ( !mParent->alarmEnabled() )
+ return "!"+message + i18n("(disabled)");
return message;
}
QDateTime Alarm::time() const
{
diff --git a/libkcal/calendar.cpp b/libkcal/calendar.cpp
index 5092d1a..a662eeb 100644
--- a/libkcal/calendar.cpp
+++ b/libkcal/calendar.cpp
@@ -427,39 +427,39 @@ void Calendar::setupRelations( Incidence *incidence )
}
// If a task with subtasks is deleted, move it's subtasks to the orphans list
void Calendar::removeRelations( Incidence *incidence )
{
// qDebug("Calendar::removeRelations ");
- QString uid = incidence->uid();
-
- QPtrList<Incidence> relations = incidence->relations();
- for( Incidence* i = relations.first(); i; i = relations.next() )
- if( !mOrphanUids.find( i->uid() ) ) {
- mOrphans.insert( uid, i );
- mOrphanUids.insert( i->uid(), i );
- i->setRelatedTo( 0 );
- i->setRelatedToUid( uid );
- }
-
- // If this incidence is related to something else, tell that about it
- if( incidence->relatedTo() )
- incidence->relatedTo()->removeRelation( incidence );
-
- // Remove this one from the orphans list
- if( mOrphanUids.remove( uid ) )
- // This incidence is located in the orphans list - it should be removed
- if( !( incidence->relatedTo() != 0 && mOrphans.remove( incidence->relatedTo()->uid() ) ) ) {
- // Removing wasn't that easy
- for( QDictIterator<Incidence> it( mOrphans ); it.current(); ++it ) {
- if( it.current()->uid() == uid ) {
- mOrphans.remove( it.currentKey() );
- break;
- }
- }
- }
+ QString uid = incidence->uid();
+
+ QPtrList<Incidence> relations = incidence->relations();
+ for( Incidence* i = relations.first(); i; i = relations.next() )
+ if( !mOrphanUids.find( i->uid() ) ) {
+ mOrphans.insert( uid, i );
+ mOrphanUids.insert( i->uid(), i );
+ i->setRelatedTo( 0 );
+ i->setRelatedToUid( uid );
+ }
+
+ // If this incidence is related to something else, tell that about it
+ if( incidence->relatedTo() )
+ incidence->relatedTo()->removeRelation( incidence );
+
+ // Remove this one from the orphans list
+ if( mOrphanUids.remove( uid ) )
+ // This incidence is located in the orphans list - it should be removed
+ if( !( incidence->relatedTo() != 0 && mOrphans.remove( incidence->relatedTo()->uid() ) ) ) {
+ // Removing wasn't that easy
+ for( QDictIterator<Incidence> it( mOrphans ); it.current(); ++it ) {
+ if( it.current()->uid() == uid ) {
+ mOrphans.remove( it.currentKey() );
+ break;
+ }
+ }
+ }
}
void Calendar::registerObserver( Observer *observer )
{
mObserver = observer;
mNewObserver = true;
diff --git a/libkcal/calendar.h b/libkcal/calendar.h
index 73f82bb..2243e28 100644
--- a/libkcal/calendar.h
+++ b/libkcal/calendar.h
@@ -309,12 +309,13 @@ public:
public slots:
void setDefaultCalendar( int );
virtual void setCalendarEnabled( int id, bool enable ) = 0;
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();
void calendarLoaded();
void addAlarm(const QDateTime &qdt, const QString &noti );
void removeAlarm(const QDateTime &qdt, const QString &noti );
diff --git a/libkcal/calendarlocal.cpp b/libkcal/calendarlocal.cpp
index e48122a..749d9f6 100644
--- a/libkcal/calendarlocal.cpp
+++ b/libkcal/calendarlocal.cpp
@@ -82,32 +82,51 @@ void CalendarLocal::addCalendar( Calendar* cal )
{
cal->setDontDeleteIncidencesOnClose();
{
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();
}
}
{
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 )
{
FileStorage storage( this, fileName );
return storage.load();
}
@@ -778,12 +797,48 @@ QPtrList<Journal> CalendarLocal::journals()
{
QPtrList<Journal> el;
for ( Journal *it = mJournalList.first(); it; it = mJournalList.next() )
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 )
{
for ( Journal *it = mJournalList.first(); it; it = mJournalList.next() )
if ( it->calID() == id ) it->setCalEnabled( enable );
@@ -815,12 +870,13 @@ void CalendarLocal::setAlarmEnabled( int id, bool enable )
for ( Event *it = mEventList.first(); it; it = mEventList.next() )
if ( it->calID() == id ) it->setAlarmEnabled( enable );
for ( Todo *it = mTodoList.first(); it; it = mTodoList.next() )
if ( it->calID() == id ) it->setAlarmEnabled( enable );
+ reInitAlarmSettings();
}
void CalendarLocal::setDefaultCalendarEnabledOnly()
{
for ( Journal *it = mJournalList.first(); it; it = mJournalList.next() )
it->setCalEnabled( it->calID() == mDefaultCalendar );
diff --git a/libkcal/calendarlocal.h b/libkcal/calendarlocal.h
index 65f6aa7..5bbe55f 100644
--- a/libkcal/calendarlocal.h
+++ b/libkcal/calendarlocal.h
@@ -182,12 +182,13 @@ class CalendarLocal : public Calendar
public slots:
void setCalendarEnabled( int id, bool enable );
void setAlarmEnabled( int id, bool enable );
void setReadOnly( int id, bool enable );
void setDefaultCalendarEnabledOnly();
+ void setCalendarRemove( int id );
protected:
// Event* mNextAlarmEvent;
QString mNextSummary;
QString mNextAlarmEventDateTimeString;