#include <QSpacerItem>
#include <QPushButton>
#include <QDialogButtonBox>
+#include <QModelIndexList>
BookmarksDialog::BookmarksDialog( intf_thread_t *_p_intf ):QVLCFrame( _p_intf )
{
+ b_ignore_updates = false;
setWindowFlags( Qt::Tool );
setWindowOpacity( var_InheritFloat( p_intf, "qt-opacity" ) );
setWindowTitle( qtr( "Edit Bookmarks" ) );
void BookmarksDialog::update()
{
+ if ( b_ignore_updates ) return;
input_thread_t *p_input = THEMIM->getInput();
if( !p_input ) return;
input_thread_t *p_input = THEMIM->getInput();
if( !p_input ) return;
- int i_focused = bookmarksList->currentIndex().row();
-
- if( i_focused >= 0 )
+ QModelIndexList selected = bookmarksList->selectionModel()->selectedIndexes();
+ if ( !selected.empty() )
{
- input_Control( p_input, INPUT_DEL_BOOKMARK, i_focused );
+ b_ignore_updates = true;
+ QModelIndexList::Iterator it = selected.end();
+ for( --it; it != selected.begin(); it-- )
+ {
+ /* FIXME: Find out why selectedIndexes() doesn't follow the
+ SelectRows selectionBehavior() and returns all columns */
+ if ( (*it).column() == 0 )
+ input_Control( p_input, INPUT_DEL_BOOKMARK, (*it).row() );
+ }
+ if ( (*it).column() == 0 )
+ input_Control( p_input, INPUT_DEL_BOOKMARK, (*it).row() );
+ b_ignore_updates = false;
+ update();
}
}