diff options
author | Marco Pesenti Gritti <mpeseng@src.gnome.org> | 2003-06-15 21:21:21 +0800 |
---|---|---|
committer | Marco Pesenti Gritti <mpeseng@src.gnome.org> | 2003-06-15 21:21:21 +0800 |
commit | f8cbf86bbc84292974146504dfa287b119c0ba8e (patch) | |
tree | e2178038f1362863abf451ebcedd37589e1146c7 /embed | |
parent | edb7d2cc2c5c40ad9c8ecf167b760a7cf9ce4240 (diff) | |
download | gsoc2013-epiphany-f8cbf86bbc84292974146504dfa287b119c0ba8e.tar gsoc2013-epiphany-f8cbf86bbc84292974146504dfa287b119c0ba8e.tar.gz gsoc2013-epiphany-f8cbf86bbc84292974146504dfa287b119c0ba8e.tar.bz2 gsoc2013-epiphany-f8cbf86bbc84292974146504dfa287b119c0ba8e.tar.lz gsoc2013-epiphany-f8cbf86bbc84292974146504dfa287b119c0ba8e.tar.xz gsoc2013-epiphany-f8cbf86bbc84292974146504dfa287b119c0ba8e.tar.zst gsoc2013-epiphany-f8cbf86bbc84292974146504dfa287b119c0ba8e.zip |
*** empty log message ***
Diffstat (limited to 'embed')
-rw-r--r-- | embed/mozilla/FilePicker.cpp | 50 | ||||
-rw-r--r-- | embed/mozilla/FilePicker.h | 3 |
2 files changed, 31 insertions, 22 deletions
diff --git a/embed/mozilla/FilePicker.cpp b/embed/mozilla/FilePicker.cpp index bb9b0aaeb..537a66d7b 100644 --- a/embed/mozilla/FilePicker.cpp +++ b/embed/mozilla/FilePicker.cpp @@ -284,14 +284,17 @@ NS_IMETHODIMP GFilePicker::Show(PRInt16 *_retval) gint retVal = gtk_dialog_run(GTK_DIALOG(mFileSelector)); - HandleFilePickerResult(_retval); + HandleFilePickerResult(); if (retVal != GTK_RESPONSE_OK) { *_retval = returnCancel; } + else + { + ValidateFilePickerResult(_retval); + } - gtk_widget_hide(mFileSelector); gtk_widget_destroy(mFileSelector); return NS_OK; @@ -407,24 +410,12 @@ NS_METHOD GFilePicker::SanityCheck (PRBool *retIsSane) // begin local private methods impl //////////////////////////////////////////////////////////////////////////////// -NS_METHOD GFilePicker::HandleFilePickerResult(PRInt16 *retval) +NS_METHOD GFilePicker::HandleFilePickerResult() { - *retval = returnCancel; - nsresult rv; - const char *fileName = gtk_file_selection_get_filename(GTK_FILE_SELECTION(mFileSelector)); if (!fileName || strlen(fileName) == 0) return NS_ERROR_FAILURE; - if (mMode == nsIFilePicker::modeSave) - { - if (!ephy_gui_confirm_overwrite_file (mFileSelector, - fileName)) - { - return NS_OK; - } - } - const nsACString &cFileName = nsDependentCString(fileName); mFile->InitWithNativePath(cFileName); @@ -441,10 +432,6 @@ NS_METHOD GFilePicker::HandleFilePickerResult(PRInt16 *retval) mFile->GetNativeLeafName(mDefaultString); } - PRBool passesSanityCheck; - rv = SanityCheck(&passesSanityCheck); - if (NS_SUCCEEDED(rv) && !passesSanityCheck) return NS_ERROR_FAILURE; - if (mFormatChooser) { GtkWidget *menu = gtk_option_menu_get_menu @@ -463,9 +450,30 @@ NS_METHOD GFilePicker::HandleFilePickerResult(PRInt16 *retval) } } - *retval = returnOK; - return NS_OK; } +NS_METHOD GFilePicker::ValidateFilePickerResult(PRInt16 *retval) +{ + nsresult rv; + const char *fileName = gtk_file_selection_get_filename(GTK_FILE_SELECTION(mFileSelector)); + + *retval = returnCancel; + PRBool passesSanityCheck; + rv = SanityCheck(&passesSanityCheck); + if (NS_SUCCEEDED(rv) && !passesSanityCheck) return NS_ERROR_FAILURE; + + if (mMode == nsIFilePicker::modeSave) + { + if (!ephy_gui_confirm_overwrite_file (mFileSelector, + fileName)) + { + return NS_OK; + } + } + + *retval = returnOK; + + return NS_OK; +} diff --git a/embed/mozilla/FilePicker.h b/embed/mozilla/FilePicker.h index c478ce7a1..0b4c98af1 100644 --- a/embed/mozilla/FilePicker.h +++ b/embed/mozilla/FilePicker.h @@ -65,7 +65,8 @@ class GFilePicker : public nsIFilePicker PRInt16 mSelectedFileFormat; private: - NS_METHOD HandleFilePickerResult(PRInt16 *retval); + NS_METHOD HandleFilePickerResult(); + NS_METHOD ValidateFilePickerResult(PRInt16 *retval); nsCOMPtr<nsIDOMWindow> mParent; |