diff options
Diffstat (limited to 'ark/filelistview.cpp')
-rw-r--r-- | ark/filelistview.cpp | 55 |
1 files changed, 55 insertions, 0 deletions
diff --git a/ark/filelistview.cpp b/ark/filelistview.cpp index 0e099d0..bff5329 100644 --- a/ark/filelistview.cpp +++ b/ark/filelistview.cpp @@ -404,6 +404,61 @@ void FileListView::addItem( const TQStringList & entries ) flvi->setPixmap( 0, mimeType->pixmap( TDEIcon::Small ) ); } +void FileListView::updateItem( const TQStringList &entries ) +{ + TQStringList ancestorList = TQStringList::split( '/', entries[0] ); + + // Checks if the listview contains the first item in the list of ancestors + TQListViewItem *item = firstChild(); + while ( item ) + { + if ( item->text( 0 ) == ancestorList[0] || item->text( 0 ) == ancestorList[0].stripWhiteSpace()) + break; + item = item->nextSibling(); + } + + // If the list view does not contain the item ... + if ( !item ) + { + kdError( 1601 ) << ancestorList[0] << " not found" << endl; + return; + } + + // We've already dealt with the first item, remove it + ancestorList.pop_front(); + + while ( ancestorList.count() > 0 ) + { + TQString name = ancestorList[0]; + + FileLVI *parent = static_cast< FileLVI*>( item ); + item = parent->firstChild(); + while ( item ) + { + if ( item->text(0) == name ) + break; + item = item->nextSibling(); + } + + if ( !item ) + { + kdError( 1601 ) << name << " not found" << endl; + return; + } + + ancestorList.pop_front(); + } + + int i = 0; + for (TQStringList::ConstIterator it = entries.begin(); it != entries.end(); ++it) + { + item->setText(i, *it); + ++i; + } + + item->setOpen( true ); +} + void FileListView::selectAll() { TQListView::selectAll( true ); |