Bug 216806

Summary: KCal does not properly submit STATUS Information to Akonadi
Product: [Applications] kdepimlibs Reporter: hyper_ch <bugs.kde.org3>
Component: kcalcoreAssignee: kdepim bugs <kdepim-bugs>
Status: RESOLVED UNMAINTAINED    
Severity: normal CC: krammer, reinhold, smartins, winter
Priority: NOR    
Version: 4.3   
Target Milestone: ---   
Platform: Ubuntu   
OS: Unspecified   
Latest Commit: Version Fixed In:
Sentry Crash Report:

Description hyper_ch 2009-11-30 14:23:40 UTC
Version:            (using KDE 4.3.3)
Installed from:    Ubuntu Packages

I currently use Kontact 4.3.3 and I have setup webdav on the Horde server.

In Akonadi I can either chose eiterh "ICal Calendar File" (which uses 
Akonadi directly) or "KDE Calendar (traditional)" (which uses KCal 
IIRC). For either one I set the resource file like:

webdav://www.domain.com/horde/rpc.php/nag/USER/USER.ics

What works:
- I can add new tasks in Kontact and they will get added to horde
- I can delete tasks in Kontact and they will get added to horde
- I can edit tasks and the changes will be transmitted to horde

What does not work:
When check the box in Kontact that the task is done, it transmits it 
to Akonadi (check with Akonadi console) and it vanishes from my 
filtered list (Akonadi sets it as 100%). However this change is not 
being transmitted to horde. In Horde the task still remains as 
"active" / "undone". When then Akonadi syncs again with the Horde data 
it will unset that task and it appears in kontact undone again.

In #akonadi on freenode I was told that it's horde's fault for not 
"accpeting" those changes.
-----------------
[Wednesday, 11. November 2009] [13.51:57] <volker|office>       this 
has been discussed here before, IIRC horde ignores the percent-done 
field apparently
[Wednesday, 11. November 2009] [13.52:30] <bbroeksema|offic>     
well...... then go bug horde people =:)
[....]
[Wednesday, 11. November 2009] [14.04:14] <bbroeksema|offic>    well, 
than see volkers comments =:)
[Wednesday, 11. November 2009] [14.04:30] <bbroeksema|offic>    this 
seem to been discussed before
[Wednesday, 11. November 2009] [14.05:47] <hyper_ch>    ok
[Wednesday, 11. November 2009] [14.08:29] <bbroeksema|offic>     
hyper_ch: The best you can do is contacting horde developers and check 
if this is a known issue for your version of the horde server
------------------




