From cf88d74466cd6506875676ef2557c179d72fe422 Mon Sep 17 00:00:00 2001 From: Maurice Kalinowski Date: Tue, 6 Sep 2016 11:53:41 +0200 Subject: winrt: Fix file dialog handling for Windows Phone Windows Phone needs to use activation targets to properly handle the return value of a file dialog. 0f9ca217d0f479756e50459473cad7371f29047c introduced launching an app via different modes, but broke above use- case for Windows Phone. Hence, we first check if a dispatcher exists and use this one to forward the activation. Task-number: QTBUG-54342 Change-Id: If9dd2df9a45e9aa104775530c695325fe6f684f2 Reviewed-by: Oliver Wolff --- src/winmain/qtmain_winrt.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'src/winmain/qtmain_winrt.cpp') diff --git a/src/winmain/qtmain_winrt.cpp b/src/winmain/qtmain_winrt.cpp index 83a7dc800c..e49817ada4 100644 --- a/src/winmain/qtmain_winrt.cpp +++ b/src/winmain/qtmain_winrt.cpp @@ -198,6 +198,14 @@ public: private: HRESULT activatedLaunch(IInspectable *activateArgs) { + // Check if an application instance is already running + // This is mostly needed for Windows Phone and file pickers + QAbstractEventDispatcher *dispatcher = QCoreApplication::eventDispatcher(); + if (dispatcher) { + QCoreApplication::postEvent(dispatcher, new QActivationEvent(activateArgs)); + return S_OK; + } + QCoreApplication *app = QCoreApplication::instance(); // Check whether the app already runs -- cgit v1.2.3