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*) ) ); }
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; }
KFileTreeBranch* K3bFileTreeView::addBranch( KFileTreeBranch* branch ) { KFileTreeBranch* newBranch = KFileTreeView::addBranch( branch ); newBranch->setChildRecurse( false ); setDirOnlyMode( newBranch, m_dirOnlyMode ); return newBranch; }
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); }