Compare commits

..

15 Commits

Author SHA1 Message Date
alecf%netscape.com
639f4e8d86 one more case to call getService()
git-svn-id: svn://10.0.0.236/branches/alecf_module_branch@51557 18797224-902f-48f8-a5cc-f745e15eee43
1999-10-22 21:03:57 +00:00
alecf%netscape.com
1796b42d7d add to branch for platform testing
git-svn-id: svn://10.0.0.236/branches/alecf_module_branch@50643 18797224-902f-48f8-a5cc-f745e15eee43
1999-10-14 01:55:47 +00:00
alecf%netscape.com
7bfaa8ffa0 add to branch for platform testing
git-svn-id: svn://10.0.0.236/branches/alecf_module_branch@50641 18797224-902f-48f8-a5cc-f745e15eee43
1999-10-14 01:44:21 +00:00
alecf%netscape.com
d364dabc06 add to branch for platform testing
git-svn-id: svn://10.0.0.236/branches/alecf_module_branch@50638 18797224-902f-48f8-a5cc-f745e15eee43
1999-10-14 01:34:52 +00:00
(no author)
b71cf9b55d This commit was manufactured by cvs2svn to create branch
'alecf_module_branch'.

git-svn-id: svn://10.0.0.236/branches/alecf_module_branch@50557 18797224-902f-48f8-a5cc-f745e15eee43
1999-10-13 04:26:02 +00:00
alecf%netscape.com
35b53ff925 do module work
git-svn-id: svn://10.0.0.236/branches/alecf_module_branch@50542 18797224-902f-48f8-a5cc-f745e15eee43
1999-10-13 01:40:00 +00:00
alecf%netscape.com
b6e49afc62 fix with init methods
git-svn-id: svn://10.0.0.236/branches/alecf_module_branch@50410 18797224-902f-48f8-a5cc-f745e15eee43
1999-10-12 02:05:34 +00:00
alecf%netscape.com
eb1eb295e6 prep for module so I can test on windows/mac
git-svn-id: svn://10.0.0.236/branches/alecf_module_branch@50303 18797224-902f-48f8-a5cc-f745e15eee43
1999-10-09 03:19:52 +00:00
alecf%netscape.com
11a676f105 add nsgetmodule
git-svn-id: svn://10.0.0.236/branches/alecf_module_branch@50259 18797224-902f-48f8-a5cc-f745e15eee43
1999-10-08 21:46:50 +00:00
alecf%netscape.com
4a927a0ef3 get rid of old cruft, use new macros
git-svn-id: svn://10.0.0.236/branches/alecf_module_branch@50258 18797224-902f-48f8-a5cc-f745e15eee43
1999-10-08 21:30:05 +00:00
alecf%netscape.com
f23957990f use new macros
git-svn-id: svn://10.0.0.236/branches/alecf_module_branch@50179 18797224-902f-48f8-a5cc-f745e15eee43
1999-10-08 00:25:11 +00:00
alecf%netscape.com
c5dbbcd088 try out macro for NS_IMPL_NSGETMODULE
git-svn-id: svn://10.0.0.236/branches/alecf_module_branch@50175 18797224-902f-48f8-a5cc-f745e15eee43
1999-10-08 00:01:46 +00:00
alecf%netscape.com
2ac3dfbb5a rearrange headers and implement everything
git-svn-id: svn://10.0.0.236/branches/alecf_module_branch@50174 18797224-902f-48f8-a5cc-f745e15eee43
1999-10-08 00:00:45 +00:00
alecf%netscape.com
45aff89642 using new macros
git-svn-id: svn://10.0.0.236/branches/alecf_module_branch@50118 18797224-902f-48f8-a5cc-f745e15eee43
1999-10-07 20:38:56 +00:00
(no author)
20d06560f4 This commit was manufactured by cvs2svn to create branch
'alecf_module_branch'.

git-svn-id: svn://10.0.0.236/branches/alecf_module_branch@50105 18797224-902f-48f8-a5cc-f745e15eee43
1999-10-07 14:28:55 +00:00
354 changed files with 32445 additions and 2519 deletions

View File

@@ -0,0 +1,28 @@
#
# The contents of this file are subject to the Netscape Public License
# Version 1.0 (the "NPL"); you may not use this file except in
# compliance with the NPL. You may obtain a copy of the NPL at
# http://www.mozilla.org/NPL/
#
# Software distributed under the NPL is distributed on an "AS IS" basis,
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
# for the specific language governing rights and limitations under the
# NPL.
#
# The Initial Developer of this code under the NPL is Netscape
# Communications Corporation. Portions created by Netscape are
# Copyright (C) 1998 Netscape Communications Corporation. All Rights
# Reserved.
#
DEPTH = ../..
topsrcdir = @top_srcdir@
srcdir = @srcdir@
VPATH = @srcdir@
include $(DEPTH)/config/autoconf.mk
DIRS = public src prefs build resources
include $(topsrcdir)/config/rules.mk

View File

@@ -0,0 +1,17 @@
# The contents of this file are subject to the Netscape Public License
# Version 1.0 (the "NPL"); you may not use this file except in
# compliance with the NPL. You may obtain a copy of the NPL at
# http://www.mozilla.org/NPL/
#
# Software distributed under the NPL is distributed on an "AS IS" basis,
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
# for the specific language governing rights and limitations under the
# NPL.
#
# The Initial Developer of this code under the NPL is Netscape
# Communications Corporation. Portions created by Netscape are
# Copyright (C) 1998 Netscape Communications Corporation. All Rights
# Reserved.
#
nsAbBaseCID.h

View File

@@ -0,0 +1,49 @@
#
# The contents of this file are subject to the Netscape Public License
# Version 1.0 (the "NPL"); you may not use this file except in
# compliance with the NPL. You may obtain a copy of the NPL at
# http://www.mozilla.org/NPL/
#
# Software distributed under the NPL is distributed on an "AS IS" basis,
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
# for the specific language governing rights and limitations under the
# NPL.
#
# The Initial Developer of this code under the NPL is Netscape
# Communications Corporation. Portions created by Netscape are
# Copyright (C) 1998 Netscape Communications Corporation. All Rights
# Reserved.
#
DEPTH = ../../..
topsrcdir = @top_srcdir@
srcdir = @srcdir@
VPATH = @srcdir@
include $(DEPTH)/config/autoconf.mk
MODULE = addrbook
LIBRARY_NAME = addrbook
IS_COMPONENT = 1
CPPSRCS = nsAbFactory.cpp
EXPORTS = nsAbBaseCID.h
SHARED_LIBRARY_LIBS = \
$(DIST)/lib/libaddrbook_s.a \
$(DIST)/lib/librdfutil_s.a \
$(NULL)
EXTRA_DSO_LDOPTS = \
$(MKSHLIB_FORCE_ALL) \
$(SHARED_LIBRARY_LIBS) \
$(MKSHLIB_UNFORCE_ALL) \
-L$(DIST)/bin \
$(NSPR_LIBS) \
-lxpcom \
$(NULL)
include $(topsrcdir)/config/rules.mk
$(LIBRARY) $(SHARED_LIBRARY): $(SHARED_LIBRARY_LIBS) Makefile

View File

@@ -0,0 +1,49 @@
#!gmake
#
# The contents of this file are subject to the Netscape Public License
# Version 1.0 (the "NPL"); you may not use this file except in
# compliance with the NPL. You may obtain a copy of the NPL at
# http://www.mozilla.org/NPL/
#
# Software distributed under the NPL is distributed on an "AS IS" basis,
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
# for the specific language governing rights and limitations under the
# NPL.
#
# The Initial Developer of this code under the NPL is Netscape
# Communications Corporation. Portions created by Netscape are
# Copyright (C) 1998 Netscape Communications Corporation. All Rights
# Reserved.
DEPTH=..\..\..
MODULE=addrbook
################################################################################
## exports
EXPORTS= \
nsAbBaseCID.h \
$(NULL)
################################################################################
## library
LIBNAME = .\$(OBJDIR)\addrbook
DLL = $(LIBNAME).dll
CPP_OBJS= \
.\$(OBJDIR)\nsAbFactory.obj \
$(NULL)
LLIBS= \
$(DIST)\lib\xpcom.lib \
$(DIST)\lib\addrbook_s.lib \
$(LIBNSPR) \
$(DIST)\lib\rdfutil_s.lib \
$(NULL)
include <$(DEPTH)\config\rules.mak>
install:: $(DLL)
$(MAKE_INSTALL) $(LIBNAME).$(DLL_SUFFIX) $(DIST)\bin\components
$(MAKE_INSTALL) $(LIBNAME).$(LIB_SUFFIX) $(DIST)\lib

View File

@@ -0,0 +1,154 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Netscape Public License
* Version 1.0 (the "NPL"); you may not use this file except in
* compliance with the NPL. You may obtain a copy of the NPL at
* http://www.mozilla.org/NPL/
*
* Software distributed under the NPL is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
* for the specific language governing rights and limitations under the
* NPL.
*
* The Initial Developer of this code under the NPL is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
* Reserved.
*/
#ifndef nsAbBaseCID_h__
#define nsAbBaseCID_h__
#include "nsISupports.h"
#include "nsIFactory.h"
#include "nsIComponentManager.h"
//
// nsAddressBook
//
#define NS_ADDRESSBOOK_PROGID \
"component://netscape/addressbook"
#define NS_ADDRESSBOOK_CID \
{ /* {D60B84F2-2A8C-11d3-9E07-00A0C92B5F0D} */ \
0xd60b84f2, 0x2a8c, 0x11d3, \
{ 0x9e, 0x7, 0x0, 0xa0, 0xc9, 0x2b, 0x5f, 0xd } \
}
//
// nsAbDirectoryDataSource
//
#define NS_ABDIRECTORYDATASOURCE_PROGID \
NS_RDF_DATASOURCE_PROGID_PREFIX "addressdirectory"
#define NS_ABDIRECTORYDATASOURCE_CID \
{ /* 0A79186D-F754-11d2-A2DA-001083003D0C */ \
0xa79186d, 0xf754, 0x11d2, \
{0xa2, 0xda, 0x0, 0x10, 0x83, 0x0, 0x3d, 0xc} \
}
//
// nsAbDirectory
//
#define NS_ABDIRECTORY_PROGID \
NS_RDF_RESOURCE_FACTORY_PROGID_PREFIX "abdirectory"
#define NS_ABDIRECTORY_CID \
{ /* {6C21831D-FCC2-11d2-A2E2-001083003D0C}*/ \
0x6c21831d, 0xfcc2, 0x11d2, \
{0xa2, 0xe2, 0x0, 0x10, 0x83, 0x0, 0x3d, 0xc} \
}
//
// nsAbCardDataSource
//
#define NS_ABCARDDATASOURCE_PROGID \
NS_RDF_DATASOURCE_PROGID_PREFIX "addresscard"
#define NS_ABCARDDATASOURCE_CID \
{ /* 1920E486-0709-11d3-A2EC-001083003D0C */ \
0x1920e486, 0x709, 0x11d3, \
{0xa2, 0xec, 0x0, 0x10, 0x83, 0x0, 0x3d, 0xc} \
}
//
// nsAbCard
//
#define NS_ABCARD_PROGID \
NS_RDF_RESOURCE_FACTORY_PROGID_PREFIX "abcard"
#define NS_ABCARD_CID \
{ /* {1920E487-0709-11d3-A2EC-001083003D0C}*/ \
0x1920e487, 0x709, 0x11d3, \
{0xa2, 0xec, 0x0, 0x10, 0x83, 0x0, 0x3d, 0xc} \
}
//
// nsAddressBookDB
//
#define NS_ADDRDATABASE_PROGID \
"component://netscape/addressbook/carddatabase"
#define NS_ADDRDATABASE_CID \
{ /* 63187917-1D19-11d3-A302-001083003D0C */ \
0x63187917, 0x1d19, 0x11d3, \
{0xa3, 0x2, 0x0, 0x10, 0x83, 0x0, 0x3d, 0xc} \
}
//
// nsAbCardProperty
//
#define NS_ABCARDPROPERTY_PROGID \
"component://netscape/addressbook/cardproperty"
#define NS_ABCARDPROPERTY_CID \
{ /* 2B722171-2CEA-11d3-9E0B-00A0C92B5F0D */ \
0x2b722171, 0x2cea, 0x11d3, \
{0x9e, 0xb, 0x0, 0xa0, 0xc9, 0x2b, 0x5f, 0xd} \
}
//
// nsAddrBookSession
//
#define NS_ADDRBOOKSESSION_PROGID \
"component://netscape/addressbook/services/session"
#define NS_ADDRBOOKSESSION_CID \
{ /* C5339442-303F-11d3-9E13-00A0C92B5F0D */ \
0xc5339442, 0x303f, 0x11d3, \
{0x9e, 0x13, 0x0, 0xa0, 0xc9, 0x2b, 0x5f, 0xd} \
}
//
// nsAbDirProperty
//
#define NS_ABDIRPROPERTY_PROGID \
"component://netscape/addressbook/directoryproperty"
#define NS_ABDIRPROPERTY_CID \
{ /* 6FD8EC67-3965-11d3-A316-001083003D0C */ \
0x6fd8ec67, 0x3965, 0x11d3, \
{0xa3, 0x16, 0x0, 0x10, 0x83, 0x0, 0x3d, 0xc} \
}
//
// nsAbAutoCompleteSession
//
#define NS_ABAUTOCOMPLETESESSION_PROGID \
"component://netscape/messenger/autocomplete&type=addrbook"
#define NS_ABAUTOCOMPLETESESSION_CID \
{ /* 138DE9BD-362B-11d3-988E-001083010E9B */ \
0x138de9bd, 0x362b, 0x11d3, \
{0x98, 0x8e, 0x0, 0x10, 0x83, 0x1, 0xe, 0x9b} \
}
//
// nsAbAddressCollecter
//
#define NS_ABADDRESSCOLLECTER_PROGID \
"component://netscape/addressbook/services/addressCollecter"
#define NS_ABADDRESSCOLLECTER_CID \
{ /* fe04c8e6-501e-11d3-a527-0060b0fc04b7 */ \
0xfe04c8e6, 0x501e, 0x11d3, \
{0xa5, 0x27, 0x0, 0x60, 0xb0, 0xfc, 0x4, 0xb7} \
}
#endif // nsAbBaseCID_h__

View File

@@ -0,0 +1,83 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Netscape Public License
* Version 1.0 (the "NPL"); you may not use this file except in
* compliance with the NPL. You may obtain a copy of the NPL at
* http://www.mozilla.org/NPL/
*
* Software distributed under the NPL is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
* for the specific language governing rights and limitations under the
* NPL.
*
* The Initial Developer of this code under the NPL is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998,1999 Netscape Communications Corporation. All Rights
* Reserved.
*/
#include "nsIFactory.h"
#include "nsISupports.h"
#include "nsIGenericFactory.h"
#include "nsIModule.h"
#include "nsAbBaseCID.h"
#include "pratom.h"
#include "nsIComponentManager.h"
#include "nsIServiceManager.h"
#include "rdf.h"
#include "nsCRT.h"
#include "nsCOMPtr.h"
/* Include all of the interfaces our factory can generate components for */
#include "nsDirectoryDataSource.h"
#include "nsCardDataSource.h"
#include "nsAbDirectory.h"
#include "nsAbCard.h"
#include "nsAddrDatabase.h"
#include "nsAddressBook.h"
#include "nsAddrBookSession.h"
#include "nsAbDirProperty.h"
#include "nsAbAutoCompleteSession.h"
#include "nsAbAddressCollecter.h"
NS_GENERIC_FACTORY_CONSTRUCTOR(nsAddressBook)
NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsAbDirectoryDataSource,Init)
NS_GENERIC_FACTORY_CONSTRUCTOR(nsAbDirectory)
NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsAbCardDataSource,Init)
NS_GENERIC_FACTORY_CONSTRUCTOR(nsAbCard)
NS_GENERIC_FACTORY_CONSTRUCTOR(nsAbCardProperty)
NS_GENERIC_FACTORY_CONSTRUCTOR(nsAddrDatabase)
NS_GENERIC_FACTORY_CONSTRUCTOR(nsAbDirProperty)
NS_GENERIC_FACTORY_CONSTRUCTOR(nsAddrBookSession)
NS_GENERIC_FACTORY_CONSTRUCTOR(nsAbAutoCompleteSession)
NS_GENERIC_FACTORY_CONSTRUCTOR(nsAbAddressCollecter)
struct components_t {
nsCID cid;
nsIGenericFactory::ConstructorProcPtr constructor;
const char *progid;
const char *description;
};
static components_t components[] =
{
{ NS_ADDRESSBOOK_CID, &nsAddressBookConstructor, NS_ADDRESSBOOK_PROGID, },
{ NS_ABDIRECTORYDATASOURCE_CID, &nsAbDirectoryDataSourceConstructor, NS_ABDIRECTORYDATASOURCE_PROGID, },
{ NS_ABDIRECTORY_CID, &nsAbDirectoryConstructor, NS_ABDIRECTORY_PROGID, },
{ NS_ABCARDDATASOURCE_CID, &nsAbCardDataSourceConstructor, NS_ABCARDDATASOURCE_PROGID, },
{ NS_ABCARD_CID, &nsAbCardConstructor, NS_ABCARD_PROGID, },
{ NS_ADDRDATABASE_CID, &nsAddrDatabaseConstructor, NS_ADDRDATABASE_PROGID, },
{ NS_ABCARDPROPERTY_CID, &nsAbCardPropertyConstructor, NS_ABCARDPROPERTY_PROGID, },
{ NS_ABDIRPROPERTY_CID, &nsAbDirPropertyConstructor, NS_ABDIRPROPERTY_PROGID, },
{ NS_ADDRBOOKSESSION_CID, &nsAddrBookSessionConstructor, NS_ADDRBOOKSESSION_PROGID, },
{ NS_ABAUTOCOMPLETESESSION_CID, &nsAbAutoCompleteSessionConstructor, NS_ABAUTOCOMPLETESESSION_PROGID, },
{ NS_ABADDRESSCOLLECTER_CID, &nsAbAddressCollecterConstructor, NS_ABADDRESSCOLLECTER_PROGID, },
};
NS_IMPL_MODULE(components)
NS_IMPL_NSGETMODULE(nsModule)

Binary file not shown.

Binary file not shown.

View File

@@ -0,0 +1,21 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Netscape Public License
* Version 1.0 (the "NPL"); you may not use this file except in
* compliance with the NPL. You may obtain a copy of the NPL at
* http://www.mozilla.org/NPL/
*
* Software distributed under the NPL is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
* for the specific language governing rights and limitations under the
* NPL.
*
* The Initial Developer of this code under the NPL is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
* Reserved.
*/
#include "MacPrefix.h"

View File

@@ -0,0 +1,21 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Netscape Public License
* Version 1.0 (the "NPL"); you may not use this file except in
* compliance with the NPL. You may obtain a copy of the NPL at
* http://www.mozilla.org/NPL/
*
* Software distributed under the NPL is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
* for the specific language governing rights and limitations under the
* NPL.
*
* The Initial Developer of this code under the NPL is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
* Reserved.
*/
#include "MacPrefix_debug.h"

View File

@@ -0,0 +1,22 @@
#!nmake
#
# The contents of this file are subject to the Netscape Public License
# Version 1.0 (the "NPL"); you may not use this file except in
# compliance with the NPL. You may obtain a copy of the NPL at
# http://www.mozilla.org/NPL/
#
# Software distributed under the NPL is distributed on an "AS IS" basis,
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
# for the specific language governing rights and limitations under the
# NPL.
#
# The Initial Developer of this code under the NPL is Netscape
# Communications Corporation. Portions created by Netscape are
# Copyright (C) 1998 Netscape Communications Corporation. All Rights
# Reserved.
DEPTH=..\..
DIRS=public src prefs build resources
include <$(DEPTH)\config\rules.mak>

View File

@@ -0,0 +1,28 @@
#
# The contents of this file are subject to the Netscape Public License
# Version 1.0 (the "NPL"); you may not use this file except in
# compliance with the NPL. You may obtain a copy of the NPL at
# http://www.mozilla.org/NPL/
#
# Software distributed under the NPL is distributed on an "AS IS" basis,
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
# for the specific language governing rights and limitations under the
# NPL.
#
# The Initial Developer of this code under the NPL is Netscape
# Communications Corporation. Portions created by Netscape are
# Copyright (C) 1998 Netscape Communications Corporation. All Rights
# Reserved.
#
DEPTH = ../../..
topsrcdir = @top_srcdir@
srcdir = @srcdir@
VPATH = @srcdir@
include $(DEPTH)/config/autoconf.mk
DIRS = resources
include $(topsrcdir)/config/rules.mk

View File

@@ -0,0 +1,22 @@
#!nmake
#
# The contents of this file are subject to the Netscape Public License
# Version 1.0 (the "NPL"); you may not use this file except in
# compliance with the NPL. You may obtain a copy of the NPL at
# http://www.mozilla.org/NPL/
#
# Software distributed under the NPL is distributed on an "AS IS" basis,
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
# for the specific language governing rights and limitations under the
# NPL.
#
# The Initial Developer of this code under the NPL is Netscape
# Communications Corporation. Portions created by Netscape are
# Copyright (C) 1998 Netscape Communications Corporation. All Rights
# Reserved.
DEPTH=..\..\..
DIRS= resources
include <$(DEPTH)\config\rules.mak>

View File

@@ -0,0 +1,28 @@
#
# The contents of this file are subject to the Netscape Public License
# Version 1.0 (the "NPL"); you may not use this file except in
# compliance with the NPL. You may obtain a copy of the NPL at
# http://www.mozilla.org/NPL/
#
# Software distributed under the NPL is distributed on an "AS IS" basis,
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
# for the specific language governing rights and limitations under the
# NPL.
#
# The Initial Developer of this code under the NPL is Netscape
# Communications Corporation. Portions created by Netscape are
# Copyright (C) 1998 Netscape Communications Corporation. All Rights
# Reserved.
#
DEPTH = ../../../..
topsrcdir = @top_srcdir@
srcdir = @srcdir@
VPATH = @srcdir@
include $(DEPTH)/config/autoconf.mk
DIRS = content locale
include $(topsrcdir)/config/rules.mk

View File

@@ -0,0 +1,19 @@
# The contents of this file are subject to the Netscape Public License
# Version 1.0 (the "NPL"); you may not use this file except in
# compliance with the NPL. You may obtain a copy of the NPL at
# http://www.mozilla.org/NPL/
#
# Software distributed under the NPL is distributed on an "AS IS" basis,
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
# for the specific language governing rights and limitations under the
# NPL.
#
# The Initial Developer of this code under the NPL is Netscape
# Communications Corporation. Portions created by Netscape are
# Copyright (C) 1998 Netscape Communications Corporation. All Rights
# Reserved.
#
# This is a list of local files which get copied to the res\mailnews\messenger directory
#
pref-addressing.xul

View File

@@ -0,0 +1,37 @@
#
# The contents of this file are subject to the Netscape Public License
# Version 1.0 (the "NPL"); you may not use this file except in
# compliance with the NPL. You may obtain a copy of the NPL at
# http://www.mozilla.org/NPL/
#
# Software distributed under the NPL is distributed on an "AS IS" basis,
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
# for the specific language governing rights and limitations under the
# NPL.
#
# The Initial Developer of this code under the NPL is Netscape
# Communications Corporation. Portions created by Netscape are
# Copyright (C) 1998 Netscape Communications Corporation. All Rights
# Reserved.
#
DEPTH = ../../../../..
topsrcdir = @top_srcdir@
srcdir = @srcdir@
VPATH = @srcdir@
include $(DEPTH)/config/autoconf.mk
SAMPLES_DIR = $(DIST)/bin/chrome/addressbook/content/default
EXPORT_RESOURCE_SAMPLES = \
pref-addressing.xul \
$(NULL)
include $(topsrcdir)/config/rules.mk
GARBAGE += $(addprefix $(SAMPLES_DIR)/, $(EXPORT_RESOURCE_SAMPLES))
install::
$(INSTALL) $(addprefix $(srcdir)/, $(EXPORT_RESOURCE_SAMPLES)) $(SAMPLES_DIR)

View File

@@ -0,0 +1,26 @@
#!nmake
#
# The contents of this file are subject to the Netscape Public License
# Version 1.0 (the "NPL"); you may not use this file except in
# compliance with the NPL. You may obtain a copy of the NPL at
# http://www.mozilla.org/NPL/
#
# Software distributed under the NPL is distributed on an "AS IS" basis,
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
# for the specific language governing rights and limitations under the
# NPL.
#
# The Initial Developer of this code under the NPL is Netscape
# Communications Corporation. Portions created by Netscape are
# Copyright (C) 1998 Netscape Communications Corporation. All Rights
# Reserved.
DEPTH=..\..\..\..\..
include <$(DEPTH)\config\rules.mak>
install::
$(MAKE_INSTALL) pref-addressing.xul $(DIST)\bin\chrome\addressbook\content\default
clobber::
rm -f $(DIST)\chrome\addressbook\content\default\pref-addressing.xul

View File

@@ -0,0 +1,66 @@
<?xml version="1.0"?>
<?xml-stylesheet href="chrome://pref/skin/pref.css" type="text/css"?>
<!DOCTYPE window SYSTEM "chrome://addressbook/locale/pref-addressing.dtd">
<window xmlns:html="http://www.w3.org/TR/REC-html40"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
onload="StartUp('Mailnews-Main')" >
<html:script language="javascript" src="chrome://pref/content/PrefsWindow.js"/>
<html:div flex="100%">
<html:div id="top">
<html:span id="lefttext">&pane.title;</html:span>
</html:div>
&pinpoint.label;
<html:form>
<html:table>
<html:tr><html:td>&lookFor.label;</html:td></html:tr>
<html:tr><html:td>
<html:input type="checkbox"/>
<html:label>&padCheck.label;</html:label>
</html:td></html:tr>
<html:tr><html:td>
<html:input type="checkbox"/>
<html:label>&dirCheck.label;</html:label>
</html:td></html:tr>
<html:tr><html:td>
<html:select>
<html:option>&nsbook.label;</html:option>
</html:select>
</html:td></html:tr>
<html:tr><html:td>&mulFound.label;</html:td></html:tr>
<html:tr><html:td>
<html:input name="multilist" type="radio"/>
<html:label>&showList.label;</html:label>
</html:td></html:tr>
<html:tr><html:td>
<html:input name="multilist" type="radio"/>
<html:label>&acceptList.label;</html:label>
</html:td></html:tr>
<html:tr><html:td>&oneMatch.label;</html:td></html:tr>
<html:tr><html:td>
<html:input type="checkbox"/>
<html:label>&useAddress.label;</html:label>
</html:td></html:tr>
</html:table>
</html:form>
&displayFullname.label;
<html:form>
<html:table>
<html:tr><html:td>
<html:input name="displayname" type="radio" id="pref:0:int:mail.addr_book.lastnamefirst" checked="true"/>
<html:label>&useDisplayName.label;</html:label>
</html:td></html:tr>
<html:tr><html:td>
<html:input name="displayname" type="radio" id="pref:1:int:mail.addr_book.lastnamefirst"/>
<html:label>&useLastFirst.label;</html:label>
</html:td></html:tr>
</html:table>
</html:form>
</html:div>
</window>

View File

