QGtkStyle: remove file dialog functionality
GTK+ 2.x file dialogs are now implemented in QGtk2PlatformTheme Change-Id: I2babd6a35e7abd606ec5d047abbefbe3f0fbb892 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com> Reviewed-by: Shawn Rutledge <shawn.rutledge@digia.com> Reviewed-by: David Faure <david.faure@kdab.com>
This commit is contained in:
parent
48e6352d4c
commit
45f264b682
@ -471,15 +471,8 @@ void QGtkStyle::polish(QApplication *app)
|
|||||||
QApplicationPrivate::setSystemPalette(standardPalette());
|
QApplicationPrivate::setSystemPalette(standardPalette());
|
||||||
QApplicationPrivate::setSystemFont(d->getThemeFont());
|
QApplicationPrivate::setSystemFont(d->getThemeFont());
|
||||||
d->applyCustomPaletteHash();
|
d->applyCustomPaletteHash();
|
||||||
if (!d->isKDE4Session()) {
|
if (!d->isKDE4Session())
|
||||||
#ifndef QT_NO_FILEDIALOG
|
|
||||||
qt_filedialog_open_filename_hook = &QGtkStylePrivate::openFilename;
|
|
||||||
qt_filedialog_save_filename_hook = &QGtkStylePrivate::saveFilename;
|
|
||||||
qt_filedialog_open_filenames_hook = &QGtkStylePrivate::openFilenames;
|
|
||||||
qt_filedialog_existing_directory_hook = &QGtkStylePrivate::openDirectory;
|
|
||||||
#endif
|
|
||||||
qApp->installEventFilter(&d->filter);
|
qApp->installEventFilter(&d->filter);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -493,16 +486,8 @@ void QGtkStyle::unpolish(QApplication *app)
|
|||||||
QCommonStyle::unpolish(app);
|
QCommonStyle::unpolish(app);
|
||||||
QPixmapCache::clear();
|
QPixmapCache::clear();
|
||||||
|
|
||||||
if (app->desktopSettingsAware() && d->isThemeAvailable()
|
if (app->desktopSettingsAware() && d->isThemeAvailable() && !d->isKDE4Session())
|
||||||
&& !d->isKDE4Session()) {
|
|
||||||
#ifndef QT_NO_FILEDIALOG
|
|
||||||
qt_filedialog_open_filename_hook = 0;
|
|
||||||
qt_filedialog_save_filename_hook = 0;
|
|
||||||
qt_filedialog_open_filenames_hook = 0;
|
|
||||||
qt_filedialog_existing_directory_hook = 0;
|
|
||||||
#endif
|
|
||||||
qApp->removeEventFilter(&d->filter);
|
qApp->removeEventFilter(&d->filter);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
|
@ -180,20 +180,6 @@ Ptr_pango_font_description_get_weight QGtkStylePrivate::pango_font_description_g
|
|||||||
Ptr_pango_font_description_get_family QGtkStylePrivate::pango_font_description_get_family = 0;
|
Ptr_pango_font_description_get_family QGtkStylePrivate::pango_font_description_get_family = 0;
|
||||||
Ptr_pango_font_description_get_style QGtkStylePrivate::pango_font_description_get_style = 0;
|
Ptr_pango_font_description_get_style QGtkStylePrivate::pango_font_description_get_style = 0;
|
||||||
|
|
||||||
Ptr_gtk_file_filter_new QGtkStylePrivate::gtk_file_filter_new = 0;
|
|
||||||
Ptr_gtk_file_filter_set_name QGtkStylePrivate::gtk_file_filter_set_name = 0;
|
|
||||||
Ptr_gtk_file_filter_add_pattern QGtkStylePrivate::gtk_file_filter_add_pattern = 0;
|
|
||||||
Ptr_gtk_file_chooser_add_filter QGtkStylePrivate::gtk_file_chooser_add_filter = 0;
|
|
||||||
Ptr_gtk_file_chooser_set_filter QGtkStylePrivate::gtk_file_chooser_set_filter = 0;
|
|
||||||
Ptr_gtk_file_chooser_get_filter QGtkStylePrivate::gtk_file_chooser_get_filter = 0;
|
|
||||||
Ptr_gtk_file_chooser_dialog_new QGtkStylePrivate::gtk_file_chooser_dialog_new = 0;
|
|
||||||
Ptr_gtk_file_chooser_set_current_folder QGtkStylePrivate::gtk_file_chooser_set_current_folder = 0;
|
|
||||||
Ptr_gtk_file_chooser_get_filename QGtkStylePrivate::gtk_file_chooser_get_filename = 0;
|
|
||||||
Ptr_gtk_file_chooser_get_filenames QGtkStylePrivate::gtk_file_chooser_get_filenames = 0;
|
|
||||||
Ptr_gtk_file_chooser_set_current_name QGtkStylePrivate::gtk_file_chooser_set_current_name = 0;
|
|
||||||
Ptr_gtk_dialog_run QGtkStylePrivate::gtk_dialog_run = 0;
|
|
||||||
Ptr_gtk_file_chooser_set_filename QGtkStylePrivate::gtk_file_chooser_set_filename = 0;
|
|
||||||
|
|
||||||
Ptr_gdk_pixbuf_get_pixels QGtkStylePrivate::gdk_pixbuf_get_pixels = 0;
|
Ptr_gdk_pixbuf_get_pixels QGtkStylePrivate::gdk_pixbuf_get_pixels = 0;
|
||||||
Ptr_gdk_pixbuf_get_width QGtkStylePrivate::gdk_pixbuf_get_width = 0;
|
Ptr_gdk_pixbuf_get_width QGtkStylePrivate::gdk_pixbuf_get_width = 0;
|
||||||
Ptr_gdk_pixbuf_get_height QGtkStylePrivate::gdk_pixbuf_get_height = 0;
|
Ptr_gdk_pixbuf_get_height QGtkStylePrivate::gdk_pixbuf_get_height = 0;
|
||||||
@ -356,21 +342,6 @@ void QGtkStylePrivate::resolveGtk() const
|
|||||||
gtk_widget_destroy = (Ptr_gtk_widget_destroy)libgtk.resolve("gtk_widget_destroy");
|
gtk_widget_destroy = (Ptr_gtk_widget_destroy)libgtk.resolve("gtk_widget_destroy");
|
||||||
gtk_widget_realize = (Ptr_gtk_widget_realize)libgtk.resolve("gtk_widget_realize");
|
gtk_widget_realize = (Ptr_gtk_widget_realize)libgtk.resolve("gtk_widget_realize");
|
||||||
|
|
||||||
gtk_file_chooser_set_current_folder = (Ptr_gtk_file_chooser_set_current_folder)libgtk.resolve("gtk_file_chooser_set_current_folder");
|
|
||||||
gtk_file_filter_new = (Ptr_gtk_file_filter_new)libgtk.resolve("gtk_file_filter_new");
|
|
||||||
gtk_file_filter_set_name = (Ptr_gtk_file_filter_set_name)libgtk.resolve("gtk_file_filter_set_name");
|
|
||||||
gtk_file_filter_add_pattern = (Ptr_gtk_file_filter_add_pattern)libgtk.resolve("gtk_file_filter_add_pattern");
|
|
||||||
gtk_file_chooser_add_filter = (Ptr_gtk_file_chooser_add_filter)libgtk.resolve("gtk_file_chooser_add_filter");
|
|
||||||
gtk_file_chooser_set_filter = (Ptr_gtk_file_chooser_set_filter)libgtk.resolve("gtk_file_chooser_set_filter");
|
|
||||||
gtk_file_chooser_get_filter = (Ptr_gtk_file_chooser_get_filter)libgtk.resolve("gtk_file_chooser_get_filter");
|
|
||||||
gtk_file_chooser_dialog_new = (Ptr_gtk_file_chooser_dialog_new)libgtk.resolve("gtk_file_chooser_dialog_new");
|
|
||||||
gtk_file_chooser_set_current_folder = (Ptr_gtk_file_chooser_set_current_folder)libgtk.resolve("gtk_file_chooser_set_current_folder");
|
|
||||||
gtk_file_chooser_get_filename = (Ptr_gtk_file_chooser_get_filename)libgtk.resolve("gtk_file_chooser_get_filename");
|
|
||||||
gtk_file_chooser_get_filenames = (Ptr_gtk_file_chooser_get_filenames)libgtk.resolve("gtk_file_chooser_get_filenames");
|
|
||||||
gtk_file_chooser_set_current_name = (Ptr_gtk_file_chooser_set_current_name)libgtk.resolve("gtk_file_chooser_set_current_name");
|
|
||||||
gtk_dialog_run = (Ptr_gtk_dialog_run)libgtk.resolve("gtk_dialog_run");
|
|
||||||
gtk_file_chooser_set_filename = (Ptr_gtk_file_chooser_set_filename)libgtk.resolve("gtk_file_chooser_set_filename");
|
|
||||||
|
|
||||||
gdk_pixbuf_get_pixels = (Ptr_gdk_pixbuf_get_pixels)libgtk.resolve("gdk_pixbuf_get_pixels");
|
gdk_pixbuf_get_pixels = (Ptr_gdk_pixbuf_get_pixels)libgtk.resolve("gdk_pixbuf_get_pixels");
|
||||||
gdk_pixbuf_get_width = (Ptr_gdk_pixbuf_get_width)libgtk.resolve("gdk_pixbuf_get_width");
|
gdk_pixbuf_get_width = (Ptr_gdk_pixbuf_get_width)libgtk.resolve("gdk_pixbuf_get_width");
|
||||||
gdk_pixbuf_get_height = (Ptr_gdk_pixbuf_get_height)libgtk.resolve("gdk_pixbuf_get_height");
|
gdk_pixbuf_get_height = (Ptr_gdk_pixbuf_get_height)libgtk.resolve("gdk_pixbuf_get_height");
|
||||||
@ -881,233 +852,6 @@ QFont QGtkStylePrivate::getThemeFont()
|
|||||||
return font;
|
return font;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// ----------- Native file dialogs -----------
|
|
||||||
|
|
||||||
// Extract filter list from expressions of type: foo (*.a *.b *.c)"
|
|
||||||
QStringList QGtkStylePrivate::extract_filter(const QString &rawFilter)
|
|
||||||
{
|
|
||||||
QString result = rawFilter;
|
|
||||||
QRegExp r(QString::fromLatin1("^([^()]*)\\(([a-zA-Z0-9_.*? +;#\\-\\[\\]@\\{\\}/!<>\\$%&=^~:\\|]*)\\)$"));
|
|
||||||
int index = r.indexIn(result);
|
|
||||||
if (index >= 0)
|
|
||||||
result = r.cap(2);
|
|
||||||
return result.split(QLatin1Char(' '));
|
|
||||||
}
|
|
||||||
|
|
||||||
extern QStringList qt_make_filter_list(const QString &filter);
|
|
||||||
|
|
||||||
#ifndef QT_NO_FILEDIALOG
|
|
||||||
void QGtkStylePrivate::setupGtkFileChooser(GtkWidget* gtkFileChooser, QWidget *parent,
|
|
||||||
const QString &dir, const QString &filter, QString *selectedFilter,
|
|
||||||
QFileDialog::Options options, bool isSaveDialog,
|
|
||||||
QHash<GtkFileFilter *, QString> *filterMap)
|
|
||||||
{
|
|
||||||
g_object_set(gtkFileChooser, "do-overwrite-confirmation", gboolean(!(options & QFileDialog::DontConfirmOverwrite)), NULL);
|
|
||||||
g_object_set(gtkFileChooser, "local_only", gboolean(true), NULL);
|
|
||||||
if (!filter.isEmpty()) {
|
|
||||||
QStringList filters = qt_make_filter_list(filter);
|
|
||||||
foreach (const QString &rawfilter, filters) {
|
|
||||||
GtkFileFilter *gtkFilter = QGtkStylePrivate::gtk_file_filter_new ();
|
|
||||||
QString name = rawfilter.left(rawfilter.indexOf(QLatin1Char('(')));
|
|
||||||
QStringList extensions = extract_filter(rawfilter);
|
|
||||||
QGtkStylePrivate::gtk_file_filter_set_name(gtkFilter, qPrintable(name.isEmpty() ? extensions.join(QLS(", ")) : name));
|
|
||||||
|
|
||||||
foreach (const QString &fileExtension, extensions) {
|
|
||||||
// Note Gtk file dialogs are by default case sensitive
|
|
||||||
// and only supports basic glob syntax so we
|
|
||||||
// rewrite .xyz to .[xX][yY][zZ]
|
|
||||||
QString caseInsensitive;
|
|
||||||
for (int i = 0 ; i < fileExtension.length() ; ++i) {
|
|
||||||
QChar ch = fileExtension.at(i);
|
|
||||||
if (ch.isLetter()) {
|
|
||||||
caseInsensitive.append(
|
|
||||||
QLatin1Char('[') +
|
|
||||||
ch.toLower() +
|
|
||||||
ch.toUpper() +
|
|
||||||
QLatin1Char(']'));
|
|
||||||
} else {
|
|
||||||
caseInsensitive.append(ch);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
QGtkStylePrivate::gtk_file_filter_add_pattern (gtkFilter, qPrintable(caseInsensitive));
|
|
||||||
|
|
||||||
}
|
|
||||||
if (filterMap)
|
|
||||||
filterMap->insert(gtkFilter, rawfilter);
|
|
||||||
QGtkStylePrivate::gtk_file_chooser_add_filter((GtkFileChooser*)gtkFileChooser, gtkFilter);
|
|
||||||
if (selectedFilter && (rawfilter == *selectedFilter))
|
|
||||||
QGtkStylePrivate::gtk_file_chooser_set_filter((GtkFileChooser*)gtkFileChooser, gtkFilter);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Using the currently active window is not entirely correct, however
|
|
||||||
// it gives more sensible behavior for applications that do not provide a
|
|
||||||
// parent
|
|
||||||
QWidget *modalFor = parent ? parent->window() : qApp->activeWindow();
|
|
||||||
if (modalFor) {
|
|
||||||
QGtkStylePrivate::gtk_widget_realize(gtkFileChooser); // Creates X window
|
|
||||||
#ifndef Q_OS_MAC
|
|
||||||
XSetTransientForHint(QGtkStylePrivate::gdk_x11_drawable_get_xdisplay(gtkFileChooser->window),
|
|
||||||
QGtkStylePrivate::gdk_x11_drawable_get_xid(gtkFileChooser->window),
|
|
||||||
modalFor->winId());
|
|
||||||
#ifdef Q_WS_X11
|
|
||||||
QGtkStylePrivate::gdk_x11_window_set_user_time (gtkFileChooser->window, QX11Info::appUserTime());
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
QFileInfo fileinfo(dir);
|
|
||||||
if (dir.isEmpty())
|
|
||||||
fileinfo.setFile(QDir::currentPath());
|
|
||||||
fileinfo.makeAbsolute();
|
|
||||||
if (fileinfo.isDir()) {
|
|
||||||
QGtkStylePrivate::gtk_file_chooser_set_current_folder((GtkFileChooser*)gtkFileChooser, qPrintable(dir));
|
|
||||||
} else if (isSaveDialog) {
|
|
||||||
QGtkStylePrivate::gtk_file_chooser_set_current_folder((GtkFileChooser*)gtkFileChooser, qPrintable(fileinfo.absolutePath()));
|
|
||||||
QGtkStylePrivate::gtk_file_chooser_set_current_name((GtkFileChooser*)gtkFileChooser, qPrintable(fileinfo.fileName()));
|
|
||||||
} else {
|
|
||||||
QGtkStylePrivate::gtk_file_chooser_set_filename((GtkFileChooser*)gtkFileChooser, qPrintable(dir));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
QString QGtkStylePrivate::openFilename(QWidget *parent, const QString &caption, const QString &dir, const QString &filter,
|
|
||||||
QString *selectedFilter, QFileDialog::Options options)
|
|
||||||
{
|
|
||||||
QHash<GtkFileFilter *, QString> filterMap;
|
|
||||||
GtkWidget *gtkFileChooser = QGtkStylePrivate::gtk_file_chooser_dialog_new (qPrintable(caption),
|
|
||||||
NULL,
|
|
||||||
GTK_FILE_CHOOSER_ACTION_OPEN,
|
|
||||||
GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
|
|
||||||
GTK_STOCK_OPEN, GTK_RESPONSE_ACCEPT,
|
|
||||||
NULL);
|
|
||||||
|
|
||||||
setupGtkFileChooser(gtkFileChooser, parent, dir, filter, selectedFilter, options, false, &filterMap);
|
|
||||||
|
|
||||||
QWidget modal_widget;
|
|
||||||
modal_widget.setAttribute(Qt::WA_NoChildEventsForParent, true);
|
|
||||||
modal_widget.setParent(parent, Qt::Window);
|
|
||||||
modal_widget.createWinId();
|
|
||||||
QGuiApplicationPrivate::showModalWindow(modal_widget.windowHandle());
|
|
||||||
|
|
||||||
QString filename;
|
|
||||||
if (QGtkStylePrivate::gtk_dialog_run ((GtkDialog*)gtkFileChooser) == GTK_RESPONSE_ACCEPT) {
|
|
||||||
char *gtk_filename = QGtkStylePrivate::gtk_file_chooser_get_filename ((GtkFileChooser*)gtkFileChooser);
|
|
||||||
filename = QString::fromUtf8(gtk_filename);
|
|
||||||
g_free (gtk_filename);
|
|
||||||
if (selectedFilter) {
|
|
||||||
GtkFileFilter *gtkFilter = QGtkStylePrivate::gtk_file_chooser_get_filter ((GtkFileChooser*)gtkFileChooser);
|
|
||||||
*selectedFilter = filterMap.value(gtkFilter);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
QApplicationPrivate::hideModalWindow(modal_widget.windowHandle());
|
|
||||||
gtk_widget_destroy (gtkFileChooser);
|
|
||||||
return filename;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
QString QGtkStylePrivate::openDirectory(QWidget *parent, const QString &caption, const QString &dir, QFileDialog::Options options)
|
|
||||||
{
|
|
||||||
QHash<GtkFileFilter *, QString> filterMap;
|
|
||||||
GtkWidget *gtkFileChooser = QGtkStylePrivate::gtk_file_chooser_dialog_new (qPrintable(caption),
|
|
||||||
NULL,
|
|
||||||
GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER,
|
|
||||||
GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
|
|
||||||
GTK_STOCK_OPEN, GTK_RESPONSE_ACCEPT,
|
|
||||||
NULL);
|
|
||||||
|
|
||||||
setupGtkFileChooser(gtkFileChooser, parent, dir, QString(), 0, options);
|
|
||||||
QWidget modal_widget;
|
|
||||||
modal_widget.setAttribute(Qt::WA_NoChildEventsForParent, true);
|
|
||||||
modal_widget.setParent(parent, Qt::Window);
|
|
||||||
modal_widget.createWinId();
|
|
||||||
QGuiApplicationPrivate::showModalWindow(modal_widget.windowHandle());
|
|
||||||
|
|
||||||
QString filename;
|
|
||||||
if (QGtkStylePrivate::gtk_dialog_run ((GtkDialog*)gtkFileChooser) == GTK_RESPONSE_ACCEPT) {
|
|
||||||
char *gtk_filename = QGtkStylePrivate::gtk_file_chooser_get_filename ((GtkFileChooser*)gtkFileChooser);
|
|
||||||
filename = QString::fromUtf8(gtk_filename);
|
|
||||||
g_free (gtk_filename);
|
|
||||||
}
|
|
||||||
|
|
||||||
QApplicationPrivate::hideModalWindow(modal_widget.windowHandle());
|
|
||||||
gtk_widget_destroy (gtkFileChooser);
|
|
||||||
return filename;
|
|
||||||
}
|
|
||||||
|
|
||||||
QStringList QGtkStylePrivate::openFilenames(QWidget *parent, const QString &caption, const QString &dir, const QString &filter,
|
|
||||||
QString *selectedFilter, QFileDialog::Options options)
|
|
||||||
{
|
|
||||||
QStringList filenames;
|
|
||||||
QHash<GtkFileFilter *, QString> filterMap;
|
|
||||||
GtkWidget *gtkFileChooser = QGtkStylePrivate::gtk_file_chooser_dialog_new (qPrintable(caption),
|
|
||||||
NULL,
|
|
||||||
GTK_FILE_CHOOSER_ACTION_OPEN,
|
|
||||||
GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
|
|
||||||
GTK_STOCK_OPEN, GTK_RESPONSE_ACCEPT,
|
|
||||||
NULL);
|
|
||||||
|
|
||||||
setupGtkFileChooser(gtkFileChooser, parent, dir, filter, selectedFilter, options, false, &filterMap);
|
|
||||||
g_object_set(gtkFileChooser, "select-multiple", gboolean(true), NULL);
|
|
||||||
|
|
||||||
QWidget modal_widget;
|
|
||||||
modal_widget.setAttribute(Qt::WA_NoChildEventsForParent, true);
|
|
||||||
modal_widget.setParent(parent, Qt::Window);
|
|
||||||
modal_widget.createWinId();
|
|
||||||
QGuiApplicationPrivate::showModalWindow(modal_widget.windowHandle());
|
|
||||||
|
|
||||||
if (gtk_dialog_run ((GtkDialog*)gtkFileChooser) == GTK_RESPONSE_ACCEPT) {
|
|
||||||
GSList *gtk_file_names = QGtkStylePrivate::gtk_file_chooser_get_filenames((GtkFileChooser*)gtkFileChooser);
|
|
||||||
for (GSList *iterator = gtk_file_names ; iterator; iterator = iterator->next)
|
|
||||||
filenames << QString::fromUtf8((const char*)iterator->data);
|
|
||||||
g_slist_free(gtk_file_names);
|
|
||||||
if (selectedFilter) {
|
|
||||||
GtkFileFilter *gtkFilter = QGtkStylePrivate::gtk_file_chooser_get_filter ((GtkFileChooser*)gtkFileChooser);
|
|
||||||
*selectedFilter = filterMap.value(gtkFilter);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
QApplicationPrivate::hideModalWindow(modal_widget.windowHandle());
|
|
||||||
gtk_widget_destroy (gtkFileChooser);
|
|
||||||
return filenames;
|
|
||||||
}
|
|
||||||
|
|
||||||
QString QGtkStylePrivate::saveFilename(QWidget *parent, const QString &caption, const QString &dir, const QString &filter,
|
|
||||||
QString *selectedFilter, QFileDialog::Options options)
|
|
||||||
{
|
|
||||||
QHash<GtkFileFilter *, QString> filterMap;
|
|
||||||
GtkWidget *gtkFileChooser = QGtkStylePrivate::gtk_file_chooser_dialog_new (qPrintable(caption),
|
|
||||||
NULL,
|
|
||||||
GTK_FILE_CHOOSER_ACTION_SAVE,
|
|
||||||
GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
|
|
||||||
GTK_STOCK_SAVE, GTK_RESPONSE_ACCEPT,
|
|
||||||
NULL);
|
|
||||||
setupGtkFileChooser(gtkFileChooser, parent, dir, filter, selectedFilter, options, true, &filterMap);
|
|
||||||
|
|
||||||
QWidget modal_widget;
|
|
||||||
modal_widget.setAttribute(Qt::WA_NoChildEventsForParent, true);
|
|
||||||
modal_widget.setParent(parent, Qt::Window);
|
|
||||||
modal_widget.createWinId();
|
|
||||||
QGuiApplicationPrivate::showModalWindow(modal_widget.windowHandle());
|
|
||||||
|
|
||||||
QString filename;
|
|
||||||
if (QGtkStylePrivate::gtk_dialog_run ((GtkDialog*)gtkFileChooser) == GTK_RESPONSE_ACCEPT) {
|
|
||||||
char *gtk_filename = QGtkStylePrivate::gtk_file_chooser_get_filename ((GtkFileChooser*)gtkFileChooser);
|
|
||||||
filename = QString::fromUtf8(gtk_filename);
|
|
||||||
g_free (gtk_filename);
|
|
||||||
if (selectedFilter) {
|
|
||||||
GtkFileFilter *gtkFilter = QGtkStylePrivate::gtk_file_chooser_get_filter ((GtkFileChooser*)gtkFileChooser);
|
|
||||||
*selectedFilter = filterMap.value(gtkFilter);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
QApplicationPrivate::hideModalWindow(modal_widget.windowHandle());
|
|
||||||
gtk_widget_destroy (gtkFileChooser);
|
|
||||||
return filename;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
QIcon QGtkStylePrivate::getFilesystemIcon(const QFileInfo &info)
|
QIcon QGtkStylePrivate::getFilesystemIcon(const QFileInfo &info)
|
||||||
{
|
{
|
||||||
QIcon icon;
|
QIcon icon;
|
||||||
|
@ -200,23 +200,6 @@ typedef gint (*Ptr_pango_font_description_get_size) (const PangoFontDescription
|
|||||||
typedef PangoWeight (*Ptr_pango_font_description_get_weight) (const PangoFontDescription *);
|
typedef PangoWeight (*Ptr_pango_font_description_get_weight) (const PangoFontDescription *);
|
||||||
typedef const char* (*Ptr_pango_font_description_get_family) (const PangoFontDescription *);
|
typedef const char* (*Ptr_pango_font_description_get_family) (const PangoFontDescription *);
|
||||||
typedef PangoStyle (*Ptr_pango_font_description_get_style) (const PangoFontDescription *desc);
|
typedef PangoStyle (*Ptr_pango_font_description_get_style) (const PangoFontDescription *desc);
|
||||||
typedef gboolean (*Ptr_gtk_file_chooser_set_current_folder)(GtkFileChooser *, const gchar *);
|
|
||||||
typedef GtkFileFilter* (*Ptr_gtk_file_filter_new)(void);
|
|
||||||
typedef void (*Ptr_gtk_file_filter_set_name)(GtkFileFilter *, const gchar *);
|
|
||||||
typedef void (*Ptr_gtk_file_filter_add_pattern)(GtkFileFilter *filter, const gchar *pattern);
|
|
||||||
typedef void (*Ptr_gtk_file_chooser_add_filter)(GtkFileChooser *chooser, GtkFileFilter *filter);
|
|
||||||
typedef void (*Ptr_gtk_file_chooser_set_filter)(GtkFileChooser *chooser, GtkFileFilter *filter);
|
|
||||||
typedef GtkFileFilter* (*Ptr_gtk_file_chooser_get_filter)(GtkFileChooser *chooser);
|
|
||||||
typedef gchar* (*Ptr_gtk_file_chooser_get_filename)(GtkFileChooser *chooser);
|
|
||||||
typedef GSList* (*Ptr_gtk_file_chooser_get_filenames)(GtkFileChooser *chooser);
|
|
||||||
typedef GtkWidget* (*Ptr_gtk_file_chooser_dialog_new)(const gchar *title,
|
|
||||||
GtkWindow *parent,
|
|
||||||
GtkFileChooserAction action,
|
|
||||||
const gchar *first_button_text,
|
|
||||||
...);
|
|
||||||
typedef void (*Ptr_gtk_file_chooser_set_current_name) (GtkFileChooser *, const gchar *);
|
|
||||||
typedef gboolean (*Ptr_gtk_file_chooser_set_filename) (GtkFileChooser *chooser, const gchar *name);
|
|
||||||
typedef gint (*Ptr_gtk_dialog_run) (GtkDialog*);
|
|
||||||
typedef void (*Ptr_gtk_border_free)(GtkBorder *);
|
typedef void (*Ptr_gtk_border_free)(GtkBorder *);
|
||||||
typedef void (*Ptr_gtk_widget_get_allocation) (GtkWidget*, GtkAllocation*);
|
typedef void (*Ptr_gtk_widget_get_allocation) (GtkWidget*, GtkAllocation*);
|
||||||
typedef void (*Ptr_gtk_widget_set_allocation) (GtkWidget*, const GtkAllocation*);
|
typedef void (*Ptr_gtk_widget_set_allocation) (GtkWidget*, const GtkAllocation*);
|
||||||
@ -242,22 +225,6 @@ typedef Display* (*Ptr_gdk_x11_drawable_get_xdisplay) ( GdkDrawable *);
|
|||||||
|
|
||||||
QT_BEGIN_NAMESPACE
|
QT_BEGIN_NAMESPACE
|
||||||
|
|
||||||
#ifndef QT_NO_FILEDIALOG
|
|
||||||
typedef QStringList (*_qt_filedialog_open_filenames_hook)(QWidget * parent, const QString &caption, const QString &dir,
|
|
||||||
const QString &filter, QString *selectedFilter, QFileDialog::Options options);
|
|
||||||
typedef QString (*_qt_filedialog_open_filename_hook) (QWidget * parent, const QString &caption, const QString &dir,
|
|
||||||
const QString &filter, QString *selectedFilter, QFileDialog::Options options);
|
|
||||||
typedef QString (*_qt_filedialog_save_filename_hook) (QWidget * parent, const QString &caption, const QString &dir,
|
|
||||||
const QString &filter, QString *selectedFilter, QFileDialog::Options options);
|
|
||||||
typedef QString (*_qt_filedialog_existing_directory_hook)(QWidget *parent, const QString &caption, const QString &dir,
|
|
||||||
QFileDialog::Options options);
|
|
||||||
|
|
||||||
extern Q_WIDGETS_EXPORT _qt_filedialog_open_filename_hook qt_filedialog_open_filename_hook;
|
|
||||||
extern Q_WIDGETS_EXPORT _qt_filedialog_open_filenames_hook qt_filedialog_open_filenames_hook;
|
|
||||||
extern Q_WIDGETS_EXPORT _qt_filedialog_save_filename_hook qt_filedialog_save_filename_hook;
|
|
||||||
extern Q_WIDGETS_EXPORT _qt_filedialog_existing_directory_hook qt_filedialog_existing_directory_hook;
|
|
||||||
#endif //!QT_NO_FILEDIALOG
|
|
||||||
|
|
||||||
class QGtkPainter;
|
class QGtkPainter;
|
||||||
class QGtkStylePrivate;
|
class QGtkStylePrivate;
|
||||||
|
|
||||||
@ -326,20 +293,6 @@ public:
|
|||||||
static QString getThemeName();
|
static QString getThemeName();
|
||||||
virtual int getSpinboxArrowSize() const;
|
virtual int getSpinboxArrowSize() const;
|
||||||
|
|
||||||
#ifndef QT_NO_FILEDIALOG
|
|
||||||
static void setupGtkFileChooser(GtkWidget* gtkFileChooser, QWidget *parent,
|
|
||||||
const QString &dir, const QString &filter, QString *selectedFilter,
|
|
||||||
QFileDialog::Options options, bool isSaveDialog = false,
|
|
||||||
QHash<GtkFileFilter *, QString> *filterMap = 0);
|
|
||||||
|
|
||||||
static QString openFilename(QWidget *parent, const QString &caption, const QString &dir, const QString &filter,
|
|
||||||
QString *selectedFilter, QFileDialog::Options options);
|
|
||||||
static QString saveFilename(QWidget *parent, const QString &caption, const QString &dir, const QString &filter,
|
|
||||||
QString *selectedFilter, QFileDialog::Options options);
|
|
||||||
static QString openDirectory(QWidget *parent, const QString &caption, const QString &dir, QFileDialog::Options options);
|
|
||||||
static QStringList openFilenames(QWidget *parent, const QString &caption, const QString &dir, const QString &filter,
|
|
||||||
QString *selectedFilter, QFileDialog::Options options);
|
|
||||||
#endif
|
|
||||||
static QIcon getFilesystemIcon(const QFileInfo &);
|
static QIcon getFilesystemIcon(const QFileInfo &);
|
||||||
|
|
||||||
static Ptr_gtk_container_forall gtk_container_forall;
|
static Ptr_gtk_container_forall gtk_container_forall;
|
||||||
@ -425,20 +378,6 @@ public:
|
|||||||
static Ptr_pango_font_description_get_family pango_font_description_get_family;
|
static Ptr_pango_font_description_get_family pango_font_description_get_family;
|
||||||
static Ptr_pango_font_description_get_style pango_font_description_get_style;
|
static Ptr_pango_font_description_get_style pango_font_description_get_style;
|
||||||
|
|
||||||
static Ptr_gtk_file_filter_new gtk_file_filter_new;
|
|
||||||
static Ptr_gtk_file_filter_set_name gtk_file_filter_set_name;
|
|
||||||
static Ptr_gtk_file_filter_add_pattern gtk_file_filter_add_pattern;
|
|
||||||
static Ptr_gtk_file_chooser_add_filter gtk_file_chooser_add_filter;
|
|
||||||
static Ptr_gtk_file_chooser_set_filter gtk_file_chooser_set_filter;
|
|
||||||
static Ptr_gtk_file_chooser_get_filter gtk_file_chooser_get_filter;
|
|
||||||
static Ptr_gtk_file_chooser_dialog_new gtk_file_chooser_dialog_new;
|
|
||||||
static Ptr_gtk_file_chooser_set_current_folder gtk_file_chooser_set_current_folder;
|
|
||||||
static Ptr_gtk_file_chooser_get_filename gtk_file_chooser_get_filename;
|
|
||||||
static Ptr_gtk_file_chooser_get_filenames gtk_file_chooser_get_filenames;
|
|
||||||
static Ptr_gtk_file_chooser_set_current_name gtk_file_chooser_set_current_name;
|
|
||||||
static Ptr_gtk_dialog_run gtk_dialog_run;
|
|
||||||
static Ptr_gtk_file_chooser_set_filename gtk_file_chooser_set_filename;
|
|
||||||
|
|
||||||
static Ptr_gdk_pixbuf_get_pixels gdk_pixbuf_get_pixels;
|
static Ptr_gdk_pixbuf_get_pixels gdk_pixbuf_get_pixels;
|
||||||
static Ptr_gdk_pixbuf_get_width gdk_pixbuf_get_width;
|
static Ptr_gdk_pixbuf_get_width gdk_pixbuf_get_width;
|
||||||
static Ptr_gdk_pixbuf_get_height gdk_pixbuf_get_height;
|
static Ptr_gdk_pixbuf_get_height gdk_pixbuf_get_height;
|
||||||
|
Loading…
Reference in New Issue
Block a user