| 955 | } |
| 956 | |
| 957 | void 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 | |
| 985 | IDocument* DocumentController::activeDocument() const |
| 986 | { |
nothing calls this directly
no test coverage detected