rem: r->setYearly( Recurrence::rYearlyMonth, freq, endDate ); else r->setYearly( Recurrence::rYearlyMonth, freq, -1 ); r->addYearlyNum( startDate.month() );
add: r->setEndDate( endDate );
context:     bool startElement( const QString &, const QString &, const QString & qName,                        const QXmlAttributes &attributes )    {      if ( qName == "event" ) {        Event *event = new Event;        QString uid = "Qtopia" + attributes.value( "uid" );        event->setUid( uid );        event->setSummary( attributes.value( "description" ) );        event->setLocation( attributes.value( "location" ) );        event->setDescription( attributes.value( "note" ) );        event->setDtStart( toDateTime( attributes.value( "start" ) ) );        event->setDtEnd( toDateTime( attributes.value( "end" ) ) );        if ( attributes.value( "type" ) == "AllDay" ) {          event->setFloats( true );        } else {          event->setFloats( false );        }        QString rtype = attributes.value( "rtype" );        if ( !rtype.isEmpty() ) {          QDate startDate = event->dtStart().date();                  QString freqStr = attributes.value( "rfreq" );          int freq = freqStr.toInt();          QString hasEndDateStr = attributes.value( "rhasenddate" );          bool hasEndDate = hasEndDateStr == "1";          QString endDateStr = attributes.value( "enddt" );          QDate endDate = toDateTime( endDateStr ).date();          QString weekDaysStr = attributes.value( "rweekdays" );          int weekDaysNum = weekDaysStr.toInt();          QBitArray weekDays( 7 );          int i;          for( i = 1; i <= 7; ++i ) {            weekDays.setBit( i - 1, ( 2 << i ) & weekDaysNum );           }          QString posStr = attributes.value( "rposition" );          int pos = posStr.toInt();          Recurrence *r = event->recurrence();          if ( rtype == "Daily" ) {            if ( hasEndDate ) r->setDaily( freq, endDate );            else r->setDaily( freq, -1 );          } else if ( rtype == "Weekly" ) {            if ( hasEndDate ) r->setWeekly( freq, weekDays, endDate );            else r->setWeekly( freq, weekDays, -1 );          } else if ( rtype == "MonthlyDate" ) {            if ( hasEndDate )              r->setMonthly( Recurrence::rMonthlyDay, freq, endDate );            else              r->setMonthly( Recurrence::rMonthlyDay, freq, -1 );            r->addMonthlyDay( startDate.day() );          } else if ( rtype == "MonthlyDay" ) {            if ( hasEndDate )              r->setMonthly( Recurrence::rMonthlyPos, freq, endDate );            else              r->setMonthly( Recurrence::rMonthlyPos, freq, -1 );            QBitArray days( 7 );            days.fill( false );            days.setBit( startDate.dayOfWeek() - 1 );            r->addMonthlyPos( pos, days );          } else if ( rtype == "Yearly" ) {            if ( hasEndDate )              r->setYearly( Recurrence::rYearlyMonth, freq, endDate );            else              r->setYearly( Recurrence::rYearlyMonth, freq, -1 );            r->addYearlyNum( startDate.month() );          }        }                QString categoryList = attributes.value( "categories" );        event->setCategories( lookupCategories( categoryList ) );        QString alarmStr = attributes.value( "alarm" );        if ( !alarmStr.isEmpty() ) {          kdDebug(5800) << "Alarm: " << alarmStr << endl;          Alarm *alarm = new Alarm( event );          alarm->setType( Alarm::Display );          alarm->setEnabled( true );          int alarmOffset = alarmStr.toInt();          alarm->setStartOffset( alarmOffset * -60 );          event->addAlarm( alarm );        }        Event *oldEvent = mCalendar->event( uid );        if ( oldEvent ) mCalendar->deleteEvent( oldEvent );        mCalendar->addEvent( event );      } else if ( qName == "Task" ) {        Todo *todo = new Todo;        QString uid = "Qtopia" + attributes.value( "Uid" );        todo->setUid( uid );                QString description = attributes.value( "Description" );        int pos = description.find( '\n' );        if ( pos > 0 ) {          QString summary = description.left( pos );          todo->setSummary( summary );          todo->setDescription( description );        } else {          todo->setSummary( description );        }                int priority = attributes.value( "Priority" ).toInt();//        if ( priority == 0 ) priority = 3;        todo->setPriority( priority );                QString categoryList = attributes.value( "Categories" );        todo->setCategories( lookupCategories( categoryList ) );                QString completedStr = attributes.value( "Completed" );        if ( completedStr == "1" ) todo->setCompleted( true );                QString hasDateStr = attributes.value( "HasDate" );        if ( hasDateStr == "1" ) {          int year = attributes.value( "DateYear" ).toInt();          int month = attributes.value( "DateMonth" ).toInt();          int day = attributes.value( "DateDay" ).toInt();                    todo->setDtDue( QDateTime( QDate( year, month, day ) ) );          todo->setHasDueDate( true );        }                Todo *oldTodo = mCalendar->todo( uid );        if ( oldTodo ) mCalendar->deleteTodo( oldTodo );        mCalendar->addTodo( todo );      } else if ( qName == "Category" ) {        QString id = attributes.value( "id" );        QString name = attributes.value( "name" );        setCategory( id, name );      }            return true;    }