aboutsummaryrefslogtreecommitdiffstats
path: root/app/src
diff options
context:
space:
mode:
Diffstat (limited to 'app/src')
-rw-r--r--app/src/main/java/app/passwordstore/ui/setup/PgpKeysScreen.kt2
-rw-r--r--app/src/main/java/app/passwordstore/ui/setup/PgpKeysViewModel.kt8
-rw-r--r--app/src/main/res/values-it/strings.xml1
-rw-r--r--app/src/main/res/values/strings.xml1
4 files changed, 7 insertions, 5 deletions
diff --git a/app/src/main/java/app/passwordstore/ui/setup/PgpKeysScreen.kt b/app/src/main/java/app/passwordstore/ui/setup/PgpKeysScreen.kt
index 9ba96bbb..34e5bed6 100644
--- a/app/src/main/java/app/passwordstore/ui/setup/PgpKeysScreen.kt
+++ b/app/src/main/java/app/passwordstore/ui/setup/PgpKeysScreen.kt
@@ -261,7 +261,7 @@ fun PgpKeysDestination(
viewModel.busy = true
activity.lifecycleScope.launch {
try {
- val error = viewModel.createStore(root, row)
+ val error = viewModel.createStore(root, row, activity.getString(R.string.store_not_empty))
if (error != null) {
activity.snackbar(
message = activity.getString(R.string.store_create_failed, error),
diff --git a/app/src/main/java/app/passwordstore/ui/setup/PgpKeysViewModel.kt b/app/src/main/java/app/passwordstore/ui/setup/PgpKeysViewModel.kt
index afb65265..d270275f 100644
--- a/app/src/main/java/app/passwordstore/ui/setup/PgpKeysViewModel.kt
+++ b/app/src/main/java/app/passwordstore/ui/setup/PgpKeysViewModel.kt
@@ -208,13 +208,13 @@ constructor(
/**
* Creates the local store at [root] for [row]: a git repository and a `.gpg-id` naming the key by
- * its uppercase long key ID ([gpgIdText]). Returns null, or why it failed.
+ * its uppercase long key ID ([gpgIdText]). Returns null, or why it failed; [occupied] is the
+ * reason given when [root] already holds a store.
*/
- suspend fun createStore(root: File, row: KeyRow): String? =
+ suspend fun createStore(root: File, row: KeyRow, occupied: String): String? =
withContext(dispatcherProvider.io()) {
// A restored, already-cloned store must keep its .gpg-id.
- if (root.isDirectory && cloneTarget(root) == CloneTarget.Occupied)
- return@withContext "the folder is not empty"
+ if (root.isDirectory && cloneTarget(root) == CloneTarget.Occupied) return@withContext occupied
try {
check(root.isDirectory || root.mkdirs()) { "Could not create $root" }
PasswordRepository.createRepository(root)
diff --git a/app/src/main/res/values-it/strings.xml b/app/src/main/res/values-it/strings.xml
index 050623b7..72bcb009 100644
--- a/app/src/main/res/values-it/strings.xml
+++ b/app/src/main/res/values-it/strings.xml
@@ -378,6 +378,7 @@
<string name="pgp_key_needed_message">Importa la chiave privata per cui è cifrato questo archivio, così le sue voci si possono leggere e salvare.</string>
<string name="pgp_key_needed_recipients">Destinatari dell\'archivio</string>
<string name="store_create_failed">Impossibile creare l\'archivio: %1$s</string>
+ <string name="store_not_empty">la cartella contiene già un archivio</string>
<string name="git_clone_delete_failed">Impossibile svuotare la cartella dell\'archivio, la clonazione non è partita.</string>
<string name="pgp_key_import_too_large">Il file supera 1 MiB: non è una chiave PGP.</string>
<string name="pgp_key_import_downgrade">Una chiave privata con questo ID è già importata. La sola chiave pubblica non può sostituirla: elimina prima la chiave privata, se vuoi davvero farlo.</string>
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
index 055e0593..dc8069b8 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -413,6 +413,7 @@
<string name="pgp_key_needed_message">Import the private key this store is encrypted for, so its entries can be read and saved.</string>
<string name="pgp_key_needed_recipients">Store recipients</string>
<string name="store_create_failed">Could not create the store: %1$s</string>
+ <string name="store_not_empty">the folder already holds a store</string>
<string name="git_clone_delete_failed">Could not empty the store folder, so the clone did not start.</string>
<string name="pgp_key_import_too_large">The file is larger than 1 MiB: not a PGP key.</string>
<string name="pgp_key_import_downgrade">A private key with this ID is already imported. Its public key alone cannot replace it: delete the private key first if you really want to.</string>