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