[vlc-commits] Improved recognition of selected bookmarks for deletion.

Eugen Geist git at videolan.org
Tue Mar 24 10:38:53 CET 2015


vlc | branch: master | Eugen Geist <eugen.geist at gmail.com> | Mon Mar 23 17:35:55 2015 +0000| [1ffd6fa762a9c709b2ae7ba583139c6ef878b784] | committer: Jean-Baptiste Kempf

Improved recognition of selected bookmarks for deletion.

Removed FIXME annotation and fixed the recognition of selected rows in
bookmarklist.

Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=1ffd6fa762a9c709b2ae7ba583139c6ef878b784
---

 modules/gui/qt4/dialogs/bookmarks.cpp |   13 ++++++-------
 1 file changed, 6 insertions(+), 7 deletions(-)

diff --git a/modules/gui/qt4/dialogs/bookmarks.cpp b/modules/gui/qt4/dialogs/bookmarks.cpp
index bfea0eb..4a8750c 100644
--- a/modules/gui/qt4/dialogs/bookmarks.cpp
+++ b/modules/gui/qt4/dialogs/bookmarks.cpp
@@ -179,20 +179,19 @@ void BookmarksDialog::del()
     input_thread_t *p_input = THEMIM->getInput();
     if( !p_input ) return;
 
-    QModelIndexList selected = bookmarksList->selectionModel()->selectedIndexes();
+    QModelIndexList selected = bookmarksList->selectionModel()->selectedRows();
     if ( !selected.empty() )
     {
         b_ignore_updates = true;
+        /* Sort needed to make sure that selected elements are deleted in descending
+           order, otherwise the indexes might change and wrong bookmarks are deleted. */
+        qSort( selected.begin(), selected.end() );
         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() );
+        }
+        input_Control( p_input, INPUT_DEL_BOOKMARK, (*it).row() );
         b_ignore_updates = false;
         update();
     }



More information about the vlc-commits mailing list