TokenData

#include <bb/extensions/cascades/tokenentry/TokenData>

Data structure for tokens, the content of TokenEntry.

TokenEntry allows for users to enter text that maps to some application data. For example email address to a contact card.

TokenData allows for the pairing of the user entered text to other information: title of the entry to display; status information; a detailed description; an image to display. It also supports differentiating different types of tokens.

TokenEntry will store a collection of these, that have either been entered by a user, or provided by an application.

When an application wants to suggest tokens to the user, use this class to represent the data.

When used to supply completions, the data inside TokenData is mapped directly to a StandardListItem. The title is what is displayed in the token once one is selected.

For example, providing an email address would be as follows:

title: the display name that is to be displayed description: the email address tied to this token status: perhaps unused image: an optional display image

If no display name is supplied, then title will need to be set to the email address in order for it to be displayed in the token.

See also:

TokenEntry


Overview

Public Functions Index

TokenData (QObject *parent=0)
virtual ~TokenData ()
bb::cascades::ActionSet *actionSet ()
voidactivateContextMenu ()
bb::cascades::ContextMenuHandler *contextMenuHandler ()
const QStringdescription ()
intgroupCount ()
voidgroupTokens (QList< bb::extensions::cascades::tokenentry::TokenData * > &tokenCollection)
const QStringhashTitle ()
QUrlimageSource ()
boolisContextMenuActivated ()
boolisLookupToken ()
const QVariantmiscellaneous ()
voidmoveTokenDataToThread (QThread *threadToMoveTo)
boolreserveImageSpace ()
voidsetDescription (const QString &description)
voidsetDescriptionDisplayOnList (bool displayOnList)
voidsetGroupTokens (QList< bb::extensions::cascades::tokenentry::TokenData * > const &tokenCollection)
voidsetImageDisplayOnList (bool displayOnList)
voidsetImageSource (QUrl imageSource)
voidsetMiscellaneous (const QVariant data)
voidsetReserveImageSpace (bool reserve)
voidsetStatus (const QString &status)
voidsetStatusDisplayOnList (bool displayOnList)
voidsetTitle (const QString &title)
voidsetTitleDisplayOnList (bool displayOnList)
voidsetTokenData (TokenData *const token)
voidsetTokenType (const int tokenType)
voidsetupContextMenu (bb::cascades::ContextMenuHandler *contextMenuHandler, bb::cascades::ActionSet *actionSet)
boolshouldDescriptionDisplayOnList ()
boolshouldImageDisplayOnList ()
boolshouldStatusDisplayOnList ()
boolshouldTitleDisplayOnList ()
const QStringstatus ()
const QStringtitle ()
inttokenType ()

Signals Index

voiddescriptionChanged (QString description)
voidgroupCountChanged (int groupCount)
voidgroupListChanged ()
voidimageSourceChanged (QUrl imageSource)
voidstatusChanged (QString status)
voidtitleChanged (QString title)
voidtokenTypeChanged (int tokenType)

Public Types

TokenType

The public Token Types.

Types noted as valid will be returned by the TokenEntry::getValidTokens( QList<TokenData *> & ) function. Types noted as NOT valid will NOT be returned by the TokenEntry::getValidTokens( QList<TokenData *> & ) function.

TokenType_Default 256

The default token type.

This token type is valid.

TokenType_Warning

A token used for an error condition.

This token type is NOT valid.

TokenType_Tip

A token used for a tip.

Deprecated

This type is not currently in use and will not be displayed.

TokenType_Note

A token use for a note.

Deprecated

This type is not currently in use and will not be displayed.

TokenType_Suggestion

A token used for suggestions.

This token type prepends a + to the title. NOT recommended for public use. The AbstractTokenHandler::provideSuggestions(TokenEntryEvent *) function should return tokens of the type the client app wishes to display. TokenEntry will handle making it a suggestion token while displayed in the suggestions pane.

TokenType_ValidWarning

A token used for a warning condition.

This token type is valid.

TokenType_CertificateSearch

A token type used while a SMIME Certificate is being retrieved.

This token type is NOT valid.

Displays a progress indicator while the certificate search is in progress.

TokenType_Group

A token type representing a group.

This token type is valid.

Contains a list of other TokenData representing the members of the group.

TokenType_GroupWarning

A token type representing a group with an error condition.

This token type is NOT valid.

Contains a list of other TokenData representing the members of the group.

TokenType_GroupValidWarning

A token type representing a group with a warning condition.

This token type is valid.

Contains a list of other TokenData representing the members of the group.

TokenType_GroupCertificateSearch

A token type representing a group used while a SMIME Certificate is being retrieved.

This token type is NOT valid.

Contains a list of other TokenData representing the members of the group.

Properties

QString description

int groupCount[read-only]

QUrl imageSource

QString status

QString title

int tokenType

Public Functions

