]> git.sesse.net Git - vlc/blobdiff - modules/gui/qt4/dialogs/bookmarks.cpp
Qt: add fingerprinting ui
[vlc] / modules / gui / qt4 / dialogs / bookmarks.cpp
index 718a995b685a0fd48d4e46587e57f4878d88f4da..4867c88754f881d56886aa49d379bdf449c796fb 100644 (file)
 #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" ) );
@@ -118,6 +120,7 @@ void BookmarksDialog::updateButtons()
 
 void BookmarksDialog::update()
 {
+    if ( b_ignore_updates ) return;
     input_thread_t *p_input = THEMIM->getInput();
     if( !p_input ) return;
 
@@ -176,11 +179,22 @@ void BookmarksDialog::del()
     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();
     }
 }