void IncidenceCompletionPriority::load( const KCalCore::Incidence::Ptr &incidence )
{
  mLoadedIncidence = incidence;

  // TODO priority might be valid for other incidence types as well
  // only for Todos
  KCalCore::Todo::Ptr todo = IncidenceCompletionPriority::incidence<KCalCore::Todo>();
  if ( todo == 0 ) {
    mWasDirty = false;
    return;
  }

  d->mUi->mCompletionPriorityWidget->show();
  d->mUi->mTaskLabel->show();
#ifndef KDEPIM_MOBILE_UI
  d->mUi->mTaskSeparator->show();
#endif

  d->mOrigPercentCompleted = todo->percentComplete();
  d->mUi->mCompletionSlider->blockSignals( true );
  d->mUi->mCompletionSlider->setValue( todo->percentComplete() );
  d->sliderValueChanged( d->mUi->mCompletionSlider->value() );
  d->mUi->mCompletionSlider->blockSignals( false );

  d->mUi->mPriorityCombo->blockSignals( true );
  d->mUi->mPriorityCombo->setCurrentIndex( todo->priority() );
  d->mUi->mPriorityCombo->blockSignals( false );

  mWasDirty = false;
}
bool IncidenceCompletionPriority::isDirty() const
{
  KCalCore::Todo::Ptr todo = IncidenceCompletionPriority::incidence<KCalCore::Todo>();

  if ( !todo ) {
    return false;
  }

  if ( d->mUi->mCompletionSlider->value() != todo->percentComplete() ) {
    return true;
  }

  if ( d->mUi->mPriorityCombo->currentIndex() != todo->priority() ) {
    return true;
  }

  return false;
}