From c5c8b89f98144ec3d92e65de593c2d565d7d95af Mon Sep 17 00:00:00 2001 From: tibbi Date: Thu, 11 Jan 2018 16:26:08 +0100 Subject: [PATCH] store caldav calendar type too --- .../com/simplemobiletools/calendar/helpers/CalDAVHandler.kt | 4 +++- .../com/simplemobiletools/calendar/models/CalDAVCalendar.kt | 3 ++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/calendar/helpers/CalDAVHandler.kt b/app/src/main/kotlin/com/simplemobiletools/calendar/helpers/CalDAVHandler.kt index 0f5a66605..c7cbc03d2 100644 --- a/app/src/main/kotlin/com/simplemobiletools/calendar/helpers/CalDAVHandler.kt +++ b/app/src/main/kotlin/com/simplemobiletools/calendar/helpers/CalDAVHandler.kt @@ -49,6 +49,7 @@ class CalDAVHandler(val context: Context) { CalendarContract.Calendars._ID, CalendarContract.Calendars.CALENDAR_DISPLAY_NAME, CalendarContract.Calendars.ACCOUNT_NAME, + CalendarContract.Calendars.ACCOUNT_TYPE, CalendarContract.Calendars.OWNER_ACCOUNT, CalendarContract.Calendars.CALENDAR_COLOR, CalendarContract.Calendars.CALENDAR_ACCESS_LEVEL) @@ -62,10 +63,11 @@ class CalDAVHandler(val context: Context) { val id = cursor.getIntValue(CalendarContract.Calendars._ID) val displayName = cursor.getStringValue(CalendarContract.Calendars.CALENDAR_DISPLAY_NAME) val accountName = cursor.getStringValue(CalendarContract.Calendars.ACCOUNT_NAME) + val accountType = cursor.getStringValue(CalendarContract.Calendars.ACCOUNT_TYPE) val ownerName = cursor.getStringValue(CalendarContract.Calendars.OWNER_ACCOUNT) val color = cursor.getIntValue(CalendarContract.Calendars.CALENDAR_COLOR) val accessLevel = cursor.getIntValue(CalendarContract.Calendars.CALENDAR_ACCESS_LEVEL) - val calendar = CalDAVCalendar(id, displayName, accountName, ownerName, color, accessLevel) + val calendar = CalDAVCalendar(id, displayName, accountName, accountType, ownerName, color, accessLevel) calendars.add(calendar) } while (cursor.moveToNext()) } diff --git a/app/src/main/kotlin/com/simplemobiletools/calendar/models/CalDAVCalendar.kt b/app/src/main/kotlin/com/simplemobiletools/calendar/models/CalDAVCalendar.kt index f0258bb13..b1f13316a 100644 --- a/app/src/main/kotlin/com/simplemobiletools/calendar/models/CalDAVCalendar.kt +++ b/app/src/main/kotlin/com/simplemobiletools/calendar/models/CalDAVCalendar.kt @@ -1,6 +1,7 @@ package com.simplemobiletools.calendar.models -data class CalDAVCalendar(val id: Int, val displayName: String, val accountName: String, val ownerName: String, val color: Int, val accessLevel: Int) { +data class CalDAVCalendar(val id: Int, val displayName: String, val accountName: String, val accountType: String, val ownerName: String, + val color: Int, val accessLevel: Int) { fun canWrite() = accessLevel >= 500 fun getFullTitle() = "$displayName ($accountName)"