vmbx/vmbxengine/src/vmbxcsvideoengine.cpp
branchRCL_3
changeset 20 987c9837762f
parent 19 7d48bed6ce0c
child 21 0a6dd2dc9970
equal deleted inserted replaced
19:7d48bed6ce0c 20:987c9837762f
     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 CVmbxCsVideoEngine class
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 // INCLUDE FILES
       
    20 #include <cvoicemailboxentry.h>
       
    21 
       
    22 #include "vmbxuiutilities.h"
       
    23 #include "vmbxutilities.h"
       
    24 #include "vmbxenginebase.h"
       
    25 #include "vmbxlogger.h"
       
    26 #include "vmbxcenrephandler.h"
       
    27 #include "vmbxcsvideoengine.h"
       
    28 
       
    29 // ============================ MEMBER FUNCTIONS =============================
       
    30 
       
    31 // ---------------------------------------------------------------------------
       
    32 // CVmbxCsVideoEngine::CVmbxCsVideoEngine
       
    33 // C++ default constructor can NOT contain any code, that
       
    34 // might leave.
       
    35 // ---------------------------------------------------------------------------
       
    36 //
       
    37 CVmbxCsVideoEngine::CVmbxCsVideoEngine( MVmbxResourceProvider& aProvider )
       
    38                                 : CVmbxEngineBase( aProvider )
       
    39     {
       
    40     VMBLOGSTRING( "VMBX: CVmbxCsVideoEngine::CVmbxCsVideoEngine <=>" );
       
    41     }
       
    42 
       
    43 // ---------------------------------------------------------------------------
       
    44 // CVmbxCsVideoEngine::~CVmbxCsVideoEngine
       
    45 // Destructor.
       
    46 // ---------------------------------------------------------------------------
       
    47 //
       
    48 CVmbxCsVideoEngine::~CVmbxCsVideoEngine()
       
    49     {
       
    50     VMBLOGSTRING( "VMBX: CVmbxCsVideoEngine::~CVmbxCsVideoEngine <=>" );
       
    51     }
       
    52 
       
    53 // ---------------------------------------------------------------------------
       
    54 // CVmbxCsVideoEngine::NewL
       
    55 // Two-phased constructor.
       
    56 // ---------------------------------------------------------------------------
       
    57 //
       
    58 CVmbxCsVideoEngine* CVmbxCsVideoEngine::NewL( MVmbxResourceProvider& aProvider )
       
    59     {
       
    60     VMBLOGSTRING( "VMBX: CVmbxCsVideoEngine::NewL =>" );
       
    61     if ( !VmbxUtilities::VideoSupported() )
       
    62         {
       
    63         User::Leave( KErrNotSupported );
       
    64         }
       
    65 
       
    66     CVmbxCsVideoEngine* self = new( ELeave ) CVmbxCsVideoEngine( aProvider );
       
    67     CleanupStack::PushL( self );
       
    68     self->ConstructL();
       
    69     CleanupStack::Pop( self );
       
    70     VMBLOGSTRING( "VMBX: CVmbxCsVideoEngine::NewL <=" );
       
    71     return self;
       
    72     }
       
    73 
       
    74 // ---------------------------------------------------------------------------
       
    75 // CVmbxCsVideoEngine::ConstructL
       
    76 // Symbian 2nd phase constructor can leave.
       
    77 // ---------------------------------------------------------------------------
       
    78 //
       
    79 void CVmbxCsVideoEngine::ConstructL()
       
    80     {
       
    81     VMBLOGSTRING( "VMBX: CVmbxCsVideoEngine::ConstructL =>" );
       
    82     VMBLOGSTRING( "VMBX: CVmbxCsVideoEngine::ConstructL <=" );
       
    83     }
       
    84 
       
    85 // ---------------------------------------------------------------------------
       
    86 // CVmbxCsVideoEngine::GetL
       
    87 // Gets voice mailbox number
       
    88 // ---------------------------------------------------------------------------
       
    89 //
       
    90 void CVmbxCsVideoEngine::GetL( CVoiceMailboxEntry*& aEntry )
       
    91     {
       
    92     VMBLOGSTRING( "VMBX: CVmbxCsVideoEngine::GetL =>" );
       
    93     CVoiceMailboxEntry* vmbxEntry = CVoiceMailboxEntry::NewLC();
       
    94     // get number from store
       
    95     vmbxEntry->SetVoiceMailboxType( EVmbxVideo );
       
    96     vmbxEntry->SetUsingMemoryLocation( EVmbxPhoneMemory );
       
    97     vmbxEntry->SetVmbxAlsLineType( VmbxUtilities::AlsLine() );
       
    98     vmbxEntry->SetServiceId( KVmbxServiceVideo );
       
    99     TInt result = iProvider.VmbxCenRepHandler().GetVmbxNumber( *vmbxEntry );
       
   100 
       
   101     VMBLOGSTRING2( "VMBX: CVmbxCsVideoEngine::GetL: result=%I ", result );
       
   102     User::LeaveIfError( result );
       
   103     CleanupStack::Pop( vmbxEntry );
       
   104     aEntry = vmbxEntry;
       
   105     vmbxEntry = NULL;
       
   106     VMBLOGSTRING( "VMBX: CVmbxCsVideoEngine::GetL <=" );
       
   107     }
       
   108 
       
   109 // ---------------------------------------------------------------------------
       
   110 // CVmbxCsVideoEngine::SaveL
       
   111 // Saves voice mailbox number
       
   112 // ---------------------------------------------------------------------------
       
   113 //
       
   114 void CVmbxCsVideoEngine::SaveL( const CVoiceMailboxEntry& aEntry,
       
   115                                 TBool aShowNotesAllowed )
       
   116     {
       
   117     VMBLOGSTRING( "VMBX: CVmbxCsVideoEngine::SaveL =>" );
       
   118 
       
   119     TPtrC vmbxNumber( KNullDesC );
       
   120     aEntry.GetVmbxNumber( vmbxNumber );
       
   121 
       
   122     if ( vmbxNumber.Length() 
       
   123          && ( !VmbxUtilities::IsValidPhoneNumber( vmbxNumber )
       
   124          || VmbxUtilities::IsEmergencyNumber( vmbxNumber ) ) )
       
   125         {
       
   126         VMBLOGSTRING( "VMBX: CVmbxCsVideoEngine::SaveL: number invalid <=" );
       
   127         User::Leave( KErrArgument );
       
   128         }
       
   129 
       
   130     // Save to cenrep
       
   131     TInt result = iProvider.VmbxCenRepHandler().Save( aEntry );
       
   132     VMBLOGSTRING2( "VMBX: CVmbxCsVideoEngine::SaveL: result%I ", result );
       
   133     User::LeaveIfError( result );
       
   134 
       
   135     // show note
       
   136     if ( KErrNone == result && aShowNotesAllowed )
       
   137         {
       
   138         iProvider.VmbxUiUtilities().ShowInformationdNoteL( EVideoNumberSaved );
       
   139         }
       
   140 
       
   141     VMBLOGSTRING( "VMBX: CVmbxCsVideoEngine::SaveL <=" );
       
   142     }
       
   143 
       
   144 // ---------------------------------------------------------------------------
       
   145 // CVmbxCsVideoEngine::SaveL
       
   146 // Saves Provisioned video mailbox number
       
   147 // ---------------------------------------------------------------------------
       
   148 //
       
   149 void CVmbxCsVideoEngine::SaveProvisionedEntryL( 
       
   150                 const CVoiceMailboxEntry& aEntry )
       
   151     {
       
   152     VMBLOGSTRING( "VMBX: CVmbxCsVideoEngine::SaveProvisionedEntryL =>" );
       
   153     SaveL( aEntry, EFalse );
       
   154     VMBLOGSTRING( "VMBX: CVmbxCsVideoEngine::SaveProvisionedEntryL <=" );
       
   155     }
       
   156 
       
   157 // ----------------------------------------------------------------------------
       
   158 //  CVmbxCsVideoEngine::CheckConfiguration()
       
   159 // ----------------------------------------------------------------------------
       
   160 //
       
   161 TBool CVmbxCsVideoEngine::CheckConfiguration( 
       
   162             const TVoiceMailboxParams& aParams, const TInt aFlags )
       
   163     {
       
   164     VMBLOGSTRING( "VMBX: CVmbxCsVideoEngine::CheckConfiguration =>" );
       
   165     TBool conf( EFalse );
       
   166     if ( EVmbxChangeNbrAllowedOnUi & aFlags )
       
   167         {
       
   168         conf = iProvider.VmbxCenRepHandler().IsAllowedUserEdit();
       
   169         }
       
   170     else if ( EVmbxVideoMailboxSupported & aFlags )
       
   171         {
       
   172         conf = ETrue;
       
   173         }
       
   174     else
       
   175         {
       
   176         conf = CVmbxEngineBase::CheckConfiguration(aParams, aFlags);
       
   177         }
       
   178     VMBLOGSTRING2( "VMBX: CVmbxCsVideoEngine::CheckConfiguration: conf%I <=",
       
   179                  conf );
       
   180     return conf;
       
   181     }
       
   182 // End of file