mobilemessaging/smum/src/SmumUtilCDMA.cpp
changeset 0 72b543305e3a
equal deleted inserted replaced
-1:000000000000 0:72b543305e3a
       
     1 /*
       
     2 * Copyright (c) 2002 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:  
       
    15 *       Finds default name for Service Centre and adds ordinal
       
    16 *       number in the end if it is needed.
       
    17 *
       
    18 */
       
    19 
       
    20 
       
    21 
       
    22 // INCLUDE FILES
       
    23 #include <coemain.h>                    // CCoeEnv::Static()
       
    24 #include <smum.rsg>                     // resource identifiers
       
    25 #include <stringresourcereader.h>       // CStringResourceReader
       
    26 #include <StringLoader.h>               // StringLoader
       
    27 #include <aknnotewrappers.h>            // CAknInformationNote
       
    28 #include "SmumUtil.h"                   // SmumUtil
       
    29 #include "SmumLogging.h"
       
    30 #include "smsui.pan"                    // Panic codes
       
    31 #include <data_caging_path_literals.hrh>
       
    32 #include <CentralRepository.h>          // CRepository
       
    33 #include <MessagingInternalCRKeys.h>    // Keys
       
    34 
       
    35 // CONSTANTS
       
    36 _LIT(KFmtSpec, "%S(%02d)");
       
    37 _LIT(KSmumResourceFileName, "smum.rsc");
       
    38 const TInt KTestStringLength = 100;
       
    39 
       
    40 // ----------------------------------------------------
       
    41 // FindDefaultNameL
       
    42 // Finds default name for Service Centre and adds ordinal
       
    43 // number in the end if it is needed.
       
    44 // ----------------------------------------------------
       
    45 EXPORT_C void SmumUtil::FindDefaultNameForSCL(
       
    46     TDes& aName,
       
    47     TBool aNameIsForSCentreFromSIM,
       
    48     CDesCArrayFlat* /*aSCNamesList*/)
       
    49     { 
       
    50     // Parse the filename
       
    51     TFileName myFileName;
       
    52     TParse tp;
       
    53     tp.Set( KSmumResourceFileName, &KDC_MTM_RESOURCE_DIR, NULL );
       
    54     myFileName.Copy( tp.FullName() );
       
    55 
       
    56     // Initialise string resource reader
       
    57     CStringResourceReader* reader = CStringResourceReader::NewLC( myFileName );
       
    58  
       
    59     // Load default name without ordinals
       
    60     HBufC* buf = reader->ReadResourceString( aNameIsForSCentreFromSIM ? 
       
    61         R_QTN_MCE_SETTINGS_SIM_CENTRE : R_QTN_MCE_SETTINGS_SMS_SC_D_NAME ).AllocLC();
       
    62 
       
    63     TInt nameMaxLength = aName.MaxLength();
       
    64     if ( nameMaxLength < buf->Length())
       
    65         {
       
    66         User::Leave(KErrOverflow);
       
    67         }
       
    68     aName.Append(buf->Des());
       
    69 
       
    70     CleanupStack::PopAndDestroy( 2 ); // buf, reader 
       
    71     }
       
    72 
       
    73 // ----------------------------------------------------
       
    74 // SmumUtil::::ShowInformationNoteL
       
    75 //
       
    76 // ----------------------------------------------------
       
    77 void SmumUtil::ShowInformationNoteL( TInt aResource )
       
    78     {
       
    79     CCoeEnv* coeEnv = CEikonEnv::Static();
       
    80     __ASSERT_DEBUG( coeEnv, Panic( ESmumUtilNullPointer ) );
       
    81     if ( !coeEnv )
       
    82         {
       
    83         User::Leave( KErrGeneral );        
       
    84         }
       
    85     HBufC* text = StringLoader::LoadLC( aResource, coeEnv );
       
    86     CAknInformationNote* note = new ( ELeave ) CAknInformationNote( ETrue );
       
    87     note->ExecuteLD( *text );
       
    88     CleanupStack::PopAndDestroy(); // text
       
    89     }
       
    90     
       
    91 // ----------------------------------------------------------------------------
       
    92 // SmumUtil::CheckVariationFlagsL()
       
    93 // Function to check and set variation according to 
       
    94 // flags set in Central Repository
       
    95 // ----------------------------------------------------------------------------
       
    96 TInt SmumUtil::CheckVariationFlagsL( const TUid aUid, const TUint32 aKey )
       
    97     {
       
    98     TInt flags = KErrNotFound;
       
    99     // Create storage
       
   100     CRepository* storage = CRepository::NewLC( aUid );
       
   101     TInt error = storage->Get( aKey, flags ); 
       
   102     // Leave on error
       
   103     User::LeaveIfError( error );
       
   104     CleanupStack::PopAndDestroy(); // storage
       
   105     return flags;
       
   106     }    
       
   107 
       
   108 // ----------------------------------------------------
       
   109 // SmumUtil::ReadEmailOverSmsSettingsL
       
   110 // ----------------------------------------------------
       
   111 //
       
   112 EXPORT_C TInt SmumUtil::ReadEmailOverSmsSettingsL( 
       
   113     TDes& /*aSmsc*/, 
       
   114     TDes& /*aDestinationAddress*/,
       
   115     TBool& /*aModifiable*/ )
       
   116     {
       
   117     SMUMLOGGER_ENTERFN("SmumUtil::ReadEmailOverSmsSettingsL")
       
   118     SMUMLOGGER_LEAVEFN("SmumUtil::ReadEmailOverSmsSettingsL")
       
   119     return KErrNone;
       
   120     }
       
   121 
       
   122 // ----------------------------------------------------
       
   123 // SmumUtil::WriteEmailOverSmsSettingsL
       
   124 // ----------------------------------------------------
       
   125 //
       
   126 EXPORT_C TInt SmumUtil::WriteEmailOverSmsSettingsL( 
       
   127     const TDes& /*aSmsc*/, 
       
   128     const TDes& /*aDestinationAddress*/,
       
   129     const TBool& /*aModifiable*/ )
       
   130     {
       
   131     SMUMLOGGER_ENTERFN("SmumUtil::WriteEmailOverSmsSettingsL")
       
   132     SMUMLOGGER_LEAVEFN("SmumUtil::WriteEmailOverSmsSettingsL")
       
   133     return KErrNone;
       
   134     }
       
   135 
       
   136 // ----------------------------------------------------
       
   137 // SmumUtil::CheckEmailOverSmsSupportL
       
   138 //
       
   139 // ----------------------------------------------------
       
   140 EXPORT_C TBool SmumUtil::CheckEmailOverSmsSupportL()
       
   141     {
       
   142     SMUMLOGGER_ENTERFN("SmumUtil::CheckEmailOverSmsSupportL")
       
   143     SMUMLOGGER_LEAVEFN("SmumUtil::CheckEmailOverSmsSupportL")
       
   144     return EFalse;
       
   145     }
       
   146 
       
   147 // ---------------------------------------------------------------------------
       
   148 // SmumUtil::ReadEmailSupportFromVASL
       
   149 // 
       
   150 // ---------------------------------------------------------------------------
       
   151 TBool SmumUtil::ReadEmailSupportFromVASL()
       
   152     {
       
   153     SMUMLOGGER_ENTERFN("CSmumMainSettingsDialogGSM::ReadEmailSupportFromVASL")
       
   154     SMUMLOGGER_LEAVEFN("CSmumMainSettingsDialogGSM::ReadEmailSupportFromVASL")
       
   155     return EFalse;
       
   156     }
       
   157 
       
   158 //  End of File