don't activate the TOC when it has no items

svn path=/trunk/KDE/kdegraphics/okular/; revision=753072
This commit is contained in:
Pino Toscano 2007-12-26 16:01:54 +00:00
parent b92fce0027
commit f84c256657
3 changed files with 8 additions and 1 deletions

View file

@ -79,7 +79,7 @@ void TOC::notifySetup( const QVector< Okular::Page * > & /*pages*/, int setupFla
// else populate the listview and enable the tab
m_model->fill( syn );
emit hasTOC( true );
emit hasTOC( !m_model->isEmpty() );
}
void TOC::notifyViewportChanged( bool /*smoothMove*/ )

View file

@ -313,6 +313,11 @@ void TOCModel::setCurrentViewport( const Okular::DocumentViewport &viewport )
}
}
bool TOCModel::isEmpty() const
{
return d->root->children.isEmpty();
}
QString TOCModel::externalFileNameForIndex( const QModelIndex &index ) const
{
if ( !index.isValid() )

View file

@ -41,6 +41,8 @@ class TOCModel : public QAbstractItemModel
void clear();
void setCurrentViewport( const Okular::DocumentViewport &viewport );
bool isEmpty() const;
QString externalFileNameForIndex( const QModelIndex &index ) const;
Okular::DocumentViewport viewportForIndex( const QModelIndex &index ) const;