aboutsummaryrefslogtreecommitdiffstats
path: root/embed/mozilla/ContentHandler.cpp
diff options
context:
space:
mode:
authorXan Lopez <xan@src.gnome.org>2003-11-28 07:46:32 +0800
committerXan Lopez <xan@src.gnome.org>2003-11-28 07:46:32 +0800
commit493334ce5b250010cd55fddfef9d83470b6d0c70 (patch)
treeb0ca55562c16790de3626e99f38e0aa75e735e5a /embed/mozilla/ContentHandler.cpp
parent9bba3e204ba22f682e2ab211f9fccf760ae58a93 (diff)
downloadgsoc2013-epiphany-493334ce5b250010cd55fddfef9d83470b6d0c70.tar
gsoc2013-epiphany-493334ce5b250010cd55fddfef9d83470b6d0c70.tar.gz
gsoc2013-epiphany-493334ce5b250010cd55fddfef9d83470b6d0c70.tar.bz2
gsoc2013-epiphany-493334ce5b250010cd55fddfef9d83470b6d0c70.tar.lz
gsoc2013-epiphany-493334ce5b250010cd55fddfef9d83470b6d0c70.tar.xz
gsoc2013-epiphany-493334ce5b250010cd55fddfef9d83470b6d0c70.tar.zst
gsoc2013-epiphany-493334ce5b250010cd55fddfef9d83470b6d0c70.zip
Do not blindly overwrite when downloading a file with the same name than a
* embed/mozilla/ContentHandler.cpp: * embed/mozilla/EphyHeaderSniffer.cpp: * embed/mozilla/MozDownload.cpp: * embed/mozilla/MozDownload.h: Do not blindly overwrite when downloading a file with the same name than a local one, append a number after the name. Fixes (more or less) #12775
Diffstat (limited to 'embed/mozilla/ContentHandler.cpp')
-rw-r--r--embed/mozilla/ContentHandler.cpp44
1 files changed, 3 insertions, 41 deletions
diff --git a/embed/mozilla/ContentHandler.cpp b/embed/mozilla/ContentHandler.cpp
index 7286ba3ff..1ad9095ff 100644
--- a/embed/mozilla/ContentHandler.cpp
+++ b/embed/mozilla/ContentHandler.cpp
@@ -25,6 +25,7 @@
#include "ContentHandler.h"
#include "MozillaPrivate.h"
+#include "MozDownload.h"
#include "nsCOMPtr.h"
#include "nsString.h"
@@ -104,47 +105,8 @@ NS_IMETHODIMP GContentHandler::PromptForSaveToFile(
const PRUnichar *aSuggestedFileExtension,
nsILocalFile **_retval)
{
- char *path, *download_dir;
-
- download_dir = eel_gconf_get_string (CONF_STATE_DOWNLOAD_DIR);
- if (!download_dir)
- {
- /* Emergency download destination */
- download_dir = g_strdup (g_get_home_dir ());
- }
-
- if (!strcmp (download_dir, "Desktop"))
- {
- if (eel_gconf_get_boolean (CONF_DESKTOP_IS_HOME_DIR))
- {
- path = g_build_filename
- (g_get_home_dir (),
- NS_ConvertUCS2toUTF8 (aDefaultFile).get(),
- NULL);
- }
- else
- {
- path = g_build_filename
- (g_get_home_dir (), "Desktop",
- NS_ConvertUCS2toUTF8 (aDefaultFile).get(),
- NULL);
- }
- }
- else
- {
- path = g_build_filename
- (gnome_vfs_expand_initial_tilde (download_dir),
- NS_ConvertUCS2toUTF8 (aDefaultFile).get(),
- NULL);
- }
- g_free (download_dir);
-
- nsCOMPtr <nsILocalFile> destFile (do_CreateInstance(NS_LOCAL_FILE_CONTRACTID));
- destFile->InitWithNativePath (nsDependentCString (path));
- g_free (path);
-
- NS_IF_ADDREF (*_retval = destFile);
- return NS_OK;
+ return BuildDownloadPath (NS_ConvertUCS2toUTF8 (aDefaultFile).get(),
+ _retval);
}
#if MOZILLA_SNAPSHOT < 10