Respect config when exporting events
This commit is contained in:
parent
635fa436c7
commit
01c8a4c977
|
@ -33,7 +33,7 @@ class ExportEventsDialog(
|
|||
export_tasks_checkbox_holder.setOnClickListener {
|
||||
export_tasks_checkbox.toggle()
|
||||
}
|
||||
export_past_events_checkbox.isChecked = config.exportPastEvents
|
||||
export_past_events_checkbox.isChecked = config.exportPastEntries
|
||||
export_past_events_checkbox_holder.setOnClickListener {
|
||||
export_past_events_checkbox.toggle()
|
||||
}
|
||||
|
@ -83,7 +83,7 @@ class ExportEventsDialog(
|
|||
lastExportPath = file.absolutePath.getParentPath()
|
||||
exportEvents = view.export_events_checkbox.isChecked
|
||||
exportTasks = view.export_tasks_checkbox.isChecked
|
||||
exportPastEvents = view.export_past_events_checkbox.isChecked
|
||||
exportPastEntries = view.export_past_events_checkbox.isChecked
|
||||
}
|
||||
|
||||
val eventTypes = (view.export_events_types_list.adapter as FilterEventTypeAdapter).getSelectedItemsList()
|
||||
|
|
|
@ -231,7 +231,7 @@ class Config(context: Context) : BaseConfig(context) {
|
|||
get() = prefs.getBoolean(EXPORT_TASKS, true)
|
||||
set(exportTasks) = prefs.edit().putBoolean(EXPORT_TASKS, exportTasks).apply()
|
||||
|
||||
var exportPastEvents: Boolean
|
||||
var exportPastEntries: Boolean
|
||||
get() = prefs.getBoolean(EXPORT_PAST_EVENTS, false)
|
||||
set(exportPastEvents) = prefs.edit().putBoolean(EXPORT_PAST_EVENTS, exportPastEvents).apply()
|
||||
|
||||
|
|
|
@ -523,13 +523,17 @@ class EventsHelper(val context: Context) {
|
|||
val currTS = getNowSeconds()
|
||||
var events = ArrayList<Event>()
|
||||
val tasks = ArrayList<Event>()
|
||||
if (config.exportPastEvents) {
|
||||
events.addAll(eventsDB.getAllEventsWithTypes(eventTypes))
|
||||
if (config.exportPastEntries) {
|
||||
if (config.exportEvents) {
|
||||
events.addAll(eventsDB.getAllEventsWithTypes(eventTypes))
|
||||
}
|
||||
if (config.exportTasks) {
|
||||
tasks.addAll(eventsDB.getAllTasksWithTypes(eventTypes))
|
||||
}
|
||||
} else {
|
||||
events.addAll(eventsDB.getAllFutureEventsWithTypes(currTS, eventTypes))
|
||||
if (config.exportEvents) {
|
||||
events.addAll(eventsDB.getAllFutureEventsWithTypes(currTS, eventTypes))
|
||||
}
|
||||
if (config.exportTasks) {
|
||||
tasks.addAll(eventsDB.getAllFutureTasksWithTypes(currTS, eventTypes))
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue