Monotone-Parent: 1ed4bccebed155143bf812c74cb29f69ccb51f7d

Monotone-Revision: 38830b89dba3fbe47ce03c0a4617768116eda22b

Monotone-Author: wsourdeau@inverse.ca
Monotone-Date: 2010-10-26T20:19:37
Monotone-Branch: ca.inverse.sogo
maint-2.0.2
Wolfgang Sourdeau 2010-10-26 20:19:37 +00:00
parent 90a40362af
commit 00fe3ec6dd
25 changed files with 62 additions and 55 deletions

View File

@ -1,5 +1,15 @@
2010-10-26 Wolfgang Sourdeau <wsourdeau@inverse.ca>
* SoObjects/Contacts/SOGoContactSourceFolder.m
(-lookupContactsWithFilter:onCriteria:sortBy:ordering:): added the
handling of the new "criteria" parameter, returning an empty set
if no known one has been passed.
* SoObjects/Contacts/SOGoContactGCSFolder.m
(-lookupContactsWithFilter:onCriteria:sortBy:ordering:): added the
handling of the new "criteria" parameter, returning an empty set
if no known one has been passed.
* OGoContentStore/OCSContactFieldExtractor.m
(-extractQuickFieldsFromVCard:): we now extract the list of
categories from the vcard.

View File

@ -43,6 +43,7 @@
@protocol SOGoContactFolder <NSObject>
- (NSArray *) lookupContactsWithFilter: (NSString *) filter
onCriteria: (NSString *) criteria
sortBy: (NSString *) sortKey
ordering: (NSComparisonResult) sortOrdering;
- (NSDictionary *) lookupContactWithName: (NSString *) aName;

View File

