Hi!

I've added support for syncing the category of an event to the palm plugin. (See the attached patch.)

The built-in DateBook application does not support categories but the most popular replacements (Agendus and DateBK) support datebook categories.

Cheers,
--leo
--
-------------------------------------------------------
Alexander (Leo) Bergolth          [EMAIL PROTECTED]
WU-Wien - Zentrum fuer Informatikdienste - Projektbuero
--- palm_sync.h.orig	2004-08-11 23:16:06.430142120 +0200
+++ palm_sync.h	2004-08-11 23:14:48.207033840 +0200
@@ -59,7 +59,7 @@
 } palm_entry;
 
 GString *address2vcard(palm_connection *, struct Address, char *);
-GString *calendar2vevent(palm_connection *, struct Appointment);
+GString *calendar2vevent(palm_connection *, struct Appointment, char *category);
 GString *todo2vcal(palm_connection *, struct ToDo, char *);
 void palm_debug(palm_connection *conn, int level, char *message, ...);
 int connectDevice(palm_connection *conn, gboolean block, gboolean popup);
--- palm_sync.c.orig	2004-08-11 22:54:22.655346016 +0200
+++ palm_sync.c	2004-08-11 22:54:43.535171800 +0200
@@ -335,7 +335,7 @@
 				vcard = address2vcard(conn, data->address, data->category);
 				break;
 			case SYNC_OBJECT_TYPE_CALENDAR:
-				vcard = calendar2vevent(conn, data->appointment);
+				vcard = calendar2vevent(conn, data->appointment, data->category);
 				break;
 			case SYNC_OBJECT_TYPE_TODO:
 				vcard = todo2vcal(conn, data->todo, data->category);
--- vcard.c.orig	2004-08-11 22:55:53.676508696 +0200
+++ vcard.c	2004-08-11 23:12:52.112682864 +0200
@@ -83,7 +83,7 @@
  * Summary:   converts an palm calendar record to an vevent card
  *
  ***********************************************************************/
-GString *calendar2vevent(palm_connection *conn, struct Appointment appointment)
+GString *calendar2vevent(palm_connection *conn, struct Appointment appointment, char *category)
 {
 	VObjectO *vcal;
 	VObjectO *vevent;
@@ -272,6 +272,10 @@
 		}
 	}
 
+	if (category) {
+		addPropValueO(vevent, "CATEGORIES", category);
+	}
+	
 	vcalptr = writeMemVObjectO(0,0,vcal);
 	vcalstr = g_string_new(vcalptr);
 	free(vcalptr);
@@ -501,10 +505,27 @@
 
 					//Exceptions TODO
 					if(strcmp(n,"EXDATE") == 0) {
-						entry->appointment.exception[entry->appointment.exceptions] = vcaltime2tm(fakeCStringO(vObjectUStringZValueO(t)));
+						entry->appointment.exception[entry->appointment.exceptions] = vcaltime2tm(attrValue);
 						entry->appointment.exceptions++;
 					}
 
+					//Categories
+					if (strcmp(n, "CATEGORIES") == 0) {
+					  palm_debug(conn, 3, "GOT CATEGORIES: %s\n", attrValue);
+					  gchar **array = g_strsplit(attrValue, ",", 0);
+					  int z = 0;
+					  while (array[z] != NULL) {
+					    palm_debug(conn, 3, "testing %s\n", array[z]);
+					    entry->catID = get_category_id_from_name(conn, array[z]);
+					    if (entry->catID != 0) {
+					      palm_debug(conn, 3, "Found category %i\n", entry->catID);
+					      break;
+					    }
+					    z++;
+					  }
+					  g_strfreev(array);
+					}
+
 					if (attrValue)
 						free(attrValue);
 				}

Reply via email to