1
0
mirror of https://github.com/moparisthebest/davmail synced 2024-12-13 03:02:22 -05:00

Caldav: implement task categories

git-svn-id: http://svn.code.sf.net/p/davmail/code/trunk@1766 3d1905a2-6b24-0410-a738-b14d5a86fcbd
This commit is contained in:
mguessan 2011-08-07 14:13:51 +00:00
parent f321f6de76
commit 849a5058ec
2 changed files with 10 additions and 1 deletions

View File

@ -1394,6 +1394,7 @@ public class DavExchangeSession extends ExchangeSession {
eventProperties.add("importance"); eventProperties.add("importance");
eventProperties.add("uid"); eventProperties.add("uid");
eventProperties.add("percentcomplete"); eventProperties.add("percentcomplete");
eventProperties.add("keywords");
MultiStatusResponse[] responses = searchItems(folderPath, eventProperties, DavExchangeSession.this.isEqualTo("urlcompname", convertItemNameToEML(itemName)), FolderQueryTraversal.Shallow, 1); MultiStatusResponse[] responses = searchItems(folderPath, eventProperties, DavExchangeSession.this.isEqualTo("urlcompname", convertItemNameToEML(itemName)), FolderQueryTraversal.Shallow, 1);
if (responses.length == 0) { if (responses.length == 0) {
@ -1415,9 +1416,14 @@ public class DavExchangeSession extends ExchangeSession {
vEvent.setPropertyValue("UID", uid); vEvent.setPropertyValue("UID", uid);
vEvent.setPropertyValue("SUMMARY", getPropertyIfExists(davPropertySet, "subject")); vEvent.setPropertyValue("SUMMARY", getPropertyIfExists(davPropertySet, "subject"));
vEvent.setPropertyValue("PRIORITY", convertPriorityFromExchange(getPropertyIfExists(davPropertySet, "importance"))); vEvent.setPropertyValue("PRIORITY", convertPriorityFromExchange(getPropertyIfExists(davPropertySet, "importance")));
vEvent.setPropertyValue("CATEGORIES", getPropertyIfExists(davPropertySet, "keywords"));
if (instancetype == null) { if (instancetype == null) {
vEvent.type = "VTODO"; vEvent.type = "VTODO";
vEvent.setPropertyValue("PERCENT-COMPLETE", String.valueOf(getDoublePropertyIfExists(davPropertySet, "percentcomplete")*100)); double percentComplete = getDoublePropertyIfExists(davPropertySet, "percentcomplete");
if (percentComplete > 0) {
vEvent.setPropertyValue("PERCENT-COMPLETE", String.valueOf((int) (percentComplete * 100)));
}
vEvent.setPropertyValue("STATUS", taskTovTodoStatusMap.get(getPropertyIfExists(davPropertySet, "taskstatus"))); vEvent.setPropertyValue("STATUS", taskTovTodoStatusMap.get(getPropertyIfExists(davPropertySet, "taskstatus")));
} else { } else {
@ -1571,6 +1577,7 @@ public class DavExchangeSession extends ExchangeSession {
} }
propertyValues.add(Field.createPropertyValue("percentcomplete", String.valueOf(Double.parseDouble(percentComplete) / 100))); propertyValues.add(Field.createPropertyValue("percentcomplete", String.valueOf(Double.parseDouble(percentComplete) / 100)));
propertyValues.add(Field.createPropertyValue("taskstatus", vTodoToTaskStatusMap.get(vCalendar.getFirstVeventPropertyValue("STATUS")))); propertyValues.add(Field.createPropertyValue("taskstatus", vTodoToTaskStatusMap.get(vCalendar.getFirstVeventPropertyValue("STATUS"))));
propertyValues.add(Field.createPropertyValue("keywords", vCalendar.getFirstVeventPropertyValue("CATEGORIES")));
ExchangePropPatchMethod propPatchMethod = new ExchangePropPatchMethod(encodedHref, propertyValues); ExchangePropPatchMethod propPatchMethod = new ExchangePropPatchMethod(encodedHref, propertyValues);
propPatchMethod.setRequestHeader("Translate", "f"); propPatchMethod.setRequestHeader("Translate", "f");

View File

@ -328,6 +328,8 @@ public class Field {
createField(URN_SCHEMAS_MAILHEADER, "importance");//PS_INTERNET_HEADERS/importance createField(URN_SCHEMAS_MAILHEADER, "importance");//PS_INTERNET_HEADERS/importance
createField("percentcomplete", DistinguishedPropertySetType.Task, 0x8102, "percentcomplete", PropertyType.Double); createField("percentcomplete", DistinguishedPropertySetType.Task, 0x8102, "percentcomplete", PropertyType.Double);
createField("taskstatus", DistinguishedPropertySetType.Task, 0x8101, "taskstatus", PropertyType.Integer); createField("taskstatus", DistinguishedPropertySetType.Task, 0x8101, "taskstatus", PropertyType.Integer);
createField("categories", DistinguishedPropertySetType.PublicStrings, 0x9000, "categories", PropertyType.StringArray);
} }
protected static String toHexString(int propertyTag) { protected static String toHexString(int propertyTag) {