| 854 | } |
| 855 | |
| 856 | QList< IDocument * > KDevelop::DocumentController::visibleDocumentsInWindow(MainWindow * mw) const |
| 857 | { |
| 858 | // Gather a list of all documents which do have a view in the given main window |
| 859 | // Does not find documents which are open in inactive areas |
| 860 | QList<IDocument*> list; |
| 861 | const auto documents = openDocuments(); |
| 862 | for (IDocument* doc : documents) { |
| 863 | if (auto* sdoc = dynamic_cast<Sublime::Document*>(doc)) { |
| 864 | const auto views = sdoc->views(); |
| 865 | const auto hasViewInWindow = std::any_of(views.cbegin(), views.cend(), [mw](const Sublime::View* view) { |
| 866 | const auto* const widget = view->widget(); |
| 867 | return widget && widget->window() == mw; |
| 868 | }); |
| 869 | if (hasViewInWindow) { |
| 870 | list.append(doc); |
| 871 | } |
| 872 | } |
| 873 | } |
| 874 | return list; |
| 875 | } |
| 876 | |
| 877 | QList< IDocument * > KDevelop::DocumentController::documentsExclusivelyInWindow(MainWindow * mw, bool currentAreaOnly) const |
| 878 | { |