[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    Re: kdepim/korganizer
From:       Reinhold Kainhofer <reinhold () kainhofer ! com>
Date:       2005-05-01 11:53:57
Message-ID: 200505011354.02486.reinhold () kainhofer ! com
[Download RAW message or body]


Am Sonntag, 1. Mai 2005 13:38 schrieb Till Adam:
> CVS commit by tilladam:
>
> Forward port of:
>
> CVS commit by tilladam:
>
> Make it impossible to specify a weekly recurrence without any day set.
> While the ical standard allows this, strictly speaking, it leads to an
> endless loop when setting todos completed which have such a recurrence,
> since the assumption that there will be a day is pervasive.

Good intentions, bad solution ;-) 

KOEditorRecurrence::validateInput() should check that if weekly recurrence is 
selected, at least one of the seven checkboxes is checked. No need to do that 
in writeIncidence and completely remove the whole recurrence! 
Just tell the user that he has to select at least one day.

Cheers,
Reinhold

>
> --- kdepim/korganizer/koeditorrecurrence.cpp  #1.83:1.84
> @@ -1339,4 +1339,5 @@ void KOEditorRecurrence::writeIncidence(
>    // clear out any old settings;
>    r->unsetRecurs();
> +  bool invalidRecurrence = false;
>
>    int duration = mRecurrenceRange->duration();
> @@ -1351,7 +1352,12 @@ void KOEditorRecurrence::writeIncidence(
>    } else if ( recurrenceType == RecurrenceChooser::Weekly ) {
>        int freq = mWeekly->frequency();
> -      QBitArray days = mWeekly->days();
> +      const QBitArray &days = mWeekly->days();
> +      bool valid = false; // make sure at least one day is set
> +      for ( int i = 0; i<7; i++ ) valid = valid || days.testBit( i );
> +      invalidRecurrence = !valid;
> +      if ( !invalidRecurrence ) {
>        if ( duration != 0 ) r->setWeekly( freq, days, duration );
>        else r->setWeekly( freq, days, endDate );
> +      }
>    } else if ( recurrenceType == RecurrenceChooser::Monthly ) {
>        int freq = mMonthly->frequency();
> @@ -1412,4 +1418,7 @@ void KOEditorRecurrence::writeIncidence(
>      } // end "Yearly"
>
> +  if ( invalidRecurrence )
> +    r->unsetRecurs();
> +  else
>      incidence->setExDates( mExceptions->dates() );
>  }

-- 
------------------------------------------------------------------
Reinhold Kainhofer, Vienna, Austria
email: reinhold@kainhofer.com, http://reinhold.kainhofer.com/
 * Financial and Actuarial Mathematics, TU Wien, http://www.fam.tuwien.ac.at
 * K Desktop Environment, http://www.kde.org/, KOrganizer / KPilot maintainer

[Attachment #3 (application/pgp-signature)]

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic