mmshplugins/mmshwpadapterplugin/src/muswpitem.cpp
changeset 22 496ad160a278
equal deleted inserted replaced
15:ccd8e69b5392 22:496ad160a278
       
     1 /*
       
     2 * Copyright (c) 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:  project specification
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 // USER
       
    21 #include "muswpitem.h"
       
    22 #include "mussettings.h"
       
    23 #include "muslogger.h"
       
    24 
       
    25 _LIT( KMusWpCapabilityQueryParallel, "1" ); // (from w9017.txt)
       
    26 _LIT( KMusWpCapabilityQuerySequential, "2" ); // (from w9017.txt)
       
    27 
       
    28 _LIT( KMusWpActivationConditionAlways, "1" ); // (from w9017.txt)
       
    29 _LIT( KMusWpActivationConditionInHome, "2" ); // (from w9017.txt)
       
    30 _LIT( KMusWpActivationConditionNever, "3" ); // (from w9017.txt)
       
    31 
       
    32 // -----------------------------------------------------------------------------
       
    33 // Symbian two-phased constructor.
       
    34 // -----------------------------------------------------------------------------
       
    35 //
       
    36 CMusWpItem* CMusWpItem::NewL()
       
    37     {
       
    38     MUS_LOG( "mus: [MUSWP]  ->  CMusWpItem::NewL" )
       
    39     CMusWpItem* self = new( ELeave ) CMusWpItem;
       
    40     CleanupStack::PushL( self );
       
    41     self->ConstructL();
       
    42     CleanupStack::Pop( self );
       
    43     MUS_LOG( "mus: [MUSWP]  <- CMusWpItem::NewL" )
       
    44     return self;
       
    45     }
       
    46 
       
    47 
       
    48 // -----------------------------------------------------------------------------
       
    49 // Destructor.
       
    50 // -----------------------------------------------------------------------------
       
    51 //
       
    52 CMusWpItem::~CMusWpItem()
       
    53     {
       
    54     MUS_LOG( "mus: [MUSWP]  -> CMusWpItem::~CMusWpItem" )
       
    55  
       
    56     delete iProviderId;
       
    57     delete iName;
       
    58     delete iToAppRef;
       
    59  
       
    60     MUS_LOG( "mus: [MUSWP]  <- CMusWpItem::~CMusWpItem" )
       
    61     }
       
    62     
       
    63 
       
    64 // -----------------------------------------------------------------------------
       
    65 // 
       
    66 // -----------------------------------------------------------------------------
       
    67 //
       
    68 const TDesC& CMusWpItem::ProviderId() const
       
    69     {
       
    70     if ( iProviderId )
       
    71         {
       
    72         return *iProviderId;
       
    73         }
       
    74     
       
    75     return KNullDesC;
       
    76     }
       
    77     
       
    78 
       
    79 // -----------------------------------------------------------------------------
       
    80 // 
       
    81 // -----------------------------------------------------------------------------
       
    82 //
       
    83 void CMusWpItem::SetProviderIdL( const TDesC& aProviderId )
       
    84     {
       
    85     HBufC* newProviderId = aProviderId.AllocL();
       
    86     delete iProviderId;
       
    87     iProviderId = newProviderId;
       
    88     }
       
    89     
       
    90 
       
    91 // -----------------------------------------------------------------------------
       
    92 // 
       
    93 // -----------------------------------------------------------------------------
       
    94 //
       
    95 const TDesC& CMusWpItem::Name() const
       
    96     {
       
    97     if ( iName )
       
    98         {
       
    99         return *iName;
       
   100         }
       
   101     
       
   102     return KNullDesC;
       
   103     }
       
   104     
       
   105 
       
   106 // -----------------------------------------------------------------------------
       
   107 // 
       
   108 // -----------------------------------------------------------------------------
       
   109 //
       
   110 void CMusWpItem::SetNameL( const TDesC& aName)
       
   111     {
       
   112     HBufC* newName = aName.AllocL();
       
   113     delete iName;
       
   114     iName = newName;
       
   115     }
       
   116     
       
   117     
       
   118 // -----------------------------------------------------------------------------
       
   119 // 
       
   120 // -----------------------------------------------------------------------------
       
   121 //
       
   122 const TDesC& CMusWpItem::ToAppRef() const
       
   123     {
       
   124     if ( iToAppRef )
       
   125         {
       
   126         return *iToAppRef;
       
   127         }
       
   128     
       
   129     return KNullDesC;
       
   130     }
       
   131     
       
   132     
       
   133 // -----------------------------------------------------------------------------
       
   134 // 
       
   135 // -----------------------------------------------------------------------------
       
   136 //
       
   137 void CMusWpItem::SetToAppRefL( const TDesC& aToAppRef )
       
   138     {
       
   139     HBufC* newToAppRef = aToAppRef.AllocL();
       
   140     delete iToAppRef;
       
   141     iToAppRef = newToAppRef;
       
   142     }
       
   143    
       
   144 
       
   145 // -----------------------------------------------------------------------------
       
   146 // 
       
   147 // -----------------------------------------------------------------------------
       
   148 //
       
   149 void CMusWpItem::SetEdgeDtmSupport( TBool aEdgeDtmSupport )
       
   150     {
       
   151     if ( aEdgeDtmSupport )
       
   152         {
       
   153         iEdgeDtmSupport = MusSettingsKeys::EDtmModeAllowed;
       
   154         }
       
   155     else
       
   156         {
       
   157         iEdgeDtmSupport = MusSettingsKeys::EDtmModeNotAllowed;
       
   158         }
       
   159     }
       
   160   
       
   161 
       
   162 // -----------------------------------------------------------------------------
       
   163 // 
       
   164 // -----------------------------------------------------------------------------
       
   165 //
       
   166 void CMusWpItem::SetForceInternetSignaling( TBool aInternetSignaling )
       
   167     {
       
   168     if ( aInternetSignaling )
       
   169         {
       
   170         iForceInternetSignaling = MusSettingsKeys::EForceInternetSignaling;
       
   171         }
       
   172     else
       
   173         {
       
   174         iForceInternetSignaling = MusSettingsKeys::EFollowProfileConfiguration;
       
   175         }
       
   176     
       
   177     }
       
   178 
       
   179 
       
   180 // -----------------------------------------------------------------------------
       
   181 // 
       
   182 // -----------------------------------------------------------------------------
       
   183 //
       
   184 void CMusWpItem::SetCapabilityQuery( const TDesC& aValue )
       
   185     {
       
   186     if ( aValue == KMusWpCapabilityQueryParallel() )
       
   187         {    
       
   188         iCapabilityQuery = MusSettingsKeys::EParallel;   
       
   189         }
       
   190     else if ( aValue == KMusWpCapabilityQuerySequential() )
       
   191         {
       
   192         iCapabilityQuery = MusSettingsKeys::ESequential;
       
   193         }
       
   194     else
       
   195         {
       
   196         // To keep PC-Lint happy
       
   197         }
       
   198     }
       
   199     
       
   200         
       
   201 // -----------------------------------------------------------------------------
       
   202 // 
       
   203 // -----------------------------------------------------------------------------
       
   204 //
       
   205 void CMusWpItem::SetActivationCondition( const TDesC& aValue )
       
   206     {
       
   207     if ( aValue == KMusWpActivationConditionAlways() )
       
   208         {
       
   209         iActivationCondition = MusSettingsKeys::EAlwaysActive;
       
   210         }
       
   211     else if ( aValue == KMusWpActivationConditionInHome() )
       
   212         {
       
   213         iActivationCondition = MusSettingsKeys::EActiveInHomeNetworks;
       
   214         }
       
   215     else if ( aValue == KMusWpActivationConditionNever )
       
   216         {
       
   217         iActivationCondition = MusSettingsKeys::ENever;
       
   218         }
       
   219     else
       
   220         {
       
   221         // To keep PC-Lint happy
       
   222         }
       
   223     }
       
   224             
       
   225 
       
   226 // -----------------------------------------------------------------------------
       
   227 // 
       
   228 // -----------------------------------------------------------------------------
       
   229 //
       
   230 void CMusWpItem::SaveL()
       
   231     {
       
   232     MUS_LOG( "mus: [MUSWP]  -> CMusWpItem::SaveL" )
       
   233     
       
   234     // Uncomment next line to enable provisioning of EDGE / DTM setting
       
   235     // MultimediaSharingSettings::SetEdgeDtmSupportSettingL( iEdgeDtmSupport );
       
   236     MultimediaSharingSettings::SetForceInternetSignalingSettingL( 
       
   237                                                     iForceInternetSignaling );
       
   238     MultimediaSharingSettings::SetCapabilityQuerySettingL( iCapabilityQuery );
       
   239     MultimediaSharingSettings::SetActivationSettingL( iActivationCondition );
       
   240     
       
   241     MUS_LOG( "mus: [MUSWP]  <- CMusWpItem::SaveL" )
       
   242     }
       
   243 
       
   244 
       
   245 // -----------------------------------------------------------------------------
       
   246 // C++ default constructor
       
   247 // Default setting for activation is temporarily changed to EAlways
       
   248 // -----------------------------------------------------------------------------
       
   249 //
       
   250 CMusWpItem::CMusWpItem() 
       
   251     :iEdgeDtmSupport( MusSettingsKeys::EDtmModeNotAllowed ),
       
   252      iForceInternetSignaling( MusSettingsKeys::EFollowProfileConfiguration ),
       
   253      iCapabilityQuery( MusSettingsKeys::ENoOptions ),
       
   254      //iActivationCondition( MusSettingsKeys::EActiveInHomeNetworks )
       
   255      iActivationCondition( MusSettingsKeys::EAlwaysActive )
       
   256     {
       
   257     }
       
   258 
       
   259 
       
   260 // -----------------------------------------------------------------------------
       
   261 // Symbian 2nd phase constructor
       
   262 // -----------------------------------------------------------------------------
       
   263 //
       
   264 void CMusWpItem::ConstructL()
       
   265     {
       
   266     }
       
   267 
       
   268 
       
   269 
       
   270 
       
   271 
       
   272