From 296422fc636acce0af3afc5824dcc3128f319f7c Mon Sep 17 00:00:00 2001 From: Samuel Nevala Date: Fri, 28 Aug 2015 13:32:55 +0300 Subject: 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 --- src/winmain/qtmain_winrt.cpp | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) (limited to 'src/winmain') 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 #include #include +#include #include #include @@ -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(args); + } + + ~QActivationEvent() { + IUnknown *args = reinterpret_cast(d); + args->Release(); + d = nullptr; + } +}; + class AppContainer : public RuntimeClass { 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 -- cgit v1.2.3