QContactFetchHint Class
The QContactFetchHint class provides hints to the manager about which contact information needs to be retrieved in an asynchronous fetch request or a synchronous function call. More...
Header: | #include <QContactFetchHint> |
Public Types
enum | OptimizationHint { AllRequired, NoRelationships, NoActionPreferences, NoBinaryBlobs } |
flags | OptimizationHints |
Public Functions
QContactFetchHint() | |
QContactFetchHint(const QContactFetchHint & other) | |
~QContactFetchHint() | |
QList<QContactDetail::DetailType> | detailTypesHint() const |
int | maxCountHint() const |
OptimizationHints | optimizationHints() const |
QSize | preferredImageSize() const |
QStringList | relationshipTypesHint() const |
void | setDetailTypesHint(const QList<QContactDetail::DetailType> & types) |
void | setMaxCountHint(int count) |
void | setOptimizationHints(OptimizationHints hints) |
void | setPreferredImageSize(const QSize & size) |
void | setRelationshipTypesHint(const QStringList & relationshipTypes) |
QContactFetchHint & | operator=(const QContactFetchHint & other) |
Detailed Description
The QContactFetchHint class provides hints to the manager about which contact information needs to be retrieved in an asynchronous fetch request or a synchronous function call.
All of the hints may be ignored at the discretion of the manager, however if a manager is able to optimize retrieval of contacts due to hints, it may do so. If a manager ignores a hint, it must retrieve the full set of data that the hint refers to.
The fetch hint contains:
- a list of detail types which the client is interested in (empty if interested in all detail types)
- a list of relationship types which the client is interested in (empty if interested in all relationships)
- some optimization flags which allow the client to tell the backend if they are not interested in any relationships, any action preferences, or any binary blobs (images etc).
- a preferred size for any images, if the backend supports multiple sizes or scaling
Important note: a client should not make changes to a contact which has been retrieved using a fetch hint other than the default fetch hint. Doing so can result in information loss when saving the contact back to the manager (as the "new" restricted contact will replace the previously saved contact in the backend).
Member Type Documentation
enum QContactFetchHint::OptimizationHint
flags QContactFetchHint::OptimizationHints
This enum defines flags which may be set to inform the backend that the client does not require certain information. The backend may safely ignore the hint, but then must return the full set of information relating to the optimization hint.
Constant | Value | Description |
---|---|---|
QContactFetchHint::AllRequired | 0x0 | Tells the backend that all information is required |
QContactFetchHint::NoRelationships | 0x1 | Tells the backend that the client does not require retrieved contacts to include a cache of relationships |
QContactFetchHint::NoActionPreferences | 0x2 | Tells the backend that the client does not require retrieved contacts to include a cache of action preferences |
QContactFetchHint::NoBinaryBlobs | 0x4 | Tells the backend that the client does not require retrieved contacts to include binary blobs |
The OptimizationHints type is a typedef for QFlags<OptimizationHint>. It stores an OR combination of OptimizationHint values.
Member Function Documentation
QContactFetchHint::QContactFetchHint()
Constructs a new contact fetch hint which requests that the backend fetch all information
QContactFetchHint::QContactFetchHint(const QContactFetchHint & other)
Constructs a new contact fetch hint as a copy of other
QContactFetchHint::~QContactFetchHint()
Frees any memory in use by the fetch hint
QList<QContactDetail::DetailType> QContactFetchHint::detailTypesHint() const
Returns the list of detail types that identify which detail type the manager should (at a minimum) retrieve when fetching contacts. This hint may be ignored by the backend, in which case it will return the full set of details for each contact retrieved.
See also setDetailTypesHint().
int QContactFetchHint::maxCountHint() const
Returns the number of results which the client considers to be the maximum number of useful results. The client is only interested in this number of results, so returning any more results would be superfluous to the client's requirements. Note that this fetch hint only affects operations where the backend would return a list of contacts; this hint specifies the maximum number of contacts in the list which would be useful to the client. The backend may ignore this hint, in which case it must return all contacts which would otherwise have been returned as a result of the operation.
A negative value for count denotes that the client wishes to retrieve all results. The default value is -1.
See also setMaxCountHint().
OptimizationHints QContactFetchHint::optimizationHints() const
Returns the optimization hint flags specified by the client. These hints may be ignored by the backend, in which case it will return the full set of information accessible in a contact, including relationships, action preferences, and binary blobs.
See also setOptimizationHints().
QSize QContactFetchHint::preferredImageSize() const
Returns the preferred pixel dimensions for any images returned by the manager for a given request. This hint may be ignored by the manager.
This is useful when the backend supports multiple sizes of an image (or the image is natively scaleable) in order to get an image that will look good at the indicated dimensions.
The caller should be prepared for images of any dimensions, in any case.
See also setPreferredImageSize().
QStringList QContactFetchHint::relationshipTypesHint() const
Returns the list of relationship types that the manager should (at a minimum) retrieve when fetching contacts. This hint may be ignored by the backend, in which case it will return the full set of relationships for each contact retrieved.
See also setRelationshipTypesHint() and QContact::relationships().
void QContactFetchHint::setDetailTypesHint(const QList<QContactDetail::DetailType> & types)
Sets the list of detail types that identify which detail type the manager should (at a minimum) retrieve when fetching contacts to types. This hint may be ignored by the backend, in which case it will return the full set of details for each contact retrieved.
See also detailTypesHint().
void QContactFetchHint::setMaxCountHint(int count)
Sets the maximum number of results which the client is interested in to count. The client is only interested in this number of results, so returning any more results would be superfluous to the client's requirements. Note that this fetch hint only affects operations where the backend would return a list of contacts; this hint specifies the maximum number of contacts in the list which would be useful to the client. The backend may ignore this hint, in which case it must return all contacts which would otherwise have been returned as a result of the operation.
A negative value for count denotes that the client wishes to retrieve all results. The default value is -1.
See also maxCountHint().
void QContactFetchHint::setOptimizationHints(OptimizationHints hints)
Sets the optimization hint flags specified by the client to hints. These hints may be ignored by the backend, in which case it will return the full set of information accessible in a contact, including relationships, action preferences, and binary blobs.
See also optimizationHints().
void QContactFetchHint::setPreferredImageSize(const QSize & size)
Sets the preferred pixel dimensions for any images returned by the manager for the given request to size. This hint may be ignored by the manager.
This is useful when the backend supports multiple sizes of an image (or the image is natively scaleable) in order to get an image that will look good at the indicated dimensions.
The caller should be prepared for images of any dimensions, in any case.
See also preferredImageSize().
void QContactFetchHint::setRelationshipTypesHint(const QStringList & relationshipTypes)
Sets the list of relationship types that the manager should (at a minimum) retrieve when fetching contacts to relationshipTypes. This hint may be ignored by the backend, in which case it will return the full set of relationships for each contact retrieved.
See also relationshipTypesHint() and QContact::relationships().
QContactFetchHint & QContactFetchHint::operator=(const QContactFetchHint & other)
Assigns this fetch hint to be equal to the other fetch hint