Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 99b44bd5 authored by cketti's avatar cketti
Browse files

Remove special account "All messages"

parent ff1bedf7
Loading
Loading
Loading
Loading
+0 −13
Original line number Diff line number Diff line
@@ -13,22 +13,9 @@ import com.fsck.k9.search.SearchSpecification.SearchField;
 * an account. This is a meta-account containing all the email that matches the search.
 */
public class SearchAccount implements BaseAccount {
    public static final String ALL_MESSAGES = "all_messages";
    public static final String UNIFIED_INBOX = "unified_inbox";


    // create the all messages search ( all accounts is default when none specified )
    public static SearchAccount createAllMessagesAccount() {
        CoreResourceProvider resourceProvider = DI.get(CoreResourceProvider.class);
        String name = resourceProvider.searchAllMessagesTitle();

        LocalSearch tmpSearch = new LocalSearch(name);
        tmpSearch.and(SearchField.SEARCHABLE, "1", Attribute.EQUALS);

        return new SearchAccount(ALL_MESSAGES, tmpSearch, name, resourceProvider.searchAllMessagesDetail());
    }


    // create the unified inbox meta account ( all accounts is default when none specified )
    public static SearchAccount createUnifiedInboxAccount() {
        CoreResourceProvider resourceProvider = DI.get(CoreResourceProvider.class);
+1 −3
Original line number Diff line number Diff line
@@ -105,7 +105,7 @@ class UnreadWidgetConfigurationActivity : K9PreferenceActivity() {
        selectedAccountUuid = accountUuid
        selectedFolder = null
        unreadFolder.summary = getString(R.string.unread_widget_folder_summary)
        if (SearchAccount.UNIFIED_INBOX == selectedAccountUuid || SearchAccount.ALL_MESSAGES == selectedAccountUuid) {
        if (SearchAccount.UNIFIED_INBOX == selectedAccountUuid) {
            handleSearchAccount()
        } else {
            handleRegularAccount()
@@ -115,8 +115,6 @@ class UnreadWidgetConfigurationActivity : K9PreferenceActivity() {
    private fun handleSearchAccount() {
        if (SearchAccount.UNIFIED_INBOX == selectedAccountUuid) {
            unreadAccount.setSummary(R.string.unread_widget_unified_inbox_account_summary)
        } else if (SearchAccount.ALL_MESSAGES == selectedAccountUuid) {
            unreadAccount.setSummary(R.string.unread_widget_all_messages_account_summary)
        }
        unreadFolderEnabled.isEnabled = false
        unreadFolderEnabled.isChecked = false
+1 −3
Original line number Diff line number Diff line
@@ -3,7 +3,6 @@ package com.fsck.k9.widget.unread
import android.content.Context
import android.content.Intent
import com.fsck.k9.Account
import com.fsck.k9.K9
import com.fsck.k9.Preferences
import com.fsck.k9.R
import com.fsck.k9.activity.FolderList
@@ -18,7 +17,7 @@ class UnreadWidgetDataProvider(
        private val messagingController: MessagingController
) {
    fun loadUnreadWidgetData(configuration: UnreadWidgetConfiguration): UnreadWidgetData? = with(configuration) {
        if (SearchAccount.UNIFIED_INBOX == accountUuid || SearchAccount.ALL_MESSAGES == accountUuid) {
        if (SearchAccount.UNIFIED_INBOX == accountUuid) {
            loadSearchAccountData(configuration)
        } else if (folderServerId != null) {
            loadFolderData(configuration)
@@ -41,7 +40,6 @@ class UnreadWidgetDataProvider(

    private fun getSearchAccount(accountUuid: String): SearchAccount = when (accountUuid) {
        SearchAccount.UNIFIED_INBOX -> SearchAccount.createUnifiedInboxAccount()
        SearchAccount.ALL_MESSAGES -> SearchAccount.createAllMessagesAccount()
        else -> throw AssertionError("SearchAccount expected")
    }

+0 −13
Original line number Diff line number Diff line
@@ -38,19 +38,6 @@ class UnreadWidgetDataProviderTest : AppRobolectricTest() {
        }
    }

    @Test
    fun allMessages() {
        val configuration = UnreadWidgetConfiguration(
                appWidgetId = 2, accountUuid = SearchAccount.ALL_MESSAGES, folderServerId = null)

        val widgetData = provider.loadUnreadWidgetData(configuration)

        with(widgetData!!) {
            assertThat(title).isEqualTo("All messages")
            assertThat(unreadCount).isEqualTo(SEARCH_ACCOUNT_UNREAD_COUNT)
        }
    }

    @Test
    fun regularAccount() {
        val configuration = UnreadWidgetConfiguration(
+0 −3
Original line number Diff line number Diff line
@@ -72,10 +72,7 @@ public abstract class AccountList extends K9ListActivity implements OnItemClickL

        if (displaySpecialAccounts() && !K9.isHideSpecialAccounts()) {
            BaseAccount unifiedInboxAccount = SearchAccount.createUnifiedInboxAccount();
            BaseAccount allMessagesAccount = SearchAccount.createAllMessagesAccount();

            accounts.add(unifiedInboxAccount);
            accounts.add(allMessagesAccount);
        }

        accounts.addAll(realAccounts);
Loading