summaryrefslogtreecommitdiffabout
Unidiff
Diffstat (more/less context) (show 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.cpp4
-rw-r--r--korganizer/kofilterview.cpp4
-rw-r--r--korganizer/kofilterview.h1
-rw-r--r--korganizer/komonthview.cpp4
-rw-r--r--korganizer/kotodoview.cpp4
-rw-r--r--korganizer/kotodoviewitem.cpp2
-rw-r--r--korganizer/kowhatsnextview.cpp4
-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
15 files changed, 85 insertions, 9 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
@@ -1335,56 +1335,56 @@
1335{ "Start/Stop todo...","Starte/Stoppe Todo..." }, 1335{ "Start/Stop todo...","Starte/Stoppe Todo..." },
1336{ "Color for running todos:","Farbe für laufende Todos:" }, 1336{ "Color for running todos:","Farbe für laufende Todos:" },
1337{ "The todo\n%1\nis started.\nDo you want to set\nthe state to stopped?","Das Todo\n%1\nist gestartet.\nWollen Sie es\nauf gestoppt setzen?" }, 1337{ "The todo\n%1\nis started.\nDo you want to set\nthe state to stopped?","Das Todo\n%1\nist gestartet.\nWollen Sie es\nauf gestoppt setzen?" },
1338{ "Todo is started","Todo ist gestartet" }, 1338{ "Todo is started","Todo ist gestartet" },
1339{ "Stop todo","Stoppe Todo" }, 1339{ "Stop todo","Stoppe Todo" },
1340{ "Todo is stopped","Todo ist gestoppt" }, 1340{ "Todo is stopped","Todo ist gestoppt" },
1341{ "Start todo","Starte Todo" }, 1341{ "Start todo","Starte Todo" },
1342{ "The todo\n%1\nis stopped.\nDo you want to set\nthe state to started?","Das Todo\n%1\nist gestoppt.\nWollen Sie es auf\ngestartet setzen?" }, 1342{ "The todo\n%1\nis stopped.\nDo you want to set\nthe state to started?","Das Todo\n%1\nist gestoppt.\nWollen Sie es auf\ngestartet setzen?" },
1343{ "The todo\n%1\nwill be cloned!\nIt has subtodos!\nDo you want to clone\nall subtodos as well?","Das Todo\n%1\nwird geklont!\nEs hat Untertodos!\nMöchten Sie alle\nUntertodos auch klonen?" }, 1343{ "The todo\n%1\nwill be cloned!\nIt has subtodos!\nDo you want to clone\nall subtodos as well?","Das Todo\n%1\nwird geklont!\nEs hat Untertodos!\nMöchten Sie alle\nUntertodos auch klonen?" },
1344{ "Todo has subtodos","Todo hat Untertodos" }, 1344{ "Todo has subtodos","Todo hat Untertodos" },
1345{ "Block popup until mouse button release","Sperre Popup bis Mausknopf losgelassen" }, 1345{ "Block popup until mouse button release","Sperre Popup bis Mausknopf losgelassen" },
1346{ "Colors","Farben" }, 1346{ "Colors","Farben" },
1347{ "Click on new parent item","Klicke auf neues Übertodo" }, 1347{ "Click on new parent item","Klicke auf neues Übertodo" },
1348{ "Reparenting aborted!","Übertodo setzen abgebrochen" }, 1348{ "Reparenting aborted!","Übertodo setzen abgebrochen" },
1349{ "Cannot move Todo to itself\nor a child of itself","Kann nicht Todo auf\nsich selbst oder\nein Untertodo verschieben" }, 1349{ "Cannot move Todo to itself\nor a child of itself","Kann nicht Todo auf\nsich selbst oder\nein Untertodo verschieben" },
1350{ "Recursive reparenting not possible!","Rekursives Verschieben nicht möglich" }, 1350{ "Recursive reparenting not possible!","Rekursives Verschieben nicht möglich" },
1351{ "Delete all completed todos?\n(Completed recurring todos\nwill not be deleted!)","Entferne alle erledigten Todos?\n(Erledigte wiederholende Todos\nwerden nicht gelöscht!)" }, 1351{ "Delete all completed todos?\n(Completed recurring todos\nwill not be deleted!)","Entferne alle erledigten Todos?\n(Erledigte wiederholende Todos\nwerden nicht gelöscht!)" },
1352{ "Alternating background of list views","Abwechselnder Hintergrund für Listen" }, 1352{ "Alternating background of list views","Abwechselnder Hintergrund für Listen" },
1353{ "times","Zeiten" }, 1353{ "times","Zeiten" },
1354{ "The todo\n%1\nhas subtodos!\nDo you want to set\nthe categories for\nall subtodos as well?","Das Todo\n%1\nhat Untertodos!\nMöchten Sie die Kategorien\nauch für alle Untertodos setzen?" }, 1354{ "The todo\n%1\nhas subtodos!\nDo you want to set\nthe categories for\nall subtodos as well?","Das Todo\n%1\nhat Untertodos!\nMöchten Sie die Kategorien\nauch für alle Untertodos setzen?" },
1355{ "Backup enabled","Backup angeschaltet" }, 1355{ "Backup enabled","Backup angeschaltet" },
1356{ "Use standard backup dir","Standard Backupverzeichnis" }, 1356{ "Use standard backup dir","Standard Backupverzeichnis" },
1357{ "Number of Backups:","Anzahl der Backups" }, 1357{ "Number of Backups:","Anzahl der Backups" },
1358{ "Make backup every ","Mache ein Backup alle " }, 1358{ "Make backup every ","Mache ein Backup alle " },
1359{ " days"," Tage" }, 1359{ " days"," Tage" },
1360{ "Creating backup ... please wait ...","Erzeuge Backup ... bitte warten ..." }, 1360{ "Creating backup ... please wait ...","Erzeuge Backup ... bitte warten ..." },
1361{ "Backup Failed!","Backup Problem!" }, 1361{ "Backup Failed!","Backup Problem!" },
1362{ "Try again now","Versuche jetzt nochmal" }, 1362{ "Try again now","Versuche jetzt nochmal" },
1363{ "Try again later","Versuche später nochmal" }, 1363{ "Try again later","Versuche später nochmal" },
1364{ "Try again tomorrow","Versuche morgen nochmal" }, 1364{ "Try again tomorrow","Versuche morgen nochmal" },
1365{ "Disable backup","Schalte Backup ab" }, 1365{ "Disable backup","Schalte Backup ab" },
1366{ "<b>Backup directory does not exist: </b>","<b>Backup Verzeichnis existiert nicht: </b>" }, 1366{ "<b>Backup directory does not exist: </b>","<b>Backup Verzeichnis existiert nicht: </b>" },
1367{ "<b>The backup copy command failed!</b>","<b>Das Backup Kopierkommando is fehlgeschlagen!</b>" }, 1367{ "<b>The backup copy command failed!</b>","<b>Das Backup Kopierkommando is fehlgeschlagen!</b>" },
1368{ "Choose action","Wähle Aktion" }, 1368{ "Choose action","Wähle Aktion" },
1369{ "Comment for todo:","Kommentar zum Todo:" }, 1369{ "Comment for todo:","Kommentar zum Todo:" },
1370{ "Stop+note","Stop+Notiz" }, 1370{ "Stop+note","Stop+Notiz" },
1371{ "Agenda view shows completed todos","Agenda Ansicht zeigt erledigte Todos" }, 1371{ "Agenda view shows completed todos","Agenda Ansicht zeigt erledigte Todos" },
1372{ "KO/Pi: Missing alarms!","KO/Pi: Verpasste Alarme!" }, 1372{ "KO/Pi: Missing alarms!","KO/Pi: Verpasste Alarme!" },
1373{ "You missed the alarms for the following events or todos:","Sie verpassten die Alarme für folgende Termine oder Todos:" }, 1373{ "You missed the alarms for the following events or todos:","Sie verpassten die Alarme für folgende Termine oder Todos:" },
1374{ "Print complete list","Drucke komplette Liste" }, 1374{ "Print complete list","Drucke komplette Liste" },
1375{ "Hide all selected","Verstecke Selektierte" }, 1375{ "Hide all selected","Verstecke Selektierte" },
1376{ "Add items","hinzufügen" }, 1376{ "Add items","hinzufügen" },
1377{ "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?" }, 1377{ "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?" },
1378{ "Print List View...","Drucke Listenansicht..." }, 1378{ "Print List View...","Drucke Listenansicht..." },
1379{ "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." }, 1379{ "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." },
1380{ "Configure KO/Pi...","Konfiguriere KO/Pi..." }, 1380{ "Configure KO/Pi...","Konfiguriere KO/Pi..." },
1381{ "Global Settings...","Globale Einstellungen..." }, 1381{ "Global Settings...","Globale Einstellungen..." },
1382{ "<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" }, 1382{ "<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" },
1383{ "","" }, 1383{ "(disabled)","(abgeschaltet)" },
1384{ "","" }, 1384{ "","" },
1385{ "","" }, 1385{ "","" },
1386{ "","" }, 1386{ "","" },
1387{ "","" }, 1387{ "","" },
1388{ "","" }, 1388{ "","" },
1389{ "","" }, 1389{ "","" },
1390{ "","" }, \ No newline at end of file 1390{ "","" }, \ No newline at end of file
diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp
index 07ec459..6e60c56 100644
--- a/korganizer/calendarview.cpp
+++ b/korganizer/calendarview.cpp
@@ -418,96 +418,99 @@ void CalendarView::init()
418 } 418 }
419#endif 419#endif
420 QWidget *rightBox = new QWidget( mPanner ); 420 QWidget *rightBox = new QWidget( mPanner );
421 QBoxLayout *rightLayout = new QVBoxLayout( rightBox ); 421 QBoxLayout *rightLayout = new QVBoxLayout( rightBox );
422 422
423 mRightFrame = new QWidgetStack( rightBox ); 423 mRightFrame = new QWidgetStack( rightBox );
424 rightLayout->addWidget( mRightFrame, 1 ); 424 rightLayout->addWidget( mRightFrame, 1 );
425 425
426 mLeftFrame = mLeftSplitter; 426 mLeftFrame = mLeftSplitter;
427#else 427#else
428 //QWidget *mainBox = new QWidget( this ); 428 //QWidget *mainBox = new QWidget( this );
429 //QWidget *leftFrame = new QWidget( mainBox ); 429 //QWidget *leftFrame = new QWidget( mainBox );
430 //QBoxLayout * mainBoxLayout; 430 //QBoxLayout * mainBoxLayout;
431 if ( KOPrefs::instance()->mVerticalScreen ) { 431 if ( KOPrefs::instance()->mVerticalScreen ) {
432 //mainBoxLayout = new QVBoxLayout(mainBox); 432 //mainBoxLayout = new QVBoxLayout(mainBox);
433 //leftFrameLayout = new QHBoxLayout(leftFrame ); 433 //leftFrameLayout = new QHBoxLayout(leftFrame );
434 mMainFrame = new KDGanttMinimizeSplitter( Qt::Vertical, this ); 434 mMainFrame = new KDGanttMinimizeSplitter( Qt::Vertical, this );
435 mMainFrame->setMinimizeDirection ( KDGanttMinimizeSplitter::Up ); 435 mMainFrame->setMinimizeDirection ( KDGanttMinimizeSplitter::Up );
436 mLeftFrame = new KDGanttMinimizeSplitter( Qt::Horizontal, mMainFrame);; 436 mLeftFrame = new KDGanttMinimizeSplitter( Qt::Horizontal, mMainFrame);;
437 mLeftFrame->setMinimizeDirection ( KDGanttMinimizeSplitter::Right ); 437 mLeftFrame->setMinimizeDirection ( KDGanttMinimizeSplitter::Right );
438 } else { 438 } else {
439 //mainBoxLayout = new QHBoxLayout(mainBox); 439 //mainBoxLayout = new QHBoxLayout(mainBox);
440 //leftFrameLayout = new QVBoxLayout(leftFrame ); 440 //leftFrameLayout = new QVBoxLayout(leftFrame );
441 mMainFrame = new KDGanttMinimizeSplitter( Qt::Horizontal, this); 441 mMainFrame = new KDGanttMinimizeSplitter( Qt::Horizontal, this);
442 mMainFrame->setMinimizeDirection ( KDGanttMinimizeSplitter::Left); 442 mMainFrame->setMinimizeDirection ( KDGanttMinimizeSplitter::Left);
443 mLeftFrame = new KDGanttMinimizeSplitter( Qt::Vertical, mMainFrame); 443 mLeftFrame = new KDGanttMinimizeSplitter( Qt::Vertical, mMainFrame);
444 mLeftFrame->setMinimizeDirection ( KDGanttMinimizeSplitter::Up ); 444 mLeftFrame->setMinimizeDirection ( KDGanttMinimizeSplitter::Up );
445 } 445 }
446 mMainFrame->setSizePolicy( QSizePolicy (QSizePolicy::Expanding,QSizePolicy::Expanding) ); 446 mMainFrame->setSizePolicy( QSizePolicy (QSizePolicy::Expanding,QSizePolicy::Expanding) );
447 //QBoxLayout * leftFrameLayout; 447 //QBoxLayout * leftFrameLayout;
448 topLayout->addWidget( mMainFrame ); 448 topLayout->addWidget( mMainFrame );
449 //mainBoxLayout->addWidget (mLeftFrame); 449 //mainBoxLayout->addWidget (mLeftFrame);
450 mDateNavigator = new DateNavigatorContainer( mLeftFrame, 450 mDateNavigator = new DateNavigatorContainer( mLeftFrame,
451 "CalendarView::DateNavigator" ); 451 "CalendarView::DateNavigator" );
452#if 0 452#if 0
453 // FIXME 453 // FIXME
454 mDateNavigator = new KDateNavigator(mLeftFrame, mCalendar, TRUE, 454 mDateNavigator = new KDateNavigator(mLeftFrame, mCalendar, TRUE,
455 "CalendarView::DateNavigator", QDate::currentDate()); 455 "CalendarView::DateNavigator", QDate::currentDate());
456#endif 456#endif
457 // mDateNavigator->blockSignals( true ); 457 // mDateNavigator->blockSignals( true );
458 //leftFrameLayout->addWidget( mDateNavigator ); 458 //leftFrameLayout->addWidget( mDateNavigator );
459 mTodoList = new KOTodoView(mCalendar, mLeftFrame, "todolistsmall"); 459 mTodoList = new KOTodoView(mCalendar, mLeftFrame, "todolistsmall");
460 mFilterView = new KOFilterView(&mFilters,mLeftFrame,"CalendarView::FilterView"); 460 mFilterView = new KOFilterView(&mFilters,mLeftFrame,"CalendarView::FilterView");
461 mCalEditView = new KOCalEditView(mLeftFrame,"CalendarView::CaleditView"); 461 mCalEditView = new KOCalEditView(mLeftFrame,"CalendarView::CaleditView");
462 connect( mCalEditView, SIGNAL( calendarEnabled (int,bool) ),mCalendar, SLOT( setCalendarEnabled(int,bool)) ); 462 connect( mCalEditView, SIGNAL( calendarEnabled (int,bool) ),mCalendar, SLOT( setCalendarEnabled(int,bool)) );
463 connect( mCalEditView, SIGNAL( alarmEnabled(int,bool) ),mCalendar, SLOT( setAlarmEnabled(int,bool)) ); 463 connect( mCalEditView, SIGNAL( alarmEnabled(int,bool) ),mCalendar, SLOT( setAlarmEnabled(int,bool)) );
464 connect( mCalEditView, SIGNAL( calendarReadonly(int,bool) ),mCalendar, SLOT( setReadOnly(int,bool)) ); 464 connect( mCalEditView, SIGNAL( calendarReadonly(int,bool) ),mCalendar, SLOT( setReadOnly(int,bool)) );
465 connect( mCalEditView, SIGNAL( setCalendarDefault(int) ),mCalendar, SLOT( setDefaultCalendar(int)) ); 465 connect( mCalEditView, SIGNAL( setCalendarDefault(int) ),mCalendar, SLOT( setDefaultCalendar(int)) );
466 connect( mCalEditView, SIGNAL( removeCalendar(int) ),mCalendar, SLOT( setCalendarRemove(int)) );
467 connect( mCalEditView, SIGNAL( calendarAdded(int) ),this, SLOT( addCalendarId(int)) );
468 connect( mCalEditView, SIGNAL( needsUpdate() ),this, SLOT( updateView()) );
466 mTodoList->setNavigator( mNavigator ); 469 mTodoList->setNavigator( mNavigator );
467#if 0 470#if 0
468 if ( QApplication::desktop()->width() < 480 ) { 471 if ( QApplication::desktop()->width() < 480 ) {
469 leftFrameLayout->addWidget(mFilterView); 472 leftFrameLayout->addWidget(mFilterView);
470 leftFrameLayout->addWidget(mTodoList, 2 ); 473 leftFrameLayout->addWidget(mTodoList, 2 );
471 474
472 } else { 475 } else {
473 leftFrameLayout->addWidget(mTodoList,2 ); 476 leftFrameLayout->addWidget(mTodoList,2 );
474 leftFrameLayout->addWidget(mFilterView ); 477 leftFrameLayout->addWidget(mFilterView );
475 } 478 }
476#endif 479#endif
477 mFilterView->hide(); 480 mFilterView->hide();
478 mCalEditView->hide(); 481 mCalEditView->hide();
479 QWidget *rightBox = new QWidget( mMainFrame ); 482 QWidget *rightBox = new QWidget( mMainFrame );
480 //mainBoxLayout->addWidget ( rightBox, 10 ); 483 //mainBoxLayout->addWidget ( rightBox, 10 );
481 QBoxLayout *rightLayout = new QVBoxLayout( rightBox ); 484 QBoxLayout *rightLayout = new QVBoxLayout( rightBox );
482 mRightFrame = new QWidgetStack( rightBox ); 485 mRightFrame = new QWidgetStack( rightBox );
483 rightLayout->addWidget( mRightFrame, 10 ); 486 rightLayout->addWidget( mRightFrame, 10 );
484 487
485 //mLeftFrame = (QWidget *)leftFrame; 488 //mLeftFrame = (QWidget *)leftFrame;
486 if ( KOPrefs::instance()->mVerticalScreen ) { 489 if ( KOPrefs::instance()->mVerticalScreen ) {
487 //mDateNavigator->setFixedHeight( mDateNavigator->sizeHint().height() ); 490 //mDateNavigator->setFixedHeight( mDateNavigator->sizeHint().height() );
488 //mDateNavigator->setMinimumWidth( mDateNavigator->sizeHint().width() ); 491 //mDateNavigator->setMinimumWidth( mDateNavigator->sizeHint().width() );
489 //mTodoList->setFixedHeight( mDateNavigator->sizeHint().height() ); 492 //mTodoList->setFixedHeight( mDateNavigator->sizeHint().height() );
490 //leftFrame->setFixedHeight( mDateNavigator->sizeHint().height() ); 493 //leftFrame->setFixedHeight( mDateNavigator->sizeHint().height() );
491 } else { 494 } else {
492 //mDateNavigator->setFixedWidth( mDateNavigator->sizeHint().width() ); 495 //mDateNavigator->setFixedWidth( mDateNavigator->sizeHint().width() );
493 //mTodoList->setFixedWidth( mDateNavigator->sizeHint().width() ); 496 //mTodoList->setFixedWidth( mDateNavigator->sizeHint().width() );
494 //leftFrame->setFixedWidth( mDateNavigator->sizeHint().width() ); 497 //leftFrame->setFixedWidth( mDateNavigator->sizeHint().width() );
495 } 498 }
496 if ( !KOPrefs::instance()->mShowDateNavigator) 499 if ( !KOPrefs::instance()->mShowDateNavigator)
497 mDateNavigator->hide(); 500 mDateNavigator->hide();
498 //qDebug("Calendarview Size %d %d ", width(), height()); 501 //qDebug("Calendarview Size %d %d ", width(), height());
499#endif 502#endif
500 503
501 connect( mNavigator, SIGNAL( datesSelected( const KCal::DateList & ) ), 504 connect( mNavigator, SIGNAL( datesSelected( const KCal::DateList & ) ),
502 SLOT( showDates( const KCal::DateList & ) ) ); 505 SLOT( showDates( const KCal::DateList & ) ) );
503 506
504 connect( mNavigator, SIGNAL( datesSelected( const KCal::DateList & ) ), 507 connect( mNavigator, SIGNAL( datesSelected( const KCal::DateList & ) ),
505 mDateNavigator, SLOT( selectDates( const KCal::DateList & ) ) ); 508 mDateNavigator, SLOT( selectDates( const KCal::DateList & ) ) );
506 509
507 510
508 511
509 connect( mDateNavigator, SIGNAL( showMonth( const QDate & ) ), 512 connect( mDateNavigator, SIGNAL( showMonth( const QDate & ) ),
510 mViewManager, SLOT( showMonth( const QDate & ) ) ); 513 mViewManager, SLOT( showMonth( const QDate & ) ) );
511 514
512 connect( mDateNavigator, SIGNAL( weekClicked( const QDate & ) ), 515 connect( mDateNavigator, SIGNAL( weekClicked( const QDate & ) ),
513 mNavigator, SLOT( selectWeek( const QDate & ) ) ); 516 mNavigator, SLOT( selectWeek( const QDate & ) ) );
@@ -1824,96 +1827,101 @@ bool CalendarView::importQtopia( const QString &categories,
1824 1827
1825 1828
1826#endif 1829#endif
1827 1830
1828} 1831}
1829 1832
1830void CalendarView::setSyncEventsReadOnly() 1833void CalendarView::setSyncEventsReadOnly()
1831{ 1834{
1832 Event * ev; 1835 Event * ev;
1833 QPtrList<Event> eL = mCalendar->rawEvents(); 1836 QPtrList<Event> eL = mCalendar->rawEvents();
1834 ev = eL.first(); 1837 ev = eL.first();
1835 while ( ev ) { 1838 while ( ev ) {
1836 if ( ev->uid().left(15) == QString("last-syncEvent-") ) 1839 if ( ev->uid().left(15) == QString("last-syncEvent-") )
1837 ev->setReadOnly( true ); 1840 ev->setReadOnly( true );
1838 ev = eL.next(); 1841 ev = eL.next();
1839 } 1842 }
1840} 1843}
1841 1844
1842bool CalendarView::loadCalendars() 1845bool CalendarView::loadCalendars()
1843{ 1846{
1844 QPtrList<KopiCalendarFile> calendars = KOPrefs::instance()->mCalendars; 1847 QPtrList<KopiCalendarFile> calendars = KOPrefs::instance()->mCalendars;
1845 KopiCalendarFile * cal = calendars.first(); 1848 KopiCalendarFile * cal = calendars.first();
1846 mCalendar->setDefaultCalendar( 1 ); 1849 mCalendar->setDefaultCalendar( 1 );
1847 openCalendar( MainWindow::defaultFileName(), false ); 1850 openCalendar( MainWindow::defaultFileName(), false );
1848 cal = calendars.next(); 1851 cal = calendars.next();
1849 while ( cal ) { 1852 while ( cal ) {
1850 addCalendar( cal ); 1853 addCalendar( cal );
1851 cal = calendars.next(); 1854 cal = calendars.next();
1852 } 1855 }
1853 restoreCalendarSettings(); 1856 restoreCalendarSettings();
1854 mCalendar->reInitAlarmSettings(); 1857 mCalendar->reInitAlarmSettings();
1855 setSyncEventsReadOnly(); 1858 setSyncEventsReadOnly();
1856 updateUnmanagedViews(); 1859 updateUnmanagedViews();
1857 updateView(); 1860 updateView();
1858} 1861}
1859bool CalendarView::restoreCalendarSettings() 1862bool CalendarView::restoreCalendarSettings()
1860{ 1863{
1861 QPtrList<KopiCalendarFile> calendars = KOPrefs::instance()->mCalendars; 1864 QPtrList<KopiCalendarFile> calendars = KOPrefs::instance()->mCalendars;
1862 KopiCalendarFile * cal = calendars.first(); 1865 KopiCalendarFile * cal = calendars.first();
1863 while ( cal ) { 1866 while ( cal ) {
1864 mCalendar->setCalendarEnabled( cal->mCalNumber,cal->isEnabled ); 1867 mCalendar->setCalendarEnabled( cal->mCalNumber,cal->isEnabled );
1865 mCalendar->setAlarmEnabled( cal->mCalNumber, cal->isAlarmEnabled ); 1868 mCalendar->setAlarmEnabled( cal->mCalNumber, cal->isAlarmEnabled );
1866 mCalendar->setReadOnly( cal->mCalNumber, cal->isReadOnly ); 1869 mCalendar->setReadOnly( cal->mCalNumber, cal->isReadOnly );
1867 if ( cal->isStandard ) 1870 if ( cal->isStandard )
1868 mCalendar->setDefaultCalendar( cal->mCalNumber ); 1871 mCalendar->setDefaultCalendar( cal->mCalNumber );
1869 cal = calendars.next(); 1872 cal = calendars.next();
1870 } 1873 }
1871} 1874}
1875void CalendarView::addCalendarId( int id )
1876{
1877 KopiCalendarFile * cal = KOPrefs::instance()->getCalendar( id );
1878 addCalendar( cal );
1879}
1872bool CalendarView::addCalendar( KopiCalendarFile * cal ) 1880bool CalendarView::addCalendar( KopiCalendarFile * cal )
1873{ 1881{
1874 1882
1875 if ( mCalendar->addCalendarFile( cal->mFileName, cal->mCalNumber )) 1883 if ( mCalendar->addCalendarFile( cal->mFileName, cal->mCalNumber ))
1876 return true; 1884 return true;
1877 qDebug("KO: Error adding calendar file %1 ",cal->mFileName.latin1() ); 1885 qDebug("KO: Error adding calendar file %1 ",cal->mFileName.latin1() );
1878 KMessageBox::error(this,i18n("Error loading calendar file\n%1.").arg(cal->mFileName)); 1886 KMessageBox::error(this,i18n("Error loading calendar file\n%1.").arg(cal->mFileName));
1879 return false; 1887 return false;
1880} 1888}
1881bool CalendarView::openCalendar(QString filename, bool merge) 1889bool CalendarView::openCalendar(QString filename, bool merge)
1882{ 1890{
1883 1891
1884 if (filename.isEmpty()) { 1892 if (filename.isEmpty()) {
1885 return false; 1893 return false;
1886 } 1894 }
1887 1895
1888 if (!QFile::exists(filename)) { 1896 if (!QFile::exists(filename)) {
1889 KMessageBox::error(this,i18n("File does not exist:\n '%1'.").arg(filename)); 1897 KMessageBox::error(this,i18n("File does not exist:\n '%1'.").arg(filename));
1890 return false; 1898 return false;
1891 } 1899 }
1892 1900
1893 globalFlagBlockAgenda = 1; 1901 globalFlagBlockAgenda = 1;
1894 clearAllViews(); 1902 clearAllViews();
1895 if (!merge) { 1903 if (!merge) {
1896 mViewManager->setDocumentId( filename ); 1904 mViewManager->setDocumentId( filename );
1897 mCalendar->close(); 1905 mCalendar->close();
1898 } 1906 }
1899 mStorage->setFileName( filename ); 1907 mStorage->setFileName( filename );
1900 1908
1901 if ( mStorage->load() ) { 1909 if ( mStorage->load() ) {
1902 if ( merge ) ;//setModified( true ); 1910 if ( merge ) ;//setModified( true );
1903 else { 1911 else {
1904 //setModified( true ); 1912 //setModified( true );
1905 mViewManager->setDocumentId( filename ); 1913 mViewManager->setDocumentId( filename );
1906 mDialogManager->setDocumentId( filename ); 1914 mDialogManager->setDocumentId( filename );
1907 mTodoList->setDocumentId( filename ); 1915 mTodoList->setDocumentId( filename );
1908 } 1916 }
1909 globalFlagBlockAgenda = 2; 1917 globalFlagBlockAgenda = 2;
1910 // if ( getLastSyncEvent() ) 1918 // if ( getLastSyncEvent() )
1911 // getLastSyncEvent()->setReadOnly( true ); 1919 // getLastSyncEvent()->setReadOnly( true );
1912 mCalendar->reInitAlarmSettings(); 1920 mCalendar->reInitAlarmSettings();
1913 setSyncEventsReadOnly(); 1921 setSyncEventsReadOnly();
1914 updateUnmanagedViews(); 1922 updateUnmanagedViews();
1915 updateView(); 1923 updateView();
1916 if ( filename != MainWindow::defaultFileName() ) { 1924 if ( filename != MainWindow::defaultFileName() ) {
1917 saveCalendar( MainWindow::defaultFileName() ); 1925 saveCalendar( MainWindow::defaultFileName() );
1918 } else { 1926 } else {
1919 QFileInfo finf ( MainWindow::defaultFileName()); 1927 QFileInfo finf ( MainWindow::defaultFileName());
diff --git a/korganizer/calendarview.h b/korganizer/calendarview.h
index 0144ba4..ec5b7ab 100644
--- a/korganizer/calendarview.h
+++ b/korganizer/calendarview.h
@@ -182,96 +182,97 @@ class CalendarView : public KOrg::CalendarViewBase, public KCal::Calendar::Obser
182 is possible or not. 182 is possible or not.
183 */ 183 */
184 void pasteEnabled(bool); 184 void pasteEnabled(bool);
185 185
186 /** Emitted, when the number of incoming messages has changed. */ 186 /** Emitted, when the number of incoming messages has changed. */
187 void numIncomingChanged(int); 187 void numIncomingChanged(int);
188 188
189 /** Emitted, when the number of outgoing messages has changed. */ 189 /** Emitted, when the number of outgoing messages has changed. */
190 void numOutgoingChanged(int); 190 void numOutgoingChanged(int);
191 191
192 /** Send status message, which can e.g. be displayed in the status bar. */ 192 /** Send status message, which can e.g. be displayed in the status bar. */
193 void statusMessage(const QString &); 193 void statusMessage(const QString &);
194 194
195 void calendarViewExpanded( bool ); 195 void calendarViewExpanded( bool );
196 void updateSearchDialog(); 196 void updateSearchDialog();
197 197
198 198
199 public slots: 199 public slots:
200 void checkAlarms(); 200 void checkAlarms();
201 void slotprintSelInc(); 201 void slotprintSelInc();
202 void showNextAlarms(); 202 void showNextAlarms();
203 void showOpenError(); 203 void showOpenError();
204 void watchSavedFile(); 204 void watchSavedFile();
205 void recheckTimerAlarm(); 205 void recheckTimerAlarm();
206 void checkNextTimerAlarm(); 206 void checkNextTimerAlarm();
207 void addAlarm(const QDateTime &qdt, const QString &noti ); 207 void addAlarm(const QDateTime &qdt, const QString &noti );
208 void addSuspendAlarm(const QDateTime &qdt, const QString &noti ); 208 void addSuspendAlarm(const QDateTime &qdt, const QString &noti );
209 void removeAlarm(const QDateTime &qdt, const QString &noti ); 209 void removeAlarm(const QDateTime &qdt, const QString &noti );
210 210
211 /** options dialog made a changed to the configuration. we catch this 211 /** options dialog made a changed to the configuration. we catch this
212 * and notify all widgets which need to update their configuration. */ 212 * and notify all widgets which need to update their configuration. */
213 void updateConfig(); 213 void updateConfig();
214 214
215 void insertBirthdays(const QString& uid, const QStringList& birthdayList, 215 void insertBirthdays(const QString& uid, const QStringList& birthdayList,
216 const QStringList& anniversaryList, const QStringList& realNameList, 216 const QStringList& anniversaryList, const QStringList& realNameList,
217 const QStringList& emailList, const QStringList& assembledNameList, 217 const QStringList& emailList, const QStringList& assembledNameList,
218 const QStringList& uidList); 218 const QStringList& uidList);
219 219
220 /** 220 /**
221 Load calendar from file \a filename. If \a merge is true, load 221 Load calendar from file \a filename. If \a merge is true, load
222 calendar into existing one, if it is false, clear calendar, before 222 calendar into existing one, if it is false, clear calendar, before
223 loading. Return true, if calendar could be successfully loaded. 223 loading. Return true, if calendar could be successfully loaded.
224 */ 224 */
225 bool openCalendar(QString filename, bool merge=false); 225 bool openCalendar(QString filename, bool merge=false);
226 bool loadCalendars(); 226 bool loadCalendars();
227 bool saveCalendars(); 227 bool saveCalendars();
228 bool restoreCalendarSettings(); 228 bool restoreCalendarSettings();
229 bool addCalendar( KopiCalendarFile * ); 229 bool addCalendar( KopiCalendarFile * );
230 void addCalendarId( int id );
230 bool syncCalendar(QString filename,int mode = 0 ); 231 bool syncCalendar(QString filename,int mode = 0 );
231 232
232 /** 233 /**
233 Save calendar data to file. Return true if calendar could be 234 Save calendar data to file. Return true if calendar could be
234 successfully saved. 235 successfully saved.
235 */ 236 */
236 bool saveCalendar(QString filename); 237 bool saveCalendar(QString filename);
237 238
238 /** 239 /**
239 Close calendar. Clear calendar data and reset views to display an empty 240 Close calendar. Clear calendar data and reset views to display an empty
240 calendar. 241 calendar.
241 */ 242 */
242 void closeCalendar(); 243 void closeCalendar();
243 244
244 /** Archive old events of calendar */ 245 /** Archive old events of calendar */
245 void archiveCalendar(); 246 void archiveCalendar();
246 247
247 void showIncidence(); 248 void showIncidence();
248 void editIncidence(); 249 void editIncidence();
249 void editIncidenceDescription(); 250 void editIncidenceDescription();
250 void deleteIncidence(); 251 void deleteIncidence();
251 void cloneIncidence(); 252 void cloneIncidence();
252 void moveIncidence(); 253 void moveIncidence();
253 void beamIncidence(); 254 void beamIncidence();
254 void toggleCancelIncidence(); 255 void toggleCancelIncidence();
255 256
256 /** create an editeventwin with supplied date/time, and if bool is true, 257 /** create an editeventwin with supplied date/time, and if bool is true,
257 * make the event take all day. */ 258 * make the event take all day. */
258 void newEvent(QDateTime, QDateTime, bool allDay ); 259 void newEvent(QDateTime, QDateTime, bool allDay );
259 void newEvent(QDateTime, QDateTime); 260 void newEvent(QDateTime, QDateTime);
260 void newEvent(QDateTime fh); 261 void newEvent(QDateTime fh);
261 void newEvent(QDate dt); 262 void newEvent(QDate dt);
262 /** create new event without having a date hint. Takes current date as 263 /** create new event without having a date hint. Takes current date as
263 default hint. */ 264 default hint. */
264 void newEvent(); 265 void newEvent();
265 void newFloatingEvent(); 266 void newFloatingEvent();
266 267
267 /** Create a read-only viewer dialog for the supplied incidence. It calls the correct showXXX method*/ 268 /** Create a read-only viewer dialog for the supplied incidence. It calls the correct showXXX method*/
268 void showIncidence(Incidence *); 269 void showIncidence(Incidence *);
269 void showIncidence(QString uid); 270 void showIncidence(QString uid);
270 /** Create an editor for the supplied incidence. It calls the correct editXXX method*/ 271 /** Create an editor for the supplied incidence. It calls the correct editXXX method*/
271 void editIncidence(Incidence *); 272 void editIncidence(Incidence *);
272 /** Delete the supplied incidence. It calls the correct deleteXXX method*/ 273 /** Delete the supplied incidence. It calls the correct deleteXXX method*/
273 void deleteIncidence(Incidence *); 274 void deleteIncidence(Incidence *);
274 void cloneIncidence(Incidence *); 275 void cloneIncidence(Incidence *);
275 void cancelIncidence(Incidence *); 276 void cancelIncidence(Incidence *);
276 /** Create an editor for the supplied event. */ 277 /** Create an editor for the supplied event. */
277 void editEvent(Event *); 278 void editEvent(Event *);
diff --git a/korganizer/koagendaitem.cpp b/korganizer/koagendaitem.cpp
index 5a3c4d2..c7bc6eb 100644
--- a/korganizer/koagendaitem.cpp
+++ b/korganizer/koagendaitem.cpp
@@ -76,177 +76,177 @@ KOAgendaItem::KOAgendaItem(Incidence *incidence, QDate qd, QWidget *parent,bool
76 QWidget(parent, name), mIncidence(incidence), mDate(qd) 76 QWidget(parent, name), mIncidence(incidence), mDate(qd)
77{ 77{
78#ifndef DESKTOP_VERSION 78#ifndef DESKTOP_VERSION
79 //QPEApplication::setStylusOperation( this, QPEApplication::RightOnHold ); 79 //QPEApplication::setStylusOperation( this, QPEApplication::RightOnHold );
80#endif 80#endif
81 mKOAgendaItemWhatsThis = new KOAgendaItemWhatsThis(this); 81 mKOAgendaItemWhatsThis = new KOAgendaItemWhatsThis(this);
82 int wflags = getWFlags() |WRepaintNoErase;// WResizeNoErase 82 int wflags = getWFlags() |WRepaintNoErase;// WResizeNoErase
83 setWFlags ( wflags); 83 setWFlags ( wflags);
84 mAllDay = allday; 84 mAllDay = allday;
85 init ( incidence, qd ); 85 init ( incidence, qd );
86 //setMouseTracking(true); 86 //setMouseTracking(true);
87 //setAcceptDrops(true); 87 //setAcceptDrops(true);
88 xPaintCoord = -1; 88 xPaintCoord = -1;
89 yPaintCoord = -1; 89 yPaintCoord = -1;
90} 90}
91QString KOAgendaItem::getWhatsThisText() 91QString KOAgendaItem::getWhatsThisText()
92{ 92{
93 if ( mIncidence ) 93 if ( mIncidence )
94 return KIncidenceFormatter::instance()->getFormattedText( mIncidence, 94 return KIncidenceFormatter::instance()->getFormattedText( mIncidence,
95 KOPrefs::instance()->mWTshowDetails, 95 KOPrefs::instance()->mWTshowDetails,
96 KOPrefs::instance()->mWTshowCreated, 96 KOPrefs::instance()->mWTshowCreated,
97 KOPrefs::instance()->mWTshowChanged); 97 KOPrefs::instance()->mWTshowChanged);
98 return "KOAgendaItem::getWhatsThisText()::internal error"; 98 return "KOAgendaItem::getWhatsThisText()::internal error";
99} 99}
100void KOAgendaItem::init ( Incidence *incidence, QDate qd ) 100void KOAgendaItem::init ( Incidence *incidence, QDate qd )
101{ 101{
102 mIncidence = incidence; 102 mIncidence = incidence;
103 mDate = qd; 103 mDate = qd;
104 mFirstMultiItem = 0; 104 mFirstMultiItem = 0;
105 mNextMultiItem = 0; 105 mNextMultiItem = 0;
106 mLastMultiItem = 0; 106 mLastMultiItem = 0;
107 computeText(); 107 computeText();
108 108
109 if ( (incidence->typeID() == todoID ) && 109 if ( (incidence->typeID() == todoID ) &&
110 ( !((static_cast<Todo*>(incidence))->isCompleted()) && 110 ( !((static_cast<Todo*>(incidence))->isCompleted()) &&
111 ((static_cast<Todo*>(incidence))->dtDue().date() <= QDate::currentDate()) ) ) { 111 ((static_cast<Todo*>(incidence))->dtDue().date() <= QDate::currentDate()) ) ) {
112 if ( (static_cast<Todo*>(incidence))->dtDue() < QDateTime::currentDateTime().date()) 112 if ( (static_cast<Todo*>(incidence))->dtDue() < QDateTime::currentDateTime().date())
113 mBackgroundColor = KOPrefs::instance()->mTodoOverdueColor ; 113 mBackgroundColor = KOPrefs::instance()->mTodoOverdueColor ;
114 else 114 else
115 mBackgroundColor = KOPrefs::instance()->mTodoDueTodayColor; 115 mBackgroundColor = KOPrefs::instance()->mTodoDueTodayColor;
116 } 116 }
117 else { 117 else {
118 QStringList categories = mIncidence->categories(); 118 QStringList categories = mIncidence->categories();
119 QString cat = categories.first(); 119 QString cat = categories.first();
120 if (cat.isEmpty()) { 120 if (cat.isEmpty()) {
121 if ( (incidence->typeID() == todoID ) &&((static_cast<Todo*>(incidence))->isCompleted()) ) 121 if ( (incidence->typeID() == todoID ) &&((static_cast<Todo*>(incidence))->isCompleted()) )
122 mBackgroundColor =KOPrefs::instance()->mTodoDoneColor; 122 mBackgroundColor =KOPrefs::instance()->mTodoDoneColor;
123 else 123 else
124 mBackgroundColor =KOPrefs::instance()->mEventColor; 124 mBackgroundColor =KOPrefs::instance()->defaultColor( incidence->calID() );
125 } else { 125 } else {
126 mBackgroundColor = *KOPrefs::instance()->categoryColor(cat); 126 mBackgroundColor = *KOPrefs::instance()->categoryColor(cat);
127 if ( (incidence->typeID() == todoID ) &&((static_cast<Todo*>(incidence))->isCompleted()) ) { 127 if ( (incidence->typeID() == todoID ) &&((static_cast<Todo*>(incidence))->isCompleted()) ) {
128 if ( mBackgroundColor == KOPrefs::instance()->mEventColor ) 128 if ( mBackgroundColor == KOPrefs::instance()->mEventColor )
129 mBackgroundColor =KOPrefs::instance()->mTodoDoneColor; 129 mBackgroundColor =KOPrefs::instance()->mTodoDoneColor;
130 } 130 }
131 } 131 }
132 132
133 } 133 }
134 mColorGroup = QColorGroup( mBackgroundColor.light(), 134 mColorGroup = QColorGroup( mBackgroundColor.light(),
135 mBackgroundColor.dark(),mBackgroundColor.light(), 135 mBackgroundColor.dark(),mBackgroundColor.light(),
136 mBackgroundColor.dark(),mBackgroundColor, black, mBackgroundColor) ; 136 mBackgroundColor.dark(),mBackgroundColor, black, mBackgroundColor) ;
137 setBackgroundColor( mBackgroundColor ); 137 setBackgroundColor( mBackgroundColor );
138 138
139 mConflictItems.clear(); 139 mConflictItems.clear();
140 setCellXY(0,0,1); 140 setCellXY(0,0,1);
141 setCellXWidth(0); 141 setCellXWidth(0);
142 setSubCell(0); 142 setSubCell(0);
143 setSubCells(1); 143 setSubCells(1);
144 setMultiItem(0,0,0); 144 setMultiItem(0,0,0);
145 startMove(); 145 startMove();
146 mSelected = true; 146 mSelected = true;
147 select(false); 147 select(false);
148 QFontMetrics fontinf(KOPrefs::instance()->mAgendaViewFont); 148 QFontMetrics fontinf(KOPrefs::instance()->mAgendaViewFont);
149 mFontPixelSize = fontinf.height();; 149 mFontPixelSize = fontinf.height();;
150 hide(); 150 hide();
151 xPaintCoord = -1; 151 xPaintCoord = -1;
152 yPaintCoord = -1; 152 yPaintCoord = -1;
153} 153}
154 154
155 155
156KOAgendaItem::~KOAgendaItem() 156KOAgendaItem::~KOAgendaItem()
157{ 157{
158#if QT_VERSION >= 0x030000 158#if QT_VERSION >= 0x030000
159 159
160#else 160#else
161 delete mKOAgendaItemWhatsThis; 161 delete mKOAgendaItemWhatsThis;
162#endif 162#endif
163 163
164} 164}
165 165
166void KOAgendaItem::recreateIncidence() 166void KOAgendaItem::recreateIncidence()
167{ 167{
168#if 0 168#if 0
169 Incidence* newInc = mIncidence->clone(); 169 Incidence* newInc = mIncidence->clone();
170 newInc->recreate(); 170 newInc->recreate();
171 if ( mIncidence->doesRecur() ) { 171 if ( mIncidence->doesRecur() ) {
172 mIncidence->addExDate( mDate ); 172 mIncidence->addExDate( mDate );
173 newInc->recurrence()->unsetRecurs(); 173 newInc->recurrence()->unsetRecurs();
174 int len = mIncidence->dtStart().secsTo( ((Event*)mIncidence)->dtEnd()); 174 int len = mIncidence->dtStart().secsTo( ((Event*)mIncidence)->dtEnd());
175 QTime tim = mIncidence->dtStart().time(); 175 QTime tim = mIncidence->dtStart().time();
176 newInc->setDtStart( QDateTime(mDate, tim) ); 176 newInc->setDtStart( QDateTime(mDate, tim) );
177 ((Event*)newInc)->setDtEnd( newInc->dtStart().addSecs( len ) ); 177 ((Event*)newInc)->setDtEnd( newInc->dtStart().addSecs( len ) );
178 } 178 }
179#endif 179#endif
180 mIncidence = mIncidence->recreateCloneException( mDate ); 180 mIncidence = mIncidence->recreateCloneException( mDate );
181} 181}
182bool KOAgendaItem::updateIcons(QPainter * p, bool horLayout) 182bool KOAgendaItem::updateIcons(QPainter * p, bool horLayout)
183{ 183{
184 int size = AGENDA_ICON_SIZE; 184 int size = AGENDA_ICON_SIZE;
185 185
186 int yOff = 0; 186 int yOff = 0;
187 int xOff = 0; 187 int xOff = 0;
188 int x = pos().x() +3; 188 int x = pos().x() +3;
189 int y; 189 int y;
190 if ( mAllDay ) 190 if ( mAllDay )
191 y = pos().y()+3; 191 y = pos().y()+3;
192 else 192 else
193 y = mCellYTop * ( height() / cellHeight() ) +3; 193 y = mCellYTop * ( height() / cellHeight() ) +3;
194 if (mIncidence->cancelled()) { 194 if (mIncidence->cancelled()) {
195 int xpos = xOff*( 1 +AGENDA_ICON_SIZE )+x; 195 int xpos = xOff*( 1 +AGENDA_ICON_SIZE )+x;
196 int ypos = yOff*( 1 +AGENDA_ICON_SIZE)+y; 196 int ypos = yOff*( 1 +AGENDA_ICON_SIZE)+y;
197 p->drawLine( xpos, ypos, xpos+AGENDA_ICON_SIZE-1, ypos+AGENDA_ICON_SIZE-1 ); 197 p->drawLine( xpos, ypos, xpos+AGENDA_ICON_SIZE-1, ypos+AGENDA_ICON_SIZE-1 );
198 p->drawLine( xpos, ypos+AGENDA_ICON_SIZE-1, xpos+AGENDA_ICON_SIZE-1, ypos ); 198 p->drawLine( xpos, ypos+AGENDA_ICON_SIZE-1, xpos+AGENDA_ICON_SIZE-1, ypos );
199 if ( horLayout ) 199 if ( horLayout )
200 ++xOff; 200 ++xOff;
201 else 201 else
202 ++yOff; 202 ++yOff;
203 } 203 }
204 if (mIncidence->isAlarmEnabled()) { 204 if (mIncidence->isAlarmEnabled() && mIncidence->alarmEnabled()) {
205 p->fillRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x, yOff*( 1 +AGENDA_ICON_SIZE)+y, AGENDA_ICON_SIZE, AGENDA_ICON_SIZE, red ); 205 p->fillRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x, yOff*( 1 +AGENDA_ICON_SIZE)+y, AGENDA_ICON_SIZE, AGENDA_ICON_SIZE, red );
206 if ( horLayout ) 206 if ( horLayout )
207 ++xOff; 207 ++xOff;
208 else 208 else
209 ++yOff; 209 ++yOff;
210 } 210 }
211 if (mIncidence->recurrence()->doesRecur()) { 211 if (mIncidence->recurrence()->doesRecur()) {
212 p->fillRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x, yOff*( 1 +AGENDA_ICON_SIZE)+y, AGENDA_ICON_SIZE, AGENDA_ICON_SIZE, blue ); 212 p->fillRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x, yOff*( 1 +AGENDA_ICON_SIZE)+y, AGENDA_ICON_SIZE, AGENDA_ICON_SIZE, blue );
213 if ( horLayout ) 213 if ( horLayout )
214 ++xOff; 214 ++xOff;
215 else 215 else
216 ++yOff; 216 ++yOff;
217 } 217 }
218 if (mIncidence->description().length() > 0) { 218 if (mIncidence->description().length() > 0) {
219 p->fillRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x, yOff*( 1 +AGENDA_ICON_SIZE)+y, AGENDA_ICON_SIZE, AGENDA_ICON_SIZE, darkGreen ); 219 p->fillRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x, yOff*( 1 +AGENDA_ICON_SIZE)+y, AGENDA_ICON_SIZE, AGENDA_ICON_SIZE, darkGreen );
220 if ( horLayout ) 220 if ( horLayout )
221 ++xOff; 221 ++xOff;
222 else 222 else
223 ++yOff; 223 ++yOff;
224 } 224 }
225 if (mIncidence->isReadOnly()) { 225 if (mIncidence->isReadOnly()) {
226 p->fillRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x, yOff*( 1 +AGENDA_ICON_SIZE)+y, AGENDA_ICON_SIZE, AGENDA_ICON_SIZE, white ); 226 p->fillRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x, yOff*( 1 +AGENDA_ICON_SIZE)+y, AGENDA_ICON_SIZE, AGENDA_ICON_SIZE, white );
227 if ( horLayout ) 227 if ( horLayout )
228 ++xOff; 228 ++xOff;
229 else 229 else
230 ++yOff; 230 ++yOff;
231 } 231 }
232 232
233 if (mIncidence->attendeeCount()>0) { 233 if (mIncidence->attendeeCount()>0) {
234 234
235 if (mIncidence->organizer() == KOPrefs::instance()->email()) { 235 if (mIncidence->organizer() == KOPrefs::instance()->email()) {
236 p->fillRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x, yOff*( 1 +AGENDA_ICON_SIZE)+y, AGENDA_ICON_SIZE, AGENDA_ICON_SIZE, black ); 236 p->fillRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x, yOff*( 1 +AGENDA_ICON_SIZE)+y, AGENDA_ICON_SIZE, AGENDA_ICON_SIZE, black );
237 if ( horLayout ) 237 if ( horLayout )
238 ++xOff; 238 ++xOff;
239 else 239 else
240 ++yOff; 240 ++yOff;
241 } else { 241 } else {
242 Attendee *me = mIncidence->attendeeByMails(KOPrefs::instance()->mAdditionalMails,KOPrefs::instance()->email()); 242 Attendee *me = mIncidence->attendeeByMails(KOPrefs::instance()->mAdditionalMails,KOPrefs::instance()->email());
243 if (me!=0) { 243 if (me!=0) {
244 244
245 245
246 } else { 246 } else {
247 p->fillRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x, yOff*( 1 +AGENDA_ICON_SIZE)+y, AGENDA_ICON_SIZE, AGENDA_ICON_SIZE, yellow ); 247 p->fillRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x, yOff*( 1 +AGENDA_ICON_SIZE)+y, AGENDA_ICON_SIZE, AGENDA_ICON_SIZE, yellow );
248 if ( horLayout ) 248 if ( horLayout )
249 ++xOff; 249 ++xOff;
250 else 250 else
251 ++yOff; 251 ++yOff;
252 252
diff --git a/korganizer/kofilterview.cpp b/korganizer/kofilterview.cpp
index 29a4393..2b16347 100644
--- a/korganizer/kofilterview.cpp
+++ b/korganizer/kofilterview.cpp
@@ -113,147 +113,151 @@ void KOFilterView::updateFilters()
113 while(filter) { 113 while(filter) {
114 mSelectionCombo->insertItem(filter->name()); 114 mSelectionCombo->insertItem(filter->name());
115 filter = mFilters->next(); 115 filter = mFilters->next();
116 } 116 }
117} 117}
118 118
119CalFilter *KOFilterView::selectedFilter() 119CalFilter *KOFilterView::selectedFilter()
120{ 120{
121 CalFilter *f = mFilters->at(mSelectionCombo->currentItem()); 121 CalFilter *f = mFilters->at(mSelectionCombo->currentItem());
122 return f; 122 return f;
123} 123}
124 124
125void KOFilterView::setSelectedFilter(QString filterName) 125void KOFilterView::setSelectedFilter(QString filterName)
126{ 126{
127 int filter_num = mSelectionCombo->count(); 127 int filter_num = mSelectionCombo->count();
128 int i; 128 int i;
129 for (i=0;i<filter_num;i++) { 129 for (i=0;i<filter_num;i++) {
130 if (mSelectionCombo->text(i)==filterName) 130 if (mSelectionCombo->text(i)==filterName)
131 mSelectionCombo->setCurrentItem(i); 131 mSelectionCombo->setCurrentItem(i);
132 } 132 }
133 emit filterChanged(); 133 emit filterChanged();
134} 134}
135void KOFilterView::setSelectedFilter( int fil ) 135void KOFilterView::setSelectedFilter( int fil )
136{ 136{
137 if ( fil >= mSelectionCombo->count() ) 137 if ( fil >= mSelectionCombo->count() )
138 return; 138 return;
139 mSelectionCombo->setCurrentItem( fil ); 139 mSelectionCombo->setCurrentItem( fil );
140 emit filterChanged(); 140 emit filterChanged();
141} 141}
142 142
143 143
144 144
145KOCalEditView::KOCalEditView(QWidget* parent, 145KOCalEditView::KOCalEditView(QWidget* parent,
146 const char* name ) 146 const char* name )
147 : QWidget(parent,name) 147 : QWidget(parent,name)
148{ 148{
149 mw = 0; 149 mw = 0;
150 ml = new QVBoxLayout ( this ); 150 ml = new QVBoxLayout ( this );
151} 151}
152 152
153KOCalEditView::~KOCalEditView() 153KOCalEditView::~KOCalEditView()
154{ 154{
155 // no need to delete child widgets, Qt does it all for us 155 // no need to delete child widgets, Qt does it all for us
156} 156}
157void KOCalEditView::selectCal(int id ,bool b) 157void KOCalEditView::selectCal(int id ,bool b)
158{ 158{
159 KOPrefs::instance()->getCalendar( id )->isEnabled = b; 159 KOPrefs::instance()->getCalendar( id )->isEnabled = b;
160 emit calendarEnabled ( id, b ); 160 emit calendarEnabled ( id, b );
161 emit needsUpdate();
161 162
162} 163}
163void KOCalEditView::selectStdCal( int id, bool b ) 164void KOCalEditView::selectStdCal( int id, bool b )
164{ 165{
165 166
166 if ( !b ) { 167 if ( !b ) {
167 KOCalCheckButton* it = (KOCalCheckButton*) sender(); 168 KOCalCheckButton* it = (KOCalCheckButton*) sender();
168 if ( it ) { 169 if ( it ) {
169 it->blockSignals( true ); 170 it->blockSignals( true );
170 it->setChecked( true ); 171 it->setChecked( true );
171 it->blockSignals( false ); 172 it->blockSignals( false );
172 return; 173 return;
173 } 174 }
174 return; 175 return;
175 } 176 }
176 KOCalCheckButton* sen = (KOCalCheckButton*) sender(); 177 KOCalCheckButton* sen = (KOCalCheckButton*) sender();
177 KOCalCheckButton* it = mStdandardB.first(); 178 KOCalCheckButton* it = mStdandardB.first();
178 while ( it ) { 179 while ( it ) {
179 if ( it->isChecked() ) { 180 if ( it->isChecked() ) {
180 if ( it != sen ) { 181 if ( it != sen ) {
181 it->blockSignals( true ); 182 it->blockSignals( true );
182 it->setChecked( false ); 183 it->setChecked( false );
183 it->blockSignals( false ); 184 it->blockSignals( false );
184 break; 185 break;
185 } 186 }
186 } 187 }
187 it = mStdandardB.next(); 188 it = mStdandardB.next();
188 } 189 }
189 KopiCalendarFile * kkf = KOPrefs::instance()->mCalendars.first(); 190 KopiCalendarFile * kkf = KOPrefs::instance()->mCalendars.first();
190 while ( kkf ) { 191 while ( kkf ) {
191 kkf->isStandard = false; 192 kkf->isStandard = false;
192 kkf = KOPrefs::instance()->mCalendars.next(); 193 kkf = KOPrefs::instance()->mCalendars.next();
193 } 194 }
194 KOPrefs::instance()->getCalendar( id )->isStandard = true; 195 KOPrefs::instance()->getCalendar( id )->isStandard = true;
195 emit setCalendarDefault ( id ); 196 emit setCalendarDefault ( id );
196} 197}
197 198
198void KOCalEditView::selectCalAlarm(int id ,bool b ) 199void KOCalEditView::selectCalAlarm(int id ,bool b )
199{ 200{
200 KOPrefs::instance()->getCalendar( id )->isAlarmEnabled = b; 201 KOPrefs::instance()->getCalendar( id )->isAlarmEnabled = b;
201 emit alarmEnabled ( id , b ); 202 emit alarmEnabled ( id , b );
203 emit needsUpdate();
202} 204}
203void KOCalEditView::selectReadOnly(int id ,bool b ) 205void KOCalEditView::selectReadOnly(int id ,bool b )
204{ 206{
205 KOPrefs::instance()->getCalendar( id )->isReadOnly = b; 207 KOPrefs::instance()->getCalendar( id )->isReadOnly = b;
206 emit calendarReadonly ( id , b ); 208 emit calendarReadonly ( id , b );
209 emit needsUpdate();
207 210
208} 211}
209void KOCalEditView::setColor( const QColor& c, int id ) 212void KOCalEditView::setColor( const QColor& c, int id )
210{ 213{
211 KOPrefs::instance()->getCalendar( id )->mDefaultColor = c; 214 KOPrefs::instance()->getCalendar( id )->mDefaultColor = c;
215 emit needsUpdate();
212} 216}
213void KOCalEditView::deleteCal( int id ) 217void KOCalEditView::deleteCal( int id )
214{ 218{
215 KopiCalendarFile * kkf = KOPrefs::instance()->getCalendar( id ); 219 KopiCalendarFile * kkf = KOPrefs::instance()->getCalendar( id );
216 QString name = kkf->mName; 220 QString name = kkf->mName;
217 QString file = kkf->mFileName; 221 QString file = kkf->mFileName;
218 if ( KMessageBox::warningContinueCancel( this, i18n("The calendar <b>%1</b> is displaying file <b>%2</b><tr> Do you want to remove this calendar from KO/Pi? (The file is not removed, of course!)").arg(name).arg(file) ) != KMessageBox::Continue ) return; 222 if ( KMessageBox::warningContinueCancel( this, i18n("The calendar <b>%1</b> is displaying file <b>%2</b><tr> Do you want to remove this calendar from KO/Pi? (The file is not removed, of course!)").arg(name).arg(file) ) != KMessageBox::Continue ) return;
219 emit removeCalendar ( id ); 223 emit removeCalendar ( id );
220 KOPrefs::instance()->mCalendars.remove ( kkf ); 224 KOPrefs::instance()->mCalendars.remove ( kkf );
221 readConfig(); 225 readConfig();
222} 226}
223void KOCalEditView::infoCal( int id ) 227void KOCalEditView::infoCal( int id )
224{ 228{
225 QString name = KOPrefs::instance()->getCalendar( id )->mName; 229 QString name = KOPrefs::instance()->getCalendar( id )->mName;
226 QString file = KOPrefs::instance()->getCalendar( id )->mFileName; 230 QString file = KOPrefs::instance()->getCalendar( id )->mFileName;
227 KMessageBox::information( this, i18n("The calendar <b>%1</b> is displaying file <b>%2</b>").arg(name).arg(file) ); 231 KMessageBox::information( this, i18n("The calendar <b>%1</b> is displaying file <b>%2</b>").arg(name).arg(file) );
228} 232}
229void KOCalEditView::readConfig() 233void KOCalEditView::readConfig()
230{ 234{
231 235
232 mStdandardB.clear(); 236 mStdandardB.clear();
233 mEnabledB.clear(); 237 mEnabledB.clear();
234 mAlarmB.clear(); 238 mAlarmB.clear();
235 mROB.clear(); 239 mROB.clear();
236 240
237 if ( mw ) delete mw; 241 if ( mw ) delete mw;
238 mw = new QWidget ( this ); 242 mw = new QWidget ( this );
239 ml->addWidget ( mw ); 243 ml->addWidget ( mw );
240 244
241 mainLayout = new QGridLayout ( mw , 2, 8 ); 245 mainLayout = new QGridLayout ( mw , 2, 8 );
242 //mainLayout->setSpacing( 3 ); 246 //mainLayout->setSpacing( 3 );
243 QPushButton * addBut = new QPushButton ( mw ); 247 QPushButton * addBut = new QPushButton ( mw );
244 mainLayout->addWidget( addBut,0,0 ); 248 mainLayout->addWidget( addBut,0,0 );
245 addBut->setPixmap ( SmallIcon("plus")); 249 addBut->setPixmap ( SmallIcon("plus"));
246 connect(addBut,SIGNAL(clicked()),SLOT(addCal())); 250 connect(addBut,SIGNAL(clicked()),SLOT(addCal()));
247 addBut->setMaximumWidth( addBut->sizeHint().height() ); 251 addBut->setMaximumWidth( addBut->sizeHint().height() );
248 252
249 addBut = new QPushButton ( mw ); 253 addBut = new QPushButton ( mw );
250 mainLayout->addWidget( addBut,0,1 ); 254 mainLayout->addWidget( addBut,0,1 );
251 addBut->setPixmap ( SmallIcon("eye")); 255 addBut->setPixmap ( SmallIcon("eye"));
252 connect(addBut,SIGNAL(clicked()),SLOT(enableAll())); 256 connect(addBut,SIGNAL(clicked()),SLOT(enableAll()));
253 addBut->setMaximumWidth( addBut->sizeHint().height() ); 257 addBut->setMaximumWidth( addBut->sizeHint().height() );
254 258
255 QLabel* lab = new QLabel ( " "+i18n("Calendar")+" ", mw ); 259 QLabel* lab = new QLabel ( " "+i18n("Calendar")+" ", mw );
256 mainLayout->addWidget( lab,0,2 ); 260 mainLayout->addWidget( lab,0,2 );
257 261
258 addBut = new QPushButton ( mw ); 262 addBut = new QPushButton ( mw );
259 mainLayout->addWidget( addBut,0,3 ); 263 mainLayout->addWidget( addBut,0,3 );
diff --git a/korganizer/kofilterview.h b/korganizer/kofilterview.h
index aaf0eb6..4a0cd8a 100644
--- a/korganizer/kofilterview.h
+++ b/korganizer/kofilterview.h
@@ -93,63 +93,64 @@ class KOFilterView : public KOFilterView_base
93 public: 93 public:
94 KOFilterView(QPtrList<CalFilter> *filterList,QWidget* parent=0,const char* name=0, WFlags fl=0); 94 KOFilterView(QPtrList<CalFilter> *filterList,QWidget* parent=0,const char* name=0, WFlags fl=0);
95 ~KOFilterView(); 95 ~KOFilterView();
96 96
97 void updateFilters(); 97 void updateFilters();
98 98
99 bool filtersEnabled(); 99 bool filtersEnabled();
100 void setFiltersEnabled(bool); 100 void setFiltersEnabled(bool);
101 CalFilter *selectedFilter(); 101 CalFilter *selectedFilter();
102 void setSelectedFilter(QString); 102 void setSelectedFilter(QString);
103 void setSelectedFilter( int ); 103 void setSelectedFilter( int );
104 104
105 signals: 105 signals:
106 void filterChanged(); 106 void filterChanged();
107 void editFilters(); 107 void editFilters();
108 108
109 private: 109 private:
110 QPtrList<CalFilter> *mFilters; 110 QPtrList<CalFilter> *mFilters;
111}; 111};
112 112
113class KOCalEditView : public QWidget 113class KOCalEditView : public QWidget
114{ 114{
115 Q_OBJECT 115 Q_OBJECT
116 public: 116 public:
117 KOCalEditView( QWidget* parent=0,const char* name=0); 117 KOCalEditView( QWidget* parent=0,const char* name=0);
118 ~KOCalEditView(); 118 ~KOCalEditView();
119 119
120 void readConfig(); 120 void readConfig();
121 public slots: 121 public slots:
122 void addCal(); 122 void addCal();
123 void enableAll(); 123 void enableAll();
124 void enableAlarm(); 124 void enableAlarm();
125 void disableRO(); 125 void disableRO();
126 void deleteAll(); 126 void deleteAll();
127 void selectStdCal(int,bool ); 127 void selectStdCal(int,bool );
128 void selectCal(int,bool ); 128 void selectCal(int,bool );
129 void selectCalAlarm(int,bool ); 129 void selectCalAlarm(int,bool );
130 void selectReadOnly(int,bool ); 130 void selectReadOnly(int,bool );
131 void setColor(const QColor &,int) ; 131 void setColor(const QColor &,int) ;
132 void deleteCal(int) ; 132 void deleteCal(int) ;
133 void infoCal(int) ; 133 void infoCal(int) ;
134 signals: 134 signals:
135 void alarmEnabled ( int cal, bool enable ); 135 void alarmEnabled ( int cal, bool enable );
136 void calendarEnabled ( int cal, bool enable ); 136 void calendarEnabled ( int cal, bool enable );
137 void calendarReadonly ( int cal, bool readonly ); 137 void calendarReadonly ( int cal, bool readonly );
138 void setCalendarDefault ( int cal ); 138 void setCalendarDefault ( int cal );
139 void removeCalendar ( int cal ); 139 void removeCalendar ( int cal );
140 void calendarAdded( int ); 140 void calendarAdded( int );
141 void needsUpdate();
141 142
142 private: 143 private:
143 QVBoxLayout* ml; 144 QVBoxLayout* ml;
144 QWidget *mw; 145 QWidget *mw;
145 void toggleList ( QPtrList<KOCalCheckButton> ); 146 void toggleList ( QPtrList<KOCalCheckButton> );
146 QPtrList<KOCalCheckButton> mStdandardB; 147 QPtrList<KOCalCheckButton> mStdandardB;
147 QPtrList<KOCalCheckButton> mEnabledB; 148 QPtrList<KOCalCheckButton> mEnabledB;
148 QPtrList<KOCalCheckButton> mAlarmB; 149 QPtrList<KOCalCheckButton> mAlarmB;
149 QPtrList<KOCalCheckButton> mROB; 150 QPtrList<KOCalCheckButton> mROB;
150 QGridLayout* mainLayout; 151 QGridLayout* mainLayout;
151}; 152};
152 153
153 154
154 155
155#endif // KOFILTERVIEW_H 156#endif // KOFILTERVIEW_H
diff --git a/korganizer/komonthview.cpp b/korganizer/komonthview.cpp
index c868270..96f2502 100644
--- a/korganizer/komonthview.cpp
+++ b/korganizer/komonthview.cpp
@@ -703,178 +703,178 @@ int MonthViewCell::insertEvent(Event *event)
703 if ( useToolTips ) 703 if ( useToolTips )
704 mToolTipText += text; 704 mToolTipText += text;
705 } 705 }
706 else { 706 else {
707 text = KGlobal::locale()->formatTime(event->dtStart().time()); 707 text = KGlobal::locale()->formatTime(event->dtStart().time());
708 text += " " + event->summary(); 708 text += " " + event->summary();
709 if ( useToolTips ) 709 if ( useToolTips )
710 mToolTipText += KGlobal::locale()->formatTime(event->dtStart().time()) +"-"+KGlobal::locale()->formatTime(event->dtEnd().time())+" " + event->summary(); 710 mToolTipText += KGlobal::locale()->formatTime(event->dtStart().time()) +"-"+KGlobal::locale()->formatTime(event->dtEnd().time())+" " + event->summary();
711 } 711 }
712 } 712 }
713 if ( useToolTips && ! event->location().isEmpty() ) { 713 if ( useToolTips && ! event->location().isEmpty() ) {
714 mToolTipText += " (" + event->location() +")"; 714 mToolTipText += " (" + event->location() +")";
715 } 715 }
716 MonthViewItem *item ; 716 MonthViewItem *item ;
717 717
718 if ( mAvailItemList.count() ) { 718 if ( mAvailItemList.count() ) {
719 item = mAvailItemList.first(); 719 item = mAvailItemList.first();
720 mAvailItemList.remove( item ); 720 mAvailItemList.remove( item );
721 item->recycle( event, mDate, text ); 721 item->recycle( event, mDate, text );
722 } else { 722 } else {
723 item = new MonthViewItem( event, mDate, text ); 723 item = new MonthViewItem( event, mDate, text );
724 } 724 }
725 725
726 QPalette pal; 726 QPalette pal;
727 if (KOPrefs::instance()->mMonthViewUsesCategoryColor) { 727 if (KOPrefs::instance()->mMonthViewUsesCategoryColor) {
728 QStringList categories = event->categories(); 728 QStringList categories = event->categories();
729 QString cat = categories.first(); 729 QString cat = categories.first();
730 if ( KOPrefs::instance()->mMonthViewUsesForegroundColor ) { 730 if ( KOPrefs::instance()->mMonthViewUsesForegroundColor ) {
731 pal = getPalette(); 731 pal = getPalette();
732 if (cat.isEmpty()) { 732 if (cat.isEmpty()) {
733 pal.setColor(QColorGroup::Foreground,KOPrefs::instance()->mEventColor); 733 pal.setColor(QColorGroup::Foreground,KOPrefs::instance()->mEventColor);
734 } else { 734 } else {
735 pal.setColor(QColorGroup::Foreground, *(KOPrefs::instance()->categoryColor(cat))); 735 pal.setColor(QColorGroup::Foreground, *(KOPrefs::instance()->categoryColor(cat)));
736 } 736 }
737 737
738 } else { 738 } else {
739 if (cat.isEmpty()) { 739 if (cat.isEmpty()) {
740 pal = QPalette(KOPrefs::instance()->mEventColor, KOPrefs::instance()->mEventColor); 740 pal = QPalette(KOPrefs::instance()->mEventColor, KOPrefs::instance()->mEventColor);
741 } else { 741 } else {
742 pal = QPalette(*(KOPrefs::instance()->categoryColor(cat)), *(KOPrefs::instance()->categoryColor(cat))); 742 pal = QPalette(*(KOPrefs::instance()->categoryColor(cat)), *(KOPrefs::instance()->categoryColor(cat)));
743 } 743 }
744 } 744 }
745 745
746 } else { 746 } else {
747 pal = mStandardPalette ; 747 pal = mStandardPalette ;
748 } 748 }
749 item->setPalette( pal ); 749 item->setPalette( pal );
750 item->setRecur( event->recurrence()->doesRecur() ); 750 item->setRecur( event->recurrence()->doesRecur() );
751 item->setAlarm( event->isAlarmEnabled() && multiday < 2 ); 751 item->setAlarm( event->isAlarmEnabled() && multiday < 2 && event->alarmEnabled() );
752 item->setMoreInfo( event->description().length() > 0 ); 752 item->setMoreInfo( event->description().length() > 0 );
753#ifdef DESKTOP_VERSION 753#ifdef DESKTOP_VERSION
754 Attendee *me = event->attendeeByMails(KOPrefs::instance()->mAdditionalMails, 754 Attendee *me = event->attendeeByMails(KOPrefs::instance()->mAdditionalMails,
755 KOPrefs::instance()->email()); 755 KOPrefs::instance()->email());
756 if ( me != 0 ) { 756 if ( me != 0 ) {
757 if ( me->status() == Attendee::NeedsAction && me->RSVP()) 757 if ( me->status() == Attendee::NeedsAction && me->RSVP())
758 item->setReply(true && multiday < 2); 758 item->setReply(true && multiday < 2);
759 else 759 else
760 item->setReply(false); 760 item->setReply(false);
761 } else 761 } else
762 item->setReply(false); 762 item->setReply(false);
763#endif 763#endif
764 item->setMultiDay( multiday ); 764 item->setMultiDay( multiday );
765 if ( multiday ) { 765 if ( multiday ) {
766 insertItem( item ,mdayCount); 766 insertItem( item ,mdayCount);
767 ++mdayCount; 767 ++mdayCount;
768 } else { 768 } else {
769 uint i; 769 uint i;
770 int pos = mdayCount; 770 int pos = mdayCount;
771 for ( i = mdayCount; i < count();++i ) { 771 for ( i = mdayCount; i < count();++i ) {
772 QListBoxItem* it = this->item ( i ); 772 QListBoxItem* it = this->item ( i );
773 if ( it && text < it->text() ) { 773 if ( it && text < it->text() ) {
774 pos = i; 774 pos = i;
775 break; 775 break;
776 } 776 }
777 ++pos; 777 ++pos;
778 } 778 }
779 insertItem( item ,pos); 779 insertItem( item ,pos);
780 } 780 }
781 if ( useToolTips ) { 781 if ( useToolTips ) {
782 mToolTip.append( mToolTipText ); 782 mToolTip.append( mToolTipText );
783 } 783 }
784 return mdayCount; 784 return mdayCount;
785} 785}
786void MonthViewCell::insertTodo(Todo *todo) 786void MonthViewCell::insertTodo(Todo *todo)
787{ 787{
788 setFocusPolicy(WheelFocus); 788 setFocusPolicy(WheelFocus);
789 QString text; 789 QString text;
790 if (todo->hasDueDate()) { 790 if (todo->hasDueDate()) {
791 if (!todo->doesFloat()) { 791 if (!todo->doesFloat()) {
792 text += KGlobal::locale()->formatTime(todo->dtDue().time()); 792 text += KGlobal::locale()->formatTime(todo->dtDue().time());
793 text += " "; 793 text += " ";
794 } 794 }
795 } 795 }
796 text += todo->summary(); 796 text += todo->summary();
797 MonthViewItem *item ; 797 MonthViewItem *item ;
798 if ( mAvailItemList.count() ) { 798 if ( mAvailItemList.count() ) {
799 item = mAvailItemList.first(); 799 item = mAvailItemList.first();
800 mAvailItemList.remove( item ); 800 mAvailItemList.remove( item );
801 item->recycle( todo, mDate, text ); 801 item->recycle( todo, mDate, text );
802 } else { 802 } else {
803 item = new MonthViewItem( todo, mDate, text ); 803 item = new MonthViewItem( todo, mDate, text );
804 } 804 }
805 //MonthViewItem *item = new MonthViewItem( todo, mDate, text ); 805 //MonthViewItem *item = new MonthViewItem( todo, mDate, text );
806 //item->setPalette( mStandardPalette ); 806 //item->setPalette( mStandardPalette );
807 QPalette pal; 807 QPalette pal;
808 if (KOPrefs::instance()->mMonthViewUsesCategoryColor) { 808 if (KOPrefs::instance()->mMonthViewUsesCategoryColor) {
809 QStringList categories = todo->categories(); 809 QStringList categories = todo->categories();
810 QString cat = categories.first(); 810 QString cat = categories.first();
811 if ( KOPrefs::instance()->mMonthViewUsesForegroundColor ) { 811 if ( KOPrefs::instance()->mMonthViewUsesForegroundColor ) {
812 pal = getPalette(); 812 pal = getPalette();
813 if (cat.isEmpty()) { 813 if (cat.isEmpty()) {
814 pal.setColor(QColorGroup::Foreground,KOPrefs::instance()->mEventColor); 814 pal.setColor(QColorGroup::Foreground,KOPrefs::instance()->mEventColor);
815 } else { 815 } else {
816 pal.setColor(QColorGroup::Foreground, *(KOPrefs::instance()->categoryColor(cat))); 816 pal.setColor(QColorGroup::Foreground, *(KOPrefs::instance()->categoryColor(cat)));
817 } 817 }
818 818
819 } else { 819 } else {
820 if (cat.isEmpty()) { 820 if (cat.isEmpty()) {
821 pal = QPalette(KOPrefs::instance()->mEventColor, KOPrefs::instance()->mEventColor); 821 pal = QPalette(KOPrefs::instance()->mEventColor, KOPrefs::instance()->mEventColor);
822 } else { 822 } else {
823 pal = QPalette(*(KOPrefs::instance()->categoryColor(cat)), *(KOPrefs::instance()->categoryColor(cat))); 823 pal = QPalette(*(KOPrefs::instance()->categoryColor(cat)), *(KOPrefs::instance()->categoryColor(cat)));
824 } 824 }
825 } 825 }
826 826
827 } else { 827 } else {
828 pal = mStandardPalette ; 828 pal = mStandardPalette ;
829 } 829 }
830 item->setPalette( pal ); 830 item->setPalette( pal );
831 item->setRecur( todo->recurrence()->doesRecur() ); 831 item->setRecur( todo->recurrence()->doesRecur() );
832 item->setAlarm( todo->isAlarmEnabled() ); 832 item->setAlarm( todo->isAlarmEnabled() && todo->alarmEnabled() );
833 item->setMoreInfo( todo->description().length() > 0 ); 833 item->setMoreInfo( todo->description().length() > 0 );
834 insertItem( item , count()); 834 insertItem( item , count());
835#ifdef DESKTOP_VERSION 835#ifdef DESKTOP_VERSION
836 mToolTip.append( text ); 836 mToolTip.append( text );
837#endif 837#endif
838} 838}
839void MonthViewCell::repaintfinishUpdateCell() 839void MonthViewCell::repaintfinishUpdateCell()
840{ 840{
841 MonthViewItem *mitem = (MonthViewItem*) firstItem (); 841 MonthViewItem *mitem = (MonthViewItem*) firstItem ();
842 while ( mitem ) { 842 while ( mitem ) {
843 mitem->setBlockRepaint( false ); 843 mitem->setBlockRepaint( false );
844 updateItem ( mitem ); 844 updateItem ( mitem );
845 mitem = (MonthViewItem *)mitem->next(); 845 mitem = (MonthViewItem *)mitem->next();
846 } 846 }
847} 847}
848void MonthViewCell::finishUpdateCell() 848void MonthViewCell::finishUpdateCell()
849{ 849{
850 850
851 851
852 852
853#ifdef DESKTOP_VERSION 853#ifdef DESKTOP_VERSION
854 if (mToolTip.count() > 0 ) { 854 if (mToolTip.count() > 0 ) {
855 mToolTip.sort(); 855 mToolTip.sort();
856 QToolTip::add(this,mToolTip.join("\n"),toolTipGroup(),""); 856 QToolTip::add(this,mToolTip.join("\n"),toolTipGroup(),"");
857 } 857 }
858#endif 858#endif
859 //sort(); 859 //sort();
860 //setMyPalette(); 860 //setMyPalette();
861 setMyPalette(); 861 setMyPalette();
862 862
863 resizeEvent( 0 ); 863 resizeEvent( 0 );
864 864
865} 865}
866void MonthViewCell::updateCell() 866void MonthViewCell::updateCell()
867{ 867{
868 if ( !mMonthView->isUpdatePossible() ) 868 if ( !mMonthView->isUpdatePossible() )
869 return; 869 return;
870 startUpdateCell(); 870 startUpdateCell();
871 //mLabel->setMaximumWidth( width() - mItemList->lineWidth()*2); 871 //mLabel->setMaximumWidth( width() - mItemList->lineWidth()*2);
872 QPtrList<Event> events = mMonthView->calendar()->events( mDate, true ); 872 QPtrList<Event> events = mMonthView->calendar()->events( mDate, true );
873 Event *event; 873 Event *event;
874 for( event = events.first(); event; event = events.next() ) { // for event 874 for( event = events.first(); event; event = events.next() ) { // for event
875 insertEvent(event); 875 insertEvent(event);
876 } 876 }
877 // insert due todos 877 // insert due todos
878 QPtrList<Todo> todos = mMonthView->calendar()->todos( mDate ); 878 QPtrList<Todo> todos = mMonthView->calendar()->todos( mDate );
879 Todo *todo; 879 Todo *todo;
880 for(todo = todos.first(); todo; todo = todos.next()) { 880 for(todo = todos.first(); todo; todo = todos.next()) {
diff --git a/korganizer/kotodoview.cpp b/korganizer/kotodoview.cpp
index 2602487..35c2a9f 100644
--- a/korganizer/kotodoview.cpp
+++ b/korganizer/kotodoview.cpp
@@ -659,97 +659,97 @@ void KOTodoView::updateView()
659 659
660 660
661 mTodoListView->clear(); 661 mTodoListView->clear();
662 if ( mName == "todolistsmall" ) { 662 if ( mName == "todolistsmall" ) {
663 if ( KOPrefs::instance()->mTodoViewUsesSmallFont ) { 663 if ( KOPrefs::instance()->mTodoViewUsesSmallFont ) {
664 int ps = fo.pointSize() -2; 664 int ps = fo.pointSize() -2;
665 if ( ps > 12 ) 665 if ( ps > 12 )
666 ps -= 2; 666 ps -= 2;
667 fo.setPointSize( ps ); 667 fo.setPointSize( ps );
668 } 668 }
669 } 669 }
670 670
671 mTodoListView->setFont( fo ); 671 mTodoListView->setFont( fo );
672 // QFontMetrics fm ( KOPrefs::instance()->mTodoViewFont ); 672 // QFontMetrics fm ( KOPrefs::instance()->mTodoViewFont );
673 //mTodoListView->header()->setMaximumHeight(fm.height()); 673 //mTodoListView->header()->setMaximumHeight(fm.height());
674 QPtrList<Todo> todoList = calendar()->todos(); 674 QPtrList<Todo> todoList = calendar()->todos();
675 675
676/* 676/*
677 kdDebug() << "KOTodoView::updateView(): Todo List:" << endl; 677 kdDebug() << "KOTodoView::updateView(): Todo List:" << endl;
678 Event *t; 678 Event *t;
679 for(t = todoList.first(); t; t = todoList.next()) { 679 for(t = todoList.first(); t; t = todoList.next()) {
680 kdDebug() << " " << t->getSummary() << endl; 680 kdDebug() << " " << t->getSummary() << endl;
681 681
682 if (t->getRelatedTo()) { 682 if (t->getRelatedTo()) {
683 kdDebug() << " (related to " << t->getRelatedTo()->getSummary() << ")" << endl; 683 kdDebug() << " (related to " << t->getRelatedTo()->getSummary() << ")" << endl;
684 } 684 }
685 685
686 QPtrList<Event> l = t->getRelations(); 686 QPtrList<Event> l = t->getRelations();
687 Event *c; 687 Event *c;
688 for(c=l.first();c;c=l.next()) { 688 for(c=l.first();c;c=l.next()) {
689 kdDebug() << " - relation: " << c->getSummary() << endl; 689 kdDebug() << " - relation: " << c->getSummary() << endl;
690 } 690 }
691 } 691 }
692*/ 692*/
693 693
694 // Put for each Event a KOTodoViewItem in the list view. Don't rely on a 694 // Put for each Event a KOTodoViewItem in the list view. Don't rely on a
695 // specific order of events. That means that we have to generate parent items 695 // specific order of events. That means that we have to generate parent items
696 // recursively for proper hierarchical display of Todos. 696 // recursively for proper hierarchical display of Todos.
697 mTodoMap.clear(); 697 mTodoMap.clear();
698 Todo *todo; 698 Todo *todo;
699 todo = todoList.first();// todo; todo = todoList.next()) { 699 todo = todoList.first();// todo; todo = todoList.next()) {
700 while ( todo ) { 700 while ( todo ) {
701 bool next = true; 701 bool next = true;
702 // qDebug("todo %s ", todo->summary().latin1()); 702 // qDebug("todo %s ", todo->summary().latin1());
703 Incidence *incidence = todo->relatedTo(); 703 Incidence *incidence = todo->relatedTo();
704 while ( incidence ) { 704 while ( incidence ) {
705 if ( incidence->typeID() == todoID ) { 705 if ( incidence->typeID() == todoID ) {
706 //qDebug("related %s ",incidence->summary().latin1() ); 706 //qDebug("related %s ",incidence->summary().latin1() );
707 if ( !(todoList.contains ( ((Todo* )incidence ) ) )) { 707 if ( !(todoList.contains ( ((Todo* )incidence ) ) ) && incidence->calEnabled() ) {
708 //qDebug("related not found "); 708 //qDebug("related not found ");
709 todoList.remove( ); 709 todoList.remove( );
710 todo = todoList.current(); 710 todo = todoList.current();
711 next = false; 711 next = false;
712 incidence = 0; 712 incidence = 0;
713 713
714 } else { 714 } else {
715 //qDebug("related found "); 715 //qDebug("related found ");
716 incidence = incidence->relatedTo(); 716 incidence = incidence->relatedTo();
717 } 717 }
718 } else 718 } else
719 incidence = 0; 719 incidence = 0;
720 } 720 }
721 if ( next ) 721 if ( next )
722 todo = todoList.next(); 722 todo = todoList.next();
723 } 723 }
724 724
725 for(todo = todoList.first(); todo; todo = todoList.next()) { 725 for(todo = todoList.first(); todo; todo = todoList.next()) {
726 if (!mTodoMap.contains(todo) && checkTodo( todo ) ) 726 if (!mTodoMap.contains(todo) && checkTodo( todo ) )
727 { 727 {
728 insertTodoItem(todo); 728 insertTodoItem(todo);
729 } 729 }
730 } 730 }
731 // Restore opened/closed state 731 // Restore opened/closed state
732 mTodoListView->blockSignals( true ); 732 mTodoListView->blockSignals( true );
733 if( mDocPrefs ) restoreItemState( mTodoListView->firstChild() ); 733 if( mDocPrefs ) restoreItemState( mTodoListView->firstChild() );
734 mTodoListView->blockSignals( false ); 734 mTodoListView->blockSignals( false );
735 resetCurrentItem(); 735 resetCurrentItem();
736 processSelectionChange(); 736 processSelectionChange();
737} 737}
738 738
739void KOTodoView::storeCurrentItem() 739void KOTodoView::storeCurrentItem()
740{ 740{
741 mCurItem = 0; 741 mCurItem = 0;
742 mCurItemRootParent = 0; 742 mCurItemRootParent = 0;
743 mCurItemParent = 0; 743 mCurItemParent = 0;
744 mCurItemAbove = 0; 744 mCurItemAbove = 0;
745 mActiveItem = (KOTodoViewItem*)mTodoListView->currentItem(); 745 mActiveItem = (KOTodoViewItem*)mTodoListView->currentItem();
746 if (mActiveItem) { 746 if (mActiveItem) {
747 mCurItem = mActiveItem->todo(); 747 mCurItem = mActiveItem->todo();
748 KOTodoViewItem* activeItemAbove = (KOTodoViewItem*)mActiveItem->itemAbove (); 748 KOTodoViewItem* activeItemAbove = (KOTodoViewItem*)mActiveItem->itemAbove ();
749 if ( activeItemAbove ) 749 if ( activeItemAbove )
750 mCurItemAbove = activeItemAbove->todo(); 750 mCurItemAbove = activeItemAbove->todo();
751 mCurItemRootParent = mCurItem; 751 mCurItemRootParent = mCurItem;
752 mCurItemParent = mCurItemRootParent->relatedTo(); 752 mCurItemParent = mCurItemRootParent->relatedTo();
753 while ( mCurItemRootParent->relatedTo() != 0 ) 753 while ( mCurItemRootParent->relatedTo() != 0 )
754 mCurItemRootParent = mCurItemRootParent->relatedTo(); 754 mCurItemRootParent = mCurItemRootParent->relatedTo();
755 } 755 }
@@ -799,96 +799,98 @@ void KOTodoView::resetCurrentItem()
799 } else { 799 } else {
800 mTodoListView->setCurrentItem( mTodoListView->firstChild () ); 800 mTodoListView->setCurrentItem( mTodoListView->firstChild () );
801 } 801 }
802 } 802 }
803 mTodoListView->setFocus(); 803 mTodoListView->setFocus();
804} 804}
805//Incidence * mCurItem, *mCurItemRootParent,*mCurItemAbove; 805//Incidence * mCurItem, *mCurItemRootParent,*mCurItemAbove;
806bool KOTodoView::checkTodo( Todo * todo ) 806bool KOTodoView::checkTodo( Todo * todo )
807{ 807{
808 808
809 if ( !KOPrefs::instance()->mShowCompletedTodo && todo->isCompleted() ) 809 if ( !KOPrefs::instance()->mShowCompletedTodo && todo->isCompleted() )
810 return false; 810 return false;
811 if ( !todo->isCompleted() ) { 811 if ( !todo->isCompleted() ) {
812 if ( todo->hasDueDate() && todo->dtDue().date() <= QDate::currentDate() ) 812 if ( todo->hasDueDate() && todo->dtDue().date() <= QDate::currentDate() )
813 return true; 813 return true;
814 } 814 }
815 if ( KOPrefs::instance()->mHideNonStartedTodos && mNavigator ) { 815 if ( KOPrefs::instance()->mHideNonStartedTodos && mNavigator ) {
816 if ( todo->hasStartDate() ) 816 if ( todo->hasStartDate() )
817 if ( mNavigator->selectedDates().last() < todo->dtStart().date() ) 817 if ( mNavigator->selectedDates().last() < todo->dtStart().date() )
818 return false; 818 return false;
819 if ( todo->hasDueDate() ) 819 if ( todo->hasDueDate() )
820 if ( mNavigator->selectedDates().first() > todo->dtDue().date() ) 820 if ( mNavigator->selectedDates().first() > todo->dtDue().date() )
821 return false; 821 return false;
822 } 822 }
823 return true; 823 return true;
824} 824}
825 825
826void KOTodoView::restoreItemState( QListViewItem *item ) 826void KOTodoView::restoreItemState( QListViewItem *item )
827{ 827{
828 pendingSubtodo = 0; 828 pendingSubtodo = 0;
829 while( item ) { 829 while( item ) {
830 KOTodoViewItem *todoItem = (KOTodoViewItem *)item; 830 KOTodoViewItem *todoItem = (KOTodoViewItem *)item;
831 todoItem->setOpen( mDocPrefs->readBoolEntry( todoItem->todo()->uid() ) ); 831 todoItem->setOpen( mDocPrefs->readBoolEntry( todoItem->todo()->uid() ) );
832 if( item->childCount() > 0 ) restoreItemState( item->firstChild() ); 832 if( item->childCount() > 0 ) restoreItemState( item->firstChild() );
833 item = item->nextSibling(); 833 item = item->nextSibling();
834 } 834 }
835} 835}
836 836
837 837
838QMap<Todo *,KOTodoViewItem *>::ConstIterator 838QMap<Todo *,KOTodoViewItem *>::ConstIterator
839 KOTodoView::insertTodoItem(Todo *todo) 839 KOTodoView::insertTodoItem(Todo *todo)
840{ 840{
841 841
842// kdDebug() << "KOTodoView::insertTodoItem(): " << todo->getSummary() << endl; 842// kdDebug() << "KOTodoView::insertTodoItem(): " << todo->getSummary() << endl;
843 // TODO: Check, if dynmaic cast is necessary 843 // TODO: Check, if dynmaic cast is necessary
844 844
845 pendingSubtodo = 0; 845 pendingSubtodo = 0;
846 Incidence *incidence = todo->relatedTo(); 846 Incidence *incidence = todo->relatedTo();
847 while ( incidence && !incidence->calEnabled() )
848 incidence = incidence->relatedTo();
847 if (incidence && incidence->typeID() == todoID ) { 849 if (incidence && incidence->typeID() == todoID ) {
848 Todo *relatedTodo = static_cast<Todo *>(incidence); 850 Todo *relatedTodo = static_cast<Todo *>(incidence);
849 851
850// kdDebug() << " has Related" << endl; 852// kdDebug() << " has Related" << endl;
851 QMap<Todo *,KOTodoViewItem *>::ConstIterator itemIterator; 853 QMap<Todo *,KOTodoViewItem *>::ConstIterator itemIterator;
852 itemIterator = mTodoMap.find(relatedTodo); 854 itemIterator = mTodoMap.find(relatedTodo);
853 if (itemIterator == mTodoMap.end()) { 855 if (itemIterator == mTodoMap.end()) {
854// kdDebug() << " related not yet in list" << endl; 856// kdDebug() << " related not yet in list" << endl;
855 itemIterator = insertTodoItem (relatedTodo); 857 itemIterator = insertTodoItem (relatedTodo);
856 } 858 }
857 // isn't this pretty stupid? We give one Todo to the KOTodoViewItem 859 // isn't this pretty stupid? We give one Todo to the KOTodoViewItem
858 // and one into the map. Sure finding is more easy but why? -zecke 860 // and one into the map. Sure finding is more easy but why? -zecke
859 KOTodoViewItem *todoItem = new KOTodoViewItem(*itemIterator,todo,this); 861 KOTodoViewItem *todoItem = new KOTodoViewItem(*itemIterator,todo,this);
860 return mTodoMap.insert(todo,todoItem); 862 return mTodoMap.insert(todo,todoItem);
861 } else { 863 } else {
862// kdDebug() << " no Related" << endl; 864// kdDebug() << " no Related" << endl;
863 // see above -zecke 865 // see above -zecke
864 KOTodoViewItem *todoItem = new KOTodoViewItem(mTodoListView,todo,this); 866 KOTodoViewItem *todoItem = new KOTodoViewItem(mTodoListView,todo,this);
865 return mTodoMap.insert(todo,todoItem); 867 return mTodoMap.insert(todo,todoItem);
866 } 868 }
867} 869}
868 870
869 871
870void KOTodoView::updateConfig() 872void KOTodoView::updateConfig()
871{ 873{
872 updateView(); 874 updateView();
873 mTodoListView->repaintContents(); 875 mTodoListView->repaintContents();
874} 876}
875 877
876QPtrList<Incidence> KOTodoView::selectedIncidences() 878QPtrList<Incidence> KOTodoView::selectedIncidences()
877{ 879{
878 QPtrList<Incidence> selected; 880 QPtrList<Incidence> selected;
879 881
880 KOTodoViewItem *item = (KOTodoViewItem *)(mTodoListView->selectedItem()); 882 KOTodoViewItem *item = (KOTodoViewItem *)(mTodoListView->selectedItem());
881// if (!item) item = mActiveItem; 883// if (!item) item = mActiveItem;
882 if (item) selected.append(item->todo()); 884 if (item) selected.append(item->todo());
883 885
884 return selected; 886 return selected;
885} 887}
886 888
887QPtrList<Todo> KOTodoView::selectedTodos() 889QPtrList<Todo> KOTodoView::selectedTodos()
888{ 890{
889 QPtrList<Todo> selected; 891 QPtrList<Todo> selected;
890 892
891 KOTodoViewItem *item = (KOTodoViewItem *)(mTodoListView->selectedItem()); 893 KOTodoViewItem *item = (KOTodoViewItem *)(mTodoListView->selectedItem());
892// if (!item) item = mActiveItem; 894// if (!item) item = mActiveItem;
893 if (item) selected.append(item->todo()); 895 if (item) selected.append(item->todo());
894 896
diff --git a/korganizer/kotodoviewitem.cpp b/korganizer/kotodoviewitem.cpp
index 8cb6b83..f987b63 100644
--- a/korganizer/kotodoviewitem.cpp
+++ b/korganizer/kotodoviewitem.cpp
@@ -150,97 +150,97 @@ void KOTodoViewItem::construct()
150 } 150 }
151 setText(5,keyd); 151 setText(5,keyd);
152 setText(6,keyt); 152 setText(6,keyt);
153 setSortKey(5,skeyd); 153 setSortKey(5,skeyd);
154 setSortKey(6,skeyt); 154 setSortKey(6,skeyt);
155 155
156 setText(7,mTodo->cancelled() ? i18n("Yes") : i18n("No")); 156 setText(7,mTodo->cancelled() ? i18n("Yes") : i18n("No"));
157 setText(8,mTodo->categoriesStr()); 157 setText(8,mTodo->categoriesStr());
158 158
159#if 0 159#if 0
160 // Find sort id in description. It's the text behind the last '#' character 160 // Find sort id in description. It's the text behind the last '#' character
161 // found in the description. White spaces are removed from beginning and end 161 // found in the description. White spaces are removed from beginning and end
162 // of sort id. 162 // of sort id.
163 int pos = mTodo->description().findRev('#'); 163 int pos = mTodo->description().findRev('#');
164 if (pos < 0) { 164 if (pos < 0) {
165 setText(6,""); 165 setText(6,"");
166 } else { 166 } else {
167 QString str = mTodo->description().mid(pos+1); 167 QString str = mTodo->description().mid(pos+1);
168 str.stripWhiteSpace(); 168 str.stripWhiteSpace();
169 setText(6,str); 169 setText(6,str);
170 } 170 }
171#endif 171#endif
172 172
173 m_known = false; 173 m_known = false;
174 m_init = false; 174 m_init = false;
175 175
176 setMyPixmap(); 176 setMyPixmap();
177 177
178} 178}
179void KOTodoViewItem::setMyPixmap() 179void KOTodoViewItem::setMyPixmap()
180{ 180{
181 int size = 5; 181 int size = 5;
182 QPixmap pixi = QPixmap( 1, 1 ); 182 QPixmap pixi = QPixmap( 1, 1 );
183 // if ( !mTodo->isCompleted() && mTodo->hasDueDate() && mTodo->dtDue() < QDateTime::currentDateTime() ) { 183 // if ( !mTodo->isCompleted() && mTodo->hasDueDate() && mTodo->dtDue() < QDateTime::currentDateTime() ) {
184// pixi = SmallIcon("redcross16"); 184// pixi = SmallIcon("redcross16");
185// } else { 185// } else {
186 QPainter p; 186 QPainter p;
187 187
188 int pixSize = 0; 188 int pixSize = 0;
189 QPixmap pPix = QPixmap( size, size ); 189 QPixmap pPix = QPixmap( size, size );
190 if ( mTodo->description().length() > 0 ) { 190 if ( mTodo->description().length() > 0 ) {
191 pixi.resize(size, pixSize+size); 191 pixi.resize(size, pixSize+size);
192 pPix.fill( Qt::darkGreen ); 192 pPix.fill( Qt::darkGreen );
193 p.begin( &pixi ); 193 p.begin( &pixi );
194 p. drawPixmap ( 0, pixSize, pPix); 194 p. drawPixmap ( 0, pixSize, pPix);
195 p.end(); 195 p.end();
196 pixSize += size; 196 pixSize += size;
197 } 197 }
198 if ( mTodo->isAlarmEnabled() ) { 198 if ( mTodo->isAlarmEnabled() && mTodo->alarmEnabled()) {
199 pixi.resize(size, pixSize+size); 199 pixi.resize(size, pixSize+size);
200 pPix.fill( Qt::red ); 200 pPix.fill( Qt::red );
201 p.begin( &pixi ); 201 p.begin( &pixi );
202 p. drawPixmap ( 0, pixSize, pPix); 202 p. drawPixmap ( 0, pixSize, pPix);
203 p.end(); 203 p.end();
204 pixSize += size; 204 pixSize += size;
205 } 205 }
206 if ( mTodo->doesRecur() ) { 206 if ( mTodo->doesRecur() ) {
207 pixi.resize(size, pixSize+size); 207 pixi.resize(size, pixSize+size);
208 pPix.fill( Qt::blue ); 208 pPix.fill( Qt::blue );
209 p.begin( &pixi ); 209 p.begin( &pixi );
210 p. drawPixmap ( 0, pixSize, pPix); 210 p. drawPixmap ( 0, pixSize, pPix);
211 p.end(); 211 p.end();
212 pixSize += size; 212 pixSize += size;
213 } 213 }
214 // } 214 // }
215 if ( pixi.width() > 1 ) { 215 if ( pixi.width() > 1 ) {
216 setPixmap ( 0,pixi ) ; 216 setPixmap ( 0,pixi ) ;
217 } else { 217 } else {
218 setPixmap ( 0,QPixmap() ) ; 218 setPixmap ( 0,QPixmap() ) ;
219 } 219 }
220} 220}
221void KOTodoViewItem::stateChange(bool state) 221void KOTodoViewItem::stateChange(bool state)
222{ 222{
223 // qDebug("KOTodoViewItem::stateChange %d ", state); 223 // qDebug("KOTodoViewItem::stateChange %d ", state);
224 // do not change setting on startup 224 // do not change setting on startup
225 if ( m_init ) return; 225 if ( m_init ) return;
226 if (isOn()!=state) { 226 if (isOn()!=state) {
227 setOn(state); 227 setOn(state);
228 //qDebug("SETON "); 228 //qDebug("SETON ");
229 return; 229 return;
230 } 230 }
231 if ( mTodo->isCompleted() == state ) { 231 if ( mTodo->isCompleted() == state ) {
232 //qDebug("STATECHANGE:nothing to do "); 232 //qDebug("STATECHANGE:nothing to do ");
233 return; 233 return;
234 } 234 }
235 QString keyd = "=="; 235 QString keyd = "==";
236 QString keyt = "=="; 236 QString keyt = "==";
237 //qDebug("KOTodoViewItem::stateChange %s ", text(0).latin1()); 237 //qDebug("KOTodoViewItem::stateChange %s ", text(0).latin1());
238 if ( mTodo->doesRecur() ){ 238 if ( mTodo->doesRecur() ){
239 QDateTime start = mTodo->dtStart(); 239 QDateTime start = mTodo->dtStart();
240 mTodo->setCompleted(state); 240 mTodo->setCompleted(state);
241 if ( start != mTodo->dtStart() ) { 241 if ( start != mTodo->dtStart() ) {
242 if ( state && !mTodo->isCompleted() ) { 242 if ( state && !mTodo->isCompleted() ) {
243 setOn( false ); 243 setOn( false );
244 state = false; 244 state = false;
245 } 245 }
246 } 246 }
diff --git a/korganizer/kowhatsnextview.cpp b/korganizer/kowhatsnextview.cpp
index e8574a0..221debc 100644
--- a/korganizer/kowhatsnextview.cpp
+++ b/korganizer/kowhatsnextview.cpp
@@ -550,171 +550,171 @@ bool KOWhatsNextView::appendEvent(Incidence *ev, bool reply, bool notRed, bool a
550 550
551 } else { 551 } else {
552 if ( bDay ) { 552 if ( bDay ) {
553 553
554 if ( ev->isBirthday()) 554 if ( ev->isBirthday())
555 tempText += "<font color=\"#00B000\">" + i18n("Birthday") +":</font>"; 555 tempText += "<font color=\"#00B000\">" + i18n("Birthday") +":</font>";
556 else 556 else
557 tempText += "<font color=\"#00B0000\">" + i18n("Anniversary")+":</font>"; 557 tempText += "<font color=\"#00B0000\">" + i18n("Anniversary")+":</font>";
558 } else { 558 } else {
559 tempText += i18n("Allday:"); 559 tempText += i18n("Allday:");
560 } 560 }
561 561
562 } 562 }
563 } 563 }
564 } else { 564 } else {
565 mTodos.append( ev ); 565 mTodos.append( ev );
566 tempText += i18n("ToDo:"); 566 tempText += i18n("ToDo:");
567 if (reply) { 567 if (reply) {
568 tempText += " "; 568 tempText += " ";
569 if ( noc != cdt ) { 569 if ( noc != cdt ) {
570 tempText += KGlobal::locale()->formatDate( noc.date() , KOPrefs::instance()->mShortDateInViewer) +": "; 570 tempText += KGlobal::locale()->formatDate( noc.date() , KOPrefs::instance()->mShortDateInViewer) +": ";
571 } 571 }
572 } else { 572 } else {
573 if ( ((Todo*)ev)->dtDue().date() < QDate::currentDate() ) { 573 if ( ((Todo*)ev)->dtDue().date() < QDate::currentDate() ) {
574 // tempText +="<font color=\"#F00000\">" + i18n("O-due!") + "</font>"; 574 // tempText +="<font color=\"#F00000\">" + i18n("O-due!") + "</font>";
575 QString dfs = KGlobal::locale()->dateFormatShort(); 575 QString dfs = KGlobal::locale()->dateFormatShort();
576 KGlobal::locale()->setDateFormatShort("%d.%b"); 576 KGlobal::locale()->setDateFormatShort("%d.%b");
577 tempText +="<font color=\"#F00000\">" + KGlobal::locale()->formatDate(((Todo*)ev)->dtDue().date(), true, KLocale::Userdefined) + "</font>"; 577 tempText +="<font color=\"#F00000\">" + KGlobal::locale()->formatDate(((Todo*)ev)->dtDue().date(), true, KLocale::Userdefined) + "</font>";
578 KGlobal::locale()->setDateFormatShort(dfs); 578 KGlobal::locale()->setDateFormatShort(dfs);
579 } else { 579 } else {
580 if (!ev->doesFloat() ) 580 if (!ev->doesFloat() )
581 if( ( (Todo*)ev)->dtDue() < cdt ) { 581 if( ( (Todo*)ev)->dtDue() < cdt ) {
582 tempText +="<font color=\"#F00000\">" + ((Todo*)ev)->dtDueTimeStr() + "</font>"; 582 tempText +="<font color=\"#F00000\">" + ((Todo*)ev)->dtDueTimeStr() + "</font>";
583 583
584 584
585 } else 585 } else
586 tempText +=((Todo*)ev)->dtDueTimeStr(); 586 tempText +=((Todo*)ev)->dtDueTimeStr();
587 mTodos.append( ev ); 587 mTodos.append( ev );
588 } 588 }
589 } 589 }
590 } 590 }
591 tempText += "</b></td><td>"; 591 tempText += "</b></td><td>";
592 bool needClose = false; 592 bool needClose = false;
593 if ( ev->cancelled() ) { 593 if ( ev->cancelled() ) {
594 tempText += "<font color=\"#F00000\">[c"; 594 tempText += "<font color=\"#F00000\">[c";
595 needClose =true; 595 needClose =true;
596 596
597 } 597 }
598 if ( ev->isAlarmEnabled() ) { 598 if ( ev->isAlarmEnabled() && ev->alarmEnabled()) {
599 if ( !needClose) 599 if ( !needClose)
600 tempText +="["; 600 tempText +="[";
601 tempText += "a"; 601 tempText += "a";
602 needClose =true; 602 needClose =true;
603 603
604 } 604 }
605 if ( ev->description().length() > 0 ) { 605 if ( ev->description().length() > 0 ) {
606 if ( !needClose) 606 if ( !needClose)
607 tempText +="["; 607 tempText +="[";
608 tempText += "i"; 608 tempText += "i";
609 needClose =true; 609 needClose =true;
610 } 610 }
611 if ( ev->recurrence()->doesRecur() ) { 611 if ( ev->recurrence()->doesRecur() ) {
612 if ( !needClose) 612 if ( !needClose)
613 tempText +="["; 613 tempText +="[";
614 tempText += "r"; 614 tempText += "r";
615 needClose =true; 615 needClose =true;
616 } 616 }
617 if ( needClose ) { 617 if ( needClose ) {
618 tempText += "] "; 618 tempText += "] ";
619 } 619 }
620 if ( ev->cancelled() ) 620 if ( ev->cancelled() )
621 tempText += "</font>"; 621 tempText += "</font>";
622 tempText += "<a "; 622 tempText += "<a ";
623 if (ev->typeID() == eventID ) tempText += "href=\"event:"; 623 if (ev->typeID() == eventID ) tempText += "href=\"event:";
624 if (ev->typeID() == todoID ) tempText += "href=\"todo:"; 624 if (ev->typeID() == todoID ) tempText += "href=\"todo:";
625 tempText += ev->uid() + "\">"; 625 tempText += ev->uid() + "\">";
626 if ( ev->summary().length() > 0 ) 626 if ( ev->summary().length() > 0 )
627 tempText += ev->summary(); 627 tempText += ev->summary();
628 else 628 else
629 tempText += i18n("-no summary-"); 629 tempText += i18n("-no summary-");
630 if ( bDay ) { 630 if ( bDay ) {
631 noc = ev->getNextOccurence( cdt.addDays(-1), &ok ); 631 noc = ev->getNextOccurence( cdt.addDays(-1), &ok );
632 if ( ok ) { 632 if ( ok ) {
633 int years = 0; 633 int years = 0;
634 if ( ev->typeID() == todoID ) { 634 if ( ev->typeID() == todoID ) {
635 years = noc.date().year() -((Todo*)ev)->dtDue().date().year(); 635 years = noc.date().year() -((Todo*)ev)->dtDue().date().year();
636 } else 636 } else
637 years = noc.date().year() - ev->dtStart().date().year(); 637 years = noc.date().year() - ev->dtStart().date().year();
638 tempText += i18n(" (%1 y.)"). arg( years ); 638 tempText += i18n(" (%1 y.)"). arg( years );
639 } 639 }
640 } 640 }
641 641
642 tempText += "</a>"; 642 tempText += "</a>";
643 if ( KOPrefs::instance()->mWNViewShowLocation ) 643 if ( KOPrefs::instance()->mWNViewShowLocation )
644 if ( !ev->location().isEmpty() ) 644 if ( !ev->location().isEmpty() )
645 tempText += " ("+ev->location() +")"; 645 tempText += " ("+ev->location() +")";
646 if ( ev->relatedTo() && KOPrefs::instance()->mWNViewShowsParents) 646 if ( ev->relatedTo() && KOPrefs::instance()->mWNViewShowsParents)
647 tempText += " ["+ev->relatedTo()->summary() +"]"; 647 tempText += " ["+ev->relatedTo()->summary() +"]";
648 tempText += "</td></tr>\n"; 648 tempText += "</td></tr>\n";
649 mText += tempText; 649 mText += tempText;
650 return true; 650 return true;
651} 651}
652 652
653bool KOWhatsNextView::appendTodo(Incidence *ev, QString ind , bool isSub ) 653bool KOWhatsNextView::appendTodo(Incidence *ev, QString ind , bool isSub )
654{ 654{
655 if ( mTodos.find( ev ) != mTodos.end() ) return false; 655 if ( mTodos.find( ev ) != mTodos.end() ) return false;
656 656
657 mTodos.append( ev ); 657 mTodos.append( ev );
658 if ( !isSub ) 658 if ( !isSub )
659 mText += "<p>"; 659 mText += "<p>";
660 else 660 else
661 mText += "<li>"; 661 mText += "<li>";
662 mText += "[" +QString::number(ev->priority()) + "/" + QString::number(((Todo*)ev)->percentComplete())+"%] "; 662 mText += "[" +QString::number(ev->priority()) + "/" + QString::number(((Todo*)ev)->percentComplete())+"%] ";
663 663
664 664
665 mText += ind; 665 mText += ind;
666 bool needClose = false; 666 bool needClose = false;
667 if ( ev->cancelled() ) { 667 if ( ev->cancelled() ) {
668 mText += "<font color=\"#F00000\">[c"; 668 mText += "<font color=\"#F00000\">[c";
669 needClose =true; 669 needClose =true;
670 670
671 } 671 }
672 if ( ev->isAlarmEnabled() ) { 672 if ( ev->isAlarmEnabled() && ev->alarmEnabled() ) {
673 if ( !needClose) 673 if ( !needClose)
674 mText +="["; 674 mText +="[";
675 mText += "a"; 675 mText += "a";
676 needClose =true; 676 needClose =true;
677 677
678 } 678 }
679 679
680 if ( ev->description().length() > 0 ) { 680 if ( ev->description().length() > 0 ) {
681 if ( !needClose) 681 if ( !needClose)
682 mText +="["; 682 mText +="[";
683 mText += "i"; 683 mText += "i";
684 needClose =true; 684 needClose =true;
685 } 685 }
686 if ( ev->doesRecur() ) { 686 if ( ev->doesRecur() ) {
687 if ( !needClose) 687 if ( !needClose)
688 mText +="["; 688 mText +="[";
689 mText += "r"; 689 mText += "r";
690 needClose =true; 690 needClose =true;
691 } 691 }
692 // if ( ev->recurrence()->doesRecur() ) { 692 // if ( ev->recurrence()->doesRecur() ) {
693 // if ( !needClose) 693 // if ( !needClose)
694 // mText +="("; 694 // mText +="(";
695 // mText += "r"; 695 // mText += "r";
696 // needClose =true; 696 // needClose =true;
697 // } 697 // }
698 if ( needClose ) 698 if ( needClose )
699 mText += "] "; 699 mText += "] ";
700 if ( ev->cancelled() ) 700 if ( ev->cancelled() )
701 mText += "</font>"; 701 mText += "</font>";
702 mText += "<a href=\"todo:" + ev->uid() + "\">"; 702 mText += "<a href=\"todo:" + ev->uid() + "\">";
703 if ( ev->summary().length() > 0 ) 703 if ( ev->summary().length() > 0 )
704 mText += ev->summary(); 704 mText += ev->summary();
705 else 705 else
706 mText += i18n("-no summary-"); 706 mText += i18n("-no summary-");
707 mText += "</a>"; 707 mText += "</a>";
708 if ( ((Todo*)ev)->hasDueDate () ) { 708 if ( ((Todo*)ev)->hasDueDate () ) {
709 QString year = ""; 709 QString year = "";
710 int ye = ((Todo*)ev)->dtDue().date().year(); 710 int ye = ((Todo*)ev)->dtDue().date().year();
711 if ( QDateTime::currentDateTime().date().year() != ye ) 711 if ( QDateTime::currentDateTime().date().year() != ye )
712 year = QString::number( ye ); 712 year = QString::number( ye );
713 QString dfs = KGlobal::locale()->dateFormatShort(); 713 QString dfs = KGlobal::locale()->dateFormatShort();
714 KGlobal::locale()->setDateFormatShort("%d.%b"); 714 KGlobal::locale()->setDateFormatShort("%d.%b");
715 mText +="<font color=\"#00A000\"> [" + KGlobal::locale()->formatDate(((Todo*)ev)->dtDue().date(), true, KLocale::Userdefined) + "."+ year +"]</font>"; 715 mText +="<font color=\"#00A000\"> [" + KGlobal::locale()->formatDate(((Todo*)ev)->dtDue().date(), true, KLocale::Userdefined) + "."+ year +"]</font>";
716 KGlobal::locale()->setDateFormatShort(dfs); 716 KGlobal::locale()->setDateFormatShort(dfs);
717 } 717 }
718 if ( KOPrefs::instance()->mWNViewShowLocation ) 718 if ( KOPrefs::instance()->mWNViewShowLocation )
719 if ( !ev->location().isEmpty() ) 719 if ( !ev->location().isEmpty() )
720 mText += " ("+ev->location() +")"; 720 mText += " ("+ev->location() +")";
diff --git a/libkcal/alarm.cpp b/libkcal/alarm.cpp
index 0afa0a7..79e0464 100644
--- a/libkcal/alarm.cpp
+++ b/libkcal/alarm.cpp
@@ -326,96 +326,98 @@ void Alarm::setText(const QString &text)
326QString Alarm::text() const 326QString Alarm::text() const
327{ 327{
328 return (mType == Display) ? mDescription : QString::null; 328 return (mType == Display) ? mDescription : QString::null;
329} 329}
330 330
331void Alarm::setTime(const QDateTime &alarmTime) 331void Alarm::setTime(const QDateTime &alarmTime)
332{ 332{
333 mAlarmTime = alarmTime; 333 mAlarmTime = alarmTime;
334 mHasTime = true; 334 mHasTime = true;
335 335
336 mParent->updated(); 336 mParent->updated();
337} 337}
338int Alarm::offset() 338int Alarm::offset()
339{ 339{
340 if ( hasTime() ) { 340 if ( hasTime() ) {
341 if (mParent->typeID() == todoID ) { 341 if (mParent->typeID() == todoID ) {
342 Todo *t = static_cast<Todo*>(mParent); 342 Todo *t = static_cast<Todo*>(mParent);
343 return t->dtDue().secsTo( mAlarmTime ) ; 343 return t->dtDue().secsTo( mAlarmTime ) ;
344 } else 344 } else
345 return mParent->dtStart().secsTo( mAlarmTime ) ; 345 return mParent->dtStart().secsTo( mAlarmTime ) ;
346 } 346 }
347 else 347 else
348 { 348 {
349 return mOffset.asSeconds(); 349 return mOffset.asSeconds();
350 } 350 }
351 351
352} 352}
353QString Alarm::offsetText() 353QString Alarm::offsetText()
354{ 354{
355 int min = -offset()/60; 355 int min = -offset()/60;
356 int hours = min /60; 356 int hours = min /60;
357 min = min % 60; 357 min = min % 60;
358 int days = hours /24; 358 int days = hours /24;
359 hours = hours % 24; 359 hours = hours % 24;
360 QString message; 360 QString message;
361 //qDebug("%d %d %d ", days, hours, min ); 361 //qDebug("%d %d %d ", days, hours, min );
362 if ( days > 0 ) 362 if ( days > 0 )
363 message += i18n("%1d").arg( days ); 363 message += i18n("%1d").arg( days );
364 if ( hours > 0 ) { 364 if ( hours > 0 ) {
365 if ( !message.isEmpty() ) message += "/"; 365 if ( !message.isEmpty() ) message += "/";
366 message += i18n("%1h").arg( hours ); 366 message += i18n("%1h").arg( hours );
367 } 367 }
368 if ( min > 0 ) { 368 if ( min > 0 ) {
369 if ( !message.isEmpty() ) message += "/"; 369 if ( !message.isEmpty() ) message += "/";
370 message += i18n("%1min").arg( min ); 370 message += i18n("%1min").arg( min );
371 } 371 }
372 if ( message.isEmpty() ) 372 if ( message.isEmpty() )
373 message = i18n("%1min").arg( 0 ); 373 message = i18n("%1min").arg( 0 );
374 if ( !mParent->alarmEnabled() )
375 return "!"+message + i18n("(disabled)");
374 return message; 376 return message;
375} 377}
376 378
377 379
378QDateTime Alarm::time() const 380QDateTime Alarm::time() const
379{ 381{
380 if ( hasTime() ) 382 if ( hasTime() )
381 return mAlarmTime; 383 return mAlarmTime;
382 else 384 else
383 { 385 {
384 if (mParent->typeID() == todoID ) { 386 if (mParent->typeID() == todoID ) {
385 Todo *t = static_cast<Todo*>(mParent); 387 Todo *t = static_cast<Todo*>(mParent);
386 return mOffset.end( t->dtDue() ); 388 return mOffset.end( t->dtDue() );
387 } else if (mEndOffset) { 389 } else if (mEndOffset) {
388 return mOffset.end( mParent->dtEnd() ); 390 return mOffset.end( mParent->dtEnd() );
389 } else { 391 } else {
390 return mOffset.end( mParent->dtStart() ); 392 return mOffset.end( mParent->dtStart() );
391 } 393 }
392 } 394 }
393} 395}
394 396
395bool Alarm::hasTime() const 397bool Alarm::hasTime() const
396{ 398{
397 return mHasTime; 399 return mHasTime;
398} 400}
399 401
400void Alarm::setSnoozeTime(int alarmSnoozeTime) 402void Alarm::setSnoozeTime(int alarmSnoozeTime)
401{ 403{
402 mAlarmSnoozeTime = alarmSnoozeTime; 404 mAlarmSnoozeTime = alarmSnoozeTime;
403 mParent->updated(); 405 mParent->updated();
404} 406}
405 407
406int Alarm::snoozeTime() const 408int Alarm::snoozeTime() const
407{ 409{
408 return mAlarmSnoozeTime; 410 return mAlarmSnoozeTime;
409} 411}
410 412
411void Alarm::setRepeatCount(int alarmRepeatCount) 413void Alarm::setRepeatCount(int alarmRepeatCount)
412{ 414{
413 kdDebug(5800) << "Alarm::setRepeatCount(): " << alarmRepeatCount << endl; 415 kdDebug(5800) << "Alarm::setRepeatCount(): " << alarmRepeatCount << endl;
414 416
415 mAlarmRepeatCount = alarmRepeatCount; 417 mAlarmRepeatCount = alarmRepeatCount;
416 mParent->updated(); 418 mParent->updated();
417} 419}
418 420
419int Alarm::repeatCount() const 421int Alarm::repeatCount() const
420{ 422{
421 kdDebug(5800) << "Alarm::repeatCount(): " << mAlarmRepeatCount << endl; 423 kdDebug(5800) << "Alarm::repeatCount(): " << mAlarmRepeatCount << endl;
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
@@ -267,96 +267,97 @@ public:
267 267
268 /** 268 /**
269 Set calendar filter, which filters events for the events() functions. 269 Set calendar filter, which filters events for the events() functions.
270 The Filter object is owned by the caller. 270 The Filter object is owned by the caller.
271 */ 271 */
272 void setFilter( CalFilter * ); 272 void setFilter( CalFilter * );
273 /** 273 /**
274 Return calendar filter. 274 Return calendar filter.
275 */ 275 */
276 CalFilter *filter(); 276 CalFilter *filter();
277 virtual QDateTime nextAlarm( int daysTo ) = 0; 277 virtual QDateTime nextAlarm( int daysTo ) = 0;
278 virtual QString nextSummary( ) const = 0; 278 virtual QString nextSummary( ) const = 0;
279 virtual void reInitAlarmSettings() = 0; 279 virtual void reInitAlarmSettings() = 0;
280 virtual QDateTime nextAlarmEventDateTime() const = 0; 280 virtual QDateTime nextAlarmEventDateTime() const = 0;
281 virtual void checkAlarmForIncidence( Incidence *, bool ) = 0; 281 virtual void checkAlarmForIncidence( Incidence *, bool ) = 0;
282 /** 282 /**
283 Return all alarms, which ocur in the given time interval. 283 Return all alarms, which ocur in the given time interval.
284 */ 284 */
285 virtual Alarm::List alarms( const QDateTime &from, 285 virtual Alarm::List alarms( const QDateTime &from,
286 const QDateTime &to ) = 0; 286 const QDateTime &to ) = 0;
287 287
288 class Observer { 288 class Observer {
289 public: 289 public:
290 virtual void calendarModified( bool, Calendar * ) = 0; 290 virtual void calendarModified( bool, Calendar * ) = 0;
291 }; 291 };
292 292
293 void registerObserver( Observer * ); 293 void registerObserver( Observer * );
294 294
295 void setModified( bool ); 295 void setModified( bool );
296 296
297 /** 297 /**
298 Set product id returned by loadedProductId(). This function is only 298 Set product id returned by loadedProductId(). This function is only
299 useful for the calendar loading code. 299 useful for the calendar loading code.
300 */ 300 */
301 void setLoadedProductId( const QString & ); 301 void setLoadedProductId( const QString & );
302 /** 302 /**
303 Return product id taken from file that has been loaded. Returns 303 Return product id taken from file that has been loaded. Returns
304 QString::null, if no calendar has been loaded. 304 QString::null, if no calendar has been loaded.
305 */ 305 */
306 QString loadedProductId(); 306 QString loadedProductId();
307 int defaultCalendar(); 307 int defaultCalendar();
308 void setDontDeleteIncidencesOnClose (); 308 void setDontDeleteIncidencesOnClose ();
309 public slots: 309 public slots:
310 void setDefaultCalendar( int ); 310 void setDefaultCalendar( int );
311 virtual void setCalendarEnabled( int id, bool enable ) = 0; 311 virtual void setCalendarEnabled( int id, bool enable ) = 0;
312 virtual void setAlarmEnabled( int id, bool enable ) = 0; 312 virtual void setAlarmEnabled( int id, bool enable ) = 0;
313 virtual void setReadOnly( int id, bool enable ) = 0; 313 virtual void setReadOnly( int id, bool enable ) = 0;
314 virtual void setDefaultCalendarEnabledOnly() = 0; 314 virtual void setDefaultCalendarEnabledOnly() = 0;
315 virtual void setCalendarRemove( int id ) = 0;
315 signals: 316 signals:
316 void calendarChanged(); 317 void calendarChanged();
317 void calendarSaved(); 318 void calendarSaved();
318 void calendarLoaded(); 319 void calendarLoaded();
319 void addAlarm(const QDateTime &qdt, const QString &noti ); 320 void addAlarm(const QDateTime &qdt, const QString &noti );
320 void removeAlarm(const QDateTime &qdt, const QString &noti ); 321 void removeAlarm(const QDateTime &qdt, const QString &noti );
321 322
322 protected: 323 protected:
323 /** 324 /**
324 Get unfiltered events, which occur on the given date. 325 Get unfiltered events, which occur on the given date.
325 */ 326 */
326 virtual QPtrList<Event> rawEventsForDate( const QDateTime &qdt ) = 0; 327 virtual QPtrList<Event> rawEventsForDate( const QDateTime &qdt ) = 0;
327 /** 328 /**
328 Get unfiltered events, which occur on the given date. 329 Get unfiltered events, which occur on the given date.
329 */ 330 */
330 virtual QPtrList<Event> rawEventsForDate( const QDate &date, 331 virtual QPtrList<Event> rawEventsForDate( const QDate &date,
331 bool sorted = false ) = 0; 332 bool sorted = false ) = 0;
332 /** 333 /**
333 Get events in a range of dates. If inclusive is set to true, only events 334 Get events in a range of dates. If inclusive is set to true, only events
334 are returned, which are completely included in the range. 335 are returned, which are completely included in the range.
335 */ 336 */
336 virtual QPtrList<Event> rawEvents( const QDate &start, const QDate &end, 337 virtual QPtrList<Event> rawEvents( const QDate &start, const QDate &end,
337 bool inclusive = false ) = 0; 338 bool inclusive = false ) = 0;
338 339
339 Incidence *mNextAlarmIncidence; 340 Incidence *mNextAlarmIncidence;
340 Incidence *mUndoIncidence; 341 Incidence *mUndoIncidence;
341 int mDefaultCalendar; 342 int mDefaultCalendar;
342 bool mDeleteIncidencesOnClose; 343 bool mDeleteIncidencesOnClose;
343 344
344private: 345private:
345 void init(); 346 void init();
346 347
347 QString mOwner; // who the calendar belongs to 348 QString mOwner; // who the calendar belongs to
348 QString mOwnerEmail; // email address of the owner 349 QString mOwnerEmail; // email address of the owner
349 int mTimeZone; // timezone OFFSET from GMT (MINUTES) 350 int mTimeZone; // timezone OFFSET from GMT (MINUTES)
350 bool mLocalTime; // use local time, not UTC or a time zone 351 bool mLocalTime; // use local time, not UTC or a time zone
351 352
352 353
353 CalFilter *mFilter; 354 CalFilter *mFilter;
354 CalFilter *mDefaultFilter; 355 CalFilter *mDefaultFilter;
355 356
356 357
357 QString mTimeZoneId; 358 QString mTimeZoneId;
358 359
359 Observer *mObserver; 360 Observer *mObserver;
360 bool mNewObserver; 361 bool mNewObserver;
361 362
362 bool mModified; 363 bool mModified;
diff --git a/libkcal/calendarlocal.cpp b/libkcal/calendarlocal.cpp
index e48122a..749d9f6 100644
--- a/libkcal/calendarlocal.cpp
+++ b/libkcal/calendarlocal.cpp
@@ -40,116 +40,135 @@
40 40
41#include "calendarlocal.h" 41#include "calendarlocal.h"
42 42
43// #ifndef DESKTOP_VERSION 43// #ifndef DESKTOP_VERSION
44// #include <qtopia/alarmserver.h> 44// #include <qtopia/alarmserver.h>
45// #endif 45// #endif
46using namespace KCal; 46using namespace KCal;
47 47
48CalendarLocal::CalendarLocal() 48CalendarLocal::CalendarLocal()
49 : Calendar() 49 : Calendar()
50{ 50{
51 init(); 51 init();
52} 52}
53 53
54CalendarLocal::CalendarLocal(const QString &timeZoneId) 54CalendarLocal::CalendarLocal(const QString &timeZoneId)
55 : Calendar(timeZoneId) 55 : Calendar(timeZoneId)
56{ 56{
57 init(); 57 init();
58} 58}
59 59
60void CalendarLocal::init() 60void CalendarLocal::init()
61{ 61{
62 mNextAlarmIncidence = 0; 62 mNextAlarmIncidence = 0;
63} 63}
64 64
65 65
66CalendarLocal::~CalendarLocal() 66CalendarLocal::~CalendarLocal()
67{ 67{
68 if ( mDeleteIncidencesOnClose ) 68 if ( mDeleteIncidencesOnClose )
69 close(); 69 close();
70} 70}
71bool CalendarLocal::addCalendarFile( QString name, int id ) 71bool CalendarLocal::addCalendarFile( QString name, int id )
72{ 72{
73 CalendarLocal calendar( timeZoneId() ); 73 CalendarLocal calendar( timeZoneId() );
74 calendar.setDefaultCalendar( id ); 74 calendar.setDefaultCalendar( id );
75 if ( calendar.load( name ) ) { 75 if ( calendar.load( name ) ) {
76 addCalendar( &calendar ); 76 addCalendar( &calendar );
77 return true; 77 return true;
78 } 78 }
79 return false; 79 return false;
80} 80}
81void CalendarLocal::addCalendar( Calendar* cal ) 81void CalendarLocal::addCalendar( Calendar* cal )
82{ 82{
83 cal->setDontDeleteIncidencesOnClose(); 83 cal->setDontDeleteIncidencesOnClose();
84 { 84 {
85 QPtrList<Event> EventList = cal->rawEvents(); 85 QPtrList<Event> EventList = cal->rawEvents();
86 Event * ev = EventList.first(); 86 Event * ev = EventList.first();
87 while ( ev ) { 87 while ( ev ) {
88 ev->unRegisterObserver( cal );
89 ev->registerObserver( this );
88 mEventList.append( ev ); 90 mEventList.append( ev );
89 ev = EventList.next(); 91 ev = EventList.next();
90 } 92 }
91 } 93 }
92 { 94 {
95
93 QPtrList<Todo> TodoList = cal->rawTodos(); 96 QPtrList<Todo> TodoList = cal->rawTodos();
94 Todo * ev = TodoList.first(); 97 Todo * ev = TodoList.first();
95 while ( ev ) { 98 while ( ev ) {
99 QString rel = ev->relatedToUid();
100 if ( !rel.isEmpty() ){
101 ev->setRelatedTo ( 0 );
102 ev->setRelatedToUid( rel );
103 }
104 ev = TodoList.next();
105 }
106 //TodoList = cal->rawTodos();
107 ev = TodoList.first();
108 while ( ev ) {
109 ev->unRegisterObserver( cal );
110 ev->registerObserver( this );
96 mTodoList.append( ev ); 111 mTodoList.append( ev );
112 setupRelations( ev );
97 ev = TodoList.next(); 113 ev = TodoList.next();
98 } 114 }
99 } 115 }
100 { 116 {
101 QPtrList<Journal> JournalList = cal->journals(); 117 QPtrList<Journal> JournalList = cal->journals();
102 Journal * ev = JournalList.first(); 118 Journal * ev = JournalList.first();
103 while ( ev ) { 119 while ( ev ) {
120 ev->unRegisterObserver( cal );
121 ev->registerObserver( this );
104 mJournalList.append( ev ); 122 mJournalList.append( ev );
105 ev = JournalList.next(); 123 ev = JournalList.next();
106 } 124 }
107 } 125 }
126 setModified( true );
108} 127}
109bool CalendarLocal::load( const QString &fileName ) 128bool CalendarLocal::load( const QString &fileName )
110{ 129{
111 FileStorage storage( this, fileName ); 130 FileStorage storage( this, fileName );
112 return storage.load(); 131 return storage.load();
113} 132}
114 133
115bool CalendarLocal::save( const QString &fileName, CalFormat *format ) 134bool CalendarLocal::save( const QString &fileName, CalFormat *format )
116{ 135{
117 FileStorage storage( this, fileName, format ); 136 FileStorage storage( this, fileName, format );
118 return storage.save(); 137 return storage.save();
119} 138}
120 139
121void CalendarLocal::close() 140void CalendarLocal::close()
122{ 141{
123 142
124 Todo * i; 143 Todo * i;
125 for( i = mTodoList.first(); i; i = mTodoList.next() ) i->setRunning(false); 144 for( i = mTodoList.first(); i; i = mTodoList.next() ) i->setRunning(false);
126 145
127 mEventList.setAutoDelete( true ); 146 mEventList.setAutoDelete( true );
128 mTodoList.setAutoDelete( true ); 147 mTodoList.setAutoDelete( true );
129 mJournalList.setAutoDelete( false ); 148 mJournalList.setAutoDelete( false );
130 149
131 mEventList.clear(); 150 mEventList.clear();
132 mTodoList.clear(); 151 mTodoList.clear();
133 mJournalList.clear(); 152 mJournalList.clear();
134 153
135 mEventList.setAutoDelete( false ); 154 mEventList.setAutoDelete( false );
136 mTodoList.setAutoDelete( false ); 155 mTodoList.setAutoDelete( false );
137 mJournalList.setAutoDelete( false ); 156 mJournalList.setAutoDelete( false );
138 157
139 setModified( false ); 158 setModified( false );
140} 159}
141 160
142bool CalendarLocal::addAnniversaryNoDup( Event *event ) 161bool CalendarLocal::addAnniversaryNoDup( Event *event )
143{ 162{
144 QString cat; 163 QString cat;
145 bool isBirthday = true; 164 bool isBirthday = true;
146 if( event->categoriesStr() == i18n( "Anniversary" ) ) { 165 if( event->categoriesStr() == i18n( "Anniversary" ) ) {
147 isBirthday = false; 166 isBirthday = false;
148 cat = i18n( "Anniversary" ); 167 cat = i18n( "Anniversary" );
149 } else if( event->categoriesStr() == i18n( "Birthday" ) ) { 168 } else if( event->categoriesStr() == i18n( "Birthday" ) ) {
150 isBirthday = true; 169 isBirthday = true;
151 cat = i18n( "Birthday" ); 170 cat = i18n( "Birthday" );
152 } else { 171 } else {
153 qDebug("addAnniversaryNoDup called without fitting category! "); 172 qDebug("addAnniversaryNoDup called without fitting category! ");
154 return false; 173 return false;
155 } 174 }
@@ -736,99 +755,136 @@ bool CalendarLocal::addJournal(Journal *journal)
736 755
737 mJournalList.append(journal); 756 mJournalList.append(journal);
738 757
739 journal->registerObserver( this ); 758 journal->registerObserver( this );
740 759
741 setModified( true ); 760 setModified( true );
742 journal->setCalID( mDefaultCalendar ); 761 journal->setCalID( mDefaultCalendar );
743 journal->setCalEnabled( true ); 762 journal->setCalEnabled( true );
744 return true; 763 return true;
745} 764}
746 765
747void CalendarLocal::deleteJournal( Journal *journal ) 766void CalendarLocal::deleteJournal( Journal *journal )
748{ 767{
749 if ( mUndoIncidence ) delete mUndoIncidence; 768 if ( mUndoIncidence ) delete mUndoIncidence;
750 mUndoIncidence = journal->clone(); 769 mUndoIncidence = journal->clone();
751 mUndoIncidence->setSummary( mUndoIncidence->description().left(25)); 770 mUndoIncidence->setSummary( mUndoIncidence->description().left(25));
752 if ( mJournalList.removeRef(journal) ) { 771 if ( mJournalList.removeRef(journal) ) {
753 setModified( true ); 772 setModified( true );
754 } 773 }
755} 774}
756 775
757Journal *CalendarLocal::journal( const QDate &date ) 776Journal *CalendarLocal::journal( const QDate &date )
758{ 777{
759// kdDebug(5800) << "CalendarLocal::journal() " << date.toString() << endl; 778// kdDebug(5800) << "CalendarLocal::journal() " << date.toString() << endl;
760 779
761 for ( Journal *it = mJournalList.first(); it; it = mJournalList.next() ) 780 for ( Journal *it = mJournalList.first(); it; it = mJournalList.next() )
762 if ( it->calEnabled() && it->dtStart().date() == date ) 781 if ( it->calEnabled() && it->dtStart().date() == date )
763 return it; 782 return it;
764 783
765 return 0; 784 return 0;
766} 785}
767 786
768Journal *CalendarLocal::journal( const QString &uid ) 787Journal *CalendarLocal::journal( const QString &uid )
769{ 788{
770 for ( Journal *it = mJournalList.first(); it; it = mJournalList.next() ) 789 for ( Journal *it = mJournalList.first(); it; it = mJournalList.next() )
771 if ( it->calEnabled() && it->uid() == uid ) 790 if ( it->calEnabled() && it->uid() == uid )
772 return it; 791 return it;
773 792
774 return 0; 793 return 0;
775} 794}
776 795
777QPtrList<Journal> CalendarLocal::journals() 796QPtrList<Journal> CalendarLocal::journals()
778{ 797{
779 QPtrList<Journal> el; 798 QPtrList<Journal> el;
780 for ( Journal *it = mJournalList.first(); it; it = mJournalList.next() ) 799 for ( Journal *it = mJournalList.first(); it; it = mJournalList.next() )
781 if ( it->calEnabled() ) el.append( it ); 800 if ( it->calEnabled() ) el.append( it );
782 return el; 801 return el;
783} 802}
803void CalendarLocal::setCalendarRemove( int id )
804{
805
806 {
807 QPtrList<Event> EventList = mEventList;
808 Event * ev = EventList.first();
809 while ( ev ) {
810 if ( ev->calID() == id )
811 deleteEvent( ev );
812 ev = EventList.next();
813 }
814 }
815 {
816
817 QPtrList<Todo> TodoList = mTodoList;
818 Todo * ev = TodoList.first();
819 while ( ev ) {
820 if ( ev->calID() == id )
821 deleteTodo( ev );
822 ev = TodoList.next();
823 }
824 }
825 {
826 QPtrList<Journal> JournalList = mJournalList;
827 Journal * ev = JournalList.first();
828 while ( ev ) {
829 if ( ev->calID() == id )
830 deleteJournal( ev );
831 ev = JournalList.next();
832 }
833 }
834
835 if ( mUndoIncidence ) delete mUndoIncidence;
836 mUndoIncidence = 0;
837
838}
784 839
785void CalendarLocal::setCalendarEnabled( int id, bool enable ) 840void CalendarLocal::setCalendarEnabled( int id, bool enable )
786{ 841{
787 for ( Journal *it = mJournalList.first(); it; it = mJournalList.next() ) 842 for ( Journal *it = mJournalList.first(); it; it = mJournalList.next() )
788 if ( it->calID() == id ) it->setCalEnabled( enable ); 843 if ( it->calID() == id ) it->setCalEnabled( enable );
789 844
790 for ( Event *it = mEventList.first(); it; it = mEventList.next() ) 845 for ( Event *it = mEventList.first(); it; it = mEventList.next() )
791 if ( it->calID() == id ) it->setCalEnabled( enable ); 846 if ( it->calID() == id ) it->setCalEnabled( enable );
792 847
793 for ( Todo *it = mTodoList.first(); it; it = mTodoList.next() ) 848 for ( Todo *it = mTodoList.first(); it; it = mTodoList.next() )
794 if ( it->calID() == id ) it->setCalEnabled( enable ); 849 if ( it->calID() == id ) it->setCalEnabled( enable );
795 850
796} 851}
797 852
798void CalendarLocal::setReadOnly( int id, bool enable ) 853void CalendarLocal::setReadOnly( int id, bool enable )
799{ 854{
800 for ( Journal *it = mJournalList.first(); it; it = mJournalList.next() ) 855 for ( Journal *it = mJournalList.first(); it; it = mJournalList.next() )
801 if ( it->calID() == id ) it->setReadOnly( enable ); 856 if ( it->calID() == id ) it->setReadOnly( enable );
802 857
803 for ( Event *it = mEventList.first(); it; it = mEventList.next() ) 858 for ( Event *it = mEventList.first(); it; it = mEventList.next() )
804 if ( it->calID() == id ) it->setReadOnly( enable ); 859 if ( it->calID() == id ) it->setReadOnly( enable );
805 860
806 for ( Todo *it = mTodoList.first(); it; it = mTodoList.next() ) 861 for ( Todo *it = mTodoList.first(); it; it = mTodoList.next() )
807 if ( it->calID() == id ) it->setReadOnly( enable ); 862 if ( it->calID() == id ) it->setReadOnly( enable );
808 863
809} 864}
810 865
811void CalendarLocal::setAlarmEnabled( int id, bool enable ) 866void CalendarLocal::setAlarmEnabled( int id, bool enable )
812{ 867{
813 for ( Journal *it = mJournalList.first(); it; it = mJournalList.next() ) 868 for ( Journal *it = mJournalList.first(); it; it = mJournalList.next() )
814 if ( it->calID() == id ) it->setAlarmEnabled( enable ); 869 if ( it->calID() == id ) it->setAlarmEnabled( enable );
815 870
816 for ( Event *it = mEventList.first(); it; it = mEventList.next() ) 871 for ( Event *it = mEventList.first(); it; it = mEventList.next() )
817 if ( it->calID() == id ) it->setAlarmEnabled( enable ); 872 if ( it->calID() == id ) it->setAlarmEnabled( enable );
818 873
819 for ( Todo *it = mTodoList.first(); it; it = mTodoList.next() ) 874 for ( Todo *it = mTodoList.first(); it; it = mTodoList.next() )
820 if ( it->calID() == id ) it->setAlarmEnabled( enable ); 875 if ( it->calID() == id ) it->setAlarmEnabled( enable );
876 reInitAlarmSettings();
821 877
822} 878}
823void CalendarLocal::setDefaultCalendarEnabledOnly() 879void CalendarLocal::setDefaultCalendarEnabledOnly()
824{ 880{
825 for ( Journal *it = mJournalList.first(); it; it = mJournalList.next() ) 881 for ( Journal *it = mJournalList.first(); it; it = mJournalList.next() )
826 it->setCalEnabled( it->calID() == mDefaultCalendar ); 882 it->setCalEnabled( it->calID() == mDefaultCalendar );
827 883
828 for ( Event *it = mEventList.first(); it; it = mEventList.next() ) 884 for ( Event *it = mEventList.first(); it; it = mEventList.next() )
829 it->setCalEnabled( it->calID() == mDefaultCalendar); 885 it->setCalEnabled( it->calID() == mDefaultCalendar);
830 886
831 for ( Todo *it = mTodoList.first(); it; it = mTodoList.next() ) 887 for ( Todo *it = mTodoList.first(); it; it = mTodoList.next() )
832 it->setCalEnabled( it->calID() == mDefaultCalendar); 888 it->setCalEnabled( it->calID() == mDefaultCalendar);
833 889
834} 890}
diff --git a/libkcal/calendarlocal.h b/libkcal/calendarlocal.h
index 65f6aa7..5bbe55f 100644
--- a/libkcal/calendarlocal.h
+++ b/libkcal/calendarlocal.h
@@ -140,84 +140,85 @@ class CalendarLocal : public Calendar
140 140
141 /** 141 /**
142 Return all alarms, which ocur in the given time interval. 142 Return all alarms, which ocur in the given time interval.
143 */ 143 */
144 Alarm::List alarms( const QDateTime &from, const QDateTime &to ); 144 Alarm::List alarms( const QDateTime &from, const QDateTime &to );
145 145
146 /** 146 /**
147 Return all alarms, which ocur before given date. 147 Return all alarms, which ocur before given date.
148 */ 148 */
149 Alarm::List alarmsTo( const QDateTime &to ); 149 Alarm::List alarmsTo( const QDateTime &to );
150 150
151 QDateTime nextAlarm( int daysTo ) ; 151 QDateTime nextAlarm( int daysTo ) ;
152 QDateTime nextAlarmEventDateTime() const; 152 QDateTime nextAlarmEventDateTime() const;
153 void checkAlarmForIncidence( Incidence *, bool deleted ) ; 153 void checkAlarmForIncidence( Incidence *, bool deleted ) ;
154 void registerAlarm(); 154 void registerAlarm();
155 void deRegisterAlarm(); 155 void deRegisterAlarm();
156 QString getAlarmNotification(); 156 QString getAlarmNotification();
157 QString nextSummary() const ; 157 QString nextSummary() const ;
158 /** 158 /**
159 This method should be called whenever a Event is modified directly 159 This method should be called whenever a Event is modified directly
160 via it's pointer. It makes sure that the calendar is internally 160 via it's pointer. It makes sure that the calendar is internally
161 consistent. 161 consistent.
162 */ 162 */
163 void update( IncidenceBase *incidence ); 163 void update( IncidenceBase *incidence );
164 164
165 /** 165 /**
166 Builds and then returns a list of all events that match for the 166 Builds and then returns a list of all events that match for the
167 date specified. useful for dayView, etc. etc. 167 date specified. useful for dayView, etc. etc.
168 */ 168 */
169 QPtrList<Event> rawEventsForDate( const QDate &date, bool sorted = false ); 169 QPtrList<Event> rawEventsForDate( const QDate &date, bool sorted = false );
170 /** 170 /**
171 Get unfiltered events for date \a qdt. 171 Get unfiltered events for date \a qdt.
172 */ 172 */
173 QPtrList<Event> rawEventsForDate( const QDateTime &qdt ); 173 QPtrList<Event> rawEventsForDate( const QDateTime &qdt );
174 /** 174 /**
175 Get unfiltered events in a range of dates. If inclusive is set to true, 175 Get unfiltered events in a range of dates. If inclusive is set to true,
176 only events are returned, which are completely included in the range. 176 only events are returned, which are completely included in the range.
177 */ 177 */
178 QPtrList<Event> rawEvents( const QDate &start, const QDate &end, 178 QPtrList<Event> rawEvents( const QDate &start, const QDate &end,
179 bool inclusive = false ); 179 bool inclusive = false );
180 Todo *todo( QString, QString ); 180 Todo *todo( QString, QString );
181 Event *event( QString, QString ); 181 Event *event( QString, QString );
182 182
183public slots: 183public slots:
184 void setCalendarEnabled( int id, bool enable ); 184 void setCalendarEnabled( int id, bool enable );
185 void setAlarmEnabled( int id, bool enable ); 185 void setAlarmEnabled( int id, bool enable );
186 void setReadOnly( int id, bool enable ); 186 void setReadOnly( int id, bool enable );
187 void setDefaultCalendarEnabledOnly(); 187 void setDefaultCalendarEnabledOnly();
188 void setCalendarRemove( int id );
188 189
189 protected: 190 protected:
190 191
191 // Event* mNextAlarmEvent; 192 // Event* mNextAlarmEvent;
192 QString mNextSummary; 193 QString mNextSummary;
193 QString mNextAlarmEventDateTimeString; 194 QString mNextAlarmEventDateTimeString;
194 QString mLastAlarmNotificationString; 195 QString mLastAlarmNotificationString;
195 QDateTime mNextAlarmEventDateTime; 196 QDateTime mNextAlarmEventDateTime;
196 QDateTime mNextAlarmDateTime; 197 QDateTime mNextAlarmDateTime;
197 void reInitAlarmSettings(); 198 void reInitAlarmSettings();
198 199
199 /** Notification function of IncidenceBase::Observer. */ 200 /** Notification function of IncidenceBase::Observer. */
200 void incidenceUpdated( IncidenceBase *i ) { update( i ); } 201 void incidenceUpdated( IncidenceBase *i ) { update( i ); }
201 202
202 /** inserts an event into its "proper place" in the calendar. */ 203 /** inserts an event into its "proper place" in the calendar. */
203 void insertEvent( Event *event ); 204 void insertEvent( Event *event );
204 205
205 /** Append alarms of incidence in interval to list of alarms. */ 206 /** Append alarms of incidence in interval to list of alarms. */
206 void appendAlarms( Alarm::List &alarms, Incidence *incidence, 207 void appendAlarms( Alarm::List &alarms, Incidence *incidence,
207 const QDateTime &from, const QDateTime &to ); 208 const QDateTime &from, const QDateTime &to );
208 209
209 /** Append alarms of recurring events in interval to list of alarms. */ 210 /** Append alarms of recurring events in interval to list of alarms. */
210 void appendRecurringAlarms( Alarm::List &alarms, Incidence *incidence, 211 void appendRecurringAlarms( Alarm::List &alarms, Incidence *incidence,
211 const QDateTime &from, const QDateTime &to ); 212 const QDateTime &from, const QDateTime &to );
212 213
213 private: 214 private:
214 void init(); 215 void init();
215 216
216 QPtrList<Event> mEventList; 217 QPtrList<Event> mEventList;
217 QPtrList<Todo> mTodoList; 218 QPtrList<Todo> mTodoList;
218 QPtrList<Journal> mJournalList; 219 QPtrList<Journal> mJournalList;
219}; 220};
220 221
221} 222}
222 223
223#endif 224#endif