Data Structures | |
struct | QofDateBook |
Files | |
file | qof-datebook.c |
QOF datebook definitions for pilot-link. | |
file | qof-datebook.h |
QOF datebook definitions for pilot-link. | |
Defines | |
#define | _GNU_SOURCE |
#define | ENUM_REPEAT_LIST(_) |
see QOF or alioth for information on this macro. | |
#define | ENUM_ALARM_UNIT(_) _(advMinutes,) _(advHours,) _(advDays,) |
Units to measure the digit entered in alarm_advance. | |
#define | ENUM_MONTH_DAYQ(_) |
#define | DATEBOOK_REPEATER "transient_repeat" |
Is this a transient repeat object? | |
#define | DATEBOOK_KVP_PATH "datebook/exceptions" |
#define | DATEBOOK_EVENT "untimed_event" |
#define | DATEBOOK_BEGIN "start_time" |
#define | DATEBOOK_END "end_time" |
#define | DATEBOOK_ALARM "use_alarm" |
#define | DATEBOOK_ADVANCE "alarm_advance" |
#define | DATEBOOK_ADV_UNIT "advance_unit" |
#define | DATEBOOK_REPEAT_TYPE "repeat_type" |
#define | DATEBOOK_REPEAT_FOREVER "repeat_forever" |
Does the repeat have an end? | |
#define | DATEBOOK_REPEAT_END "repeat_end" |
#define | DATEBOOK_REPEAT_FREQUENCY "repeat_frequency" |
#define | DATEBOOK_REPEAT_DAY "repeat_day" |
#define | DATEBOOK_REPEAT_WEEK_START "repeat_week_start" |
#define | DATEBOOK_EXCEPTIONS "exception_count" |
#define | DATEBOOK_EXCEPTION "exception_list" |
#define | DATEBOOK_NOTE "note" |
#define | DATEBOOK_CATEGORY "category" |
Functions | |
static QofDateBook * | datebook_create (QofBook *book) |
Create a datebook object in QOF. | |
Appointment_t * | datebook_get_pilot (QofInstance *inst) |
static gboolean | datebook_getEvent (QofDateBook *d) |
static QofTime * | datebook_getBegin (QofDateBook *d) |
static QofTime * | datebook_getEnd (QofDateBook *d) |
static gboolean | datebook_getAlarm (QofDateBook *d) |
static gint | datebook_getAdvance (QofDateBook *d) |
static const gchar * | datebook_getAdvanceUnit (QofDateBook *d) |
Uses ENUM_ALARM_UNIT to convert to a string. | |
static const gchar * | datebook_getRepeatType (QofDateBook *d) |
static gboolean | datebook_getRepeatForever (QofDateBook *d) |
static QofTime * | datebook_getRepeatEnd (QofDateBook *d) |
static gint | datebook_getRepeatFrequency (QofDateBook *d) |
How often to repeat. | |
static const gchar * | datebook_getRepeatDay (QofDateBook *d) |
static gchar * | datebook_getRepeatWeekStart (QofDateBook *d) |
static gint | datebook_getExceptions (QofDateBook *d) |
static gchar * | datebook_getDescription (QofDateBook *d) |
static gchar * | datebook_getNote (QofDateBook *d) |
static gchar * | datebook_getCategory (QofDateBook *d) |
static double | datebook_getDuration (QofDateBook *d) |
static gboolean | datebook_check_repeater (QofDateBook *d) |
static void | datebook_set_repeater (QofDateBook *d, gboolean e) |
static void | datebook_setEvent (QofDateBook *d, gboolean e) |
static void | datebook_setBegin (QofDateBook *d, QofTime *qt) |
static void | datebook_setEnd (QofDateBook *d, QofTime *qt) |
static void | datebook_setAlarm (QofDateBook *d, gboolean e) |
static void | datebook_setAdvance (QofDateBook *d, gint e) |
static void | datebook_setAdvanceUnit (QofDateBook *d, const gchar *e) |
static void | datebook_setRepeatType (QofDateBook *d, const gchar *type_label) |
Uses ENUM_REPEAT_LIST to convert to an enum value. | |
static void | datebook_setRepeatForever (QofDateBook *d, gboolean e) |
static void | datebook_setRepeatEnd (QofDateBook *d, QofTime *qt) |
static void | datebook_setRepeatFrequency (QofDateBook *d, gint e) |
static void | datebook_setRepeatDay (QofDateBook *d, const gchar *e) |
static void | datebook_setRepeatWeekStart (QofDateBook *d, gchar *e) |
Set the day to start the week from the locale name. | |
static void | datebook_setExceptions (QofDateBook *d, gint e) |
static void | datebook_setDescription (QofDateBook *d, gchar *h) |
static void | datebook_setNote (QofDateBook *d, gchar *h) |
static void | datebook_setCategory (QofDateBook *d, gchar *n) |
void | datebook_repeater_clone (QofEntity *ent, QofTime *qt_end, QofTime *qt_increment) |
static const gchar * | datebookPrintable (gpointer instance) |
gboolean | DateBookRegister (void) |
Variables | |
static QofLogModule | log_module = "pilotqof-objects" |
static QofDateFormat | df = 0 |
Get the locale name of the day to start the week. | |
static QofObject | datebook_object_def |
QOF object declaration | |
| |
#define | DATEBOOK_VERSION datebook_v1 |
#define | PILOT_LINK_QOF_DATEBOOK "pilot_datebook" |
#define | QOF_DATEBOOK_DESC "Pilot-link QOF datebook" |
#define | DATEBOOK_DESCRIPTION "description" |
#define | DATEBOOK_DURATION "duration_hours" |
A note on TIME:
The pilot-link QOF objects therefore expect UTC time from QOF and pass localtime to the pilot-link code.
#define DATEBOOK_REPEAT_FOREVER "repeat_forever" |
Does the repeat have an end?
If set, any value in repeat-end is ignored.
Definition at line 76 of file qof-datebook.h.
#define DATEBOOK_REPEATER "transient_repeat" |
Is this a transient repeat object?
To make it easier to query repeat appointments, transient events are created for each incidence of a repeat. This parameter allows such transient events to be ignored in certain queries.
Definition at line 62 of file qof-datebook.h.
#define ENUM_MONTH_DAYQ | ( | _ | ) |
_(dom1stSun,) _(dom1stMon,) _(dom1stTue,) _(dom1stWen,) _(dom1stThu,) \ _(dom1stFri,) _(dom1stSat,) _(dom2ndSun,) _(dom2ndMon,) _(dom2ndTue,) \ _(dom2ndWen,) _(dom2ndThu,) _(dom2ndFri,) _(dom2ndSat,) _(dom3rdSun,) \ _(dom3rdMon,) _(dom3rdTue,) _(dom3rdWen,) _(dom3rdThu,) _(dom3rdFri,) \ _(dom3rdSat,) _(dom4thSun,) _(dom4thMon,) _(dom4thTue,) _(dom4thWen,) \ _(dom4thThu,) _(dom4thFri,) _(dom4thSat,) \ _(domLastSun,) _(domLastMon,) _(domLastTue,) _(domLastWen,) \ _(domLastThu,) _(domLastFri,) _(domLastSat,)
Possible settings for repeats on certain days of each month. dom == day of month in each case.
Definition at line 93 of file qof-datebook.c.
#define ENUM_REPEAT_LIST | ( | _ | ) |
_(repeatNone,) \ _(repeatDaily,) \ _(repeatWeekly,) \ _(repeatMonthlyByDay,) \ _(repeatMonthlyByDate,) \ _(repeatYearly,)
see QOF or alioth for information on this macro.
To document enums generated using the macro, look at the doxygen.cfg file in this package, under "PREPROCESSOR".
Note the use of the NON_TYPEDEF versions of the macro here. enum values cannot be defined twice so if the original definition in libpisock is NOT a typedef, use the NON_TYPEDEF version of the macro.
http://qof.sourceforge.net/doxy/group__Utilities.html
http://alioth.debian.org/snippet/detail.php?type=snippet&id=13
Definition at line 75 of file qof-datebook.c.
static QofDateBook* datebook_create | ( | QofBook * | book | ) | [static] |
Create a datebook object in QOF.
Sets a default time for start and end as the current time. Creates a KVP frame ready for any exceptions which is an array of struct tm. The length of array = datebook_getExceptions()
let QofTime remain NULL
Definition at line 117 of file qof-datebook.c.
References QofDateBook::repeater.
{ Appointment_t *qd; QofDateBook *obj; QofCollection *coll; GList *all; obj = g_new0 (QofDateBook, 1); qof_instance_init (&obj->inst, PILOT_LINK_QOF_DATEBOOK, book); coll = qof_book_get_collection (book, PILOT_LINK_QOF_DATEBOOK); all = qof_collection_get_data (coll); all = g_list_prepend (all, obj); qof_collection_set_data (coll, all); qd = &obj->wrap; obj->repeater = FALSE; qd->exception = NULL; return obj; }
static const gchar* datebook_getAdvanceUnit | ( | QofDateBook * | d | ) | [static] |
Uses ENUM_ALARM_UNIT to convert to a string.
The enumerator values are converted to text for XML.
Definition at line 204 of file qof-datebook.c.
{ Appointment_t *qd; gchar *unit; g_return_val_if_fail (d != NULL, NULL); qd = &d->wrap; if (datebook_getAlarm (d) == FALSE) return NULL; unit = g_strdup (alarmTypesasString (qd->advanceUnits)); return unit; }
static gint datebook_getRepeatFrequency | ( | QofDateBook * | d | ) | [static] |
How often to repeat.
Actual frequency depends on the value of repeatType. 1 == every time that repeat type comes around. 2 == every other repeat.
Definition at line 258 of file qof-datebook.c.
{
Appointment_t *qd;
g_return_val_if_fail (d != NULL, -1);
qd = &d->wrap;
return qd->repeatFrequency;
}
static void datebook_setRepeatType | ( | QofDateBook * | d, | |
const gchar * | type_label | |||
) | [static] |
Uses ENUM_REPEAT_LIST to convert to an enum value.
The XML string is converted back to an enumerator value.
Definition at line 505 of file qof-datebook.c.
{
Appointment_t *qd;
enum repeatTypes type;
g_return_if_fail (d != NULL);
qd = &d->wrap;
repeatTypesfromString (type_label, &type);
qd->repeatType = type;
}
static void datebook_setRepeatWeekStart | ( | QofDateBook * | d, | |
gchar * | e | |||
) | [static] |
Set the day to start the week from the locale name.
If the value is not recognised, QOF sets a default of zero - which would start the week on Sunday.
However, this value is not synced to the Palm - it is XML only.
Definition at line 575 of file qof-datebook.c.
{ gchar day[MAX_DATE_LENGTH]; Appointment_t *qd; time_t local; struct tm *local_tm; gint i, diff; gboolean found; g_return_if_fail (d != NULL); qd = &d->wrap; diff = 0; found = FALSE; local = time (NULL); local_tm = localtime (&local); if (local_tm->tm_wday <= 7) diff = 1; else diff = -1; for (i = 0; i < 7; i++) { strftime (day, MAX_DATE_LENGTH, "%A", local_tm); if (0 == safe_strcmp (e, day)) { found = TRUE; break; } local_tm->tm_mday += diff; } if (!found) i = 0; qd->repeatWeekstart = i; }
gboolean DateBookRegister | ( | void | ) |
Register the datebook with QOF
QofObject datebook_object_def [static] |
{ interface_version:QOF_OBJECT_VERSION, e_type: "pilot_datebook" , type_label: "Pilot-link QOF datebook" , create:(gpointer) datebook_create, book_begin:NULL, book_end:NULL, is_dirty:qof_collection_is_dirty, mark_clean:qof_collection_mark_clean, foreach:qof_collection_foreach, printable:datebookPrintable, version_cmp:(gint (*)(gpointer, gpointer)) qof_instance_version_cmp, }
Definition at line 685 of file qof-datebook.c.
QofDateFormat df = 0 [static] |
Get the locale name of the day to start the week.
Calculate the current day of the week, compare with the integer set in the preferences and deduce the full weekday name according to the current locale.
This value is not used to set the preference in the Palm, so it does not need to be translated back. Setting the value in Datebooks and Appointments only affects any exported XML.
repeatWeekstart contains 0=sunday, 1=monday etc. QofDate->qd_wday also starts at 0=sunday. Say it's Tues 26th and weekstart is sunday qd_wday = 2, qd_mday = 26, repeatWeekstart = 0; if (qdate->qd_mday < qdate->qd_wday) qdate->qd_mday += 7; qdate->qd_mday -= qdate->qd_wday + repeatWeekstart; qd_mday = 26 - 2 + 0 = 24. Sunday 24th. in case it's near the start of the month, go to the next week. If it's Thursday 1st and weekstart is Monday: qd_wday = 4, qd_mday = 1. qd_mday = qd_mday + 7 = 8. (Thurs 8th) qd_mday = 8 - 4 + 1 = 5. (Mon 5th.)
Definition at line 317 of file qof-datebook.c.