1
0
mirror of https://github.com/moparisthebest/k-9 synced 2024-12-25 00:58:50 -05:00

find src/com/fsck/ -name \*.java|xargs astyle --style=ansi --mode=java --indent-switches --indent=spaces=4 --convert-tabs --unpad=paren

This commit is contained in:
Jesse Vincent 2010-04-29 04:59:14 +00:00
parent 2775795abe
commit 8af7f4a7b6
48 changed files with 579 additions and 513 deletions

View File

@ -17,7 +17,7 @@ import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Random; import java.util.Random;
import java.util.UUID; import java.util.UUID;
import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentHashMap;
@ -35,13 +35,13 @@ public class Account implements BaseAccount
public static final int DELETE_POLICY_7DAYS = 1; public static final int DELETE_POLICY_7DAYS = 1;
public static final int DELETE_POLICY_ON_DELETE = 2; public static final int DELETE_POLICY_ON_DELETE = 2;
public static final int DELETE_POLICY_MARK_AS_READ = 3; public static final int DELETE_POLICY_MARK_AS_READ = 3;
public static final String TYPE_WIFI = "WIFI"; public static final String TYPE_WIFI = "WIFI";
public static final String TYPE_MOBILE = "MOBILE"; public static final String TYPE_MOBILE = "MOBILE";
public static final String TYPE_OTHER = "OTHER"; public static final String TYPE_OTHER = "OTHER";
private static String[] networkTypes = { TYPE_WIFI, TYPE_MOBILE, TYPE_OTHER }; private static String[] networkTypes = { TYPE_WIFI, TYPE_MOBILE, TYPE_OTHER };
/** /**
* <pre> * <pre>
* 0 - Never (DELETE_POLICY_NEVER) * 0 - Never (DELETE_POLICY_NEVER)
@ -60,7 +60,7 @@ public class Account implements BaseAccount
private String mAlwaysBcc; private String mAlwaysBcc;
private int mAutomaticCheckIntervalMinutes; private int mAutomaticCheckIntervalMinutes;
private int mDisplayCount; private int mDisplayCount;
private int mChipColor; private int mChipColor;
private long mLastAutomaticCheckTime; private long mLastAutomaticCheckTime;
private boolean mNotifyNewMail; private boolean mNotifyNewMail;
private boolean mNotifySelfNewMail; private boolean mNotifySelfNewMail;
@ -82,7 +82,7 @@ public class Account implements BaseAccount
private boolean mIsSignatureBeforeQuotedText; private boolean mIsSignatureBeforeQuotedText;
private String mExpungePolicy = EXPUNGE_IMMEDIATELY; private String mExpungePolicy = EXPUNGE_IMMEDIATELY;
private int mMaxPushFolders; private int mMaxPushFolders;
private Map<String, Boolean> compressionMap = new ConcurrentHashMap<String, Boolean>(); private Map<String, Boolean> compressionMap = new ConcurrentHashMap<String, Boolean>();
private Searchable searchableFolders; private Searchable searchableFolders;
// Tracks if we have sent a notification for this account for // Tracks if we have sent a notification for this account for
// current set of fetched messages // current set of fetched messages
@ -98,9 +98,9 @@ public class Account implements BaseAccount
public enum HideButtons public enum HideButtons
{ {
NEVER, ALWAYS, KEYBOARD_AVAILABLE; NEVER, ALWAYS, KEYBOARD_AVAILABLE;
} }
public enum Searchable public enum Searchable
{ {
ALL, DISPLAYABLE, NONE ALL, DISPLAYABLE, NONE
} }
@ -128,10 +128,10 @@ public class Account implements BaseAccount
mExpungePolicy = EXPUNGE_IMMEDIATELY; mExpungePolicy = EXPUNGE_IMMEDIATELY;
mAutoExpandFolderName = "INBOX"; mAutoExpandFolderName = "INBOX";
mMaxPushFolders = 10; mMaxPushFolders = 10;
mChipColor = 0; mChipColor = 0;
searchableFolders = Searchable.ALL; searchableFolders = Searchable.ALL;
identities = new ArrayList<Identity>(); identities = new ArrayList<Identity>();
Identity identity = new Identity(); Identity identity = new Identity();
@ -182,11 +182,11 @@ public class Account implements BaseAccount
mExpungePolicy = preferences.getPreferences().getString(mUuid + ".expungePolicy", EXPUNGE_IMMEDIATELY); mExpungePolicy = preferences.getPreferences().getString(mUuid + ".expungePolicy", EXPUNGE_IMMEDIATELY);
mMaxPushFolders = preferences.getPreferences().getInt(mUuid + ".maxPushFolders", 10); mMaxPushFolders = preferences.getPreferences().getInt(mUuid + ".maxPushFolders", 10);
for (String type : networkTypes) for (String type : networkTypes)
{ {
Boolean useCompression = preferences.getPreferences().getBoolean(mUuid + ".useCompression." + type, Boolean useCompression = preferences.getPreferences().getBoolean(mUuid + ".useCompression." + type,
true); true);
compressionMap.put(type, useCompression); compressionMap.put(type, useCompression);
} }
@ -215,15 +215,15 @@ public class Account implements BaseAccount
"INBOX"); "INBOX");
mAccountNumber = preferences.getPreferences().getInt(mUuid + ".accountNumber", 0); mAccountNumber = preferences.getPreferences().getInt(mUuid + ".accountNumber", 0);
Random random = new Random((long)mAccountNumber+4); Random random = new Random((long)mAccountNumber+4);
mChipColor = preferences.getPreferences().getInt(mUuid+".chipColor", mChipColor = preferences.getPreferences().getInt(mUuid+".chipColor",
(random.nextInt(0x70) ) + (random.nextInt(0x70)) +
(random.nextInt(0x70) * 0xff ) + (random.nextInt(0x70) * 0xff) +
(random.nextInt(0x70) * 0xffff ) + (random.nextInt(0x70) * 0xffff) +
0xff000000); 0xff000000);
mVibrate = preferences.getPreferences().getBoolean(mUuid + ".vibrate", false); mVibrate = preferences.getPreferences().getBoolean(mUuid + ".vibrate", false);
mRing = preferences.getPreferences().getBoolean(mUuid + ".ring", true); mRing = preferences.getPreferences().getBoolean(mUuid + ".ring", true);
@ -278,7 +278,7 @@ public class Account implements BaseAccount
{ {
mFolderTargetMode = FolderMode.NOT_SECOND_CLASS; mFolderTargetMode = FolderMode.NOT_SECOND_CLASS;
} }
try try
{ {
searchableFolders = Searchable.valueOf(preferences.getPreferences().getString(mUuid + ".searchableFolders", searchableFolders = Searchable.valueOf(preferences.getPreferences().getString(mUuid + ".searchableFolders",
@ -421,8 +421,8 @@ public class Account implements BaseAccount
editor.putString(mUuid + ".expungePolicy", mExpungePolicy); editor.putString(mUuid + ".expungePolicy", mExpungePolicy);
editor.putInt(mUuid + ".maxPushFolders", mMaxPushFolders); editor.putInt(mUuid + ".maxPushFolders", mMaxPushFolders);
editor.putString(mUuid + ".searchableFolders", searchableFolders.name()); editor.putString(mUuid + ".searchableFolders", searchableFolders.name());
editor.putInt(mUuid + ".chipColor", mChipColor); editor.putInt(mUuid + ".chipColor", mChipColor);
for (String type : networkTypes) for (String type : networkTypes)
{ {
Boolean useCompression = compressionMap.get(type); Boolean useCompression = compressionMap.get(type);
@ -490,7 +490,7 @@ public class Account implements BaseAccount
} }
unreadMessageCount += folder.getUnreadMessageCount(); unreadMessageCount += folder.getUnreadMessageCount();
flaggedMessageCount += folder.getFlaggedMessageCount(); flaggedMessageCount += folder.getFlaggedMessageCount();
} }
} }
long folderEvalEnd = System.currentTimeMillis(); long folderEvalEnd = System.currentTimeMillis();
@ -499,20 +499,22 @@ public class Account implements BaseAccount
long endTime = System.currentTimeMillis(); long endTime = System.currentTimeMillis();
if (K9.DEBUG) if (K9.DEBUG)
Log.d(K9.LOG_TAG, "Account.getStats() on " + getDescription() + " took " + (endTime - startTime) + " ms;" Log.d(K9.LOG_TAG, "Account.getStats() on " + getDescription() + " took " + (endTime - startTime) + " ms;"
+ " loading " + folders.size() + " took " + (folderLoadEnd - folderLoadStart) + " ms;" + " loading " + folders.size() + " took " + (folderLoadEnd - folderLoadStart) + " ms;"
+ " evaluating took " + (folderEvalEnd - folderEvalStart) + " ms"); + " evaluating took " + (folderEvalEnd - folderEvalStart) + " ms");
return stats; return stats;
} }
public void setChipColor(int color) { public void setChipColor(int color)
mChipColor = color; {
} mChipColor = color;
}
public int getChipColor() {
return mChipColor; public int getChipColor()
} {
return mChipColor;
}
public String getUuid() public String getUuid()
{ {
return mUuid; return mUuid;
@ -615,18 +617,18 @@ public class Account implements BaseAccount
/* Have we sent a new mail notification on this account */ /* Have we sent a new mail notification on this account */
public boolean isRingNotified() public boolean isRingNotified()
{ {
return mRingNotified; return mRingNotified;
} }
public void setRingNotified(boolean ringNotified) public void setRingNotified(boolean ringNotified)
{ {
mRingNotified = ringNotified; mRingNotified = ringNotified;
} }
public synchronized String getRingtone() public synchronized String getRingtone()
{ {
return mRingtoneUri; return mRingtoneUri;
} }
@ -662,7 +664,7 @@ public class Account implements BaseAccount
int oldInterval = this.mAutomaticCheckIntervalMinutes; int oldInterval = this.mAutomaticCheckIntervalMinutes;
int newInterval = automaticCheckIntervalMinutes; int newInterval = automaticCheckIntervalMinutes;
this.mAutomaticCheckIntervalMinutes = automaticCheckIntervalMinutes; this.mAutomaticCheckIntervalMinutes = automaticCheckIntervalMinutes;
return (oldInterval != newInterval); return (oldInterval != newInterval);
} }
@ -798,7 +800,7 @@ public class Account implements BaseAccount
{ {
FolderMode oldSyncMode = mFolderSyncMode; FolderMode oldSyncMode = mFolderSyncMode;
mFolderSyncMode = syncMode; mFolderSyncMode = syncMode;
if (syncMode == FolderMode.NONE && oldSyncMode != FolderMode.NONE) if (syncMode == FolderMode.NONE && oldSyncMode != FolderMode.NONE)
{ {
return true; return true;
@ -818,7 +820,7 @@ public class Account implements BaseAccount
public synchronized boolean setFolderPushMode(FolderMode pushMode) public synchronized boolean setFolderPushMode(FolderMode pushMode)
{ {
FolderMode oldPushMode = mFolderPushMode; FolderMode oldPushMode = mFolderPushMode;
mFolderPushMode = pushMode; mFolderPushMode = pushMode;
return pushMode != oldPushMode; return pushMode != oldPushMode;
} }
@ -907,12 +909,12 @@ public class Account implements BaseAccount
public LocalStore getLocalStore() throws MessagingException public LocalStore getLocalStore() throws MessagingException
{ {
return Store.getLocalInstance(this, K9.app); return Store.getLocalInstance(this, K9.app);
} }
public Store getRemoteStore() throws MessagingException public Store getRemoteStore() throws MessagingException
{ {
return Store.getRemoteInstance(this); return Store.getRemoteInstance(this);
} }
@Override @Override
@ -920,12 +922,12 @@ public class Account implements BaseAccount
{ {
return mDescription; return mDescription;
} }
public void setCompression(String networkType, boolean useCompression) public void setCompression(String networkType, boolean useCompression)
{ {
compressionMap.put(networkType, useCompression); compressionMap.put(networkType, useCompression);
} }
public boolean useCompression(String networkType) public boolean useCompression(String networkType)
{ {
Boolean useCompression = compressionMap.get(networkType); Boolean useCompression = compressionMap.get(networkType);
@ -938,7 +940,7 @@ public class Account implements BaseAccount
return useCompression; return useCompression;
} }
} }
public boolean useCompression(int type) public boolean useCompression(int type)
{ {
String networkType = TYPE_OTHER; String networkType = TYPE_OTHER;
@ -953,7 +955,7 @@ public class Account implements BaseAccount
} }
return useCompression(networkType); return useCompression(networkType);
} }
@Override @Override
public boolean equals(Object o) public boolean equals(Object o)
{ {

View File

@ -1,5 +1,5 @@
/** /**
* *
*/ */
package com.fsck.k9; package com.fsck.k9;

View File

@ -25,25 +25,30 @@ import android.view.MotionEvent;
import android.view.View; import android.view.View;
public class ColorPickerDialog extends Dialog { public class ColorPickerDialog extends Dialog
{
public interface OnColorChangedListener { public interface OnColorChangedListener
{
void colorChanged(int color); void colorChanged(int color);
} }
private OnColorChangedListener mListener; private OnColorChangedListener mListener;
private int mInitialColor; private int mInitialColor;
private static class ColorPickerView extends View { private static class ColorPickerView extends View
{
private Paint mPaint; private Paint mPaint;
private Paint mCenterPaint; private Paint mCenterPaint;
private final int[] mColors; private final int[] mColors;
private OnColorChangedListener mListener; private OnColorChangedListener mListener;
ColorPickerView(Context c, OnColorChangedListener l, int color) { ColorPickerView(Context c, OnColorChangedListener l, int color)
{
super(c); super(c);
mListener = l; mListener = l;
mColors = new int[] { mColors = new int[]
{
0xFF800000, 0xFF800080, 0xFF000080, 0xFF008080, 0xFF008000, 0xFF800000, 0xFF800080, 0xFF000080, 0xFF008080, 0xFF008000,
0xFF808000, 0xFF800000 0xFF808000, 0xFF800000
}; };
@ -63,7 +68,8 @@ public class ColorPickerDialog extends Dialog {
private boolean mHighlightCenter; private boolean mHighlightCenter;
@Override @Override
protected void onDraw(Canvas canvas) { protected void onDraw(Canvas canvas)
{
float r = CENTER_X - mPaint.getStrokeWidth()*0.5f; float r = CENTER_X - mPaint.getStrokeWidth()*0.5f;
canvas.translate(CENTER_X, CENTER_X); canvas.translate(CENTER_X, CENTER_X);
@ -71,13 +77,17 @@ public class ColorPickerDialog extends Dialog {
canvas.drawOval(new RectF(-r, -r, r, r), mPaint); canvas.drawOval(new RectF(-r, -r, r, r), mPaint);
canvas.drawCircle(0, 0, CENTER_RADIUS, mCenterPaint); canvas.drawCircle(0, 0, CENTER_RADIUS, mCenterPaint);
if (mTrackingCenter) { if (mTrackingCenter)
{
int c = mCenterPaint.getColor(); int c = mCenterPaint.getColor();
mCenterPaint.setStyle(Paint.Style.STROKE); mCenterPaint.setStyle(Paint.Style.STROKE);
if (mHighlightCenter) { if (mHighlightCenter)
{
mCenterPaint.setAlpha(0xFF); mCenterPaint.setAlpha(0xFF);
} else { }
else
{
mCenterPaint.setAlpha(0x80); mCenterPaint.setAlpha(0x80);
} }
canvas.drawCircle(0, 0, canvas.drawCircle(0, 0,
@ -90,7 +100,8 @@ public class ColorPickerDialog extends Dialog {
} }
@Override @Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec)
{
setMeasuredDimension(CENTER_X*2, CENTER_Y*2); setMeasuredDimension(CENTER_X*2, CENTER_Y*2);
} }
@ -98,28 +109,37 @@ public class ColorPickerDialog extends Dialog {
private static final int CENTER_Y = 100; private static final int CENTER_Y = 100;
private static final int CENTER_RADIUS = 32; private static final int CENTER_RADIUS = 32;
private int floatToByte(float x) { private int floatToByte(float x)
{
int n = java.lang.Math.round(x); int n = java.lang.Math.round(x);
return n; return n;
} }
private int pinToByte(int n) { private int pinToByte(int n)
if (n < 0) { {
if (n < 0)
{
n = 0; n = 0;
} else if (n > 255) { }
else if (n > 255)
{
n = 255; n = 255;
} }
return n; return n;
} }
private int ave(int s, int d, float p) { private int ave(int s, int d, float p)
return s + java.lang.Math.round(p * (d - s)); {
return s + java.lang.Math.round(p *(d - s));
} }
private int interpColor(int colors[], float unit) { private int interpColor(int colors[], float unit)
if (unit <= 0) { {
if (unit <= 0)
{
return colors[0]; return colors[0];
} }
if (unit >= 1) { if (unit >= 1)
{
return colors[colors.length - 1]; return colors[colors.length - 1];
} }
@ -138,7 +158,8 @@ public class ColorPickerDialog extends Dialog {
return Color.argb(a, r, g, b); return Color.argb(a, r, g, b);
} }
private int rotateColor(int color, float rad) { private int rotateColor(int color, float rad)
{
float deg = rad * 180 / 3.1415927f; float deg = rad * 180 / 3.1415927f;
int r = Color.red(color); int r = Color.red(color);
int g = Color.green(color); int g = Color.green(color);
@ -166,30 +187,38 @@ public class ColorPickerDialog extends Dialog {
private static final float PI = 3.1415926f; private static final float PI = 3.1415926f;
@Override @Override
public boolean onTouchEvent(MotionEvent event) { public boolean onTouchEvent(MotionEvent event)
{
float x = event.getX() - CENTER_X; float x = event.getX() - CENTER_X;
float y = event.getY() - CENTER_Y; float y = event.getY() - CENTER_Y;
boolean inCenter = java.lang.Math.sqrt(x*x + y*y) <= CENTER_RADIUS; boolean inCenter = java.lang.Math.sqrt(x*x + y*y) <= CENTER_RADIUS;
switch (event.getAction()) { switch (event.getAction())
{
case MotionEvent.ACTION_DOWN: case MotionEvent.ACTION_DOWN:
mTrackingCenter = inCenter; mTrackingCenter = inCenter;
if (inCenter) { if (inCenter)
{
mHighlightCenter = true; mHighlightCenter = true;
invalidate(); invalidate();
break; break;
} }
case MotionEvent.ACTION_MOVE: case MotionEvent.ACTION_MOVE:
if (mTrackingCenter) { if (mTrackingCenter)
if (mHighlightCenter != inCenter) { {
if (mHighlightCenter != inCenter)
{
mHighlightCenter = inCenter; mHighlightCenter = inCenter;
invalidate(); invalidate();
} }
} else { }
else
{
float angle = (float)java.lang.Math.atan2(y, x); float angle = (float)java.lang.Math.atan2(y, x);
// need to turn angle [-PI ... PI] into unit [0....1] // need to turn angle [-PI ... PI] into unit [0....1]
float unit = angle/(2*PI); float unit = angle/(2*PI);
if (unit < 0) { if (unit < 0)
{
unit += 1; unit += 1;
} }
mCenterPaint.setColor(interpColor(mColors, unit)); mCenterPaint.setColor(interpColor(mColors, unit));
@ -197,8 +226,10 @@ public class ColorPickerDialog extends Dialog {
} }
break; break;
case MotionEvent.ACTION_UP: case MotionEvent.ACTION_UP:
if (mTrackingCenter) { if (mTrackingCenter)
if (inCenter) { {
if (inCenter)
{
mListener.colorChanged(mCenterPaint.getColor()); mListener.colorChanged(mCenterPaint.getColor());
} }
mTrackingCenter = false; // so we draw w/o halo mTrackingCenter = false; // so we draw w/o halo
@ -214,7 +245,8 @@ public class ColorPickerDialog extends Dialog {
public ColorPickerDialog(Context context, public ColorPickerDialog(Context context,
OnColorChangedListener listener, OnColorChangedListener listener,
int initialColor) { int initialColor)
{
super(context); super(context);
mListener = listener; mListener = listener;
@ -222,10 +254,13 @@ public class ColorPickerDialog extends Dialog {
} }
@Override @Override
protected void onCreate(Bundle savedInstanceState) { protected void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
OnColorChangedListener l = new OnColorChangedListener() { OnColorChangedListener l = new OnColorChangedListener()
public void colorChanged(int color) { {
public void colorChanged(int color)
{
mListener.colorChanged(color); mListener.colorChanged(color);
dismiss(); dismiss();
} }

View File

@ -55,7 +55,7 @@ public abstract class EmailAddressAdapter extends ResourceCursorAdapter
try try
{ {
Class<? extends EmailAddressAdapter> clazz = Class<? extends EmailAddressAdapter> clazz =
Class.forName(className).asSubclass(EmailAddressAdapter.class); Class.forName(className).asSubclass(EmailAddressAdapter.class);
sInstance = clazz.newInstance(); sInstance = clazz.newInstance();
} }
catch (Exception e) catch (Exception e)

View File

@ -34,7 +34,8 @@ public class EmailAddressAdapterSdk5 extends EmailAddressAdapter
private static final String SORT_ORDER = Contacts.TIMES_CONTACTED private static final String SORT_ORDER = Contacts.TIMES_CONTACTED
+ " DESC, " + Contacts.DISPLAY_NAME; + " DESC, " + Contacts.DISPLAY_NAME;
private static final String[] PROJECTION = { private static final String[] PROJECTION =
{
Data._ID, // 0 Data._ID, // 0
Contacts.DISPLAY_NAME, // 1 Contacts.DISPLAY_NAME, // 1
Email.DATA // 2 Email.DATA // 2

View File

@ -106,7 +106,7 @@ public class FontSizes
/** /**
* Font size of the message content in the message view activity. * Font size of the message content in the message view activity.
* *
* Note: The unit is WebSettings.TextSize * Note: The unit is WebSettings.TextSize
*/ */
private TextSize messageViewContent = TextSize.NORMAL; private TextSize messageViewContent = TextSize.NORMAL;
@ -125,7 +125,7 @@ public class FontSizes
messageListSubject = SMALL; messageListSubject = SMALL;
messageListSender = SMALL; messageListSender = SMALL;
messageListDate = SMALL; messageListDate = SMALL;
messageViewSender = SMALL; messageViewSender = SMALL;
messageViewTo = FONT_12DIP; messageViewTo = FONT_12DIP;
messageViewCC = FONT_12DIP; messageViewCC = FONT_12DIP;
@ -136,7 +136,7 @@ public class FontSizes
/** /**
* Permanently save the font size settings. * Permanently save the font size settings.
* *
* @param editor Used to save the font size settings. * @param editor Used to save the font size settings.
*/ */
public void save(SharedPreferences.Editor editor) public void save(SharedPreferences.Editor editor)
@ -162,7 +162,7 @@ public class FontSizes
/** /**
* Load the font size settings from permanent storage. * Load the font size settings from permanent storage.
* *
* @param prefs Used to load the font size settings. * @param prefs Used to load the font size settings.
*/ */
public void load(SharedPreferences prefs) public void load(SharedPreferences prefs)
@ -172,7 +172,7 @@ public class FontSizes
folderName = prefs.getInt(FOLDER_NAME, folderName); folderName = prefs.getInt(FOLDER_NAME, folderName);
folderStatus = prefs.getInt(FOLDER_STATUS, folderStatus); folderStatus = prefs.getInt(FOLDER_STATUS, folderStatus);
messageListSubject = prefs.getInt(MESSAGE_LIST_SUBJECT, messageListSubject); messageListSubject = prefs.getInt(MESSAGE_LIST_SUBJECT, messageListSubject);
messageListSender = prefs.getInt(MESSAGE_LIST_SENDER, messageListSender); messageListSender = prefs.getInt(MESSAGE_LIST_SENDER, messageListSender);
messageListDate = prefs.getInt(MESSAGE_LIST_DATE, messageListDate); messageListDate = prefs.getInt(MESSAGE_LIST_DATE, messageListDate);
@ -325,12 +325,17 @@ public class FontSizes
{ {
switch (messageViewContent) switch (messageViewContent)
{ {
case SMALLEST: return 1; case SMALLEST:
case SMALLER: return 2; return 1;
case SMALLER:
return 2;
default: default:
case NORMAL: return 3; case NORMAL:
case LARGER: return 4; return 3;
case LARGEST: return 5; case LARGER:
return 4;
case LARGEST:
return 5;
} }
} }
@ -338,11 +343,21 @@ public class FontSizes
{ {
switch (size) switch (size)
{ {
case 1: messageViewContent = TextSize.SMALLEST; break; case 1:
case 2: messageViewContent = TextSize.SMALLER; break; messageViewContent = TextSize.SMALLEST;
case 3: messageViewContent = TextSize.NORMAL; break; break;
case 4: messageViewContent = TextSize.LARGER; break; case 2:
case 5: messageViewContent = TextSize.LARGEST; break; messageViewContent = TextSize.SMALLER;
break;
case 3:
messageViewContent = TextSize.NORMAL;
break;
case 4:
messageViewContent = TextSize.LARGER;
break;
case 5:
messageViewContent = TextSize.LARGEST;
break;
} }
} }
} }

View File

@ -81,7 +81,7 @@ public class K9 extends Application
* We use WebSettings.getBlockNetworkLoads() to prevent the WebView that displays email * We use WebSettings.getBlockNetworkLoads() to prevent the WebView that displays email
* bodies from loading external resources over the network. Unfortunately this method * bodies from loading external resources over the network. Unfortunately this method
* isn't exposed via the official Android API. That's why we use reflection to be able * isn't exposed via the official Android API. That's why we use reflection to be able
* to call the method. * to call the method.
*/ */
private static final Method mGetBlockNetworkLoads = getMethod(WebSettings.class, "setBlockNetworkLoads"); private static final Method mGetBlockNetworkLoads = getMethod(WebSettings.class, "setBlockNetworkLoads");
@ -441,12 +441,12 @@ public class K9 extends Application
{ {
return mGesturesEnabled; return mGesturesEnabled;
} }
public static void setGesturesEnabled(boolean gestures) public static void setGesturesEnabled(boolean gestures)
{ {
mGesturesEnabled = gestures; mGesturesEnabled = gestures;
} }
public static boolean isAnimations() public static boolean isAnimations()
{ {
return mAnimations; return mAnimations;
@ -497,12 +497,12 @@ public class K9 extends Application
catch (NoSuchMethodException e) catch (NoSuchMethodException e)
{ {
Log.i(K9.LOG_TAG, "Can't get method " + Log.i(K9.LOG_TAG, "Can't get method " +
classObject.toString() + "." + methodName); classObject.toString() + "." + methodName);
} }
catch (Exception e) catch (Exception e)
{ {
Log.e(K9.LOG_TAG, "Error while using reflection to get method " + Log.e(K9.LOG_TAG, "Error while using reflection to get method " +
classObject.toString() + "." + methodName, e); classObject.toString() + "." + methodName, e);
} }
return null; return null;
} }

View File

@ -17,7 +17,7 @@ public class K9Activity extends Activity
private GestureDetector gestureDetector; private GestureDetector gestureDetector;
protected ScrollView mTopView; protected ScrollView mTopView;
@Override @Override
public void onCreate(Bundle icicle) public void onCreate(Bundle icicle)
{ {
@ -64,7 +64,7 @@ public class K9Activity extends Activity
} }
protected void onNext(boolean animate) protected void onNext(boolean animate)
{ {
} }
protected void onPrevious(boolean animate) protected void onPrevious(boolean animate)
{ {
@ -76,7 +76,7 @@ public class K9Activity extends Activity
private static final float SWIPE_MIN_DISTANCE_DIP = 130.0f; private static final float SWIPE_MIN_DISTANCE_DIP = 130.0f;
private static final float SWIPE_MAX_OFF_PATH_DIP = 250f; private static final float SWIPE_MAX_OFF_PATH_DIP = 250f;
private static final float SWIPE_THRESHOLD_VELOCITY_DIP = 325f; private static final float SWIPE_THRESHOLD_VELOCITY_DIP = 325f;
@Override @Override
public boolean onDoubleTap(MotionEvent ev) public boolean onDoubleTap(MotionEvent ev)
{ {
@ -87,12 +87,12 @@ public class K9Activity extends Activity
if (ev.getRawY() < (height/4)) if (ev.getRawY() < (height/4))
{ {
mTopView.fullScroll(View.FOCUS_UP); mTopView.fullScroll(View.FOCUS_UP);
} }
else if (ev.getRawY() > (height - height/4)) else if (ev.getRawY() > (height - height/4))
{ {
mTopView.fullScroll(View.FOCUS_DOWN); mTopView.fullScroll(View.FOCUS_DOWN);
} }
} }
return false; return false;
@ -108,8 +108,8 @@ public class K9Activity extends Activity
int min_distance = (int)(SWIPE_MIN_DISTANCE_DIP * mGestureScale + 0.5f); int min_distance = (int)(SWIPE_MIN_DISTANCE_DIP * mGestureScale + 0.5f);
int min_velocity = (int)(SWIPE_THRESHOLD_VELOCITY_DIP * mGestureScale + 0.5f); int min_velocity = (int)(SWIPE_THRESHOLD_VELOCITY_DIP * mGestureScale + 0.5f);
int max_off_path = (int)(SWIPE_MAX_OFF_PATH_DIP * mGestureScale + 0.5f); int max_off_path = (int)(SWIPE_MAX_OFF_PATH_DIP * mGestureScale + 0.5f);
try try
{ {
if (Math.abs(e1.getY() - e2.getY()) > max_off_path) if (Math.abs(e1.getY() - e2.getY()) > max_off_path)

View File

@ -701,10 +701,10 @@ public class MessagingController implements Runnable
public void searchLocalMessages(SearchSpecification searchSpecification, final Message[] messages, final MessagingListener listener) public void searchLocalMessages(SearchSpecification searchSpecification, final Message[] messages, final MessagingListener listener)
{ {
searchLocalMessages(searchSpecification.getAccountUuids(), searchSpecification.getFolderNames(), messages, searchLocalMessages(searchSpecification.getAccountUuids(), searchSpecification.getFolderNames(), messages,
searchSpecification.getQuery(), searchSpecification.isIntegrate(), searchSpecification.getRequiredFlags(), searchSpecification.getForbiddenFlags(), listener); searchSpecification.getQuery(), searchSpecification.isIntegrate(), searchSpecification.getRequiredFlags(), searchSpecification.getForbiddenFlags(), listener);
} }
/** /**
* Find all messages in any local account which match the query 'query' * Find all messages in any local account which match the query 'query'
@ -716,22 +716,22 @@ public class MessagingController implements Runnable
* @param account * @param account
* @throws MessagingException * @throws MessagingException
*/ */
public void searchLocalMessages(final String[] accountUuids, final String[] folderNames, final Message[] messages, final String query, final boolean integrate, public void searchLocalMessages(final String[] accountUuids, final String[] folderNames, final Message[] messages, final String query, final boolean integrate,
final Flag[] requiredFlags, final Flag[] forbiddenFlags, final MessagingListener listener) final Flag[] requiredFlags, final Flag[] forbiddenFlags, final MessagingListener listener)
{ {
if (K9.DEBUG) if (K9.DEBUG)
{ {
Log.i(K9.LOG_TAG, "searchLocalMessages (" Log.i(K9.LOG_TAG, "searchLocalMessages ("
+ "accountUuids=" + Utility.combine(accountUuids, ',') + "accountUuids=" + Utility.combine(accountUuids, ',')
+ ", folderNames = " + Utility.combine(folderNames, ',') + ", folderNames = " + Utility.combine(folderNames, ',')
+ ", messages.size() = " + (messages != null ? messages.length : null) + ", messages.size() = " + (messages != null ? messages.length : null)
+ ", query = " + query + ", query = " + query
+ ", integrate = " + integrate + ", integrate = " + integrate
+ ", requiredFlags = " + Utility.combine(requiredFlags, ',') + ", requiredFlags = " + Utility.combine(requiredFlags, ',')
+ ", forbiddenFlags = " + Utility.combine(forbiddenFlags, ',') + ", forbiddenFlags = " + Utility.combine(forbiddenFlags, ',')
+ ")"); + ")");
} }
threadPool.execute(new Runnable() threadPool.execute(new Runnable()
{ {
public void run() public void run()
@ -743,7 +743,7 @@ public class MessagingController implements Runnable
{ {
for (String accountUuid : accountUuids) for (String accountUuid : accountUuids)
{ {
accountUuidsSet.add(accountUuid); accountUuidsSet.add(accountUuid);
} }
} }
final Preferences prefs = Preferences.getPreferences(mApplication.getApplicationContext()); final Preferences prefs = Preferences.getPreferences(mApplication.getApplicationContext());
@ -757,7 +757,7 @@ public class MessagingController implements Runnable
{ {
continue; continue;
} }
if (accountUuids != null && accountUuidsSet.contains(account.getUuid()) == true) if (accountUuids != null && accountUuidsSet.contains(account.getUuid()) == true)
{ {
displayableOnly = true; displayableOnly = true;
@ -773,14 +773,14 @@ public class MessagingController implements Runnable
case DISPLAYABLE: case DISPLAYABLE:
displayableOnly = true; displayableOnly = true;
break; break;
} }
} }
if (listener != null) if (listener != null)
{ {
listener.listLocalMessagesStarted(account, null); listener.listLocalMessagesStarted(account, null);
} }
if (integrate || displayableOnly || folderNames != null || noSpecialFolders) if (integrate || displayableOnly || folderNames != null || noSpecialFolders)
{ {
List<LocalFolder> tmpFoldersToSearch = new LinkedList<LocalFolder>(); List<LocalFolder> tmpFoldersToSearch = new LinkedList<LocalFolder>();
@ -812,17 +812,17 @@ public class MessagingController implements Runnable
if (folderNameSet != null) if (folderNameSet != null)
{ {
if (folderNameSet.contains(localFolderName) == false) if (folderNameSet.contains(localFolderName) == false)
{ {
include = false; include = false;
} }
} }
else if (noSpecialFolders && ( else if (noSpecialFolders && (
localFolderName.equals(account.getTrashFolderName()) || localFolderName.equals(account.getTrashFolderName()) ||
localFolderName.equals(account.getOutboxFolderName()) || localFolderName.equals(account.getOutboxFolderName()) ||
localFolderName.equals(account.getDraftsFolderName()) || localFolderName.equals(account.getDraftsFolderName()) ||
localFolderName.equals(account.getSentFolderName()) || localFolderName.equals(account.getSentFolderName()) ||
localFolderName.equals(account.getErrorFolderName()))) localFolderName.equals(account.getErrorFolderName())))
{ {
include = false; include = false;
} }
@ -831,7 +831,7 @@ public class MessagingController implements Runnable
include = false; include = false;
} }
} }
if (include) if (include)
{ {
tmpFoldersToSearch.add(localFolder); tmpFoldersToSearch.add(localFolder);
@ -848,9 +848,9 @@ public class MessagingController implements Runnable
Log.e(K9.LOG_TAG, "Unable to restrict search folders in Account " + account.getDescription() + ", searching all", me); Log.e(K9.LOG_TAG, "Unable to restrict search folders in Account " + account.getDescription() + ", searching all", me);
addErrorMessage(account, null, me); addErrorMessage(account, null, me);
} }
} }
MessageRetrievalListener retrievalListener = new MessageRetrievalListener() MessageRetrievalListener retrievalListener = new MessageRetrievalListener()
{ {
public void messageStarted(String message, int number, int ofTotal) {} public void messageStarted(String message, int number, int ofTotal) {}
@ -865,11 +865,11 @@ public class MessagingController implements Runnable
{ {
listener.listLocalMessagesAddMessages(account, null, messages); listener.listLocalMessagesAddMessages(account, null, messages);
} }
} }
public void messagesFinished(int number) public void messagesFinished(int number)
{ {
} }
}; };
@ -877,7 +877,7 @@ public class MessagingController implements Runnable
{ {
LocalStore localStore = account.getLocalStore(); LocalStore localStore = account.getLocalStore();
localStore.searchForMessages(retrievalListener, query, foldersToSearch, messages, requiredFlags, forbiddenFlags); localStore.searchForMessages(retrievalListener, query, foldersToSearch, messages, requiredFlags, forbiddenFlags);
} }
catch (Exception e) catch (Exception e)
{ {
@ -1172,7 +1172,7 @@ public class MessagingController implements Runnable
int unreadMessageCount = setLocalUnreadCountToRemote(localFolder, remoteFolder, newMessages); int unreadMessageCount = setLocalUnreadCountToRemote(localFolder, remoteFolder, newMessages);
setLocalFlaggedCountToRemote(localFolder, remoteFolder); setLocalFlaggedCountToRemote(localFolder, remoteFolder);
for (MessagingListener l : getListeners()) for (MessagingListener l : getListeners())
{ {
@ -1287,7 +1287,7 @@ public class MessagingController implements Runnable
return localFolder.getMessageCount(); return localFolder.getMessageCount();
} }
} }
private void setLocalFlaggedCountToRemote(LocalFolder localFolder, Folder remoteFolder) throws MessagingException private void setLocalFlaggedCountToRemote(LocalFolder localFolder, Folder remoteFolder) throws MessagingException
{ {
int remoteFlaggedMessageCount = remoteFolder.getFlaggedMessageCount(); int remoteFlaggedMessageCount = remoteFolder.getFlaggedMessageCount();
@ -1448,7 +1448,7 @@ public class MessagingController implements Runnable
{ {
smallMessages.add(message); smallMessages.add(message);
} }
// And include it in the view // And include it in the view
if (message.getSubject() != null && if (message.getSubject() != null &&
message.getFrom() != null) message.getFrom() != null)
@ -1476,7 +1476,7 @@ public class MessagingController implements Runnable
{ {
newMessages.incrementAndGet(); newMessages.incrementAndGet();
} }
} }
} }
@ -2723,7 +2723,7 @@ public class MessagingController implements Runnable
{ {
@Override @Override
public void act(final Account account, final Folder folder, public void act(final Account account, final Folder folder,
final List<Message> messages) final List<Message> messages)
{ {
String[] uids = new String[messages.size()]; String[] uids = new String[messages.size()];
for (int i = 0; i < messages.size(); i++) for (int i = 0; i < messages.size(); i++)
@ -2732,9 +2732,9 @@ public class MessagingController implements Runnable
} }
setFlag(account, folder.getName(), uids, flag, newState); setFlag(account, folder.getName(), uids, flag, newState);
} }
}); });
} }
public void setFlag( public void setFlag(
@ -2766,7 +2766,7 @@ public class MessagingController implements Runnable
Message msg = localFolder.getMessage(uid); Message msg = localFolder.getMessage(uid);
if (msg != null) if (msg != null)
{ {
messages.add(msg); messages.add(msg);
} }
} }
@ -2977,7 +2977,7 @@ public class MessagingController implements Runnable
message message
}, fp, null); }, fp, null);
localFolder.close(); localFolder.close();
for (MessagingListener l : getListeners()) for (MessagingListener l : getListeners())
{ {
l.loadMessageForViewBodyAvailable(account, folder, uid, message); l.loadMessageForViewBodyAvailable(account, folder, uid, message);
@ -3340,14 +3340,14 @@ public class MessagingController implements Runnable
account.getSentFolderName()); account.getSentFolderName());
if (K9.DEBUG) if (K9.DEBUG)
Log.i(K9.LOG_TAG, "Moving sent message to folder '" + account.getSentFolderName() + "' (" + localSentFolder.getId() + ") "); Log.i(K9.LOG_TAG, "Moving sent message to folder '" + account.getSentFolderName() + "' (" + localSentFolder.getId() + ") ");
localFolder.moveMessages( localFolder.moveMessages(
new Message[] { message }, new Message[] { message },
localSentFolder); localSentFolder);
if (K9.DEBUG) if (K9.DEBUG)
Log.i(K9.LOG_TAG, "Moved sent message to folder '" + account.getSentFolderName() + "' (" + localSentFolder.getId() + ") "); Log.i(K9.LOG_TAG, "Moved sent message to folder '" + account.getSentFolderName() + "' (" + localSentFolder.getId() + ") ");
PendingCommand command = new PendingCommand(); PendingCommand command = new PendingCommand();
command.command = PENDING_COMMAND_APPEND; command.command = PENDING_COMMAND_APPEND;
command.arguments = command.arguments =
@ -3359,7 +3359,7 @@ public class MessagingController implements Runnable
queuePendingCommand(account, command); queuePendingCommand(account, command);
processPendingCommands(account); processPendingCommands(account);
} }
} }
catch (Exception e) catch (Exception e)
{ {
@ -3465,7 +3465,7 @@ public class MessagingController implements Runnable
} }
public void getAccountStats(final Context context, final Account account, public void getAccountStats(final Context context, final Account account,
final MessagingListener l) final MessagingListener l)
{ {
Runnable unreadRunnable = new Runnable() Runnable unreadRunnable = new Runnable()
{ {
@ -3481,13 +3481,13 @@ public class MessagingController implements Runnable
Log.e(K9.LOG_TAG, "Count not get unread count for account " + account.getDescription(), Log.e(K9.LOG_TAG, "Count not get unread count for account " + account.getDescription(),
me); me);
} }
} }
}; };
put("getAccountStats:" + account.getDescription(), l, unreadRunnable); put("getAccountStats:" + account.getDescription(), l, unreadRunnable);
} }
public void getFolderUnreadMessageCount(final Account account, final String folderName, public void getFolderUnreadMessageCount(final Account account, final String folderName,
final MessagingListener l) final MessagingListener l)
{ {
@ -3515,7 +3515,7 @@ public class MessagingController implements Runnable
} }
public boolean isMoveCapable(Message message) public boolean isMoveCapable(Message message)
{ {
if (!message.getUid().startsWith(K9.LOCAL_UID_PREFIX)) if (!message.getUid().startsWith(K9.LOCAL_UID_PREFIX))
@ -3562,7 +3562,7 @@ public class MessagingController implements Runnable
} }
} }
public void moveMessages(final Account account, final String srcFolder, final Message[] messages, final String destFolder, public void moveMessages(final Account account, final String srcFolder, final Message[] messages, final String destFolder,
final MessagingListener listener) final MessagingListener listener)
{ {
for (Message message : messages) for (Message message : messages)
{ {
@ -3578,13 +3578,13 @@ public class MessagingController implements Runnable
} }
public void moveMessage(final Account account, final String srcFolder, final Message message, final String destFolder, public void moveMessage(final Account account, final String srcFolder, final Message message, final String destFolder,
final MessagingListener listener) final MessagingListener listener)
{ {
moveMessages(account, srcFolder, new Message[] { message }, destFolder, listener); moveMessages(account, srcFolder, new Message[] { message }, destFolder, listener);
} }
public void copyMessages(final Account account, final String srcFolder, final Message[] messages, final String destFolder, public void copyMessages(final Account account, final String srcFolder, final Message[] messages, final String destFolder,
final MessagingListener listener) final MessagingListener listener)
{ {
putBackground("copyMessages", null, new Runnable() putBackground("copyMessages", null, new Runnable()
{ {
@ -3595,7 +3595,7 @@ public class MessagingController implements Runnable
}); });
} }
public void copyMessage(final Account account, final String srcFolder, final Message message, final String destFolder, public void copyMessage(final Account account, final String srcFolder, final Message message, final String destFolder,
final MessagingListener listener) final MessagingListener listener)
{ {
copyMessages(account, srcFolder, new Message[] { message }, destFolder, listener); copyMessages(account, srcFolder, new Message[] { message }, destFolder, listener);
} }
@ -3618,7 +3618,7 @@ public class MessagingController implements Runnable
Folder localSrcFolder = localStore.getFolder(srcFolder); Folder localSrcFolder = localStore.getFolder(srcFolder);
Folder localDestFolder = localStore.getFolder(destFolder); Folder localDestFolder = localStore.getFolder(destFolder);
List<String> uids = new LinkedList<String>(); List<String> uids = new LinkedList<String>();
for (Message message : inMessages) for (Message message : inMessages)
{ {
@ -3628,17 +3628,17 @@ public class MessagingController implements Runnable
uids.add(uid); uids.add(uid);
} }
} }
Message[] messages = localSrcFolder.getMessages(uids.toArray(new String[0]), null); Message[] messages = localSrcFolder.getMessages(uids.toArray(new String[0]), null);
if (messages.length > 0) if (messages.length > 0)
{ {
Map<String, Message> origUidMap = new HashMap<String, Message>(); Map<String, Message> origUidMap = new HashMap<String, Message>();
for (Message message : messages) for (Message message : messages)
{ {
origUidMap.put(message.getUid(), message); origUidMap.put(message.getUid(), message);
} }
if (K9.DEBUG) if (K9.DEBUG)
Log.i(K9.LOG_TAG, "moveOrCopyMessageSynchronous: source folder = " + srcFolder Log.i(K9.LOG_TAG, "moveOrCopyMessageSynchronous: source folder = " + srcFolder
+ ", " + messages.length + " messages, " + ", destination folder = " + destFolder + ", isCopy = " + isCopy); + ", " + messages.length + " messages, " + ", destination folder = " + destFolder + ", isCopy = " + isCopy);
@ -3663,7 +3663,7 @@ public class MessagingController implements Runnable
unsuppressMessage(account, srcFolder, origUid); unsuppressMessage(account, srcFolder, origUid);
} }
} }
queueMoveOrCopy(account, srcFolder, destFolder, isCopy, origUidMap.keySet().toArray(new String[0])); queueMoveOrCopy(account, srcFolder, destFolder, isCopy, origUidMap.keySet().toArray(new String[0]));
} }
@ -3687,8 +3687,8 @@ public class MessagingController implements Runnable
} }
}); });
} }
public void deleteDraft(final Account account, String uid) public void deleteDraft(final Account account, String uid)
{ {
LocalFolder localFolder = null; LocalFolder localFolder = null;
try try
@ -3722,7 +3722,7 @@ public class MessagingController implements Runnable
@Override @Override
public void act(final Account account, final Folder folder, public void act(final Account account, final Folder folder,
final List<Message> messages) final List<Message> messages)
{ {
for (Message message : messages) for (Message message : messages)
{ {
@ -3737,9 +3737,9 @@ public class MessagingController implements Runnable
} }
}); });
} }
}); });
} }
private void deleteMessagesSynchronous(final Account account, final String folder, final Message[] messages, private void deleteMessagesSynchronous(final Account account, final String folder, final Message[] messages,
@ -3852,7 +3852,7 @@ public class MessagingController implements Runnable
} }
finally finally
{ {
if (localFolder != null) if (localFolder != null)
{ {
localFolder.close(); localFolder.close();
@ -4056,9 +4056,9 @@ public class MessagingController implements Runnable
if (K9.DEBUG) if (K9.DEBUG)
Log.i(K9.LOG_TAG, "Synchronizing account " + account.getDescription()); Log.i(K9.LOG_TAG, "Synchronizing account " + account.getDescription());
account.setRingNotified(false); account.setRingNotified(false);
putBackground("sendPending " + account.getDescription(), null, new Runnable() putBackground("sendPending " + account.getDescription(), null, new Runnable()
{ {
public void run() public void run()
@ -4234,11 +4234,11 @@ public class MessagingController implements Runnable
public void run() public void run()
{ {
if (K9.DEBUG) if (K9.DEBUG)
Log.v(K9.LOG_TAG, "Clearing notification flag for " + account.getDescription()); Log.v(K9.LOG_TAG, "Clearing notification flag for " + account.getDescription());
account.setRingNotified(false); account.setRingNotified(false);
} }
} }
); );
} }
@ -4480,7 +4480,7 @@ public class MessagingController implements Runnable
}; };
queuePendingCommand(account, command); queuePendingCommand(account, command);
processPendingCommands(account); processPendingCommands(account);
} }
catch (MessagingException e) catch (MessagingException e)
{ {
@ -5067,12 +5067,12 @@ public class MessagingController implements Runnable
private void actOnMessages(Message[] messages, MessageActor actor) private void actOnMessages(Message[] messages, MessageActor actor)
{ {
Map<Account, Map<Folder, List<Message>>> accountMap = new HashMap<Account, Map<Folder, List<Message>>>(); Map<Account, Map<Folder, List<Message>>> accountMap = new HashMap<Account, Map<Folder, List<Message>>>();
for (Message message : messages) for (Message message : messages)
{ {
Folder folder = message.getFolder(); Folder folder = message.getFolder();
Account account = folder.getAccount(); Account account = folder.getAccount();
Map<Folder, List<Message>> folderMap = accountMap.get(account); Map<Folder, List<Message>> folderMap = accountMap.get(account);
if (folderMap == null) if (folderMap == null)
{ {
@ -5085,7 +5085,7 @@ public class MessagingController implements Runnable
messageList = new LinkedList<Message>(); messageList = new LinkedList<Message>();
folderMap.put(folder, messageList); folderMap.put(folder, messageList);
} }
messageList.add(message); messageList.add(message);
} }
for (Map.Entry<Account, Map<Folder, List<Message>>> entry : accountMap.entrySet()) for (Map.Entry<Account, Map<Folder, List<Message>>> entry : accountMap.entrySet())
@ -5102,8 +5102,8 @@ public class MessagingController implements Runnable
} }
} }
} }
interface MessageActor interface MessageActor
{ {
public void act(final Account account, final Folder folder, final List<Message> messages); public void act(final Account account, final Folder folder, final List<Message> messages);
} }

