comparison ui/installwrapper.cpp @ 511:cef732072774

Use open instead of runas if not admin
author Andre Heinecke <aheinecke@intevation.de>
date Mon, 28 Apr 2014 10:43:59 +0000
parents a7163018de2f
children a9a57dc1eb2f
comparison
equal deleted inserted replaced
510:20f81c195cc4 511:cef732072774
13 #include <QApplication> 13 #include <QApplication>
14 #include <QDir> 14 #include <QDir>
15 #include <QDebug> 15 #include <QDebug>
16 16
17 #include "logging.h" 17 #include "logging.h"
18 #include "util.h"
18 19
19 #define INSTALL_TIMEOUT 3600000 /* Wait up to an hour */ 20 #define INSTALL_TIMEOUT 3600000 /* Wait up to an hour */
20 21
21 InstallWrapper::InstallWrapper(QObject* parent, 22 InstallWrapper::InstallWrapper(QObject* parent,
22 const QString& path, const QStringList& choices): 23 const QString& path, const QStringList& choices):
93 QString parameters = "\"list=" + mCertListFile + 94 QString parameters = "\"list=" + mCertListFile +
94 "\" \"choices=" + choicesFile.fileName() + "\""; 95 "\" \"choices=" + choicesFile.fileName() + "\"";
95 96
96 shExecInfo.cbSize = sizeof(SHELLEXECUTEINFOW); 97 shExecInfo.cbSize = sizeof(SHELLEXECUTEINFOW);
97 shExecInfo.fMask = SEE_MASK_NOCLOSEPROCESS; 98 shExecInfo.fMask = SEE_MASK_NOCLOSEPROCESS;
98 shExecInfo.lpVerb = L"runas"; 99 if (!is_admin()) {
100 shExecInfo.lpVerb = L"open";
101 } else {
102 shExecInfo.lpVerb = L"runas";
103 }
99 shExecInfo.lpFile = reinterpret_cast<LPCWSTR> (cinstFileName.utf16()); 104 shExecInfo.lpFile = reinterpret_cast<LPCWSTR> (cinstFileName.utf16());
100 shExecInfo.lpParameters = reinterpret_cast<LPCWSTR> (parameters.utf16()); 105 shExecInfo.lpParameters = reinterpret_cast<LPCWSTR> (parameters.utf16());
101 106
102 qDebug() << "Starting process " << cinstFileName <<" params: " << parameters; 107 qDebug() << "Starting process " << cinstFileName <<" params: " << parameters;
103 108

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