contacts_plat/contacts_ui_extensions_api/inc/cntinfoprovider.h
author hgs
Mon, 23 Aug 2010 16:06:28 +0300
changeset 61 d30183af6ca6
permissions -rw-r--r--
201033
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
61
hgs
parents:
diff changeset
     1
/*
hgs
parents:
diff changeset
     2
* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
hgs
parents:
diff changeset
     3
* All rights reserved.
hgs
parents:
diff changeset
     4
* This component and the accompanying materials are made available
hgs
parents:
diff changeset
     5
* under the terms of "Eclipse Public License v1.0"
hgs
parents:
diff changeset
     6
* which accompanies this distribution, and is available
hgs
parents:
diff changeset
     7
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
hgs
parents:
diff changeset
     8
*
hgs
parents:
diff changeset
     9
* Initial Contributors:
hgs
parents:
diff changeset
    10
* Nokia Corporation - initial contribution.
hgs
parents:
diff changeset
    11
*
hgs
parents:
diff changeset
    12
* Contributors:
hgs
parents:
diff changeset
    13
*
hgs
parents:
diff changeset
    14
* Description: Interface for info provider plugins to class CntListModel.
hgs
parents:
diff changeset
    15
*
hgs
parents:
diff changeset
    16
*/
hgs
parents:
diff changeset
    17
hgs
parents:
diff changeset
    18
#ifndef CNTINFOPROVIDER_H
hgs
parents:
diff changeset
    19
#define CNTINFOPROVIDER_H
hgs
parents:
diff changeset
    20
hgs
parents:
diff changeset
    21
#include <QObject>
hgs
parents:
diff changeset
    22
#include <qcontact.h>
hgs
parents:
diff changeset
    23
hgs
parents:
diff changeset
    24
QTM_USE_NAMESPACE
hgs
parents:
diff changeset
    25
hgs
parents:
diff changeset
    26
/*
hgs
parents:
diff changeset
    27
   Info providers may provide up to three different types of info fields:
hgs
parents:
diff changeset
    28
   text, icon1 and icon2.
hgs
parents:
diff changeset
    29
 */
hgs
parents:
diff changeset
    30
enum ContactInfoField {
hgs
parents:
diff changeset
    31
    ContactInfoTextField = 0x01,
hgs
parents:
diff changeset
    32
    ContactInfoIcon1Field = 0x02,
hgs
parents:
diff changeset
    33
    ContactInfoIcon2Field = 0x04,
hgs
parents:
diff changeset
    34
    ContactInfoAllFields = ContactInfoTextField | ContactInfoIcon1Field | ContactInfoIcon2Field
hgs
parents:
diff changeset
    35
};
hgs
parents:
diff changeset
    36
Q_DECLARE_FLAGS(ContactInfoFields, ContactInfoField)
hgs
parents:
diff changeset
    37
Q_DECLARE_OPERATORS_FOR_FLAGS(ContactInfoFields)
hgs
parents:
diff changeset
    38
hgs
parents:
diff changeset
    39
/*
hgs
parents:
diff changeset
    40
   Interface for info provider plugins. Info provider plugins provide the kind of
hgs
parents:
diff changeset
    41
   info that a listview with contacts wants. Examples includes phone number, image url
hgs
parents:
diff changeset
    42
   and online status (text and/or icon).
hgs
parents:
diff changeset
    43
 */
hgs
parents:
diff changeset
    44
class CntInfoProvider : public QObject
hgs
parents:
diff changeset
    45
{
hgs
parents:
diff changeset
    46
hgs
parents:
diff changeset
    47
public:
hgs
parents:
diff changeset
    48
    /* 
hgs
parents:
diff changeset
    49
       The unqiue name of the plugin.
hgs
parents:
diff changeset
    50
hgs
parents:
diff changeset
    51
       /return the id of the plugin
hgs
parents:
diff changeset
    52
     */
hgs
parents:
diff changeset
    53
    virtual QString id() const = 0;
hgs
parents:
diff changeset
    54
hgs
parents:
diff changeset
    55
    /* 
hgs
parents:
diff changeset
    56
       Checks fields that the client can provide.
hgs
parents:
diff changeset
    57
       
hgs
parents:
diff changeset
    58
       /return all the ContactInfoFields that this plugin can provide to clients
hgs
parents:
diff changeset
    59
     */
hgs
parents:
diff changeset
    60
    virtual ContactInfoFields supportedFields() const = 0;
hgs
parents:
diff changeset
    61
hgs
parents:
diff changeset
    62
    /* 
hgs
parents:
diff changeset
    63
       Requests info about a contact. The requested info fields are passed
hgs
parents:
diff changeset
    64
       back to the client via infoFieldReady() signals. Ideally this function
hgs
parents:
diff changeset
    65
       should not consume more than 50 ms of time. Info that takes longer to
hgs
parents:
diff changeset
    66
       fetch should use some asynchronous way of getting the data.
hgs
parents:
diff changeset
    67
       
hgs
parents:
diff changeset
    68
       Info values are by default empty, so an empty value does not need not be
hgs
parents:
diff changeset
    69
       sent back in response to this request. However, if a value *changes* and
hgs
parents:
diff changeset
    70
       becomes empty, that will of course need to be signaled.
hgs
parents:
diff changeset
    71
        
hgs
parents:
diff changeset
    72
       /param contact the contact for which info is requested
hgs
parents:
diff changeset
    73
       /param requestedInfo one or more of the flags in ContactInfoFields
hgs
parents:
diff changeset
    74
     */
hgs
parents:
diff changeset
    75
    virtual void requestInfo(const QContact& contact, ContactInfoFields requestedInfo) = 0;
hgs
parents:
diff changeset
    76
hgs
parents:
diff changeset
    77
signals:
hgs
parents:
diff changeset
    78
    /* 
hgs
parents:
diff changeset
    79
       The requested info fields are passed back to the client via infoFieldReady()
hgs
parents:
diff changeset
    80
       signals, one signal per field.
hgs
parents:
diff changeset
    81
       
hgs
parents:
diff changeset
    82
       /param sender the provider that sends the signal
hgs
parents:
diff changeset
    83
       /param contactId the if of the contact that this info is about
hgs
parents:
diff changeset
    84
       /param field the field that is ready (text, icon1 or icon2)
hgs
parents:
diff changeset
    85
       /param value the value of the info field
hgs
parents:
diff changeset
    86
     */
hgs
parents:
diff changeset
    87
    void infoFieldReady(CntInfoProvider* sender, int contactId, ContactInfoField field, const QString& value);
hgs
parents:
diff changeset
    88
};
hgs
parents:
diff changeset
    89
hgs
parents:
diff changeset
    90
#endif