style fixes, i suck

svn path=/trunk/KDE/kdegraphics/okular/; revision=846875
remotes/origin/old/work/tiff-improvements
Albert Astals Cid 18 years ago
parent 0d12c549cd
commit be5c6c8a95
  1. 28
      ui/side_reviews.cpp
  2. 2
      ui/side_reviews.h

@ -212,24 +212,20 @@ void Reviews::activated( const QModelIndex &index )
m_document->setViewport( vp, -1, true ); m_document->setViewport( vp, -1, true );
} }
QModelIndexList Reviews::retrieveAnnotations(const QModelIndex& idx) QList<QModelIndex> Reviews::retrieveAnnotations(const QModelIndex& idx) const
{ {
QModelIndexList ret; QList<QModelIndex> ret;
if ( idx.isValid() ) if(idx.isValid() && idx.model()->hasChildren(idx))
{ {
if ( idx.model()->hasChildren( idx ) ) for(int i=0; i<idx.model()->rowCount(idx); i++)
{ {
int rowCount = idx.model()->rowCount( idx ); ret += retrieveAnnotations(idx.child(i, idx.column()));
for ( int i = 0; i < rowCount; i++ )
{
ret += retrieveAnnotations( idx.child( i, idx.column() ) );
}
}
else
{
ret += idx;
} }
} }
else if(idx.isValid())
{
ret += idx;
}
return ret; return ret;
} }
@ -245,14 +241,14 @@ void Reviews::contextMenuRequested( const QPoint &pos )
QModelIndexList indexes = m_view->selectionModel()->selectedIndexes(); QModelIndexList indexes = m_view->selectionModel()->selectedIndexes();
Q_FOREACH ( const QModelIndex &index, indexes ) Q_FOREACH ( const QModelIndex &index, indexes )
{ {
QModelIndexList annotations = retrieveAnnotations(index); QList<QModelIndex> annotations = retrieveAnnotations(index);
Q_FOREACH ( const QModelIndex &idx, annotations ) Q_FOREACH(const QModelIndex &idx, annotations)
{ {
const QModelIndex authorIndex = m_authorProxy->mapToSource( idx ); const QModelIndex authorIndex = m_authorProxy->mapToSource( idx );
const QModelIndex filterIndex = m_groupProxy->mapToSource( authorIndex ); const QModelIndex filterIndex = m_groupProxy->mapToSource( authorIndex );
const QModelIndex annotIndex = m_filterProxy->mapToSource( filterIndex ); const QModelIndex annotIndex = m_filterProxy->mapToSource( filterIndex );
Okular::Annotation *annotation = m_model->annotationForIndex( annotIndex ); Okular::Annotation *annotation = m_model->annotationForIndex( annotIndex );
if ( annotation ) if(annotation)
{ {
const int pageNumber = m_model->data( annotIndex, AnnotationModel::PageRole ).toInt(); const int pageNumber = m_model->data( annotIndex, AnnotationModel::PageRole ).toInt();
popup.addAnnotation( annotation, pageNumber ); popup.addAnnotation( annotation, pageNumber );

@ -56,7 +56,7 @@ class Reviews : public QWidget, public Okular::DocumentObserver
void contextMenuRequested( const QPoint& ); void contextMenuRequested( const QPoint& );
private: private:
QModelIndexList retrieveAnnotations(const QModelIndex& idx); QModelIndexList retrieveAnnotations(const QModelIndex& idx) const;
// data fields (GUI) // data fields (GUI)
TreeView * m_view; TreeView * m_view;

Loading…
Cancel
Save