Esempio n. 1
0
/* --- KFileTreeViewToplevelItem --- */
KFileTreeBranch::KFileTreeBranch( KFileTreeView *parent, const KURL& url,
                                  const TQString& name,
				  const TQPixmap& pix, bool showHidden,
				  KFileTreeViewItem *branchRoot )

    : KDirLister( false ),
      m_root( branchRoot ),
      m_startURL( url ),
      m_name ( name ),
      m_rootIcon( pix ),
      m_openRootIcon( pix ),
      m_recurseChildren(true),
      m_showExtensions(true)
{
    kdDebug( 250) << "Creating branch for url " << url.prettyURL() << endl;

    /* if non exists, create one */
    if( ! branchRoot )
    {
        m_root =  new KFileTreeViewItem( parent,
                                         new KFileItem( url, "inode/directory",
                                                        S_IFDIR  ),
                                         this );
    }

    m_root->setExpandable( true );
    m_root->setPixmap( 0, pix );
    m_root->setText( 0, name );

    setShowingDotFiles( showHidden );

    connect( this, TQT_SIGNAL( refreshItems(const KFileItemList&)),
             this, TQT_SLOT  ( slotRefreshItems( const KFileItemList& )));

    connect( this, TQT_SIGNAL( newItems(const KFileItemList&)),
             this, TQT_SLOT  ( addItems( const KFileItemList& )));

    connect( this, TQT_SIGNAL( completed(const KURL& )),
             this,   TQT_SLOT(slCompleted(const KURL&)));

    connect( this, TQT_SIGNAL( started( const KURL& )),
             this,   TQT_SLOT( slotListerStarted( const KURL& )));

    connect( this, TQT_SIGNAL( deleteItem( KFileItem* )),
             this,   TQT_SLOT( slotDeleteItem( KFileItem* )));

    connect( this, TQT_SIGNAL( canceled(const KURL&) ),
             this,   TQT_SLOT( slotCanceled(const KURL&) ));

    connect( this, TQT_SIGNAL( clear()),
             this, TQT_SLOT( slotDirlisterClear()));

    connect( this, TQT_SIGNAL( clear(const KURL&)),
             this, TQT_SLOT( slotDirlisterClearURL(const KURL&)));

    connect( this, TQT_SIGNAL( redirection( const KURL& , const KURL& ) ),
             this, TQT_SLOT( slotRedirect( const KURL&, const KURL& )));

    m_openChildrenURLs.append( url );
}
   RemoteLister::RemoteLister( const KURL &url, QWidget *parent )
      : KDirLister( true /*don't fetch mimetypes*/ )
      , m_root( new Store( url, url.url(), 0 ) )
      , m_store( m_root )
   {
      setAutoUpdate( false ); //don't use KDirWatchers
      setShowingDotFiles( true ); //stupid KDirLister API function names
      setMainWindow( parent );

      //use SIGNAL(result(KIO::Job*)) instead and then use Job::error()
      connect( this, SIGNAL(completed()), SLOT(completed()) );
      connect( this, SIGNAL(canceled()), SLOT(canceled()) );

      //we do this non-recursively - it is the only way!
      openURL( url );
   }