diff options
-rw-r--r-- | src/libs/installer/packagemanagergui.cpp | 12 | ||||
-rw-r--r-- | src/libs/installer/packagemanagergui.h | 3 | ||||
-rw-r--r-- | tests/auto/installer/scriptengine/tst_scriptengine.cpp | 12 |
3 files changed, 9 insertions, 18 deletions
diff --git a/src/libs/installer/packagemanagergui.cpp b/src/libs/installer/packagemanagergui.cpp index cececaef4..338e8fad9 100644 --- a/src/libs/installer/packagemanagergui.cpp +++ b/src/libs/installer/packagemanagergui.cpp @@ -254,7 +254,7 @@ PackageManagerGui::PackageManagerGui(PackageManagerCore *core, QWidget *parent) connect(m_core, SIGNAL(installationFinished()), this, SLOT(showFinishedPage()), Qt::QueuedConnection); connect(m_core, SIGNAL(uninstallationFinished()), this, SLOT(showFinishedPage()), Qt::QueuedConnection); - connect(this, SIGNAL(currentIdChanged(int)), this, SLOT(slotCurrentPageChanged(int))); + connect(this, SIGNAL(currentIdChanged(int)), this, SLOT(executeControlScript(int))); connect(this, SIGNAL(currentIdChanged(int)), m_core, SIGNAL(currentPageChanged(int))); connect(button(QWizard::FinishButton), SIGNAL(clicked()), this, SIGNAL(finishButtonClicked())); connect(button(QWizard::FinishButton), SIGNAL(clicked()), m_core, SIGNAL(finishButtonClicked())); @@ -359,12 +359,6 @@ void PackageManagerGui::loadControlScript(const QString &scriptPath) qDebug() << "Loaded control script" << scriptPath; } -void PackageManagerGui::slotCurrentPageChanged(int id) -{ - QMetaObject::invokeMethod(this, "delayedControlScriptExecution", Qt::QueuedConnection, - Q_ARG(int, id)); -} - void PackageManagerGui::callControlScriptMethod(const QString &methodName) { if (!d->m_controlScriptContext.isValid()) @@ -382,9 +376,9 @@ void PackageManagerGui::callControlScriptMethod(const QString &methodName) } } -void PackageManagerGui::delayedControlScriptExecution(int id) +void PackageManagerGui::executeControlScript(int pageId) { - if (PackageManagerPage *const p = qobject_cast<PackageManagerPage*> (page(id))) + if (PackageManagerPage *const p = qobject_cast<PackageManagerPage*> (page(pageId))) callControlScriptMethod(p->objectName() + QLatin1String("Callback")); } diff --git a/src/libs/installer/packagemanagergui.h b/src/libs/installer/packagemanagergui.h index 5c428bf87..4f58a077d 100644 --- a/src/libs/installer/packagemanagergui.h +++ b/src/libs/installer/packagemanagergui.h @@ -116,8 +116,7 @@ protected Q_SLOTS: void wizardWidgetInsertionRequested(QWidget *widget, QInstaller::PackageManagerCore::WizardPage page); void wizardWidgetRemovalRequested(QWidget *widget); void wizardPageVisibilityChangeRequested(bool visible, int page); - void slotCurrentPageChanged(int id); - void delayedControlScriptExecution(int id); + void executeControlScript(int pageId); void setValidatorForCustomPageRequested(QInstaller::Component *component, const QString &name, const QString &callbackName); diff --git a/tests/auto/installer/scriptengine/tst_scriptengine.cpp b/tests/auto/installer/scriptengine/tst_scriptengine.cpp index 283d7bdad..b626d5a2e 100644 --- a/tests/auto/installer/scriptengine/tst_scriptengine.cpp +++ b/tests/auto/installer/scriptengine/tst_scriptengine.cpp @@ -26,9 +26,9 @@ public: virtual void init() {} - void callProtectedDelayedControlScriptExecution(int id) + void callProtectedDelayedExecuteControlScript(int id) { - delayedControlScriptExecution(id); + executeControlScript(id); } }; @@ -218,18 +218,16 @@ private slots: testGui.loadControlScript(":///data/auto-install.qs"); QCOMPARE(m_core.value("GuiTestValue"), QString("hello")); - testGui.show(); // show event calls automatically the first callback which does not exist setExpectedScriptOutput("Control script callback \"IntroductionPageCallback\" does not exist. "); - // give some time to the event triggering mechanism - qApp->processEvents(); + testGui.show(); // inside the auto-install script we are clicking the next button, with a not existing button QTest::ignoreMessage(QtWarningMsg, "Button with type: \"unknown button\" not found! "); - testGui.callProtectedDelayedControlScriptExecution(PackageManagerCore::ComponentSelection); + testGui.callProtectedDelayedExecuteControlScript(PackageManagerCore::ComponentSelection); setExpectedScriptOutput("FinishedPageCallback - OK"); - testGui.callProtectedDelayedControlScriptExecution(PackageManagerCore::InstallationFinished); + testGui.callProtectedDelayedExecuteControlScript(PackageManagerCore::InstallationFinished); } catch (const Error &error) { QFAIL(qPrintable(error.message())); } |