예제 #1
0
파일: tabbar.cpp 프로젝트: amosbird/CopyQ
void TabBar::dragEnterEvent(QDragEnterEvent *event)
{
    if ( canDropToTab(*event) )
        acceptDrag(event);
    else
        QTabBar::dragEnterEvent(event);
}
예제 #2
0
파일: tabbar.cpp 프로젝트: amosbird/CopyQ
void TabBar::dragMoveEvent(QDragMoveEvent *event)
{
    if ( dropItemsTabIndex(*event, *this) != -1 )
        acceptDrag(event);
    else
        QTabBar::dragMoveEvent(event);
}
예제 #3
0
void KFileDetailView::contentsDropEvent( TQDropEvent *e )
{
    d->dropItem = 0;
    d->autoOpenTimer.stop();

    if ( ! acceptDrag( e ) ) { // can we decode this ?
        e->ignore();            // No
        return;
    }
    e->acceptAction();     // Yes

    KFileListViewItem *item = dynamic_cast<KFileListViewItem*>(itemAt( contentsToViewport( e->pos() ) ));
    KFileItem * fileItem = 0;
    if (item)
        fileItem = item->fileInfo();

    emit dropped(e, fileItem);

    KURL::List urls;
    if (KURLDrag::decode( e, urls ) && !urls.isEmpty())
    {
        emit dropped(e, urls, fileItem ? fileItem->url() : KURL());
        sig->dropURLs(fileItem, e, urls);
    }
}
예제 #4
0
void KFileDetailView::contentsDragMoveEvent( TQDragMoveEvent *e )
{
    if ( ! acceptDrag( e ) ) { // can we decode this ?
        e->ignore();            // No
        return;
    }
    e->acceptAction();     // Yes

    if ((dropOptions() & AutoOpenDirs) == 0)
       return;

    KFileListViewItem *item = dynamic_cast<KFileListViewItem*>(itemAt( contentsToViewport( e->pos() ) ));
    if ( item ) {  // are we over an item ?
       if (d->dropItem != item)
       {
           d->dropItem = item;
           d->autoOpenTimer.start( autoOpenDelay() ); // restart timer
       }
    }
    else
    {
       d->dropItem = 0;
       d->autoOpenTimer.stop();
    }
}
예제 #5
0
void KNCollectionView::contentsDropEvent(QDropEvent *e)
{
    cleanItemHighlighter(); // necessary since we overwrite KListView::contentsDropEvent()
    QListViewItem *item = itemAt(contentsToViewport(e->pos()));
    KNCollectionViewItem *fti = static_cast<KNCollectionViewItem *>(item);
    if(fti && (fti->coll) && acceptDrag(e))
    {
        emit folderDrop(e, fti);
        e->accept(true);
    }
    else
        e->accept(false);
}
예제 #6
0
void LibraryTreeWidget::dragEnterEvent(QDragEnterEvent *event)
{
    if (acceptDrag(event)) {
        event->accept();
        m_currentItem = currentItem();
        m_dropItem = itemAt(event->pos());

        if (m_dropItem) {
            m_openBranchTimer->start(AUTO_EXPAND_DELAY);
        }
    } else {
        event->ignore();
    }
}
예제 #7
0
//-----------------------------------------------
void KFileDnDDetailView::contentsDragEnterEvent( QDragEnterEvent *e ) {

    kdDebug (9020) << "KFileDnDDetailView::contentsDragEnterEvent" << endl;

	if ( ! acceptDrag( e ) ) {
		e->accept( false );
		return;
	}
	e->acceptAction();
	QListViewItem *i = itemAt( contentsToViewport( e->pos() ) );
	if ( i && m_useAutoOpenTimer ) {
		m_dropItem = i;
		m_autoOpenTimer.start( m_autoOpenTime );
	}
}
예제 #8
0
//-----------------------------------------------
void KFileDnDDetailView::contentsDropEvent( QDropEvent* e ) {

    kdDebug (9020) << "KFileDndDetailView::contentsDropEvent" << endl;

	if( m_useAutoOpenTimer ) {
		m_autoOpenTimer.stop();
		m_dropItem = 0L;
	}
	if( ! acceptDrag( e ) ) {
		e->acceptAction( false );
		return;
	}
	e->acceptAction();				
	// the drop was accepted so lets emit this to the outside world
	KURL::List urls;
	KURLDrag::decode( e, urls );
	emit dropped( e );
	emit dropped( this, e );
	emit dropped( this, urls );
}
예제 #9
0
void LibraryTreeWidget::dragMoveEvent(QDragMoveEvent *event)
{
    m_openBranchTimer->stop();

    if (acceptDrag(event)) {
        event->accept();
        m_dropItem = itemAt(event->pos());

        if (m_dropItem && m_dropItem == m_currentItem) { // tring to drop on same Library
            QToolTip::showText(mapToGlobal(event->pos() + QPoint(10, 0)), i18n("existing library"));
        } else {
            QToolTip::hideText();
        }

        if (m_dropItem) {
            setCurrentItem(m_dropItem);
            m_openBranchTimer->start(AUTO_EXPAND_DELAY);
        }
    } else {
        event->ignore();
    }
}