summaryrefslogtreecommitdiffstats
path: root/ark/filelistview.cpp
diff options
context:
space:
mode:
authorFabio Rossi <rossi.f@inwind.it>2016-04-23 22:19:52 +1000
committerMichele Calgaro <michele.calgaro@yahoo.it>2016-04-23 22:19:52 +1000
commit058176316ee0b92a9d50d0c842690869af09e3de (patch)
treee4563277953c002bf0bc4c434f4170b0ea170a57 /ark/filelistview.cpp
parent4e99fc39eb61da7ad6fedaa05df76101c6db571e (diff)
downloadtdeutils-058176316ee0b92a9d50d0c842690869af09e3de.tar.gz
tdeutils-058176316ee0b92a9d50d0c842690869af09e3de.zip
Ark: info for folders in rar archives are now displayed as well.
This relates to bug 2541. Signed-off-by: Fabio Rossi <rossi.f@inwind.it> Patch updated and slightly reworked to fit TQt framework Signed-off-by: Michele Calgaro <michele.calgaro@yahoo.it>
Diffstat (limited to 'ark/filelistview.cpp')
-rw-r--r--ark/filelistview.cpp55
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 );