Ask confirmation to lock if changes without save #970

This commit is contained in:
J-Jamet
2022-04-07 18:06:47 +02:00
parent 3149f8745c
commit 2042c85b22
4 changed files with 19 additions and 3 deletions

View File

@@ -9,6 +9,7 @@ KeePassDX(3.4.0)
* Better search implementation #175 #1254
* Setting to change keyboard during a search #1267
* Manage package name from Magikeyboard #1010
* Ask confirmation to lock if changes without save #970
KeePassDX(3.3.3)
* Fix shared otpauth link if database not open #1274

View File

@@ -29,6 +29,7 @@ import android.view.View
import android.view.ViewGroup
import android.widget.Toast
import androidx.activity.viewModels
import androidx.appcompat.app.AlertDialog
import com.kunzisoft.keepass.R
import com.kunzisoft.keepass.activities.dialogs.DeleteNodesDialogFragment
import com.kunzisoft.keepass.activities.dialogs.PasswordEncodingDialogFragment
@@ -431,7 +432,19 @@ abstract class DatabaseLockActivity : DatabaseModeActivity(),
}
protected fun lockAndExit() {
sendBroadcast(Intent(LOCK_ACTION))
// Ask confirmation if modification not saved
if (mDatabase?.isReadOnly == false
&& mDatabase?.dataModifiedSinceLastLoading == true
&& !PreferencesUtil.isAutoSaveDatabaseEnabled(this)) {
AlertDialog.Builder(this)
.setMessage(R.string.discard_changes)
.setNegativeButton(android.R.string.cancel, null)
.setPositiveButton(R.string.lock) { _, _ ->
sendBroadcast(Intent(LOCK_ACTION))
}.create().show()
} else {
sendBroadcast(Intent(LOCK_ACTION))
}
}
fun resetAppTimeout() {

View File

@@ -8,3 +8,4 @@
* Better search implementation #175 #1254
* Setting to change keyboard during a search #1267
* Manage package name from Magikeyboard #1010
* Ask confirmation to lock if changes without save #970

View File

@@ -8,3 +8,4 @@
* Meilleure implémentation de la recherche #175 #1254
* Paramètre pour changer de clavier lors d'une recherche #1267
* Gestion du nom de package du Magiclavier #1010
* Demande de confirmation de verouiller si chanegement sans sauvegarde #970