added show image method to invoke the picture preview card, may not be yet functional

This commit is contained in:
Morgan McMillian 2017-11-12 07:41:09 -08:00
parent 282f3e1b0b
commit fdb0b22ee4
4 changed files with 48 additions and 19 deletions

View file

@ -119,6 +119,11 @@ NavigationPane {
function copyText(text) {
_app.copyText(text)
}
function showImage(filename) {
console.log('-- showImage --')
console.log(filename)
_app.showImage(filename)
}
attachedObjects: [
ListScrollStateHandler {
onAtEndChanged: {

View file

@ -25,6 +25,9 @@
#include <bb/cascades/LocaleHandler>
#include <bb/ApplicationInfo>
#include <bb/system/Clipboard>
#include <bb/system/InvokeRequest>
#include <bb/system/InvokeManager>
#include <bb/system/InvokeTargetReply>
using namespace bb::cascades;
@ -115,3 +118,23 @@ void ApplicationUI::onInvoke(const bb::system::InvokeRequest& request)
emit createPost(request.data());
}
}
void ApplicationUI::showImage(const QString& filename)
{
qDebug() << "showImage called!";
bb::system::InvokeManager manager;
bb::system::InvokeRequest request;
request.setUri(QUrl::fromLocalFile(filename));
request.setTarget("sys.pictures.card.previewer");
request.setAction("bb.action.VIEW");
bb::system::InvokeTargetReply *targetReply = manager.invoke(request);
manager.setParent(this);
if (targetReply == NULL) {
qDebug() << "InvokeTargetReply is NULL: targetReply = " << targetReply;
} else {
targetReply->setParent(this);
}
qDebug() << "targetReply = " << targetReply;
}

View file

@ -48,6 +48,7 @@ public:
Q_INVOKABLE void setSetting(const QString &key, const QString &value);
Q_INVOKABLE QString appversion();
Q_INVOKABLE void copyText(QByteArray text);
Q_INVOKABLE void showImage(const QString &filename);
Q_SIGNALS:
void createPost(QByteArray text);

View file

@ -30,52 +30,52 @@
<context>
<name>PostItem</name>
<message>
<location filename="../assets/PostItem.qml" line="189"/>
<location filename="../assets/PostItem.qml" line="190"/>
<source>Reply</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../assets/PostItem.qml" line="198"/>
<location filename="../assets/PostItem.qml" line="199"/>
<source>Reply All</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../assets/PostItem.qml" line="208"/>
<source>Add Bookmark</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../assets/PostItem.qml" line="208"/>
<location filename="../assets/PostItem.qml" line="209"/>
<source>Delete Bookmark</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../assets/PostItem.qml" line="219"/>
<source>Repost</source>
<location filename="../assets/PostItem.qml" line="209"/>
<source>Add Bookmark</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../assets/PostItem.qml" line="219"/>
<location filename="../assets/PostItem.qml" line="220"/>
<source>Delete Repost</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../assets/PostItem.qml" line="230"/>
<location filename="../assets/PostItem.qml" line="220"/>
<source>Repost</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../assets/PostItem.qml" line="231"/>
<source>Quote</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../assets/PostItem.qml" line="239"/>
<location filename="../assets/PostItem.qml" line="240"/>
<source>View Profile</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../assets/PostItem.qml" line="246"/>
<location filename="../assets/PostItem.qml" line="247"/>
<source>Copy text</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../assets/PostItem.qml" line="276"/>
<location filename="../assets/PostItem.qml" line="277"/>
<source>Delete</source>
<translation type="unfinished"></translation>
</message>
@ -190,22 +190,22 @@
<context>
<name>StreamTab</name>
<message>
<location filename="../assets/StreamTab.qml" line="143"/>
<location filename="../assets/StreamTab.qml" line="148"/>
<source>New Post</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../assets/StreamTab.qml" line="157"/>
<location filename="../assets/StreamTab.qml" line="162"/>
<source>To Top</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../assets/StreamTab.qml" line="185"/>
<location filename="../assets/StreamTab.qml" line="190"/>
<source>To Bottom</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../assets/StreamTab.qml" line="172"/>
<location filename="../assets/StreamTab.qml" line="177"/>
<source>Reload</source>
<translation type="unfinished"></translation>
</message>