]> git.lyx.org Git - lyx.git/blobdiff - src/frontends/qt4/TocModel.cpp
Use <cstdint> instead of <boost/cstdint.hpp>
[lyx.git] / src / frontends / qt4 / TocModel.cpp
index 03dbf38671bd867aa7066237ed50c146b8c01b2b..51365311aa9eba703bfeda79a7243a7e114f8db2 100644 (file)
@@ -303,17 +303,17 @@ QModelIndex TocModels::currentIndex(QString const & type,
 }
 
 
-void TocModels::goTo(QString const & type, QModelIndex const & index) const
+FuncRequest TocModels::goTo(QString const & type, QModelIndex const & index) const
 {
        const_iterator it = models_.find(type);
        if (it == models_.end() || !index.isValid()) {
                LYXERR(Debug::GUI, "TocModels::goTo(): QModelIndex is invalid!");
-               return;
+               return FuncRequest(LFUN_NOACTION);
        }
-       LASSERT(index.model() == it.value()->model(), return);
+       LASSERT(index.model() == it.value()->model(), return FuncRequest(LFUN_NOACTION));
        TocItem const item = it.value()->tocItem(index);
        LYXERR(Debug::GUI, "TocModels::goTo " << item.asString());
-       dispatch(item.action());
+       return item.action();
 }
 
 
@@ -351,21 +351,19 @@ void TocModels::reset(BufferView const * bv)
        names_->blockSignals(true);
        names_->beginResetModel();
        names_->insertColumns(0, 1);
+       // In the outliner, add Tocs from the master document
        TocBackend const & backend = bv->buffer().masterBuffer()->tocBackend();
-       TocList const & tocs = backend.tocs();
-       TocList::const_iterator it = tocs.begin();
-       TocList::const_iterator toc_end = tocs.end();
-       for (; it != toc_end; ++it) {
-               QString const type = toqstr(it->first);
+       for (pair<string, shared_ptr<Toc>> const & toc : backend.tocs()) {
+               QString const type = toqstr(toc.first);
 
                // First, fill in the toc models.
                iterator mod_it = models_.find(type);
                if (mod_it == models_.end())
                        mod_it = models_.insert(type, new TocModel(this));
-               mod_it.value()->reset(it->second);
+               mod_it.value()->reset(toc.second);
 
                // Fill in the names_ model.
-               QString const gui_name = toqstr(backend.outlinerName(it->first));
+               QString const gui_name = toqstr(backend.outlinerName(toc.first));
                int const current_row = names_->rowCount();
                names_->insertRows(current_row, 1);
                QModelIndex const index = names_->index(current_row, 0);