void JobListWidget::execDeleteJob(JobListWidgetItem *jobItem) { if(!jobItem) { DEBUG << "Null JobListWidgetItem passed."; return; } JobPtr job = jobItem->job(); QMessageBox::StandardButton confirm = QMessageBox::question(this, tr("Confirm action"), tr("Are you sure you want to delete job \"%1\" " "(this cannot be undone)?") .arg(job->name())); if(confirm != QMessageBox::Yes) return; bool purgeArchives = false; if(!job->archives().isEmpty()) { QMessageBox::StandardButton delArchives = QMessageBox::question(this, tr("Confirm action"), tr("Also delete %1 archives " "belonging to this job " "(this cannot be undone)?") .arg(job->archives().count())); if(delArchives == QMessageBox::Yes) purgeArchives = true; } emit deleteJob(job, purgeArchives); delete jobItem; emit countChanged(count(), visibleItemsCount()); }
void JobListWidget::restoreItem() { if(sender()) { JobPtr job = qobject_cast<JobListWidgetItem *>(sender())->job(); if(!job->archives().isEmpty()) { ArchivePtr archive = job->archives().first(); RestoreDialog *restoreDialog = new RestoreDialog(this, archive); restoreDialog->show(); connect(restoreDialog, &RestoreDialog::accepted, [=] { emit restoreArchive(restoreDialog->archive(), restoreDialog->getOptions()); }); } } }