mirror of
https://github.com/SimpleMobileTools/Simple-Calendar.git
synced 2025-06-05 21:59:17 +02:00
add a boolean to indicate if the created event should be added to caldav
This commit is contained in:
@@ -466,7 +466,7 @@ class EventActivity : SimpleActivity(), DBHelper.EventUpdateListener {
|
||||
|
||||
private fun storeEvent(wasRepeatable: Boolean) {
|
||||
if (mEvent.id == 0) {
|
||||
dbHelper.insert(mEvent) {
|
||||
dbHelper.insert(mEvent, true) {
|
||||
if (DateTime.now().isAfter(mEventStartDateTime.millis)) {
|
||||
toast(R.string.past_event_added)
|
||||
} else {
|
||||
@@ -486,7 +486,7 @@ class EventActivity : SimpleActivity(), DBHelper.EventUpdateListener {
|
||||
dbHelper.addEventRepeatException(mEvent.id, mEventOccurrenceTS)
|
||||
mEvent.parentId = mEvent.id
|
||||
mEvent.id = 0
|
||||
dbHelper.insert(mEvent) {
|
||||
dbHelper.insert(mEvent, true) {
|
||||
toast(R.string.event_updated)
|
||||
finish()
|
||||
}
|
||||
|
@@ -326,7 +326,7 @@ fun Context.fetchCalDAVCalendarEvents(calendarId: Long, eventTypeId: Int) {
|
||||
}
|
||||
}
|
||||
} else {
|
||||
dbHelper.insert(event) {
|
||||
dbHelper.insert(event, false) {
|
||||
importIdsMap.put(event.importId, event)
|
||||
}
|
||||
}
|
||||
|
@@ -175,7 +175,7 @@ class DBHelper private constructor(val context: Context) : SQLiteOpenHelper(cont
|
||||
addEventType(eventType, db)
|
||||
}
|
||||
|
||||
fun insert(event: Event, callback: (id: Int) -> Unit) {
|
||||
fun insert(event: Event, addToCalDAV: Boolean, callback: (id: Int) -> Unit) {
|
||||
if (event.startTS > event.endTS || event.title.trim().isEmpty()) {
|
||||
callback(0)
|
||||
return
|
||||
@@ -192,6 +192,11 @@ class DBHelper private constructor(val context: Context) : SQLiteOpenHelper(cont
|
||||
|
||||
context.updateWidgets()
|
||||
context.scheduleReminder(event, this)
|
||||
|
||||
if (addToCalDAV) {
|
||||
|
||||
}
|
||||
|
||||
callback(event.id)
|
||||
}
|
||||
|
||||
@@ -283,7 +288,7 @@ class DBHelper private constructor(val context: Context) : SQLiteOpenHelper(cont
|
||||
endTS = 0
|
||||
}
|
||||
|
||||
insert(childEvent) {
|
||||
insert(childEvent, false) {
|
||||
callback(ContentValues().apply {
|
||||
put(COL_PARENT_EVENT_ID, parentEventId)
|
||||
put(COL_OCCURRENCE_DAYCODE, Formatter.getDayCodeFromTS(occurrenceTS))
|
||||
|
@@ -105,7 +105,7 @@ class IcsImporter {
|
||||
event.endTS -= DAY
|
||||
}
|
||||
|
||||
context.dbHelper.insert(event) {
|
||||
context.dbHelper.insert(event, true) {
|
||||
for (exceptionTS in curRepeatExceptions) {
|
||||
context.dbHelper.addEventRepeatException(it, exceptionTS)
|
||||
}
|
||||
|
Reference in New Issue
Block a user