Merge branch 'master' into el6
This commit is contained in:
commit
bcbbb02d1e
@ -29,7 +29,7 @@
|
||||
Summary: Qt5 - QtBase components
|
||||
Name: qt5-qtbase
|
||||
Version: 5.3.2
|
||||
Release: 1%{?dist}
|
||||
Release: 3%{?dist}
|
||||
|
||||
# See LGPL_EXCEPTIONS.txt, LICENSE.GPL3, respectively, for exception details
|
||||
License: LGPLv2 with exceptions or GPLv3 with exceptions
|
||||
@ -52,8 +52,12 @@ Source5: qconfig-multilib.h
|
||||
# QT_XCB_FORCE_SOFTWARE_OPENGL for them
|
||||
Source6: 10-qt5-check-opengl2.sh
|
||||
|
||||
# support the old versions of libxcb and libxkbcommon in F19 and F20
|
||||
Patch1: qtbase-opensource-src-5.3.0-old-xcb.patch
|
||||
# support the old version of libxcb and the resulting lack of libxkbcommon-x11
|
||||
# in F19 and F20
|
||||
Patch0: qtbase-opensource-src-5.3.2-old_xcb.patch
|
||||
|
||||
# support the old version of libxkbcommon in F19 and F20
|
||||
Patch1: qtbase-opensource-src-5.3.2-old_xkbcommon.patch
|
||||
|
||||
# support multilib optflags
|
||||
Patch2: qtbase-multilib_optflags.patch
|
||||
@ -74,6 +78,7 @@ Patch12: qtbase-opensource-src-5.2.0-enable_ft_lcdfilter.patch
|
||||
Patch50: qt5-poll.patch
|
||||
|
||||
##upstream patches
|
||||
Patch100: qtbase-qfiledialog-implement-getopenfileurl-and-friends.patch
|
||||
|
||||
# macros
|
||||
%define _qt5 %{name}
|
||||
@ -125,11 +130,20 @@ BuildRequires: pkgconfig(xcb-xkb) >= 1.10
|
||||
BuildRequires: pkgconfig(xkbcommon) >= 0.4.1
|
||||
BuildRequires: pkgconfig(xkbcommon-x11) >= 0.4.1
|
||||
%else
|
||||
# apply patch to support older versions of xcb and xkbcommon
|
||||
# apply patch to support older version of xcb, resulting lack of xkbcommon-x11
|
||||
%global old_xcb 1
|
||||
%if 0%{?fedora} > 19
|
||||
# Fedora 20
|
||||
BuildRequires: pkgconfig(xkbcommon) >= 0.4.1
|
||||
%else
|
||||
# Fedora 19 and older
|
||||
BuildRequires: pkgconfig(xkbcommon)
|
||||
# apply patch to support older version of xkbcommon
|
||||
%global old_xkbcommon 1
|
||||
%endif
|
||||
%endif
|
||||
%else
|
||||
# not Fedora
|
||||
%global xkbcommon -qt-xkbcommon
|
||||
Provides: bundled(libxkbcommon) = 0.4.1
|
||||
%endif
|
||||
@ -280,7 +294,10 @@ Qt5 libraries used for drawing widgets and OpenGL items.
|
||||
%setup -q -n qtbase-opensource-src-%{version}%{?pre:-%{pre}}
|
||||
|
||||
%if 0%{?old_xcb}
|
||||
%patch1 -p1 -b .old_xcb
|
||||
%patch0 -p1 -b .old_xcb
|
||||
%if 0%{?old_xkbcommon}
|
||||
%patch1 -p1 -b .old_xkbcommon
|
||||
%endif
|
||||
%endif
|
||||
%patch2 -p1 -b .multilib_optflags
|
||||
# drop backup file(s), else they get installed too, http://bugzilla.redhat.com/639463
|
||||
@ -292,15 +309,12 @@ rm -fv mkspecs/linux-g++*/qmake.conf.multilib-optflags
|
||||
|
||||
#patch50 -p1 -b .poll
|
||||
|
||||
%patch100 -p1 -b .qfiledialog-implement-getopenfileurl-and-friends
|
||||
|
||||
# drop -fexceptions from $RPM_OPT_FLAGS
|
||||
RPM_OPT_FLAGS=`echo $RPM_OPT_FLAGS | sed 's|-fexceptions||g'`
|
||||
|
||||
%define platform linux-g++
|
||||
%ifarch %{multilib_archs}
|
||||
%if "%{?__isa_bits}" == "64"
|
||||
%define platform linux-g++-64
|
||||
%endif
|
||||
%endif
|
||||
|
||||
sed -i -e "s|-O2|$RPM_OPT_FLAGS|g" \
|
||||
mkspecs/%{platform}/qmake.conf
|
||||
@ -747,6 +761,15 @@ fi
|
||||
|
||||
|
||||
%changelog
|
||||
* Mon Oct 13 2014 Jan Grulich <jgrulich@redhat.com> 5.3.2-3
|
||||
- QFileDialog: implement getOpenFileUrl and friends for real
|
||||
|
||||
* Thu Oct 09 2014 Rex Dieter <rdieter@fedoraproject.org> 5.3.2-2
|
||||
- use linux-g++ platform unconditionally
|
||||
|
||||
* Thu Oct 09 2014 Kevin Kofler <Kevin@tigcc.ticalc.org> 5.3.2-1.1
|
||||
- F20: require libxkbcommon >= 0.4.1, only patch for the old libxcb
|
||||
|
||||
* Tue Sep 16 2014 Rex Dieter <rdieter@fedoraproject.org> 5.3.2-1
|
||||
- 5.3.2
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
diff -ur qtbase-opensource-src-5.3.0/configure qtbase-opensource-src-5.3.0-old-xcb/configure
|
||||
--- qtbase-opensource-src-5.3.0/configure 2014-05-15 19:12:04.000000000 +0200
|
||||
+++ qtbase-opensource-src-5.3.0-old-xcb/configure 2014-06-01 23:45:21.000000000 +0200
|
||||
@@ -4946,10 +4946,8 @@
|
||||
diff -ur qtbase-opensource-src-5.3.2/configure qtbase-opensource-src-5.3.2-old_xcb/configure
|
||||
--- qtbase-opensource-src-5.3.2/configure 2014-09-11 12:47:55.000000000 +0200
|
||||
+++ qtbase-opensource-src-5.3.2-old_xcb/configure 2014-10-08 19:46:02.000000000 +0200
|
||||
@@ -4982,10 +4982,8 @@
|
||||
QMAKE_LIBS_XCB="`$PKG_CONFIG --libs $XCB_PACKAGES 2>/dev/null`"
|
||||
fi
|
||||
|
||||
@ -13,13 +13,7 @@ diff -ur qtbase-opensource-src-5.3.0/configure qtbase-opensource-src-5.3.0-old-x
|
||||
QMAKE_CFLAGS_XKB="`$PKG_CONFIG --cflags xcb xcb-xkb 2>/dev/null`"
|
||||
QMAKE_LIBS_XKB="`$PKG_CONFIG --libs xcb xcb-xkb 2>/dev/null`"
|
||||
if compileTest qpa/xcb-xkb "xcb-xkb" $QMAKE_CFLAGS_XKB $QMAKE_LIBS_XKB; then
|
||||
@@ -5051,14 +5049,14 @@
|
||||
fi
|
||||
|
||||
# Detect libxkbcommon
|
||||
-MIN_REQ_XKBCOMMON="0.4.1"
|
||||
+MIN_REQ_XKBCOMMON="0.3.0"
|
||||
ORIG_CFG_XKBCOMMON="$CFG_XKBCOMMON"
|
||||
@@ -5092,9 +5090,9 @@
|
||||
# currently only xcb platform plugin supports building xkbcommon
|
||||
if [ "$CFG_XCB" != "no" ]; then
|
||||
if [ "$CFG_XKBCOMMON" = "auto" ] || [ "$CFG_XKBCOMMON" = "system" ]; then
|
||||
@ -32,7 +26,7 @@ diff -ur qtbase-opensource-src-5.3.0/configure qtbase-opensource-src-5.3.0-old-x
|
||||
|
||||
QMakeVar set QMAKE_CFLAGS_XKBCOMMON "$QMAKE_CFLAGS_XKBCOMMON"
|
||||
QMakeVar set QMAKE_LIBS_XKBCOMMON "$QMAKE_LIBS_XKBCOMMON"
|
||||
@@ -6552,7 +6550,7 @@
|
||||
@@ -6588,7 +6586,7 @@
|
||||
echo
|
||||
fi
|
||||
if [ "$ORIG_CFG_XKBCOMMON" != qt ] && [ "$CFG_XKBCOMMON" = qt ]; then
|
||||
@ -41,10 +35,10 @@ diff -ur qtbase-opensource-src-5.3.0/configure qtbase-opensource-src-5.3.0-old-x
|
||||
echo "the bundled version from 3rd party directory."
|
||||
fi
|
||||
if [ "$CFG_XKBCOMMON" = "qt" ] && [ "$CFG_XKB_CONFIG_ROOT" = "not found" ]; then
|
||||
diff -ur qtbase-opensource-src-5.3.0/src/plugins/platforms/xcb/qxcbconnection.cpp qtbase-opensource-src-5.3.0-old-xcb/src/plugins/platforms/xcb/qxcbconnection.cpp
|
||||
--- qtbase-opensource-src-5.3.0/src/plugins/platforms/xcb/qxcbconnection.cpp 2014-05-15 19:12:17.000000000 +0200
|
||||
+++ qtbase-opensource-src-5.3.0-old-xcb/src/plugins/platforms/xcb/qxcbconnection.cpp 2014-06-02 00:17:14.000000000 +0200
|
||||
@@ -1698,7 +1698,7 @@
|
||||
diff -ur qtbase-opensource-src-5.3.2/src/plugins/platforms/xcb/qxcbconnection.cpp qtbase-opensource-src-5.3.2-old_xcb/src/plugins/platforms/xcb/qxcbconnection.cpp
|
||||
--- qtbase-opensource-src-5.3.2/src/plugins/platforms/xcb/qxcbconnection.cpp 2014-09-11 12:48:06.000000000 +0200
|
||||
+++ qtbase-opensource-src-5.3.2-old_xcb/src/plugins/platforms/xcb/qxcbconnection.cpp 2014-10-08 19:46:02.000000000 +0200
|
||||
@@ -1710,7 +1710,7 @@
|
||||
xcb_xkb_use_extension_cookie_t xkb_query_cookie;
|
||||
xcb_xkb_use_extension_reply_t *xkb_query;
|
||||
|
||||
@ -53,9 +47,9 @@ diff -ur qtbase-opensource-src-5.3.0/src/plugins/platforms/xcb/qxcbconnection.cp
|
||||
xkb_query = xcb_xkb_use_extension_reply(c, xkb_query_cookie, 0);
|
||||
|
||||
if (!xkb_query) {
|
||||
diff -ur qtbase-opensource-src-5.3.0/src/plugins/platforms/xcb/qxcbkeyboard.cpp qtbase-opensource-src-5.3.0-old-xcb/src/plugins/platforms/xcb/qxcbkeyboard.cpp
|
||||
--- qtbase-opensource-src-5.3.0/src/plugins/platforms/xcb/qxcbkeyboard.cpp 2014-05-15 19:12:17.000000000 +0200
|
||||
+++ qtbase-opensource-src-5.3.0-old-xcb/src/plugins/platforms/xcb/qxcbkeyboard.cpp 2014-06-30 19:08:22.000000000 +0200
|
||||
diff -ur qtbase-opensource-src-5.3.2/src/plugins/platforms/xcb/qxcbkeyboard.cpp qtbase-opensource-src-5.3.2-old_xcb/src/plugins/platforms/xcb/qxcbkeyboard.cpp
|
||||
--- qtbase-opensource-src-5.3.2/src/plugins/platforms/xcb/qxcbkeyboard.cpp 2014-09-11 12:48:06.000000000 +0200
|
||||
+++ qtbase-opensource-src-5.3.2-old_xcb/src/plugins/platforms/xcb/qxcbkeyboard.cpp 2014-10-08 19:46:02.000000000 +0200
|
||||
@@ -697,50 +697,65 @@
|
||||
// log only critical errors, we do our own error logging from printKeymapError()
|
||||
xkb_context_set_log_level(xkb_context, (xkb_log_level)XKB_LOG_LEVEL_CRITICAL);
|
||||
@ -157,25 +151,7 @@ diff -ur qtbase-opensource-src-5.3.0/src/plugins/platforms/xcb/qxcbkeyboard.cpp
|
||||
}
|
||||
|
||||
#ifndef QT_NO_XKB
|
||||
@@ -856,7 +871,7 @@
|
||||
return QList<int>();
|
||||
|
||||
QList<int> result;
|
||||
- int baseQtKey = keysymToQtKey(sym, modifiers, lookupString(kb_state, event->nativeScanCode()));
|
||||
+ int baseQtKey = keysymToQtKey(sym, modifiers, keysymToUnicode(sym));
|
||||
result += (baseQtKey + modifiers); // The base key is _always_ valid, of course
|
||||
|
||||
xkb_mod_index_t shiftMod = xkb_keymap_mod_get_index(xkb_keymap, "Shift");
|
||||
@@ -903,7 +918,7 @@
|
||||
continue;
|
||||
|
||||
Qt::KeyboardModifiers mods = modifiers & ~neededMods;
|
||||
- qtKey = keysymToQtKey(sym, mods, lookupString(kb_state, event->nativeScanCode()));
|
||||
+ qtKey = keysymToQtKey(sym, mods, keysymToUnicode(sym));
|
||||
|
||||
if (qtKey == baseQtKey)
|
||||
continue;
|
||||
@@ -986,11 +1001,23 @@
|
||||
@@ -995,11 +1010,23 @@
|
||||
if (connection->hasXKB()) {
|
||||
updateVModMapping();
|
||||
updateVModToRModMapping();
|
||||
@ -201,41 +177,9 @@ diff -ur qtbase-opensource-src-5.3.0/src/plugins/platforms/xcb/qxcbkeyboard.cpp
|
||||
} else {
|
||||
#endif
|
||||
m_key_symbols = xcb_key_symbols_alloc(xcb_connection());
|
||||
@@ -1320,7 +1347,7 @@
|
||||
|
||||
Qt::KeyboardModifiers modifiers = translateModifiers(state);
|
||||
|
||||
- QString string = lookupString(xkb_state, code);
|
||||
+ QString string = keysymToUnicode(sym);
|
||||
int count = string.size();
|
||||
string.truncate(count);
|
||||
|
||||
@@ -1383,12 +1410,18 @@
|
||||
}
|
||||
}
|
||||
|
||||
-QString QXcbKeyboard::lookupString(struct xkb_state *state, xcb_keycode_t code) const
|
||||
+QString QXcbKeyboard::keysymToUnicode(xcb_keysym_t sym) const
|
||||
{
|
||||
QByteArray chars;
|
||||
- chars.resize(1 + xkb_state_key_get_utf8(state, code, 0, 0));
|
||||
- // equivalent of XLookupString
|
||||
- xkb_state_key_get_utf8(state, code, chars.data(), chars.size());
|
||||
+ int bytes;
|
||||
+ chars.resize(7);
|
||||
+
|
||||
+ bytes = xkb_keysym_to_utf8(sym, chars.data(), chars.size());
|
||||
+
|
||||
+ if (bytes == -1)
|
||||
+ qWarning("QXcbKeyboard::handleKeyEvent - buffer too small");
|
||||
+ chars.resize(bytes-1);
|
||||
+
|
||||
return QString::fromUtf8(chars);
|
||||
}
|
||||
|
||||
diff -ur qtbase-opensource-src-5.3.0/src/plugins/platforms/xcb/qxcbkeyboard.h qtbase-opensource-src-5.3.0-old-xcb/src/plugins/platforms/xcb/qxcbkeyboard.h
|
||||
--- qtbase-opensource-src-5.3.0/src/plugins/platforms/xcb/qxcbkeyboard.h 2014-05-15 19:12:17.000000000 +0200
|
||||
+++ qtbase-opensource-src-5.3.0-old-xcb/src/plugins/platforms/xcb/qxcbkeyboard.h 2014-06-30 19:06:35.000000000 +0200
|
||||
diff -ur qtbase-opensource-src-5.3.2/src/plugins/platforms/xcb/qxcbkeyboard.h qtbase-opensource-src-5.3.2-old_xcb/src/plugins/platforms/xcb/qxcbkeyboard.h
|
||||
--- qtbase-opensource-src-5.3.2/src/plugins/platforms/xcb/qxcbkeyboard.h 2014-09-11 12:48:06.000000000 +0200
|
||||
+++ qtbase-opensource-src-5.3.2-old_xcb/src/plugins/platforms/xcb/qxcbkeyboard.h 2014-10-08 19:46:02.000000000 +0200
|
||||
@@ -47,9 +47,6 @@
|
||||
#include <xcb/xcb_keysyms.h>
|
||||
|
||||
@ -246,12 +190,3 @@ diff -ur qtbase-opensource-src-5.3.0/src/plugins/platforms/xcb/qxcbkeyboard.h qt
|
||||
|
||||
#include <QEvent>
|
||||
|
||||
@@ -86,7 +83,7 @@
|
||||
void handleKeyEvent(QWindow *window, QEvent::Type type, xcb_keycode_t code, quint16 state, xcb_timestamp_t time);
|
||||
|
||||
void resolveMaskConflicts();
|
||||
- QString lookupString(struct xkb_state *state, xcb_keycode_t code) const;
|
||||
+ QString keysymToUnicode(xcb_keysym_t sym) const;
|
||||
int keysymToQtKey(xcb_keysym_t keysym) const;
|
||||
int keysymToQtKey(xcb_keysym_t keysym, Qt::KeyboardModifiers &modifiers, QString text) const;
|
||||
void printKeymapError(const char *error) const;
|
77
qtbase-opensource-src-5.3.2-old_xkbcommon.patch
Normal file
77
qtbase-opensource-src-5.3.2-old_xkbcommon.patch
Normal file
@ -0,0 +1,77 @@
|
||||
diff -ur qtbase-opensource-src-5.3.2-old_xcb/configure qtbase-opensource-src-5.3.2-old_xkbcommon/configure
|
||||
--- qtbase-opensource-src-5.3.2-old_xcb/configure 2014-10-08 19:46:02.000000000 +0200
|
||||
+++ qtbase-opensource-src-5.3.2-old_xkbcommon/configure 2014-10-08 19:42:46.000000000 +0200
|
||||
@@ -5085,7 +5085,7 @@
|
||||
fi
|
||||
|
||||
# Detect libxkbcommon
|
||||
-MIN_REQ_XKBCOMMON="0.4.1"
|
||||
+MIN_REQ_XKBCOMMON="0.3.0"
|
||||
ORIG_CFG_XKBCOMMON="$CFG_XKBCOMMON"
|
||||
# currently only xcb platform plugin supports building xkbcommon
|
||||
if [ "$CFG_XCB" != "no" ]; then
|
||||
diff -ur qtbase-opensource-src-5.3.2-old_xcb/src/plugins/platforms/xcb/qxcbkeyboard.cpp qtbase-opensource-src-5.3.2-old_xkbcommon/src/plugins/platforms/xcb/qxcbkeyboard.cpp
|
||||
--- qtbase-opensource-src-5.3.2-old_xcb/src/plugins/platforms/xcb/qxcbkeyboard.cpp 2014-10-08 19:46:02.000000000 +0200
|
||||
+++ qtbase-opensource-src-5.3.2-old_xkbcommon/src/plugins/platforms/xcb/qxcbkeyboard.cpp 2014-10-08 19:42:46.000000000 +0200
|
||||
@@ -871,7 +871,7 @@
|
||||
return QList<int>();
|
||||
|
||||
QList<int> result;
|
||||
- int baseQtKey = keysymToQtKey(sym, modifiers, lookupString(kb_state, event->nativeScanCode()));
|
||||
+ int baseQtKey = keysymToQtKey(sym, modifiers, keysymToUnicode(sym));
|
||||
result += (baseQtKey + modifiers); // The base key is _always_ valid, of course
|
||||
|
||||
xkb_mod_index_t shiftMod = xkb_keymap_mod_get_index(xkb_keymap, "Shift");
|
||||
@@ -918,7 +918,7 @@
|
||||
continue;
|
||||
|
||||
Qt::KeyboardModifiers mods = modifiers & ~neededMods;
|
||||
- qtKey = keysymToQtKey(sym, mods, lookupString(kb_state, event->nativeScanCode()));
|
||||
+ qtKey = keysymToQtKey(sym, mods, keysymToUnicode(sym));
|
||||
|
||||
if (qtKey == baseQtKey)
|
||||
continue;
|
||||
@@ -1363,7 +1363,7 @@
|
||||
|
||||
Qt::KeyboardModifiers modifiers = translateModifiers(state);
|
||||
|
||||
- QString string = lookupString(xkb_state, code);
|
||||
+ QString string = keysymToUnicode(sym);
|
||||
int count = string.size();
|
||||
string.truncate(count);
|
||||
|
||||
@@ -1427,12 +1427,18 @@
|
||||
}
|
||||
}
|
||||
|
||||
-QString QXcbKeyboard::lookupString(struct xkb_state *state, xcb_keycode_t code) const
|
||||
+QString QXcbKeyboard::keysymToUnicode(xcb_keysym_t sym) const
|
||||
{
|
||||
QByteArray chars;
|
||||
- chars.resize(1 + xkb_state_key_get_utf8(state, code, 0, 0));
|
||||
- // equivalent of XLookupString
|
||||
- xkb_state_key_get_utf8(state, code, chars.data(), chars.size());
|
||||
+ int bytes;
|
||||
+ chars.resize(7);
|
||||
+
|
||||
+ bytes = xkb_keysym_to_utf8(sym, chars.data(), chars.size());
|
||||
+
|
||||
+ if (bytes == -1)
|
||||
+ qWarning("QXcbKeyboard::handleKeyEvent - buffer too small");
|
||||
+ chars.resize(bytes-1);
|
||||
+
|
||||
return QString::fromUtf8(chars);
|
||||
}
|
||||
|
||||
diff -ur qtbase-opensource-src-5.3.2-old_xcb/src/plugins/platforms/xcb/qxcbkeyboard.h qtbase-opensource-src-5.3.2-old_xkbcommon/src/plugins/platforms/xcb/qxcbkeyboard.h
|
||||
--- qtbase-opensource-src-5.3.2-old_xcb/src/plugins/platforms/xcb/qxcbkeyboard.h 2014-10-08 19:46:02.000000000 +0200
|
||||
+++ qtbase-opensource-src-5.3.2-old_xkbcommon/src/plugins/platforms/xcb/qxcbkeyboard.h 2014-10-08 19:42:46.000000000 +0200
|
||||
@@ -83,7 +83,7 @@
|
||||
void handleKeyEvent(xcb_window_t sourceWindow, QEvent::Type type, xcb_keycode_t code, quint16 state, xcb_timestamp_t time);
|
||||
|
||||
void resolveMaskConflicts();
|
||||
- QString lookupString(struct xkb_state *state, xcb_keycode_t code) const;
|
||||
+ QString keysymToUnicode(xcb_keysym_t sym) const;
|
||||
int keysymToQtKey(xcb_keysym_t keysym) const;
|
||||
int keysymToQtKey(xcb_keysym_t keysym, Qt::KeyboardModifiers &modifiers, QString text) const;
|
||||
void printKeymapError(const char *error) const;
|
261
qtbase-qfiledialog-implement-getopenfileurl-and-friends.patch
Normal file
261
qtbase-qfiledialog-implement-getopenfileurl-and-friends.patch
Normal file
@ -0,0 +1,261 @@
|
||||
diff --git a/src/widgets/dialogs/qfiledialog.cpp b/src/widgets/dialogs/qfiledialog.cpp
|
||||
index 9219757..22fbe37 100644
|
||||
--- a/src/widgets/dialogs/qfiledialog.cpp
|
||||
+++ b/src/widgets/dialogs/qfiledialog.cpp
|
||||
@@ -2100,35 +2100,9 @@ QString QFileDialog::getOpenFileName(QWidget *parent,
|
||||
QString *selectedFilter,
|
||||
Options options)
|
||||
{
|
||||
- QFileDialogArgs args;
|
||||
- args.parent = parent;
|
||||
- args.caption = caption;
|
||||
- args.directory = QFileDialogPrivate::workingDirectory(dir);
|
||||
- args.selection = QFileDialogPrivate::initialSelection(dir);
|
||||
- args.filter = filter;
|
||||
- args.mode = ExistingFile;
|
||||
- args.options = options;
|
||||
-#if defined(Q_WS_WIN)
|
||||
- if (QGuiApplicationPrivate::platformIntegration()->usePlatformNativeDialog() && !(args.options & DontUseNativeDialog)) {
|
||||
- return qt_win_get_open_file_name(args, &(args.directory), selectedFilter);
|
||||
- }
|
||||
-#endif
|
||||
-
|
||||
- // create a qt dialog
|
||||
- QFileDialog dialog(args);
|
||||
- if (selectedFilter && !selectedFilter->isEmpty())
|
||||
- dialog.selectNameFilter(*selectedFilter);
|
||||
- if (dialog.exec() == QDialog::Accepted) {
|
||||
- if (selectedFilter)
|
||||
- *selectedFilter = dialog.selectedNameFilter();
|
||||
- return dialog.selectedFiles().value(0);
|
||||
- }
|
||||
- return QString();
|
||||
-}
|
||||
-
|
||||
-static inline QUrl dialogResultToUrl(const QString &file)
|
||||
-{
|
||||
- return file.isEmpty() ? QUrl() : QUrl::fromLocalFile(file);
|
||||
+ const QStringList schemes = QStringList(QStringLiteral("file"));
|
||||
+ const QUrl selectedUrl = getOpenFileUrl(parent, caption, QUrl::fromLocalFile(dir), filter, selectedFilter, options, schemes);
|
||||
+ return selectedUrl.toLocalFile();
|
||||
}
|
||||
|
||||
/*!
|
||||
@@ -2166,10 +2140,26 @@ QUrl QFileDialog::getOpenFileUrl(QWidget *parent,
|
||||
Options options,
|
||||
const QStringList &supportedSchemes)
|
||||
{
|
||||
- Q_UNUSED(supportedSchemes);
|
||||
+ Q_UNUSED(supportedSchemes); // TODO
|
||||
+
|
||||
+ QFileDialogArgs args;
|
||||
+ args.parent = parent;
|
||||
+ args.caption = caption;
|
||||
+ args.directory = QFileDialogPrivate::workingDirectory(dir.toLocalFile());
|
||||
+ args.selection = QFileDialogPrivate::initialSelection(dir.toLocalFile());
|
||||
+ args.filter = filter;
|
||||
+ args.mode = ExistingFile;
|
||||
+ args.options = options;
|
||||
|
||||
- // Falls back to local file
|
||||
- return dialogResultToUrl(getOpenFileName(parent, caption, dir.toLocalFile(), filter, selectedFilter, options));
|
||||
+ QFileDialog dialog(args);
|
||||
+ if (selectedFilter && !selectedFilter->isEmpty())
|
||||
+ dialog.selectNameFilter(*selectedFilter);
|
||||
+ if (dialog.exec() == QDialog::Accepted) {
|
||||
+ if (selectedFilter)
|
||||
+ *selectedFilter = dialog.selectedNameFilter();
|
||||
+ return dialog.selectedUrls().value(0);
|
||||
+ }
|
||||
+ return QUrl();
|
||||
}
|
||||
|
||||
/*!
|
||||
@@ -2228,31 +2218,12 @@ QStringList QFileDialog::getOpenFileNames(QWidget *parent,
|
||||
QString *selectedFilter,
|
||||
Options options)
|
||||
{
|
||||
- QFileDialogArgs args;
|
||||
- args.parent = parent;
|
||||
- args.caption = caption;
|
||||
- args.directory = QFileDialogPrivate::workingDirectory(dir);
|
||||
- args.selection = QFileDialogPrivate::initialSelection(dir);
|
||||
- args.filter = filter;
|
||||
- args.mode = ExistingFiles;
|
||||
- args.options = options;
|
||||
-
|
||||
-#if defined(Q_WS_WIN)
|
||||
- if (QGuiApplicationPrivate::platformIntegration()->usePlatformNativeDialog() && !(args.options & DontUseNativeDialog)) {
|
||||
- return qt_win_get_open_file_names(args, &(args.directory), selectedFilter);
|
||||
- }
|
||||
-#endif
|
||||
-
|
||||
- // create a qt dialog
|
||||
- QFileDialog dialog(args);
|
||||
- if (selectedFilter && !selectedFilter->isEmpty())
|
||||
- dialog.selectNameFilter(*selectedFilter);
|
||||
- if (dialog.exec() == QDialog::Accepted) {
|
||||
- if (selectedFilter)
|
||||
- *selectedFilter = dialog.selectedNameFilter();
|
||||
- return dialog.selectedFiles();
|
||||
- }
|
||||
- return QStringList();
|
||||
+ const QStringList schemes = QStringList(QStringLiteral("file"));
|
||||
+ const QList<QUrl> selectedUrls = getOpenFileUrls(parent, caption, QUrl::fromLocalFile(dir), filter, selectedFilter, options, schemes);
|
||||
+ QStringList fileNames;
|
||||
+ foreach (const QUrl &url, selectedUrls)
|
||||
+ fileNames << url.toLocalFile();
|
||||
+ return fileNames;
|
||||
}
|
||||
|
||||
/*!
|
||||
@@ -2293,14 +2264,24 @@ QList<QUrl> QFileDialog::getOpenFileUrls(QWidget *parent,
|
||||
{
|
||||
Q_UNUSED(supportedSchemes);
|
||||
|
||||
- // Falls back to local files
|
||||
- QList<QUrl> urls;
|
||||
-
|
||||
- const QStringList fileNames = getOpenFileNames(parent, caption, dir.toLocalFile(), filter, selectedFilter, options);
|
||||
- foreach (const QString &fileName, fileNames)
|
||||
- urls << QUrl::fromLocalFile(fileName);
|
||||
+ QFileDialogArgs args;
|
||||
+ args.parent = parent;
|
||||
+ args.caption = caption;
|
||||
+ args.directory = QFileDialogPrivate::workingDirectory(dir.toLocalFile());
|
||||
+ args.selection = QFileDialogPrivate::initialSelection(dir.toLocalFile());
|
||||
+ args.filter = filter;
|
||||
+ args.mode = ExistingFiles;
|
||||
+ args.options = options;
|
||||
|
||||
- return urls;
|
||||
+ QFileDialog dialog(args);
|
||||
+ if (selectedFilter && !selectedFilter->isEmpty())
|
||||
+ dialog.selectNameFilter(*selectedFilter);
|
||||
+ if (dialog.exec() == QDialog::Accepted) {
|
||||
+ if (selectedFilter)
|
||||
+ *selectedFilter = dialog.selectedNameFilter();
|
||||
+ return dialog.selectedUrls();
|
||||
+ }
|
||||
+ return QList<QUrl>();
|
||||
}
|
||||
|
||||
/*!
|
||||
@@ -2360,33 +2341,9 @@ QString QFileDialog::getSaveFileName(QWidget *parent,
|
||||
QString *selectedFilter,
|
||||
Options options)
|
||||
{
|
||||
- QFileDialogArgs args;
|
||||
- args.parent = parent;
|
||||
- args.caption = caption;
|
||||
- args.directory = QFileDialogPrivate::workingDirectory(dir);
|
||||
- args.selection = QFileDialogPrivate::initialSelection(dir);
|
||||
- args.filter = filter;
|
||||
- args.mode = AnyFile;
|
||||
- args.options = options;
|
||||
-
|
||||
-#if defined(Q_WS_WIN)
|
||||
- if (QGuiApplicationPrivate::platformIntegration()->usePlatformNativeDialog() && !(args.options & DontUseNativeDialog)) {
|
||||
- return qt_win_get_save_file_name(args, &(args.directory), selectedFilter);
|
||||
- }
|
||||
-#endif
|
||||
-
|
||||
- // create a qt dialog
|
||||
- QFileDialog dialog(args);
|
||||
- dialog.setAcceptMode(AcceptSave);
|
||||
- if (selectedFilter && !selectedFilter->isEmpty())
|
||||
- dialog.selectNameFilter(*selectedFilter);
|
||||
- if (dialog.exec() == QDialog::Accepted) {
|
||||
- if (selectedFilter)
|
||||
- *selectedFilter = dialog.selectedNameFilter();
|
||||
- return dialog.selectedFiles().value(0);
|
||||
- }
|
||||
-
|
||||
- return QString();
|
||||
+ const QStringList schemes = QStringList(QStringLiteral("file"));
|
||||
+ const QUrl selectedUrl = getSaveFileUrl(parent, caption, QUrl::fromLocalFile(dir), filter, selectedFilter, options, schemes);
|
||||
+ return selectedUrl.toLocalFile();
|
||||
}
|
||||
|
||||
/*!
|
||||
@@ -2426,8 +2383,25 @@ QUrl QFileDialog::getSaveFileUrl(QWidget *parent,
|
||||
{
|
||||
Q_UNUSED(supportedSchemes);
|
||||
|
||||
- // Falls back to local file
|
||||
- return dialogResultToUrl(getSaveFileName(parent, caption, dir.toLocalFile(), filter, selectedFilter, options));
|
||||
+ QFileDialogArgs args;
|
||||
+ args.parent = parent;
|
||||
+ args.caption = caption;
|
||||
+ args.directory = QFileDialogPrivate::workingDirectory(dir.toLocalFile());
|
||||
+ args.selection = QFileDialogPrivate::initialSelection(dir.toLocalFile());
|
||||
+ args.filter = filter;
|
||||
+ args.mode = AnyFile;
|
||||
+ args.options = options;
|
||||
+
|
||||
+ QFileDialog dialog(args);
|
||||
+ dialog.setAcceptMode(AcceptSave);
|
||||
+ if (selectedFilter && !selectedFilter->isEmpty())
|
||||
+ dialog.selectNameFilter(*selectedFilter);
|
||||
+ if (dialog.exec() == QDialog::Accepted) {
|
||||
+ if (selectedFilter)
|
||||
+ *selectedFilter = dialog.selectedNameFilter();
|
||||
+ return dialog.selectedUrls().value(0);
|
||||
+ }
|
||||
+ return QUrl();
|
||||
}
|
||||
|
||||
/*!
|
||||
@@ -2474,29 +2448,9 @@ QString QFileDialog::getExistingDirectory(QWidget *parent,
|
||||
const QString &dir,
|
||||
Options options)
|
||||
{
|
||||
- QFileDialogArgs args;
|
||||
- args.parent = parent;
|
||||
- args.caption = caption;
|
||||
- args.directory = QFileDialogPrivate::workingDirectory(dir);
|
||||
- args.mode = (options & ShowDirsOnly ? DirectoryOnly : Directory);
|
||||
- args.options = options;
|
||||
-
|
||||
-#if defined(Q_WS_WIN)
|
||||
- if (QGuiApplicationPrivate::platformIntegration()->usePlatformNativeDialog() && !(args.options & DontUseNativeDialog) && (options & ShowDirsOnly)
|
||||
-#if defined(Q_OS_WINCE)
|
||||
- && qt_priv_ptr_valid
|
||||
-#endif
|
||||
- ) {
|
||||
- return qt_win_get_existing_directory(args);
|
||||
- }
|
||||
-#endif
|
||||
-
|
||||
- // create a qt dialog
|
||||
- QFileDialog dialog(args);
|
||||
- if (dialog.exec() == QDialog::Accepted) {
|
||||
- return dialog.selectedFiles().value(0);
|
||||
- }
|
||||
- return QString();
|
||||
+ const QStringList schemes = QStringList(QStringLiteral("file"));
|
||||
+ const QUrl selectedUrl = getExistingDirectoryUrl(parent, caption, QUrl::fromLocalFile(dir), options, schemes);
|
||||
+ return selectedUrl.toLocalFile();
|
||||
}
|
||||
|
||||
/*!
|
||||
@@ -2534,8 +2488,17 @@ QUrl QFileDialog::getExistingDirectoryUrl(QWidget *parent,
|
||||
{
|
||||
Q_UNUSED(supportedSchemes);
|
||||
|
||||
- // Falls back to local file
|
||||
- return dialogResultToUrl(getExistingDirectory(parent, caption, dir.toLocalFile(), options));
|
||||
+ QFileDialogArgs args;
|
||||
+ args.parent = parent;
|
||||
+ args.caption = caption;
|
||||
+ args.directory = QFileDialogPrivate::workingDirectory(dir.toLocalFile());
|
||||
+ args.mode = (options & ShowDirsOnly ? DirectoryOnly : Directory);
|
||||
+ args.options = options;
|
||||
+
|
||||
+ QFileDialog dialog(args);
|
||||
+ if (dialog.exec() == QDialog::Accepted)
|
||||
+ return dialog.selectedUrls().value(0);
|
||||
+ return QUrl();
|
||||
}
|
||||
|
||||
inline static QString _qt_get_directory(const QString &path)
|
Loading…
Reference in New Issue
Block a user