diff --git a/apidoc/Titanium/Calendar/Calendar.yml b/apidoc/Titanium/Calendar/Calendar.yml index 3f50396f095..bd13bd00dbc 100644 --- a/apidoc/Titanium/Calendar/Calendar.yml +++ b/apidoc/Titanium/Calendar/Calendar.yml @@ -607,6 +607,48 @@ properties: platforms: [iphone, ipad] since: "6.0.0" + - name: SOURCE_TYPE_LOCAL + summary: A local calendar source. + type: Number + permission: read-only + platforms: [iphone, ipad] + since: "6.1.0" + + - name: SOURCE_TYPE_EXCHANGE + summary: A microsoft exchange calendar source. + type: Number + permission: read-only + platforms: [iphone, ipad] + since: "6.1.0" + + - name: SOURCE_TYPE_CALDAV + summary: A calDev calendar source. + type: Number + permission: read-only + platforms: [iphone, ipad] + since: "6.1.0" + + - name: SOURCE_TYPE_MOBILEME + summary: A mobileMe calendar source. + type: Number + permission: read-only + platforms: [iphone, ipad] + since: "6.1.0" + + - name: SOURCE_TYPE_SUBSCRIBED + summary: A subscribed calendar source. + type: Number + permission: read-only + platforms: [iphone, ipad] + since: "6.1.0" + + - name: SOURCE_TYPE_BIRTHDAYS + summary: A birthday calendar source. + type: Number + permission: read-only + platforms: [iphone, ipad] + since: "6.1.0" + - name: eventsAuthorization summary: Returns an authorization constant indicating if the application has access to the events in the EventKit. description: | diff --git a/apidoc/Titanium/Calendar/CalendarProxy.yml b/apidoc/Titanium/Calendar/CalendarProxy.yml index ee5d19289e7..d087886bb17 100644 --- a/apidoc/Titanium/Calendar/CalendarProxy.yml +++ b/apidoc/Titanium/Calendar/CalendarProxy.yml @@ -113,3 +113,25 @@ properties: type: Boolean permission: read-only platforms: [android] + + - name: sourceTitle + summary: Displays the source title. + type: String + permission: read-only + since: "6.1.0" + platforms: [iphone, ipad] + + - name: sourceType + summary: Displays the source type. + type: Number + permission: read-only + since: "6.1.0" + constants: Titanium.Calendar.SOURCE_TYPE_* + platforms: [iphone, ipad] + + - name: sourceIdentifier + summary: Displays the source identifier. + type: String + permission: read-only + since: "6.1.0" + platforms: [iphone, ipad] diff --git a/iphone/Classes/CalendarModule.h b/iphone/Classes/CalendarModule.h index ce070f52327..aa74fc87e93 100644 --- a/iphone/Classes/CalendarModule.h +++ b/iphone/Classes/CalendarModule.h @@ -68,6 +68,12 @@ @property (nonatomic, readonly)NSNumber* ATTENDEE_TYPE_RESOURCE; @property (nonatomic, readonly)NSNumber* ATTENDEE_TYPE_GROUP; +@property (nonatomic, readonly)NSNumber* SOURCE_TYPE_LOCAL; +@property (nonatomic, readonly)NSNumber* SOURCE_TYPE_EXCHANGE; +@property (nonatomic, readonly)NSNumber* SOURCE_TYPE_CALDAV; +@property (nonatomic, readonly)NSNumber* SOURCE_TYPE_MOBILEME; +@property (nonatomic, readonly)NSNumber* SOURCE_TYPE_SUBSCRIBED; +@property (nonatomic, readonly)NSNumber* SOURCE_TYPE_BIRTHDAYS; @end diff --git a/iphone/Classes/CalendarModule.m b/iphone/Classes/CalendarModule.m index f57d615113d..30f12ba3c5b 100644 --- a/iphone/Classes/CalendarModule.m +++ b/iphone/Classes/CalendarModule.m @@ -348,6 +348,12 @@ -(NSNumber*) calendarAuthorization MAKE_SYSTEM_PROP(ATTENDEE_TYPE_RESOURCE, EKParticipantTypeResource); MAKE_SYSTEM_PROP(ATTENDEE_TYPE_GROUP, EKParticipantTypeGroup); +MAKE_SYSTEM_PROP(SOURCE_TYPE_LOCAL, EKSourceTypeLocal); +MAKE_SYSTEM_PROP(SOURCE_TYPE_EXCHANGE, EKSourceTypeExchange); +MAKE_SYSTEM_PROP(SOURCE_TYPE_CALDAV, EKSourceTypeCalDAV); +MAKE_SYSTEM_PROP(SOURCE_TYPE_MOBILEME, EKSourceTypeMobileMe); +MAKE_SYSTEM_PROP(SOURCE_TYPE_SUBSCRIBED, EKSourceTypeSubscribed); +MAKE_SYSTEM_PROP(SOURCE_TYPE_BIRTHDAYS, EKSourceTypeBirthdays); @end #endif diff --git a/iphone/Classes/TiCalendarCalendar.m b/iphone/Classes/TiCalendarCalendar.m index ebbcc542c67..55210caa43b 100644 --- a/iphone/Classes/TiCalendarCalendar.m +++ b/iphone/Classes/TiCalendarCalendar.m @@ -291,6 +291,35 @@ -(NSString*)name return [[self calendar] title]; } +-(NSString*)sourceTitle +{ + __block id result; + TiThreadPerformOnMainThread(^{ + result = [[[self calendar] source] title]; + },YES); + + return result; +} + +-(NSNumber*)sourceType +{ + __block id result; + TiThreadPerformOnMainThread(^{ + result = NUMINT([[[self calendar] source] sourceType]); + },YES); + + return result; +} + +-(NSString*)sourceIdentifier +{ + __block id result; + TiThreadPerformOnMainThread(^{ + result = [[[self calendar] source] sourceIdentifier]; + },YES); + + return result; +} @end