changes to add support for the "browser.startup.page" pref and the new

"browser.startup.splash" page pref.

all that's left is to get radha to add the code to get the last page visted.


git-svn-id: svn://10.0.0.236/trunk@35907 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
sspitzer%netscape.com 1999-06-19 21:06:59 +00:00
parent 673e850292
commit d89d7b412a
5 changed files with 63 additions and 0 deletions

View File

@ -45,6 +45,9 @@ interface nsIGlobalHistory : nsISupports
// Get the preferred completion for aURL
string GetURLCompletion(in string aURL);
// get the last page visited
string GetLastPageVisted();
};
%{ C++

View File

@ -58,6 +58,48 @@
dump("Setting content window\n");
appCore.setContentWindow( window.frames[0].frames[1] );
// Have browser app core load appropriate initial page.
var pref = Components.classes['component://netscape/preferences'];
// if all else fails, use trusty "about:" as the start page
var startPage = "about:";
if (pref) {
pref = pref.getService();
}
if (pref) {
pref = pref.QueryInterface(Components.interfaces.nsIPref);
}
if (pref) {
// from mozilla/modules/libpref/src/init/all.js
// 0 = blank
// 1 = home (browser.startup.homepage)
// 2 = last
// 3 = splash (browser.startup.splash)
choice = pref.GetIntPref("browser.startup.page");
if (choice == 0) {
startpage = "about:blank";
}
else if (choice == 1) {
startpage = pref.CopyCharPref("browser.startup.homepage");
}
else if (choice == 2) {
var history = Components.classes['component://netscape/browser/global-history'];
if (history) {
history = history.QueryInterface(Components.interfaces.nsIGlobalHistory);
}
if (history) {
startpage = history.GetLastPageVisted();
}
}
else if (choice == 3) {
startpage = pref.CopyCharPref("browser.startup.splash");
}
else {
// use about: as the default
startpage = "about:";
}
}
document.getElementById("args").setAttribute("value", startpage);
appCore.loadInitialPage();
} else {
// Try again.

View File

@ -294,7 +294,11 @@
<broadcaster id="Browser:Status"/>
<broadcaster id="Browser:Security" secure="false"/>
<broadcaster id="Browser:Throbber" busy="false"/>
<<<<<<< navigator.xul
<broadcaster id="args" value=""/>
=======
<broadcaster id="args" value="http://www.mozillazine.org"/>
>>>>>>> 1.136
<!-- Interim hack to transition from nsIXULWindowCallbacks/ShowWindowWithArgs -->
<broadcaster id="dialog.start" ready="false"/>

View File

@ -45,6 +45,9 @@ interface nsIGlobalHistory : nsISupports
// Get the preferred completion for aURL
string GetURLCompletion(in string aURL);
// get the last page visited
string GetLastPageVisted();
};
%{ C++

View File

@ -112,6 +112,7 @@ public:
NS_IMETHOD RemovePage(const char *aURL);
NS_IMETHOD GetLastVisitDate(const char *aURL, PRInt64 *_retval);
NS_IMETHOD GetURLCompletion(const char *aURL, char **_retval);
NS_IMETHOD GetLastPageVisted(char **_retval);
// nsIRDFDataSource
NS_IMETHOD Init(const char* aURI);
@ -505,6 +506,16 @@ nsGlobalHistory::GetURLCompletion(const char *aURL, char **_retval)
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP
nsGlobalHistory::GetLastPageVisted(char **_retval)
{
NS_PRECONDITION(_retval != nsnull, "null ptr");
if (! _retval)
return NS_ERROR_NULL_POINTER;
*_retval = PR_smprintf("http://people.netscape.com/radha");
return NS_OK;
}
////////////////////////////////////////////////////////////////////////
// nsIRDFDataSource