NS_METHOD GContentHandler::MIMEConfirmAction (){ GtkWidget *dialog, *button, *image; const char *action_label; const char *mime_description; const gchar *file_name; nsEmbedCString suggested_name_c; nsCOMPtr<nsIDOMWindow> parentDOMWindow = do_GetInterface (mContext); GtkWindow *parentWindow = GTK_WINDOW (EphyUtils::FindGtkParent(parentDOMWindow)); action_label = (mAction == CONTENT_ACTION_OPEN) || (mAction == CONTENT_ACTION_OPEN_TMP) ? GTK_STOCK_OPEN : EPHY_STOCK_DOWNLOAD;#ifdef HAVE_GECKO_1_8 mime_description = gnome_vfs_mime_get_description (mMimeType.get());#else mime_description = gnome_vfs_mime_get_description (mMimeType);#endif if (mime_description == NULL) { mime_description = Q_("File Type:|Unknown"); }#ifdef HAVE_GECKO_1_8 { nsEmbedString suggested; mLauncher->GetSuggestedFileName(&suggested); NS_UTF16ToCString ( suggested, NS_CSTRING_ENCODING_UTF8, suggested_name_c); file_name = suggested_name_c.get();#else { PRUnichar *suggested = nsnull; mLauncher->GetSuggestedFileName(&suggested); if (suggested != nsnull) { NS_UTF16ToCString ( nsEmbedString(suggested), NS_CSTRING_ENCODING_UTF8, suggested_name_c); file_name = suggested_name_c.get(); nsMemory::Free(suggested); } else { file_name = ""; } }#endif if (mPermission != EPHY_MIME_PERMISSION_SAFE && mHelperApp) { dialog = gtk_message_dialog_new (parentWindow, GTK_DIALOG_DESTROY_WITH_PARENT, GTK_MESSAGE_WARNING, GTK_BUTTONS_NONE, _("Download this unsafe file?")); gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (dialog), /* translators: First %s is the file type description, Second %s is the file name */ _("File Type: %s.\nIt is unsafe to open \"%s\", " "it could potentially damage your documents or " "invade your privacy. You can download it instead."), mime_description, file_name); } else if (mAction == CONTENT_ACTION_OPEN_TMP && mHelperApp) { dialog = gtk_message_dialog_new (parentWindow, GTK_DIALOG_DESTROY_WITH_PARENT, GTK_MESSAGE_QUESTION, GTK_BUTTONS_NONE, _("Open this file?")); gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (dialog), /* translators: First %s is the file type description, Second %s is the file name, Third %s is the application used to open the file */ _("File Type: %s.\nYou can open \"%s\" using %s or save it."), mime_description, file_name, mHelperApp->name); } else { dialog = gtk_message_dialog_new (parentWindow, GTK_DIALOG_DESTROY_WITH_PARENT, GTK_MESSAGE_QUESTION, GTK_BUTTONS_NONE, _("Download this file?")); gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (dialog), /* translators: First %s is the file type description, Second %s is the file name */ _("File Type: %s.\nYou have no application able to open \"%s\". " "You can download it instead."), mime_description, file_name); }