aboutsummaryrefslogtreecommitdiffstats
path: root/embed
diff options
context:
space:
mode:
Diffstat (limited to 'embed')
-rw-r--r--embed/mozilla/ContentHandler.cpp34
-rw-r--r--embed/mozilla/ContentHandler.h3
2 files changed, 27 insertions, 10 deletions
diff --git a/embed/mozilla/ContentHandler.cpp b/embed/mozilla/ContentHandler.cpp
index cdf844c9b..622c95ca7 100644
--- a/embed/mozilla/ContentHandler.cpp
+++ b/embed/mozilla/ContentHandler.cpp
@@ -250,7 +250,7 @@ NS_METHOD GContentHandler::Init (void)
return NS_OK;
}
-NS_METHOD GContentHandler::MIMEConfirmAction ()
+NS_METHOD GContentHandler::MIMEConfirmAction (PRBool autoDownload)
{
GtkWidget *dialog;
GtkWidget *hbox, *vbox, *label, *image;
@@ -278,7 +278,9 @@ NS_METHOD GContentHandler::MIMEConfirmAction ()
gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog)->vbox), hbox,
TRUE, TRUE, 0);
- if (mPermission != EPHY_MIME_PERMISSION_SAFE)
+ g_print ("AAA %d %p", mPermission, mHelperApp);
+
+ if (mPermission == EPHY_MIME_PERMISSION_UNSAFE && mHelperApp)
{
text = g_strdup_printf ("<span weight=\"bold\" size=\"larger\">%s</span>\n\n%s",
_("Download the unsafe file?"),
@@ -287,7 +289,7 @@ NS_METHOD GContentHandler::MIMEConfirmAction ()
"It's not safe to open it directly. You "
"can save it instead."));
}
- else if (mAction == CONTENT_ACTION_OPEN)
+ else if (mAction == CONTENT_ACTION_OPEN && !autoDownload)
{
text = g_strdup_printf ("<span weight=\"bold\" size=\"larger\">%s</span>\n\n%s",
_("Open the file in another application?"),
@@ -352,23 +354,30 @@ NS_METHOD GContentHandler::MIMEDoAction (void)
CheckAppSupportScheme ();
mPermission = ephy_embed_shell_check_mime (embed_shell, mMimeType);
- mAction = CONTENT_ACTION_OPEN;
+ if (auto_downloads)
+ {
+ mAction = CONTENT_ACTION_OPEN;
+ }
+ else
+ {
+ mAction = CONTENT_ACTION_OPEN_TMP;
+ }
- if (mPermission != EPHY_MIME_PERMISSION_SAFE)
+ if (!mHelperApp || mPermission == EPHY_MIME_PERMISSION_UNSAFE)
{
mAction = CONTENT_ACTION_DOWNLOAD;
}
- if (!auto_downloads)
+ if (!auto_downloads || mAction == CONTENT_ACTION_DOWNLOAD)
{
- MIMEConfirmAction ();
+ MIMEConfirmAction (auto_downloads);
}
nsCOMPtr<nsIMIMEInfo> mimeInfo;
mLauncher->GetMIMEInfo(getter_AddRefs(mimeInfo));
NS_ENSURE_TRUE (mimeInfo, NS_ERROR_FAILURE);
- if (mAction == CONTENT_ACTION_OPEN && auto_downloads)
+ if (mAction == CONTENT_ACTION_OPEN)
{
/* HACK we use the application description to ask
MozDownload to open the file when download
@@ -387,10 +396,17 @@ NS_METHOD GContentHandler::MIMEDoAction (void)
{
LaunchHelperApp ();
}
- else if (auto_downloads)
+ else
{
mLauncher->SaveToDisk (nsnull, PR_FALSE);
}
+ }
+ else if (mAction == CONTENT_ACTION_OPEN_TMP)
+ {
+ if (mAppSupportScheme)
+ {
+ LaunchHelperApp ();
+ }
else
{
mLauncher->LaunchWithApplication (nsnull, PR_FALSE);
diff --git a/embed/mozilla/ContentHandler.h b/embed/mozilla/ContentHandler.h
index 6aa39658d..3642cc65d 100644
--- a/embed/mozilla/ContentHandler.h
+++ b/embed/mozilla/ContentHandler.h
@@ -43,6 +43,7 @@
typedef enum
{
CONTENT_ACTION_OPEN,
+ CONTENT_ACTION_OPEN_TMP,
CONTENT_ACTION_DOWNLOAD,
CONTENT_ACTION_SAVEAS,
CONTENT_ACTION_NONE
@@ -72,7 +73,7 @@ class GContentHandler : public nsIHelperAppLauncherDialog
NS_METHOD Init ();
NS_METHOD LaunchHelperApp ();
- NS_METHOD MIMEConfirmAction ();
+ NS_METHOD MIMEConfirmAction (PRBool autoDownload);
NS_METHOD MIMEDoAction ();
NS_METHOD CheckAppSupportScheme ();