File tree 1 file changed +17
-2
lines changed
app/src/main/kotlin/at/bitfire/davdroid/resource
1 file changed +17
-2
lines changed Original file line number Diff line number Diff line change @@ -9,6 +9,7 @@ import android.annotation.SuppressLint
9
9
import android.content.ContentValues
10
10
import android.content.Context
11
11
import android.net.Uri
12
+ import androidx.core.database.getIntOrNull
12
13
import at.bitfire.davdroid.Constants
13
14
import at.bitfire.davdroid.db.Collection
14
15
import at.bitfire.davdroid.db.SyncState
@@ -69,8 +70,22 @@ class LocalTaskList private constructor(
69
70
}
70
71
71
72
override var readOnly: Boolean
72
- get() = TODO (" Not yet implemented" )
73
- set(value) {}
73
+ get() = provider.client.query(
74
+ taskListSyncUri(), arrayOf(TaskListColumns .ACCESS_LEVEL ),
75
+ null , null , null
76
+ )?.use { cursor ->
77
+ if (cursor.moveToNext())
78
+ return cursor.getIntOrNull(0 ) == TaskListColumns .ACCESS_LEVEL_READ
79
+ else
80
+ false
81
+ } == true
82
+ set(readOnly) {
83
+ val values = ContentValues ().apply { put(
84
+ TaskListColumns .ACCESS_LEVEL ,
85
+ if (readOnly) TaskListColumns .ACCESS_LEVEL_READ else TaskListColumns .ACCESS_LEVEL_OWNER
86
+ )}
87
+ provider.client.update(taskListSyncUri(), values, null , null )
88
+ }
74
89
75
90
override val tag: String
76
91
get() = " tasks-${account.name} -$id "
You can’t perform that action at this time.
0 commit comments