--Boundary-00=_n3KYAj7bwVtLpER Content-Type: text/plain; charset="iso-8859-1"; boundary="" Content-Transfer-Encoding: 7bit Content-Disposition: inline [Sorry. Sent the wrong file in my last message] On Tuesday 23 March 2004 04:30 pm, Allen Winter wrote: > Howdy, > > OK, attached is a patch for kogroupware.cpp that reworks the calendar > meeting invitation/replies and task assignments/replies as we've been > discussing recently. Please review. I don't do groupware stuff in my > little two-person office so I can't test. > > The new Request formats are: > You have been invited to this meeting.
> Start Time: 03/23/04 2:00pm
> End Time: 03/23/04 4:00pm
> Duration: 2 hours
> > You have been assigned this task:
> Summary: Fix all bugs in our software
> Description: You will fix all the bugs before the end of the day or you're fired!
> > The new Reply formats are: > Sender accepts/tentatively accepts/declines this meeting invitation. > Start Time: 03/23/04 2:00pm
> End Time: 03/23/04 4:00pm
> Duration: 2 hours
> > Sender this task:
> Summary: Fix all bugs in our software
> Description: You will fix all the bugs before the end of the day or you're fired!
> > Regards, > Allen > --Boundary-00=_n3KYAj7bwVtLpER Content-Type: text/x-diff; charset="iso-8859-1"; name="kogroupware.cpp.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="kogroupware.cpp.patch" Index: kogroupware.cpp =================================================================== RCS file: /home/kde/kdepim/korganizer/kogroupware.cpp,v retrieving revision 1.21 diff -u -p -u -r1.21 kogroupware.cpp --- kogroupware.cpp 14 Feb 2004 15:29:08 -0000 1.21 +++ kogroupware.cpp 23 Mar 2004 21:35:12 -0000 @@ -151,6 +151,87 @@ static void string2HTML( QString& str ) str.replace( "\\,", "," ); } +static QString meetingDetails( Incidence* incidence, Event* event ) +{ + QString html; + + QString sLocation = i18n( "Location unspecified" ); + if ( incidence ) { + if ( ! incidence->location().isEmpty() ) { + sLocation = incidence->location(); + string2HTML( sLocation ); + } + } + + // Meeting Location + html = i18n( "Where: %1
" ).arg( sLocation ); + + // Meeting Start Time + html += i18n( "Start Time: %1 " ).arg( event->dtStartDateStr() ); + if ( ! event->doesFloat() ) { + html += event->dtStartTimeStr(); + } else { + html += i18n( "(no time specified)" ); + } + html += "
"; + + // Meeting End Time + html += i18n( "End Time: " ); + if ( event->hasEndDate() ) { + html += event->dtEndDateStr(); + if ( ! event->doesFloat() ) { + html += event->dtEndTimeStr(); + } else { + html += i18n( "(no time specified)" ); + } + html += "
"; + } else { + html += i18n( "(no date/time specified)
" ); + } + + // Meeting Duration + if ( ! event->doesFloat() && event->hasEndDate() ) { + QTime sDuration, t; + int secs = event->dtStart().secsTo( event->dtEnd() ); + t = sDuration.addSecs( secs ); + html += i18n( "Duration: " ); + if ( t.hour() > 0 ) { + html += t.toString( "h" ); + html += i18n( " hours " ); + } + if ( t.minute() > 0 ) { + html += t.toString( "m" ); + html += i18n( " mins " ); + } + html += "
"; + } + + return html; +} + +static QString taskDetails( Incidence* incidence ) +{ + QString html; + + QString sSummary = i18n( "Summary unspecified" ); + QString sDescr = i18n( "Description unspecified" ); + if ( incidence ) { + if ( ! incidence->summary().isEmpty() ) { + sSummary = incidence->summary(); + string2HTML( sSummary ); + } + if ( ! incidence->description().isEmpty() ) { + sDescr = incidence->description(); + string2HTML( sDescr ); + } + } + + html = i18n( "Summary: %1
" ).arg( sSummary ); + html += i18n( "Description: %1
" ).arg( sDescr ); + + return html; +} + QString KOGroupware::formatICal( const QString& iCal ) { KCal::CalendarLocal cl; @@ -173,18 +254,6 @@ QString KOGroupware::formatICal( const Q else incidence = todo = cl.todos().first(); - QString sLocation = incidence->location(); - if( sLocation.isEmpty() ) - sLocation = i18n( "some unknown location" ); - string2HTML( sLocation ); - QString sDtEnd, sDtStart; - if( event ) { - sDtEnd = event->dtEndTimeStr(); - sDtStart = event->dtStartTimeStr(); - } - QString sSummary = incidence->summary(); - QString sDescr = incidence->description(); - // TODO: Actually the scheduler needs to do this: QString sMethod; // = incidence->method(); // TODO: This is a temporary workaround to get the method @@ -192,18 +261,16 @@ QString KOGroupware::formatICal( const Q vPartMicroParser( iCal, sMethod ); sMethod = sMethod.lower(); - kdDebug(5850) << "Event stuff: " << sLocation << ", " << sDtEnd << ", " - << sDtStart << ", " << sDescr << ", " << sMethod << endl; - // First make the text of the message QString html; if( sMethod == "request" ) { - if( event ) - html = i18n( "You have been invited to a meeting." ) - + "
" + i18n( "The meeting will take place in %1 from %2 to %3." ) - .arg( sLocation ).arg( sDtStart ).arg( sDtEnd ); - else - html = i18n( "You have been assigned a task:
%1" ).arg( sSummary ); + if( event ) { + html = i18n( "You have been invited to this meeting.
" ); + html += meetingDetails( incidence, event ); + } else { + html = i18n( "You have been assigned this task:
" ); + html += taskDetails( incidence ); + } } else if( sMethod == "reply" ) { Attendee::List attendees = incidence->attendees(); if( attendees.count() == 0 ) { @@ -217,48 +284,53 @@ QString KOGroupware::formatICal( const Q switch( attendee->status() ) { case Attendee::Accepted: - if( event ) - html = i18n( "Sender accepts the invitation to " - "meet in %1
from %2 to %3." ) - .arg( sLocation ).arg( sDtStart ).arg( sDtEnd ); - else - html = i18n( "Sender accepts the task %1." ) - .arg( sSummary ); + if( event ) { + html = i18n( "Sender accepts this meeting invitation.
" ); + html += meetingDetails( incidence, event ); + } else { + html = i18n( "Sender accepts this task.
" ); + html += taskDetails( incidence ); + } break; case Attendee::Tentative: - if( event ) - html = i18n( "Sender tentatively accepts the " - "invitation to meet in %1
from %2 to %3." ) - .arg( sLocation ).arg( sDtStart ).arg( sDtEnd ); - else - html = i18n( "Sender tentatively accepts the task %1." ) - .arg( sSummary ); + if( event ) { + html = i18n( "Sender tentatively accepts this " + "meeting invitation.
" ); + html += meetingDetails( incidence, event ); + } else { + html = i18n( "Sender tentatively accepts this task.
" ); + html += taskDetails( incidence ); + } break; case Attendee::Declined: - if( event ) - html = i18n( "Sender declines the invitation to meet " - "in %1
from %2 to %3." ) - .arg( sLocation ).arg( sDtStart ).arg( sDtEnd ); - else - html = i18n( "Sender declines the task %1." ).arg( sSummary ); + if( event ) { + html = i18n( "Sender declines this meeting invitation.
" ); + html += meetingDetails( incidence, event ); + } else { + html = i18n( "Sender declines this task.
" ); + html += taskDetails( incidence ); + } break; default: - if( event ) - html = - i18n( "This is an unknown reply to the event in %1 from %2 to %3" ) - .arg( sLocation ).arg( sDtStart ).arg( sDtEnd ); - else - html = i18n( "This is an unknown reply to the task %1" ) - .arg( sSummary ); + if( event ) { + html = i18n( "Unknown response to this meeting invitation.
" ); + html += meetingDetails( incidence, event ); + } else { + html = i18n( "Unknown response to this task.
" ); + html += taskDetails( incidence ); + } } } else if( sMethod == "cancel" ) { - if( event ) - html = i18n( "The event %1 was canceled" ).arg( sSummary ); - else - html = i18n( "The task %1 was canceled" ).arg( sSummary ); + if( event ) { + html = i18n( "This meeting has been canceled.
" ); + html += meetingDetails( incidence, event ); + } else { + html = i18n( "This task was canceled.
" ); + html += taskDetails( incidence ); + } } // Add the groupware URLs @@ -296,6 +368,7 @@ QString KOGroupware::formatICal( const Q } html += ""; + QString sDescr = incidence->description(); if( ( sMethod == "request" || sMethod == "cancel" ) && !sDescr.isEmpty() ) { string2HTML( sDescr ); html += "
 
 
" + i18n("Description:") --Boundary-00=_n3KYAj7bwVtLpER Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ kde-pim mailing list kde-pim@mail.kde.org https://mail.kde.org/mailman/listinfo/kde-pim kde-pim home page at http://pim.kde.org/ --Boundary-00=_n3KYAj7bwVtLpER--