summaryrefslogtreecommitdiffstats
path: root/src/winmain/qtmain_winrt.cpp
diff options
context:
space:
mode:
authorSamuel Nevala <samuel.nevala@intopalo.com>2015-08-28 13:32:55 +0300
committerSamuel Nevala <samuel.nevala@intopalo.com>2015-09-07 06:05:05 +0000
commit296422fc636acce0af3afc5824dcc3128f319f7c (patch)
tree01cae38fe545f6e39289760b3fd88d5cf1d90624 /src/winmain/qtmain_winrt.cpp
parent5953109a04e16df1abb87d37a676a0a51e7a2eca (diff)
winrt: Add support for native pickers for Windows Phone.
Support picking file(s), folder and save file via native component on Windows Phone. Task-Id: QTBUG-44833 Change-Id: Ibffc1cf3c133c9fbf9c92e0a4f874c4e197c50ee Reviewed-by: Oliver Wolff <oliver.wolff@theqtcompany.com>
Diffstat (limited to 'src/winmain/qtmain_winrt.cpp')
-rw-r--r--src/winmain/qtmain_winrt.cpp24
1 files changed, 23 insertions, 1 deletions
diff --git a/src/winmain/qtmain_winrt.cpp b/src/winmain/qtmain_winrt.cpp
index d9f8c8f991..b7125eec59 100644
--- a/src/winmain/qtmain_winrt.cpp
+++ b/src/winmain/qtmain_winrt.cpp
@@ -70,6 +70,7 @@ extern "C" {
#include <qdir.h>
#include <qstandardpaths.h>
#include <qfunctions_winrt.h>
+#include <qcoreapplication.h>
#include <wrl.h>
#include <Windows.ApplicationModel.core.h>
@@ -109,6 +110,24 @@ static void devMessageHandler(QtMsgType type, const QMessageLogContext &context,
defaultMessageHandler(type, context, message);
}
+class QActivationEvent : public QEvent
+{
+public:
+ explicit QActivationEvent(IInspectable *args)
+ : QEvent(QEvent::WinEventAct)
+ {
+ setAccepted(false);
+ args->AddRef();
+ d = reinterpret_cast<QEventPrivate *>(args);
+ }
+
+ ~QActivationEvent() {
+ IUnknown *args = reinterpret_cast<IUnknown *>(d);
+ args->Release();
+ d = nullptr;
+ }
+};
+
class AppContainer : public RuntimeClass<Xaml::IApplicationOverrides>
{
public:
@@ -158,7 +177,10 @@ public:
private:
HRESULT __stdcall OnActivated(IActivatedEventArgs *args) Q_DECL_OVERRIDE
{
- return base->OnActivated(args);
+ QAbstractEventDispatcher *dispatcher = QCoreApplication::eventDispatcher();
+ if (dispatcher)
+ QCoreApplication::postEvent(dispatcher, new QActivationEvent(args));
+ return S_OK;
}
HRESULT __stdcall OnLaunched(ILaunchActivatedEventArgs *launchArgs) Q_DECL_OVERRIDE