show secure LDAP server icon for addressbook dir pane.
r/sr=bienvenu, a=asa
This commit is contained in:
sspitzer%netscape.com 2003-01-30 07:24:14 +00:00
Родитель f26e6ef885
Коммит 76b519462e
12 изменённых файлов: 82 добавлений и 24 удалений

Просмотреть файл

@ -130,6 +130,11 @@ interface nsIAbDirectory : nsISupports {
*/
readonly attribute boolean isRemote;
/**
* directory is secure (as in LDAP over SSL)
*/
readonly attribute boolean isSecure;
/**
* directory should be searched when doing local autocomplete
*/

Просмотреть файл

@ -65,13 +65,16 @@ Contributors:
<binding subject="?member"
predicate="http://home.netscape.com/NC-rdf#IsRemote"
object="?IsRemote"/>
<binding subject="?member"
predicate="http://home.netscape.com/NC-rdf#IsSecure"
object="?IsSecure"/>
</bindings>
<action>
<treechildren>
<treeitem uri="?member" persist="sortDirection sortColumn open">
<treerow>
<treecell label="?DirName" properties="IsMailList-?IsMailList IsRemote-?IsRemote"/>
<treecell label="?DirName" properties="IsMailList-?IsMailList IsRemote-?IsRemote IsSecure-?IsSecure"/>
</treerow>
</treeitem>
</treechildren>

Просмотреть файл

@ -280,6 +280,13 @@ NS_IMETHODIMP nsAbDirProperty::GetIsRemote(PRBool *aIsRemote)
return NS_OK;
}
NS_IMETHODIMP nsAbDirProperty::GetIsSecure(PRBool *aIsSecure)
{
NS_ENSURE_ARG_POINTER(aIsSecure);
*aIsSecure = PR_FALSE;
return NS_OK;
}
NS_IMETHODIMP nsAbDirProperty::GetSearchDuringLocalAutocomplete(PRBool *aSearchDuringLocalAutocomplete)
{
NS_ENSURE_ARG_POINTER(aSearchDuringLocalAutocomplete);

Просмотреть файл

@ -55,6 +55,7 @@
#include "nsIPref.h"
#include "nsXPCOM.h"
#include "nsISupportsPrimitives.h"
#include "nsIPrefBranch.h"
nsAbLDAPDirectory::nsAbLDAPDirectory() :
nsAbDirectoryRDFResource(),
@ -454,6 +455,27 @@ NS_IMETHODIMP nsAbLDAPDirectory::GetIsRemote(PRBool *aIsRemote)
return NS_OK;
}
NS_IMETHODIMP nsAbLDAPDirectory::GetIsSecure(PRBool *aIsSecure)
{
NS_ENSURE_ARG_POINTER(aIsSecure);
nsresult rv;
nsCOMPtr<nsIPrefBranch> prefBranch = do_GetService(NS_PREFSERVICE_CONTRACTID, &rv);
NS_ENSURE_SUCCESS(rv, rv);
// use mURINoQuery to get a prefName
nsCAutoString prefName;
prefName = nsDependentCString(mURINoQuery.get() + kLDAPDirectoryRootLen) + NS_LITERAL_CSTRING(".uri");
nsXPIDLCString URI;
rv = prefBranch->GetCharPref(prefName.get(), getter_Copies(URI));
NS_ENSURE_SUCCESS(rv,rv);
// to determine if this is a secure directory, check if the uri is ldaps:// or not
*aIsSecure = (strncmp(URI.get(), "ldaps:", 6) == 0);
return NS_OK;
}
NS_IMETHODIMP nsAbLDAPDirectory::GetSearchDuringLocalAutocomplete(PRBool *aSearchDuringLocalAutocomplete)
{
NS_ENSURE_ARG_POINTER(aSearchDuringLocalAutocomplete);

Просмотреть файл

@ -67,6 +67,7 @@ public:
NS_IMETHOD HasCard(nsIAbCard *cards, PRBool *hasCard);
NS_IMETHOD GetSupportsMailingLists(PRBool *aSupportsMailingsLists);
NS_IMETHOD GetIsRemote(PRBool *aIsRemote);
NS_IMETHOD GetIsSecure(PRBool *aIsRemote);
NS_IMETHOD GetSearchDuringLocalAutocomplete(PRBool *aSearchDuringLocalAutocomplete);
// nsAbLDAPDirectoryQuery methods

Просмотреть файл

@ -60,9 +60,9 @@
#define NC_RDF_DIRURI "http://home.netscape.com/NC-rdf#DirUri"
#define NC_RDF_ISMAILLIST "http://home.netscape.com/NC-rdf#IsMailList"
#define NC_RDF_ISREMOTE "http://home.netscape.com/NC-rdf#IsRemote"
#define NC_RDF_ISSECURE "http://home.netscape.com/NC-rdf#IsSecure"
#define NC_RDF_ISWRITEABLE "http://home.netscape.com/NC-rdf#IsWriteable"
//Directory Commands
#define NC_RDF_DELETE "http://home.netscape.com/NC-rdf#Delete"
#define NC_RDF_DELETECARDS "http://home.netscape.com/NC-rdf#DeleteCards"
@ -145,6 +145,8 @@ nsAbDirectoryDataSource::Init()
NS_ENSURE_SUCCESS(rv,rv);
rv = rdf->GetResource(NC_RDF_ISREMOTE, getter_AddRefs(kNC_IsRemote));
NS_ENSURE_SUCCESS(rv,rv);
rv = rdf->GetResource(NC_RDF_ISSECURE, getter_AddRefs(kNC_IsSecure));
NS_ENSURE_SUCCESS(rv,rv);
rv = rdf->GetResource(NC_RDF_ISWRITEABLE, getter_AddRefs(kNC_IsWriteable));
NS_ENSURE_SUCCESS(rv,rv);
rv = rdf->GetResource(NC_RDF_DELETE, getter_AddRefs(kNC_Delete));
@ -229,6 +231,7 @@ NS_IMETHODIMP nsAbDirectoryDataSource::GetTargets(nsIRDFResource* source,
(kNC_DirUri == property) ||
(kNC_IsMailList == property) ||
(kNC_IsRemote == property) ||
(kNC_IsSecure == property) ||
(kNC_IsWriteable == property))
{
nsSingletonEnumerator* cursor =
@ -300,6 +303,7 @@ nsAbDirectoryDataSource::HasArcOut(nsIRDFResource *aSource, nsIRDFResource *aArc
aArc == kNC_DirUri ||
aArc == kNC_IsMailList ||
aArc == kNC_IsRemote ||
aArc == kNC_IsSecure ||
aArc == kNC_IsWriteable);
}
else {
@ -349,6 +353,7 @@ nsAbDirectoryDataSource::getDirectoryArcLabelsOut(nsIAbDirectory *directory,
(*arcs)->AppendElement(kNC_DirUri);
(*arcs)->AppendElement(kNC_IsMailList);
(*arcs)->AppendElement(kNC_IsRemote);
(*arcs)->AppendElement(kNC_IsSecure);
(*arcs)->AppendElement(kNC_IsWriteable);
return NS_OK;
}
@ -503,6 +508,8 @@ nsresult nsAbDirectoryDataSource::createDirectoryNode(nsIAbDirectory* directory,
rv = createDirectoryIsMailListNode(directory, target);
if ((kNC_IsRemote == property))
rv = createDirectoryIsRemoteNode(directory, target);
if ((kNC_IsSecure == property))
rv = createDirectoryIsSecureNode(directory, target);
if ((kNC_IsWriteable == property))
rv = createDirectoryIsWriteableNode(directory, target);
return rv;
@ -579,16 +586,23 @@ nsresult
nsAbDirectoryDataSource::createDirectoryIsRemoteNode(nsIAbDirectory* directory,
nsIRDFNode **target)
{
nsresult rv;
PRBool isRemote;
rv = directory->GetIsRemote(&isRemote);
nsresult rv = directory->GetIsRemote(&isRemote);
NS_ENSURE_SUCCESS(rv, rv);
if (isRemote)
*target = kTrueLiteral;
else
*target = kFalseLiteral;
NS_IF_ADDREF(*target);
NS_IF_ADDREF(*target = (isRemote ? kTrueLiteral : kFalseLiteral));
return NS_OK;
}
nsresult
nsAbDirectoryDataSource::createDirectoryIsSecureNode(nsIAbDirectory* directory,
nsIRDFNode **target)
{
PRBool IsSecure;
nsresult rv = directory->GetIsSecure(&IsSecure);
NS_ENSURE_SUCCESS(rv, rv);
NS_IF_ADDREF(*target = (IsSecure ? kTrueLiteral : kFalseLiteral));
return NS_OK;
}
@ -596,16 +610,11 @@ nsresult
nsAbDirectoryDataSource::createDirectoryIsWriteableNode(nsIAbDirectory* directory,
nsIRDFNode **target)
{
nsresult rv;
PRBool isWriteable;
rv = directory->GetOperations(&isWriteable);
nsresult rv = directory->GetOperations(&isWriteable);
NS_ENSURE_SUCCESS(rv, rv);
if (isWriteable & nsIAbDirectory::opWrite)
*target = kTrueLiteral;
else
*target = kFalseLiteral;
NS_IF_ADDREF(*target);
NS_IF_ADDREF(*target = ((isWriteable & nsIAbDirectory::opWrite) ? kTrueLiteral : kFalseLiteral));
return NS_OK;
}
@ -618,11 +627,7 @@ nsAbDirectoryDataSource::createDirectoryIsMailListNode(nsIAbDirectory* directory
rv = directory->GetIsMailList(&isMailList);
NS_ENSURE_SUCCESS(rv, rv);
if (isMailList)
*target = kTrueLiteral;
else
*target = kFalseLiteral;
NS_IF_ADDREF(*target);
NS_IF_ADDREF(*target = (isMailList ? kTrueLiteral : kFalseLiteral));
return NS_OK;
}
@ -715,7 +720,7 @@ nsresult nsAbDirectoryDataSource::DoDirectoryHasAssertion(nsIAbDirectory *direct
rv = directory->HasDirectory(newDirectory, hasAssertion);
}
else if ((kNC_IsMailList == property) || (kNC_IsRemote == property) ||
(kNC_IsWriteable == property))
(kNC_IsSecure == property) || (kNC_IsWriteable == property))
{
nsCOMPtr<nsIRDFResource> dirResource(do_QueryInterface(directory, &rv));
NS_ENSURE_SUCCESS(rv, rv);

Просмотреть файл

@ -120,6 +120,8 @@ protected:
nsresult createDirectoryIsMailListNode(nsIAbDirectory *directory,
nsIRDFNode **target);
nsresult createDirectoryIsRemoteNode(nsIAbDirectory *directory,
nsIRDFNode **target);
nsresult createDirectoryIsSecureNode(nsIAbDirectory *directory,
nsIRDFNode **target);
nsresult createDirectoryIsWriteableNode(nsIAbDirectory *directory,
nsIRDFNode **target);
@ -146,6 +148,7 @@ protected:
nsCOMPtr<nsIRDFResource> kNC_DirUri;
nsCOMPtr<nsIRDFResource> kNC_IsMailList;
nsCOMPtr<nsIRDFResource> kNC_IsRemote;
nsCOMPtr<nsIRDFResource> kNC_IsSecure;
nsCOMPtr<nsIRDFResource> kNC_IsWriteable;
// commands

Просмотреть файл

@ -289,6 +289,7 @@ classic.jar:
skin/classic/messenger/addressbook/icons/addrbook.gif (messenger/addressbook/icons/addrbook.gif)
skin/classic/messenger/addressbook/icons/ablist.gif (messenger/addressbook/icons/ablist.gif)
skin/classic/messenger/addressbook/icons/remote-addrbook.gif (messenger/addressbook/icons/remote-addrbook.gif)
skin/classic/messenger/addressbook/icons/secure-remote-addrbook.gif (messenger/addressbook/icons/secure-remote-addrbook.gif)
skin/classic/messenger/addressbook/icons/remote-addrbook-error.gif (messenger/addressbook/icons/remote-addrbook-error.gif)
skin/classic/messenger/addressbook/icons/abcard.gif (messenger/addressbook/icons/abcard.gif)
skin/classic/messenger/addressbook/icons/im.gif (messenger/addressbook/icons/im.gif)

Просмотреть файл

@ -42,3 +42,8 @@ treechildren:-moz-tree-image(DirCol, IsMailList-true) {
treechildren:-moz-tree-image(DirCol, IsRemote-true) {
list-style-image: url("chrome://messenger/skin/addressbook/icons/remote-addrbook.gif");
}
treechildren:-moz-tree-image(DirCol, IsRemote-true, IsSecure-true) {
list-style-image: url("chrome://messenger/skin/addressbook/icons/secure-remote-addrbook.gif");
}

Просмотреть файл

@ -296,6 +296,7 @@ modern.jar:
skin/modern/messenger/addressbook/icons/directory-down.gif (messenger/addressbook/icons/directory-down.gif)
skin/modern/messenger/addressbook/icons/directory-open.gif (messenger/addressbook/icons/directory-open.gif)
skin/modern/messenger/addressbook/icons/directory.gif (messenger/addressbook/icons/directory.gif)
skin/modern/messenger/addressbook/icons/secure-directory.gif (messenger/addressbook/icons/secure-directory.gif)
skin/modern/messenger/addressbook/icons/list.gif (messenger/addressbook/icons/list.gif)
skin/modern/messenger/addressbook/icons/mast-ab.gif (messenger/addressbook/icons/mast-ab.gif)
skin/modern/messenger/addressbook/icons/myaddrbk.gif (messenger/addressbook/icons/myaddrbk.gif)

Просмотреть файл

@ -56,3 +56,8 @@ treechildren:-moz-tree-image(DirCol, IsMailList-true) {
treechildren:-moz-tree-image(DirCol, IsRemote-true) {
list-style-image: url("chrome://messenger/skin/addressbook/icons/directory.gif");
}
treechildren:-moz-tree-image(DirCol, IsRemote-true, IsSecure-true) {
list-style-image: url("chrome://messenger/skin/addressbook/icons/secure-directory.gif");
}