@@ -0,0 +1,28 @@
#
# The contents of this file are subject to the Netscape Public License
# Version 1.0 (the "NPL"); you may not use this file except in
# compliance with the NPL. You may obtain a copy of the NPL at
# http://www.mozilla.org/NPL/
#
# Software distributed under the NPL is distributed on an "AS IS" basis,
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
# for the specific language governing rights and limitations under the
# NPL.
#
# The Initial Developer of this code under the NPL is Netscape
# Communications Corporation. Portions created by Netscape are
# Copyright (C) 1998 Netscape Communications Corporation. All Rights
# Reserved.
#
DEPTH = ../../../../..
topsrcdir = @top_srcdir@
srcdir = @srcdir@
VPATH = @srcdir@
include $(DEPTH)/config/autoconf.mk
DIRS = en-US
include $(topsrcdir)/config/rules.mk

View File

@@ -0,0 +1 @@
pref-addressing.dtd

View File

@@ -0,0 +1,29 @@
#
# The contents of this file are subject to the Netscape Public License
# Version 1.0 (the "NPL"); you may not use this file except in
# compliance with the NPL. You may obtain a copy of the NPL at
# http://www.mozilla.org/NPL/
#
# Software distributed under the NPL is distributed on an "AS IS" basis,
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
# for the specific language governing rights and limitations under the
# NPL.
#
# The Initial Developer of this code under the NPL is Netscape
# Communications Corporation. Portions created by Netscape are
# Copyright (C) 1998 Netscape Communications Corporation. All Rights
# Reserved.
#
DEPTH = ../../../../../..
topsrcdir = @top_srcdir@
srcdir = @srcdir@
VPATH = @srcdir@
include $(DEPTH)/config/autoconf.mk
include $(topsrcdir)/config/rules.mk
install::
$(INSTALL) $(srcdir)/pref-addressing.dtd $(DIST)/bin/chrome/addressbook/locale/en-US

View File

@@ -0,0 +1,29 @@
#!nmake
#
# The contents of this file are subject to the Netscape Public License
# Version 1.0 (the "NPL"); you may not use this file except in
# compliance with the NPL. You may obtain a copy of the NPL at
# http://www.mozilla.org/NPL/
#
# Software distributed under the NPL is distributed on an "AS IS" basis,
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
# for the specific language governing rights and limitations under the
# NPL.
#
# The Initial Developer of this code under the NPL is Netscape
# Communications Corporation. Portions created by Netscape are
# Copyright (C) 1998 Netscape Communications Corporation. All Rights
# Reserved.
DEPTH=..\..\..\..\..\..
include <$(DEPTH)\config\rules.mak>
DISTBROWSER=$(DIST)\bin\chrome\addressbook\locale\en-US
install::
$(MAKE_INSTALL) pref-addressing.dtd $(DISTBROWSER)
clobber::
rm -f $(DIST)\bin\chrome\addressbook\locale\en-US\pref-addressing.dtd

View File

@@ -0,0 +1,35 @@
<!--
The contents of this file are subject to the Netscape Public
License Version 1.1 (the "License"); you may not use this file
except in compliance with the License. You may obtain a copy of
the License at http://www.mozilla.org/NPL/
Software distributed under the License is distributed on an "AS
IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
implied. See the License for the specific language governing
rights and limitations under the License.
The Original Code is Mozilla Communicator client code, released
March 31, 1998.
The Initial Developer of the Original Code is Netscape
Communications Corporation. Portions created by Netscape are
Copyright (C) 1998-1999 Netscape Communications Corporation. All
Rights Reserved.
-->
<!ENTITY window.title "Addressing">
<!ENTITY pane.title "Addressing">
<!ENTITY pinpoint.label "Pinpoint Addressing">
<!ENTITY lookFor.label "Look for addresses in the following">
<!ENTITY padCheck.label "Address Books">
<!ENTITY dirCheck.label "Directory Server">
<!ENTITY nsbook.label "Netscape Phonebook">
<!ENTITY mulFound.label "When there are multiple addresses found:">
<!ENTITY showList.label "Show me a list of choices">
<!ENTITY acceptList.label "Accept what I have typed">
<!ENTITY oneMatch.label "If there is one match in your personal address books:">
<!ENTITY useAddress.label "Use the address and do not search in the directory">
<!ENTITY displayFullname.label "When displaying full names:">
<!ENTITY useDisplayName.label "Show names using display name (from address book card)">
<!ENTITY useLastFirst.label "Show names using last name, first name">

View File

@@ -0,0 +1,22 @@
#!nmake
#
# The contents of this file are subject to the Netscape Public License
# Version 1.0 (the "NPL"); you may not use this file except in
# compliance with the NPL. You may obtain a copy of the NPL at
# http://www.mozilla.org/NPL/
#
# Software distributed under the NPL is distributed on an "AS IS" basis,
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
# for the specific language governing rights and limitations under the
# NPL.
#
# The Initial Developer of this code under the NPL is Netscape
# Communications Corporation. Portions created by Netscape are
# Copyright (C) 1998 Netscape Communications Corporation. All Rights
# Reserved.
DEPTH=..\..\..\..\..
DIRS= en-US
include <$(DEPTH)\config\rules.mak>

View File

@@ -0,0 +1,22 @@
#!nmake
#
# The contents of this file are subject to the Netscape Public License
# Version 1.0 (the "NPL"); you may not use this file except in
# compliance with the NPL. You may obtain a copy of the NPL at
# http://www.mozilla.org/NPL/
#
# Software distributed under the NPL is distributed on an "AS IS" basis,
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
# for the specific language governing rights and limitations under the
# NPL.
#
# The Initial Developer of this code under the NPL is Netscape
# Communications Corporation. Portions created by Netscape are
# Copyright (C) 1998 Netscape Communications Corporation. All Rights
# Reserved.
DEPTH=..\..\..\..
DIRS= content locale
include <$(DEPTH)\config\rules.mak>

View File

@@ -0,0 +1,18 @@
# The contents of this file are subject to the Netscape Public License
# Version 1.0 (the "NPL"); you may not use this file except in
# compliance with the NPL. You may obtain a copy of the NPL at
# http://www.mozilla.org/NPL/
#
# Software distributed under the NPL is distributed on an "AS IS" basis,
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
# for the specific language governing rights and limitations under the
# NPL.
#
# The Initial Developer of this code under the NPL is Netscape
# Communications Corporation. Portions created by Netscape are
# Copyright (C) 1998 Netscape Communications Corporation. All Rights
# Reserved.
#
# This is a list of local files which get copied to the mozilla:dist:mailnews directory
#

View File

@@ -0,0 +1,6 @@
#
# This is a list of local files which get copied to the mozilla:dist:idl directory
#
nsIAbAddressCollecter.idl

View File

@@ -0,0 +1,43 @@
#
# The contents of this file are subject to the Netscape Public License
# Version 1.0 (the "NPL"); you may not use this file except in
# compliance with the NPL. You may obtain a copy of the NPL at
# http://www.mozilla.org/NPL/
#
# Software distributed under the NPL is distributed on an "AS IS" basis,
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
# for the specific language governing rights and limitations under the
# NPL.
#
# The Initial Developer of this code under the NPL is Netscape
# Communications Corporation. Portions created by Netscape are
# Copyright (C) 1998 Netscape Communications Corporation. All Rights
# Reserved.
#
DEPTH = ../../..
topsrcdir = @top_srcdir@
srcdir = @srcdir@
VPATH = @srcdir@
include $(DEPTH)/config/autoconf.mk
MODULE = addrbook
XPIDLSRCS = \
nsIAbListener.idl \
nsIAbDirectory.idl \
nsIAbCard.idl \
nsIAddrDBAnnouncer.idl \
nsIAddrDBListener.idl \
nsIAddrDatabase.idl \
nsIAddressBook.idl \
nsIAbBase.idl \
nsIAddrBookSession.idl \
nsIAutoCompleteListener.idl \
nsIAutoCompleteSession.idl \
nsIAbAddressCollecter.idl \
$(NULL)
include $(topsrcdir)/config/rules.mk

View File

@@ -0,0 +1,39 @@
#!nmake
#
# The contents of this file are subject to the Netscape Public License
# Version 1.0 (the "NPL"); you may not use this file except in
# compliance with the NPL. You may obtain a copy of the NPL at
# http://www.mozilla.org/NPL/
#
# Software distributed under the NPL is distributed on an "AS IS" basis,
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
# for the specific language governing rights and limitations under the
# NPL.
#
# The Initial Developer of this code under the NPL is Netscape
# Communications Corporation. Portions created by Netscape are
# Copyright (C) 1998 Netscape Communications Corporation. All Rights
# Reserved.
DEPTH=..\..\..
MODULE=addrbook
XPIDLSRCS = \
.\nsIAbListener.idl \
.\nsIAbBase.idl \
.\nsIAbDirectory.idl \
.\nsIAbCard.idl \
.\nsIAddrDBAnnouncer.idl \
.\nsIAddrDBListener.idl \
.\nsIAddrDatabase.idl \
.\nsIAddressBook.idl \
.\nsIAddrBookSession.idl \
.\nsIAutoCompleteSession.idl \
.\nsIAutoCompleteListener.idl \
.\nsIAbAddressCollecter.idl \
$(NULL)
include <$(DEPTH)\config\rules.mak>
include <$(DEPTH)\config\config.mak>

View File

@@ -0,0 +1,28 @@
/* -*- Mode: IDL; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
*
* The contents of this file are subject to the Netscape Public License
* Version 1.0 (the "NPL"); you may not use this file except in
* compliance with the NPL. You may obtain a copy of the NPL at
* http://www.mozilla.org/NPL/
*
* Software distributed under the NPL is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
* for the specific language governing rights and limitations under the
* NPL.
*
* The Initial Developer of this code under the NPL is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1999 Netscape Communications Corporation. All Rights
* Reserved.
*/
#include "nsISupports.idl"
[scriptable, uuid(fe04c8e6-501e-11d3-a527-0060b0fc04b7)]
interface nsIAbAddressCollecter : nsISupports {
void CollectAddress(in string address);
};

View File

@@ -0,0 +1,35 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Netscape Public License
* Version 1.0 (the "NPL"); you may not use this file except in
* compliance with the NPL. You may obtain a copy of the NPL at
* http://www.mozilla.org/NPL/
*
* Software distributed under the NPL is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
* for the specific language governing rights and limitations under the
* NPL.
*
* The Initial Developer of this code under the NPL is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
* Reserved.
*/
#include "nsICollection.idl"
[scriptable, uuid(013DD009-F73B-11d2-A2DA-001083003D0C)]
interface nsIAbBase : nsICollection {
readonly attribute string URI;
attribute string name;
nsISupports GetChildNamed(in string name);
attribute nsIAbBase parent;
nsIEnumerator GetChildNodes();
void AddUnique(in nsISupports element);
void ReplaceElement(in nsISupports element, in nsISupports newElement);
};

View File

@@ -0,0 +1,97 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Netscape Public License
* Version 1.0 (the "NPL"); you may not use this file except in
* compliance with the NPL. You may obtain a copy of the NPL at
* http://www.mozilla.org/NPL/
*
* Software distributed under the NPL is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
* for the specific language governing rights and limitations under the
* NPL.
*
* The Initial Developer of this code under the NPL is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
* Reserved.
*/
#include "nsISupports.idl"
interface nsIAddrDatabase;
[ptr] native nsVoidArray(nsVoidArray);
%{C++
#include "nsVoidArray.h"
%}
[scriptable, uuid(FA5C977F-04C8-11d3-A2EB-001083003D0C)]
interface nsIAbCard : nsISupports {
attribute wstring FirstName;
attribute wstring LastName;
attribute wstring DisplayName;
attribute wstring NickName;
attribute wstring PrimaryEmail;
attribute wstring SecondEmail;
attribute wstring WorkPhone;
attribute wstring HomePhone;
attribute wstring FaxNumber;
attribute wstring PagerNumber;
attribute wstring CellularNumber;
attribute wstring HomeAddress;
attribute wstring HomeAddress2;
attribute wstring HomeCity;
attribute wstring HomeState;
attribute wstring HomeZipCode;
attribute wstring HomeCountry;
attribute wstring WorkAddress;
attribute wstring WorkAddress2;
attribute wstring WorkCity;
attribute wstring WorkState;
attribute wstring WorkZipCode;
attribute wstring WorkCountry;
attribute wstring JobTitle;
attribute wstring Department;
attribute wstring Company;
attribute wstring WebPage1;
attribute wstring WebPage2;
attribute wstring BirthYear;
attribute wstring BirthMonth;
attribute wstring BirthDay;
attribute wstring Custom1;
attribute wstring Custom2;
attribute wstring Custom3;
attribute wstring Custom4;
attribute wstring Notes;
attribute unsigned long LastModifiedDate;
attribute boolean SendPlainText;
attribute unsigned long DbTableID;
attribute unsigned long DbRowID;
void GetCardValue(in string attrname, out wstring value);
void SetCardValue(in string attrname, in wstring value);
void SetAbDatabase(in nsIAddrDatabase database);
[noscript] void GetAnonymousStrAttrubutesList(out nsVoidArray attrlist);
[noscript] void GetAnonymousStrValuesList(out nsVoidArray valuelist);
[noscript] void GetAnonymousIntAttrubutesList(out nsVoidArray attrlist);
[noscript] void GetAnonymousIntValuesList(out nsVoidArray valuelist);
[noscript] void GetAnonymousBoolAttrubutesList(out nsVoidArray attrlist);
[noscript] void GetAnonymousBoolValuesList(out nsVoidArray valuelist);
void SetAnonymousStringAttribute(in string attrname, in string value);
void SetAnonymousIntAttribute(in string attrname, in unsigned long value);
void SetAnonymousBoolAttribute(in string attrname, in boolean value);
void AddAnonymousAttributesToDB();
void EditAnonymousAttributesInDB();
void GetCardURI(out string uri);
void AddCardToDatabase(in string uri);
void EditCardToDatabase(in string uri);
void CopyCard(in nsIAbCard srcCard);
void GetCollationKey(in wstring str, out wstring key);
};

View File

@@ -0,0 +1,51 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Netscape Public License
* Version 1.0 (the "NPL"); you may not use this file except in
* compliance with the NPL. You may obtain a copy of the NPL at
* http://www.mozilla.org/NPL/
*
* Software distributed under the NPL is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
* for the specific language governing rights and limitations under the
* NPL.
*
* The Initial Developer of this code under the NPL is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
* Reserved.
*/
#include "nsISupports.idl"
#include "nsIAbCard.idl"
#include "nsISupportsArray.idl"
[ptr] native nsFileSpec(nsFileSpec);
[ptr] native DIR_Server(DIR_Server);
%{C++
#include "nsFileSpec.h"
#include "nsDirPrefs.h"
%}
[scriptable, uuid(1920E485-0709-11d3-A2EC-001083003D0C)]
interface nsIAbDirectory : nsISupports {
attribute wstring DirName;
attribute unsigned long LastModifiedDate;
attribute DIR_Server server;
void GetDirFilePath(out string dbPath);
void GetChildNodes(out nsIEnumerator childList);
void GetChildCards(out nsIEnumerator childCards);
void AddChildCards(in string uriName, out nsIAbCard childCard);
void AddDirectory(in string uriName, out nsIAbDirectory childDir);
void DeleteDirectories(in nsISupportsArray dierctories);
void DeleteCards(in nsISupportsArray cards);
void HasCard(in nsIAbCard cards, out boolean hasCard);
void HasDirectory(in nsIAbDirectory dir, out boolean hasDir);
void GetMailingList(out nsIEnumerator mailingList);
void CreateNewDirectory(in wstring dirName, in string fileName);
void GetDirUri(out string uri);
};

View File

@@ -0,0 +1,29 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Netscape Public License
* Version 1.0 (the "NPL"); you may not use this file except in
* compliance with the NPL. You may obtain a copy of the NPL at
* http://www.mozilla.org/NPL/
*
* Software distributed under the NPL is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
* for the specific language governing rights and limitations under the
* NPL.
*
* The Initial Developer of this code under the NPL is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
* Reserved.
*/
#include "nsISupports.idl"
#include "nsIEnumerator.idl"
[scriptable, uuid(1920E484-0709-11d3-A2EC-001083003D0C)]
interface nsIAbListener : nsISupports {
void OnItemAdded(in nsISupports parentDir, in nsISupports item);
void OnItemRemoved(in nsISupports parentDir, in nsISupports item);
void OnItemPropertyChanged(in nsISupports item, in string property, in wstring oldValue, in wstring newValue);
};

View File

@@ -0,0 +1,49 @@
/* -*- Mode: IDL; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
*
* The contents of this file are subject to the Netscape Public License
* Version 1.0 (the "NPL"); you may not use this file except in
* compliance with the NPL. You may obtain a copy of the NPL at
* http://www.mozilla.org/NPL/
*
* Software distributed under the NPL is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
* for the specific language governing rights and limitations under the
* NPL.
*
* The Initial Developer of this code under the NPL is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
* Reserved.
*/
#include "nsISupports.idl"
/*
* The mail session is a replacement for the old 4.x MSG_Master object. It
* contains mail session generic information such as the account manager, etc
* I'm starting this off as an empty interface and as people feel they need to
* add more information to it, they can. I think this is a better approach
* than trying to port over the old MSG_Master in its entirety as that had a
* lot of cruft in it....
*/
#include "nsISupports.idl"
#include "nsIAbListener.idl"
#include "nsIAbDirectory.idl"
#include "nsIAbCard.idl"
[scriptable, uuid(C5339441-303F-11d3-9E13-00A0C92B5F0D)]
interface nsIAddrBookSession : nsISupports {
void AddAddressBookListener(in nsIAbListener listener);
void RemoveAddressBookListener(in nsIAbListener listener);
void NotifyItemPropertyChanged(in nsISupports item,
in string property,
in wstring oldValue,
in wstring newValue);
void NotifyDirectoryItemAdded(in nsIAbDirectory directory, in nsISupports item);
void NotifyDirectoryItemDeleted(in nsIAbDirectory directory, in nsISupports item);
[noscript] void GetUserProfileDirectory(out nsFileSpec userDir);
};

View File

@@ -0,0 +1,37 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Netscape Public License
* Version 1.0 (the "NPL"); you may not use this file except in
* compliance with the NPL. You may obtain a copy of the NPL at
* http://www.mozilla.org/NPL/
*
* Software distributed under the NPL is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
* for the specific language governing rights and limitations under the
* NPL.
*
* The Initial Developer of this code under the NPL is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
* Reserved.
*/
#include "nsISupports.idl"
#include "nsIAbCard.idl"
interface nsIAddrDBListener;
[scriptable, uuid(A4186D8A-1DD0-11d3-A303-001083003D0C)]
interface nsIAddrDBAnnouncer : nsISupports {
void AddListener(in nsIAddrDBListener listener);
void RemoveListener(in nsIAddrDBListener listener);
void NotifyCardAttribChange(in unsigned long abCode,
in nsIAddrDBListener instigator);
void NotifyCardEntryChange (in unsigned long abCode,
in nsIAbCard card,
in nsIAddrDBListener instigator);
void NotifyAnnouncerGoingAway();
};

View File

@@ -0,0 +1,32 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Netscape Public License
* Version 1.0 (the "NPL"); you may not use this file except in
* compliance with the NPL. You may obtain a copy of the NPL at
* http://www.mozilla.org/NPL/
*
* Software distributed under the NPL is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
* for the specific language governing rights and limitations under the
* NPL.
*
* The Initial Developer of this code under the NPL is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
* Reserved.
*/
#include "nsISupports.idl"
#include "nsIAbCard.idl"
interface nsIAddrDBAnnouncer;
[scriptable, uuid(A4186D89-1DD0-11d3-A303-001083003D0C)]
interface nsIAddrDBListener : nsISupports {
void OnCardAttribChange(in unsigned long abCode,
in nsIAddrDBListener instigator);
void OnCardEntryChange (in unsigned long abCode,
in nsIAbCard card,
in nsIAddrDBListener instigator);
void OnAnnouncerGoingAway(in nsIAddrDBAnnouncer instigator);
};

View File

@@ -0,0 +1,109 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Netscape Public License
* Version 1.0 (the "NPL"); you may not use this file except in
* compliance with the NPL. You may obtain a copy of the NPL at
* http://www.mozilla.org/NPL/
*
* Software distributed under the NPL is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
* for the specific language governing rights and limitations under the
* NPL.
*
* The Initial Developer of this code under the NPL is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
* Reserved.
*/
/* nsFileSpec is declared in nsIAbDirectory.idl */
#include "nsIAddrDBAnnouncer.idl"
#include "nsIAbCard.idl"
#include "nsIAbDirectory.idl"
[ptr] native nsIMdbTableRowCursor(nsIMdbTableRowCursor);
[ptr] native nsIMdbEnv(nsIMdbEnv);
[ptr] native nsIMdbRow(nsIMdbRow);
%{C++
#include "mdb.h"
%}
[scriptable, uuid(A4186D8B-1DD0-11d3-A303-001083003D0C)]
interface nsIAddrDatabase : nsIAddrDBAnnouncer {
attribute nsFileSpec dbPath;
[noscript] void Open(in nsFileSpec folderName, in boolean create,
out nsIAddrDatabase pCardDB, in boolean upgrading);
void Close(in boolean forceCommit);
[noscript] void OpenMDB(in nsFileSpec dbName, in boolean create);
void CloseMDB(in boolean commit);
void OpenAnonymousDB(out nsIAddrDatabase pCardDB);
void CloseAnonymousDB(in boolean forceCommit);
void Commit(in unsigned long commitType);
void ForceClosed();
void CreateNewCardAndAddToDB(in nsIAbCard newCard, in boolean beNotify);
void EnumerateCards(in nsIAbDirectory directory, out nsIEnumerator result);
void EnumerateMailingLists(in nsIAbDirectory directory, out nsIEnumerator result);
void DeleteCard(in nsIAbCard card, in boolean beNotify);
void EditCard(in nsIAbCard card, in boolean beNotify);
void ContainsCard(in nsIAbCard card, out boolean hasCard);
void GetCardForEmailAddress(in nsIAbDirectory directory, in string emailAddress, out nsIAbCard card);
void SetAnonymousStringAttribute(in string attrname, in string value);
void GetAnonymousStringAttribute(in string attrname, out string value);
void SetAnonymousIntAttribute(in string attrname, in unsigned long value);
void GetAnonymousIntAttribute(in string attrname, out unsigned long value);
void SetAnonymousBoolAttribute(in string attrname, in boolean value);
void GetAnonymousBoolAttribute(in string attrname, out boolean value);
void AddAnonymousAttributesToDB();
void RemoveAnonymousAttributesFromDB();
void EditAnonymousAttributesInDB();
void AddAnonymousAttributesFromCard(in nsIAbCard card);
void RemoveAnonymousAttributesFromCard(in nsIAbCard card);
void EditAnonymousAttributesFromCard(in nsIAbCard card);
[noscript] void GetNewRow(out nsIMdbRow newRow);
[noscript] void AddCardRowToDB(in nsIMdbRow newRow);
[noscript] void AddFirstName(in nsIMdbRow row, in string value);
[noscript] void AddLastName(in nsIMdbRow row, in string value);
[noscript] void AddDisplayName(in nsIMdbRow row, in string value);
[noscript] void AddNickName(in nsIMdbRow row, in string value);
[noscript] void AddPrimaryEmail(in nsIMdbRow row, in string value);
[noscript] void Add2ndEmail(in nsIMdbRow row, in string value);
[noscript] void AddWorkPhone(in nsIMdbRow row, in string value);
[noscript] void AddHomePhone(in nsIMdbRow row, in string value);
[noscript] void AddFaxNumber(in nsIMdbRow row, in string value);
[noscript] void AddPagerNumber(in nsIMdbRow row, in string value);
[noscript] void AddCellularNumber(in nsIMdbRow row, in string value);
[noscript] void AddHomeAddress(in nsIMdbRow row, in string value);
[noscript] void AddHomeAddress2(in nsIMdbRow row, in string value);
[noscript] void AddHomeCity(in nsIMdbRow row, in string value);
[noscript] void AddHomeState(in nsIMdbRow row, in string value);
[noscript] void AddHomeZipCode(in nsIMdbRow row, in string value);
[noscript] void AddHomeCountry(in nsIMdbRow row, in string value);
[noscript] void AddWorkAddress(in nsIMdbRow row, in string value);
[noscript] void AddWorkAddress2(in nsIMdbRow row, in string value);
[noscript] void AddWorkCity(in nsIMdbRow row, in string value);
[noscript] void AddWorkState(in nsIMdbRow row, in string value);
[noscript] void AddWorkZipCode(in nsIMdbRow row, in string value);
[noscript] void AddWorkCountry(in nsIMdbRow row, in string value);
[noscript] void AddJobTitle(in nsIMdbRow row, in string value);
[noscript] void AddDepartment(in nsIMdbRow row, in string value);
[noscript] void AddCompany(in nsIMdbRow row, in string value);
[noscript] void AddWebPage1(in nsIMdbRow row, in string value);
[noscript] void AddWebPage2(in nsIMdbRow row, in string value);
[noscript] void AddBirthYear(in nsIMdbRow row, in string value);
[noscript] void AddBirthMonth(in nsIMdbRow row, in string value);
[noscript] void AddBirthDay(in nsIMdbRow row, in string value);
[noscript] void AddCustom1(in nsIMdbRow row, in string value);
[noscript] void AddCustom2(in nsIMdbRow row, in string value);
[noscript] void AddCustom3(in nsIMdbRow row, in string value);
[noscript] void AddCustom4(in nsIMdbRow row, in string value);
[noscript] void AddNotes(in nsIMdbRow row, in string value);
};

View File

@@ -0,0 +1,43 @@
/* -*- Mode: IDL; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
*
* The contents of this file are subject to the Netscape Public License
* Version 1.0 (the "NPL"); you may not use this file except in
* compliance with the NPL. You may obtain a copy of the NPL at
* http://www.mozilla.org/NPL/
*
* Software distributed under the NPL is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
* for the specific language governing rights and limitations under the
* NPL.
*
* The Initial Developer of this code under the NPL is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
* Reserved.
*/
#include "nsISupports.idl"
#include "xulstubs.idl"
#include "nsIRDFCompositeDataSource.idl"
#include "nsIAbCard.idl"
%{C++
#include "nsIDOMNodeList.h"
#include "nsIDOMXULElement.h"
%}
interface nsIDOMWindow;
[scriptable, uuid(D60B84F1-2A8C-11d3-9E07-00A0C92B5F0D)]
interface nsIAddressBook : nsISupports {
void DeleteCards(in nsIDOMXULElement tree, in nsIDOMXULElement srcDir, in nsIDOMNodeList node);
void NewAddressBook(in nsIRDFCompositeDataSource db, in nsIDOMXULElement srcDir, in wstring name);
void DeleteAddressBooks(in nsIRDFCompositeDataSource db, in nsIDOMXULElement srcDir, in nsIDOMNodeList node);
void PrintCard();
void PrintAddressbook();
void SetWebShellWindow(in nsIDOMWindow win);
void ImportAddressBook();
};

View File

@@ -0,0 +1,26 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Netscape Public License
* Version 1.0 (the "NPL"); you may not use this file except in
* compliance with the NPL. You may obtain a copy of the NPL at
* http://www.mozilla.org/NPL/
*
* Software distributed under the NPL is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
* for the specific language governing rights and limitations under the
* NPL.
*
* The Initial Developer of this code under the NPL is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1999 Netscape Communications Corporation. All Rights
* Reserved.
*/
#include "nsISupports.idl"
#include "nsrootidl.idl"
[scriptable, uuid(CA2A6B08-3625-11d3-988E-001083010E9B)]
interface nsIAutoCompleteListener : nsISupports {
void OnAutoCompleteResult(in nsISupports aParam, in wstring aOriginalString, in wstring aMatch);
};

View File

