From 317c09aca8b028fbf81ce5e7e382fe5b700bf081 Mon Sep 17 00:00:00 2001 From: Morgan McMillian Date: Fri, 17 Feb 2017 16:47:41 -0800 Subject: [PATCH] added copy text to clipboard for issue #7 --- assets/.assets.index | 7 ++++--- assets/PostItem.qml | 7 +++++++ assets/StreamTab.qml | 3 +++ assets/icons/ic_copy.png | Bin 0 -> 1852 bytes config.pri | 1 + src/applicationui.cpp | 8 ++++++++ src/applicationui.hpp | 1 + translations/Goober.ts | 31 ++++++++++++++++++------------- 8 files changed, 42 insertions(+), 16 deletions(-) create mode 100644 assets/icons/ic_copy.png diff --git a/assets/.assets.index b/assets/.assets.index index 564fe2e..5ddf8ea 100644 --- a/assets/.assets.index +++ b/assets/.assets.index @@ -1,11 +1,10 @@ 1 -47 +48 AppCover.qml LoginSheet.qml main.qml moment.js NewPostSheet.qml -ProfilePage.qml RefreshItem.qml SettingsPage.qml ThreadPage.qml @@ -42,8 +41,10 @@ icons/retweet.png icons/sign-out.png icons/star-o.png icons/star.png -PostItem.qml +icons/ic_copy.png StreamTab.qml WebViewSheet.qml +PostItem.qml +ProfilePage.qml parser.js AboutPage.qml diff --git a/assets/PostItem.qml b/assets/PostItem.qml index 0bde87e..dc93478 100644 --- a/assets/PostItem.qml +++ b/assets/PostItem.qml @@ -240,6 +240,13 @@ Container { postitem.ListItem.view.viewProfile(ListItemData.user) } } + ActionItem { + title: qsTr("Copy text") + imageSource: "asset:///icons/ic_copy.png" + onTriggered: { + postitem.ListItem.view.copyText(ListItemData.content.text) + } + } // ActionItem { // id: edItem // enabled: (ListItemData.user.username === postitem.ListItem.view.getUserName()) diff --git a/assets/StreamTab.qml b/assets/StreamTab.qml index 9c4ccef..54dd8db 100644 --- a/assets/StreamTab.qml +++ b/assets/StreamTab.qml @@ -116,6 +116,9 @@ NavigationPane { return false } } + function copyText(text) { + _app.copyText(text) + } attachedObjects: [ ListScrollStateHandler { onAtEndChanged: { diff --git a/assets/icons/ic_copy.png b/assets/icons/ic_copy.png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;jVOw(dpdC`L;5xphe@oK_=?B=fVyxYOTIfHv67ibWi5WKNf4& z+>oYT4H#(^gqL=k+ZSB%$vdMGz0B0tS0zw-ug((e*|7UZA31Pn_;kVL_^0%I0HUC; z2QA07#d6WsV7Jd3Y63lyX%0g{_}rPO^UnL;JNKl68@FcTRO`3>3h!Ex2&SyK-*PPJ zBg!q8-|x)4^Y!)v0N_dXSx}MNWPf65Ut?vScaeK@G5kwyLV-Td`srh3&ktU&y!+hN z4OCwbX#Hd^;$7sjWA2vX!upZ#d!B8}{(?HEB-bUILdz*6p(-gQru&2wbzcS%O zESUUI@Q{DoBYm1m^vr?jlvecT7U7ey>A88C9T(joUP@;)d7eIGDq?%rer3nz_`dM4 z;wIOh8_#`kYVauc@_yOJ #include #include +#include using namespace bb::cascades; @@ -94,3 +95,10 @@ QString ApplicationUI::appversion() bb::ApplicationInfo appinfo; return appinfo.version(); } + +void ApplicationUI::copyText(QByteArray text) +{ + bb::system::Clipboard clipboard; + clipboard.clear(); + clipboard.insert("text/plain", text); +} diff --git a/src/applicationui.hpp b/src/applicationui.hpp index 46d0e60..740cdfe 100644 --- a/src/applicationui.hpp +++ b/src/applicationui.hpp @@ -45,6 +45,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); private slots: void onSystemLanguageChanged(); private: diff --git a/translations/Goober.ts b/translations/Goober.ts index e0f4432..3f1c23b 100644 --- a/translations/Goober.ts +++ b/translations/Goober.ts @@ -30,47 +30,52 @@ PostItem - + Reply - + Reply All - + Add Bookmark - + Delete Bookmark - + Repost - + Delete Repost - + Quote - + View Profile - + + Copy text + + + + Delete @@ -185,22 +190,22 @@ StreamTab - + New Post - + To Top - + To Bottom - + Reload