void ViewManager::dropped(QDropEvent *e) { kdDebug(5720) << "ViewManager::dropped: got a drop event" << endl; // don't allow drops from our own drags if(e->source() == this) return; QString clipText, vcards; KURL::List urls; if(KURLDrag::decode(e, urls)) { KURL::List::ConstIterator it = urls.begin(); int c = urls.count(); if(c > 1) { QString questionString = i18n("Import one contact into your addressbook?", "Import %n contacts into your addressbook?", c); if(KMessageBox::questionYesNo(this, questionString, i18n("Import Contacts?"), i18n("Import"), i18n("Do Not Import")) == KMessageBox::Yes) { for(; it != urls.end(); ++it) emit urlDropped(*it); } } else if(c == 1) emit urlDropped(*it); } else if(KVCardDrag::decode(e, vcards)) { KABC::VCardConverter converter; const KABC::Addressee::List list = converter.parseVCards(vcards); KABC::Addressee::List::ConstIterator it; for(it = list.begin(); it != list.end(); ++it) { KABC::Addressee a = mCore->addressBook()->findByUid((*it).uid()); if(a.isEmpty()) // not yet in address book { mCore->addressBook()->insertAddressee(*it); emit modified(); } } mActiveView->refresh(); } }
/* drag event processing need setAcceptDrops(true); into the constructor need implementation to accept the drop: void dragEnterEvent(QDragEnterEvent* event); void dragMoveEvent(QDragMoveEvent* event); void dragLeaveEvent(QDragLeaveEvent* event); */ void Themes::dropEvent(QDropEvent *event) { const QMimeData* mimeData = event->mimeData(); if(mimeData->hasUrls()) { emit urlDropped(mimeData->urls()); event->acceptProposedAction(); } }
void Wallpaper::addUrls(const KUrl::List &urls) { if (d->script) { d->script->setUrls(urls); } else { // provide compatibility with urlDropped foreach (const KUrl &url, urls) { emit urlDropped(url); } }
/* drag event processing need setAcceptDrops(true); into the constructor need implementation to accept the drop: void dragEnterEvent(QDragEnterEvent* event); void dragMoveEvent(QDragMoveEvent* event); void dragLeaveEvent(QDragLeaveEvent* event); */ void Themes::dropEvent(QDropEvent *event) { ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("start")); const QMimeData* mimeData = event->mimeData(); if(mimeData->hasUrls()) { ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("hasUrls")); emit urlDropped(mimeData->urls()); event->acceptProposedAction(); } }
/* drag event processing (impossible with Qt on systray) need setAcceptDrops(true); into the constructor need implementation to accept the drop: void dragEnterEvent(QDragEnterEvent* event); void dragMoveEvent(QDragMoveEvent* event); void dragLeaveEvent(QDragLeaveEvent* event); */ void SystrayIcon::dropEvent(QDropEvent *event) { const QMimeData* mimeData = event->mimeData(); if(mimeData->hasUrls()) { //impossible with Qt on systray ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"mimeData->urls().size()"+QString::number(mimeData->urls().size())); emit urlDropped(mimeData->urls()); event->acceptProposedAction(); } }
/** * @brief handle image drops * @param event event info */ void CanvasView::dropEvent(QDropEvent *event) { const QMimeData *data = event->mimeData(); if(data->hasImage()) { emit imageDropped(qvariant_cast<QImage>(event->mimeData()->imageData())); } else if(data->hasUrls()) { emit urlDropped(event->mimeData()->urls().first()); } else if(data->hasColor()) { emit colorDropped(event->mimeData()->colorData().value<QColor>()); } else { // unsupported data return; } event->acceptProposedAction(); }
void ThumbnailList::dropEvent( QDropEvent * ev ) { KURL::List lst; if ( KURLDrag::decode( ev, lst ) ) emit urlDropped( lst.first() ); }