wvuing/wvuistorage/src/CCAContact.h
changeset 0 094583676ce7
equal deleted inserted replaced
-1:000000000000 0:094583676ce7
       
     1 /*
       
     2 * Copyright (c) 2005 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:  Contact data container implementation
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 #ifndef CCACONTACT_H
       
    21 #define CCACONTACT_H
       
    22 
       
    23 #include "impsbuilddefinitions.h"
       
    24 
       
    25 //  INCLUDES
       
    26 #include <e32base.h>
       
    27 
       
    28 #include "MCAStoredContact.h"
       
    29 
       
    30 // FORWARD DECLARATIONS
       
    31 class CCAStorage;
       
    32 class MCAStoredContactsObserver;
       
    33 class MCAStorageInfo;
       
    34 
       
    35 // CLASS DECLARATION
       
    36 
       
    37 /**
       
    38  *  Contact data implementation
       
    39  *
       
    40  *  @lib CAStorage.dll
       
    41  *  @since 2.1
       
    42  */
       
    43 class CCAContact : public CBase,
       
    44             public MCAStoredContact
       
    45     {
       
    46     public:  // Constructors and destructor
       
    47 
       
    48         /**
       
    49          * Two-phased constructor.
       
    50          * @param aStorage Storage instance
       
    51          * @param aObserver contact data container observer
       
    52          *
       
    53          */
       
    54         static CCAContact* NewL( MCAStoredContactsObserver* aObserver,
       
    55                                  MCAStorageInfo* aVariation );
       
    56 
       
    57         /**
       
    58          * Destructor.
       
    59          */
       
    60         ~CCAContact();
       
    61 
       
    62 
       
    63         /**
       
    64          * Set user id
       
    65          */
       
    66         void SetUserIdL( const TDesC& aUserId );
       
    67         void SetNicknameL( const TDesC& aNickname );
       
    68         void SetAliasL( const TDesC& aAlias );
       
    69 
       
    70     public: // Functions from base classes
       
    71 
       
    72         /**
       
    73          * @see MCAContact
       
    74          */
       
    75         const TDesC& UserId() const;
       
    76 
       
    77         /**
       
    78          * @see MCAContact
       
    79          */
       
    80         const TDesC& Nickname() const;
       
    81 
       
    82         /**
       
    83          * @see MCAContact
       
    84          */
       
    85         const TDesC& Alias() const;
       
    86 
       
    87         /**
       
    88          * @see MCAContact
       
    89          */
       
    90         const TDesC& Identification() const;
       
    91 
       
    92         /**
       
    93          * @see MCAContact
       
    94          */
       
    95         TStorageManagerGlobals::TPresenceStatus OnlineStatus() const;
       
    96 
       
    97         /**
       
    98          * @see MCAContact
       
    99          */
       
   100         TBool IsBlocked() const;
       
   101 
       
   102         /**
       
   103          * @see MCAContact
       
   104          */
       
   105         TBool IsWatched() const;
       
   106 
       
   107         /**
       
   108          * @see MCAContact
       
   109          */
       
   110         TStorageManagerGlobals::TClientType ClientType() const;
       
   111 
       
   112         /**
       
   113          * @see MCAContact
       
   114          */
       
   115         void SetClientType( TStorageManagerGlobals::TClientType aType );
       
   116 
       
   117         /**
       
   118          * @see MCAContact
       
   119          */
       
   120         void SetOnlineStatus(
       
   121             TStorageManagerGlobals::TPresenceStatus aOnlineStatus );
       
   122 
       
   123         /**
       
   124          * @see MCAContact
       
   125          */
       
   126         void SetBlocked( TBool aBlocked );
       
   127 
       
   128         /**
       
   129          * @see MCAContact
       
   130          */
       
   131         void SetWatched( TBool aWatched );
       
   132 
       
   133         /**
       
   134          * @see MCAStoredContact
       
   135          */
       
   136         void SetPendingMessages( TInt aAmount );
       
   137 
       
   138         /**
       
   139          * @see MCAContact
       
   140          */
       
   141         void SignalChanges();
       
   142 
       
   143         /**
       
   144          * @see MCAContact
       
   145          */
       
   146         TBool Selected() const;
       
   147 
       
   148         /**
       
   149          * @see MCAContact
       
   150          */
       
   151         void SetSelected( TBool aSelected );
       
   152 
       
   153         /**
       
   154          * @see MCAContact
       
   155          */
       
   156         TInt PendingMessages() const;
       
   157 
       
   158         /**
       
   159          * @see MCAContact
       
   160          */
       
   161         const TDesC& StatusText() const;
       
   162 
       
   163         /**
       
   164          * @see MCAContact
       
   165          */
       
   166         void SetStatusTextL( const TDesC& aStatusText );
       
   167 
       
   168     public:
       
   169 
       
   170         /**
       
   171          * From MCAContact
       
   172          */
       
   173         HBufC* PropertyL(
       
   174             TStorageManagerGlobals::TCAStorageProperty aProperty );
       
   175 
       
   176         /**
       
   177          * From MCAContact
       
   178          */
       
   179         void SetPropertyL(
       
   180             TStorageManagerGlobals::TCAStorageProperty aProperty,
       
   181             const TDesC& aData );
       
   182 
       
   183 
       
   184     private:
       
   185 
       
   186         /**
       
   187          * C++ default constructor.
       
   188          * @param aStorage Storage instance
       
   189          * @param aObserver contact data container observer
       
   190          */
       
   191         CCAContact( MCAStoredContactsObserver* aObserver,
       
   192                     MCAStorageInfo* aVariation );
       
   193 
       
   194         /**
       
   195          * By default Symbian 2nd phase constructor is private.
       
   196          */
       
   197         void ConstructL();
       
   198 
       
   199         /**
       
   200          * Update the identification string to be up-to-date
       
   201          * according to the logic 1. nickname, 2. alias, 3. userid.
       
   202          */
       
   203         void UpdateIdentification();
       
   204 
       
   205     private:    // Data
       
   206 
       
   207         // observer who wants to know about changes etc.
       
   208         MCAStoredContactsObserver* iObserver; // used
       
   209 
       
   210         // storage variation interface
       
   211         MCAStorageInfo* iVariation;
       
   212 
       
   213         // has active watcher (ETrue)
       
   214         TBool iWatcherActive;
       
   215 
       
   216         // is blocked (ETrue)
       
   217         TBool iIsBlocked;
       
   218 
       
   219         // identification
       
   220         TPtrC iIdentification;   // owns
       
   221 
       
   222         // user WV ID
       
   223         HBufC* iUserId;     // owns
       
   224 
       
   225         // presence status (online, offline, etc)
       
   226         TStorageManagerGlobals::TPresenceStatus iPresenceStatus;
       
   227 
       
   228         // Client type (PC, Mobile, Unknown)
       
   229         TStorageManagerGlobals::TClientType iClientType;
       
   230 
       
   231         // internal flag for contact deletion management
       
   232         TBool iDeletionImminent;
       
   233 
       
   234         // Data contained in the contact has changed.
       
   235         // We use a binary or (|) trick.
       
   236         TInt iIsChanged;
       
   237 
       
   238         // ETrue if the user id has been changed
       
   239         TBool iUserIdChanged;
       
   240 
       
   241         // Nickname. No longer in Pbk but contact has this. Uses old API
       
   242         // for maximum compatibility. Owns.
       
   243         HBufC* iNickname;
       
   244 
       
   245         // Alias. Owns
       
   246         HBufC* iAlias;
       
   247 
       
   248         /// Status text. Owns.
       
   249         HBufC* iStatusText;
       
   250 
       
   251         /// Is contact selected or not.
       
   252         TBool iSelected;
       
   253 
       
   254         /// Amount of pending messages
       
   255         TInt iPendingMessages;
       
   256     };
       
   257 
       
   258 #endif      // CCACONTACT_H
       
   259 
       
   260 // End of File