1
0
mirror of https://github.com/moparisthebest/k-9 synced 2024-08-13 17:03:48 -04:00
This commit is contained in:
Jesse Vincent 2010-05-12 02:51:59 +00:00
parent 1bf1643987
commit ba021597c4
16 changed files with 74 additions and 73 deletions

View File

@ -166,9 +166,9 @@ public class Account implements BaseAccount
mAutomaticCheckIntervalMinutes = preferences.getPreferences().getInt(mUuid
+ ".automaticCheckIntervalMinutes", -1);
mIdleRefreshMinutes = preferences.getPreferences().getInt(mUuid
+ ".idleRefreshMinutes", 24);
+ ".idleRefreshMinutes", 24);
mPushPollOnConnect = preferences.getPreferences().getBoolean(mUuid
+ ".pushPollOnConnect", true);
+ ".pushPollOnConnect", true);
mDisplayCount = preferences.getPreferences().getInt(mUuid + ".displayCount", -1);
mLastAutomaticCheckTime = preferences.getPreferences().getLong(mUuid
+ ".lastAutomaticCheckTime", 0);

View File

@ -574,11 +574,11 @@ public class K9 extends Application
/**
* Check if this system contains a buggy Gallery 3D package.
*
*
* We have to work around the fact that those Gallery versions won't show
* any images or videos when the pick intent is used with a MIME type other
* than image/* or video/*. See issue 1186.
*
*
* @return true, if a buggy Gallery 3D package was found. False, otherwise.
*/
private boolean checkForBuggyGallery()
@ -586,7 +586,7 @@ public class K9 extends Application
try
{
PackageInfo pi = getPackageManager().getPackageInfo("com.cooliris.media", 0);
return (pi.versionCode == 30682);
}
catch (NameNotFoundException e)

View File

