TQDragObject *KFileDetailView::dragObject() { // create a list of the URL:s that we want to drag KURL::List urls; KFileItemListIterator it( * KFileView::selectedItems() ); for ( ; it.current(); ++it ){ urls.append( (*it)->url() ); } TQPixmap pixmap; if( urls.count() > 1 ) pixmap = DesktopIcon( "tdemultiple", TDEIcon::SizeSmall ); if( pixmap.isNull() ) pixmap = currentFileItem()->pixmap( TDEIcon::SizeSmall ); TQPoint hotspot; hotspot.setX( pixmap.width() / 2 ); hotspot.setY( pixmap.height() / 2 ); TQDragObject* myDragObject = new KURLDrag( urls, widget() ); myDragObject->setPixmap( pixmap, hotspot ); return myDragObject; }
//----------------------------------------------- void KFileDnDDetailView::startDrag(){ kdDebug (9020) << "KFileDnDDetailView::startDrag()" << endl; // create a list of the URL:s that we want to drag KURL::List urls; KFileItemListIterator it( * KFileView::selectedItems() ); for ( ; it.current(); ++it ){ urls.append( (*it)->url() ); } QPixmap pixmap; if( urls.count() > 1 ){ pixmap = DesktopIcon( "kmultiple", 16 ); } if( pixmap.isNull() ) pixmap = currentFileItem()->pixmap( 16 ); QPoint hotspot; hotspot.setX( pixmap.width() / 2 ); hotspot.setY( pixmap.height() / 2 ); m_dragObject = KURLDrag::newDrag( urls, widget() ); m_dragObject->setPixmap( pixmap, hotspot ); m_dragObject->drag(); // start the drag }