InvokeQuery

Since: BlackBerry 10.0.0

#include <bb/cascades/InvokeQuery>

Contains the query data to use in invoke items.

An InvokeQuery is used by other classes in Cascades that need to send a query to the MenuService to ask for handlers that are registered for handling certain types of data.

For more information about invocations and the Invoke framework, bb::system::InvokeManager, bb::system::InvokeAction and bb::system::InvokeTarget, bb::system::MenuManager might be good places to start.

At least one of mimeType and uri must be set. The data, invokeActionId, and invokeTargetId properties are optional (they don't need to be set). If left undefined, they will not be used to filter what handlers the Invoke framework will return.

Here's how you create an InvokeQuery using the builder pattern:

InvokeQuery* pInvokeQuery(InvokeQuery::create()
  .mimeType("text/txt")
  .uri("file:///path/to/my/textfile")
  .invokeActionId("bb.action.OPEN"));

And here's how you create an InvokeQuery using QML:

InvokeQuery {
  mimeType: "text/txt"
  uri: "file:///path/to/my/textfile"
  invokeActionId: "bb.action.OPEN"
}


Overview

Inheritance

bb::cascades::BaseObject
bb::cascades::InvokeQuery

QML properties

data: QByteArray
fileTransferMode: bb::system::FileTransferMode::Type
invokeActionId: QString
invokerIncluded: bool
invokeTargetId: QString
metadata: QVariantMap
mimeType: QString
uri: QUrl
objectName: QStringInherited
parent: QObject [read-only]Inherited

Public Functions Index

~InvokeQuery ()
QByteArraydata () const
bb::system::FileTransferMode::TypefileTransferMode () const
QStringinvokeActionId () const
boolinvokerIncluded () const
QStringinvokeTargetId () const
QVariantMapmetadata () const
QStringmimeType () const
Q_SLOT voidsetData (const QByteArray &data)
Q_SLOT voidsetFileTransferMode (bb::system::FileTransferMode::Type mode)
Q_SLOT voidsetInvokeActionId (const QString &invokeActionId)
Q_SLOT voidsetInvokerIncluded (bool invokerIncluded)
Q_SLOT voidsetInvokeTargetId (const QString &invokeTargetId)
voidsetMetadata (const QVariantMap &metadata)
Q_SLOT voidsetMimeType (const QString &mimeType)
Q_SLOT voidsetUri (const QUrl &uri)
Q_SLOT voidupdateQuery ()
QUrluri () const
voidsetObjectName (const QString &name)Inherited
virtual Q_INVOKABLE QStringtoDebugString () const Inherited

Static Public Functions Index

Buildercreate ()

Protected Functions Index

Only has inherited protected functions

BaseObject (QObject *parent=0)Inherited

Signals Index

voiddataChanged (const QByteArray &data)
voidfileTransferModeChanged (bb::system::FileTransferMode::Type newFileTransferMode)
voidinvokeActionIdChanged (const QString &invokeActionId)
voidinvokerIncludedChanged (bool invokerIncluded)
voidinvokeTargetIdChanged (const QString &invokeTargetId)
voidmetadataChanged (const QVariantMap &metadata)
voidmimeTypeChanged (const QString &mimeType)
voidqueryChanged ()
voiduriChanged (const QUrl &uri)
voidcreationCompleted ()Inherited
voidobjectNameChanged (const QString &objectName)Inherited

Properties

QVariant data

Arbitrary data to be used by the query.

Since:

BlackBerry 10.0.0

bb::system::FileTransferMode::Type fileTransferMode

The mode to be used for transferring the file pointed to by the uri.

If this property is changed, a call to updateQuery() is needed to trigger a re-query to MenuService with the changed parameter content.

The default value of this property is bb::system::FileTransferMode::Unspecified.

This property is optional.

Since:

BlackBerry 10.0.0

QString invokeActionId

The ID of the invoke action to query for.

If this property is changed, a call to updateQuery() is needed to trigger a re-query to MenuService with the changed parameter content.

This property is optional.

Since:

BlackBerry 10.0.0

bool invokerIncluded

Indicates whether to include the invoking application itself as a potential target.

The default value is false, meaning the invoking application itself will not be considered as a potential target for this query.

If this property is changed, a call to updateQuery() is needed to trigger a re-query to MenuService with the changed parameter content.

This property is optional.

Since:

BlackBerry 10.0.0

QString invokeTargetId

The ID of the invoke target to query for.

If this property is changed, a call to updateQuery() is needed to trigger a re-query to MenuService with the changed parameter content.

This property is optional.

Since:

BlackBerry 10.0.0

QVariantMap metadata

The metadata used when querying for an action/target.

If this property is changed, a call to updateQuery() is needed to trigger a re-query to MenuService with the changed parameter content.

This property is optional.

Since:

BlackBerry 10.0.0

QString mimeType

Identifies the MIME type of the data to operate on.

If this property is changed, a call to updateQuery() is needed to trigger a re-query to MenuService with the changed parameter content.

This property is mandatory if uri is not set. If uri is set this property is optional.

Since:

BlackBerry 10.0.0

QUrl uri

Identifies the data to operate on.

If this property is changed, a call to updateQuery() is needed to trigger a re-query to MenuService with the changed parameter content.

This property is mandatory if mimeType is not set. If mimeType is set this property is optional.

Since:

BlackBerry 10.0.0

QString objectNameInherited

This property is overridden from QObject.

See also:

QObject::objectName().

Since:

BlackBerry 10.0.0

QObject parentInherited[read-only]

A read-only property that represents this object's parent.

The parent of an object is specified using QObject::setParent(QObject*). The purpose of the property is to expose the object's parent to QML.

This property is read-only to prevent modifications from QML, where typically the parent is declaratively set. In C++ code, the parent can be explicitly set using QObject::setParent(QObject*), or implicitly set by adding it to a visual container.

The default value of this property is 0.

Since:

BlackBerry 10.0.0

Public Functions

~InvokeQuery ()

Destructor.

QByteArray data ()

Gets the data to be used in a query by this InvokeQuery.

Return:

The data to be used in a query by this InvokeQuery.

Since:

BlackBerry 10.0.0

bb::system::FileTransferMode::Type fileTransferMode ()

The file transfer mode used during invocation.

Return:

The file transfer mode of this query.

Since:

BlackBerry 10.0.0

QString invokeActionId ()

The action ID of this query.

Return:

The action ID of this query.

Since:

BlackBerry 10.0.0

bool invokerIncluded ()

Flag indicating if invoking application shall be included in query result or not.

Return:

True if invoking application is to be included in query result, false otherwise.

Since:

BlackBerry 10.0.0

QString invokeTargetId ()

The target ID of this query.

Return:

The target ID of this query.

Since:

BlackBerry 10.0.0

QVariantMap metadata ()

Gets the metadata to be used in a query by this InvokeQuery.

Return:

The metadata used in a query by this InvokeQuery.

Since:

BlackBerry 10.0.0

QString mimeType ()

The data MIME type of this query.

Return:

The data MIME type of this query.

Since:

BlackBerry 10.0.0

Q_SLOT void setData (

Sets the data to be used in a query by this InvokeQuery.

Parameters
data

The data to be used in a query by this InvokeQuery.

Since:

BlackBerry 10.0.0

Q_SLOT void setFileTransferMode (

Sets the file transfer mode to be used during invocation.

Parameters
mode

The file transfer mode to be used during invocation.

Since:

BlackBerry 10.0.0

Q_SLOT void setInvokeActionId (

Gets the data to be used in a query by this InvokeQuery.

Parameters
invokeActionId

The new action ID of this query.

Since:

BlackBerry 10.0.0

Q_SLOT void setInvokerIncluded (
  • boolinvokerIncluded)

Sets flag indicating if invoking application shall be included in query result or not.

Parameters
invokerIncluded

Set to true for invoking application to be included in query result.

Since:

BlackBerry 10.0.0

Q_SLOT void setInvokeTargetId (

Sets the target ID of this query.

Parameters
invokeTargetId

The new target ID of this query.

Since:

BlackBerry 10.0.0

void setMetadata (

Sets the metadata to be used in a query by this InvokeQuery.

Parameters
metadata

The metadata to be used in a query by this InvokeQuery.

Since:

BlackBerry 10.0.0

Q_SLOT void setMimeType (

Sets the data MIME type of this query.

Parameters
mimeType

The new data MIME type of this query.

Since:

BlackBerry 10.0.0

Q_SLOT void setUri (

Sets the data URI of this query.

Parameters
uri

The new data URI of this query.

Since:

BlackBerry 10.0.0

Q_SLOT void updateQuery ()

Tell holding class InvokeQuery is updated.

Use updateQuery to tell the holding class that the InvokeQuery has been updated. The holding class will use the new properties in a re-query to MenuService and replace the previous result with the new result.

The preferred way of usage is to make all the needed property changes before calling updateQuery.

Below is a small example on how to trigger a new query on changed properties.

InvokeActionItem {
  id: iai
  query {
    mimeType: "image/png"
    onQueryChanged: iai.query.updateQuery()
  }
}
Since:

BlackBerry 10.0.0

QUrl uri ()

The data URI of this query.

Return:

The data URI of this query.

Since:

BlackBerry 10.0.0

void setObjectName (Inherited

Sets the objectName property.

Parameters
name

The new name for the object.

Since:

BlackBerry 10.0.0

virtual Q_INVOKABLE QString toDebugString ()Inherited

Returns a debug string representing this object.

Return:

A debug string for the object.

Since:

BlackBerry 10.0.0

Static Public Functions

Builder create ()

Creates and returns a builder for constructing an InvokeQuery.

Usage:
InvokeQuery* pInvokeQuery(InvokeQuery::create()
  .uri("file:///mytextfile")
  .invokeActionId("bb.action.OPEN"));
Return:

A builder used for constructing an InvokeQuery.

Since:

BlackBerry 10.0.0

Protected Functions

(Only has inherited protected functions)

BaseObject (Inherited

Constructs an instance of BaseObject's subclass.

Parameters
parent

An optional parent, defaults to 0.

Since:

BlackBerry 10.0.0

Signals

void dataChanged (

Emitted when data property has been changed.

Parameters
data

The new data property set to be used by updateQuery.

Since:

BlackBerry 10.0.0

void fileTransferModeChanged (

Emitted when file transfer mode has been changed.

Note:

Due to a work around for a Qt Core issue with accessing enums from QML the argument of this signal doesn't follow naming convention for signals in which the signal arguments are typically named to match the associated property's name. Use the object's property to access current property value instead of the signal argument to avoid runtime errors (i.e. use fileTransferMode instead of newFileTransferMode).

Parameters
newFileTransferMode

The new file transfer mode set to be used by updateQuery.

Since:

BlackBerry 10.0.0

void invokeActionIdChanged (

Emitted when invoke action id has been changed.

Parameters
invokeActionId

The new invoke action id set to be used by updateQuery.

Since:

BlackBerry 10.0.0

void invokerIncludedChanged (
  • boolinvokerIncluded)

Emitted when invokerIncluded has been changed.

Parameters
invokerIncluded

The new value of invokerIncluded property.

Since:

BlackBerry 10.0.0

void invokeTargetIdChanged (

Emitted when invoke target id has been changed.

Parameters
invokeTargetId

The new invoke target id set to be used by updateQuery.

Since:

BlackBerry 10.0.0

void metadataChanged (

Emitted when metadata has been changed.

Parameters
metadata

The new metadata set to be used by updateQuery.

Since:

BlackBerry 10.0.0

void mimeTypeChanged (

Emitted when MIME type has been changed.

Parameters
mimeType

The new mimeType set to be used by updateQuery.

Since:

BlackBerry 10.0.0

void queryChanged ()

Convenience signal emitted when any one of the properties has been changed.

Since:

BlackBerry 10.0.0

void uriChanged (

Emitted when uri has been changed.

Parameters
uri

The new uri set to be used by updateQuery.

Since:

BlackBerry 10.0.0

void creationCompleted ()Inherited

Emitted when this object is instantiated as a result of loading a QML document and creating the root node (only after the root component that caused this instantiation has completed construction), or when the object is being constructed from its builder class.

This signal indicates that the construction and initialization of the object has been completed, the properties are initialized, and any QML binding values have been assigned to the object.

This signal is not emitted when the object is constructed from C++ using the constructor. If the object is constructed using its builder class, the signal is emitted when the the builder class returns the fully constructed object.

This signal can be used when there is an activity that needs to be performed, such as a property state integrity verification after the object is instantiated from a QML document or a builder, but before control is returned to the application.

See also:

QmlDocument

Since:

BlackBerry 10.0.0

void objectNameChanged (Inherited

This signal is emitted when the objectName property is changed.

Since:

BlackBerry 10.0.0

Last modified: 2014-09-29



Got questions about leaving a comment? Get answers from our Disqus FAQ.

comments powered by Disqus