MCPcopy Create free account
hub / github.com/KDE/kdevelop / saveSomeDocuments

Method saveSomeDocuments

kdevplatform/shell/documentcontroller.cpp:825–854  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

823}
824
825bool DocumentController::saveSomeDocuments(const QList<IDocument*>& list, SaveSelectionMode mode)
826{
827 if (mode == SaveSelectionMode::DontAskUser) {
828 bool ret = true;
829 const auto documents = modifiedDocuments(list);
830 const QPointer thisGuard(this);
831 for (IDocument* doc : documents) {
832 if (!DocumentController::isEmptyDocumentUrl(doc->url()) && !doc->save()) {
833 if (!thisGuard) {
834 return false; // already destroyed (KDevelop is probably exiting now)
835 }
836 // Fail because the user canceled saving a document.
837 // Keep saving the remaining documents, because they are likely to be
838 // saved without user prompts. And our caller may not be able to
839 // (or choose not to) abort the operation that triggered the saving.
840 ret = false;
841 }
842 }
843 return ret;
844 } else {
845 // Ask the user which documents to save
846 QList<IDocument*> checkSave = modifiedDocuments(list);
847
848 if (!checkSave.isEmpty()) {
849 ScopedDialog<KSaveSelectDialog> dialog(checkSave, qApp->activeWindow());
850 return dialog->exec();
851 }
852 return true;
853 }
854}
855
856QList< IDocument * > KDevelop::DocumentController::visibleDocumentsInWindow(MainWindow * mw) const
857{

Callers 3

testSaveSomeDocumentsMethod · 0.80
executeMethod · 0.80
startSearchMethod · 0.80

Calls 4

execMethod · 0.80
urlMethod · 0.45
saveMethod · 0.45
isEmptyMethod · 0.45

Tested by 1

testSaveSomeDocumentsMethod · 0.64