mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-10 11:55:49 +00:00
fix for bug #229214
non-subscribable folders in subscribe ui should be grayed out and have the subscribe checkbox hidden r/sr=bienvenu
This commit is contained in:
parent
cb3ff4f762
commit
2a5a30198d
@ -85,6 +85,8 @@ interface nsISubscribableServer : nsISupports {
|
||||
boolean hasChildren(in string path);
|
||||
// if path is null, use the root
|
||||
boolean isSubscribed(in string path);
|
||||
// if path is null, use the root
|
||||
boolean isSubscribable(in string path);
|
||||
// if path is null, use the root
|
||||
wstring getLeafName(in string path);
|
||||
// if path is null, use the root
|
||||
|
@ -115,6 +115,9 @@ Rights Reserved.
|
||||
<binding subject="?member"
|
||||
predicate="http://home.netscape.com/NC-rdf#Subscribed"
|
||||
object="?Subscribed"/>
|
||||
<binding subject="?member"
|
||||
predicate="http://home.netscape.com/NC-rdf#Subscribable"
|
||||
object="?Subscribable"/>
|
||||
<binding subject="?member"
|
||||
predicate="http://home.netscape.com/NC-rdf#TotalMessages"
|
||||
object="?TotalMessages"/>
|
||||
@ -124,8 +127,8 @@ Rights Reserved.
|
||||
<treechildren>
|
||||
<treeitem uri="?member">
|
||||
<treerow>
|
||||
<treecell label="?LeafName" properties="ServerType-?ServerType"/>
|
||||
<treecell properties="Subscribed-?Subscribed"/>
|
||||
<treecell label="?LeafName" properties="ServerType-?ServerType Subscribable-?Subscribable"/>
|
||||
<treecell properties="Subscribed-?Subscribed Subscribable-?Subscribable"/>
|
||||
<!-- commenting out until bug 38906 is fixed
|
||||
<treecell label="?TotalMessages"/> -->
|
||||
</treerow>
|
||||
|
@ -686,14 +686,12 @@ nsSubscribableServer::HasChildren(const char *path, PRBool *aHasChildren)
|
||||
NS_IMETHODIMP
|
||||
nsSubscribableServer::IsSubscribed(const char *path, PRBool *aIsSubscribed)
|
||||
{
|
||||
nsresult rv = NS_OK;
|
||||
NS_ASSERTION(aIsSubscribed, "no aIsSubscribed");
|
||||
if (!aIsSubscribed) return NS_ERROR_NULL_POINTER;
|
||||
NS_ENSURE_ARG_POINTER(aIsSubscribed);
|
||||
|
||||
*aIsSubscribed = PR_FALSE;
|
||||
|
||||
SubscribeTreeNode *node = nsnull;
|
||||
rv = FindAndCreateNode(path, &node);
|
||||
nsresult rv = FindAndCreateNode(path, &node);
|
||||
NS_ENSURE_SUCCESS(rv,rv);
|
||||
|
||||
NS_ASSERTION(node,"didn't find the node");
|
||||
@ -703,6 +701,24 @@ nsSubscribableServer::IsSubscribed(const char *path, PRBool *aIsSubscribed)
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsSubscribableServer::IsSubscribable(const char *path, PRBool *aIsSubscribable)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aIsSubscribable);
|
||||
|
||||
*aIsSubscribable = PR_FALSE;
|
||||
|
||||
SubscribeTreeNode *node = nsnull;
|
||||
nsresult rv = FindAndCreateNode(path, &node);
|
||||
NS_ENSURE_SUCCESS(rv,rv);
|
||||
|
||||
NS_ASSERTION(node,"didn't find the node");
|
||||
if (!node) return NS_ERROR_FAILURE;
|
||||
|
||||
*aIsSubscribable = node->isSubscribable;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsSubscribableServer::GetLeafName(const char *path, PRUnichar **aLeafName)
|
||||
{
|
||||
|
@ -99,6 +99,10 @@ nsSubscribeDataSource::Init()
|
||||
getter_AddRefs(kNC_Subscribed));
|
||||
NS_ENSURE_SUCCESS(rv,rv);
|
||||
|
||||
rv = mRDFService->GetResource(NS_LITERAL_CSTRING(NC_NAMESPACE_URI "Subscribable"),
|
||||
getter_AddRefs(kNC_Subscribable));
|
||||
NS_ENSURE_SUCCESS(rv,rv);
|
||||
|
||||
rv = mRDFService->GetResource(NS_LITERAL_CSTRING(NC_NAMESPACE_URI "ServerType"),
|
||||
getter_AddRefs(kNC_ServerType));
|
||||
NS_ENSURE_SUCCESS(rv,rv);
|
||||
@ -198,16 +202,16 @@ nsSubscribeDataSource::GetTarget(nsIRDFResource *source,
|
||||
rv = server->IsSubscribed(relativePath, &isSubscribed);
|
||||
NS_ENSURE_SUCCESS(rv,rv);
|
||||
|
||||
if (isSubscribed) {
|
||||
*target = kTrueLiteral;
|
||||
NS_IF_ADDREF(*target);
|
||||
return NS_OK;
|
||||
}
|
||||
else {
|
||||
*target = kFalseLiteral;
|
||||
NS_IF_ADDREF(*target);
|
||||
return NS_OK;
|
||||
}
|
||||
NS_IF_ADDREF(*target = (isSubscribed ? kTrueLiteral : kFalseLiteral));
|
||||
return NS_OK;
|
||||
}
|
||||
else if (property == kNC_Subscribable.get()) {
|
||||
PRBool isSubscribable;
|
||||
rv = server->IsSubscribable(relativePath, &isSubscribable);
|
||||
NS_ENSURE_SUCCESS(rv,rv);
|
||||
|
||||
NS_IF_ADDREF(*target = (isSubscribable ? kTrueLiteral : kFalseLiteral));
|
||||
return NS_OK;
|
||||
}
|
||||
else if (property == kNC_ServerType.get()) {
|
||||
nsXPIDLCString serverTypeStr;
|
||||
@ -319,8 +323,7 @@ nsSubscribeDataSource::GetTargets(nsIRDFResource *source,
|
||||
nsISimpleEnumerator* result = new nsSingletonEnumerator(leafName);
|
||||
if (!result) return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
NS_ADDREF(result);
|
||||
*targets = result;
|
||||
NS_IF_ADDREF(*targets = result);
|
||||
return NS_OK;
|
||||
}
|
||||
else if (property == kNC_Subscribed.get()) {
|
||||
@ -328,17 +331,21 @@ nsSubscribeDataSource::GetTargets(nsIRDFResource *source,
|
||||
rv = server->IsSubscribed(relativePath, &isSubscribed);
|
||||
NS_ENSURE_SUCCESS(rv,rv);
|
||||
|
||||
nsISimpleEnumerator* result = nsnull;
|
||||
if (isSubscribed) {
|
||||
result = new nsSingletonEnumerator(kTrueLiteral);
|
||||
}
|
||||
else {
|
||||
result = new nsSingletonEnumerator(kFalseLiteral);
|
||||
}
|
||||
nsISimpleEnumerator* result = new nsSingletonEnumerator(isSubscribed ? kTrueLiteral : kFalseLiteral);
|
||||
if (!result) return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
NS_ADDREF(result);
|
||||
*targets = result;
|
||||
NS_IF_ADDREF(*targets = result);
|
||||
return NS_OK;
|
||||
}
|
||||
else if (property == kNC_Subscribable.get()) {
|
||||
PRBool isSubscribable;
|
||||
rv = server->IsSubscribable(relativePath, &isSubscribable);
|
||||
NS_ENSURE_SUCCESS(rv,rv);
|
||||
|
||||
nsISimpleEnumerator* result = new nsSingletonEnumerator(isSubscribable ? kTrueLiteral : kFalseLiteral);
|
||||
if (!result) return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
NS_IF_ADDREF(*targets = result);
|
||||
return NS_OK;
|
||||
}
|
||||
else if (property == kNC_Name.get()) {
|
||||
@ -349,8 +356,7 @@ nsSubscribeDataSource::GetTargets(nsIRDFResource *source,
|
||||
nsISimpleEnumerator* result = new nsSingletonEnumerator(name);
|
||||
if (!result) return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
NS_ADDREF(result);
|
||||
*targets = result;
|
||||
NS_IF_ADDREF(*targets = result);
|
||||
return NS_OK;
|
||||
}
|
||||
else if (property == kNC_ServerType.get()) {
|
||||
@ -365,8 +371,7 @@ nsSubscribeDataSource::GetTargets(nsIRDFResource *source,
|
||||
nsISimpleEnumerator* result = new nsSingletonEnumerator(serverType);
|
||||
if (!result) return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
NS_ADDREF(result);
|
||||
*targets = result;
|
||||
NS_IF_ADDREF(*targets = result);
|
||||
return NS_OK;
|
||||
}
|
||||
else {
|
||||
@ -529,6 +534,10 @@ nsSubscribeDataSource::HasAssertion(nsIRDFResource *source,
|
||||
// everything is subscribed or not
|
||||
*hasAssertion = PR_TRUE;
|
||||
}
|
||||
else if (property == kNC_Subscribable.get()) {
|
||||
// everything is subscribable or not
|
||||
*hasAssertion = PR_TRUE;
|
||||
}
|
||||
else if (property == kNC_ServerType.get()) {
|
||||
// everything has a server type
|
||||
*hasAssertion = PR_TRUE;
|
||||
@ -569,6 +578,7 @@ nsSubscribeDataSource::HasArcOut(nsIRDFResource *source, nsIRDFResource *aArc, P
|
||||
return NS_OK;
|
||||
}
|
||||
else if ((aArc == kNC_Subscribed.get()) ||
|
||||
(aArc == kNC_Subscribable.get()) ||
|
||||
(aArc == kNC_LeafName.get()) ||
|
||||
(aArc == kNC_ServerType.get()) ||
|
||||
(aArc == kNC_Name.get())) {
|
||||
@ -617,6 +627,7 @@ nsSubscribeDataSource::ArcLabelsOut(nsIRDFResource *source,
|
||||
NS_ENSURE_SUCCESS(rv,rv);
|
||||
|
||||
array->AppendElement(kNC_Subscribed);
|
||||
array->AppendElement(kNC_Subscribable);
|
||||
array->AppendElement(kNC_Name);
|
||||
array->AppendElement(kNC_ServerType);
|
||||
array->AppendElement(kNC_LeafName);
|
||||
|
@ -67,6 +67,7 @@ private:
|
||||
nsCOMPtr <nsIRDFResource> kNC_Name;
|
||||
nsCOMPtr <nsIRDFResource> kNC_LeafName;
|
||||
nsCOMPtr <nsIRDFResource> kNC_Subscribed;
|
||||
nsCOMPtr <nsIRDFResource> kNC_Subscribable;
|
||||
nsCOMPtr <nsIRDFResource> kNC_ServerType;
|
||||
nsCOMPtr <nsIRDFLiteral> kTrueLiteral;
|
||||
nsCOMPtr <nsIRDFLiteral> kFalseLiteral;
|
||||
|
@ -3098,6 +3098,14 @@ nsImapIncomingServer::IsSubscribed(const char *path, PRBool *aIsSubscribed)
|
||||
return mInner->IsSubscribed(path, aIsSubscribed);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsImapIncomingServer::IsSubscribable(const char *path, PRBool *aIsSubscribable)
|
||||
{
|
||||
nsresult rv = EnsureInner();
|
||||
NS_ENSURE_SUCCESS(rv,rv);
|
||||
return mInner->IsSubscribable(path, aIsSubscribable);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsImapIncomingServer::GetLeafName(const char *path, PRUnichar **aLeafName)
|
||||
{
|
||||
|
@ -1321,6 +1321,14 @@ nsNntpIncomingServer::IsSubscribed(const char *path, PRBool *aIsSubscribed)
|
||||
return mInner->IsSubscribed(path, aIsSubscribed);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsNntpIncomingServer::IsSubscribable(const char *path, PRBool *aIsSubscribable)
|
||||
{
|
||||
nsresult rv = EnsureInner();
|
||||
NS_ENSURE_SUCCESS(rv,rv);
|
||||
return mInner->IsSubscribable(path, aIsSubscribable);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsNntpIncomingServer::GetLeafName(const char *path, PRUnichar **aLeafName)
|
||||
{
|
||||
|
@ -42,6 +42,15 @@ treechildren::-moz-tree-image(subscribedColumn2, subscribed) {
|
||||
list-style-image: url("chrome://messenger/skin/icons/check.gif");
|
||||
}
|
||||
|
||||
treechildren::-moz-tree-image(subscribedColumn, Subscribable-false) {
|
||||
list-style-image: none;
|
||||
}
|
||||
|
||||
treechildren::-moz-tree-cell-text(nameColumn, Subscribable-false) {
|
||||
color: gray;
|
||||
font-style: italic;
|
||||
}
|
||||
|
||||
/* ::::: folder icons :::::: */
|
||||
|
||||
treechildren::-moz-tree-image(nameColumn) {
|
||||
|
@ -55,6 +55,15 @@ treechildren::-moz-tree-image(subscribedColumn2, subscribed) {
|
||||
list-style-image: url("chrome://global/skin/checkbox/cbox-check.gif");
|
||||
}
|
||||
|
||||
treechildren::-moz-tree-image(subscribedColumn, Subscribable-false) {
|
||||
list-style-image: none;
|
||||
}
|
||||
|
||||
treechildren::-moz-tree-cell-text(nameColumn, Subscribable-false) {
|
||||
color: gray;
|
||||
font-style: italic;
|
||||
}
|
||||
|
||||
/* ::::: folder icons :::::: */
|
||||
|
||||
treechildren::-moz-tree-image(nameColumn) {
|
||||
|
Loading…
Reference in New Issue
Block a user