check in the rest of unified toolbar files, also fix for 185985. sr=pink

This commit is contained in:
joshmoz%gmail.com 2005-05-21 08:48:58 +00:00
Родитель 0cef8134b7
Коммит 74ed88d50b
4 изменённых файлов: 29 добавлений и 31 удалений

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

@ -503,7 +503,7 @@ const int kReuseWindowOnAE = 2;
else if (openInNewTab)
[browserWindowController openURLArray:[(BookmarkFolder *)item childURLs] replaceExistingTabs:NO allowPopups:YES];
else
[browserWindowController openURLArrayReplacingTabs:[(BookmarkFolder *)item childURLs] closeExtraTabs:[item isGroup] allowPopups:YES];
[browserWindowController openURLArrayReplacingTabs:[(BookmarkFolder *)item childURLs] closeExtraTabs:[(BookmarkFolder *)item isGroup] allowPopups:YES];
}
}

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

@ -113,7 +113,7 @@ enum {
-(void) buildFlatFolderList:(NSMenu *)menu depth:(unsigned)pad;
// searching
-(NSArray *) resolveKeyword:(NSString *)aString;
-(NSArray*)resolveKeyword:(NSString *)keyword withArgs:(NSString *)args;
-(NSSet *) bookmarksWithString:(NSString *)searchString inFieldWithTag:(int)tag;
- (BOOL)containsChildItem:(BookmarkItem*)inItem;

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

@ -685,43 +685,29 @@ NSString* const BookmarkFolderDockMenuChangeNotificaton = @"bf_dmc";
//
// searching/keywords processing
//
-(NSArray *)resolveKeyword:(NSString *)aString
-(NSArray*)resolveKeyword:(NSString *)keyword withArgs:(NSString *)args
{
// see if it's us
if ([[self keyword] isEqualToString:aString])
return [self childURLs];
// see if it's us after an expansion
NSRange spaceRange = [aString rangeOfString:@" "];
NSString *firstWord = nil;
NSString *secondWord = nil;
if (spaceRange.location != NSNotFound) {
firstWord = [aString substringToIndex:spaceRange.location];
secondWord = [aString substringFromIndex:(spaceRange.location + spaceRange.length)];
if ([[self keyword] isEqualToString:firstWord]) {
NSMutableArray *urlArray = (NSMutableArray *)[self childURLs];
int i, j=[urlArray count];
for (i = 0; i < j; i++) {
NSString *newURL = [self expandKeyword:secondWord inString:[urlArray objectAtIndex:i]];
[urlArray replaceObjectAtIndex:i withObject:newURL];
}
return urlArray;
if ([[self keyword] isEqualToString:keyword]) {
NSMutableArray *urlArray = (NSMutableArray *)[self childURLs];
int i, j=[urlArray count];
for (i = 0; i < j; i++) {
NSString *newURL = [self expandKeyword:args inString:[urlArray objectAtIndex:i]];
[urlArray replaceObjectAtIndex:i withObject:newURL];
}
return urlArray;
}
// see if it's one of our kids
NSArray *childArray = nil;
NSEnumerator* enumerator = [[self childArray] objectEnumerator];
id aKid;
while ((aKid = [enumerator nextObject])) {
if ([aKid isKindOfClass:[Bookmark class]]) {
if ([[aKid keyword] isEqualToString:aString])
return [NSArray arrayWithObject:[aKid url]];
if (firstWord) {
if ([[aKid keyword] isEqualToString:firstWord])
return [NSArray arrayWithObject:[self expandKeyword:secondWord inString:[aKid url]]];
}
if ([[aKid keyword] isEqualToString:keyword])
return [NSArray arrayWithObject:[self expandKeyword:args inString:[aKid url]]];
}
else if ([aKid isKindOfClass:[BookmarkFolder class]]) {
childArray = [aKid resolveKeyword:aString];
// recurse into sub-folders
NSArray *childArray = [aKid resolveKeyword:keyword withArgs:(NSString *)args];
if (childArray)
return childArray;
}
@ -781,7 +767,7 @@ NSString* const BookmarkFolderDockMenuChangeNotificaton = @"bf_dmc";
if ([curChild isKindOfClass:[BookmarkFolder class]])
{
if ([curChild containsChildItem:inItem])
if ([(BookmarkFolder *)curChild containsChildItem:inItem])
return YES;
}
}

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

@ -424,8 +424,20 @@ static unsigned gFirstUserCollection = 0;
-(NSArray *)resolveBookmarksKeyword:(NSString *)keyword
{
NSArray *resolvedArray = nil;
if (![keyword isEqualToString:@""])
resolvedArray = [[self rootBookmarks] resolveKeyword:keyword];
if (![keyword isEqualToString:@""]) {
NSRange spaceRange = [keyword rangeOfString:@" "];
NSString *firstWord = nil;
NSString *secondWord = nil;
if (spaceRange.location != NSNotFound) {
firstWord = [keyword substringToIndex:spaceRange.location];
secondWord = [keyword substringFromIndex:(spaceRange.location + spaceRange.length)];
}
else {
firstWord = keyword;
secondWord = @"";
}
resolvedArray = [[self rootBookmarks] resolveKeyword:firstWord withArgs:secondWord];
}
if (resolvedArray)
return resolvedArray;
return [NSArray arrayWithObject:keyword];