summaryrefslogtreecommitdiffabout
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--bin/kdepim/korganizer/germantranslation.txt4
-rw-r--r--korganizer/calendarview.cpp52
-rw-r--r--libkcal/event.cpp16
-rw-r--r--libkcal/event.h2
4 files changed, 45 insertions, 29 deletions
diff --git a/bin/kdepim/korganizer/germantranslation.txt b/bin/kdepim/korganizer/germantranslation.txt
index 43bc343..34e9b7f 100644
--- a/bin/kdepim/korganizer/germantranslation.txt
+++ b/bin/kdepim/korganizer/germantranslation.txt
@@ -1469,49 +1469,49 @@
1469{ "Toolbar changes needs a restart!","Neustart benötigt für Toolbaränderungen!" }, 1469{ "Toolbar changes needs a restart!","Neustart benötigt für Toolbaränderungen!" },
1470{ "Filepath: ","Dateipfad: " }, 1470{ "Filepath: ","Dateipfad: " },
1471{ "You can try to reload the calendar in the Resource View!","In der Resourcenansicht können Sie erneut versuchen den Kalender zu laden!" }, 1471{ "You can try to reload the calendar in the Resource View!","In der Resourcenansicht können Sie erneut versuchen den Kalender zu laden!" },
1472{ "<b>WARNING:</b> There is a pending suspended alarm!","<b>WARNUNG:</b> Es gibt einen laufenden Suspendalarm!" }, 1472{ "<b>WARNING:</b> There is a pending suspended alarm!","<b>WARNUNG:</b> Es gibt einen laufenden Suspendalarm!" },
1473{ "Pending Suspend Alarm","Laufender Suspend Alarm" }, 1473{ "Pending Suspend Alarm","Laufender Suspend Alarm" },
1474{ "Error loading calendar %1","Fehler beim Laden von Kalender %1" }, 1474{ "Error loading calendar %1","Fehler beim Laden von Kalender %1" },
1475{ "Calendar(s) not loaded:","Nicht geladene(r) Kalender:" }, 1475{ "Calendar(s) not loaded:","Nicht geladene(r) Kalender:" },
1476{ "Loding of calendar(s) failed","Laden von Kalendern fehlgeschlagen" }, 1476{ "Loding of calendar(s) failed","Laden von Kalendern fehlgeschlagen" },
1477{ "Alarm Options","Alarm Einstellungen" }, 1477{ "Alarm Options","Alarm Einstellungen" },
1478{ "Delete selected...","Lösche Ausgewählte..." }, 1478{ "Delete selected...","Lösche Ausgewählte..." },
1479{ "None","Nichts" }, 1479{ "None","Nichts" },
1480{ "Selection","Auswahl" }, 1480{ "Selection","Auswahl" },
1481{ "Set categories","Setze Kategorien" }, 1481{ "Set categories","Setze Kategorien" },
1482{ "This adds the selected\nitems to the calendar\n%1\nand removes them from\ntheir current calendar!","Das fügt die ausgewählten\nEinträge dem Kalender\n%1\nhinzu und entfernt sie von\nihrem aktuellen Kalender!" }, 1482{ "This adds the selected\nitems to the calendar\n%1\nand removes them from\ntheir current calendar!","Das fügt die ausgewählten\nEinträge dem Kalender\n%1\nhinzu und entfernt sie von\nihrem aktuellen Kalender!" },
1483{ "Reset","Neu setzen" }, 1483{ "Reset","Neu setzen" },
1484{ "Do you want to <b>add</b> categories to the selected items or <b>reset</b> the list (i.e. remove current categories)?","Möchten Sie Kategorien zu den ausgewählten Einträgen <b>hinzufügen</b> oder die Liste <b>neu setzen</b> (d.h. vorhandene Kategorien löschen)?" }, 1484{ "Do you want to <b>add</b> categories to the selected items or <b>reset</b> the list (i.e. remove current categories)?","Möchten Sie Kategorien zu den ausgewählten Einträgen <b>hinzufügen</b> oder die Liste <b>neu setzen</b> (d.h. vorhandene Kategorien löschen)?" },
1485{ "The file\n%1\ndoes not exist!\nShall I create it for you?","Die Datei\n%1\nexistiert nicht!\nSoll sie neu angelegt werden?" }, 1485{ "The file\n%1\ndoes not exist!\nShall I create it for you?","Die Datei\n%1\nexistiert nicht!\nSoll sie neu angelegt werden?" },
1486{ "Sorry, cannot create the file\n%1!\nNo calendar added!","Kann leider die Datei\n%1\nnicht anlegen!\nKein Kalender hinzugefügt!" }, 1486{ "Sorry, cannot create the file\n%1!\nNo calendar added!","Kann leider die Datei\n%1\nnicht anlegen!\nKein Kalender hinzugefügt!" },
1487{ "\nNO\n WRITEABLE\n CALENDAR\n FOUND!\n\nPlease fix your calendar settings!\n","\nKEIN\n SCHREIBBARER\n KALENDER\n GEFUNDEN!\n\nBitte korrigieren Sie\nihre Kalendereinstellungen!\n" }, 1487{ "\nNO\n WRITEABLE\n CALENDAR\n FOUND!\n\nPlease fix your calendar settings!\n","\nKEIN\n SCHREIBBARER\n KALENDER\n GEFUNDEN!\n\nBitte korrigieren Sie\nihre Kalendereinstellungen!\n" },
1488{ "\nThe file\n%1\non disk has changed!\nFile size: %2 bytes.\nLast modified: %3\nDo you want to:\n\n - Save and overwrite file?\n - Sync with file, then save?\n - Cancel without saving? \n","\nDie Datei\n%1\nwurde verändert!\nDatei Grösse: %2 Bytes.\nZuletzt geändert: %3\nMöchten Sie:\n\n - Speichern und die Datei überschreiben?\n - Mit Datei Synchronisieren, dann speichern?\n - Abbrechen ohne zu speichern? \n" }, 1488{ "\nThe file\n%1\non disk has changed!\nFile size: %2 bytes.\nLast modified: %3\nDo you want to:\n\n - Save and overwrite file?\n - Sync with file, then save?\n - Cancel without saving? \n","\nDie Datei\n%1\nwurde verändert!\nDatei Grösse: %2 Bytes.\nZuletzt geändert: %3\nMöchten Sie:\n\n - Speichern und die Datei überschreiben?\n - Mit Datei Synchronisieren, dann speichern?\n - Abbrechen ohne zu speichern? \n" },
1489{ "Edit","Edit" }, 1489{ "Edit","Edit" },
1490{ "Last Modified","Zuletzt geändert" }, 1490{ "Last Modified","Zuletzt geändert" },
1491{ "Journal viewer","Journal Anzeige" }, 1491{ "Journal viewer","Journal Anzeige" },
1492{ "Configure Calendar Files...","Konfiguriere Kalenderdateien..." }, 1492{ "Configure Calendar Files...","Konfiguriere Kalenderdateien..." },
1493{ "You can use and display <b>more than one</b> calendar file in KO/Pi. A calendar file is called a <b>resource</b>. To add a calendar or change calendar settings please use menu: <b>View -> Toggle Resource View</b>.","Sie können <b>mehr als eine</b> Kalenderdatei in KO/Pi darstellen und benutzen. Eine Kalenderdatei wird <b>Resource</b> genannt. Um einen Kalender hinzuzufügen oder die Kalendereinstellungen zu ändern benutzen Sie bitte das Menu: <b>Ansicht -> Resourcenansicht umschalten</b>." }, 1493{ "You can use and display <b>more than one</b> calendar file in KO/Pi. A calendar file is called a <b>resource</b>. To add a calendar or change calendar settings please use menu: <b>View -> Toggle Resource View</b>.","Sie können <b>mehr als eine</b> Kalenderdatei in KO/Pi darstellen und benutzen. Eine Kalenderdatei wird <b>Resource</b> genannt. Um einen Kalender hinzuzufügen oder die Kalendereinstellungen zu ändern benutzen Sie bitte das Menu: <b>Ansicht -> Resourcenansicht umschalten</b>." },
1494{ "Hide Completed","Verstecke erledigte Todos" }, 1494{ "Hide Completed","Verstecke erledigte Todos" },
1495{ "Show not Running","Zeige nicht Laufende" }, 1495{ "Show not Running","Zeige nicht Laufende" },
1496{ "Click to add new Todo","Klick für neues Todo!" }, 1496{ "Click to add new Todo","Klick für neues Todo!" },
1497{ "Show next conflict for","Zeige nächsten Konflikt für" }, 1497{ "Show next conflict for","Zeige nächsten Konflikt für" },
1498{ "All events","Alle Termine" }, 1498{ "All events","Alle Termine" },
1499{ "Allday events","Ganztagestermine" }, 1499{ "Allday events","Ganztagestermine" },
1500{ "Events with time","Termine mit Zeit" }, 1500{ "Events with time","Termine mit Zeit" },
1501{ "No conflict found within the next two years","Kein Konflikt innerhalb der nächsten zwei Jahre gefunden" }, 1501{ "No conflict found","Kein Konflikt gefunden" },
1502{ "Conflict %1 <-> %2","Konflikt %1 <-> %2" }, 1502{ "Conflict %1 <-> %2","Konflikt %1 <-> %2" },
1503{ "<p><b>Q</b>: Show next date with conflicting events\n ","<p><b>Q</b>: Zeige nächstes Datum mit Terminen im Konflikt\n " }, 1503{ "<p><b>Q</b>: Show next date with conflicting events\n ","<p><b>Q</b>: Zeige nächstes Datum mit Terminen im Konflikt\n " },
1504{ "Week view mode uses row layout","Wochenansicht Modus nutzt Reihenlayout" }, 1504{ "Week view mode uses row layout","Wochenansicht Modus nutzt Reihenlayout" },
1505{ "The event\n%1\nconflicts with event\n%2\nat date\n%3.\n","Der Termin\n%1\nist im Konflikt mit Termin\n%2\nam Datum\n%3.\n" }, 1505{ "The event\n%1\nconflicts with event\n%2\nat date\n%3.\n","Der Termin\n%1\nist im Konflikt mit Termin\n%2\nam Datum\n%3.\n" },
1506{ "KO/Pi Conflict delected","KO/Pi Konflikt erkannt" }, 1506{ "KO/Pi Conflict delected","KO/Pi Konflikt erkannt" },
1507{ "Show date","Zeige Datum" }, 1507{ "Show date","Zeige Datum" },
1508{ "No problem!","Kein Problem!" }, 1508{ "No problem!","Null Problemo!" },
1509{ "","" }, 1509{ "","" },
1510{ "","" }, 1510{ "","" },
1511{ "","" }, 1511{ "","" },
1512{ "","" }, 1512{ "","" },
1513{ "","" }, 1513{ "","" },
1514{ "","" }, 1514{ "","" },
1515{ "","" }, 1515{ "","" },
1516{ "","" }, 1516{ "","" },
1517{ "","" }, 1517{ "","" },
diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp
index 65750af..426e8f9 100644
--- a/korganizer/calendarview.cpp
+++ b/korganizer/calendarview.cpp
@@ -632,106 +632,121 @@ void CalendarView::init()
632 connect( mAlarmDialog, SIGNAL( addAlarm(const QDateTime &, const QString & ) ), SLOT( addSuspendAlarm(const QDateTime &, const QString & ) ) ); 632 connect( mAlarmDialog, SIGNAL( addAlarm(const QDateTime &, const QString & ) ), SLOT( addSuspendAlarm(const QDateTime &, const QString & ) ) );
633 mAlarmDialog->setServerNotification( false ); 633 mAlarmDialog->setServerNotification( false );
634 mAlarmDialog->setSuspendTime( KOPrefs::instance()->mAlarmSuspendTime ); 634 mAlarmDialog->setSuspendTime( KOPrefs::instance()->mAlarmSuspendTime );
635 635
636 636
637#ifndef DESKTOP_VERSION 637#ifndef DESKTOP_VERSION
638//US listen for arriving address resultsets 638//US listen for arriving address resultsets
639 connect(ExternalAppHandler::instance(), SIGNAL(receivedBirthdayListEvent(const QString&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&)), 639 connect(ExternalAppHandler::instance(), SIGNAL(receivedBirthdayListEvent(const QString&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&)),
640 this, SLOT(insertBirthdays(const QString&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&))); 640 this, SLOT(insertBirthdays(const QString&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&)));
641#endif 641#endif
642 mDateNavigator->setCalendar( mCalendar ); 642 mDateNavigator->setCalendar( mCalendar );
643} 643}
644 644
645 645
646CalendarView::~CalendarView() 646CalendarView::~CalendarView()
647{ 647{
648 // kdDebug() << "~CalendarView()" << endl; 648 // kdDebug() << "~CalendarView()" << endl;
649 //qDebug("CalendarView::~CalendarView() "); 649 //qDebug("CalendarView::~CalendarView() ");
650 delete mDialogManager; 650 delete mDialogManager;
651 delete mViewManager; 651 delete mViewManager;
652 delete mStorage; 652 delete mStorage;
653 delete mDateFrame ; 653 delete mDateFrame ;
654 delete mEventViewerDialog; 654 delete mEventViewerDialog;
655 //kdDebug() << "~CalendarView() done" << endl; 655 //kdDebug() << "~CalendarView() done" << endl;
656} 656}
657void CalendarView::nextConflict( bool all, bool allday ) 657void CalendarView::nextConflict( bool all, bool allday )
658{ 658{
659 659
660 QPtrList<Event> testlist = mCalendar->events(); 660 QPtrList<Event> testlist = mCalendar->events();
661 Event * test = testlist.first(); 661 Event * test = testlist.first();
662 while ( test ) { 662 while ( test ) {
663 test->setTagged( false ); 663 test->setTagged( false );
664 test = testlist.next();
664 } 665 }
665 QDateTime startDT = QDateTime (mNavigator->selectedDates().first().addDays(1), QTime ( 0,0,0)); 666 QDateTime startDT = QDateTime (mNavigator->selectedDates().first().addDays(1), QTime ( 0,0,0));
666 QDateTime conflict; 667 QDateTime conflict;
667 QDateTime retVal; 668 QDateTime retVal;
668 bool found = false; 669 bool found = false;
669 Event * cE = 0; 670 Event * cE = 0;
671 Event * cE2 = 0;
670 QPtrList<Event> testlist2 = testlist; 672 QPtrList<Event> testlist2 = testlist;
673 test = testlist.first();
674 bool skip = false;
671 while ( test ) { 675 while ( test ) {
672 Event * test2 = testlist2.first(); 676 skip = false;
673 while ( test2 ) { 677 if ( !all ) skip = ( allday != test->doesFloat() );
674 if ( !test2->isTagged() ) { 678 if ( !skip ) {
675 if ( test->isOverlapping ( test2, &retVal, true ) ) { 679 Event * test2 = testlist2.first();
676 if ( ! found ) { 680 while ( test2 ) {
677 if ( retVal >= startDT ) { 681 skip = false;
678 conflict = retVal; 682 if ( !all ) skip = ( allday != test2->doesFloat() );
679 cE = test; 683 if ( !skip ) {
680 found = true; 684 if ( !test2->isTagged() ) {
681 } 685 if ( test->isOverlapping ( test2, &retVal, &startDT ) ) {
682 } else { 686 //qDebug("overlap ");
683 if ( retVal >= startDT && retVal < conflict ) { 687 if ( ! found ) {
684 conflict = retVal; 688 if ( retVal >= startDT ) {
685 cE = test; 689 conflict = retVal;
690 cE = test;
691 cE2 = test2;
692 found = true;
693 }
694 } else {
695 if ( retVal >= startDT && retVal < conflict ) {
696 conflict = retVal;
697 cE = test;
698 cE2 = test2;
699 }
700 }
686 } 701 }
687 } 702 }
688 } 703 }
704 test2 = testlist2.next();
689 } 705 }
690 test2 = testlist2.next();
691 } 706 }
692 test->setTagged( true ); 707 test->setTagged( true );
693 test = testlist.next(); 708 test = testlist.next();
694 } 709 }
695 if ( found ) { 710 if ( found ) {
696 if ( mViewManager->currentView() != mViewManager->agendaView() || mNavigator->selectedDates().count() > 1 ) 711 if ( mViewManager->currentView() != mViewManager->agendaView() || mNavigator->selectedDates().count() > 1 )
697 mViewManager->showDayView(); 712 mViewManager->showDayView();
698 mNavigator->slotDaySelect( conflict.date() ); 713 mNavigator->slotDaySelect( conflict.date() );
699 int hour = conflict.time().hour(); 714 int hour = conflict.time().hour();
700 mViewManager->agendaView()->setStartHour( hour ); 715 mViewManager->agendaView()->setStartHour( hour );
701 topLevelWidget()->setCaption( i18n("Conflict %1 <-> %2"). arg( mConflictingEvent->summary().left( 20 ) ).arg( cE->summary().left( 20 ) ) ); 716 topLevelWidget()->setCaption( i18n("Conflict %1 <-> %2"). arg( cE->summary().left( 20 ) ).arg( cE2->summary().left( 20 ) ) );
702 return; 717 return;
703 } 718 }
704 719
705 topLevelWidget()->setCaption( i18n("No conflict found within the next two years") ); 720 topLevelWidget()->setCaption( i18n("No conflict found") );
706 qDebug("No conflict found "); 721 qDebug("No conflict found ");
707 return; 722 return;
708 723
709 724
710 725
711 726
712 727
713#if 0 728#if 0
714 729
715 730
716 QDate end = start.addDays( 365*2); 731 QDate end = start.addDays( 365*2);
717 while ( start < end ) { 732 while ( start < end ) {
718 QPtrList<Event> eventList = calendar()->events( start ); 733 QPtrList<Event> eventList = calendar()->events( start );
719 Event * ev = eventList.first(); 734 Event * ev = eventList.first();
720 QPtrList<Event> test = eventList; 735 QPtrList<Event> test = eventList;
721 while ( ev ) { 736 while ( ev ) {
722 //qDebug("found %d on %s ", eventList.count(), start.toString().latin1()); 737 //qDebug("found %d on %s ", eventList.count(), start.toString().latin1());
723 Event * t_ev = test.first(); 738 Event * t_ev = test.first();
724 QDateTime es = ev->dtStart(); 739 QDateTime es = ev->dtStart();
725 QDateTime ee = ev->dtEnd(); 740 QDateTime ee = ev->dtEnd();
726 if ( ev->doesFloat() ) 741 if ( ev->doesFloat() )
727 ee = ee.addDays( 1 ); 742 ee = ee.addDays( 1 );
728 if ( ! all ) { 743 if ( ! all ) {
729 if ( ev->doesFloat() != allday ) 744 if ( ev->doesFloat() != allday )
730 t_ev = 0; 745 t_ev = 0;
731 } 746 }
732 while ( t_ev ) { 747 while ( t_ev ) {
733 bool skip = false; 748 bool skip = false;
734 if ( ! all ) { 749 if ( ! all ) {
735 if ( t_ev->doesFloat() != allday ) 750 if ( t_ev->doesFloat() != allday )
736 skip = true; 751 skip = true;
737 } 752 }
@@ -2765,67 +2780,68 @@ void CalendarView::changeEventDisplay(Event *which, int action)
2765 //mDialogManager->updateSearchDialog(); 2780 //mDialogManager->updateSearchDialog();
2766 if (which) { 2781 if (which) {
2767 // If there is an event view visible update the display 2782 // If there is an event view visible update the display
2768 mViewManager->currentView()->changeEventDisplay(which,action); 2783 mViewManager->currentView()->changeEventDisplay(which,action);
2769 // TODO: check, if update needed 2784 // TODO: check, if update needed
2770 // if (which->getTodoStatus()) { 2785 // if (which->getTodoStatus()) {
2771 mTodoList->updateView(); 2786 mTodoList->updateView();
2772 if ( action != KOGlobals::EVENTDELETED ) { 2787 if ( action != KOGlobals::EVENTDELETED ) {
2773 mConflictingEvent = which ; 2788 mConflictingEvent = which ;
2774 QTimer::singleShot( 1000, this, SLOT ( checkConflictForEvent() ) ); 2789 QTimer::singleShot( 1000, this, SLOT ( checkConflictForEvent() ) );
2775 } 2790 }
2776 // } 2791 // }
2777 } else { 2792 } else {
2778 mViewManager->currentView()->updateView(); 2793 mViewManager->currentView()->updateView();
2779 } 2794 }
2780} 2795}
2781void CalendarView::checkConflictForEvent() 2796void CalendarView::checkConflictForEvent()
2782{ 2797{
2783 2798
2784 if (!KOPrefs::instance()->mConfirm) 2799 if (!KOPrefs::instance()->mConfirm)
2785 return; 2800 return;
2786 if ( ! mConflictingEvent ) return; 2801 if ( ! mConflictingEvent ) return;
2787 if ( mConflictingEvent->doesFloat() ) { 2802 if ( mConflictingEvent->doesFloat() ) {
2788 mConflictingEvent = 0; 2803 mConflictingEvent = 0;
2789 return; 2804 return;
2790 } 2805 }
2791 QPtrList<Event> testlist = mCalendar->events(); 2806 QPtrList<Event> testlist = mCalendar->events();
2792 Event * test = testlist.first(); 2807 Event * test = testlist.first();
2793 QDateTime conflict; 2808 QDateTime conflict;
2794 QDateTime retVal; 2809 QDateTime retVal;
2795 bool found = false; 2810 bool found = false;
2796 Event * cE = 0; 2811 Event * cE = 0;
2812 QDateTime current = QDateTime::currentDateTime();
2797 while ( test ) { 2813 while ( test ) {
2798 if ( !test->doesFloat() ) { 2814 if ( !test->doesFloat() ) {
2799 if ( mConflictingEvent->isOverlapping ( test, &retVal, true ) ) { 2815 if ( mConflictingEvent->isOverlapping ( test, &retVal, &current ) ) {
2800 if ( ! found ) { 2816 if ( ! found ) {
2801 conflict = retVal; 2817 conflict = retVal;
2802 cE = test; 2818 cE = test;
2803 } else { 2819 } else {
2804 if ( retVal < conflict ) { 2820 if ( retVal < conflict ) {
2805 conflict = retVal; 2821 conflict = retVal;
2806 cE = test; 2822 cE = test;
2807 } 2823 }
2808 } 2824 }
2809 found = true; 2825 found = true;
2810 } 2826 }
2811 } 2827 }
2812 test = testlist.next(); 2828 test = testlist.next();
2813 } 2829 }
2814 if ( found ) { 2830 if ( found ) {
2815 QString mess = i18n("The event\n%1\nconflicts with event\n%2\nat date\n%3.\n").arg(KGlobal::formatMessage ( mConflictingEvent->summary(),0 ) ).arg( KGlobal::formatMessage ( cE->summary(),0 )).arg(KGlobal::locale()->formatDate(conflict.date()) ) ; 2831 QString mess = i18n("The event\n%1\nconflicts with event\n%2\nat date\n%3.\n").arg(KGlobal::formatMessage ( mConflictingEvent->summary(),0 ) ).arg( KGlobal::formatMessage ( cE->summary(),0 )).arg(KGlobal::locale()->formatDate(conflict.date()) ) ;
2816 qApp->processEvents(); 2832 qApp->processEvents();
2817 int km = KMessageBox::warningContinueCancel(this,mess, 2833 int km = KMessageBox::warningContinueCancel(this,mess,
2818 i18n("KO/Pi Conflict delected"),i18n("Show date"),i18n("No problem!")); 2834 i18n("KO/Pi Conflict delected"),i18n("Show date"),i18n("No problem!"));
2819 if ( km != KMessageBox::Continue ) 2835 if ( km != KMessageBox::Continue )
2820 return; 2836 return;
2821 2837
2822 if ( mViewManager->currentView() != mViewManager->agendaView() || mNavigator->selectedDates().count() > 1 ) 2838 if ( mViewManager->currentView() != mViewManager->agendaView() || mNavigator->selectedDates().count() > 1 )
2823 mViewManager->showDayView(); 2839 mViewManager->showDayView();
2824 mNavigator->slotDaySelect( conflict.date() ); 2840 mNavigator->slotDaySelect( conflict.date() );
2825 int hour = conflict.time().hour(); 2841 int hour = conflict.time().hour();
2826 mViewManager->agendaView()->setStartHour( hour ); 2842 mViewManager->agendaView()->setStartHour( hour );
2827 topLevelWidget()->setCaption( i18n("Conflict %1 <-> %2"). arg( mConflictingEvent->summary().left( 20 ) ).arg( cE->summary().left( 20 ) ) ); 2843 topLevelWidget()->setCaption( i18n("Conflict %1 <-> %2"). arg( mConflictingEvent->summary().left( 20 ) ).arg( cE->summary().left( 20 ) ) );
2828 return; 2844 return;
2829 } 2845 }
2830 2846
2831 return; 2847 return;
diff --git a/libkcal/event.cpp b/libkcal/event.cpp
index 235ae55..46e8174 100644
--- a/libkcal/event.cpp
+++ b/libkcal/event.cpp
@@ -142,169 +142,169 @@ void Event::setHasEndDate(bool b)
142{ 142{
143 mHasEndDate = b; 143 mHasEndDate = b;
144} 144}
145 145
146bool Event::hasEndDate() const 146bool Event::hasEndDate() const
147{ 147{
148 return mHasEndDate; 148 return mHasEndDate;
149} 149}
150 150
151bool Event::isMultiDay() const 151bool Event::isMultiDay() const
152{ 152{
153 bool multi = !(dtStart().date() == dtEnd().date()); 153 bool multi = !(dtStart().date() == dtEnd().date());
154 return multi; 154 return multi;
155} 155}
156 156
157void Event::setTransparency(Event::Transparency transparency) 157void Event::setTransparency(Event::Transparency transparency)
158{ 158{
159 if (mReadOnly) return; 159 if (mReadOnly) return;
160 mTransparency = transparency; 160 mTransparency = transparency;
161 updated(); 161 updated();
162} 162}
163 163
164Event::Transparency Event::transparency() const 164Event::Transparency Event::transparency() const
165{ 165{
166 return mTransparency; 166 return mTransparency;
167} 167}
168 168
169void Event::setDuration(int seconds) 169void Event::setDuration(int seconds)
170{ 170{
171 setHasEndDate(false); 171 setHasEndDate(false);
172 Incidence::setDuration(seconds); 172 Incidence::setDuration(seconds);
173} 173}
174bool Event::isOverlapping ( Event* testEvent, QDateTime* overlapDT, bool inFutureOnly ) 174bool Event::isOverlapping ( Event* testEvent, QDateTime* overlapDT, QDateTime* startDT )
175{ 175{
176 if ( testEvent == this ) 176 if ( testEvent == this )
177 return false; 177 return false;
178 if ( ! doesRecur() && !testEvent->doesRecur() ) { 178 if ( ! doesRecur() && !testEvent->doesRecur() ) {
179 QDateTime te; 179 QDateTime te;
180 if ( testEvent->doesFloat() ) 180 if ( testEvent->doesFloat() )
181 te = testEvent->mDtEnd.addDays( 1 ); 181 te = testEvent->mDtEnd.addDays( 1 );
182 else 182 else
183 te = testEvent->mDtEnd; 183 te = testEvent->mDtEnd;
184 QDateTime e; 184 QDateTime e;
185 if ( doesFloat() ) 185 if ( doesFloat() )
186 e = mDtEnd.addDays( 1 ); 186 e = mDtEnd.addDays( 1 );
187 else 187 else
188 e = mDtEnd; 188 e = mDtEnd;
189 if ( mDtStart < te && testEvent->mDtStart < e ) { 189 if ( mDtStart < te && testEvent->mDtStart < e ) {
190 if ( mDtStart < testEvent->mDtStart ) 190 if ( mDtStart < testEvent->mDtStart )
191 *overlapDT = testEvent->mDtStart; 191 *overlapDT = testEvent->mDtStart;
192 else 192 else
193 *overlapDT = mDtStart; 193 *overlapDT = mDtStart;
194 if ( inFutureOnly ) 194 if ( startDT )
195 return (*overlapDT >= QDateTime::currentDateTime() ); 195 return (*overlapDT >= *startDT );
196 return true; 196 return true;
197 } 197 }
198 return false; 198 return false;
199 } 199 }
200 Event *nonRecur = 0; 200 Event *nonRecur = 0;
201 Event *recurEvent = 0; 201 Event *recurEvent = 0;
202 if ( ! doesRecur() ) { 202 if ( ! doesRecur() ) {
203 nonRecur = this; 203 nonRecur = this;
204 recurEvent = testEvent; 204 recurEvent = testEvent;
205 } 205 }
206 else if ( !testEvent->doesRecur() ) { 206 else if ( !testEvent->doesRecur() ) {
207 nonRecur = testEvent; 207 nonRecur = testEvent;
208 recurEvent = this; 208 recurEvent = this;
209 } 209 }
210 if ( nonRecur ) { 210 if ( nonRecur ) {
211 QDateTime enr; 211 QDateTime enr;
212 if ( nonRecur->doesFloat() ) 212 if ( nonRecur->doesFloat() )
213 enr = nonRecur->mDtEnd.addDays( 1 ); 213 enr = nonRecur->mDtEnd.addDays( 1 );
214 else 214 else
215 enr = nonRecur->mDtEnd; 215 enr = nonRecur->mDtEnd;
216 if ( enr < recurEvent->mDtStart ) 216 if ( enr < recurEvent->mDtStart )
217 return false; 217 return false;
218 if ( inFutureOnly && enr < QDateTime::currentDateTime() ) 218 if ( startDT && enr < *startDT )
219 return false; 219 return false;
220 int recDuration = recurEvent->mDtStart.secsTo( recurEvent->mDtEnd ); 220 int recDuration = recurEvent->mDtStart.secsTo( recurEvent->mDtEnd );
221 if ( recurEvent->doesFloat() ) 221 if ( recurEvent->doesFloat() )
222 recDuration += 86400; 222 recDuration += 86400;
223 bool ok = true; 223 bool ok = true;
224 QDateTime recStart = recurEvent->mDtStart.addSecs( -300);; 224 QDateTime recStart = recurEvent->mDtStart.addSecs( -300);;
225 while ( ok ) { 225 while ( ok ) {
226 recStart = recurEvent->getNextOccurence( recStart.addSecs( 60 ), &ok ); 226 recStart = recurEvent->getNextOccurence( recStart.addSecs( 60 ), &ok );
227 if ( ok ) { 227 if ( ok ) {
228 if ( recStart > enr ) 228 if ( recStart > enr )
229 return false; 229 return false;
230 QDateTime recEnd = recStart.addSecs( recDuration ); 230 QDateTime recEnd = recStart.addSecs( recDuration );
231 if ( nonRecur->mDtStart < recEnd && recStart < nonRecur->mDtEnd ) { 231 if ( nonRecur->mDtStart < recEnd && recStart < nonRecur->mDtEnd ) {
232 if ( nonRecur->mDtStart < recStart ) 232 if ( nonRecur->mDtStart < recStart )
233 *overlapDT = recStart; 233 *overlapDT = recStart;
234 else 234 else
235 *overlapDT = nonRecur->mDtStart; 235 *overlapDT = nonRecur->mDtStart;
236 if ( inFutureOnly ) { 236 if ( startDT ) {
237 if ( *overlapDT >= QDateTime::currentDateTime() ) 237 if ( *overlapDT >= *startDT )
238 return true; 238 return true;
239 } else 239 } else
240 return true; 240 return true;
241 } 241 }
242 } 242 }
243 } 243 }
244 return false; 244 return false;
245 } 245 }
246 246
247 QDateTime incidenceStart = mDtStart; 247 QDateTime incidenceStart = mDtStart;
248 int duration = mDtStart.secsTo( mDtEnd ); 248 int duration = mDtStart.secsTo( mDtEnd );
249 if ( doesFloat() ) 249 if ( doesFloat() )
250 duration += 86400; 250 duration += 86400;
251 QDateTime testincidenceStart = testEvent->mDtStart; 251 QDateTime testincidenceStart = testEvent->mDtStart;
252 int testduration = testEvent->mDtStart.secsTo( testEvent->mDtEnd ); 252 int testduration = testEvent->mDtStart.secsTo( testEvent->mDtEnd );
253 if ( testEvent->doesFloat() ) 253 if ( testEvent->doesFloat() )
254 testduration += 86400; 254 testduration += 86400;
255 bool computeThis = false; 255 bool computeThis = false;
256 if ( incidenceStart < testincidenceStart ) 256 if ( incidenceStart < testincidenceStart )
257 computeThis = true; 257 computeThis = true;
258 bool ok = true; 258 bool ok = true;
259 if ( computeThis ) 259 if ( computeThis )
260 incidenceStart = incidenceStart.addSecs( -300 ); 260 incidenceStart = incidenceStart.addSecs( -300 );
261 else 261 else
262 testincidenceStart = testincidenceStart.addSecs( -300 ); 262 testincidenceStart = testincidenceStart.addSecs( -300 );
263 int count = 0; 263 int count = 0;
264 while ( ok ) { 264 while ( ok ) {
265 ++count; 265 ++count;
266 if ( count > 1000 ) break; 266 if ( count > 1000 ) break;
267 if ( computeThis ) 267 if ( computeThis )
268 incidenceStart = getNextOccurence( incidenceStart.addSecs( 60 ), &ok ); 268 incidenceStart = getNextOccurence( incidenceStart.addSecs( 60 ), &ok );
269 else 269 else
270 testincidenceStart = testEvent->getNextOccurence( testincidenceStart.addSecs( 60 ), &ok ); 270 testincidenceStart = testEvent->getNextOccurence( testincidenceStart.addSecs( 60 ), &ok );
271 if ( ok ) { 271 if ( ok ) {
272 if ( incidenceStart < testincidenceStart.addSecs( testduration ) && testincidenceStart < incidenceStart.addSecs( duration ) ) { 272 if ( incidenceStart < testincidenceStart.addSecs( testduration ) && testincidenceStart < incidenceStart.addSecs( duration ) ) {
273 if ( incidenceStart < testincidenceStart ) 273 if ( incidenceStart < testincidenceStart )
274 *overlapDT = testincidenceStart; 274 *overlapDT = testincidenceStart;
275 else 275 else
276 *overlapDT = incidenceStart; 276 *overlapDT = incidenceStart;
277 if ( inFutureOnly ) { 277 if ( startDT ) {
278 if ( *overlapDT >= QDateTime::currentDateTime() ) 278 if ( *overlapDT >= *startDT )
279 return true; 279 return true;
280 } else 280 } else
281 return true; 281 return true;
282 } 282 }
283 computeThis = ( incidenceStart < testincidenceStart ); 283 computeThis = ( incidenceStart < testincidenceStart );
284 } 284 }
285 285
286 } 286 }
287 return false; 287 return false;
288} 288}
289QDateTime Event::getNextAlarmDateTime( bool * ok, int * offset, QDateTime start_dt ) const 289QDateTime Event::getNextAlarmDateTime( bool * ok, int * offset, QDateTime start_dt ) const
290{ 290{
291 *ok = false; 291 *ok = false;
292 if ( !alarmEnabled() ) 292 if ( !alarmEnabled() )
293 return QDateTime (); 293 return QDateTime ();
294 bool yes; 294 bool yes;
295 QDateTime incidenceStart = getNextOccurence( start_dt, &yes ); 295 QDateTime incidenceStart = getNextOccurence( start_dt, &yes );
296 if ( ! yes || cancelled() ) { 296 if ( ! yes || cancelled() ) {
297 *ok = false; 297 *ok = false;
298 return QDateTime (); 298 return QDateTime ();
299 } 299 }
300 300
301 bool enabled = false; 301 bool enabled = false;
302 Alarm* alarm; 302 Alarm* alarm;
303 int off = 0; 303 int off = 0;
304 QDateTime alarmStart = QDateTime::currentDateTime().addDays( 3650 );; 304 QDateTime alarmStart = QDateTime::currentDateTime().addDays( 3650 );;
305 // if ( QDateTime::currentDateTime() > incidenceStart ){ 305 // if ( QDateTime::currentDateTime() > incidenceStart ){
306// *ok = false; 306// *ok = false;
307// return incidenceStart; 307// return incidenceStart;
308// } 308// }
309 for (QPtrListIterator<Alarm> it(mAlarms); (alarm = it.current()) != 0; ++it) { 309 for (QPtrListIterator<Alarm> it(mAlarms); (alarm = it.current()) != 0; ++it) {
310 if (alarm->enabled()) { 310 if (alarm->enabled()) {
diff --git a/libkcal/event.h b/libkcal/event.h
index 80c11c4..e6055a5 100644
--- a/libkcal/event.h
+++ b/libkcal/event.h
@@ -45,49 +45,49 @@ class Event : public Incidence
45 Incidence *clone(); 45 Incidence *clone();
46 QDateTime getNextAlarmDateTime( bool * ok, int * offset ,QDateTime start_dt ) const; 46 QDateTime getNextAlarmDateTime( bool * ok, int * offset ,QDateTime start_dt ) const;
47 47
48 /** for setting an event's ending date/time with a QDateTime. */ 48 /** for setting an event's ending date/time with a QDateTime. */
49 void setDtEnd(const QDateTime &dtEnd); 49 void setDtEnd(const QDateTime &dtEnd);
50 /** Return the event's ending date/time as a QDateTime. */ 50 /** Return the event's ending date/time as a QDateTime. */
51 virtual QDateTime dtEnd() const; 51 virtual QDateTime dtEnd() const;
52 /** returns an event's end time as a string formatted according to the 52 /** returns an event's end time as a string formatted according to the
53 users locale settings */ 53 users locale settings */
54 QString dtEndTimeStr() const; 54 QString dtEndTimeStr() const;
55 /** returns an event's end date as a string formatted according to the 55 /** returns an event's end date as a string formatted according to the
56 users locale settings */ 56 users locale settings */
57 QString dtEndDateStr(bool shortfmt=true) const; 57 QString dtEndDateStr(bool shortfmt=true) const;
58 /** returns an event's end date and time as a string formatted according 58 /** returns an event's end date and time as a string formatted according
59 to the users locale settings */ 59 to the users locale settings */
60 QString dtEndStr(bool shortfmt=true) const; 60 QString dtEndStr(bool shortfmt=true) const;
61 void setHasEndDate(bool); 61 void setHasEndDate(bool);
62 /** Return whether the event has an end date/time. */ 62 /** Return whether the event has an end date/time. */
63 bool hasEndDate() const; 63 bool hasEndDate() const;
64 64
65 /** Return true if the event spans multiple days, otherwise return false. */ 65 /** Return true if the event spans multiple days, otherwise return false. */
66 bool isMultiDay() const; 66 bool isMultiDay() const;
67 67
68 /** set the event's time transparency level. */ 68 /** set the event's time transparency level. */
69 void setTransparency(Transparency transparency); 69 void setTransparency(Transparency transparency);
70 /** get the event's time transparency level. */ 70 /** get the event's time transparency level. */
71 Transparency transparency() const; 71 Transparency transparency() const;
72 72
73 void setDuration(int seconds); 73 void setDuration(int seconds);
74 74
75 bool contains ( Event*); 75 bool contains ( Event*);
76 76
77 bool isOverlapping ( Event*, QDateTime*, bool inFutureOnly ); 77 bool isOverlapping ( Event*, QDateTime*, QDateTime* );
78 78
79 private: 79 private:
80 bool accept(Visitor &v) { return v.visit(this); } 80 bool accept(Visitor &v) { return v.visit(this); }
81 81
82 QDateTime mDtEnd; 82 QDateTime mDtEnd;
83 bool mHasEndDate; 83 bool mHasEndDate;
84 Transparency mTransparency; 84 Transparency mTransparency;
85}; 85};
86 86
87bool operator==( const Event&, const Event& ); 87bool operator==( const Event&, const Event& );
88 88
89 89
90} 90}
91 91
92 92
93#endif 93#endif