bool FavoriteFolderView::acceptDrag(QDropEvent *e) const
{
    KMFolderTree *ft = mainWidget()->folderTree();
    assert(ft);
    if(e->provides("application/x-qlistviewitem") &&
            (e->source() == ft->viewport() || e->source() == viewport()))
        return true;
    return FolderTreeBase::acceptDrag(e);
}
示例#2
0
void FavoriteFolderView::dropped(QDropEvent * e, QListViewItem * after)
{
  QListViewItem* afterItem = after;
  KMFolderTree *ft = mainWidget()->folderTree();
  assert( ft );
  if ( e->source() == ft->viewport() && e->provides( "application/x-qlistviewitem" ) ) {
    for ( QListViewItemIterator it( ft ); it.current(); ++it ) {
      if ( !it.current()->isSelected() )
        continue;
      KMFolderTreeItem *fti = static_cast<KMFolderTreeItem*>( it.current() );
      if ( !fti->folder() )
        continue;
      afterItem = addFolder( fti->folder(), prettyName( fti ), afterItem );
    }
    e->accept();
  }
}