vmbx/vmbxcpplugin/tsrc/src/ut_dummyvoicemailboxentry.cpp
branchRCL_3
changeset 19 7d48bed6ce0c
equal deleted inserted replaced
18:594d59766373 19:7d48bed6ce0c
       
     1 /*
       
     2 * Copyright (c) 2009 - 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:  Implementation of the CVoiceMailboxEntry class
       
    15 *
       
    16 */
       
    17 
       
    18 // System includes
       
    19 #include <QtTest/QtTest>
       
    20 #include <cvoicemailboxentry.h>
       
    21 // For global value
       
    22 #include "ut_vmbxuiengine.h"
       
    23 
       
    24 // CONSTANTS
       
    25 
       
    26 // ============================ MEMBER FUNCTIONS =============================
       
    27 
       
    28 // ---------------------------------------------------------------------------
       
    29 // CVoiceMailboxEntry::NewL
       
    30 // 
       
    31 // ---------------------------------------------------------------------------
       
    32 //
       
    33 
       
    34 EXPORT_C CVoiceMailboxEntry* CVoiceMailboxEntry::NewL()
       
    35     {
       
    36     qDebug( "DummyVoiceMailboxEntry::NewL >" );
       
    37     CVoiceMailboxEntry* self = CVoiceMailboxEntry::NewLC();
       
    38     CleanupStack::Pop( self );
       
    39     qDebug( "DummyVoiceMailboxEntry::NewL <" );
       
    40     return self;
       
    41     }
       
    42 
       
    43 // ---------------------------------------------------------------------------
       
    44 // CVoiceMailboxEntry::NewLC
       
    45 // 
       
    46 // ---------------------------------------------------------------------------
       
    47 //
       
    48 EXPORT_C CVoiceMailboxEntry* CVoiceMailboxEntry::NewLC()
       
    49     {
       
    50     qDebug( "DummyVoiceMailboxEntry::NewLC >" );
       
    51     CVoiceMailboxEntry* self = new( ELeave ) CVoiceMailboxEntry;
       
    52     CleanupStack::PushL( self );
       
    53     self->ConstructL();
       
    54     qDebug( "DummyVoiceMailboxEntry::NewLC <" );
       
    55     return self;
       
    56     }
       
    57 
       
    58 // ---------------------------------------------------------------------------
       
    59 // CVoiceMailboxEntry::~CVoiceMailboxEntry
       
    60 // Destructor
       
    61 // ---------------------------------------------------------------------------
       
    62 //
       
    63 CVoiceMailboxEntry::~CVoiceMailboxEntry()
       
    64     {
       
    65     qDebug( "DummyVoiceMailboxEntry::~CVoiceMailboxEntry >" );
       
    66     delete ivmbxNumber;
       
    67     delete iVmbxBrandId;
       
    68     delete ivmbxName;
       
    69     qDebug( "DummyVoiceMailboxEntry::~CVoiceMailboxEntry <" );
       
    70     }
       
    71 
       
    72 // ---------------------------------------------------------------------------
       
    73 // CVoiceMailboxEntry::ServiceId
       
    74 // Get ServiceId
       
    75 // ---------------------------------------------------------------------------
       
    76 //
       
    77 EXPORT_C TServiceId CVoiceMailboxEntry::ServiceId() const
       
    78     {
       
    79     qDebug( "DummyVoiceMailboxEntry::ServiceId %d", iVmbxServiceId );
       
    80     return iVmbxServiceId;
       
    81     }
       
    82 
       
    83 // ---------------------------------------------------------------------------
       
    84 // CVoiceMailboxEntry::SetServiceId
       
    85 // Set entry's service id
       
    86 // ---------------------------------------------------------------------------
       
    87 //
       
    88 void CVoiceMailboxEntry::SetServiceId( 
       
    89                         const TServiceId& aVmbxServiceId )
       
    90     {
       
    91     qDebug( "DummyVoiceMailboxEntry::SetServiceId %d", aVmbxServiceId);
       
    92     iVmbxServiceId = aVmbxServiceId;
       
    93     }
       
    94 
       
    95 // ---------------------------------------------------------------------------
       
    96 // CVoiceMailboxEntry::VoiceMailboxType
       
    97 // Returns type of the entry instance
       
    98 // ---------------------------------------------------------------------------
       
    99 //
       
   100 EXPORT_C TVmbxType CVoiceMailboxEntry::VoiceMailboxType( ) const
       
   101     {
       
   102     qDebug( "DummyVoiceMailboxEntry::VoiceMailboxType %d", iVmbxType );
       
   103     return iVmbxType;
       
   104     }
       
   105 
       
   106 // ---------------------------------------------------------------------------
       
   107 // CVoiceMailboxEntry::SetVoiceMailboxType
       
   108 // Set Type of the entry instance
       
   109 // ---------------------------------------------------------------------------
       
   110 //
       
   111 EXPORT_C void CVoiceMailboxEntry::SetVoiceMailboxType( const TVmbxType& aType )
       
   112     {
       
   113     qDebug( "DummyVoiceMailboxEntry::SetVoiceMailboxType %d", aType );
       
   114     iVmbxType = aType;
       
   115     }
       
   116 
       
   117 // ---------------------------------------------------------------------------
       
   118 // CVoiceMailboxEntry::VmbxAlsLineType
       
   119 // Get ALS line Type of the entry instance
       
   120 // ---------------------------------------------------------------------------
       
   121 //
       
   122 EXPORT_C TVmbxAlsLineType CVoiceMailboxEntry::VmbxAlsLineType() const
       
   123     {
       
   124     qDebug( "DummyVoiceMailboxEntry::VmbxAlsLineType >" );
       
   125     return iVmbxLineType;
       
   126     }
       
   127 
       
   128 // ---------------------------------------------------------------------------
       
   129 // CVoiceMailboxEntry::SetVmbxAlsLineType
       
   130 // Set ALS line Type of the entry instance
       
   131 // ---------------------------------------------------------------------------
       
   132 //
       
   133 void CVoiceMailboxEntry::SetVmbxAlsLineType( 
       
   134                                 const TVmbxAlsLineType& aLine )
       
   135     {
       
   136     qDebug( "DummyVoiceMailboxEntry::SetVmbxAlsLineType %d >", aLine );
       
   137     if ( EVmbxAlsLineDefault == aLine  )
       
   138         {
       
   139         iVmbxLineType = EVmbxAlsLine1;
       
   140         }
       
   141     else
       
   142         {
       
   143         iVmbxLineType = aLine;
       
   144         }
       
   145     qDebug( "DummyVoiceMailboxEntry::SetVmbxAlsLineType %d <", iVmbxLineType );
       
   146     }
       
   147 
       
   148 // ---------------------------------------------------------------------------
       
   149 // CVoiceMailboxEntry::GetVmbxNumber
       
   150 // Get number or address of the entry instance
       
   151 // ---------------------------------------------------------------------------
       
   152 //
       
   153 TInt CVoiceMailboxEntry::GetVmbxNumber( TPtrC& aVmbxNumber ) const
       
   154     {
       
   155     qDebug("DummyVoiceMailboxEntry::GetVmbxNumber >");
       
   156     aVmbxNumber.Set(globalNumber.utf16());
       
   157     qDebug("DummyVoiceMailboxEntry::GetVmbxNumber %d", globalExpRet);
       
   158     return globalExpRet;
       
   159     }
       
   160 
       
   161 // ---------------------------------------------------------------------------
       
   162 // CVoiceMailboxEntry::SetVmbxNumber
       
   163 // Set number or address of the entry instance
       
   164 // ---------------------------------------------------------------------------
       
   165 //
       
   166 TInt CVoiceMailboxEntry::SetVmbxNumber( const TDesC& aVmbxNumber )
       
   167     {
       
   168     qDebug("DummyVoiceMailboxEntry::SetVmbxNumber >");
       
   169     globalNumber = QString::fromUtf16(aVmbxNumber.Ptr(), aVmbxNumber.Length());
       
   170     qDebug("DummyVoiceMailboxEntry::SetVmbxNumber %d", globalExpRet);
       
   171     return globalExpRet;
       
   172     }
       
   173 
       
   174 // ---------------------------------------------------------------------------
       
   175 // CVoiceMailboxEntry::GetVmbxAlsLineType
       
   176 // Get Brand Id of the entry instance
       
   177 // ---------------------------------------------------------------------------
       
   178 //
       
   179 TInt CVoiceMailboxEntry::GetBrandId( TPtrC8& aBrandId ) const
       
   180     {
       
   181     qDebug("DummyVoiceMailboxEntry::GetBrandId >");
       
   182     TInt result( KErrNotFound ); 
       
   183     if ( iVmbxBrandId )
       
   184         {
       
   185         aBrandId.Set( iVmbxBrandId->Des() );
       
   186         result = KErrNone;
       
   187         }
       
   188     else
       
   189         {
       
   190         aBrandId.Set( KNullDesC8 );
       
   191         }
       
   192     qDebug("DummyVoiceMailboxEntry::GetBrandId <");
       
   193     return result;
       
   194     }
       
   195 
       
   196 // ---------------------------------------------------------------------------
       
   197 // CVoiceMailboxEntry::SetBrandId
       
   198 // Set Brand Id of the entry instance
       
   199 // ---------------------------------------------------------------------------
       
   200 //
       
   201 TInt CVoiceMailboxEntry::SetBrandId( const TDesC8& aBrandId )
       
   202 {
       
   203     qDebug("DummyVoiceMailboxEntry::SetBrandId >");
       
   204     TInt result( KErrNoMemory );
       
   205     if ( KVmbxMaxNumberLength < aBrandId.Length() ){
       
   206         result = KErrArgument;
       
   207     }else{
       
   208         delete iVmbxBrandId;
       
   209         iVmbxBrandId = aBrandId.Alloc();
       
   210         if ( iVmbxBrandId ){
       
   211             result = KErrNone;
       
   212         }
       
   213     }
       
   214     qDebug("DummyVoiceMailboxEntry::SetBrandId <");
       
   215     return result;
       
   216 }
       
   217 
       
   218 // ---------------------------------------------------------------------------
       
   219 // CVoiceMailboxEntry::GetVmbxName
       
   220 // Get Name of the entry instance
       
   221 // ---------------------------------------------------------------------------
       
   222 //
       
   223 EXPORT_C TInt CVoiceMailboxEntry::GetVmbxName( TPtrC& aVmbxName ) const
       
   224 {
       
   225     qDebug("DummyVoiceMailboxEntry::GetVmbxName >");
       
   226     TInt result( KErrNotFound );
       
   227     if ( ivmbxName ){
       
   228         aVmbxName.Set( ivmbxName->Des() );
       
   229         result = KErrNone;
       
   230     }else{
       
   231         qDebug( "DummyVoiceMailboxEntry::GetVmbxName:KNullDesC" );
       
   232         aVmbxName.Set( KNullDesC );
       
   233     }      
       
   234     qDebug("DummyVoiceMailboxEntry::GetVmbxName <");
       
   235     return result;
       
   236 }
       
   237 
       
   238 // ---------------------------------------------------------------------------
       
   239 // CVoiceMailboxEntry::SetVmbxName
       
   240 // Set Name of the entry instance
       
   241 // ---------------------------------------------------------------------------
       
   242 //
       
   243 EXPORT_C TInt CVoiceMailboxEntry::SetVmbxName( const TDesC& aVmbxName )
       
   244 {
       
   245     qDebug("DummyVoiceMailboxEntry::SetVmbxName >");
       
   246     TInt result( KErrNoMemory );
       
   247     if (KVmbxMaxNumberLength < aVmbxName.Length()){
       
   248         result = KErrArgument;
       
   249     }else{
       
   250         delete ivmbxName;
       
   251         ivmbxName = aVmbxName.Alloc(); // Returns NULL if fails.
       
   252         if ( ivmbxName ){
       
   253             result = KErrNone;
       
   254         }       
       
   255     }
       
   256     qDebug("DummyVoiceMailboxEntry::SetVmbxName <");
       
   257     return result;
       
   258 }
       
   259 
       
   260 // ---------------------------------------------------------------------------
       
   261 // CVoiceMailboxEntry::UsingMemoryLocation
       
   262 // Returns memory location of the entry instance
       
   263 // ---------------------------------------------------------------------------
       
   264 //
       
   265 EXPORT_C TVmbxMemoryLocation CVoiceMailboxEntry::UsingMemoryLocation( ) const
       
   266     {
       
   267     qDebug("DummyVoiceMailboxEntry::UsingMemoryLocation <>");
       
   268     return iUsingMemory;
       
   269     }
       
   270 
       
   271 // ---------------------------------------------------------------------------
       
   272 // CVoiceMailboxEntry::Reset
       
   273 // Reset the data members of the entry instance
       
   274 // ---------------------------------------------------------------------------
       
   275 //
       
   276 EXPORT_C void CVoiceMailboxEntry::Reset()
       
   277 {
       
   278     qDebug("DummyVoiceMailboxEntry::Reset >");
       
   279     iVmbxServiceId = KVmbxServiceIdNone;
       
   280     iVmbxType = EVmbxNone;
       
   281     iVmbxLineType = EVmbxAlsLineDefault;
       
   282     if (ivmbxNumber){
       
   283     	ivmbxNumber->Des().Zero();
       
   284     	qDebug("DummyVoiceMailboxEntry::Reset vmbx number");
       
   285     }
       
   286     if (ivmbxName){
       
   287     	ivmbxName->Des().Zero();
       
   288     	qDebug("DummyVoiceMailboxEntry::Reset vmbx name");
       
   289     }
       
   290     if (iVmbxBrandId){
       
   291     	iVmbxBrandId->Des().Zero();
       
   292     	qDebug("DummyVoiceMailboxEntry::Reset vmbx brandId");
       
   293     }
       
   294     iUsingMemory = EVmbxSimMemory;
       
   295     qDebug("DummyVoiceMailboxEntry::Reset <");
       
   296 }
       
   297 
       
   298 // ---------------------------------------------------------------------------
       
   299 // CVoiceMailboxEntry::SetUsingMemoryLocation
       
   300 // Set using memory of the entry instance
       
   301 // ---------------------------------------------------------------------------
       
   302 //
       
   303 void CVoiceMailboxEntry::SetUsingMemoryLocation( 
       
   304                                         const TVmbxMemoryLocation& aType  )
       
   305     {
       
   306     qDebug("DummyVoiceMailboxEntry::SetUsingMemoryLocation %d", aType);
       
   307     iUsingMemory = aType;
       
   308     }
       
   309 
       
   310 // ---------------------------------------------------------------------------
       
   311 // CVoiceMailboxEntry::CVoiceMailboxEntry
       
   312 // C++ default constructor can NOT contain any code, that
       
   313 // might leave.
       
   314 // ---------------------------------------------------------------------------
       
   315 //
       
   316 CVoiceMailboxEntry::CVoiceMailboxEntry()
       
   317     {
       
   318     qDebug("DummyVoiceMailboxEntry::CVoiceMailboxEntry <>");
       
   319     }
       
   320 
       
   321 // ---------------------------------------------------------------------------
       
   322 // CVoiceMailboxEntry::ConstructL
       
   323 // Symbian 2nd phase constructor can leave.
       
   324 // ---------------------------------------------------------------------------
       
   325 //
       
   326 void CVoiceMailboxEntry::ConstructL()
       
   327     {
       
   328     qDebug("DummyVoiceMailboxEntry::ConstructL <>");
       
   329     }
       
   330 
       
   331 // End of file