do not allow batch deleting locked folders, only one

This commit is contained in:
tibbi 2019-07-02 20:52:17 +02:00
parent 505b925ed8
commit 6e01ea3386

View file

@ -487,7 +487,7 @@ class DirectoryAdapter(activity: BaseSimpleActivity, var dirs: ArrayList<Directo
}
activity.handleSAFDialog(SAFPath) {
val foldersToDelete = ArrayList<File>(selectedKeys.size)
var foldersToDelete = ArrayList<File>(selectedKeys.size)
selectedDirs.forEach {
if (it.areFavorites() || it.isRecycleBin()) {
if (it.isRecycleBin()) {
@ -507,7 +507,14 @@ class DirectoryAdapter(activity: BaseSimpleActivity, var dirs: ArrayList<Directo
}
}
listener?.deleteFolders(foldersToDelete)
if (foldersToDelete.size == 1) {
activity.handleLockedFolderOpening(foldersToDelete.first().absolutePath) {
listener?.deleteFolders(foldersToDelete)
}
} else {
foldersToDelete = foldersToDelete.filter { !activity.config.isFolderProtected(it.absolutePath) }.toMutableList() as ArrayList<File>
listener?.deleteFolders(foldersToDelete)
}
}
}