Checking in fix for bug 145815 for bnesse. Hook up 'Search' button in toolbar to use mozilla pref, if it exists, or the IC preference. r=me

This commit is contained in:
sfraser%netscape.com 2002-07-01 03:48:42 +00:00
Родитель d87d58ada0
Коммит 4452a0fd47
4 изменённых файлов: 88 добавлений и 8 удалений

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

@ -636,8 +636,28 @@ static NSString *SearchToolbarItemIdentifier = @"Search Toolbar Item";
- (void)performSearch
{
// XXX go to the user's preferred search engine.
[[mBrowserView getBrowserView] loadURI: @"http://dmoz.org/" flags:NSLoadFlagsNone];
NSString *searchEngine = nil;
// Try and get the search engine from the pref service
nsCOMPtr<nsIPrefBranch> prefBranch(do_GetService("@mozilla.org/preferences-service;1"));
if (prefBranch) {
char *buf = nsnull;
prefBranch->GetCharPref("search.default_engine", &buf);
if (buf) {
if (*buf)
searchEngine = [NSString stringWithCString:buf];
free(buf);
}
}
// Get the users preferred search engine from IC
if (!searchEngine) {
searchEngine = [[CHPreferenceManager sharedInstance] getICStringPref:kICWebSearchPagePrefs];
if (!searchEngine || ([searchEngine cStringLength] == 0))
searchEngine = @"http://dmoz.org/";
}
[[mBrowserView getBrowserView] loadURI:searchEngine flags:NSLoadFlagsNone];
}

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

@ -636,8 +636,28 @@ static NSString *SearchToolbarItemIdentifier = @"Search Toolbar Item";
- (void)performSearch
{
// XXX go to the user's preferred search engine.
[[mBrowserView getBrowserView] loadURI: @"http://dmoz.org/" flags:NSLoadFlagsNone];
NSString *searchEngine = nil;
// Try and get the search engine from the pref service
nsCOMPtr<nsIPrefBranch> prefBranch(do_GetService("@mozilla.org/preferences-service;1"));
if (prefBranch) {
char *buf = nsnull;
prefBranch->GetCharPref("search.default_engine", &buf);
if (buf) {
if (*buf)
searchEngine = [NSString stringWithCString:buf];
free(buf);
}
}
// Get the users preferred search engine from IC
if (!searchEngine) {
searchEngine = [[CHPreferenceManager sharedInstance] getICStringPref:kICWebSearchPagePrefs];
if (!searchEngine || ([searchEngine cStringLength] == 0))
searchEngine = @"http://dmoz.org/";
}
[[mBrowserView getBrowserView] loadURI:searchEngine flags:NSLoadFlagsNone];
}

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

@ -636,8 +636,28 @@ static NSString *SearchToolbarItemIdentifier = @"Search Toolbar Item";
- (void)performSearch
{
// XXX go to the user's preferred search engine.
[[mBrowserView getBrowserView] loadURI: @"http://dmoz.org/" flags:NSLoadFlagsNone];
NSString *searchEngine = nil;
// Try and get the search engine from the pref service
nsCOMPtr<nsIPrefBranch> prefBranch(do_GetService("@mozilla.org/preferences-service;1"));
if (prefBranch) {
char *buf = nsnull;
prefBranch->GetCharPref("search.default_engine", &buf);
if (buf) {
if (*buf)
searchEngine = [NSString stringWithCString:buf];
free(buf);
}
}
// Get the users preferred search engine from IC
if (!searchEngine) {
searchEngine = [[CHPreferenceManager sharedInstance] getICStringPref:kICWebSearchPagePrefs];
if (!searchEngine || ([searchEngine cStringLength] == 0))
searchEngine = @"http://dmoz.org/";
}
[[mBrowserView getBrowserView] loadURI:searchEngine flags:NSLoadFlagsNone];
}

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

@ -636,8 +636,28 @@ static NSString *SearchToolbarItemIdentifier = @"Search Toolbar Item";
- (void)performSearch
{
// XXX go to the user's preferred search engine.
[[mBrowserView getBrowserView] loadURI: @"http://dmoz.org/" flags:NSLoadFlagsNone];
NSString *searchEngine = nil;
// Try and get the search engine from the pref service
nsCOMPtr<nsIPrefBranch> prefBranch(do_GetService("@mozilla.org/preferences-service;1"));
if (prefBranch) {
char *buf = nsnull;
prefBranch->GetCharPref("search.default_engine", &buf);
if (buf) {
if (*buf)
searchEngine = [NSString stringWithCString:buf];
free(buf);
}
}
// Get the users preferred search engine from IC
if (!searchEngine) {
searchEngine = [[CHPreferenceManager sharedInstance] getICStringPref:kICWebSearchPagePrefs];
if (!searchEngine || ([searchEngine cStringLength] == 0))
searchEngine = @"http://dmoz.org/";
}
[[mBrowserView getBrowserView] loadURI:searchEngine flags:NSLoadFlagsNone];
}