Allow the selection of more than annotation in the annotation tree, so they can be deleted at once using the popup menu.

FEATURE: 155668

svn path=/trunk/KDE/kdegraphics/okular/; revision=761323
remotes/origin/KDE/4.1
Pino Toscano 18 years ago
parent 51f34f3f9f
commit b0245bd01d
  1. 41
      ui/side_reviews.cpp

@ -92,6 +92,7 @@ Reviews::Reviews( QWidget * parent, Okular::Document * document )
m_view = new TreeView( m_document, this ); m_view = new TreeView( m_document, this );
m_view->setAlternatingRowColors( true ); m_view->setAlternatingRowColors( true );
m_view->setSelectionMode( QAbstractItemView::ExtendedSelection );
m_view->header()->hide(); m_view->header()->hide();
QToolBar *toolBar = new QToolBar( this ); QToolBar *toolBar = new QToolBar( this );
@ -213,28 +214,26 @@ void Reviews::activated( const QModelIndex &index )
void Reviews::contextMenuRequested( const QPoint &pos ) void Reviews::contextMenuRequested( const QPoint &pos )
{ {
const QModelIndex index = m_view->indexAt( pos ); AnnotationPopup popup( m_document, this );
if ( !index.isValid() ) connect( &popup, SIGNAL( setAnnotationWindow( Okular::Annotation* ) ),
return; this, SIGNAL( setAnnotationWindow( Okular::Annotation* ) ) );
connect( &popup, SIGNAL( removeAnnotationWindow( Okular::Annotation* ) ),
const QModelIndex authorIndex = m_authorProxy->mapToSource( index ); this, SIGNAL( removeAnnotationWindow( Okular::Annotation* ) ) );
const QModelIndex filterIndex = m_groupProxy->mapToSource( authorIndex );
const QModelIndex annotIndex = m_filterProxy->mapToSource( filterIndex ); QModelIndexList indexes = m_view->selectionModel()->selectedIndexes();
Q_FOREACH ( const QModelIndex &index, indexes )
Okular::Annotation *annotation = m_model->annotationForIndex( annotIndex ); {
if ( annotation ) { const QModelIndex authorIndex = m_authorProxy->mapToSource( index );
int pageNumber = m_model->data( annotIndex, AnnotationModel::PageRole ).toInt(); const QModelIndex filterIndex = m_groupProxy->mapToSource( authorIndex );
const QModelIndex annotIndex = m_filterProxy->mapToSource( filterIndex );
AnnotationPopup popup( m_document, this ); Okular::Annotation *annotation = m_model->annotationForIndex( annotIndex );
popup.addAnnotation( annotation, pageNumber ); if ( annotation ) {
const int pageNumber = m_model->data( annotIndex, AnnotationModel::PageRole ).toInt();
connect( &popup, SIGNAL( setAnnotationWindow( Okular::Annotation* ) ), popup.addAnnotation( annotation, pageNumber );
this, SIGNAL( setAnnotationWindow( Okular::Annotation* ) ) ); }
connect( &popup, SIGNAL( removeAnnotationWindow( Okular::Annotation* ) ),
this, SIGNAL( removeAnnotationWindow( Okular::Annotation* ) ) );
popup.exec( m_view->viewport()->mapToGlobal( pos ) );
} }
popup.exec( m_view->viewport()->mapToGlobal( pos ) );
} }
#include "side_reviews.moc" #include "side_reviews.moc"

Loading…
Cancel
Save