| 301 | } |
| 302 | |
| 303 | void QmitkForm::OnSubmitButtonClicked() |
| 304 | { |
| 305 | if (this->ValidateCurrentSection()) |
| 306 | { |
| 307 | emit Submit(); |
| 308 | |
| 309 | if (m_ResponsesPath.empty()) |
| 310 | { |
| 311 | m_ResponsesPath = QFileDialog::getSaveFileName(this, |
| 312 | "Submit Form", |
| 313 | QStandardPaths::writableLocation(QStandardPaths::DocumentsLocation).append("/form.csv"), |
| 314 | "Comma-separated values (*.csv)").toStdString(); |
| 315 | } |
| 316 | |
| 317 | if (!m_ResponsesPath.empty()) |
| 318 | { |
| 319 | bool retry; |
| 320 | |
| 321 | do |
| 322 | { |
| 323 | retry = false; |
| 324 | |
| 325 | try |
| 326 | { |
| 327 | mitk::Forms::SubmitToCSV(*m_Form, m_ResponsesPath); |
| 328 | } |
| 329 | catch (const mitk::Exception& e) |
| 330 | { |
| 331 | QMessageBox messageBox; |
| 332 | messageBox.setWindowTitle("Submit form"); |
| 333 | messageBox.setIcon(QMessageBox::Warning); |
| 334 | messageBox.setText(e.GetDescription()); |
| 335 | auto retryButton = messageBox.addButton("Retry", QMessageBox::NoRole); |
| 336 | messageBox.addButton("Ignore", QMessageBox::YesRole); |
| 337 | |
| 338 | messageBox.exec(); |
| 339 | |
| 340 | if (messageBox.clickedButton() == retryButton) |
| 341 | retry = true; |
| 342 | } |
| 343 | } while (retry); |
| 344 | |
| 345 | m_HasBeenSubmitted = true; |
| 346 | this->Update(); |
| 347 | } |
| 348 | } |
| 349 | } |
| 350 | |
| 351 | void QmitkForm::OnClearButtonClicked() |
| 352 | { |
nothing calls this directly
no test coverage detected