Added mime type to the showImage method.

This commit is contained in:
Morgan McMillian 2017-11-12 09:26:43 -08:00
parent fdb0b22ee4
commit e525492bc6
3 changed files with 5 additions and 4 deletions

View file

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

View file

@ -119,7 +119,7 @@ void ApplicationUI::onInvoke(const bb::system::InvokeRequest& request)
} }
} }
void ApplicationUI::showImage(const QString& filename) void ApplicationUI::showImage(const QString& filename, const QString& mtype)
{ {
qDebug() << "showImage called!"; qDebug() << "showImage called!";
bb::system::InvokeManager manager; bb::system::InvokeManager manager;
@ -128,6 +128,7 @@ void ApplicationUI::showImage(const QString& filename)
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); Q_INVOKABLE void showImage(const QString &filename, const QString &mtype);
Q_SIGNALS: Q_SIGNALS:
void createPost(QByteArray text); void createPost(QByteArray text);