Added method Folder.isFlagSupported(Flag)

This commit is contained in:
cketti 2011-05-14 23:19:24 +02:00
parent e90a479384
commit ba9bc2f8e9
3 changed files with 12 additions and 10 deletions

View File

@ -2174,14 +2174,7 @@ public class MessagingController implements Runnable {
Store remoteStore = account.getRemoteStore();
Folder remoteFolder = remoteStore.getFolder(folder);
if (!remoteFolder.exists() ||
/*
* Don't proceed if the remote folder doesn't support flags and
* the flag to be changed isn't the deleted flag. This avoids
* unnecessary connections to POP3 servers.
*/
// TODO: This should actually call a supportsSettingFlag(flag) method.
(!remoteFolder.supportsFetchingFlags() && !Flag.DELETED.equals(flag))) {
if (!remoteFolder.exists() || !remoteFolder.isFlagSupported(flag)) {
return;
}
@ -3982,7 +3975,7 @@ public class MessagingController implements Runnable {
Intent i = FolderList.actionHandleNotification(context, account, message.getFolder().getName());
PendingIntent pi = PendingIntent.getActivity(context, 0, i, 0);
String accountDescr = (account.getDescription() != null) ? account.getDescription() : account.getEmail();
String accountDescr = (account.getDescription() != null) ? account.getDescription() : account.getEmail();
String accountNotice = context.getString(R.string.notification_new_one_account_fmt, unreadCount, accountDescr);
notif.setLatestEventInfo(context, accountNotice, messageNotice, pi);

View File

@ -153,9 +153,13 @@ public abstract class Folder {
return null;
}
public boolean isFlagSupported(Flag flag) {
return true;
}
public boolean supportsFetchingFlags() {
return true;
}//isFlagSupported
}
@Override
public String toString() {

View File

@ -891,6 +891,11 @@ public class Pop3Store extends Store {
}
}
@Override
public boolean isFlagSupported(Flag flag) {
return (flag == Flag.DELETED);
}
@Override
public boolean supportsFetchingFlags() {
return false;