@@ -0,0 +1,28 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Netscape Public License
* Version 1.0 (the "NPL"); you may not use this file except in
* compliance with the NPL. You may obtain a copy of the NPL at
* http://www.mozilla.org/NPL/
*
* Software distributed under the NPL is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
* for the specific language governing rights and limitations under the
* NPL.
*
* The Initial Developer of this code under the NPL is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1999 Netscape Communications Corporation. All Rights
* Reserved.
*/
#include "nsISupports.idl"
#include "nsrootidl.idl"
interface nsIAutoCompleteListener;
[scriptable, uuid(CA2A6B07-3625-11d3-988E-001083010E9B)]
interface nsIAutoCompleteSession : nsISupports {
void AutoComplete(in nsISupports aParam, in wstring aSearchString, in nsIAutoCompleteListener aResultListener);
};

View File

@@ -0,0 +1,28 @@
#
# The contents of this file are subject to the Netscape Public License
# Version 1.0 (the "NPL"); you may not use this file except in
# compliance with the NPL. You may obtain a copy of the NPL at
# http://www.mozilla.org/NPL/
#
# Software distributed under the NPL is distributed on an "AS IS" basis,
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
# for the specific language governing rights and limitations under the
# NPL.
#
# The Initial Developer of this code under the NPL is Netscape
# Communications Corporation. Portions created by Netscape are
# Copyright (C) 1998 Netscape Communications Corporation. All Rights
# Reserved.
#
DEPTH = ../../..
topsrcdir = @top_srcdir@
srcdir = @srcdir@
VPATH = @srcdir@
include $(DEPTH)/config/autoconf.mk
DIRS = content locale skin
include $(topsrcdir)/config/rules.mk

View File

@@ -0,0 +1,33 @@
# The contents of this file are subject to the Netscape Public License
# Version 1.0 (the "NPL"); you may not use this file except in
# compliance with the NPL. You may obtain a copy of the NPL at
# http://www.mozilla.org/NPL/
#
# Software distributed under the NPL is distributed on an "AS IS" basis,
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
# for the specific language governing rights and limitations under the
# NPL.
#
# The Initial Developer of this code under the NPL is Netscape
# Communications Corporation. Portions created by Netscape are
# Copyright (C) 1998 Netscape Communications Corporation. All Rights
# Reserved.
#
# This is a list of local files which get copied to the res\mailnews\messenger directory
#
abAddressBookNameDialog.js
abAddressBookNameDialog.xul
abCardOverlay.js
abCardOverlay.xul
abCardViewOverlay.js
abCardViewOverlay.xul
abCommon.js
abDirTreeOverlay.xul
abEditCardDialog.xul
abNewCardDialog.xul
abResultsTreeOverlay.xul
abSelectAddressesDialog.js
abSelectAddressesDialog.xul
addressbook.js
addressbook.xul

View File

@@ -0,0 +1,51 @@
#
# The contents of this file are subject to the Netscape Public License
# Version 1.0 (the "NPL"); you may not use this file except in
# compliance with the NPL. You may obtain a copy of the NPL at
# http://www.mozilla.org/NPL/
#
# Software distributed under the NPL is distributed on an "AS IS" basis,
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
# for the specific language governing rights and limitations under the
# NPL.
#
# The Initial Developer of this code under the NPL is Netscape
# Communications Corporation. Portions created by Netscape are
# Copyright (C) 1998 Netscape Communications Corporation. All Rights
# Reserved.
#
DEPTH = ../../../..
topsrcdir = @top_srcdir@
srcdir = @srcdir@
VPATH = @srcdir@
include $(DEPTH)/config/autoconf.mk
SAMPLES_DIR = $(DIST)/bin/chrome/addressbook/content/default
EXPORT_RESOURCE_SAMPLES = \
abAddressBookNameDialog.js \
abAddressBookNameDialog.xul \
abCardOverlay.js \
abCardOverlay.xul \
abCardViewOverlay.js \
abCardViewOverlay.xul \
abCommon.js \
abDirTreeOverlay.xul \
abEditCardDialog.xul \
abNewCardDialog.xul \
abResultsTreeOverlay.xul \
abSelectAddressesDialog.js \
abSelectAddressesDialog.xul \
addressbook.js \
addressbook.xul \
$(NULL)
include $(topsrcdir)/config/rules.mk
GARBAGE += $(addprefix $(SAMPLES_DIR)/, $(EXPORT_RESOURCE_SAMPLES))
install::
$(INSTALL) $(addprefix $(srcdir)/, $(EXPORT_RESOURCE_SAMPLES)) $(SAMPLES_DIR)

View File

@@ -0,0 +1,37 @@
var okCallback = 0;
function abNameOnLoad()
{
doSetOKCancel(abNameOKButton, 0);
// look in arguments[0] for parameters
if (window.arguments && window.arguments[0])
{
if ( window.arguments[0].title )
{
dump("title = " + window.arguments[0].title + "\n");
var title = window.arguments[0].title;
top.window.title = title;
}
if ( window.arguments[0].okCallback )
top.okCallback = window.arguments[0].okCallback;
}
// focus on input
var name = document.getElementById('name');
if ( name )
name.focus();
}
function abNameOKButton()
{
if ( top.okCallback )
{
var name = document.getElementById('name').value;
top.okCallback(name);
}
return true;
}

View File

@@ -0,0 +1,51 @@
<?xml version="1.0"?>
<!--
The contents of this file are subject to the Netscape Public
License Version 1.1 (the "License"); you may not use this file
except in compliance with the License. You may obtain a copy of
the License at http://www.mozilla.org/NPL/
Software distributed under the License is distributed on an "AS
IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
implied. See the License for the specific language governing
rights and limitations under the License.
The Original Code is Mozilla Communicator client code, released
March 31, 1998.
The Initial Developer of the Original Code is Netscape
Communications Corporation. Portions created by Netscape are
Copyright (C) 1998-1999 Netscape Communications Corporation. All
Rights Reserved.
-->
<?xul-overlay href="chrome://global/content/dialogOverlay.xul"?>
<!DOCTYPE window SYSTEM "chrome://addressbook/locale/abAddressBookNameDialog.dtd">
<window xmlns:html="http://www.w3.org/TR/REC-html40"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
align="vertical"
class="dialog"
onload="abNameOnLoad()"
style="padding:10px">
<html:script language="JavaScript" src="chrome://addressbook/content/abAddressBookNameDialog.js"/>
<keyset id="keyset"/>
<box align="vertical" style="width:36em; min-height:12em">
<spring flex="100%"/>
<html:div style="margin-bottom:.3em">&name.label;</html:div>
<html:input tabindex="0" type="text" id="name" style="width:100%"/>
<spring flex="100%"/>
<box id="okCancelButtons"/>
</box>
</window>

View File

@@ -0,0 +1,303 @@
var editCard;
var newCardTitlePrefix = "New Card for ";
var editCardTitlePrefix = "Card for ";
var editCardFirstLastSeparator = " ";
var editCardLastFirstSeparator = ", ";
function OnLoadNewCard()
{
InitEditCard();
doSetOKCancel(NewCardOKButton, 0);
editCard.card = 0;
editCard.okCallback = 0;
editCard.titlePrefix = newCardTitlePrefix;
if (window.arguments && window.arguments[0])
{
if ( window.arguments[0].selectedAB )
editCard.selectedAB = window.arguments[0].selectedAB;
}
// set popup with address book names
var abPopup = document.getElementById('abPopup');
if ( editCard.selectedAB )
abPopup.value = editCard.selectedAB;
//// FIX ME - looks like we need to focus on both the text field and the tab widget
//// probably need to do the same in the addressing widget
// focus on first name
var firstName = document.getElementById('FirstName');
if ( firstName )
firstName.focus();
}
function OnLoadEditCard()
{
InitEditCard();
doSetOKCancel(EditCardOKButton, 0);
editCard.titlePrefix = editCardTitlePrefix;
if (window.arguments && window.arguments[0])
{
if ( window.arguments[0].card )
editCard.card = window.arguments[0].card;
if ( window.arguments[0].okCallback )
editCard.okCallback = window.arguments[0].okCallback;
if ( window.arguments[0].abURI )
editCard.abURI = window.arguments[0].abURI;
}
// set global state variables
// if first or last name entered, disable generateDisplayName
if ( editCard.generateDisplayName && (editCard.card.FirstName.length +
editCard.card.LastName.length +
editCard.card.DisplayName.length > 0) )
{
editCard.generateDisplayName = false;
}
GetCardValues(editCard.card, document);
top.window.title = editCard.titlePrefix + editCard.card.DisplayName;
}
function InitEditCard()
{
// create editCard object that contains global variables for editCard.js
editCard = new Object;
// get pointer to nsIPref object
var prefs = Components.classes["component://netscape/preferences"];
if ( prefs )
{
prefs = prefs.getService();
if ( prefs )
{
prefs = prefs.QueryInterface(Components.interfaces.nsIPref);
editCard.prefs = prefs;
}
}
// get specific prefs that editCard will need
if ( prefs )
{
try {
editCard.displayLastNameFirst = prefs.GetBoolPref("mail.addr_book.lastnamefirst");
}
catch (ex) {
dump("failed to get the mail.addr_book.lastnamefirst pref\n");
}
try {
editCard.generateDisplayName = prefs.GetBoolPref("mail.addr_book.displayName.autoGeneration");
}
catch (ex) {
dump("failed to get the mail.addr_book.displayName.autoGeneration pref\n");
}
}
}
function NewCardOKButton()
{
var popup = document.getElementById('abPopup');
if ( popup )
{
var uri = popup.value;
// FIX ME - hack to avoid crashing if no ab selected because of blank option bug from template
// should be able to just remove this if we are not seeing blank lines in the ab popup
if ( !uri )
return false; // don't close window
// -----
var cardproperty = Components.classes["component://netscape/addressbook/cardproperty"].createInstance();
cardproperty = cardproperty.QueryInterface(Components.interfaces.nsIAbCard);
if ( cardproperty )
{
SetCardValues(cardproperty, document);
cardproperty.AddCardToDatabase(uri);
}
}
return true; // close the window
}
function EditCardOKButton()
{
SetCardValues(editCard.card, document);
editCard.card.EditCardToDatabase(editCard.abURI);
// callback to allow caller to update
if ( editCard.okCallback )
editCard.okCallback();
return true; // close the window
}
// Move the data from the cardproperty to the dialog
function GetCardValues(cardproperty, doc)
{
if ( cardproperty )
{
doc.getElementById('FirstName').value = cardproperty.FirstName;
doc.getElementById('LastName').value = cardproperty.LastName;
doc.getElementById('DisplayName').value = cardproperty.DisplayName;
doc.getElementById('NickName').value = cardproperty.NickName;
doc.getElementById('PrimaryEmail').value = cardproperty.PrimaryEmail;
doc.getElementById('SecondEmail').value = cardproperty.SecondEmail;
//doc.getElementById('SendPlainText').value = cardproperty.SendPlainText;
doc.getElementById('WorkPhone').value = cardproperty.WorkPhone;
doc.getElementById('HomePhone').value = cardproperty.HomePhone;
doc.getElementById('FaxNumber').value = cardproperty.FaxNumber;
doc.getElementById('PagerNumber').value = cardproperty.PagerNumber;
doc.getElementById('CellularNumber').value = cardproperty.CellularNumber;
doc.getElementById('HomeAddress').value = cardproperty.HomeAddress;
doc.getElementById('HomeAddress2').value = cardproperty.HomeAddress2;
doc.getElementById('HomeCity').value = cardproperty.HomeCity;
doc.getElementById('HomeState').value = cardproperty.HomeState;
doc.getElementById('HomeZipCode').value = cardproperty.HomeZipCode;
doc.getElementById('HomeCountry').value = cardproperty.HomeCountry;
doc.getElementById('JobTitle').value = cardproperty.JobTitle;
doc.getElementById('Department').value = cardproperty.Department;
doc.getElementById('Company').value = cardproperty.Company;
doc.getElementById('WorkAddress').value = cardproperty.WorkAddress;
doc.getElementById('WorkAddress2').value = cardproperty.WorkAddress2;
doc.getElementById('WorkCity').value = cardproperty.WorkCity;
doc.getElementById('WorkState').value = cardproperty.WorkState;
doc.getElementById('WorkZipCode').value = cardproperty.WorkZipCode;
doc.getElementById('WorkCountry').value = cardproperty.WorkCountry;
doc.getElementById('WebPage1').value = cardproperty.WebPage1;
doc.getElementById('Custom1').value = cardproperty.Custom1;
doc.getElementById('Custom2').value = cardproperty.Custom2;
doc.getElementById('Custom3').value = cardproperty.Custom3;
doc.getElementById('Custom4').value = cardproperty.Custom4;
doc.getElementById('Notes').value = cardproperty.Notes;
}
}
// Move the data from the dialog to the cardproperty to be stored in the database
function SetCardValues(cardproperty, doc)
{
if (cardproperty)
{
cardproperty.FirstName = doc.getElementById('FirstName').value;
cardproperty.LastName = doc.getElementById('LastName').value;
cardproperty.DisplayName = doc.getElementById('DisplayName').value;
cardproperty.NickName = doc.getElementById('NickName').value;
cardproperty.PrimaryEmail = doc.getElementById('PrimaryEmail').value;
cardproperty.SecondEmail = doc.getElementById('SecondEmail').value;
//cardproperty.SendPlainText = doc.getElementById('SendPlainText').value;
cardproperty.WorkPhone = doc.getElementById('WorkPhone').value;
cardproperty.HomePhone = doc.getElementById('HomePhone').value;
cardproperty.FaxNumber = doc.getElementById('FaxNumber').value;
cardproperty.PagerNumber = doc.getElementById('PagerNumber').value;
cardproperty.CellularNumber = doc.getElementById('CellularNumber').value;
cardproperty.HomeAddress = doc.getElementById('HomeAddress').value;
cardproperty.HomeAddress2 = doc.getElementById('HomeAddress2').value;
cardproperty.HomeCity = doc.getElementById('HomeCity').value;
cardproperty.HomeState = doc.getElementById('HomeState').value;
cardproperty.HomeZipCode = doc.getElementById('HomeZipCode').value;
cardproperty.HomeCountry = doc.getElementById('HomeCountry').value;
cardproperty.JobTitle = doc.getElementById('JobTitle').value;
cardproperty.Department = doc.getElementById('Department').value;
cardproperty.Company = doc.getElementById('Company').value;
cardproperty.WorkAddress = doc.getElementById('WorkAddress').value;
cardproperty.WorkAddress2 = doc.getElementById('WorkAddress2').value;
cardproperty.WorkCity = doc.getElementById('WorkCity').value;
cardproperty.WorkState = doc.getElementById('WorkState').value;
cardproperty.WorkZipCode = doc.getElementById('WorkZipCode').value;
cardproperty.WorkCountry = doc.getElementById('WorkCountry').value;
cardproperty.WebPage1 = doc.getElementById('WebPage1').value;
cardproperty.Custom1 = doc.getElementById('Custom1').value;
cardproperty.Custom2 = doc.getElementById('Custom2').value;
cardproperty.Custom3 = doc.getElementById('Custom3').value;
cardproperty.Custom4 = doc.getElementById('Custom4').value;
cardproperty.Notes = doc.getElementById('Notes').value;
}
}
function NewCardCancelButton()
{
top.window.close();
}
function EditCardCancelButton()
{
top.window.close();
}
function GenerateDisplayName()
{
if ( editCard.generateDisplayName )
{
var displayName;
var firstNameField = document.getElementById('FirstName');
var lastNameField = document.getElementById('LastName');
var displayNameField = document.getElementById('DisplayName');
/* todo: i18N work todo here */
/* this used to be XP_GetString(MK_ADDR_FIRST_LAST_SEP) */
/* todo: mscott says there was a pref in 4.5 that would */
/* cause GenerateDisplayName() to do nothing. */
/* the i18N people need it. */
/* find the pref and heed it. */
/* trying to be smart about no using the first last sep */
/* if first or last is missing */
/* todo: is this i18N safe? */
var separator = "";
if ( lastNameField.value && firstNameField.value )
{
if ( editCard.displayLastNameFirst )
separator = editCardLastFirstSeparator;
else
separator = editCardFirstLastSeparator;
}
if ( editCard.displayLastNameFirst )
displayName = lastNameField.value + separator + firstNameField.value;
else
displayName = firstNameField.value + separator + lastNameField.value;
displayNameField.value = displayName;
top.window.title = editCard.titlePrefix + displayName;
}
}
function DisplayNameChanged()
{
// turn off generateDisplayName if the user changes the display name
editCard.generateDisplayName = false;
var title = editCard.titlePrefix + document.getElementById('DisplayName').value;
if ( top.window.title != title )
top.window.title = title;
}

View File

@@ -0,0 +1,293 @@
<?xml version="1.0"?>
<!--
The contents of this file are subject to the Netscape Public
License Version 1.1 (the "License"); you may not use this file
except in compliance with the License. You may obtain a copy of
the License at http://www.mozilla.org/NPL/
Software distributed under the License is distributed on an "AS
IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
implied. See the License for the specific language governing
rights and limitations under the License.
The Original Code is Mozilla Communicator client code, released
March 31, 1998.
The Initial Developer of the Original Code is Netscape
Communications Corporation. Portions created by Netscape are
Copyright (C) 1998-1999 Netscape Communications Corporation. All
Rights Reserved.
-->
<!DOCTYPE window SYSTEM "chrome://addressbook/locale/abCardOverlay.dtd">
<overlay id="editcardOverlay"
xmlns:html="http://www.w3.org/TR/REC-html40"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
<html:script language="JavaScript" src="chrome://addressbook/content/abCardOverlay.js"/>
<box id="editcard" align="vertical">
<tabcontrol align="vertical" style="margin:5px">
<tabbox align="horizontal">
<tab>&Name.tab;</tab>
<tab>&Address.tab;</tab>
<tab>&Other.tab;</tab>
</tabbox>
<tabpanel align="vertical" flex="100%" style="border:2px groove white">
<!-- ** Name Tab ** -->
<box index="name" align="vertical" flex="100%">
<html:fieldset flex="100%">
<html:legend align="left">
<html:div style="font-weight: bold">&Name.box;</html:div>
</html:legend>
<box align="vertical" style="width:100%">
<box align="horizontal" flex="100%">
<spring flex="100%"/>
<html:label for="FirstName">&FirstName.label;</html:label>
<html:input type="text" id="FirstName" class="CardEdit" onkeyup="top.GenerateDisplayName()" />
</box>
<box align="horizontal">
<spring flex="100%"/>
<html:label for="LastName">&LastName.label;</html:label>
<html:input id="LastName" type="text" class="CardEdit" onkeyup="top.GenerateDisplayName()"/>
</box>
<box align="horizontal">
<spring flex="100%"/>
<html:label for="DisplayName">&DisplayName.label;</html:label>
<html:input id="DisplayName" type="text" class="CardEdit" onkeyup="top.DisplayNameChanged()"/>
</box>
<box align="horizontal">
<spring flex="100%"/>
<html:label for="NickName">&NickName.label;</html:label>
<html:input id="NickName" type="text" class="CardEdit"/>
</box>
</box>
</html:fieldset>
<html:fieldset flex="100%">
<html:legend align="left">
<html:div style="font-weight: bold">&Internet.box;</html:div>
</html:legend>
<box align="vertical" style="width:100%">
<box align="horizontal">
<spring flex="100%"/>
<html:label for="PrimaryEmail">&PrimaryEmail.label;</html:label>
<html:input id="PrimaryEmail" type="text" class="CardEdit"/>
</box>
<box align="horizontal">
<spring flex="100%"/>
<html:label for="SecondEmail">&SecondEmail.label;</html:label>
<html:input id="SecondEmail" type="text" class="CardEdit"/>
</box>
<box align="horizontal">
<spring flex="100%"/>
<box class="CardEditWidth">
<html:input id="SendPlainText" type="checkbox"/>
<html:label for="SendPlainText">&SendPlainText.label;</html:label>
</box>
</box>
</box>
</html:fieldset>
<html:fieldset flex="100%">
<html:legend align="left">
<html:div style="font-weight: bold">&Phones.box;</html:div>
</html:legend>
<box align="vertical" style="width:100%">
<box align="horizontal" style="vertical-align:baseline">
<spring flex="100%"/>
<html:label for="WorkPhone" style="vertical-align:baseline">&WorkPhone.label;</html:label>
<html:input id="WorkPhone" type="text" class="CardEdit" style="vertical-align:baseline"/>
</box>
<box align="horizontal">
<spring flex="100%"/>
<html:label for="HomePhone">&HomePhone.label;</html:label>
<html:input id="HomePhone" type="text" class="CardEdit"/>
</box>
<box align="horizontal">
<spring flex="100%"/>
<html:label for="FaxNumber">&FaxNumber.label;</html:label>
<html:input id="FaxNumber" type="text" class="CardEdit"/>
</box>
<box align="horizontal">
<spring flex="100%"/>
<html:label for="PagerNumber">&PagerNumber.label;</html:label>
<html:input id="PagerNumber" type="text" class="CardEdit"/>
</box>
<box align="horizontal">
<spring flex="100%"/>
<html:label for="CellularNumber">&CellularNumber.label;</html:label>
<html:input id="CellularNumber" type="text" class="CardEdit"/>
</box>
</box>
</html:fieldset>
</box>
<!-- ** Address Tab ** -->
<box index="address" align="vertical" flex="100%">
<html:fieldset flex="100%">
<html:legend align="left">
<html:div style="font-weight: bold">&Home.box;</html:div>
</html:legend>
<box align="vertical" style="width:100%">
<box align="horizontal">
<spring flex="100%"/>
<html:label for="HomeAddress">&HomeAddress.label;</html:label>
<html:input type="text" id="HomeAddress" class="CardEdit"/>
</box>
<box align="horizontal">
<spring flex="100%"/>
<html:label for="HomeAddress2">&HomeAddress2.label;</html:label>
<html:input type="text" id="HomeAddress2" class="CardEdit"/>
</box>
<box align="horizontal">
<spring flex="100%"/>
<html:label for="HomeCity">&HomeCity.label;</html:label>
<html:input id="HomeCity" type="text" class="CardEdit"/>
</box>
<box align="horizontal">
<spring flex="100%"/>
<html:label for="HomeState">&HomeState.label;</html:label>
<box class="CardEditWidth">
<html:input id="HomeState" type="text" class="CardEdit" style="min-width:1em; width:8em"/>
<spring flex="100%"/>
<html:label for="HomeZipCode">&HomeZipCode.label;</html:label>
<html:input id="HomeZipCode" type="text" class="CardEdit" style="min-width:1em; width:8em"/>
</box>
</box>
<box align="horizontal">
<spring flex="100%"/>
<html:label for="HomeCountry">&HomeCountry.label;</html:label>
<html:input id="HomeCountry" type="text" class="CardEdit"/>
</box>
</box>
</html:fieldset>
<html:fieldset style="width:100%">
<html:legend align="left">
<html:div style="font-weight: bold">&Work.box;</html:div>
</html:legend>
<box align="vertical" style="width:100%">
<box align="horizontal">
<spring flex="100%"/>
<html:label for="JobTitle">&JobTitle.label;</html:label>
<html:input type="text" id="JobTitle" class="CardEdit"/>
</box>
<box align="horizontal">
<spring flex="100%"/>
<html:label for="Department">&Department.label;</html:label>
<html:input type="text" id="Department" class="CardEdit"/>
</box>
<box align="horizontal">
<spring flex="100%"/>
<html:label for="Company">&Company.label;</html:label>
<html:input type="text" id="Company" class="CardEdit"/>
</box>
<box align="horizontal">
<spring flex="100%"/>
<html:label for="WorkAddress">&WorkAddress.label;</html:label>
<html:input type="text" id="WorkAddress" class="CardEdit"/>
</box>
<box align="horizontal">
<spring flex="100%"/>
<html:label for="WorkAddress2">&WorkAddress2.label;</html:label>
<html:input type="text" id="WorkAddress2" class="CardEdit"/>
</box>
<box align="horizontal">
<spring flex="100%"/>
<html:label for="WorkCity">&WorkCity.label;</html:label>
<html:input id="WorkCity" type="text" class="CardEdit"/>
</box>
<box align="horizontal">
<spring flex="100%"/>
<html:label for="WorkState">&WorkState.label;</html:label>
<box class="CardEditWidth">
<html:input id="WorkState" type="text" class="CardEdit" style="min-width:1em; width:8em"/>
<spring flex="100%"/>
<html:label for="WorkZipCode">&WorkZipCode.label;</html:label>
<html:input id="WorkZipCode" type="text" class="CardEdit" style="min-width:1em; width:8em"/>
</box>
</box>
<box align="horizontal">
<spring flex="100%"/>
<html:label for="WorkCountry">&WorkCountry.label;</html:label>
<html:input id="WorkCountry" type="text" class="CardEdit"/>
</box>
</box>
</html:fieldset>
<!--html:fieldset style="width:100%">
<html:legend align="left">
<html:div style="font-weight: bold">&Web.box;</html:div>
</html:legend-->
<box align="vertical" style="width:100%">
<box align="horizontal">
<!--spring flex="100%"/-->
<html:label for="WebPage1">&WebPage1.label;</html:label>
<html:input type="text" id="WebPage1" class="CardEdit" flex="100%"/>
</box>
</box>
<!--/html:fieldset-->
</box>
<!-- ** Other Tab ** -->
<box index="other" align="vertical" flex="100%">
<box align="vertical" style="width:100%">
<box align="horizontal" flex="100%">
<spring flex="100%"/>
<html:label for="Custom1">&Custom1.label;</html:label>
<html:input type="text" id="Custom1" class="CardEdit"/>
</box>
<box align="horizontal" flex="100%">
<spring flex="100%"/>
<html:label for="Custom2">&Custom2.label;</html:label>
<html:input type="text" id="Custom2" class="CardEdit"/>
</box>
<box align="horizontal" flex="100%">
<spring flex="100%"/>
<html:label for="Custom3">&Custom3.label;</html:label>
<html:input type="text" id="Custom3" class="CardEdit"/>
</box>
<box align="horizontal" flex="100%">
<spring flex="100%"/>
<html:label for="Custom4">&Custom4.label;</html:label>
<html:input type="text" id="Custom4" class="CardEdit"/>
</box>
</box>
<html:fieldset style="width:100%">
<html:legend align="left">
<html:div style="font-weight: bold">&Notes.box;</html:div>
</html:legend>
<box align="vertical" style="width:100%">
<html:textarea id="Notes" rows="15"/>
</box>
</html:fieldset>
</box>
</tabpanel>
</tabcontrol>
</box>
</overlay>

View File

