Merge pull request #1399 from evilthiesje/master

Rename CATEGORY_COLOR field in ics-export (fix #1396)
This commit is contained in:
Tibor Kaputa 2021-07-05 23:02:46 +02:00 committed by GitHub
commit e3b1a2c45f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 1 deletions

View File

@ -125,7 +125,8 @@ const val RECURRENCE_ID = "RECURRENCE-ID"
const val SEQUENCE = "SEQUENCE" const val SEQUENCE = "SEQUENCE"
// this tag isn't a standard ICS tag, but there's no official way of adding a category color in an ics file // this tag isn't a standard ICS tag, but there's no official way of adding a category color in an ics file
const val CATEGORY_COLOR = "CATEGORY_COLOR:" const val CATEGORY_COLOR = "X-SMT-CATEGORY-COLOR:"
const val CATEGORY_COLOR_LEGACY = "CATEGORY_COLOR:"
const val DISPLAY = "DISPLAY" const val DISPLAY = "DISPLAY"
const val EMAIL = "EMAIL" const val EMAIL = "EMAIL"

View File

@ -118,6 +118,11 @@ class IcsImporter(val activity: SimpleActivity) {
if (!value.startsWith("-")) { if (!value.startsWith("-")) {
curReminderTriggerMinutes *= -1 curReminderTriggerMinutes *= -1
} }
} else if (line.startsWith(CATEGORY_COLOR_LEGACY)) {
val color = line.substring(CATEGORY_COLOR_LEGACY.length)
if (color.trimStart('-').areDigitsOnly()) {
curCategoryColor = Integer.parseInt(color)
}
} else if (line.startsWith(CATEGORY_COLOR)) { } else if (line.startsWith(CATEGORY_COLOR)) {
val color = line.substring(CATEGORY_COLOR.length) val color = line.substring(CATEGORY_COLOR.length)
if (color.trimStart('-').areDigitsOnly()) { if (color.trimStart('-').areDigitsOnly()) {