1
0
mirror of https://github.com/moparisthebest/k-9 synced 2024-11-27 11:42:16 -05:00

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(); Store remoteStore = account.getRemoteStore();
Folder remoteFolder = remoteStore.getFolder(folder); Folder remoteFolder = remoteStore.getFolder(folder);
if (!remoteFolder.exists() || if (!remoteFolder.exists() || !remoteFolder.isFlagSupported(flag)) {
/*
* 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))) {
return; return;
} }
@ -3982,7 +3975,7 @@ public class MessagingController implements Runnable {
Intent i = FolderList.actionHandleNotification(context, account, message.getFolder().getName()); Intent i = FolderList.actionHandleNotification(context, account, message.getFolder().getName());
PendingIntent pi = PendingIntent.getActivity(context, 0, i, 0); 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); String accountNotice = context.getString(R.string.notification_new_one_account_fmt, unreadCount, accountDescr);
notif.setLatestEventInfo(context, accountNotice, messageNotice, pi); notif.setLatestEventInfo(context, accountNotice, messageNotice, pi);

View File

@ -153,9 +153,13 @@ public abstract class Folder {
return null; return null;
} }
public boolean isFlagSupported(Flag flag) {
return true;
}
public boolean supportsFetchingFlags() { public boolean supportsFetchingFlags() {
return true; return true;
}//isFlagSupported }
@Override @Override
public String toString() { 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 @Override
public boolean supportsFetchingFlags() { public boolean supportsFetchingFlags() {
return false; return false;