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. 0f9ca217d0
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 <oliver.wolff@qt.io>
This commit is contained in:
Maurice Kalinowski 2016-09-06 11:53:41 +02:00
parent 657c2bfbec
commit cf88d74466

View File

@ -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