Commit e54c5cbc authored by Bertjan Broeksema's avatar Bertjan Broeksema

SVN_SILENT: krazy2 - Use const & in foreach loops.

svn path=/branches/work/kdepim_kcalcore/incidenceeditors/incidenceeditor-ng/; revision=1158256
parent abe01e1b
......@@ -105,22 +105,23 @@ void FreePeriodModel::slotNewFreePeriods( const KCalCore::Period::List& freePeri
KCalCore::Period::List FreePeriodModel::splitPeriodsByDay( const KCalCore::Period::List& freePeriods )
{
KCalCore::Period::List splitList;
foreach( KCalCore::Period period, freePeriods ) {
foreach( const KCalCore::Period &period, freePeriods ) {
if( period.start().date() == period.end().date() ) {
splitList << period; // period occurs on the same day
continue;
}
KCalCore::Period tmpPeriod = period;
while( period.start().date() != period.end().date() ) {
const KDateTime midnight( period.start().date(), QTime( 23, 59, 59, 999 ), period.start().timeSpec() );
KCalCore::Period firstPeriod( period.start(), midnight );
KCalCore::Period secondPeriod( midnight.addMSecs( 1 ), period.end() );
if( firstPeriod.duration().asSeconds() >= 5*60 /*5 minutes*/ )
splitList << firstPeriod;
period = secondPeriod;
tmpPeriod = secondPeriod;
}
if( period.duration().asSeconds() >= 5*60 /*5 minutes*/ )
splitList << period;
splitList << tmpPeriod;
}
// Perform some jiggery pokery to remove duplicates
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment