Delete the oldModel even if the new doc has no toc

BUGS: 313146
remotes/origin/epub-qtextdoc
Albert Astals Cid 13 years ago
parent d940c53767
commit 0413d53857
  1. 8
      ui/toc.cpp
  2. 6
      ui/tocmodel.cpp

@ -73,14 +73,6 @@ void TOC::notifySetup( const QVector< Okular::Page * > & /*pages*/, int setupFla
// request synopsis description (is a dom tree)
const Okular::DocumentSynopsis * syn = m_document->documentSynopsis();
// if not present, disable the contents tab
if ( !syn )
{
emit hasTOC( false );
return;
}
// else populate the listview and enable the tab
m_model->fill( syn );
emit hasTOC( !m_model->isEmpty() );
}

@ -266,8 +266,12 @@ static QModelIndex indexForIndex( const QModelIndex &oldModelIndex, QAbstractIte
void TOCModel::fill( const Okular::DocumentSynopsis *toc )
{
if ( !toc )
if ( !toc ) {
delete d->m_oldModel;
d->m_oldModel = 0;
d->m_oldTocExpandedIndexes.clear();
return;
}
clear();
emit layoutAboutToBeChanged();

Loading…
Cancel
Save