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

Method closeAllOtherDocuments

kdevplatform/shell/documentcontroller.cpp:957–983  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

955}
956
957void DocumentController::closeAllOtherDocuments()
958{
959 if (Sublime::MainWindow* mw = Core::self()->uiControllerInternal()->activeSublimeWindow()) {
960 const auto* const activeView = mw->activeView();
961
962 if (!activeView) {
963 qCWarning(SHELL) << "Shouldn't there always be an active view when this function is called?";
964 return;
965 }
966
967 // Deal with saving unsaved solo views
968 QList<IDocument*> soloViews = documentsExclusivelyInWindow(qobject_cast<KDevelop::MainWindow*>(mw));
969 soloViews.removeAll(qobject_cast<IDocument*>(activeView->document()));
970
971 if (!saveSomeDocuments(soloViews, SaveSelectionMode::LetUserSelect))
972 // User cancelled or other error
973 return;
974
975 const bool closeSilently = true; // already offered to save the documents to be closed, do not ask again
976 const auto views = mw->area()->views();
977 for (Sublime::View* view : views) {
978 if (view != activeView)
979 mw->area()->closeView(view, closeSilently);
980 }
981 activeView->widget()->setFocus();
982 }
983}
984
985IDocument* DocumentController::activeDocument() const
986{

Callers

nothing calls this directly

Calls 8

activeSublimeWindowMethod · 0.80
uiControllerInternalMethod · 0.80
activeViewMethod · 0.45
documentMethod · 0.45
viewsMethod · 0.45
areaMethod · 0.45
closeViewMethod · 0.45
widgetMethod · 0.45

Tested by

no test coverage detected