added copy text to clipboard for issue #7

This commit is contained in:
Morgan McMillian 2017-02-17 16:47:41 -08:00
parent 35ce43caf7
commit 317c09aca8
8 changed files with 42 additions and 16 deletions

View file

@ -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

View file

@ -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())

View file

@ -116,6 +116,9 @@ NavigationPane {
return false
}
}
function copyText(text) {
_app.copyText(text)
}
attachedObjects: [
ListScrollStateHandler {
onAtEndChanged: {

BIN
assets/icons/ic_copy.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

View file

@ -92,6 +92,7 @@ config_pri_assets {
$$quote($$BASEDIR/assets/icons/ic_cancel.png) \
$$quote($$BASEDIR/assets/icons/ic_compose.png) \
$$quote($$BASEDIR/assets/icons/ic_contact.png) \
$$quote($$BASEDIR/assets/icons/ic_copy.png) \
$$quote($$BASEDIR/assets/icons/ic_del_bookmarks.png) \
$$quote($$BASEDIR/assets/icons/ic_edit.png) \
$$quote($$BASEDIR/assets/icons/ic_favorite.png) \

View file

@ -24,6 +24,7 @@
#include <bb/cascades/AbstractPane>
#include <bb/cascades/LocaleHandler>
#include <bb/ApplicationInfo>
#include <bb/system/Clipboard>
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);
}

View file

@ -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:

View file

@ -30,47 +30,52 @@
<context>
<name>PostItem</name>
<message>
<location filename="../assets/PostItem.qml" line="189"/>
<location filename="../assets/PostItem.qml" line="187"/>
<source>Reply</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../assets/PostItem.qml" line="198"/>
<location filename="../assets/PostItem.qml" line="196"/>
<source>Reply All</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../assets/PostItem.qml" line="208"/>
<location filename="../assets/PostItem.qml" line="206"/>
<source>Add Bookmark</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../assets/PostItem.qml" line="208"/>
<location filename="../assets/PostItem.qml" line="206"/>
<source>Delete Bookmark</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../assets/PostItem.qml" line="219"/>
<location filename="../assets/PostItem.qml" line="217"/>
<source>Repost</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../assets/PostItem.qml" line="219"/>
<location filename="../assets/PostItem.qml" line="217"/>
<source>Delete Repost</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../assets/PostItem.qml" line="230"/>
<location filename="../assets/PostItem.qml" line="228"/>
<source>Quote</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../assets/PostItem.qml" line="239"/>
<location filename="../assets/PostItem.qml" line="237"/>
<source>View Profile</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../assets/PostItem.qml" line="257"/>
<location filename="../assets/PostItem.qml" line="244"/>
<source>Copy text</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../assets/PostItem.qml" line="262"/>
<source>Delete</source>
<translation type="unfinished"></translation>
</message>
@ -185,22 +190,22 @@
<context>
<name>StreamTab</name>
<message>
<location filename="../assets/StreamTab.qml" line="140"/>
<location filename="../assets/StreamTab.qml" line="143"/>
<source>New Post</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../assets/StreamTab.qml" line="154"/>
<location filename="../assets/StreamTab.qml" line="157"/>
<source>To Top</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../assets/StreamTab.qml" line="182"/>
<location filename="../assets/StreamTab.qml" line="185"/>
<source>To Bottom</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../assets/StreamTab.qml" line="169"/>
<location filename="../assets/StreamTab.qml" line="172"/>
<source>Reload</source>
<translation type="unfinished"></translation>
</message>