Open image in preview card

This commit is contained in:
Morgan McMillian 2017-11-16 12:35:30 -08:00
parent 3ec3521b38
commit 6f41f3b948
6 changed files with 27 additions and 25 deletions

View file

@ -154,7 +154,8 @@ Container {
// TODO: add tab to open full image in a page // TODO: add tab to open full image in a page
horizontalAlignment: HorizontalAlignment.Center horizontalAlignment: HorizontalAlignment.Center
bottomMargin: ui.sdu(2.0) bottomMargin: ui.sdu(2.0)
ImageView { ImageButton {
id: pimage
visible: { visible: {
var isphoto = false var isphoto = false
if (typeof ListItemData.raw !== "undefined") { if (typeof ListItemData.raw !== "undefined") {
@ -168,9 +169,10 @@ Container {
} }
return isphoto return isphoto
} }
scalingMethod: ScalingMethod.AspectFit defaultImage: ptracker.image
//imageSource: "asset:///icons/laughing_man.png" onClicked: {
image: ptracker.image postitem.ListItem.view.showImage(ptracker.imageSource)
}
attachedObjects: [ attachedObjects: [
NetImageTracker { NetImageTracker {
id: ptracker id: ptracker

View file

@ -122,10 +122,8 @@ NavigationPane {
function copyText(text) { function copyText(text) {
_app.copyText(text) _app.copyText(text)
} }
function showImage(filename, mtype) { function showImage(filename) {
console.log('-- showImage --') _app.showImage(filename)
console.log(filename)
_app.showImage(filename, mtype)
} }
attachedObjects: [ attachedObjects: [
ListScrollStateHandler { ListScrollStateHandler {

View file

@ -66,6 +66,9 @@ Page {
return false return false
} }
} }
function showImage(filename) {
_app.showImage(filename)
}
attachedObjects: [ attachedObjects: [
NetImageManager { NetImageManager {
id: feedImageManager id: feedImageManager

View file

@ -123,7 +123,7 @@ void ApplicationUI::onInvoke(const bb::system::InvokeRequest& request)
} }
} }
void ApplicationUI::showImage(const QString& filename, const QString& mtype) void ApplicationUI::showImage(const QString& filename)
{ {
qDebug() << "showImage called!"; qDebug() << "showImage called!";
bb::system::InvokeManager manager; bb::system::InvokeManager manager;
@ -132,7 +132,6 @@ void ApplicationUI::showImage(const QString& filename, const QString& mtype)
request.setUri(QUrl::fromLocalFile(filename)); request.setUri(QUrl::fromLocalFile(filename));
request.setTarget("sys.pictures.card.previewer"); request.setTarget("sys.pictures.card.previewer");
request.setAction("bb.action.VIEW"); request.setAction("bb.action.VIEW");
request.setMimeType(mtype);
bb::system::InvokeTargetReply *targetReply = manager.invoke(request); bb::system::InvokeTargetReply *targetReply = manager.invoke(request);
manager.setParent(this); manager.setParent(this);

View file

@ -48,7 +48,7 @@ public:
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); Q_INVOKABLE void copyText(QByteArray text);
Q_INVOKABLE void showImage(const QString &filename, const QString &mtype); Q_INVOKABLE void showImage(const QString &filename);
Q_SIGNALS: Q_SIGNALS:
void createPost(QByteArray text); void createPost(QByteArray text);

View file

@ -43,52 +43,52 @@
<context> <context>
<name>PostItem</name> <name>PostItem</name>
<message> <message>
<location filename="../assets/PostItem.qml" line="220"/> <location filename="../assets/PostItem.qml" line="222"/>
<source>Reply</source> <source>Reply</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="../assets/PostItem.qml" line="229"/> <location filename="../assets/PostItem.qml" line="231"/>
<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="239"/> <location filename="../assets/PostItem.qml" line="241"/>
<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="239"/> <location filename="../assets/PostItem.qml" line="241"/>
<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="250"/> <location filename="../assets/PostItem.qml" line="252"/>
<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="250"/> <location filename="../assets/PostItem.qml" line="252"/>
<source>Repost</source> <source>Repost</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="../assets/PostItem.qml" line="261"/> <location filename="../assets/PostItem.qml" line="263"/>
<source>Quote</source> <source>Quote</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="../assets/PostItem.qml" line="270"/> <location filename="../assets/PostItem.qml" line="272"/>
<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="277"/> <location filename="../assets/PostItem.qml" line="279"/>
<source>Copy text</source> <source>Copy text</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="../assets/PostItem.qml" line="307"/> <location filename="../assets/PostItem.qml" line="309"/>
<source>Delete</source> <source>Delete</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
@ -203,22 +203,22 @@
<context> <context>
<name>StreamTab</name> <name>StreamTab</name>
<message> <message>
<location filename="../assets/StreamTab.qml" line="157"/> <location filename="../assets/StreamTab.qml" line="155"/>
<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="171"/> <location filename="../assets/StreamTab.qml" line="169"/>
<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="199"/> <location filename="../assets/StreamTab.qml" line="197"/>
<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="186"/> <location filename="../assets/StreamTab.qml" line="184"/>
<source>Reload</source> <source>Reload</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>