Changeset View
Changeset View
Standalone View
Standalone View
kate/kateviewspace.cpp
Show First 20 Lines • Show All 701 Lines • ▼ Show 20 Line(s) | |||||
702 | 702 | | |||
703 | void KateViewSpace::restoreConfig(KateViewManager *viewMan, const KConfigBase *config, const QString &groupname) | 703 | void KateViewSpace::restoreConfig(KateViewManager *viewMan, const KConfigBase *config, const QString &groupname) | ||
704 | { | 704 | { | ||
705 | KConfigGroup group(config, groupname); | 705 | KConfigGroup group(config, groupname); | ||
706 | 706 | | |||
707 | // restore Document lru list so that all tabs from the last session reappear | 707 | // restore Document lru list so that all tabs from the last session reappear | ||
708 | const QStringList lruList = group.readEntry("Documents", QStringList()); | 708 | const QStringList lruList = group.readEntry("Documents", QStringList()); | ||
709 | for (int i = 0; i < lruList.size(); ++i) { | 709 | for (int i = 0; i < lruList.size(); ++i) { | ||
710 | // ignore non-existing documents and documents we already added to the LRU list | ||||
711 | // no wild m_lruDocList modifications to keep list + tabs in sync even for restore | ||||
710 | auto doc = KateApp::self()->documentManager()->findDocument(QUrl(lruList[i])); | 712 | auto doc = KateApp::self()->documentManager()->findDocument(QUrl(lruList[i])); | ||
711 | if (doc) { | 713 | if (doc && !m_lruDocList.contains(doc)) { | ||
712 | const int index = m_lruDocList.indexOf(doc); | | |||
713 | if (index < 0) { | | |||
714 | registerDocument(doc); | 714 | registerDocument(doc); | ||
715 | Q_ASSERT(m_lruDocList.contains(doc)); | 715 | Q_ASSERT(m_lruDocList.contains(doc)); | ||
716 | } else { | | |||
717 | m_lruDocList.removeAt(index); | | |||
718 | m_lruDocList.append(doc); | | |||
719 | } | | |||
720 | } | 716 | } | ||
721 | } | 717 | } | ||
722 | 718 | | |||
723 | // restore active view properties | 719 | // restore active view properties | ||
724 | const QString fn = group.readEntry("Active View"); | 720 | const QString fn = group.readEntry("Active View"); | ||
725 | if (!fn.isEmpty()) { | 721 | if (!fn.isEmpty()) { | ||
726 | KTextEditor::Document *doc = KateApp::self()->documentManager()->findDocument(QUrl(fn)); | 722 | KTextEditor::Document *doc = KateApp::self()->documentManager()->findDocument(QUrl(fn)); | ||
727 | 723 | | |||
Show All 20 Lines |