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:23:45 +1000
commit1ac492f796364b35a681c1bab1dce81e1798b365 (patch)
tree588604f2ed96602195641f5ae5d0864162f2a828 /ark/filelistview.cpp
parent0123b079a9817ccd7bf4791db673b77414dad414 (diff)
downloadtdeutils-1ac492f796364b35a681c1bab1dce81e1798b365.tar.gz
tdeutils-1ac492f796364b35a681c1bab1dce81e1798b365.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> (cherry picked from commit 058176316ee0b92a9d50d0c842690869af09e3de)
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 );