Commit f65aea4d authored by Michael Brüning's avatar Michael Brüning Committed by Jani Heikkinen
Browse files

Also run the rejected signal handler when closing prompt dialogs.


The prompt dialog inherits ApplicationWindow, which emits the
signal "closing" when the window gets closed by pressing the X
button.

Change-Id: I23e5cf6f8e81251869d765d7fd2864257f3c0b89
Task-number: QTBUG-43902
Reviewed-by: default avatarAndras Becsi <andras.becsi@theqtcompany.com>
Showing with 12 additions and 9 deletions
...@@ -310,15 +310,6 @@ void UIDelegatesManager::showDialog(QSharedPointer<JavaScriptDialogController> d ...@@ -310,15 +310,6 @@ void UIDelegatesManager::showDialog(QSharedPointer<JavaScriptDialogController> d
QQmlProperty titleProp(dialog, QStringLiteral("title")); QQmlProperty titleProp(dialog, QStringLiteral("title"));
titleProp.write(title); titleProp.write(title);
if (dialogComponentType == PromptDialog) {
QQmlProperty promptProp(dialog, QStringLiteral("prompt"));
promptProp.write(dialogController->defaultPrompt());
QQmlProperty inputSignal(dialog, QStringLiteral("onInput"));
CHECK_QML_SIGNAL_PROPERTY(inputSignal, dialogComponent->url());
static int setTextIndex = dialogController->metaObject()->indexOfSlot("textProvided(QString)");
QObject::connect(dialog, inputSignal.method(), dialogController.data(), dialogController->metaObject()->method(setTextIndex));
}
QQmlProperty acceptSignal(dialog, QStringLiteral("onAccepted")); QQmlProperty acceptSignal(dialog, QStringLiteral("onAccepted"));
QQmlProperty rejectSignal(dialog, QStringLiteral("onRejected")); QQmlProperty rejectSignal(dialog, QStringLiteral("onRejected"));
CHECK_QML_SIGNAL_PROPERTY(acceptSignal, dialogComponent->url()); CHECK_QML_SIGNAL_PROPERTY(acceptSignal, dialogComponent->url());
...@@ -328,6 +319,18 @@ void UIDelegatesManager::showDialog(QSharedPointer<JavaScriptDialogController> d ...@@ -328,6 +319,18 @@ void UIDelegatesManager::showDialog(QSharedPointer<JavaScriptDialogController> d
QObject::connect(dialog, acceptSignal.method(), dialogController.data(), dialogController->metaObject()->method(acceptIndex)); QObject::connect(dialog, acceptSignal.method(), dialogController.data(), dialogController->metaObject()->method(acceptIndex));
static int rejectIndex = dialogController->metaObject()->indexOfSlot("reject()"); static int rejectIndex = dialogController->metaObject()->indexOfSlot("reject()");
QObject::connect(dialog, rejectSignal.method(), dialogController.data(), dialogController->metaObject()->method(rejectIndex)); QObject::connect(dialog, rejectSignal.method(), dialogController.data(), dialogController->metaObject()->method(rejectIndex));
if (dialogComponentType == PromptDialog) {
QQmlProperty promptProp(dialog, QStringLiteral("prompt"));
promptProp.write(dialogController->defaultPrompt());
QQmlProperty inputSignal(dialog, QStringLiteral("onInput"));
CHECK_QML_SIGNAL_PROPERTY(inputSignal, dialogComponent->url());
static int setTextIndex = dialogController->metaObject()->indexOfSlot("textProvided(QString)");
QObject::connect(dialog, inputSignal.method(), dialogController.data(), dialogController->metaObject()->method(setTextIndex));
QQmlProperty closingSignal(dialog, QStringLiteral("onClosing"));
QObject::connect(dialog, closingSignal.method(), dialogController.data(), dialogController->metaObject()->method(rejectIndex));
}
dialogComponent->completeCreate(); dialogComponent->completeCreate();
QObject::connect(dialogController.data(), &JavaScriptDialogController::dialogCloseRequested, dialog, &QObject::deleteLater); QObject::connect(dialogController.data(), &JavaScriptDialogController::dialogCloseRequested, dialog, &QObject::deleteLater);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment