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