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

void KDirTree::startReading ( const KUrl &  url ) [slot]

Actually start reading.

It's not very pretty this is required as an extra method, but this cannot simply be done in the constructor: We need to give the caller a chance to set up Qt signal connections, and for this the constructor must return before any signals are sent, i.e. before anything is read.

Definition at line 101 of file kdirtree.cpp.

References addJob(), childAddedNotify(), finalizeLocal(), finished(), KDirStat::KFileInfo::isDir(), readConfig(), setRoot(), startingReading(), KDirStat::KioDirReadJob::stat(), and KDirStat::KLocalDirReadJob::stat().

Referenced by KDirStat::KDirTreeView::openURL(), and refresh().

{
    // kdDebug() << k_funcinfo << " " << url.url() << endl;

#if 0
    kdDebug() << "url: "            << url.url()            << endl;
    kdDebug() << "path: "           << url.path()           << endl;
    kdDebug() << "filename: "       << url.filename()       << endl;
    kdDebug() << "protocol: "       << url.protocol()       << endl;
    kdDebug() << "isValid: "        << url.isValid()  << endl;
    kdDebug() << "isMalformed: "    << url.isMalformed()    << endl;
    kdDebug() << "isLocalFile: "    << url.isLocalFile()    << endl;
#endif

    _isBusy = true;
    emit startingReading();

    setRoot( 0 );
    readConfig();
    _isFileProtocol = url.isLocalFile();

    if ( _isFileProtocol && _enableLocalDirReader )
    {
      // kdDebug() << "Using local directory reader for " << url.url() << endl;
      _readMethod = KDirReadLocal;
      _root       = KLocalDirReadJob::stat( url, this );
    }
    else
    {
      // kdDebug() << "Using KIO methods for " << url.url() << endl;
      KUrl cleanUrl( url );
      cleanUrl.cleanPath();   // Resolve relative paths, get rid of multiple '/'
      _readMethod = KDirReadKIO;
      _root             = KioDirReadJob::stat( cleanUrl, this );
    }

    if ( _root )
    {
      childAddedNotify( _root );

      if ( _root->isDir() )
      {
          KDirInfo *dir = (KDirInfo *) _root;

          if ( _readMethod == KDirReadLocal )
            addJob( new KLocalDirReadJob( this, dir ) );
          else
            addJob( new KioDirReadJob( this, dir ) );
      }
      else
      {
          _isBusy = false;
          emit finished();
      }
    }
    else    // stat() failed
    {
      // kdWarning() << "stat(" << url.url() << ") failed" << endl;
      _isBusy = false;
      emit finished();
      emit finalizeLocal( 0 );
    }
}

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