From 6f064e1193e80743cfe3cc1cb7ee13cc46b75a86 Mon Sep 17 00:00:00 2001 From: Daniel Applebaum Date: Sat, 6 Feb 2010 05:55:40 +0000 Subject: [PATCH] Partial implementation for Issue 1059. Doesn't help those without physical keyboards, though, and should be modified to only re-setup pushers. Current implementation causes a wasteful reschedule of polling. Also gets the help Toast for the folder up-to-date after the FolderList/MessageList split. --- res/values/strings.xml | 9 ++++++- src/com/fsck/k9/activity/FolderList.java | 34 +++++++++++++++++++++++- 2 files changed, 41 insertions(+), 2 deletions(-) diff --git a/res/values/strings.xml b/res/values/strings.xml index 4832a6ebc..8710aaca4 100644 --- a/res/values/strings.xml +++ b/res/values/strings.xml @@ -594,7 +594,14 @@ Welcome to K-9 Mail setup. K-9 is an open source mail client for Android origin Del (or D) - Delete\u000AR - Reply\u000AA - Reply All\u000AC - Compose\u000AF - Forward\u000aM - Move\u000AY - Copy\u000AG - Star\u000AO - Sort type\u000AI - Sort order\u000AQ - - Return to Accounts\u000AS - Select/deselect + - Return to Folders\u000AS - Select/deselect + + 1 - Display only 1st Class folders\u000A + 2 - Display 1st and 2nd Class folders\u000A + 3 - Display all except 2nd Class folders\u000A + 4 - Display all folders\u000A + Q - Return to Accounts\u000A + S - Edit Account Settings Signature position Before quoted messages diff --git a/src/com/fsck/k9/activity/FolderList.java b/src/com/fsck/k9/activity/FolderList.java index f05918d0f..a921f4576 100644 --- a/src/com/fsck/k9/activity/FolderList.java +++ b/src/com/fsck/k9/activity/FolderList.java @@ -19,12 +19,14 @@ import android.widget.*; import android.widget.AdapterView.AdapterContextMenuInfo; import android.widget.AdapterView.OnItemClickListener; import com.fsck.k9.*; +import com.fsck.k9.Account.FolderMode; import com.fsck.k9.activity.setup.AccountSettings; import com.fsck.k9.activity.setup.FolderSettings; import com.fsck.k9.mail.Folder; import com.fsck.k9.mail.Message; import com.fsck.k9.mail.MessagingException; import com.fsck.k9.mail.Store; +import com.fsck.k9.service.MailService; import java.util.ArrayList; import java.util.Collections; @@ -368,16 +370,46 @@ public class FolderList extends K9ListActivity case KeyEvent.KEYCODE_H: { - Toast toast = Toast.makeText(this, R.string.message_list_help_key, Toast.LENGTH_LONG); + Toast toast = Toast.makeText(this, R.string.folder_list_help_key, Toast.LENGTH_LONG); toast.show(); return true; } + + case KeyEvent.KEYCODE_1: + { + setDisplayMode(FolderMode.FIRST_CLASS); + return true; + } + case KeyEvent.KEYCODE_2: + { + setDisplayMode(FolderMode.FIRST_AND_SECOND_CLASS); + return true; + } + case KeyEvent.KEYCODE_3: + { + setDisplayMode(FolderMode.NOT_SECOND_CLASS); + return true; + } + case KeyEvent.KEYCODE_4: + { + setDisplayMode(FolderMode.ALL); + return true; + } }//switch return super.onKeyDown(keyCode, event); }//onKeyDown + private void setDisplayMode(FolderMode newMode) + { + mAccount.setFolderDisplayMode(newMode); + mAccount.save(Preferences.getPreferences(this)); + MailService.actionReschedule(this, null); // TODO: really should just refresh pushers + onRefresh(false); + } + + private void onRefresh(final boolean forceRemote) {