diff options
Diffstat (limited to 'ark')
-rw-r--r-- | ark/filelistview.cpp | 24 |
1 files changed, 20 insertions, 4 deletions
diff --git a/ark/filelistview.cpp b/ark/filelistview.cpp index f951a22..f1c941f 100644 --- a/ark/filelistview.cpp +++ b/ark/filelistview.cpp @@ -381,14 +381,30 @@ FileListView::contentsMouseMoveEvent(TQMouseEvent *e) FileLVI* FileListView::item(const TQString& filename) const { + if (filename.isEmpty()) { + return 0; + } + + TQStringList pathList = TQStringList::split( '/', filename ); + FileLVI * flvi = (FileLVI*) firstChild(); + // File path iterator + TQStringList::ConstIterator pathIt = pathList.begin(), pathEnd = pathList.end(); + // Iterate over the current tree level siblings while (flvi) { - TQString curFilename = flvi->fileName(); - if (curFilename == filename) - return flvi; - flvi = (FileLVI*) flvi->nextSibling(); + if (flvi->fileName() == *pathIt || flvi->fileName() == (*pathIt).stripWhiteSpace()) { + ++pathIt; + if (pathIt != pathEnd) { + flvi = (FileLVI*) flvi->firstChild(); + } else { + return flvi; + } + } + else { + flvi = (FileLVI*) flvi->nextSibling(); + } } return 0; |