зеркало из https://github.com/mozilla/pjs.git
Added a dialog on launch to allow the user to set Camino as their default browser (with a "Don't ask again" checkbox), and code to silently update default browser from org.mozilla.navigator to org.mozilla.camino if necessary.
Added a checkbox to the prefs to turn the default browser checking on and off. Moved all the default browser code into an NSWorkspace category, so it can be called from the app and pref panels. Compressed some of the pref panel tiff images.
This commit is contained in:
Родитель
1b34d592d9
Коммит
c5b84967d6
|
@ -955,6 +955,48 @@
|
|||
//0F2
|
||||
//0F3
|
||||
//0F4
|
||||
0F08FB1408D37DA90022DD45 = {
|
||||
fileEncoding = 30;
|
||||
isa = PBXFileReference;
|
||||
lastKnownFileType = sourcecode.c.h;
|
||||
name = "NSWorkspace+Utils.h";
|
||||
path = "src/extensions/NSWorkspace+Utils.h";
|
||||
refType = 2;
|
||||
sourceTree = SOURCE_ROOT;
|
||||
};
|
||||
0F08FB1508D37DA90022DD45 = {
|
||||
fileRef = 0F08FB1408D37DA90022DD45;
|
||||
isa = PBXBuildFile;
|
||||
settings = {
|
||||
};
|
||||
};
|
||||
0F08FB1608D37DA90022DD45 = {
|
||||
fileRef = 0F08FB1408D37DA90022DD45;
|
||||
isa = PBXBuildFile;
|
||||
settings = {
|
||||
};
|
||||
};
|
||||
0F08FB1708D37DB30022DD45 = {
|
||||
fileEncoding = 30;
|
||||
isa = PBXFileReference;
|
||||
lastKnownFileType = sourcecode.c.objc;
|
||||
name = "NSWorkspace+Utils.m";
|
||||
path = "src/extensions/NSWorkspace+Utils.m";
|
||||
refType = 2;
|
||||
sourceTree = SOURCE_ROOT;
|
||||
};
|
||||
0F08FB1808D37DB30022DD45 = {
|
||||
fileRef = 0F08FB1708D37DB30022DD45;
|
||||
isa = PBXBuildFile;
|
||||
settings = {
|
||||
};
|
||||
};
|
||||
0F08FB1908D37DB30022DD45 = {
|
||||
fileRef = 0F08FB1708D37DB30022DD45;
|
||||
isa = PBXBuildFile;
|
||||
settings = {
|
||||
};
|
||||
};
|
||||
0F0AD72C08CA3682002782ED = {
|
||||
children = (
|
||||
0F0AD72D08CA3682002782ED,
|
||||
|
@ -3437,6 +3479,7 @@
|
|||
0F84BF1808862E4B00E23BC4,
|
||||
0FC4B33E08941B4F009C5F41,
|
||||
0F222C6108C6102B00B34F14,
|
||||
0F08FB1508D37DA90022DD45,
|
||||
);
|
||||
isa = PBXHeadersBuildPhase;
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
|
@ -4583,6 +4626,7 @@
|
|||
0F222C6408C6103300B34F14,
|
||||
0FE7712B08C7C42F00AFB850,
|
||||
0FDEEA3B08CBD04200754D9B,
|
||||
0F08FB1808D37DB30022DD45,
|
||||
);
|
||||
isa = PBXSourcesBuildPhase;
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
|
@ -7319,6 +7363,7 @@
|
|||
0F84BF1708862E4B00E23BC4,
|
||||
0FC4B33F08941B4F009C5F41,
|
||||
0F222C6208C6102B00B34F14,
|
||||
0F08FB1608D37DA90022DD45,
|
||||
);
|
||||
isa = PBXHeadersBuildPhase;
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
|
@ -8472,6 +8517,7 @@
|
|||
0F222C6508C6103300B34F14,
|
||||
0FE7712C08C7C42F00AFB850,
|
||||
0FDEEA3C08CBD04200754D9B,
|
||||
0F08FB1908D37DB30022DD45,
|
||||
);
|
||||
isa = PBXSourcesBuildPhase;
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
|
@ -16190,6 +16236,7 @@
|
|||
F558099D02F22168015DF512,
|
||||
0F84BF1608862E4B00E23BC4,
|
||||
F527C90203BCD43601A80166,
|
||||
0F08FB1408D37DA90022DD45,
|
||||
0FBC0EE20798FA2700E8E0E2,
|
||||
3FF08F0606E7CF9C001C9B19,
|
||||
3FF08F0706E7CF9C001C9B19,
|
||||
|
@ -16224,6 +16271,7 @@
|
|||
0F84BF1208862E3E00E23BC4,
|
||||
3FE4ECE9082C2D89003BF39E,
|
||||
F527C90303BCD43601A80166,
|
||||
0F08FB1708D37DB30022DD45,
|
||||
0FBC0EDF0798FA1900E8E0E2,
|
||||
3FF08EFD06E7CF86001C9B19,
|
||||
3FF08EFE06E7CF86001C9B19,
|
||||
|
|
Двоичные данные
camino/PreferencePanes/Appearance/Appearance.tiff
Двоичные данные
camino/PreferencePanes/Appearance/Appearance.tiff
Двоичный файл не отображается.
Двоичные данные
camino/PreferencePanes/Downloads/Downloads.tiff
Двоичные данные
camino/PreferencePanes/Downloads/Downloads.tiff
Двоичный файл не отображается.
Двоичные данные
camino/PreferencePanes/History/History.tiff
Двоичные данные
camino/PreferencePanes/History/History.tiff
Двоичный файл не отображается.
|
@ -17,6 +17,7 @@
|
|||
CLASS = OrgMozillaChimeraPreferenceNavigation;
|
||||
LANGUAGE = ObjC;
|
||||
OUTLETS = {
|
||||
checkboxCheckDefaultBrowserOnLaunch = NSButton;
|
||||
checkboxNewTabBlank = NSButton;
|
||||
checkboxNewWindowBlank = NSButton;
|
||||
defaultBrowserPopUp = NSPopUpButton;
|
||||
|
|
Двоичные данные
camino/PreferencePanes/Navigation/English.lproj/Navigation.nib/keyedobjects.nib
сгенерированный
Двоичные данные
camino/PreferencePanes/Navigation/English.lproj/Navigation.nib/keyedobjects.nib
сгенерированный
Двоичный файл не отображается.
|
@ -41,11 +41,12 @@
|
|||
|
||||
@interface OrgMozillaChimeraPreferenceNavigation : PreferencePaneBase
|
||||
{
|
||||
IBOutlet NSTextField *textFieldHomePage;
|
||||
IBOutlet NSTextField* textFieldHomePage;
|
||||
|
||||
IBOutlet NSButton *checkboxNewTabBlank;
|
||||
IBOutlet NSButton *checkboxNewWindowBlank;
|
||||
IBOutlet NSPopUpButton *defaultBrowserPopUp;
|
||||
IBOutlet NSButton* checkboxNewTabBlank;
|
||||
IBOutlet NSButton* checkboxNewWindowBlank;
|
||||
IBOutlet NSPopUpButton* defaultBrowserPopUp;
|
||||
IBOutlet NSButton* checkboxCheckDefaultBrowserOnLaunch;
|
||||
}
|
||||
|
||||
- (IBAction)checkboxStartPageClicked:(id)sender;
|
||||
|
|
|
@ -42,45 +42,23 @@
|
|||
#import <Cocoa/Cocoa.h>
|
||||
#import <ApplicationServices/ApplicationServices.h>
|
||||
|
||||
#import "Navigation.h"
|
||||
#import "NSString+Utils.h"
|
||||
#import "NSWorkspace+Utils.h"
|
||||
|
||||
#import "Navigation.h"
|
||||
|
||||
const int kDefaultExpireDays = 9;
|
||||
static NSString* const kUserChosenBrowserUserDefaultsKey = @"UserChosenBrowsers";
|
||||
|
||||
// these functions are undocumented - even if we're not using them all
|
||||
// its best to leave them here since they are not documented anywhere else
|
||||
extern "C" {
|
||||
/* Returns the NSURL for application currently set as the default for the given URL scheme. The
|
||||
NSURL must be released by the caller. */
|
||||
extern OSStatus _LSCopyDefaultSchemeHandlerURL(NSString *scheme, NSURL **appURL);
|
||||
extern OSStatus _LSSetDefaultSchemeHandlerURL(NSString *scheme, NSURL *appURL);
|
||||
extern OSStatus _LSSaveAndRefresh(void); // inform the finder and others of changes
|
||||
extern OSStatus _LSCopyAllApplicationURLs(CFArrayRef *apps);
|
||||
extern OSStatus _LSSetWeakBindingForType(OSType inType,
|
||||
OSType inCreator,
|
||||
CFStringRef inExtension,
|
||||
LSRolesMask inRoleMask,
|
||||
const FSRef* inBindingRef);
|
||||
/* Returns by reference the NSURLs of the applications regsistered to handle the given URL. For the
|
||||
"file" protocol, this will use the type/extension/etc info for the file (which must exist for
|
||||
this to work), and for any other type of URLs this will return applications registered to handle
|
||||
that URL scheme. The resulting NSArray must be released by the caller. */
|
||||
/* Panther has a public LSCopyApplicationURLsForURL() function that would be better to use */
|
||||
extern OSStatus _LSCopyApplicationURLsForItemURL(NSURL *inURL, LSRolesMask inRoleMask, NSArray **outApps);
|
||||
}
|
||||
|
||||
@interface OrgMozillaChimeraPreferenceNavigation(Private)
|
||||
|
||||
- (NSString*)getCurrentHomePage;
|
||||
+ (NSArray*)getWebBrowserList;
|
||||
+ (NSString*)displayNameForURL:(NSURL*)url;
|
||||
-(void)updateDefaultBrowserMenu;
|
||||
|
||||
@end
|
||||
|
||||
// this is for sorting the web browser bundle ID list by display name
|
||||
int compareBundleIDAppDisplayNames(id a, id b, void *context)
|
||||
static int CompareBundleIDAppDisplayNames(id a, id b, void *context)
|
||||
{
|
||||
NSURL* appURLa = nil;
|
||||
NSURL* appURLb = nil;
|
||||
|
@ -88,8 +66,8 @@ int compareBundleIDAppDisplayNames(id a, id b, void *context)
|
|||
if ((LSFindApplicationForInfo(kLSUnknownCreator, (CFStringRef)a, NULL, NULL, (CFURLRef*)&appURLa) == noErr) &&
|
||||
(LSFindApplicationForInfo(kLSUnknownCreator, (CFStringRef)b, NULL, NULL, (CFURLRef*)&appURLb) == noErr))
|
||||
{
|
||||
NSString *aName = [OrgMozillaChimeraPreferenceNavigation displayNameForURL:appURLa];
|
||||
NSString *bName = [OrgMozillaChimeraPreferenceNavigation displayNameForURL:appURLb];
|
||||
NSString *aName = [[NSWorkspace sharedWorkspace] displayNameForFile:appURLa];
|
||||
NSString *bName = [[NSWorkspace sharedWorkspace] displayNameForFile:appURLb];
|
||||
return [aName compare:bName];
|
||||
}
|
||||
|
||||
|
@ -100,25 +78,6 @@ int compareBundleIDAppDisplayNames(id a, id b, void *context)
|
|||
|
||||
@implementation OrgMozillaChimeraPreferenceNavigation
|
||||
|
||||
+ (NSString*)displayNameForURL:(NSURL*)url
|
||||
{
|
||||
NSString *name;
|
||||
LSCopyDisplayNameForURL((CFURLRef)url, (CFStringRef *)&name);
|
||||
return [name autorelease];
|
||||
}
|
||||
|
||||
+ (NSString*)bundleIDForURL:(NSURL*)url
|
||||
{
|
||||
NSBundle *tmpBundle = [NSBundle bundleWithPath:[[url path] stringByStandardizingPath]];
|
||||
if (tmpBundle) {
|
||||
NSString *tmpBundleID = [tmpBundle bundleIdentifier];
|
||||
if (tmpBundleID && ([tmpBundleID length] > 0)) {
|
||||
return tmpBundleID;
|
||||
}
|
||||
}
|
||||
return nil;
|
||||
}
|
||||
|
||||
- (id)initWithBundle:(NSBundle *)bundle
|
||||
{
|
||||
if ((self = [super initWithBundle:bundle])) {
|
||||
|
@ -142,10 +101,13 @@ int compareBundleIDAppDisplayNames(id a, id b, void *context)
|
|||
// 0: blank page. 1: home page. 2: last page visited. Our behaviour here should
|
||||
// match what the browser does when the prefs don't exist.
|
||||
if (([self getIntPref:"browser.startup.page" withSuccess:&gotPref] == 1) || !gotPref)
|
||||
[checkboxNewWindowBlank setState:YES];
|
||||
[checkboxNewWindowBlank setState:NSOnState];
|
||||
|
||||
if (([self getIntPref:"browser.tabs.startPage" withSuccess:&gotPref] == 1))
|
||||
[checkboxNewTabBlank setState:YES];
|
||||
[checkboxNewTabBlank setState:NSOnState];
|
||||
|
||||
if ([self getBooleanPref:"camino.check_default_browser" withSuccess:&gotPref] || !gotPref)
|
||||
[checkboxCheckDefaultBrowserOnLaunch setState:NSOnState];
|
||||
|
||||
[textFieldHomePage setStringValue:[self getCurrentHomePage]];
|
||||
|
||||
|
@ -158,11 +120,13 @@ int compareBundleIDAppDisplayNames(id a, id b, void *context)
|
|||
if (!mPrefService)
|
||||
return;
|
||||
|
||||
[self setPref:"browser.startup.homepage" toString:[textFieldHomePage stringValue]];
|
||||
[self setPref:"browser.startup.homepage" toString:[textFieldHomePage stringValue]];
|
||||
|
||||
// ensure that the prefs exist
|
||||
[self setPref:"browser.startup.page" toInt:[checkboxNewWindowBlank state] ? 1 : 0];
|
||||
[self setPref:"browser.tabs.startPage" toInt:[checkboxNewTabBlank state] ? 1 : 0];
|
||||
|
||||
[self setPref:"camino.check_default_browser" toBoolean:([checkboxCheckDefaultBrowserOnLaunch state] == NSOnState)];
|
||||
}
|
||||
|
||||
- (IBAction)checkboxStartPageClicked:(id)sender
|
||||
|
@ -180,31 +144,12 @@ int compareBundleIDAppDisplayNames(id a, id b, void *context)
|
|||
[self setPref:prefName toInt: [sender state] ? 1 : 0];
|
||||
}
|
||||
|
||||
- (NSString*) getCurrentHomePage
|
||||
- (NSString*)getCurrentHomePage
|
||||
{
|
||||
BOOL gotPref;
|
||||
|
||||
return [self getStringPref:"browser.startup.homepage" withSuccess:&gotPref];
|
||||
}
|
||||
|
||||
- (void)setDefaultBrowser:(NSString*)bundleID
|
||||
{
|
||||
NSURL *browserURL = nil;
|
||||
if (LSFindApplicationForInfo(kLSUnknownCreator, (CFStringRef)bundleID, NULL, NULL, (CFURLRef*)&browserURL) == noErr) {
|
||||
FSRef browserFSRef;
|
||||
CFURLGetFSRef((CFURLRef)browserURL, &browserFSRef);
|
||||
|
||||
_LSSetDefaultSchemeHandlerURL(@"http", browserURL);
|
||||
_LSSetDefaultSchemeHandlerURL(@"https", browserURL);
|
||||
_LSSetDefaultSchemeHandlerURL(@"ftp", browserURL);
|
||||
_LSSetDefaultSchemeHandlerURL(@"gopher", browserURL);
|
||||
_LSSetWeakBindingForType(0, 0, (CFStringRef)@"htm", kLSRolesAll, &browserFSRef);
|
||||
_LSSetWeakBindingForType(0, 0, (CFStringRef)@"html", kLSRolesAll, &browserFSRef);
|
||||
_LSSetWeakBindingForType(0, 0, (CFStringRef)@"url", kLSRolesAll, &browserFSRef);
|
||||
_LSSaveAndRefresh();
|
||||
}
|
||||
}
|
||||
|
||||
// called when the users changes the selection in the default browser menu
|
||||
- (IBAction)defaultBrowserChange:(id)sender
|
||||
{
|
||||
|
@ -215,7 +160,7 @@ int compareBundleIDAppDisplayNames(id a, id b, void *context)
|
|||
if (LSFindApplicationForInfo(kLSUnknownCreator, (CFStringRef)repObject, NULL, NULL, (CFURLRef*)&appURL) == noErr) {
|
||||
if ([[NSFileManager defaultManager] isExecutableFileAtPath:[[appURL path] stringByStandardizingPath]]) {
|
||||
// set it as the default browser
|
||||
[self setDefaultBrowser:repObject];
|
||||
[[NSWorkspace sharedWorkspace] setDefaultBrowserWithIdentifier:repObject];
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -242,7 +187,7 @@ int compareBundleIDAppDisplayNames(id a, id b, void *context)
|
|||
- (void)openPanelDidEnd:(NSOpenPanel *)sheet returnCode:(int)returnCode contextInfo:(void *)contextInfo
|
||||
{
|
||||
if (returnCode == NSOKButton) {
|
||||
NSString *chosenBundleID = [OrgMozillaChimeraPreferenceNavigation bundleIDForURL:[[sheet URLs] objectAtIndex:0]];
|
||||
NSString *chosenBundleID = [[NSWorkspace sharedWorkspace] identifierForBundle:[[sheet URLs] objectAtIndex:0]];
|
||||
if (chosenBundleID) {
|
||||
// add this browser to a list of apps we should always consider as browsers
|
||||
NSMutableArray *userChosenBundleIDs = [NSMutableArray arrayWithCapacity:2];
|
||||
|
@ -252,77 +197,49 @@ int compareBundleIDAppDisplayNames(id a, id b, void *context)
|
|||
[[NSUserDefaults standardUserDefaults] setObject:userChosenBundleIDs forKey:kUserChosenBrowserUserDefaultsKey];
|
||||
}
|
||||
// make it the default browser
|
||||
[self setDefaultBrowser:chosenBundleID];
|
||||
[[NSWorkspace sharedWorkspace] setDefaultBrowserWithIdentifier:chosenBundleID];
|
||||
}
|
||||
}
|
||||
[self updateDefaultBrowserMenu];
|
||||
}
|
||||
|
||||
// returns an array of web browser bundle IDs sorted by display name
|
||||
+ (NSArray*)getWebBrowserList
|
||||
- (NSArray*)getWebBrowserList
|
||||
{
|
||||
// use a set for automatic duplicate elimination
|
||||
NSMutableSet* browsersSet = [NSMutableSet setWithCapacity:10];
|
||||
NSArray* installedBrowsers = [[NSWorkspace sharedWorkspace] installedBrowserIdentifiers];
|
||||
|
||||
// use a set to avoid duplicates
|
||||
NSMutableSet* browsersSet = [NSMutableSet setWithArray:installedBrowsers];
|
||||
|
||||
// using LSCopyApplicationURLsForURL would be nice (its not hidden),
|
||||
// but it only exists on Mac OS X >= 10.3
|
||||
NSArray* apps;
|
||||
_LSCopyApplicationURLsForItemURL([NSURL URLWithString:@"http:"], kLSRolesViewer, &apps);
|
||||
[apps autorelease];
|
||||
|
||||
// Put all the browsers into a new array, but only if they also support https and have a bundle ID we can access
|
||||
NSEnumerator *appEnumerator = [apps objectEnumerator];
|
||||
NSURL* anApp;
|
||||
while ((anApp = [appEnumerator nextObject])) {
|
||||
Boolean canHandleHTTPS;
|
||||
if ((LSCanURLAcceptURL((CFURLRef)[NSURL URLWithString:@"https:"], (CFURLRef)anApp, kLSRolesAll, kLSAcceptDefault, &canHandleHTTPS) == noErr) &&
|
||||
canHandleHTTPS) {
|
||||
NSString *tmpBundleID = [OrgMozillaChimeraPreferenceNavigation bundleIDForURL:anApp];
|
||||
if (tmpBundleID)
|
||||
[browsersSet addObject:tmpBundleID];
|
||||
}
|
||||
}
|
||||
|
||||
// add user chosen browsers to list
|
||||
[browsersSet addObjectsFromArray:[[NSUserDefaults standardUserDefaults] objectForKey:kUserChosenBrowserUserDefaultsKey]];
|
||||
|
||||
// add default browser in case it hasn't been already
|
||||
NSURL *currSetURL = nil;
|
||||
if (_LSCopyDefaultSchemeHandlerURL(@"http", &currSetURL) == noErr)
|
||||
[browsersSet addObject:[OrgMozillaChimeraPreferenceNavigation bundleIDForURL:currSetURL]];
|
||||
[currSetURL release];
|
||||
|
||||
NSMutableArray* browsers = [[browsersSet allObjects] mutableCopy];
|
||||
|
||||
// sort by display name
|
||||
[browsers sortUsingFunction:&compareBundleIDAppDisplayNames context:NULL];
|
||||
|
||||
return browsers;
|
||||
NSMutableArray* browsers = [[browsersSet allObjects] mutableCopy];
|
||||
[browsers sortUsingFunction:&CompareBundleIDAppDisplayNames context:NULL];
|
||||
return [browsers autorelease];
|
||||
}
|
||||
|
||||
-(void)updateDefaultBrowserMenu
|
||||
{
|
||||
NSArray *browsers = [OrgMozillaChimeraPreferenceNavigation getWebBrowserList];
|
||||
NSArray *browsers = [self getWebBrowserList];
|
||||
NSMenu *menu = [[[NSMenu alloc] initWithTitle:@"Browsers"] autorelease];
|
||||
NSMenuItem *selectedBrowserMenuItem = nil;
|
||||
NSString *caminoBundleID = [[NSBundle mainBundle] bundleIdentifier];
|
||||
NSString* caminoBundleID = [[NSBundle mainBundle] bundleIdentifier];
|
||||
|
||||
// get current default browser's bundle ID
|
||||
NSURL *currSetURL = nil;
|
||||
_LSCopyDefaultSchemeHandlerURL(@"http", &currSetURL);
|
||||
NSString *currentDefaultBrowserBundleID = [OrgMozillaChimeraPreferenceNavigation bundleIDForURL:currSetURL];
|
||||
[currSetURL release];
|
||||
NSString* currentDefaultBrowserBundleID = [[NSWorkspace sharedWorkspace] defaultBrowserIdentifier];
|
||||
|
||||
// add separator first, current instance of Camino will be inserted before it
|
||||
[menu addItem:[NSMenuItem separatorItem]];
|
||||
|
||||
// Set up new menu
|
||||
NSEnumerator *browserEnumerator = [browsers objectEnumerator];
|
||||
while (NSString *bundleID = [browserEnumerator nextObject]) {
|
||||
NSURL *appURL = nil;
|
||||
OSErr e = LSFindApplicationForInfo(kLSUnknownCreator, (CFStringRef)bundleID,
|
||||
NULL, NULL, (CFURLRef*)&appURL);
|
||||
if (e != noErr) {
|
||||
NSMenuItem* selectedBrowserMenuItem = nil;
|
||||
NSEnumerator* browserEnumerator = [browsers objectEnumerator];
|
||||
NSString* bundleID;
|
||||
while ((bundleID = [browserEnumerator nextObject]))
|
||||
{
|
||||
NSURL* appURL = [[NSWorkspace sharedWorkspace] urlOfApplicationWithIdentifier:bundleID];
|
||||
if (!appURL) {
|
||||
// see if it was supposed to find Camino and use our own path in that case,
|
||||
// otherwise skip this bundle ID
|
||||
if ([bundleID isEqualToString:caminoBundleID])
|
||||
|
@ -331,7 +248,7 @@ int compareBundleIDAppDisplayNames(id a, id b, void *context)
|
|||
continue;
|
||||
}
|
||||
|
||||
NSMenuItem* item = [[NSMenuItem alloc] initWithTitle:[OrgMozillaChimeraPreferenceNavigation displayNameForURL:appURL]
|
||||
NSMenuItem* item = [[NSMenuItem alloc] initWithTitle:[[NSWorkspace sharedWorkspace] displayNameForFile:appURL]
|
||||
action:@selector(defaultBrowserChange:) keyEquivalent:@""];
|
||||
NSImage *icon = [[NSWorkspace sharedWorkspace] iconForFile:[[appURL path] stringByStandardizingPath]];
|
||||
[icon setSize:NSMakeSize(16.0, 16.0)];
|
||||
|
|
Двоичные данные
camino/PreferencePanes/Navigation/Navigation.tiff
Двоичные данные
camino/PreferencePanes/Navigation/Navigation.tiff
Двоичный файл не отображается.
Двоичные данные
camino/PreferencePanes/Privacy/Privacy.tiff
Двоичные данные
camino/PreferencePanes/Privacy/Privacy.tiff
Двоичный файл не отображается.
Двоичные данные
camino/PreferencePanes/Tabs/Tabs.tiff
Двоичные данные
camino/PreferencePanes/Tabs/Tabs.tiff
Двоичный файл не отображается.
Двоичные данные
camino/PreferencePanes/WebFeatures/WebFeatures.tiff
Двоичные данные
camino/PreferencePanes/WebFeatures/WebFeatures.tiff
Двоичный файл не отображается.
Двоичные данные
camino/resources/localized/English.lproj/Localizable.strings
Двоичные данные
camino/resources/localized/English.lproj/Localizable.strings
Двоичный файл не отображается.
|
@ -43,6 +43,7 @@
|
|||
#import "NSResponder+Utils.h"
|
||||
#import "NSMenu+Utils.h"
|
||||
#import "NSURL+Utils.h"
|
||||
#import "NSWorkspace+Utils.h"
|
||||
|
||||
#import "ChimeraUIConstants.h"
|
||||
#import "MainController.h"
|
||||
|
@ -103,6 +104,7 @@ const int kReuseWindowOnAE = 2;
|
|||
|
||||
- (void)setupStartpage;
|
||||
- (void)setupRendezvous;
|
||||
- (void)checkDefaultBrowser;
|
||||
- (NSMenu*)bookmarksMenu;
|
||||
- (BOOL)bookmarksItemsEnabled;
|
||||
- (void)adjustBookmarkMenuItems;
|
||||
|
@ -331,6 +333,8 @@ const int kReuseWindowOnAE = 2;
|
|||
NSWindow* browserWindow = [self getFrontmostBrowserWindow];
|
||||
if (!browserWindow)
|
||||
[self newWindow:self];
|
||||
|
||||
[self checkDefaultBrowser];
|
||||
}
|
||||
|
||||
- (NSApplicationTerminateReply)applicationShouldTerminate:(NSApplication *)sender
|
||||
|
@ -425,6 +429,41 @@ const int kReuseWindowOnAE = 2;
|
|||
}
|
||||
}
|
||||
|
||||
- (void)checkDefaultBrowser
|
||||
{
|
||||
NSString* defaultBrowserIdentifier = [[NSWorkspace sharedWorkspace] defaultBrowserIdentifier];
|
||||
NSString* myIdentifier = [[NSBundle mainBundle] bundleIdentifier];
|
||||
|
||||
// silently update from our old to new bundle identifier
|
||||
if ([defaultBrowserIdentifier isEqualToString:@"org.mozilla.navigator"])
|
||||
{
|
||||
[[NSWorkspace sharedWorkspace] setDefaultBrowserWithIdentifier:myIdentifier];
|
||||
}
|
||||
else if (![defaultBrowserIdentifier isEqualToString:myIdentifier])
|
||||
{
|
||||
BOOL gotPref;
|
||||
BOOL allowPrompt = ([[PreferenceManager sharedInstance] getBooleanPref:"camino.check_default_browser" withSuccess:&gotPref] ||
|
||||
!gotPref);
|
||||
if (allowPrompt)
|
||||
{
|
||||
nsAlertController* controller = [[nsAlertController alloc] init];
|
||||
BOOL dontAskAgain = NO;
|
||||
BOOL confirmed = [controller confirmCheck:nil
|
||||
title:NSLocalizedString(@"DefaultBrowserTitle", nil)
|
||||
text:NSLocalizedString(@"DefaultBrowserMessage", nil)
|
||||
checkMsg:NSLocalizedString(@"DefaultBrowserChecboxTitle", nil)
|
||||
checkValue:&dontAskAgain];
|
||||
if (confirmed)
|
||||
{
|
||||
[[NSWorkspace sharedWorkspace] setDefaultBrowserWithIdentifier:myIdentifier];
|
||||
}
|
||||
|
||||
[[PreferenceManager sharedInstance] setPref:"camino.check_default_browser" toBoolean:!dontAskAgain];
|
||||
[controller release];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// bookmarkLoadingCompleted:
|
||||
//
|
||||
|
|
Загрузка…
Ссылка в новой задаче