Finish off bug 294019: when opening a set of urls in tabs, select the first tab that we changed.

This commit is contained in:
smfr%smfr.org 2005-07-21 22:30:13 +00:00
Родитель 19c7d38f76
Коммит 775f7087e0
1 изменённых файлов: 9 добавлений и 2 удалений

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

@ -2648,12 +2648,13 @@ enum BWCOpenDest {
{ {
int curNumTabs = [mTabBrowser numberOfTabViewItems]; int curNumTabs = [mTabBrowser numberOfTabViewItems];
int numItems = (int)[urlArray count]; int numItems = (int)[urlArray count];
int selectedTabIndex = [[mTabBrowser tabViewItems] indexOfObject:[mTabBrowser selectedTabViewItem]]; int selectedTabIndex = [[mTabBrowser tabViewItems] indexOfObject:[mTabBrowser selectedTabViewItem]];
BrowserTabViewItem* tabViewToSelect = nil;
for (int i = 0; i < numItems; i++) for (int i = 0; i < numItems; i++)
{ {
NSString* thisURL = [urlArray objectAtIndex:i]; NSString* thisURL = [urlArray objectAtIndex:i];
BrowserTabViewItem* tabViewItem; BrowserTabViewItem* tabViewItem = nil;
if (tabPolicy == eReplaceTabs && i < curNumTabs) if (tabPolicy == eReplaceTabs && i < curNumTabs)
tabViewItem = [mTabBrowser tabViewItemAtIndex: i]; tabViewItem = [mTabBrowser tabViewItemAtIndex: i];
@ -2666,9 +2667,15 @@ enum BWCOpenDest {
[mTabBrowser addTabViewItem: tabViewItem]; [mTabBrowser addTabViewItem: tabViewItem];
} }
if (!tabViewToSelect)
tabViewToSelect = tabViewItem;
[[tabViewItem view] loadURI: thisURL referrer:nil [[tabViewItem view] loadURI: thisURL referrer:nil
flags: NSLoadFlagsNone activate:(i == 0) allowPopups:inAllowPopups]; flags: NSLoadFlagsNone activate:(i == 0) allowPopups:inAllowPopups];
} }
// select the first tab that we changed
[mTabBrowser selectTabViewItem:tabViewToSelect];
} }
-(void) openURLArrayReplacingTabs:(NSArray*)urlArray closeExtraTabs:(BOOL)closeExtra allowPopups:(BOOL)inAllowPopups -(void) openURLArrayReplacingTabs:(NSArray*)urlArray closeExtraTabs:(BOOL)closeExtra allowPopups:(BOOL)inAllowPopups