1
0
mirror of https://github.com/moparisthebest/k-9 synced 2024-11-30 21:22:26 -05:00

Numerous small fixes to search results

This commit is contained in:
Jesse Vincent 2009-12-27 17:22:57 +00:00
parent a53e9d1b89
commit 794f515bc8

View File

@ -531,7 +531,11 @@ public class MessageList
case KeyEvent.KEYCODE_DPAD_LEFT: case KeyEvent.KEYCODE_DPAD_LEFT:
{ {
if (mBatchButtonArea.hasFocus()) if (mQueryString != null)
{ // no widget customization in search results yet
return false;
}
else if (mBatchButtonArea.hasFocus())
{ {
return false; return false;
} }
@ -544,7 +548,11 @@ public class MessageList
} }
case KeyEvent.KEYCODE_DPAD_RIGHT: case KeyEvent.KEYCODE_DPAD_RIGHT:
{ {
if (mBatchButtonArea.hasFocus()) if (mQueryString != null)
{ // no widget customization in search results yet
return false;
}
else if (mBatchButtonArea.hasFocus())
{ {
return false; return false;
} }
@ -821,8 +829,17 @@ public class MessageList
private void onCompose() private void onCompose()
{ {
if (mQueryString != null)
{// if we have a query string, we don't have an account, to let compose start the default action
MessageCompose.actionCompose(this, null);
}
else
{
MessageCompose.actionCompose(this, mAccount); MessageCompose.actionCompose(this, mAccount);
} }
}
private void onEditAccount() private void onEditAccount()
{ {
@ -1109,7 +1126,7 @@ public class MessageList
private void onToggleRead(MessageInfoHolder holder) private void onToggleRead(MessageInfoHolder holder)
{ {
mController.setFlag(mAccount, holder.message.getFolder().getName(), new String[] { holder.uid }, Flag.SEEN, !holder.read); mController.setFlag(holder.account, holder.message.getFolder().getName(), new String[] { holder.uid }, Flag.SEEN, !holder.read);
holder.read = !holder.read; holder.read = !holder.read;
mHandler.sortMessages(); mHandler.sortMessages();
} }
@ -1117,7 +1134,7 @@ public class MessageList
private void onToggleFlag(MessageInfoHolder holder) private void onToggleFlag(MessageInfoHolder holder)
{ {
mController.setFlag(mAccount, holder.message.getFolder().getName(), new String[] { holder.uid }, Flag.FLAGGED, !holder.flagged); mController.setFlag(holder.account, holder.message.getFolder().getName(), new String[] { holder.uid }, Flag.FLAGGED, !holder.flagged);
holder.flagged = !holder.flagged; holder.flagged = !holder.flagged;
mHandler.sortMessages(); mHandler.sortMessages();
} }
@ -1193,7 +1210,15 @@ public class MessageList
onShowFolderList(); onShowFolderList();
return true; return true;
}
if (mQueryString != null)
{
return false; // none of the options after this point are "safe" for search results
}
switch (itemId)
{
case R.id.mark_all_as_read: case R.id.mark_all_as_read:
if (mFolderName != null) if (mFolderName != null)
{ {
@ -1303,6 +1328,16 @@ public class MessageList
@Override @Override
public boolean onPrepareOptionsMenu(Menu menu) public boolean onPrepareOptionsMenu(Menu menu)
{ {
if (mQueryString != null)
{
menu.findItem(R.id.batch_ops).setVisible(false);
menu.findItem(R.id.mark_all_as_read).setVisible(false);
menu.findItem(R.id.folder_settings).setVisible(false);
menu.findItem(R.id.account_settings).setVisible(false);
menu.findItem(R.id.list_folders).setVisible(false);
menu.findItem(R.id.expunge).setVisible(false);
}
switch (mSelectedWidget) switch (mSelectedWidget)
{ {
case WIDGET_FLAG: case WIDGET_FLAG:
@ -1575,7 +1610,7 @@ public class MessageList
public void synchronizeMailboxAddOrUpdateMessage(Account account, String folder, Message message) public void synchronizeMailboxAddOrUpdateMessage(Account account, String folder, Message message)
{ {
// eventually, we may want to check a message added during sync against the query filter // eventually, we may want to check a message added during sync against the query filter
if( mQueryString == null ) if (mQueryString == null)
{ {
addOrUpdateMessage(account, folder, message); addOrUpdateMessage(account, folder, message);
} }
@ -1591,34 +1626,47 @@ public class MessageList
@Override @Override
public void listLocalMessagesStarted(Account account, String folder) public void listLocalMessagesStarted(Account account, String folder)
{ {
if (account != null && account.equals(mAccount)) if ((mQueryString != null && folder == null) ||
(account != null && account.equals(mAccount))
)
{ {
mHandler.progress(true); mHandler.progress(true);
if (folder != null)
{
mHandler.folderLoading(folder, true); mHandler.folderLoading(folder, true);
} }
} }
}
@Override @Override
public void listLocalMessagesFailed(Account account, String folder, String message) public void listLocalMessagesFailed(Account account, String folder, String message)
{ {
if (account != null && account.equals(mAccount)) if ((mQueryString != null && folder == null) ||
(account != null && account.equals(mAccount)))
{ {
mHandler.sortMessages(); mHandler.sortMessages();
mHandler.progress(false); mHandler.progress(false);
if (folder != null)
{
mHandler.folderLoading(folder, false); mHandler.folderLoading(folder, false);
} }
}
} }
@Override @Override
public void listLocalMessagesFinished(Account account, String folder) public void listLocalMessagesFinished(Account account, String folder)
{ {
if (account != null && account.equals(mAccount)) if ((mQueryString != null && folder == null) ||
(account != null && account.equals(mAccount)))
{ {
mHandler.sortMessages(); mHandler.sortMessages();
mHandler.progress(false); mHandler.progress(false);
if (folder != null)
{
mHandler.folderLoading(folder, false); mHandler.folderLoading(folder, false);
} }
}
} }
@ -1998,6 +2046,10 @@ public class MessageList
if (footerView == null) if (footerView == null)
{ {
footerView = mInflater.inflate(R.layout.message_list_item_footer, parent, false); footerView = mInflater.inflate(R.layout.message_list_item_footer, parent, false);
if (mQueryString != null)
{
footerView.setVisibility(View.GONE);
}
footerView.setId(R.layout.message_list_item_footer); footerView.setId(R.layout.message_list_item_footer);
FooterViewHolder holder = new FooterViewHolder(); FooterViewHolder holder = new FooterViewHolder();
holder.progress = (ProgressBar)footerView.findViewById(R.id.message_list_progress); holder.progress = (ProgressBar)footerView.findViewById(R.id.message_list_progress);