summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforms/winrt/qwinrttheme.cpp
diff options
context:
space:
mode:
authorAndrew Knight <andrew.knight@digia.com>2014-08-08 13:25:51 +0300
committerOswald Buddenhagen <oswald.buddenhagen@digia.com>2014-08-09 15:37:09 +0200
commit5dd7164c97bee863d29bfd724cfcad380e2c786a (patch)
treed3701f0dc6f732678a0513efe12d4cf1f0e5d866 /src/plugins/platforms/winrt/qwinrttheme.cpp
parent4413254ff603fa19f4fa22d4936e69f4a6dbbc2b (diff)
winrt: Use native file dialog
The native Windows Runtime file picker is required to support picking of any file/folder from the system. Due to platform security restrictions, the non-native file dialog is effectively useless when outside of the application's installation or local storage directories. This adds a QPA implementation for the WinRT file picker, as well as a simple file system engine to handle files which were opened by the picker. This necessary for platform security reasons, as it is not possible to open files from arbitrary paths - only file handles opened by the picker can be used, so these are kept inside this file system engine and acted upon when a known path is observed. The file system engine is only instantiated when needed, and may prove useful for other areas of Qt (such as known folders/standard paths) which must operate on a virtual file rather than an absolute path. Task-number: QTBUG-37748 Change-Id: Ia4fd6c5065ac92101ce34adcb6c9026fbcff56df Reviewed-by: Maurice Kalinowski <maurice.kalinowski@digia.com>
Diffstat (limited to 'src/plugins/platforms/winrt/qwinrttheme.cpp')
-rw-r--r--src/plugins/platforms/winrt/qwinrttheme.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/plugins/platforms/winrt/qwinrttheme.cpp b/src/plugins/platforms/winrt/qwinrttheme.cpp
index f9c2e21676..3566683163 100644
--- a/src/plugins/platforms/winrt/qwinrttheme.cpp
+++ b/src/plugins/platforms/winrt/qwinrttheme.cpp
@@ -41,6 +41,7 @@
#include "qwinrttheme.h"
#include "qwinrtmessagedialoghelper.h"
+#include "qwinrtfiledialoghelper.h"
#include <QtCore/qfunctions_winrt.h>
#include <QtGui/QPalette>
@@ -134,7 +135,7 @@ bool QWinRTTheme::usePlatformNativeDialog(DialogType type) const
static bool useNativeDialogs = qEnvironmentVariableIsSet("QT_USE_WINRT_NATIVE_DIALOGS")
? qgetenv("QT_USE_WINRT_NATIVE_DIALOGS").toInt() : true;
- if (type == MessageDialog)
+ if (type == FileDialog || type == MessageDialog)
return useNativeDialogs;
return false;
}
@@ -142,6 +143,8 @@ bool QWinRTTheme::usePlatformNativeDialog(DialogType type) const
QPlatformDialogHelper *QWinRTTheme::createPlatformDialogHelper(DialogType type) const
{
switch (type) {
+ case FileDialog:
+ return new QWinRTFileDialogHelper;
case MessageDialog:
return new QWinRTMessageDialogHelper(this);
default: