phonebookui/cntlistmodel/cntcacheitems.h
changeset 81 640d30f4fb64
equal deleted inserted replaced
77:c18f9fa7f42e 81:640d30f4fb64
       
     1 /*
       
     2 * Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description: Classes for each of the items (name, info and icon) in cache.
       
    15 *
       
    16 */
       
    17 
       
    18 #ifndef CNTCACHEITEMS_H
       
    19 #define CNTCACHEITEMS_H
       
    20 
       
    21 #include <HbIcon>
       
    22 #include <qtcontacts.h>
       
    23 #include <cntuids.h>
       
    24 
       
    25 QTM_USE_NAMESPACE
       
    26 
       
    27 class CntNameCacheItem
       
    28 {
       
    29 public:
       
    30     CntNameCacheItem(QContactLocalId id, const QString &firstName, const QString &lastName, CntNameOrder nameFormat);
       
    31     ~CntNameCacheItem();
       
    32     QContactLocalId contactId() const { return mContactId; }
       
    33     QString name() const { return mName; }
       
    34     QString firstName() const;
       
    35     QString lastName() const;
       
    36     void setNameFormat(CntNameOrder newFormat);
       
    37     void operator=(const CntNameCacheItem &other);
       
    38     void externalize(QDataStream &stream);
       
    39     static CntNameCacheItem* internalize(QDataStream &stream, CntNameOrder nameFormat);
       
    40 
       
    41 private:
       
    42     void setFormattedName(const QString &firstName, const QString &lastName, CntNameOrder nameFormat);
       
    43 
       
    44 private:
       
    45     QContactLocalId mContactId; // database contact id for this name
       
    46     int mFirstNamePosition;     // length << 16 | offset
       
    47     int mLastNamePosition;      // length << 16 | offset
       
    48     QString mName;              // formatted name
       
    49 };
       
    50 
       
    51 class CntInfoCacheItem
       
    52 {
       
    53 public:
       
    54     QContactLocalId contactId;
       
    55     QString text;
       
    56     QString icons[2];
       
    57     QTime lastRequest;
       
    58 };
       
    59 
       
    60 class CntIconCacheItem
       
    61 {
       
    62 public:
       
    63     QString iconName;
       
    64     HbIcon icon;
       
    65     QList<QContactLocalId> requestedBy;
       
    66     QTime lastRequest;
       
    67 };
       
    68 
       
    69 #endif