mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-30 08:12:05 +00:00
landing bienvenu's fix for adding "has attachment" support to
local mail search and the mail views. bug #183581. r/sr=sspitzer
This commit is contained in:
parent
69fe7dd610
commit
b5640204f2
@ -655,7 +655,7 @@
|
|||||||
<!-- searchvalue - a widget which dynamically changes it's user interface
|
<!-- searchvalue - a widget which dynamically changes it's user interface
|
||||||
depending on what type of data it's supposed to be showing
|
depending on what type of data it's supposed to be showing
|
||||||
currently handles arbitrary text entry, and menulists for
|
currently handles arbitrary text entry, and menulists for
|
||||||
priority, status, junk status and addressbook
|
priority, status, junk status, hasAttachment status, and addressbook
|
||||||
-->
|
-->
|
||||||
<binding id="searchvalue" name="searchValue">
|
<binding id="searchvalue" name="searchValue">
|
||||||
<content>
|
<content>
|
||||||
@ -706,6 +706,11 @@
|
|||||||
<xul:menuitem value="2" stringTag="junk" class="search-value-menuitem"/>
|
<xul:menuitem value="2" stringTag="junk" class="search-value-menuitem"/>
|
||||||
</xul:menupopup>
|
</xul:menupopup>
|
||||||
</xul:menulist>
|
</xul:menulist>
|
||||||
|
<xul:menulist flex="1" class="search-value-menulist">
|
||||||
|
<xul:menupopup class="search-value-popup">
|
||||||
|
<xul:menuitem value="0" stringTag="hasAttachments" class="search-value-menuitem"/>
|
||||||
|
</xul:menupopup>
|
||||||
|
</xul:menulist>
|
||||||
</content>
|
</content>
|
||||||
<implementation>
|
<implementation>
|
||||||
<field name="internalOperator">null</field>
|
<field name="internalOperator">null</field>
|
||||||
@ -797,6 +802,9 @@
|
|||||||
else if (val == Components.interfaces.nsMsgSearchAttrib.JunkStatus) {
|
else if (val == Components.interfaces.nsMsgSearchAttrib.JunkStatus) {
|
||||||
this.setAttribute("selectedIndex", "6");
|
this.setAttribute("selectedIndex", "6");
|
||||||
}
|
}
|
||||||
|
else if (val == Components.interfaces.nsMsgSearchAttrib.HasAttachmentStatus) {
|
||||||
|
this.setAttribute("selectedIndex", "7");
|
||||||
|
}
|
||||||
else {
|
else {
|
||||||
// a normal text field
|
// a normal text field
|
||||||
this.setAttribute("selectedIndex", "0");
|
this.setAttribute("selectedIndex", "0");
|
||||||
@ -853,6 +861,12 @@
|
|||||||
if (junkStatus.length > 0)
|
if (junkStatus.length > 0)
|
||||||
children[6].selectedItem = junkStatus[0];
|
children[6].selectedItem = junkStatus[0];
|
||||||
}
|
}
|
||||||
|
else if (attrib == nsMsgSearchAttrib.HasAttachmentStatus) {
|
||||||
|
var hasAttachmentStatus =
|
||||||
|
children[7].getElementsByAttribute("value", val.hasAttachmentStatus);
|
||||||
|
if (hasAttachmentStatus.length > 0)
|
||||||
|
children[7].selectedItem = hasAttachmentStatus[0];
|
||||||
|
}
|
||||||
else
|
else
|
||||||
children[0].value = val.str;
|
children[0].value = val.str;
|
||||||
return val;
|
return val;
|
||||||
@ -872,7 +886,7 @@
|
|||||||
searchValue.priority = children[1].selectedItem.value;
|
searchValue.priority = children[1].selectedItem.value;
|
||||||
}
|
}
|
||||||
else if (searchAttribute == nsMsgSearchAttrib.MsgStatus)
|
else if (searchAttribute == nsMsgSearchAttrib.MsgStatus)
|
||||||
searchValue.status = children[2].selectedItem.value;
|
searchValue.status = children[2].value;
|
||||||
else if (searchAttribute == nsMsgSearchAttrib.AgeInDays)
|
else if (searchAttribute == nsMsgSearchAttrib.AgeInDays)
|
||||||
searchValue.age = children[0].value;
|
searchValue.age = children[0].value;
|
||||||
else if (searchAttribute == nsMsgSearchAttrib.Date)
|
else if (searchAttribute == nsMsgSearchAttrib.Date)
|
||||||
@ -890,6 +904,8 @@
|
|||||||
searchValue.junkStatus = children[6].value;
|
searchValue.junkStatus = children[6].value;
|
||||||
else if (searchAttribute == nsMsgSearchAttrib.Size)
|
else if (searchAttribute == nsMsgSearchAttrib.Size)
|
||||||
searchValue.size = children[0].value;
|
searchValue.size = children[0].value;
|
||||||
|
else if (searchAttribute == nsMsgSearchAttrib.HasAttachmentStatus)
|
||||||
|
searchValue.status = 0x10000000; // 0x10000000 is MSG_FLAG_ATTACHMENT;
|
||||||
else
|
else
|
||||||
searchValue.str = children[0].value;
|
searchValue.str = children[0].value;
|
||||||
]]>
|
]]>
|
||||||
@ -976,6 +992,8 @@
|
|||||||
|
|
||||||
// initialize the junk status picker
|
// initialize the junk status picker
|
||||||
this.initialize(document.getAnonymousNodes(this)[6], bundle);
|
this.initialize(document.getAnonymousNodes(this)[6], bundle);
|
||||||
|
// initialize the has attachment status picker
|
||||||
|
this.initialize(document.getAnonymousNodes(this)[7], bundle);
|
||||||
]]>
|
]]>
|
||||||
</constructor>
|
</constructor>
|
||||||
</implementation>
|
</implementation>
|
||||||
|
@ -183,6 +183,8 @@ unknown=Unknown
|
|||||||
junk=Junk
|
junk=Junk
|
||||||
notjunk=Not Junk
|
notjunk=Not Junk
|
||||||
|
|
||||||
|
hasAttachments=Has Attachments
|
||||||
|
|
||||||
# mailnews.js
|
# mailnews.js
|
||||||
mailnews.send_default_charset=ISO-8859-1
|
mailnews.send_default_charset=ISO-8859-1
|
||||||
mailnews.view_default_charset=ISO-8859-1
|
mailnews.view_default_charset=ISO-8859-1
|
||||||
|
@ -102,8 +102,8 @@ interface nsMsgSearchAttrib {
|
|||||||
const nsMsgSearchAttribValue Department = 30;
|
const nsMsgSearchAttribValue Department = 30;
|
||||||
const nsMsgSearchAttribValue AdditionalEmail = 31;
|
const nsMsgSearchAttribValue AdditionalEmail = 31;
|
||||||
|
|
||||||
// 32 - 46, reserved for ab / LDAP;
|
// 32 - 45, reserved for ab / LDAP;
|
||||||
|
const nsMsgSearchAttribValue HasAttachmentStatus = 46;
|
||||||
const nsMsgSearchAttribValue JunkStatus = 47;
|
const nsMsgSearchAttribValue JunkStatus = 47;
|
||||||
const nsMsgSearchAttribValue Label = 48; /* mail only...can search by label */
|
const nsMsgSearchAttribValue Label = 48; /* mail only...can search by label */
|
||||||
//49 is for showing customize... in ui headers start from 50 onwards up until 99.
|
//49 is for showing customize... in ui headers start from 50 onwards up until 99.
|
||||||
@ -211,7 +211,8 @@ typedef struct nsMsgSearchValue
|
|||||||
_a == nsMsgSearchAttrib::MsgStatus || _a == nsMsgSearchAttrib::MessageKey || \
|
_a == nsMsgSearchAttrib::MsgStatus || _a == nsMsgSearchAttrib::MessageKey || \
|
||||||
_a == nsMsgSearchAttrib::Size || _a == nsMsgSearchAttrib::AgeInDays || \
|
_a == nsMsgSearchAttrib::Size || _a == nsMsgSearchAttrib::AgeInDays || \
|
||||||
_a == nsMsgSearchAttrib::FolderInfo || _a == nsMsgSearchAttrib::Location || \
|
_a == nsMsgSearchAttrib::FolderInfo || _a == nsMsgSearchAttrib::Location || \
|
||||||
_a == nsMsgSearchAttrib::Label || _a == nsMsgSearchAttrib::JunkStatus))
|
_a == nsMsgSearchAttrib::Label || _a == nsMsgSearchAttrib::JunkStatus || \
|
||||||
|
_a == nsMsgSearchAttrib::HasAttachmentStatus))
|
||||||
%}
|
%}
|
||||||
|
|
||||||
[ptr] native nsSearchMenuItem(nsSearchMenuItem);
|
[ptr] native nsSearchMenuItem(nsSearchMenuItem);
|
||||||
|
@ -47,7 +47,7 @@
|
|||||||
43=reserved for AB
|
43=reserved for AB
|
||||||
44=reserved for AB
|
44=reserved for AB
|
||||||
45=reserved for AB
|
45=reserved for AB
|
||||||
46=reserved for AB
|
46=Attachment Status
|
||||||
47=Junk Status
|
47=Junk Status
|
||||||
48=Label
|
48=Label
|
||||||
# don't use above 49
|
# don't use above 49
|
||||||
|
@ -171,7 +171,6 @@ nsresult nsMsgSearchOnlineMail::Encode (nsCString& pEncoding,
|
|||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
#define READY_TO_FORK_AND_SPAM_IS_ENABLED 1
|
|
||||||
|
|
||||||
nsresult nsMsgSearchValidityManager::InitOfflineMailTable ()
|
nsresult nsMsgSearchValidityManager::InitOfflineMailTable ()
|
||||||
{
|
{
|
||||||
@ -290,14 +289,15 @@ nsresult nsMsgSearchValidityManager::InitOfflineMailTable ()
|
|||||||
m_offlineMailTable->SetAvailable (nsMsgSearchAttrib::AgeInDays, nsMsgSearchOp::Is, 1);
|
m_offlineMailTable->SetAvailable (nsMsgSearchAttrib::AgeInDays, nsMsgSearchOp::Is, 1);
|
||||||
m_offlineMailTable->SetEnabled (nsMsgSearchAttrib::AgeInDays, nsMsgSearchOp::Is, 1);
|
m_offlineMailTable->SetEnabled (nsMsgSearchAttrib::AgeInDays, nsMsgSearchOp::Is, 1);
|
||||||
|
|
||||||
// don't enable this until we are ready to fork rules.dat
|
|
||||||
// and the bayesian junk filter has landed
|
|
||||||
#ifdef READY_TO_FORK_AND_SPAM_IS_ENABLED
|
|
||||||
m_offlineMailTable->SetAvailable (nsMsgSearchAttrib::JunkStatus, nsMsgSearchOp::Is, 1);
|
m_offlineMailTable->SetAvailable (nsMsgSearchAttrib::JunkStatus, nsMsgSearchOp::Is, 1);
|
||||||
m_offlineMailTable->SetEnabled (nsMsgSearchAttrib::JunkStatus, nsMsgSearchOp::Is, 1);
|
m_offlineMailTable->SetEnabled (nsMsgSearchAttrib::JunkStatus, nsMsgSearchOp::Is, 1);
|
||||||
m_offlineMailTable->SetAvailable (nsMsgSearchAttrib::JunkStatus, nsMsgSearchOp::Isnt, 1);
|
m_offlineMailTable->SetAvailable (nsMsgSearchAttrib::JunkStatus, nsMsgSearchOp::Isnt, 1);
|
||||||
m_offlineMailTable->SetEnabled (nsMsgSearchAttrib::JunkStatus, nsMsgSearchOp::Isnt, 1);
|
m_offlineMailTable->SetEnabled (nsMsgSearchAttrib::JunkStatus, nsMsgSearchOp::Isnt, 1);
|
||||||
#endif
|
|
||||||
|
m_offlineMailTable->SetAvailable (nsMsgSearchAttrib::HasAttachmentStatus, nsMsgSearchOp::Is, 1);
|
||||||
|
m_offlineMailTable->SetEnabled (nsMsgSearchAttrib::HasAttachmentStatus, nsMsgSearchOp::Is, 1);
|
||||||
|
m_offlineMailTable->SetAvailable (nsMsgSearchAttrib::HasAttachmentStatus, nsMsgSearchOp::Isnt, 1);
|
||||||
|
m_offlineMailTable->SetEnabled (nsMsgSearchAttrib::HasAttachmentStatus, nsMsgSearchOp::Isnt, 1);
|
||||||
|
|
||||||
m_offlineMailTable->SetAvailable (nsMsgSearchAttrib::OtherHeader, nsMsgSearchOp::Contains, 1);
|
m_offlineMailTable->SetAvailable (nsMsgSearchAttrib::OtherHeader, nsMsgSearchOp::Contains, 1);
|
||||||
m_offlineMailTable->SetEnabled (nsMsgSearchAttrib::OtherHeader, nsMsgSearchOp::Contains, 1);
|
m_offlineMailTable->SetEnabled (nsMsgSearchAttrib::OtherHeader, nsMsgSearchOp::Contains, 1);
|
||||||
|
@ -541,6 +541,7 @@ nsresult nsMsgSearchOfflineMail::ProcessSearchTerm(nsIMsgDBHdr *msgToMatch,
|
|||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
case nsMsgSearchAttrib::HasAttachmentStatus:
|
||||||
case nsMsgSearchAttrib::MsgStatus:
|
case nsMsgSearchAttrib::MsgStatus:
|
||||||
err = aTerm->MatchStatus (msgFlags, &result);
|
err = aTerm->MatchStatus (msgFlags, &result);
|
||||||
break;
|
break;
|
||||||
|
@ -99,6 +99,7 @@ nsMsgSearchAttribEntry SearchAttribEntryTable[] =
|
|||||||
// the old style. see bug #179803
|
// the old style. see bug #179803
|
||||||
{nsMsgSearchAttrib::Sender, "from in ab"},
|
{nsMsgSearchAttrib::Sender, "from in ab"},
|
||||||
{nsMsgSearchAttrib::JunkStatus, "junk status"},
|
{nsMsgSearchAttrib::JunkStatus, "junk status"},
|
||||||
|
{nsMsgSearchAttrib::HasAttachmentStatus, "has attachment status"},
|
||||||
};
|
};
|
||||||
|
|
||||||
// Take a string which starts off with an attribute
|
// Take a string which starts off with an attribute
|
||||||
@ -184,7 +185,6 @@ nsresult NS_MsgGetStringForAttribute(PRInt16 attrib, const char **string)
|
|||||||
}
|
}
|
||||||
// we no longer return invalid attribute. If we cannot find the string in the table,
|
// we no longer return invalid attribute. If we cannot find the string in the table,
|
||||||
// then it is an arbitrary header. Return success regardless if found or not
|
// then it is an arbitrary header. Return success regardless if found or not
|
||||||
// return (found) ? SearchError_Success : SearchError_InvalidAttribute;
|
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -458,6 +458,11 @@ nsresult nsMsgSearchTerm::OutputValue(nsCString &outputStr)
|
|||||||
outputStr.AppendWithConversion(priority);
|
outputStr.AppendWithConversion(priority);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
case nsMsgSearchAttrib::HasAttachmentStatus:
|
||||||
|
{
|
||||||
|
outputStr.Append("true"); // don't need anything here, really
|
||||||
|
break;
|
||||||
|
}
|
||||||
default:
|
default:
|
||||||
NS_ASSERTION(PR_FALSE, "trying to output invalid attribute");
|
NS_ASSERTION(PR_FALSE, "trying to output invalid attribute");
|
||||||
break;
|
break;
|
||||||
@ -543,6 +548,9 @@ nsresult nsMsgSearchTerm::ParseValue(char *inStream)
|
|||||||
case nsMsgSearchAttrib::JunkStatus:
|
case nsMsgSearchAttrib::JunkStatus:
|
||||||
m_value.u.junkStatus = atoi(inStream); // only if we read from disk, right?
|
m_value.u.junkStatus = atoi(inStream); // only if we read from disk, right?
|
||||||
break;
|
break;
|
||||||
|
case nsMsgSearchAttrib::HasAttachmentStatus:
|
||||||
|
m_value.u.msgStatus = MSG_FLAG_ATTACHMENT;
|
||||||
|
break; // this should always be true.
|
||||||
default:
|
default:
|
||||||
NS_ASSERTION(PR_FALSE, "invalid attribute parsing search term value");
|
NS_ASSERTION(PR_FALSE, "invalid attribute parsing search term value");
|
||||||
break;
|
break;
|
||||||
@ -1301,7 +1309,7 @@ nsresult nsMsgSearchTerm::MatchStatus(PRUint32 statusToMatch, PRBool *pResult)
|
|||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
rv = NS_ERROR_FAILURE;
|
rv = NS_ERROR_FAILURE;
|
||||||
NS_ASSERTION(PR_FALSE, "invalid compare op for msg status");
|
NS_ERROR("invalid compare op for msg status");
|
||||||
}
|
}
|
||||||
|
|
||||||
*pResult = matches;
|
*pResult = matches;
|
||||||
@ -1572,6 +1580,7 @@ nsresult nsMsgResultElement::AssignValues (nsIMsgSearchValue *src, nsMsgSearchVa
|
|||||||
case nsMsgSearchAttrib::Date:
|
case nsMsgSearchAttrib::Date:
|
||||||
err = src->GetDate(&dst->u.date);
|
err = src->GetDate(&dst->u.date);
|
||||||
break;
|
break;
|
||||||
|
case nsMsgSearchAttrib::HasAttachmentStatus:
|
||||||
case nsMsgSearchAttrib::MsgStatus:
|
case nsMsgSearchAttrib::MsgStatus:
|
||||||
err = src->GetStatus(&dst->u.msgStatus);
|
err = src->GetStatus(&dst->u.msgStatus);
|
||||||
break;
|
break;
|
||||||
|
@ -16,3 +16,7 @@ name="Not Junk"
|
|||||||
enabled="yes"
|
enabled="yes"
|
||||||
type="1"
|
type="1"
|
||||||
condition="AND (junk status,isn't,2)"
|
condition="AND (junk status,isn't,2)"
|
||||||
|
name="Has Attachments"
|
||||||
|
enabled="yes"
|
||||||
|
type="1"
|
||||||
|
condition="AND (has attachment status,is,true)"
|
||||||
|
Loading…
Reference in New Issue
Block a user