summaryrefslogtreecommitdiffstats
path: root/src/libs/installer/remoteclient_p.h
diff options
context:
space:
mode:
authorSlobodan Vrkacevic <slobodan@froglogic.com>2016-05-04 14:31:00 +0200
committerKatja Marttila <katja.marttila@qt.io>2016-05-18 03:09:55 +0000
commit80a655749ffbce4ec6328541e194e08d60b34639 (patch)
treef18b915a6ca62e2708cb825d3d931a02d1268b4b /src/libs/installer/remoteclient_p.h
parent32ecf4e576e60fd1e411b1e0cec2900516ccbace (diff)
Make usage of authorization fallback optional
Asking users to use the authorization fallback in case of authorization errors might be a bit problematic in some cases. If the users are not familiar with the concept, running: "<installer_exe> --startserver PRODUCTION,{GUID},{GUID}" from command line might be confusing or difficult. Also it might not help at all. So let's make this optional. If the config variable DisableAuthorizationFallback is set to true the installer will not ask users to run the authorization fallback but instead it will abort the installation immediately. In RemoteClient this is implemented by adding a new function called setAuthorizationFallbackDisabled. The init function could be also extend for this but the config settings are not loaded at the time when the function is called. Change-Id: I4baf1dea34c5cc0016e98df47a9492ee1418c5ee Reviewed-by: Katja Marttila <katja.marttila@qt.io> Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io>
Diffstat (limited to 'src/libs/installer/remoteclient_p.h')
-rw-r--r--src/libs/installer/remoteclient_p.h17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/libs/installer/remoteclient_p.h b/src/libs/installer/remoteclient_p.h
index e88d0579d..92dc18bfa 100644
--- a/src/libs/installer/remoteclient_p.h
+++ b/src/libs/installer/remoteclient_p.h
@@ -64,6 +64,7 @@ public:
, m_active(false)
, m_key(QLatin1String(Protocol::DefaultAuthorizationKey))
, m_mode(Protocol::Mode::Debug)
+ , m_authorizationFallbackDisabled(false)
{
m_thread.setObjectName(QLatin1String("KeepAlive"));
}
@@ -106,6 +107,11 @@ public:
}
}
+ void setAuthorizationFallbackDisabled(bool disabled)
+ {
+ m_authorizationFallbackDisabled = disabled;
+ }
+
void maybeStartServer() {
if (m_mode == Protocol::Mode::Debug)
m_serverStarted = true; // we expect the server to be started by the developer
@@ -123,6 +129,16 @@ public:
started = AdminAuthorization::execute(0, m_serverCommand, m_serverArguments);
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;
+ }
// something went wrong with authorizing, either user pressed cancel or entered
// wrong password
const QString fallback = m_serverCommand + QLatin1String(" ") + m_serverArguments
@@ -184,6 +200,7 @@ private:
QString m_key;
QThread m_thread;
Protocol::Mode m_mode;
+ bool m_authorizationFallbackDisabled;
};
} // namespace QInstaller