Commit 64dc1ebd authored by Sergio Luis Martins's avatar Sergio Luis Martins
Browse files

Remove static down casting and duplicated code.

Use the Incidence::RoleAlarm instead.

svn path=/trunk/KDE/kdepim/korganizer/; revision=1176742
parent ee5058d6
......@@ -847,23 +847,11 @@ KDateTime AlarmDialog::triggerDateForIncidence( const Incidence::Ptr &incidence,
displayStr = KGlobal::locale()->formatDateTime( result.toLocalZone() );
}
if ( incidence->type() == Incidence::TypeEvent ) {
if ( !result.isValid() ) {
Event::Ptr event = incidence.staticCast<Event>();
result = alarm->hasStartOffset() ? event->dtStart() :
event->dtEnd();
displayStr = IncidenceFormatter::dateTimeToString( result, false,
true,
KDateTime::Spec::LocalZone() );
}
} else if ( incidence->type() == Incidence::TypeTodo ) {
if ( !result.isValid() ) {
Todo::Ptr todo = incidence.staticCast<Todo>() ;
result = alarm->hasStartOffset() && todo->dtStart().isValid() ? todo->dtStart():
todo->dtDue();
displayStr = IncidenceFormatter::dateTimeToString( result, false, true,
KDateTime::Spec::LocalZone() );
}
if ( !result.isValid() ) {
result = incidence->dateTime( Incidence::RoleAlarm );
displayStr = IncidenceFormatter::dateTimeToString( result, false,
true,
KDateTime::Spec::LocalZone() );
}
return result;
......
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