diff options
author | Katja Marttila <katja.marttila@qt.io> | 2017-11-06 13:37:22 +0200 |
---|---|---|
committer | Katja Marttila <katja.marttila@qt.io> | 2017-11-14 09:27:04 +0000 |
commit | e5860c52349d53e7eb53b33a77fa15950c6a95a1 (patch) | |
tree | bf9a321e4f858589f3742e9d93e32e09556a3b15 /src | |
parent | 8715fc14d987d22fae0c230e32e048b8f655533b (diff) |
Add possibility to reopen admin query
In windows if admin rights are asked, you have two minutes to answer
to the query. After that installing is not possible as there is no way to
go back to admin query.
Adding a possibility to restart the admin right query when 'No' pressed
or two minutes timeframe has passed in Windows. Requires
DisableAuthorizationFallback set to true, otherwize user is asked to use
fallback '--startserver'.
Task-number: QTIFW-988
Change-Id: Ide33b588299c981cfe653e7f53e7316a768d87bb
Reviewed-by: Iikka Eklund <iikka.eklund@qt.io>
Diffstat (limited to 'src')
-rw-r--r-- | src/libs/installer/remoteclient_p.h | 56 |
1 files changed, 31 insertions, 25 deletions
diff --git a/src/libs/installer/remoteclient_p.h b/src/libs/installer/remoteclient_p.h index d1e873d43..ed1731342 100644 --- a/src/libs/installer/remoteclient_p.h +++ b/src/libs/installer/remoteclient_p.h @@ -125,32 +125,38 @@ public: if (!started) { if (m_authorizationFallbackDisabled) { - MessageBoxHandler::critical(MessageBoxHandler::currentBestSuitParent(), - QLatin1String("AuthorizationError"), - QCoreApplication::translate("RemoteClient", "Cannot get authorization."), - QCoreApplication::translate("RemoteClient", - "Cannot get authorization that is needed for continuing the installation.\n\n" - "Please start the setup program as a user with the appropriate rights.\n" - "Or accept the elevation of access rights if being asked.")); - return; + QMessageBox::Button res = QMessageBox::Retry; + while (res == QMessageBox::Retry && !started) { + res = MessageBoxHandler::critical(MessageBoxHandler::currentBestSuitParent(), + QLatin1String("AuthorizationError"), + QCoreApplication::translate("RemoteClient", "Cannot get authorization."), + QCoreApplication::translate("RemoteClient", + "Cannot get authorization that is needed for continuing the installation.\n\n" + "Please start the setup program as a user with the appropriate rights.\n" + "Or accept the elevation of access rights if being asked."), + QMessageBox::Abort | QMessageBox::Retry, QMessageBox::Retry); + if (res == QMessageBox::Retry) + started = AdminAuthorization::execute(0, m_serverCommand, m_serverArguments); + } + } else { + // something went wrong with authorizing, either user pressed cancel or entered + // wrong password + const QString fallback = m_serverCommand + QLatin1String(" ") + m_serverArguments + .join(QLatin1String(" ")); + + const QMessageBox::Button res = + MessageBoxHandler::critical(MessageBoxHandler::currentBestSuitParent(), + QLatin1String("AuthorizationError"), + QCoreApplication::translate("RemoteClient", "Cannot get authorization."), + QCoreApplication::translate("RemoteClient", "Cannot get authorization that " + "is needed for continuing the installation.\n Either abort the " + "installation or use the fallback solution by running\n\n%1\n\nas a user " + "with the appropriate rights and then clicking OK.").arg(fallback), + QMessageBox::Abort | QMessageBox::Ok, QMessageBox::Ok); + + if (res == QMessageBox::Ok) + started = true; } - // something went wrong with authorizing, either user pressed cancel or entered - // wrong password - const QString fallback = m_serverCommand + QLatin1String(" ") + m_serverArguments - .join(QLatin1String(" ")); - - const QMessageBox::Button res = - MessageBoxHandler::critical(MessageBoxHandler::currentBestSuitParent(), - QLatin1String("AuthorizationError"), - QCoreApplication::translate("RemoteClient", "Cannot get authorization."), - QCoreApplication::translate("RemoteClient", "Cannot get authorization that " - "is needed for continuing the installation.\n Either abort the " - "installation or use the fallback solution by running\n\n%1\n\nas a user " - "with the appropriate rights and then clicking OK.").arg(fallback), - QMessageBox::Abort | QMessageBox::Ok, QMessageBox::Ok); - - if (res == QMessageBox::Ok) - started = true; } } else { started = QInstaller::startDetached(m_serverCommand, m_serverArguments, |