MCPcopy Create free account
hub / github.com/KDE/kdiff3 / dropEvent

Method dropEvent

src/difftextwindow.cpp:437–477  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

435}
436
437void DiffTextWindow::dropEvent(QDropEvent* dropEvent)
438{
439 dropEvent->accept();
440
441 if(dropEvent->mimeData()->hasUrls())
442 {
443 QList<QUrl> urlList = dropEvent->mimeData()->urls();
444
445 if(m_app.canContinue() && !urlList.isEmpty())
446 {
447 FileAccess fa(urlList.first());
448 if(fa.isDir())
449 return;
450
451 d->sourceData->setFileAccess(fa);
452
453 Q_EMIT finishDrop();
454 }
455 }
456 else if(dropEvent->mimeData()->hasText())
457 {
458 QString text = dropEvent->mimeData()->text();
459
460 if(m_app.canContinue())
461 {
462 QString error;
463
464 d->sourceData->setData(text);
465 const QStringList& errors = d->sourceData->getErrors();
466 if(!errors.isEmpty())
467 error = d->sourceData->getErrors()[0];
468
469 if(!error.isEmpty())
470 {
471 KMessageBox::error(this, error);
472 }
473
474 Q_EMIT finishDrop();
475 }
476 }
477}
478
479void DiffTextWindow::printWindow(RLPainter& painter, const QRect& view, const QString& headerText, qint32 line, const LineType linesPerPage, const QColor& fgColor)
480{

Callers

nothing calls this directly

Calls 6

setDataMethod · 0.80
acceptMethod · 0.45
canContinueMethod · 0.45
isEmptyMethod · 0.45
isDirMethod · 0.45
setFileAccessMethod · 0.45

Tested by

no test coverage detected