mobilemessaging/audiomsg/uisrc/audiomessageuidata.cpp
changeset 0 72b543305e3a
equal deleted inserted replaced
-1:000000000000 0:72b543305e3a
       
     1 /*
       
     2 * Copyright (c) 2005-2006 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:   Provides AudioMessageui data methods. 
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 #include <mtclbase.h>
       
    21 #include <eikon.rsg>
       
    22 #include <data_caging_path_literals.hrh> 
       
    23 #include <coemain.h>
       
    24 #include <AknsUtils.h>
       
    25 #include <AknsConstants.h>
       
    26 #include <fbs.h>
       
    27 #include <mtmuids.h>
       
    28 #include <msvids.h>
       
    29 #include <msvuids.h>
       
    30 #include <mtmuidef.hrh>
       
    31 #include <avkon.rsg>
       
    32 #include <featmgr.h>
       
    33 
       
    34 #include <audiomessagemtm.rsg>
       
    35 #include "audiomessageuidata.h"
       
    36 
       
    37 _LIT(KAMSUiResourceFile, "AudioMessageMtm");
       
    38 
       
    39 // ======== LOCAL FUNCTIONS ========
       
    40 
       
    41 // ---------------------------------------------------------------------------
       
    42 // Factory function
       
    43 // ---------------------------------------------------------------------------
       
    44 //
       
    45 EXPORT_C CBaseMtmUiData* NewAudiomessageUiDataL( CRegisteredMtmDll& aRegisteredDll )
       
    46     {
       
    47     FeatureManager::InitializeLibL();
       
    48     if ( !FeatureManager::FeatureSupported( KFeatureIdAudioMessaging ) )
       
    49         {
       
    50         FeatureManager::UnInitializeLib();
       
    51         User::Leave( KErrNotSupported );
       
    52         }
       
    53     FeatureManager::UnInitializeLib();
       
    54     
       
    55     return CAudioMessageUiData::NewL( aRegisteredDll );
       
    56     }
       
    57 
       
    58 
       
    59 // ======== MEMBER FUNCTIONS ========
       
    60 
       
    61 CAudioMessageUiData::CAudioMessageUiData( CRegisteredMtmDll& aRegisteredDll )
       
    62     :   CBaseMtmUiData( aRegisteredDll )
       
    63     {
       
    64     }
       
    65 
       
    66 void CAudioMessageUiData::ConstructL()
       
    67     {
       
    68     CBaseMtmUiData::ConstructL();
       
    69     }
       
    70 
       
    71 CAudioMessageUiData* CAudioMessageUiData::NewL( CRegisteredMtmDll& aRegisteredDll )
       
    72     {
       
    73     CAudioMessageUiData* self = new ( ELeave ) CAudioMessageUiData( aRegisteredDll );
       
    74     
       
    75     CleanupStack::PushL( self );
       
    76     self->ConstructL();
       
    77     CleanupStack::Pop(); //self
       
    78 
       
    79     return self;
       
    80     }
       
    81 
       
    82 CAudioMessageUiData::~CAudioMessageUiData()
       
    83     {
       
    84     }
       
    85 
       
    86 TInt CAudioMessageUiData::OperationSupportedL(
       
    87     TInt aFunctionId,
       
    88     const TMsvEntry& aContext ) const
       
    89     {
       
    90     // Only Message Info for messages is a supported operation
       
    91     if ( ( aFunctionId == KMtmUiFunctionMessageInfo ) &&
       
    92         ( aContext.iType == KUidMsvMessageEntry ) )
       
    93         {
       
    94         return 0;
       
    95         }
       
    96 
       
    97     return R_EIK_TBUF_NOT_AVAILABLE;
       
    98     }
       
    99 
       
   100 // ---------------------------------------------------------------------------
       
   101 // The default UI capability checker (UI MTM may have also minimal
       
   102 // UI specific checks also)
       
   103 // ---------------------------------------------------------------------------
       
   104 //
       
   105 TInt CAudioMessageUiData::QueryCapability(
       
   106     TUid aFunctionId,
       
   107     TInt& aResponse ) const
       
   108     {
       
   109     TInt error = KErrNone;
       
   110 
       
   111     switch ( aFunctionId.iUid )
       
   112         {
       
   113         // Supported:
       
   114         case KUidMtmQueryMaxTotalMsgSizeValue:
       
   115             aResponse = KMaxTInt;
       
   116         case KUidMtmQueryCanSendMsgValue:
       
   117         case KUidMtmQueryCanCreateNewMsgValue:
       
   118         case KUidMsvMtmQueryMessageInfo:
       
   119             break;
       
   120 
       
   121         case KUidMsvMtmQuerySupportEditor:
       
   122         case KUidMtmQuerySupportAttachmentsValue: // For SendUi
       
   123             aResponse = ETrue;
       
   124             break;
       
   125         default:
       
   126             error = KErrNotSupported;
       
   127         }
       
   128     return error;   
       
   129     }
       
   130 
       
   131 // ---------------------------------------------------------------------------
       
   132 // Returns the array of icons relevant to given entry
       
   133 // ---------------------------------------------------------------------------
       
   134 //
       
   135 const CBaseMtmUiData::CBitmapArray& CAudioMessageUiData::ContextIcon(
       
   136     const TMsvEntry& /*aContext*/,
       
   137     TInt /*aStateFlags*/ ) const
       
   138     {
       
   139     CArrayPtrFlat<CFbsBitmap>* array (NULL); 
       
   140     TRAP_IGNORE( array = new (ELeave) CArrayPtrFlat<CFbsBitmap>( 0 ) );
       
   141     return *array;
       
   142     }
       
   143 
       
   144 TBool CAudioMessageUiData::CanCreateEntryL(
       
   145     const TMsvEntry& /*aParent*/,
       
   146     TMsvEntry& /*aNewEntry*/,
       
   147     TInt& aReasonResourceId ) const
       
   148     {
       
   149     aReasonResourceId = R_EIK_TBUF_NOT_AVAILABLE;
       
   150     return EFalse;
       
   151     }
       
   152 
       
   153 TBool CAudioMessageUiData::CanOpenEntryL(
       
   154     const TMsvEntry& /*aContext*/,
       
   155     TInt& aReasonResourceId ) const
       
   156     {
       
   157     aReasonResourceId = R_EIK_TBUF_NOT_AVAILABLE;
       
   158     return EFalse;
       
   159     }
       
   160 
       
   161 TBool CAudioMessageUiData::CanCloseEntryL(
       
   162     const TMsvEntry& /*aContext*/,
       
   163     TInt& aReasonResourceId ) const
       
   164     {
       
   165     aReasonResourceId=R_EIK_TBUF_NOT_AVAILABLE;
       
   166     return EFalse;
       
   167     }
       
   168 
       
   169 TBool CAudioMessageUiData::CanViewEntryL(
       
   170     const TMsvEntry& /*aContext*/,
       
   171     TInt& aReasonResourceId ) const
       
   172     {
       
   173     aReasonResourceId = R_EIK_TBUF_NOT_AVAILABLE;
       
   174     return EFalse;
       
   175     }
       
   176 
       
   177 TBool CAudioMessageUiData::CanEditEntryL(
       
   178     const TMsvEntry& /*aContext*/,
       
   179     TInt& aReasonResourceId ) const
       
   180     {
       
   181     aReasonResourceId = R_EIK_TBUF_NOT_AVAILABLE;
       
   182     return EFalse;
       
   183     }
       
   184 
       
   185 TBool CAudioMessageUiData::CanDeleteFromEntryL(
       
   186     const TMsvEntry& /*aContext*/,
       
   187     TInt& aReasonResourceId ) const
       
   188     {
       
   189     aReasonResourceId = R_EIK_TBUF_NOT_AVAILABLE;
       
   190     return EFalse;
       
   191     }
       
   192 
       
   193 TBool CAudioMessageUiData::CanDeleteServiceL(
       
   194     const TMsvEntry& /*aService*/,
       
   195     TInt& aReasonResourceId ) const
       
   196     {
       
   197     aReasonResourceId = R_EIK_TBUF_NOT_AVAILABLE;
       
   198     return EFalse;
       
   199     }
       
   200 
       
   201 TBool CAudioMessageUiData::CanCopyMoveToEntryL(
       
   202     const TMsvEntry& /*aContext*/,
       
   203     TInt& aReasonResourceId ) const
       
   204     {
       
   205     aReasonResourceId = R_EIK_TBUF_NOT_AVAILABLE;
       
   206     return EFalse;
       
   207     }
       
   208 
       
   209 TBool CAudioMessageUiData::CanCopyMoveFromEntryL(
       
   210     const TMsvEntry& /*aContext*/,
       
   211     TInt& aReasonResourceId ) const
       
   212     {
       
   213     aReasonResourceId = R_EIK_TBUF_NOT_AVAILABLE;
       
   214     return EFalse;
       
   215     }
       
   216 
       
   217 TBool CAudioMessageUiData::CanReplyToEntryL(
       
   218     const TMsvEntry& /*aContext*/,
       
   219     TInt& aReasonResourceId ) const
       
   220     {
       
   221     aReasonResourceId = R_EIK_TBUF_NOT_AVAILABLE;
       
   222     return EFalse;
       
   223     }
       
   224 
       
   225 TBool CAudioMessageUiData::CanForwardEntryL(
       
   226     const TMsvEntry& /*aContext*/,
       
   227     TInt& aReasonResourceId ) const
       
   228     {
       
   229     aReasonResourceId = R_EIK_TBUF_NOT_AVAILABLE;
       
   230     return EFalse;
       
   231     }
       
   232 
       
   233 TBool CAudioMessageUiData::CanCancelL(
       
   234     const TMsvEntry& /*aContext*/,
       
   235     TInt& aReasonResourceId ) const
       
   236     {
       
   237     aReasonResourceId = R_EIK_TBUF_NOT_AVAILABLE;
       
   238     return EFalse;
       
   239     }
       
   240 
       
   241 // ---------------------------------------------------------------------------
       
   242 // Shows the text in outbox
       
   243 // ---------------------------------------------------------------------------
       
   244 //
       
   245 HBufC* CAudioMessageUiData::StatusTextL( const TMsvEntry& /*aContext*/ ) const
       
   246     {
       
   247     return HBufC::NewL( 0 );
       
   248     }
       
   249 
       
   250 void CAudioMessageUiData::PopulateArraysL( )
       
   251     {
       
   252     ReadFunctionsFromResourceFileL( R_AMS_MTM_FUNCTION_ARRAY );    
       
   253     }
       
   254 
       
   255 void CAudioMessageUiData::GetResourceFileName( TFileName& aFileName ) const
       
   256     {
       
   257     aFileName = KAMSUiResourceFile; 
       
   258     }
       
   259