mirror of
https://github.com/Kunzisoft/KeePassDX.git
synced 2025-12-04 15:49:33 +01:00
Add default Recycle Bin name as string resource
This commit is contained in:
@@ -43,7 +43,7 @@ class DeleteEntryRunnable constructor(
|
||||
// Remove Entry from parent
|
||||
mCanRecycle = database.canRecycle(mEntryToDelete)
|
||||
if (mCanRecycle) {
|
||||
database.recycle(mEntryToDelete)
|
||||
database.recycle(mEntryToDelete, context.resources)
|
||||
} else {
|
||||
database.deleteEntry(mEntryToDelete)
|
||||
}
|
||||
|
||||
@@ -39,7 +39,7 @@ class DeleteGroupRunnable(context: FragmentActivity,
|
||||
// Remove Group from parent
|
||||
mRecycle = database.canRecycle(mGroupToDelete)
|
||||
if (mRecycle) {
|
||||
database.recycle(mGroupToDelete)
|
||||
database.recycle(mGroupToDelete, context.resources)
|
||||
} else {
|
||||
database.deleteGroup(mGroupToDelete)
|
||||
}
|
||||
|
||||
@@ -683,15 +683,15 @@ class Database {
|
||||
return canRecycle ?: false
|
||||
}
|
||||
|
||||
fun recycle(entry: EntryVersioned) {
|
||||
fun recycle(entry: EntryVersioned, resources: Resources) {
|
||||
entry.pwEntryV4?.let {
|
||||
pwDatabaseV4?.recycle(it)
|
||||
pwDatabaseV4?.recycle(it, resources)
|
||||
}
|
||||
}
|
||||
|
||||
fun recycle(group: GroupVersioned) {
|
||||
fun recycle(group: GroupVersioned, resources: Resources) {
|
||||
group.pwGroupV4?.let {
|
||||
pwDatabaseV4?.recycle(it)
|
||||
pwDatabaseV4?.recycle(it, resources)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -19,8 +19,10 @@
|
||||
*/
|
||||
package com.kunzisoft.keepass.database.element
|
||||
|
||||
import android.content.res.Resources
|
||||
import android.util.Log
|
||||
import biz.source_code.base64Coder.Base64Coder
|
||||
import com.kunzisoft.keepass.R
|
||||
import com.kunzisoft.keepass.crypto.CryptoUtil
|
||||
import com.kunzisoft.keepass.crypto.engine.AesEngine
|
||||
import com.kunzisoft.keepass.crypto.engine.CipherEngine
|
||||
@@ -315,21 +317,20 @@ class PwDatabaseV4 : PwDatabase<PwGroupV4, PwEntryV4>() {
|
||||
* Ensure that the recycle bin tree exists, if enabled and create it
|
||||
* if it doesn't exist
|
||||
*/
|
||||
private fun ensureRecycleBin() {
|
||||
private fun ensureRecycleBin(resources: Resources) {
|
||||
if (recycleBin == null) {
|
||||
// Create recycle bin
|
||||
createGroup().apply {
|
||||
title = RECYCLEBIN_NAME
|
||||
val recycleBinGroup = createGroup().apply {
|
||||
title = resources.getString(R.string.recycle_bin)
|
||||
icon = iconFactory.trashIcon
|
||||
enableAutoType = false
|
||||
enableSearching = false
|
||||
isExpanded = false
|
||||
|
||||
addGroupTo(this, rootGroup)
|
||||
recycleBinUUID = id
|
||||
lastModificationTime.date?.let {
|
||||
recycleBinChanged = it
|
||||
}
|
||||
}
|
||||
addGroupTo(recycleBinGroup, rootGroup)
|
||||
recycleBinUUID = recycleBinGroup.id
|
||||
recycleBinGroup.lastModificationTime.date?.let {
|
||||
recycleBinChanged = it
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -349,15 +350,15 @@ class PwDatabaseV4 : PwDatabase<PwGroupV4, PwEntryV4>() {
|
||||
return false
|
||||
}
|
||||
|
||||
fun recycle(group: PwGroupV4) {
|
||||
ensureRecycleBin()
|
||||
fun recycle(group: PwGroupV4, resources: Resources) {
|
||||
ensureRecycleBin(resources)
|
||||
removeGroupFrom(group, group.parent)
|
||||
addGroupTo(group, recycleBin)
|
||||
group.afterAssignNewParent()
|
||||
}
|
||||
|
||||
fun recycle(entry: PwEntryV4) {
|
||||
ensureRecycleBin()
|
||||
fun recycle(entry: PwEntryV4, resources: Resources) {
|
||||
ensureRecycleBin(resources)
|
||||
removeEntryFrom(entry, entry.parent)
|
||||
addEntryTo(entry, recycleBin)
|
||||
entry.afterAssignNewParent()
|
||||
@@ -416,7 +417,6 @@ class PwDatabaseV4 : PwDatabase<PwGroupV4, PwEntryV4>() {
|
||||
|
||||
private const val DEFAULT_HISTORY_MAX_ITEMS = 10 // -1 unlimited
|
||||
private const val DEFAULT_HISTORY_MAX_SIZE = (6 * 1024 * 1024).toLong() // -1 unlimited
|
||||
private const val RECYCLEBIN_NAME = "RecycleBin"
|
||||
|
||||
private const val RootElementName = "KeyFile"
|
||||
//private const val MetaElementName = "Meta";
|
||||
|
||||
@@ -278,7 +278,7 @@
|
||||
<string name="text_appearance">Text</string>
|
||||
<string name="application_appearance">App</string>
|
||||
<string name="other">Other</string>
|
||||
|
||||
<string name="recycle_bin">Recycle Bin</string>
|
||||
<string name="keyboard">Keyboard</string>
|
||||
<string name="magic_keyboard_title">Magikeyboard</string>
|
||||
<string name="magic_keyboard_summary">Activate a custom keyboard populating your passwords and all identity fields</string>
|
||||
|
||||
Reference in New Issue
Block a user