mirror of
https://github.com/Kunzisoft/KeePassDX.git
synced 2025-12-04 15:49:33 +01:00
fix: Remove the "merge, reload" wording in read only mode #1709
This commit is contained in:
@@ -43,6 +43,7 @@ class DatabaseChangedDialogFragment : DatabaseDialogFragment() {
|
||||
|
||||
val oldSnapFileDatabaseInfo: SnapFileDatabaseInfo? = arguments?.getParcelableCompat(OLD_FILE_DATABASE_INFO)
|
||||
val newSnapFileDatabaseInfo: SnapFileDatabaseInfo? = arguments?.getParcelableCompat(NEW_FILE_DATABASE_INFO)
|
||||
val readOnlyDatabase: Boolean = arguments?.getBoolean(READ_ONLY_DATABASE) ?: true
|
||||
|
||||
if (oldSnapFileDatabaseInfo != null && newSnapFileDatabaseInfo != null) {
|
||||
// Use the Builder class for convenient dialog construction
|
||||
@@ -54,7 +55,13 @@ class DatabaseChangedDialogFragment : DatabaseDialogFragment() {
|
||||
stringBuilder.append("\n\n" +oldSnapFileDatabaseInfo.toString(activity)
|
||||
+ "\n→\n" +
|
||||
newSnapFileDatabaseInfo.toString(activity) + "\n\n")
|
||||
stringBuilder.append(getString(R.string.warning_database_info_changed_options))
|
||||
stringBuilder.append(getString(
|
||||
if (readOnlyDatabase) {
|
||||
R.string.warning_database_info_changed_options_read_only
|
||||
} else {
|
||||
R.string.warning_database_info_changed_options
|
||||
}
|
||||
))
|
||||
} else {
|
||||
stringBuilder.append(getString(R.string.warning_database_revoked))
|
||||
}
|
||||
@@ -77,15 +84,18 @@ class DatabaseChangedDialogFragment : DatabaseDialogFragment() {
|
||||
const val DATABASE_CHANGED_DIALOG_TAG = "databaseChangedDialogFragment"
|
||||
private const val OLD_FILE_DATABASE_INFO = "OLD_FILE_DATABASE_INFO"
|
||||
private const val NEW_FILE_DATABASE_INFO = "NEW_FILE_DATABASE_INFO"
|
||||
private const val READ_ONLY_DATABASE = "READ_ONLY_DATABASE"
|
||||
|
||||
fun getInstance(oldSnapFileDatabaseInfo: SnapFileDatabaseInfo,
|
||||
newSnapFileDatabaseInfo: SnapFileDatabaseInfo
|
||||
newSnapFileDatabaseInfo: SnapFileDatabaseInfo,
|
||||
readOnly: Boolean
|
||||
)
|
||||
: DatabaseChangedDialogFragment {
|
||||
val fragment = DatabaseChangedDialogFragment()
|
||||
fragment.arguments = Bundle().apply {
|
||||
putParcelable(OLD_FILE_DATABASE_INFO, oldSnapFileDatabaseInfo)
|
||||
putParcelable(NEW_FILE_DATABASE_INFO, newSnapFileDatabaseInfo)
|
||||
putBoolean(READ_ONLY_DATABASE, readOnly)
|
||||
}
|
||||
return fragment
|
||||
}
|
||||
|
||||
@@ -182,8 +182,11 @@ class DatabaseTaskProvider(
|
||||
|
||||
private var databaseInfoListener = object:
|
||||
DatabaseTaskNotificationService.DatabaseInfoListener {
|
||||
override fun onDatabaseInfoChanged(previousDatabaseInfo: SnapFileDatabaseInfo,
|
||||
newDatabaseInfo: SnapFileDatabaseInfo) {
|
||||
override fun onDatabaseInfoChanged(
|
||||
previousDatabaseInfo: SnapFileDatabaseInfo,
|
||||
newDatabaseInfo: SnapFileDatabaseInfo,
|
||||
readOnlyDatabase: Boolean
|
||||
) {
|
||||
activity?.let { activity ->
|
||||
activity.lifecycleScope.launch {
|
||||
if (databaseChangedDialogFragment == null) {
|
||||
@@ -195,7 +198,8 @@ class DatabaseTaskProvider(
|
||||
if (progressTaskDialogFragment == null) {
|
||||
databaseChangedDialogFragment = DatabaseChangedDialogFragment.getInstance(
|
||||
previousDatabaseInfo,
|
||||
newDatabaseInfo
|
||||
newDatabaseInfo,
|
||||
readOnlyDatabase
|
||||
)
|
||||
databaseChangedDialogFragment?.actionDatabaseListener =
|
||||
mActionDatabaseListener
|
||||
|
||||
@@ -27,7 +27,6 @@ import android.os.Build
|
||||
import android.os.Bundle
|
||||
import android.os.IBinder
|
||||
import android.util.Log
|
||||
import android.widget.Toast
|
||||
import androidx.annotation.StringRes
|
||||
import androidx.media.app.NotificationCompat
|
||||
import com.kunzisoft.keepass.R
|
||||
@@ -162,6 +161,7 @@ open class DatabaseTaskNotificationService : LockNotificationService(), Progress
|
||||
fun onDatabaseInfoChanged(
|
||||
previousDatabaseInfo: SnapFileDatabaseInfo,
|
||||
newDatabaseInfo: SnapFileDatabaseInfo,
|
||||
readOnlyDatabase: Boolean
|
||||
)
|
||||
}
|
||||
|
||||
@@ -220,8 +220,11 @@ open class DatabaseTaskNotificationService : LockNotificationService(), Progress
|
||||
// Call listener to indicate a change in database info
|
||||
if (!mSaveState && previousDatabaseInfo != null) {
|
||||
mDatabaseInfoListeners.forEach { listener ->
|
||||
listener.onDatabaseInfoChanged(previousDatabaseInfo,
|
||||
lastFileDatabaseInfo)
|
||||
listener.onDatabaseInfoChanged(
|
||||
previousDatabaseInfo,
|
||||
lastFileDatabaseInfo,
|
||||
mDatabase?.isReadOnly ?: true
|
||||
)
|
||||
}
|
||||
}
|
||||
mSnapFileDatabaseInfo = lastFileDatabaseInfo
|
||||
|
||||
@@ -376,6 +376,7 @@
|
||||
<string name="warning_empty_keyfile_explanation">The content of the keyfile should never be changed, and in the best case, should contain randomly generated data.</string>
|
||||
<string name="warning_database_info_changed">The information contained in your database file has been modified outside the app.</string>
|
||||
<string name="warning_database_info_changed_options">Merge the data, overwrite the external modifications by saving the database or reload it with the latest changes.</string>
|
||||
<string name="warning_database_info_changed_options_read_only">Reload the database with the latest changes.</string>
|
||||
<string name="warning_database_info_reloaded">Reloading the database will delete the locally modified data.</string>
|
||||
<string name="warning_database_revoked">Access to the file revoked by the file manager, close the database and reopen it from its location.</string>
|
||||
<string name="warning_exact_alarm">You have not allowed the app to use an exact alarm. As a result, the features requiring a timer will not be done with an exact time.</string>
|
||||
|
||||
Reference in New Issue
Block a user