merging ab outliner branch to the trunk, not part of the build.

This commit is contained in:
sspitzer%netscape.com 2001-12-20 22:50:14 +00:00
Родитель 04c3315aa3
Коммит 95111cbc0e
9 изменённых файлов: 363 добавлений и 247 удалений

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

@ -52,7 +52,8 @@ interface nsIAbViewListener : nsISupports
interface nsIAbView : nsISupports
{
/**
* returns the actual sortColumn. migration, switching from mozilla to netscape 6.x, etc, could cause
* returns the actual sortColumn. migration, switching from mozilla
* to netscape 6.x, etc, could cause
* the "persisted" sortColumn to be bogus.
*/
wstring init(in string URI, in nsIAbViewListener abViewListener, in wstring sortColumn, in wstring sortDirection);
@ -60,8 +61,8 @@ interface nsIAbView : nsISupports
void sortBy(in wstring sortColumn, in wstring sortDirection);
readonly attribute string URI;
readonly attribute wstring sortColumn;
readonly attribute wstring sortDirection;
readonly attribute AString sortColumn;
readonly attribute AString sortDirection;
readonly attribute nsIAbDirectory directory;
nsIAbCard getCardFromRow(in long row);

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

@ -1,25 +1,38 @@
/* -*- Mode: Java; 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.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/
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* 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 contents of this file are subject to the Mozilla 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/MPL/
*
* The Original Code is Mozilla Communicator client code, released
* March 31, 1998.
* 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 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.
* The Original Code is Mozilla addressbook.
*
* Original Author:
* Seth Spitzer <sspitzer@netscape.com>
*/
* The Initial Developer of the Original Code is
* Seth Spitzer <sspitzer@netscape.com>.
* Portions created by the Initial Developer are Copyright (C) 2001
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
function AbResultsPaneOnClick(event)
{

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

@ -1,26 +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.
Original Author:
Seth Spitzer <sspitzer@netscape.com>
-->
<!-- ***** BEGIN LICENSE BLOCK *****
- Version: MPL 1.1/GPL 2.0/LGPL 2.1
-
- The contents of this file are subject to the Mozilla 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/MPL/
-
- 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 addressbook.
-
- The Initial Developer of the Original Code is
- Seth Spitzer <sspitzer@netscape.com>.
- Portions created by the Initial Developer are Copyright (C) 2001
- the Initial Developer. All Rights Reserved.
-
- Contributor(s):
-
- Alternatively, the contents of this file may be used under the terms of
- either the GNU General Public License Version 2 or later (the "GPL"), or
- the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
- in which case the provisions of the GPL or the LGPL are applicable instead
- of those above. If you wish to allow use of your version of this file only
- under the terms of either the GPL or the LGPL, and not to allow others to
- use your version of this file under the terms of the MPL, indicate your
- decision by deleting the provisions above and replace them with the notice
- and other provisions required by the LGPL or the GPL. If you do not delete
- the provisions above, a recipient may use your version of this file under
- the terms of any one of the MPL, the GPL or the LGPL.
-
- ***** END LICENSE BLOCK ***** -->
<?xml-stylesheet href="chrome://messenger/skin/addressbook/abResultsPane.css" type="text/css"?>
@ -44,38 +57,54 @@ Original Author:
<outlinercol id="GeneratedName" class="sortDirectionIndicator"
persist="hidden ordinal width" flex="1" label="&GeneratedName.label;" primary="true"/>
<splitter class="tree-splitter"/>
<outlinercol id="WorkPhone" class="sortDirectionIndicator"
persist="hidden ordinal width" flex="1" label="&WorkPhone.label;"/>
<splitter class="tree-splitter"/>
<outlinercol id="PrimaryEmail" class="sortDirectionIndicator"
persist="hidden ordinal width" flex="1" label="&PrimaryEmail.label;"/>
<splitter class="tree-splitter"/>
<outlinercol id="WorkPhone" class="sortDirectionIndicator"
persist="hidden ordinal width" flex="1" label="&WorkPhone.label;"/>
<splitter class="tree-splitter"/>
<outlinercol id="Company" class="sortDirectionIndicator"
persist="hidden ordinal width" flex="1" label="&Company.label;"/>
<splitter class="tree-splitter"/>
<outlinercol id="NickName" class="sortDirectionIndicator"
persist="hidden ordinal width" flex="1" label="&NickName.label;"/>
persist="hidden ordinal width"
hiddenbydefault="true"
flex="1" label="&NickName.label;"/>
<splitter class="tree-splitter"/>
<outlinercol id="HomePhone" class="sortDirectionIndicator"
persist="hidden ordinal width" flex="1" label="&HomePhone.label;"/>
persist="hidden ordinal width"
hiddenbydefault="true"
flex="1" label="&HomePhone.label;"/>
<splitter class="tree-splitter"/>
<outlinercol id="FaxNumber" class="sortDirectionIndicator"
persist="hidden ordinal width" flex="1" label="&FaxNumber.label;"/>
persist="hidden ordinal width"
hiddenbydefault="true"
flex="1" label="&FaxNumber.label;"/>
<splitter class="tree-splitter"/>
<outlinercol id="PagerNumber" class="sortDirectionIndicator"
persist="hidden ordinal width" flex="1" label="&PagerNumber.label;"/>
persist="hidden ordinal width"
hiddenbydefault="true"
flex="1" label="&PagerNumber.label;"/>
<splitter class="tree-splitter"/>
<outlinercol id="CellularNumber" class="sortDirectionIndicator"
persist="hidden ordinal width" flex="1" label="&CellularNumber.label;"/>
persist="hidden ordinal width"
hiddenbydefault="true"
flex="1" label="&CellularNumber.label;"/>
<splitter class="tree-splitter"/>
<outlinercol id="SecondEmail" class="sortDirectionIndicator"
persist="hidden ordinal width" flex="1" label="&SecondEmail.label;"/>
persist="hidden ordinal width"
hiddenbydefault="true"
flex="1" label="&SecondEmail.label;"/>
<splitter class="tree-splitter"/>
<outlinercol id="JobTitle" class="sortDirectionIndicator"
persist="hidden ordinal width" flex="1" label="&JobTitle.label;"/>
persist="hidden ordinal width"
hiddenbydefault="true"
flex="1" label="&JobTitle.label;"/>
<splitter class="tree-splitter"/>
<outlinercol id="Department" class="sortDirectionIndicator"
persist="hidden ordinal width" flex="1" label="&Department.label;"/>
persist="hidden ordinal width"
hiddenbydefault="true"
flex="1" label="&Department.label;"/>
</outlinercols>
<outlinerbody flex="1"
onselect="this.parentNode.outlinerBoxObject.view.selectionChanged();"

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

@ -1,25 +1,38 @@
/* -*- Mode: Java; 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.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/
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* 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 contents of this file are subject to the Mozilla 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/MPL/
*
* The Original Code is Mozilla Communicator client code, released
* March 31, 1998.
* 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 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.
* The Original Code is Mozilla addressbook.
*
* Original Author:
* Seth Spitzer <sspitzer@netscape.com>
*/
* The Initial Developer of the Original Code is
* Seth Spitzer <sspitzer@netscape.com>.
* Portions created by the Initial Developer are Copyright (C) 2001
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
function GetAbViewListener()
{
@ -27,19 +40,43 @@ function GetAbViewListener()
return null;
}
function AbPanelLoad()
{
InitCommonJS();
var gAddressBookPanelAbListener = {
onItemAdded: function(parentDir, item) {
// will not be called
},
onItemRemoved: function(parentDir, item) {
// will only be called when an addressbook is deleted
try {
var directory = item.QueryInterface(Components.interfaces.nsIAbDirectory);
// check if the item being removed is the directory
// that we are showing in the addressbook sidebar
// if so, select the person addressbook (it can't be removed)
if (directory == GetAbView().directory) {
var abPopup = document.getElementById('addressbookList');
abPopup.setAttribute("selectedAB", kPersonalAddressbookURI);
LoadPreviouslySelectedAB();
}
}
catch (ex) {
}
},
onItemPropertyChanged: function(item, property, oldValue, newValue) {
// will not be called
}
};
// XXX todo
// can we combine some common code? see OnLoadNewMailList()
// set popup with address book names
function LoadPreviouslySelectedAB()
{
var abPopup = document.getElementById('addressbookList');
if ( abPopup )
{
var menupopup = document.getElementById('addressbookList-menupopup');
var selectedAB = abPopup.getAttribute("selectedAB");
if (!selectedAB.length)
if (!selectedAB)
selectedAB = kPersonalAddressbookURI;
if ( selectedAB && menupopup && menupopup.childNodes )
@ -55,10 +92,24 @@ function AbPanelLoad()
}
}
}
ChangeDirectoryByDOMNode(abPopup.selectedItem);
}
function AbPanelLoad()
{
InitCommonJS();
UpgradeAddressBookResultsPaneUI("mailnews.ui.addressbook_panel_results.version");
LoadPreviouslySelectedAB();
// add a listener, so we can switch directories if
// the current directory is deleted
var addrbookSession = Components.classes["@mozilla.org/addressbook/services/session;1"].getService().QueryInterface(Components.interfaces.nsIAddrBookSession);
// this listener only cares when a directory is removed
addrbookSession.addAddressBookListener(gAddressBookPanelAbListener, Components.interfaces.nsIAbListener.directoryRemoved);
}
function AbPanelOnChange(event)
{
@ -69,6 +120,9 @@ function AbPanelOnChange(event)
function AbPanelUnload()
{
var addrbookSession = Components.classes["@mozilla.org/addressbook/services/session;1"].getService().QueryInterface(Components.interfaces.nsIAddrBookSession);
addrbookSession.removeAddressBookListener(gAddressBookPanelAbListener);
CloseAbView();
}

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

@ -1,25 +1,38 @@
<!--
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.
Original Author:
Seth Spitzer <sspitzer@netscape.com>
-->
<!-- ***** BEGIN LICENSE BLOCK *****
- Version: MPL 1.1/GPL 2.0/LGPL 2.1
-
- The contents of this file are subject to the Mozilla 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/MPL/
-
- 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 addressbook.
-
- The Initial Developer of the Original Code is
- Seth Spitzer <sspitzer@netscape.com>.
- Portions created by the Initial Developer are Copyright (C) 2001
- the Initial Developer. All Rights Reserved.
-
- Contributor(s):
-
- Alternatively, the contents of this file may be used under the terms of
- either the GNU General Public License Version 2 or later (the "GPL"), or
- the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
- in which case the provisions of the GPL or the LGPL are applicable instead
- of those above. If you wish to allow use of your version of this file only
- under the terms of either the GPL or the LGPL, and not to allow others to
- use your version of this file under the terms of the MPL, indicate your
- decision by deleting the provisions above and replace them with the notice
- and other provisions required by the LGPL or the GPL. If you do not delete
- the provisions above, a recipient may use your version of this file under
- the terms of any one of the MPL, the GPL or the LGPL.
-
- ***** END LICENSE BLOCK ***** -->
<!ENTITY GeneratedName.label "Name">
<!ENTITY GeneratedName.accesskey "N">

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

@ -1,4 +1,4 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: NPL 1.1/GPL 2.0/LGPL 2.1
*
@ -65,16 +65,7 @@
static NS_DEFINE_CID(kCollationFactoryCID, NS_COLLATIONFACTORY_CID);
NS_IMPL_ADDREF(nsAbView)
NS_IMPL_RELEASE(nsAbView)
NS_INTERFACE_MAP_BEGIN(nsAbView)
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIAbView)
NS_INTERFACE_MAP_ENTRY(nsIAbView)
NS_INTERFACE_MAP_ENTRY(nsIOutlinerView)
NS_INTERFACE_MAP_ENTRY(nsIAbListener)
NS_INTERFACE_MAP_ENTRY(nsIObserver)
NS_INTERFACE_MAP_END
NS_IMPL_ISUPPORTS4(nsAbView, nsIAbView, nsIOutlinerView, nsIAbListener, nsIObserver);
nsAbView::nsAbView()
{
@ -98,6 +89,8 @@ NS_IMETHODIMP nsAbView::Close()
mURI = "";
mDirectory = nsnull;
mAbViewListener = nsnull;
mOutliner = nsnull;
mOutlinerSelection = nsnull;
nsresult rv = NS_OK;
@ -141,7 +134,7 @@ nsresult nsAbView::RemoveCardAt(PRInt32 row)
NS_IMETHODIMP nsAbView::GetURI(char **aURI)
{
*aURI = nsCRT::strdup(mURI.get());
*aURI = ToNewCString(mURI);
return NS_OK;
}
@ -227,12 +220,13 @@ NS_IMETHODIMP nsAbView::Init(const char *aURI, nsIAbViewListener *abViewListener
rv = EnumerateCards();
NS_ENSURE_SUCCESS(rv, rv);
NS_NAMED_LITERAL_STRING(generatedNameColumnId, GENERATED_NAME_COLUMN_ID);
// see if the persisted sortColumn is valid.
// it may not be, if you migrated from older versions, or switched between
// a mozilla build and a commercial build, which have different columns.
nsAutoString actualSortColumn;
actualSortColumn = colID;
if (nsCRT::strcmp(colID, NS_LITERAL_STRING(GENERATED_NAME_COLUMN_ID).get()) && mCards.Count()) {
if (generatedNameColumnId.Equals(colID) && mCards.Count()) {
nsIAbCard *card = ((AbCard *)(mCards.ElementAt(0)))->card;
nsXPIDLString value;
// XXX todo
@ -241,7 +235,12 @@ NS_IMETHODIMP nsAbView::Init(const char *aURI, nsIAbViewListener *abViewListener
// it might not be. example: _ScreenName is valid in Netscape, but not Mozilla.
rv = GetCardValue(card, colID, getter_Copies(value));
if (NS_FAILED(rv))
actualSortColumn = NS_LITERAL_STRING(GENERATED_NAME_COLUMN_ID).get();
actualSortColumn = generatedNameColumnId.get();
else
actualSortColumn = colID;
}
else {
actualSortColumn = colID;
}
rv = SortBy(actualSortColumn.get(), sortDirection);
@ -250,7 +249,8 @@ NS_IMETHODIMP nsAbView::Init(const char *aURI, nsIAbViewListener *abViewListener
nsCOMPtr<nsIAddrBookSession> abSession = do_GetService(NS_ADDRBOOKSESSION_CONTRACTID, &rv);
NS_ENSURE_SUCCESS(rv,rv);
rv = abSession->AddAddressBookListener(this);
// this listener cares about all events
rv = abSession->AddAddressBookListener(this, nsIAbListener::all);
NS_ENSURE_SUCCESS(rv,rv);
if (mAbViewListener && !mSuppressCountChange) {
@ -258,15 +258,14 @@ NS_IMETHODIMP nsAbView::Init(const char *aURI, nsIAbViewListener *abViewListener
NS_ENSURE_SUCCESS(rv,rv);
}
*result = nsCRT::strdup(actualSortColumn.get());
*result = ToNewUnicode(actualSortColumn);
return NS_OK;
}
NS_IMETHODIMP nsAbView::GetDirectory(nsIAbDirectory **aDirectory)
{
NS_ENSURE_ARG_POINTER(aDirectory);
*aDirectory = mDirectory;
NS_IF_ADDREF(*aDirectory);
NS_IF_ADDREF(*aDirectory = mDirectory);
return NS_OK;
}
@ -320,8 +319,7 @@ NS_IMETHODIMP nsAbView::GetRowCount(PRInt32 *aRowCount)
NS_IMETHODIMP nsAbView::GetSelection(nsIOutlinerSelection * *aSelection)
{
*aSelection = mOutlinerSelection;
NS_IF_ADDREF(*aSelection);
NS_IF_ADDREF(*aSelection = mOutlinerSelection);
return NS_OK;
}
@ -342,17 +340,19 @@ NS_IMETHODIMP nsAbView::GetCellProperties(PRInt32 row, const PRUnichar *colID, n
return NS_OK;
// "G" == "GeneratedName"
if (colID[0] != 'G')
if (colID[0] != PRUnichar('G'))
return NS_OK;
nsIAbCard *card = ((AbCard *)(mCards.ElementAt(row)))->card;
PRBool isMailList = PR_FALSE;
PRBool isMailList;
nsresult rv = card->GetIsMailList(&isMailList);
NS_ENSURE_SUCCESS(rv,rv);
if (isMailList)
properties->AppendElement(mMailListAtom);
if (isMailList) {
rv = properties->AppendElement(mMailListAtom);
NS_ENSURE_SUCCESS(rv,rv);
}
return NS_OK;
}
@ -428,7 +428,7 @@ nsresult nsAbView::GetCardValue(nsIAbCard *card, const PRUnichar *colID, PRUnich
// "G" == "GeneratedName"
// "_" == generic column (like _AimScreenName)
// else, standard column (like PrimaryEmail)
if (colID[0] == 'G') {
if (colID[0] == PRUnichar('G')) {
// XXX todo
// cache the ab session?
nsCOMPtr<nsIAddrBookSession> abSession = do_GetService(NS_ADDRBOOKSESSION_CONTRACTID, &rv);
@ -438,15 +438,10 @@ nsresult nsAbView::GetCardValue(nsIAbCard *card, const PRUnichar *colID, PRUnich
NS_ENSURE_SUCCESS(rv,rv);
}
else {
// XXX todo
// do this conversion once, and cache it?
nsCAutoString column;
column.AssignWithConversion(colID);
if (colID[0] == '_')
rv = mDirectory->GetValueForCard(card, column.get(), _retval);
if (colID[0] == PRUnichar('_'))
rv = mDirectory->GetValueForCard(card, NS_LossyConvertUCS2toASCII(colID).get(), _retval);
else
rv = card->GetCardUnicharValue(column.get(), _retval);
rv = card->GetCardValue(NS_LossyConvertUCS2toASCII(colID).get(), _retval);
}
return rv;
}
@ -559,7 +554,7 @@ inplaceSortCallback(const void *data1, const void *data2, void *privateData)
// PrimaryEmail. use the last primary key as the secondary key.
//
// "Pr" to distinguish "PrimaryEmail" from "PagerNumber"
if (closure->colID[0] == 'P' && closure->colID[1] == 'r') {
if (closure->colID[0] == PRUnichar('P') && closure->colID[1] == PRUnichar('r')) {
sortValue = closure->abView->CompareCollationKeys(card1->secondaryCollationKey,card1->secondaryCollationKeyLen,card2->secondaryCollationKey,card2->secondaryCollationKeyLen);
if (sortValue)
return sortValue * closure->factor;
@ -667,7 +662,7 @@ NS_IMETHODIMP nsAbView::SortBy(const PRUnichar *colID, const PRUnichar *sortDir)
rv = InvalidateOutliner(ALL_ROWS);
NS_ENSURE_SUCCESS(rv,rv);
return NS_OK;
return rv;
}
PRInt32 nsAbView::CompareCollationKeys(PRUint8 *key1, PRUint32 len1, PRUint8 *key2, PRUint32 len2)
@ -872,6 +867,7 @@ PRInt32 nsAbView::FindIndexForInsert(AbCard *abcard)
NS_IMETHODIMP nsAbView::OnItemRemoved(nsISupports *parentDir, nsISupports *item)
{
nsresult rv;
nsCOMPtr <nsIAbDirectory> directory = do_QueryInterface(parentDir,&rv);
NS_ENSURE_SUCCESS(rv,rv);
@ -1006,11 +1002,9 @@ NS_IMETHODIMP nsAbView::OnItemPropertyChanged(nsISupports *item, const char *pro
mSuppressCountChange = PR_FALSE;
// ensure restored selection is visible
if (cardWasSelected) {
if (mOutliner)
if (cardWasSelected && mOutliner)
mOutliner->EnsureRowIsVisible(index);
}
}
return NS_OK;
}
@ -1023,15 +1017,15 @@ NS_IMETHODIMP nsAbView::SelectAll()
return NS_OK;
}
NS_IMETHODIMP nsAbView::GetSortDirection(PRUnichar **direction)
NS_IMETHODIMP nsAbView::GetSortDirection(nsAWritableString & aDirection)
{
*direction = nsCRT::strdup(mSortDirection.get());
aDirection = mSortDirection;
return NS_OK;
}
NS_IMETHODIMP nsAbView::GetSortColumn(PRUnichar **column)
NS_IMETHODIMP nsAbView::GetSortColumn(nsAWritableString & aColumn)
{
*column = nsCRT::strdup(mSortColumn.get());
aColumn = mSortColumn;
return NS_OK;
}
@ -1085,7 +1079,7 @@ NS_IMETHODIMP nsAbView::DeleteSelectedCards()
rv = mDirectory->DeleteCards(cardsToDelete);
NS_ENSURE_SUCCESS(rv,rv);
return NS_OK;
return rv;
}
nsresult nsAbView::GetSelectedCards(nsISupportsArray **selectedCards)
@ -1094,17 +1088,15 @@ nsresult nsAbView::GetSelectedCards(nsISupportsArray **selectedCards)
if (!mOutlinerSelection)
return NS_OK;
nsresult rv = NS_NewISupportsArray(selectedCards);
NS_ENSURE_SUCCESS(rv,rv);
PRInt32 selectionCount;
rv = mOutlinerSelection->GetRangeCount(&selectionCount);
nsresult rv = mOutlinerSelection->GetRangeCount(&selectionCount);
NS_ENSURE_SUCCESS(rv,rv);
if (!selectionCount)
return NS_OK;
NS_NewISupportsArray(selectedCards);
rv = NS_NewISupportsArray(selectedCards);
NS_ENSURE_SUCCESS(rv,rv);
for (PRInt32 i = 0; i < selectionCount; i++)
{

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

@ -40,6 +40,7 @@
#define _nsAbView_H_
#include "nsISupports.h"
#include "nsString.h"
#include "nsIAbView.h"
#include "nsIOutlinerView.h"
#include "nsIOutlinerBoxObject.h"

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

@ -1,25 +1,39 @@
/*
* 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/
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* 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 contents of this file are subject to the Mozilla 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/MPL/
*
* The Original Code is Mozilla Communicator client code, released
* March 31, 1998.
* 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 Initial Developer of the Original Code is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998-2001 Netscape Communications Corporation. All
* Rights Reserved.
* The Original Code is Mozilla addressbook.
*
* Original Author:
* Seth Spitzer <sspitzer@netscape.com>
*/
* The Initial Developer of the Original Code is
* Seth Spitzer <sspitzer@netscape.com>.
* Portions created by the Initial Developer are Copyright (C) 2001
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Joe Hewitt <hewitt@netscape.com>
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
@namespace url("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul");

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

@ -1,26 +1,25 @@
/* ***** BEGIN LICENSE BLOCK *****
* Version: NPL 1.1/GPL 2.0/LGPL 2.1
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* 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/
* The contents of this file are subject to the Mozilla 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/MPL/
*
* 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.org code.
* The Original Code is Mozilla addressbook.
*
* The Initial Developer of the Original Code is
* Netscape Communications Corporation.
* Portions created by the Initial Developer are Copyright (C) 1998
* Seth Spitzer <sspitzer@netscape.com>.
* Portions created by the Initial Developer are Copyright (C) 2001
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Joe Hewitt <hewitt@netscape.com>
* Seth Spitzer <sspitzer@netscape.com>
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
@ -28,11 +27,11 @@
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the NPL, indicate your
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the NPL, the GPL or the LGPL.
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */