aboutsummaryrefslogtreecommitdiffstats
path: root/calendar/conduits
diff options
context:
space:
mode:
authorJP Rosevear <jpr@ximian.com>2001-12-09 07:18:37 +0800
committerJP Rosevear <jpr@src.gnome.org>2001-12-09 07:18:37 +0800
commitd1ddbc231d6e816af4e582b79da400fda8e8bd01 (patch)
tree3b96dd341632540f62015d4fd327c83b2246b77d /calendar/conduits
parent9cb9cf06c9063ddf76a87b07cb6e94c2008dd605 (diff)
downloadgsoc2013-evolution-d1ddbc231d6e816af4e582b79da400fda8e8bd01.tar.gz
gsoc2013-evolution-d1ddbc231d6e816af4e582b79da400fda8e8bd01.tar.zst
gsoc2013-evolution-d1ddbc231d6e816af4e582b79da400fda8e8bd01.zip
if we have an alarm that can be represented on the pilot, set the
2001-12-08 JP Rosevear <jpr@ximian.com> * conduits/calendar/calendar-conduit.c (local_record_from_comp): if we have an alarm that can be represented on the pilot, set the appointment fields appropriately, if the duration has values for minutes and/or hours and/or days, use the lowest common denominator (comp_from_remote_record): if the appointment on the pilot has an alarm, find the first alarm an item currently had that is relative to the start and with a negative duration and update it (or create a new one if no valid ones exist) * cal-util/cal-component.c (cal_component_get_alarm_uids): build list in the order they appear in the component so we get consisting order for the gui and for the pilot svn path=/trunk/; revision=14943
Diffstat (limited to 'calendar/conduits')
-rw-r--r--calendar/conduits/calendar/calendar-conduit.c97
1 files changed, 97 insertions, 0 deletions
diff --git a/calendar/conduits/calendar/calendar-conduit.c b/calendar/conduits/calendar/calendar-conduit.c
index 71d6cf73b6..1546141254 100644
--- a/calendar/conduits/calendar/calendar-conduit.c
+++ b/calendar/conduits/calendar/calendar-conduit.c
@@ -66,6 +66,8 @@ void conduit_destroy_gpilot_conduit (GnomePilotConduit*);
#define WARN(e...) g_log (G_LOG_DOMAIN, G_LOG_LEVEL_WARNING, e)
#define INFO(e...) g_log (G_LOG_DOMAIN, G_LOG_LEVEL_MESSAGE, e)
+#define PILOT_MAX_ADVANCE 99
+
/* Debug routines */
static char *
print_local (ECalLocalRecord *local)
@@ -720,6 +722,54 @@ local_record_from_comp (ECalLocalRecord *local, CalComponent *comp, ECalConduitC
*local->appt->exception = icaltimetype_to_tm (dt->value);
}
cal_component_free_exdate_list (edl);
+
+ /* Alarm */
+ local->appt->alarm = 0;
+ if (cal_component_has_alarms (comp)) {
+ GList *uids, *l;
+ CalComponentAlarm *alarm;
+ CalAlarmTrigger trigger;
+
+ uids = cal_component_get_alarm_uids (comp);
+ for (l = uids; l != NULL; l = l->next) {
+ alarm = cal_component_get_alarm (comp, l->data);
+ cal_component_alarm_get_trigger (alarm, &trigger);
+
+ if ((trigger.type == CAL_ALARM_TRIGGER_RELATIVE_START
+ && trigger.u.rel_duration.is_neg)) {
+ local->appt->advanceUnits = advMinutes;
+ local->appt->advance =
+ trigger.u.rel_duration.minutes
+ + trigger.u.rel_duration.hours * 60
+ + trigger.u.rel_duration.days * 60 * 24
+ + trigger.u.rel_duration.weeks * 7 * 60 * 24;
+
+ if (local->appt->advance > PILOT_MAX_ADVANCE) {
+ local->appt->advanceUnits = advHours;
+ local->appt->advance =
+ trigger.u.rel_duration.minutes / 60
+ + trigger.u.rel_duration.hours
+ + trigger.u.rel_duration.days * 24
+ + trigger.u.rel_duration.weeks * 7 * 24;
+ }
+ if (local->appt->advance > PILOT_MAX_ADVANCE) {
+ local->appt->advanceUnits = advDays;
+ local->appt->advance =
+ trigger.u.rel_duration.minutes / (60 * 24)
+ + trigger.u.rel_duration.hours / 24
+ + trigger.u.rel_duration.days
+ + trigger.u.rel_duration.weeks * 7;
+ }
+ if (local->appt->advance > PILOT_MAX_ADVANCE)
+ local->appt->advance = PILOT_MAX_ADVANCE;
+
+ local->appt->alarm = 1;
+ break;
+ }
+ cal_component_alarm_free (alarm);
+ }
+ cal_obj_uid_list_free (uids);
+ }
cal_component_get_classification (comp, &classif);
@@ -907,6 +957,53 @@ comp_from_remote_record (GnomePilotConduitSyncAbs *conduit,
}
cal_component_set_exdate_list (comp, edl);
cal_component_free_exdate_list (edl);
+
+ /* Alarm */
+ if (appt.alarm) {
+ CalComponentAlarm *alarm = NULL;
+ CalAlarmTrigger trigger;
+ gboolean found = FALSE;
+
+ if (cal_component_has_alarms (comp)) {
+ GList *uids, *l;
+
+ uids = cal_component_get_alarm_uids (comp);
+ for (l = uids; l != NULL; l = l->next) {
+ alarm = cal_component_get_alarm (comp, l->data);
+ cal_component_alarm_get_trigger (alarm, &trigger);
+ if ((trigger.type == CAL_ALARM_TRIGGER_RELATIVE_START
+ && trigger.u.rel_duration.is_neg)) {
+ found = TRUE;
+ break;
+ }
+ cal_component_alarm_free (alarm);
+ }
+ cal_obj_uid_list_free (uids);
+ }
+ if (!found)
+ alarm = cal_component_alarm_new ();
+
+ memset (&trigger, 0, sizeof (CalAlarmTrigger));
+ trigger.type = CAL_ALARM_TRIGGER_RELATIVE_START;
+ trigger.u.rel_duration.is_neg = 1;
+ switch (appt.advanceUnits) {
+ case advMinutes:
+ trigger.u.rel_duration.minutes = appt.advance;
+ break;
+ case advHours:
+ trigger.u.rel_duration.hours = appt.advance;
+ break;
+ case advDays:
+ trigger.u.rel_duration.days = appt.advance;
+ break;
+ }
+ cal_component_alarm_set_trigger (alarm, trigger);
+ cal_component_alarm_set_action (alarm, CAL_ALARM_DISPLAY);
+
+ if (!found)
+ cal_component_add_alarm (comp, alarm);
+ cal_component_alarm_free (alarm);
+ }
cal_component_set_transparency (comp, CAL_COMPONENT_TRANSP_NONE);
orge González2010-10-201-216/+223 * Bug #631451 - Add handlers for x-scheme-handler/mailtoMilan Crha2010-10-202-25/+32 * Bug #630504 - Precache collate keys before sorting in EReflowModelMilan Crha2010-10-206-17/+109 * Updated Japanese translationTakayuki KUSANO2010-10-201-350/+351 * Bug #630969 - Implement also Message->Go to->Previous ThreadMilan Crha2010-10-204-0/+57 * Updated Spanish translationJorge González2010-10-201-205/+215 * [help] Fix XML validity of French translationClaude Paroz2010-10-201-4/+5 * Reduce GConf usage in em-composer-utils.c.Matthew Barnes2010-10-2018-291/+614 * Bug #630695 - Invalid read when enable/disable the account in preferencesMilan Crha2010-10-191-6/+19 * Bug #534453 - Incorporate 'Remove attachments' pluginRex Tsai2010-10-193-2/+107 * Bug #567265 - BCC kept on message forward from Sent folderMilan Crha2010-10-193-4/+10 * Crash on start with vfolders configuredMilan Crha2010-10-192-0/+8 * Updated Spanish translationJorge González2010-10-191-762/+769 * Add an "ellipsize" property to EMFolderTree.Matthew Barnes2010-10-194-12/+112 * Fix a runtime warning from the enum change.Matthew Barnes2010-10-191-2/+2 * Collect mail enum types in e-mail-enums.h.Matthew Barnes2010-10-1924-139/+220 * Miscellaneous fixups.Matthew Barnes2010-10-192-0/+10 * Move more account utilities to e-account-utils.c.Matthew Barnes2010-10-1940-176/+251 * Kill mail_config_service_set_save_passwd().Matthew Barnes2010-10-193-11/+1 * Kill mail_config_get_gconf_client().Matthew Barnes2010-10-1915-301/+302 * Send errors to an EAlertSink instead of the task bar.Matthew Barnes2010-10-1951-1754/+570 * Add an EOfflineAlert module.Matthew Barnes2010-10-197-3/+241 * EAlert: Allow arbitrary actions to be added.Matthew Barnes2010-10-1916-174/+458 * Implement EAlertSinkInterface in EShellContent.Matthew Barnes2010-10-185-14/+170 * EShellView: Mark a string for translation.Matthew Barnes2010-10-181-3/+1 * post release version bumpChenthill Palanisamy2010-10-181-1/+1 * News update for 2.91.1 releaseEVOLUTION_2_91_1Chenthill Palanisamy2010-10-181-0/+58 * Bug #630518 - Hides calendar parts from multipart/alternativeMilan Crha2010-10-182-4/+17 * Updated Spanish translationJorge González2010-10-181-27/+24 * Bug #630506 - "You have %d alarms" needs ngettextMilan Crha2010-10-181-1/+1 * Bug #631968 - Date wrongly displayed as Tomorrow.Punit Jain2010-10-181-0/+2 * Bug #604981 - Always bcc ignored for Contacts.Bharath Acharya2010-10-181-2/+2 * Updated Norwegian bokmål translationKjartan Maraas2010-10-161-1550/+1665 * Updated Spanish translationJorge González2010-10-151-201/+229 * Widget 'label-comments' gone in Contact editorMilan Crha2010-10-151-1/+0 * Bug #587011 - Integrate remove-duplicates into evolutionMilan Crha2010-10-154-0/+151 * Bug 632171 - "New Address Book" dialog accepts whitespace for nameMatthew Barnes2010-10-151-1/+8 * Bug 632127 - Composer is editable while sending messageMatthew Barnes2010-10-156-59/+121 * Added sl for Slovenian translationMatej Urbančič2010-10-151-1/+1 * Added Slovenian translationMatej Urbančič2010-10-151-0/+10246 * Updated Spanish translationJorge González2010-10-151-1188/+1187 * Update POTFILES.in.Matthew Barnes2010-10-141-1/+4 * Replace EBinding with GBinding.Matthew Barnes2010-10-1493-1437/+1332 * Remove an unused mail-config enum type.Matthew Barnes2010-10-141-7/+0 * Bug 305425 - Toolbar cancel button is always sensitiveMatthew Barnes2010-10-141-0/+6 * Bug 461769 - Add a --force-online command line optionMatthew Barnes2010-10-146-12/+75 * EAlertBar: Always show the most recent alert.Matthew Barnes2010-10-141-6/+2 * EShellBackend: Respond to EShell::prepare-for-quit signals.Matthew Barnes2010-10-145-8/+170 * Bug #630490 - Not visible calendar color change immediatelyMilan Crha2010-10-141-0/+6 * Bug #630375 - Character encoding of GPG encrypted message not honoredMilan Crha2010-10-133-2/+33 * Bug #617611 - redo_queries calls gtk+ functions in non-main threadMilan Crha2010-10-131-12/+55 * Updated Spanish translationJorge González2010-10-131-39/+13 * Remove unused mail_msg_wait().Matthew Barnes2010-10-132-29/+0 * Adjust EAlertBar text attributes.Matthew Barnes2010-10-131-2/+7 * Updated Spanish translationJorge González2010-10-131-20/+11 * Remove mail_tools_folder_to_url().Matthew Barnes2010-10-1311-84/+30 * Composer: Show cancellable operations and errors inline.Matthew Barnes2010-10-1333-1642/+4423 * Give MailSession a permanent home.Matthew Barnes2010-10-13107-2617/+4597 * Updated Spanish translationJorge González2010-10-121-101/+79 * Bug #619387 - EMailBrowser doesn't honour sorting of a mail windowMilan Crha2010-10-121-0/+23 * Minor fixes on Catalan translationGil Forcada2010-10-111-31/+2 * Updated Catalan translationDavid Planella2010-10-111-4506/+5467 * Updated Spanish translationJorge González2010-10-101-2106/+2309 * Day view print: Put day name in its boxCarlos Martín Nieto2010-10-091-2/+3 * Add a missing week number offsetCarlos Martín Nieto2010-10-091-1/+1 * [i18n] Updated German translationMario Blättermann2010-10-091-2457/+2480 * Bug #240302 - Print the work week viewCarlos Martín Nieto2010-10-081-0/+419 * Bug #223337 - Auto-close message-browser when replying to themMilan Crha2010-10-083-2/+92 * Bug #552121 - Drop UUENCODE inline filterMilan Crha2010-10-081-51/+1 * autogen.sh: remove unneded call to autopointJavier Jardón2010-10-081-6/+0 * MailFolderCache notifies in reverse orderMilan Crha2010-10-071-5/+4 * Bug #631341 - On This Computer/Inbox sub-folders lostMilan Crha2010-10-071-0/+7 * Bug #631588 - Sort by Subject doesn't workMilan Crha2010-10-071-1/+1 * Realli fix srcdir != builddir buildsJavier Jardón2010-10-071-1/+3 * Bug #631320 - GtkObject is gone in GTK3Milan Crha2010-10-07