@ -169,21 +169,33 @@ static NSArray *folderListingFields = nil;
}
- (EOQualifier *) _qualifierForFilter: (NSString *) filter
onCriteria: (NSString *) criteria
{
NSString *qs;
EOQualifier *qualifier;
if (filter && [filter length] > 0)
if ([filter length] > 0)
{
filter = [[filter stringByReplacingString: @"\\" withString: @"\\\\"]
stringByReplacingString: @"'" withString: @"\\'\\'"];
qs = [NSString stringWithFormat:
@"(c_sn isCaseInsensitiveLike: '%%%@%%') OR "
@"(c_givenname isCaseInsensitiveLike: '%%%@%%') OR "
@"(c_cn isCaseInsensitiveLike: '%%%@%%') OR "
@"(c_mail isCaseInsensitiveLike: '%%%@%%')",
filter, filter, filter, filter];
qualifier = [EOQualifier qualifierWithQualifierFormat: qs];
stringByReplacingString: @"'" withString: @"\\'\\'"];
if ([criteria isEqualToString: @"name_or_address"])
qs = [NSString stringWithFormat:
@"(c_sn isCaseInsensitiveLike: '%%%@%%') OR "
@"(c_givenname isCaseInsensitiveLike: '%%%@%%') OR "
@"(c_cn isCaseInsensitiveLike: '%%%@%%') OR "
@"(c_mail isCaseInsensitiveLike: '%%%@%%')",
filter, filter, filter, filter];
else if ([criteria isEqualToString: @"category"])
qs = [NSString stringWithFormat:
@"(c_categories isCaseInsensitiveLike: '%%%@%%')",
filter];
else
qs = @"(1 == 0)";
if (qs)
qualifier = [EOQualifier qualifierWithQualifierFormat: qs];
else
qualifier = nil;
}
else
qualifier = nil;
@ -264,6 +276,7 @@ static NSArray *folderListingFields = nil;
}
- (NSArray *) lookupContactsWithFilter: (NSString *) filter
onCriteria: (NSString *) criteria
sortBy: (NSString *) sortKey
ordering: (NSComparisonResult) sortOrdering
{
@ -271,7 +284,7 @@ static NSArray *folderListingFields = nil;
EOQualifier *qualifier;
EOSortOrdering *ordering;
qualifier = [self _qualifierForFilter: filter];
qualifier = [self _qualifierForFilter: filter onCriteria: criteria];
dbRecords = [[self ocsFolder] fetchFields: folderListingFields
matchingQualifier: qualifier];

View File

@ -243,6 +243,7 @@
}
- (NSArray *) lookupContactsWithFilter: (NSString *) filter
onCriteria: (NSString *) criteria
sortBy: (NSString *) sortKey
ordering: (NSComparisonResult) sortOrdering
{
@ -251,7 +252,7 @@
result = nil;
if (filter && [filter length] > 0)
if ([filter length] > 0 && [criteria isEqualToString: @"name_or_address"])
{
records = [source fetchContactsMatching: filter];
[childRecords setObjects: records

View File

@ -100,8 +100,9 @@
{
currentFilter = [filters objectAtIndex: count];
contacts = [[(id<SOGoContactFolder>)self lookupContactsWithFilter: [[currentFilter allValues] lastObject]
sortBy: @"c_givenname"
ordering: NSOrderedDescending]
onCriteria: @"name_or_address"
sortBy: @"c_givenname"
ordering: NSOrderedDescending]
objectEnumerator];
while ((contact = [contacts nextObject]))

View File

@ -270,6 +270,7 @@ Class SOGoContactSourceFolderKlass = Nil;
filter = @".";
resultEntries
= [folder lookupContactsWithFilter: filter
onCriteria: @"name_or_address"
sortBy: @"c_cn"
ordering: NSOrderedAscending];
}

View File

@ -58,6 +58,7 @@
"htmlMailFormat_TRUE" = "HTML";
"Name or Email" = "Nome ou Email";
"Category" = "Category";
"Personal Addressbook" = "Catálogo Pessoal";
"Search in Addressbook" = "Localizar no Catálogo";

View File

@ -58,6 +58,7 @@
"htmlMailFormat_TRUE" = "HTML";
"Name or Email" = "Nom o correu";
"Category" = "Category";
"Personal Addressbook" = "Llibre personal d'adreces";
"Search in Addressbook" = "Buscar en la llibreta";

View File

@ -58,6 +58,7 @@
"htmlMailFormat_TRUE" = "HTML";
"Name or Email" = "Jméno nebo e-mail";
"Category" = "Category";
"Personal Addressbook" = "Osobní kontakty";
"Search in Addressbook" = "Vyhledávat v kontaktech";

View File

@ -58,6 +58,7 @@
"htmlMailFormat_TRUE" = "HTML";
"Name or Email" = "Naam of E-mail";
"Category" = "Category";
"Personal Addressbook" = "Persoonlijk adresboek";
"Search in Addressbook" = "Adresboek doorzoeken...";

View File

@ -58,6 +58,7 @@
"htmlMailFormat_TRUE" = "HTML";
"Name or Email" = "Name or Email";
"Category" = "Category";
"Personal Addressbook" = "Personal Addressbook";
"Search in Addressbook" = "Search in Addressbook";

View File

@ -58,6 +58,7 @@
"htmlMailFormat_TRUE" = "HTML";
"Name or Email" = "Le nom ou l'adresse";
"Category" = "La catégorie";
"Personal Addressbook" = "Adresses personnelles";
"Search in Addressbook" = "Carnet d'adresses...";

View File

@ -57,6 +57,7 @@
"htmlMailFormat_TRUE" = "HTML";
"Name or Email" = "Name oder E-Mail";
"Category" = "Category";
"Personal Addressbook" = "Persönliches Adressbuch";
"Search in Addressbook" = "Im Adressbuch suchen ...";

View File

@ -58,6 +58,7 @@
"htmlMailFormat_TRUE" = "HTML";
"Name or Email" = "Név vagy email";
"Category" = "Category";
"Personal Addressbook" = "Személyes címjegyzék";
"Search in Addressbook" = "Keresés a címjegyzékben";

View File

@ -58,6 +58,7 @@
"htmlMailFormat_TRUE" = "HTML";
"Name or Email" = "Nome o indirizzo Email";
"Category" = "Category";
"Personal Addressbook" = "Rubrica personale";
"Search in Addressbook" = "Cerca nella rubrica";

View File

@ -58,6 +58,7 @@
"htmlMailFormat_TRUE" = "HTML";
"Name or Email" = "Nazwa lub e-mail";
"Category" = "Category";
"Personal Addressbook" = "Osobista książka adresowa";
"Search in Addressbook" = "Szukaj w książce adresowej";

View File

@ -52,6 +52,7 @@
"htmlMailFormat_TRUE" = "HTML";
"Name or Email" = "Name or Email";
"Category" = "Category";
"Personal Addressbook" = "Personal Addressbook";
"Search in Addressbook" = "Search in Addressbook";

View File

@ -58,6 +58,7 @@
"htmlMailFormat_TRUE" = "HTML";
"Name or Email" = "Nombre o correo";
"Category" = "Category";
"Personal Addressbook" = "Libre personal de direcciones";
"Search in Addressbook" = "Buscar en libreta";

View File

@ -58,6 +58,7 @@
"htmlMailFormat_TRUE" = "HTML";
"Name or Email" = "Namn eller e-post";
"Category" = "Category";
"Personal Addressbook" = "Personlig adressbok";
"Search in Addressbook" = "Sök i adressbok";

View File

@ -113,45 +113,6 @@
return (selectorComponentClass != nil);
}
- (void) _fillResults: (NSMutableDictionary *) results
inFolder: (id <SOGoContactFolder>) folder
withSearchOn: (NSString *) contact
{
NSEnumerator *folderResults;
NSDictionary *currentContact;
NSString *uid;
folderResults = [[folder lookupContactsWithFilter: contact
sortBy: @"cn"
ordering: NSOrderedAscending] objectEnumerator];
currentContact = [folderResults nextObject];
while (currentContact)
{
uid = [currentContact objectForKey: @"c_uid"];
if (uid && ![results objectForKey: uid])
[results setObject: currentContact forKey: uid];
currentContact = [folderResults nextObject];
}
}
- (NSString *) _emailForResult: (NSDictionary *) result
{
NSMutableString *email;
NSString *name, *mail;
email = [NSMutableString string];
name = [result objectForKey: @"displayName"];
if (![name length])
name = [result objectForKey: @"cn"];
mail = [result objectForKey: @"mail"];
if ([name length])
[email appendFormat: @"%@ <%@>", name, mail];
else
[email appendString: mail];
return email;
}
- (id <WOActionResults>) allContactSearchAction
{
id <WOActionResults> result;
@ -199,6 +160,7 @@
folder = [sortedFolders objectAtIndex: i];
//NSLog(@" Address book: %@ (%@)", [folder displayName], [folder class]);
contacts = [folder lookupContactsWithFilter: searchText
onCriteria: @"name_or_address"
sortBy: @"c_cn"
ordering: NSOrderedAscending];
for (j = 0; j < [contacts count]; j++)

View File

@ -112,8 +112,9 @@
[contactInfos release];
contactInfos = [folder lookupContactsWithFilter: valueText
sortBy: [self sortKey]
ordering: ordering];
onCriteria: searchText
sortBy: [self sortKey]
ordering: ordering];
[contactInfos retain];
}
@ -145,6 +146,7 @@
uniqueContacts = [NSMutableDictionary dictionary];
contacts = [folder lookupContactsWithFilter: searchText
onCriteria: @"name_or_address"
sortBy: @"c_cn"
ordering: NSOrderedAscending];
for (i = 0; i < [contacts count]; i++)

