Mercurial > trustbridge
comparison ui/mainwindow.cpp @ 555:4cc378f335f5
Use native path to execute software update on windows
This still does not work and always returns access denied on execution
author | Andre Heinecke <aheinecke@intevation.de> |
---|---|
date | Thu, 22 May 2014 08:52:10 +0000 |
parents | d512d8eef8f6 |
children | aee3eb10bbba |
comparison
equal
deleted
inserted
replaced
554:d512d8eef8f6 | 555:4cc378f335f5 |
---|---|
181 loadCertificateList(); | 181 loadCertificateList(); |
182 } | 182 } |
183 } | 183 } |
184 | 184 |
185 void MainWindow::handleNewSW(const QString& fileName, const QDateTime& modDate) { | 185 void MainWindow::handleNewSW(const QString& fileName, const QDateTime& modDate) { |
186 mCurMessage = tr("<h3>An update for %1 is available.</h3>\n" | 186 mCurMessage = tr("An update for %1 is available.\n" |
187 "Click here to download and install the update.").arg( | 187 "Click here to download and install the update.").arg( |
188 QApplication::applicationName()); | 188 QApplication::applicationName()); |
189 setState(NewSoftwareAvailable); | 189 setState(NewSoftwareAvailable); |
190 mSettings.setValue("Software/available", fileName); | 190 mSettings.setValue("Software/available", fileName); |
191 mSettings.setValue("Software/availableDate", modDate); | 191 mSettings.setValue("Software/availableDate", modDate); |
201 setState(TransferError); | 201 setState(TransferError); |
202 return; | 202 return; |
203 } | 203 } |
204 #ifdef WIN32 | 204 #ifdef WIN32 |
205 SHELLEXECUTEINFOW shExecInfo; | 205 SHELLEXECUTEINFOW shExecInfo; |
206 shExecInfo.lpFile = reinterpret_cast<LPCWSTR> (fileName.utf16()); | 206 shExecInfo.lpFile = reinterpret_cast<LPCWSTR> ( |
207 QDir::toNativeSeparators(instProcInfo.absoluteFilePath()).utf16()); | |
207 | 208 |
208 if (!is_admin()) { | 209 if (!is_admin()) { |
209 shExecInfo.lpVerb = L"open"; | 210 shExecInfo.lpVerb = L"open"; |
210 } else { | 211 } else { |
211 shExecInfo.lpVerb = L"runas"; | 212 shExecInfo.lpVerb = L"runas"; |
212 } | 213 } |
213 | 214 |
214 qDebug() << "Starting process " << fileName; | 215 qDebug() << "Admin? " << is_admin(); |
216 qDebug() << "Starting processs: " << QDir::toNativeSeparators(instProcInfo.absoluteFilePath()); | |
215 | 217 |
216 if (!ShellExecuteExW(&shExecInfo)) { | 218 if (!ShellExecuteExW(&shExecInfo)) { |
217 /* Execution failed, maybe the user aborted the UAC check? */ | 219 /* Execution failed, maybe the user aborted the UAC check? */ |
218 char* errmsg = getLastErrorMsg(); | 220 char* errmsg = getLastErrorMsg(); |
219 QString qerrmsg = QString::fromUtf8(errmsg); | 221 QString qerrmsg = QString::fromUtf8(errmsg); |