mirror of
https://github.com/moparisthebest/k-9
synced 2025-01-13 06:38:05 -05:00
Set interface makes more sense for flags
This commit is contained in:
parent
195f28db00
commit
40102d560d
@ -2410,7 +2410,7 @@ public class MessagingController implements Runnable {
|
|||||||
if (messages.isEmpty()) {
|
if (messages.isEmpty()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
remoteFolder.setFlags(messages, Collections.singletonList(flag), newState);
|
remoteFolder.setFlags(messages, Collections.singleton(flag), newState);
|
||||||
} finally {
|
} finally {
|
||||||
closeFolder(remoteFolder);
|
closeFolder(remoteFolder);
|
||||||
}
|
}
|
||||||
@ -2602,7 +2602,7 @@ public class MessagingController implements Runnable {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
remoteFolder.setFlags(Collections.singletonList(Flag.SEEN), true);
|
remoteFolder.setFlags(Collections.singleton(Flag.SEEN), true);
|
||||||
remoteFolder.close();
|
remoteFolder.close();
|
||||||
} catch (UnsupportedOperationException uoe) {
|
} catch (UnsupportedOperationException uoe) {
|
||||||
Log.w(K9.LOG_TAG, "Could not mark all server-side as read because store doesn't support operation", uoe);
|
Log.w(K9.LOG_TAG, "Could not mark all server-side as read because store doesn't support operation", uoe);
|
||||||
@ -2878,7 +2878,7 @@ public class MessagingController implements Runnable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Update the messages in the local store
|
// Update the messages in the local store
|
||||||
localFolder.setFlags(messages, Collections.singletonList(flag), newState);
|
localFolder.setFlags(messages, Collections.singleton(flag), newState);
|
||||||
|
|
||||||
int unreadMessageCount = localFolder.getUnreadMessageCount();
|
int unreadMessageCount = localFolder.getUnreadMessageCount();
|
||||||
for (MessagingListener l : getListeners()) {
|
for (MessagingListener l : getListeners()) {
|
||||||
|
@ -130,10 +130,10 @@ public abstract class Folder {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public abstract void setFlags(List<? extends Message> messages, Collection<Flag> flags, boolean value)
|
public abstract void setFlags(List<? extends Message> messages, Set<Flag> flags, boolean value)
|
||||||
throws MessagingException;
|
throws MessagingException;
|
||||||
|
|
||||||
public abstract void setFlags(Collection<Flag> flags, boolean value) throws MessagingException;
|
public abstract void setFlags(Set<Flag> flags, boolean value) throws MessagingException;
|
||||||
|
|
||||||
public abstract String getUidFromMessageId(Message message) throws MessagingException;
|
public abstract String getUidFromMessageId(Message message) throws MessagingException;
|
||||||
|
|
||||||
|
@ -210,8 +210,8 @@ public abstract class Message implements Part, CompositeBody {
|
|||||||
/*
|
/*
|
||||||
* TODO Refactor Flags at some point to be able to store user defined flags.
|
* TODO Refactor Flags at some point to be able to store user defined flags.
|
||||||
*/
|
*/
|
||||||
public Collection<Flag> getFlags() {
|
public Set<Flag> getFlags() {
|
||||||
return Collections.unmodifiableCollection(mFlags);
|
return Collections.unmodifiableSet(mFlags);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -235,7 +235,7 @@ public abstract class Message implements Part, CompositeBody {
|
|||||||
* @param flags
|
* @param flags
|
||||||
* @param set
|
* @param set
|
||||||
*/
|
*/
|
||||||
public void setFlags(final Collection<Flag> flags, boolean set) throws MessagingException {
|
public void setFlags(final Set<Flag> flags, boolean set) throws MessagingException {
|
||||||
for (Flag flag : flags) {
|
for (Flag flag : flags) {
|
||||||
setFlag(flag, set);
|
setFlag(flag, set);
|
||||||
}
|
}
|
||||||
|
@ -2110,7 +2110,7 @@ public class ImapStore extends Store {
|
|||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setFlags(Collection<Flag> flags, boolean value)
|
public void setFlags(Set<Flag> flags, boolean value)
|
||||||
throws MessagingException {
|
throws MessagingException {
|
||||||
open(OPEN_MODE_RW);
|
open(OPEN_MODE_RW);
|
||||||
checkOpen();
|
checkOpen();
|
||||||
@ -2145,7 +2145,7 @@ public class ImapStore extends Store {
|
|||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setFlags(List<? extends Message> messages, final Collection<Flag> flags, boolean value)
|
public void setFlags(List<? extends Message> messages, final Set<Flag> flags, boolean value)
|
||||||
throws MessagingException {
|
throws MessagingException {
|
||||||
open(OPEN_MODE_RW);
|
open(OPEN_MODE_RW);
|
||||||
checkOpen();
|
checkOpen();
|
||||||
@ -2911,7 +2911,7 @@ public class ImapStore extends Store {
|
|||||||
@Override
|
@Override
|
||||||
public void setFlag(Flag flag, boolean set) throws MessagingException {
|
public void setFlag(Flag flag, boolean set) throws MessagingException {
|
||||||
super.setFlag(flag, set);
|
super.setFlag(flag, set);
|
||||||
mFolder.setFlags(Collections.singletonList(this), Collections.singletonList(flag), set);
|
mFolder.setFlags(Collections.singletonList(this), Collections.singleton(flag), set);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -977,12 +977,12 @@ public class Pop3Store extends Store {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setFlags(final Collection<Flag> flags, boolean value) throws MessagingException {
|
public void setFlags(final Set<Flag> flags, boolean value) throws MessagingException {
|
||||||
throw new UnsupportedOperationException("POP3: No setFlags(Collection<Flag>,boolean)");
|
throw new UnsupportedOperationException("POP3: No setFlags(Set<Flag>,boolean)");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setFlags(List<? extends Message> messages, final Collection<Flag> flags, boolean value)
|
public void setFlags(List<? extends Message> messages, final Set<Flag> flags, boolean value)
|
||||||
throws MessagingException {
|
throws MessagingException {
|
||||||
if (!value || !flags.contains(Flag.DELETED)) {
|
if (!value || !flags.contains(Flag.DELETED)) {
|
||||||
/*
|
/*
|
||||||
@ -1187,7 +1187,7 @@ public class Pop3Store extends Store {
|
|||||||
@Override
|
@Override
|
||||||
public void setFlag(Flag flag, boolean set) throws MessagingException {
|
public void setFlag(Flag flag, boolean set) throws MessagingException {
|
||||||
super.setFlag(flag, set);
|
super.setFlag(flag, set);
|
||||||
mFolder.setFlags(Collections.singletonList(this), Collections.singletonList(flag), set);
|
mFolder.setFlags(Collections.singletonList(this), Collections.singleton(flag), set);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -1781,7 +1781,7 @@ public class WebDavStore extends Store {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setFlags(List<? extends Message> messages, final Collection<Flag> flags, boolean value)
|
public void setFlags(List<? extends Message> messages, final Set<Flag> flags, boolean value)
|
||||||
throws MessagingException {
|
throws MessagingException {
|
||||||
String[] uids = new String[messages.size()];
|
String[] uids = new String[messages.size()];
|
||||||
|
|
||||||
@ -1929,9 +1929,9 @@ public class WebDavStore extends Store {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setFlags(final Collection<Flag> flags, boolean value) throws MessagingException {
|
public void setFlags(final Set<Flag> flags, boolean value) throws MessagingException {
|
||||||
Log.e(K9.LOG_TAG,
|
Log.e(K9.LOG_TAG,
|
||||||
"Unimplemented method setFlags(Collection<Flag>, boolean) breaks markAllMessagesAsRead and EmptyTrash");
|
"Unimplemented method setFlags(Set<Flag>, boolean) breaks markAllMessagesAsRead and EmptyTrash");
|
||||||
// Try to make this efficient by not retrieving all of the messages
|
// Try to make this efficient by not retrieving all of the messages
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2029,7 +2029,7 @@ public class WebDavStore extends Store {
|
|||||||
@Override
|
@Override
|
||||||
public void setFlag(Flag flag, boolean set) throws MessagingException {
|
public void setFlag(Flag flag, boolean set) throws MessagingException {
|
||||||
super.setFlag(flag, set);
|
super.setFlag(flag, set);
|
||||||
mFolder.setFlags(Collections.singletonList(this), Collections.singletonList(flag), set);
|
mFolder.setFlags(Collections.singletonList(this), Collections.singleton(flag), set);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1724,7 +1724,7 @@ public class LocalFolder extends Folder implements Serializable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setFlags(final List<? extends Message> messages, final Collection<Flag> flags, final boolean value)
|
public void setFlags(final List<? extends Message> messages, final Set<Flag> flags, final boolean value)
|
||||||
throws MessagingException {
|
throws MessagingException {
|
||||||
open(OPEN_MODE_RW);
|
open(OPEN_MODE_RW);
|
||||||
|
|
||||||
@ -1752,7 +1752,7 @@ public class LocalFolder extends Folder implements Serializable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setFlags(final Collection<Flag> flags, boolean value)
|
public void setFlags(final Set<Flag> flags, boolean value)
|
||||||
throws MessagingException {
|
throws MessagingException {
|
||||||
open(OPEN_MODE_RW);
|
open(OPEN_MODE_RW);
|
||||||
for (Message message : getMessages(null)) {
|
for (Message message : getMessages(null)) {
|
||||||
|
Loading…
Reference in New Issue
Block a user