diff --git a/src/plugins/coreplugin/editormanager/editormanager.cpp b/src/plugins/coreplugin/editormanager/editormanager.cpp index deb3c85b2f1..9056f03519a 100644 --- a/src/plugins/coreplugin/editormanager/editormanager.cpp +++ b/src/plugins/coreplugin/editormanager/editormanager.cpp @@ -1428,7 +1428,7 @@ void EditorManager::updateActions() { QString fName; IEditor *curEditor = currentEditor(); - int openedCount = openedEditors().count() + m_d->m_editorModel->restoredEditorCount(); + int openedCount = openedEditors().count() + m_d->m_editorModel->restoredEditors().count(); if (curEditor) { if (!curEditor->file()->fileName().isEmpty()) { QFileInfo fi(curEditor->file()->fileName()); diff --git a/src/plugins/coreplugin/editormanager/openeditorsmodel.cpp b/src/plugins/coreplugin/editormanager/openeditorsmodel.cpp index 65c6f498787..28e0afe1bb6 100644 --- a/src/plugins/coreplugin/editormanager/openeditorsmodel.cpp +++ b/src/plugins/coreplugin/editormanager/openeditorsmodel.cpp @@ -188,15 +188,15 @@ void OpenEditorsModel::removeAllRestoredEditors() } } -int OpenEditorsModel::restoredEditorCount() const +QList OpenEditorsModel::restoredEditors() const { - int count = 0; + QList result; for (int i = m_editors.count()-1; i >= 0; --i) { if (!m_editors.at(i).editor) { - ++count; + result.append(m_editors.at(i)); } } - return count; + return result; } bool OpenEditorsModel::isDuplicate(IEditor *editor) const diff --git a/src/plugins/coreplugin/editormanager/openeditorsmodel.h b/src/plugins/coreplugin/editormanager/openeditorsmodel.h index fb1e1cdb85a..208d125e367 100644 --- a/src/plugins/coreplugin/editormanager/openeditorsmodel.h +++ b/src/plugins/coreplugin/editormanager/openeditorsmodel.h @@ -72,10 +72,10 @@ public: void removeEditor(const QModelIndex &index); void removeAllRestoredEditors(); - int restoredEditorCount() const; void emitDataChanged(IEditor *editor); QList editors() const; + QList restoredEditors() const; bool isDuplicate(IEditor *editor) const; QList duplicatesFor(IEditor *editor) const; IEditor *originalForDuplicate(IEditor *duplicate) const; diff --git a/src/plugins/locator/opendocumentsfilter.cpp b/src/plugins/locator/opendocumentsfilter.cpp index 096db8b7ea6..42b03dab06a 100644 --- a/src/plugins/locator/opendocumentsfilter.cpp +++ b/src/plugins/locator/opendocumentsfilter.cpp @@ -56,13 +56,13 @@ QList OpenDocumentsFilter::matchesFor(const QString &entry) const QRegExp regexp(pattern, Qt::CaseInsensitive, QRegExp::Wildcard); if (!regexp.isValid()) return value; - foreach (IEditor *editor, m_editors) { - QString fileName = editor->file()->fileName(); - if (regexp.exactMatch(editor->displayName())) { - QString visibleName; - QVariant data; + foreach (const OpenEditorsModel::Entry &entry, m_editors) { + QString fileName = entry.fileName(); + QString displayName = entry.displayName(); + if (regexp.exactMatch(displayName)) { if (fileName.isEmpty()) { - value.append(FilterEntry(this, editor->displayName(), qVariantFromValue(editor))); + if (entry.editor) + value.append(FilterEntry(this, displayName, qVariantFromValue(entry.editor))); } else { QFileInfo fi(fileName); FilterEntry entry(this, fi.fileName(), fileName); @@ -77,7 +77,13 @@ QList OpenDocumentsFilter::matchesFor(const QString &entry) void OpenDocumentsFilter::refreshInternally() { - m_editors = m_editorManager->openedEditors(); + m_editors.clear(); + foreach (IEditor *editor, m_editorManager->openedEditors()) { + OpenEditorsModel::Entry entry; + entry.editor = editor; + m_editors.append(entry); + } + m_editors += m_editorManager->openedEditorsModel()->restoredEditors(); } void OpenDocumentsFilter::refresh(QFutureInterface &future) diff --git a/src/plugins/locator/opendocumentsfilter.h b/src/plugins/locator/opendocumentsfilter.h index b2f078ae391..7d01ebf99d2 100644 --- a/src/plugins/locator/opendocumentsfilter.h +++ b/src/plugins/locator/opendocumentsfilter.h @@ -39,6 +39,7 @@ #include #include +#include #include namespace Locator { @@ -63,7 +64,7 @@ public slots: private: Core::EditorManager *m_editorManager; - QList m_editors; + QList m_editors; }; } // namespace Internal diff --git a/src/plugins/qmldesigner/designmode.cpp b/src/plugins/qmldesigner/designmode.cpp index ffa1578e238..4b824d3e4bc 100644 --- a/src/plugins/qmldesigner/designmode.cpp +++ b/src/plugins/qmldesigner/designmode.cpp @@ -256,7 +256,7 @@ void DesignMode::updateActions() Core::IEditor *curEditor = m_currentEditor.data(); int openedCount = editorManager->openedEditors().count() - + editorManager->openedEditorsModel()->restoredEditorCount(); + + editorManager->openedEditorsModel()->restoredEditors().count(); QString fName; if (curEditor) {