calendarui/views/dayview/src/calendayutils.cpp
changeset 81 ce92091cbd61
parent 70 a5ed90760192
child 83 5aadd1120515
equal deleted inserted replaced
75:7ac58b2aae6f 81:ce92091cbd61
   138     ASSERT(mMainWindow);
   138     ASSERT(mMainWindow);
   139     
   139     
   140     return mMainWindow;
   140     return mMainWindow;
   141 }
   141 }
   142 
   142 
   143 /*!
   143 /*
   144  \brief getEventValidStartEndTime
   144  * Get event's start/end time fromm agenda entry.
   145  \brief Get event's valid start/end time from agenda entry.
   145  * Start/end time are validated to be within the current day (the case of
   146  */
   146  * multi-day events)
   147 void CalenDayUtils::getEventValidStartEndTime( QDateTime& start, QDateTime& end, 
   147  * @param start [out] valid start time
   148                                     const AgendaEntry& entry, QDateTime& currentDate )
   148  * @param end [out] valid end time
       
   149  * @param entry [in] agenda entry asociated with the event.
       
   150  * @param currentDate [in] current date
       
   151  */
       
   152 void CalenDayUtils::getEventValidStartEndTime(
       
   153     QDateTime& start,
       
   154     QDateTime& end,
       
   155     const AgendaEntry& entry,
       
   156     QDateTime& currentDate)
   149 {
   157 {
   150     start = entry.startTime();
   158     start = entry.startTime();
   151     end = entry.endTime();
   159     end = entry.endTime();
   152     
   160 
   153     if ( !CalenDateUtils::onSameDay( start, currentDate ) ) {
   161     if (!CalenDateUtils::onSameDay(start, currentDate)) {
   154         start = CalenDateUtils::beginningOfDay( currentDate );
   162         start = CalenDateUtils::beginningOfDay(currentDate);
   155     }
   163     }
   156     
   164 
   157     if ( !CalenDateUtils::onSameDay( end, currentDate ) ) {
   165     if (!CalenDateUtils::onSameDay(end, currentDate)) {
   158        QDateTime tommorrow( currentDate.addDays( 1 ));
   166         QDateTime tommorrow(currentDate.addDays(1));
   159        end = CalenDateUtils::beginningOfDay( tommorrow ).addSecs( -60 );
   167         end = CalenDateUtils::beginningOfDay(tommorrow).addSecs(-60);
   160     }
   168     }
   161 }
   169 }
   162 
   170 
   163 /*!
   171 /*!
   164  \brief Constructor
   172  \brief Constructor