|
Lines 381-397
FileListView::contentsMouseMoveEvent(TQMouseEvent *e)
Link Here
|
| 381 |
FileLVI* |
381 |
FileLVI* |
| 382 |
FileListView::item(const TQString& filename) const |
382 |
FileListView::item(const TQString& filename) const |
| 383 |
{ |
383 |
{ |
| 384 |
FileLVI * flvi = (FileLVI*) firstChild(); |
384 |
TQStringList ancestorList = TQStringList::split( '/', filename ); |
| 385 |
|
385 |
|
| 386 |
while (flvi) |
386 |
// Checks if the listview contains the first item in the list of ancestors |
|
|
387 |
TQListViewItem *item = firstChild(); |
| 388 |
while ( item ) |
| 387 |
{ |
389 |
{ |
| 388 |
TQString curFilename = flvi->fileName(); |
390 |
if ( item->text( 0 ) == ancestorList[0] || item->text( 0 ) == ancestorList[0].stripWhiteSpace()) |
| 389 |
if (curFilename == filename) |
391 |
break; |
| 390 |
return flvi; |
392 |
item = item->nextSibling(); |
| 391 |
flvi = (FileLVI*) flvi->nextSibling(); |
|
|
| 392 |
} |
393 |
} |
| 393 |
|
394 |
|
| 394 |
return 0; |
395 |
// If the list view does not contain the item ... |
|
|
396 |
if ( !item ) |
| 397 |
{ |
| 398 |
kdDebug( 1601 ) << ancestorList[0] << " not found" << endl; |
| 399 |
return NULL; |
| 400 |
} |
| 401 |
|
| 402 |
// We've already dealt with the first item, remove it |
| 403 |
ancestorList.pop_front(); |
| 404 |
|
| 405 |
while ( ancestorList.count() > 0 ) |
| 406 |
{ |
| 407 |
TQString name = ancestorList[0]; |
| 408 |
|
| 409 |
FileLVI *parent = static_cast< FileLVI*>( item ); |
| 410 |
item = parent->firstChild(); |
| 411 |
while ( item ) |
| 412 |
{ |
| 413 |
if ( item->text( 0 ) == name || item->text( 0 ) == name.stripWhiteSpace()) |
| 414 |
break; |
| 415 |
item = item->nextSibling(); |
| 416 |
} |
| 417 |
|
| 418 |
if ( !item ) |
| 419 |
{ |
| 420 |
kdDebug( 1601 ) << name << " not found" << endl; |
| 421 |
return NULL; |
| 422 |
} |
| 423 |
|
| 424 |
ancestorList.pop_front(); |
| 425 |
} |
| 426 |
return static_cast< FileLVI*>( item );; |
| 395 |
} |
427 |
} |
| 396 |
|
428 |
|
| 397 |
FileLVI *FileListView::addItem( const TQStringList & entries ) |
429 |
FileLVI *FileListView::addItem( const TQStringList & entries ) |
|
Lines 412-418
FileLVI *FileListView::addItem( const TQStringList & entries )
Link Here
|
| 412 |
|
444 |
|
| 413 |
FileLVI *FileListView::addOrUpdateItem( const TQStringList &entries ) |
445 |
FileLVI *FileListView::addOrUpdateItem( const TQStringList &entries ) |
| 414 |
{ |
446 |
{ |
| 415 |
FileLVI *flvi = item ( entries[0] ); |
447 |
FileLVI *flvi = item( entries[0] ); |
| 416 |
if (flvi) { |
448 |
if (flvi) { |
| 417 |
flvi->setItemData (entries); |
449 |
flvi->setItemData (entries); |
| 418 |
return flvi; |
450 |
return flvi; |