@ -893,9 +893,9 @@ public class MessagingController implements Runnable
try
{
LocalStore localStore = account.getLocalStore();
localStore.searchForMessages(retrievalListener, query, foldersToSearch,
messagesToSearch == null ? null : messagesToSearch.toArray(new Message[0]),
requiredFlags, forbiddenFlags);
localStore.searchForMessages(retrievalListener, query, foldersToSearch,
messagesToSearch == null ? null : messagesToSearch.toArray(new Message[0]),
requiredFlags, forbiddenFlags);
}
catch (Exception e)
@ -986,7 +986,7 @@ public class MessagingController implements Runnable
{
Folder remoteFolder = null;
LocalFolder tLocalFolder = null;
if (K9.DEBUG)
Log.i(K9.LOG_TAG, "Synchronizing folder " + account.getDescription() + ":" + folder);

View File

@ -817,7 +817,7 @@ public class Accounts extends K9ListActivity implements OnItemClickListener, OnC
holder.email.setText(account.getEmail());
}
}
String description = account.getDescription();
if (description == null || description.length() == 0)
{

View File

@ -255,7 +255,7 @@ public class FolderList extends K9ListActivity
{
super.onCreate(savedInstanceState);
requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS);
setContentView(R.layout.folder_list);
mListView = getListView();
mListView.setScrollBarStyle(View.SCROLLBARS_OUTSIDE_INSET);

View File

@ -750,7 +750,7 @@ public class MessageCompose extends K9Activity implements OnClickListener, OnFoc
Attachment attachment = (Attachment) mAttachments.getChildAt(i).getTag();
MimeBodyPart bp = new MimeBodyPart(
new LocalStore.LocalAttachmentBody(attachment.uri, getApplication()));
new LocalStore.LocalAttachmentBody(attachment.uri, getApplication()));
/*
* Correctly encode the filename here. Otherwise the whole
@ -758,30 +758,30 @@ public class MessageCompose extends K9Activity implements OnClickListener, OnFoc
* MimeHeader.writeTo().
*/
bp.addHeader(MimeHeader.HEADER_CONTENT_TYPE, String.format("%s;\n name=\"%s\"",
attachment.contentType,
EncoderUtil.encodeIfNecessary(attachment.name,
EncoderUtil.Usage.WORD_ENTITY, 7)));
attachment.contentType,
EncoderUtil.encodeIfNecessary(attachment.name,
EncoderUtil.Usage.WORD_ENTITY, 7)));
bp.addHeader(MimeHeader.HEADER_CONTENT_TRANSFER_ENCODING, "base64");
/*
* TODO: Oh the joys of MIME...
*
*
* From RFC 2183 (The Content-Disposition Header Field):
* "Parameter values longer than 78 characters, or which
* contain non-ASCII characters, MUST be encoded as specified
* in [RFC 2184]."
*
*
* Example:
*
*
* Content-Type: application/x-stuff
* title*1*=us-ascii'en'This%20is%20even%20more%20
* title*2*=%2A%2A%2Afun%2A%2A%2A%20
* title*3="isn't it!"
*/
bp.addHeader(MimeHeader.HEADER_CONTENT_DISPOSITION, String.format(
"attachment;\n filename=\"%s\";\n size=%d",
attachment.name, attachment.size));
"attachment;\n filename=\"%s\";\n size=%d",
attachment.name, attachment.size));
mp.addBodyPart(bp);
}
@ -947,14 +947,14 @@ public class MessageCompose extends K9Activity implements OnClickListener, OnFoc
if (K9.useGalleryBugWorkaround())
{
Toast.makeText(MessageCompose.this,
getString(R.string.message_compose_use_workaround),
Toast.LENGTH_LONG).show();
getString(R.string.message_compose_use_workaround),
Toast.LENGTH_LONG).show();
}
else
{
Toast.makeText(MessageCompose.this,
getString(R.string.message_compose_buggy_gallery),
Toast.LENGTH_LONG).show();
getString(R.string.message_compose_buggy_gallery),
Toast.LENGTH_LONG).show();
}
}
@ -1195,7 +1195,7 @@ public class MessageCompose extends K9Activity implements OnClickListener, OnFoc
/*
* Show the menu items "Add attachment (Image)" and "Add attachment (Video)"
* if the work-around for the Gallery bug is enabled (see Issue 1186).
* if the work-around for the Gallery bug is enabled (see Issue 1186).
*/
int found = 0;
for (int i = menu.size() - 1; i >= 0; i--)
@ -1203,7 +1203,7 @@ public class MessageCompose extends K9Activity implements OnClickListener, OnFoc
MenuItem item = menu.getItem(i);
int id = item.getItemId();
if ((id == R.id.add_attachment_image) ||
(id == R.id.add_attachment_video))
(id == R.id.add_attachment_video))
{
item.setVisible(K9.useGalleryBugWorkaround());
found++;

View File

@ -146,7 +146,7 @@ public class MessageList
}
}
resetUnreadCountOnThread();
mAdapter.notifyDataSetChanged();
toggleBatchButtons();
}
@ -164,10 +164,10 @@ public class MessageList
{
for (final MessageInfoHolder message : messages)
{
if (mFolderName == null || (message.folder != null && message.folder.name.equals(mFolderName)))
{
int index = Collections.binarySearch(mAdapter.messages, message);
if (index < 0)
@ -179,13 +179,13 @@ public class MessageList
}
}
if (wasEmpty)
{
mListView.setSelection(0);
}
resetUnreadCountOnThread();
mAdapter.notifyDataSetChanged();
}
});
@ -1732,7 +1732,7 @@ public class MessageList
ref.accountUuid = account.getUuid();
ref.folderName = folder;
ref.uid = oldUid;
MessageInfoHolder holder = getMessage(ref);
if (holder != null)
{
@ -1833,19 +1833,19 @@ public class MessageList
m.populate(message, new FolderInfoHolder(message.getFolder(), account), account);
needsSort = true;
}
}
if (messagesToSearch.size() > 0)
{
mController.searchLocalMessages(mAccountUuids, mFolderNames, messagesToSearch.toArray(new Message[0]), mQueryString, mIntegrate, mQueryFlags, mForbiddenFlags,
new MessagingListener()
mController.searchLocalMessages(mAccountUuids, mFolderNames, messagesToSearch.toArray(new Message[0]), mQueryString, mIntegrate, mQueryFlags, mForbiddenFlags,
new MessagingListener()
{
@Override
public void listLocalMessagesAddMessages(Account account, String folder, List<Message> messages)
{
addOrUpdateMessages(account, folder, messages, false);
}
});
}
if (messagesToRemove.size() > 0)
@ -1867,8 +1867,8 @@ public class MessageList
{
return getMessage(message.makeMessageReference());
}
// XXX TODO - make this not use a for loop
// XXX TODO - make this not use a for loop
public MessageInfoHolder getMessage(MessageReference messageReference)
{
for (MessageInfoHolder holder : mAdapter.messages)
@ -2336,7 +2336,7 @@ public class MessageList
@Override
public boolean equals(Object o)
{
if (o instanceof MessageInfoHolder == false)
{
return false;

View File

@ -132,7 +132,7 @@ public class AccountSetupIncoming extends K9Activity implements OnClickListener
idleRefreshPeriod = (Spinner)findViewById(R.id.idle_refresh_period);
folderPushLimit = (Spinner)findViewById(R.id.folder_push_limit);
mImapFolderDrafts.setOnClickListener(this);
mImapFolderSent.setOnClickListener(this);
mImapFolderTrash.setOnClickListener(this);
@ -401,12 +401,12 @@ public class AccountSetupIncoming extends K9Activity implements OnClickListener
updatePortFromSecurityType();
}
pushPollOnConnect.setChecked(mAccount.isPushPollOnConnect());
SpinnerHelper.initSpinner(this, idleRefreshPeriod, R.array.idle_refresh_period_entries,
R.array.idle_refresh_period_values, String.valueOf(mAccount.getIdleRefreshMinutes()));
SpinnerHelper.initSpinner(this, folderPushLimit, R.array.account_settings_push_limit_entries,
R.array.account_settings_push_limit_values, String.valueOf(mAccount.getMaxPushFolders()));
SpinnerHelper.initSpinner(this, idleRefreshPeriod, R.array.idle_refresh_period_entries,
R.array.idle_refresh_period_values, String.valueOf(mAccount.getIdleRefreshMinutes()));
SpinnerHelper.initSpinner(this, folderPushLimit, R.array.account_settings_push_limit_entries,
R.array.account_settings_push_limit_values, String.valueOf(mAccount.getMaxPushFolders()));
validateFields();
}
catch (Exception e)
@ -576,7 +576,7 @@ public class AccountSetupIncoming extends K9Activity implements OnClickListener
Log.e(K9.LOG_TAG, "Unable to parse max push folders value '" + maxPushFoldersValue + "'", e);
mAccount.setMaxPushFolders(10);
}
AccountSetupCheckSettings.actionCheckSettings(this, mAccount, true, false);
}
catch (Exception e)

