MCPcopy Create free account
hub / github.com/ModOrganizer2/modorganizer / confirmRestartAsAdmin

Function confirmRestartAsAdmin

src/spawn.cpp:249–283  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

247}
248
249bool confirmRestartAsAdmin(QWidget* parent, const SpawnParameters& sp)
250{
251 const auto details = makeDetails(sp, ERROR_ELEVATION_REQUIRED);
252
253 log::error("{}", details);
254
255 const auto title = QObject::tr("Elevation required");
256
257 const auto mainText = QObject::tr("Cannot start %1").arg(sp.binary.fileName());
258
259 const auto content = QObject::tr(
260 "This program is requesting to run as administrator but Mod Organizer "
261 "itself is not running as administrator. Running programs as administrator "
262 "is typically unnecessary as long as the game and Mod Organizer have been "
263 "installed outside \"Program Files\".\r\n\r\n"
264 "You can restart Mod Organizer as administrator and try launching the "
265 "program again.");
266
267 log::debug("asking user to restart MO as administrator");
268
269 const auto r =
270 MOBase::TaskDialog(parent, title)
271 .main(mainText)
272 .content(content)
273 .details(details)
274 .icon(QMessageBox::Question)
275 .button({QObject::tr("Restart Mod Organizer as administrator"),
276 QObject::tr(
277 "You must allow \"helper.exe\" to make changes to the system."),
278 QMessageBox::Yes})
279 .button({QObject::tr("Cancel"), QMessageBox::Cancel})
280 .exec();
281
282 return (r == QMessageBox::Yes);
283}
284
285QMessageBox::StandardButton
286confirmStartSteam(QWidget* parent, const SpawnParameters& sp, const QString& details)

Callers 1

startBinaryAdminFunction · 0.85

Calls 3

makeDetailsFunction · 0.85
execMethod · 0.45
iconMethod · 0.45

Tested by

no test coverage detected