Fix for bugscape bug 15424: Support easy way to add a sidebar panel
via CCK (r=smeredith) git-svn-id: svn://10.0.0.236/trunk@122678 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
@@ -173,7 +173,7 @@ Value=Customize Sidebar Tabs
|
||||
Start_x=0
|
||||
Start_y=163
|
||||
Width=407
|
||||
Height=64
|
||||
Height=74
|
||||
|
||||
[Widget 300]
|
||||
Type=Text
|
||||
@@ -187,49 +187,45 @@ Height=25
|
||||
[Widget 7]
|
||||
Type=Text
|
||||
Name=Text25
|
||||
Value=Path to Your Customized Sidebar Tabs File (panels.rdf):
|
||||
Value=Sidebar Tab Title
|
||||
Start_x=11
|
||||
Start_y=191
|
||||
Width=275
|
||||
Width=65
|
||||
Height=25
|
||||
|
||||
[Widget 8]
|
||||
Type=DynamicText
|
||||
Name=SidebarPath
|
||||
Type=EditBox
|
||||
Name=SidebartabTitle
|
||||
Value=
|
||||
Start_x=75
|
||||
Start_y=189
|
||||
Width=225
|
||||
Height=14
|
||||
|
||||
[Widget 12]
|
||||
Type=Text
|
||||
Name=Text26
|
||||
Value=Sidebar Tab URL
|
||||
Start_x=11
|
||||
Start_y=205
|
||||
Width=200
|
||||
Height=14
|
||||
Start_y=210
|
||||
Width=65
|
||||
Height=25
|
||||
|
||||
[Widget 4931]
|
||||
Type=Button
|
||||
Name=Button1069
|
||||
Value=View File
|
||||
Start_x=240
|
||||
Start_y=202
|
||||
Width=40
|
||||
[Widget 14]
|
||||
Type=EditBox
|
||||
Name=SidebartabURL
|
||||
Value=
|
||||
Start_x=75
|
||||
Start_y=208
|
||||
Width=225
|
||||
Height=14
|
||||
onCommand=command(%NCIFileEditor% "%SidebarPath%");
|
||||
|
||||
|
||||
[Widget 507]
|
||||
Type=Button
|
||||
Name=Button3163
|
||||
Value=Choose File...
|
||||
Start_x=284
|
||||
Start_y=202
|
||||
Width=50
|
||||
Height=14
|
||||
onCommand=BrowseFile()
|
||||
Target=SidebarPath
|
||||
|
||||
[Widget 200]
|
||||
Type=Button
|
||||
Name=Button116
|
||||
Value=Show Example
|
||||
Start_x=339
|
||||
Start_y=202
|
||||
Start_y=208
|
||||
Width=60
|
||||
Height=14
|
||||
onCommand=DisplayImage(sidebar.ini)
|
||||
|
||||
@@ -6,7 +6,6 @@ OrganizationName=
|
||||
AnimatedLogoURL=http://home.netscape.com
|
||||
LargeAnimPath=%Root%Configs\Default\Workspace\AnimLogo\animlogo32.gif
|
||||
LargeStillPath=%Root%Configs\Default\Workspace\AnimLogo\staticlogo32.gif
|
||||
SidebarPath=%Root%Configs\Default\Workspace\Sidebar\panels.rdf
|
||||
CompanyName=
|
||||
HomePageURL=http://home.netscape.com
|
||||
HelpMenuCommandName=
|
||||
|
||||
@@ -6,7 +6,6 @@ OrganizationName=
|
||||
AnimatedLogoURL=http://home.netscape.com
|
||||
LargeAnimPath=%Root%Configs\MyIsp\Workspace\AnimLogo\animlogo32.gif
|
||||
LargeStillPath=%Root%Configs\MyIsp\Workspace\AnimLogo\staticlogo32.gif
|
||||
SidebarPath=%Root%Configs\MyIsp\Workspace\Sidebar\panels.rdf
|
||||
CompanyName=MyIsp
|
||||
HomePageURL=http://home.netscape.com
|
||||
HelpMenuCommandName=
|
||||
|
||||
@@ -7,7 +7,6 @@ OrganizationName=
|
||||
AnimatedLogoURL=http://home.netscape.com
|
||||
LargeAnimPath=%Root%Configs\Default\Workspace\AnimLogo\animlogo32.gif
|
||||
LargeStillPath=%Root%Configs\Default\Workspace\AnimLogo\staticlogo32.gif
|
||||
SidebarPath=%Root%Configs\Default\Workspace\Sidebar\panels.rdf
|
||||
CompanyName=
|
||||
HomePageURL=http://home.netscape.com
|
||||
HelpMenuCommandName=
|
||||
|
||||
@@ -1144,6 +1144,47 @@ BOOL MarkCFGVersion(CString HashedPrefsFile, CString versionTxt)
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void ModifySidebar(CString inputFile, CString outputFile)
|
||||
{
|
||||
// Add a sidebar tab at the topmost location in 'My sidebar'
|
||||
|
||||
char tempbuf[MAX_SIZE];
|
||||
CString searchstr = "<RDF:Seq>";
|
||||
CString sidebartabTitle = GetGlobal("SidebartabTitle");
|
||||
CString sidebartabURL = GetGlobal("SidebartabURL");
|
||||
|
||||
ifstream srcf(inputFile);
|
||||
if (!srcf)
|
||||
{
|
||||
AfxMessageBox("Cannot open input file: " + CString(inputFile),MB_OK);
|
||||
return;
|
||||
}
|
||||
ofstream dstf(outputFile);
|
||||
if (!dstf)
|
||||
{
|
||||
AfxMessageBox("Cannot open output file: " + CString(outputFile), MB_OK);
|
||||
return;
|
||||
}
|
||||
|
||||
while (!srcf.eof())
|
||||
{
|
||||
srcf.getline(tempbuf,MAX_SIZE);
|
||||
dstf << tempbuf << "\n";
|
||||
if ((CString(tempbuf).Find(searchstr)) != -1)
|
||||
{
|
||||
dstf << " <RDF:li>" << "\n";
|
||||
dstf << " <RDF:Description about=\"" << sidebartabTitle << "\">\n";
|
||||
dstf << " <NC:title>" << sidebartabTitle << "</NC:title>" << "\n";
|
||||
dstf << " <NC:content>" << sidebartabURL << "</NC:content>" << "\n";
|
||||
dstf << " </RDF:Description>" << "\n";
|
||||
dstf << " </RDF:li>" << "\n";
|
||||
}
|
||||
}
|
||||
|
||||
srcf.close();
|
||||
dstf.close();
|
||||
}
|
||||
|
||||
int interpret(char *cmd)
|
||||
{
|
||||
char *cmdname = strtok(cmd, "(");
|
||||
@@ -1279,7 +1320,36 @@ int interpret(char *cmd)
|
||||
}
|
||||
}
|
||||
|
||||
else if (strcmp(cmdname, "modifySidebar") == 0)
|
||||
{
|
||||
// extract the file to be modified from the jar/xpi
|
||||
// and process the file
|
||||
|
||||
char *xpiname = strtok(NULL, ",)"); // xpi file name
|
||||
char *jarname = strtok(NULL, ",)"); // jar name within xpi file
|
||||
char *filename = strtok(NULL, ",)"); // file name within jar file
|
||||
|
||||
CString inputFile = filename;
|
||||
inputFile.Replace("/","\\");
|
||||
inputFile = tempPath + "\\" + inputFile;
|
||||
CString outputFile = inputFile + ".new";
|
||||
|
||||
if (!xpiname || !filename)
|
||||
return TRUE;
|
||||
|
||||
//check to see if it is a jar and then do accordingly
|
||||
if (stricmp(jarname,"no.jar")==0)
|
||||
ExtractXPIFile(xpiname, filename);
|
||||
else
|
||||
ExtractJARFile(xpiname, (CString)jarname, filename);
|
||||
|
||||
if (strcmp(cmdname, "modifySidebar") == 0)
|
||||
ModifySidebar(inputFile, outputFile);
|
||||
|
||||
remove(inputFile);
|
||||
rename(outputFile, inputFile);
|
||||
}
|
||||
|
||||
else if ((strcmp(cmdname, "modifyDTD") == 0) ||
|
||||
(strcmp(cmdname, "modifyJS") == 0) ||
|
||||
(strcmp(cmdname, "modifyJS1") == 0) ||
|
||||
|
||||
@@ -8,8 +8,8 @@ replaceXPI(ChromeDefaults.zip,chrome/modern.jar,skin/modern/communicator/brand/t
|
||||
replaceXPI(ChromeDefaults.zip,chrome/modern.jar,skin/modern/communicator/brand/throbber16-single.gif,%LargeStillPath%)
|
||||
replaceXPI(ChromeDefaults.zip,no.jar,defaults/profile/bookmarks.html,%CustomBookmarkFile%)
|
||||
replaceXPI(ChromeDefaults.zip,no.jar,defaults/profile/%REGION%/bookmarks.html,%CustomBookmarkFile%)
|
||||
replaceXPI(ChromeDefaults.zip,no.jar,defaults/profile/panels.rdf,%SidebarPath%)
|
||||
replaceXPI(ChromeDefaults.zip,no.jar,defaults/profile/%REGION%/panels.rdf,%SidebarPath%)
|
||||
modifySidebar(ChromeDefaults.zip,no.jar,bin/defaults/profile/panels.rdf)
|
||||
modifySidebar(ChromeDefaults.zip,no.jar,bin/defaults/profile/%REGION%/panels.rdf)
|
||||
replaceXPI(ChromeDefaults.zip,chrome/comm.jar,content/communicator/communicatorOverlay.xul,%HlpRDF%)
|
||||
modifyDTD(ChromeDefaults.zip,chrome/%lang%-%REGION%.jar,locale/%lang%-%REGION%/navigator/navigator-title.dtd,mainWindow.titlemodifier,%CompanyName%)
|
||||
modifyProperties(ChromeDefaults.zip,chrome/%REGION%.jar,locale/%REGION%/navigator-region/region.properties,browser.startup.homepage,%HomePageURL%)
|
||||
|
||||
@@ -16,8 +16,8 @@ replaceXPI(browser.xpi,bin/chrome/modern.jar,skin/modern/communicator/brand/thro
|
||||
replaceXPI(browser.xpi,bin/chrome/modern.jar,skin/modern/communicator/brand/throbber16-single.gif,%LargeStillPath%)
|
||||
replaceXPI(defl%lang%%region%.xpi,no.jar,bin/defaults/profile/bookmarks.html,%CustomBookmarkFile%)
|
||||
replaceXPI(reg%region%.xpi,no.jar,bin/defaults/profile/%REGION%/bookmarks.html,%CustomBookmarkFile%)
|
||||
replaceXPI(defl%lang%%region%.xpi,no.jar,bin/defaults/profile/panels.rdf,%SidebarPath%)
|
||||
replaceXPI(reg%region%.xpi,no.jar,bin/defaults/profile/%REGION%/panels.rdf,%SidebarPath%)
|
||||
modifySidebar(defl%lang%%region%.xpi,no.jar,bin/defaults/profile/panels.rdf)
|
||||
modifySidebar(reg%region%.xpi,no.jar,bin/defaults/profile/%REGION%/panels.rdf)
|
||||
replaceXPI(browser.xpi,bin/chrome/comm.jar,content/communicator/communicatorOverlay.xul,%HlpRDF%)
|
||||
modifyDTD(lang%lang%%region%.xpi,bin/chrome/%lang%-%REGION%.jar,locale/%lang%-%REGION%/navigator/navigator-title.dtd,mainWindow.titlemodifier,%CompanyName%)
|
||||
modifyProperties(reg%region%.xpi,bin/chrome/%REGION%.jar,locale/%REGION%/navigator-region/region.properties,browser.startup.homepage,%HomePageURL%)
|
||||
|
||||
@@ -8,8 +8,8 @@ replaceXPI(browser.xpi,bin/chrome/modern.jar,skin/modern/communicator/brand/thro
|
||||
replaceXPI(browser.xpi,bin/chrome/modern.jar,skin/modern/communicator/brand/throbber16-single.gif,%LargeStillPath%)
|
||||
replaceXPI(defl%lang%%region%.xpi,no.jar,bin/defaults/profile/bookmarks.html,%CustomBookmarkFile%)
|
||||
replaceXPI(reg%region%.xpi,no.jar,bin/defaults/profile/%REGION%/bookmarks.html,%CustomBookmarkFile%)
|
||||
replaceXPI(defl%lang%%region%.xpi,no.jar,bin/defaults/profile/panels.rdf,%SidebarPath%)
|
||||
replaceXPI(reg%region%.xpi,no.jar,bin/defaults/profile/%REGION%/panels.rdf,%SidebarPath%)
|
||||
modifySidebar(defl%lang%%region%.xpi,no.jar,bin/defaults/profile/panels.rdf)
|
||||
modifySidebar(reg%region%.xpi,no.jar,bin/defaults/profile/%REGION%/panels.rdf)
|
||||
replaceXPI(browser.xpi,bin/chrome/comm.jar,content/communicator/communicatorOverlay.xul,%HlpRDF%)
|
||||
modifyDTD(lang%lang%%region%.xpi,bin/chrome/%lang%-%REGION%.jar,locale/%lang%-%REGION%/navigator/navigator-title.dtd,mainWindow.titlemodifier,%CompanyName%)
|
||||
modifyProperties(reg%region%.xpi,bin/chrome/%REGION%.jar,locale/%REGION%/navigator-region/region.properties,browser.startup.homepage,%HomePageURL%)
|
||||
|
||||
@@ -77,7 +77,6 @@ BOOL Config(CString globalsName, CString DialogTitle, WIDGET* curWidget)
|
||||
SetGlobal("LargeAnimPath", newDir + "\\Workspace\\AnimLogo\\animlogo32.gif");
|
||||
SetGlobal("LargeStillPath", newDir + "\\Workspace\\AnimLogo\\staticlogo32.gif");
|
||||
SetGlobal("ReadMeFile", newDir + "\\Workspace\\readme.txt");
|
||||
SetGlobal("SidebarPath", newDir + "\\Workspace\\Sidebar\\panels.rdf");
|
||||
SetGlobal("CustomBookmarkFile", newDir + "\\Workspace\\Bkmarks\\bookmarks.html");
|
||||
SetGlobal("ShellBgBitmap", newDir + "\\Workspace\\Autorun\\Shell\\bmps\\install.bmp");
|
||||
SetGlobal("ShellInstallTextFile", newDir + "\\Workspace\\Autorun\\install.txt");
|
||||
|
||||
Reference in New Issue
Block a user