From fddd407504e49368d36fa1c901fc5e9318a46ff0 Mon Sep 17 00:00:00 2001 From: Morgan McMillian Date: Sun, 13 Oct 2019 16:32:36 -0700 Subject: [PATCH] handle international utf8 text when copying to the clipboard resolves issue #25 --- src/applicationui.cpp | 6 ++++-- src/applicationui.hpp | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/applicationui.cpp b/src/applicationui.cpp index 2a5ce32..97d0e9c 100644 --- a/src/applicationui.cpp +++ b/src/applicationui.cpp @@ -106,11 +106,13 @@ QString ApplicationUI::appversion() return appinfo.version(); } -void ApplicationUI::copyText(QByteArray text) +void ApplicationUI::copyText(QString text) { bb::system::Clipboard clipboard; clipboard.clear(); - clipboard.insert("text/plain", text); + QByteArray textstr; + textstr.append(text.toUtf8()); + clipboard.insert("text/plain", textstr); } void ApplicationUI::onInvoke(const bb::system::InvokeRequest& request) diff --git a/src/applicationui.hpp b/src/applicationui.hpp index 4ac4f70..761ae1f 100644 --- a/src/applicationui.hpp +++ b/src/applicationui.hpp @@ -47,7 +47,7 @@ public: Q_INVOKABLE QVariant setting(const QString &key); Q_INVOKABLE void setSetting(const QString &key, const QString &value); Q_INVOKABLE QString appversion(); - Q_INVOKABLE void copyText(QByteArray text); + Q_INVOKABLE void copyText(QString text); Q_INVOKABLE void showImage(const QString &filename); Q_SIGNALS: