Commit 0490f551 authored by Volker Krause's avatar Volker Krause
Browse files

Also allow to paste binary content

Common e.g. for train barcodes.
parent 70df0be3
......@@ -235,17 +235,22 @@ void ApplicationController::importFromIntent(const KAndroidExtras::Intent &inten
void ApplicationController::importFromClipboard()
{
if (QGuiApplication::clipboard()->mimeData()->hasUrls()) {
const auto urls = QGuiApplication::clipboard()->mimeData()->urls();
for (const auto &url : urls)
const auto md = QGuiApplication::clipboard()->mimeData();
if (md->hasUrls()) {
const auto urls = md->urls();
for (const auto &url : urls) {
importFromUrl(url);
return;
}
}
if (QGuiApplication::clipboard()->mimeData()->hasText()) {
const auto content = QGuiApplication::clipboard()->mimeData()->data(QLatin1String("text/plain"));
else if (md->hasText()) {
const auto content = md->data(QLatin1String("text/plain"));
importData(content);
}
else if (md->hasFormat(QLatin1String("application/octet-stream"))) {
importData(md->data(QLatin1String("application/octet-stream")));
}
}
void ApplicationController::importFromUrl(const QUrl &url)
......@@ -373,7 +378,8 @@ void ApplicationController::checkCalendar()
bool ApplicationController::hasClipboardContent() const
{
return QGuiApplication::clipboard()->mimeData()->hasText() || QGuiApplication::clipboard()->mimeData()->hasUrls();
const auto md = QGuiApplication::clipboard()->mimeData();
return md->hasText() || md->hasUrls() || md->hasFormat(QLatin1String("application/octet-stream"));
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment