Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IMAPsearch #129

Closed
wants to merge 23 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
20 changes: 20 additions & 0 deletions res/values/arrays.xml
Expand Up @@ -662,5 +662,25 @@
<item>HTML</item>
<item>AUTO</item>
</string-array>
<string-array name="account_settings_remote_search_num_results_entries">
<item >@string/account_settings_remote_search_num_results_entries_10</item>
<item >@string/account_settings_remote_search_num_results_entries_25</item>
<item >@string/account_settings_remote_search_num_results_entries_50</item>
<item >@string/account_settings_remote_search_num_results_entries_100</item>
<item >@string/account_settings_remote_search_num_results_entries_250</item>
<item >@string/account_settings_remote_search_num_results_entries_500</item>
<item >@string/account_settings_remote_search_num_results_entries_1000</item>
<item >@string/account_settings_remote_search_num_results_entries_all</item>
</string-array>
<string-array name="account_settings_remote_search_num_results_values">
<item >10</item>
<item >25</item>
<item >50</item>
<item >100</item>
<item >250</item>
<item >500</item>
<item >1000</item>
<item >0</item>
</string-array>

</resources>
25 changes: 25 additions & 0 deletions res/values/strings.xml
Expand Up @@ -1131,4 +1131,29 @@ Welcome to K-9 Mail setup. K-9 is an open source mail client for Android origin
the import operation. Please install a file manager application from Android Market</string>
<string name="open_market">Open Market</string>
<string name="close">Close</string>
<string name="account_settings_allow_remote_search_label">Allow remote search</string>
<string name="account_settings_allow_remote_search_summary">Enable remote searching for this account</string>
<string name="account_settings_remote_search_num_results_entries_all">All</string>
<string name="account_settings_remote_search_num_results_entries_10">10</string>
<string name="account_settings_remote_search_num_results_entries_25">25</string>
<string name="account_settings_remote_search_num_results_entries_50">50</string>
<string name="account_settings_remote_search_num_results_entries_100">100</string>
<string name="account_settings_remote_search_num_results_entries_250">250</string>
<string name="account_settings_remote_search_num_results_entries_500">500</string>
<string name="account_settings_remote_search_num_results_entries_1000">1000</string>
<string name="account_settings_remote_search_num_label">Results limit</string>
<string name="search_mode_local_all">All Local Folders</string>
<string name="search_mode_remote">Remote Folder</string>
<string name="search_mode_title">Search Location</string>
<string name="account_settings_remote_search">Remote folder searching</string>
<string name="account_settings_remote_search_full_text_summary">Can be slow</string>
<string name="account_settings_remote_search_full_text">Include body text</string>
<string name="account_settings_allow_remote_search_help">
To perform a remote search, press your device\'s Search button while viewing a folder from this account.
\n\nNote: Remote search is NOT available from the Unified Inbox or from a list of folders.
</string>
<string name="remote_search_sending_query">Sending query to server</string>
<string name="no_show_again">Don\'t Show Again</string>
<string name="remote_search_downloading">Fetching %d results</string>
<string name="remote_search_downloading_limited">Fetching %1$d of %2$d results</string>
</resources>
27 changes: 26 additions & 1 deletion res/xml/account_settings_preferences.xml
Expand Up @@ -20,7 +20,9 @@
the preferences. See com.fsck.k9.preferences.Storage.
-->

<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android">
<PreferenceScreen
xmlns:android="http://schemas.android.com/apk/res/android"
android:key="main">

<PreferenceScreen
android:title="@string/account_settings_general_title"
Expand Down Expand Up @@ -438,6 +440,29 @@

</PreferenceScreen>

<PreferenceScreen android:title="@string/account_settings_remote_search" android:key="remote_search">
<CheckBoxPreference
android:key="account_allow_remote_search"
android:title="@string/account_settings_allow_remote_search_label"
android:persistent="false"/>

<ListPreference
android:entries="@array/account_settings_remote_search_num_results_entries"
android:entryValues="@array/account_settings_remote_search_num_results_values"
android:key="account_remote_search_num_results"
android:title="@string/account_settings_remote_search_num_label"
android:dialogTitle="@string/account_settings_remote_search_num_label"
android:dependency="account_allow_remote_search"/>

<CheckBoxPreference
android:key="account_remote_search_full_text"
android:title="@string/account_settings_remote_search_full_text"
android:summary="@string/account_settings_remote_search_full_text_summary"
android:persistent="false"
android:dependency="account_allow_remote_search"/>

</PreferenceScreen>

<PreferenceScreen
android:title="@string/account_settings_crypto"
android:key="crypto">
Expand Down
65 changes: 52 additions & 13 deletions src/com/fsck/k9/Account.java
@@ -1,6 +1,18 @@

package com.fsck.k9;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.Calendar;
import java.util.Collections;
import java.util.Date;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.Random;
import java.util.UUID;
import java.util.concurrent.ConcurrentHashMap;

import android.content.Context;
import android.content.SharedPreferences;
import android.net.ConnectivityManager;
Expand All @@ -18,19 +30,6 @@
import com.fsck.k9.mail.store.StorageManager.StorageProvider;
import com.fsck.k9.view.ColorChip;

import java.lang.reflect.Array;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Calendar;
import java.util.Collections;
import java.util.Date;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.Random;
import java.util.UUID;
import java.util.concurrent.ConcurrentHashMap;

/**
* Account stores all of the settings for a single account defined by the user. It is able to save
* and delete itself given a Preferences to work with. Each account is defined by a UUID.
Expand Down Expand Up @@ -68,6 +67,7 @@ public class Account implements BaseAccount {
public static final boolean DEFAULT_QUOTED_TEXT_SHOWN = true;
public static final boolean DEFAULT_REPLY_AFTER_QUOTE = false;
public static final boolean DEFAULT_STRIP_SIGNATURE = true;
public static final int DEFAULT_REMOTE_SEARCH_NUM_RESULTS = 25;

public static final String ACCOUNT_DESCRIPTION_KEY = "description";
public static final String STORE_URI_KEY = "storeUri";
Expand Down Expand Up @@ -149,6 +149,9 @@ public class Account implements BaseAccount {
private String mCryptoApp;
private boolean mCryptoAutoSignature;
private boolean mCryptoAutoEncrypt;
private boolean mAllowRemoteSearch;
private boolean mRemoteSearchFullText;
private int mRemoteSearchNumResults;

private CryptoProvider mCryptoProvider = null;

Expand Down Expand Up @@ -235,6 +238,9 @@ protected Account(Context context) {
mCryptoApp = Apg.NAME;
mCryptoAutoSignature = false;
mCryptoAutoEncrypt = false;
mAllowRemoteSearch = false;
mRemoteSearchFullText = false;
mRemoteSearchNumResults = DEFAULT_REMOTE_SEARCH_NUM_RESULTS;
mEnabled = true;

searchableFolders = Searchable.ALL;
Expand Down Expand Up @@ -390,6 +396,10 @@ private synchronized void loadAccount(Preferences preferences) {
mCryptoApp = prefs.getString(mUuid + ".cryptoApp", Apg.NAME);
mCryptoAutoSignature = prefs.getBoolean(mUuid + ".cryptoAutoSignature", false);
mCryptoAutoEncrypt = prefs.getBoolean(mUuid + ".cryptoAutoEncrypt", false);
mAllowRemoteSearch = prefs.getBoolean(mUuid + ".allowRemoteSearch", false);
mRemoteSearchFullText = prefs.getBoolean(mUuid + ".remoteSearchFullText", false);
mRemoteSearchNumResults = prefs.getInt(mUuid + ".remoteSearchNumResults", DEFAULT_REMOTE_SEARCH_NUM_RESULTS);

mEnabled = prefs.getBoolean(mUuid + ".enabled", true);
}

Expand Down Expand Up @@ -631,6 +641,9 @@ public synchronized void save(Preferences preferences) {
editor.putString(mUuid + ".cryptoApp", mCryptoApp);
editor.putBoolean(mUuid + ".cryptoAutoSignature", mCryptoAutoSignature);
editor.putBoolean(mUuid + ".cryptoAutoEncrypt", mCryptoAutoEncrypt);
editor.putBoolean(mUuid + ".allowRemoteSearch", mAllowRemoteSearch);
editor.putBoolean(mUuid + ".remoteSearchFullText", mRemoteSearchFullText);
editor.putInt(mUuid + ".remoteSearchNumResults", mRemoteSearchNumResults);
editor.putBoolean(mUuid + ".enabled", mEnabled);

editor.putBoolean(mUuid + ".vibrate", mNotificationSetting.shouldVibrate());
Expand Down Expand Up @@ -1446,6 +1459,22 @@ public void setCryptoAutoEncrypt(boolean cryptoAutoEncrypt) {
mCryptoAutoEncrypt = cryptoAutoEncrypt;
}

public boolean allowRemoteSearch() {
return mAllowRemoteSearch;
}

public void setAllowRemoteSearch(boolean val) {
mAllowRemoteSearch = val;
}

public int getRemoteSearchNumResults() {
return mRemoteSearchNumResults;
}

public void setRemoteSearchNumResults(int val) {
mRemoteSearchNumResults = (val >= 0 ? val : 0);
}

public String getInboxFolderName() {
return mInboxFolderName;
}
Expand Down Expand Up @@ -1500,4 +1529,14 @@ public synchronized boolean isEnabled() {
public synchronized void setEnabled(boolean enabled) {
mEnabled = enabled;
}

public boolean isRemoteSearchFullText() {
return mRemoteSearchFullText;
}

public void setRemoteSearchFullText(boolean val) {
mRemoteSearchFullText = val;
}


}
4 changes: 2 additions & 2 deletions src/com/fsck/k9/activity/MessageInfoHolder.java
Expand Up @@ -2,7 +2,7 @@

import java.util.Date;
import com.fsck.k9.helper.MessageHelper;
import com.fsck.k9.mail.store.LocalStore.LocalMessage;
import com.fsck.k9.mail.Message;

public class MessageInfoHolder {
public String date;
Expand All @@ -19,7 +19,7 @@ public class MessageInfoHolder {
public boolean downloaded;
public boolean partially_downloaded;
public boolean dirty;
public LocalMessage message;
public Message message;
public FolderInfoHolder folder;
public boolean selected;
public String account;
Expand Down