View File

@ -75,7 +75,7 @@ public class MessagingControllerPushReceiver implements PushReceiver
{ {
controller.messagesArrived(account, folder, messages, false); controller.messagesArrived(account, folder, messages, false);
} }
public void syncFolder(Folder folder) public void syncFolder(Folder folder)
{ {
if (K9.DEBUG) if (K9.DEBUG)
@ -84,13 +84,13 @@ public class MessagingControllerPushReceiver implements PushReceiver
controller.synchronizeMailbox(account, folder.getName(), new MessagingListener() controller.synchronizeMailbox(account, folder.getName(), new MessagingListener()
{ {
public void synchronizeMailboxFinished(Account account, String folder, public void synchronizeMailboxFinished(Account account, String folder,
int totalMessagesInMailbox, int numNewMessages) int totalMessagesInMailbox, int numNewMessages)
{ {
latch.countDown(); latch.countDown();
} }
public void synchronizeMailboxFailed(Account account, String folder, public void synchronizeMailboxFailed(Account account, String folder,
String message) String message)
{ {
latch.countDown(); latch.countDown();
} }

View File

@ -18,11 +18,11 @@ import java.util.List;
public class MessagingListener public class MessagingListener
{ {
public void searchStats(AccountStats stats) {} public void searchStats(AccountStats stats) {}
public void accountStatusChanged(BaseAccount account, AccountStats stats) public void accountStatusChanged(BaseAccount account, AccountStats stats)
{ {
} }
public void accountSizeChanged(Account account, long oldSize, long newSize) public void accountSizeChanged(Account account, long oldSize, long newSize)
{ {
} }

View File

@ -1,5 +1,5 @@
/** /**
* *
*/ */
package com.fsck.k9; package com.fsck.k9;
@ -22,22 +22,22 @@ public class SearchAccount implements BaseAccount, SearchSpecification, Serializ
private boolean builtin = false; private boolean builtin = false;
private String[] accountUuids = null; private String[] accountUuids = null;
private String[] folderNames = null; private String[] folderNames = null;
public SearchAccount(Preferences preferences) public SearchAccount(Preferences preferences)
{ {
} }
protected synchronized void delete(Preferences preferences) protected synchronized void delete(Preferences preferences)
{ {
} }
public synchronized void save(Preferences preferences) public synchronized void save(Preferences preferences)
{ {
} }
public SearchAccount(Context context, boolean nintegrate, Flag[] requiredFlags, Flag[] forbiddenFlags) public SearchAccount(Context context, boolean nintegrate, Flag[] requiredFlags, Flag[] forbiddenFlags)
{ {
mRequiredFlags = requiredFlags; mRequiredFlags = requiredFlags;

View File

@ -5,16 +5,16 @@ import com.fsck.k9.mail.Flag;
public interface SearchSpecification public interface SearchSpecification
{ {
public Flag[] getRequiredFlags(); public Flag[] getRequiredFlags();
public Flag[] getForbiddenFlags(); public Flag[] getForbiddenFlags();
public boolean isIntegrate(); public boolean isIntegrate();
public String getQuery(); public String getQuery();
public String[] getAccountUuids(); public String[] getAccountUuids();
public String[] getFolderNames(); public String[] getFolderNames();
} }

View File

@ -308,14 +308,14 @@ public class Accounts extends K9ListActivity implements OnItemClickListener, OnC
@Override @Override
public void onCreate(Bundle icicle) public void onCreate(Bundle icicle)
{ {
unreadAccount = new SearchAccount(this, false, null, null ); unreadAccount = new SearchAccount(this, false, null, null);
unreadAccount.setDescription(getString(R.string.search_all_messages_title)); unreadAccount.setDescription(getString(R.string.search_all_messages_title));
unreadAccount.setEmail(getString(R.string.search_all_messages_detail)); unreadAccount.setEmail(getString(R.string.search_all_messages_detail));
integratedInboxAccount = new SearchAccount(this, true, null, null); integratedInboxAccount = new SearchAccount(this, true, null, null);
integratedInboxAccount.setDescription(getString(R.string.integrated_inbox_title)); integratedInboxAccount.setDescription(getString(R.string.integrated_inbox_title));
integratedInboxAccount.setEmail(getString(R.string.integrated_inbox_detail)); integratedInboxAccount.setEmail(getString(R.string.integrated_inbox_detail));
super.onCreate(icicle); super.onCreate(icicle);
Account[] accounts = Preferences.getPreferences(this).getAccounts(); Account[] accounts = Preferences.getPreferences(this).getAccounts();
@ -386,19 +386,19 @@ public class Accounts extends K9ListActivity implements OnItemClickListener, OnC
private void refresh() private void refresh()
{ {
BaseAccount[] accounts = Preferences.getPreferences(this).getAccounts(); BaseAccount[] accounts = Preferences.getPreferences(this).getAccounts();
List<BaseAccount> newAccounts = new ArrayList<BaseAccount>(accounts.length + 4); List<BaseAccount> newAccounts = new ArrayList<BaseAccount>(accounts.length + 4);
if (accounts.length > 0) if (accounts.length > 0)
{ {
newAccounts.add(integratedInboxAccount); newAccounts.add(integratedInboxAccount);
newAccounts.add(unreadAccount); newAccounts.add(unreadAccount);
} }
for (BaseAccount account : accounts) for (BaseAccount account : accounts)
{ {
newAccounts.add(account); newAccounts.add(account);
} }
mAdapter = new AccountsAdapter(newAccounts.toArray(new BaseAccount[0])); mAdapter = new AccountsAdapter(newAccounts.toArray(new BaseAccount[0]));
getListView().setAdapter(mAdapter); getListView().setAdapter(mAdapter);
if (newAccounts.size() > 0) if (newAccounts.size() > 0)
@ -409,7 +409,7 @@ public class Accounts extends K9ListActivity implements OnItemClickListener, OnC
for (BaseAccount account : newAccounts) for (BaseAccount account : newAccounts)
{ {
if (account instanceof Account) if (account instanceof Account)
{ {
pendingWork.put(account, "true"); pendingWork.put(account, "true");
@ -420,7 +420,7 @@ public class Accounts extends K9ListActivity implements OnItemClickListener, OnC
{ {
pendingWork.put(account, "true"); pendingWork.put(account, "true");
final SearchAccount searchAccount = (SearchAccount)account; final SearchAccount searchAccount = (SearchAccount)account;
MessagingController.getInstance(getApplication()).searchLocalMessages(searchAccount, null, new MessagingListener() MessagingController.getInstance(getApplication()).searchLocalMessages(searchAccount, null, new MessagingListener()
{ {
@Override @Override
@ -431,7 +431,7 @@ public class Accounts extends K9ListActivity implements OnItemClickListener, OnC
}); });
} }
} }
} }
private void onAddNewAccount() private void onAddNewAccount()
@ -556,7 +556,7 @@ public class Accounts extends K9ListActivity implements OnItemClickListener, OnC
public void onClick(DialogInterface dialog, int whichButton) public void onClick(DialogInterface dialog, int whichButton)
{ {
dismissDialog(DIALOG_REMOVE_ACCOUNT); dismissDialog(DIALOG_REMOVE_ACCOUNT);
if (mSelectedContextAccount instanceof Account) if (mSelectedContextAccount instanceof Account)
{ {
Account realAccount = (Account)mSelectedContextAccount; Account realAccount = (Account)mSelectedContextAccount;
@ -684,7 +684,7 @@ public class Accounts extends K9ListActivity implements OnItemClickListener, OnC
{ {
String appName = getString(R.string.app_name); String appName = getString(R.string.app_name);
WebView wv = new WebView(this); WebView wv = new WebView(this);
String html = "<meta http-equiv=\"content-type\" content=\"text/html; charset=utf-8\" />" + String html = "<meta http-equiv=\"content-type\" content=\"text/html; charset=utf-8\" />" +
"<h1>" + String.format(getString(R.string.about_title_fmt), "<h1>" + String.format(getString(R.string.about_title_fmt),
"<a href=\"" + getString(R.string.app_webpage_url) + "\">" + appName + "</a>") + "</h1>" + "<a href=\"" + getString(R.string.app_webpage_url) + "\">" + appName + "</a>") + "</h1>" +
"<p>" + appName + " " + "<p>" + appName + " " +
@ -748,7 +748,7 @@ public class Accounts extends K9ListActivity implements OnItemClickListener, OnC
super.onCreateContextMenu(menu, v, menuInfo); super.onCreateContextMenu(menu, v, menuInfo);
menu.setHeaderTitle(R.string.accounts_context_menu_title); menu.setHeaderTitle(R.string.accounts_context_menu_title);
getMenuInflater().inflate(R.menu.accounts_context, menu); getMenuInflater().inflate(R.menu.accounts_context, menu);
AdapterContextMenuInfo info = (AdapterContextMenuInfo) menuInfo; AdapterContextMenuInfo info = (AdapterContextMenuInfo) menuInfo;
BaseAccount account = mAdapter.getItem(info.position); BaseAccount account = mAdapter.getItem(info.position);
if (account instanceof SearchAccount) if (account instanceof SearchAccount)
@ -799,7 +799,7 @@ public class Accounts extends K9ListActivity implements OnItemClickListener, OnC
view.setTag(holder); view.setTag(holder);
} }
AccountStats stats = accountStats.get(account.getUuid()); AccountStats stats = accountStats.get(account.getUuid());
if (stats != null && account instanceof Account && stats.size >= 0) if (stats != null && account instanceof Account && stats.size >= 0)
{ {
holder.email.setText(SizeFormatter.formatSize(Accounts.this, stats.size)); holder.email.setText(SizeFormatter.formatSize(Accounts.this, stats.size));
@ -808,7 +808,7 @@ public class Accounts extends K9ListActivity implements OnItemClickListener, OnC
{ {
holder.email.setText(account.getEmail()); holder.email.setText(account.getEmail());
} }
String description = account.getDescription(); String description = account.getDescription();
if (description == null || description.length() == 0) if (description == null || description.length() == 0)
{ {
@ -816,25 +816,25 @@ public class Accounts extends K9ListActivity implements OnItemClickListener, OnC
} }
holder.description.setText(description); holder.description.setText(description);
if (account.getEmail().equals(account.getDescription())) if (account.getEmail().equals(account.getDescription()))
{ {
holder.email.setVisibility(View.GONE); holder.email.setVisibility(View.GONE);
} }
Integer unreadMessageCount = null; Integer unreadMessageCount = null;
if (stats != null) if (stats != null)
{ {
unreadMessageCount = stats.unreadMessageCount; unreadMessageCount = stats.unreadMessageCount;
holder.newMessageCount.setText(Integer.toString(unreadMessageCount)); holder.newMessageCount.setText(Integer.toString(unreadMessageCount));
holder.newMessageCount.setVisibility(unreadMessageCount > 0 ? View.VISIBLE : View.GONE); holder.newMessageCount.setVisibility(unreadMessageCount > 0 ? View.VISIBLE : View.GONE);
holder.flaggedMessageCount.setText(Integer.toString(stats.flaggedMessageCount)); holder.flaggedMessageCount.setText(Integer.toString(stats.flaggedMessageCount));
holder.flaggedMessageCount.setVisibility(K9.messageListStars() && stats.flaggedMessageCount > 0 ? View.VISIBLE : View.GONE); holder.flaggedMessageCount.setVisibility(K9.messageListStars() && stats.flaggedMessageCount > 0 ? View.VISIBLE : View.GONE);
holder.flaggedMessageCount.setOnClickListener(new AccountClickListener(account, SearchModifier.FLAGGED)); holder.flaggedMessageCount.setOnClickListener(new AccountClickListener(account, SearchModifier.FLAGGED));
holder.newMessageCount.setOnClickListener(new AccountClickListener(account, SearchModifier.UNREAD)); holder.newMessageCount.setOnClickListener(new AccountClickListener(account, SearchModifier.UNREAD));
holder.activeIcons.setOnClickListener(new OnClickListener() holder.activeIcons.setOnClickListener(new OnClickListener()
{ {
public void onClick(View v) public void onClick(View v)
@ -843,7 +843,7 @@ public class Accounts extends K9ListActivity implements OnItemClickListener, OnC
toast.show(); toast.show();
} }
} }
); );
} }
else else
@ -912,13 +912,13 @@ public class Accounts extends K9ListActivity implements OnItemClickListener, OnC
} }
return flags.toArray(new Flag[0]); return flags.toArray(new Flag[0]);
} }
private class AccountClickListener implements OnClickListener private class AccountClickListener implements OnClickListener
{ {
final BaseAccount account; final BaseAccount account;
final SearchModifier searchModifier; final SearchModifier searchModifier;
AccountClickListener(BaseAccount nAccount, SearchModifier nSearchModifier ) AccountClickListener(BaseAccount nAccount, SearchModifier nSearchModifier)
{ {
account = nAccount; account = nAccount;
searchModifier = nSearchModifier; searchModifier = nSearchModifier;
@ -930,11 +930,11 @@ public class Accounts extends K9ListActivity implements OnItemClickListener, OnC
if (account instanceof SearchAccount) if (account instanceof SearchAccount)
{ {
SearchAccount searchAccount = (SearchAccount)account; SearchAccount searchAccount = (SearchAccount)account;
MessageList.actionHandle(Accounts.this, MessageList.actionHandle(Accounts.this,
description, "", searchAccount.isIntegrate(), description, "", searchAccount.isIntegrate(),
combine(searchAccount.getRequiredFlags(), searchModifier.requiredFlags), combine(searchAccount.getRequiredFlags(), searchModifier.requiredFlags),
combine(searchAccount.getForbiddenFlags(), searchModifier.forbiddenFlags)); combine(searchAccount.getForbiddenFlags(), searchModifier.forbiddenFlags));
} }
else else
{ {
@ -975,12 +975,12 @@ public class Accounts extends K9ListActivity implements OnItemClickListener, OnC
{ {
return null; return null;
} }
}; };
MessageList.actionHandle(Accounts.this, description, searchSpec); MessageList.actionHandle(Accounts.this, description, searchSpec);
} }
} }
} }
} }

View File

@ -74,7 +74,8 @@ public class EditIdentity extends K9Activity
mSignatureUse = (CheckBox)findViewById(R.id.signature_use); mSignatureUse = (CheckBox)findViewById(R.id.signature_use);
mSignatureView = (EditText)findViewById(R.id.signature); mSignatureView = (EditText)findViewById(R.id.signature);
mSignatureUse.setChecked(mIdentity.getSignatureUse()); mSignatureUse.setChecked(mIdentity.getSignatureUse());
mSignatureUse.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { mSignatureUse.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener()
{
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) public void onCheckedChanged(CompoundButton buttonView, boolean isChecked)
{ {
if (isChecked) if (isChecked)

View File

@ -78,8 +78,8 @@ public class FolderList extends K9ListActivity
{ {
public void run() public void run()
{ {
String dispString = mAdapter.mListener.formatHeader(FolderList.this, String dispString = mAdapter.mListener.formatHeader(FolderList.this,
getString(R.string.folder_list_title, mAccount.getDescription()), mUnreadMessageCount, getTimeFormat()); getString(R.string.folder_list_title, mAccount.getDescription()), mUnreadMessageCount, getTimeFormat());
setTitle(dispString); setTitle(dispString);
@ -269,7 +269,7 @@ public class FolderList extends K9ListActivity
} }
}); });
registerForContextMenu(mListView); registerForContextMenu(mListView);
mListView.setSaveEnabled(true); mListView.setSaveEnabled(true);
mInflater = getLayoutInflater(); mInflater = getLayoutInflater();
@ -382,7 +382,7 @@ public class FolderList extends K9ListActivity
toast.show(); toast.show();
return true; return true;
} }
case KeyEvent.KEYCODE_1: case KeyEvent.KEYCODE_1:
{ {
setDisplayMode(FolderMode.FIRST_CLASS); setDisplayMode(FolderMode.FIRST_CLASS);
@ -419,8 +419,8 @@ public class FolderList extends K9ListActivity
} }
onRefresh(false); onRefresh(false);
} }
private void onRefresh(final boolean forceRemote) private void onRefresh(final boolean forceRemote)
{ {
@ -1113,14 +1113,14 @@ public class FolderList extends K9ListActivity
super.pendingCommandsFinished(account); super.pendingCommandsFinished(account);
mHandler.refreshTitle(); mHandler.refreshTitle();
} }
@Override @Override
public void pendingCommandStarted(Account account, String commandTitle) public void pendingCommandStarted(Account account, String commandTitle)
{ {
super.pendingCommandStarted(account, commandTitle); super.pendingCommandStarted(account, commandTitle);
mHandler.refreshTitle(); mHandler.refreshTitle();
} }
@Override @Override
public void pendingCommandCompleted(Account account, String commandTitle) public void pendingCommandCompleted(Account account, String commandTitle)
{ {
@ -1249,11 +1249,11 @@ public class FolderList extends K9ListActivity
{ {
holder.newMessageCount.setVisibility(View.GONE); holder.newMessageCount.setVisibility(View.GONE);
} }
if (K9.messageListStars() && folder.flaggedMessageCount > 0) if (K9.messageListStars() && folder.flaggedMessageCount > 0)
{ {
holder.flaggedMessageCount.setText(Integer holder.flaggedMessageCount.setText(Integer
.toString(folder.flaggedMessageCount)); .toString(folder.flaggedMessageCount));
holder.flaggedMessageCount.setOnClickListener(new FolderClickListener(mAccount, folder.name, folder.displayName, SearchModifier.FLAGGED)); holder.flaggedMessageCount.setOnClickListener(new FolderClickListener(mAccount, folder.name, folder.displayName, SearchModifier.FLAGGED));
holder.flaggedMessageCount.setVisibility(View.VISIBLE); holder.flaggedMessageCount.setVisibility(View.VISIBLE);
} }
@ -1269,8 +1269,8 @@ public class FolderList extends K9ListActivity
toast.show(); toast.show();
} }
} }
); );
holder.chip.setBackgroundColor(mAccount.getChipColor()); holder.chip.setBackgroundColor(mAccount.getChipColor());
holder.chip.getBackground().setAlpha(folder.unreadMessageCount == 0 ? 127 : 255); holder.chip.getBackground().setAlpha(folder.unreadMessageCount == 0 ? 127 : 255);
@ -1303,7 +1303,7 @@ public class FolderList extends K9ListActivity
public long lastChecked; public long lastChecked;
public int unreadMessageCount; public int unreadMessageCount;
public int flaggedMessageCount; public int flaggedMessageCount;
public boolean loading; public boolean loading;
@ -1325,7 +1325,7 @@ public class FolderList extends K9ListActivity
{ {
return this.name.equals(((FolderInfoHolder)o).name); return this.name.equals(((FolderInfoHolder)o).name);
} }
@Override @Override
public int hashCode() public int hashCode()
{ {
@ -1364,7 +1364,7 @@ public class FolderList extends K9ListActivity
try try
{ {
folder.open(Folder.OpenMode.READ_WRITE); folder.open(Folder.OpenMode.READ_WRITE);
// unreadCount = folder.getUnreadMessageCount(); // unreadCount = folder.getUnreadMessageCount();
} }
catch (MessagingException me) catch (MessagingException me)
{ {
@ -1410,7 +1410,7 @@ public class FolderList extends K9ListActivity
this.status = mess; this.status = mess;
this.unreadMessageCount = unreadCount; this.unreadMessageCount = unreadCount;
try try
{ {
this.flaggedMessageCount = folder.getFlaggedMessageCount(); this.flaggedMessageCount = folder.getFlaggedMessageCount();
@ -1438,15 +1438,15 @@ public class FolderList extends K9ListActivity
public String rawFolderName; public String rawFolderName;
public View chip; public View chip;
} }
private class FolderClickListener implements OnClickListener private class FolderClickListener implements OnClickListener
{ {
final BaseAccount account; final BaseAccount account;
final String folderName; final String folderName;
final String displayName; final String displayName;
final SearchModifier searchModifier; final SearchModifier searchModifier;
FolderClickListener(BaseAccount nAccount, String folderName, String displayName, SearchModifier nSearchModifier ) FolderClickListener(BaseAccount nAccount, String folderName, String displayName, SearchModifier nSearchModifier)
{ {
account = nAccount; account = nAccount;
this.folderName = folderName; this.folderName = folderName;
@ -1456,10 +1456,10 @@ public class FolderList extends K9ListActivity
@Override @Override
public void onClick(View v) public void onClick(View v)
{ {
String description = getString(R.string.search_title, String description = getString(R.string.search_title,
getString(R.string.message_list_title, account.getDescription(), displayName), getString(R.string.message_list_title, account.getDescription(), displayName),
getString(searchModifier.resId)); getString(searchModifier.resId));
SearchSpecification searchSpec = new SearchSpecification() SearchSpecification searchSpec = new SearchSpecification()
{ {
@Override @Override
@ -1497,14 +1497,14 @@ public class FolderList extends K9ListActivity
{ {
return new String[] { folderName }; return new String[] { folderName };
} }
}; };
MessageList.actionHandle(FolderList.this, description, searchSpec); MessageList.actionHandle(FolderList.this, description, searchSpec);
} }
} }
} }

View File

@ -379,7 +379,7 @@ public class MessageCompose extends K9Activity implements OnClickListener, OnFoc
if ("mailto".equals(uri.getScheme())) if ("mailto".equals(uri.getScheme()))
{ {
initializeFromMailTo(uri.toString()); initializeFromMailTo(uri.toString());
} }
else else
{ {
String toText = uri.getSchemeSpecificPart(); String toText = uri.getSchemeSpecificPart();
@ -980,11 +980,13 @@ public class MessageCompose extends K9Activity implements OnClickListener, OnFoc
File f = new File(uriString.substring("file://".length())); File f = new File(uriString.substring("file://".length()));
attachment.size = f.length(); attachment.size = f.length();
} }
else { else
{
Log.v(K9.LOG_TAG, "Not a file: " + uriString); Log.v(K9.LOG_TAG, "Not a file: " + uriString);
} }
} }
else { else
{
Log.v(K9.LOG_TAG, "old attachment.size: " + attachment.size); Log.v(K9.LOG_TAG, "old attachment.size: " + attachment.size);
} }
Log.v(K9.LOG_TAG, "new attachment.size: " + attachment.size); Log.v(K9.LOG_TAG, "new attachment.size: " + attachment.size);
@ -1575,7 +1577,7 @@ public class MessageCompose extends K9Activity implements OnClickListener, OnFoc
mDraftUid = newUid; mDraftUid = newUid;
} }
} }
if (account.equals(mAccount) && (folder.equals(mFolder))) if (account.equals(mAccount) && (folder.equals(mFolder)))
{ {
if (oldUid.equals(mSourceMessageUid)) if (oldUid.equals(mSourceMessageUid))
@ -1591,7 +1593,7 @@ public class MessageCompose extends K9Activity implements OnClickListener, OnFoc
} }
private String decode(String s) private String decode(String s)
throws UnsupportedEncodingException throws UnsupportedEncodingException
{ {
return URLDecoder.decode(s, "UTF-8"); return URLDecoder.decode(s, "UTF-8");
} }
@ -1599,14 +1601,15 @@ public class MessageCompose extends K9Activity implements OnClickListener, OnFoc
/** /**
* When we are launched with an intent that includes a mailto: URI, we can actually * When we are launched with an intent that includes a mailto: URI, we can actually
* gather quite a few of our message fields from it. * gather quite a few of our message fields from it.
* *
* @mailToString the href (which must start with "mailto:"). * @mailToString the href (which must start with "mailto:").
*/ */
private void initializeFromMailTo(String mailToString) { private void initializeFromMailTo(String mailToString)
{
// Chop up everything between mailto: and ? to find recipients // Chop up everything between mailto: and ? to find recipients
int index = mailToString.indexOf("?"); int index = mailToString.indexOf("?");
int length = "mailto".length() + 1; int length = "mailto".length() + 1;
String to; String to;
try try
{ {
@ -1614,13 +1617,13 @@ public class MessageCompose extends K9Activity implements OnClickListener, OnFoc
if (index == -1) if (index == -1)
{ {
to = decode(mailToString.substring(length)); to = decode(mailToString.substring(length));
} }
else else
{ {
to = decode(mailToString.substring(length, index)); to = decode(mailToString.substring(length, index));
} }
mToView.setText(to); mToView.setText(to);
} }
catch (UnsupportedEncodingException e) catch (UnsupportedEncodingException e)
{ {
Log.e(K9.LOG_TAG, e.getMessage() + " while decoding '" + mailToString + "'"); Log.e(K9.LOG_TAG, e.getMessage() + " while decoding '" + mailToString + "'");
@ -1660,5 +1663,5 @@ public class MessageCompose extends K9Activity implements OnClickListener, OnFoc
{ {
mMessageContentView.setText(body.get(0)); mMessageContentView.setText(body.get(0));
} }
} }
} }

View File

@ -57,7 +57,7 @@ public class MessageList
private static final int ACTIVITY_CHOOSE_FOLDER_MOVE = 1; private static final int ACTIVITY_CHOOSE_FOLDER_MOVE = 1;
private static final int ACTIVITY_CHOOSE_FOLDER_COPY = 2; private static final int ACTIVITY_CHOOSE_FOLDER_COPY = 2;
private static final int ACTIVITY_CHOOSE_FOLDER_MOVE_BATCH = 3; private static final int ACTIVITY_CHOOSE_FOLDER_MOVE_BATCH = 3;
private static final int ACTIVITY_CHOOSE_FOLDER_COPY_BATCH = 4; private static final int ACTIVITY_CHOOSE_FOLDER_COPY_BATCH = 4;
@ -67,7 +67,7 @@ public class MessageList
private static final String EXTRA_QUERY_FLAGS = "queryFlags"; private static final String EXTRA_QUERY_FLAGS = "queryFlags";
private static final String EXTRA_FORBIDDEN_FLAGS = "forbiddenFlags"; private static final String EXTRA_FORBIDDEN_FLAGS = "forbiddenFlags";
private static final String EXTRA_INTEGRATE = "integrate"; private static final String EXTRA_INTEGRATE = "integrate";
private static final String EXTRA_ACCOUNT_UUIDS = "accountUuids"; private static final String EXTRA_ACCOUNT_UUIDS = "accountUuids";
private static final String EXTRA_FOLDER_NAMES = "folderNames"; private static final String EXTRA_FOLDER_NAMES = "folderNames";
private static final String EXTRA_TITLE = "title"; private static final String EXTRA_TITLE = "title";
@ -312,7 +312,7 @@ public class MessageList
} }
return intent; return intent;
} }
public static void actionHandle(Context context, String title, String queryString, boolean integrate, Flag[] flags, Flag[] forbiddenFlags) public static void actionHandle(Context context, String title, String queryString, boolean integrate, Flag[] flags, Flag[] forbiddenFlags)
{ {
Intent intent = new Intent(context, MessageList.class); Intent intent = new Intent(context, MessageList.class);
@ -330,7 +330,7 @@ public class MessageList
context.startActivity(intent); context.startActivity(intent);
} }
public static void actionHandle(Context context, String title, SearchSpecification searchSpecification) public static void actionHandle(Context context, String title, SearchSpecification searchSpecification)
{ {
Intent intent = new Intent(context, MessageList.class); Intent intent = new Intent(context, MessageList.class);
@ -348,7 +348,7 @@ public class MessageList
intent.putExtra(EXTRA_FOLDER_NAMES, searchSpecification.getFolderNames()); intent.putExtra(EXTRA_FOLDER_NAMES, searchSpecification.getFolderNames());
intent.putExtra(EXTRA_TITLE, title); intent.putExtra(EXTRA_TITLE, title);
context.startActivity(intent); context.startActivity(intent);
} }
public void onItemClick(AdapterView<?> parent, View view, int position, long id) public void onItemClick(AdapterView<?> parent, View view, int position, long id)
@ -394,7 +394,7 @@ public class MessageList
mAccount = Preferences.getPreferences(this).getAccount(accountUuid); mAccount = Preferences.getPreferences(this).getAccount(accountUuid);
mFolderName = intent.getStringExtra(EXTRA_FOLDER); mFolderName = intent.getStringExtra(EXTRA_FOLDER);
mQueryString = intent.getStringExtra(EXTRA_QUERY); mQueryString = intent.getStringExtra(EXTRA_QUERY);
String queryFlags = intent.getStringExtra(EXTRA_QUERY_FLAGS); String queryFlags = intent.getStringExtra(EXTRA_QUERY_FLAGS);
if (queryFlags != null) if (queryFlags != null)
{ {
@ -417,9 +417,9 @@ public class MessageList
} }
mIntegrate = intent.getBooleanExtra(EXTRA_INTEGRATE, false); mIntegrate = intent.getBooleanExtra(EXTRA_INTEGRATE, false);
mAccountUuids = intent.getStringArrayExtra(EXTRA_ACCOUNT_UUIDS); mAccountUuids = intent.getStringArrayExtra(EXTRA_ACCOUNT_UUIDS);
mFolderNames = intent.getStringArrayExtra(EXTRA_FOLDER_NAMES); mFolderNames = intent.getStringArrayExtra(EXTRA_FOLDER_NAMES);
mTitle = intent.getStringExtra(EXTRA_TITLE); mTitle = intent.getStringExtra(EXTRA_TITLE);
// Take the initial folder into account only if we are *not* restoring the // Take the initial folder into account only if we are *not* restoring the
// activity already // activity already
@ -498,7 +498,7 @@ public class MessageList
} }
private void initializeLayout () private void initializeLayout()
{ {
requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS); requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS);
requestWindowFeature(Window.FEATURE_PROGRESS); requestWindowFeature(Window.FEATURE_PROGRESS);
@ -633,7 +633,7 @@ public class MessageList
onDelete(message, position); onDelete(message, position);
return true; return true;
} }
case KeyEvent.KEYCODE_S: case KeyEvent.KEYCODE_S:
{ {
setSelected(message, !message.selected); setSelected(message, !message.selected);
@ -695,7 +695,7 @@ public class MessageList
{ {
result = super.onKeyDown(keyCode, event); result = super.onKeyDown(keyCode, event);
} }
return result; return result;
}//onKeyDown }//onKeyDown
@ -1087,7 +1087,7 @@ public class MessageList
int itemId = item.getItemId(); int itemId = item.getItemId();
switch (itemId) switch (itemId)
{ {
case R.id.compose: case R.id.compose:
onCompose(); onCompose();
@ -1137,7 +1137,7 @@ public class MessageList
setAllSelected(false); setAllSelected(false);
toggleBatchButtons(); toggleBatchButtons();
return true; return true;
case R.id.batch_delete_op: case R.id.batch_delete_op:
deleteSelected(); deleteSelected();
return true; return true;
@ -1209,7 +1209,7 @@ public class MessageList
onMoveBatch(); onMoveBatch();
return true; return true;
case R.id.expunge: case R.id.expunge:
if (mCurrentFolder != null) if (mCurrentFolder != null)
{ {
@ -1243,7 +1243,7 @@ public class MessageList
{ {
boolean anySelected = anySelected(); boolean anySelected = anySelected();
setOpsState(menu, true, anySelected); setOpsState(menu, true, anySelected);
if (mQueryString != null) if (mQueryString != null)
{ {
menu.findItem(R.id.mark_all_as_read).setVisible(false); menu.findItem(R.id.mark_all_as_read).setVisible(false);
@ -1656,14 +1656,14 @@ public class MessageList
{ {
addOrUpdateMessage(account, folder, message); addOrUpdateMessage(account, folder, message);
} }
@Override @Override
public void searchStats(AccountStats stats) public void searchStats(AccountStats stats)
{ {
mUnreadMessageCount = stats.unreadMessageCount; mUnreadMessageCount = stats.unreadMessageCount;
mHandler.refreshTitle(); mHandler.refreshTitle();
} }
@Override @Override
public void folderStatusChanged(Account account, String folder, int unreadMessageCount) public void folderStatusChanged(Account account, String folder, int unreadMessageCount)
{ {
@ -2277,7 +2277,7 @@ public class MessageList
{ {
return (this.uid.equals(((MessageInfoHolder)o).uid)); return (this.uid.equals(((MessageInfoHolder)o).uid));
} }
@Override @Override
public int hashCode() public int hashCode()
{ {
@ -2701,7 +2701,7 @@ public class MessageList
mSelectedCount = 0; mSelectedCount = 0;
toggleBatchButtons(); toggleBatchButtons();
} }
private void onMoveBatch() private void onMoveBatch()
{ {
if (mController.isMoveCapable(mAccount) == false) if (mController.isMoveCapable(mAccount) == false)
@ -2751,7 +2751,7 @@ public class MessageList
} }
} }
mAdapter.removeMessages(removeHolderList); mAdapter.removeMessages(removeHolderList);
mController.moveMessages(mAccount, mCurrentFolder.name, messageList.toArray(new Message[0]), folderName, null); mController.moveMessages(mAccount, mCurrentFolder.name, messageList.toArray(new Message[0]), folderName, null);
mSelectedCount = 0; mSelectedCount = 0;
toggleBatchButtons(); toggleBatchButtons();
@ -2802,7 +2802,7 @@ public class MessageList
messageList.add(holder.message); messageList.add(holder.message);
} }
} }
mController.copyMessages(mAccount, mCurrentFolder.name, messageList.toArray(new Message[0]), folderName, null); mController.copyMessages(mAccount, mCurrentFolder.name, messageList.toArray(new Message[0]), folderName, null);
} }
} }

View File

@ -7,7 +7,7 @@ public class MessageReference implements Serializable
String accountUuid; String accountUuid;
String folderName; String folderName;
String uid; String uid;
public boolean equals(Object o) public boolean equals(Object o)
{ {
if (o instanceof MessageReference == false) if (o instanceof MessageReference == false)
@ -26,9 +26,9 @@ public class MessageReference implements Serializable
public String toString() public String toString()
{ {
return "MessageReference{accountUuid = '" + return "MessageReference{accountUuid = '" +
accountUuid accountUuid
+ "', folderName = '" + folderName + "', folderName = '" + folderName
+ "', uid = '" + uid + "', uid = '" + uid
+ "'}"; + "'}";
} }
} }

View File

@ -279,7 +279,7 @@ public class MessageView extends K9Activity implements OnClickListener
mTimeView.setText(time); mTimeView.setText(time);
mToView.setText(to); mToView.setText(to);
mCcContainerView.setVisibility((cc != null && cc.length() > 0 )? View.VISIBLE : View.GONE); mCcContainerView.setVisibility((cc != null && cc.length() > 0)? View.VISIBLE : View.GONE);
mCcView.setText(cc); mCcView.setText(cc);
mAttachmentIcon.setVisibility(hasAttachments ? View.VISIBLE : View.GONE); mAttachmentIcon.setVisibility(hasAttachments ? View.VISIBLE : View.GONE);
@ -451,7 +451,7 @@ public class MessageView extends K9Activity implements OnClickListener
mCcContainerView = (LinearLayout)findViewById(R.id.cc_container); mCcContainerView = (LinearLayout)findViewById(R.id.cc_container);
mSubjectView = (TextView)findViewById(R.id.subject); mSubjectView = (TextView)findViewById(R.id.subject);
defaultSubjectColor = mSubjectView.getCurrentTextColor(); defaultSubjectColor = mSubjectView.getCurrentTextColor();
chip = findViewById(R.id.chip); chip = findViewById(R.id.chip);
mDateView = (TextView)findViewById(R.id.date); mDateView = (TextView)findViewById(R.id.date);
@ -557,12 +557,12 @@ public class MessageView extends K9Activity implements OnClickListener
Toast.makeText(this, "Invalid account id: " + accountId, Toast.LENGTH_LONG).show(); Toast.makeText(this, "Invalid account id: " + accountId, Toast.LENGTH_LONG).show();
return; return;
} }
mMessageReference = new MessageReference(); mMessageReference = new MessageReference();
mMessageReference.accountUuid = mAccount.getUuid(); mMessageReference.accountUuid = mAccount.getUuid();
mMessageReference.folderName = segmentList.get(1); mMessageReference.folderName = segmentList.get(1);
mMessageReference.uid = segmentList.get(2); mMessageReference.uid = segmentList.get(2);
mMessageReferences = new ArrayList<MessageReference>(); mMessageReferences = new ArrayList<MessageReference>();
} }
else else
@ -631,9 +631,9 @@ public class MessageView extends K9Activity implements OnClickListener
mMessageReference = ref; mMessageReference = ref;
if (K9.DEBUG) if (K9.DEBUG)
Log.d(K9.LOG_TAG, "MessageView displaying message " + mMessageReference); Log.d(K9.LOG_TAG, "MessageView displaying message " + mMessageReference);
mAccount = Preferences.getPreferences(this).getAccount(ref.accountUuid); mAccount = Preferences.getPreferences(this).getAccount(ref.accountUuid);
mMessageContentView.getSettings().setBlockNetworkImage(true); mMessageContentView.getSettings().setBlockNetworkImage(true);
K9.setBlockNetworkLoads(mMessageContentView.getSettings(), true); K9.setBlockNetworkLoads(mMessageContentView.getSettings(), true);
@ -1052,7 +1052,7 @@ public class MessageView extends K9Activity implements OnClickListener
mShowPicturesSection.setVisibility(View.GONE); mShowPicturesSection.setVisibility(View.GONE);
} }
public void onClick(View view) public void onClick(View view)
{ {
switch (view.getId()) switch (view.getId())
@ -1347,7 +1347,7 @@ public class MessageView extends K9Activity implements OnClickListener
public void loadMessageForViewHeadersAvailable(Account account, String folder, String uid, public void loadMessageForViewHeadersAvailable(Account account, String folder, String uid,
final Message message) final Message message)
{ {
if (!mMessageReference.uid.equals(uid) || !mMessageReference.folderName.equals(folder) if (!mMessageReference.uid.equals(uid) || !mMessageReference.folderName.equals(folder)
|| !mMessageReference.accountUuid.equals(account.getUuid())) || !mMessageReference.accountUuid.equals(account.getUuid()))
{ {
return; return;
@ -1355,7 +1355,7 @@ public class MessageView extends K9Activity implements OnClickListener
MessageView.this.mMessage = message; MessageView.this.mMessage = message;
if (!message.isSet(Flag.X_DOWNLOADED_FULL) if (!message.isSet(Flag.X_DOWNLOADED_FULL)
&& !message.isSet(Flag.X_DOWNLOADED_PARTIAL)) && !message.isSet(Flag.X_DOWNLOADED_PARTIAL))
{ {
mHandler.post(new Runnable() mHandler.post(new Runnable()
{ {
@ -1379,7 +1379,7 @@ public class MessageView extends K9Activity implements OnClickListener
public void loadMessageForViewBodyAvailable(Account account, String folder, String uid, public void loadMessageForViewBodyAvailable(Account account, String folder, String uid,
Message message) Message message)
{ {
if (!mMessageReference.uid.equals(uid) || !mMessageReference.folderName.equals(folder) if (!mMessageReference.uid.equals(uid) || !mMessageReference.folderName.equals(folder)
|| !mMessageReference.accountUuid.equals(account.getUuid())) || !mMessageReference.accountUuid.equals(account.getUuid()))
{ {
return; return;
@ -1388,8 +1388,8 @@ public class MessageView extends K9Activity implements OnClickListener
try try
{ {
if (MessageView.this.mMessage!=null if (MessageView.this.mMessage!=null
&& MessageView.this.mMessage.isSet(Flag.X_DOWNLOADED_PARTIAL) && MessageView.this.mMessage.isSet(Flag.X_DOWNLOADED_PARTIAL)
&& message.isSet(Flag.X_DOWNLOADED_FULL)) && message.isSet(Flag.X_DOWNLOADED_FULL))
{ {
setHeaders(account, folder, uid, message); setHeaders(account, folder, uid, message);
@ -1467,7 +1467,7 @@ public class MessageView extends K9Activity implements OnClickListener
public void loadMessageForViewFailed(Account account, String folder, String uid, public void loadMessageForViewFailed(Account account, String folder, String uid,
final Throwable t) final Throwable t)
{ {
if (!mMessageReference.uid.equals(uid) || !mMessageReference.folderName.equals(folder) if (!mMessageReference.uid.equals(uid) || !mMessageReference.folderName.equals(folder)
|| !mMessageReference.accountUuid.equals(account.getUuid())) || !mMessageReference.accountUuid.equals(account.getUuid()))
{ {
return; return;
@ -1498,7 +1498,7 @@ public class MessageView extends K9Activity implements OnClickListener
public void loadMessageForViewFinished(Account account, String folder, String uid, public void loadMessageForViewFinished(Account account, String folder, String uid,
Message message) Message message)
{ {
if (!mMessageReference.uid.equals(uid) || !mMessageReference.folderName.equals(folder) if (!mMessageReference.uid.equals(uid) || !mMessageReference.folderName.equals(folder)
|| !mMessageReference.accountUuid.equals(account.getUuid())) || !mMessageReference.accountUuid.equals(account.getUuid()))
{ {
return; return;
@ -1516,7 +1516,7 @@ public class MessageView extends K9Activity implements OnClickListener
@Override @Override
public void loadMessageForViewStarted(Account account, String folder, String uid) public void loadMessageForViewStarted(Account account, String folder, String uid)
{ {
if (!mMessageReference.uid.equals(uid) || !mMessageReference.folderName.equals(folder) if (!mMessageReference.uid.equals(uid) || !mMessageReference.folderName.equals(folder)
|| !mMessageReference.accountUuid.equals(account.getUuid())) || !mMessageReference.accountUuid.equals(account.getUuid()))
{ {
return; return;

View File

@ -1,5 +1,5 @@
/** /**
* *
*/ */
package com.fsck.k9.activity; package com.fsck.k9.activity;
@ -8,17 +8,17 @@ import com.fsck.k9.mail.Flag;
enum SearchModifier enum SearchModifier
{ {
FLAGGED(R.string.flagged_modifier, new Flag[] { Flag.FLAGGED}, null), UNREAD(R.string.unread_modifier, null, new Flag[] { Flag.SEEN} ); FLAGGED(R.string.flagged_modifier, new Flag[] { Flag.FLAGGED}, null), UNREAD(R.string.unread_modifier, null, new Flag[] { Flag.SEEN});
final int resId; final int resId;
final Flag[] requiredFlags; final Flag[] requiredFlags;
final Flag[] forbiddenFlags; final Flag[] forbiddenFlags;
SearchModifier(int nResId, Flag[] nRequiredFlags, Flag[] nForbiddenFlags) SearchModifier(int nResId, Flag[] nRequiredFlags, Flag[] nForbiddenFlags)
{ {
resId = nResId; resId = nResId;
requiredFlags = nRequiredFlags; requiredFlags = nRequiredFlags;
forbiddenFlags = nForbiddenFlags; forbiddenFlags = nForbiddenFlags;
} }
} }

View File

@ -249,7 +249,7 @@ public class AccountSettings extends K9PreferenceActivity
return false; return false;
} }
}); });
mSearchableFolders = (ListPreference) findPreference(PREFERENCE_SEARCHABLE_FOLDERS); mSearchableFolders = (ListPreference) findPreference(PREFERENCE_SEARCHABLE_FOLDERS);
mSearchableFolders.setValue(mAccount.getSearchableFolders().name()); mSearchableFolders.setValue(mAccount.getSearchableFolders().name());
mSearchableFolders.setSummary(mSearchableFolders.getEntry()); mSearchableFolders.setSummary(mSearchableFolders.getEntry());
@ -325,7 +325,8 @@ public class AccountSettings extends K9PreferenceActivity
mAutoExpandFolder.setSummary(translateFolder(mAccount.getAutoExpandFolderName())); mAutoExpandFolder.setSummary(translateFolder(mAccount.getAutoExpandFolderName()));
mAutoExpandFolder.setOnPreferenceClickListener( mAutoExpandFolder.setOnPreferenceClickListener(
new Preference.OnPreferenceClickListener() { new Preference.OnPreferenceClickListener()
{
public boolean onPreferenceClick(Preference preference) public boolean onPreferenceClick(Preference preference)
{ {
onChooseAutoExpandFolder(); onChooseAutoExpandFolder();
@ -338,13 +339,14 @@ public class AccountSettings extends K9PreferenceActivity
mChipColor = (Preference)findPreference(PREFERENCE_CHIP_COLOR); mChipColor = (Preference)findPreference(PREFERENCE_CHIP_COLOR);
mChipColor.setOnPreferenceClickListener( mChipColor.setOnPreferenceClickListener(
new Preference.OnPreferenceClickListener() { new Preference.OnPreferenceClickListener()
{
public boolean onPreferenceClick(Preference preference) public boolean onPreferenceClick(Preference preference)
{ {
onChooseChipColor(); onChooseChipColor();
return false; return false;
} }
} }
); );
@ -415,18 +417,18 @@ public class AccountSettings extends K9PreferenceActivity
mAccount.setDeletePolicy(Integer.parseInt(mDeletePolicy.getValue())); mAccount.setDeletePolicy(Integer.parseInt(mDeletePolicy.getValue()));
mAccount.setExpungePolicy(mExpungePolicy.getValue()); mAccount.setExpungePolicy(mExpungePolicy.getValue());
mAccount.setSearchableFolders(Account.Searchable.valueOf(mSearchableFolders.getValue())); mAccount.setSearchableFolders(Account.Searchable.valueOf(mSearchableFolders.getValue()));
boolean needsRefresh = mAccount.setAutomaticCheckIntervalMinutes(Integer.parseInt(mCheckFrequency.getValue())); boolean needsRefresh = mAccount.setAutomaticCheckIntervalMinutes(Integer.parseInt(mCheckFrequency.getValue()));
needsRefresh |= mAccount.setFolderSyncMode(Account.FolderMode.valueOf(mSyncMode.getValue())); needsRefresh |= mAccount.setFolderSyncMode(Account.FolderMode.valueOf(mSyncMode.getValue()));
boolean needsPushRestart = mAccount.setFolderPushMode(Account.FolderMode.valueOf(mPushMode.getValue())); boolean needsPushRestart = mAccount.setFolderPushMode(Account.FolderMode.valueOf(mPushMode.getValue()));
if (mAccount.getFolderPushMode() != FolderMode.NONE) if (mAccount.getFolderPushMode() != FolderMode.NONE)
{ {
needsPushRestart |= mAccount.setFolderDisplayMode(Account.FolderMode.valueOf(mDisplayMode.getValue())); needsPushRestart |= mAccount.setFolderDisplayMode(Account.FolderMode.valueOf(mDisplayMode.getValue()));
needsPushRestart |= mAccount.setMaxPushFolders(Integer.parseInt(mPushLimit.getValue())); needsPushRestart |= mAccount.setMaxPushFolders(Integer.parseInt(mPushLimit.getValue()));
needsPushRestart |= mIncomingChanged; needsPushRestart |= mIncomingChanged;
} }
SharedPreferences prefs = mAccountRingtone.getPreferenceManager().getSharedPreferences(); SharedPreferences prefs = mAccountRingtone.getPreferenceManager().getSharedPreferences();
String newRingtone = prefs.getString(PREFERENCE_RINGTONE, null); String newRingtone = prefs.getString(PREFERENCE_RINGTONE, null);
if (newRingtone != null) if (newRingtone != null)
@ -509,9 +511,14 @@ public class AccountSettings extends K9PreferenceActivity
public void onChooseChipColor() public void onChooseChipColor()
{ {
new ColorPickerDialog(this, new ColorPickerDialog.OnColorChangedListener () { new ColorPickerDialog(this, new ColorPickerDialog.OnColorChangedListener()
public void colorChanged (int color) { mAccount.setChipColor(color); } }, {
mAccount.getChipColor()).show(); public void colorChanged(int color)
{
mAccount.setChipColor(color);
}
},
mAccount.getChipColor()).show();
} }
public void onChooseAutoExpandFolder() public void onChooseAutoExpandFolder()

View File

@ -237,7 +237,7 @@ public class AccountSetupBasics extends K9Activity
URI outgoingUri = null; URI outgoingUri = null;
try try
{ {
String userEnc = URLEncoder.encode(user, "UTF-8"); String userEnc = URLEncoder.encode(user, "UTF-8");
String passwordEnc = URLEncoder.encode(password, "UTF-8"); String passwordEnc = URLEncoder.encode(password, "UTF-8");
String incomingUsername = mProvider.incomingUsernameTemplate; String incomingUsername = mProvider.incomingUsernameTemplate;
@ -343,7 +343,7 @@ public class AccountSetupBasics extends K9Activity
mAccount.setEmail(email); mAccount.setEmail(email);
try try
{ {
String userEnc = URLEncoder.encode(user, "UTF-8"); String userEnc = URLEncoder.encode(user, "UTF-8");
String passwordEnc = URLEncoder.encode(password, "UTF-8"); String passwordEnc = URLEncoder.encode(password, "UTF-8");
URI uri = new URI("placeholder", userEnc + ":" + passwordEnc, "mail." + domain, -1, null, URI uri = new URI("placeholder", userEnc + ":" + passwordEnc, "mail." + domain, -1, null,

View File

@ -69,25 +69,26 @@ public class AccountSetupComposition extends K9Activity
mAccountAlwaysBcc = (EditText)findViewById(R.id.account_always_bcc); mAccountAlwaysBcc = (EditText)findViewById(R.id.account_always_bcc);
mAccountAlwaysBcc.setText(mAccount.getAlwaysBcc()); mAccountAlwaysBcc.setText(mAccount.getAlwaysBcc());
mAccountSignatureLayout = (LinearLayout)findViewById(R.id.account_signature_layout); mAccountSignatureLayout = (LinearLayout)findViewById(R.id.account_signature_layout);
mAccountSignatureUse = (CheckBox)findViewById(R.id.account_signature_use); mAccountSignatureUse = (CheckBox)findViewById(R.id.account_signature_use);
boolean useSignature = mAccount.getSignatureUse(); boolean useSignature = mAccount.getSignatureUse();
mAccountSignatureUse.setChecked(useSignature); mAccountSignatureUse.setChecked(useSignature);
mAccountSignatureUse.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { mAccountSignatureUse.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener()
{
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) public void onCheckedChanged(CompoundButton buttonView, boolean isChecked)
{ {
if (isChecked) if (isChecked)
{ {
mAccountSignatureLayout.setVisibility(View.VISIBLE); mAccountSignatureLayout.setVisibility(View.VISIBLE);
mAccountSignature.setText(mAccount.getSignature()); mAccountSignature.setText(mAccount.getSignature());
boolean isSignatureBeforeQuotedText = mAccount.isSignatureBeforeQuotedText(); boolean isSignatureBeforeQuotedText = mAccount.isSignatureBeforeQuotedText();
mAccountSignatureBeforeLocation.setChecked(isSignatureBeforeQuotedText); mAccountSignatureBeforeLocation.setChecked(isSignatureBeforeQuotedText);
mAccountSignatureAfterLocation.setChecked(!isSignatureBeforeQuotedText); mAccountSignatureAfterLocation.setChecked(!isSignatureBeforeQuotedText);
} }
else else
{ {
mAccountSignatureLayout.setVisibility(View.GONE); mAccountSignatureLayout.setVisibility(View.GONE);
} }
} }
}); });
@ -107,7 +108,7 @@ public class AccountSetupComposition extends K9Activity
} }
else else
{ {
mAccountSignatureLayout.setVisibility(View.GONE); mAccountSignatureLayout.setVisibility(View.GONE);
} }
} }
@ -126,9 +127,9 @@ public class AccountSetupComposition extends K9Activity
mAccount.setSignatureUse(mAccountSignatureUse.isChecked()); mAccount.setSignatureUse(mAccountSignatureUse.isChecked());
if (mAccountSignatureUse.isChecked()) if (mAccountSignatureUse.isChecked())
{ {
mAccount.setSignature(mAccountSignature.getText().toString()); mAccount.setSignature(mAccountSignature.getText().toString());
boolean isSignatureBeforeQuotedText = mAccountSignatureBeforeLocation.isChecked(); boolean isSignatureBeforeQuotedText = mAccountSignatureBeforeLocation.isChecked();
mAccount.setSignatureBeforeQuotedText(isSignatureBeforeQuotedText); mAccount.setSignatureBeforeQuotedText(isSignatureBeforeQuotedText);
} }
mAccount.save(Preferences.getPreferences(this)); mAccount.save(Preferences.getPreferences(this));

View File

@ -449,8 +449,8 @@ public class AccountSetupIncoming extends K9Activity implements OnClickListener
*/ */
try try
{ {
String usernameEnc = URLEncoder.encode(mUsernameView.getText().toString(), "UTF-8"); String usernameEnc = URLEncoder.encode(mUsernameView.getText().toString(), "UTF-8");
String passwordEnc = URLEncoder.encode(mPasswordView.getText().toString(), "UTF-8"); String passwordEnc = URLEncoder.encode(mPasswordView.getText().toString(), "UTF-8");
URI oldUri = new URI(mAccount.getTransportUri()); URI oldUri = new URI(mAccount.getTransportUri());
URI uri = new URI( URI uri = new URI(
oldUri.getScheme(), oldUri.getScheme(),
@ -502,7 +502,7 @@ public class AccountSetupIncoming extends K9Activity implements OnClickListener
final String userInfo; final String userInfo;
String user = mUsernameView.getText().toString(); String user = mUsernameView.getText().toString();
String password = mPasswordView.getText().toString(); String password = mPasswordView.getText().toString();
String userEnc = URLEncoder.encode(user, "UTF-8"); String userEnc = URLEncoder.encode(user, "UTF-8");
String passwordEnc = URLEncoder.encode(password, "UTF-8"); String passwordEnc = URLEncoder.encode(password, "UTF-8");
if (mAccountSchemes[securityType].startsWith("imap")) if (mAccountSchemes[securityType].startsWith("imap"))

View File

@ -84,12 +84,12 @@ public class FolderSettings extends K9PreferenceActivity
Preference category = findPreference(PREFERENCE_TOP_CATERGORY); Preference category = findPreference(PREFERENCE_TOP_CATERGORY);
category.setTitle(folderName); category.setTitle(folderName);
mInTopGroup = (CheckBoxPreference)findPreference(PREFERENCE_IN_TOP_GROUP); mInTopGroup = (CheckBoxPreference)findPreference(PREFERENCE_IN_TOP_GROUP);
mInTopGroup.setChecked(mFolder.isInTopGroup()); mInTopGroup.setChecked(mFolder.isInTopGroup());
mIntegrate = (CheckBoxPreference)findPreference(PREFERENCE_INTEGRATE); mIntegrate = (CheckBoxPreference)findPreference(PREFERENCE_INTEGRATE);
mIntegrate.setChecked(mFolder.isIntegrate()); mIntegrate.setChecked(mFolder.isIntegrate());
mDisplayClass = (ListPreference) findPreference(PREFERENCE_DISPLAY_CLASS); mDisplayClass = (ListPreference) findPreference(PREFERENCE_DISPLAY_CLASS);
mDisplayClass.setValue(mFolder.getDisplayClass().name()); mDisplayClass.setValue(mFolder.getDisplayClass().name());
mDisplayClass.setSummary(mDisplayClass.getEntry()); mDisplayClass.setSummary(mDisplayClass.getEntry());
@ -161,14 +161,14 @@ public class FolderSettings extends K9PreferenceActivity
mFolder.setDisplayClass(FolderClass.valueOf(mDisplayClass.getValue())); mFolder.setDisplayClass(FolderClass.valueOf(mDisplayClass.getValue()));
mFolder.setSyncClass(FolderClass.valueOf(mSyncClass.getValue())); mFolder.setSyncClass(FolderClass.valueOf(mSyncClass.getValue()));
mFolder.setPushClass(FolderClass.valueOf(mPushClass.getValue())); mFolder.setPushClass(FolderClass.valueOf(mPushClass.getValue()));
FolderClass newPushClass = mFolder.getPushClass(); FolderClass newPushClass = mFolder.getPushClass();
FolderClass newDisplayClass = mFolder.getDisplayClass(); FolderClass newDisplayClass = mFolder.getDisplayClass();
try try
{ {
mFolder.save(Preferences.getPreferences(this)); mFolder.save(Preferences.getPreferences(this));
if (oldPushClass != newPushClass if (oldPushClass != newPushClass
|| (newPushClass != FolderClass.NO_CLASS && oldDisplayClass != newDisplayClass)) || (newPushClass != FolderClass.NO_CLASS && oldDisplayClass != newDisplayClass))
{ {
MailService.actionRestartPushers(getApplication(), null); MailService.actionRestartPushers(getApplication(), null);

View File

@ -13,13 +13,13 @@ import com.fsck.k9.*;
/** /**
* Activity to configure the font size of the information displayed in the * Activity to configure the font size of the information displayed in the
* account list, folder list, message list and in the message view. * account list, folder list, message list and in the message view.
* *
* @see FontSizes * @see FontSizes
*/ */
public class FontSizeSettings extends K9PreferenceActivity public class FontSizeSettings extends K9PreferenceActivity
{ {
/* /*
* Keys of the preferences defined in res/xml/font_preferences.xml * Keys of the preferences defined in res/xml/font_preferences.xml
*/ */
private static final String PREFERENCE_ACCOUNT_NAME_FONT = "account_name_font"; private static final String PREFERENCE_ACCOUNT_NAME_FONT = "account_name_font";
private static final String PREFERENCE_ACCOUNT_DESCRIPTION_FONT = "account_description_font"; private static final String PREFERENCE_ACCOUNT_DESCRIPTION_FONT = "account_description_font";
@ -54,7 +54,7 @@ public class FontSizeSettings extends K9PreferenceActivity
/** /**
* Start the FontSizeSettings activity. * Start the FontSizeSettings activity.
* *
* @param context The application context. * @param context The application context.
*/ */
public static void actionEditSettings(Context context) public static void actionEditSettings(Context context)
@ -134,10 +134,10 @@ public class FontSizeSettings extends K9PreferenceActivity
/** /**
* Set up the ListPreference instance identified by <code>key</code>. * Set up the ListPreference instance identified by <code>key</code>.
* *
* @param key The key of the ListPreference object. * @param key The key of the ListPreference object.
* @param value Initial value for the ListPreference object. * @param value Initial value for the ListPreference object.
* @return The ListPreference instance identified by <code>key</code>. * @return The ListPreference instance identified by <code>key</code>.
*/ */
private ListPreference initializeListPreference(String key, int value) private ListPreference initializeListPreference(String key, int value)
{ {
@ -149,7 +149,7 @@ public class FontSizeSettings extends K9PreferenceActivity
} }
/** /**
* This class handles value changes of the ListPreference objects. * This class handles value changes of the ListPreference objects.
*/ */
private class PreferenceChangeListener implements Preference.OnPreferenceChangeListener private class PreferenceChangeListener implements Preference.OnPreferenceChangeListener
{ {
@ -161,7 +161,7 @@ public class FontSizeSettings extends K9PreferenceActivity
} }
/** /**
* Show the preference value in the preference summary field. * Show the preference value in the preference summary field.
*/ */
@Override @Override
public boolean onPreferenceChange(Preference preference, Object newValue) public boolean onPreferenceChange(Preference preference, Object newValue)

View File

@ -82,13 +82,13 @@ public class Prefs extends K9PreferenceActivity
findPreference(PREFERENCE_FONT_SIZE).setOnPreferenceClickListener( findPreference(PREFERENCE_FONT_SIZE).setOnPreferenceClickListener(
new Preference.OnPreferenceClickListener() new Preference.OnPreferenceClickListener()
{
public boolean onPreferenceClick(Preference preference)
{ {
public boolean onPreferenceClick(Preference preference) onFontSizeSettings();
{ return true;
onFontSizeSettings(); }
return true; });
}
});
mDateFormat = (ListPreference) findPreference(PREFERENCE_DATE_FORMAT); mDateFormat = (ListPreference) findPreference(PREFERENCE_DATE_FORMAT);
String[] formats = DateFormatter.getFormats(this); String[] formats = DateFormatter.getFormats(this);
@ -152,10 +152,10 @@ public class Prefs extends K9PreferenceActivity
mTouchable = (CheckBoxPreference)findPreference(PREFERENCE_MESSAGELIST_TOUCHABLE); mTouchable = (CheckBoxPreference)findPreference(PREFERENCE_MESSAGELIST_TOUCHABLE);
mTouchable.setChecked(K9.messageListTouchable()); mTouchable.setChecked(K9.messageListTouchable());
mMeasureAccounts = (CheckBoxPreference)findPreference(PREFERENCE_MEASURE_ACCOUNTS); mMeasureAccounts = (CheckBoxPreference)findPreference(PREFERENCE_MEASURE_ACCOUNTS);
mMeasureAccounts.setChecked(K9.measureAccounts()); mMeasureAccounts.setChecked(K9.measureAccounts());
mCountSearch = (CheckBoxPreference)findPreference(PREFERENCE_COUNT_SEARCH); mCountSearch = (CheckBoxPreference)findPreference(PREFERENCE_COUNT_SEARCH);
mCountSearch.setChecked(K9.countSearchMessages()); mCountSearch.setChecked(K9.countSearchMessages());
} }

View File

@ -151,7 +151,7 @@ public class Address
} }
return super.equals(o); return super.equals(o);
} }
@Override @Override
public int hashCode() public int hashCode()
{ {

View File

@ -203,7 +203,7 @@ public abstract class Folder
{ {
} }
public boolean isInTopGroup() public boolean isInTopGroup()
{ {
return false; return false;

View File

@ -59,24 +59,24 @@ public abstract class Multipart implements Body
this.mParent = parent; this.mParent = parent;
} }
public void setEncoding(String encoding) public void setEncoding(String encoding)
{ {
for (BodyPart part : mParts) for (BodyPart part : mParts)
{ {
try try
{ {
Body body = part.getBody(); Body body = part.getBody();
if (body instanceof TextBody) if (body instanceof TextBody)
{ {
part.setHeader(MimeHeader.HEADER_CONTENT_TRANSFER_ENCODING, encoding); part.setHeader(MimeHeader.HEADER_CONTENT_TRANSFER_ENCODING, encoding);
((TextBody)body).setEncoding(encoding); ((TextBody)body).setEncoding(encoding);
} }
} }
catch (MessagingException e) catch (MessagingException e)
{ {
// Ignore // Ignore
} }
} }
} }
} }

View File

@ -457,11 +457,11 @@ public class MimeMessage extends Message
@Override @Override
public void setEncoding(String encoding) public void setEncoding(String encoding)
{ {
if (mBody instanceof Multipart) if (mBody instanceof Multipart)
{ {
((Multipart)mBody).setEncoding(encoding); ((Multipart)mBody).setEncoding(encoding);
} }
else if (mBody instanceof TextBody) else if (mBody instanceof TextBody)
{ {
setHeader(MimeHeader.HEADER_CONTENT_TRANSFER_ENCODING, encoding); setHeader(MimeHeader.HEADER_CONTENT_TRANSFER_ENCODING, encoding);
((TextBody)mBody).setEncoding(encoding); ((TextBody)mBody).setEncoding(encoding);

View File

@ -71,6 +71,6 @@ public class TextBody implements Body
public void setEncoding(String encoding) public void setEncoding(String encoding)
{ {
mEncoding = encoding; mEncoding = encoding;
} }
} }

View File

@ -440,14 +440,14 @@ public class ImapResponseParser
throw new MessagingException("Unable to parse IMAP datetime", pe); throw new MessagingException("Unable to parse IMAP datetime", pe);
} }
} }
public boolean containsKey(Object key) public boolean containsKey(Object key)
{ {
if (key == null) if (key == null)
{ {
return false; return false;
} }
for (int i = 0, count = size(); i < count; i++) for (int i = 0, count = size(); i < count; i++)
{ {
if (key.equals(get(i))) if (key.equals(get(i)))
@ -457,7 +457,7 @@ public class ImapResponseParser
} }
return false; return false;
} }
public int getKeyIndex(Object key) public int getKeyIndex(Object key)
{ {
for (int i = 0, count = size(); i < count; i++) for (int i = 0, count = size(); i < count; i++)
@ -467,7 +467,7 @@ public class ImapResponseParser
return i; return i;
} }
} }
throw new IllegalArgumentException("getKeyIndex() only works for keys that are in the collection."); throw new IllegalArgumentException("getKeyIndex() only works for keys that are in the collection.");
} }

View File

@ -64,7 +64,7 @@ public class ImapStore extends Store
private static final int IDLE_REFRESH_INTERVAL = 20 * 60 * 1000; // 20 minutes private static final int IDLE_REFRESH_INTERVAL = 20 * 60 * 1000; // 20 minutes
private static final int IDLE_FAILURE_COUNT_LIMIT = 10; private static final int IDLE_FAILURE_COUNT_LIMIT = 10;
private static int MAX_DELAY_TIME = 5 * 60 * 1000; // 5 minutes private static int MAX_DELAY_TIME = 5 * 60 * 1000; // 5 minutes
private static int NORMAL_DELAY_TIME = 5000; private static int NORMAL_DELAY_TIME = 5000;
private static final Flag[] PERMANENT_FLAGS = { Flag.DELETED, Flag.SEEN }; private static final Flag[] PERMANENT_FLAGS = { Flag.DELETED, Flag.SEEN };
@ -75,7 +75,7 @@ public class ImapStore extends Store
private static final String CAPABILITY_CAPABILITY = "CAPABILITY"; private static final String CAPABILITY_CAPABILITY = "CAPABILITY";
private static final String COMMAND_CAPABILITY = "CAPABILITY"; private static final String COMMAND_CAPABILITY = "CAPABILITY";
private static final String CAPABILITY_COMPRESS_DEFLATE = "COMPRESS=DEFLATE"; private static final String CAPABILITY_COMPRESS_DEFLATE = "COMPRESS=DEFLATE";
private static final String COMMAND_COMPRESS_DEFLATE = "COMPRESS DEFLATE"; private static final String COMMAND_COMPRESS_DEFLATE = "COMPRESS DEFLATE";
@ -862,7 +862,7 @@ public class ImapStore extends Store
throw ioExceptionHandler(mConnection, ioe); throw ioExceptionHandler(mConnection, ioe);
} }
} }
@Override @Override
public int getFlaggedMessageCount() throws MessagingException public int getFlaggedMessageCount() throws MessagingException
{ {
@ -890,7 +890,7 @@ public class ImapStore extends Store
throw ioExceptionHandler(mConnection, ioe); throw ioExceptionHandler(mConnection, ioe);
} }
} }
protected int getHighestUid() protected int getHighestUid()
{ {
try try
@ -967,7 +967,7 @@ public class ImapStore extends Store
}; };
return search(searcher, listener); return search(searcher, listener);
} }
private Message[] search(ImapSearcher searcher, MessageRetrievalListener listener) throws MessagingException private Message[] search(ImapSearcher searcher, MessageRetrievalListener listener) throws MessagingException
{ {
@ -1274,7 +1274,7 @@ public class ImapStore extends Store
if (part != null) if (part != null)
{ {
String contentTransferEncoding = part.getHeader( String contentTransferEncoding = part.getHeader(
MimeHeader.HEADER_CONTENT_TRANSFER_ENCODING)[0]; MimeHeader.HEADER_CONTENT_TRANSFER_ENCODING)[0];
part.setBody(MimeUtility.decodeBody(bodyStream, contentTransferEncoding)); part.setBody(MimeUtility.decodeBody(bodyStream, contentTransferEncoding));
} }
else else
@ -1843,7 +1843,7 @@ public class ImapStore extends Store
} }
return super.equals(o); return super.equals(o);
} }
@Override @Override
public int hashCode() public int hashCode()
{ {
@ -1882,7 +1882,7 @@ public class ImapStore extends Store
{ {
return "conn" + hashCode(); return "conn" + hashCode();
} }
private List<ImapResponse> receiveCapabilities(List<ImapResponse> responses) private List<ImapResponse> receiveCapabilities(List<ImapResponse> responses)
{ {
for (ImapResponse response : responses) for (ImapResponse response : responses)
@ -1907,7 +1907,7 @@ public class ImapStore extends Store
{ {
capabilityList = response; capabilityList = response;
} }
if (capabilityList != null) if (capabilityList != null)
{ {
if (capabilityList.size() > 0 && capabilityList.get(0).equals(CAPABILITY_CAPABILITY)) if (capabilityList.size() > 0 && capabilityList.get(0).equals(CAPABILITY_CAPABILITY))
@ -1927,7 +1927,7 @@ public class ImapStore extends Store
capabilities.add((String)capability); capabilities.add((String)capability);
} }
} }
} }
} }
} }
@ -1995,7 +1995,7 @@ public class ImapStore extends Store
List<ImapResponse> nullResponses = new LinkedList<ImapResponse>(); List<ImapResponse> nullResponses = new LinkedList<ImapResponse>();
nullResponses.add(nullResponse); nullResponses.add(nullResponse);
receiveCapabilities(nullResponses); receiveCapabilities(nullResponses);
if (hasCapability(CAPABILITY_CAPABILITY) == false) if (hasCapability(CAPABILITY_CAPABILITY) == false)
{ {
if (K9.DEBUG) if (K9.DEBUG)
@ -2006,7 +2006,7 @@ public class ImapStore extends Store
throw new MessagingException("Invalid CAPABILITY response received"); throw new MessagingException("Invalid CAPABILITY response received");
} }
} }
if (mConnectionSecurity == CONNECTION_SECURITY_TLS_OPTIONAL if (mConnectionSecurity == CONNECTION_SECURITY_TLS_OPTIONAL
|| mConnectionSecurity == CONNECTION_SECURITY_TLS_REQUIRED) || mConnectionSecurity == CONNECTION_SECURITY_TLS_REQUIRED)
{ {
@ -2053,7 +2053,7 @@ public class ImapStore extends Store
{ {
throw new MessagingException("Invalid CAPABILITY response received"); throw new MessagingException("Invalid CAPABILITY response received");
} }
} }
else if (mAuthType == AuthType.PLAIN) else if (mAuthType == AuthType.PLAIN)
{ {
@ -2078,7 +2078,7 @@ public class ImapStore extends Store
{ {
ConnectivityManager connectivityManager = (ConnectivityManager)K9.app.getSystemService(Context.CONNECTIVITY_SERVICE); ConnectivityManager connectivityManager = (ConnectivityManager)K9.app.getSystemService(Context.CONNECTIVITY_SERVICE);
boolean useCompression = true; boolean useCompression = true;
NetworkInfo netInfo = connectivityManager.getActiveNetworkInfo(); NetworkInfo netInfo = connectivityManager.getActiveNetworkInfo();
if (netInfo != null) if (netInfo != null)
{ {
@ -2086,7 +2086,7 @@ public class ImapStore extends Store
if (K9.DEBUG) if (K9.DEBUG)
Log.d(K9.LOG_TAG, "On network type " + type); Log.d(K9.LOG_TAG, "On network type " + type);
useCompression = mAccount.useCompression(type); useCompression = mAccount.useCompression(type);
} }
if (K9.DEBUG) if (K9.DEBUG)
Log.d(K9.LOG_TAG, "useCompression " + useCompression); Log.d(K9.LOG_TAG, "useCompression " + useCompression);
@ -2113,8 +2113,8 @@ public class ImapStore extends Store
} }
} }
} }
if (K9.DEBUG) if (K9.DEBUG)
Log.d(K9.LOG_TAG, "NAMESPACE = " + hasCapability(CAPABILITY_NAMESPACE) Log.d(K9.LOG_TAG, "NAMESPACE = " + hasCapability(CAPABILITY_NAMESPACE)
+ ", mPathPrefix = " + mPathPrefix); + ", mPathPrefix = " + mPathPrefix);
@ -2497,7 +2497,7 @@ public class ImapStore extends Store
class ImapMessage extends MimeMessage class ImapMessage extends MimeMessage
{ {
ImapMessage(String uid, Folder folder) ImapMessage(String uid, Folder folder)
{ {
this.mUid = uid; this.mUid = uid;
this.mFolder = folder; this.mFolder = folder;
@ -2572,7 +2572,7 @@ public class ImapStore extends Store
{ {
mAlertText = alertText; mAlertText = alertText;
} }
} }
public class ImapFolderPusher extends ImapFolder implements UntaggedHandler public class ImapFolderPusher extends ImapFolder implements UntaggedHandler
{ {
@ -2668,9 +2668,9 @@ public class ImapStore extends Store
receiver.syncFolder(ImapFolderPusher.this); receiver.syncFolder(ImapFolderPusher.this);
} }
int startUid = oldUidNext; int startUid = oldUidNext;
int newUidNext = uidNext; int newUidNext = uidNext;
if (newUidNext == -1) if (newUidNext == -1)
{ {
if (K9.DEBUG) if (K9.DEBUG)
@ -2684,11 +2684,11 @@ public class ImapStore extends Store
Log.i(K9.LOG_TAG, "highest UID = " + highestUid); Log.i(K9.LOG_TAG, "highest UID = " + highestUid);
newUidNext = highestUid + 1; newUidNext = highestUid + 1;
if (K9.DEBUG) if (K9.DEBUG)
Log.i(K9.LOG_TAG, "highest UID = " + highestUid Log.i(K9.LOG_TAG, "highest UID = " + highestUid
+ ", set newUidNext to " + newUidNext); + ", set newUidNext to " + newUidNext);
} }
} }
if (startUid < newUidNext - mAccount.getDisplayCount()) if (startUid < newUidNext - mAccount.getDisplayCount())
{ {
startUid = newUidNext - mAccount.getDisplayCount(); startUid = newUidNext - mAccount.getDisplayCount();

View File

@ -630,11 +630,11 @@ public class LocalStore extends Store implements Serializable
return true; return true;
} }
public Message[] searchForMessages(MessageRetrievalListener listener, String queryString, public Message[] searchForMessages(MessageRetrievalListener listener, String queryString,
List<LocalFolder> folders, Message[] messages, final Flag[] requiredFlags, final Flag[] forbiddenFlags) throws MessagingException List<LocalFolder> folders, Message[] messages, final Flag[] requiredFlags, final Flag[] forbiddenFlags) throws MessagingException
{ {
List<String> args = new LinkedList<String>(); List<String> args = new LinkedList<String>();
StringBuilder whereClause = new StringBuilder(); StringBuilder whereClause = new StringBuilder();
if (queryString != null && queryString.length() > 0) if (queryString != null && queryString.length() > 0)
{ {
@ -689,7 +689,7 @@ public class LocalStore extends Store implements Serializable
} }
anyAdded = true; anyAdded = true;
whereClause.append(" flags NOT LIKE ?"); whereClause.append(" flags NOT LIKE ?");
args.add("%" + flag.toString() + "%"); args.add("%" + flag.toString() + "%");
} }
whereClause.append(" )"); whereClause.append(" )");
@ -706,12 +706,12 @@ public class LocalStore extends Store implements Serializable
} }
anyAdded = true; anyAdded = true;
whereClause.append(" flags LIKE ?"); whereClause.append(" flags LIKE ?");
args.add("%" + flag.toString() + "%"); args.add("%" + flag.toString() + "%");
} }
whereClause.append(" )"); whereClause.append(" )");
} }
if (K9.DEBUG) if (K9.DEBUG)
{ {
Log.v(K9.LOG_TAG, "whereClause = " + whereClause.toString()); Log.v(K9.LOG_TAG, "whereClause = " + whereClause.toString());
@ -993,7 +993,7 @@ public class LocalStore extends Store implements Serializable
open(OpenMode.READ_WRITE); open(OpenMode.READ_WRITE);
return mUnreadMessageCount; return mUnreadMessageCount;
} }
@Override @Override
public int getFlaggedMessageCount() throws MessagingException public int getFlaggedMessageCount() throws MessagingException
{ {
@ -1008,7 +1008,7 @@ public class LocalStore extends Store implements Serializable
mDb.execSQL("UPDATE folders SET unread_count = ? WHERE id = ?", mDb.execSQL("UPDATE folders SET unread_count = ? WHERE id = ?",
new Object[] { mUnreadMessageCount, mFolderId }); new Object[] { mUnreadMessageCount, mFolderId });
} }
public void setFlaggedMessageCount(int flaggedMessageCount) throws MessagingException public void setFlaggedMessageCount(int flaggedMessageCount) throws MessagingException
{ {
open(OpenMode.READ_WRITE); open(OpenMode.READ_WRITE);
@ -1141,7 +1141,7 @@ public class LocalStore extends Store implements Serializable
{ {
this.pushClass = pushClass; this.pushClass = pushClass;
} }
public boolean isIntegrate() public boolean isIntegrate()
{ {
return mIntegrate; return mIntegrate;
@ -1150,7 +1150,7 @@ public class LocalStore extends Store implements Serializable
{ {
mIntegrate = integrate; mIntegrate = integrate;
} }
private String getPrefId() throws MessagingException private String getPrefId() throws MessagingException
{ {
open(OpenMode.READ_WRITE); open(OpenMode.READ_WRITE);
@ -1216,15 +1216,15 @@ public class LocalStore extends Store implements Serializable
editor.commit(); editor.commit();
} }
public FolderClass getDisplayClass(Preferences preferences) throws MessagingException public FolderClass getDisplayClass(Preferences preferences) throws MessagingException
{ {
String id = getPrefId(); String id = getPrefId();
return FolderClass.valueOf(preferences.getPreferences().getString(id + ".displayMode", return FolderClass.valueOf(preferences.getPreferences().getString(id + ".displayMode",
FolderClass.NO_CLASS.name())); FolderClass.NO_CLASS.name()));
} }
@Override @Override
public void refresh(Preferences preferences) throws MessagingException public void refresh(Preferences preferences) throws MessagingException
{ {
@ -1586,7 +1586,7 @@ public class LocalStore extends Store implements Serializable
setUnreadMessageCount(getUnreadMessageCount() - 1); setUnreadMessageCount(getUnreadMessageCount() - 1);
lDestFolder.setUnreadMessageCount(lDestFolder.getUnreadMessageCount() + 1); lDestFolder.setUnreadMessageCount(lDestFolder.getUnreadMessageCount() + 1);
} }
if (message.isSet(Flag.FLAGGED)) if (message.isSet(Flag.FLAGGED))
{ {
setFlaggedMessageCount(getFlaggedMessageCount() - 1); setFlaggedMessageCount(getFlaggedMessageCount() - 1);
@ -2075,7 +2075,7 @@ public class LocalStore extends Store implements Serializable
Log.e(K9.LOG_TAG, "Unable to fetch all messages from LocalStore", e); Log.e(K9.LOG_TAG, "Unable to fetch all messages from LocalStore", e);
} }
} }
@Override @Override
public void delete(boolean recurse) throws MessagingException public void delete(boolean recurse) throws MessagingException
@ -2298,7 +2298,7 @@ public class LocalStore extends Store implements Serializable
{ {
return inTopGroup; return inTopGroup;
} }
public void setInTopGroup(boolean inTopGroup) public void setInTopGroup(boolean inTopGroup)
{ {
this.inTopGroup = inTopGroup; this.inTopGroup = inTopGroup;
@ -2368,14 +2368,14 @@ public class LocalStore extends Store implements Serializable
if (flagList != null && flagList.length() > 0) if (flagList != null && flagList.length() > 0)
{ {
String[] flags = flagList.split(","); String[] flags = flagList.split(",");
for (String flag : flags) for (String flag : flags)
{ {
try try
{ {
this.setFlagInternal(Flag.valueOf(flag), true); this.setFlagInternal(Flag.valueOf(flag), true);
} }
catch (Exception e) catch (Exception e)
{ {
if ("X_BAD_FLAG".equals(flag) == false) if ("X_BAD_FLAG".equals(flag) == false)
@ -2635,7 +2635,7 @@ public class LocalStore extends Store implements Serializable
{ {
folder.setFlaggedMessageCount(folder.getFlaggedMessageCount() - 1); folder.setFlaggedMessageCount(folder.getFlaggedMessageCount() - 1);
} }
else else
{ {
folder.setFlaggedMessageCount(folder.getFlaggedMessageCount() + 1); folder.setFlaggedMessageCount(folder.getFlaggedMessageCount() + 1);
} }
@ -2647,7 +2647,7 @@ public class LocalStore extends Store implements Serializable
{ {
folder.setFlaggedMessageCount(folder.getFlaggedMessageCount() + 1); folder.setFlaggedMessageCount(folder.getFlaggedMessageCount() + 1);
} }
else else
{ {
folder.setFlaggedMessageCount(folder.getFlaggedMessageCount() - 1); folder.setFlaggedMessageCount(folder.getFlaggedMessageCount() - 1);
} }

View File

@ -525,10 +525,10 @@ public class Pop3Store extends Store
/* /*
* At least one server software places a "+OK" in * At least one server software places a "+OK" in
* front of every line in the unique-id listing. * front of every line in the unique-id listing.
* *
* Fix up the array if we detected this behavior. * Fix up the array if we detected this behavior.
* See Issue 1237 * See Issue 1237
*/ */
uidParts[0] = uidParts[1]; uidParts[0] = uidParts[1];
uidParts[1] = uidParts[2]; uidParts[1] = uidParts[2];
} }
@ -1078,7 +1078,7 @@ public class Pop3Store extends Store
} }
return super.equals(o); return super.equals(o);
} }
@Override @Override
public int hashCode() public int hashCode()
{ {

View File

@ -1628,7 +1628,7 @@ public class WebDavStore extends Store
statusCode > 300) statusCode > 300)
{ {
throw new IOException("Error during with code " + statusCode + " during fetch: " throw new IOException("Error during with code " + statusCode + " during fetch: "
+ response.getStatusLine().toString()); + response.getStatusLine().toString());
} }
if (entity != null) if (entity != null)
@ -1972,7 +1972,7 @@ public class WebDavStore extends Store
subject = ""; subject = "";
} }
*/ */
ByteArrayOutputStream out; ByteArrayOutputStream out;
try try
{ {
@ -1985,7 +1985,7 @@ public class WebDavStore extends Store
} }
open(OpenMode.READ_WRITE); open(OpenMode.READ_WRITE);
EOLConvertingOutputStream msgOut = new EOLConvertingOutputStream( EOLConvertingOutputStream msgOut = new EOLConvertingOutputStream(
new BufferedOutputStream(out, 1024)); new BufferedOutputStream(out, 1024));
message.writeTo(msgOut); message.writeTo(msgOut);
msgOut.flush(); msgOut.flush();
@ -2018,9 +2018,9 @@ public class WebDavStore extends Store
if (statusCode < 200 || if (statusCode < 200 ||
statusCode > 300) statusCode > 300)
{ {
throw new IOException("Error with status code " + statusCode throw new IOException("Error with status code " + statusCode
+ " while sending/appending message. Response = " + " while sending/appending message. Response = "
+ response.getStatusLine().toString() + " for message " + messageURL); + response.getStatusLine().toString() + " for message " + messageURL);
} }
WebDavMessage retMessage = new WebDavMessage(message.getUid(), this); WebDavMessage retMessage = new WebDavMessage(message.getUid(), this);
@ -2041,7 +2041,7 @@ public class WebDavStore extends Store
{ {
return false; return false;
} }
@Override @Override
public int hashCode() public int hashCode()
{ {

View File

@ -36,7 +36,7 @@ public class EOLConvertingOutputStream extends FilterOutputStream
{ {
super.write('\n'); super.write('\n');
lastChar = '\n'; lastChar = '\n';
// We have to ignore the next character if it is <LF>. Otherwise it // We have to ignore the next character if it is <LF>. Otherwise it
// will be expanded to an additional <CR><LF> sequence although it // will be expanded to an additional <CR><LF> sequence although it
// belongs to the one just completed. // belongs to the one just completed.

View File

@ -26,10 +26,10 @@ public class LineWrapOutputStream extends FilterOutputStream
// Buffer full? // Buffer full?
if (lineLength == buffer.length) if (lineLength == buffer.length)
{ {
// Usable word-boundary found earlier? // Usable word-boundary found earlier?
if (endOfLastWord > 0) if (endOfLastWord > 0)
{ {
// Yes, so output everything up to that word-boundary // Yes, so output everything up to that word-boundary
out.write(buffer, bufferStart, endOfLastWord - bufferStart); out.write(buffer, bufferStart, endOfLastWord - bufferStart);
out.write(CRLF); out.write(CRLF);

View File

@ -9,7 +9,7 @@ public class SmtpDataStuffing extends FilterOutputStream
private static final int STATE_NORMAL = 0; private static final int STATE_NORMAL = 0;
private static final int STATE_CR = 1; private static final int STATE_CR = 1;
private static final int STATE_CRLF = 2; private static final int STATE_CRLF = 2;
private int state = STATE_NORMAL; private int state = STATE_NORMAL;
public SmtpDataStuffing(OutputStream out) public SmtpDataStuffing(OutputStream out)

View File

@ -300,7 +300,7 @@ public class SmtpTransport extends Transport
boolean possibleSend = false; boolean possibleSend = false;
try try
{ {
//TODO: Add BODY=8BITMIME parameter if appropriate? //TODO: Add BODY=8BITMIME parameter if appropriate?
executeSimpleCommand("MAIL FROM: " + "<" + from[0].getAddress() + ">"); executeSimpleCommand("MAIL FROM: " + "<" + from[0].getAddress() + ">");
for (Address address : message.getRecipients(RecipientType.TO)) for (Address address : message.getRecipients(RecipientType.TO))
{ {
@ -316,12 +316,12 @@ public class SmtpTransport extends Transport
} }
message.setRecipients(RecipientType.BCC, null); message.setRecipients(RecipientType.BCC, null);
executeSimpleCommand("DATA"); executeSimpleCommand("DATA");
EOLConvertingOutputStream msgOut = new EOLConvertingOutputStream( EOLConvertingOutputStream msgOut = new EOLConvertingOutputStream(
new SmtpDataStuffing( new SmtpDataStuffing(
new LineWrapOutputStream( new LineWrapOutputStream(
new BufferedOutputStream(mOut, 1024), new BufferedOutputStream(mOut, 1024),
1000))); 1000)));
message.writeTo(msgOut); message.writeTo(msgOut);

View File

@ -421,13 +421,13 @@ public class Storage implements SharedPreferences
try try
{ {
cursor = mDb.query( cursor = mDb.query(
"preferences_storage", "preferences_storage",
new String[] {"value"}, new String[] {"value"},
"primkey = ?", "primkey = ?",
new String[] {key}, new String[] {key},
null, null,
null, null,
null); null);
if (cursor.moveToNext()) if (cursor.moveToNext())
{ {

View File

@ -157,7 +157,7 @@ public class AttachmentProvider extends ContentProvider
} }
private File getFile(String dbName, String id) private File getFile(String dbName, String id)
throws FileNotFoundException throws FileNotFoundException
{ {
try try
{ {
@ -166,7 +166,8 @@ public class AttachmentProvider extends ContentProvider
if (!file.exists()) if (!file.exists())
{ {
file = new File("/sdcard" + attachmentsDir.getCanonicalPath().substring("/data".length()), id); file = new File("/sdcard" + attachmentsDir.getCanonicalPath().substring("/data".length()), id);
if (!file.exists()) { if (!file.exists())
{
throw new FileNotFoundException(); throw new FileNotFoundException();
} }
} }

View File

@ -22,7 +22,7 @@ public abstract class CoreService extends Service
private static AtomicInteger wakeLockSeq = new AtomicInteger(0); private static AtomicInteger wakeLockSeq = new AtomicInteger(0);
private ExecutorService threadPool = null; private ExecutorService threadPool = null;
private final String className = getClass().getName(); private final String className = getClass().getName();
@Override @Override
public void onCreate() public void onCreate()
{ {
@ -30,9 +30,9 @@ public abstract class CoreService extends Service
Log.i(K9.LOG_TAG, "CoreService: " + className + ".onCreate()"); Log.i(K9.LOG_TAG, "CoreService: " + className + ".onCreate()");
threadPool = Executors.newFixedThreadPool(1); // Must be single threaded threadPool = Executors.newFixedThreadPool(1); // Must be single threaded
super.onCreate(); super.onCreate();
} }
protected static void addWakeLockId(Intent i, Integer wakeLockId) protected static void addWakeLockId(Intent i, Integer wakeLockId)
{ {
if (wakeLockId != null) if (wakeLockId != null)
@ -53,8 +53,8 @@ public abstract class CoreService extends Service
i.putExtra(WAKE_LOCK_ID, tmpWakeLockId); i.putExtra(WAKE_LOCK_ID, tmpWakeLockId);
} }
@Override @Override
public void onStart(Intent intent, int startId) public void onStart(Intent intent, int startId)
@ -104,12 +104,12 @@ public abstract class CoreService extends Service
public void execute(Context context, final Runnable runner, int wakeLockTime, final Integer startId) public void execute(Context context, final Runnable runner, int wakeLockTime, final Integer startId)
{ {
PowerManager pm = (PowerManager) context.getSystemService(Context.POWER_SERVICE); PowerManager pm = (PowerManager) context.getSystemService(Context.POWER_SERVICE);
final WakeLock wakeLock = pm.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, "K9"); final WakeLock wakeLock = pm.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, "K9");
wakeLock.setReferenceCounted(false); wakeLock.setReferenceCounted(false);
wakeLock.acquire(wakeLockTime); wakeLock.acquire(wakeLockTime);
Runnable myRunner = new Runnable() Runnable myRunner = new Runnable()
{ {
public void run() public void run()
@ -137,7 +137,7 @@ public abstract class CoreService extends Service
if (threadPool == null) if (threadPool == null)
{ {
Log.e(K9.LOG_TAG, "CoreService.execute (" + className + ") called with no threadPool available; running Runnable " + runner.hashCode() + " in calling thread", new Throwable()); Log.e(K9.LOG_TAG, "CoreService.execute (" + className + ") called with no threadPool available; running Runnable " + runner.hashCode() + " in calling thread", new Throwable());
synchronized(this) synchronized (this)
{ {
myRunner.run(); myRunner.run();
} }

View File

@ -38,7 +38,7 @@ public class MailService extends CoreService
private static final String CANCEL_CONNECTIVITY_NOTICE = "com.fsck.k9.intent.action.MAIL_SERVICE_CANCEL_CONNECTIVITY_NOTICE"; private static final String CANCEL_CONNECTIVITY_NOTICE = "com.fsck.k9.intent.action.MAIL_SERVICE_CANCEL_CONNECTIVITY_NOTICE";
private static final String HAS_CONNECTIVITY = "com.fsck.k9.intent.action.MAIL_SERVICE_HAS_CONNECTIVITY"; private static final String HAS_CONNECTIVITY = "com.fsck.k9.intent.action.MAIL_SERVICE_HAS_CONNECTIVITY";
private static long nextCheck = -1; private static long nextCheck = -1;
public static void actionReset(Context context, Integer wakeLockId) public static void actionReset(Context context, Integer wakeLockId)
@ -53,7 +53,7 @@ public class MailService extends CoreService
} }
context.startService(i); context.startService(i);
} }
public static void actionRestartPushers(Context context, Integer wakeLockId) public static void actionRestartPushers(Context context, Integer wakeLockId)
{ {
Intent i = new Intent(); Intent i = new Intent();
@ -66,7 +66,7 @@ public class MailService extends CoreService
} }
context.startService(i); context.startService(i);
} }
public static void actionReschedulePoll(Context context, Integer wakeLockId) public static void actionReschedulePoll(Context context, Integer wakeLockId)
{ {
Intent i = new Intent(); Intent i = new Intent();
@ -192,7 +192,7 @@ public class MailService extends CoreService
startIdObj = null; startIdObj = null;
} }
} }
else if (CONNECTIVITY_CHANGE.equals(intent.getAction()) ) else if (CONNECTIVITY_CHANGE.equals(intent.getAction()))
{ {
notifyConnectionStatus(hasConnectivity); notifyConnectionStatus(hasConnectivity);
rescheduleAll(hasConnectivity, doBackground, startIdObj); rescheduleAll(hasConnectivity, doBackground, startIdObj);
@ -220,7 +220,7 @@ public class MailService extends CoreService
{ {
reschedulePoll(hasConnectivity, doBackground, null, true); reschedulePoll(hasConnectivity, doBackground, null, true);
reschedulePushers(hasConnectivity, doBackground, startId); reschedulePushers(hasConnectivity, doBackground, startId);
} }
private void notifyConnectionStatus(boolean hasConnectivity) private void notifyConnectionStatus(boolean hasConnectivity)
@ -273,10 +273,10 @@ public class MailService extends CoreService
private final static String PREVIOUS_INTERVAL = "MailService.previousInterval"; private final static String PREVIOUS_INTERVAL = "MailService.previousInterval";
private final static String LAST_CHECK_END = "MailService.lastCheckEnd"; private final static String LAST_CHECK_END = "MailService.lastCheckEnd";
public static void saveLastCheckEnd(Context context) public static void saveLastCheckEnd(Context context)
{ {
long lastCheckEnd = System.currentTimeMillis(); long lastCheckEnd = System.currentTimeMillis();
if (K9.DEBUG) if (K9.DEBUG)
Log.i(K9.LOG_TAG, "Saving lastCheckEnd = " + new Date(lastCheckEnd)); Log.i(K9.LOG_TAG, "Saving lastCheckEnd = " + new Date(lastCheckEnd));
@ -286,7 +286,7 @@ public class MailService extends CoreService
editor.putLong(LAST_CHECK_END, lastCheckEnd); editor.putLong(LAST_CHECK_END, lastCheckEnd);
editor.commit(); editor.commit();
} }
private void reschedulePoll(final boolean hasConnectivity, final boolean doBackground, Integer startId, final boolean considerLastCheckEnd) private void reschedulePoll(final boolean hasConnectivity, final boolean doBackground, Integer startId, final boolean considerLastCheckEnd)
{ {
if (hasConnectivity && doBackground) if (hasConnectivity && doBackground)
@ -296,7 +296,7 @@ public class MailService extends CoreService
public void run() public void run()
{ {
int shortestInterval = -1; int shortestInterval = -1;
Preferences prefs = Preferences.getPreferences(MailService.this); Preferences prefs = Preferences.getPreferences(MailService.this);
SharedPreferences sPrefs = prefs.getPreferences(); SharedPreferences sPrefs = prefs.getPreferences();
int previousInterval = sPrefs.getInt(PREVIOUS_INTERVAL, -1); int previousInterval = sPrefs.getInt(PREVIOUS_INTERVAL, -1);
@ -313,7 +313,7 @@ public class MailService extends CoreService
SharedPreferences.Editor editor = sPrefs.edit(); SharedPreferences.Editor editor = sPrefs.edit();
editor.putInt(PREVIOUS_INTERVAL, shortestInterval); editor.putInt(PREVIOUS_INTERVAL, shortestInterval);
editor.commit(); editor.commit();
if (shortestInterval == -1) if (shortestInterval == -1)
{ {
nextCheck = -1; nextCheck = -1;
@ -327,11 +327,11 @@ public class MailService extends CoreService
long base = (previousInterval == -1 || lastCheckEnd == -1 || considerLastCheckEnd == false ? System.currentTimeMillis() : lastCheckEnd); long base = (previousInterval == -1 || lastCheckEnd == -1 || considerLastCheckEnd == false ? System.currentTimeMillis() : lastCheckEnd);
long nextTime = base + delay; long nextTime = base + delay;
if (K9.DEBUG) if (K9.DEBUG)
Log.i(K9.LOG_TAG, Log.i(K9.LOG_TAG,
"previousInterval = " + previousInterval "previousInterval = " + previousInterval
+ ", shortestInterval = " + shortestInterval + ", shortestInterval = " + shortestInterval
+ ", lastCheckEnd = " + new Date(lastCheckEnd) + ", lastCheckEnd = " + new Date(lastCheckEnd)
+ ", considerLastCheckEnd = " + considerLastCheckEnd); + ", considerLastCheckEnd = " + considerLastCheckEnd);
nextCheck = nextTime; nextCheck = nextTime;
try try
{ {
@ -343,12 +343,12 @@ public class MailService extends CoreService
// I once got a NullPointerException deep in new Date(); // I once got a NullPointerException deep in new Date();
Log.e(K9.LOG_TAG, "Exception while logging", e); Log.e(K9.LOG_TAG, "Exception while logging", e);
} }
Intent i = new Intent(); Intent i = new Intent();
i.setClassName(getApplication().getPackageName(), "com.fsck.k9.service.MailService"); i.setClassName(getApplication().getPackageName(), "com.fsck.k9.service.MailService");
i.setAction(ACTION_CHECK_MAIL); i.setAction(ACTION_CHECK_MAIL);
BootReceiver.scheduleIntent(MailService.this, nextTime, i); BootReceiver.scheduleIntent(MailService.this, nextTime, i);
} }
} }
} }

View File

@ -140,11 +140,11 @@ public class PollService extends CoreService
private void release() private void release()
{ {
MessagingController controller = MessagingController.getInstance(getApplication()); MessagingController controller = MessagingController.getInstance(getApplication());
controller.setCheckMailListener(null); controller.setCheckMailListener(null);
MailService.saveLastCheckEnd(getApplication()); MailService.saveLastCheckEnd(getApplication());
MailService.actionReschedulePoll(PollService.this, null); MailService.actionReschedulePoll(PollService.this, null);
wakeLockRelease(); wakeLockRelease();
if (K9.DEBUG) if (K9.DEBUG)

View File

@ -159,7 +159,7 @@ public class RemoteControlService extends CoreService
Editor editor = sPrefs.edit(); Editor editor = sPrefs.edit();
K9.save(editor); K9.save(editor);
editor.commit(); editor.commit();
if (needsReschedule) if (needsReschedule)
{ {
Intent i = new Intent(); Intent i = new Intent();