Datebooks and Appointments
[Query Object Framework]


Detailed Description

A note on TIME:

The pilot-link QOF objects therefore expect UTC time from QOF and pass localtime to the pilot-link code.


Files

file  qof-datebook.c
 QOF datebook definitions for pilot-link.
file  qof-datebook.h
 QOF datebook definitions for pilot-link.

Data Structures

struct  QofDateBook

QOF object declaration

#define PILOT_LINK_QOF_DATEBOOK   "pilot_datebook"
#define QOF_DATEBOOK_DESC   "Pilot-link QOF datebook"
#define DATEBOOK_DESCRIPTION   "description"
#define DATEBOOK_DURATION   "duration_hours"

Defines

#define _GNU_SOURCE
#define DATEBOOK_VERSION   datebook_v1
#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"
#define DATEBOOK_KVP_PATH   "datebook/exceptions"
#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?

Functions

const gchar * repeatTypesasString (enum repeatTypes n)
void repeatTypesfromString (const gchar *str, enum repeatTypes *type)
const gchar * alarmTypesasString (enum alarmTypes n)
void alarmTypesfromString (const gchar *str, enum alarmTypes *type)
const gchar * DayOfMonthTypeasString (enum DayOfMonthType n)
void DayOfMonthTypefromString (const gchar *str, enum DayOfMonthType *type)
static QofDateBookdatebook_create (QofBook *book)
 Create a datebook object in QOF.
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)
static gint datebook_unpack (QofEntity *ent, gpointer user_data)
static gint datebook_pack (QofEntity *ent, gpointer user_data)
 pack the entity into a Palm datebook record
static gint datebook_appinfo_unpack (QofEntity *ent, gpointer user_data)
 unpack the application information.
static gint qof_datebook_free (QofEntity *ent, gpointer user_data)
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
static PQPack datebook_pack_def


Define Documentation

#define DATEBOOK_REPEAT_FOREVER   "repeat_forever"

Does the repeat have an end?

If set, any value in repeat-end is ignored.

Definition at line 55 of file qof-datebook.c.

Referenced by DateBookRegister().

#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 60 of file qof-datebook.h.

Referenced by DateBookRegister().

#define ENUM_MONTH_DAYQ (  ) 

Value:

