| 78 | } |
| 79 | |
| 80 | void KSaveSelectDialog::save( ) |
| 81 | { |
| 82 | auto resultCode = DialogCode::Accepted; |
| 83 | |
| 84 | const QPointer thisGuard(this); |
| 85 | for (int i = 0, count = m_listWidget->count(); i < count; ++i) { |
| 86 | auto* item = static_cast<DocumentItem*>(m_listWidget->item(i)); |
| 87 | if (item->data(Qt::CheckStateRole).toBool()) { |
| 88 | if (!item->doc()->save()) { |
| 89 | if (!thisGuard) { |
| 90 | return; // already destroyed (KDevelop is probably exiting now) |
| 91 | } |
| 92 | // Reject because the user canceled saving a document. |
| 93 | // Keep saving the remaining selected documents, because the user opted |
| 94 | // to save them all, and we assume this canceled document is an exception. |
| 95 | resultCode = DialogCode::Rejected; |
| 96 | } |
| 97 | } |
| 98 | } |
| 99 | |
| 100 | done(resultCode); |
| 101 | } |
| 102 | |
| 103 | #include "moc_savedialog.cpp" |
no test coverage detected