@@ -0,0 +1,231 @@
var zWork = "Work: ";
var zHome = "Home: ";
var zFax = "Fax: ";
var zCellular = "Cellular: ";
var zPager = "Pager: ";
var zCustom1 = "Custom 1: ";
var zCustom2 = "Custom 2: ";
var zCustom3 = "Custom 3: ";
var zCustom4 = "Custom 4: ";
var rdf;
var cvData;
function OnLoadCardView()
{
// This should be in an onload for the card view window, but that is not currently working
rdf = Components.classes["component://netscape/rdf/rdf-service"].getService();
rdf = rdf.QueryInterface(Components.interfaces.nsIRDFService);
var doc = document;
/* data for address book, prefixes: "cvb" = card view box
"cvh" = crad view header
"cv" = card view (normal fields) */
cvData = new Object;
// Card View Box
cvData.CardViewBox = doc.getElementById("CardViewBox");
// Title
cvData.CardTitle = doc.getElementById("CardTitle");
// Name section
cvData.cvbName = doc.getElementById("cvbName");
cvData.cvhName = doc.getElementById("cvhName");
cvData.cvNickname = doc.getElementById("cvNickname");
cvData.cvEmail1 = doc.getElementById("cvEmail1");
cvData.cvEmail2 = doc.getElementById("cvEmail2");
// Home section
cvData.cvbHome = doc.getElementById("cvbHome");
cvData.cvhHome = doc.getElementById("cvhHome");
cvData.cvHomeAddress = doc.getElementById("cvHomeAddress");
cvData.cvHomeAddress2 = doc.getElementById("cvHomeAddress2");
cvData.cvHomeCityStZip = doc.getElementById("cvHomeCityStZip");
cvData.cvHomeCountry = doc.getElementById("cvHomeCountry");
// Other section
cvData.cvbOther = doc.getElementById("cvbOther");
cvData.cvhOther = doc.getElementById("cvhOther");
cvData.cvCustom1 = doc.getElementById("cvCustom1");
cvData.cvCustom2 = doc.getElementById("cvCustom2");
cvData.cvCustom3 = doc.getElementById("cvCustom3");
cvData.cvCustom4 = doc.getElementById("cvCustom4");
cvData.cvNotes = doc.getElementById("cvNotes");
// Phone section
cvData.cvbPhone = doc.getElementById("cvbPhone");
cvData.cvhPhone = doc.getElementById("cvhPhone");
cvData.cvPhWork = doc.getElementById("cvPhWork");
cvData.cvPhHome = doc.getElementById("cvPhHome");
cvData.cvPhFax = doc.getElementById("cvPhFax");
cvData.cvPhCellular = doc.getElementById("cvPhCellular");
cvData.cvPhPager = doc.getElementById("cvPhPager");
// Work section
cvData.cvbWork = doc.getElementById("cvbWork");
cvData.cvhWork = doc.getElementById("cvhWork");
cvData.cvJobTitle = doc.getElementById("cvJobTitle");
cvData.cvDepartment = doc.getElementById("cvDepartment");
cvData.cvCompany = doc.getElementById("cvCompany");
cvData.cvWorkAddress = doc.getElementById("cvWorkAddress");
cvData.cvWorkAddress2 = doc.getElementById("cvWorkAddress2");
cvData.cvWorkCityStZip = doc.getElementById("cvWorkCityStZip");
cvData.cvWorkCountry = doc.getElementById("cvWorkCountry");
}
function DisplayCardViewPane(abNode)
{
var uri = abNode.getAttribute('id');
var cardResource = top.rdf.GetResource(uri);
var card = cardResource.QueryInterface(Components.interfaces.nsIAbCard);
// FIX ME - this should use a i18n name routine in JS
var name = card.DisplayName;
if ( card.FirstName.length + card.LastName.length > 0 )
name = card.FirstName + " " + card.LastName;
var nickname;
if ( card.NickName )
nickname = "\"" + card.NickName + "\"";
var data = top.cvData;
var visible;
// set fields in card view pane
cvSetNode(data.CardTitle, "Card for " + card.DisplayName);
// Name section
cvSetNode(data.cvhName, name);
cvSetNode(data.cvNickname, nickname);
cvSetNode(data.cvEmail1, card.PrimaryEmail);
cvSetNode(data.cvEmail2, card.SecondEmail);
// Home section
visible = cvSetNode(data.cvHomeAddress, card.HomeAddress);
visible = cvSetNode(data.cvHomeAddress2, card.HomeAddress2) || visible;
visible = cvSetCityStateZip(data.cvHomeCityStZip, card.HomeCity, card.HomeState, card.HomeZipCode) || visible;
visible = cvSetNode(data.cvHomeCountry, card.HomeCountry) || visible;
cvSetVisible(data.cvhHome, visible);
// Other section
visible = cvSetNodeWithLabel(data.cvCustom1, zCustom1, card.Custom1);
visible = cvSetNodeWithLabel(data.cvCustom2, zCustom2, card.Custom2) || visible;
visible = cvSetNodeWithLabel(data.cvCustom3, zCustom3, card.Custom3) || visible;
visible = cvSetNodeWithLabel(data.cvCustom4, zCustom4, card.Custom4) || visible;
visible = cvSetNode(data.cvNotes, card.Notes) || visible;
cvSetVisible(data.cvhOther, visible);
// Phone section
visible = cvSetNodeWithLabel(data.cvPhWork, zWork, card.WorkPhone);
visible = cvSetNodeWithLabel(data.cvPhHome, zHome, card.HomePhone) || visible;
visible = cvSetNodeWithLabel(data.cvPhFax, zFax, card.FaxNumber) || visible;
visible = cvSetNodeWithLabel(data.cvPhCellular, zCellular, card.CellularNumber) || visible;
visible = cvSetNodeWithLabel(data.cvPhPager, zPager, card.PagerNumber) || visible;
cvSetVisible(data.cvhPhone, visible);
// Work section
visible = cvSetNode(data.cvJobTitle, card.JobTitle);
visible = cvSetNode(data.cvDepartment, card.Department) || visible;
visible = cvSetNode(data.cvCompany, card.Company) || visible;
visible = cvSetNode(data.cvWorkAddress, card.WorkAddress) || visible;
visible = cvSetNode(data.cvWorkAddress2, card.WorkAddress2) || visible;
visible = cvSetCityStateZip(data.cvWorkCityStZip, card.WorkCity, card.WorkState, card.WorkZipCode) || visible;
visible = cvSetNode(data.cvWorkCountry, card.WorkCountry) || visible;
cvSetVisible(data.cvhWork, visible);
// make the card view box visible
cvSetVisible(top.cvData.CardViewBox, true);
}
function ClearCardViewPane()
{
cvSetVisible(top.cvData.CardViewBox, false);
/* can remove this code now that boxes handle display:none
// HACK - we need to be able to set the entire box or div to display:none when bug fixed
var data = top.cvData;
// title
cvSetVisible(data.CardTitle, false);
// Name section
cvSetVisible(data.cvhName, false);
cvSetVisible(data.cvNickname, false);
cvSetVisible(data.cvEmail1, false);
cvSetVisible(data.cvEmail2, false);
// Home section
cvSetVisible(data.cvhHome, false);
cvSetVisible(data.cvHomeAddress, false);
cvSetVisible(data.cvHomeAddress2, false);
cvSetVisible(data.cvHomeCityStZip, false);
cvSetVisible(data.cvHomeCountry, false);
// Other section
cvSetVisible(data.cvhOther, false);
cvSetVisible(data.cvCustom1, false);
cvSetVisible(data.cvCustom2, false);
cvSetVisible(data.cvCustom3, false);
cvSetVisible(data.cvCustom4, false);
cvSetVisible(data.cvNotes, false);
// Phone section
cvSetVisible(data.cvhPhone, false);
cvSetVisible(data.cvPhWork, false);
cvSetVisible(data.cvPhHome, false);
cvSetVisible(data.cvPhFax, false);
cvSetVisible(data.cvPhCellular, false);
cvSetVisible(data.cvPhPager, false);
// Work section
cvSetVisible(data.cvhWork, false);
cvSetVisible(data.cvJobTitle, false);
cvSetVisible(data.cvDepartment, false);
cvSetVisible(data.cvCompany, false);
cvSetVisible(data.cvWorkAddress, false);
cvSetVisible(data.cvWorkAddress2, false);
cvSetVisible(data.cvWorkCityStZip, false);
cvSetVisible(data.cvWorkCountry, false);
*/
}
function cvSetNodeWithLabel(node, label, text)
{
if ( text )
return cvSetNode(node, label + text);
else
{
cvSetVisible(node, false);
return false;
}
}
function cvSetCityStateZip(node, city, state, zip)
{
var text;
if ( city )
{
text = city;
if ( state || zip )
text += ", ";
}
if ( state )
text += state + " ";
if ( zip )
text += zip;
return cvSetNode(node, text);
}
function cvSetNode(node, text)
{
node.childNodes[0].nodeValue = text;
var visible;
if ( text )
visible = true;
else
visible = false;
cvSetVisible(node, visible);
return visible;
}
function cvSetVisible(node, visible)
{
if ( visible )
node.removeAttribute("hide");
else
node.setAttribute("hide", "true");
}

View File

@@ -0,0 +1,94 @@
<?xml version="1.0"?>
<!--
The contents of this file are subject to the Netscape Public
License Version 1.1 (the "License"); you may not use this file
except in compliance with the License. You may obtain a copy of
the License at http://www.mozilla.org/NPL/
Software distributed under the License is distributed on an "AS
IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
implied. See the License for the specific language governing
rights and limitations under the License.
The Original Code is Mozilla Communicator client code, released
March 31, 1998.
The Initial Developer of the Original Code is Netscape
Communications Corporation. Portions created by Netscape are
Copyright (C) 1998-1999 Netscape Communications Corporation. All
Rights Reserved.
-->
<!DOCTYPE window SYSTEM "chrome://addressbook/locale/abCardViewOverlay.dtd">
<overlay xmlns:html="http://www.w3.org/TR/REC-html40"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
<html:script language="JavaScript" src="chrome://addressbook/content/abCardViewOverlay.js"/>
<box id="CardViewBox"
align="vertical"
flex="100%"
style="overflow:auto; background-color:#dddddd; padding-left:5px; padding-right:5px">
<html:div hide="true" style="font-size:150%; font-weight:bold; border-bottom:2px solid black" id="CardTitle">*</html:div>
<box align="horizontal" flex="100%">
<box align="vertical" flex="100%" style="width:100px">
<box id="cvbName" align="vertical">
<html:div class="CardViewHeading" hide="true" id="cvhName">*</html:div>
<html:div class="CardViewText" hide="true" id="cvNickname">*</html:div>
<html:div class="CardViewText" hide="true" id="cvEmail1">*</html:div>
<html:div class="CardViewText" hide="true" id="cvEmail2">*</html:div>
</box>
<box id="cvbHome" align="vertical">
<html:div class="CardViewHeading" hide="true" id="cvhHome">&home.heading;</html:div>
<html:div class="CardViewText" hide="true" id="cvHomeAddress">*</html:div>
<html:div class="CardViewText" hide="true" id="cvHomeAddress2">*</html:div>
<html:div class="CardViewText" hide="true" id="cvHomeCityStZip">*</html:div>
<html:div class="CardViewText" hide="true" id="cvHomeCountry">*</html:div>
</box>
<box id="cvbOther" align="vertical">
<html:div class="CardViewHeading" hide="true" id="cvhOther">&other.heading;</html:div>
<html:div class="CardViewText" hide="true" id="cvCustom1">*</html:div>
<html:div class="CardViewText" hide="true" id="cvCustom2">*</html:div>
<html:div class="CardViewText" hide="true" id="cvCustom3">*</html:div>
<html:div class="CardViewText" hide="true" id="cvCustom4">*</html:div>
<html:div class="CardViewText" hide="true" id="cvNotes">*</html:div>
</box>
</box>
<spring style="width:20px"/>
<box align="vertical" flex="100%" style="width:100px">
<box id="cvbPhone" align="vertical">
<html:div class="CardViewHeading" hide="true" id="cvhPhone">&phone.heading;</html:div>
<html:div class="CardViewText" hide="true" id="cvPhWork">*</html:div>
<html:div class="CardViewText" hide="true" id="cvPhHome">*</html:div>
<html:div class="CardViewText" hide="true" id="cvPhFax">*</html:div>
<html:div class="CardViewText" hide="true" id="cvPhCellular">*</html:div>
<html:div class="CardViewText" hide="true" id="cvPhPager">*</html:div>
</box>
<box id="cvbWork" align="vertical">
<html:div class="CardViewHeading" hide="true" id="cvhWork">&work.heading;</html:div>
<html:div class="CardViewText" hide="true" id="cvJobTitle">*</html:div>
<html:div class="CardViewText" hide="true" id="cvDepartment">*</html:div>
<html:div class="CardViewText" hide="true" id="cvCompany">*</html:div>
<html:div class="CardViewText" hide="true" id="cvWorkAddress">*</html:div>
<html:div class="CardViewText" hide="true" id="cvWorkAddress2">*</html:div>
<html:div class="CardViewText" hide="true" id="cvWorkCityStZip">*</html:div>
<html:div class="CardViewText" hide="true" id="cvWorkCountry">*</html:div>
</box>
</box>
</box>
</box>
</overlay>

View File

@@ -0,0 +1,257 @@
// functions needed from abMainWindow and abSelectAddresses
// Controller object for Results Pane
var ResultsPaneController =
{
IsCommandEnabled: function(command)
{
dump('ResultsPaneController::IsCommandEnabled(' + command + ')\n');
switch ( command )
{
case "cmd_selectAll":
return true;
case "cmd_delete":
var resultsTree = document.getElementById('resultsTree');
if ( resultsTree && resultsTree.selectedItems )
return true;
else
return false;
default:
return false;
}
},
DoCommand: function(command)
{
var resultsTree = document.getElementById('resultsTree');
switch ( command )
{
case "cmd_selectAll":
if ( resultsTree )
{
dump("select all now!!!!!!" + "\n");
resultsTree.selectAll();
}
break;
case "cmd_delete":
if ( resultsTree )
{
var cardList = resultsTree.selectedItems;
top.addressbook.DeleteCards(resultsTree, resultsTree, cardList);
}
break;
}
}
};
// Controller object for Dir Pane
var DirPaneController =
{
IsCommandEnabled: function(command)
{
dump('DirPaneController::IsCommandEnabled(' + command + ')\n');
switch ( command )
{
case "cmd_selectAll":
return true;
case "cmd_delete":
var dirTree = document.getElementById('dirTree');
if ( dirTree && dirTree.selectedItems )
return true;
else
return false;
default:
return false;
}
},
DoCommand: function(command)
{
var dirTree = document.getElementById('dirTree');
switch ( command )
{
case "cmd_selectAll":
if ( dirTree )
{
dump("select all now!!!!!!" + "\n");
dirTree.selectAll();
}
break;
case "cmd_delete":
if ( dirTree )
top.addressbook.DeleteAddressBooks(dirTree.database, dirTree, dirTree.selectedItems);
break;
}
}
};
function SetupCommandUpdateHandlers()
{
var widget;
// dir pane
widget = document.getElementById('dirTree');
if ( widget )
widget.controller = DirPaneController;
// results pane
widget = document.getElementById('resultsTree');
if ( widget )
widget.controller = ResultsPaneController;
}
function AbNewCard()
{
var selectedAB = 0;
var tree = document.getElementById('dirTree');
if ( tree && tree.selectedItems && (tree.selectedItems.length == 1) )
selectedAB = tree.selectedItems[0].getAttribute('id');
goNewCardDialog(selectedAB);
}
function AbEditCard()
{
var rdf = Components.classes["component://netscape/rdf/rdf-service"].getService();
rdf = rdf.QueryInterface(Components.interfaces.nsIRDFService);
var resultsTree = document.getElementById('resultsTree');
if ( resultsTree.selectedItems && resultsTree.selectedItems.length == 1 )
{
var uri = resultsTree.selectedItems[0].getAttribute('id');
var card = rdf.GetResource(uri);
card = card.QueryInterface(Components.interfaces.nsIAbCard);
goEditCardDialog(document.getElementById('resultsTree').getAttribute('ref'),
card, top.editCardCallback);
}
}
function AbNewMessage()
{
var msgComposeService = Components.classes["component://netscape/messengercompose"].getService();
msgComposeService = msgComposeService.QueryInterface(Components.interfaces.nsIMsgComposeService);
msgComposeService.OpenComposeWindowWithValues(null, 0, GetSelectedAddresses(), null, null,
null, null, null);
}
function GetSelectedAddresses()
{
var item, uri, rdf, cardResource, card;
var selectedAddresses = "";
var resultsTree = document.getElementById('resultsTree');
rdf = Components.classes["component://netscape/rdf/rdf-service"].getService();
rdf = rdf.QueryInterface(Components.interfaces.nsIRDFService);
if ( resultsTree.selectedItems && resultsTree.selectedItems.length )
{
for ( item = 0; item < resultsTree.selectedItems.length; item++ )
{
uri = resultsTree.selectedItems[item].getAttribute('id');
cardResource = rdf.GetResource(uri);
card = cardResource.QueryInterface(Components.interfaces.nsIAbCard);
if ( selectedAddresses )
selectedAddresses += ",";
selectedAddresses += "\"" + card.DisplayName + "\" <" + card.PrimaryEmail + ">";
}
}
dump("selectedAddresses = " + selectedAddresses + "\n");
return selectedAddresses;
}
function SelectFirstAddressBook()
{
var tree = document.getElementById('dirTree');
var body = document.getElementById('dirTreeBody');
if ( tree && body )
{
var treeitems = body.getElementsByTagName('treeitem');
if ( treeitems && treeitems.length > 0 )
{
tree.selectItem(treeitems[0]);
ChangeDirectoryByDOMNode(treeitems[0]);
}
}
}
function DirPaneSelectionChange()
{
// FIX ME - deselect the items in the results pane to work around tree bug
var resultsTree = document.getElementById('resultsTree');
if ( resultsTree )
resultsTree.clearItemSelection();
// ----
var tree = document.getElementById('dirTree');
if ( tree && tree.selectedItems && (tree.selectedItems.length == 1) )
ChangeDirectoryByDOMNode(tree.selectedItems[0]);
else
{
var tree = document.getElementById('resultsTree');
if ( tree )
tree.setAttribute('ref', null);
}
}
function ChangeDirectoryByDOMNode(dirNode)
{
var uri = dirNode.getAttribute('id');
dump("uri = " + uri + "\n");
var tree = document.getElementById('resultsTree');
if ( tree )
tree.setAttribute('ref', uri);
}
function ResultsPaneSelectionChange()
{
// FIX ME! - Should use some js var to determine abmain vs selectaddress dialog
// not in ab window if no parent.parent.rdf
if ( parent.parent.rdf )
{
var tree = document.getElementById('resultsTree');
if ( tree && tree.selectedItems && (tree.selectedItems.length == 1) )
DisplayCardViewPane(tree.selectedItems[0]);
else
ClearCardViewPane();
}
}
function SortResultPane(column, sortKey)
{
var node = document.getElementById(column);
if(!node) return(false);
var isupports = Components.classes["component://netscape/rdf/xul-sort-service"].getService();
if (!isupports) return(false);
var xulSortService = isupports.QueryInterface(Components.interfaces.nsIXULSortService);
if (!xulSortService) return(false);
// sort!!!
sortDirection = "ascending";
var currentDirection = node.getAttribute('sortDirection');
if (currentDirection == "ascending")
sortDirection = "descending";
else if (currentDirection == "descending")
sortDirection = "ascending";
else sortDirection = "ascending";
xulSortService.Sort(node, sortKey, sortDirection);
return(true);
}

View File

@@ -0,0 +1,64 @@
<?xml version="1.0"?>
<!--
The contents of this file are subject to the Netscape Public
License Version 1.1 (the "License"); you may not use this file
except in compliance with the License. You may obtain a copy of
the License at http://www.mozilla.org/NPL/
Software distributed under the License is distributed on an "AS
IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
implied. See the License for the specific language governing
rights and limitations under the License.
The Original Code is Mozilla Communicator client code, released
March 31, 1998.
The Initial Developer of the Original Code is Netscape
Communications Corporation. Portions created by Netscape are
Copyright (C) 1998-1999 Netscape Communications Corporation. All
Rights Reserved.
-->
<!DOCTYPE window SYSTEM "chrome://addressbook/locale/abDirTreeOverlay.dtd">
<overlay xmlns:html="http://www.w3.org/TR/REC-html40"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
<!-- FIX ME - remove document.commandDispatcher.updateCommands() when tree selection calls this automatically -->
<tree id="dirTree"
class="abDirectory"
style="width:100%; height:100%"
ref="abdirectory://"
open="true"
datasources="rdf:addressdirectory"
onselect="DirPaneSelectionChange(); document.commandDispatcher.updateCommands('select');">
<template>
<rule>
<treechildren>
<treeitem uri="...">
<treerow >
<treecell indent="true" value="rdf:http://home.netscape.com/NC-rdf#DirName"/>
</treerow>
</treeitem>
</treechildren>
</rule>
</template>
<treecol rdf:resource="http://home.netscape.com/NC-rdf#DirName"/>
<treehead>
<treerow>
<treecell>&directoryColumn.label;</treecell>
</treerow>
</treehead>
<treechildren id="dirTreeBody"
rdf:containment="http://home.netscape.com/NC-rdf#child"
rdf:ignore="http://home.netscape.com/NC-rdf#CardChild">
</treechildren>
</tree>
</overlay>

View File

@@ -0,0 +1,39 @@
<?xml version="1.0"?>
<!--
The contents of this file are subject to the Netscape Public
License Version 1.1 (the "License"); you may not use this file
except in compliance with the License. You may obtain a copy of
the License at http://www.mozilla.org/NPL/
Software distributed under the License is distributed on an "AS
IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
implied. See the License for the specific language governing
rights and limitations under the License.
The Original Code is Mozilla Communicator client code, released
March 31, 1998.
The Initial Developer of the Original Code is Netscape
Communications Corporation. Portions created by Netscape are
Copyright (C) 1998-1999 Netscape Communications Corporation. All
Rights Reserved.
-->
<?xml-stylesheet href="chrome://addressbook/skin/" type="text/css"?>
<?xul-overlay href="chrome://global/content/dialogOverlay.xul"?>
<?xul-overlay href="chrome://addressbook/content/abCardOverlay.xul"?>
<window xmlns:html="http://www.w3.org/TR/REC-html40"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
onload="OnLoadEditCard()"
class="dialog"
align="vertical">
<keyset id="keyset"/>
<box id="editcard"/>
<box id="okCancelButtons"/>
</window>

View File

@@ -0,0 +1,63 @@
<?xml version="1.0"?>
<!--
The contents of this file are subject to the Netscape Public
License Version 1.1 (the "License"); you may not use this file
except in compliance with the License. You may obtain a copy of
the License at http://www.mozilla.org/NPL/
Software distributed under the License is distributed on an "AS
IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
implied. See the License for the specific language governing
rights and limitations under the License.
The Original Code is Mozilla Communicator client code, released
March 31, 1998.
The Initial Developer of the Original Code is Netscape
Communications Corporation. Portions created by Netscape are
Copyright (C) 1998-1999 Netscape Communications Corporation. All
Rights Reserved.
-->
<?xml-stylesheet href="chrome://addressbook/skin/" type="text/css"?>
<?xul-overlay href="chrome://global/content/dialogOverlay.xul"?>
<?xul-overlay href="chrome://addressbook/content/abCardOverlay.xul"?>
<!DOCTYPE window SYSTEM "chrome://addressbook/locale/abNewCardDialog.dtd">
<window xmlns:html="http://www.w3.org/TR/REC-html40"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
title="&editcardWindow.title;"
onload="OnLoadNewCard()"
class="dialog"
align="vertical">
<!--html:script language="JavaScript" src="resource:/res/samples/DumpDOM.js"/-->
<keyset id="keyset"/>
<box align="horizontal">
<html:label for="abPopup">&chooseAddressBook.label;</html:label>
<html:select id="abPopup" ref="abdirectory://" datasources="rdf:addressdirectory">
<template>
<html:option uri="..." value="rdf:http://home.netscape.com/NC-rdf#DirUri">
<text value="rdf:http://home.netscape.com/NC-rdf#DirName"/>
</html:option>
</template>
</html:select>
</box>
<!--box align="horizontal">
<html:label for="chooseAddressBook">&chooseAddressBook.label;</html:label>
<html:select id="chooseAddressBook">
</html:select>
</box-->
<spring style="height:1em"/>
<box id="editcard"/>
<box id="okCancelButtons"/>
</window>

View File

@@ -0,0 +1,66 @@
<?xml version="1.0"?>
<!--
The contents of this file are subject to the Netscape Public
License Version 1.1 (the "License"); you may not use this file
except in compliance with the License. You may obtain a copy of
the License at http://www.mozilla.org/NPL/
Software distributed under the License is distributed on an "AS
IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
implied. See the License for the specific language governing
rights and limitations under the License.
The Original Code is Mozilla Communicator client code, released
March 31, 1998.
The Initial Developer of the Original Code is Netscape
Communications Corporation. Portions created by Netscape are
Copyright (C) 1998-1999 Netscape Communications Corporation. All
Rights Reserved.
-->
<!DOCTYPE window SYSTEM "chrome://addressbook/locale/abResultsTreeOverlay.dtd">
<overlay xmlns:html="http://www.w3.org/TR/REC-html40"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
<!-- FIX ME - remove document.commandDispatcher.updateCommands() when tree selection calls this automatically -->
<tree id="resultsTree"
class="abResults"
style="width:100%; height:100%"
datasources="rdf:addressdirectory rdf:addresscard"
onselect="top.ResultsPaneSelectionChange(); document.commandDispatcher.updateCommands('select');"
ondblclick="top.AbEditCard()"
containment="http://home.netscape.com/NC-rdf#CardChild">
<template>
<rule>
<treechildren>
<treeitem uri="...">
<treerow >
<treecell indent="true" value="rdf:http://home.netscape.com/NC-rdf#DisplayName"/>
<treecell value="rdf:http://home.netscape.com/NC-rdf#PrimaryEmail"/>
<treecell value="rdf:http://home.netscape.com/NC-rdf#WorkPhone"/>
</treerow>
</treeitem>
</treechildren>
</rule>
</template>
<treecol style="width:20%" id="NameColumn" rdf:resource="http://home.netscape.com/NC-rdf#DisplayName"/>
<treecol style="width:21%" id="EmailColumn" rdf:resource="http://home.netscape.com/NC-rdf#PrimaryEmail"/>
<treecol style="width:20%" id="WorkPhoneColumn" rdf:resource="http://home.netscape.com/NC-rdf#WorkPhone"/>
<treehead>
<treerow>
<treecell onclick="return top.SortResultPane('NameColumn', 'http://home.netscape.com/NC-rdf#DisplayName');">&nameColumn.label;</treecell>
<treecell onclick="return top.SortResultPane('EmailColumn', 'http://home.netscape.com/NC-rdf#PrimaryEmail');">&emailColumn.label;</treecell>
<treecell onclick="return top.SortResultPane('WorkPhoneColumn', 'http://home.netscape.com/NC-rdf#WorkPhone');">&phoneColumn.label;</treecell>
</treerow>
</treehead>
</tree>
</overlay>

View File

