MCPcopy Create free account
hub / github.com/Serial-Studio/Serial-Studio / cancelDownload

Method cancelDownload

lib/QSimpleUpdater/src/Downloader.cpp:307–334  ·  view source on GitHub ↗

* @brief Prompts the user to cancel the download, and cancels it if confirmed. * * If the update is mandatory and the user cancels, the application will quit. */

Source from the content-addressed store, hash-verified

305 * If the update is mandatory and the user cancels, the application will quit.
306 */
307void Downloader::cancelDownload()
308{
309 if (m_reply && !m_reply->isFinished()) {
310 QMessageBox box;
311 box.setWindowTitle(tr("Updater"));
312 box.setIcon(QMessageBox::Question);
313 box.setStandardButtons(QMessageBox::Yes | QMessageBox::No);
314
315 QString text = tr("Are you sure you want to cancel the download?");
316 if (m_mandatoryUpdate) {
317 text = tr("Are you sure you want to cancel the download? This is a "
318 "mandatory update, exiting now will close the application");
319 }
320 box.setText(text);
321
322 if (box.exec() == QMessageBox::Yes) {
323 hide();
324 m_reply->abort();
325 if (m_mandatoryUpdate)
326 QApplication::quit();
327 }
328 } else {
329 if (m_mandatoryUpdate)
330 QApplication::quit();
331
332 hide();
333 }
334}
335
336/**
337 * @brief Writes the downloaded data to the disk.

Callers

nothing calls this directly

Calls 2

execMethod · 0.80
abortMethod · 0.45

Tested by

no test coverage detected