| | 659 | void CDayWeekTable::AddTimedFreeBusy(iCal::CICalendarComponent* vfreebusy) |
| | 660 | { |
| | 661 | // Get the actual VFREEBUSY item |
| | 662 | iCal::CICalendarVFreeBusy* fb = dynamic_cast<iCal::CICalendarVFreeBusy*>(vfreebusy); |
| | 663 | if ((fb == NULL) || (fb->GetBusyTime() == NULL)) |
| | 664 | return; |
| | 665 | |
| | 666 | // Now look at each period |
| | 667 | CDayEvent* prev_event = NULL; |
| | 668 | for(iCal::CICalendarFreeBusyList::const_iterator iter1 = fb->GetBusyTime()->begin(); iter1 != fb->GetBusyTime()->end(); iter1++) |
| | 669 | { |
| | 670 | // Must be busy item |
| | 671 | if ((*iter1).GetType() == iCal::CICalendarFreeBusy::eFree) |
| | 672 | continue; |
| | 673 | |
| | 674 | iCal::CICalendarDateTime dtstart((*iter1).GetPeriod().GetStart()); |
| | 675 | iCal::CICalendarDateTime dtend((*iter1).GetPeriod().GetEnd()); |
| | 676 | |
| | 677 | // Iterate over each cell and see if event should be in it |
| | 678 | STableCell cell(cFirstTimedRow, 0); |
| | 679 | bool starts_in_first_column = false; |
| | 680 | bool ends_in_last_column = false; |
| | 681 | for(cell.col = 2; cell.col <= mCols; cell.col++) |
| | 682 | { |
| | 683 | const iCal::CICalendarDateTime& cell_start = GetTimedStartDate(cell); |
| | 684 | const iCal::CICalendarDateTime& cell_end = GetTimedEndDate(cell); |
| | 685 | |
| | 686 | // First check that event actually spans this day |
| | 687 | if ((dtend <= cell_start) || (dtstart >= cell_end)) |
| | 688 | continue; |
| | 689 | |
| | 690 | starts_in_first_column = ((*iter1).GetPeriod().GetStart() >= cell_start); |
| | 691 | ends_in_last_column = ((*iter1).GetPeriod().GetEnd() <= cell_end); |
| | 692 | |
| | 693 | Rect start_cellFrameQD; |
| | 694 | HIRect start_cellFrame; |
| | 695 | GetLocalCellRectAlways(cell, start_cellFrameQD); |
| | 696 | CGUtils::QDToHIRect(start_cellFrameQD, start_cellFrame); |
| | 697 | |
| | 698 | // Create new day event |
| | 699 | CDayEvent* event = CDayEvent::Create(this, start_cellFrame); |
| | 700 | event->Add_Listener(this); |
| | 701 | |
| | 702 | // For non-all day event that starts in this row, prepend its time to the title |
| | 703 | cdstring summary; |
| | 704 | if (starts_in_first_column && CPreferences::sPrefs->mDisplayTime.GetValue()) |
| | 705 | { |
| | 706 | summary = (*iter1).GetPeriod().GetStart().GetAdjustedTime(mTimezone).GetTime(false, !iCal::CICalendarLocale::Use24HourTime()); |
| | 707 | summary += " "; |
| | 708 | summary += rsrc::GetString("CDayWeekTable::Busy"); |
| | 709 | } |
| | 710 | else |
| | 711 | summary = rsrc::GetString("CDayWeekTable::Busy"); |
| | 712 | |
| | 713 | // Now set event details |
| | 714 | event->SetDetails(fb, (*iter1).GetPeriod(), this, summary.c_str(), false, starts_in_first_column, ends_in_last_column, false); |
| | 715 | event->SetColumnSpan(1); |
| | 716 | |
| | 717 | // Now link to previous one |
| | 718 | if (prev_event) |
| | 719 | { |
| | 720 | event->SetPreviousLink(prev_event); |
| | 721 | prev_event->SetNextLink(event); |
| | 722 | } |
| | 723 | prev_event = event; |
| | 724 | |
| | 725 | // Add to list |
| | 726 | mTimedEvents[cell.col - 2].push_back(event); |
| | 727 | |
| | 728 | // Now show it |
| | 729 | PositionTimedEvent(event, cell, cell_start.GetPosixTime()); |
| | 730 | event->SetVisible(true); |
| | 731 | } |
| | 732 | } |
| | 733 | } |
| | 734 | |
| 768 | | data.push_back(SEventInfo(*iter, true, col++, (*iter)->GetVEvent()->GetInstanceStart().GetPosixTime())); |
| 769 | | data.push_back(SEventInfo(*iter, false, col++, (*iter)->GetVEvent()->GetInstanceEnd().GetPosixTime())); |
| | 845 | data.push_back(SEventInfo(*iter, true, col++, (*iter)->GetInstancePeriod().GetStart().GetPosixTime())); |
| | 846 | data.push_back(SEventInfo(*iter, false, col++, (*iter)->GetInstancePeriod().GetEnd().GetPosixTime())); |