1173 // We are creating an exception, hence get the global Uid |
1173 // We are creating an exception, hence get the global Uid |
1174 HBufC8* guid = calEntry->UidL().AllocLC(); |
1174 HBufC8* guid = calEntry->UidL().AllocLC(); |
1175 // create new (child) entry |
1175 // create new (child) entry |
1176 // Use original instance time for recurrenceID as this entry hasn't got one. |
1176 // Use original instance time for recurrenceID as this entry hasn't got one. |
1177 TCalTime originalCalTime = calEntry->StartTimeL(); |
1177 TCalTime originalCalTime = calEntry->StartTimeL(); |
1178 TDateTime origDateTime = originalCalTime.TimeLocalL().DateTime(); |
|
1179 // set the instance date to this |
|
1180 QDate date = entry.startTime().date(); |
|
1181 QTime time =entry.startTime().time(); |
|
1182 origDateTime.Set(date.year(), |
|
1183 static_cast<TMonth> (date.month() - 1), |
|
1184 date.day() - 1, |
|
1185 time.hour(), |
|
1186 time.minute(),time.second(), 0); |
|
1187 TTime originalTime(origDateTime); |
|
1188 originalCalTime.SetTimeLocalL(originalTime); |
|
1189 // create the new child now |
1178 // create the new child now |
1190 CCalEntry* newEntry = CCalEntry::NewL( calEntry->EntryTypeL(), |
1179 CCalEntry* newEntry = CCalEntry::NewL( calEntry->EntryTypeL(), |
1191 guid, |
1180 guid, |
1192 calEntry->MethodL(), |
1181 calEntry->MethodL(), |
1193 calEntry->SequenceNumberL(), |
1182 calEntry->SequenceNumberL(), |
1250 // We are creating an exception, hence get the global Uid |
1239 // We are creating an exception, hence get the global Uid |
1251 HBufC8* guid = calEntry->UidL().AllocLC(); |
1240 HBufC8* guid = calEntry->UidL().AllocLC(); |
1252 // create new (child) entry |
1241 // create new (child) entry |
1253 // Use original instance time for recurrenceID as this entry hasn't got one. |
1242 // Use original instance time for recurrenceID as this entry hasn't got one. |
1254 TCalTime originalCalTime = calEntry->StartTimeL(); |
1243 TCalTime originalCalTime = calEntry->StartTimeL(); |
1255 TDateTime origDateTime = originalCalTime.TimeLocalL().DateTime(); |
|
1256 // set only the instance date but not the time to this |
|
1257 QDate date = entry.startTime().date(); |
|
1258 QTime time =entry.startTime().time(); |
|
1259 origDateTime.Set(date.year(), |
|
1260 static_cast<TMonth> (date.month() - 1), |
|
1261 date.day() - 1, |
|
1262 origDateTime.Hour(), |
|
1263 origDateTime.Minute(), |
|
1264 origDateTime.Second(), |
|
1265 origDateTime.MicroSecond()); |
|
1266 TTime originalTime(origDateTime); |
|
1267 originalCalTime.SetTimeLocalL(originalTime); |
|
1268 // create the new child now |
1244 // create the new child now |
1269 CCalEntry* newEntry = CCalEntry::NewL( calEntry->EntryTypeL(), |
1245 CCalEntry* newEntry = CCalEntry::NewL( calEntry->EntryTypeL(), |
1270 guid, |
1246 guid, |
1271 calEntry->MethodL(), |
1247 calEntry->MethodL(), |
1272 calEntry->SequenceNumberL(), |
1248 calEntry->SequenceNumberL(), |
1664 CCalEntry::TType type = instanceList[i]->Entry().EntryTypeL(); |
1640 CCalEntry::TType type = instanceList[i]->Entry().EntryTypeL(); |
1665 // Get the start time and end time of the events |
1641 // Get the start time and end time of the events |
1666 TCalTime startCalTime = instanceList[i]->StartTimeL(); |
1642 TCalTime startCalTime = instanceList[i]->StartTimeL(); |
1667 TCalTime endCalTime = instanceList[i]->EndTimeL(); |
1643 TCalTime endCalTime = instanceList[i]->EndTimeL(); |
1668 TDateTime startDateTime = startCalTime.TimeLocalL().DateTime(); |
1644 TDateTime startDateTime = startCalTime.TimeLocalL().DateTime(); |
|
1645 TDateTime endDateTime = endCalTime.TimeLocalL().DateTime(); |
1669 QDate startDate(startDateTime.Year(), startDateTime.Month()+1, |
1646 QDate startDate(startDateTime.Year(), startDateTime.Month()+1, |
1670 startDateTime.Day() + 1); |
1647 startDateTime.Day() + 1); |
|
1648 QDate endDate(endDateTime.Year(), endDateTime.Month()+1, |
|
1649 endDateTime.Day() + 1); |
1671 if (type == CCalEntry::EEvent || type == CCalEntry::EAppt || |
1650 if (type == CCalEntry::EEvent || type == CCalEntry::EAppt || |
1672 type == CCalEntry::EReminder) { |
1651 type == CCalEntry::EReminder) { |
1673 if(endsAtStartOfDay(instanceList[i], endCalTime.TimeLocalL())) { |
1652 if(endsAtStartOfDay(instanceList[i], endCalTime.TimeLocalL())) { |
1674 // instance ends at start of endtime day, month view doesnt |
1653 // instance ends at start of endtime day, month view doesnt |
1675 // want to show event on this day |
1654 // want to show event on this day |
1678 TTime time(endDateTime); |
1657 TTime time(endDateTime); |
1679 if (time <= startDateForInstanceSearch.TimeLocalL()) { |
1658 if (time <= startDateForInstanceSearch.TimeLocalL()) { |
1680 continue; |
1659 continue; |
1681 } |
1660 } |
1682 } |
1661 } |
1683 |
1662 // Mark the required dates frm start date to end date |
1684 // Mark the required dates frm start date to end date |
1663 TTimeIntervalDays days ; |
1685 TTimeIntervalDays days = endCalTime.TimeLocalL().DaysFrom(startCalTime.TimeLocalL()); |
1664 //check if the start date of the entry is before the start day of the grid |
1686 for (int j = -1; j < days.Int(); j++) { |
1665 if(startDate < rangeStart.date()){ |
1687 QDate date = startDate.addDays(j+1); |
1666 if(endDate<=rangeEnd.date()){ |
1688 if (date <= rangeEnd.date()) { |
1667 //if the end date of entry is lying in the grid , |
1689 dates.append(date); |
1668 //then mark the entry from start day of the grid to the end date of the entry |
1690 } else { |
1669 days = endCalTime.TimeLocalL().DaysFrom(startDateForInstanceSearch.TimeLocalL()); |
1691 break; |
1670 } |
1692 } |
1671 else{ |
1693 } |
1672 //if end date of the entry is greater then the last date of grid, |
1694 } else if (type == CCalEntry::EAnniv) { |
1673 //then mark all the date of the grid with the entry |
1695 if (startDate <= rangeEnd.date()) { |
1674 days = endDateForInstanceSearch.TimeLocalL().DaysFrom(startDateForInstanceSearch.TimeLocalL()) ; |
1696 dates.append(startDate); |
1675 } |
1697 } |
1676 //start the entries from the first day of the grid |
1698 } else if (type == CCalEntry::ETodo) { |
1677 for (int j = 0; j <= days.Int(); j++) { |
1699 // if start time is less that today, then mark it for today |
1678 QDate date = rangeStart.date().addDays(j); |
1700 if (startDate < QDate::currentDate()) { |
1679 if (date <= rangeEnd.date()) { |
1701 dates.append(QDate::currentDate()); |
1680 dates.append(date); |
1702 } else { |
1681 } else { |
1703 dates.append(startDate); |
1682 break; |
1704 } |
1683 } |
1705 } |
1684 } |
1706 } |
1685 } |
1707 CleanupStack::PopAndDestroy(); |
1686 //if the start date of the entry is lying inside the grid |
|
1687 else{ |
|
1688 if(endDate<=rangeEnd.date()){ |
|
1689 //if the end date of entry is lying in the grid , |
|
1690 //then mark the entry from start date of the entry to the end date of the entry |
|
1691 days = endCalTime.TimeLocalL().DaysFrom(startCalTime.TimeLocalL()) ; |
|
1692 } |
|
1693 else{ |
|
1694 //if end date of the entry is greater then the last date of grid, |
|
1695 //then mark all the date from start date of the entry to the end date of the grid |
|
1696 days = endDateForInstanceSearch.TimeLocalL().DaysFrom(startCalTime.TimeLocalL()) ; |
|
1697 } |
|
1698 for (int j = 0; j <= days.Int(); j++) { |
|
1699 QDate date = startDate.addDays(j); |
|
1700 if (date <= rangeEnd.date()) { |
|
1701 dates.append(date); |
|
1702 } else { |
|
1703 break; |
|
1704 } |
|
1705 } |
|
1706 } |
|
1707 } else if (type == CCalEntry::EAnniv) { |
|
1708 if (startDate <= rangeEnd.date()) { |
|
1709 dates.append(startDate); |
|
1710 } |
|
1711 } else if (type == CCalEntry::ETodo) { |
|
1712 // if start time is less that today, then mark it for today |
|
1713 if (startDate < QDate::currentDate()) { |
|
1714 dates.append(QDate::currentDate()); |
|
1715 } else { |
|
1716 dates.append(startDate); |
|
1717 } |
|
1718 } |
|
1719 } |
|
1720 CleanupStack::PopAndDestroy(); |
1708 } |
1721 } |
1709 |
1722 |
1710 QList<AgendaEntry> AgendaUtilPrivate::createEntryIdListForDay( QDateTime day, |
1723 QList<AgendaEntry> AgendaUtilPrivate::createEntryIdListForDay( QDateTime day, |
1711 AgendaUtil::FilterFlags filter ) |
1724 AgendaUtil::FilterFlags filter ) |
1712 { |
1725 { |