summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael BrĂ¼ning <michael.bruning@theqtcompany.com>2015-01-20 11:18:20 +0100
committerJani Heikkinen <jani.heikkinen@theqtcompany.com>2015-01-20 11:51:09 +0100
commitf65aea4d98f498a1e97abf84bad24789f2342499 (patch)
tree58efc5ab20e94c69fa103d835d95c45776c41463
parente66a1125f2b796fe48aef6c88caf501ee3224c0f (diff)
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: Andras Becsi <andras.becsi@theqtcompany.com>
-rw-r--r--src/webengine/ui_delegates_manager.cpp21
1 files changed, 12 insertions, 9 deletions
diff --git a/src/webengine/ui_delegates_manager.cpp b/src/webengine/ui_delegates_manager.cpp
index 48e1bee7e..9e7af3fad 100644
--- a/src/webengine/ui_delegates_manager.cpp
+++ b/src/webengine/ui_delegates_manager.cpp
@@ -310,15 +310,6 @@ void UIDelegatesManager::showDialog(QSharedPointer<JavaScriptDialogController> d
QQmlProperty titleProp(dialog, QStringLiteral("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 rejectSignal(dialog, QStringLiteral("onRejected"));
CHECK_QML_SIGNAL_PROPERTY(acceptSignal, dialogComponent->url());
@@ -328,6 +319,18 @@ void UIDelegatesManager::showDialog(QSharedPointer<JavaScriptDialogController> d
QObject::connect(dialog, acceptSignal.method(), dialogController.data(), dialogController->metaObject()->method(acceptIndex));
static int rejectIndex = dialogController->metaObject()->indexOfSlot("reject()");
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();
QObject::connect(dialogController.data(), &JavaScriptDialogController::dialogCloseRequested, dialog, &QObject::deleteLater);