aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ChangeLog6
-rw-r--r--embed/mozilla/ContentHandler.cpp14
2 files changed, 17 insertions, 3 deletions
diff --git a/ChangeLog b/ChangeLog
index c1de7c1a1..11bb44a8e 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,11 @@
2004-07-31 Christian Persch <chpe@cvs.gnome.org>
+ * embed/mozilla/ContentHandler.cpp:
+
+ Confirm before overwriting a file. Fixes bug #143501.
+
+2004-07-31 Christian Persch <chpe@cvs.gnome.org>
+
* src/prefs-dialog.c: (prefs_download_path_button_clicked_cb):
Start the directory choose in the home dir. Fixes bug #146055.
diff --git a/embed/mozilla/ContentHandler.cpp b/embed/mozilla/ContentHandler.cpp
index 5ec5e281c..448c6f8bd 100644
--- a/embed/mozilla/ContentHandler.cpp
+++ b/embed/mozilla/ContentHandler.cpp
@@ -49,6 +49,7 @@
#include "ephy-embed-shell.h"
#include "ephy-file-chooser.h"
#include "ephy-stock-icons.h"
+#include "ephy-gui.h"
#include "ephy-debug.h"
#include "eel-gconf-extensions.h"
@@ -130,7 +131,7 @@ NS_IMETHODIMP GContentHandler::PromptForSaveToFile(
{
EphyFileChooser *dialog;
gint response;
- char *filename;
+ char *filename = NULL;
nsEmbedCString defaultFile;
NS_UTF16ToCString (nsEmbedString (aDefaultFile),
@@ -149,13 +150,20 @@ NS_IMETHODIMP GContentHandler::PromptForSaveToFile(
CONF_STATE_SAVE_DIR,
EPHY_FILE_FILTER_ALL);
gtk_file_chooser_set_current_name (GTK_FILE_CHOOSER (dialog), defaultFile.get());
- response = gtk_dialog_run (GTK_DIALOG (dialog));
- if (response == GTK_RESPONSE_ACCEPT)
+ do
{
+ g_free (filename);
+ response = gtk_dialog_run (GTK_DIALOG (dialog));
filename = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (dialog));
+ } while (response == GTK_RESPONSE_ACCEPT
+ && !ephy_gui_confirm_overwrite_file (GTK_WIDGET (dialog), filename));
+ if (response == GTK_RESPONSE_ACCEPT)
+ {
nsCOMPtr <nsILocalFile> destFile (do_CreateInstance(NS_LOCAL_FILE_CONTRACTID));
+ NS_ENSURE_TRUE (destFile, NS_ERROR_FAILURE);
+
destFile->InitWithNativePath (nsEmbedCString (filename));
g_free (filename);