QContactRelationship Class

The QContactRelationship class describes a one-to-one relationship between a locally-stored contact and another (possibly remote) contact. More...

Header: #include <QContactRelationship>

Public Types

enum Role { First, Second, Either }

Public Functions

QContactRelationship()
QContactRelationship(const QContactRelationship & other)
~QContactRelationship()
QContact first() const
QString relationshipType() const
QContact second() const
void setFirst(const QContact & firstContact)
void setRelationshipType(const QString & relationshipType)
void setSecond(const QContact & secondContact)
bool operator!=(const QContactRelationship & other) const
QContactRelationship & operator=(const QContactRelationship & other)
bool operator==(const QContactRelationship & other) const

Static Public Members

const QString Aggregates()
const QString HasAssistant()
const QString HasManager()
const QString HasMember()
const QString HasSpouse()
const QString IsSameAs()

Detailed Description

The QContactRelationship class describes a one-to-one relationship between a locally-stored contact and another (possibly remote) contact.

Each relationship is uniquely identified by the combination of the first contact, second contact, and the relationship type.

A relationship should not contain a second contact which is the same as the first contact. Any local contacts which are referenced in the relationship (that is, any source contact, or any second contact whose manager URI is left empty or whose manager URI references the manager that stores the source contact, and in which the relationship will be saved) should exist.

If any of these requirements are not met, validation of the relationship may fail when attempting to save the relationship in a QContactManager.

See also QContactRelationshipFilter.

Member Type Documentation

enum QContactRelationship::Role

Describes the roles that a contact may take in a relationship.

ConstantValueDescription
QContactRelationship::First0The contact is the first contact in the relationship
QContactRelationship::Second1The contact is the second contact in the relationship
QContactRelationship::Either2The contact is either the first or second contact in the relationship

Member Function Documentation

QContactRelationship::QContactRelationship()

Constructs a new relationship

QContactRelationship::QContactRelationship(const QContactRelationship & other)

Creates a copy of the other relationship

QContactRelationship::~QContactRelationship()

Frees the memory in use by the relationship

[static] const QString QContactRelationship::Aggregates()

The relationship type which identifies the first contact as aggregating the second contact into a metacontact

[static] const QString QContactRelationship::HasAssistant()

The relationship type which identifies the second contact as being the assistant of the first contact

[static] const QString QContactRelationship::HasManager()

The relationship type which identifies the second contact as being the manager of the first contact

[static] const QString QContactRelationship::HasMember()

The relationship type which identifies the first contact as being a group which includes the second contact

[static] const QString QContactRelationship::HasSpouse()

The relationship type which identifies the second contact as being the spouse of the first contact

[static] const QString QContactRelationship::IsSameAs()

The relationship type which identifies the first contact as being the same contact as the second contact

QContact QContactRelationship::first() const

Returns the locally-stored contact which has a relationship of the given type with the second contact

See also relationshipType(), second(), and setFirst().

QString QContactRelationship::relationshipType() const

Returns the type of relationship which the source contact has with the destination contacts

See also setRelationshipType().

QContact QContactRelationship::second() const

Returns the contact with which the first contact has a relationship of the given type

See also setSecond(), relationshipType(), and first().

void QContactRelationship::setFirst(const QContact & firstContact)

Sets the first contact in the relationship to firstContact. This contact must be stored in the manager in which the relationship is stored, and has a relationship of the specified type with the second contact.

See also first().

void QContactRelationship::setRelationshipType(const QString & relationshipType)

Sets the type of relationship that the source contact has with the destination contacts to relationshipType.

See also relationshipType().

void QContactRelationship::setSecond(const QContact & secondContact)

Sets the second contact in the relationship to secondContact. The first contact has a relationship of the specified type with this contact.

See also second().

bool QContactRelationship::operator!=(const QContactRelationship & other) const

Returns true if this relationship is not equal to other, otherwise returns false.

QContactRelationship & QContactRelationship::operator=(const QContactRelationship & other)

Assigns this relationship to be equal to other

bool QContactRelationship::operator==(const QContactRelationship & other) const

Returns true if this relationship is equal to the other relationship, otherwise returns false.