[vlc-devel] [PATCH] Improved recognition of selected bookmarks for deletion.
Eugen Geist
eugen.geist at gmail.com
Sat Mar 21 02:01:39 CET 2015
Removed FIXME annotation and fixed the recognition of selected rows in
bookmarklist.
---
modules/gui/qt4/dialogs/bookmarks.cpp | 15 ++++++++-------
1 file changed, 8 insertions(+), 7 deletions(-)
diff --git a/modules/gui/qt4/dialogs/bookmarks.cpp b/modules/gui/qt4/dialogs/bookmarks.cpp
index bfea0eb..ef0e304 100644
--- a/modules/gui/qt4/dialogs/bookmarks.cpp
+++ b/modules/gui/qt4/dialogs/bookmarks.cpp
@@ -33,6 +33,8 @@
#include <QDialogButtonBox>
#include <QModelIndexList>
+#include <stdlib.h>
+
BookmarksDialog::BookmarksDialog( intf_thread_t *_p_intf ):QVLCFrame( _p_intf )
{
b_ignore_updates = false;
@@ -179,20 +181,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();
}
--
1.9.1
More information about the vlc-devel
mailing list