From c7b7ce7b088c064d864766aaed01ff1f0f87a4cc Mon Sep 17 00:00:00 2001 From: Pino Toscano Date: Sat, 26 Dec 2009 18:19:07 +0000 Subject: [PATCH] fix selectiveUrlUpdate() - create new branches for documents different than the current one - give the Url data role, so they can be identified again later this makes it possible use it for any situation, even for updating non-existing branches for non-current documents svn path=/trunk/KDE/kdegraphics/okular/; revision=1066321 --- ui/bookmarklist.cpp | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/ui/bookmarklist.cpp b/ui/bookmarklist.cpp index adeff1cdf..dd88e6b2c 100644 --- a/ui/bookmarklist.cpp +++ b/ui/bookmarklist.cpp @@ -238,10 +238,7 @@ void BookmarkList::slotBookmarksChanged( const KUrl& url ) return; QTreeWidgetItem *item = itemForUrl( url ); - if ( item ) - { - selectiveUrlUpdate( url, item ); - } + selectiveUrlUpdate( url, item ); } QList createItems( const KUrl& baseurl, const KBookmark::List& bmlist ) @@ -356,7 +353,7 @@ void BookmarkList::selectiveUrlUpdate( const KUrl& url, QTreeWidgetItem*& item ) const QString fileString = url.isLocalFile() ? url.path() : url.prettyUrl(); if ( item ) { - for ( int i = item->childCount(); i >= 0; --i ) + for ( int i = item->childCount() - 1; i >= 0; --i ) { item->removeChild( item->child( i ) ); } @@ -364,9 +361,13 @@ void BookmarkList::selectiveUrlUpdate( const KUrl& url, QTreeWidgetItem*& item ) else { item = new QTreeWidgetItem( m_tree, FileItemType ); + item->setText( 0, fileString ); + item->setData( 0, UrlRole, qVariantFromValue( url ) ); + } + if ( m_document->isOpened() && url == m_document->currentDocument() ) + { item->setIcon( 0, KIcon( "bookmarks" ) ); item->setExpanded( true ); - item->setText( 0, fileString ); } item->addChildren( createItems( url, urlbookmarks ) ); if ( item != m_tree->invisibleRootItem() )