src/profilesmodel_p_symbian.cpp
changeset 0 dc71378f4890
equal deleted inserted replaced
-1:000000000000 0:dc71378f4890
       
     1 /*
       
     2 * Copyright (c) 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: Profiles widget plugin.
       
    15 *
       
    16 */
       
    17 
       
    18 // System includes
       
    19 #include <e32base.h>
       
    20 #include <MProfileEngineExtended.h>
       
    21 #include <xqconversions.h>
       
    22 #include <mprofilename.h>
       
    23 #include <mprofile.h>
       
    24 
       
    25 // User includes
       
    26 #include "profilesmodel_p.h"
       
    27 #include "profileswidgetconsts.h"
       
    28 
       
    29 /*!
       
    30     \class ProfilesModelPrivate
       
    31     \profiles widget model class
       
    32 
       
    33     This class is used to create profiles widget model
       
    34 */
       
    35 
       
    36 // ======== MEMBER FUNCTIONS ========
       
    37 
       
    38 /*!
       
    39    NewL
       
    40 */
       
    41 ProfilesModelPrivate* ProfilesModelPrivate::NewL()
       
    42 {
       
    43 	ProfilesModelPrivate *self = new (ELeave)ProfilesModelPrivate();
       
    44     CleanupStack::PushL(self);
       
    45     self->ConstructL();
       
    46     CleanupStack::Pop(); //self
       
    47     return self;
       
    48 }
       
    49 
       
    50 /*!
       
    51    Constructor
       
    52 */
       
    53 ProfilesModelPrivate::ProfilesModelPrivate()
       
    54 {
       
    55     mEngine = NULL;
       
    56 }
       
    57 
       
    58 /*!
       
    59    ConstructL
       
    60 */
       
    61 void ProfilesModelPrivate::ConstructL()
       
    62 {
       
    63     mEngine = CreateProfileEngineExtendedL();
       
    64 }
       
    65 
       
    66 /*!
       
    67    Destroyer
       
    68 */
       
    69 ProfilesModelPrivate::~ProfilesModelPrivate()
       
    70 {
       
    71     mEngine->Release();
       
    72 }
       
    73 
       
    74 /*!
       
    75    Get the actived profile ID
       
    76 */
       
    77 int ProfilesModelPrivate::activeProfileId()
       
    78 {
       
    79     return mEngine->ActiveProfileId();
       
    80 }
       
    81 
       
    82 /*!
       
    83    Set active profile to specified ID
       
    84 */
       
    85 int ProfilesModelPrivate::activateProfile(int profileId)
       
    86 {
       
    87     TRAPD(err, mEngine->SetActiveProfileL(profileId));
       
    88     return err;
       
    89 }
       
    90 
       
    91 /*!
       
    92    Get actived profile name
       
    93 */
       
    94 QString ProfilesModelPrivate::activeProfileName()
       
    95 {
       
    96     MProfile *lProfile = mEngine->ActiveProfileL();
       
    97     CleanupReleasePushL(*lProfile);
       
    98      
       
    99     const MProfileName &lMProfileName = lProfile->ProfileName();
       
   100     TBuf<10> lProfileName = lMProfileName.Name();
       
   101     CleanupStack::PopAndDestroy();
       
   102     QString profileName = XQConversions::s60DescToQString(lProfileName);
       
   103     return profileName;
       
   104 }