Bug 511290: Can't use standard file picker to upload files from user's Maemo File area [r=roc r=ted.mielczarek]

This commit is contained in:
Mark Finkle 2009-10-15 14:38:10 -04:00
Родитель d1b6c0a0f6
Коммит 5af590af06
4 изменённых файлов: 23 добавлений и 2 удалений

Просмотреть файл

@ -625,6 +625,8 @@ LIBHILDONMIME_CFLAGS = @LIBHILDONMIME_CFLAGS@
LIBHILDONMIME_LIBS = @LIBHILDONMIME_LIBS@ LIBHILDONMIME_LIBS = @LIBHILDONMIME_LIBS@
LIBOSSO_CFLAGS = @LIBOSSO_CFLAGS@ LIBOSSO_CFLAGS = @LIBOSSO_CFLAGS@
LIBOSSO_LIBS = @LIBOSSO_LIBS@ LIBOSSO_LIBS = @LIBOSSO_LIBS@
LIBHILDONFM_CFLAGS = @LIBHILDONFM_CFLAGS@
LIBHILDONFM_LIBS = @LIBHILDONFM_LIBS@
MACOS_SDK_DIR = @MACOS_SDK_DIR@ MACOS_SDK_DIR = @MACOS_SDK_DIR@
NEXT_ROOT = @NEXT_ROOT@ NEXT_ROOT = @NEXT_ROOT@

Просмотреть файл

@ -6198,6 +6198,12 @@ fi
AC_SUBST(LIBOSSO_CFLAGS) AC_SUBST(LIBOSSO_CFLAGS)
AC_SUBST(LIBOSSO_LIBS) AC_SUBST(LIBOSSO_LIBS)
PKG_CHECK_MODULES(LIBHILDONFM,hildon-fm-2,
NS_HILDONFM=1,
NS_HILDONFM)
AC_SUBST(LIBHILDONFM_CFLAGS)
AC_SUBST(LIBHILDONFM_LIBS)
dnl ======================================================== dnl ========================================================
dnl = faststripe theme dnl = faststripe theme
dnl ======================================================== dnl ========================================================

Просмотреть файл

@ -205,7 +205,7 @@ endif
endif endif
ifdef MOZ_PLATFORM_HILDON ifdef MOZ_PLATFORM_HILDON
EXTRA_DSO_LDOPTS += $(LIBHILDONMIME_LIBS) EXTRA_DSO_LDOPTS += $(LIBHILDONMIME_LIBS) $(LIBHILDONFM_LIBS)
endif endif
ifdef NS_OSSO ifdef NS_OSSO

Просмотреть файл

@ -56,6 +56,10 @@
#include "nsFilePicker.h" #include "nsFilePicker.h"
#include "nsAccessibilityHelper.h" #include "nsAccessibilityHelper.h"
#ifdef MOZ_PLATFORM_HILDON
#include <hildon-fm-2/hildon/hildon-file-chooser-dialog.h>
#endif
#define MAX_PREVIEW_SIZE 180 #define MAX_PREVIEW_SIZE 180
nsILocalFile *nsFilePicker::mPrevDisplayDirectory = nsnull; nsILocalFile *nsFilePicker::mPrevDisplayDirectory = nsnull;
@ -429,6 +433,14 @@ nsFilePicker::Show(PRInt16 *aReturn)
GtkFileChooserAction action = GetGtkFileChooserAction(mMode); GtkFileChooserAction action = GetGtkFileChooserAction(mMode);
const gchar *accept_button = (action == GTK_FILE_CHOOSER_ACTION_SAVE) const gchar *accept_button = (action == GTK_FILE_CHOOSER_ACTION_SAVE)
? GTK_STOCK_SAVE : GTK_STOCK_OPEN; ? GTK_STOCK_SAVE : GTK_STOCK_OPEN;
#ifdef MOZ_PLATFORM_HILDON
GtkWidget *file_chooser =
hildon_file_chooser_dialog_new_with_properties(parent_widget,
"action", action,
"open-button-text", accept_button,
NULL);
gtk_window_set_title(GTK_WINDOW(file_chooser), title);
#else
GtkWidget *file_chooser = GtkWidget *file_chooser =
gtk_file_chooser_dialog_new(title, parent_widget, action, gtk_file_chooser_dialog_new(title, parent_widget, action,
GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
@ -441,6 +453,7 @@ nsFilePicker::Show(PRInt16 *aReturn)
if (mAllowURLs) { if (mAllowURLs) {
gtk_file_chooser_set_local_only(GTK_FILE_CHOOSER(file_chooser), FALSE); gtk_file_chooser_set_local_only(GTK_FILE_CHOOSER(file_chooser), FALSE);
} }
#endif
if (action == GTK_FILE_CHOOSER_ACTION_OPEN || action == GTK_FILE_CHOOSER_ACTION_SAVE) { if (action == GTK_FILE_CHOOSER_ACTION_OPEN || action == GTK_FILE_CHOOSER_ACTION_SAVE) {
GtkWidget *img_preview = gtk_image_new(); GtkWidget *img_preview = gtk_image_new();
@ -528,6 +541,7 @@ nsFilePicker::Show(PRInt16 *aReturn)
gint response = gtk_dialog_run(GTK_DIALOG(file_chooser)); gint response = gtk_dialog_run(GTK_DIALOG(file_chooser));
switch (response) { switch (response) {
case GTK_RESPONSE_OK:
case GTK_RESPONSE_ACCEPT: case GTK_RESPONSE_ACCEPT:
ReadValuesFromFileChooser(file_chooser); ReadValuesFromFileChooser(file_chooser);
*aReturn = nsIFilePicker::returnOK; *aReturn = nsIFilePicker::returnOK;
@ -539,7 +553,6 @@ nsFilePicker::Show(PRInt16 *aReturn)
file->Exists(&exists); file->Exists(&exists);
if (exists) if (exists)
*aReturn = nsIFilePicker::returnReplace; *aReturn = nsIFilePicker::returnReplace;
} }
} }
break; break;