Exemplo n.º 1
0
void DirSelectWidget::setRootPath(const KUrl& rootUrl, const KUrl& currentUrl)
{
    d->m_rootUrl = rootUrl;
    clear();
    QString root = QDir::cleanPath(rootUrl.toLocalFile());

    if (!root.endsWith('/'))
    {
        root.append("/");
    }

    QString currentPath = QDir::cleanPath(currentUrl.isValid() ? currentUrl.toLocalFile() : root);

    d->m_item = addBranch( rootUrl, rootUrl.fileName() );
    setDirOnlyMode( d->m_item, true );
    currentPath      = currentPath.mid( root.length() );
    d->m_pendingPath = currentPath.split('/', QString::KeepEmptyParts);

    if ( !d->m_pendingPath[0].isEmpty() )
    {
        d->m_pendingPath.prepend( "" );    // ensure we open the root first.
    }

    connect( d->m_item, SIGNAL( populateFinished(K3FileTreeViewItem*) ),
             this, SLOT( load() ) );

    load();

    connect( this, SIGNAL( executed(Q3ListViewItem*) ),
             this, SLOT( slotFolderSelected(Q3ListViewItem*) ) );
}
Exemplo n.º 2
0
KFileTreeBranch* K3bFileTreeView::addBranch( const KURL& url, const QString& name, const QPixmap& pix, bool showHidden )
{
  KFileTreeBranch* newBranch = KFileTreeView::addBranch( url, name, pix, showHidden );
  newBranch->setChildRecurse( false );
  setDirOnlyMode( newBranch, m_dirOnlyMode );

  return newBranch;
}
Exemplo n.º 3
0
KFileTreeBranch* K3bFileTreeView::addBranch( KFileTreeBranch* branch )
{
  KFileTreeBranch* newBranch = KFileTreeView::addBranch( branch );
  newBranch->setChildRecurse( false );
  setDirOnlyMode( newBranch, m_dirOnlyMode );

  return newBranch;
}
Exemplo n.º 4
0
FileTreeBranch *ScanGallery::openRoot(const KUrl &root, const QString &title)
{
    FileTreeBranch *branch = addBranch(root, title);

    branch->setOpenPixmap(KIconLoader::global()->loadIcon("folder-image", KIconLoader::Small));
    branch->setShowExtensions(true);

    setDirOnlyMode(branch, false);

    connect(branch, SIGNAL(newTreeViewItems(FileTreeBranch *,const FileTreeViewItemList &)),
            SLOT(slotDecorate(FileTreeBranch *,const FileTreeViewItemList &)));

    connect(branch, SIGNAL(changedTreeViewItems(FileTreeBranch *,const FileTreeViewItemList &)),
            SLOT(slotDecorate(FileTreeBranch *,const FileTreeViewItemList &)));

    connect(branch, SIGNAL(directoryChildCount(FileTreeViewItem *,int)),
            SLOT(slotDirCount(FileTreeViewItem *,int)));

    connect(branch, SIGNAL(populateFinished(FileTreeViewItem *)),
            SLOT(slotStartupFinished(FileTreeViewItem *)));

    return (branch);
}