mirror of
https://github.com/moparisthebest/k-9
synced 2025-01-12 06:08:25 -05:00
Refactoring to better propagate "folder" along with messages as they're instantiated
This commit is contained in:
parent
d60521f06f
commit
63b6f6bf62
@ -670,7 +670,7 @@ public class MessageList
|
||||
|
||||
private void onOpenMessage(MessageInfoHolder message)
|
||||
{
|
||||
if (mAccount != null && message.folder.name.equals(message.account.getDraftsFolderName()))
|
||||
if ( message.folder.name.equals(message.account.getDraftsFolderName()))
|
||||
{
|
||||
MessageCompose.actionEditDraft(this, message.account, message.message);
|
||||
}
|
||||
@ -1741,7 +1741,7 @@ public class MessageList
|
||||
|
||||
if (m == null)
|
||||
{
|
||||
m = new MessageInfoHolder(message, f, account);
|
||||
m = new MessageInfoHolder(message, account);
|
||||
messagesToAdd.add(m);
|
||||
}
|
||||
else
|
||||
@ -1753,7 +1753,7 @@ public class MessageList
|
||||
}
|
||||
else
|
||||
{
|
||||
m.populate(message, f, account);
|
||||
m.populate(message, new FolderInfoHolder(message.getFolder(), account), account);
|
||||
needsSort = true;
|
||||
|
||||
}
|
||||
@ -1924,7 +1924,7 @@ public class MessageList
|
||||
|
||||
|
||||
|
||||
holder.chip.setBackgroundResource( colorChipResIds[message.account.getAccountNumber() % colorChipResIds.length] );
|
||||
holder.chip.setBackgroundResource(colorChipResIds[message.account.getAccountNumber() % colorChipResIds.length]);
|
||||
holder.selected = (CheckBox) view.findViewById(R.id.selected_checkbox);
|
||||
if (holder.selected!=null)
|
||||
{
|
||||
@ -2088,10 +2088,10 @@ public class MessageList
|
||||
this.selected = false;
|
||||
}
|
||||
|
||||
public MessageInfoHolder(Message m, Folder folder, Account account)
|
||||
public MessageInfoHolder(Message m, Account account)
|
||||
{
|
||||
this();
|
||||
populate(m, new FolderInfoHolder(folder, account), account);
|
||||
populate(m, new FolderInfoHolder(m.getFolder(), account), account);
|
||||
}
|
||||
|
||||
public MessageInfoHolder(Message m, FolderInfoHolder folder, Account account)
|
||||
@ -2367,26 +2367,26 @@ public class MessageList
|
||||
}
|
||||
else
|
||||
{
|
||||
this.displayName = folder.getName();
|
||||
this.displayName = this.name;
|
||||
}
|
||||
|
||||
if (this.name.equals(mAccount.getOutboxFolderName()))
|
||||
if (this.name.equals(account.getOutboxFolderName()))
|
||||
{
|
||||
this.displayName = String.format(getString(R.string.special_mailbox_name_outbox_fmt), this.name);
|
||||
this.outbox = true;
|
||||
}
|
||||
|
||||
if (this.name.equals(mAccount.getDraftsFolderName()))
|
||||
if (this.name.equals(account.getDraftsFolderName()))
|
||||
{
|
||||
this.displayName = String.format(getString(R.string.special_mailbox_name_drafts_fmt), this.name);
|
||||
}
|
||||
|
||||
if (this.name.equals(mAccount.getTrashFolderName()))
|
||||
if (this.name.equals(account.getTrashFolderName()))
|
||||
{
|
||||
this.displayName = String.format(getString(R.string.special_mailbox_name_trash_fmt), this.name);
|
||||
}
|
||||
|
||||
if (this.name.equals(mAccount.getSentFolderName()))
|
||||
if (this.name.equals(account.getSentFolderName()))
|
||||
{
|
||||
this.displayName = String.format(getString(R.string.special_mailbox_name_sent_fmt), this.name);
|
||||
}
|
||||
|
@ -573,8 +573,6 @@ public class LocalStore extends Store implements Serializable
|
||||
queryString
|
||||
}
|
||||
);
|
||||
|
||||
|
||||
}
|
||||
/*
|
||||
* Given a query string, actually do the query for the messages and
|
||||
@ -628,7 +626,7 @@ public class LocalStore extends Store implements Serializable
|
||||
|
||||
public class LocalFolder extends Folder implements Serializable
|
||||
{
|
||||
private String mName;
|
||||
private String mName = null;
|
||||
private long mFolderId = -1;
|
||||
private int mUnreadMessageCount = -1;
|
||||
private int mVisibleLimit = -1;
|
||||
@ -725,7 +723,7 @@ public class LocalStore extends Store implements Serializable
|
||||
@Override
|
||||
public boolean isOpen()
|
||||
{
|
||||
return mFolderId != -1;
|
||||
return (mFolderId != -1 && mName != null);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -2081,7 +2079,7 @@ public class LocalStore extends Store implements Serializable
|
||||
this.mAttachmentCount = cursor.getInt(10);
|
||||
this.setInternalDate(new Date(cursor.getLong(11)));
|
||||
this.setMessageId(cursor.getString(12));
|
||||
if (this.getFolder() == null)
|
||||
if (this.mFolder == null)
|
||||
{
|
||||
LocalFolder f = new LocalFolder(cursor.getInt(13));
|
||||
f.open(LocalFolder.OpenMode.READ_WRITE);
|
||||
|
Loading…
Reference in New Issue
Block a user