@@ -0,0 +1,183 @@
var addressbook = 0;
var composeWindow = 0;
var msgCompFields = 0;
var editCardCallback = 0;
// localization strings
var prefixTo = "To: ";
var prefixCc = "Cc: ";
var prefixBcc = "Bcc: ";
function OnLoadSelectAddress()
{
var toAddress="", ccAddress="", bccAddress="";
doSetOKCancel(SelectAddressOKButton, 0);
top.addressbook = Components.classes["component://netscape/addressbook"].createInstance();
top.addressbook = top.addressbook.QueryInterface(Components.interfaces.nsIAddressBook);
// look in arguments[0] for parameters
if (window.arguments && window.arguments[0])
{
// keep parameters in global for later
if ( window.arguments[0].composeWindow )
top.composeWindow = window.arguments[0].composeWindow;
if ( window.arguments[0].msgCompFields )
top.msgCompFields = window.arguments[0].msgCompFields;
if ( window.arguments[0].toAddress )
toAddress = window.arguments[0].toAddress;
if ( window.arguments[0].ccAddress )
ccAddress = window.arguments[0].ccAddress;
if ( window.arguments[0].bccAddress )
bccAddress = window.arguments[0].bccAddress;
dump("onload top.composeWindow: " + top.composeWindow + "\n");
dump("onload toAddress: " + toAddress + "\n");
// put the addresses into the bucket
AddAddressFromComposeWindow(toAddress, prefixTo);
AddAddressFromComposeWindow(ccAddress, prefixCc);
AddAddressFromComposeWindow(bccAddress, prefixBcc);
}
SelectFirstAddressBook();
}
function AddAddressFromComposeWindow(addresses, prefix)
{
if ( addresses )
{
var addressArray = addresses.split(",");
for ( var index = 0; index < addressArray.length; index++ )
{
// remove leading spaces
while ( addressArray[index][0] == " " )
addressArray[index] = addressArray[index].substring(1, addressArray[index].length);
AddAddressIntoBucket(prefix + addressArray[index]);
}
}
}
function SelectAddressOKButton()
{
var body = document.getElementById('bucketBody');
var item, row, cell, text, colon;
var toAddress="", ccAddress="", bccAddress="";
for ( var index = 0; index < body.childNodes.length; index++ )
{
item = body.childNodes[index];
if ( item.childNodes && item.childNodes.length )
{
row = item.childNodes[0];
if ( row.childNodes && row.childNodes.length )
{
cell = row.childNodes[0];
if ( cell.childNodes && cell.childNodes.length )
{
text = cell.childNodes[0];
if ( text && text.data && text.data.length )
{
switch ( text.data[0] )
{
case prefixTo[0]:
if ( toAddress )
toAddress += ", ";
toAddress += text.data.substring(prefixTo.length, text.data.length);
break;
case prefixCc[0]:
if ( ccAddress )
ccAddress += ", ";
ccAddress += text.data.substring(prefixCc.length, text.data.length);
break;
case prefixBcc[0]:
if ( bccAddress )
bccAddress += ", ";
bccAddress += text.data.substring(prefixBcc.length, text.data.length);
break;
}
}
}
}
}
}
// reset the UI in compose window
msgCompFields.SetTo(toAddress);
msgCompFields.SetCc(ccAddress);
msgCompFields.SetBcc(bccAddress);
top.composeWindow.CompFields2Recipients(top.msgCompFields);
return true;
}
function SelectAddressToButton()
{
AddSelectedAddressesIntoBucket(prefixTo);
}
function SelectAddressCcButton()
{
AddSelectedAddressesIntoBucket(prefixCc);
}
function SelectAddressBccButton()
{
AddSelectedAddressesIntoBucket(prefixBcc);
}
function AddSelectedAddressesIntoBucket(prefix)
{
var item, uri, rdf, cardResource, card, address;
rdf = Components.classes["component://netscape/rdf/rdf-service"].getService();
rdf = rdf.QueryInterface(Components.interfaces.nsIRDFService);
var resultsTree = document.getElementById('resultsTree');
if ( resultsTree && resultsTree.selectedItems && resultsTree.selectedItems.length )
{
for ( item = 0; item < resultsTree.selectedItems.length; item++ )
{
uri = resultsTree.selectedItems[item].getAttribute('id');
cardResource = rdf.GetResource(uri);
card = cardResource.QueryInterface(Components.interfaces.nsIAbCard);
address = prefix + "\"" + card.DisplayName + "\" <" + card.PrimaryEmail + ">";
AddAddressIntoBucket(address);
}
}
}
function AddAddressIntoBucket(address)
{
var body = document.getElementById("bucketBody");
var item = document.createElement('treeitem');
var row = document.createElement('treerow');
var cell = document.createElement('treecell');
var text = document.createTextNode(address);
cell.appendChild(text);
row.appendChild(cell);
item.appendChild(row);
body.appendChild(item);
}
function RemoveSelectedFromBucket()
{
var bucketTree = document.getElementById("addressBucket");
if ( bucketTree )
{
var body = document.getElementById("bucketBody");
if ( body && bucketTree.selectedItems && bucketTree.selectedItems.length )
{
for ( var item = bucketTree.selectedItems.length - 1; item >= 0; item-- )
body.removeChild(bucketTree.selectedItems[item]);
}
}
}

View File

@@ -0,0 +1,141 @@
<?xml version="1.0"?>
<!--
The contents of this file are subject to the Netscape Public
License Version 1.1 (the "License"); you may not use this file
except in compliance with the License. You may obtain a copy of
the License at http://www.mozilla.org/NPL/
Software distributed under the License is distributed on an "AS
IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
implied. See the License for the specific language governing
rights and limitations under the License.
The Original Code is Mozilla Communicator client code, released
March 31, 1998.
The Initial Developer of the Original Code is Netscape
Communications Corporation. Portions created by Netscape are
Copyright (C) 1998-1999 Netscape Communications Corporation. All
Rights Reserved.
-->
<?xml-stylesheet href="chrome://addressbook/skin/" type="text/css"?>
<?xul-overlay href="chrome://global/content/dialogOverlay.xul"?>
<?xul-overlay href="chrome://addressbook/content/abDirTreeOverlay.xul"?>
<?xul-overlay href="chrome://addressbook/content/abResultsTreeOverlay.xul"?>
<!DOCTYPE window SYSTEM "chrome://addressbook/locale/abSelectAddressesDialog.dtd">
<window xmlns:html="http://www.w3.org/TR/REC-html40"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
title="&selectAddressWindow.title;"
class="dialog"
width="640" height="480"
style="width:100%; height:100%; padding:0px"
onload="OnLoadSelectAddress()"
align="vertical">
<html:script language="JavaScript" src="chrome://addressbook/content/abCommon.js"/>
<html:script language="JavaScript" src="chrome://addressbook/content/abSelectAddressesDialog.js"/>
<html:script language="JavaScript" src="chrome://messengercompose/content/MsgComposeCommands.js"/>
<html:script language="JavaScript" src="chrome://global/content/globalOverlay.js"/>
<!--html:script language="JavaScript" src="resource:/res/samples/DumpDOM.js"/-->
<keyset id="keyset"/>
<!-- Thin box across top, show names containing & stop, search buttons -->
<box align="horizontal" style="width:100%; padding:0px; padding-top:2px; padding-bottom:2px">
<html:div flex="100%" style="vertical-align: middle;">
<html:label for="searchtext" tabindex="0">&search.label;</html:label>
<html:input type="text" id="searchtext" flex="100%"/>
</html:div>
<spring style="width: 1em;"/>
<titledbutton id="stop" value="&stopButton.label;" class="push" onclick="SelectAddressStopButton()"/>
<spring style="width:5px"/>
<titledbutton id="search" value="&searchButton.label;" class="push" onclick="SelectAddressSearchButton()"/>
</box>
<!-- Main box, 3 pane and majority of buttons -->
<box align="horizontal" flex="100%">
<!-- 3 Pane box -->
<box align="horizontal" flex="100%" style="border-top:solid black 1px; border-bottom:solid black 1px">
<!-- dir tree -->
<box align="horizontal"
style="width:200px; height:100%; background-color:white; border-right:solid black 1px">
<!-- FIX ME - div is hack to make tree scroll properly -->
<html:div style="width:100px;height:100px" flex="1">
<tree id="dirTree"/>
</html:div>
</box>
<splitter collapse="before"/>
<!-- Box that holds results pane, (to,cc,bcc buttons), and address bucket -->
<box align="vertical" flex="100%" style="border-left:solid black 1px; border-right:solid black 1px">
<!-- Box that holds results pane and (to,cc,bcc buttons) -->
<box align="vertical" flex="100%">
<!-- results tree -->
<box flex="100%" align="vertical"
style="background-color:white; border-bottom:solid black 1px">
<!-- FIX ME - div is hack to make tree scroll properly -->
<html:div style="width:100px;height:100px" flex="1">
<tree id="resultsTree"/>
</html:div>
</box>
<!-- Box that holds (to,cc,bcc buttons) -->
<box align="horizontal" style="padding:0.3em; border-bottom:solid black 1px">
<spring flex="50%"/>
<titledbutton id="toButton" value="&toButton.label;" class="push" onclick="SelectAddressToButton()"/>
<spring style="width:10px"/>
<titledbutton id="ccButton" value="&ccButton.label;" class="push" onclick="SelectAddressCcButton()"/>
<spring style="width:10px"/>
<titledbutton id="bccButton" value="&bccButton.label;" class="push" onclick="SelectAddressBccButton()"/>
<spring flex="50%"/>
</box>
</box>
<splitter collapse="after"/>
<!-- Address bucket -->
<box align="vertical" style="height:170px; background-color:white; border-top:solid black 1px">
<html:div style="width:100px;height:100px" flex="1">
<tree id="addressBucket" style="width:100%; height:100%">
<treecol style="width:100%"/>
<treechildren id="bucketBody"/>
</tree>
</html:div>
</box>
</box>
</box>
<!-- Box with buttons on right edge of window -->
<box align="vertical" style="padding: .5em; padding-right: 0px">
<box align="vertical" flex="50%">
<spring style="height:10px"/>
<titledbutton id="new" value="&newButton.label;" class="push" onclick="AbNewCard()"/>
<spring style="height:10px"/>
<titledbutton id="edit" value="&editButton.label;" class="push" onclick="AbEditCard()"/>
<spring style="height:10px"/>
<titledbutton id="view" value="&viewButton.label;" class="push" onclick="SelectAddressViewButton()"/>
<spring flex="100%"/>
</box>
<box align="vertical" flex="50%">
<spring flex="50%"/>
<titledbutton id="remove" value="&removeButton.label;" class="push" onclick="RemoveSelectedFromBucket()"/>
<spring flex="50%"/>
</box>
</box>
</box>
<!-- OK & Cancel buttons -->
<box id="okCancelButtons"/>
</window>

View File

@@ -0,0 +1,183 @@
var addressbook = 0;
var editCardCallback = 0;
// functions used only by addressbook
function OnLoadAddressBook()
{
// FIX ME - later we will be able to use onload from the overlay
OnLoadCardView();
top.addressbook = Components.classes["component://netscape/addressbook"].createInstance();
top.addressbook = top.addressbook.QueryInterface(Components.interfaces.nsIAddressBook);
top.editCardCallback = UpdateCardView;
try {
top.addressbook.SetWebShellWindow(window)
}
catch (ex) {
dump("failed to set webshell window\n");
}
SetupCommandUpdateHandlers();
SelectFirstAddressBook();
}
function CommandUpdate_AddressBook()
{
dump("CommandUpdate_AddressBook\n");
// get selection info from dir pane
var tree = document.getElementById('dirTree');
var oneAddressBookSelected = false;
if ( tree && tree.selectedItems && (tree.selectedItems.length == 1) )
oneAddressBookSelected = true;
dump("oneAddressBookSelected = " + oneAddressBookSelected + "\n");
// get selection info from results pane
var selectedCards = GetSelectedAddresses();
var oneOrMoreCardsSelected = false;
if ( selectedCards )
oneOrMoreCardsSelected = true;
// set commands to enabled / disabled
goSetCommandEnabled('cmd_PrintCard', oneOrMoreCardsSelected);
goSetCommandEnabled('cmd_SortByName', oneAddressBookSelected);
goSetCommandEnabled('cmd_SortByEmail', oneAddressBookSelected);
goSetCommandEnabled('cmd_SortByPhone', oneAddressBookSelected);
AbUpdateCommandDelete();
}
// This function updates the text of the delete menu item and sets the state of the delete button
function AbUpdateCommandDelete()
{
var command = "cmd_delete";
var focusedElement = document.commandDispatcher.focusedElement;
var id = 0;
if ( focusedElement )
id = focusedElement.getAttribute('id');
dump("focusedOn = " + id + "\n");
switch ( id )
{
case "dirTree":
// menu text
goSetMenuValue(command, 'valueAddressBook');
// delete button
var dirTree = document.getElementById('dirTree');
var numSelected = 0;
if ( dirTree && dirTree.selectedItems )
numSelected = dirTree.selectedItems.length;
goSetCommandEnabled('button_delete', (numSelected>0));
break;
case "resultsTree":
// menu text
var resultsTree = document.getElementById('resultsTree');
var numSelected = 0;
if ( resultsTree && resultsTree.selectedItems )
numSelected = resultsTree.selectedItems.length;
if ( numSelected < 2 )
goSetMenuValue(command, 'valueCard');
else
goSetMenuValue(command, 'valueCards');
// delete button
goSetCommandEnabled('button_delete', (numSelected>0));
break;
default:
goSetMenuValue(command, 'valueDefault');
goSetCommandEnabled('button_delete', false);
break;
}
}
function UpdateCardView()
{
var tree = document.getElementById('resultsTree');
if ( tree && tree.selectedItems && (tree.selectedItems.length == 1) )
DisplayCardViewPane(tree.selectedItems[0]);
}
function AbClose()
{
top.window.close();
}
function AbNewAddressBook()
{
var dialog = window.openDialog("chrome://addressbook/content/abAddressBookNameDialog.xul",
"",
"chrome",
{title:"New Address Book",
okCallback:AbCreateNewAddressBook});
}
function AbCreateNewAddressBook(name)
{
top.addressbook.NewAddressBook(document.getElementById('dirTree').database, document.getElementById('resultsTree'), name);
}
function AbPrintCard()
{
dump("print card\n");
try {
addressbook.PrintCard();
}
catch (ex) {
dump("failed to print card\n");
}
}
function AbPrintAddressBook()
{
dump("print address book \n");
try {
addressbook.PrintAddressbook();
}
catch (ex) {
dump("failed to print address book\n");
}
}
function AbImport()
{
addressbook.ImportAddressBook();
}
/*
function AbDelete()
{
// dump("\AbDelete from XUL\n");
var tree = document.getElementById('resultsTree');
if ( tree )
{
//get the selected elements
var cardList = tree.selectedItems;
//get the current folder
var srcDirectory = document.getElementById('resultsTree');
dump("srcDirectory = " + srcDirectory + "\n");
top.addressbook.DeleteCards(tree, srcDirectory, cardList);
}
}
*/
/*
function AbDeleteDirectory()
{
// dump("\AbDeleteDirectory from XUL\n");
var tree = document.getElementById('dirTree');
// if ( tree && tree.selectedItems && tree.selectedItems.length )
if ( tree )
top.addressbook.DeleteAddressBooks(tree.database, tree, tree.selectedItems);
}
*/

View File

@@ -0,0 +1,247 @@
<?xml version="1.0"?>
<!--
The contents of this file are subject to the Netscape Public
License Version 1.1 (the "License"); you may not use this file
except in compliance with the License. You may obtain a copy of
the License at http://www.mozilla.org/NPL/
Software distributed under the License is distributed on an "AS
IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
implied. See the License for the specific language governing
rights and limitations under the License.
The Original Code is Mozilla Communicator client code, released
March 31, 1998.
The Initial Developer of the Original Code is Netscape
Communications Corporation. Portions created by Netscape are
Copyright (C) 1998-1999 Netscape Communications Corporation. All
Rights Reserved.
-->
<?xml-stylesheet href="chrome://addressbook/skin/" type="text/css"?>
<?xul-overlay href="chrome://global/content/globalOverlay.xul"?>
<?xul-overlay href="chrome://global/content/tasksOverlay.xul"?>
<?xul-overlay href="chrome://addressbook/content/abDirTreeOverlay.xul"?>
<?xul-overlay href="chrome://addressbook/content/abResultsTreeOverlay.xul"?>
<?xul-overlay href="chrome://addressbook/content/abCardViewOverlay.xul"?>
<!DOCTYPE window SYSTEM "chrome://addressbook/locale/abMainWindow.dtd">
<window xmlns:html="http://www.w3.org/TR/REC-html40"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
height="420"
width="600"
align="vertical"
title="&addressbookWindow.title;"
windowtype="mail:addressbook"
onload="OnLoadAddressBook()">
<html:script language="JavaScript" src="chrome://addressbook/content/addressbook.js"/>
<html:script language="JavaScript" src="chrome://addressbook/content/abCommon.js"/>
<!--html:script language="JavaScript" src="resource:/res/samples/DumpDOM.js"/-->
<commands id="commands">
<commandset id="CommandUpdate_AddressBook"
commandupdater="true"
events="focus,blur,select"
oncommandupdate="CommandUpdate_AddressBook()"/>
<commandset id="globalEditMenuItems"/>
</commands>
<broadcasterset id="broadcasterset">
<!-- File Menu -->
<broadcaster id="cmd_newNavigator"/>
<broadcaster id="cmd_newMessage"/>
<broadcaster id="cmd_PrintCard" oncommand="AbPrintCard()" disabled="true"/>
<broadcaster id="cmd_close" oncommand="AbClose()"/>
<broadcaster id="cmd_quit"/>
<!-- Edit Menu -->
<broadcaster id="cmd_undo"/>
<broadcaster id="cmd_redo"/>
<broadcaster id="cmd_cut"/>
<broadcaster id="cmd_copy"/>
<broadcaster id="cmd_paste"/>
<broadcaster id="cmd_delete"
valueAddressBook="&deleteAbCmd.label;"
valueCard="&deleteCardCmd.label;"
valueCards="&deleteCardsCmd.label;"/>
<broadcaster id='cmd_selectAll'/>
<broadcaster id="cmd_preferences"/>
</broadcasterset>
<keyset id="keyset">
<!-- File Menu -->
<key id="key_newNavigator"/>
<key id="key_newMessage"/>
<key id="key_PrintCard" command="true" key="&printCardViewCmd.key;" observes="cmd_PrintCard" />
<key id="key_close"/>
<key id="key_quit"/>
<!-- Edit Menu -->
<key id="key_undo"/>
<key id="key_redo"/>
<key id="key_cut"/>
<key id="key_copy"/>
<key id="key_paste"/>
<key id="key_delete"/>
<key id="key_selectAll"/>
<key id="key_preferences"/>
</keyset>
<toolbox>
<menubar>
<menu id="menu_File">
<menupopup id="menu_FilePopup">
<menuitem value="&newCard.label;" accesskey="&newCard.accesskey;" oncommand="AbNewCard()"/>
<menu id="menu_New">
<menupopup>
<menuitem value="&newListCmd.label;" accesskey="&newListCmd.accesskey;" oncommand="AbNewList()"/>
<menuitem value="&newAddressBookCmd.label;" accesskey="&newAddressBookCmd.accesskey;" oncommand="AbNewAddressBook()"/>
<menuitem value="&newDirectoryCmd.label;" accesskey="&newDirectoryCmd.accesskey;" oncommand="AbNewDirectoryt()"/>
<menuseparator/>
<menuitem id="menu_newNavigator"/>
<menuitem id="menu_newMessage"/>
<menuitem id="cmd_newCard"/>
</menupopup>
</menu>
<menuseparator/>
<menuitem id="menu_close"/>
<menuseparator/>
<menuitem value="&importCmd.label;" oncommand="AbImport()"/>
<menuitem value="&exportCmd.label;" oncommand="AbExport()"/>
<menuseparator/>
<menuitem id="menu_pageSetup"/>
<menuitem value="&printPreviewCmd.label;" oncommand="AbPrintPreview()"/>
<menuitem value="&printCardViewCmd.label;" key="key_PrintCard" observes="cmd_PrintCard"/>
<menuitem value="&printAddressBook.label;" oncommand="AbPrintAddressBook()"/>
<menuseparator/>
</menupopup>
</menu>
<menu id="menu_Edit">
<menupopup>
<menuitem id="menu_undo"/>
<menuitem id="menu_redo"/>
<menuseparator/>
<menuitem id="menu_cut"/>
<menuitem id="menu_copy"/>
<menuitem id="menu_paste"/>
<menuitem id="menu_delete"/>
<menuseparator/>
<menuitem id="menu_selectAll"/>
<menuseparator/>
<menuitem value="&editCardCmd.label;"
accesskey="&editCardCmd.accesskey;"
oncommand="AbEditCard();"/>
<menuitem value="&htmlDomainCmd.label;"
accesskey="&htmlDomainCmd.accesskey;"
oncommand="AbHTMLDomain();"/>
<menuseparator/>
<menuitem id="menu_preferences" oncommand="goPreferences('addressbook.xul', 'chrome://addressbook/content/pref-addressing.xul')"/>
</menupopup>
</menu>
<menu id="menu_View">
<menupopup>
<menu id="menu_Toolbars">
<menupopup>
<menuitem id="menu_showAbToolbar"
value="&showAbToolbarCmd.label;"
accesskey="&showAbToolbarCmd.accesskey;"
oncommand="goToggleToolbar('abToolbar', 'menu_showAbToolbar')"
checked="true"/>
<menuitem id="menu_showTaskbar"/>
</menupopup>
</menu>
<menuitem value="&showCardPane.label;" oncommand="AbShowCardPane()"/>
<menu value="&sortMenu.label;">
<menupopup>
<menuitem value="&sortByNameCmd.label;"
id="cmd_SortByName"
disabled="true"
oncommand="top.SortResultPane('NameColumn', 'http://home.netscape.com/NC-rdf#DisplayName')"/>
<menuitem value="&sortByEmailCmd.label;"
id="cmd_SortByEmail"
disabled="true"
oncommand="top.SortResultPane('EmailColumn', 'http://home.netscape.com/NC-rdf#PrimaryEmail')"/>
<menuitem value="&sortByOrganizationCmd.label;" oncommand="AbSortByOrganization()"/>
<menuitem value="&sortByNicknameCmd.label;" oncommand="AbSortByNickname()"/>
<menuitem value="&sortByPhoneCmd.label;"
id="cmd_SortByPhone"
disabled="true"
oncommand="top.SortResultPane('WorkPhoneColumn', 'http://home.netscape.com/NC-rdf#WorkPhone')"/>
<menuitem value="&sortByCityCmd.label;" oncommand="AbSortByCity()"/>
<menuseparator/>
<menuitem value="&sortAscendingCmd.label;" oncommand="AbSortAscending()"/>
<menuitem value="&sortDescendingCmd.label;" oncommand="AbSortDescending()"/>
</menupopup>
</menu>
</menupopup>
</menu>
<menu id="tasksMenu"/>
<menu id="menu_Help"/>
<spring flex="100%"/>
</menubar>
<toolbar id="abToolbar" persist="collapsed">
<titledbutton src="&newcardButton.img;" align="top" value="&newcardButton.label;" onclick="AbNewCard()"/>
<titledbutton src="&newlistButton.img;" align="top" value="&newlistButton.label;" onclick="AbNewList()"/>
<titledbutton src="&editButton.img;" align="top" value="&editButton.label;" onclick="AbEditCard()"/>
<titledbutton src="&newmsgButton.img;" align="top" value="&newmsgButton.label;" onclick="AbNewMessage()"/>
<titledbutton id="button_delete" disabled="true" src="&deleteButton.img;" align="top" value="&deleteButton.label;" onclick="AbDelete()"/>
<html:div class="separator" align="vertical"/>
<box align="vertical">
<spring flex="100%"/>
<html:div style="padding-left:5px; padding-bottom:2px">&showNames.label;</html:div>
<html:input id="searchtext" type="text" align="bottom" style="min-width:100px; min-height:25px; padding-bottom:0px"/>
</box>
<titledbutton src="&stopButton.img;" align="top" value="&stopButton.label;" onclick="AbStop()"/>
<titledbutton src="&searchButton.img;" align="top" value="&searchButton.label;" onclick="AbSearch()"/>
<spring flex="100%"/>
<titledbutton id="Throbber" align="right" onclick="MsgHome('http://www.mozilla.org/')"/>
</toolbar>
</toolbox>
<!-- The main address book three pane -->
<box align="horizontal" flex="100%">
<!-- dir tree -->
<box align="horizontal"
style="width:200px; height:100%; background-color:white; border-right:solid black 1px">
<!-- FIX ME - div is hack to make tree scroll properly -->
<html:div style="width:100px;height:100px" flex="1">
<tree id="dirTree"/>
</html:div>
</box>
<splitter collapse="before"/>
<box align="vertical" flex="100%" style="border-left:solid black 1px">
<!-- results tree -->
<box flex="50%" align="vertical"
style="background-color:white; border-bottom:solid black 1px">
<!-- FIX ME - div is hack to make tree scroll properly -->
<html:div style="width:100px;height:100px" flex="1">
<tree id="resultsTree"/>
</html:div>
</box>
<splitter collapse="after"/>
<!-- card view -->
<box style="height:170px; border-top:solid black 1px">
<box id="CardViewBox"/>
</box>
</box>
</box>
<toolbox id="taskbox"/>
</window>

View File

@@ -0,0 +1,58 @@
#!nmake
#
# The contents of this file are subject to the Netscape Public License
# Version 1.0 (the "NPL"); you may not use this file except in
# compliance with the NPL. You may obtain a copy of the NPL at
# http://www.mozilla.org/NPL/
#
# Software distributed under the NPL is distributed on an "AS IS" basis,
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
# for the specific language governing rights and limitations under the
# NPL.
#
# The Initial Developer of this code under the NPL is Netscape
# Communications Corporation. Portions created by Netscape are
# Copyright (C) 1998 Netscape Communications Corporation. All Rights
# Reserved.
DEPTH=..\..\..\..
include <$(DEPTH)\config\rules.mak>
install::
$(MAKE_INSTALL) abAddressBookNameDialog.js $(DIST)\bin\chrome\addressbook\content\default
$(MAKE_INSTALL) abAddressBookNameDialog.xul $(DIST)\bin\chrome\addressbook\content\default
$(MAKE_INSTALL) abCardOverlay.js $(DIST)\bin\chrome\addressbook\content\default
$(MAKE_INSTALL) abCardOverlay.xul $(DIST)\bin\chrome\addressbook\content\default
$(MAKE_INSTALL) abCardViewOverlay.js $(DIST)\bin\chrome\addressbook\content\default
$(MAKE_INSTALL) abCardViewOverlay.xul $(DIST)\bin\chrome\addressbook\content\default
$(MAKE_INSTALL) abCommon.js $(DIST)\bin\chrome\addressbook\content\default
$(MAKE_INSTALL) abDirTreeOverlay.xul $(DIST)\bin\chrome\addressbook\content\default
$(MAKE_INSTALL) abEditCardDialog.xul $(DIST)\bin\chrome\addressbook\content\default
$(MAKE_INSTALL) abNewCardDialog.xul $(DIST)\bin\chrome\addressbook\content\default
$(MAKE_INSTALL) abResultsTreeOverlay.xul $(DIST)\bin\chrome\addressbook\content\default
$(MAKE_INSTALL) abSelectAddressesDialog.js $(DIST)\bin\chrome\addressbook\content\default
$(MAKE_INSTALL) abSelectAddressesDialog.xul $(DIST)\bin\chrome\addressbook\content\default
$(MAKE_INSTALL) addressbook.js $(DIST)\bin\chrome\addressbook\content\default
$(MAKE_INSTALL) addressbook.xul $(DIST)\bin\chrome\addressbook\content\default
clobber::
rm -f $(DIST)\chrome\addressbook\content\default\abAddressBookNameDialog.js
rm -f $(DIST)\chrome\addressbook\content\default\abAddressBookNameDialog.xul
rm -f $(DIST)\chrome\addressbook\content\default\abCardOverlay.js
rm -f $(DIST)\chrome\addressbook\content\default\abCardOverlay.xul
rm -f $(DIST)\chrome\addressbook\content\default\abCardViewOverlay.js
rm -f $(DIST)\chrome\addressbook\content\default\abCardViewOverlay.xul
rm -f $(DIST)\chrome\addressbook\content\default\abCommon.js
rm -f $(DIST)\chrome\addressbook\content\default\abDirTreeOverlay.xul
rm -f $(DIST)\chrome\addressbook\content\default\abEditCardDialog.xul
rm -f $(DIST)\chrome\addressbook\content\default\abNewCardDialog.xul
rm -f $(DIST)\chrome\addressbook\content\default\abResultsTreeOverlay.xul
rm -f $(DIST)\chrome\addressbook\content\default\abSelectAddressesDialog.js
rm -f $(DIST)\chrome\addressbook\content\default\abSelectAddressesDialog.xul
rm -f $(DIST)\chrome\addressbook\content\default\addressbook.js
rm -f $(DIST)\chrome\addressbook\content\default\addressbook.xul

