Logo Search packages:      
Sourcecode: k4dirstat version File versions  Download package

QString KFileInfo::urlPart ( int  level ) const

Returns part no. "level" of this object's URL, i.e. traverses up the tree until this tree level is reached and returns this predecessor's name() . This is useful for tree searches in symmetrical trees to find an item's counterpart in the other tree.

Definition at line 257 of file kfileinfo.cpp.

References name(), parent(), and treeLevel().

Referenced by KDirStat::KDirTreeViewItem::locate().

{
    int level = treeLevel();  // Cache this - it's expensive!

    if ( level < targetLevel )
    {
      kdError() << k_funcinfo << "URL level " << targetLevel
              << " requested, this is level " << level << endl;
      return "";
    }

    const KFileInfo *item = this;

    while ( level > targetLevel )
    {
      level--;
      item = item->parent();
    }

    return item->name();
}

Here is the call graph for this function:

Here is the caller graph for this function:


Generated by  Doxygen 1.6.0   Back to index