TokenData (

virtual~TokenData ()

Destructor.

bb::cascades::ActionSet * actionSet ()

Retrieves the action set.

This method will be deprecated at the same time as setupContextMenu.

void activateContextMenu ()

Activates the context menu for this TokenData.

Calling this will result in a ContextMenuHandler being created and set to the appropriate control such that a context menu will show up when the user long presses on the control.

Actions are expected to be provided through AbstractTokenHandler::provideActionSet.

bb::cascades::ContextMenuHandler * contextMenuHandler ()

Retrieves the context menu handler.

This method will be deprecated at the same time as setupContextMenu.

const QString description ()

Retrieve the description.

Return:

the description of this TokenData

int groupCount ()

Retrieves the number of members of a group.

Return:

int containing the number of members of a group. Returns 0 if the token type is not TokenType_Group.

void groupTokens (

Retrieve all of the tokens contained in the group token.

This provides access to all of the TokenData that has been set on a group token.

Parameters
tokenCollection

the collection to store the TokenData in

const QString hashTitle ()

Retrieve the title, hashed.

Return:

the hashed title of this TokenData

QUrl imageSource ()

Retrieve the image source.

Return:

the image source of this TokenData

bool isContextMenuActivated ()

Returns whether the context menu is activated.

Return:

true if context menu is activated for this TokenData, false otherwise.

bool isLookupToken ()

Returns whether the token is a lookup token.

Return:

true if the token is a lookup token, false otherwise.

const QVariant miscellaneous ()

Retrieve miscellaneous user-defined data.

Return:

some user-defined data

void moveTokenDataToThread (

Moves this TokenData to a new thread.

Used to push this TokenData from the thread that created it to the supplied thread.

bool reserveImageSpace ()

Retrieves whether or not to reserve image space, even if one is not set.

Return:

true to reserve image space, false otherwise.

void setDescription (

Set additional details about this token data.

No visual representation in TokenEntry

Parameters
description

text to use as the description

void setDescriptionDisplayOnList (
  • booldisplayOnList)

Sets whether the description is displayed on the drop down list.

Defaults to true.

Parameters
displayOnList

true to display, false otherwise.

void setGroupTokens (

Sets the members of a group token.

Any existing list will be REPLACED with the contents of the specified list. Only used for tokens of type TokenType_Group.

This group token takes ownership of the TokenData items, unless they have a parent.

Parameters
tokenCollection

The set of tokenData representing the members of this group.

void setImageDisplayOnList (
  • booldisplayOnList)

Sets whether the image is displayed on the drop down list.

Defaults to true.

Parameters
displayOnList

true to display, false otherwise.

void setImageSource (

Set an image source to represent this data.

Optional image source can be set. This image can be used to display along with the title.

Parameters
imageSource

the source of the image to show

void setMiscellaneous (

Set miscellaneous user-defined data.

TokenData provides a single QVariant storage container for all user-specific data

Parameters
data

any user-defined data

void setReserveImageSpace (
  • boolreserve)

Sets whether to reserve space for an image, even if one is not set.

void setStatus (

Sets a status for this data set.

This allows for custom status information to be associated to this TokenData.

No visual representation in TokenEntry

Parameters
status

text representing the status

void setStatusDisplayOnList (
  • booldisplayOnList)

Sets whether the status is displayed on the drop down list.

Defaults to true.

Parameters
displayOnList

true to display, false otherwise.

void setTitle (

Sets the title of this data set.

This sets a title for the data set. This title not only represents this TokenData but will also be displayed to user when this is added to a TokenEntry

Parameters
title

the text to set as the title

void setTitleDisplayOnList (
  • booldisplayOnList)

Sets whether the title is displayed on the drop down list.

Defaults to true.

Parameters
displayOnList

true to display, false otherwise.

void setTokenData (

Copy data from another token.

Copy title, status, description, image, type and user-specific data from the provided TokenData.

Parameters
data

source TokenData

void setTokenType (
  • const inttokenType)

Set an optional type for the data.

If an application wishes to differentiate between different types of TokenData
Parameters
tokenType

a number to represent the type

void setupContextMenu (

Sets up the context menu information.

The TokenData takes ownership of the ContextMenuHandler.

Pass in 0 to remove the ContextMenuHandler.

This method will be deprecated in favour of activateContextMenu();

Parameters
contextMenuHandler

the ContextMenuHandler for the context menu.

actionSet

the ActionSet for the context menu.

bool shouldDescriptionDisplayOnList ()

Retrieves whether or not the description will be displayed on the drop down list.

Return:

true if the title will be displayed, false otherwise.

bool shouldImageDisplayOnList ()

Retrieves whether or not the image will be displayed on the drop down list.

Return:

true if the title will be displayed, false otherwise.

bool shouldStatusDisplayOnList ()

Retrieves whether or not the status will be displayed on the drop down list.

Return:

true if the title will be displayed, false otherwise.

bool shouldTitleDisplayOnList ()

Retrieves whether or not the title will be displayed on the drop down list.

Return:

true if the title will be displayed, false otherwise.

const QString status ()

Retrieve the status.

Return:

the status of this TokenData

const QString title ()

Retrieve the title.

Return:

the title of this TokenData

int tokenType ()

Retrieve the token type.

Return:

the token type of this TokenData

Signals

void descriptionChanged (

void groupCountChanged (
  • intgroupCount)

void groupListChanged ()

void imageSourceChanged (

void statusChanged (

void titleChanged (

void tokenTypeChanged (
  • inttokenType)

Last modified: 2015-07-24



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

comments powered by Disqus