View File

@@ -0,0 +1,28 @@
#
# The contents of this file are subject to the Netscape Public License
# Version 1.0 (the "NPL"); you may not use this file except in
# compliance with the NPL. You may obtain a copy of the NPL at
# http://www.mozilla.org/NPL/
#
# Software distributed under the NPL is distributed on an "AS IS" basis,
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
# for the specific language governing rights and limitations under the
# NPL.
#
# The Initial Developer of this code under the NPL is Netscape
# Communications Corporation. Portions created by Netscape are
# Copyright (C) 1998 Netscape Communications Corporation. All Rights
# Reserved.
#
DEPTH = ../../../..
topsrcdir = @top_srcdir@
srcdir = @srcdir@
VPATH = @srcdir@
include $(DEPTH)/config/autoconf.mk
DIRS = en-US
include $(topsrcdir)/config/rules.mk

View File

@@ -0,0 +1,8 @@
abAddressBookNameDialog.dtd
abCardOverlay.dtd
abCardViewOverlay.dtd
abDirTreeOverlay.dtd
abMainWindow.dtd
abNewCardDialog.dtd
abResultsTreeOverlay.dtd
abSelectAddressesDialog.dtd

View File

@@ -0,0 +1,40 @@
#
# The contents of this file are subject to the Netscape Public License
# Version 1.0 (the "NPL"); you may not use this file except in
# compliance with the NPL. You may obtain a copy of the NPL at
# http://www.mozilla.org/NPL/
#
# Software distributed under the NPL is distributed on an "AS IS" basis,
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
# for the specific language governing rights and limitations under the
# NPL.
#
# The Initial Developer of this code under the NPL is Netscape
# Communications Corporation. Portions created by Netscape are
# Copyright (C) 1998 Netscape Communications Corporation. All Rights
# Reserved.
#
DEPTH = ../../../../..
topsrcdir = @top_srcdir@
srcdir = @srcdir@
VPATH = @srcdir@
include $(DEPTH)/config/autoconf.mk
EXPORT_RESOURCE_CONTENT = \
$(srcdir)/abAddressBookNameDialog.dtd \
$(srcdir)/abCardOverlay.dtd \
$(srcdir)/abCardViewOverlay.dtd \
$(srcdir)/abDirTreeOverlay.dtd \
$(srcdir)/abMainWindow.dtd \
$(srcdir)/abNewCardDialog.dtd \
$(srcdir)/abResultsTreeOverlay.dtd \
$(srcdir)/abSelectAddressesDialog.dtd \
$(NULL)
include $(topsrcdir)/config/rules.mk
install::
$(INSTALL) $(EXPORT_RESOURCE_CONTENT) $(DIST)/bin/chrome/addressbook/locale/en-US

View File

@@ -0,0 +1,22 @@
<!--
The contents of this file are subject to the Netscape Public
License Version 1.1 (the "License"); you may not use this file
except in compliance with the License. You may obtain a copy of
the License at http://www.mozilla.org/NPL/
Software distributed under the License is distributed on an "AS
IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
implied. See the License for the specific language governing
rights and limitations under the License.
The Original Code is Mozilla Communicator client code, released
March 31, 1998.
The Initial Developer of the Original Code is Netscape
Communications Corporation. Portions created by Netscape are
Copyright (C) 1998-1999 Netscape Communications Corporation. All
Rights Reserved.
-->
<!-- Labels -->
<!ENTITY name.label "Address Book Name">

View File

@@ -0,0 +1,65 @@
<!--
The contents of this file are subject to the Netscape Public
License Version 1.1 (the "License"); you may not use this file
except in compliance with the License. You may obtain a copy of
the License at http://www.mozilla.org/NPL/
Software distributed under the License is distributed on an "AS
IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
implied. See the License for the specific language governing
rights and limitations under the License.
The Original Code is Mozilla Communicator client code, released
March 31, 1998.
The Initial Developer of the Original Code is Netscape
Communications Corporation. Portions created by Netscape are
Copyright (C) 1998-1999 Netscape Communications Corporation. All
Rights Reserved.
-->
<!-- Labels -->
<!ENTITY Name.tab "Name">
<!ENTITY Name.box "Name">
<!ENTITY FirstName.label "First:">
<!ENTITY LastName.label "Last:">
<!ENTITY DisplayName.label "Display:">
<!ENTITY NickName.label "Nickname:">
<!ENTITY Internet.box "Internet">
<!ENTITY PrimaryEmail.label "* Email:">
<!ENTITY SecondEmail.label "Additional Email:">
<!ENTITY SendPlainText.label "Send email as plain text (no html)">
<!ENTITY Phones.box "Phones">
<!ENTITY WorkPhone.label "Work:">
<!ENTITY HomePhone.label "Home:">
<!ENTITY FaxNumber.label "Fax:">
<!ENTITY PagerNumber.label "Pager:">
<!ENTITY CellularNumber.label "Cellular:">
<!ENTITY Address.tab "Address">
<!ENTITY Home.box "Home">
<!ENTITY HomeAddress.label "Address:">
<!ENTITY HomeAddress2.label "">
<!ENTITY HomeCity.label "City:">
<!ENTITY HomeState.label "State:">
<!ENTITY HomeZipCode.label "Zip:">
<!ENTITY HomeCountry.label "Country:">
<!ENTITY Work.box "Work">
<!ENTITY JobTitle.label "Title:">
<!ENTITY Department.label "Department:">
<!ENTITY Company.label "Organization:">
<!ENTITY WorkAddress.label "Address:">
<!ENTITY WorkAddress2.label "">
<!ENTITY WorkCity.label "City:">
<!ENTITY WorkState.label "State:">
<!ENTITY WorkZipCode.label "Zip:">
<!ENTITY WorkCountry.label "Country:">
<!--ENTITY Web.box "Web"-->
<!ENTITY WebPage1.label "Web Page:">
<!ENTITY Other.tab "Other">
<!ENTITY Custom1.label "Custom 1:">
<!ENTITY Custom2.label "Custom 2:">
<!ENTITY Custom3.label "Custom 3:">
<!ENTITY Custom4.label "Custom 4:">
<!ENTITY Notes.box "Notes">

View File

@@ -0,0 +1,25 @@
<!--
The contents of this file are subject to the Netscape Public
License Version 1.1 (the "License"); you may not use this file
except in compliance with the License. You may obtain a copy of
the License at http://www.mozilla.org/NPL/
Software distributed under the License is distributed on an "AS
IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
implied. See the License for the specific language governing
rights and limitations under the License.
The Original Code is Mozilla Communicator client code, released
March 31, 1998.
The Initial Developer of the Original Code is Netscape
Communications Corporation. Portions created by Netscape are
Copyright (C) 1998-1999 Netscape Communications Corporation. All
Rights Reserved.
-->
<!-- Box Headings -->
<!ENTITY home.heading "Home">
<!ENTITY other.heading "Other">
<!ENTITY phone.heading "Phone">
<!ENTITY work.heading "Work">

View File

@@ -0,0 +1,22 @@
<!--
The contents of this file are subject to the Netscape Public
License Version 1.1 (the "License"); you may not use this file
except in compliance with the License. You may obtain a copy of
the License at http://www.mozilla.org/NPL/
Software distributed under the License is distributed on an "AS
IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
implied. See the License for the specific language governing
rights and limitations under the License.
The Original Code is Mozilla Communicator client code, released
March 31, 1998.
The Initial Developer of the Original Code is Netscape
Communications Corporation. Portions created by Netscape are
Copyright (C) 1998-1999 Netscape Communications Corporation. All
Rights Reserved.
-->
<!-- Column Heading -->
<!ENTITY directoryColumn.label "Directory">

View File

@@ -0,0 +1,83 @@
<!--
The contents of this file are subject to the Netscape Public
License Version 1.1 (the "License"); you may not use this file
except in compliance with the License. You may obtain a copy of
the License at http://www.mozilla.org/NPL/
Software distributed under the License is distributed on an "AS
IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
implied. See the License for the specific language governing
rights and limitations under the License.
The Original Code is Mozilla Communicator client code, released
March 31, 1998.
The Initial Developer of the Original Code is Netscape
Communications Corporation. Portions created by Netscape are
Copyright (C) 1998-1999 Netscape Communications Corporation. All
Rights Reserved.
-->
<!-- Title -->
<!ENTITY addressbookWindow.title "Address Book">
<!-- Menus: the . means that the menu item isn't implemented yet -->
<!-- File Menu -->
<!ENTITY newCard.label "New Address Book Card">
<!ENTITY newCard.accesskey "n">
<!ENTITY newListCmd.label ".Mailing List">
<!ENTITY newListCmd.accesskey "l">
<!ENTITY newAddressBookCmd.label "Address Book">
<!ENTITY newAddressBookCmd.accesskey "b">
<!ENTITY newDirectoryCmd.label ".Directory">
<!ENTITY newDirectoryCmd.accesskey "d">
<!ENTITY importCmd.label "Import...">
<!ENTITY exportCmd.label ".Export...">
<!ENTITY printPreviewCmd.label ".Print Preview">
<!ENTITY printCardViewCmd.label ".Print Card View...">
<!ENTITY printCardViewCmd.key "P">
<!ENTITY printAddressBook.label ".Print Address Book...">
<!-- Edit Menu -->
<!ENTITY deleteAbCmd.label "Delete Address Book">
<!ENTITY deleteCardCmd.label "Delete Card">
<!ENTITY deleteCardsCmd.label "Delete Selected Cards">
<!ENTITY editCardCmd.label "Edit Card...">
<!ENTITY editCardCmd.accesskey "e">
<!ENTITY htmlDomainCmd.label ".HTML Domains...">
<!ENTITY htmlDomainCmd.accesskey "h">
<!-- View Menu -->
<!ENTITY showAbToolbarCmd.label "Show Address Book Toolbar">
<!ENTITY showAbToolbarCmd.accesskey "a">
<!ENTITY showCardPane.label ".Card Pane">
<!ENTITY sortMenu.label "Sort">
<!ENTITY sortByNameCmd.label "by Name">
<!ENTITY sortByEmailCmd.label "by Email">
<!ENTITY sortByOrganizationCmd.label ".by Organization">
<!ENTITY sortByNicknameCmd.label ".by Nickname">
<!ENTITY sortByPhoneCmd.label "by Phone Number">
<!ENTITY sortByCityCmd.label ".by City">
<!ENTITY sortAscendingCmd.label ".Ascending">
<!ENTITY sortDescendingCmd.label ".Descending">
<!ENTITY stopSearchingCmd.label ".Stop Searching">
<!-- Toolbar items -->
<!ENTITY newcardButton.img "chrome://addressbook/skin/newcard.gif">
<!ENTITY newcardButton.label "New Card">
<!ENTITY newlistButton.img "chrome://addressbook/skin/newlist.gif">
<!ENTITY newlistButton.label ".New List">
<!ENTITY editButton.img "chrome://addressbook/skin/property.gif">
<!ENTITY editButton.label "Edit">
<!ENTITY newmsgButton.img "chrome://addressbook/skin/abnewmsg.gif">
<!ENTITY newmsgButton.label "New Msg">
<!ENTITY deleteButton.img "chrome://messenger/skin/trash.gif">
<!ENTITY deleteButton.label "Delete">
<!ENTITY stopButton.img "resource:/res/toolbar/TB_Stop.gif">
<!ENTITY stopButton.label ".Stop">
<!ENTITY searchButton.img "resource:/res/toolbar/TB_Search.gif">
<!ENTITY searchButton.label ".Search">
<!ENTITY showNames.label "Show names containing:">
<!ENTITY throbber.img "resource:/res/throbber/anims00.gif">
<!ENTITY throbber.url "http://www.mozilla.org/">

View File

@@ -0,0 +1,24 @@
<!--
The contents of this file are subject to the Netscape Public
License Version 1.1 (the "License"); you may not use this file
except in compliance with the License. You may obtain a copy of
the License at http://www.mozilla.org/NPL/
Software distributed under the License is distributed on an "AS
IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
implied. See the License for the specific language governing
rights and limitations under the License.
The Original Code is Mozilla Communicator client code, released
March 31, 1998.
The Initial Developer of the Original Code is Netscape
Communications Corporation. Portions created by Netscape are
Copyright (C) 1998-1999 Netscape Communications Corporation. All
Rights Reserved.
-->
<!-- Title -->
<!ENTITY editcardWindow.title "New Card">
<!-- Labels -->
<!ENTITY chooseAddressBook.label "Add to: ">

View File

@@ -0,0 +1,25 @@
<!--
The contents of this file are subject to the Netscape Public
License Version 1.1 (the "License"); you may not use this file
except in compliance with the License. You may obtain a copy of
the License at http://www.mozilla.org/NPL/
Software distributed under the License is distributed on an "AS
IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
implied. See the License for the specific language governing
rights and limitations under the License.
The Original Code is Mozilla Communicator client code, released
March 31, 1998.
The Initial Developer of the Original Code is Netscape
Communications Corporation. Portions created by Netscape are
Copyright (C) 1998-1999 Netscape Communications Corporation. All
Rights Reserved.
-->
<!-- Column Headings -->
<!ENTITY nameColumn.label "Name">
<!ENTITY emailColumn.label "Email">
<!-- LOCALIZATION NOTE (phoneColumn.label): "#" means "number" -->
<!ENTITY phoneColumn.label "Phone#">

View File

@@ -0,0 +1,40 @@
<!--
The contents of this file are subject to the Netscape Public
License Version 1.1 (the "License"); you may not use this file
except in compliance with the License. You may obtain a copy of
the License at http://www.mozilla.org/NPL/
Software distributed under the License is distributed on an "AS
IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
implied. See the License for the specific language governing
rights and limitations under the License.
The Original Code is Mozilla Communicator client code, released
March 31, 1998.
The Initial Developer of the Original Code is Netscape
Communications Corporation. Portions created by Netscape are
Copyright (C) 1998-1999 Netscape Communications Corporation. All
Rights Reserved.
-->
<!-- Title -->
<!ENTITY selectAddressWindow.title "Select Addresses">
<!-- Buttons -->
<!ENTITY toButton.label "To:">
<!ENTITY ccButton.label "Cc:">
<!ENTITY bccButton.label "Bcc:">
<!ENTITY stopButton.label ".Stop">
<!ENTITY searchButton.label ".Search...">
<!ENTITY newButton.label "New...">
<!ENTITY editButton.label "Edit...">
<!ENTITY viewButton.label ".View">
<!ENTITY removeButton.label "Remove">
<!ENTITY okButton.label "OK">
<!ENTITY cancelButton.label "Cancel">
<!ENTITY helpButton.label ".Help">
<!-- Toolbar items -->
<!ENTITY search.label "Show names containing:">

View File

@@ -0,0 +1,43 @@
#!nmake
#
# The contents of this file are subject to the Netscape Public License
# Version 1.0 (the "NPL"); you may not use this file except in
# compliance with the NPL. You may obtain a copy of the NPL at
# http://www.mozilla.org/NPL/
#
# Software distributed under the NPL is distributed on an "AS IS" basis,
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
# for the specific language governing rights and limitations under the
# NPL.
#
# The Initial Developer of this code under the NPL is Netscape
# Communications Corporation. Portions created by Netscape are
# Copyright (C) 1998 Netscape Communications Corporation. All Rights
# Reserved.
DEPTH=..\..\..\..\..
include <$(DEPTH)\config\rules.mak>
DISTBROWSER=$(DIST)\bin\chrome\addressbook\locale\en-US
install::
$(MAKE_INSTALL) abAddressBookNameDialog.dtd $(DISTBROWSER)
$(MAKE_INSTALL) abCardOverlay.dtd $(DISTBROWSER)
$(MAKE_INSTALL) abCardViewOverlay.dtd $(DISTBROWSER)
$(MAKE_INSTALL) abDirTreeOverlay.dtd $(DISTBROWSER)
$(MAKE_INSTALL) abMainWindow.dtd $(DISTBROWSER)
$(MAKE_INSTALL) abNewCardDialog.dtd $(DISTBROWSER)
$(MAKE_INSTALL) abResultsTreeOverlay.dtd $(DISTBROWSER)
$(MAKE_INSTALL) abSelectAddressesDialog.dtd $(DISTBROWSER)
clobber::
rm -f $(DIST)\bin\chrome\addressbook\locale\en-US\abAddressBookNameDialog.dtd
rm -f $(DIST)\bin\chrome\addressbook\locale\en-US\abCardOverlay.dtd
rm -f $(DIST)\bin\chrome\addressbook\locale\en-US\abCardViewOverlay.dtd
rm -f $(DIST)\bin\chrome\addressbook\locale\en-US\abDirTreeOverlay.dtd
rm -f $(DIST)\bin\chrome\addressbook\locale\en-US\abMainWindow.dtd
rm -f $(DIST)\bin\chrome\addressbook\locale\en-US\abNewCardDialog.dtd
rm -f $(DIST)\bin\chrome\addressbook\locale\en-US\abResultsTreeOverlay.dtd
rm -f $(DIST)\bin\chrome\addressbook\locale\en-US\abSelectAddressesDialog.dtd

View File

@@ -0,0 +1,22 @@
#!nmake
#
# The contents of this file are subject to the Netscape Public License
# Version 1.0 (the "NPL"); you may not use this file except in
# compliance with the NPL. You may obtain a copy of the NPL at
# http://www.mozilla.org/NPL/
#
# Software distributed under the NPL is distributed on an "AS IS" basis,
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
# for the specific language governing rights and limitations under the
# NPL.
#
# The Initial Developer of this code under the NPL is Netscape
# Communications Corporation. Portions created by Netscape are
# Copyright (C) 1998 Netscape Communications Corporation. All Rights
# Reserved.
DEPTH=..\..\..\..
DIRS= en-US
include <$(DEPTH)\config\rules.mak>

View File

@@ -0,0 +1,22 @@
#!nmake
#
# The contents of this file are subject to the Netscape Public License
# Version 1.0 (the "NPL"); you may not use this file except in
# compliance with the NPL. You may obtain a copy of the NPL at
# http://www.mozilla.org/NPL/
#
# Software distributed under the NPL is distributed on an "AS IS" basis,
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
# for the specific language governing rights and limitations under the
# NPL.
#
# The Initial Developer of this code under the NPL is Netscape
# Communications Corporation. Portions created by Netscape are
# Copyright (C) 1998 Netscape Communications Corporation. All Rights
# Reserved.
DEPTH=..\..\..
DIRS= content locale skin
include <$(DEPTH)\config\rules.mak>

View File

@@ -0,0 +1,27 @@
# The contents of this file are subject to the Netscape Public License
# Version 1.0 (the "NPL"); you may not use this file except in
# compliance with the NPL. You may obtain a copy of the NPL at
# http://www.mozilla.org/NPL/
#
# Software distributed under the NPL is distributed on an "AS IS" basis,
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
# for the specific language governing rights and limitations under the
# NPL.
#
# The Initial Developer of this code under the NPL is Netscape
# Communications Corporation. Portions created by Netscape are
# Copyright (C) 1998 Netscape Communications Corporation. All Rights
# Reserved.
#
# This is a list of local files which get copied to the res\mailnews\messenger directory
#
addressbook.css
newcard.gif
newlist.gif
property.gif
abnewmsg.gif
person.gif
list.gif
myaddrbk.gif

View File

@@ -0,0 +1,44 @@
#
# The contents of this file are subject to the Netscape Public License
# Version 1.0 (the "NPL"); you may not use this file except in
# compliance with the NPL. You may obtain a copy of the NPL at
# http://www.mozilla.org/NPL/
#
# Software distributed under the NPL is distributed on an "AS IS" basis,
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
# for the specific language governing rights and limitations under the
# NPL.
#
# The Initial Developer of this code under the NPL is Netscape
# Communications Corporation. Portions created by Netscape are
# Copyright (C) 1998 Netscape Communications Corporation. All Rights
# Reserved.
#
DEPTH = ../../../..
topsrcdir = @top_srcdir@
srcdir = @srcdir@
VPATH = @srcdir@
include $(DEPTH)/config/autoconf.mk
SAMPLES_DIR = $(DIST)/bin/chrome/addressbook/skin/default
EXPORT_RESOURCE_SAMPLES = \
addressbook.css \
newcard.gif \
newlist.gif \
property.gif \
abnewmsg.gif \
person.gif \
list.gif \
myaddrbk.gif \
$(NULL)
include $(topsrcdir)/config/rules.mk
GARBAGE += $(addprefix $(SAMPLES_DIR)/, $(EXPORT_RESOURCE_SAMPLES))
install::
$(INSTALL) $(addprefix $(srcdir)/, $(EXPORT_RESOURCE_SAMPLES)) $(SAMPLES_DIR)

Binary file not shown.

After

Width:  |  Height:  |  Size: 285 B

View File

