aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMilan Crha <mcrha@src.gnome.org>2007-09-03 14:43:55 +0800
committerMilan Crha <mcrha@src.gnome.org>2007-09-03 14:43:55 +0800
commit9f85d756bd915ae4e2c9cec242c536932d679eed (patch)
tree27ed1451f47eacc3d03d4a34cd5d594d4c41a31f
parent488e83927c0df7d0e4210b697a387462961e92fd (diff)
downloadgsoc2013-evolution-9f85d756bd915ae4e2c9cec242c536932d679eed.tar
gsoc2013-evolution-9f85d756bd915ae4e2c9cec242c536932d679eed.tar.gz
gsoc2013-evolution-9f85d756bd915ae4e2c9cec242c536932d679eed.tar.bz2
gsoc2013-evolution-9f85d756bd915ae4e2c9cec242c536932d679eed.tar.lz
gsoc2013-evolution-9f85d756bd915ae4e2c9cec242c536932d679eed.tar.xz
gsoc2013-evolution-9f85d756bd915ae4e2c9cec242c536932d679eed.tar.zst
gsoc2013-evolution-9f85d756bd915ae4e2c9cec242c536932d679eed.zip
2007-09-03 mcrha Fix for bug #201167 by Nathan Owens
svn path=/trunk/; revision=34162
-rw-r--r--ChangeLog6
-rw-r--r--calendar/ChangeLog15
-rw-r--r--calendar/conduits/Makefile.am4
-rw-r--r--calendar/conduits/calendar/Makefile.am3
-rw-r--r--calendar/conduits/calendar/calendar-conduit.c61
-rw-r--r--calendar/conduits/memo/Makefile.am3
-rw-r--r--calendar/conduits/memo/memo-conduit.c172
-rw-r--r--calendar/conduits/todo/Makefile.am3
-rw-r--r--calendar/conduits/todo/todo-conduit.c136
-rw-r--r--configure.in1
10 files changed, 147 insertions, 257 deletions
diff --git a/ChangeLog b/ChangeLog
index 0a52c9c275..afcdf8690e 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2007-09-03 Milan Crha <mcrha@redhat.com>
+
+ ** Fix for bug #201167 by Nathan Owens
+
+ * configure.in:
+
2007-09-02 Matthew Barnes <mbarnes@redhat.com>
* Update FSF address in header comments (#469886).
diff --git a/calendar/ChangeLog b/calendar/ChangeLog
index e8a4695d0b..e95194eb14 100644
--- a/calendar/ChangeLog
+++ b/calendar/ChangeLog
@@ -1,3 +1,18 @@
+2007-09-03 Milan Crha <mcrha@redhat.com>
+
+ ** Fix for bug #201167 by Nathan Owens
+
+ * conduits/todo/Makefile.am:
+ * conduits/todo/todo-conduit.c:
+ * conduits/common/libecalendar-common-conduit.c:
+ * conduits/common/libecalendar-common-conduit.h:
+ * conduits/common/Makefile.am:
+ * conduits/calendar/Makefile.am:
+ * conduits/calendar/calendar-conduit.c:
+ * conduits/Makefile.am:
+ * conduits/memo/memo-conduit.c:
+ * conduits/memo/Makefile.am:
+
2007-09-03 Srinivasa Ragavan <sragavan@novell.com>
** Fix for bug #471791 (Move away from asserts to g_ret*)
diff --git a/calendar/conduits/Makefile.am b/calendar/conduits/Makefile.am
index 365053399f..a53bd426d5 100644
--- a/calendar/conduits/Makefile.am
+++ b/calendar/conduits/Makefile.am
@@ -1 +1,3 @@
-SUBDIRS = calendar memo todo
+SUBDIRS = common calendar memo todo
+
+
diff --git a/calendar/conduits/calendar/Makefile.am b/calendar/conduits/calendar/Makefile.am
index 36ec220208..cb431e9619 100644
--- a/calendar/conduits/calendar/Makefile.am
+++ b/calendar/conduits/calendar/Makefile.am
@@ -3,6 +3,8 @@ INCLUDES = \
-I$(top_builddir)/e-util \
-I$(top_srcdir)/widgets/misc \
-I$(top_builddir)/widgets/misc \
+ -I$(top_srcdir)/calendar/conduits/common \
+ -I$(top_builddir)/calendar/conduits/common \
$(EVOLUTION_CALENDAR_CONDUIT_CFLAGS)
# Calendar Conduit
@@ -17,6 +19,7 @@ libecalendar_conduit_la_LIBADD = \
$(top_builddir)/e-util/libeutil.la \
$(top_builddir)/e-util/libeconduit.la \
$(top_builddir)/widgets/misc/libemiscwidgets.la \
+ $(top_builddir)/calendar/conduits/common/libecalendar_common_conduit.la \
$(EVOLUTION_CALENDAR_CONDUIT_LIBS)
e-calendar.conduit: e-calendar.conduit.in
diff --git a/calendar/conduits/calendar/calendar-conduit.c b/calendar/conduits/calendar/calendar-conduit.c
index ec92c471b5..f18480007c 100644
--- a/calendar/conduits/calendar/calendar-conduit.c
+++ b/calendar/conduits/calendar/calendar-conduit.c
@@ -42,6 +42,7 @@
#include <e-pilot-settings.h>
#include <e-pilot-util.h>
#include <e-config-listener.h>
+#include <libecalendar-common-conduit.h>
GnomePilotConduit * conduit_get_gpilot_conduit (guint32);
void conduit_destroy_gpilot_conduit (GnomePilotConduit*);
@@ -87,7 +88,7 @@ calconduit_destroy_record (ECalLocalRecord *local)
{
g_object_unref (local->comp);
free_Appointment (local->appt);
- g_free (local->appt);
+ g_free (local->appt);
g_free (local);
}
@@ -938,6 +939,9 @@ local_record_from_comp (ECalLocalRecord *local, ECalComponent *comp, ECalConduit
pi_buffer_free (record);
#endif
}
+
+ /*Category support*/
+ e_pilot_local_category_to_remote(&(local->local.category), comp, &(ctxt->ai.category));
/* STOP: don't replace these with g_strdup, since free_Appointment
uses free to deallocate */
@@ -1183,7 +1187,8 @@ comp_from_remote_record (GnomePilotConduitSyncAbs *conduit,
GnomePilotRecord *remote,
ECalComponent *in_comp,
ECal *client,
- icaltimezone *timezone)
+ icaltimezone *timezone,
+ struct CategoryAppInfo *category)
{
ECalComponent *comp;
struct Appointment appt;
@@ -1229,6 +1234,9 @@ comp_from_remote_record (GnomePilotConduitSyncAbs *conduit,
summary.value = txt = e_pilot_utf8_from_pchar (appt.description);
e_cal_component_set_summary (comp, &summary);
free (txt);
+
+ /*Category support*/
+ e_pilot_remote_category_to_local(remote->category, comp, category);
/* The iCal description field */
if (!appt.note) {
@@ -1621,6 +1629,7 @@ pre_sync (GnomePilotConduit *conduit,
pi_buffer_free(buffer);
#endif
unpack_AppointmentAppInfo (&(ctxt->ai), buf, len);
+ //unpack_CategoryAppInfo (&(ctxt->ai.category), buf, len);
g_free (buf);
check_for_slow_setting (conduit, ctxt);
@@ -1638,8 +1647,28 @@ post_sync (GnomePilotConduit *conduit,
{
GList *changed;
gchar *filename, *change_id;
+ unsigned char *buf;
+ int dlpRetVal, len;
LOG (g_message ( "post_sync: Calendar Conduit v.%s", CONDUIT_VERSION ));
+
+ /* Write AppBlock to PDA - updates categories */
+ buf = (unsigned char*)g_malloc (0xffff);
+
+ len = pack_AppointmentAppInfo (&(ctxt->ai), buf, 0xffff);
+
+ dlpRetVal = dlp_WriteAppBlock (dbi->pilot_socket, dbi->db_handle,
+ (unsigned char *)buf, len);
+
+ g_free (buf);
+
+ if (dlpRetVal < 0) {
+ WARN ( ("Could not write pilot's Calendar application block"));
+ WARN ("dlp_WriteAppBlock(...) = %d", dlpRetVal);
+ /*gnome_pilot_conduit_error (conduit,
+ _("Could not write pilot's Calendar application block"));*/
+ return -1;
+ }
g_free (ctxt->cfg->last_uri);
ctxt->cfg->last_uri = g_strdup (e_cal_get_uri (ctxt->client));
@@ -1714,7 +1743,11 @@ for_each (GnomePilotConduitSyncAbs *conduit,
*local = g_new0 (ECalLocalRecord, 1);
local_record_from_comp (*local, comps->data, ctxt);
- ctxt->locals = g_list_prepend (ctxt->locals, *local);
+
+ /* NOTE: ignore the return value, otherwise ctxt->locals
+ * gets messed up. The calling function keeps track of
+ * the *local variable */
+ g_list_prepend (ctxt->locals, *local);
iterator = comps;
} else {
@@ -1729,7 +1762,11 @@ for_each (GnomePilotConduitSyncAbs *conduit,
*local = g_new0 (ECalLocalRecord, 1);
local_record_from_comp (*local, iterator->data, ctxt);
- ctxt->locals = g_list_prepend (ctxt->locals, *local);
+
+ /* NOTE: ignore the return value, otherwise ctxt->locals
+ * gets messed up. The calling function keeps track of
+ * the *local variable */
+ g_list_prepend (ctxt->locals, *local);
} else {
LOG (g_message ( "for_each ending" ));
@@ -1768,7 +1805,11 @@ for_each_modified (GnomePilotConduitSyncAbs *conduit,
*local = g_new0 (ECalLocalRecord, 1);
local_record_from_comp (*local, ccc->comp, ctxt);
- ctxt->locals = g_list_prepend (ctxt->locals, *local);
+
+ /* NOTE: ignore the return value, otherwise ctxt->locals
+ * gets messed up. The calling function keeps track of
+ * the *local variable */
+ g_list_prepend (ctxt->locals, *local);
} else {
LOG (g_message ( "no events" ));
@@ -1782,7 +1823,11 @@ for_each_modified (GnomePilotConduitSyncAbs *conduit,
*local = g_new0 (ECalLocalRecord, 1);
local_record_from_comp (*local, ccc->comp, ctxt);
- ctxt->locals = g_list_prepend (ctxt->locals, *local);
+
+ /* NOTE: ignore the return value, otherwise ctxt->locals
+ * gets messed up. The calling function keeps track of
+ * the *local variable */
+ g_list_prepend (ctxt->locals, *local);
} else {
LOG (g_message ( "for_each_modified ending" ));
@@ -1837,7 +1882,7 @@ add_record (GnomePilotConduitSyncAbs *conduit,
LOG (g_message ( "add_record: adding %s to desktop\n", print_remote (remote) ));
- comp = comp_from_remote_record (conduit, remote, ctxt->default_comp, ctxt->client, ctxt->timezone);
+ comp = comp_from_remote_record (conduit, remote, ctxt->default_comp, ctxt->client, ctxt->timezone, &(ctxt->ai.category));
/* Give it a new UID otherwise it will be the uid of the default comp */
uid = e_cal_component_gen_uid ();
@@ -1869,7 +1914,7 @@ replace_record (GnomePilotConduitSyncAbs *conduit,
LOG (g_message ("replace_record: replace %s with %s\n",
print_local (local), print_remote (remote)));
- new_comp = comp_from_remote_record (conduit, remote, local->comp, ctxt->client, ctxt->timezone);
+ new_comp = comp_from_remote_record (conduit, remote, local->comp, ctxt->client, ctxt->timezone, &(ctxt->ai.category));
g_object_unref (local->comp);
local->comp = new_comp;
diff --git a/calendar/conduits/memo/Makefile.am b/calendar/conduits/memo/Makefile.am
index afbee4e56c..791af9268f 100644
--- a/calendar/conduits/memo/Makefile.am
+++ b/calendar/conduits/memo/Makefile.am
@@ -3,6 +3,8 @@ INCLUDES = \
-I$(top_builddir)/e-util \
-I$(top_srcdir)/widgets/misc \
-I$(top_builddir)/widgets/misc \
+ -I$(top_srcdir)/calendar/conduits/common \
+ -I$(top_builddir)/calendar/conduits/common \
$(EVOLUTION_CALENDAR_CONDUIT_CFLAGS)
# Memo Conduit
@@ -17,6 +19,7 @@ libememo_conduit_la_LIBADD = \
$(top_builddir)/e-util/libeutil.la \
$(top_builddir)/e-util/libeconduit.la \
$(top_builddir)/widgets/misc/libemiscwidgets.la \
+ $(top_builddir)/calendar/conduits/common/libecalendar_common_conduit.la \
$(EVOLUTION_CALENDAR_CONDUIT_LIBS)
e-memo.conduit: e-memo.conduit.in
diff --git a/calendar/conduits/memo/memo-conduit.c b/calendar/conduits/memo/memo-conduit.c
index 4f477324c6..6c6fcaa120 100644
--- a/calendar/conduits/memo/memo-conduit.c
+++ b/calendar/conduits/memo/memo-conduit.c
@@ -45,6 +45,7 @@
#include <e-pilot-settings.h>
#include <e-pilot-util.h>
#include <e-config-listener.h>
+#include <libecalendar-common-conduit.h>
GnomePilotConduit * conduit_get_gpilot_conduit (guint32);
void conduit_destroy_gpilot_conduit (GnomePilotConduit*);
@@ -504,70 +505,6 @@ local_record_to_pilot_record (EMemoLocalRecord *local,
}
/*
- * Adds a category to the category app info structure (name and ID),
- * sets category->renamed[i] to true if possible to rename.
- *
- * This will be packed and written to the app info block during post_sync.
- */
-
-static int
-add_category_if_possible(char *cat_to_add, struct CategoryAppInfo *category)
-{
- int i, j;
- int retval = 0; /* 0 is the Unfiled category */
- LOG(fprintf(stderr, "add_category_if_possible: called\n"));
-
- for(i=0; i<16; i++){
- /* if strlen is 0, then the category is empty
- the PalmOS doesn't let 0-length strings for
- categories */
- LOG(fprintf(stderr, "add_category_if_possible: calling strlen, i==%d\n", i));
- if(strlen(category->name[i]) == 0){
- int cat_to_add_len;
- LOG(fprintf(stderr, "add_category_if_possible: strlen == 0\n"));
-
- cat_to_add_len = strlen(cat_to_add);
- LOG(fprintf(stderr, "add_category_if_possible: cat_to_add_len: %d\n",
- cat_to_add_len));
- retval = i;
-
- /* only 15 characters for category, 16th is
- * '\0' can't do direct mem transfer due to
- * declaration type
- */
- LOG(fprintf(stderr, "add_category_if_possible: copying first 15 of category\n"));
- for(j=0; j<cat_to_add_len; j++){
- category->name[i][j] = cat_to_add[j];
- }
- LOG(fprintf(stderr,
- "add_category_if_possible: setting from %d to i==15 to \\0\n",
- cat_to_add_len));
-
- for(j=cat_to_add_len; j<16; j++)
- category->name[i][j] = '\0';
-
- LOG(fprintf(stderr, "add_category_if_possible: setting ID[%d] to %d\n",
- category->ID[i], lastDesktopUniqueID));
- category->ID[i] = lastDesktopUniqueID;
- lastDesktopUniqueID++;
-
- LOG(fprintf(stderr, "add_category_if_possible: setting renamed[%d] to TRUE\n", i));
- category->renamed[i] = TRUE;
-
- LOG(g_message("*** adding category '%s', ID %d ***",
- category->name[i], category->ID[i]));
- break;
- }
- }
-
- if(retval == 0){
- LOG(g_message("*** not adding category - category list already full ***"));
- }
-
- return retval;
-}
-
-/*
* converts a ECalComponent object to a EMemoLocalRecord
*/
static void
@@ -638,51 +575,8 @@ local_record_from_comp (EMemoLocalRecord *local, ECalComponent *comp, EMemoCondu
LOG(fprintf(stderr, "local_record_from_comp: done calling dlp_ReadRecordById\n"));
}
- /*
- * Grab category from existing category list in ctxt->ai.category
- */
- if(local->local.category == 0){
- GSList *categ_list_head, *categ_list_cur;
- int cat = -1;
- int i;
-
- LOG(fprintf(stderr, "local_record_from_comp: trying to set category"));
- LOG(fprintf(stderr, "local_record_from_comp: calling e_cal_component_get_categories_list\n"));
-
- e_cal_component_get_categories_list(comp, &categ_list_head);
- LOG(fprintf(stderr, "local_record_from_comp: got list, setting categ_list_cur to head\n"));
-
- categ_list_cur = categ_list_head;
- while (categ_list_cur && cat == -1)
- {
- LOG(fprintf(stderr, "local_record_from_comp: iterating, data == %s",
- (char *)categ_list_cur->data));
- for(i=0; i<16; i++){
- LOG(fprintf(stderr, "local_record_from_comp: i == %d\n", i));
- if(strcmp((char *)categ_list_cur->data,
- ctxt->ai.category.name[i]) == 0){
- cat = i;
- LOG(fprintf(stderr, "local_record_from_comp: found category, name: %s\n",
- ctxt->ai.category.name[i]));
- break;
- }
- }
-
- LOG(fprintf(stderr, "local_record_from_comp: calling g_slist_next\n"));
- categ_list_cur = g_slist_next(categ_list_cur);
- }
-
- if(cat != -1){
- LOG(fprintf(stderr, "local_record_from_comp: setting category\n"));
- local->local.category = cat;
- }
- else if(categ_list_head != NULL){
- local->local.category =
- add_category_if_possible(
- (char *)(categ_list_head->data),
- &(ctxt->ai.category));
- }
- }
+ /*Category support*/
+ e_pilot_local_category_to_remote(&(local->local.category), comp, &(ctxt->ai.category));
/* STOP: don't replace these with g_strdup, since free_Memo
uses free to deallocate */
@@ -759,7 +653,6 @@ comp_from_remote_record (GnomePilotConduitSyncAbs *conduit,
struct icaltimetype now;
icaltimezone *utc_zone;
char *txt, *txt2, *txt3;
- char *category;
int i;
#ifdef PILOT_LINK_0_12
pi_buffer_t * buffer;
@@ -797,6 +690,9 @@ comp_from_remote_record (GnomePilotConduitSyncAbs *conduit,
e_cal_component_set_last_modified (comp, &now);
+ /*Category support*/
+ e_pilot_remote_category_to_local(remote->category, comp, &(ai->category));
+
/* The iCal description field */
if (!memo.text) {
e_cal_component_set_comment_list (comp, NULL);
@@ -851,19 +747,6 @@ comp_from_remote_record (GnomePilotConduitSyncAbs *conduit,
e_cal_component_set_classification (comp, E_CAL_COMPONENT_CLASS_PRIVATE);
else
e_cal_component_set_classification (comp, E_CAL_COMPONENT_CLASS_PUBLIC);
-
-
- /* set the category properly */
- category = ai->category.name[remote->category];
-
- /* TODO The Memos editor page and search bar are not updated until
- a restart of the evolution client */
- if(e_categories_exist(category) == FALSE){
- /* add if it doesn't exist */
- e_categories_add(category, NULL, NULL, TRUE);
- }
-
- e_cal_component_set_categories(comp, category);
e_cal_component_commit_sequence (comp);
@@ -1150,11 +1033,12 @@ for_each (GnomePilotConduitSyncAbs *conduit,
LOG (g_message ( "for_each: iterating over %d records", g_list_length (comps)));
*local = g_new0 (EMemoLocalRecord, 1);
- LOG(fprintf(stderr, "for_each: calling local_record_from_comp\n"));
local_record_from_comp (*local, comps->data, ctxt);
- LOG(fprintf(stderr, "for_each: calling g_list_prepend\n"));
- ctxt->locals = g_list_prepend (ctxt->locals, *local);
- LOG(fprintf(stderr, "for_each: setting iterator = comps\n"));
+
+ /* NOTE: ignore the return value, otherwise ctxt->locals
+ * gets messed up. The calling function keeps track of
+ * the *local variable */
+ g_list_prepend (ctxt->locals, *local);
iterator = comps;
} else {
LOG (g_message ( "no events" ));
@@ -1163,15 +1047,18 @@ for_each (GnomePilotConduitSyncAbs *conduit,
}
} else {
count++;
- LOG(fprintf(stderr, "for_each: calling g_list_next (else part)\n"));
+
if (g_list_next (iterator)) {
iterator = g_list_next (iterator);
- LOG(fprintf(stderr, "for_each: creating EMemoLocalRecord\n"));
+
*local = g_new0 (EMemoLocalRecord, 1);
LOG(fprintf(stderr, "for_each: calling local_record_from_comp\n"));
local_record_from_comp (*local, iterator->data, ctxt);
- LOG(fprintf(stderr, "for_each: calling g_list_prepend\n"));
- ctxt->locals = g_list_prepend (ctxt->locals, *local);
+
+ /* NOTE: ignore the return value, otherwise ctxt->locals
+ * gets messed up. The calling function keeps track of
+ * the *local variable */
+ g_list_prepend (ctxt->locals, *local);
} else {
LOG (g_message ( "for_each ending" ));
@@ -1207,12 +1094,14 @@ for_each_modified (GnomePilotConduitSyncAbs *conduit,
iterator = next_changed_item (ctxt, iterator);
if (iterator != NULL) {
ECalChange *ccc = iterator->data;
- LOG(fprintf(stderr, "for_each_modified: creating EMemoLocalRecord\n"));
+
*local = g_new0 (EMemoLocalRecord, 1);
- LOG(fprintf(stderr, "for_each_modified: calling local_record_from_comp\n"));
local_record_from_comp (*local, ccc->comp, ctxt);
- LOG(fprintf(stderr, "for_each_modified: calling g_list_prepend\n"));
- ctxt->locals = g_list_prepend (ctxt->locals, *local);
+
+ /* NOTE: ignore the return value, otherwise ctxt->locals
+ * gets messed up. The calling function keeps track of
+ * the *local variable */
+ g_list_prepend (ctxt->locals, *local);
} else {
LOG (g_message ( "no events" ));
@@ -1220,17 +1109,18 @@ for_each_modified (GnomePilotConduitSyncAbs *conduit,
}
} else {
count++;
- LOG(fprintf(stderr, "for_each_modified: calling g_list_next\n"));
+
iterator = g_list_next (iterator);
- LOG(fprintf(stderr, "for_each_modified: calling next_changed_item\n"));
if (iterator && (iterator = next_changed_item (ctxt, iterator))) {
ECalChange *ccc = iterator->data;
- LOG(fprintf(stderr, "for_each_modified: calling EMemoLocalRecord\n"));
+
*local = g_new0 (EMemoLocalRecord, 1);
- LOG(fprintf(stderr, "for_each_modified: calling local_record_from_comp\n"));
local_record_from_comp (*local, ccc->comp, ctxt);
- LOG(fprintf(stderr, "for_each_modified: calling g_list_prepend\n"));
- ctxt->locals = g_list_prepend (ctxt->locals, *local);
+
+ /* NOTE: ignore the return value, otherwise ctxt->locals
+ * gets messed up. The calling function keeps track of
+ * the *local variable */
+ g_list_prepend (ctxt->locals, *local);
} else {
LOG (g_message ( "for_each_modified ending" ));
diff --git a/calendar/conduits/todo/Makefile.am b/calendar/conduits/todo/Makefile.am
index 2978fcef61..bf3a07b23f 100644
--- a/calendar/conduits/todo/Makefile.am
+++ b/calendar/conduits/todo/Makefile.am
@@ -3,6 +3,8 @@ INCLUDES = \
-I$(top_builddir)/e-util \
-I$(top_srcdir)/widgets/misc \
-I$(top_builddir)/widgets/misc \
+ -I$(top_srcdir)/calendar/conduits/common \
+ -I$(top_builddir)/calendar/conduits/common \
$(EVOLUTION_CALENDAR_CONDUIT_CFLAGS)
# ToDo Conduit
@@ -17,6 +19,7 @@ libetodo_conduit_la_LIBADD = \
$(top_builddir)/e-util/libeutil.la \
$(top_builddir)/e-util/libeconduit.la \
$(top_builddir)/widgets/misc/libemiscwidgets.la \
+ $(top_builddir)/calendar/conduits/common/libecalendar_common_conduit.la \
$(EVOLUTION_CALENDAR_CONDUIT_LIBS)
e-todo.conduit: e-todo.conduit.in
diff --git a/calendar/conduits/todo/todo-conduit.c b/calendar/conduits/todo/todo-conduit.c
index 42a37802e0..315c59c064 100644
--- a/calendar/conduits/todo/todo-conduit.c
+++ b/calendar/conduits/todo/todo-conduit.c
@@ -47,6 +47,7 @@
#include <e-pilot-settings.h>
#include <e-pilot-util.h>
#include <e-config-listener.h>
+#include <libecalendar-common-conduit.h>
GnomePilotConduit * conduit_get_gpilot_conduit (guint32);
void conduit_destroy_gpilot_conduit (GnomePilotConduit*);
@@ -430,9 +431,9 @@ static char *print_remote (GnomePilotRecord *remote)
todo.priority,
todo.complete,
todo.description ?
- todo.description : "",
+ e_pilot_utf8_from_pchar(todo.description) : "",
todo.note ?
- todo.note : "",
+ e_pilot_utf8_from_pchar(todo.note) : "",
remote->category);
free_ToDo (&todo);
@@ -646,55 +647,6 @@ local_record_to_pilot_record (EToDoLocalRecord *local,
}
/*
- * Adds a category to the category app info structure (name and ID),
- * sets category->renamed[i] to true if possible to rename.
- *
- * This will be packed and written to the app info block during post_sync.
- */
-
-static int
-add_category_if_possible(char *cat_to_add, struct CategoryAppInfo *category)
-{
- int i, j;
- int retval = 0; // 0 is the Unfiled category
-
- for(i=0; i<16; i++){
- // if strlen is 0, then the category is empty
- // the PalmOS doesn't let 0-length strings for
- // categories
- if(strlen(category->name[i]) == 0){
- int cat_to_add_len = strlen(cat_to_add);
- retval = i;
-
- /* only 15 characters for category, 16th is
- * '\0' can't do direct mem transfer due to
- * declaration type
- */
- for(j=0; j<cat_to_add_len; j++)
- category->name[i][j] = cat_to_add[j];
-
- for(j=cat_to_add_len; j<16; j++)
- category->name[i][j] = '\0';
-
- category->ID[i] = lastDesktopUniqueID;
- lastDesktopUniqueID++;
-
- category->renamed[i] = TRUE;
-
- LOG(g_message("*** adding category '%s', ID %d ***",
- category->name[i], category->ID[i]));
- break;
- }
- }
-
- if(retval == 0){
- LOG(g_message("*** not adding category - category list already full ***"));
- }
-
- return retval;
-}
-
-/*
* converts a ECalComponent object to a EToDoLocalRecord
*/
static void
@@ -755,42 +707,8 @@ local_record_from_comp (EToDoLocalRecord *local, ECalComponent *comp, EToDoCondu
#endif
}
- /*
- * Grab category from existing category list in ctxt->ai.category
- */
- if(local->local.category == 0){
- GSList *categ_list_head, *categ_list_cur;
- int cat = -1;
- int i;
-
- e_cal_component_get_categories_list(comp, &categ_list_head);
-
- categ_list_cur = categ_list_head;
- while (categ_list_cur && cat == -1)
- {
- for(i=0; i<16; i++){
- if(strcmp((char *)categ_list_cur->data,
- ctxt->ai.category.name[i]) == 0){
- cat = i;
- break;
- }
- }
-
- categ_list_cur = g_slist_next(categ_list_cur);
- }
-
- if(cat != -1){
- local->local.category = cat;
- }
- else{
- if(categ_list_head != NULL){
- local->local.category =
- add_category_if_possible(
- (char *)(categ_list_head->data),
- &(ctxt->ai.category));
- }
- }
- }
+ /*Category support*/
+ e_pilot_local_category_to_remote(&(local->local.category), comp, &(ctxt->ai.category));
/* STOP: don't replace these with g_strdup, since free_ToDo
uses free to deallocate */
@@ -907,7 +825,6 @@ comp_from_remote_record (GnomePilotConduitSyncAbs *conduit,
icaltimezone *utc_zone;
int priority;
char *txt;
- char *category;
#ifdef PILOT_LINK_0_12
pi_buffer_t * buffer;
#endif
@@ -949,6 +866,9 @@ comp_from_remote_record (GnomePilotConduitSyncAbs *conduit,
e_cal_component_set_summary (comp, &summary);
free (txt);
+ /*Category support*/
+ e_pilot_remote_category_to_local(remote->category, comp, &(ai->category));
+
/* The iCal description field */
if (!todo.note) {
e_cal_component_set_comment_list (comp, NULL);
@@ -990,7 +910,7 @@ comp_from_remote_record (GnomePilotConduitSyncAbs *conduit,
e_cal_component_set_status (comp, ICAL_STATUS_NEEDSACTION);
}
- if (!is_empty_time (todo.due)) {
+ if (!todo.indefinite && !is_empty_time (todo.due)) {
due = tm_to_icaltimetype (&todo.due, TRUE);
dt.value = &due;
e_cal_component_set_due (comp, &dt);
@@ -1020,20 +940,6 @@ comp_from_remote_record (GnomePilotConduitSyncAbs *conduit,
e_cal_component_set_classification (comp, E_CAL_COMPONENT_CLASS_PRIVATE);
else
e_cal_component_set_classification (comp, E_CAL_COMPONENT_CLASS_PUBLIC);
-
-
- // set the category properly
- category = ai->category.name[remote->category];
-
-
- // TODO The Tasks editor page and search bar are not updated until
- // a restart of the evolution client
- if(e_categories_exist(category) == FALSE){
- // add if it doesn't exist
- e_categories_add(category, NULL, NULL, TRUE);
- }
-
- e_cal_component_set_categories(comp, category);
e_cal_component_commit_sequence (comp);
@@ -1315,7 +1221,11 @@ for_each (GnomePilotConduitSyncAbs *conduit,
*local = g_new0 (EToDoLocalRecord, 1);
local_record_from_comp (*local, comps->data, ctxt);
- ctxt->locals = g_list_prepend (ctxt->locals, *local);
+
+ /* NOTE: ignore the return value, otherwise ctxt->locals
+ * gets messed up. The calling function keeps track of
+ * the *local variable */
+ g_list_prepend (ctxt->locals, *local);
iterator = comps;
} else {
@@ -1330,7 +1240,11 @@ for_each (GnomePilotConduitSyncAbs *conduit,
*local = g_new0 (EToDoLocalRecord, 1);
local_record_from_comp (*local, iterator->data, ctxt);
- ctxt->locals = g_list_prepend (ctxt->locals, *local);
+
+ /* NOTE: ignore the return value, otherwise ctxt->locals
+ * gets messed up. The calling function keeps track of
+ * the *local variable */
+ g_list_prepend (ctxt->locals, *local);
} else {
LOG (g_message ( "for_each ending" ));
@@ -1369,7 +1283,11 @@ for_each_modified (GnomePilotConduitSyncAbs *conduit,
*local = g_new0 (EToDoLocalRecord, 1);
local_record_from_comp (*local, ccc->comp, ctxt);
- ctxt->locals = g_list_prepend (ctxt->locals, *local);
+
+ /* NOTE: ignore the return value, otherwise ctxt->locals
+ * gets messed up. The calling function keeps track of
+ * the *local variable */
+ g_list_prepend (ctxt->locals, *local);
} else {
LOG (g_message ( "no events" ));
@@ -1383,7 +1301,11 @@ for_each_modified (GnomePilotConduitSyncAbs *conduit,
*local = g_new0 (EToDoLocalRecord, 1);
local_record_from_comp (*local, ccc->comp, ctxt);
- ctxt->locals = g_list_prepend (ctxt->locals, *local);
+
+ /* NOTE: ignore the return value, otherwise ctxt->locals
+ * gets messed up. The calling function keeps track of
+ * the *local variable */
+ g_list_prepend (ctxt->locals, *local);
} else {
LOG (g_message ( "for_each_modified ending" ));
diff --git a/configure.in b/configure.in
index 0fbd308571..735d23f20f 100644
--- a/configure.in
+++ b/configure.in
@@ -1969,6 +1969,7 @@ calendar/importers/Makefile
calendar/common/Makefile
calendar/idl/Makefile
calendar/conduits/Makefile
+calendar/conduits/common/Makefile
calendar/conduits/todo/Makefile
calendar/conduits/calendar/Makefile
calendar/conduits/memo/Makefile