Exemplo n.º 1
0
void KFileTreeBranch::slotCanceled( const KURL& url )
{
    // ### anything else to do?
    // remove the url from the childrento-recurse-list
    m_openChildrenURLs.remove( url);

    // stop animations etc.
    KFileTreeViewItem *item = findTVIByURL(url);
    if (!item) return; // Uh oh...
    emit populateFinished(item);
}
Exemplo n.º 2
0
void KFileTreeBranch::slotRefreshItems( const KFileItemList& list )
{
    KFileItemListIterator it( list );
    kdDebug(250) << "Refreshing " << list.count() << " items !" << endl;
    KFileItem *currItem;
    KFileTreeViewItem *item = 0;

    while ( (currItem = it.current()) != 0 )
    {
        item = findTVIByURL(currItem->url());
        if (item) {
            item->setPixmap(0, item->fileItem()->pixmap( TDEIcon::SizeSmall ));
            item->setText( 0, item->fileItem()->text());
        }
        ++it;
    }
}
Exemplo n.º 3
0
void BaseTreeBranch::reopenFolder()
{
  if (folderToOpen.isEmpty())
    return;
  KFileTreeViewItem *item;
  for (QStringList::Iterator it = folderToOpen.begin(); it != folderToOpen.end(); ++it) {
    KURL url( (*it) );
    item = findTVIByURL(url);
    if (item) {
      // erase the url in the list
      (*it) = "";
      // open the folder
      item->setExpandable(true);
      item->setOpen(true);
    }
  }
}
Exemplo n.º 4
0
KFileTreeViewItem *KFileTreeBranch::parentKFTVItem( KFileItem *item )
{
    KFileTreeViewItem *parent = 0;

    if( ! item ) return 0;

    /* If it is a directory, check, if it exists in the dict. If not, go one up
     * and check again.
     */
    KURL url = item->url();
    // kdDebug(250) << "Item's url is " << url.prettyURL() << endl;
    KURL dirUrl( url );
    dirUrl.setFileName( TQString::null );
    // kdDebug(250) << "Directory url is " << dirUrl.prettyURL() << endl;

    parent  = findTVIByURL( dirUrl );
    // kdDebug(250) << "Returning as parent item <" << parent <<  ">" << endl;
    return( parent );
}
Exemplo n.º 5
0
void KFileTreeBranch::slCompleted( const KURL& url )
{
    kdDebug(250) << "SlotCompleted hit for " << url.prettyURL() << endl;
    KFileTreeViewItem *currParent = findTVIByURL( url );
    if( ! currParent ) return;

    kdDebug(250) << "current parent " << currParent << " is already listed: "
                 << currParent->alreadyListed() << endl;

    emit( populateFinished(currParent));
    emit( directoryChildCount(currParent, currParent->childCount()));

    /* This is a walk through the children of the last populated directory.
     * Here we start the dirlister on every child of the dir and wait for its
     * finish. When it has finished, we go to the next child.
     * This must be done for non local file systems in dirOnly- and Full-Mode
     * and for local file systems only in full mode, because the stat trick
     * (see addItem-Method) does only work for dirs, not for files in the directory.
     */
    /* Set bit that the parent dir was listed completely */
    currParent->setListed(true);

    kdDebug(250) << "recurseChildren: " << m_recurseChildren << endl;
    kdDebug(250) << "isLocalFile: " << m_startURL.isLocalFile() << endl;
    kdDebug(250) << "dirOnlyMode: " << dirOnlyMode() << endl;


    if( m_recurseChildren && (!m_startURL.isLocalFile() || ! dirOnlyMode()) )
    {
        bool wantRecurseUrl = false;
        /* look if the url is in the list for url to recurse */
        for ( KURL::List::Iterator it = m_openChildrenURLs.begin();
              it != m_openChildrenURLs.end(); ++it )
        {
            /* it is only interesting that the url _is_in_ the list. */
            if( (*it).equals( url, true ) )
                wantRecurseUrl = true;
        }

        KFileTreeViewItem    *nextChild = 0;
        kdDebug(250) << "Recursing " << url.prettyURL() << "? " << wantRecurseUrl << endl;

        if( wantRecurseUrl && currParent )
        {

            /* now walk again through the tree and populate the children to get +-signs */
            /* This is the starting point. The visible folder has finished,
               processing the children has not yet started */
            nextChild = static_cast<KFileTreeViewItem*>
                        (static_cast<TQListViewItem*>(currParent)->firstChild());

            if( ! nextChild )
            {
                /* This happens if there is no child at all */
                kdDebug( 250 ) << "No children to recuse" << endl;
            }

            /* Since we have listed the children to recurse, we can remove the entry
             * in the list of the URLs to see the children.
             */
            m_openChildrenURLs.remove(url);
        }

        if( nextChild ) /* This implies that idx > -1 */
        {
            /* Next child is defined. We start a dirlister job on every child item
             * which is a directory to find out how much children are in the child
             * of the last opened dir
             */

            /* Skip non directory entries */
            while( nextChild )
            {
                if( nextChild->isDir() && ! nextChild->alreadyListed())
                {
                    KFileItem *kfi = nextChild->fileItem();
                    if( kfi && kfi->isReadable())
                    {
                        KURL recurseUrl = kfi->url();
                        kdDebug(250) << "Starting to recurse NOW " << recurseUrl.prettyURL() << endl;
                        openURL( recurseUrl, true );
                    }
                }
                nextChild = static_cast<KFileTreeViewItem*>(static_cast<TQListViewItem*>(nextChild->nextSibling()));
                // kdDebug(250) << "Next child " << m_nextChild << endl;
            }
        }
    }
    else
    {
        kdDebug(250) << "skipping to recurse in complete-slot" << endl;
    }
}