However the newest entry on the horde bug list ( http://bugs.horde.org/ticket/8703 ) by Jan Schneider says this:
-------------------
Re-reading RFC 2445 again, I'm pretty sure that Akonadi is wrong. They 
use the PERCENT-COMPLETE property to indicate the task status instead 
of the STATUS property like Nag does. RFC 2445 says:

Property Name: PERCENT-COMPLETE
Purpose: This property is used by an assignee or delegatee of a to-do 
to convey the percent completion of a to-do to the Organizer.

Property Name: STATUS
Purpose: This property defines the overall status or confirmation for 
the calendar component.
Description: In a group scheduled calendar component, the property is 
used by the "Organizer" to provide a confirmation of the event to the 
"Attendees".

So the difference is that PERCENT-COMPLETE is used by attendees to be 
consumed by organizers, while STATUS is used by organizers to be 
consumed by attendees. Editing and saving a task on the (Nag) server 
is done by the task organizer (or anyone with the same permissions) 
and authoritative for anyone consuming this task. This is *not* an 
update from an attendee sent to the organizer. The RFC even explicitly 
mentions that PERCENT-COMPLETE is per attendee, so that attendees can 
report back different completion states for their parts of the task. 
It is *not* to be stored with the task. How should that work anyway if 
this a property of the VTODO component but can be different for each 
attendee?
--------------


And now back in the #akonadi channel on freenode I get told this:
---------------
[14:12] <volker|office> looks like that's hard to tell without reading the ical spec...
[14:13] <hyper_ch> well, it's either akonadi's fault or horde's fault and I just get pushed always to the other program from devs on both sides....
[14:13] <volker|office> if it's on our side, then the bug is in kcal, not akonadi
[14:15] <hyper_ch> why in kcal?
[14:15] <volker|office> that's what translates todo objects to and from ical
[14:15] <hyper_ch> and in kontact they tell me it's akonadi
[14:15] <hyper_ch> basically it's nobody's fault and I'm just imagining things
[14:16] <volker|office> akonadi just up/downloads the ical file and converts it using kcal
[14:17] <hyper_ch> I'll open a bug in kontact now but I'm sure it will be closed soon telling that it's not kontact's fault
---------------
Comment 1 hyper_ch 2010-01-12 14:54:52 UTC
With a little help I dug further into the problem. First I verified RFC 2445 and found this here:


RFC 2445, p. 88:

Dawson & Stenerson          Standards Track                    [Page 88]

RFC 2445                       iCalendar                   November 1998


     statvalue  =/ "NEEDS-ACTION"       ;Indicates to-do needs action.
                / "COMPLETED"           ;Indicates to-do completed.
                / "IN-PROCESS"          ;Indicates to-do in process of
                / "CANCELLED"           ;Indicates to-do was cancelled.
        ;Status values for "VTODO".

     statvalue  =/ "DRAFT"              ;Indicates journal is draft.
                / "FINAL"               ;Indicates journal is final.
                / "CANCELLED"           ;Indicates journal is removed.
        ;Status values for "VJOURNAL".

   Example: The following is an example of this property for a "VEVENT"
   calendar component:

     STATUS:TENTATIVE

   The following is an example of this property for a "VTODO" calendar
   component:

     STATUS:NEEDS-ACTION

   The following is an example of this property for a "VJOURNAL"
   calendar component:

     STATUS:DRAFT


So, that seems that a STATUS field is required in the ical files.


-----------------


Then I checked the horde entries. I copied one below and replaced email and subject:



BEGIN:VTODO
UID:libkcal-2078158521.175
ORGANIZER:MAILTO:my@email.com
SUMMARY:just some boring text
PRIORITY:2
DUE:20091120T120000Z
STATUS:COMPLETED
COMPLETED:20100112T125449Z
CATEGORIES:MISCELLANEOUS
CREATED:20091110T085606Z
LAST-MODIFIED:20091123T172054Z
END:VTODO


That looks RFC compliant to me with regard to the completion of a task.



----------


Next I check how korganizer / kcal handle that.


First I created a new calendar in korganizer (-> Setting it as ical (local file)). Then I went into the todo list, created an entry and marked it as completed. The output is below:



BEGIN:VCALENDAR
PRODID:-//K Desktop Environment//NONSGML libkcal 4.3//EN
VERSION:2.0
BEGIN:VTODO
DTSTAMP:20100112T124208Z
ORGANIZER;CN="you wish":MAILTO:some email address
CREATED:20100112T124202Z
UID:libkcal-1626628246.613
SEQUENCE:1
LAST-MODIFIED:20100112T124208Z
SUMMARY:asdfasdfasdfasdfasdfasdfasdfasfdasf
PRIORITY:5
DUE;VALUE=DATE:20100119
COMPLETED:20100112T124208Z
PERCENT-COMPLETE:100
END:VTODO
END:VCALENDAR


Then I also created a new akonadi resource, selected "ICal Calendar file (locally)" and created again a new entry in the todo list and marked it as completed.


BEGIN:VCALENDAR
PRODID:-//K Desktop Environment//NONSGML libkcal 4.3//EN
VERSION:2.0
BEGIN:VTODO
DTSTAMP:20100112T125120Z
ORGANIZER;CN="you wish":MAILTO:some email address
CREATED:20100112T124843Z
UID:libkcal-793896051.397
SEQUENCE:1
LAST-MODIFIED:20100112T125120Z
SUMMARY:cal_test3.ical
PRIORITY:5
DUE;VALUE=DATE:20100119
COMPLETED:20100112T125120Z
PERCENT-COMPLETE:100
END:VTODO
END:VCALENDAR



Both entries created in Kontact do not have the STATUS field in them which seems to be the cause for all the problems.
Comment 2 hyper_ch 2010-01-12 15:07:33 UTC
I also run now following tests on a local ical file:

(1) I created it and marked it as completed

--> no STATUS field was added

(2) I closed kontact and manually added STATUS:COMPLETED

--> The task still showed as completed... editing and saving it again did not remove the STATUS:COMPLETED field

(3) I closed kontact again and manually deleted the PERCENT-COMPLETE:100 field

--> Again, Korgainzed showed the task as completed
Comment 3 Kevin Krammer 2010-01-12 16:47:01 UTC
Looks like the problem is in ICalFormatImpl::writeTodo() in icalformat_p.cpp

It checks for Todo::isCompleted() but only writes the completion date to the ical structure and does not yet set the status.
Comment 4 Reinhold Kainhofer 2010-01-13 15:04:12 UTC
AFAICS, the RFCs (2445 and 5545) do not specify how exactly completion should be indicated...

My comment on IRC:

[14:39] <reinhold> hyper_ch: Regarding your STATUS:COMPLETED vs.  
 PERCENT-COMPLETE:100, the rfcs 2445 and  5545 (the successor to RFC  
 2445) do not require STATUS:COMPLETED to be set. Actually, it does not  
 specify at all how completion should be indicated. There are three  
 completion settings: STATUS:COMPLETED, COMPLETED:Date-Time,  
 PERCENT-COMPLETE:100
 [14:41] <reinhold> hyper_ch: Actually, the example at the end of  
 section 3.6.2 shows a completed todo with STATUS:NEEDS-ACTION... See  
 http://pastebin.org/75500
 [14:41] <reinhold> hyper_ch: That might be an oversight, though.

I've now also sent a request for clarification to the calsify mailing list:
http://lists.osafoundation.org/pipermail/ietf-calsify/2010-January/002234.html
Comment 5 hyper_ch 2010-03-11 15:30:00 UTC
Any news on this?

The problem I face right now is that the Horde people say it's Akonadi's fault. They don't do it correctly. And the Akonadi people say it's Horde's fault. They don't do it correctly.

In the end the result is, that it just doesn't work because neither party is willing to go one step ahead and make it work.
Comment 6 Allen Winter 2011-03-18 00:22:23 UTC
If the incidence's status field is set to something other than NONE, it will be written out in ICalFormatImpl::writeIncidence().  So I don't think we need to muck around in KCalCore.

We need to go into KOrganizer and set a to-do's status value as COMPLETED vs NEEDS-ACTION as necessary.  Now, on reading a to-do .. I expect to see a completion percentage and will only agree to setting a to-do as DONE if that percentage is 100; i.e. the status won't affect completeness on read.

I'm ok with doing this.  However I don't agree with Horde: they could check for 100% completion too -- this must be how everyone checks for to-do completeness else how come nobody else has bitched about this for so many years?
Comment 7 Denis Kurz 2016-09-24 20:55:19 UTC
This bug has only been reported for versions before 4.14, which have been unsupported for at least two years now. Can anyone tell if this bug still present?

If noone confirms this bug for a Framework-based version of kdepim (version 5.0 or later, as part of KDE Applications 15.08 or later), it gets closed in about three months.
Comment 8 Denis Kurz 2017-01-07 22:10:53 UTC
Just as announced in my last comment, I close this bug. If you encounter it again in a recent version (at least 5.0 aka 15.08), please open a new one unless it already exists. Thank you for all your input.