View File

@ -55,6 +55,7 @@
"htmlMailFormat_TRUE" = "HTML";
"Name or Email" = "Ім’я або адреса електронної пошти";
"Category" = "Category";
"Personal Addressbook" = "Особиста адресна книга";
"Search in Addressbook" = "Шукати в адресній книзі";

View File

@ -52,6 +52,7 @@
"htmlMailFormat_TRUE" = "HTML";
"Name or Email" = "Enw neu Ebost";
"Category" = "Category";
"Personal Addressbook" = "Llyfr Cyfeiriadau Personol";
"Search in Addressbook" = "Chwilio yn Llyfr Cyfeiriadau";

View File

@ -9,6 +9,7 @@
<ul id="searchOptions" class="choiceMenu">
<li id="name_or_address"><var:string
label:value="Name or Email"/></li>
<li id="category"><var:string label:value="Category"/></li>
</ul>
</div>

View File

@ -1125,7 +1125,7 @@ function getMenus() {
"-", onMenuDeleteContact, "-",
"moveContactMenu", "copyContactMenu",
onMenuExportContact);
menus["searchMenu"] = new Array(setSearchCriteria);
menus["searchMenu"] = new Array(setSearchCriteria, setSearchCriteria);
var contactFoldersMenu = $("contactFoldersMenu");
if (contactFoldersMenu)