* @brief Instructs the OS to open the downloaded file as an installer. * * @note If @c useCustomInstallProcedures() returns @c true, this function does * nothing. Use the QSimpleUpdater signals to implement your own install * logic. */
| 259 | * logic. |
| 260 | */ |
| 261 | void Downloader::installUpdate() |
| 262 | { |
| 263 | if (useCustomInstallProcedures()) |
| 264 | return; |
| 265 | |
| 266 | // Update labels |
| 267 | m_ui->stopButton->setText(tr("Close")); |
| 268 | m_ui->downloadLabel->setText(tr("Download complete!")); |
| 269 | m_ui->timeLabel->setText(tr("The installer opens separately") + "..."); |
| 270 | |
| 271 | // Ask the user to install the download |
| 272 | QMessageBox box; |
| 273 | box.setIcon(QMessageBox::Question); |
| 274 | box.setDefaultButton(QMessageBox::Ok); |
| 275 | box.setStandardButtons(QMessageBox::Ok | QMessageBox::Cancel); |
| 276 | box.setInformativeText(tr("Click \"OK\" to begin installing the update")); |
| 277 | |
| 278 | QString text = tr("In order to install the update, you may need to " |
| 279 | "quit the application."); |
| 280 | |
| 281 | if (m_mandatoryUpdate) |
| 282 | text = tr("In order to install the update, you may need to " |
| 283 | "quit the application. This is a mandatory update, exiting now " |
| 284 | "will close the application."); |
| 285 | |
| 286 | box.setText("<h3>" + text + "</h3>"); |
| 287 | |
| 288 | // User wants to install the download |
| 289 | if (box.exec() == QMessageBox::Ok) { |
| 290 | if (!useCustomInstallProcedures()) |
| 291 | openDownload(); |
| 292 | } else { |
| 293 | if (m_mandatoryUpdate) |
| 294 | QApplication::quit(); |
| 295 | |
| 296 | m_ui->openButton->setEnabled(true); |
| 297 | m_ui->openButton->setVisible(true); |
| 298 | m_ui->timeLabel->setText(tr("Click the \"Open\" button to apply the update")); |
| 299 | } |
| 300 | } |
| 301 | |
| 302 | /** |
| 303 | * @brief Prompts the user to cancel the download, and cancels it if confirmed. |
nothing calls this directly
no test coverage detected