comparison ui/installwrapper.cpp @ 841:216a65d7fc4b

(issue66) Implement is_system_install and use it This has completly different implementations for linux and Windows. The commit also moves some code into util.c for better reuse.
author Andre Heinecke <andre.heinecke@intevation.de>
date Tue, 29 Jul 2014 18:12:57 +0200
parents 51830f4912c2
children b8ae69bcc540
comparison
equal deleted inserted replaced
840:c9a31544aaab 841:216a65d7fc4b
94 QString parameters = "\"list=" + mCertListFile + 94 QString parameters = "\"list=" + mCertListFile +
95 "\" \"choices=" + choicesFile.fileName() + "\""; 95 "\" \"choices=" + choicesFile.fileName() + "\"";
96 96
97 shExecInfo.cbSize = sizeof(SHELLEXECUTEINFOW); 97 shExecInfo.cbSize = sizeof(SHELLEXECUTEINFOW);
98 shExecInfo.fMask = SEE_MASK_NOCLOSEPROCESS; 98 shExecInfo.fMask = SEE_MASK_NOCLOSEPROCESS;
99 if (!is_admin()) { 99 if (!is_admin() || !is_system_install()) {
100 shExecInfo.lpVerb = L"open"; 100 shExecInfo.lpVerb = L"open";
101 } else { 101 } else {
102 shExecInfo.lpVerb = L"runas"; 102 shExecInfo.lpVerb = L"runas";
103 } 103 }
104 shExecInfo.lpFile = reinterpret_cast<LPCWSTR> (cinstFileName.utf16()); 104 shExecInfo.lpFile = reinterpret_cast<LPCWSTR> (cinstFileName.utf16());
154 154
155 choicesFile.setAutoRemove(false); 155 choicesFile.setAutoRemove(false);
156 parameters << "list=" + mCertListFile << "choices=" + choicesFile.fileName(); 156 parameters << "list=" + mCertListFile << "choices=" + choicesFile.fileName();
157 157
158 bool sudo_started = false; 158 bool sudo_started = false;
159 bool use_sudo = is_admin(); 159 bool use_sudo = is_admin() && is_system_install();
160 if (use_sudo) { 160 if (use_sudo) {
161 QStringList sudoPrograms; 161 QStringList sudoPrograms;
162 sudoPrograms << "gksudo" << "kdesudo" << "sudo"; 162 sudoPrograms << "gksudo" << "kdesudo" << "sudo";
163 QStringList sudoParams; 163 QStringList sudoParams;
164 sudoParams << cinstProcInfo.absoluteFilePath() << parameters; 164 sudoParams << cinstProcInfo.absoluteFilePath() << parameters;

http://wald.intevation.org/projects/trustbridge/