-rw-r--r-- | bin/kdepim/korganizer/germantranslation.txt | 13 | ||||
-rw-r--r-- | korganizer/calendarview.cpp | 133 | ||||
-rw-r--r-- | korganizer/kotodoview.cpp | 14 | ||||
-rw-r--r-- | libkcal/event.cpp | 115 | ||||
-rw-r--r-- | libkcal/event.h | 2 | ||||
-rw-r--r-- | libkcal/incidencebase.cpp | 8 | ||||
-rw-r--r-- | libkcal/incidencebase.h | 4 |
7 files changed, 232 insertions, 57 deletions
diff --git a/bin/kdepim/korganizer/germantranslation.txt b/bin/kdepim/korganizer/germantranslation.txt index b225594..43bc343 100644 --- a/bin/kdepim/korganizer/germantranslation.txt +++ b/bin/kdepim/korganizer/germantranslation.txt | |||
@@ -1456,65 +1456,62 @@ | |||
1456 | { "Cancel - do not start"," Abbrechen - Todo nicht starten" }, | 1456 | { "Cancel - do not start"," Abbrechen - Todo nicht starten" }, |
1457 | { "The timezone has changed!\nShould the calendar be reloaded\nto shift the time of the events?\nPlease read Menu: Help->FAQ:\n"How do I change the timezone?"\nas well!","Die Zeitzone wurde geändert!\nSollen die Kalender neu geladen\nwerden num die Zeiten\nder Termine zu ändern?\nBitte lesen Sie auch\nMenu: Help->FAQ:\n"How do I change the timezone?"" }, | 1457 | { "The timezone has changed!\nShould the calendar be reloaded\nto shift the time of the events?\nPlease read Menu: Help->FAQ:\n"How do I change the timezone?"\nas well!","Die Zeitzone wurde geändert!\nSollen die Kalender neu geladen\nwerden num die Zeiten\nder Termine zu ändern?\nBitte lesen Sie auch\nMenu: Help->FAQ:\n"How do I change the timezone?"" }, |
1458 | { "Reload","Neu laden" }, | 1458 | { "Reload","Neu laden" }, |
1459 | { "Timezone settings","Zeitzoneneinstellung" }, | 1459 | { "Timezone settings","Zeitzoneneinstellung" }, |
1460 | { "Title: ","Titel: " }, | 1460 | { "Title: ","Titel: " }, |
1461 | { "Journal from: ","Journal vom: " }, | 1461 | { "Journal from: ","Journal vom: " }, |
1462 | { "Journal: %1 from ","Journal: %1 vom " }, | 1462 | { "Journal: %1 from ","Journal: %1 vom " }, |
1463 | { "<b>Click here to edit categories: </b>","<b>Klicke hier um Kategorien zu ändern: </b>" }, | 1463 | { "<b>Click here to edit categories: </b>","<b>Klicke hier um Kategorien zu ändern: </b>" }, |
1464 | { "Selected Item","Ausgewähltes Item" }, | 1464 | { "Selected Item","Ausgewähltes Item" }, |
1465 | { "Select Date...","Wähle Datum..." }, | 1465 | { "Select Date...","Wähle Datum..." }, |
1466 | { "After importing/loading/syncing there may be new categories in events or todos which are not added automatically to the category list. Please choose what to do <b>now</b>:","Nach dem Importieren/Laden/Syncen kann es neue Kategorien in den Terminen oder Todos geben, die nicht automatisch der Kategorieliste hinzugefügt werden. Bitte wählen Sie, was <b>jetzt</b> passieren soll:" }, | 1466 | { "After importing/loading/syncing there may be new categories in events or todos which are not added automatically to the category list. Please choose what to do <b>now</b>:","Nach dem Importieren/Laden/Syncen kann es neue Kategorien in den Terminen oder Todos geben, die nicht automatisch der Kategorieliste hinzugefügt werden. Bitte wählen Sie, was <b>jetzt</b> passieren soll:" }, |
1467 | { "Change category list now!","Ändere Kategorieliste jetzt!" }, | 1467 | { "Change category list now!","Ändere Kategorieliste jetzt!" }, |
1468 | { "Edit category list...","Ändere Kategorieliste..." }, | 1468 | { "Edit category list...","Ändere Kategorieliste..." }, |
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 within the next two years","Kein Konflikt innerhalb der nächsten zwei Jahre 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" }, | ||
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" }, | ||
1507 | { "Show date","Zeige Datum" }, | ||
1508 | { "No problem!","Kein Problem!" }, | ||
1504 | { "","" }, | 1509 | { "","" }, |
1505 | { "","" }, | 1510 | { "","" }, |
1506 | { "","" }, | 1511 | { "","" }, |
1507 | { "","" }, | 1512 | { "","" }, |
1508 | { "","" }, | 1513 | { "","" }, |
1509 | { "","" }, | 1514 | { "","" }, |
1510 | { "","" }, | 1515 | { "","" }, |
1511 | { "","" }, | 1516 | { "","" }, |
1512 | { "","" }, | 1517 | { "","" }, |
1513 | { "","" }, | ||
1514 | { "","" }, | ||
1515 | { "","" }, | ||
1516 | { "","" }, | ||
1517 | { "","" }, | ||
1518 | |||
1519 | |||
1520 | |||
diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp index e766b8f..65750af 100644 --- a/korganizer/calendarview.cpp +++ b/korganizer/calendarview.cpp | |||
@@ -611,145 +611,202 @@ void CalendarView::init() | |||
611 | //mDateFrame->setFrameStyle(QFrame::PopupPanel | QFrame::Raised); | 611 | //mDateFrame->setFrameStyle(QFrame::PopupPanel | QFrame::Raised); |
612 | mDateFrame->setFrameStyle( QFrame::WinPanel |QFrame::Raised ); | 612 | mDateFrame->setFrameStyle( QFrame::WinPanel |QFrame::Raised ); |
613 | mDateFrame->setLineWidth(3); | 613 | mDateFrame->setLineWidth(3); |
614 | mDateFrame->hide(); | 614 | mDateFrame->hide(); |
615 | mDateFrame->setCaption( i18n( "Pick a date to display")); | 615 | mDateFrame->setCaption( i18n( "Pick a date to display")); |
616 | mDatePicker = new KDatePicker ( mDateFrame , QDate::currentDate() ); | 616 | mDatePicker = new KDatePicker ( mDateFrame , QDate::currentDate() ); |
617 | 617 | ||
618 | connect(mDatePicker,SIGNAL(dateSelected(QDate)),SLOT(slotSelectPickerDate(QDate))); | 618 | connect(mDatePicker,SIGNAL(dateSelected(QDate)),SLOT(slotSelectPickerDate(QDate))); |
619 | 619 | ||
620 | mEventEditor = mDialogManager->getEventEditor(); | 620 | mEventEditor = mDialogManager->getEventEditor(); |
621 | mTodoEditor = mDialogManager->getTodoEditor(); | 621 | mTodoEditor = mDialogManager->getTodoEditor(); |
622 | 622 | ||
623 | mFlagEditDescription = false; | 623 | mFlagEditDescription = false; |
624 | 624 | ||
625 | mSuspendTimer = new QTimer( this ); | 625 | mSuspendTimer = new QTimer( this ); |
626 | mAlarmTimer = new QTimer( this ); | 626 | mAlarmTimer = new QTimer( this ); |
627 | mRecheckAlarmTimer = new QTimer( this ); | 627 | mRecheckAlarmTimer = new QTimer( this ); |
628 | connect( mRecheckAlarmTimer, SIGNAL( timeout () ), SLOT( recheckTimerAlarm() ) ); | 628 | connect( mRecheckAlarmTimer, SIGNAL( timeout () ), SLOT( recheckTimerAlarm() ) ); |
629 | connect( mSuspendTimer, SIGNAL( timeout () ), SLOT( suspendAlarm() ) ); | 629 | connect( mSuspendTimer, SIGNAL( timeout () ), SLOT( suspendAlarm() ) ); |
630 | connect( mAlarmTimer, SIGNAL( timeout () ), SLOT( timerAlarm() ) ); | 630 | connect( mAlarmTimer, SIGNAL( timeout () ), SLOT( timerAlarm() ) ); |
631 | mAlarmDialog = new AlarmDialog( this ); | 631 | mAlarmDialog = new AlarmDialog( this ); |
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 | ||
646 | CalendarView::~CalendarView() | 646 | CalendarView::~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 | } |
657 | void CalendarView::nextConflict( bool all, bool allday ) | 657 | void CalendarView::nextConflict( bool all, bool allday ) |
658 | { | 658 | { |
659 | QDate start = mNavigator->selectedDates().first().addDays(1); | 659 | |
660 | QPtrList<Event> testlist = mCalendar->events(); | ||
661 | Event * test = testlist.first(); | ||
662 | while ( test ) { | ||
663 | test->setTagged( false ); | ||
664 | } | ||
665 | QDateTime startDT = QDateTime (mNavigator->selectedDates().first().addDays(1), QTime ( 0,0,0)); | ||
666 | QDateTime conflict; | ||
667 | QDateTime retVal; | ||
668 | bool found = false; | ||
669 | Event * cE = 0; | ||
670 | QPtrList<Event> testlist2 = testlist; | ||
671 | while ( test ) { | ||
672 | Event * test2 = testlist2.first(); | ||
673 | while ( test2 ) { | ||
674 | if ( !test2->isTagged() ) { | ||
675 | if ( test->isOverlapping ( test2, &retVal, true ) ) { | ||
676 | if ( ! found ) { | ||
677 | if ( retVal >= startDT ) { | ||
678 | conflict = retVal; | ||
679 | cE = test; | ||
680 | found = true; | ||
681 | } | ||
682 | } else { | ||
683 | if ( retVal >= startDT && retVal < conflict ) { | ||
684 | conflict = retVal; | ||
685 | cE = test; | ||
686 | } | ||
687 | } | ||
688 | } | ||
689 | } | ||
690 | test2 = testlist2.next(); | ||
691 | } | ||
692 | test->setTagged( true ); | ||
693 | test = testlist.next(); | ||
694 | } | ||
695 | if ( found ) { | ||
696 | if ( mViewManager->currentView() != mViewManager->agendaView() || mNavigator->selectedDates().count() > 1 ) | ||
697 | mViewManager->showDayView(); | ||
698 | mNavigator->slotDaySelect( conflict.date() ); | ||
699 | int hour = conflict.time().hour(); | ||
700 | mViewManager->agendaView()->setStartHour( hour ); | ||
701 | topLevelWidget()->setCaption( i18n("Conflict %1 <-> %2"). arg( mConflictingEvent->summary().left( 20 ) ).arg( cE->summary().left( 20 ) ) ); | ||
702 | return; | ||
703 | } | ||
704 | |||
705 | topLevelWidget()->setCaption( i18n("No conflict found within the next two years") ); | ||
706 | qDebug("No conflict found "); | ||
707 | return; | ||
708 | |||
709 | |||
710 | |||
711 | |||
712 | |||
713 | #if 0 | ||
714 | |||
715 | |||
660 | QDate end = start.addDays( 365*2); | 716 | QDate end = start.addDays( 365*2); |
661 | while ( start < end ) { | 717 | while ( start < end ) { |
662 | QPtrList<Event> eventList = calendar()->events( start ); | 718 | QPtrList<Event> eventList = calendar()->events( start ); |
663 | Event * ev = eventList.first(); | 719 | Event * ev = eventList.first(); |
664 | QPtrList<Event> test = eventList; | 720 | QPtrList<Event> test = eventList; |
665 | while ( ev ) { | 721 | while ( ev ) { |
666 | //qDebug("found %d on %s ", eventList.count(), start.toString().latin1()); | 722 | //qDebug("found %d on %s ", eventList.count(), start.toString().latin1()); |
667 | Event * t_ev = test.first(); | 723 | Event * t_ev = test.first(); |
668 | QDateTime es = ev->dtStart(); | 724 | QDateTime es = ev->dtStart(); |
669 | QDateTime ee = ev->dtEnd(); | 725 | QDateTime ee = ev->dtEnd(); |
670 | if ( ev->doesFloat() ) | 726 | if ( ev->doesFloat() ) |
671 | ee = ee.addDays( 1 ); | 727 | ee = ee.addDays( 1 ); |
672 | if ( ! all ) { | 728 | if ( ! all ) { |
673 | if ( ev->doesFloat() != allday ) | 729 | if ( ev->doesFloat() != allday ) |
674 | t_ev = 0; | 730 | t_ev = 0; |
675 | } | 731 | } |
676 | while ( t_ev ) { | 732 | while ( t_ev ) { |
677 | bool skip = false; | 733 | bool skip = false; |
678 | if ( ! all ) { | 734 | if ( ! all ) { |
679 | if ( t_ev->doesFloat() != allday ) | 735 | if ( t_ev->doesFloat() != allday ) |
680 | skip = true; | 736 | skip = true; |
681 | } | 737 | } |
682 | if ( !skip && ev != t_ev ) { | 738 | if ( !skip && ev != t_ev ) { |
683 | QDateTime ets = t_ev->dtStart(); | 739 | QDateTime ets = t_ev->dtStart(); |
684 | QDateTime ete = t_ev->dtEnd(); | 740 | QDateTime ete = t_ev->dtEnd(); |
685 | if ( t_ev->doesFloat() ) | 741 | if ( t_ev->doesFloat() ) |
686 | ete = ete.addDays( 1 ); | 742 | ete = ete.addDays( 1 ); |
687 | //qDebug("test %s -- %s -------- %s -- %s ", es.toString().latin1() , ee.toString().latin1(), ets.toString().latin1() , ete.toString().latin1() ); | 743 | //qDebug("test %s -- %s -------- %s -- %s ", es.toString().latin1() , ee.toString().latin1(), ets.toString().latin1() , ete.toString().latin1() ); |
688 | if ( es < ete && ets < ee ) { | 744 | if ( es < ete && ets < ee ) { |
689 | if ( mViewManager->currentView() != mViewManager->agendaView() || mNavigator->selectedDates().count() > 1 ) | 745 | if ( mViewManager->currentView() != mViewManager->agendaView() || mNavigator->selectedDates().count() > 1 ) |
690 | mViewManager->showDayView(); | 746 | mViewManager->showDayView(); |
691 | mNavigator->slotDaySelect( start ); | 747 | mNavigator->slotDaySelect( start ); |
692 | int hour = es.time().hour(); | 748 | int hour = es.time().hour(); |
693 | if ( ets > es ) | 749 | if ( ets > es ) |
694 | hour = ets.time().hour(); | 750 | hour = ets.time().hour(); |
695 | mViewManager->agendaView()->setStartHour( hour ); | 751 | mViewManager->agendaView()->setStartHour( hour ); |
696 | topLevelWidget()->setCaption( i18n("Conflict %1 <-> %2"). arg( ev->summary().left( 20 ) ).arg( t_ev->summary().left( 20 ) ) ); | 752 | topLevelWidget()->setCaption( i18n("Conflict %1 <-> %2"). arg( ev->summary().left( 20 ) ).arg( t_ev->summary().left( 20 ) ) ); |
697 | return; | 753 | return; |
698 | } | 754 | } |
699 | } | 755 | } |
700 | t_ev = test.next(); | 756 | t_ev = test.next(); |
701 | } | 757 | } |
702 | ev = eventList.next(); | 758 | ev = eventList.next(); |
703 | } | 759 | } |
704 | start = start.addDays( 1 ); | 760 | start = start.addDays( 1 ); |
705 | } | 761 | } |
706 | topLevelWidget()->setCaption( i18n("No conflict found within the next two years") ); | 762 | topLevelWidget()->setCaption( i18n("No conflict found within the next two years") ); |
707 | qDebug("No conflict found "); | 763 | qDebug("No conflict found "); |
764 | #endif | ||
708 | } | 765 | } |
709 | 766 | ||
710 | void CalendarView::conflictAll() | 767 | void CalendarView::conflictAll() |
711 | { | 768 | { |
712 | nextConflict ( true, true ); | 769 | nextConflict ( true, true ); |
713 | } | 770 | } |
714 | void CalendarView::conflictAllday() | 771 | void CalendarView::conflictAllday() |
715 | { | 772 | { |
716 | nextConflict ( false, true ); | 773 | nextConflict ( false, true ); |
717 | } | 774 | } |
718 | void CalendarView::conflictNotAll() | 775 | void CalendarView::conflictNotAll() |
719 | { | 776 | { |
720 | nextConflict ( false, false ); | 777 | nextConflict ( false, false ); |
721 | } | 778 | } |
722 | 779 | ||
723 | void CalendarView::setCalReadOnly( int id, bool readO ) | 780 | void CalendarView::setCalReadOnly( int id, bool readO ) |
724 | { | 781 | { |
725 | if ( readO ) { | 782 | if ( readO ) { |
726 | emit save(); | 783 | emit save(); |
727 | } | 784 | } |
728 | mCalendar->setReadOnly( id, readO ); | 785 | mCalendar->setReadOnly( id, readO ); |
729 | } | 786 | } |
730 | void CalendarView::setScrollBarStep(int val ) | 787 | void CalendarView::setScrollBarStep(int val ) |
731 | { | 788 | { |
732 | #ifdef DESKTOP_VERSION | 789 | #ifdef DESKTOP_VERSION |
733 | mDateScrollBar->setLineStep ( val ); | 790 | mDateScrollBar->setLineStep ( val ); |
734 | #endif | 791 | #endif |
735 | } | 792 | } |
736 | void CalendarView::scrollBarValue(int val ) | 793 | void CalendarView::scrollBarValue(int val ) |
737 | { | 794 | { |
738 | #ifdef DESKTOP_VERSION | 795 | #ifdef DESKTOP_VERSION |
739 | if ( QApplication::desktop()->width() < 800 ) return; | 796 | if ( QApplication::desktop()->width() < 800 ) return; |
740 | static bool block = false; | 797 | static bool block = false; |
741 | if ( block ) return; | 798 | if ( block ) return; |
742 | block = true; | 799 | block = true; |
743 | int count = mNavigator->selectedDates().count(); | 800 | int count = mNavigator->selectedDates().count(); |
744 | int day = mNavigator->selectedDates().first().dayOfYear(); | 801 | int day = mNavigator->selectedDates().first().dayOfYear(); |
745 | int stepdays = val; | 802 | int stepdays = val; |
746 | if ( mDateScrollBar->lineStep () <= count ) { | 803 | if ( mDateScrollBar->lineStep () <= count ) { |
747 | //val = val/mDateScrollBar->lineStep ()*mDateScrollBar->lineStep(); | 804 | //val = val/mDateScrollBar->lineStep ()*mDateScrollBar->lineStep(); |
748 | //qDebug("VAL %d ",val ); | 805 | //qDebug("VAL %d ",val ); |
749 | stepdays = (val-day)/mDateScrollBar->lineStep ()*mDateScrollBar->lineStep(); | 806 | stepdays = (val-day)/mDateScrollBar->lineStep ()*mDateScrollBar->lineStep(); |
750 | stepdays = day+stepdays; | 807 | stepdays = day+stepdays; |
751 | if ( stepdays < 0 ) stepdays = 0; | 808 | if ( stepdays < 0 ) stepdays = 0; |
752 | } | 809 | } |
753 | if ( stepdays == day ) { | 810 | if ( stepdays == day ) { |
754 | block = false; | 811 | block = false; |
755 | return; | 812 | return; |
@@ -2650,193 +2707,173 @@ void CalendarView::eventChanged(Event *event) | |||
2650 | } | 2707 | } |
2651 | 2708 | ||
2652 | void CalendarView::eventAdded(Event *event) | 2709 | void CalendarView::eventAdded(Event *event) |
2653 | { | 2710 | { |
2654 | changeEventDisplay(event,KOGlobals::EVENTADDED); | 2711 | changeEventDisplay(event,KOGlobals::EVENTADDED); |
2655 | } | 2712 | } |
2656 | 2713 | ||
2657 | void CalendarView::eventToBeDeleted(Event *) | 2714 | void CalendarView::eventToBeDeleted(Event *) |
2658 | { | 2715 | { |
2659 | kdDebug() << "CalendarView::eventToBeDeleted(): to be implemented" << endl; | 2716 | kdDebug() << "CalendarView::eventToBeDeleted(): to be implemented" << endl; |
2660 | } | 2717 | } |
2661 | 2718 | ||
2662 | void CalendarView::eventDeleted() | 2719 | void CalendarView::eventDeleted() |
2663 | { | 2720 | { |
2664 | changeEventDisplay(0,KOGlobals::EVENTDELETED); | 2721 | changeEventDisplay(0,KOGlobals::EVENTDELETED); |
2665 | } | 2722 | } |
2666 | void CalendarView::changeTodoDisplay(Todo *which, int action) | 2723 | void CalendarView::changeTodoDisplay(Todo *which, int action) |
2667 | { | 2724 | { |
2668 | changeIncidenceDisplay((Incidence *)which, action); | 2725 | changeIncidenceDisplay((Incidence *)which, action); |
2669 | mDateNavigator->updateView(); //LR | 2726 | mDateNavigator->updateView(); //LR |
2670 | //mDialogManager->updateSearchDialog(); | 2727 | //mDialogManager->updateSearchDialog(); |
2671 | 2728 | ||
2672 | if (which) { | 2729 | if (which) { |
2673 | mViewManager->updateWNview(); | 2730 | mViewManager->updateWNview(); |
2674 | //mTodoList->updateView(); | 2731 | //mTodoList->updateView(); |
2675 | } | 2732 | } |
2676 | 2733 | ||
2677 | } | 2734 | } |
2678 | 2735 | ||
2679 | void CalendarView::changeIncidenceDisplay(Incidence *which, int action) | 2736 | void CalendarView::changeIncidenceDisplay(Incidence *which, int action) |
2680 | { | 2737 | { |
2681 | updateUnmanagedViews(); | 2738 | updateUnmanagedViews(); |
2682 | //qDebug(" CalendarView::changeIncidenceDisplay++++++++++++++++++++++++++ %d %d ",which, action ); | 2739 | //qDebug(" CalendarView::changeIncidenceDisplay++++++++++++++++++++++++++ %d %d ",which, action ); |
2683 | if ( action == KOGlobals::EVENTDELETED ) { //delete | 2740 | if ( action == KOGlobals::EVENTDELETED ) { //delete |
2684 | mCalendar->checkAlarmForIncidence( 0, true ); | 2741 | mCalendar->checkAlarmForIncidence( 0, true ); |
2685 | if ( mEventViewerDialog ) | 2742 | if ( mEventViewerDialog ) |
2686 | mEventViewerDialog->hide(); | 2743 | mEventViewerDialog->hide(); |
2687 | } | 2744 | } |
2688 | else | 2745 | else |
2689 | mCalendar->checkAlarmForIncidence( which , false ); | 2746 | mCalendar->checkAlarmForIncidence( which , false ); |
2690 | } | 2747 | } |
2691 | 2748 | ||
2692 | // most of the changeEventDisplays() right now just call the view's | 2749 | // most of the changeEventDisplays() right now just call the view's |
2693 | // total update mode, but they SHOULD be recoded to be more refresh-efficient. | 2750 | // total update mode, but they SHOULD be recoded to be more refresh-efficient. |
2694 | void CalendarView::changeEventDisplay(Event *which, int action) | 2751 | void CalendarView::changeEventDisplay(Event *which, int action) |
2695 | { | 2752 | { |
2696 | // kdDebug() << "CalendarView::changeEventDisplay" << endl; | 2753 | // kdDebug() << "CalendarView::changeEventDisplay" << endl; |
2697 | changeIncidenceDisplay((Incidence *)which, action); | 2754 | changeIncidenceDisplay((Incidence *)which, action); |
2698 | |||
2699 | |||
2700 | static bool clearallviews = false; | 2755 | static bool clearallviews = false; |
2701 | if ( KOPrefs::instance()->mGlobalUpdateDisabled ) { | 2756 | if ( KOPrefs::instance()->mGlobalUpdateDisabled ) { |
2702 | if ( clearallviews ) { | 2757 | if ( clearallviews ) { |
2703 | clearAllViews(); | 2758 | clearAllViews(); |
2704 | clearallviews = false; | 2759 | clearallviews = false; |
2705 | } | 2760 | } |
2706 | return; | 2761 | return; |
2707 | } | 2762 | } |
2708 | clearallviews = true; | 2763 | clearallviews = true; |
2709 | |||
2710 | |||
2711 | |||
2712 | mDateNavigator->updateView(); | 2764 | mDateNavigator->updateView(); |
2713 | //mDialogManager->updateSearchDialog(); | 2765 | //mDialogManager->updateSearchDialog(); |
2714 | |||
2715 | if (which) { | 2766 | if (which) { |
2716 | // If there is an event view visible update the display | 2767 | // If there is an event view visible update the display |
2717 | mViewManager->currentView()->changeEventDisplay(which,action); | 2768 | mViewManager->currentView()->changeEventDisplay(which,action); |
2718 | // TODO: check, if update needed | 2769 | // TODO: check, if update needed |
2719 | // if (which->getTodoStatus()) { | 2770 | // if (which->getTodoStatus()) { |
2720 | mTodoList->updateView(); | 2771 | mTodoList->updateView(); |
2721 | if ( action != KOGlobals::EVENTDELETED ) { | 2772 | if ( action != KOGlobals::EVENTDELETED ) { |
2722 | mConflictingEvent = which ; | 2773 | mConflictingEvent = which ; |
2723 | QTimer::singleShot( 1000, this, SLOT ( checkConflictForEvent() ) ); | 2774 | QTimer::singleShot( 1000, this, SLOT ( checkConflictForEvent() ) ); |
2724 | } | 2775 | } |
2725 | // } | 2776 | // } |
2726 | } else { | 2777 | } else { |
2727 | mViewManager->currentView()->updateView(); | 2778 | mViewManager->currentView()->updateView(); |
2728 | } | 2779 | } |
2729 | } | 2780 | } |
2730 | void CalendarView::checkConflictForEvent() | 2781 | void CalendarView::checkConflictForEvent() |
2731 | { | 2782 | { |
2732 | 2783 | ||
2733 | if (!KOPrefs::instance()->mConfirm) | 2784 | if (!KOPrefs::instance()->mConfirm) |
2734 | return; | 2785 | return; |
2735 | if ( ! mConflictingEvent ) return; | 2786 | if ( ! mConflictingEvent ) return; |
2736 | if ( mConflictingEvent->doesFloat() ) { | 2787 | if ( mConflictingEvent->doesFloat() ) { |
2737 | mConflictingEvent = 0; | 2788 | mConflictingEvent = 0; |
2738 | return; | 2789 | return; |
2739 | } | 2790 | } |
2740 | bool all = false; | 2791 | QPtrList<Event> testlist = mCalendar->events(); |
2741 | bool allday = false; | 2792 | Event * test = testlist.first(); |
2742 | Event * ev = mConflictingEvent; | 2793 | QDateTime conflict; |
2743 | mConflictingEvent = 0; | 2794 | QDateTime retVal; |
2744 | QDate start = ev->dtStart().date(); | 2795 | bool found = false; |
2745 | QDate end = ev->dtEnd().date().addDays(1); | 2796 | Event * cE = 0; |
2746 | while ( start < end ) { | 2797 | while ( test ) { |
2747 | QPtrList<Event> test = calendar()->events( start ); | 2798 | if ( !test->doesFloat() ) { |
2748 | //qDebug("found %d on %s ", eventList.count(), start.toString().latin1()); | 2799 | if ( mConflictingEvent->isOverlapping ( test, &retVal, true ) ) { |
2749 | Event * t_ev = test.first(); | 2800 | if ( ! found ) { |
2750 | QDateTime es = ev->dtStart(); | 2801 | conflict = retVal; |
2751 | QDateTime ee = ev->dtEnd(); | 2802 | cE = test; |
2752 | if ( ev->doesFloat() ) | 2803 | } else { |
2753 | ee = ee.addDays( 1 ); | 2804 | if ( retVal < conflict ) { |
2754 | if ( ! all ) { | 2805 | conflict = retVal; |
2755 | if ( ev->doesFloat() != allday ) | 2806 | cE = test; |
2756 | t_ev = 0; | ||
2757 | } | 2807 | } |
2758 | while ( t_ev ) { | ||
2759 | bool skip = false; | ||
2760 | if ( ! all ) { | ||
2761 | if ( t_ev->doesFloat() != allday ) | ||
2762 | skip = true; | ||
2763 | } | 2808 | } |
2764 | if ( !skip && ev != t_ev ) { | 2809 | found = true; |
2765 | QDateTime ets = t_ev->dtStart(); | 2810 | } |
2766 | QDateTime ete = t_ev->dtEnd(); | 2811 | } |
2767 | if ( t_ev->doesFloat() ) | 2812 | test = testlist.next(); |
2768 | ete = ete.addDays( 1 ); | 2813 | } |
2769 | //qDebug("test %s -- %s -------- %s -- %s ", es.toString().latin1() , ee.toString().latin1(), ets.toString().latin1() , ete.toString().latin1() ); | 2814 | if ( found ) { |
2770 | if ( es < ete && ets < ee ) { | 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()) ) ; |
2771 | QString mess = i18n("The event\n%1\nconflicts with event\n%2\nat date\n%3.\n").arg(KGlobal::formatMessage ( ev->summary(),0 ) ).arg( KGlobal::formatMessage ( t_ev->summary(),0 )).arg(KGlobal::locale()->formatDate(start) ) ; | ||
2772 | qApp->processEvents(); | 2816 | qApp->processEvents(); |
2773 | int km = KMessageBox::warningContinueCancel(this,mess, | 2817 | int km = KMessageBox::warningContinueCancel(this,mess, |
2774 | i18n("KO/Pi Conflict delected"),i18n("Show date"),i18n("No problem!")); | 2818 | i18n("KO/Pi Conflict delected"),i18n("Show date"),i18n("No problem!")); |
2775 | if ( km != KMessageBox::Continue ) | 2819 | if ( km != KMessageBox::Continue ) |
2776 | return; | 2820 | return; |
2777 | 2821 | ||
2778 | if ( mViewManager->currentView() != mViewManager->agendaView() || mNavigator->selectedDates().count() > 1 ) | 2822 | if ( mViewManager->currentView() != mViewManager->agendaView() || mNavigator->selectedDates().count() > 1 ) |
2779 | mViewManager->showDayView(); | 2823 | mViewManager->showDayView(); |
2780 | mNavigator->slotDaySelect( start ); | 2824 | mNavigator->slotDaySelect( conflict.date() ); |
2781 | int hour = es.time().hour(); | 2825 | int hour = conflict.time().hour(); |
2782 | if ( ets > es ) | ||
2783 | hour = ets.time().hour(); | ||
2784 | mViewManager->agendaView()->setStartHour( hour ); | 2826 | mViewManager->agendaView()->setStartHour( hour ); |
2785 | topLevelWidget()->setCaption( i18n("Conflict %1 <-> %2"). arg( ev->summary().left( 20 ) ).arg( t_ev->summary().left( 20 ) ) ); | 2827 | topLevelWidget()->setCaption( i18n("Conflict %1 <-> %2"). arg( mConflictingEvent->summary().left( 20 ) ).arg( cE->summary().left( 20 ) ) ); |
2786 | return; | 2828 | return; |
2787 | } | 2829 | } |
2788 | } | ||
2789 | t_ev = test.next(); | ||
2790 | } | ||
2791 | start = start.addDays( 1 ); | ||
2792 | } | ||
2793 | qDebug("No conflict found "); | ||
2794 | 2830 | ||
2831 | return; | ||
2795 | 2832 | ||
2796 | } | 2833 | } |
2797 | 2834 | ||
2798 | void CalendarView::updateTodoViews() | 2835 | void CalendarView::updateTodoViews() |
2799 | { | 2836 | { |
2800 | mTodoList->updateView(); | 2837 | mTodoList->updateView(); |
2801 | mViewManager->currentView()->updateView(); | 2838 | mViewManager->currentView()->updateView(); |
2802 | 2839 | ||
2803 | } | 2840 | } |
2804 | 2841 | ||
2805 | 2842 | ||
2806 | 2843 | ||
2807 | void CalendarView::clearAllViews() | 2844 | void CalendarView::clearAllViews() |
2808 | { | 2845 | { |
2809 | mTodoList->clearList(); | 2846 | mTodoList->clearList(); |
2810 | mViewManager->clearAllViews(); | 2847 | mViewManager->clearAllViews(); |
2811 | SearchDialog * sd = mDialogManager->getSearchDialog(); | 2848 | SearchDialog * sd = mDialogManager->getSearchDialog(); |
2812 | if ( sd ) { | 2849 | if ( sd ) { |
2813 | KOListView* kol = sd->listview(); | 2850 | KOListView* kol = sd->listview(); |
2814 | if ( kol ) | 2851 | if ( kol ) |
2815 | kol->clearList(); | 2852 | kol->clearList(); |
2816 | } | 2853 | } |
2817 | } | 2854 | } |
2818 | void CalendarView::updateView() | 2855 | void CalendarView::updateView() |
2819 | { | 2856 | { |
2820 | static bool clearallviews = false; | 2857 | static bool clearallviews = false; |
2821 | if ( KOPrefs::instance()->mGlobalUpdateDisabled ) { | 2858 | if ( KOPrefs::instance()->mGlobalUpdateDisabled ) { |
2822 | if ( clearallviews ) { | 2859 | if ( clearallviews ) { |
2823 | clearAllViews(); | 2860 | clearAllViews(); |
2824 | clearallviews = false; | 2861 | clearallviews = false; |
2825 | } | 2862 | } |
2826 | return; | 2863 | return; |
2827 | } | 2864 | } |
2828 | clearallviews = true; | 2865 | clearallviews = true; |
2829 | DateList tmpList = mNavigator->selectedDates(); | 2866 | DateList tmpList = mNavigator->selectedDates(); |
2830 | 2867 | ||
2831 | if ( KOPrefs::instance()->mHideNonStartedTodos ) | 2868 | if ( KOPrefs::instance()->mHideNonStartedTodos ) |
2832 | mTodoList->updateView(); | 2869 | mTodoList->updateView(); |
2833 | // We assume that the navigator only selects consecutive days. | 2870 | // We assume that the navigator only selects consecutive days. |
2834 | updateView( tmpList.first(), tmpList.last() ); | 2871 | updateView( tmpList.first(), tmpList.last() ); |
2835 | } | 2872 | } |
2836 | 2873 | ||
2837 | void CalendarView::updateUnmanagedViews() | 2874 | void CalendarView::updateUnmanagedViews() |
2838 | { | 2875 | { |
2839 | mDateNavigator->updateDayMatrix(); | 2876 | mDateNavigator->updateDayMatrix(); |
2840 | } | 2877 | } |
2841 | 2878 | ||
2842 | int CalendarView::msgItemDelete(const QString name) | 2879 | int CalendarView::msgItemDelete(const QString name) |
diff --git a/korganizer/kotodoview.cpp b/korganizer/kotodoview.cpp index 2c017e1..c2ad886 100644 --- a/korganizer/kotodoview.cpp +++ b/korganizer/kotodoview.cpp | |||
@@ -357,96 +357,100 @@ void KOTodoListView::contentsMousePressEvent(QMouseEvent* e) | |||
357 | void KOTodoListView::paintEvent(QPaintEvent* e) | 357 | void KOTodoListView::paintEvent(QPaintEvent* e) |
358 | { | 358 | { |
359 | emit paintNeeded(); | 359 | emit paintNeeded(); |
360 | QListView::paintEvent( e); | 360 | QListView::paintEvent( e); |
361 | } | 361 | } |
362 | void KOTodoListView::contentsMouseMoveEvent(QMouseEvent* e) | 362 | void KOTodoListView::contentsMouseMoveEvent(QMouseEvent* e) |
363 | { | 363 | { |
364 | 364 | ||
365 | #ifndef KORG_NODND | 365 | #ifndef KORG_NODND |
366 | //QListView::contentsMouseMoveEvent(e); | 366 | //QListView::contentsMouseMoveEvent(e); |
367 | if (mMousePressed && (mPressPos - e->pos()).manhattanLength() > | 367 | if (mMousePressed && (mPressPos - e->pos()).manhattanLength() > |
368 | QApplication::startDragDistance()*3) { | 368 | QApplication::startDragDistance()*3) { |
369 | mMousePressed = false; | 369 | mMousePressed = false; |
370 | QListViewItem *item = itemAt(contentsToViewport(mPressPos)); | 370 | QListViewItem *item = itemAt(contentsToViewport(mPressPos)); |
371 | if (item) { | 371 | if (item) { |
372 | DndFactory factory( mCalendar ); | 372 | DndFactory factory( mCalendar ); |
373 | ICalDrag *vd = factory.createDrag( | 373 | ICalDrag *vd = factory.createDrag( |
374 | ((KOTodoViewItem *)item)->todo(),viewport()); | 374 | ((KOTodoViewItem *)item)->todo(),viewport()); |
375 | internalDrop = false; | 375 | internalDrop = false; |
376 | // we cannot do any senseful here, because the DnD is still broken in Qt | 376 | // we cannot do any senseful here, because the DnD is still broken in Qt |
377 | if (vd->drag()) { | 377 | if (vd->drag()) { |
378 | if ( !internalDrop ) { | 378 | if ( !internalDrop ) { |
379 | //emit deleteTodo( ((KOTodoViewItem *)item)->todo() ); | 379 | //emit deleteTodo( ((KOTodoViewItem *)item)->todo() ); |
380 | qDebug("Dnd: External move: Delete drag source "); | 380 | qDebug("Dnd: External move: Delete drag source "); |
381 | } else | 381 | } else |
382 | qDebug("Dnd: Internal move "); | 382 | qDebug("Dnd: Internal move "); |
383 | 383 | ||
384 | } else { | 384 | } else { |
385 | if ( !internalDrop ) { | 385 | if ( !internalDrop ) { |
386 | qDebug("Dnd: External Copy"); | 386 | qDebug("Dnd: External Copy"); |
387 | } else | 387 | } else |
388 | qDebug("DnD: Internal copy: Copy pending"); | 388 | qDebug("DnD: Internal copy: Copy pending"); |
389 | } | 389 | } |
390 | } | 390 | } |
391 | } | 391 | } |
392 | #endif | 392 | #endif |
393 | } | 393 | } |
394 | void KOTodoListView::keyReleaseEvent ( QKeyEvent *e ) | 394 | void KOTodoListView::keyReleaseEvent ( QKeyEvent *e ) |
395 | { | 395 | { |
396 | if ( !e->isAutoRepeat() ) { | 396 | if ( !e->isAutoRepeat() ) { |
397 | mFlagKeyPressed = false; | 397 | mFlagKeyPressed = false; |
398 | } | 398 | } |
399 | } | 399 | } |
400 | 400 | ||
401 | 401 | ||
402 | void KOTodoListView::keyPressEvent ( QKeyEvent * e ) | 402 | void KOTodoListView::keyPressEvent ( QKeyEvent * e ) |
403 | { | 403 | { |
404 | qApp->processEvents(); | 404 | qApp->processEvents(); |
405 | if ( !isVisible() ) { | ||
406 | e->ignore(); | ||
407 | return; | ||
408 | } | ||
405 | if ( e->isAutoRepeat() && !mFlagKeyPressed ) { | 409 | if ( e->isAutoRepeat() && !mFlagKeyPressed ) { |
406 | e->ignore(); | 410 | e->ignore(); |
407 | // qDebug(" ignore %d",e->isAutoRepeat() ); | 411 | // qDebug(" ignore %d",e->isAutoRepeat() ); |
408 | return; | 412 | return; |
409 | } | 413 | } |
410 | if (! e->isAutoRepeat() ) | 414 | if (! e->isAutoRepeat() ) |
411 | mFlagKeyPressed = true; | 415 | mFlagKeyPressed = true; |
412 | QListViewItem* cn; | 416 | QListViewItem* cn; |
413 | if ( e->key() == Qt::Key_Return || e->key() == Qt::Key_Enter ) { | 417 | if ( e->key() == Qt::Key_Return || e->key() == Qt::Key_Enter ) { |
414 | cn = currentItem(); | 418 | cn = currentItem(); |
415 | if ( cn ) { | 419 | if ( cn ) { |
416 | KOTodoViewItem* ci = (KOTodoViewItem*)( cn ); | 420 | KOTodoViewItem* ci = (KOTodoViewItem*)( cn ); |
417 | if ( ci ){ | 421 | if ( ci ){ |
418 | if ( e->state() == ShiftButton ) | 422 | if ( e->state() == ShiftButton ) |
419 | ci->setOn( false ); | 423 | ci->setOn( false ); |
420 | else | 424 | else |
421 | ci->setOn( true ); | 425 | ci->setOn( true ); |
422 | cn = cn->itemBelow(); | 426 | cn = cn->itemBelow(); |
423 | if ( cn ) { | 427 | if ( cn ) { |
424 | setCurrentItem ( cn ); | 428 | setCurrentItem ( cn ); |
425 | ensureItemVisible ( cn ); | 429 | ensureItemVisible ( cn ); |
426 | } | 430 | } |
427 | 431 | ||
428 | } | 432 | } |
429 | } | 433 | } |
430 | 434 | ||
431 | return; | 435 | return; |
432 | } | 436 | } |
433 | 437 | ||
434 | if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton || mName != "todolistsmall" ) { | 438 | if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton || mName != "todolistsmall" ) { |
435 | switch ( e->key() ) { | 439 | switch ( e->key() ) { |
436 | case Qt::Key_Down: | 440 | case Qt::Key_Down: |
437 | case Qt::Key_Up: | 441 | case Qt::Key_Up: |
438 | QListView::keyPressEvent ( e ); | 442 | QListView::keyPressEvent ( e ); |
439 | break; | 443 | break; |
440 | case Qt::Key_Left: | 444 | case Qt::Key_Left: |
441 | case Qt::Key_Right: | 445 | case Qt::Key_Right: |
442 | QListView::keyPressEvent ( e ); | 446 | QListView::keyPressEvent ( e ); |
443 | e->accept(); | 447 | e->accept(); |
444 | return; | 448 | return; |
445 | break; | 449 | break; |
446 | default: | 450 | default: |
447 | e->ignore(); | 451 | e->ignore(); |
448 | break; | 452 | break; |
449 | } | 453 | } |
450 | return; | 454 | return; |
451 | } | 455 | } |
452 | e->ignore(); | 456 | e->ignore(); |
@@ -1555,103 +1559,113 @@ void KOTodoView::toggleCompleted() | |||
1555 | KOPrefs::instance()->mShowCompletedTodo = !KOPrefs::instance()->mShowCompletedTodo; | 1559 | KOPrefs::instance()->mShowCompletedTodo = !KOPrefs::instance()->mShowCompletedTodo; |
1556 | mPopupMenu->setItemChecked( 3,KOPrefs::instance()->mShowCompletedTodo ); | 1560 | mPopupMenu->setItemChecked( 3,KOPrefs::instance()->mShowCompletedTodo ); |
1557 | mItemPopupMenu->setItemChecked( 33 , KOPrefs::instance()->mShowCompletedTodo ); | 1561 | mItemPopupMenu->setItemChecked( 33 , KOPrefs::instance()->mShowCompletedTodo ); |
1558 | updateView(); | 1562 | updateView(); |
1559 | if ( KOPrefs::instance()->mShowCompletedTodo ) | 1563 | if ( KOPrefs::instance()->mShowCompletedTodo ) |
1560 | topLevelWidget()->setCaption(i18n("Show Completed")); | 1564 | topLevelWidget()->setCaption(i18n("Show Completed")); |
1561 | else | 1565 | else |
1562 | topLevelWidget()->setCaption(i18n("Hide Completed")); | 1566 | topLevelWidget()->setCaption(i18n("Hide Completed")); |
1563 | } | 1567 | } |
1564 | 1568 | ||
1565 | void KOTodoView::addQuickTodo() | 1569 | void KOTodoView::addQuickTodo() |
1566 | { | 1570 | { |
1567 | addQuickTodoPar( 0 ); | 1571 | addQuickTodoPar( 0 ); |
1568 | } | 1572 | } |
1569 | void KOTodoView::addQuickTodoPar( Todo * parentTodo) | 1573 | void KOTodoView::addQuickTodoPar( Todo * parentTodo) |
1570 | { | 1574 | { |
1571 | Todo *todo = new Todo(); | 1575 | Todo *todo = new Todo(); |
1572 | todo->setSummary(mQuickAdd->text()); | 1576 | todo->setSummary(mQuickAdd->text()); |
1573 | todo->setOrganizer(KOPrefs::instance()->email()); | 1577 | todo->setOrganizer(KOPrefs::instance()->email()); |
1574 | if ( parentTodo ) { | 1578 | if ( parentTodo ) { |
1575 | todo->setRelatedTo(parentTodo); | 1579 | todo->setRelatedTo(parentTodo); |
1576 | 1580 | ||
1577 | todo->setCategories (parentTodo->categoriesStr ()); | 1581 | todo->setCategories (parentTodo->categoriesStr ()); |
1578 | todo->setSecrecy (parentTodo->secrecy ()); | 1582 | todo->setSecrecy (parentTodo->secrecy ()); |
1579 | if ( parentTodo->priority() < 3 ) | 1583 | if ( parentTodo->priority() < 3 ) |
1580 | todo->setPriority( parentTodo->priority() ); | 1584 | todo->setPriority( parentTodo->priority() ); |
1581 | todo->setCalID( parentTodo->calID() ); | 1585 | todo->setCalID( parentTodo->calID() ); |
1582 | } else { | 1586 | } else { |
1583 | CalFilter * cf = mCalendar->filter(); | 1587 | CalFilter * cf = mCalendar->filter(); |
1584 | if ( cf ) { | 1588 | if ( cf ) { |
1585 | if ( cf->isEnabled()&& cf->showCategories()) { | 1589 | if ( cf->isEnabled()&& cf->showCategories()) { |
1586 | todo->setCategories(cf->categoryList()); | 1590 | todo->setCategories(cf->categoryList()); |
1587 | } | 1591 | } |
1588 | if ( cf->isEnabled() ) | 1592 | if ( cf->isEnabled() ) |
1589 | todo->setSecrecy( cf->getSecrecy()); | 1593 | todo->setSecrecy( cf->getSecrecy()); |
1590 | } | 1594 | } |
1591 | } | 1595 | } |
1592 | mCalendar->addTodo(todo); | 1596 | mCalendar->addTodo(todo); |
1593 | mQuickAdd->setText(""); | 1597 | mQuickAdd->setText(""); |
1594 | todoModified (todo, KOGlobals::EVENTADDED ); | 1598 | todoModified (todo, KOGlobals::EVENTADDED ); |
1595 | updateView(); | 1599 | updateView(); |
1596 | 1600 | ||
1597 | } | 1601 | } |
1598 | void KOTodoView::keyPressEvent ( QKeyEvent * e ) | 1602 | void KOTodoView::keyPressEvent ( QKeyEvent * e ) |
1599 | { | 1603 | { |
1600 | // e->ignore(); | 1604 | // e->ignore(); |
1601 | //return; | 1605 | //return; |
1602 | //qDebug("KOTodoView::keyPressEvent "); | 1606 | //qDebug("KOTodoView::keyPressEvent "); |
1607 | if ( !isVisible() ) { | ||
1608 | e->ignore(); | ||
1609 | return; | ||
1610 | } | ||
1603 | switch ( e->key() ) { | 1611 | switch ( e->key() ) { |
1604 | case Qt::Key_Down: | 1612 | case Qt::Key_Down: |
1605 | case Qt::Key_Up: | 1613 | case Qt::Key_Up: |
1606 | QWidget::keyPressEvent ( e ); | 1614 | QWidget::keyPressEvent ( e ); |
1607 | break; | 1615 | break; |
1608 | 1616 | ||
1609 | case Qt::Key_Q: | 1617 | case Qt::Key_Q: |
1618 | |||
1619 | |||
1620 | if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton ) { | ||
1621 | e->ignore(); | ||
1622 | break; | ||
1623 | } | ||
1610 | toggleQuickTodo(); | 1624 | toggleQuickTodo(); |
1611 | break; | 1625 | break; |
1612 | case Qt::Key_U: | 1626 | case Qt::Key_U: |
1613 | if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) { | 1627 | if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) { |
1614 | mActiveItem = (KOTodoViewItem*)mTodoListView->currentItem(); | 1628 | mActiveItem = (KOTodoViewItem*)mTodoListView->currentItem(); |
1615 | unparentTodo(); | 1629 | unparentTodo(); |
1616 | e->accept(); | 1630 | e->accept(); |
1617 | } else | 1631 | } else |
1618 | e->ignore(); | 1632 | e->ignore(); |
1619 | break; | 1633 | break; |
1620 | case Qt::Key_S: | 1634 | case Qt::Key_S: |
1621 | if ( e->state() == Qt::ControlButton ) { | 1635 | if ( e->state() == Qt::ControlButton ) { |
1622 | e->ignore(); | 1636 | e->ignore(); |
1623 | break; | 1637 | break; |
1624 | } | 1638 | } |
1625 | if ( e->state() == Qt::ShiftButton ) { | 1639 | if ( e->state() == Qt::ShiftButton ) { |
1626 | mActiveItem = (KOTodoViewItem*)mTodoListView->currentItem(); | 1640 | mActiveItem = (KOTodoViewItem*)mTodoListView->currentItem(); |
1627 | reparentTodo(); | 1641 | reparentTodo(); |
1628 | e->accept(); | 1642 | e->accept(); |
1629 | } else | 1643 | } else |
1630 | e->ignore(); | 1644 | e->ignore(); |
1631 | break; | 1645 | break; |
1632 | case Qt::Key_P: | 1646 | case Qt::Key_P: |
1633 | if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) { | 1647 | if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) { |
1634 | mActiveItem = (KOTodoViewItem*)mTodoListView->currentItem(); | 1648 | mActiveItem = (KOTodoViewItem*)mTodoListView->currentItem(); |
1635 | if ( pendingSubtodo ) | 1649 | if ( pendingSubtodo ) |
1636 | itemClicked(mActiveItem); | 1650 | itemClicked(mActiveItem); |
1637 | e->accept(); | 1651 | e->accept(); |
1638 | } else | 1652 | } else |
1639 | e->ignore(); | 1653 | e->ignore(); |
1640 | break; | 1654 | break; |
1641 | case Qt::Key_Escape: | 1655 | case Qt::Key_Escape: |
1642 | if ( pendingSubtodo ) { | 1656 | if ( pendingSubtodo ) { |
1643 | itemClicked(0); | 1657 | itemClicked(0); |
1644 | e->accept(); | 1658 | e->accept(); |
1645 | } else | 1659 | } else |
1646 | e->ignore(); | 1660 | e->ignore(); |
1647 | break; | 1661 | break; |
1648 | default: | 1662 | default: |
1649 | e->ignore(); | 1663 | e->ignore(); |
1650 | } | 1664 | } |
1651 | 1665 | ||
1652 | if ( true ) { | 1666 | if ( true ) { |
1653 | if ( e->key() == Qt::Key_I ) { | 1667 | if ( e->key() == Qt::Key_I ) { |
1654 | KOTodoViewItem*cn = (KOTodoViewItem*)mTodoListView->currentItem(); | 1668 | KOTodoViewItem*cn = (KOTodoViewItem*)mTodoListView->currentItem(); |
1655 | if ( cn ) { | 1669 | if ( cn ) { |
1656 | mActiveItem = cn; | 1670 | mActiveItem = cn; |
1657 | KOTodoViewItem* ci = (KOTodoViewItem*)( cn ); | 1671 | KOTodoViewItem* ci = (KOTodoViewItem*)( cn ); |
diff --git a/libkcal/event.cpp b/libkcal/event.cpp index 7cd81fa..235ae55 100644 --- a/libkcal/event.cpp +++ b/libkcal/event.cpp | |||
@@ -126,96 +126,211 @@ QDateTime Event::dtEnd() const | |||
126 | QString Event::dtEndTimeStr() const | 126 | QString Event::dtEndTimeStr() const |
127 | { | 127 | { |
128 | return KGlobal::locale()->formatTime(mDtEnd.time()); | 128 | return KGlobal::locale()->formatTime(mDtEnd.time()); |
129 | } | 129 | } |
130 | 130 | ||
131 | QString Event::dtEndDateStr(bool shortfmt) const | 131 | QString Event::dtEndDateStr(bool shortfmt) const |
132 | { | 132 | { |
133 | return KGlobal::locale()->formatDate(mDtEnd.date(),shortfmt); | 133 | return KGlobal::locale()->formatDate(mDtEnd.date(),shortfmt); |
134 | } | 134 | } |
135 | 135 | ||
136 | QString Event::dtEndStr(bool shortfmt) const | 136 | QString Event::dtEndStr(bool shortfmt) const |
137 | { | 137 | { |
138 | return KGlobal::locale()->formatDateTime(mDtEnd, shortfmt); | 138 | return KGlobal::locale()->formatDateTime(mDtEnd, shortfmt); |
139 | } | 139 | } |
140 | 140 | ||
141 | void Event::setHasEndDate(bool b) | 141 | void Event::setHasEndDate(bool b) |
142 | { | 142 | { |
143 | mHasEndDate = b; | 143 | mHasEndDate = b; |
144 | } | 144 | } |
145 | 145 | ||
146 | bool Event::hasEndDate() const | 146 | bool Event::hasEndDate() const |
147 | { | 147 | { |
148 | return mHasEndDate; | 148 | return mHasEndDate; |
149 | } | 149 | } |
150 | 150 | ||
151 | bool Event::isMultiDay() const | 151 | bool 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 | ||
157 | void Event::setTransparency(Event::Transparency transparency) | 157 | void 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 | ||
164 | Event::Transparency Event::transparency() const | 164 | Event::Transparency Event::transparency() const |
165 | { | 165 | { |
166 | return mTransparency; | 166 | return mTransparency; |
167 | } | 167 | } |
168 | 168 | ||
169 | void Event::setDuration(int seconds) | 169 | void Event::setDuration(int seconds) |
170 | { | 170 | { |
171 | setHasEndDate(false); | 171 | setHasEndDate(false); |
172 | Incidence::setDuration(seconds); | 172 | Incidence::setDuration(seconds); |
173 | } | 173 | } |
174 | bool Event::isOverlapping ( Event* testEvent, QDateTime* overlapDT, bool inFutureOnly ) | ||
175 | { | ||
176 | if ( testEvent == this ) | ||
177 | return false; | ||
178 | if ( ! doesRecur() && !testEvent->doesRecur() ) { | ||
179 | QDateTime te; | ||
180 | if ( testEvent->doesFloat() ) | ||
181 | te = testEvent->mDtEnd.addDays( 1 ); | ||
182 | else | ||
183 | te = testEvent->mDtEnd; | ||
184 | QDateTime e; | ||
185 | if ( doesFloat() ) | ||
186 | e = mDtEnd.addDays( 1 ); | ||
187 | else | ||
188 | e = mDtEnd; | ||
189 | if ( mDtStart < te && testEvent->mDtStart < e ) { | ||
190 | if ( mDtStart < testEvent->mDtStart ) | ||
191 | *overlapDT = testEvent->mDtStart; | ||
192 | else | ||
193 | *overlapDT = mDtStart; | ||
194 | if ( inFutureOnly ) | ||
195 | return (*overlapDT >= QDateTime::currentDateTime() ); | ||
196 | return true; | ||
197 | } | ||
198 | return false; | ||
199 | } | ||
200 | Event *nonRecur = 0; | ||
201 | Event *recurEvent = 0; | ||
202 | if ( ! doesRecur() ) { | ||
203 | nonRecur = this; | ||
204 | recurEvent = testEvent; | ||
205 | } | ||
206 | else if ( !testEvent->doesRecur() ) { | ||
207 | nonRecur = testEvent; | ||
208 | recurEvent = this; | ||
209 | } | ||
210 | if ( nonRecur ) { | ||
211 | QDateTime enr; | ||
212 | if ( nonRecur->doesFloat() ) | ||
213 | enr = nonRecur->mDtEnd.addDays( 1 ); | ||
214 | else | ||
215 | enr = nonRecur->mDtEnd; | ||
216 | if ( enr < recurEvent->mDtStart ) | ||
217 | return false; | ||
218 | if ( inFutureOnly && enr < QDateTime::currentDateTime() ) | ||
219 | return false; | ||
220 | int recDuration = recurEvent->mDtStart.secsTo( recurEvent->mDtEnd ); | ||
221 | if ( recurEvent->doesFloat() ) | ||
222 | recDuration += 86400; | ||
223 | bool ok = true; | ||
224 | QDateTime recStart = recurEvent->mDtStart.addSecs( -300);; | ||
225 | while ( ok ) { | ||
226 | recStart = recurEvent->getNextOccurence( recStart.addSecs( 60 ), &ok ); | ||
227 | if ( ok ) { | ||
228 | if ( recStart > enr ) | ||
229 | return false; | ||
230 | QDateTime recEnd = recStart.addSecs( recDuration ); | ||
231 | if ( nonRecur->mDtStart < recEnd && recStart < nonRecur->mDtEnd ) { | ||
232 | if ( nonRecur->mDtStart < recStart ) | ||
233 | *overlapDT = recStart; | ||
234 | else | ||
235 | *overlapDT = nonRecur->mDtStart; | ||
236 | if ( inFutureOnly ) { | ||
237 | if ( *overlapDT >= QDateTime::currentDateTime() ) | ||
238 | return true; | ||
239 | } else | ||
240 | return true; | ||
241 | } | ||
242 | } | ||
243 | } | ||
244 | return false; | ||
245 | } | ||
246 | |||
247 | QDateTime incidenceStart = mDtStart; | ||
248 | int duration = mDtStart.secsTo( mDtEnd ); | ||
249 | if ( doesFloat() ) | ||
250 | duration += 86400; | ||
251 | QDateTime testincidenceStart = testEvent->mDtStart; | ||
252 | int testduration = testEvent->mDtStart.secsTo( testEvent->mDtEnd ); | ||
253 | if ( testEvent->doesFloat() ) | ||
254 | testduration += 86400; | ||
255 | bool computeThis = false; | ||
256 | if ( incidenceStart < testincidenceStart ) | ||
257 | computeThis = true; | ||
258 | bool ok = true; | ||
259 | if ( computeThis ) | ||
260 | incidenceStart = incidenceStart.addSecs( -300 ); | ||
261 | else | ||
262 | testincidenceStart = testincidenceStart.addSecs( -300 ); | ||
263 | int count = 0; | ||
264 | while ( ok ) { | ||
265 | ++count; | ||
266 | if ( count > 1000 ) break; | ||
267 | if ( computeThis ) | ||
268 | incidenceStart = getNextOccurence( incidenceStart.addSecs( 60 ), &ok ); | ||
269 | else | ||
270 | testincidenceStart = testEvent->getNextOccurence( testincidenceStart.addSecs( 60 ), &ok ); | ||
271 | if ( ok ) { | ||
272 | if ( incidenceStart < testincidenceStart.addSecs( testduration ) && testincidenceStart < incidenceStart.addSecs( duration ) ) { | ||
273 | if ( incidenceStart < testincidenceStart ) | ||
274 | *overlapDT = testincidenceStart; | ||
275 | else | ||
276 | *overlapDT = incidenceStart; | ||
277 | if ( inFutureOnly ) { | ||
278 | if ( *overlapDT >= QDateTime::currentDateTime() ) | ||
279 | return true; | ||
280 | } else | ||
281 | return true; | ||
282 | } | ||
283 | computeThis = ( incidenceStart < testincidenceStart ); | ||
284 | } | ||
285 | |||
286 | } | ||
287 | return false; | ||
288 | } | ||
174 | QDateTime Event::getNextAlarmDateTime( bool * ok, int * offset, QDateTime start_dt ) const | 289 | QDateTime Event::getNextAlarmDateTime( bool * ok, int * offset, QDateTime start_dt ) const |
175 | { | 290 | { |
176 | *ok = false; | 291 | *ok = false; |
177 | if ( !alarmEnabled() ) | 292 | if ( !alarmEnabled() ) |
178 | return QDateTime (); | 293 | return QDateTime (); |
179 | bool yes; | 294 | bool yes; |
180 | QDateTime incidenceStart = getNextOccurence( start_dt, &yes ); | 295 | QDateTime incidenceStart = getNextOccurence( start_dt, &yes ); |
181 | if ( ! yes || cancelled() ) { | 296 | if ( ! yes || cancelled() ) { |
182 | *ok = false; | 297 | *ok = false; |
183 | return QDateTime (); | 298 | return QDateTime (); |
184 | } | 299 | } |
185 | 300 | ||
186 | bool enabled = false; | 301 | bool enabled = false; |
187 | Alarm* alarm; | 302 | Alarm* alarm; |
188 | int off = 0; | 303 | int off = 0; |
189 | QDateTime alarmStart = QDateTime::currentDateTime().addDays( 3650 );; | 304 | QDateTime alarmStart = QDateTime::currentDateTime().addDays( 3650 );; |
190 | // if ( QDateTime::currentDateTime() > incidenceStart ){ | 305 | // if ( QDateTime::currentDateTime() > incidenceStart ){ |
191 | // *ok = false; | 306 | // *ok = false; |
192 | // return incidenceStart; | 307 | // return incidenceStart; |
193 | // } | 308 | // } |
194 | for (QPtrListIterator<Alarm> it(mAlarms); (alarm = it.current()) != 0; ++it) { | 309 | for (QPtrListIterator<Alarm> it(mAlarms); (alarm = it.current()) != 0; ++it) { |
195 | if (alarm->enabled()) { | 310 | if (alarm->enabled()) { |
196 | if ( alarm->hasTime () ) { | 311 | if ( alarm->hasTime () ) { |
197 | if ( alarm->time() < alarmStart ) { | 312 | if ( alarm->time() < alarmStart ) { |
198 | alarmStart = alarm->time(); | 313 | alarmStart = alarm->time(); |
199 | enabled = true; | 314 | enabled = true; |
200 | off = alarmStart.secsTo( incidenceStart ); | 315 | off = alarmStart.secsTo( incidenceStart ); |
201 | } | 316 | } |
202 | 317 | ||
203 | } else { | 318 | } else { |
204 | int secs = alarm->startOffset().asSeconds(); | 319 | int secs = alarm->startOffset().asSeconds(); |
205 | if ( incidenceStart.addSecs( secs ) < alarmStart ) { | 320 | if ( incidenceStart.addSecs( secs ) < alarmStart ) { |
206 | alarmStart = incidenceStart.addSecs( secs ); | 321 | alarmStart = incidenceStart.addSecs( secs ); |
207 | enabled = true; | 322 | enabled = true; |
208 | off = -secs; | 323 | off = -secs; |
209 | } | 324 | } |
210 | } | 325 | } |
211 | } | 326 | } |
212 | } | 327 | } |
213 | if ( enabled ) { | 328 | if ( enabled ) { |
214 | if ( alarmStart > start_dt ) { | 329 | if ( alarmStart > start_dt ) { |
215 | *ok = true; | 330 | *ok = true; |
216 | * offset = off; | 331 | * offset = off; |
217 | return alarmStart; | 332 | return alarmStart; |
218 | } | 333 | } |
219 | } | 334 | } |
220 | *ok = false; | 335 | *ok = false; |
221 | return QDateTime (); | 336 | return QDateTime (); |
diff --git a/libkcal/event.h b/libkcal/event.h index 287d403..80c11c4 100644 --- a/libkcal/event.h +++ b/libkcal/event.h | |||
@@ -29,63 +29,65 @@ namespace KCal { | |||
29 | 29 | ||
30 | /** | 30 | /** |
31 | This class provides an Event in the sense of RFC2445. | 31 | This class provides an Event in the sense of RFC2445. |
32 | */ | 32 | */ |
33 | class Event : public Incidence | 33 | class Event : public Incidence |
34 | { | 34 | { |
35 | public: | 35 | public: |
36 | enum Transparency { Opaque, Transparent }; | 36 | enum Transparency { Opaque, Transparent }; |
37 | typedef ListBase<Event> List; | 37 | typedef ListBase<Event> List; |
38 | Event(); | 38 | Event(); |
39 | Event(const Event &); | 39 | Event(const Event &); |
40 | ~Event(); | 40 | ~Event(); |
41 | 41 | ||
42 | QCString type() const { return "Event"; } | 42 | QCString type() const { return "Event"; } |
43 | IncTypeID typeID() const { return eventID; } | 43 | IncTypeID typeID() const { return eventID; } |
44 | 44 | ||
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 ); | ||
78 | |||
77 | private: | 79 | private: |
78 | bool accept(Visitor &v) { return v.visit(this); } | 80 | bool accept(Visitor &v) { return v.visit(this); } |
79 | 81 | ||
80 | QDateTime mDtEnd; | 82 | QDateTime mDtEnd; |
81 | bool mHasEndDate; | 83 | bool mHasEndDate; |
82 | Transparency mTransparency; | 84 | Transparency mTransparency; |
83 | }; | 85 | }; |
84 | 86 | ||
85 | bool operator==( const Event&, const Event& ); | 87 | bool operator==( const Event&, const Event& ); |
86 | 88 | ||
87 | 89 | ||
88 | } | 90 | } |
89 | 91 | ||
90 | 92 | ||
91 | #endif | 93 | #endif |
diff --git a/libkcal/incidencebase.cpp b/libkcal/incidencebase.cpp index 96039df..dcead02 100644 --- a/libkcal/incidencebase.cpp +++ b/libkcal/incidencebase.cpp | |||
@@ -94,96 +94,104 @@ bool KCal::operator==( const IncidenceBase& i1, const IncidenceBase& i2 ) | |||
94 | Attendee * a1 = i1.attendees().first(), *a2 =i2.attendees().first() ; | 94 | Attendee * a1 = i1.attendees().first(), *a2 =i2.attendees().first() ; |
95 | while ( a1 ) { | 95 | while ( a1 ) { |
96 | if ( !( (*a1) == (*a2)) ) | 96 | if ( !( (*a1) == (*a2)) ) |
97 | { | 97 | { |
98 | //qDebug("Attendee not equal "); | 98 | //qDebug("Attendee not equal "); |
99 | return false; | 99 | return false; |
100 | } | 100 | } |
101 | a1 = i1.attendees().next(); | 101 | a1 = i1.attendees().next(); |
102 | a2 = i2.attendees().next(); | 102 | a2 = i2.attendees().next(); |
103 | } | 103 | } |
104 | } | 104 | } |
105 | //if ( i1.dtStart() != i2.dtStart() ) | 105 | //if ( i1.dtStart() != i2.dtStart() ) |
106 | // return false; | 106 | // return false; |
107 | #if 0 | 107 | #if 0 |
108 | qDebug("1 %d ",i1.doesFloat() == i2.doesFloat() ); | 108 | qDebug("1 %d ",i1.doesFloat() == i2.doesFloat() ); |
109 | qDebug("1 %d ",i1.duration() == i2.duration() ); | 109 | qDebug("1 %d ",i1.duration() == i2.duration() ); |
110 | qDebug("3 %d ",i1.hasDuration() == i2.hasDuration() ); | 110 | qDebug("3 %d ",i1.hasDuration() == i2.hasDuration() ); |
111 | qDebug("1 %d ",i1.pilotId() == i2.pilotId() ); | 111 | qDebug("1 %d ",i1.pilotId() == i2.pilotId() ); |
112 | qDebug("1 %d %d %d",i1.syncStatus() == i2.syncStatus() , i1.syncStatus(),i2.syncStatus() ); | 112 | qDebug("1 %d %d %d",i1.syncStatus() == i2.syncStatus() , i1.syncStatus(),i2.syncStatus() ); |
113 | qDebug("6 %d ",i1.organizer() == i2.organizer() ); | 113 | qDebug("6 %d ",i1.organizer() == i2.organizer() ); |
114 | 114 | ||
115 | #endif | 115 | #endif |
116 | if ( i1.hasDuration() == i2.hasDuration() ) { | 116 | if ( i1.hasDuration() == i2.hasDuration() ) { |
117 | if ( i1.hasDuration() ) { | 117 | if ( i1.hasDuration() ) { |
118 | if ( i1.duration() != i2.duration() ) | 118 | if ( i1.duration() != i2.duration() ) |
119 | return false; | 119 | return false; |
120 | } | 120 | } |
121 | } else { | 121 | } else { |
122 | return false; | 122 | return false; |
123 | } | 123 | } |
124 | 124 | ||
125 | return ( i1.organizer() == i2.organizer() && | 125 | return ( i1.organizer() == i2.organizer() && |
126 | // i1.uid() == i2.uid() && | 126 | // i1.uid() == i2.uid() && |
127 | // Don't compare lastModified, otherwise the operator is not | 127 | // Don't compare lastModified, otherwise the operator is not |
128 | // of much use. We are not comparing for identity, after all. | 128 | // of much use. We are not comparing for identity, after all. |
129 | i1.doesFloat() == i2.doesFloat() && | 129 | i1.doesFloat() == i2.doesFloat() && |
130 | i1.pilotId() == i2.pilotId() );// && i1.syncStatus() == i2.syncStatus() ); | 130 | i1.pilotId() == i2.pilotId() );// && i1.syncStatus() == i2.syncStatus() ); |
131 | // no need to compare mObserver | 131 | // no need to compare mObserver |
132 | } | 132 | } |
133 | 133 | ||
134 | 134 | ||
135 | QDateTime IncidenceBase::getEvenTime( QDateTime dt ) | 135 | QDateTime IncidenceBase::getEvenTime( QDateTime dt ) |
136 | { | 136 | { |
137 | QTime t = dt.time(); | 137 | QTime t = dt.time(); |
138 | dt.setTime( QTime (t.hour (), t.minute (), t.second () ) ); | 138 | dt.setTime( QTime (t.hour (), t.minute (), t.second () ) ); |
139 | return dt; | 139 | return dt; |
140 | } | 140 | } |
141 | 141 | ||
142 | bool IncidenceBase::isTagged() const | ||
143 | { | ||
144 | return mIsTagged; | ||
145 | } | ||
146 | void IncidenceBase::setTagged( bool b) | ||
147 | { | ||
148 | mIsTagged = b; | ||
149 | } | ||
142 | void IncidenceBase::setCalID( int id ) | 150 | void IncidenceBase::setCalID( int id ) |
143 | { | 151 | { |
144 | if ( mCalID > 0 ) | 152 | if ( mCalID > 0 ) |
145 | updated(); | 153 | updated(); |
146 | mCalID = id; | 154 | mCalID = id; |
147 | } | 155 | } |
148 | int IncidenceBase::calID() const | 156 | int IncidenceBase::calID() const |
149 | { | 157 | { |
150 | return mCalID; | 158 | return mCalID; |
151 | } | 159 | } |
152 | void IncidenceBase::setCalEnabled( bool b ) | 160 | void IncidenceBase::setCalEnabled( bool b ) |
153 | { | 161 | { |
154 | mCalEnabled = b; | 162 | mCalEnabled = b; |
155 | } | 163 | } |
156 | bool IncidenceBase::calEnabled() const | 164 | bool IncidenceBase::calEnabled() const |
157 | { | 165 | { |
158 | return mCalEnabled; | 166 | return mCalEnabled; |
159 | } | 167 | } |
160 | 168 | ||
161 | void IncidenceBase::setAlarmEnabled( bool b ) | 169 | void IncidenceBase::setAlarmEnabled( bool b ) |
162 | { | 170 | { |
163 | mAlarmEnabled = b; | 171 | mAlarmEnabled = b; |
164 | } | 172 | } |
165 | bool IncidenceBase::alarmEnabled() const | 173 | bool IncidenceBase::alarmEnabled() const |
166 | { | 174 | { |
167 | return mAlarmEnabled; | 175 | return mAlarmEnabled; |
168 | } | 176 | } |
169 | 177 | ||
170 | 178 | ||
171 | void IncidenceBase::setUid(const QString &uid) | 179 | void IncidenceBase::setUid(const QString &uid) |
172 | { | 180 | { |
173 | mUid = uid; | 181 | mUid = uid; |
174 | updated(); | 182 | updated(); |
175 | } | 183 | } |
176 | 184 | ||
177 | QString IncidenceBase::uid() const | 185 | QString IncidenceBase::uid() const |
178 | { | 186 | { |
179 | return mUid; | 187 | return mUid; |
180 | } | 188 | } |
181 | 189 | ||
182 | void IncidenceBase::setLastModified(const QDateTime &lm) | 190 | void IncidenceBase::setLastModified(const QDateTime &lm) |
183 | { | 191 | { |
184 | // DON'T! updated() because we call this from | 192 | // DON'T! updated() because we call this from |
185 | // Calendar::updateEvent(). | 193 | // Calendar::updateEvent(). |
186 | mLastModified = getEvenTime(lm); | 194 | mLastModified = getEvenTime(lm); |
187 | //qDebug("IncidenceBase::setLastModified %s ",lm.toString().latin1()); | 195 | //qDebug("IncidenceBase::setLastModified %s ",lm.toString().latin1()); |
188 | } | 196 | } |
189 | 197 | ||
diff --git a/libkcal/incidencebase.h b/libkcal/incidencebase.h index dc6024a..bccf287 100644 --- a/libkcal/incidencebase.h +++ b/libkcal/incidencebase.h | |||
@@ -102,82 +102,84 @@ class IncidenceBase : public CustomProperties | |||
102 | Add Attendee to this incidence. IncidenceBase takes ownership of the | 102 | Add Attendee to this incidence. IncidenceBase takes ownership of the |
103 | Attendee object. | 103 | Attendee object. |
104 | */ | 104 | */ |
105 | bool addAttendee(Attendee *a, bool doupdate=true ); | 105 | bool addAttendee(Attendee *a, bool doupdate=true ); |
106 | // void removeAttendee(Attendee *a); | 106 | // void removeAttendee(Attendee *a); |
107 | // void removeAttendee(const char *n); | 107 | // void removeAttendee(const char *n); |
108 | /** Remove all Attendees. */ | 108 | /** Remove all Attendees. */ |
109 | void clearAttendees(); | 109 | void clearAttendees(); |
110 | /** Return list of attendees. */ | 110 | /** Return list of attendees. */ |
111 | QPtrList<Attendee> attendees() const { return mAttendees; }; | 111 | QPtrList<Attendee> attendees() const { return mAttendees; }; |
112 | /** Return number of attendees. */ | 112 | /** Return number of attendees. */ |
113 | int attendeeCount() const { return mAttendees.count(); }; | 113 | int attendeeCount() const { return mAttendees.count(); }; |
114 | /** Return the Attendee with this email */ | 114 | /** Return the Attendee with this email */ |
115 | Attendee* attendeeByMail(const QString &); | 115 | Attendee* attendeeByMail(const QString &); |
116 | /** Return first Attendee with one of this emails */ | 116 | /** Return first Attendee with one of this emails */ |
117 | Attendee* attendeeByMails(const QStringList &, const QString& email = QString::null); | 117 | Attendee* attendeeByMails(const QStringList &, const QString& email = QString::null); |
118 | 118 | ||
119 | /** pilot syncronization states */ | 119 | /** pilot syncronization states */ |
120 | enum { SYNCNONE = 0, SYNCMOD = 1, SYNCDEL = 3 }; | 120 | enum { SYNCNONE = 0, SYNCMOD = 1, SYNCDEL = 3 }; |
121 | /** Set synchronisation satus. */ | 121 | /** Set synchronisation satus. */ |
122 | void setSyncStatus(int stat); | 122 | void setSyncStatus(int stat); |
123 | /** Return synchronisation status. */ | 123 | /** Return synchronisation status. */ |
124 | int syncStatus() const; | 124 | int syncStatus() const; |
125 | 125 | ||
126 | /** Set Pilot Id. */ | 126 | /** Set Pilot Id. */ |
127 | void setPilotId(int id); | 127 | void setPilotId(int id); |
128 | /** Return Pilot Id. */ | 128 | /** Return Pilot Id. */ |
129 | int pilotId() const; | 129 | int pilotId() const; |
130 | 130 | ||
131 | void setTempSyncStat(int id); | 131 | void setTempSyncStat(int id); |
132 | int tempSyncStat() const; | 132 | int tempSyncStat() const; |
133 | void setIDStr( const QString & ); | 133 | void setIDStr( const QString & ); |
134 | QString IDStr() const; | 134 | QString IDStr() const; |
135 | void setID( const QString &, const QString & ); | 135 | void setID( const QString &, const QString & ); |
136 | QString getID( const QString & ); | 136 | QString getID( const QString & ); |
137 | void setCsum( const QString &, const QString & ); | 137 | void setCsum( const QString &, const QString & ); |
138 | QString getCsum( const QString & ); | 138 | QString getCsum( const QString & ); |
139 | void removeID(const QString &); | 139 | void removeID(const QString &); |
140 | 140 | ||
141 | void registerObserver( Observer * ); | 141 | void registerObserver( Observer * ); |
142 | void unRegisterObserver( Observer * ); | 142 | void unRegisterObserver( Observer * ); |
143 | void updated(); | 143 | void updated(); |
144 | void setCalID( int id ); | 144 | void setCalID( int id ); |
145 | int calID() const; | 145 | int calID() const; |
146 | void setCalEnabled( bool ); | 146 | void setCalEnabled( bool ); |
147 | bool calEnabled() const; | 147 | bool calEnabled() const; |
148 | void setAlarmEnabled( bool ); | 148 | void setAlarmEnabled( bool ); |
149 | bool alarmEnabled() const; | 149 | bool alarmEnabled() const; |
150 | 150 | bool isTagged() const; | |
151 | void setTagged( bool ); | ||
151 | protected: | 152 | protected: |
153 | bool mIsTagged; | ||
152 | QDateTime mDtStart; | 154 | QDateTime mDtStart; |
153 | bool mReadOnly; | 155 | bool mReadOnly; |
154 | QDateTime getEvenTime( QDateTime ); | 156 | QDateTime getEvenTime( QDateTime ); |
155 | 157 | ||
156 | private: | 158 | private: |
157 | // base components | 159 | // base components |
158 | QString mOrganizer; | 160 | QString mOrganizer; |
159 | QString mUid; | 161 | QString mUid; |
160 | int mCalID; | 162 | int mCalID; |
161 | bool mCalEnabled; | 163 | bool mCalEnabled; |
162 | bool mAlarmEnabled; | 164 | bool mAlarmEnabled; |
163 | QDateTime mLastModified; | 165 | QDateTime mLastModified; |
164 | QPtrList<Attendee> mAttendees; | 166 | QPtrList<Attendee> mAttendees; |
165 | 167 | ||
166 | bool mFloats; | 168 | bool mFloats; |
167 | 169 | ||
168 | int mDuration; | 170 | int mDuration; |
169 | bool mHasDuration; | 171 | bool mHasDuration; |
170 | QString mExternalId; | 172 | QString mExternalId; |
171 | int mTempSyncStat; | 173 | int mTempSyncStat; |
172 | 174 | ||
173 | // PILOT SYNCHRONIZATION STUFF | 175 | // PILOT SYNCHRONIZATION STUFF |
174 | int mPilotId; // unique id for pilot sync | 176 | int mPilotId; // unique id for pilot sync |
175 | int mSyncStatus; // status (for sync) | 177 | int mSyncStatus; // status (for sync) |
176 | 178 | ||
177 | QPtrList<Observer> mObservers; | 179 | QPtrList<Observer> mObservers; |
178 | }; | 180 | }; |
179 | 181 | ||
180 | bool operator==( const IncidenceBase&, const IncidenceBase& ); | 182 | bool operator==( const IncidenceBase&, const IncidenceBase& ); |
181 | } | 183 | } |
182 | 184 | ||
183 | #endif | 185 | #endif |