diff --git a/CHANGELOG b/CHANGELOG index 30d6f0192..2ce784f6c 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,5 +1,6 @@ KeePassDX(2.8) * Fix TOTP period (> 60s) + * Fix searching in recycle bin KeePassDX(2.7) * Add blocklists for autofill 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 fe54e8e47..be3f58e07 100644 --- a/app/src/main/java/com/kunzisoft/keepass/activities/GroupActivity.kt +++ b/app/src/main/java/com/kunzisoft/keepass/activities/GroupActivity.kt @@ -75,7 +75,10 @@ import com.kunzisoft.keepass.notifications.DatabaseTaskNotificationService.Compa import com.kunzisoft.keepass.settings.PreferencesUtil import com.kunzisoft.keepass.timeout.TimeoutHelper import com.kunzisoft.keepass.utils.MenuUtil -import com.kunzisoft.keepass.view.* +import com.kunzisoft.keepass.view.AddNodeButtonView +import com.kunzisoft.keepass.view.ToolbarAction +import com.kunzisoft.keepass.view.asError +import com.kunzisoft.keepass.view.showActionError class GroupActivity : LockingActivity(), GroupEditDialogFragment.EditGroupListener, @@ -389,7 +392,8 @@ class GroupActivity : LockingActivity(), // If it's a search if (Intent.ACTION_SEARCH == intent.action) { val searchString = intent.getStringExtra(SearchManager.QUERY)?.trim { it <= ' ' } ?: "" - return mDatabase?.createVirtualGroupFromSearch(searchString) + return mDatabase?.createVirtualGroupFromSearch(searchString, + PreferencesUtil.omitBackup(this)) } // else a real group else { diff --git a/app/src/main/java/com/kunzisoft/keepass/adapters/SearchEntryCursorAdapter.kt b/app/src/main/java/com/kunzisoft/keepass/adapters/SearchEntryCursorAdapter.kt index a79e1b928..e82111751 100644 --- a/app/src/main/java/com/kunzisoft/keepass/adapters/SearchEntryCursorAdapter.kt +++ b/app/src/main/java/com/kunzisoft/keepass/adapters/SearchEntryCursorAdapter.kt @@ -46,7 +46,8 @@ class SearchEntryCursorAdapter(private val context: Context, private val cursorInflater: LayoutInflater? = context.getSystemService( Context.LAYOUT_INFLATER_SERVICE) as LayoutInflater? - private var displayUsername: Boolean = false + private var mDisplayUsername: Boolean = false + private var mOmitBackup: Boolean = true private val iconColor: Int init { @@ -59,7 +60,8 @@ class SearchEntryCursorAdapter(private val context: Context, } fun reInit(context: Context) { - this.displayUsername = PreferencesUtil.showUsernamesListEntries(context) + this.mDisplayUsername = PreferencesUtil.showUsernamesListEntries(context) + this.mOmitBackup = PreferencesUtil.omitBackup(context) } override fun newView(context: Context, cursor: Cursor, parent: ViewGroup): View { @@ -93,7 +95,7 @@ class SearchEntryCursorAdapter(private val context: Context, // Assign subtitle viewHolder.textViewSubTitle?.apply { val entryUsername = currentEntry.username - text = if (displayUsername && entryUsername.isNotEmpty()) { + text = if (mDisplayUsername && entryUsername.isNotEmpty()) { String.format("(%s)", entryUsername) } else { "" @@ -129,7 +131,9 @@ class SearchEntryCursorAdapter(private val context: Context, if (database.type == DatabaseKDBX.TYPE) cursorKDBX = EntryCursorKDBX() - val searchGroup = database.createVirtualGroupFromSearch(query, SearchHelper.MAX_SEARCH_ENTRY) + val searchGroup = database.createVirtualGroupFromSearch(query, + mOmitBackup, + SearchHelper.MAX_SEARCH_ENTRY) if (searchGroup != null) { // Search in hide entries but not meta-stream for (entry in searchGroup.getFilteredChildEntries(Group.ChildFilter.getDefaults(context))) { diff --git a/app/src/main/java/com/kunzisoft/keepass/database/action/LoadDatabaseRunnable.kt b/app/src/main/java/com/kunzisoft/keepass/database/action/LoadDatabaseRunnable.kt index 9f1ab2475..1f68f59f2 100644 --- a/app/src/main/java/com/kunzisoft/keepass/database/action/LoadDatabaseRunnable.kt +++ b/app/src/main/java/com/kunzisoft/keepass/database/action/LoadDatabaseRunnable.kt @@ -39,7 +39,6 @@ class LoadDatabaseRunnable(private val context: Context, private val mKey: Uri?, private val mReadonly: Boolean, private val mCipherEntity: CipherDatabaseEntity?, - private val mOmitBackup: Boolean, private val mFixDuplicateUUID: Boolean, private val progressTaskUpdater: ProgressTaskUpdater?, private val mDuplicateUuidAction: ((Result) -> Unit)?) @@ -58,7 +57,6 @@ class LoadDatabaseRunnable(private val context: Context, mReadonly, context.contentResolver, cacheDirectory, - mOmitBackup, mFixDuplicateUUID, progressTaskUpdater) } diff --git a/app/src/main/java/com/kunzisoft/keepass/database/element/Database.kt b/app/src/main/java/com/kunzisoft/keepass/database/element/Database.kt index 70f32c332..1faba33e3 100644 --- a/app/src/main/java/com/kunzisoft/keepass/database/element/Database.kt +++ b/app/src/main/java/com/kunzisoft/keepass/database/element/Database.kt @@ -46,7 +46,6 @@ import com.kunzisoft.keepass.database.file.output.DatabaseOutputKDBX import com.kunzisoft.keepass.database.search.SearchHelper import com.kunzisoft.keepass.database.search.SearchParameters import com.kunzisoft.keepass.icons.IconDrawableFactory -import com.kunzisoft.keepass.model.SearchInfo import com.kunzisoft.keepass.stream.readBytes4ToUInt import com.kunzisoft.keepass.tasks.ProgressTaskUpdater import com.kunzisoft.keepass.utils.SingletonHolder @@ -316,7 +315,6 @@ class Database { readOnly: Boolean, contentResolver: ContentResolver, cacheDirectory: File, - omitBackup: Boolean, fixDuplicateUUID: Boolean, progressTaskUpdater: ProgressTaskUpdater?) { @@ -378,7 +376,7 @@ class Database { else -> throw SignatureDatabaseException() } - this.mSearchHelper = SearchHelper(omitBackup) + this.mSearchHelper = SearchHelper() loaded = true } catch (e: LoadDatabaseException) { @@ -393,20 +391,24 @@ class Database { } } - fun isGroupSearchable(group: Group, isOmitBackup: Boolean): Boolean { - return mDatabaseKDB?.isGroupSearchable(group.groupKDB, isOmitBackup) ?: - mDatabaseKDBX?.isGroupSearchable(group.groupKDBX, isOmitBackup) ?: + fun isGroupSearchable(group: Group, omitBackup: Boolean): Boolean { + return mDatabaseKDB?.isGroupSearchable(group.groupKDB, omitBackup) ?: + mDatabaseKDBX?.isGroupSearchable(group.groupKDBX, omitBackup) ?: false } fun createVirtualGroupFromSearch(searchQuery: String, + omitBackup: Boolean, max: Int = Integer.MAX_VALUE): Group? { - return mSearchHelper?.createVirtualGroupWithSearchResult(this, searchQuery, SearchParameters(), max) + return mSearchHelper?.createVirtualGroupWithSearchResult(this, + searchQuery, SearchParameters(), omitBackup, max) } fun createVirtualGroupFromSearchInfo(searchInfoString: String, + omitBackup: Boolean, max: Int = Integer.MAX_VALUE): Group? { - return mSearchHelper?.createVirtualGroupWithSearchResult(this, searchInfoString, SearchParameters().apply { + return mSearchHelper?.createVirtualGroupWithSearchResult(this, + searchInfoString, SearchParameters().apply { searchInTitles = false searchInUserNames = false searchInPasswords = false @@ -416,7 +418,7 @@ class Database { searchInUUIDs = false searchInTags = false ignoreCase = true - }, max) + }, omitBackup, max) } @Throws(DatabaseOutputException::class) diff --git a/app/src/main/java/com/kunzisoft/keepass/database/search/SearchHelper.kt b/app/src/main/java/com/kunzisoft/keepass/database/search/SearchHelper.kt index dc57f168f..1d89924f7 100644 --- a/app/src/main/java/com/kunzisoft/keepass/database/search/SearchHelper.kt +++ b/app/src/main/java/com/kunzisoft/keepass/database/search/SearchHelper.kt @@ -32,7 +32,7 @@ import com.kunzisoft.keepass.model.getSearchString import com.kunzisoft.keepass.settings.PreferencesUtil import com.kunzisoft.keepass.timeout.TimeoutHelper -class SearchHelper(private val isOmitBackup: Boolean) { +class SearchHelper { companion object { const val MAX_SEARCH_ENTRY = 6 @@ -54,6 +54,7 @@ class SearchHelper(private val isOmitBackup: Boolean) { // If search provide results database.createVirtualGroupFromSearchInfo( searchInfo.getSearchString(context), + PreferencesUtil.omitBackup(context), MAX_SEARCH_ENTRY )?.let { searchGroup -> if (searchGroup.getNumberOfChildEntries() > 0) { @@ -77,6 +78,7 @@ class SearchHelper(private val isOmitBackup: Boolean) { fun createVirtualGroupWithSearchResult(database: Database, searchQuery: String, searchParameters: SearchParameters, + omitBackup: Boolean, max: Int): Group? { val searchGroup = database.createGroup() @@ -101,7 +103,7 @@ class SearchHelper(private val isOmitBackup: Boolean) { override fun operate(node: Group): Boolean { return when { incrementEntry >= max -> false - database.isGroupSearchable(node, isOmitBackup) -> true + database.isGroupSearchable(node, omitBackup) -> true else -> false } } diff --git a/app/src/main/java/com/kunzisoft/keepass/notifications/DatabaseTaskNotificationService.kt b/app/src/main/java/com/kunzisoft/keepass/notifications/DatabaseTaskNotificationService.kt index 1db4fc8e4..219af8cc6 100644 --- a/app/src/main/java/com/kunzisoft/keepass/notifications/DatabaseTaskNotificationService.kt +++ b/app/src/main/java/com/kunzisoft/keepass/notifications/DatabaseTaskNotificationService.kt @@ -21,19 +21,23 @@ package com.kunzisoft.keepass.notifications import android.content.Intent import android.net.Uri -import android.os.* +import android.os.AsyncTask +import android.os.Binder +import android.os.Bundle +import android.os.IBinder import com.kunzisoft.keepass.R import com.kunzisoft.keepass.app.database.CipherDatabaseEntity import com.kunzisoft.keepass.database.action.* import com.kunzisoft.keepass.database.action.history.DeleteEntryHistoryDatabaseRunnable import com.kunzisoft.keepass.database.action.history.RestoreEntryHistoryDatabaseRunnable import com.kunzisoft.keepass.database.action.node.* -import com.kunzisoft.keepass.database.element.* +import com.kunzisoft.keepass.database.element.Database +import com.kunzisoft.keepass.database.element.Entry +import com.kunzisoft.keepass.database.element.Group import com.kunzisoft.keepass.database.element.database.CompressionAlgorithm import com.kunzisoft.keepass.database.element.node.Node import com.kunzisoft.keepass.database.element.node.NodeId import com.kunzisoft.keepass.database.element.node.Type -import com.kunzisoft.keepass.settings.PreferencesUtil import com.kunzisoft.keepass.tasks.ActionRunnable import com.kunzisoft.keepass.tasks.ProgressTaskUpdater import com.kunzisoft.keepass.utils.DATABASE_START_TASK_ACTION @@ -256,7 +260,6 @@ class DatabaseTaskNotificationService : NotificationService(), ProgressTaskUpdat keyFileUri, readOnly, cipherEntity, - PreferencesUtil.omitBackup(this), intent.getBooleanExtra(FIX_DUPLICATE_UUID_KEY, false), this ) { result -> diff --git a/fastlane/metadata/android/en-US/changelogs/36.txt b/fastlane/metadata/android/en-US/changelogs/36.txt index c3b2f345b..217c86600 100644 --- a/fastlane/metadata/android/en-US/changelogs/36.txt +++ b/fastlane/metadata/android/en-US/changelogs/36.txt @@ -1,2 +1,3 @@ * Fix TOTP period (> 60s) + * Fix searching in recycle bin diff --git a/fastlane/metadata/android/fr-FR/changelogs/36.txt b/fastlane/metadata/android/fr-FR/changelogs/36.txt index b46b3f02e..9b983eccd 100644 --- a/fastlane/metadata/android/fr-FR/changelogs/36.txt +++ b/fastlane/metadata/android/fr-FR/changelogs/36.txt @@ -1,2 +1,3 @@ * Correction de la période pour le TOTP (> 60s) + * Correction de la recherche dans la corbeille