@@ -0,0 +1,78 @@
/*
The contents of this file are subject to the Netscape Public
License Version 1.1 (the "License"); you may not use this file
except in compliance with the License. You may obtain a copy of
the License at http://www.mozilla.org/NPL/
Software distributed under the License is distributed on an "AS
IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
implied. See the License for the specific language governing
rights and limitations under the License.
The Original Code is Mozilla Communicator client code, released
March 31, 1998.
The Initial Developer of the Original Code is Netscape
Communications Corporation. Portions created by Netscape are
Copyright (C) 1998-1999 Netscape Communications Corporation. All
Rights Reserved.
*/
/* CardEdit styles - used in the Card Edit Dialog */
box[class="CardEditWidth"] {
width : 24.4em;
margin-left : 0px;
margin-right : 8px;
}
input[class="CardEdit"] {
width : 25em;
height : 1.5em;
margin : 0px;
padding : 0px;
padding-right : 0px;
min-height : 1.5em;
}
/* CardView styles - used in the Card View Pane*/
div[class="CardViewHeading"] {
padding: 1px;
padding-left: 5px;
color: white;
background-color: #5050ff;
font-weight: bold;
margin-top: 8px;
margin-bottom: 3px;
}
div[class="CardViewText"] {
padding-left: 20px;
padding-right: 2px;
color:inherit;
}
/* Custom Trees */
tree[class="abDirectory"] treeitem > treerow > treecell > .tree-icon {
list-style-image: url("chrome://addressbook/skin/myaddrbk.gif");
}
tree[class="abResults"] treeitem > treerow > treecell > .tree-icon {
list-style-image: url("chrome://addressbook/skin/person.gif");
}
/* Address Book specific style */
[hide] {
display: none;
}
titledbutton#Throbber
{
list-style-image:url(chrome://navigator/skin/animthrob_single.gif);
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 165 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 143 B

View File

@@ -0,0 +1,43 @@
#!nmake
#
# The contents of this file are subject to the Netscape Public License
# Version 1.0 (the "NPL"); you may not use this file except in
# compliance with the NPL. You may obtain a copy of the NPL at
# http://www.mozilla.org/NPL/
#
# Software distributed under the NPL is distributed on an "AS IS" basis,
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
# for the specific language governing rights and limitations under the
# NPL.
#
# The Initial Developer of this code under the NPL is Netscape
# Communications Corporation. Portions created by Netscape are
# Copyright (C) 1998 Netscape Communications Corporation. All Rights
# Reserved.
DEPTH=..\..\..\..
MODULE=addrbook
include <$(DEPTH)\config\rules.mak>
install::
$(MAKE_INSTALL) addressbook.css $(DIST)\bin\chrome\addressbook\skin\default
$(MAKE_INSTALL) newcard.gif $(DIST)\bin\chrome\addressbook\skin\default
$(MAKE_INSTALL) newlist.gif $(DIST)\bin\chrome\addressbook\skin\default
$(MAKE_INSTALL) property.gif $(DIST)\bin\chrome\addressbook\skin\default
$(MAKE_INSTALL) abnewmsg.gif $(DIST)\bin\chrome\addressbook\skin\default
$(MAKE_INSTALL) person.gif $(DIST)\bin\chrome\addressbook\skin\default
$(MAKE_INSTALL) list.gif $(DIST)\bin\chrome\addressbook\skin\default
$(MAKE_INSTALL) myaddrbk.gif $(DIST)\bin\chrome\addressbook\skin\default
clobber::
rm -f $(DIST)\chrome\addressbook\skin\default\addressbook.css
rm -f $(DIST)\chrome\addressbook\skin\default\newcard.gif
rm -f $(DIST)\chrome\addressbook\skin\default\newlist.gif
rm -f $(DIST)\chrome\addressbook\skin\default\property.gif
rm -f $(DIST)\chrome\addressbook\skin\default\abnewmsg.gif
rm -f $(DIST)\chrome\addressbook\skin\default\person.gif
rm -f $(DIST)\chrome\addressbook\skin\default\list.gif
rm -f $(DIST)\chrome\addressbook\skin\default\myaddrbk.gif

Binary file not shown.

After

Width:  |  Height:  |  Size: 148 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 265 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 273 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 135 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 259 B

View File

@@ -0,0 +1,20 @@
# The contents of this file are subject to the Netscape Public License
# Version 1.0 (the "NPL"); you may not use this file except in
# compliance with the NPL. You may obtain a copy of the NPL at
# http://www.mozilla.org/NPL/
#
# Software distributed under the NPL is distributed on an "AS IS" basis,
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
# for the specific language governing rights and limitations under the
# NPL.
#
# The Initial Developer of this code under the NPL is Netscape
# Communications Corporation. Portions created by Netscape are
# Copyright (C) 1998 Netscape Communications Corporation. All Rights
# Reserved.
#
# This is a list of local files which get copied to the mozilla:dist:mailnews directory
#
nsDirPrefs.h

View File

@@ -0,0 +1,67 @@
#
# The contents of this file are subject to the Netscape Public License
# Version 1.0 (the "NPL"); you may not use this file except in
# compliance with the NPL. You may obtain a copy of the NPL at
# http://www.mozilla.org/NPL/
#
# Software distributed under the NPL is distributed on an "AS IS" basis,
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
# for the specific language governing rights and limitations under the
# NPL.
#
# The Initial Developer of this code under the NPL is Netscape
# Communications Corporation. Portions created by Netscape are
# Copyright (C) 1998 Netscape Communications Corporation. All Rights
# Reserved.
#
DEPTH = ../../..
topsrcdir = @top_srcdir@
srcdir = @srcdir@
VPATH = @srcdir@
include $(DEPTH)/config/autoconf.mk
MODULE = addrbook
LIBRARY_NAME = addrbook_s
CPPSRCS = \
nsAddressBook.cpp \
nsAddrBookSession.cpp \
nsAbRDFDataSource.cpp \
nsAbRDFResource.cpp \
nsCardDataSource.cpp \
nsDirectoryDataSource.cpp \
nsAbCard.cpp \
nsAbDirectory.cpp \
nsAbCardProperty.cpp \
nsDirPrefs.cpp \
nsAddrDatabase.cpp \
nsAbDirProperty.cpp \
nsAbAutoCompleteSession.cpp \
nsAbAddressCollecter.cpp \
$(NULL)
EXPORTS = \
nsAddressBook.h \
nsAddrBookSession.h \
nsAbRDFDataSource.h \
nsAbRDFResource.h \
nsCardDataSource.h \
nsDirectoryDataSource.h \
nsAbCard.h \
nsAbDirectory.h \
nsAbCardProperty.h \
nsDirPrefs.h \
nsAddrDatabase.h \
nsAbDirProperty.h \
nsAbAutoCompleteSession.h \
nsAbAddressCollecter.h \
$(NULL)
# we don't want the shared lib, but we want to force the creation of a static lib.
override NO_SHARED_LIB=1
override NO_STATIC_LIB=
include $(topsrcdir)/config/rules.mk

View File

@@ -0,0 +1,71 @@
#!nmake
#
# The contents of this file are subject to the Netscape Public License
# Version 1.0 (the "NPL"); you may not use this file except in
# compliance with the NPL. You may obtain a copy of the NPL at
# http://www.mozilla.org/NPL/
#
# Software distributed under the NPL is distributed on an "AS IS" basis,
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
# for the specific language governing rights and limitations under the
# NPL.
#
# The Initial Developer of this code under the NPL is Netscape
# Communications Corporation. Portions created by Netscape are
# Copyright (C) 1998 Netscape Communications Corporation. All Rights
# Reserved.
DEPTH=..\..\..
MODULE= addrbook
include <$(DEPTH)\config\config.mak>
################################################################################
## exports
EXPORTS= \
nsAddressBook.h \
nsAddrBookSession.h \
nsAbRDFDataSource.h \
nsAbRDFResource.h \
nsCardDataSource.h \
nsDirectoryDataSource.h \
nsAbCard.h \
nsAbDirectory.h \
nsAbCardProperty.h \
nsDirPrefs.h \
nsAddrDatabase.h \
nsAbDirProperty.h \
nsAbAutoCompleteSession.h \
nsAbAddressCollecter.h \
$(NULL)
################################################################################
## library
LIBRARY_NAME=addrbook_s
CPP_OBJS= \
.\$(OBJDIR)\nsAddressBook.obj \
.\$(OBJDIR)\nsAddrBookSession.obj \
.\$(OBJDIR)\nsAbRDFDataSource.obj \
.\$(OBJDIR)\nsAbRDFResource.obj \
.\$(OBJDIR)\nsCardDataSource.obj \
.\$(OBJDIR)\nsDirectoryDataSource.obj \
.\$(OBJDIR)\nsAbCard.obj \
.\$(OBJDIR)\nsAbDirectory.obj \
.\$(OBJDIR)\nsAbCardProperty.obj \
.\$(OBJDIR)\nsDirPrefs.obj \
.\$(OBJDIR)\nsAddrDatabase.obj \
.\$(OBJDIR)\nsAbDirProperty.obj \
.\$(OBJDIR)\nsAbAutoCompleteSession.obj \
.\$(OBJDIR)\nsAbAddressCollecter.obj \
$(NULL)
include <$(DEPTH)\config\rules.mak>
libs:: $(LIBRARY)
$(MAKE_INSTALL) $(LIBRARY) $(DIST)\lib
clobber::
rm -f $(DIST)\lib\$(LIBRARY_NAME).lib

View File

@@ -0,0 +1,289 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
*
* The contents of this file are subject to the Netscape Public License
* Version 1.0 (the "NPL"); you may not use this file except in
* compliance with the NPL. You may obtain a copy of the NPL at
* http://www.mozilla.org/NPL/
*
* Software distributed under the NPL is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
* for the specific language governing rights and limitations under the
* NPL.
*
* The Initial Developer of this code under the NPL is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1999 Netscape Communications Corporation. All Rights
* Reserved.
*/
#include "msgCore.h" // for pre-compiled headers
#include "nsIServiceManager.h"
#include "nsIAbCard.h"
#include "nsAbBaseCID.h"
#include "nsAbAddressCollecter.h"
#include "nsIPref.h"
#include "nsIAddrBookSession.h"
#include "nsIMsgHeaderParser.h"
#include "nsIRDFService.h"
#include "nsRDFCID.h"
#include "nsXPIDLString.h"
// For the new pref API's
static NS_DEFINE_CID(kPrefCID, NS_PREF_CID);
static NS_DEFINE_CID(kAbCardPropertyCID, NS_ABCARDPROPERTY_CID);
static NS_DEFINE_CID(kAddrBookSessionCID, NS_ADDRBOOKSESSION_CID);
static NS_DEFINE_CID(kAddressBookDBCID, NS_ADDRDATABASE_CID);
static NS_DEFINE_CID(kMsgHeaderParserCID, NS_MSGHEADERPARSER_CID);
static NS_DEFINE_CID(kRDFServiceCID, NS_RDFSERVICE_CID);
NS_IMPL_ISUPPORTS(nsAbAddressCollecter, nsCOMTypeInfo<nsIAbAddressCollecter>::GetIID());
nsAbAddressCollecter::nsAbAddressCollecter()
{
NS_INIT_REFCNT();
}
nsAbAddressCollecter::~nsAbAddressCollecter()
{
if (m_historyAB)
{
m_historyAB->Commit(kSessionCommit);
m_historyAB->Close(PR_FALSE);
}
}
NS_IMETHODIMP nsAbAddressCollecter::CollectAddress(const char *address)
{
nsresult rv;
PRBool collectAddresses = PR_TRUE;
NS_WITH_SERVICE(nsIPref, pPref, kPrefCID, &rv);
if (NS_FAILED(rv) || !pPref)
return NS_ERROR_FAILURE;
rv = pPref->GetBoolPref("mail.collect_email_address", &collectAddresses);
if (!NS_SUCCEEDED(rv) || !collectAddresses)
return rv;
if (!m_historyAB)
{
rv = OpenHistoryAB(getter_AddRefs(m_historyAB));
if (!NS_SUCCEEDED(rv) || !m_historyAB)
return rv;
}
// note that we're now setting the whole recipient list,
// not just the pretty name of the first recipient.
PRUint32 numAddresses;
char *names;
char *addresses;
nsCOMPtr<nsIMsgHeaderParser> pHeader;
nsresult res = nsComponentManager::CreateInstance(kMsgHeaderParserCID,
NULL, nsIMsgHeaderParser::GetIID(),
(void **) getter_AddRefs(pHeader));
if (NS_FAILED(res)) return res;
nsresult ret = pHeader->ParseHeaderAddresses (nsnull, address, &names, &addresses, &numAddresses);
if (ret == NS_OK)
{
char *curName = names;
char *curAddress = addresses;
char *excludeDomainList = nsnull;
for (PRUint32 i = 0; i < numAddresses; i++)
{
PRBool exclude;
rv = IsDomainExcluded(curAddress, pPref, &exclude);
if (NS_SUCCEEDED(rv) && !exclude)
{
nsCOMPtr <nsIAbCard> existingCard;
rv = m_historyAB->GetCardForEmailAddress(m_historyDirectory, curAddress, getter_AddRefs(existingCard));
if (!existingCard)
{
nsCOMPtr<nsIAbCard> senderCard;
rv = nsComponentManager::CreateInstance(kAbCardPropertyCID, nsnull, nsCOMTypeInfo<nsIAbCard>::GetIID(), getter_AddRefs(senderCard));
if (NS_SUCCEEDED(rv) && senderCard)
{
if (curName && nsCRT::strlen(curName) > 0)
{
SetNamesForCard(senderCard, curName);
}
else
{
nsAutoString senderFromEmail(curAddress);
PRInt32 atSignIndex = senderFromEmail.FindChar('@');
if (atSignIndex > 0)
{
senderFromEmail.Truncate(atSignIndex + 1);
senderCard->SetDisplayName((PRUnichar*)senderFromEmail.GetUnicode());
}
}
nsAutoString email(curAddress);
senderCard->SetPrimaryEmail((PRUnichar*)email.GetUnicode());
senderCard->AddCardToDatabase("abdirectory://history.mab");
}
}
else
{
SetNamesForCard(existingCard, curName);
existingCard->EditCardToDatabase("abdirectory://history.mab");
}
}
curName += strlen(curName) + 1;
curAddress += strlen(curAddress) + 1;
}
PR_FREEIF(addresses);
PR_FREEIF(names);
PR_FREEIF(excludeDomainList);
}
return NS_OK;
}
nsresult nsAbAddressCollecter::OpenHistoryAB(nsIAddrDatabase **aDatabase)
{
if (!aDatabase)
return NS_ERROR_NULL_POINTER;
nsresult rv = NS_OK;
nsFileSpec* dbPath = nsnull;
NS_WITH_SERVICE(nsIAddrBookSession, abSession, kAddrBookSessionCID, &rv);
if(NS_SUCCEEDED(rv))
abSession->GetUserProfileDirectory(&dbPath);
if (dbPath)
{
(*dbPath) += "history.mab";
NS_WITH_SERVICE(nsIAddrDatabase, addrDBFactory, kAddressBookDBCID, &rv);
if (NS_SUCCEEDED(rv) && addrDBFactory)
rv = addrDBFactory->Open(dbPath, PR_TRUE, aDatabase, PR_TRUE);
}
NS_WITH_SERVICE(nsIRDFService, rdfService, kRDFServiceCID, &rv);
if (NS_FAILED(rv))
return rv;
nsCOMPtr <nsIRDFResource> resource;
rv = rdfService->GetResource("abdirectory://history.mab", getter_AddRefs(resource));
if (NS_FAILED(rv))
return rv;
// query interface
m_historyDirectory = do_QueryInterface(resource, &rv);
return rv;
}
nsresult nsAbAddressCollecter::IsDomainExcluded(const char *address, nsIPref *pPref, PRBool *bExclude)
{
if (!bExclude)
return NS_ERROR_NULL_POINTER;
*bExclude = PR_FALSE;
nsXPIDLCString excludedDomainList;
nsresult rv = pPref->CopyCharPref("mail.address_collection_ignore_domain_list",
getter_Copies(excludedDomainList));
if (NS_FAILED(rv) || !excludedDomainList || !excludedDomainList[0])
return NS_OK;
nsCAutoString incomingDomain(address);
PRInt32 atSignIndex = incomingDomain.RFindChar('@');
if (atSignIndex > 0)
{
incomingDomain.Cut(0, atSignIndex + 1);
char *token = nsnull;
char *rest = NS_CONST_CAST(char*,(const char*)excludedDomainList);
nsCAutoString str;
token = nsCRT::strtok(rest, ",", &rest);
while (token && *token)
{
str = token;
str.StripWhitespace();
if (!str.IsEmpty())
{
if (str.Equals(incomingDomain))
{
*bExclude = PR_TRUE;
break;
}
}
str = "";
token = nsCRT::strtok(rest, ",", &rest);
}
}
return rv;
}
nsresult nsAbAddressCollecter::SetNamesForCard(nsIAbCard *senderCard, const char *fullName)
{
char *firstName = nsnull;
char *lastName = nsnull;
PRUnichar *unicodeStr = nsnull;
PRInt32 unicharLength = 0;
INTL_ConvertToUnicode((const char *)fullName, nsCRT::strlen(fullName), (void**)&unicodeStr, &unicharLength);
senderCard->SetDisplayName(unicodeStr);
PR_Free(unicodeStr);
nsresult rv = SplitFullName (fullName, &firstName, &lastName);
if (NS_SUCCEEDED(rv))
{
INTL_ConvertToUnicode((const char *)firstName, nsCRT::strlen(firstName), (void**)&unicodeStr, &unicharLength);
senderCard->SetFirstName(unicodeStr);
PR_Free(unicodeStr);
if (lastName) {
INTL_ConvertToUnicode((const char *)lastName, nsCRT::strlen(lastName), (void**)&unicodeStr, &unicharLength);
senderCard->SetLastName(unicodeStr);
PR_Free(unicodeStr);
}
}
PR_FREEIF(firstName);
PR_FREEIF(lastName);
return rv;
}
nsresult nsAbAddressCollecter::SplitFullName (const char *fullName, char **firstName, char **lastName)
{
if (fullName)
{
*firstName = nsCRT::strdup(fullName);
if (NULL == *firstName)
return NS_ERROR_OUT_OF_MEMORY;
char *plastSpace = *firstName;
char *walkName = *firstName;
char *plastName = nsnull;
while (walkName && *walkName)
{
if (*walkName == ' ')
{
plastSpace = walkName;
plastName = plastSpace + 1;
}
walkName++;
}
if (plastName)
{
*plastSpace = '\0';
*lastName = nsCRT::strdup (plastName);
}
}
return NS_OK;
}

View File

@@ -0,0 +1,50 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Netscape Public License
* Version 1.0 (the "NPL"); you may not use this file except in
* compliance with the NPL. You may obtain a copy of the NPL at
* http://www.mozilla.org/NPL/
*
* Software distributed under the NPL is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
* for the specific language governing rights and limitations under the
* NPL.
*
* The Initial Developer of this code under the NPL is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1999 Netscape Communications Corporation. All Rights
* Reserved.
*/
#ifndef _nsAbAddressCollecter_H_
#define _nsAbAddressCollecter_H_
#include "nsIAbAddressCollecter.h"
#include "nsCOMPtr.h"
#include "nsIAbAddressCollecter.h"
#include "nsIAddrDatabase.h"
#include "nsAddrDatabase.h"
class nsIPref;
class nsAbAddressCollecter : public nsIAbAddressCollecter
{
public:
nsAbAddressCollecter();
virtual ~nsAbAddressCollecter();
NS_DECL_ISUPPORTS
NS_DECL_NSIABADDRESSCOLLECTER
nsresult OpenHistoryAB(nsIAddrDatabase **aDatabase);
nsresult IsDomainExcluded(const char *address, nsIPref *pPref, PRBool *bExclude);
nsresult SetNamesForCard(nsIAbCard *senderCard, const char *fullName);
nsresult SplitFullName (const char *fullName, char **firstName, char **lastName);
protected:
nsCOMPtr <nsIAddrDatabase> m_historyAB;
nsCOMPtr <nsIAbDirectory> m_historyDirectory;
};
#endif // _nsAbAddressCollecter_H_

View File

@@ -0,0 +1,231 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Netscape Public License
* Version 1.0 (the "NPL"); you may not use this file except in
* compliance with the NPL. You may obtain a copy of the NPL at
* http://www.mozilla.org/NPL/
*
* Software distributed under the NPL is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
* for the specific language governing rights and limitations under the
* NPL.
*
* The Initial Developer of this code under the NPL is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1999 Netscape Communications Corporation. All Rights
* Reserved.
*/
#include "msgCore.h"
#include "nsAbAutoCompleteSession.h"
#include "nsString.h"
#include "nsIMsgHeaderParser.h"
#include "nsRDFCID.h"
#include "nsIRDFService.h"
#include "nsIAbDirectory.h"
#include "nsIAbCard.h"
#include "nsXPIDLString.h"
#include "nsMsgBaseCID.h"
#include "nsIMsgMailSession.h"
static NS_DEFINE_CID(kHeaderParserCID, NS_MSGHEADERPARSER_CID);
static NS_DEFINE_CID(kRDFServiceCID, NS_RDFSERVICE_CID);
static NS_DEFINE_CID(kCMsgMailSessionCID, NS_MSGMAILSESSION_CID);
nsresult NS_NewAbAutoCompleteSession(const nsIID &aIID, void ** aInstancePtrResult)
{
/* note this new macro for assertions...they can take a string describing the assertion */
NS_PRECONDITION(nsnull != aInstancePtrResult, "nsnull ptr");
if (aInstancePtrResult)
{
nsAbAutoCompleteSession * abSession = new nsAbAutoCompleteSession();
if (abSession)
return abSession->QueryInterface(nsCOMTypeInfo<nsIAutoCompleteSession>::GetIID(), aInstancePtrResult);
else
return NS_ERROR_OUT_OF_MEMORY; /* we couldn't allocate the object */
}
else
return NS_ERROR_NULL_POINTER; /* aInstancePtrResult was NULL....*/
}
NS_IMPL_ISUPPORTS(nsAbAutoCompleteSession, nsCOMTypeInfo<nsIAutoCompleteSession>::GetIID())
nsAbAutoCompleteSession::nsAbAutoCompleteSession()
{
NS_INIT_REFCNT();
m_numEntries = 0;
m_tableInitialized = PR_FALSE;
// temporary hack to get the current identity
nsresult rv;
NS_WITH_SERVICE(nsIMsgMailSession, mailSession, kCMsgMailSessionCID, &rv);
if (NS_SUCCEEDED(rv))
{
nsCOMPtr<nsIMsgIdentity> identity;
rv = mailSession->GetCurrentIdentity(getter_AddRefs(identity));
if (NS_SUCCEEDED(rv))
{
char * email;
identity->GetEmail(&email);
if (email && *email)
m_domain = PL_strchr(email, '@');
PR_FREEIF(email);
}
}
}
nsresult nsAbAutoCompleteSession::PopulateTableWithAB(nsIEnumerator * aABCards)
{
nsresult rv = NS_OK;
if (!aABCards)
return rv;
rv = aABCards->First();
while (NS_SUCCEEDED(rv) && m_numEntries < MAX_ENTRIES)
{
m_searchNameCompletionEntryTable[m_numEntries].userName = nsnull;
m_searchNameCompletionEntryTable[m_numEntries].emailAddress = nsnull;
nsCOMPtr<nsISupports> i;
rv = aABCards->CurrentItem(getter_AddRefs(i));
if (NS_FAILED(rv)) break;
nsCOMPtr<nsIAbCard> card(do_QueryInterface(i, &rv));
if (NS_FAILED(rv)) break;
/* card holds unicode string, convert to utf8 String for autocomplete*/
nsXPIDLString pUnicodeStr;
PRInt32 unicharLength = 0;
rv=card->GetDisplayName(getter_Copies(pUnicodeStr));
if (NS_FAILED(rv)) break;
unicharLength = nsCRT::strlen(pUnicodeStr);
INTL_ConvertFromUnicode(pUnicodeStr, unicharLength, (char**)&m_searchNameCompletionEntryTable[m_numEntries].userName);
rv=card->GetPrimaryEmail(getter_Copies(pUnicodeStr));
if (NS_FAILED(rv)) break;
unicharLength = nsCRT::strlen(pUnicodeStr);
INTL_ConvertFromUnicode(pUnicodeStr, unicharLength, (char**)&m_searchNameCompletionEntryTable[m_numEntries].emailAddress);
rv = aABCards->Next();
m_numEntries++;
m_tableInitialized = PR_TRUE;
if (m_numEntries == MAX_ENTRIES)
break;
}
return NS_OK;
}
nsresult nsAbAutoCompleteSession::InitializeTable()
{
#ifdef DEBUG_seth
fprintf(stderr,"initializing autocomplete table\n");
#endif
nsresult rv = NS_OK;
NS_WITH_SERVICE(nsIRDFService, rdfService, kRDFServiceCID, &rv);
if (NS_FAILED(rv)) return rv;
nsCOMPtr <nsIRDFResource> resource;
rv = rdfService->GetResource("abdirectory://abook.mab", getter_AddRefs(resource));
if (NS_FAILED(rv)) return rv;
// query interface
nsCOMPtr<nsIAbDirectory> directory(do_QueryInterface(resource, &rv));
if (NS_FAILED(rv)) return rv;
nsCOMPtr<nsIEnumerator> cards;
rv = directory->GetChildCards(getter_AddRefs(cards));
if (NS_FAILED(rv)) return rv;
rv = PopulateTableWithAB(cards);
if (NS_FAILED(rv)) return rv;
// now if we have any left over space, populate the table with the history address book
rv = rdfService->GetResource("abdirectory://history.mab", getter_AddRefs(resource));
if (NS_FAILED(rv)) return rv;
directory = do_QueryInterface(resource, &rv);
if (NS_FAILED(rv)) return rv;
rv = directory->GetChildCards(getter_AddRefs(cards));
if (NS_FAILED(rv)) return rv;
rv = PopulateTableWithAB(cards);
if (NS_FAILED(rv)) return rv;
return NS_OK; // always return success??
}
nsAbAutoCompleteSession::~nsAbAutoCompleteSession()
{
PRInt32 i;
for (i=0;i<m_numEntries;i++) {
PR_FREEIF(m_searchNameCompletionEntryTable[i].userName);
m_searchNameCompletionEntryTable[i].userName = nsnull;
PR_FREEIF(m_searchNameCompletionEntryTable[i].emailAddress);
m_searchNameCompletionEntryTable[i].emailAddress = nsnull;
}
}
NS_IMETHODIMP nsAbAutoCompleteSession::AutoComplete(nsISupports *aParam, const PRUnichar *aSearchString, nsIAutoCompleteListener *aResultListener)
{
// mscott - right now I'm not even going to bother to make this synchronous...
// I'll beef it up with some test data later but we want to see if this idea works for right now...
nsresult rv = NS_OK;
if (!m_tableInitialized) {
rv = InitializeTable();
if (NS_FAILED(rv)) return rv;
}
if (aResultListener)
{
PRUint32 searchStringLen = nsCRT::strlen(aSearchString);
PRBool matchFound = PR_FALSE;
PRInt32 nIndex;
for (nIndex = 0; nIndex < m_numEntries && !matchFound; nIndex++)
{
if (nsCRT::strncasecmp(aSearchString, m_searchNameCompletionEntryTable[nIndex].userName, searchStringLen) == 0
|| nsCRT::strncasecmp(aSearchString, m_searchNameCompletionEntryTable[nIndex].emailAddress,searchStringLen) == 0)
{
matchFound = PR_TRUE; // so we kick out of the loop
// get a mime header parser to generate a valid address
nsCOMPtr<nsIMsgHeaderParser> parser;
nsComponentManager::CreateInstance(kHeaderParserCID,
nsnull,
nsCOMTypeInfo<nsIMsgHeaderParser>::GetIID(),
getter_AddRefs(parser));
char * fullAddress = nsnull;
if (parser)
parser->MakeFullAddress(nsnull, m_searchNameCompletionEntryTable[nIndex].userName,
m_searchNameCompletionEntryTable[nIndex].emailAddress, &fullAddress);
nsString searchResult(fullAddress);
// iterate over the table looking for a match
rv = aResultListener->OnAutoCompleteResult(aParam, aSearchString, searchResult.GetUnicode());
break;
}
}
if (!matchFound)
{
//Does the search string has a domain name?
nsString searchResult(aSearchString);
PRInt32 atSignIndex = searchResult.FindChar('@');
if (atSignIndex < 0)
{
searchResult += m_domain;
rv = aResultListener->OnAutoCompleteResult(aParam, aSearchString, searchResult.GetUnicode());
}
}
}
else
rv = NS_ERROR_NULL_POINTER;
return rv;
}

View File

@@ -0,0 +1,60 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Netscape Public License
* Version 1.0 (the "NPL"); you may not use this file except in
* compliance with the NPL. You may obtain a copy of the NPL at
* http://www.mozilla.org/NPL/
*
* Software distributed under the NPL is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
* for the specific language governing rights and limitations under the
* NPL.
*
* The Initial Developer of this code under the NPL is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1999 Netscape Communications Corporation. All Rights
* Reserved.
*/
#ifndef nsAbAutoCompleteSession_h___
#define nsAbAutoCompleteSession_h___
#include "nsIAutoCompleteSession.h"
#include "nsIAutoCompleteListener.h"
#include "nsCOMPtr.h"
#include "msgCore.h"
typedef struct
{
char * userName;
char * emailAddress;
} nsAbStubEntry;
#define MAX_ENTRIES 100
class nsAbAutoCompleteSession : public nsIAutoCompleteSession
{
public:
NS_DECL_ISUPPORTS
NS_DECL_NSIAUTOCOMPLETESESSION
nsAbAutoCompleteSession();
virtual ~nsAbAutoCompleteSession();
protected:
nsresult InitializeTable();
nsresult PopulateTableWithAB(nsIEnumerator * aABCards); // enumerates through the cards and adds them to the table
nsCOMPtr<nsIAutoCompleteListener> m_resultListener;
PRBool m_tableInitialized;
nsAbStubEntry m_searchNameCompletionEntryTable[MAX_ENTRIES];
PRInt32 m_numEntries;
nsString m_domain;
};
// factory method
extern nsresult NS_NewAbAutoCompleteSession(const nsIID &aIID, void ** aInstancePtrResult);
#endif /* nsAbAutoCompleteSession_h___ */

View File

@@ -0,0 +1,148 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Netscape Public License
* Version 1.0 (the "NPL"); you may not use this file except in
* compliance with the NPL. You may obtain a copy of the NPL at
* http://www.mozilla.org/NPL/
*
* Software distributed under the NPL is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
* for the specific language governing rights and limitations under the
* NPL.
*
* The Initial Developer of this code under the NPL is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
* Reserved.
*/
#include "nsAbCard.h"
#include "nsIRDFService.h"
#include "nsIServiceManager.h"
#include "nsRDFCID.h"
#include "nsIFileSpec.h"
#include "nsIFileLocator.h"
#include "nsFileLocations.h"
#include "nsXPIDLString.h"
#include "nsCOMPtr.h"
#include "nsAbBaseCID.h"
#include "prmem.h"
#include "prlog.h"
#include "nsAddrDatabase.h"
#include "nsIAddrBookSession.h"
static NS_DEFINE_CID(kRDFServiceCID, NS_RDFSERVICE_CID);
static NS_DEFINE_CID(kAddrBookSessionCID, NS_ADDRBOOKSESSION_CID);
nsAbCard::nsAbCard(void)
: nsAbRDFResource(), mListeners(nsnull)
{
}
nsAbCard::~nsAbCard(void)
{
if (mCardDatabase)
{
nsIAddrDBListener* listener = this;
mCardDatabase->RemoveListener(listener);
mCardDatabase->Close(PR_TRUE);
mCardDatabase = null_nsCOMPtr();
}
if (mListeners)
{
PRInt32 i;
for (i = mListeners->Count() - 1; i >= 0; --i)
mListeners->RemoveElementAt(i);
delete mListeners;
}
}
NS_IMPL_ISUPPORTS_INHERITED(nsAbCard, nsAbRDFResource, nsIAbCard)
////////////////////////////////////////////////////////////////////////////////
NS_IMETHODIMP nsAbCard::OnCardEntryChange
(PRUint32 abCode, nsIAbCard *card, nsIAddrDBListener *instigator)
{
if (abCode == AB_NotifyPropertyChanged && card)
{
PRUint32 tableID;
PRUint32 rowID;
card->GetDbTableID(&tableID);
card->GetDbRowID(&rowID);
if (m_dbTableID == tableID && m_dbRowID == rowID)
{
nsXPIDLString pDisplayName;
card->GetDisplayName(getter_Copies(pDisplayName));
if (pDisplayName)
NotifyPropertyChanged("DisplayName", nsnull,
NS_CONST_CAST(PRUnichar*, (const PRUnichar*)pDisplayName));
nsXPIDLString pEmail;
card->GetPrimaryEmail(getter_Copies(pEmail));
if (pEmail)
NotifyPropertyChanged("PrimaryEmail", nsnull,
NS_CONST_CAST(PRUnichar*, (const PRUnichar*)pEmail));
nsXPIDLString pWorkPhone;
card->GetWorkPhone(getter_Copies(pWorkPhone));
if (pWorkPhone)
NotifyPropertyChanged("WorkPhone", nsnull,
NS_CONST_CAST(PRUnichar*, (const PRUnichar*)pWorkPhone));
}
}
return NS_OK;
}
nsresult nsAbCard::NotifyPropertyChanged(char *property, PRUnichar* oldValue, PRUnichar* newValue)
{
nsCOMPtr<nsISupports> supports;
if(NS_SUCCEEDED(QueryInterface(nsCOMTypeInfo<nsISupports>::GetIID(), getter_AddRefs(supports))))
{
//Notify listeners who listen to every folder
nsresult rv;
NS_WITH_SERVICE(nsIAddrBookSession, abSession, kAddrBookSessionCID, &rv);
if(NS_SUCCEEDED(rv))
abSession->NotifyItemPropertyChanged(supports, property, oldValue, newValue);
}
return NS_OK;
}
nsresult nsAbCard::AddSubNode(nsAutoString name, nsIAbCard **childCard)
{
if(!childCard)
return NS_ERROR_NULL_POINTER;
nsresult rv = NS_OK;
NS_WITH_SERVICE(nsIRDFService, rdf, kRDFServiceCID, &rv);
if(NS_FAILED(rv))
return rv;
nsAutoString uri;
uri.Append(mURI);
uri.Append('/');
uri.Append(name);
char* uriStr = uri.ToNewCString();
if (uriStr == nsnull)
return NS_ERROR_OUT_OF_MEMORY;
nsCOMPtr<nsIRDFResource> res;
rv = rdf->GetResource(uriStr, getter_AddRefs(res));
if (NS_FAILED(rv))
return rv;
nsCOMPtr<nsIAbCard> card(do_QueryInterface(res, &rv));
if (NS_FAILED(rv))
return rv;
delete[] uriStr;
*childCard = card;
NS_IF_ADDREF(*childCard);
return rv;
}

View File

@@ -0,0 +1,62 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Netscape Public License
* Version 1.0 (the "NPL"); you may not use this file except in
* compliance with the NPL. You may obtain a copy of the NPL at
* http://www.mozilla.org/NPL/
*
* Software distributed under the NPL is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
* for the specific language governing rights and limitations under the
* NPL.
*
* The Initial Developer of this code under the NPL is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
* Reserved.
*/
/********************************************************************************************************
Interface for representing Address Book Directory
*********************************************************************************************************/
#ifndef nsAbCard_h__
#define nsAbCard_h__
#include "nsAbCardProperty.h"
#include "nsAbRDFResource.h"
#include "nsISupportsArray.h"
#include "nsVoidArray.h"
#include "nsCOMPtr.h"
#include "nsIAddrDBListener.h"
#include "nsIAddrDatabase.h"
/*
* Address Book Directory
*/
class nsAbCard: public nsAbRDFResource, public nsAbCardProperty
{
public:
NS_DECL_ISUPPORTS_INHERITED
nsAbCard(void);
virtual ~nsAbCard(void);
// nsIAddrDBListener methods:
NS_IMETHOD OnCardEntryChange(PRUint32 abCode, nsIAbCard *card, nsIAddrDBListener *instigator);
protected:
nsresult NotifyPropertyChanged(char *property, PRUnichar* oldValue, PRUnichar* newValue);
nsresult AddSubNode(nsAutoString name, nsIAbCard **childDir);
protected:
nsVoidArray *mListeners;
};
#endif

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,113 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Netscape Public License
* Version 1.0 (the "NPL"); you may not use this file except in
* compliance with the NPL. You may obtain a copy of the NPL at
* http://www.mozilla.org/NPL/
*
* Software distributed under the NPL is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
* for the specific language governing rights and limitations under the
* NPL.
*
* The Initial Developer of this code under the NPL is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
* Reserved.
*/
/********************************************************************************************************
Interface for representing Address Book Person Card Property
*********************************************************************************************************/
#ifndef nsAbCardProperty_h__
#define nsAbCardProperty_h__
#include "nsIAbCard.h"
#include "nsISupportsArray.h"
#include "nsVoidArray.h"
#include "nsCOMPtr.h"
#include "nsIAddrDatabase.h"
/*
* Address Book Card Property
*/
class nsAbCardProperty: public nsIAbCard
{
public:
NS_DECL_ISUPPORTS
NS_DECL_NSIABCARD
nsAbCardProperty(void);
virtual ~nsAbCardProperty(void);
// nsIAbCard methods:
protected:
nsresult GetCardDatabase(const char *uri);
nsresult GetAttributeName(PRUnichar **aName, nsString& value);
nsresult SetAttributeName(const PRUnichar *aName, nsString& arrtibute);
nsresult RemoveAnonymousList(nsVoidArray* pArray);
nsresult SetAnonymousAttribute(nsVoidArray** pAttrAray,
nsVoidArray** pValueArray, void *attrname, void *value);
nsString m_FirstName;
nsString m_LastName;
nsString m_DisplayName;
nsString m_NickName;
nsString m_PrimaryEmail;
nsString m_SecondEmail;
nsString m_WorkPhone;
nsString m_HomePhone;
nsString m_FaxNumber;
nsString m_PagerNumber;
nsString m_CellularNumber;
nsString m_HomeAddress;
nsString m_HomeAddress2;
nsString m_HomeCity;
nsString m_HomeState;
nsString m_HomeZipCode;
nsString m_HomeCountry;
nsString m_WorkAddress;
nsString m_WorkAddress2;
nsString m_WorkCity;
nsString m_WorkState;
nsString m_WorkZipCode;
nsString m_WorkCountry;
nsString m_JobTitle;
nsString m_Department;
nsString m_Company;
nsString m_WebPage1;
nsString m_WebPage2;
nsString m_BirthYear;
nsString m_BirthMonth;
nsString m_BirthDay;
nsString m_Custom1;
nsString m_Custom2;
nsString m_Custom3;
nsString m_Custom4;
nsString m_Note;
PRUint32 m_LastModDate;
PRBool m_bSendPlainText;
PRUint32 m_dbTableID;
PRUint32 m_dbRowID;
nsCOMPtr<nsIAddrDatabase> mCardDatabase;
nsVoidArray* m_pAnonymousStrAttributes;
nsVoidArray* m_pAnonymousStrValues;
nsVoidArray* m_pAnonymousIntAttributes;
nsVoidArray* m_pAnonymousIntValues;
nsVoidArray* m_pAnonymousBoolAttributes;
nsVoidArray* m_pAnonymousBoolValues;
};
#endif

View File

@@ -0,0 +1,198 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Netscape Public License
* Version 1.0 (the "NPL"); you may not use this file except in
* compliance with the NPL. You may obtain a copy of the NPL at
* http://www.mozilla.org/NPL/
*
* Software distributed under the NPL is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
* for the specific language governing rights and limitations under the
* NPL.
*
* The Initial Developer of this code under the NPL is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
* Reserved.
*/
#include "nsAbDirProperty.h"
#include "nsIRDFService.h"
#include "nsIRDFResource.h"
#include "nsIServiceManager.h"
#include "nsRDFCID.h"
#include "nsXPIDLString.h"
#include "nsCOMPtr.h"
#include "nsAbBaseCID.h"
#include "nsAbCard.h"
#include "nsAddrDatabase.h"
#include "nsIAbListener.h"
#include "nsIAddrBookSession.h"
#include "mdb.h"
#include "prlog.h"
#include "prprf.h"
#include "prmem.h"
static NS_DEFINE_CID(kRDFServiceCID, NS_RDFSERVICE_CID);
static NS_DEFINE_CID(kAbCardCID, NS_ABCARD_CID);
static NS_DEFINE_CID(kAddressBookDBCID, NS_ADDRDATABASE_CID);
static NS_DEFINE_CID(kAddrBookSessionCID, NS_ADDRBOOKSESSION_CID);
nsAbDirProperty::nsAbDirProperty(void)
: m_DirName(""), m_LastModifiedDate(0),
m_DbPath(nsnull), m_Server(nsnull)
{
NS_INIT_REFCNT();
}
nsAbDirProperty::~nsAbDirProperty(void)
{
PR_FREEIF(m_DbPath);
// m_Server will free with the list
}
NS_IMPL_ADDREF(nsAbDirProperty)
NS_IMPL_RELEASE(nsAbDirProperty)
NS_IMETHODIMP nsAbDirProperty::QueryInterface(REFNSIID aIID, void** aResult)
{
if (aResult == NULL)
return NS_ERROR_NULL_POINTER;
if (aIID.Equals(nsCOMTypeInfo<nsIAbDirectory>::GetIID()) ||
aIID.Equals(nsCOMTypeInfo<nsISupports>::GetIID())) {
*aResult = NS_STATIC_CAST(nsIAbDirectory*, this);
NS_ADDREF_THIS();
return NS_OK;
}
return NS_NOINTERFACE;
}
////////////////////////////////////////////////////////////////////////////////
NS_IMETHODIMP nsAbDirProperty::GetDirFilePath(char **dbPath)
{
if (m_Server && m_Server->fileName)
{
nsresult rv = NS_OK;
nsFileSpec* dbFile = nsnull;
NS_WITH_SERVICE(nsIAddrBookSession, abSession, kAddrBookSessionCID, &rv);
if(NS_SUCCEEDED(rv))
abSession->GetUserProfileDirectory(&dbFile);
(*dbFile) += m_Server->fileName;
char* file = PL_strdup(dbFile->GetCString());
*dbPath = file;
return NS_OK;
}
return NS_ERROR_FAILURE;
}
////////////////////////////////////////////////////////////////////////////////
NS_IMETHODIMP nsAbDirProperty::GetDirName(PRUnichar **aDirName)
{
if (aDirName)
{
*aDirName = m_DirName.ToNewUnicode();
if (!(*aDirName))
return NS_ERROR_OUT_OF_MEMORY;
else
return NS_OK;
}
else
return NS_ERROR_NULL_POINTER;
}
NS_IMETHODIMP nsAbDirProperty::SetDirName(const PRUnichar * aDirName)
{
if (aDirName)
m_DirName = aDirName;
return NS_OK;
}
NS_IMETHODIMP nsAbDirProperty::GetLastModifiedDate(PRUint32 *aLastModifiedDate)
{
if (aLastModifiedDate)
{
*aLastModifiedDate = m_LastModifiedDate;
return NS_OK;
}
else
return NS_RDF_NO_VALUE;
}
NS_IMETHODIMP nsAbDirProperty::SetLastModifiedDate(PRUint32 aLastModifiedDate)
{
if (aLastModifiedDate)
{
m_LastModifiedDate = aLastModifiedDate;
}
return NS_OK;
}
NS_IMETHODIMP nsAbDirProperty::GetServer(DIR_Server * *aServer)
{
if (aServer)
{
*aServer = m_Server;
return NS_OK;
}
else
return NS_ERROR_NULL_POINTER;
}
NS_IMETHODIMP nsAbDirProperty::SetServer(DIR_Server * aServer)
{
m_Server = aServer;
return NS_OK;
}
NS_IMETHODIMP
nsAbDirProperty::GetChildNodes(nsIEnumerator **childList)
{ return NS_OK; }
NS_IMETHODIMP
nsAbDirProperty::GetChildCards(nsIEnumerator **childCards)
{ return NS_OK; }
NS_IMETHODIMP
nsAbDirProperty::AddChildCards(const char *uriName, nsIAbCard **childCard)
{ return NS_OK; }
NS_IMETHODIMP
nsAbDirProperty::AddDirectory(const char *uriName, nsIAbDirectory **childDir)
{ return NS_OK; }
NS_IMETHODIMP
nsAbDirProperty::DeleteDirectories(nsISupportsArray *dierctories)
{ return NS_OK; }
NS_IMETHODIMP
nsAbDirProperty::DeleteCards(nsISupportsArray *cards)
{ return NS_OK; }
NS_IMETHODIMP
nsAbDirProperty::HasCard(nsIAbCard *cards, PRBool *hasCard)
{ return NS_OK; }
NS_IMETHODIMP
nsAbDirProperty::HasDirectory(nsIAbDirectory *dir, PRBool *hasDir)
{ return NS_OK; }
NS_IMETHODIMP
nsAbDirProperty::GetMailingList(nsIEnumerator **mailingList)
{ return NS_OK; }
NS_IMETHODIMP
nsAbDirProperty::CreateNewDirectory(const PRUnichar *dirName, const char *fileName)
{ return NS_OK; }
NS_IMETHODIMP
nsAbDirProperty::GetDirUri(char **uri)
{ return NS_OK; }

View File

@@ -0,0 +1,56 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Netscape Public License
* Version 1.0 (the "NPL"); you may not use this file except in
* compliance with the NPL. You may obtain a copy of the NPL at
* http://www.mozilla.org/NPL/
*
* Software distributed under the NPL is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
* for the specific language governing rights and limitations under the
* NPL.
*
* The Initial Developer of this code under the NPL is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
* Reserved.
*/
/********************************************************************************************************
Interface for representing Address Book Directory
*********************************************************************************************************/
#ifndef nsAbDirProperty_h__
#define nsAbDirProperty_h__
#include "nsIAbDirectory.h" /* include the interface we are going to support */
#include "nsAbRDFResource.h"
#include "nsIAbCard.h"
#include "nsISupportsArray.h"
#include "nsCOMPtr.h"
#include "nsDirPrefs.h"
#include "nsIAbBase.h"
/*
* Address Book Directory
*/
class nsAbDirProperty: public nsIAbDirectory
{
public:
nsAbDirProperty(void);
virtual ~nsAbDirProperty(void);
NS_DECL_ISUPPORTS
NS_DECL_NSIABDIRECTORY
protected:
nsString m_DirName;
PRUint32 m_LastModifiedDate;
nsFileSpec* m_DbPath;
DIR_Server* m_Server;
};
#endif

View File

@@ -0,0 +1,494 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Netscape Public License
* Version 1.0 (the "NPL"); you may not use this file except in
* compliance with the NPL. You may obtain a copy of the NPL at
* http://www.mozilla.org/NPL/
*
* Software distributed under the NPL is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
* for the specific language governing rights and limitations under the
* NPL.
*
* The Initial Developer of this code under the NPL is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
* Reserved.
*/
#include "nsAbDirectory.h"
#include "nsIRDFService.h"
#include "nsIRDFResource.h"
#include "nsIServiceManager.h"
#include "nsRDFCID.h"
#include "nsXPIDLString.h"
#include "nsCOMPtr.h"
#include "nsAbBaseCID.h"
#include "nsAbCard.h"
#include "nsAddrDatabase.h"
#include "nsIAbListener.h"
#include "nsIAddrBookSession.h"
#include "nsIFileSpec.h"
#include "nsIFileLocator.h"
#include "nsFileLocations.h"
#include "mdb.h"
#include "prlog.h"
#include "prprf.h"
#include "prmem.h"
/* The definition is nsAddressBook.cpp */
extern const char *kDirectoryDataSourceRoot;
static NS_DEFINE_CID(kRDFServiceCID, NS_RDFSERVICE_CID);
static NS_DEFINE_CID(kAbCardCID, NS_ABCARD_CID);
static NS_DEFINE_CID(kAddressBookDBCID, NS_ADDRDATABASE_CID);
static NS_DEFINE_CID(kFileLocatorCID, NS_FILELOCATOR_CID);
static NS_DEFINE_CID(kAddrBookSessionCID, NS_ADDRBOOKSESSION_CID);
nsAbDirectory::nsAbDirectory(void)
: nsAbRDFResource(),
mInitialized(PR_FALSE)
{
NS_NewISupportsArray(getter_AddRefs(mSubDirectories));
}
nsAbDirectory::~nsAbDirectory(void)
{
if (mSubDirectories)
{
PRUint32 count;
nsresult rv = mSubDirectories->Count(&count);
NS_ASSERTION(NS_SUCCEEDED(rv), "Count failed");
PRInt32 i;
for (i = count - 1; i >= 0; i--)
mSubDirectories->RemoveElementAt(i);
}
}
NS_IMPL_ISUPPORTS_INHERITED(nsAbDirectory, nsAbRDFResource, nsIAbDirectory)
////////////////////////////////////////////////////////////////////////////////
NS_IMETHODIMP nsAbDirectory::OnCardAttribChange(PRUint32 abCode, nsIAddrDBListener *instigator)
{
return NS_OK;
}
NS_IMETHODIMP nsAbDirectory::OnCardEntryChange
(PRUint32 abCode, nsIAbCard *card, nsIAddrDBListener *instigator)
{
nsresult rv = NS_OK;
if (abCode == AB_NotifyInserted && card)
{
NS_WITH_SERVICE(nsIRDFService, rdf, kRDFServiceCID, &rv);
if(NS_FAILED(rv))
return rv;
char* cardURI = nsnull;
rv = card->GetCardURI(&cardURI);
if (NS_FAILED(rv) || !cardURI)
return NS_ERROR_NULL_POINTER;
nsCOMPtr<nsIRDFResource> res;
rv = rdf->GetResource(cardURI, getter_AddRefs(res));
if(cardURI)
PR_smprintf_free(cardURI);
if (NS_SUCCEEDED(rv))
{
nsCOMPtr<nsIAbCard> personCard = do_QueryInterface(res);
if (personCard)
{
personCard->CopyCard(card);
if (mDatabase)
{
personCard->SetAbDatabase(mDatabase);
nsCOMPtr<nsIAddrDBListener> listener(do_QueryInterface(personCard, &rv));
if (NS_FAILED(rv))
return NS_ERROR_NULL_POINTER;
mDatabase->AddListener(listener);
}
nsCOMPtr<nsISupports> cardSupports(do_QueryInterface(personCard));
if (cardSupports)
NotifyItemAdded(cardSupports);
}
}
}
else if (abCode == AB_NotifyDeleted && card)
{
nsCOMPtr<nsISupports> cardSupports(do_QueryInterface(card, &rv));
if(NS_SUCCEEDED(rv))
NotifyItemDeleted(cardSupports);
}
return NS_OK;
}
NS_IMETHODIMP nsAbDirectory::GetChildNodes(nsIEnumerator* *result)
{
if (!mInitialized)
{
if (!PL_strcmp(mURI, kDirectoryDataSourceRoot) && GetDirList())
{
PRInt32 count = GetDirList()->Count();
/* check: only show personal address book for now */
/* not showing 4.x address book unitl we have the converting done */
PRInt32 i;
for (i = 0; i < count; i++)
{
DIR_Server *server = (DIR_Server *)GetDirList()->ElementAt(i);
if (server->dirType == PABDirectory)
{
nsString name(server->fileName);
PRInt32 pos = name.Find("na2");
if (pos >= 0) /* check: this is a 4.x file, remove when conversion is done */
continue;
char* uriStr = nsnull;
uriStr = PR_smprintf("%s%s", mURI, server->fileName);
if (uriStr == nsnull)
return NS_ERROR_OUT_OF_MEMORY;
nsCOMPtr<nsIAbDirectory> childDir;
AddDirectory(uriStr, getter_AddRefs(childDir));
if (uriStr)
PR_smprintf_free(uriStr);
if (childDir)
{
PRUnichar *unichars = nsnull;
PRInt32 unicharLength = 0;
PRInt32 descLength = PL_strlen(server->description);
INTL_ConvertToUnicode((const char *)server->description,
descLength, (void**)&unichars, &unicharLength);
childDir->SetDirName(unichars);
childDir->SetServer(server);
PR_FREEIF(unichars);
}
}
}
}
mInitialized = PR_TRUE;
}
return mSubDirectories->Enumerate(result);
}
NS_IMETHODIMP nsAbDirectory::AddDirectory(const char *uriName, nsIAbDirectory **childDir)
{
if (!childDir || !uriName)
return NS_ERROR_NULL_POINTER;
nsresult rv = NS_OK;
NS_WITH_SERVICE(nsIRDFService, rdf, kRDFServiceCID, &rv);
if(NS_FAILED(rv))
return rv;
nsCOMPtr<nsIRDFResource> res;
rv = rdf->GetResource(uriName, getter_AddRefs(res));
if (NS_FAILED(rv))
return rv;
nsCOMPtr<nsIAbDirectory> directory(do_QueryInterface(res, &rv));
if (NS_FAILED(rv))
return rv;
mSubDirectories->AppendElement(directory);
*childDir = directory;
NS_IF_ADDREF(*childDir);
return rv;
}
NS_IMETHODIMP nsAbDirectory::GetChildCards(nsIEnumerator* *result)
{
nsresult rv = GetAbDatabase();
if (NS_SUCCEEDED(rv) && mDatabase)
{
rv = mDatabase->EnumerateCards(this, result);
}
return rv;
}
NS_IMETHODIMP nsAbDirectory::GetMailingList(nsIEnumerator **mailingList)
{
nsresult rv = GetAbDatabase();
if (NS_SUCCEEDED(rv) && mDatabase)
{
rv = mDatabase->EnumerateMailingLists(this, mailingList);
}
return rv;
}
NS_IMETHODIMP nsAbDirectory::CreateNewDirectory(const PRUnichar *dirName, const char *fileName)
{
if (!dirName)
return NS_ERROR_NULL_POINTER;
DIR_Server * server = nsnull;
nsresult rv = DIR_AddNewAddressBook(dirName, fileName, &server);
nsCOMPtr<nsIAbDirectory> newDir;
char *uri = PR_smprintf("%s%s", kDirectoryDataSourceRoot, server->fileName);
if (uri)
{
rv = AddDirectory(uri, getter_AddRefs(newDir));
PR_smprintf_free(uri);
if (NS_SUCCEEDED(rv) && newDir)
{
newDir->SetDirName((PRUnichar *)dirName);
newDir->SetServer(server);
// nsCOMPtr<nsISupports> dirSupports(do_QueryInterface(newDir, &rv));
// if (NS_SUCCEEDED(rv))
NotifyItemAdded(newDir);
return rv;
}
else
return NS_ERROR_NULL_POINTER;
}
return NS_ERROR_NULL_POINTER;
}
NS_IMETHODIMP nsAbDirectory::AddChildCards(const char *uriName, nsIAbCard **childCard)
{
if(!childCard)
return NS_ERROR_NULL_POINTER;
nsresult rv = NS_OK;
NS_WITH_SERVICE(nsIRDFService, rdf, kRDFServiceCID, &rv);
if(NS_FAILED(rv))
return rv;
nsAutoString uri(uriName);
char* uriStr = uri.ToNewCString();
if (uriStr == nsnull)
return NS_ERROR_OUT_OF_MEMORY;
nsCOMPtr<nsIRDFResource> res;
rv = rdf->GetResource(uriStr, getter_AddRefs(res));
if (NS_FAILED(rv))
{
delete[] uriStr;
return rv;
}
nsCOMPtr<nsIAbCard> personCard(do_QueryInterface(res, &rv));
if (NS_FAILED(rv))
{
rv = nsComponentManager::CreateInstance(kAbCardCID, nsnull, nsCOMTypeInfo<nsIAbCard>::GetIID(), getter_AddRefs(personCard));
if (NS_FAILED(rv) || !personCard)
{
delete[] uriStr;
return rv;
}
}
nsAllocator::Free(uriStr);
*childCard = personCard;
NS_ADDREF(*childCard);
return rv;
}
NS_IMETHODIMP nsAbDirectory::DeleteCards(nsISupportsArray *cards)
{
nsresult rv = NS_OK;
if (!mDatabase)
rv = GetAbDatabase();
if (NS_SUCCEEDED(rv) && mDatabase)
{
PRUint32 cardCount;
rv = cards->Count(&cardCount);
if (NS_FAILED(rv)) return rv;
for(PRUint32 i = 0; i < cardCount; i++)
{
nsCOMPtr<nsISupports> cardSupports;
nsCOMPtr<nsIAbCard> card;
cardSupports = getter_AddRefs(cards->ElementAt(i));
card = do_QueryInterface(cardSupports, &rv);
if (card)
{
mDatabase->DeleteCard(card, PR_TRUE);
}
}
mDatabase->Commit(kLargeCommit);
}
return rv;
}
nsresult nsAbDirectory::DeleteDirectoryCards(nsIAbDirectory* directory, DIR_Server *server)
{
nsresult rv = NS_OK;
nsFileSpec* dbPath = nsnull;
nsCOMPtr<nsIAddrDatabase> database;
NS_WITH_SERVICE(nsIAddrBookSession, abSession, kAddrBookSessionCID, &rv);
if(NS_SUCCEEDED(rv))
abSession->GetUserProfileDirectory(&dbPath);
if (dbPath)
{
(*dbPath) += server->fileName;
// close file before delete it
NS_WITH_SERVICE(nsIAddrDatabase, addrDBFactory, kAddressBookDBCID, &rv);
if (NS_SUCCEEDED(rv) && addrDBFactory)
rv = addrDBFactory->Open(dbPath, PR_FALSE, getter_AddRefs(database), PR_TRUE);
}
/* delete cards */
nsCOMPtr<nsISupportsArray> cardArray;
nsCOMPtr<nsIEnumerator> cardChild;
NS_NewISupportsArray(getter_AddRefs(cardArray));
rv = directory->GetChildCards(getter_AddRefs(cardChild));
if (NS_SUCCEEDED(rv) && cardChild)
{
nsCOMPtr<nsISupports> item;
rv = cardChild->First();
if (NS_SUCCEEDED(rv))
{
do
{
cardChild->CurrentItem(getter_AddRefs(item));
if (item)
{
nsCOMPtr<nsIAbCard> card;
card = do_QueryInterface(item, &rv);
if (card)
{
cardArray->AppendElement(card);
}
}
rv = cardChild->Next();
} while (NS_SUCCEEDED(rv));
if (database)
{
PRUint32 cardCount;
rv = cardArray->Count(&cardCount);
if (NS_FAILED(rv)) return rv;
for(PRUint32 i = 0; i < cardCount; i++)
{
nsISupports* cardSupports = cardArray->ElementAt(i);
nsIAbCard* card = (nsIAbCard*)cardSupports;
if (card)
{
database->DeleteCard(card, PR_TRUE);
}
}
}
}
}
return rv;
}
NS_IMETHODIMP nsAbDirectory::DeleteDirectories(nsISupportsArray *dierctories)
{
nsresult rv = NS_ERROR_FAILURE;
PRUint32 i, dirCount;
rv = dierctories->Count(&dirCount);
if (NS_FAILED(rv)) return rv;
for (i = 0; i < dirCount; i++)
{
nsCOMPtr<nsISupports> dirSupports;
nsCOMPtr<nsIAbDirectory> directory;
dirSupports = getter_AddRefs(dierctories->ElementAt(i));
directory = do_QueryInterface(dirSupports, &rv);
if (NS_SUCCEEDED(rv) && directory)
{
DIR_Server *server = nsnull;
rv = directory->GetServer(&server);
if (server)
{
DeleteDirectoryCards(directory, server);
DIR_DeleteServerFromList(server);
rv = mSubDirectories->RemoveElement(directory);
NotifyItemDeleted(directory);
}
}
}
return rv;
}
NS_IMETHODIMP nsAbDirectory::HasCard(nsIAbCard *cards, PRBool *hasCard)
{
if(!hasCard)
return NS_ERROR_NULL_POINTER;
nsresult rv = NS_OK;
if (!mDatabase)
rv = GetAbDatabase();
if(NS_SUCCEEDED(rv) && mDatabase)
{
if(NS_SUCCEEDED(rv))
rv = mDatabase->ContainsCard(cards, hasCard);
}
return rv;
}
NS_IMETHODIMP nsAbDirectory::HasDirectory(nsIAbDirectory *dir, PRBool *hasDir)
{
if (!hasDir)
return NS_ERROR_NULL_POINTER;
DIR_Server* dirServer = nsnull;
dir->GetServer(&dirServer);
nsresult rv = DIR_ContainsServer(dirServer, hasDir);
return rv;
}
nsresult nsAbDirectory::NotifyPropertyChanged(char *property, PRUnichar* oldValue, PRUnichar* newValue)
{
return NS_OK;
}
nsresult nsAbDirectory::NotifyItemAdded(nsISupports *item)
{
nsresult rv = NS_OK;
NS_WITH_SERVICE(nsIAddrBookSession, abSession, kAddrBookSessionCID, &rv);
if(NS_SUCCEEDED(rv))
abSession->NotifyDirectoryItemAdded(this, item);
return NS_OK;
}
nsresult nsAbDirectory::NotifyItemDeleted(nsISupports *item)
{
nsresult rv = NS_OK;
NS_WITH_SERVICE(nsIAddrBookSession, abSession, kAddrBookSessionCID, &rv);
if(NS_SUCCEEDED(rv))
abSession->NotifyDirectoryItemDeleted(this, item);
return NS_OK;
}
NS_IMETHODIMP nsAbDirectory::GetDirUri(char **uri)
{
if (uri)
{
if (mURI)
*uri = PL_strdup(mURI);
else
*uri = PL_strdup("");
return NS_OK;
}
else
return NS_RDF_NO_VALUE;
}

Some files were not shown because too many files have changed in this diff Show More