diff --git a/mailnews/base/resources/content/subscribe.xul b/mailnews/base/resources/content/subscribe.xul
index f693e6b8a682..9902344822fc 100644
--- a/mailnews/base/resources/content/subscribe.xul
+++ b/mailnews/base/resources/content/subscribe.xul
@@ -65,7 +65,7 @@ Rights Reserved.
-
+
@@ -91,9 +91,9 @@ Rights Reserved.
-
+
-
+
diff --git a/mailnews/base/src/nsSubscribeDataSource.cpp b/mailnews/base/src/nsSubscribeDataSource.cpp
index e8ad21939607..3a12f881fd18 100644
--- a/mailnews/base/src/nsSubscribeDataSource.cpp
+++ b/mailnews/base/src/nsSubscribeDataSource.cpp
@@ -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 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 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 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;
diff --git a/mailnews/base/src/nsSubscribeDataSource.h b/mailnews/base/src/nsSubscribeDataSource.h
index 0a7f70d9eb2d..8193599773c2 100644
--- a/mailnews/base/src/nsSubscribeDataSource.h
+++ b/mailnews/base/src/nsSubscribeDataSource.h
@@ -52,6 +52,7 @@ private:
nsCOMPtr kNC_Name;
nsCOMPtr kNC_LeafName;
nsCOMPtr kNC_Subscribed;
+ nsCOMPtr kNC_ServerType;
nsCOMPtr kTrueLiteral;
nsCOMPtr 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);
diff --git a/themes/blue/messenger/subscribe.css b/themes/blue/messenger/subscribe.css
index 33f7ea670909..13767d0fbcc9 100644
--- a/themes/blue/messenger/subscribe.css
+++ b/themes/blue/messenger/subscribe.css
@@ -24,4 +24,35 @@
.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");
+}
+
diff --git a/themes/classic/messenger/mac/subscribe.css b/themes/classic/messenger/mac/subscribe.css
index 33f7ea670909..13767d0fbcc9 100644
--- a/themes/classic/messenger/mac/subscribe.css
+++ b/themes/classic/messenger/mac/subscribe.css
@@ -24,4 +24,35 @@
.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");
+}
+
diff --git a/themes/classic/messenger/win/subscribe.css b/themes/classic/messenger/win/subscribe.css
index 33f7ea670909..13767d0fbcc9 100644
--- a/themes/classic/messenger/win/subscribe.css
+++ b/themes/classic/messenger/win/subscribe.css
@@ -24,4 +24,35 @@
.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");
+}
+
diff --git a/themes/modern/messenger/subscribe.css b/themes/modern/messenger/subscribe.css
index 33f7ea670909..13767d0fbcc9 100644
--- a/themes/modern/messenger/subscribe.css
+++ b/themes/modern/messenger/subscribe.css
@@ -24,4 +24,35 @@
.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");
+}
+