зеркало из https://github.com/mozilla/gecko-dev.git
fix for #39398. need icons in the tree and the menu list in the subscribe dialog. sr=bienvenu,syd.
This commit is contained in:
Родитель
885d29d0b4
Коммит
14e422f3fc
|
@ -65,7 +65,7 @@ Rights Reserved.
|
|||
<template>
|
||||
<rule NC:CanSubscribe="true">
|
||||
<menupopup>
|
||||
<menuitem uri="..." value="rdf:http://home.netscape.com/NC-rdf#Name"/>
|
||||
<menuitem class="subscribeMenuItem menuitem-iconic" uri="..." value="rdf:http://home.netscape.com/NC-rdf#Name" ServerType="rdf:http://home.netscape.com/NC-rdf#ServerType" IsSecure="rdf:http://home.netscape.com/NC-rdf#IsSecure"/>
|
||||
</menupopup>
|
||||
</rule>
|
||||
</template>
|
||||
|
@ -91,9 +91,9 @@ Rights Reserved.
|
|||
<template>
|
||||
<rule>
|
||||
<treechildren flex="1">
|
||||
<treeitem uri="..." name="rdf:http://home.netscape.com/NC-rdf#Name" Subscribed="rdf:http://home.netscape.com/NC-rdf#Subscribed">
|
||||
<treeitem uri="..." name="rdf:http://home.netscape.com/NC-rdf#Name" Subscribed="rdf:http://home.netscape.com/NC-rdf#Subscribed" ServerType="rdf:http://home.netscape.com/NC-rdf#ServerType">
|
||||
<treerow>
|
||||
<treecell indent="true" class="treecell-indent" value="rdf:http://home.netscape.com/NC-rdf#LeafName"/>
|
||||
<treecell indent="true" class="treecell-indent tree-cell-subscribe-icon" value="rdf:http://home.netscape.com/NC-rdf#LeafName" ServerType="rdf:http://home.netscape.com/NC-rdf#ServerType"/>
|
||||
<treecell class="treecell-image subscribedcol" allowevents="true" onclick="return top.ReverseStateFromNode(event.originalTarget.parentNode.parentNode.parentNode)" value="rdf:http://home.netscape.com/NC-rdf#Subscribed"/>
|
||||
<treecell value="rdf:http://home.netscape.com/NC-rdf#TotalMessages"/>
|
||||
</treerow>
|
||||
|
|
|
@ -81,6 +81,9 @@ nsSubscribeDataSource::Init()
|
|||
rv = mRDFService->GetResource(NC_NAMESPACE_URI "Subscribed",getter_AddRefs(kNC_Subscribed));
|
||||
NS_ENSURE_SUCCESS(rv,rv);
|
||||
|
||||
rv = mRDFService->GetResource(NC_NAMESPACE_URI "ServerType",getter_AddRefs(kNC_ServerType));
|
||||
NS_ENSURE_SUCCESS(rv,rv);
|
||||
|
||||
rv = mRDFService->GetLiteral(NS_ConvertASCIItoUCS2("true").GetUnicode(),getter_AddRefs(kTrueLiteral));
|
||||
NS_ENSURE_SUCCESS(rv,rv);
|
||||
|
||||
|
@ -187,6 +190,19 @@ nsSubscribeDataSource::GetTarget(nsIRDFResource *source,
|
|||
return NS_OK;
|
||||
}
|
||||
}
|
||||
else if (property == kNC_ServerType.get()) {
|
||||
nsXPIDLCString serverTypeStr;
|
||||
rv = GetServerType(server, getter_Copies(serverTypeStr));
|
||||
NS_ENSURE_SUCCESS(rv,rv);
|
||||
|
||||
nsCOMPtr<nsIRDFLiteral> serverType;
|
||||
rv = mRDFService->GetLiteral(NS_ConvertASCIItoUCS2((const char *)serverTypeStr).GetUnicode(), getter_AddRefs(serverType));
|
||||
NS_ENSURE_SUCCESS(rv,rv);
|
||||
|
||||
if (!serverType) rv = NS_RDF_NO_VALUE;
|
||||
if (rv == NS_RDF_NO_VALUE) return(rv);
|
||||
return serverType->QueryInterface(NS_GET_IID(nsIRDFNode), (void**) target);
|
||||
}
|
||||
else if (property == kNC_LeafName.get()) {
|
||||
nsXPIDLString leafNameStr;
|
||||
rv = server->GetLeafName(relativePath, getter_Copies(leafNameStr));
|
||||
|
@ -318,6 +334,22 @@ nsSubscribeDataSource::GetTargets(nsIRDFResource *source,
|
|||
*targets = result;
|
||||
return NS_OK;
|
||||
}
|
||||
else if (property == kNC_ServerType.get()) {
|
||||
nsXPIDLCString serverTypeStr;
|
||||
rv = GetServerType(server, getter_Copies(serverTypeStr));
|
||||
NS_ENSURE_SUCCESS(rv,rv);
|
||||
|
||||
nsCOMPtr<nsIRDFLiteral> serverType;
|
||||
rv = mRDFService->GetLiteral(NS_ConvertASCIItoUCS2((const char *)serverTypeStr).GetUnicode(), getter_AddRefs(serverType));
|
||||
NS_ENSURE_SUCCESS(rv,rv);
|
||||
|
||||
nsISimpleEnumerator* result = new nsSingletonEnumerator(serverType);
|
||||
if (!result) return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
NS_ADDREF(result);
|
||||
*targets = result;
|
||||
return NS_OK;
|
||||
}
|
||||
else {
|
||||
// do nothing
|
||||
}
|
||||
|
@ -366,6 +398,22 @@ nsSubscribeDataSource::Move(nsIRDFResource* aOldSource,
|
|||
return NS_RDF_ASSERTION_REJECTED;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsSubscribeDataSource::GetServerType(nsISubscribableServer *server, char **serverType)
|
||||
{
|
||||
nsresult rv;
|
||||
|
||||
if (!server || !serverType) return NS_ERROR_NULL_POINTER;
|
||||
nsCOMPtr<nsIMsgIncomingServer> incomingServer(do_QueryInterface(server, &rv));
|
||||
NS_ENSURE_SUCCESS(rv,rv);
|
||||
if (!incomingServer) return NS_ERROR_FAILURE;
|
||||
|
||||
rv = incomingServer->GetType(serverType);
|
||||
NS_ENSURE_SUCCESS(rv,rv);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsSubscribeDataSource::GetServerAndRelativePathFromResource(nsIRDFResource *source, nsISubscribableServer **server, char **relativePath)
|
||||
{
|
||||
|
@ -462,6 +510,10 @@ nsSubscribeDataSource::HasAssertion(nsIRDFResource *source,
|
|||
// everything is subscribed or not
|
||||
*hasAssertion = PR_TRUE;
|
||||
}
|
||||
else if (property == kNC_ServerType.get()) {
|
||||
// everything has a server type
|
||||
*hasAssertion = PR_TRUE;
|
||||
}
|
||||
else {
|
||||
// do nothing
|
||||
}
|
||||
|
@ -499,6 +551,7 @@ nsSubscribeDataSource::HasArcOut(nsIRDFResource *source, nsIRDFResource *aArc, P
|
|||
}
|
||||
else if ((aArc == kNC_Subscribed.get()) ||
|
||||
(aArc == kNC_LeafName.get()) ||
|
||||
(aArc == kNC_ServerType.get()) ||
|
||||
(aArc == kNC_Name.get())) {
|
||||
*result = PR_TRUE;
|
||||
return NS_OK;
|
||||
|
@ -546,6 +599,7 @@ nsSubscribeDataSource::ArcLabelsOut(nsIRDFResource *source,
|
|||
|
||||
array->AppendElement(kNC_Subscribed);
|
||||
array->AppendElement(kNC_Name);
|
||||
array->AppendElement(kNC_ServerType);
|
||||
array->AppendElement(kNC_LeafName);
|
||||
|
||||
PRBool hasChildren = PR_FALSE;
|
||||
|
|
|
@ -52,6 +52,7 @@ private:
|
|||
nsCOMPtr <nsIRDFResource> kNC_Name;
|
||||
nsCOMPtr <nsIRDFResource> kNC_LeafName;
|
||||
nsCOMPtr <nsIRDFResource> kNC_Subscribed;
|
||||
nsCOMPtr <nsIRDFResource> kNC_ServerType;
|
||||
nsCOMPtr <nsIRDFLiteral> kTrueLiteral;
|
||||
nsCOMPtr <nsIRDFLiteral> kFalseLiteral;
|
||||
|
||||
|
@ -60,6 +61,7 @@ private:
|
|||
|
||||
nsresult GetChildren(nsISubscribableServer *server, const char *relativePath, nsISimpleEnumerator** aResult);
|
||||
nsresult GetServerAndRelativePathFromResource(nsIRDFResource *source, nsISubscribableServer **server, char **relativePath);
|
||||
nsresult GetServerType(nsISubscribableServer *server, char **serverType);
|
||||
|
||||
static PRBool assertEnumFunc(nsISupports *aElement, void *aData);
|
||||
static PRBool unassertEnumFunc(nsISupports *aElement, void *aData);
|
||||
|
|
|
@ -25,3 +25,34 @@
|
|||
.subscribedcol[value="true"] {
|
||||
list-style-image: url("chrome://messenger/skin/check.gif");
|
||||
}
|
||||
|
||||
/* icons (newsgroup or mail folder) for the tree */
|
||||
|
||||
.tree-cell-subscribe-icon
|
||||
{
|
||||
list-style-image: url("chrome://messenger/skin/folder-closed.gif");
|
||||
}
|
||||
|
||||
.tree-cell-subscribe-icon[ServerType="nntp"] {
|
||||
list-style-image: url("chrome://messenger/skin/folder-newsgroup.gif");
|
||||
}
|
||||
|
||||
|
||||
/* for the server menu picker */
|
||||
|
||||
.subscribeMenuItem {
|
||||
list-style-image: url("chrome://messenger/skin/server-mail.gif");
|
||||
}
|
||||
|
||||
.subscribeMenuItem[ServerType="imap"][IsSecure="true"] {
|
||||
list-style-image: url("chrome://messenger/skin/server-remote-lock.gif");
|
||||
}
|
||||
|
||||
.subscribeMenuItem[ServerType="nntp"] {
|
||||
list-style-image: url("chrome://messenger/skin/server-news.gif");
|
||||
}
|
||||
|
||||
.subscribeMenuItem[ServerType="nntp"][IsSecure="true"] {
|
||||
list-style-image: url("chrome://messenger/skin/server-news-lock.gif");
|
||||
}
|
||||
|
||||
|
|
|
@ -25,3 +25,34 @@
|
|||
.subscribedcol[value="true"] {
|
||||
list-style-image: url("chrome://messenger/skin/check.gif");
|
||||
}
|
||||
|
||||
/* icons (newsgroup or mail folder) for the tree */
|
||||
|
||||
.tree-cell-subscribe-icon
|
||||
{
|
||||
list-style-image: url("chrome://messenger/skin/folder-closed.gif");
|
||||
}
|
||||
|
||||
.tree-cell-subscribe-icon[ServerType="nntp"] {
|
||||
list-style-image: url("chrome://messenger/skin/folder-newsgroup.gif");
|
||||
}
|
||||
|
||||
|
||||
/* for the server menu picker */
|
||||
|
||||
.subscribeMenuItem {
|
||||
list-style-image: url("chrome://messenger/skin/server-mail.gif");
|
||||
}
|
||||
|
||||
.subscribeMenuItem[ServerType="imap"][IsSecure="true"] {
|
||||
list-style-image: url("chrome://messenger/skin/server-remote-lock.gif");
|
||||
}
|
||||
|
||||
.subscribeMenuItem[ServerType="nntp"] {
|
||||
list-style-image: url("chrome://messenger/skin/server-news.gif");
|
||||
}
|
||||
|
||||
.subscribeMenuItem[ServerType="nntp"][IsSecure="true"] {
|
||||
list-style-image: url("chrome://messenger/skin/server-news-lock.gif");
|
||||
}
|
||||
|
||||
|
|
|
@ -25,3 +25,34 @@
|
|||
.subscribedcol[value="true"] {
|
||||
list-style-image: url("chrome://messenger/skin/check.gif");
|
||||
}
|
||||
|
||||
/* icons (newsgroup or mail folder) for the tree */
|
||||
|
||||
.tree-cell-subscribe-icon
|
||||
{
|
||||
list-style-image: url("chrome://messenger/skin/folder-closed.gif");
|
||||
}
|
||||
|
||||
.tree-cell-subscribe-icon[ServerType="nntp"] {
|
||||
list-style-image: url("chrome://messenger/skin/folder-newsgroup.gif");
|
||||
}
|
||||
|
||||
|
||||
/* for the server menu picker */
|
||||
|
||||
.subscribeMenuItem {
|
||||
list-style-image: url("chrome://messenger/skin/server-mail.gif");
|
||||
}
|
||||
|
||||
.subscribeMenuItem[ServerType="imap"][IsSecure="true"] {
|
||||
list-style-image: url("chrome://messenger/skin/server-remote-lock.gif");
|
||||
}
|
||||
|
||||
.subscribeMenuItem[ServerType="nntp"] {
|
||||
list-style-image: url("chrome://messenger/skin/server-news.gif");
|
||||
}
|
||||
|
||||
.subscribeMenuItem[ServerType="nntp"][IsSecure="true"] {
|
||||
list-style-image: url("chrome://messenger/skin/server-news-lock.gif");
|
||||
}
|
||||
|
||||
|
|
|
@ -25,3 +25,34 @@
|
|||
.subscribedcol[value="true"] {
|
||||
list-style-image: url("chrome://messenger/skin/check.gif");
|
||||
}
|
||||
|
||||
/* icons (newsgroup or mail folder) for the tree */
|
||||
|
||||
.tree-cell-subscribe-icon
|
||||
{
|
||||
list-style-image: url("chrome://messenger/skin/folder-closed.gif");
|
||||
}
|
||||
|
||||
.tree-cell-subscribe-icon[ServerType="nntp"] {
|
||||
list-style-image: url("chrome://messenger/skin/folder-newsgroup.gif");
|
||||
}
|
||||
|
||||
|
||||
/* for the server menu picker */
|
||||
|
||||
.subscribeMenuItem {
|
||||
list-style-image: url("chrome://messenger/skin/server-mail.gif");
|
||||
}
|
||||
|
||||
.subscribeMenuItem[ServerType="imap"][IsSecure="true"] {
|
||||
list-style-image: url("chrome://messenger/skin/server-remote-lock.gif");
|
||||
}
|
||||
|
||||
.subscribeMenuItem[ServerType="nntp"] {
|
||||
list-style-image: url("chrome://messenger/skin/server-news.gif");
|
||||
}
|
||||
|
||||
.subscribeMenuItem[ServerType="nntp"][IsSecure="true"] {
|
||||
list-style-image: url("chrome://messenger/skin/server-news-lock.gif");
|
||||
}
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче