store caldav calendar type too

This commit is contained in:
tibbi 2018-01-11 16:26:08 +01:00
parent f5e85c4a50
commit c5c8b89f98
2 changed files with 5 additions and 2 deletions

View File

@ -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())
}

View File

@ -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)"