aboutsummaryrefslogtreecommitdiffstats
path: root/calendar
diff options
context:
space:
mode:
Diffstat (limited to 'calendar')
-rw-r--r--calendar/ChangeLog11
-rw-r--r--calendar/cal-util/calobj.c21
-rw-r--r--calendar/calendar.c11
-rw-r--r--calendar/calobj.c21
-rw-r--r--calendar/gui/calendar.c11
-rw-r--r--calendar/gui/main.c18
-rw-r--r--calendar/main.c18
-rw-r--r--calendar/pcs/calobj.c21
8 files changed, 106 insertions, 26 deletions
diff --git a/calendar/ChangeLog b/calendar/ChangeLog
index a38f7e90d9..5d7959c4ae 100644
--- a/calendar/ChangeLog
+++ b/calendar/ChangeLog
@@ -1,3 +1,14 @@
+1998-04-18 Miguel de Icaza <miguel@nuclecu.unam.mx>
+
+ * calobj.c (ical_object_to_vobject): Add Quoted printable property
+ to items containing new lines.
+ (duration): Use unsigned integers, to work around buggy calendar
+ files generated by korganizer.
+
+ * main.c (save_calendar_cmd): Do not ask for file name if we are
+ saving.
+ (save_as_calendar_cmd): New command.
+
1998-04-17 Miguel de Icaza <miguel@nuclecu.unam.mx>
diff --git a/calendar/cal-util/calobj.c b/calendar/cal-util/calobj.c
index 4624b3a485..d9950e0bae 100644
--- a/calendar/cal-util/calobj.c
+++ b/calendar/cal-util/calobj.c
@@ -303,7 +303,7 @@ load_recur_yearly_day (iCalObject *o, char **str)
static void
duration (iCalObject *o, char **str)
{
- int duration = 0;
+ unsigned int duration = 0;
ignore_space (str);
if (**str != '#')
@@ -735,7 +735,7 @@ save_alarm (VObject *o, CalendarAlarm *alarm, iCalObject *ical)
VObject *
ical_object_to_vobject (iCalObject *ical)
{
- VObject *o, *alarm;
+ VObject *o, *alarm, *s;
GList *l;
if (ical->type == ICAL_EVENT)
@@ -757,7 +757,7 @@ ical_object_to_vobject (iCalObject *ical)
addPropValue (o, VCDTendProp, isodate_from_time_t (ical->dtend));
/* dcreated */
- addPropValue (o, VCDTendProp, isodate_from_time_t (ical->created));
+ addPropValue (o, VCDCreatedProp, isodate_from_time_t (ical->created));
/* completed */
if (ical->completed)
@@ -771,11 +771,20 @@ ical_object_to_vobject (iCalObject *ical)
store_list (o, VCExpDateProp, ical->exdate, ',');
/* description/comment */
- addPropValue (o, VCDescriptionProp, ical->comment ? ical->comment : "No Comment");
+ if (ical->comment && strlen (ical->comment)){
+ s = addPropValue (o, VCDescriptionProp, ical->comment);
+ if (strchr (ical->comment, '\n'))
+ addProp (s, VCQuotedPrintableProp);
+ }
/* summary */
- if (ical->summary)
- addPropValue (o, VCSummaryProp, ical->summary);
+ if (strlen (ical->summary)){
+ s = addPropValue (o, VCSummaryProp, ical->summary);
+ if (strchr (ical->summary, '\n'))
+ addProp (s, VCQuotedPrintableProp);
+ } else {
+ addPropValue (o, VCSummaryProp, _("Appointment"));
+ }
/* status */
addPropValue (o, VCStatusProp, ical->status);
diff --git a/calendar/calendar.c b/calendar/calendar.c
index 28f37f78eb..a32efae1e0 100644
--- a/calendar/calendar.c
+++ b/calendar/calendar.c
@@ -256,6 +256,9 @@ calendar_load_from_vobject (Calendar *cal, VObject *vcal)
if (strcmp (object_name, VCVersionProp) == 0)
continue; /* FIXME: implement */
+
+ if (strcmp (object_name, VCTimeZoneProp) == 0)
+ continue; /* FIXME: implement */
ical = ical_object_create_from_vobject (this, object_name);
@@ -296,13 +299,17 @@ calendar_save (Calendar *cal, char *fname)
{
VObject *vcal;
GList *l;
-
+ time_t now = time (NULL);
+
if (fname == NULL)
fname = cal->filename;
+
+ /* WE call localtime for the side effect of setting tzname */
+ localtime (&now);
vcal = newVObject (VCCalProp);
addPropValue (vcal, VCProdIdProp, "-//GNOME//NONSGML GnomeCalendar//EN");
- addPropValue (vcal, VCTimeZoneProp, "NONE");
+ addPropValue (vcal, VCTimeZoneProp, tzname [0]);
addPropValue (vcal, VCVersionProp, VERSION);
cal->temp = vcal;
diff --git a/calendar/calobj.c b/calendar/calobj.c
index 4624b3a485..d9950e0bae 100644
--- a/calendar/calobj.c
+++ b/calendar/calobj.c
@@ -303,7 +303,7 @@ load_recur_yearly_day (iCalObject *o, char **str)
static void
duration (iCalObject *o, char **str)
{
- int duration = 0;
+ unsigned int duration = 0;
ignore_space (str);
if (**str != '#')
@@ -735,7 +735,7 @@ save_alarm (VObject *o, CalendarAlarm *alarm, iCalObject *ical)
VObject *
ical_object_to_vobject (iCalObject *ical)
{
- VObject *o, *alarm;
+ VObject *o, *alarm, *s;
GList *l;
if (ical->type == ICAL_EVENT)
@@ -757,7 +757,7 @@ ical_object_to_vobject (iCalObject *ical)
addPropValue (o, VCDTendProp, isodate_from_time_t (ical->dtend));
/* dcreated */
- addPropValue (o, VCDTendProp, isodate_from_time_t (ical->created));
+ addPropValue (o, VCDCreatedProp, isodate_from_time_t (ical->created));
/* completed */
if (ical->completed)
@@ -771,11 +771,20 @@ ical_object_to_vobject (iCalObject *ical)
store_list (o, VCExpDateProp, ical->exdate, ',');
/* description/comment */
- addPropValue (o, VCDescriptionProp, ical->comment ? ical->comment : "No Comment");
+ if (ical->comment && strlen (ical->comment)){
+ s = addPropValue (o, VCDescriptionProp, ical->comment);
+ if (strchr (ical->comment, '\n'))
+ addProp (s, VCQuotedPrintableProp);
+ }
/* summary */
- if (ical->summary)
- addPropValue (o, VCSummaryProp, ical->summary);
+ if (strlen (ical->summary)){
+ s = addPropValue (o, VCSummaryProp, ical->summary);
+ if (strchr (ical->summary, '\n'))
+ addProp (s, VCQuotedPrintableProp);
+ } else {
+ addPropValue (o, VCSummaryProp, _("Appointment"));
+ }
/* status */
addPropValue (o, VCStatusProp, ical->status);
diff --git a/calendar/gui/calendar.c b/calendar/gui/calendar.c
index 28f37f78eb..a32efae1e0 100644
--- a/calendar/gui/calendar.c
+++ b/calendar/gui/calendar.c
@@ -256,6 +256,9 @@ calendar_load_from_vobject (Calendar *cal, VObject *vcal)
if (strcmp (object_name, VCVersionProp) == 0)
continue; /* FIXME: implement */
+
+ if (strcmp (object_name, VCTimeZoneProp) == 0)
+ continue; /* FIXME: implement */
ical = ical_object_create_from_vobject (this, object_name);
@@ -296,13 +299,17 @@ calendar_save (Calendar *cal, char *fname)
{
VObject *vcal;
GList *l;
-
+ time_t now = time (NULL);
+
if (fname == NULL)
fname = cal->filename;
+
+ /* WE call localtime for the side effect of setting tzname */
+ localtime (&now);
vcal = newVObject (VCCalProp);
addPropValue (vcal, VCProdIdProp, "-//GNOME//NONSGML GnomeCalendar//EN");
- addPropValue (vcal, VCTimeZoneProp, "NONE");
+ addPropValue (vcal, VCTimeZoneProp, tzname [0]);
addPropValue (vcal, VCVersionProp, VERSION);
cal->temp = vcal;
diff --git a/calendar/gui/main.c b/calendar/gui/main.c
index a3b9ce2bcc..cc7a0ecd85 100644
--- a/calendar/gui/main.c
+++ b/calendar/gui/main.c
@@ -229,7 +229,7 @@ close_save (GtkWidget *w)
}
void
-save_calendar_cmd (GtkWidget *widget, void *data)
+save_as_calendar_cmd (GtkWidget *widget, void *data)
{
GtkFileSelection *fs;
@@ -251,6 +251,17 @@ save_calendar_cmd (GtkWidget *widget, void *data)
gtk_widget_destroy (GTK_WIDGET (fs));
}
+void
+save_calendar_cmd (GtkWidget *widget, void *data)
+{
+ GnomeCalendar *gcal = data;
+
+ if (gcal->cal->filename)
+ calendar_save (gcal->cal, gcal->cal->filename);
+ else
+ save_as_calendar_cmd (widget, data);
+}
+
GnomeUIInfo gnome_cal_file_menu [] = {
{ GNOME_APP_UI_ITEM, N_("New calendar"), NULL, new_calendar_cmd },
@@ -260,6 +271,9 @@ GnomeUIInfo gnome_cal_file_menu [] = {
{ GNOME_APP_UI_ITEM, N_("Save calendar..."), NULL, save_calendar_cmd, NULL, NULL,
GNOME_APP_PIXMAP_STOCK, GNOME_STOCK_MENU_SAVE },
+ { GNOME_APP_UI_ITEM, N_("Save calendar as..."), NULL, save_as_calendar_cmd, NULL, NULL,
+ GNOME_APP_PIXMAP_STOCK, GNOME_STOCK_MENU_SAVE },
+
{ GNOME_APP_UI_SEPARATOR },
{ GNOME_APP_UI_ITEM, N_("Close this calendar"), NULL, close_cmd, NULL, NULL,
GNOME_APP_PIXMAP_STOCK, GNOME_STOCK_MENU_EXIT },
@@ -284,7 +298,7 @@ GnomeUIInfo gnome_cal_edit_menu [] = {
GnomeUIInfo gnome_cal_menu [] = {
{ GNOME_APP_UI_SUBTREE, N_("File"), NULL, &gnome_cal_file_menu },
- { GNOME_APP_UI_SUBTREE, N_("Edit"), NULL, &gnome_cal_edit_menu },
+ { GNOME_APP_UI_SUBTREE, N_("Calendar"), NULL, &gnome_cal_edit_menu },
{ GNOME_APP_UI_SUBTREE, N_("Help"), NULL, &gnome_cal_about_menu },
GNOMEUIINFO_END
};
diff --git a/calendar/main.c b/calendar/main.c
index a3b9ce2bcc..cc7a0ecd85 100644
--- a/calendar/main.c
+++ b/calendar/main.c
@@ -229,7 +229,7 @@ close_save (GtkWidget *w)
}
void
-save_calendar_cmd (GtkWidget *widget, void *data)
+save_as_calendar_cmd (GtkWidget *widget, void *data)
{
GtkFileSelection *fs;
@@ -251,6 +251,17 @@ save_calendar_cmd (GtkWidget *widget, void *data)
gtk_widget_destroy (GTK_WIDGET (fs));
}
+void
+save_calendar_cmd (GtkWidget *widget, void *data)
+{
+ GnomeCalendar *gcal = data;
+
+ if (gcal->cal->filename)
+ calendar_save (gcal->cal, gcal->cal->filename);
+ else
+ save_as_calendar_cmd (widget, data);
+}
+
GnomeUIInfo gnome_cal_file_menu [] = {
{ GNOME_APP_UI_ITEM, N_("New calendar"), NULL, new_calendar_cmd },
@@ -260,6 +271,9 @@ GnomeUIInfo gnome_cal_file_menu [] = {
{ GNOME_APP_UI_ITEM, N_("Save calendar..."), NULL, save_calendar_cmd, NULL, NULL,
GNOME_APP_PIXMAP_STOCK, GNOME_STOCK_MENU_SAVE },
+ { GNOME_APP_UI_ITEM, N_("Save calendar as..."), NULL, save_as_calendar_cmd, NULL, NULL,
+ GNOME_APP_PIXMAP_STOCK, GNOME_STOCK_MENU_SAVE },
+
{ GNOME_APP_UI_SEPARATOR },
{ GNOME_APP_UI_ITEM, N_("Close this calendar"), NULL, close_cmd, NULL, NULL,
GNOME_APP_PIXMAP_STOCK, GNOME_STOCK_MENU_EXIT },
@@ -284,7 +298,7 @@ GnomeUIInfo gnome_cal_edit_menu [] = {
GnomeUIInfo gnome_cal_menu [] = {
{ GNOME_APP_UI_SUBTREE, N_("File"), NULL, &gnome_cal_file_menu },
- { GNOME_APP_UI_SUBTREE, N_("Edit"), NULL, &gnome_cal_edit_menu },
+ { GNOME_APP_UI_SUBTREE, N_("Calendar"), NULL, &gnome_cal_edit_menu },
{ GNOME_APP_UI_SUBTREE, N_("Help"), NULL, &gnome_cal_about_menu },
GNOMEUIINFO_END
};
diff --git a/calendar/pcs/calobj.c b/calendar/pcs/calobj.c
index 4624b3a485..d9950e0bae 100644
--- a/calendar/pcs/calobj.c
+++ b/calendar/pcs/calobj.c
@@ -303,7 +303,7 @@ load_recur_yearly_day (iCalObject *o, char **str)
static void
duration (iCalObject *o, char **str)
{
- int duration = 0;
+ unsigned int duration = 0;
ignore_space (str);
if (**str != '#')
@@ -735,7 +735,7 @@ save_alarm (VObject *o, CalendarAlarm *alarm, iCalObject *ical)
VObject *
ical_object_to_vobject (iCalObject *ical)
{
- VObject *o, *alarm;
+ VObject *o, *alarm, *s;
GList *l;
if (ical->type == ICAL_EVENT)
@@ -757,7 +757,7 @@ ical_object_to_vobject (iCalObject *ical)
addPropValue (o, VCDTendProp, isodate_from_time_t (ical->dtend));
/* dcreated */
- addPropValue (o, VCDTendProp, isodate_from_time_t (ical->created));
+ addPropValue (o, VCDCreatedProp, isodate_from_time_t (ical->created));
/* completed */
if (ical->completed)
@@ -771,11 +771,20 @@ ical_object_to_vobject (iCalObject *ical)
store_list (o, VCExpDateProp, ical->exdate, ',');
/* description/comment */
- addPropValue (o, VCDescriptionProp, ical->comment ? ical->comment : "No Comment");
+ if (ical->comment && strlen (ical->comment)){
+ s = addPropValue (o, VCDescriptionProp, ical->comment);
+ if (strchr (ical->comment, '\n'))
+ addProp (s, VCQuotedPrintableProp);
+ }
/* summary */
- if (ical->summary)
- addPropValue (o, VCSummaryProp, ical->summary);
+ if (strlen (ical->summary)){
+ s = addPropValue (o, VCSummaryProp, ical->summary);
+ if (strchr (ical->summary, '\n'))
+ addProp (s, VCQuotedPrintableProp);
+ } else {
+ addPropValue (o, VCSummaryProp, _("Appointment"));
+ }
/* status */
addPropValue (o, VCStatusProp, ical->status);