View File

@ -17,11 +17,12 @@ public class SpinnerHelper
}
public static void initSpinner(Context context, Spinner spinner, String[] entryArray, String[] valueArray, String curVal)
{
if (entryArray.length != valueArray.length){
if (entryArray.length != valueArray.length)
{
throw new RuntimeException("Entry and value arrays are of unequal lenght");
}
EntryValue[] entryValues = new EntryValue[entryArray.length];
int curSelection = 0;
for (int i = 0; i < entryArray.length; i++)
@ -38,7 +39,7 @@ public class SpinnerHelper
spinner.setAdapter(entryValuesAdapter);
spinner.setSelection(curSelection);
}
public static String getSpinnerValue(Spinner spinner)
{
EntryValue entryValue = (EntryValue)spinner.getSelectedItem();

View File

@ -12,7 +12,7 @@ public class AutoSyncHelper
/**
* False, if we never tried to load the class for this SDK version.
* True, otherwise.
*
*
* Note: if sAutoSync is null and sChecked is true, then an error occured
* while loading the class for the SDK version we're running on.
*/
@ -27,7 +27,7 @@ public class AutoSyncHelper
/**
* Try loading the class that implements IAutoSync for this SDK version.
*
*
* @return the IAutoSync object for this SDK version, or null if something
* went wrong.
*/
@ -98,7 +98,7 @@ public class AutoSyncHelper
/**
* Checks whether we can query the auto-sync state using
* getMasterSyncAutomatically() or not.
*
*
* @return true, if calls to getMasterSyncAutomatically() will return the
* state of the auto-sync setting. false, otherwise.
*/
@ -113,7 +113,7 @@ public class AutoSyncHelper
/**
* Query the state of the auto-sync setting.
*
*
* @return the state of the auto-sync setting.
* @see IAutoSync
*/
@ -127,7 +127,7 @@ public class AutoSyncHelper
if (sAutoSync == null)
{
throw new RuntimeException(
"Called getMasterSyncAutomatically() before checking if it's available.");
"Called getMasterSyncAutomatically() before checking if it's available.");
}
return sAutoSync.getMasterSyncAutomatically();

View File

@ -16,7 +16,7 @@ public class AutoSyncSdk3 implements IAutoSync
/*
* There's no documented/official way to query the state of the
* auto-sync setting for a normal application in SDK 1.5/API 3.
*
*
* We use reflection to get an Sync.Settings.QueryMap" object, so we
* can call its getListenForNetworkTickles() method. This will return
* the current auto-sync state.

View File

@ -14,7 +14,7 @@ public class AutoSyncSdk4 implements IAutoSync
/*
* There's no documented/official way to query the state of the
* auto-sync setting for a normal application in SDK 1.6/API 4.
*
*
* We use reflection to get an ContentService object, so we can call its
* getListenForNetworkTickles() method. This will return the current
* auto-sync state.

View File

@ -5,22 +5,22 @@ import android.content.Context;
/**
* Classes that implement this interface know how to query the system for the
* current state of the auto-sync setting. This method differs from SDK 3 to
* SDK 5, so there are specialized implementations for each SDK version.
* SDK 5, so there are specialized implementations for each SDK version.
*/
public interface IAutoSync
{
/**
* Do the necessary reflection magic to get the necessary objects and/or
* methods to later query the state of the auto-sync setting.
*
*
* @param context The application context object.
* @throws NoSuchMethodException if something went wrong.
* @throws NoSuchMethodException if something went wrong.
*/
public void initialize(Context context) throws NoSuchMethodException;
/**
* Query the state of the auto-sync setting.
*
*
* @return the state of the auto-sync setting.
*/
public boolean getMasterSyncAutomatically();

View File

@ -9,7 +9,7 @@ import com.fsck.k9.activity.MessageReference;
public abstract class Message implements Part, Body
{
private MessageReference mReference = null;
public enum RecipientType
{
TO, CC, BCC,
@ -33,9 +33,9 @@ public abstract class Message implements Part, Body
Message other = (Message)o;
return (mFolder.getName().equals(other.getFolder().getName())
&& mFolder.getAccount().getUuid().equals(other.getFolder().getAccount().getUuid())
&& mUid.equals(other.getUid()));
&& mUid.equals(other.getUid()));
}
@Override
public int hashCode()
{
@ -47,7 +47,7 @@ public abstract class Message implements Part, Body
result = MULTIPLIER * result + mUid.hashCode();
return result;
}
public String getUid()
{
return mUid;
@ -175,7 +175,7 @@ public abstract class Message implements Part, Body
public abstract void saveChanges() throws MessagingException;
public abstract void setEncoding(String encoding);
public MessageReference makeMessageReference()
{
if (mReference == null)
@ -187,7 +187,7 @@ public abstract class Message implements Part, Body
}
return mReference;
}
public boolean equalsReference(MessageReference ref)
{
MessageReference tmpReference = makeMessageReference();

View File

@ -2039,7 +2039,7 @@ public class ImapStore extends Store
try
{
if (mHost.endsWith("yahoo.com"))
if (mHost.endsWith("yahoo.com"))
{
if (K9.DEBUG)
Log.v(K9.LOG_TAG, "Found Yahoo! account. Sending proprietary commands.");
@ -2689,8 +2689,8 @@ public class ImapStore extends Store
Log.d(K9.LOG_TAG, "highest UID = " + highestUid);
newUidNext = highestUid + 1;
if (K9.DEBUG)
Log.d(K9.LOG_TAG, "highest UID = " + highestUid
+ ", set newUidNext to " + newUidNext);
Log.d(K9.LOG_TAG, "highest UID = " + highestUid
+ ", set newUidNext to " + newUidNext);
}
}

View File

@ -441,7 +441,7 @@ public class MailService extends CoreService
if (K9.DEBUG)
{
Log.d(K9.LOG_TAG, "PUSHREFRESH: refreshing lastRefresh = " + lastRefresh + ", interval = " + refreshInterval
+ ", nowTime = " + nowTime + ", sinceLast = " + sinceLast);
+ ", nowTime = " + nowTime + ", sinceLast = " + sinceLast);
}
pusher.refresh();
pusher.setLastRefresh(nowTime);
@ -451,7 +451,7 @@ public class MailService extends CoreService
if (K9.DEBUG)
{
Log.d(K9.LOG_TAG, "PUSHREFRESH: NOT refreshing lastRefresh = " + lastRefresh + ", interval = " + refreshInterval
+ ", nowTime = " + nowTime + ", sinceLast = " + sinceLast);
+ ", nowTime = " + nowTime + ", sinceLast = " + sinceLast);
}
}
}