Summary: "Save As" dialog uses the incorrect filename and type
Creator:asmpgmr Date:2002-12-17 12:35:59
Project:K-Meleon Owner:jeff
Status:Closed Severity:Normal
Version:Unknow Target Version:Unknow

Save As/Save Page As (ID_FILE_SAVE_AS) doesn't put the correct filename and file type in the save dialog box but Save Link As (ID_SAVE_LINK_AS) does. Save As uses the page title (or blank for a text file) as the filename and the type is always web page (.html). It also uses K-Meleon as the download directory instead of browser.download.dir, again Save Link As works correctly.

Comments
asmpgmr  2002-12-20 18:47:21
In BrowserView.cpp, function OnFileSaveAs, you get the browser window title. That's really not good, I can't imagine ever wanting the browser window title as the filename. Couldn't functionality to get the filename and filetype similar to that in function OnSaveLinkAs or the function it calls URISaveAs be used in OnFileSaveAs ?
Ulf  2003-02-09 09:31:17
Internet Explorer saves web pages by their title. Most of our users will expect that behaviour.
Normal files should be saved by their filename though, since they don't even have a title.
Why we have both "browser.download.dir" and "kmeleon.general.saveDir" is beyond me.
[Changed Status from "Unconfirmed" to "Open"]
[Changed Owner from ".Nobody" to "jeff"]
asmpgmr  2003-02-09 11:50:48
Why should K-Meleon mimic the M$-Borg browser considering it's a Gecko browser ???? Shouldn't it mimic Mozilla on such things ?? I for one came from Netscape 4.x and NEVER expect the page title to be used as a filename. Usually a page title is several words and doesn't make for a good filename. Plus the filetype is always .html regardless of the extension which is incorrect. Please use the Netscape/Mozilla behavior or at least have a pref for it.
Also it is inconsistent that Save As works one way and Save Link As works another way.
asmpgmr  2003-02-09 12:04:49
Here's an example:
Goto http://www.sftv.org/sftv/sftvschd.txt and hit Ctrl-S to save, I expect the save dialog to default to sftvschd.txt and type .txt but it has no filename since it's a text file with no page title and save as type "Web page, HTML only (*.htm, *.html)" which is just wrong. Also the default save directory is \Program Files\K-Meleon instead of my download directory.
If I goto http://www.sftv.org/sftv/sftv.html and right click on the first link (same as above) and select Save Link As then it works as expected, filename sftvschd.txt, save as type .txt, and my download directory.
asmpgmr  2003-02-18 07:35:32
Another save as problem, if you use an extension other that .txt, .htm, or .html then .txt or .htm is appended after the extension. For example if a .c file is saved the filename becomes filename.c.txt or filename.c.htm depending on which type is selected from the type dropdown.
asmpgmr  2003-02-23 12:41:57
In BrowserView.cpp the functions OnSaveLinkAs and OnSaveImageAs have fairly simple code which ultimately call a function URISaveAs. Why can't the function OnFileSaveAs be implemented similarly ? In Netscape 4.x, Mozilla, and Opera, the save as function (Ctrl-S) uses the filename NOT the page title in the save as dialog and the file type is derived from the extension. Currently K-Meleon's Save As functionality is uninituitive and inconsistent with Save Link As and Save Image As, both of which work as expected. As it stands now whenever I want to save a page I either have to go back to get the link to the page or use the global history so I can use Save Link As which is a very inconvenient way of working.
Note I'm an assembly language and C programmer not a C++ programmer so this may not be quite correct but it should be close to what's needed. It's based on the existing OnSaveLinkAs/OnSaveImageAs functions and uses code from OnViewSource to get the current URL into variable currentURI which is passed to URISaveAs. This code is much simpler than what's there now which doesn't work as expected.
void CBrowserView::OnFileSaveAs()
{
// Try to get the file name part from the URL
// To do that we first construct an obj which supports
// nsIRUI interface. Makes it easy to extract portions
// of a URL like the filename, scheme etc. + We'll also
// use it while saving this link to a file
nsresult rv = NS_OK;
nsCOMPtr<nsIURI> currentURI;
rv = mWebNav->GetCurrentURI(getter_AddRefs(currentURI));
if(NS_FAILED(rv) || !currentURI)
return;
URISaveAs(currentURI);
}
Ulf  2003-07-23 15:05:27
Thanks. Patch submitted to CVS.
Ulf  2003-07-23 15:05:45

[Changed Status from "Open" to "Fixed"]
rmn  2006-07-18 12:32:24

[Changed Status from "Fixed" to "Closed"]

SourceForge Logo