MCPcopy Create free account
hub / github.com/baumgarr/nixnote2 / handleUrls

Method handleUrls

gui/nbrowserwindow.cpp:3575–3601  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3573
3574
3575void NBrowserWindow::handleUrls(const QMimeData *mime) {
3576 QList<QUrl> urlList = mime->urls();
3577 bool ctrlModifier = QApplication::keyboardModifiers() & Qt::ControlModifier;
3578 for (int i=0; i<urlList.size(); i++) {
3579 QString file = urlList[i].toString();
3580 if (file.toLower().startsWith("file://") && !ctrlModifier) {
3581#ifndef _WIN32
3582 attachFileSelected(file.mid(7));
3583#else
3584 attachFileSelected(file.mid(8));
3585#endif
3586 if (i<urlList.size()-1)
3587 insertHtml("<div><br/></div>");
3588 } else if (file.toLower().startsWith("file://") && ctrlModifier) {
3589 QString url = QString("<a href=\"%1\" title=\"%2\">%3</a>").arg(file).arg(file).arg(file);
3590 QLOG_DEBUG() << url;
3591 insertHtml(url);
3592 if (i<urlList.size()-1)
3593 insertHtml("<div><br/></div>");
3594 } else {
3595 editor->setFocus();
3596 QApplication::clipboard()->clear();
3597 QApplication::clipboard()->setText(file, QClipboard::Clipboard);
3598 this->editor->triggerPageAction(QWebPage::Paste);
3599 }
3600 }
3601}
3602
3603
3604

Callers 1

dropEventMethod · 0.80

Calls 4

QStringClass · 0.50
toStringMethod · 0.45
clearMethod · 0.45
setTextMethod · 0.45

Tested by

no test coverage detected