From fdb0b22ee46d1746da615e35ec3938a788784ad8 Mon Sep 17 00:00:00 2001 From: Morgan McMillian Date: Sun, 12 Nov 2017 07:41:09 -0800 Subject: [PATCH] added show image method to invoke the picture preview card, may not be yet functional --- assets/StreamTab.qml | 5 +++++ src/applicationui.cpp | 23 +++++++++++++++++++++++ src/applicationui.hpp | 1 + translations/Goober.ts | 38 +++++++++++++++++++------------------- 4 files changed, 48 insertions(+), 19 deletions(-) diff --git a/assets/StreamTab.qml b/assets/StreamTab.qml index 9ba167a..9a451d0 100644 --- a/assets/StreamTab.qml +++ b/assets/StreamTab.qml @@ -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: { diff --git a/src/applicationui.cpp b/src/applicationui.cpp index b3eab78..7fcd4c7 100644 --- a/src/applicationui.cpp +++ b/src/applicationui.cpp @@ -25,6 +25,9 @@ #include #include #include +#include +#include +#include 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; +} diff --git a/src/applicationui.hpp b/src/applicationui.hpp index c73540d..4ac4f70 100644 --- a/src/applicationui.hpp +++ b/src/applicationui.hpp @@ -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); diff --git a/translations/Goober.ts b/translations/Goober.ts index 724f462..1a50e4b 100644 --- a/translations/Goober.ts +++ b/translations/Goober.ts @@ -30,52 +30,52 @@ PostItem - + Reply - + Reply All - - Add Bookmark - - - - + Delete Bookmark - - Repost + + Add Bookmark - + Delete Repost - + + Repost + + + + Quote - + View Profile - + Copy text - + Delete @@ -190,22 +190,22 @@ StreamTab - + New Post - + To Top - + To Bottom - + Reload