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 1
47 48
AppCover.qml AppCover.qml
LoginSheet.qml LoginSheet.qml
main.qml main.qml
moment.js moment.js
NewPostSheet.qml NewPostSheet.qml
ProfilePage.qml
RefreshItem.qml RefreshItem.qml
SettingsPage.qml SettingsPage.qml
ThreadPage.qml ThreadPage.qml
@ -42,8 +41,10 @@ icons/retweet.png
icons/sign-out.png icons/sign-out.png
icons/star-o.png icons/star-o.png
icons/star.png icons/star.png
PostItem.qml icons/ic_copy.png
StreamTab.qml StreamTab.qml
WebViewSheet.qml WebViewSheet.qml
PostItem.qml
ProfilePage.qml
parser.js parser.js
AboutPage.qml AboutPage.qml

View file

@ -240,6 +240,13 @@ Container {
postitem.ListItem.view.viewProfile(ListItemData.user) 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 { // ActionItem {
// id: edItem // id: edItem
// enabled: (ListItemData.user.username === postitem.ListItem.view.getUserName()) // enabled: (ListItemData.user.username === postitem.ListItem.view.getUserName())

View file

@ -116,6 +116,9 @@ NavigationPane {
return false return false
} }
} }
function copyText(text) {
_app.copyText(text)
}
attachedObjects: [ attachedObjects: [
ListScrollStateHandler { ListScrollStateHandler {
onAtEndChanged: { 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_cancel.png) \
$$quote($$BASEDIR/assets/icons/ic_compose.png) \ $$quote($$BASEDIR/assets/icons/ic_compose.png) \
$$quote($$BASEDIR/assets/icons/ic_contact.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_del_bookmarks.png) \
$$quote($$BASEDIR/assets/icons/ic_edit.png) \ $$quote($$BASEDIR/assets/icons/ic_edit.png) \
$$quote($$BASEDIR/assets/icons/ic_favorite.png) \ $$quote($$BASEDIR/assets/icons/ic_favorite.png) \

View file

@ -24,6 +24,7 @@
#include <bb/cascades/AbstractPane> #include <bb/cascades/AbstractPane>
#include <bb/cascades/LocaleHandler> #include <bb/cascades/LocaleHandler>
#include <bb/ApplicationInfo> #include <bb/ApplicationInfo>
#include <bb/system/Clipboard>
using namespace bb::cascades; using namespace bb::cascades;
@ -94,3 +95,10 @@ QString ApplicationUI::appversion()
bb::ApplicationInfo appinfo; bb::ApplicationInfo appinfo;
return appinfo.version(); 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 QVariant setting(const QString &key);
Q_INVOKABLE void setSetting(const QString &key, const QString &value); Q_INVOKABLE void setSetting(const QString &key, const QString &value);
Q_INVOKABLE QString appversion(); Q_INVOKABLE QString appversion();
Q_INVOKABLE void copyText(QByteArray text);
private slots: private slots:
void onSystemLanguageChanged(); void onSystemLanguageChanged();
private: private:

View file

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