Camino only - Bug 337958 Dragging folder/tab group from Bookmark Bar to tab strip should respect shift toggle. Patch by Chris Lawson <bugzilla@chrislawson.net> r=hwaara sr=pink

This commit is contained in:
stridey%gmail.com 2006-10-27 21:57:34 +00:00
Родитель c9468129dc
Коммит 22d28655e1
5 изменённых файлов: 27 добавлений и 16 удалений

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

@ -353,6 +353,9 @@ typedef enum
// cache the toolbar defaults we parse from a plist
+ (NSArray*) toolbarDefaults;
// Get the load-in-background pref
+ (BOOL)shouldLoadInBackground;
// Accessor to get the proxy icon view
- (PageProxyIcon *)proxyIconView;

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

@ -1130,6 +1130,20 @@ enum BWCOpenDest {
return sToolbarDefaults;
}
// +shouldLoadInBackground
//
// gets the foreground/background tab loading pref
//
+ (BOOL)shouldLoadInBackground
{
BOOL loadInBackground = [[PreferenceManager sharedInstance] getBooleanPref:"browser.tabs.loadInBackground" withSuccess:NULL];
if ([[NSApp currentEvent] modifierFlags] & NSShiftKeyMask)
loadInBackground = !loadInBackground;
return loadInBackground;
}
- (NSArray *)toolbarDefaultItemIdentifiers:(NSToolbar *)toolbar
{
@ -3283,7 +3297,7 @@ enum BWCOpenDest {
if (tabViewItem)
{
NSString* url = [[tabViewItem view] getCurrentURI];
BOOL backgroundLoad = [[PreferenceManager sharedInstance] getBooleanPref:"browser.tabs.loadInBackground" withSuccess:NULL];
BOOL backgroundLoad = [BrowserWindowController shouldLoadInBackground];
[self openNewWindowWithURL:url referrer:nil loadInBackground:backgroundLoad allowPopups:NO];
@ -3507,9 +3521,7 @@ enum BWCOpenDest {
// if we replace all tabs (because we opened a tab group), or we open additional tabs
// with the "focus new tab"-pref on, focus the first new tab.
BOOL loadInBackground = [[PreferenceManager sharedInstance] getBooleanPref:"browser.tabs.loadInBackground" withSuccess:NULL];
if (!((tabPolicy == eAppendTabs) && loadInBackground))
if (!((tabPolicy == eAppendTabs) && [BrowserWindowController shouldLoadInBackground]))
[mTabBrowser selectTabViewItem:tabViewToSelect];
}
@ -4072,7 +4084,7 @@ enum BWCOpenDest {
if ([hrefStr length] == 0)
return;
BOOL loadInBackground = [[PreferenceManager sharedInstance] getBooleanPref:"browser.tabs.loadInBackground" withSuccess:NULL];
BOOL loadInBackground = [BrowserWindowController shouldLoadInBackground];
NSString* referrer = [[mBrowserView getBrowserView] getFocusedURLString];
@ -4162,9 +4174,7 @@ enum BWCOpenDest {
if (modifiers & NSCommandKeyMask) {
BOOL loadInTab = [[PreferenceManager sharedInstance] getBooleanPref:"browser.tabs.opentabfor.middleclick" withSuccess:NULL];
BOOL loadInBG = [[PreferenceManager sharedInstance] getBooleanPref:"browser.tabs.loadInBackground" withSuccess:NULL];
if (modifiers & NSShiftKeyMask)
loadInBG = !loadInBG; // shift key should toggle the foreground/background pref as it does elsewhere
BOOL loadInBG = [BrowserWindowController shouldLoadInBackground];
if (loadInTab)
[self openNewTabWithURL:urlStr referrer:referrer loadInBackground:loadInBG allowPopups:NO setJumpback:NO];
else

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

@ -100,12 +100,10 @@ ContentClickListener::MouseClick(nsIDOMEvent* aEvent)
if ((metaKey && button == 0) || button == 1) {
// The command key is down or we got a middle click. Open the link in a new window or tab.
BOOL useTab = [[PreferenceManager sharedInstance] getBooleanPref:"browser.tabs.opentabfor.middleclick" withSuccess:NULL];
BOOL loadInBackground = [[PreferenceManager sharedInstance] getBooleanPref:"browser.tabs.loadInBackground" withSuccess:NULL];
BOOL loadInBackground = [BrowserWindowController shouldLoadInBackground];
NSString* referrer = [[[mBrowserController getBrowserWrapper] getBrowserView] getFocusedURLString];
if (shiftKey)
loadInBackground = !loadInBackground;
if (useTab)
[mBrowserController openNewTabWithURL: hrefStr referrer:referrer loadInBackground: loadInBackground allowPopups:NO setJumpback:YES];
else

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

@ -430,7 +430,7 @@ static const unsigned int kMaxTitleLength = 50;
{
if ([[NSApp currentEvent] modifierFlags] & NSCommandKeyMask)
{
BOOL backgroundLoad = [[PreferenceManager sharedInstance] getBooleanPref:"browser.tabs.loadInBackground" withSuccess:NULL];
BOOL backgroundLoad = [BrowserWindowController shouldLoadInBackground];
if ([[PreferenceManager sharedInstance] getBooleanPref:"browser.tabs.opentabfor.middleclick" withSuccess:NULL])
[bwc openNewTabWithURL:itemURL referrer:nil loadInBackground:backgroundLoad allowPopups:NO setJumpback:NO];
else

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

@ -189,7 +189,7 @@ static NSString* const kExpandedHistoryStatesDefaultsKey = @"history_expand_stat
return;
}
BOOL loadInBackground = [[PreferenceManager sharedInstance] getBooleanPref:"browser.tabs.loadInBackground" withSuccess:NULL];
BOOL loadInBackground = [BrowserWindowController shouldLoadInBackground];
BOOL openInTabs = [[PreferenceManager sharedInstance] getBooleanPref:"browser.tabs.opentabfor.middleclick" withSuccess:NULL];
BOOL cmdKeyDown = (([[NSApp currentEvent] modifierFlags] & NSCommandKeyMask) != 0);
@ -250,7 +250,7 @@ static NSString* const kExpandedHistoryStatesDefaultsKey = @"history_expand_stat
{
NSArray* itemsArray = [mHistoryOutlineView selectedItems];
BOOL backgroundLoad = [[PreferenceManager sharedInstance] getBooleanPref:"browser.tabs.loadInBackground" withSuccess:NULL];
BOOL backgroundLoad = [BrowserWindowController shouldLoadInBackground];
NSEnumerator* itemsEnum = [itemsArray objectEnumerator];
HistoryItem* curItem;
@ -266,7 +266,7 @@ static NSString* const kExpandedHistoryStatesDefaultsKey = @"history_expand_stat
{
NSArray* itemsArray = [mHistoryOutlineView selectedItems];
BOOL backgroundLoad = [[PreferenceManager sharedInstance] getBooleanPref:"browser.tabs.loadInBackground" withSuccess:NULL];
BOOL backgroundLoad = [BrowserWindowController shouldLoadInBackground];
NSEnumerator* itemsEnum = [itemsArray objectEnumerator];
HistoryItem* curItem;
@ -293,7 +293,7 @@ static NSString* const kExpandedHistoryStatesDefaultsKey = @"history_expand_stat
}
// make new window
BOOL loadNewTabsInBackgroundPref = [[PreferenceManager sharedInstance] getBooleanPref:"browser.tabs.loadInBackground" withSuccess:NULL];
BOOL loadNewTabsInBackgroundPref = [BrowserWindowController shouldLoadInBackground];
NSWindow* behindWindow = nil;
if (loadNewTabsInBackgroundPref)