Skip to content

Commit

Permalink
winrt: Fix file dialog handling for Windows Phone
Browse files Browse the repository at this point in the history
Windows Phone needs to use activation targets to properly handle the
return value of a file dialog. 0f9ca21
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 <[email protected]>
  • Loading branch information
mauricek committed Sep 6, 2016
1 parent 657c2bf commit cf88d74
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/winmain/qtmain_winrt.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,14 @@ class AppContainer : public RuntimeClass<Xaml::IApplicationOverrides>

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
Expand Down

0 comments on commit cf88d74

Please sign in to comment.