calendarui/commonutils/src/calenagendautils.cpp
changeset 57 bb2d3e476f29
parent 45 b6db4fd4947b
child 89 b57382753122
--- a/calendarui/commonutils/src/calenagendautils.cpp	Mon Jul 26 13:54:38 2010 +0530
+++ b/calendarui/commonutils/src/calenagendautils.cpp	Mon Aug 09 18:30:52 2010 +0530
@@ -50,4 +50,38 @@
     return result;
     }
 
+ // ---------------------------------------------------------------------------
+ // CalenAgendaUtils::IsAllDayEvent
+ // Allday event is an event  with a duration of n*24h.
+ // ---------------------------------------------------------------------------
+ //
+ bool CalenAgendaUtils::isAlldayEvent( const AgendaEntry& entry )
+     {
+     
+     TRACE_ENTRY_POINT;
+
+     bool allDayEvent( false );
+     if (AgendaEntry::TypeAppoinment == entry.type() ||
+             AgendaEntry::TypeEvent == entry.type()) {    
+         QDateTime startTime = entry.startTime();
+         QDateTime stopTime  = entry.endTime();
+     
+         int differenceInDays = startTime.daysTo(stopTime);
+         if( startTime != stopTime && 
+                 startTime == CalenDateUtils::beginningOfDay( startTime ) && 
+                 stopTime == CalenDateUtils::beginningOfDay( stopTime ) && 
+                 differenceInDays >= 1 )
+             {
+             allDayEvent = true;
+             }
+         else
+             {
+             allDayEvent = false;
+             }
+     }
+     
+     TRACE_EXIT_POINT;
+     return allDayEvent;
+     }
+
 //  End of File