_(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 117 of file qof-datebook.c.

#define ENUM_REPEAT_LIST (  ) 

Value:

_(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 99 of file qof-datebook.c.


Function Documentation

static gint datebook_appinfo_unpack ( QofEntity *  ent,
gpointer  user_data 
) [static]

unpack the application information.

The AppInfo contains the category list (each record only holds the index value of this list as the category value) and other preferences.

Definition at line 902 of file qof-datebook.c.

References PQContext_s::app_buf, PQContext_s::names, PQContext_s::pi_cat, and PQ_DEF_BUFSZ.

00903 {
00904     AppointmentAppInfo_t app_db;
00905     PQContext *context;
00906     gint name_count;
00907 
00908     context = (PQContext *) user_data;
00909     g_return_val_if_fail (context != NULL, -1);
00910     ENTER (" ");
00911     unpack_AppointmentAppInfo (&app_db, context->app_buf->data,
00912         PQ_DEF_BUFSZ);
00913     for (name_count = 0; name_count < 16; name_count++)
00914     {
00915         g_sprintf (context->names[name_count], "%s",
00916             app_db.category.name[name_count]);
00917     }
00918     context->pi_cat = &app_db.category;
00919     LEAVE (" ");
00920     return 0;
00921 }

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 141 of file qof-datebook.c.

References QofDateBook::inst, PILOT_LINK_QOF_DATEBOOK, QofDateBook::repeater, and QofDateBook::wrap.

Referenced by datebook_unpack().

00142 {
00143     Appointment_t *qd;
00144     QofDateBook *obj;
00145     QofCollection *coll;
00146     GList *all;
00147 
00148     obj = g_new0 (QofDateBook, 1);
00149     qof_instance_init (&obj->inst, PILOT_LINK_QOF_DATEBOOK, book);
00150     coll = qof_book_get_collection (book, PILOT_LINK_QOF_DATEBOOK);
00151     all = qof_collection_get_data (coll);
00152     all = g_list_prepend (all, obj);
00153     qof_collection_set_data (coll, all);
00154     qd = &obj->wrap;
00155     obj->repeater = FALSE;
00157     qd->exception = NULL;
00158     return obj;
00159 }

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 220 of file qof-datebook.c.

References alarmTypesasString(), datebook_getAlarm(), and QofDateBook::wrap.

Referenced by datebook_unpack(), and DateBookRegister().

00221 {
00222     Appointment_t *qd;
00223     gchar *unit;
00224 
00225     g_return_val_if_fail (d != NULL, NULL);
00226     qd = &d->wrap;
00227     if (datebook_getAlarm (d) == FALSE)
00228         return NULL;
00229     unit = g_strdup (alarmTypesasString (qd->advanceUnits));
00230     return unit;
00231 }

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 274 of file qof-datebook.c.

References QofDateBook::wrap.

Referenced by DateBookRegister().

00275 {
00276     Appointment_t *qd;
00277 
00278     g_return_val_if_fail (d != NULL, -1);
00279     qd = &d->wrap;
00280     return qd->repeatFrequency;
00281 }

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 521 of file qof-datebook.c.

References repeatTypesfromString(), and QofDateBook::wrap.

Referenced by datebook_unpack(), and DateBookRegister().

00522 {
00523     Appointment_t *qd;
00524     enum repeatTypes type;
00525 
00526     g_return_if_fail (d != NULL);
00527     qd = &d->wrap;
00528     repeatTypesfromString (type_label, &type);
00529     qd->repeatType = type;
00530 }

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 591 of file qof-datebook.c.

References QofDateBook::wrap.

Referenced by DateBookRegister().

00592 {
00593     gchar day[MAX_DATE_LENGTH];
00594     Appointment_t *qd;
00595     time_t local;
00596     struct tm *local_tm;
00597     gint i, diff;
00598     gboolean found;
00599 
00600     g_return_if_fail (d != NULL);
00601     qd = &d->wrap;
00602     diff = 0;
00603     found = FALSE;
00604     local = time (NULL);
00605     local_tm = localtime (&local);
00606     if (local_tm->tm_wday <= 7)
00607         diff = 1;
00608     else
00609         diff = -1;
00610     for (i = 0; i < 7; i++)
00611     {
00612         strftime (day, MAX_DATE_LENGTH, "%A", local_tm);
00613         if (0 == safe_strcmp (e, day))
00614         {
00615             found = TRUE;
00616             break;
00617         }
00618         local_tm->tm_mday += diff;
00619     }
00620     if (!found)
00621         i = 0;
00622     qd->repeatWeekstart = i;
00623 }

static gint datebook_unpack ( QofEntity *  ent,
gpointer  user_data 
) [static]

unpack the Palm datebook record into the entity.

Todo:
Problems with queries not finding repeat events.

Definition at line 670 of file qof-datebook.c.

References datebook_create(), datebook_getAdvance(), datebook_getAdvanceUnit(), datebook_getAlarm(), datebook_getBegin(), datebook_getCategory(), datebook_getDescription(), datebook_getEnd(), datebook_getEvent(), datebook_getNote(), datebook_getRepeatEnd(), DATEBOOK_KVP_PATH, datebook_setAdvance(), datebook_setAdvanceUnit(), datebook_setAlarm(), datebook_setBegin(), datebook_setCategory(), datebook_setDescription(), datebook_setEnd(), datebook_setEvent(), datebook_setExceptions(), datebook_setNote(), datebook_setRepeatEnd(), datebook_setRepeatForever(), datebook_setRepeatType(), DATEBOOK_VERSION, PQContext_s::ent_category, PQContext_s::names, PQContext_s::pi_buf, QofDateBook::repeater, repeatTypesasString(), and QofDateBook::wrap.

00671 {
00672     pi_buffer_t *pi_buf;
00673     Appointment_t *qa;
00674     QofDateBook *obj, *clone;
00675     QofInstance *inst;
00676     QofBook *book;
00677     KvpFrame *inst_frame;
00678     QofTime *qt, *qt_increment, *qt_end, *qt_repeat;
00679     PQContext *context;
00680     gint size, i, day_interval, month_interval;
00681 
00682     context = (PQContext *) user_data;
00683     day_interval = 0;
00684     month_interval = 0;
00685     g_return_val_if_fail (context != NULL, -1);
00686     g_return_val_if_fail (ent != NULL, -1);
00687     obj = (QofDateBook *) ent;
00688     inst = (QofInstance *) ent;
00689     inst_frame = qof_instance_get_slots (inst);
00690     qa = &obj->wrap;
00691     pi_buf = (pi_buffer_t *) context->pi_buf;
00692     size = 0;
00693     size = unpack_Appointment (qa, pi_buf, DATEBOOK_VERSION);   // 0.12
00694     datebook_setCategory (obj, context->names[context->ent_category]);
00695     /* Use <= and handle zero if < omits last entry (&623) */
00696     for (i = 0; i < qa->exceptions; i++)
00697     {
00698         gchar *extend;
00699 
00700         extend = NULL;
00701         DEBUG (" exceptions=%d", qa->exceptions);
00702         qt = qof_time_from_tm (&qa->exception[i], 0);
00703         extend = g_strdup_printf ("%s/%d", DATEBOOK_KVP_PATH, i + 1);
00704         kvp_frame_set_time (inst_frame, extend, qt);
00705         inst->kvp_data = inst_frame;
00706         g_free (extend);
00707     }
00708     if (qa->repeatType == repeatNone)
00709         qa->repeatEnd = qa->end;
00710     /* set a marker for the interval. Do the iteration once, outside the switch. */
00711     switch (qa->repeatType)
00712     {
00713     case repeatNone:
00714         {
00715             day_interval = 0;
00716             month_interval = 0;
00717             break;
00718         }
00719     case repeatDaily:
00720         {
00721             day_interval = 1;
00722             month_interval = 0;
00723             break;
00724         }
00725     case repeatWeekly:
00726         {
00727             day_interval = 7;
00728             month_interval = 0;
00729             break;
00730         }
00731     case repeatMonthlyByDay:
00732     case repeatMonthlyByDate:
00733         {
00734             day_interval = 0;
00735             month_interval = 1;
00736             break;
00737         }
00738     case repeatYearly:
00739         {
00740             day_interval = 0;
00741             month_interval = 12;
00742             break;
00743         }
00744     default:
00745         {
00746             PERR (" unsupported repeatType=%d", qa->repeatType);
00747         }
00748     }
00749     if (day_interval == 0 && month_interval == 0)
00750         return size;
00751     /* Now create a repeater in the SAME book. */
00752     qt = datebook_getBegin (obj);
00753     qt_end = datebook_getEnd (obj);
00754     if (qa->repeatForever == 0)
00755     {
00756         qt_repeat = datebook_getRepeatEnd (obj);
00757     }
00758     else
00759     {
00760         QofDate *qd;
00761         /*  if qa->repeatForever == 1 (true), calculate year and a day from
00762            start_time. qof_date_add_months(12)
00763            qof_date_add_days(1). Store for use as repeatEnd
00764          */
00765         DEBUG (" qa->repeatForever == 1");
00766         qt_repeat = qt;
00767         qd = qof_date_from_qtime (qt_repeat);
00768         qof_date_addmonths (qd, 12, FALSE);
00769         qof_date_adddays (qd, 1);
00770         qof_date_free (qd);
00771     }
00772     qt_increment = qt;
00773     /*  qa->exception is an array of struct tm* qa->exceptions long. */
00774     /* while datebook_getBegin is less (earlier) than repeat_end */
00775     while (qof_time_cmp (qt_increment, qt_repeat) < 0)
00776     {
00777         gboolean skip;
00778 
00779         skip = FALSE;
00780         if (day_interval)
00781         {
00782             QofDate *qd;
00783             qd = qof_date_from_qtime (qt_increment);
00784             qof_date_adddays (qd, day_interval);
00785             qt_increment = qof_date_to_qtime (qd);
00786             qof_date_free (qd);
00787             qd = qof_date_from_qtime (qt_end);
00788             qof_date_adddays (qd, day_interval);
00789             qt_end = qof_date_to_qtime (qd);
00790             qof_date_free (qd);
00791         }
00792         if (month_interval)
00793         {
00794             QofDate *qd;
00795             qd = qof_date_from_qtime (qt_increment);
00796             qof_date_addmonths (qd, month_interval, FALSE);
00797             qt_increment = qof_date_to_qtime (qd);
00798             qof_date_free (qd);
00799             qd = qof_date_from_qtime (qt_end);
00800             qof_date_addmonths (qd, month_interval, FALSE);
00801             qt_end = qof_date_to_qtime (qd);
00802             qof_date_free (qd);
00803         }
00804         for (i = 0; i < qa->exceptions; i++)
00805         {
00806             QofDate *qd;
00807 
00808             qd = qof_date_from_qtime(qt_increment);
00809             if ((qd->qd_year == qa->exception[i].tm_year) &&
00810                 (qd->qd_mday == qa->exception[i].tm_mday) &&
00811                 (qd->qd_mon == qa->exception[i].tm_mon))
00812             {
00813                 /* exclude */
00814                 skip = TRUE;
00815             }
00816         }
00817         /* create the repeater */
00818         if (!skip)
00819         {
00820             book = inst->book;
00821             clone = datebook_create (book);
00822             clone->repeater = TRUE;
00823             /* clone the main parts of the event */
00824             datebook_setEvent (clone, datebook_getEvent (obj));
00825             datebook_setAlarm (clone, datebook_getAlarm (obj));
00826             datebook_setAdvance (clone, datebook_getAdvance (obj));
00827             datebook_setAdvanceUnit (clone, datebook_getAdvanceUnit (obj));
00828             datebook_setDescription (clone, datebook_getDescription (obj));
00829             datebook_setNote (clone, datebook_getNote (obj));
00830             datebook_setCategory (clone, datebook_getCategory (obj));
00831             /* the clone does not repeat */
00832             datebook_setExceptions (clone, 0);
00833             datebook_setRepeatEnd (clone, qt_end);
00834             datebook_setRepeatForever (clone, FALSE);
00835             datebook_setRepeatType (clone,
00836                 repeatTypesasString (repeatNone));
00837             datebook_setBegin (clone, qt_increment);
00838             datebook_setEnd (clone, qt_end);
00839         }
00840     }
00841     return size;
00842 }

gboolean DateBookRegister ( void   ) 

Register the datebook with QOF

Definition at line 969 of file qof-datebook.c.

References DATEBOOK_ADV_UNIT, DATEBOOK_ADVANCE, DATEBOOK_ALARM, DATEBOOK_BEGIN, DATEBOOK_CATEGORY, datebook_check_repeater(), DATEBOOK_DESCRIPTION, DATEBOOK_DURATION, DATEBOOK_END, DATEBOOK_EVENT, DATEBOOK_EXCEPTION, DATEBOOK_EXCEPTIONS, datebook_getAdvance(), datebook_getAdvanceUnit(), datebook_getAlarm(), datebook_getBegin(), datebook_getCategory(), datebook_getDescription(), datebook_getDuration(), datebook_getEnd(), datebook_getEvent(), datebook_getExceptions(), datebook_getNote(), datebook_getRepeatDay(), datebook_getRepeatEnd(), datebook_getRepeatForever(), datebook_getRepeatFrequency(), datebook_getRepeatType(), datebook_getRepeatWeekStart(), DATEBOOK_NOTE, datebook_pack_def, DATEBOOK_REPEAT_DAY, DATEBOOK_REPEAT_END, DATEBOOK_REPEAT_FOREVER, DATEBOOK_REPEAT_FREQUENCY, DATEBOOK_REPEAT_TYPE, DATEBOOK_REPEAT_WEEK_START, DATEBOOK_REPEATER, datebook_set_repeater(), datebook_setAdvance(), datebook_setAdvanceUnit(), datebook_setAlarm(), datebook_setBegin(), datebook_setCategory(), datebook_setDescription(), datebook_setEnd(), datebook_setEvent(), datebook_setExceptions(), datebook_setNote(), datebook_setRepeatDay(), datebook_setRepeatEnd(), datebook_setRepeatForever(), datebook_setRepeatFrequency(), datebook_setRepeatType(), datebook_setRepeatWeekStart(), PILOT_LINK_QOF_DATEBOOK, and pilot_qof_pack_register().

Referenced by pilot_qof_init().

00970 {
00971     static QofParam params[] = {
00972         {DATEBOOK_EVENT, QOF_TYPE_BOOLEAN,
00973                 (QofAccessFunc) datebook_getEvent,
00974             (QofSetterFunc) datebook_setEvent},
00975         {DATEBOOK_BEGIN, QOF_TYPE_TIME, (QofAccessFunc) datebook_getBegin,
00976             (QofSetterFunc) datebook_setBegin},
00977         {DATEBOOK_END, QOF_TYPE_TIME, (QofAccessFunc) datebook_getEnd,
00978             (QofSetterFunc) datebook_setEnd},
00979         {DATEBOOK_ALARM, QOF_TYPE_BOOLEAN,
00980                 (QofAccessFunc) datebook_getAlarm,
00981             (QofSetterFunc) datebook_setAlarm},
00982         {DATEBOOK_ADVANCE, QOF_TYPE_INT32,
00983                 (QofAccessFunc) datebook_getAdvance,
00984             (QofSetterFunc) datebook_setAdvance},
00985         {DATEBOOK_ADV_UNIT, QOF_TYPE_STRING,
00986                 (QofAccessFunc) datebook_getAdvanceUnit,
00987             (QofSetterFunc) datebook_setAdvanceUnit},
00988         {DATEBOOK_REPEAT_TYPE, QOF_TYPE_STRING,
00989                 (QofAccessFunc) datebook_getRepeatType,
00990             (QofSetterFunc) datebook_setRepeatType},
00991         {DATEBOOK_REPEAT_FOREVER, QOF_TYPE_BOOLEAN,
00992                 (QofAccessFunc) datebook_getRepeatForever,
00993             (QofSetterFunc) datebook_setRepeatForever},
00994         {DATEBOOK_REPEAT_END, QOF_TYPE_TIME,
00995                 (QofAccessFunc) datebook_getRepeatEnd,
00996             (QofSetterFunc) datebook_setRepeatEnd},
00997         {DATEBOOK_REPEAT_FREQUENCY, QOF_TYPE_INT32,
00998                 (QofAccessFunc) datebook_getRepeatFrequency,
00999             (QofSetterFunc) datebook_setRepeatFrequency},
01000         {DATEBOOK_REPEAT_DAY, QOF_TYPE_STRING,
01001                 (QofAccessFunc) datebook_getRepeatDay,
01002             (QofSetterFunc) datebook_setRepeatDay},
01003         {DATEBOOK_REPEAT_WEEK_START, QOF_TYPE_STRING,
01004                 (QofAccessFunc) datebook_getRepeatWeekStart,
01005             (QofSetterFunc) datebook_setRepeatWeekStart},
01006         {DATEBOOK_EXCEPTIONS, QOF_TYPE_INT32,
01007                 (QofAccessFunc) datebook_getExceptions,
01008             (QofSetterFunc) datebook_setExceptions},
01009         {DATEBOOK_DESCRIPTION, QOF_TYPE_STRING,
01010                 (QofAccessFunc) datebook_getDescription,
01011             (QofSetterFunc) datebook_setDescription},
01012         {DATEBOOK_CATEGORY, QOF_TYPE_STRING,
01013                 (QofAccessFunc) datebook_getCategory,
01014             (QofSetterFunc) datebook_setCategory},
01015         {DATEBOOK_REPEATER, QOF_TYPE_BOOLEAN,
01016                 (QofAccessFunc) datebook_check_repeater,
01017             (QofSetterFunc) datebook_set_repeater},
01018         {DATEBOOK_NOTE, QOF_TYPE_STRING, (QofAccessFunc) datebook_getNote,
01019             (QofSetterFunc) datebook_setNote},
01020         {DATEBOOK_DURATION, QOF_TYPE_DOUBLE,
01021                 (QofAccessFunc) datebook_getDuration, NULL},
01022         {DATEBOOK_EXCEPTION, QOF_TYPE_KVP,
01023                 (QofAccessFunc) qof_instance_get_slots, NULL},
01024         {QOF_PARAM_BOOK, QOF_ID_BOOK,
01025                 (QofAccessFunc) qof_instance_get_book, NULL},
01026         {QOF_PARAM_GUID, QOF_TYPE_GUID,
01027                 (QofAccessFunc) qof_instance_get_guid, NULL},
01028         {NULL},
01029     };
01030 
01031     qof_class_register (PILOT_LINK_QOF_DATEBOOK, NULL, params);
01032 
01033     pilot_qof_pack_register (&datebook_pack_def);
01034 
01035     return qof_object_register (&datebook_object_def);
01036 }

static gint qof_datebook_free ( QofEntity *  ent,
gpointer  user_data 
) [static]

free all memory related to the datebook record.

Definition at line 925 of file qof-datebook.c.

References QofDateBook::wrap.

00926 {
00927     Appointment_t *qd;
00928     QofDateBook *obj;
00929 
00930     g_return_val_if_fail (ent != NULL, -1);
00931     ENTER (" ");
00932     obj = (QofDateBook *) ent;
00933     qd = &obj->wrap;
00934     free_Appointment (qd);
00935     LEAVE (" ");
00936     return 0;
00937 }


Variable Documentation

QofObject datebook_object_def [static]

Initial value:

 {
  interface_version: 3 ,
  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 945 of file qof-datebook.c.

PQPack datebook_pack_def [static]

Initial value:

 {
  e_type: "pilot_datebook" ,
  pack_func:datebook_pack,
  unpack_func:datebook_unpack,
  free_pack_func:qof_datebook_free,
  palm_db_name:"DatebookDB",
  app_info_unpack:datebook_appinfo_unpack,
}

Definition at line 959 of file qof-datebook.c.

Referenced by DateBookRegister().

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.

Note:
Current. QOF deals with the timezone issues but if you take your Palm to another country, be prepared for this value to be translated!
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 333 of file qof-datebook.c.


Generated on Tue Mar 6 00:08:10 2007 for pilot-qof by  doxygen 1.5.1