rem: html = i18n( "<h2>Unknown response to this meeting invitation</h2>" ); html += meetingDetails( incidence, event ); } else { html = i18n( "<h2>Unknown response to this task</h2>" );
add: html += i18n( "<h2>Unknown response to this meeting invitation</h2>" ); html += meetingDetails( incidence, event ); } else { html += i18n( "<h2>Unknown response to this task</h2>" );
context:     Result format( KMail::Interface::BodyPart *bodyPart,                   KMail::HtmlWriter *writer ) const    {      if ( !writer )        // Guard against crashes in createReply()        return Ok;      const QString iCalendar = bodyPart->asText();      if ( iCalendar.isEmpty() ) return AsIcon;      // FIXME: Get the correct time zone from korganizerrc      CalendarLocal cl;      ICalFormat format;      format.fromString( &cl, iCalendar );      // Make a shallow copy of the event and task lists      if( cl.events().count() == 0 && cl.todos().count() == 0 ) {        kdDebug(5850) << "No iCal in this one\n";        return AsIcon;      }      // Parse the first event out of the vcal      // TODO: Is it legal to have several events/todos per mail part?      Incidence* incidence = 0;      Event* event = 0;      Todo* todo = 0;      if( cl.events().count() > 0 )        incidence = event = cl.events().first();      else        incidence = todo = cl.todos().first();      // TODO: Actually the scheduler needs to do this:      QString sMethod; // = incidence->method();      // TODO: This is a temporary workaround to get the method      sMethod = "METHOD";      vPartMicroParser( iCalendar, sMethod );      sMethod = sMethod.lower();      if ( sMethod.isEmpty() ) return AsIcon;      // First make the text of the message      QString html;      html += "<em>Hint for kdepim developers: This iCalendar attachement was "              "formatted by the new bodypartformatter plugin.</em><br>";      if( sMethod == "request" ) {        // FIXME: All these "if (event) ... else ..." constructions are ugly.        if( event ) {          html = i18n( "<h2>You have been invited to this meeting</h2>" );          html += meetingDetails( incidence, event );        } else {          html = i18n( "<h2>You have been assigned this task</h2>" );          html += taskDetails( incidence );        }      } else if( sMethod == "reply" ) {        Attendee::List attendees = incidence->attendees();        if( attendees.count() == 0 ) {          kdDebug(5850) << "No attendees in the iCal reply!\n";          return AsIcon;        }        if( attendees.count() != 1 )          kdDebug(5850) << "Warning: attendeecount in the reply should be 1 "                        << "but is " << attendees.count() << endl;        Attendee* attendee = *attendees.begin();        switch( attendee->status() ) {        case Attendee::Accepted:          if( event ) {            html = i18n( "<h2>Sender accepts this meeting invitation</h2>" );            html += meetingDetails( incidence, event );          } else {            html = i18n( "<h2>Sender accepts this task</h2>" );            html += taskDetails( incidence );          }          break;        case Attendee::Tentative:          if( event ) {            html = i18n( "<h2>Sender tentatively accepts this "                         "meeting invitation</h2>" );            html += meetingDetails( incidence, event );          } else {            html = i18n( "<h2>Sender tentatively accepts this task</h2>" );            html += taskDetails( incidence );          }          break;        case Attendee::Declined:          if( event ) {            html = i18n( "<h2>Sender declines this meeting invitation</h2>" );            html += meetingDetails( incidence, event );          } else {            html = i18n( "<h2>Sender declines this task</h2>" );            html += taskDetails( incidence );          }          break;        default:          if( event ) {            html = i18n( "<h2>Unknown response to this meeting invitation</h2>" );            html += meetingDetails( incidence, event );          } else {            html = i18n( "<h2>Unknown response to this task</h2>" );            html += taskDetails( incidence );          }        }      } else if( sMethod == "cancel" ) {        if( event ) {          html = i18n( "<h2>This meeting has been canceled</h2>" );          html += meetingDetails( incidence, event );        } else {          html = i18n( "<h2>This task was canceled</h2>" );          html += taskDetails( incidence );        }      } else if ( sMethod == "publish" ) {        if ( event ) {          html += i18n("<h2>This event has been published</h2>");          html += meetingDetails( incidence, event );        } else {          html += i18n("<h2>This task has been published</h2>");          html += taskDetails( incidence );        }      } else {        html += i18n("Error: iMIP message with unknown method: '%1'")                .arg( sMethod );      }#if 0      html += "<br>";      html += "<a href=\"" + bodyPart->makeLink( "accept" ) + "\"><b>";      html += i18n("[Enter this into my calendar]");      html += "</b></a>";#endif      // Add the groupware URLs      html += "<br>&nbsp;<br>&nbsp;<br>";      html += "<table border=\"0\" cellspacing=\"0\"><tr><td>&nbsp;</td><td>";      if( sMethod == "request" || sMethod == "update" ||          sMethod == "publish" ) {        // Accept        html += "<a href=\"" +                bodyPart->makeLink( "accept" ) + "\"><b>";        html += i18n( "[Accept]" );        html += "</b></a></td><td> &nbsp; </td><td>";#if 0        // Accept conditionally        html += "<a href=\"" +                bodyPart->makeLink( "accept_conditionally" ) +                "\"><b>";        html += i18n( "Accept conditionally", "[Accept cond.]" );        html += "</b></a></td><td> &nbsp; </td><td>";#endif        // Decline        html += "<a href=\"" +                bodyPart->makeLink( "decline" ) + "\"><b>";        html += i18n( "[Decline]" );#if 0        // TODO: Do this        if( event ) {          // Check my calendar...          html += "</b></a></td><td> &nbsp; </td><td>";          html += "<a href=\"" +                  bodyPart->makeLink( "check_calendar" ) + "\"><b>";          html += i18n("[Check my calendar...]" );        }#endif      } else if( sMethod == "reply" ) {        // Enter this into my calendar        html += "<a href=\"" +                bodyPart->makeLink( "reply" ) + "\"><b>";        if( event )          html += i18n( "[Enter this into my calendar]" );        else          html += i18n( "[Enter this into my task list]" );      } else if( sMethod == "cancel" ) {        // Cancel event from my calendar        html += "<a href=\"" +                bodyPart->makeLink( "cancel" ) + "\"><b>";        html += i18n( "[Remove this from my calendar]" );      }      html += "</b></a></td></tr></table>";      QString sDescr = incidence->description();      if( ( sMethod == "request" || sMethod == "cancel" ) &&          !sDescr.isEmpty() ) {        string2HTML( sDescr );        html += "<br>&nbsp;<br>&nbsp;<br><u>" + i18n("Description:")          + "</u><br><table border=\"0\"><tr><td>&nbsp;</td><td>";        html += sDescr + "</td></tr></table>";      }      writer->begin( "" );      writer->write( html );      writer->end();      return Ok;    }