[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-pim
Subject: [Kde-pim] Re: [PATCH] Displaying VCALENDAR events
From: Allen Winter <winterz () verizon ! net>
Date: 2004-03-23 21:36:39
Message-ID: 200403231636.39486.winterz () verizon ! net
[Download RAW message or body]
[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.<br>
> Start Time: 03/23/04 2:00pm<br>
> End Time: 03/23/04 4:00pm<br>
> Duration: 2 hours<br>
>
> You have been assigned this task:<br>
> Summary: Fix all bugs in our software<br>
> Description: You will fix all the bugs before the end of the day or you're fired!<br>
>
> The new Reply formats are:
> Sender <b>accepts/tentatively accepts/declines</b> this meeting invitation.
> Start Time: 03/23/04 2:00pm<br>
> End Time: 03/23/04 4:00pm<br>
> Duration: 2 hours<br>
>
> Sender <accepts/tentatively accepts/declines</b> this task:<br>
> Summary: Fix all bugs in our software<br>
> Description: You will fix all the bugs before the end of the day or you're fired!<br>
>
> Regards,
> Allen
>
["kogroupware.cpp.patch" (text/x-diff)]
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<br>" ).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 += "<br>";
+
+ // 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 += "<br>";
+ } else {
+ html += i18n( "(no date/time specified)<br>" );
+ }
+
+ // 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 += "<br>";
+ }
+
+ 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<br>" ).arg( sSummary );
+ html += i18n( "Description: %1<br>" ).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." )
- + "<br>" + 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:<br>%1" ).arg( sSummary );
+ if( event ) {
+ html = i18n( "You have been invited to this meeting.<br>" );
+ html += meetingDetails( incidence, event );
+ } else {
+ html = i18n( "You have been assigned this task:<br>" );
+ 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 <b>accepts</b> the invitation to "
- "meet in %1<br>from %2 to %3." )
- .arg( sLocation ).arg( sDtStart ).arg( sDtEnd );
- else
- html = i18n( "Sender <b>accepts</b> the task <b>%1</b>." )
- .arg( sSummary );
+ if( event ) {
+ html = i18n( "Sender <b>accepts</b> this meeting invitation.<br>" );
+ html += meetingDetails( incidence, event );
+ } else {
+ html = i18n( "Sender <b>accepts</b> this task.<br>" );
+ html += taskDetails( incidence );
+ }
break;
case Attendee::Tentative:
- if( event )
- html = i18n( "Sender <b>tentatively accepts</b> the "
- "invitation to meet in %1<br>from %2 to %3." )
- .arg( sLocation ).arg( sDtStart ).arg( sDtEnd );
- else
- html = i18n( "Sender <b>tentatively accepts</b> the task <b>%1</b>." )
- .arg( sSummary );
+ if( event ) {
+ html = i18n( "Sender <b>tentatively accepts</b> this "
+ "meeting invitation.<br>" );
+ html += meetingDetails( incidence, event );
+ } else {
+ html = i18n( "Sender <b>tentatively accepts</b> this task.<br>" );
+ html += taskDetails( incidence );
+ }
break;
case Attendee::Declined:
- if( event )
- html = i18n( "Sender <b>declines</b> the invitation to meet "
- "in %1<br>from %2 to %3." )
- .arg( sLocation ).arg( sDtStart ).arg( sDtEnd );
- else
- html = i18n( "Sender <b>declines</b> the task %1." ).arg( sSummary );
+ if( event ) {
+ html = i18n( "Sender <b>declines</b> this meeting invitation.<br>" );
+ html += meetingDetails( incidence, event );
+ } else {
+ html = i18n( "Sender <b>declines</b> this task.<br>" );
+ 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.<br>" );
+ html += meetingDetails( incidence, event );
+ } else {
+ html = i18n( "Unknown response to this task.<br>" );
+ 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.<br>" );
+ html += meetingDetails( incidence, event );
+ } else {
+ html = i18n( "This task was canceled.<br>" );
+ html += taskDetails( incidence );
+ }
}
// Add the groupware URLs
@@ -296,6 +368,7 @@ QString KOGroupware::formatICal( const Q
}
html += "</b></a></td></tr></table>";
+ QString sDescr = incidence->description();
if( ( sMethod == "request" || sMethod == "cancel" ) && !sDescr.isEmpty() ) {
string2HTML( sDescr );
html += "<br> <br> <br><u>" + i18n("Description:")
_______________________________________________
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/
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic