diff --git a/src/plugins/coreplugin/editormanager/openeditorswindow.cpp b/src/plugins/coreplugin/editormanager/openeditorswindow.cpp index 2d96ec1848a5f272d1e197397a236eaec8b9b6ae..2764e5f38e0fb3dfd72f256b629cdf38b1c063c7 100644 --- a/src/plugins/coreplugin/editormanager/openeditorswindow.cpp +++ b/src/plugins/coreplugin/editormanager/openeditorswindow.cpp @@ -199,23 +199,12 @@ void OpenEditorsWindow::setEditors(const QList<EditLocation> &globalHistory, Edi QSet<IDocument*> documentsDone; addHistoryItems(view->editorHistory(), view, model, documentsDone); + // add missing editors from the global history addHistoryItems(globalHistory, view, model, documentsDone); // add purely restored editors which are not initialised yet - foreach (DocumentModel::Entry *entry, model->documents()) { - if (entry->document) - continue; - QTreeWidgetItem *item = new QTreeWidgetItem(); - QString title = entry->displayName(); - item->setIcon(0, m_emptyIcon); - item->setText(0, title); - item->setToolTip(0, entry->fileName()); - item->setData(0, Qt::UserRole+2, QVariant::fromValue(entry->id())); - item->setTextAlignment(0, Qt::AlignLeft); - - m_editorList->addTopLevelItem(item); - } + addRestoredItems(model); } @@ -274,3 +263,20 @@ void OpenEditorsWindow::addHistoryItems(const QList<EditLocation> &history, Edit m_editorList->setCurrentItem(item); } } + +void OpenEditorsWindow::addRestoredItems(DocumentModel *model) +{ + foreach (DocumentModel::Entry *entry, model->documents()) { + if (entry->document) + continue; + QTreeWidgetItem *item = new QTreeWidgetItem(); + QString title = entry->displayName(); + item->setIcon(0, m_emptyIcon); + item->setText(0, title); + item->setToolTip(0, entry->fileName()); + item->setData(0, Qt::UserRole+2, QVariant::fromValue(entry->id())); + item->setTextAlignment(0, Qt::AlignLeft); + + m_editorList->addTopLevelItem(item); + } +} diff --git a/src/plugins/coreplugin/editormanager/openeditorswindow.h b/src/plugins/coreplugin/editormanager/openeditorswindow.h index a5d52c98c07d0d8b7466fc33ed1481eb7e7b85ea..edc7837e95f63fdc26abc8524c3132aeb3ee8142 100644 --- a/src/plugins/coreplugin/editormanager/openeditorswindow.h +++ b/src/plugins/coreplugin/editormanager/openeditorswindow.h @@ -79,6 +79,7 @@ private: static void updateItem(QTreeWidgetItem *item, IEditor *editor); void addHistoryItems(const QList<EditLocation> &history, EditorView *view, DocumentModel *model, QSet<IDocument*> &documentsDone); + void addRestoredItems(DocumentModel *model); void ensureCurrentVisible(); bool isCentering(); void centerOnItem(int selectedIndex);