GUI: emit warning when trying to edit running jobs

See #1296.
This commit is contained in:
Moritz Bunkus 2015-08-12 10:20:56 +02:00
parent 3fe20185ea
commit e698fbad14

View File

@ -340,14 +340,20 @@ Tool::openJobInTool(Job const &job)
void
Tool::onEditAndRemove() {
m_model->withSelectedJobs(ui->jobs, [this](Job &jobToEdit) {
auto emitRunningWarning = false;
m_model->withSelectedJobs(ui->jobs, [this, &emitRunningWarning](Job &jobToEdit) {
if (Job::Running == jobToEdit.status())
return;
emitRunningWarning = true;
else {
openJobInTool(jobToEdit);
m_model->removeJobsIf([&jobToEdit](Job const &jobToRemove) { return jobToEdit.id() == jobToRemove.id(); });
}
});
if (emitRunningWarning)
MainWindow::get()->setStatusBarMessage(QY("Running jobs cannot be edited."));
}
void