diff --git a/CHANGELOG b/CHANGELOG index f42104ac4..eeb33ebb2 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -3,7 +3,7 @@ KeePassDX(2.9) * Save new credentials with Autofill #524 * Fix biometric issues #724 #740 #731 * Fix autofill #725 #551 - * Small fixes and translations #732 #736 #737 + * Small fixes and translations #732 #736 #737 #742 KeePassDX(2.8.7) * Downgrade to Android API 29 (crash on startup with API 30 on some devices) diff --git a/app/src/main/java/com/kunzisoft/keepass/activities/GroupActivity.kt b/app/src/main/java/com/kunzisoft/keepass/activities/GroupActivity.kt index cb6babc47..15e3b86f8 100644 --- a/app/src/main/java/com/kunzisoft/keepass/activities/GroupActivity.kt +++ b/app/src/main/java/com/kunzisoft/keepass/activities/GroupActivity.kt @@ -45,10 +45,7 @@ import androidx.coordinatorlayout.widget.CoordinatorLayout import androidx.fragment.app.FragmentManager import com.google.android.material.snackbar.Snackbar import com.kunzisoft.keepass.R -import com.kunzisoft.keepass.activities.dialogs.DeleteNodesDialogFragment -import com.kunzisoft.keepass.activities.dialogs.GroupEditDialogFragment -import com.kunzisoft.keepass.activities.dialogs.IconPickerDialogFragment -import com.kunzisoft.keepass.activities.dialogs.SortDialogFragment +import com.kunzisoft.keepass.activities.dialogs.* import com.kunzisoft.keepass.activities.helpers.EntrySelectionHelper import com.kunzisoft.keepass.activities.helpers.ReadOnlyHelper import com.kunzisoft.keepass.activities.helpers.SpecialMode @@ -754,7 +751,7 @@ class GroupActivity : LockingActivity(), return true } - override fun onDeleteMenuClick(nodes: List): Boolean { + private fun deleteNodes(nodes: List, recycleBin: Boolean = false): Boolean { val database = mDatabase // If recycle bin enabled, ensure it exists @@ -774,13 +771,22 @@ class GroupActivity : LockingActivity(), } // else open the dialog to confirm deletion else { - DeleteNodesDialogFragment.getInstance(nodes) - .show(supportFragmentManager, "deleteNodesDialogFragment") + val deleteNodesDialogFragment: DeleteNodesDialogFragment = + if (recycleBin) { + EmptyRecycleBinDialogFragment.getInstance(nodes) + } else { + DeleteNodesDialogFragment.getInstance(nodes) + } + deleteNodesDialogFragment.show(supportFragmentManager, "deleteNodesDialogFragment") } finishNodeAction() return true } + override fun onDeleteMenuClick(nodes: List): Boolean { + return deleteNodes(nodes) + } + override fun permanentlyDeleteNodes(nodes: List) { mProgressDatabaseTaskProvider?.startDatabaseDeleteNodes( nodes, @@ -957,7 +963,7 @@ class GroupActivity : LockingActivity(), R.id.menu_empty_recycle_bin -> { mCurrentGroup?.getChildren()?.let { listChildren -> // Automatically delete all elements - onDeleteMenuClick(listChildren) + deleteNodes(listChildren, true) } return true } diff --git a/app/src/main/java/com/kunzisoft/keepass/activities/dialogs/DeleteNodesDialogFragment.kt b/app/src/main/java/com/kunzisoft/keepass/activities/dialogs/DeleteNodesDialogFragment.kt index 23b424576..d2cf2a1a5 100644 --- a/app/src/main/java/com/kunzisoft/keepass/activities/dialogs/DeleteNodesDialogFragment.kt +++ b/app/src/main/java/com/kunzisoft/keepass/activities/dialogs/DeleteNodesDialogFragment.kt @@ -31,7 +31,7 @@ import com.kunzisoft.keepass.notifications.DatabaseTaskNotificationService import com.kunzisoft.keepass.notifications.DatabaseTaskNotificationService.Companion.getBundleFromListNodes import com.kunzisoft.keepass.notifications.DatabaseTaskNotificationService.Companion.getListNodesFromBundle -class DeleteNodesDialogFragment : DialogFragment() { +open class DeleteNodesDialogFragment : DialogFragment() { private var mNodesToDelete: List = ArrayList() private var mListener: DeleteNodeListener? = null @@ -51,6 +51,10 @@ class DeleteNodesDialogFragment : DialogFragment() { super.onDetach() } + protected open fun retrieveMessage(): String { + return getString(R.string.warning_permanently_delete_nodes) + } + override fun onCreateDialog(savedInstanceState: Bundle?): Dialog { arguments?.apply { @@ -68,7 +72,7 @@ class DeleteNodesDialogFragment : DialogFragment() { // Use the Builder class for convenient dialog construction val builder = AlertDialog.Builder(activity) - builder.setMessage(getString(R.string.warning_permanently_delete_nodes)) + builder.setMessage(retrieveMessage()) builder.setPositiveButton(android.R.string.ok) { _, _ -> mListener?.permanentlyDeleteNodes(mNodesToDelete) } diff --git a/app/src/main/java/com/kunzisoft/keepass/activities/dialogs/EmptyRecycleBinDialogFragment.kt b/app/src/main/java/com/kunzisoft/keepass/activities/dialogs/EmptyRecycleBinDialogFragment.kt new file mode 100644 index 000000000..bd5f945d3 --- /dev/null +++ b/app/src/main/java/com/kunzisoft/keepass/activities/dialogs/EmptyRecycleBinDialogFragment.kt @@ -0,0 +1,39 @@ +/* + * Copyright 2020 Jeremy Jamet / Kunzisoft. + * + * This file is part of KeePassDX. + * + * KeePassDX is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * KeePassDX is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with KeePassDX. If not, see . + * + */ +package com.kunzisoft.keepass.activities.dialogs + +import com.kunzisoft.keepass.R +import com.kunzisoft.keepass.database.element.node.Node +import com.kunzisoft.keepass.notifications.DatabaseTaskNotificationService.Companion.getBundleFromListNodes + +class EmptyRecycleBinDialogFragment : DeleteNodesDialogFragment() { + + override fun retrieveMessage(): String { + return getString(R.string.warning_empty_recycle_bin) + } + + companion object { + fun getInstance(nodesToDelete: List): EmptyRecycleBinDialogFragment { + return EmptyRecycleBinDialogFragment().apply { + arguments = getBundleFromListNodes(nodesToDelete) + } + } + } +} diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index fa6dc97e6..ab411c94b 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -260,6 +260,7 @@ Continue without password unlocking protection? Continue without encryption key? Permanently delete selected nodes? + Permanently delete all nodes from the recycle bin? A KeePass database is supposed to contain only small utility files (such as PGP key files).\n\nYour database may get very large and reduce performance with this upload. Uploading this file will replace the existing one. Add the file anyway? diff --git a/fastlane/metadata/android/en-US/changelogs/44.txt b/fastlane/metadata/android/en-US/changelogs/44.txt index dfd3626ef..eac35cad3 100644 --- a/fastlane/metadata/android/en-US/changelogs/44.txt +++ b/fastlane/metadata/android/en-US/changelogs/44.txt @@ -2,4 +2,4 @@ * Save new credentials with Autofill #524 * Fix biometric issues #724 #740 #731 * Fix autofill #725 #551 - * Small fixes and translations #732 #736 #737 \ No newline at end of file + * Small fixes and translations #732 #736 #737 #742 \ No newline at end of file diff --git a/fastlane/metadata/android/fr-FR/changelogs/44.txt b/fastlane/metadata/android/fr-FR/changelogs/44.txt index 28a575c04..5b729235e 100644 --- a/fastlane/metadata/android/fr-FR/changelogs/44.txt +++ b/fastlane/metadata/android/fr-FR/changelogs/44.txt @@ -2,4 +2,4 @@ * Sauvegarde de nouveaux identifiants avec le remplissage automatique #524 * Correction de problèmes biométriques #724 #740 #731 * Correction de l'autofill #725 #551 - * Petites corrections et traductions #732 #736 #737 \ No newline at end of file + * Petites corrections et traductions #732 #736 #737 #742 \ No newline at end of file