Bug 1273477 - Allow choosing a directory for Becky AB import. ui-r=Paenglab, r=rkent
This commit is contained in:
Родитель
7cf37874b8
Коммит
3c21c444c2
|
@ -49,7 +49,7 @@ NS_IMETHODIMP
|
|||
nsBeckyAddressBooks::GetSupportsMultiple(bool *_retval)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(_retval);
|
||||
*_retval = false;
|
||||
*_retval = true;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -70,6 +70,8 @@ nsBeckyAddressBooks::GetAutoFind(char16_t **aDescription,
|
|||
NS_IMETHODIMP
|
||||
nsBeckyAddressBooks::GetNeedsFieldMap(nsIFile *aLocation, bool *_retval)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(_retval);
|
||||
|
||||
*_retval = false;
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -84,12 +86,18 @@ nsBeckyAddressBooks::FindAddressBookDirectory(nsIFile **aAddressBookDirectory)
|
|||
rv = userDirectory->Append(NS_LITERAL_STRING("AddrBook"));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
bool exists;
|
||||
bool exists = false;
|
||||
rv = userDirectory->Exists(&exists);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
if (!exists)
|
||||
return NS_ERROR_FILE_NOT_FOUND;
|
||||
|
||||
bool isDirectory = false;
|
||||
rv = userDirectory->IsDirectory(&isDirectory);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
if (!isDirectory)
|
||||
return NS_ERROR_FILE_NOT_FOUND;
|
||||
|
||||
userDirectory.forget(aAddressBookDirectory);
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -128,10 +136,13 @@ nsBeckyAddressBooks::CreateAddressBookDescriptor(nsIImportABDescriptor **aDescri
|
|||
bool
|
||||
nsBeckyAddressBooks::IsAddressBookFile(nsIFile *aFile)
|
||||
{
|
||||
if (!aFile)
|
||||
return false;
|
||||
|
||||
nsresult rv;
|
||||
bool isDirectory = false;
|
||||
rv = aFile->IsDirectory(&isDirectory);
|
||||
if (NS_SUCCEEDED(rv) && isDirectory)
|
||||
bool isFile = false;
|
||||
rv = aFile->IsFile(&isFile);
|
||||
if (NS_FAILED(rv) && !isFile)
|
||||
return false;
|
||||
|
||||
nsAutoString name;
|
||||
|
@ -142,6 +153,9 @@ nsBeckyAddressBooks::IsAddressBookFile(nsIFile *aFile)
|
|||
bool
|
||||
nsBeckyAddressBooks::HasAddressBookFile(nsIFile *aDirectory)
|
||||
{
|
||||
if (!aDirectory)
|
||||
return false;
|
||||
|
||||
nsresult rv;
|
||||
bool isDirectory = false;
|
||||
rv = aDirectory->IsDirectory(&isDirectory);
|
||||
|
@ -170,6 +184,9 @@ nsBeckyAddressBooks::HasAddressBookFile(nsIFile *aDirectory)
|
|||
uint32_t
|
||||
nsBeckyAddressBooks::CountAddressBookSize(nsIFile *aDirectory)
|
||||
{
|
||||
if (!aDirectory)
|
||||
return 0;
|
||||
|
||||
nsresult rv;
|
||||
bool isDirectory = false;
|
||||
rv = aDirectory->IsDirectory(&isDirectory);
|
||||
|
@ -205,6 +222,8 @@ nsresult
|
|||
nsBeckyAddressBooks::AppendAddressBookDescriptor(nsIFile *aEntry,
|
||||
nsIMutableArray *aCollected)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aCollected);
|
||||
|
||||
if (!HasAddressBookFile(aEntry))
|
||||
return NS_OK;
|
||||
|
||||
|
|
|
@ -4,7 +4,6 @@
|
|||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
/*
|
||||
|
||||
Interface for importing address books using the standard UI. Address
|
||||
book import occurs in several forms (yuck!).
|
||||
The destination can be 1..n new address books corresponding to the source
|
||||
|
@ -14,7 +13,7 @@
|
|||
added to the supplied address book - this allows the address book UI so provide
|
||||
an import command specific for an individual address book.
|
||||
|
||||
The source can import 1 or mulitple address books.
|
||||
The source can import 1 or multiple address books.
|
||||
The address books can be auto-discoverable or user specified.
|
||||
The address books can require field mapping or not.
|
||||
|
||||
|
|
|
@ -1,8 +1,5 @@
|
|||
function run_test()
|
||||
{
|
||||
if (!("nsIWindowsRegKey" in Ci))
|
||||
return;
|
||||
|
||||
// Due to the import code using nsIAbManager off the main thread, we need
|
||||
// to ensure that it is initialized before we start the main test.
|
||||
let abMgr = Cc["@mozilla.org/abmanager;1"].getService(Ci.nsIAbManager);
|
||||
|
|
Загрузка…
Ссылка в новой задаче