internal delegate void DbChangedCallback(string uri, IntPtr userData);
[DllImport(Libraries.Calendar, EntryPoint = "calendar_db_insert_record")]
- internal static extern int Insert(IntPtr recordHandle, out int recordId);
+ internal static extern int Insert(IntPtr recordHandle, out int recordId);
[DllImport(Libraries.Calendar, EntryPoint = "calendar_db_get_record")]
- internal static extern int Get(string uri, int recordId, out IntPtr recordHandle);
+ internal static extern int Get(string uri, int recordId, out IntPtr recordHandle);
[DllImport(Libraries.Calendar, EntryPoint = "calendar_db_update_record")]
- internal static extern int Update(IntPtr recordHandle);
+ internal static extern int Update(IntPtr recordHandle);
[DllImport(Libraries.Calendar, EntryPoint = "calendar_db_delete_record")]
- internal static extern int Delete(string uri, int recordId);
+ internal static extern int Delete(string uri, int recordId);
[DllImport(Libraries.Calendar, EntryPoint = "calendar_db_get_all_records")]
- internal static extern int GetAllRecords(string uri, int offset, int limit, out IntPtr recordListHandle);
+ internal static extern int GetAllRecords(string uri, int offset, int limit, out IntPtr recordListHandle);
[DllImport(Libraries.Calendar, EntryPoint = "calendar_db_get_records_with_query")]
- internal static extern int GetRecords(IntPtr queryHandle, int offset, int limit, out IntPtr recordListHandle);
+ internal static extern int GetRecords(IntPtr queryHandle, int offset, int limit, out IntPtr recordListHandle);
[DllImport(Libraries.Calendar, EntryPoint = "calendar_db_get_count")]
- internal static extern int GetCount(string uri, out int count);
+ internal static extern int GetCount(string uri, out int count);
[DllImport(Libraries.Calendar, EntryPoint = "calendar_db_get_count_with_query")]
- internal static extern int GetCountWithQuery(IntPtr queryHandle, out int count);
+ internal static extern int GetCountWithQuery(IntPtr queryHandle, out int count);
[DllImport(Libraries.Calendar, EntryPoint = "calendar_db_insert_records")]
- internal static extern int InsertRecords(IntPtr recordListHandle, out IntPtr recordIds, out int count);
+ internal static extern int InsertRecords(IntPtr recordListHandle, out IntPtr recordIds, out int count);
[DllImport(Libraries.Calendar, EntryPoint = "calendar_db_update_records")]
- internal static extern int UpdateRecords(IntPtr recordListHandle);
+ internal static extern int UpdateRecords(IntPtr recordListHandle);
[DllImport(Libraries.Calendar, EntryPoint = "calendar_db_delete_records")]
- internal static extern int DeleteRecords(string uri, int[] ids, int count);
+ internal static extern int DeleteRecords(string uri, int[] ids, int count);
[DllImport(Libraries.Calendar, EntryPoint = "calendar_db_get_current_version")]
- internal static extern int GetCurrentVersion(out int version);
+ internal static extern int GetCurrentVersion(out int version);
[DllImport(Libraries.Calendar, EntryPoint = "calendar_db_add_changed_cb")]
- internal static extern int AddChangedCallback(string uri, DbChangedCallback callback, IntPtr userData);
+ internal static extern int AddChangedCallback(string uri, DbChangedCallback callback, IntPtr userData);
[DllImport(Libraries.Calendar, EntryPoint = "calendar_db_remove_changed_cb")]
- internal static extern int RemoveChangedCallback(string uri, DbChangedCallback callback, IntPtr userData);
+ internal static extern int RemoveChangedCallback(string uri, DbChangedCallback callback, IntPtr userData);
[DllImport(Libraries.Calendar, EntryPoint = "calendar_db_get_changes_by_version")]
- internal static extern int GetChangesByVersion(string uri, int bookId, int dbVersion, out IntPtr recordListHandle, out int currentDbVersion);
+ internal static extern int GetChangesByVersion(string uri, int bookId, int dbVersion, out IntPtr recordListHandle, out int currentDbVersion);
[DllImport(Libraries.Calendar, EntryPoint = "calendar_db_insert_vcalendars")]
- internal static extern int InsertVcalendars(string stream, out IntPtr recordIds, out int count);
+ internal static extern int InsertVcalendars(string stream, out IntPtr recordIds, out int count);
[DllImport(Libraries.Calendar, EntryPoint = "calendar_db_replace_vcalendars")]
- internal static extern int ReplaceVcalendars(string stream, int[] ids, int count);
+ internal static extern int ReplaceVcalendars(string stream, int[] ids, int count);
[DllImport(Libraries.Calendar, EntryPoint = "calendar_db_replace_record")]
- internal static extern int Replace(IntPtr recordHandle, int recordId);
+ internal static extern int Replace(IntPtr recordHandle, int recordId);
[DllImport(Libraries.Calendar, EntryPoint = "calendar_db_replace_records")]
- internal static extern int ReplaceRecords(IntPtr recordListHandle, int[] ids, int count);
+ internal static extern int ReplaceRecords(IntPtr recordListHandle, int[] ids, int count);
[DllImport(Libraries.Calendar, EntryPoint = "calendar_db_get_last_change_version")]
- internal static extern int GetLastChangeVersion(out int lastChangeVersion);
+ internal static extern int GetLastChangeVersion(out int lastChangeVersion);
[DllImport(Libraries.Calendar, EntryPoint = "calendar_db_get_changes_exception_by_version")]
- internal static extern int GetChangesException(string uri, int eventId, int dbVersion, out IntPtr recordListHandle);
+ internal static extern int GetChangesException(string uri, int eventId, int dbVersion, out IntPtr recordListHandle);
[DllImport(Libraries.Calendar, EntryPoint = "calendar_db_clean_after_sync")]
- internal static extern int Clean(int bookId, int dbVersion);
+ internal static extern int Clean(int bookId, int dbVersion);
+ [DllImport(Libraries.Calendar, EntryPoint = "calendar_db_link_record")]
+ internal static extern int LinkRecord(int baseId, int recordId);
+ [DllImport(Libraries.Calendar, EntryPoint = "calendar_db_unlink_record")]
+ internal static extern int UnlinkRecord(int recordId);
}
}
}
internal static partial class Filter
{
[DllImport(Libraries.Calendar, EntryPoint = "calendar_filter_create")]
- internal static extern int Create(string uri, out IntPtr filterHandle);
+ internal static extern int Create(string uri, out IntPtr filterHandle);
[DllImport(Libraries.Calendar, EntryPoint = "calendar_filter_destroy")]
- internal static extern int Destroy(IntPtr filterHandle);
+ internal static extern int Destroy(IntPtr filterHandle);
[DllImport(Libraries.Calendar, EntryPoint = "calendar_filter_add_str")]
- internal static extern int AddString(IntPtr filterHandle, uint propertyId, StringMatchType match, string value);
+ internal static extern int AddString(IntPtr filterHandle, uint propertyId, StringMatchType match, string value);
[DllImport(Libraries.Calendar, EntryPoint = "calendar_filter_add_int")]
- internal static extern int AddInteger(IntPtr filterHandle, uint propertyId, IntegerMatchType match, int value);
+ internal static extern int AddInteger(IntPtr filterHandle, uint propertyId, IntegerMatchType match, int value);
[DllImport(Libraries.Calendar, EntryPoint = "calendar_filter_add_double")]
- internal static extern int AddDouble(IntPtr filterHandle, uint propertyId, IntegerMatchType match, double value);
+ internal static extern int AddDouble(IntPtr filterHandle, uint propertyId, IntegerMatchType match, double value);
[DllImport(Libraries.Calendar, EntryPoint = "calendar_filter_add_lli")]
- internal static extern int AddLong(IntPtr filterHandle, uint propertyId, IntegerMatchType match, long value);
+ internal static extern int AddLong(IntPtr filterHandle, uint propertyId, IntegerMatchType match, long value);
[DllImport(Libraries.Calendar, EntryPoint = "calendar_filter_add_caltime")]
- internal static extern int AddCalendarTime(IntPtr filterHandle, uint propertyId, IntegerMatchType match, Interop.Calendar.Record.DateTime value);
+ internal static extern int AddCalendarTime(IntPtr filterHandle, uint propertyId, IntegerMatchType match, Interop.Calendar.Record.DateTime value);
[DllImport(Libraries.Calendar, EntryPoint = "calendar_filter_add_filter")]
- internal static extern int AddFilter(IntPtr parentFilterHandle, IntPtr childFilterHandle);
+ internal static extern int AddFilter(IntPtr parentFilterHandle, IntPtr childFilterHandle);
[DllImport(Libraries.Calendar, EntryPoint = "calendar_filter_add_operator")]
- internal static extern int AddOperator(IntPtr filterHandle, LogicalOperator type);
+ internal static extern int AddOperator(IntPtr filterHandle, LogicalOperator type);
}
}
}
internal static partial class List
{
[DllImport(Libraries.Calendar, EntryPoint = "calendar_list_create")]
- internal static extern int Create(out IntPtr listHandle);
+ internal static extern int Create(out IntPtr listHandle);
[DllImport(Libraries.Calendar, EntryPoint = "calendar_list_destroy")]
- internal static extern int Destroy(IntPtr listHandle, bool delete);
+ internal static extern int Destroy(IntPtr listHandle, bool delete);
[DllImport(Libraries.Calendar, EntryPoint = "calendar_list_get_count")]
- internal static extern int GetCount(IntPtr listHandle, out int count);
+ internal static extern int GetCount(IntPtr listHandle, out int count);
[DllImport(Libraries.Calendar, EntryPoint = "calendar_list_add")]
- internal static extern int Add(IntPtr listHandle, IntPtr recordHandle);
+ internal static extern int Add(IntPtr listHandle, IntPtr recordHandle);
[DllImport(Libraries.Calendar, EntryPoint = "calendar_list_remove")]
- internal static extern int Remove(IntPtr listHandle, IntPtr recordHandle);
+ internal static extern int Remove(IntPtr listHandle, IntPtr recordHandle);
[DllImport(Libraries.Calendar, EntryPoint = "calendar_list_get_current_record_p")]
- internal static extern int GetCurrentRecordP(IntPtr listHandle, out IntPtr recordHandle);
+ internal static extern int GetCurrentRecordP(IntPtr listHandle, out IntPtr recordHandle);
[DllImport(Libraries.Calendar, EntryPoint = "calendar_list_prev")]
- internal static extern int Prev(IntPtr listHandle);
+ internal static extern int Prev(IntPtr listHandle);
[DllImport(Libraries.Calendar, EntryPoint = "calendar_list_next")]
- internal static extern int Next(IntPtr listHandle);
+ internal static extern int Next(IntPtr listHandle);
[DllImport(Libraries.Calendar, EntryPoint = "calendar_list_first")]
- internal static extern int First(IntPtr listHandle);
+ internal static extern int First(IntPtr listHandle);
[DllImport(Libraries.Calendar, EntryPoint = "calendar_list_last")]
- internal static extern int Last(IntPtr listHandle);
+ internal static extern int Last(IntPtr listHandle);
}
}
}
internal static partial class Query
{
[DllImport(Libraries.Calendar, EntryPoint = "calendar_query_create")]
- internal static extern int Create(string uri, out IntPtr queryHandle);
+ internal static extern int Create(string uri, out IntPtr queryHandle);
[DllImport(Libraries.Calendar, EntryPoint = "calendar_query_destroy")]
- internal static extern int Destroy(IntPtr queryHandle);
+ internal static extern int Destroy(IntPtr queryHandle);
[DllImport(Libraries.Calendar, EntryPoint = "calendar_query_set_projection")]
- internal static extern int SetProjection(IntPtr queryHandle, uint[] propertyIdArray, int count);
+ internal static extern int SetProjection(IntPtr queryHandle, uint[] propertyIdArray, int count);
[DllImport(Libraries.Calendar, EntryPoint = "calendar_query_set_distinct")]
- internal static extern int SetDistinct(IntPtr queryHandle, bool set);
+ internal static extern int SetDistinct(IntPtr queryHandle, bool set);
[DllImport(Libraries.Calendar, EntryPoint = "calendar_query_set_filter")]
- internal static extern int SetFilter(IntPtr queryHandle, IntPtr filterHandle);
+ internal static extern int SetFilter(IntPtr queryHandle, IntPtr filterHandle);
[DllImport(Libraries.Calendar, EntryPoint = "calendar_query_set_sort")]
- internal static extern int SetSort(IntPtr queryHandle, uint propertyId, bool isAscending);
+ internal static extern int SetSort(IntPtr queryHandle, uint propertyId, bool isAscending);
}
}
}
internal delegate void ReminderAlertedCallback(string param, IntPtr userData);
[DllImport(Libraries.Calendar, EntryPoint = "calendar_reminder_add_cb")]
- internal static extern int Add(ReminderAlertedCallback callback, IntPtr userData);
-
+ internal static extern int Add(ReminderAlertedCallback callback, IntPtr userData);
[DllImport(Libraries.Calendar, EntryPoint = "calendar_db_remove_changed_cb")]
- internal static extern int Remove(ReminderAlertedCallback callback, IntPtr userData);
+ internal static extern int Remove(ReminderAlertedCallback callback, IntPtr userData);
}
}
}
internal static partial class Service
{
[DllImport(Libraries.Calendar, EntryPoint = "calendar_connect")]
- internal static extern int Connect();
+ internal static extern int Connect();
[DllImport(Libraries.Calendar, EntryPoint = "calendar_disconnect")]
- internal static extern int Disconnect();
+ internal static extern int Disconnect();
[DllImport(Libraries.Calendar, EntryPoint = "calendar_connect_on_thread")]
- internal static extern int ConnectOnThread();
+ internal static extern int ConnectOnThread();
[DllImport(Libraries.Calendar, EntryPoint = "calendar_disconnect_on_thread")]
- internal static extern int DisconnectOnThread();
+ internal static extern int DisconnectOnThread();
[DllImport(Libraries.Calendar, EntryPoint = "calendar_connect_with_flags")]
- internal static extern int ConnectWithFlags(uint flags);
+ internal static extern int ConnectWithFlags(uint flags);
}
}
}
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
internal delegate bool ParseCallback(IntPtr recordHandle, IntPtr userData);
[DllImport(Libraries.Calendar, EntryPoint = "calendar_vcalendar_make_from_records")]
- internal static extern int Compose(IntPtr listHandle, out string stream);
+ internal static extern int Compose(IntPtr listHandle, out string stream);
[DllImport(Libraries.Calendar, EntryPoint = "calendar_vcalendar_parse_to_calendar")]
- internal static extern int Parse(string stream, out IntPtr listHandle);
+ internal static extern int Parse(string stream, out IntPtr listHandle);
[DllImport(Libraries.Calendar, EntryPoint = "calendar_vcalendar_parse_to_calendar_foreach")]
- internal static extern int ParseForEach(string filePath, ParseCallback parseCb, IntPtr userData);
+ internal static extern int ParseForEach(string filePath, ParseCallback parseCb, IntPtr userData);
}
}
}
_callbackMap.Remove(viewUri);
_delegateMap.Remove(viewUri);
}
+
+ /// <summary>
+ /// Link a record to another record.
+ /// </summary>
+ /// <param name="baseId">The base record ID</param>
+ /// <param name="recordId">The record ID to link to</param>
+ public void LinkRecord(int baseId, int recordId)
+ {
+ Log.Debug(Globals.LogTag, "LinkRecord");
+ int error = Interop.Calendar.Database.LinkRecord(baseId, recordId);
+ if (CalendarError.None != (CalendarError)error)
+ {
+ Log.Error(Globals.LogTag, "LinkRecor Failed with error " + error);
+ throw CalendarErrorFactory.GetException(error);
+ }
+ }
+
+ /// <summary>
+ /// Unlink a record from base record.
+ /// </summary>
+ /// <param name="recordId">The record ID to unlink</param>
+ public void UnlinkRecord(int recordId)
+ {
+ Log.Debug(Globals.LogTag, "UnlinkRecord");
+ int error = Interop.Calendar.Database.UnlinkRecord(recordId);
+ if (CalendarError.None != (CalendarError)error)
+ {
+ Log.Error(Globals.LogTag, "UnlinkRecor Failed with error " + error);
+ throw CalendarErrorFactory.GetException(error);
+ }
+ }
}
}
EventException = (ViewEvent|DataTypeRecord) + 54,
EventExtended = (ViewEvent|DataTypeRecord) + 55,
EventIsAllday = (ViewEvent|DataTypeInteger|PropertyReadOnly) + 56,
+ EventLinkCount = (ViewEvent|DataTypeInteger|PropertyReadOnly) + 57,
+ EventLinkBaseId = (ViewEvent|DataTypeInteger|PropertyReadOnly) + 58,
/// Todo
TodoId = (ViewTodo|DataTypeInteger|PropertyReadOnly),
/// The event is an allday event or not
/// </summary>
public const uint IsAllday = (uint)PropertyIds.EventIsAllday;
+ /// <summary>
+ /// The linked event count
+ /// </summary>
+ public const uint LinkCount = (uint)PropertyIds.EventLinkCount;
+ /// <summary>
+ /// The event is an base linked event
+ /// </summary>
+ public const uint LinkBaseId = (uint)PropertyIds.EventLinkBaseId;
}
/// <summary>