phonebookui/Phonebook2/ccapplication/ccacommlauncherplugin/tsrc/ut_commlaunchercontacthandler/inc/ccappcommlauncherheaders.h
branchRCL_3
changeset 63 f4a778e096c2
child 64 c1e8ba0c2b16
child 85 38bb213f60ba
equal deleted inserted replaced
62:5b6f26637ad3 63:f4a778e096c2
       
     1 /*
       
     2 * Copyright (c) 2007-2007 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:  Headers of plugin view implementation to help unit testing
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef __CCAPPCOMMLAUNCHERHEADERS_H__
       
    20 #define __CCAPPCOMMLAUNCHERHEADERS_H__
       
    21 
       
    22 // logfile definition
       
    23 #define KCommLauncherLogFile CCA_L("commlauncherplugin.txt")
       
    24 
       
    25 #include <e32base.h>
       
    26 #include <centralrepository.h>
       
    27 #include <vpbkfieldtypeselectorfactory.h>
       
    28 
       
    29 #include "ccalogger.h"
       
    30 #include "t_ccappcmscontactfetcher.h"
       
    31 #include "t_testsingleton.h"
       
    32 #include "phonebookPrivateCRKeys.h"
       
    33 #include <e32hashtab.h>
       
    34 class CCmsContactFieldInfo;
       
    35 class MCCAppContactFieldDataObserver;
       
    36 
       
    37 // used in CCmsContactFieldItem creation
       
    38 const TInt PHONE = 1;
       
    39 const TInt EMAIL = 2;
       
    40 const TInt VOIP = 3;
       
    41 const TInt MMS = 4;
       
    42 const TInt PHONE2 = 5;
       
    43 const TInt EMAIL2 = 6;
       
    44 const TInt VOIP2 = 7;
       
    45 const TInt NAME = 8;
       
    46 // test defines
       
    47 const TInt KTestNormal = 0;
       
    48 const TInt KTestContactInfoNull = 1;
       
    49 _LIT8( KTestString, "TestString" );
       
    50 
       
    51 // -----------------------------------------------------------------------------
       
    52 // MCCAppContactFieldDataObserver
       
    53 // dummy class
       
    54 // -----------------------------------------------------------------------------
       
    55 class MCCAppContactFieldDataObserver
       
    56     {
       
    57 public:
       
    58 
       
    59     class TParameter
       
    60         {
       
    61     public:
       
    62 
       
    63         enum TNotifyType
       
    64             {
       
    65             EUninitialised,
       
    66             EContactInfoAvailable,
       
    67             EContactDataFieldAvailable,
       
    68             EContactsChanged,
       
    69             EContactDeleted,
       
    70             EContactPresenceChanged
       
    71             };
       
    72 
       
    73         inline TParameter():
       
    74             iType( EUninitialised ),
       
    75             iContactInfo( NULL ),
       
    76             iContactField( NULL ),
       
    77             iStatusFlag( 0 ){};
       
    78     
       
    79         TNotifyType iType;
       
    80         TInt iStatusFlag;
       
    81         CCmsContactFieldInfo* iContactInfo;
       
    82         CCmsContactField* iContactField;
       
    83         };
       
    84    
       
    85     virtual void ContactFieldDataObserverNotifyL( 
       
    86         MCCAppContactFieldDataObserver::TParameter& aParameter ) = 0;
       
    87 
       
    88     virtual void ContactFieldDataObserverHandleErrorL( 
       
    89         TInt aState, TInt aError ) = 0;
       
    90 
       
    91     };    
       
    92 
       
    93 // -----------------------------------------------------------------------------
       
    94 // CCmsContactFieldItem
       
    95 // dummy class
       
    96 // -----------------------------------------------------------------------------
       
    97 class CCmsContactFieldItem : public CBase
       
    98     {
       
    99     public:  
       
   100         
       
   101         enum TCmsContactField
       
   102             {
       
   103             ECmsLastName = 10000,       //10000
       
   104             ECmsFirstName,              //10001
       
   105             ECmsUndefined,              //10002
       
   106             ECmsPresenceData,           //10003
       
   107             ECmsBrandedAvailability,    //10004
       
   108             ECmsThumbnailPic,           //10005
       
   109             ECmsSipAddress,             //10006
       
   110             ECmsLandPhoneHome,          //10007
       
   111             ECmsMobilePhoneHome,        //10008
       
   112             ECmsFaxNumberHome,          //10009
       
   113             ECmsVideoNumberHome,        //10010
       
   114             ECmsVoipNumberHome,         //10011
       
   115             ECmsEmailHome,              //10012
       
   116             ECmsUrlHome,                //10013
       
   117             ECmsLandPhoneWork,          //10014
       
   118             ECmsMobilePhoneWork,        //10015
       
   119             ECmsVideoNumberWork,        //10016
       
   120             ECmsFaxNumberWork,          //10017
       
   121             ECmsVoipNumberWork,         //10018
       
   122             ECmsEmailWork,              //10019
       
   123             ECmsUrlWork,                //10020
       
   124             ECmsEmailGeneric,           //10021
       
   125             ECmsUrlGeneric,             //10022
       
   126             ECmsLandPhoneGeneric,       //10023
       
   127             ECmsMobilePhoneGeneric,     //10024
       
   128             ECmsVideoNumberGeneric,     //10025
       
   129             ECmsAddrLabelGeneric,       //10026
       
   130             ECmsAddrPOGeneric,          //10027
       
   131             ECmsAddrExtGeneric,         //10028
       
   132             ECmsAddrStreetGeneric,      //10029
       
   133             ECmsAddrLocalGeneric,       //10030
       
   134             ECmsAddrRegionGeneric,      //10031
       
   135             ECmsAddrPostcodeGeneric,    //10032
       
   136             ECmsAddrCountryGeneric,     //10033
       
   137             ECmsVoipNumberGeneric,      //10034
       
   138             ECmsAddrLabelHome,          //10035
       
   139             ECmsAddrPOHome,             //10036
       
   140             ECmsAddrExtHome,            //10037
       
   141             ECmsAddrStreetHome,         //10038
       
   142             ECmsAddrLocalHome,          //10039
       
   143             ECmsAddrRegionHome,         //10040
       
   144             ECmsAddrPostcodeHome,       //10041
       
   145             ECmsAddrCountryHome,        //10042
       
   146             ECmsAddrLabelWork,          //10043
       
   147             ECmsAddrPOWork,             //10044
       
   148             ECmsAddrExtWork,            //10045
       
   149             ECmsAddrStreetWork,         //10046
       
   150             ECmsAddrLocalWork,          //10047
       
   151             ECmsAddrRegionWork,         //10048
       
   152             ECmsAddrPostcodeWork,       //10049
       
   153             ECmsAddrCountryWork,        //10050
       
   154             ECmsImpp,                   //10051
       
   155             ECmsFullName,               //10052
       
   156             ECmsNote,                   //10053
       
   157             ECmsNickname,               //10054
       
   158             ECmsJobTitle,               //10055
       
   159             ECmsDepartment,             //10056
       
   160             ECmsBirthday,               //10057
       
   161             ECmsAnniversary,            //10058
       
   162             ECmsCompanyName,            //10059
       
   163             ECmsMiddleName,             //10060
       
   164             ECmsAssistantNumber,        //10061
       
   165             ECmsCarPhone,               //10062
       
   166             ECmsPagerNumber,            //10063
       
   167             ECmsPushToTalk,             //10064
       
   168             ECmsShareView               //10065
       
   169             };
       
   170 
       
   171         enum TCmsContactNotification
       
   172             {
       
   173             ECmsUnknownNotification = 0x0,                
       
   174             ECmsPhonebookNotification = 0x1,                
       
   175             ECmsPresenceVoIPNotification = 0x2,
       
   176             ECmsPresenceChatNotification = 0x4,
       
   177             ECmsPresenceAllNotification = 0x6,
       
   178             ECmsAllNotifications = 0x7                        
       
   179             };
       
   180             
       
   181         enum TCmsContactFieldGroup
       
   182             {
       
   183             ECmsGroupNone = 0,
       
   184             ECmsGroupVoIP,
       
   185             ECmsGroupVoice,
       
   186             ECmsGroupMessaging,
       
   187             ECmsGroupEmail
       
   188             };
       
   189 
       
   190         enum TCmsDefaultAttributeTypes
       
   191             {
       
   192             /// Defaults
       
   193             ECmsDefaultTypeUndefined = 0,
       
   194             ECmsDefaultTypePhoneNumber = 1, 
       
   195             ECmsDefaultTypeVideoNumber = 2, 
       
   196             ECmsDefaultTypeSms = 4,
       
   197             ECmsDefaultTypeMms = 8, 
       
   198             ECmsDefaultTypeEmail = 16, 
       
   199             ECmsDefaultTypeEmailOverSms = 32,
       
   200             ECmsDefaultTypeVoIP = 64,
       
   201             ECmsDefaultTypePOC = 128,
       
   202             ECmsDefaultTypeImpp = 256,
       
   203             ECmsDefaultTypeUrl = 512
       
   204             };
       
   205         
       
   206         const TPtrC Data() const {return KNullDesC.operator ()().Left(0);}
       
   207     };
       
   208 
       
   209 // -----------------------------------------------------------------------------
       
   210 // CCmsContactField
       
   211 // dummy class
       
   212 // -----------------------------------------------------------------------------
       
   213 class CCmsContactField : public CBase
       
   214     {
       
   215 public:
       
   216 
       
   217     CCmsContactField( TInt aType ):iType(aType){}
       
   218     const CCmsContactFieldItem& ItemL( TInt /*aIndex*/) const;
       
   219     CCmsContactFieldItem::TCmsContactField Type() const;
       
   220     TInt ItemCount() const{ return 1; }
       
   221     TInt HasDefaultAttribute() const;
       
   222     
       
   223 public: // data
       
   224     TInt iDummyDefaultAttributeBitMask;
       
   225     TInt iDummy;
       
   226     TInt iType;
       
   227     CCmsContactFieldItem* iCmsContactFieldItem;
       
   228     };
       
   229 
       
   230 // -----------------------------------------------------------------------------
       
   231 // CCmsContactFieldInfo
       
   232 // dummy class
       
   233 // -----------------------------------------------------------------------------
       
   234 class CCmsContactFieldInfo : public CBase
       
   235     {
       
   236 public:
       
   237     virtual ~CCmsContactFieldInfo();
       
   238     static CCmsContactFieldInfo* NewL();
       
   239     
       
   240     void AddMoreFields(); 
       
   241     const RArray<CCmsContactFieldItem::TCmsContactField>& Fields() const 
       
   242             { 
       
   243             return *iArray;
       
   244             }
       
   245 private:
       
   246     CCmsContactFieldInfo(){}
       
   247     void ConstructL();
       
   248     
       
   249 public: // data
       
   250     TInt iDummy;
       
   251     RArray<CCmsContactFieldItem::TCmsContactField>* iArray;
       
   252     };
       
   253 
       
   254 #include "../../../inc/ccappcommlauncherprivatecrkeys.h"
       
   255 #include "../../../inc/ccappcommlaunchercontacthandler.h"
       
   256    
       
   257 
       
   258 // -----------------------------------------------------------------------------
       
   259 // CCCAppCommLauncherView
       
   260 // dummy class
       
   261 // -----------------------------------------------------------------------------
       
   262 class CCCAppCommLauncherView : public CBase,
       
   263                                public MCCAppContactHandlerNotifier
       
   264     {
       
   265 public:
       
   266 
       
   267     CCCAppCommLauncherView( /*CCCAppCommLauncherPlugin& aPlugin*/ )
       
   268         {
       
   269         iContactChangedNotifyCalled = EFalse;
       
   270         iContactEnabledFieldsChangedNotifyCalled = EFalse;
       
   271         };
       
   272 
       
   273     static CCCAppCommLauncherView* NewL( /*CCCAppCommLauncherPlugin& aPlugin*/ )
       
   274         {
       
   275         CCCAppCommLauncherView* self = new (ELeave) CCCAppCommLauncherView( /*aPlugin*/ );
       
   276         return self;
       
   277         };
       
   278 
       
   279     // MCCAppContactHandlerNotifier
       
   280     void ContactInfoFetchedNotifyL( 
       
   281         const CCmsContactFieldInfo& /*aContactFieldInfo*/ )
       
   282         {
       
   283         iContactEnabledFieldsChangedNotifyCalled = ETrue;
       
   284         };
       
   285 
       
   286     // MCCAppContactHandlerNotifier
       
   287     void ContactFieldFetchedNotifyL( 
       
   288         const CCmsContactField& /*aContactField*/ )
       
   289         {
       
   290         iContactChangedNotifyCalled = ETrue;
       
   291         };
       
   292 
       
   293     // MCCAppContactHandlerNotifier
       
   294     void ContactFieldFetchingCompletedL(){};
       
   295     // MCCAppContactHandlerNotifier
       
   296     void ContactsChangedL(){};
       
   297     // MCCAppContactHandlerNotifier
       
   298     void ContactPresenceChangedL( const CCmsContactField& /*aContactField*/){}
       
   299         
       
   300     TBool ContactChangedNotifyCalled()
       
   301         {
       
   302         return iContactChangedNotifyCalled;
       
   303         };
       
   304     TBool ContactEnabledFieldsChangedNotifyCalled()
       
   305         {
       
   306         return iContactEnabledFieldsChangedNotifyCalled;
       
   307         }
       
   308     void ResetVariables()
       
   309         {
       
   310         iContactChangedNotifyCalled = EFalse;
       
   311         iContactEnabledFieldsChangedNotifyCalled = EFalse;
       
   312         };
       
   313     
       
   314 public: // data
       
   315     TBool iContactChangedNotifyCalled;
       
   316     TBool iContactEnabledFieldsChangedNotifyCalled;
       
   317     };
       
   318 
       
   319 // -----------------------------------------------------------------------------
       
   320 // CCCAppCommLauncherPlugin
       
   321 // dummy class
       
   322 // -----------------------------------------------------------------------------
       
   323 class CCCAppCommLauncherPlugin : public CBase
       
   324     {
       
   325 public:
       
   326     
       
   327     CCCAppCommLauncherPlugin(){}
       
   328     ~CCCAppCommLauncherPlugin(){}
       
   329     static CCCAppCommLauncherPlugin* NewL();
       
   330 public:
       
   331     void SetTitleL( const TDesC& /*aTitle*/ ){}
       
   332 
       
   333     };
       
   334 
       
   335 
       
   336 #endif // __CCAPPCOMMLAUNCHERHEADERS_H__