comparison ui/mainwindow.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 78c8ce22d9f4
children bd33c6585cd0
comparison
equal deleted inserted replaced
840:c9a31544aaab 841:216a65d7fc4b
275 shExecInfo.lpParameters = reinterpret_cast<LPCWSTR> (parameters.utf16()); 275 shExecInfo.lpParameters = reinterpret_cast<LPCWSTR> (parameters.utf16());
276 276
277 // shExecInfo.fMask = SEE_MASK_NOASYNC; 277 // shExecInfo.fMask = SEE_MASK_NOASYNC;
278 shExecInfo.nShow = SW_SHOWDEFAULT; 278 shExecInfo.nShow = SW_SHOWDEFAULT;
279 279
280 if (!is_admin()) { 280 if (!is_system_install() || !is_admin()) {
281 shExecInfo.lpVerb = L"open"; 281 shExecInfo.lpVerb = L"open";
282 } else { 282 } else {
283 shExecInfo.lpVerb = L"runas"; 283 shExecInfo.lpVerb = L"runas";
284 } 284 }
285 285
297 } 297 }
298 #else /* WIN32 */ 298 #else /* WIN32 */
299 QStringList parameters; 299 QStringList parameters;
300 parameters << "--prefix" << installDir.path(); 300 parameters << "--prefix" << installDir.path();
301 bool sudo_started = false; 301 bool sudo_started = false;
302 bool use_sudo = is_admin(); 302 bool use_sudo = is_admin() && is_system_install();
303 if (use_sudo) { 303 if (use_sudo) {
304 QStringList sudoPrograms; 304 QStringList sudoPrograms;
305 sudoPrograms << "gksudo" << "kdesudo" << "sudo"; 305 sudoPrograms << "gksudo" << "kdesudo" << "sudo";
306 QStringList sudoParams; 306 QStringList sudoParams;
307 sudoParams << filePath + " " + parameters.join(" "); 307 sudoParams << filePath + " " + parameters.join(" ");
564 mQuitButton->setFixedHeight(30); 564 mQuitButton->setFixedHeight(30);
565 565
566 mInstallButton = new QPushButton(" " + tr("Install certificates again")); 566 mInstallButton = new QPushButton(" " + tr("Install certificates again"));
567 mInstallButton->setFixedHeight(30); 567 mInstallButton->setFixedHeight(30);
568 #ifdef Q_OS_WIN 568 #ifdef Q_OS_WIN
569 if (is_admin()) { 569 if (is_admin() && is_system_install()) {
570 QIcon uacShield = QApplication::style()->standardIcon(QStyle::SP_VistaShield); 570 QIcon uacShield = QApplication::style()->standardIcon(QStyle::SP_VistaShield);
571 mInstallButton->setIcon(uacShield); 571 mInstallButton->setIcon(uacShield);
572 } 572 }
573 #else 573 #else
574 mInstallButton->setIcon(QIcon(":/img/view-refresh_16px.png")); 574 mInstallButton->setIcon(QIcon(":/img/view-refresh_16px.png"));

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