deviceupdatesui/deviceupdates/src/dminforetrieval.cpp
branchRCL_3
changeset 57 6757f1e2efd2
equal deleted inserted replaced
55:c4687ff85147 57:6757f1e2efd2
       
     1 /*
       
     2 * Copyright (c) 2002-2005 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 methods for DmInfo class. 
       
    15 *
       
    16 */
       
    17 
       
    18 #include <centralrepository.h>
       
    19 #include <cmmanager.h>
       
    20 #include <cmconnectionmethod.h>
       
    21 #include "dmadvancedview.h"
       
    22 #include "nsmldmsyncprivatecrkeys.h"
       
    23 #include "dminforetrieval.h"
       
    24 
       
    25 DmInfo::DmInfo(DmAdvancedView* serversview, QGraphicsItem* /*parent*/)
       
    26     {
       
    27     iAppEngine = CNSmlDMSyncAppEngine::NewL(this);
       
    28     iSyncProfileList = CNSmlDMSyncProfileList::NewL( iAppEngine );
       
    29     iProfileList = new (ELeave) CArrayFixFlat< TNSmlDMProfileItem >(1);
       
    30     iDbNotifier = CNSmlDMDbNotifier::NewL( iAppEngine->Session(), this );
       
    31     iDbNotifier->RequestL();
       
    32     serversView = serversview;
       
    33     iDbEventsBlocked = EFalse;
       
    34     }
       
    35 
       
    36 DmInfo::~DmInfo()
       
    37     {
       
    38     delete iProfileList;
       
    39     delete iSyncProfileList;
       
    40     delete iAppEngine;
       
    41     delete iDbNotifier;
       
    42     }
       
    43 
       
    44 void DmInfo::refreshProfileList(TBool aIncludeHidden )
       
    45     {    
       
    46     FLOG( "[OMADM] DmInfo::refreshProfileList" );
       
    47     iProfileList->Reset();
       
    48     TKeyArrayFix key(_FOFF( TNSmlDMProfileItem, iProfileName ), ECmpFolded16 );
       
    49     iProfileList->Sort(key);
       
    50     iSyncProfileList->Reset();
       
    51     TRAPD( error, iSyncProfileList->ReadProfileItemsL( aIncludeHidden ) );
       
    52     if ( error != KErrNone )
       
    53         {
       
    54         iSyncProfileList->Reset();
       
    55         }
       
    56 
       
    57     //read profile values
       
    58     for ( TInt index = 0; index < iSyncProfileList->Count(); index++ )
       
    59         {
       
    60         TNSmlDMProfileItem profile;
       
    61         profile.iProfileName = iSyncProfileList->Item( index ).iProfileName;
       
    62         if ( profile.iProfileName.Length() == 0 )
       
    63             {
       
    64             //StringLoader::Load( profile.iProfileName, R_QTN_APPS_EMPTYPROFILE );
       
    65             TBuf<20> noname(_L("No NAME"));
       
    66             profile.iProfileName = noname;
       
    67             }       
       
    68         profile.iProfileId   = iSyncProfileList->Item( index ).iProfileId;
       
    69         profile.iBearer      = iSyncProfileList->Item( index ).iBearer;
       
    70         profile.iSynced      = iSyncProfileList->Item( index ).iSynced;
       
    71         profile.iLastSync    = iSyncProfileList->Item( index ).iLastSync;
       
    72         profile.iLastSuccessSync     = iSyncProfileList->Item( index ).iLastSuccessSync;
       
    73         profile.iActive      = iSyncProfileList->Item( index ).iActive;
       
    74         profile.iDeleteAllowed =  iSyncProfileList->Item( index ).iDeleteAllowed;
       
    75         profile.iProfileLocked =  iSyncProfileList->Item( index ).iProfileLocked;    
       
    76         TInt start = 0;
       
    77         TBool found( EFalse );    
       
    78         if ( iProfileList->Count() == 0 )
       
    79             {
       
    80             iProfileList->AppendL ( profile );      
       
    81             }
       
    82         else
       
    83             {
       
    84             while ( ( start < iProfileList->Count() ) && ( !found ) )
       
    85                 {
       
    86             if ( iAppEngine->Compare( profile.iProfileName,
       
    87                     iProfileList->At( start ).iProfileName ) < 1 )
       
    88                 {
       
    89                 iProfileList->InsertL( start, profile );
       
    90                 found = ETrue;
       
    91                 }
       
    92             start++;
       
    93                 }
       
    94             if ( !found ) //insert to the end of the list
       
    95                 {
       
    96                 iProfileList->AppendL( profile );
       
    97                 }
       
    98             }
       
    99         }
       
   100         FLOG( "[OMADM] CNSmlDMSyncDocument::ReadProfileListL() completed" );
       
   101      }
       
   102   
       
   103 int DmInfo::profilescount()
       
   104     {
       
   105     return iProfileList->Count();
       
   106     }
       
   107     
       
   108 int DmInfo::profileinfo(int profilelistnum, QStringList& itemtext, int& icon, bool& lock)
       
   109     {
       
   110     //TNSmlDMProfileItem* item = ProfileItemAt(profilelistnum);
       
   111     TBuf<KNSmlMaxTextLength256> text;
       
   112     TBuf<KNSmlMaxTextLength64>  timeString; 
       
   113     TBuf<KNSmlMaxTextLength64>  dateString; 
       
   114     HBufC* timeFormatted;
       
   115 
       
   116     TBool settingEnforcement = TUtil::SettingEnforcementState();
       
   117     TBool btObex = FeatureManager::FeatureSupported(KFeatureIdSyncMlDmObex);
       
   118 
       
   119     if(profilelistnum >= 0 && iProfileList->Count() > 0)
       
   120         {
       
   121         
       
   122         QString text = QString::fromUtf16(iProfileList->At( profilelistnum ).iProfileName.Ptr(), 
       
   123                 iProfileList->At( profilelistnum ).iProfileName.Length());
       
   124         itemtext << text ;
       
   125         if(iProfileList->At( profilelistnum ).iSynced)
       
   126             {            
       
   127             timeFormatted = TUtil::SyncTimeLC( ( iProfileList->At( profilelistnum ).iLastSuccessSync ));
       
   128             QString time = QString::fromUtf16(timeFormatted->Ptr(), 
       
   129                     timeFormatted->Length());
       
   130             itemtext << time ;
       
   131             CleanupStack::PopAndDestroy(1);
       
   132             }
       
   133         else
       
   134             {
       
   135             itemtext << hbTrId("txt_device_update_dblist_server_view_l2"); 
       
   136             }
       
   137         if ( ( iProfileList->At( profilelistnum ).iBearer == EProfileInternet ))
       
   138                     {                    
       
   139                     icon = 0;
       
   140                     }
       
   141         else 
       
   142             {
       
   143         //Bluetooth 
       
   144         icon = 1;        
       
   145             }
       
   146         
       
   147         TInt id = DefaultFotaProfileIdL();
       
   148         if( id == iProfileList->At( profilelistnum ).iProfileId)
       
   149             {
       
   150         //Check default or not
       
   151         //If default icon = 3;
       
   152         icon = 2 ;
       
   153             }   
       
   154         
       
   155         if(settingEnforcement || ( iProfileList->At( profilelistnum ).iProfileLocked))
       
   156             {
       
   157             lock = true;
       
   158             }
       
   159         return 1;
       
   160         }
       
   161     else
       
   162         return 0;
       
   163     }
       
   164 
       
   165 // -----------------------------------------------------------------------------
       
   166 // DmInfo::DefaultFotaProfileIdL
       
   167 // -----------------------------------------------------------------------------
       
   168 //
       
   169 TInt DmInfo::DefaultFotaProfileIdL() const
       
   170     {
       
   171     FLOG( "[OMADM] CNSmlDMFotaModel::DefaultFotaProfileIdL()" );
       
   172     TInt profileId( KErrNotFound );
       
   173     CRepository* centrep = NULL;
       
   174     TRAPD( err, centrep = CRepository::NewL( KCRUidNSmlDMSyncApp ) );
       
   175     FTRACE( FPrint( _L(
       
   176         "[OMADM] CNSmlDMFotaModel::DefaultFotaProfileIdL(), opening cenrep returned %d" ),
       
   177         err ) );
       
   178     User::LeaveIfError( err );
       
   179     centrep->Get( KNSmlDMDefaultFotaProfileKey, profileId );
       
   180     delete centrep;    
       
   181     FTRACE( FPrint( _L(
       
   182         "[OMADM] CNSmlDMFotaModel::DefaultFotaProfileIdL() completed, profileId = %d" ),
       
   183         profileId ) );
       
   184     return profileId;
       
   185     }
       
   186 
       
   187 // -----------------------------------------------------------------------------
       
   188 // DmInfo::SetDefaultFotaProfileIdL
       
   189 // -----------------------------------------------------------------------------
       
   190 //
       
   191 void DmInfo::SetDefaultFotaProfileIdL( const TInt aProfileId )
       
   192     {
       
   193     FLOG( "[OMADM] CNSmlDMFotaModel::SetDefaultFotaProfileIdL()" );
       
   194     
       
   195     CRepository* centrep = NULL;
       
   196     TRAPD( err, centrep = CRepository::NewL( KCRUidNSmlDMSyncApp ) );
       
   197     FTRACE( FPrint( _L(
       
   198         "[OMADM] CNSmlDMFotaModel::SetDefaultFotaProfileIdL(), opening cenrep returned %d" ),
       
   199         err ) );
       
   200 
       
   201     User::LeaveIfError( err );
       
   202     centrep->Set( KNSmlDMDefaultFotaProfileKey, aProfileId );
       
   203     delete centrep;
       
   204     
       
   205     FLOG( "[OMADM] CNSmlDMFotaModel::SetDefaultFotaProfileIdL() completed" );
       
   206     }
       
   207 
       
   208 void DmInfo::setDefaultProfile(int listitem)
       
   209     {
       
   210     if(listitem >= 0&& listitem < profilescount())
       
   211         {
       
   212         SetDefaultFotaProfileIdL(iProfileList->At( listitem ).iProfileId);
       
   213         FLOG( "[OMADM] default profile set done" );
       
   214         }
       
   215     else
       
   216         {
       
   217         FLOG( "[OMADM] Invalid list item" );
       
   218         }
       
   219     }
       
   220 
       
   221 bool DmInfo::Isprofilelocked(int profilelistnum)
       
   222     {
       
   223     bool lock = false;
       
   224     if(profilelistnum >= 0 && iProfileList->Count() > 0)
       
   225         {
       
   226         TBool settingEnforcement = TUtil::SettingEnforcementState();
       
   227         if(settingEnforcement || ( iProfileList->At( profilelistnum ).iProfileLocked))
       
   228             {
       
   229             lock = true;
       
   230             }                  
       
   231         }
       
   232     return lock;
       
   233     }
       
   234 
       
   235 
       
   236 bool DmInfo::Isdefaultprofile(int profilelistnum)
       
   237     {
       
   238     bool defaultprofile = false;
       
   239     if(profilelistnum >= 0 && iProfileList->Count() > 0)
       
   240            {
       
   241             TInt id = DefaultFotaProfileIdL();
       
   242             if( id == iProfileList->At( profilelistnum ).iProfileId)
       
   243                 {
       
   244                 defaultprofile = true;            
       
   245                 }  
       
   246            }
       
   247     return defaultprofile;
       
   248     }
       
   249 
       
   250 bool DmInfo::isProfileDeleteAllowed(int profilelistnum)
       
   251     {
       
   252     bool deleteAllowed = false;
       
   253     if(profilelistnum >= 0 && iProfileList->Count() > 0)
       
   254         {        
       
   255         if(( iProfileList->At( profilelistnum ).iDeleteAllowed))
       
   256             {
       
   257         deleteAllowed = true;
       
   258             }                  
       
   259         }
       
   260     return deleteAllowed;
       
   261     }
       
   262 
       
   263 void DmInfo::profileTransport(int profilelistnum, int& transport)
       
   264     {
       
   265     if(profilelistnum >= 0 && profilelistnum < profilescount())
       
   266             {
       
   267     if ( ( iProfileList->At( profilelistnum ).iBearer == EProfileInternet ))
       
   268                        {                    
       
   269     transport = 0;
       
   270     FLOG( "[OMADM] DmInfo::profileTransport Internet" );
       
   271                        }
       
   272     else
       
   273         {
       
   274     transport = 1;
       
   275     FLOG( "[OMADM] DmInfo::profileTransport Bluetooth" );
       
   276         }
       
   277             FLOG( "[OMADM] DmInfo::profileTransport set done" );
       
   278             }
       
   279         else
       
   280             {
       
   281             FLOG( "[OMADM] Invalid list item" );
       
   282             }
       
   283     }
       
   284 
       
   285 // -----------------------------------------------------------------------------
       
   286 // CNSmlDMSyncDocument::DeleteProfile
       
   287 // -----------------------------------------------------------------------------
       
   288 //
       
   289 TInt DmInfo::DeleteProfile( TInt& aIndex )
       
   290     {
       
   291     FTRACE( FPrint(
       
   292         _L("[OMADM] CNSmlDMSyncDocument::DeleteProfile(), index = %d"),
       
   293         aIndex ) );
       
   294         
       
   295     TInt retVal = KErrNotFound;
       
   296     TInt profcount = iProfileList->Count();
       
   297     if (  profcount <= 0 && aIndex >= profcount && aIndex < 0)
       
   298         {
       
   299         return retVal;
       
   300         }
       
   301     TRAP( retVal, iAppEngine->DeleteProfileL( 
       
   302                                 (*iProfileList)[aIndex].iProfileId ) );
       
   303     if ( retVal == KErrNone )
       
   304         {
       
   305         //Update profile list
       
   306         refreshProfileList();    
       
   307         }
       
   308 
       
   309     FTRACE( FPrint(
       
   310         _L("[OMADM] CNSmlDMSyncDocument::DeleteProfile() completed, retval = %d"),
       
   311         retVal) );
       
   312     return retVal;
       
   313     }
       
   314 
       
   315 bool DmInfo::createNewprofile()
       
   316     {
       
   317     iProfileId = iAppEngine->CreateProfileL();
       
   318     if(iProfileId > 0)
       
   319         return true;
       
   320     else
       
   321         return false;
       
   322     }
       
   323 
       
   324 
       
   325 int DmInfo::saveProfile(QStringList& itemdata, bool& sessmode, QString& currap,unsigned int& portnum, bool& nauth )
       
   326     {
       
   327     Q_UNUSED(sessmode);
       
   328     Q_UNUSED(nauth);	
       
   329     FLOG( "[OMADM] void CNSmlDMDlgProfileView::SaveProfileL:" );    
       
   330     TRAPD( err, iProfile = iAppEngine->OpenProfileL( iProfileId, ESmlOpenReadWrite ) );
       
   331     if( err != KErrNone )
       
   332         {
       
   333         FLOG( "[OMADM] err != KErrNone--problem in opening the profile" );
       
   334         return false;
       
   335         }
       
   336     TPtrC srvname(reinterpret_cast<const TText*>(itemdata[0].constData()));
       
   337     // Server name
       
   338     iProfile->SetNameL( srvname );
       
   339     // Server Id
       
   340     TPtrC srvid(reinterpret_cast<const TText*>(itemdata[1].constData()));
       
   341     iProfile->SetServerIdL(srvid );
       
   342     // Server password
       
   343     TPtrC srvpwd(reinterpret_cast<const TText*>(itemdata[2].constData()));
       
   344     iProfile->SetServerPasswordL(srvpwd );
       
   345     // connection type
       
   346     iProfile->SetBearerTypeL( EAspBearerInternet );
       
   347     // Accesspoint
       
   348     if(currap.length())
       
   349         iProfile->SetAccessPointL( iapmap[currap] );
       
   350     else
       
   351         iProfile->SetAccessPointL( KErrGeneral ); //Default access point
       
   352     // Host address
       
   353     TInt num = portnum;
       
   354     TPtrC hostaddr(reinterpret_cast<const TText*>(itemdata[3].constData()));
       
   355     iProfile->SetHostAddressL( hostaddr, num );
       
   356     // User name
       
   357     TPtrC usrname(reinterpret_cast<const TText*>(itemdata[4].constData()));
       
   358     iProfile->SetUserNameL( usrname );
       
   359     // User password
       
   360     TPtrC usrpwd(reinterpret_cast<const TText*>(itemdata[5].constData()));
       
   361     iProfile->SetPasswordL( usrpwd );                                 
       
   362     // Http authentication  
       
   363     iProfile->SetHttpUsedL( nauth );
       
   364     // http username
       
   365     TPtrC httpusrname(reinterpret_cast<const TText*>(itemdata[6].constData()));
       
   366     iProfile->SetHttpUserNameL( httpusrname );
       
   367     // http password
       
   368     TPtrC httpusrpwd(reinterpret_cast<const TText*>(itemdata[7].constData()));
       
   369     iProfile->SetHttpPasswordL( httpusrpwd );
       
   370     // iProfile->SetCreatorId( KUidSmlSyncApp.iUid );
       
   371     iProfileId = 0;
       
   372     iProfile->SaveL();
       
   373     iAppEngine->CloseProfile();    
       
   374     refreshProfileList();//updates profile list    
       
   375     return 1;
       
   376     }
       
   377               
       
   378 bool DmInfo::getProfiledata(int& itemnum, QStringList& itemdata,
       
   379         bool& sessmode, QStringList& iaplist, int& curriap, int& portnum,
       
   380         bool& nwauth)
       
   381     {
       
   382     if (itemnum >= 0 && iProfileList->Count() > 0)
       
   383         {
       
   384         iProfileId = iProfileList->At(itemnum).iProfileId;
       
   385         }
       
   386     TRAPD( err, iProfile = iAppEngine->OpenProfileL( iProfileId, ESmlOpenRead ) );    
       
   387     if (err == 0)
       
   388         {
       
   389         //srvname
       
   390         TBuf<KBufSize256> bufdata;
       
   391         iProfile->GetName(bufdata);
       
   392         itemdata << QString::fromUtf16(bufdata.Ptr(), bufdata.Length());
       
   393 
       
   394         //srvid
       
   395         iProfile->GetServerId(bufdata);
       
   396         itemdata << QString::fromUtf16(bufdata.Ptr(), bufdata.Length());
       
   397 
       
   398         //srvpwd
       
   399         iProfile->GetServerPassword(bufdata);
       
   400         itemdata << QString::fromUtf16(bufdata.Ptr(), bufdata.Length());
       
   401 
       
   402         //hostaddress
       
   403 
       
   404         iProfile->GetHostAddress(bufdata, portnum);
       
   405         itemdata << QString::fromUtf16(bufdata.Ptr(), bufdata.Length());
       
   406 
       
   407         //username
       
   408         iProfile->GetUserName(bufdata);
       
   409         itemdata << QString::fromUtf16(bufdata.Ptr(), bufdata.Length());
       
   410 
       
   411         //usrpwd
       
   412         iProfile->GetPassword(bufdata);
       
   413         itemdata << QString::fromUtf16(bufdata.Ptr(), bufdata.Length());
       
   414 
       
   415         //nwusrname
       
   416         iProfile->GetHttpUserNameL(bufdata);
       
   417         itemdata << QString::fromUtf16(bufdata.Ptr(), bufdata.Length());
       
   418 
       
   419         //nwpwd
       
   420         iProfile->GetHttpPasswordL(bufdata);
       
   421         itemdata << QString::fromUtf16(bufdata.Ptr(), bufdata.Length());
       
   422 
       
   423         //connection type 
       
   424         int transporttype = iProfile->BearerType();
       
   425         if (((transporttype != EProfileObexBlueTooth) && (transporttype
       
   426                 != EProfileInternet)) || transporttype == EProfileInternet)
       
   427             {
       
   428             //default to internet
       
   429             sessmode = true;           
       
   430             }
       
   431         else
       
   432             sessmode = false;       
       
   433         int apid = iProfile->AccessPointL();
       
   434         curriap = apid;
       
   435         getIaplist(iaplist, apid, curriap); //append default connection to list
       
   436         TBuf<20> apnum;
       
   437         RDebug::RawPrint(_L("omadm access point is"));
       
   438         apnum.AppendNum(curriap);
       
   439         RDebug::RawPrint(apnum);
       
   440         //check iap id exists or not 
       
   441         nwauth = iProfile->HttpUsedL();
       
   442         return true;
       
   443         }
       
   444     else
       
   445         {
       
   446         return false;
       
   447         }
       
   448     }
       
   449 
       
   450 bool DmInfo::checksrvid(QString& serverid)
       
   451     {
       
   452     TPtrC srvid(reinterpret_cast<const TText*> (serverid.constData()));
       
   453     return iAppEngine->ServerIdFoundL(srvid, iProfileId);
       
   454     }
       
   455 
       
   456 void DmInfo::getIaplist(QStringList& iaplist, int& iapselected,
       
   457         int& listindex)
       
   458     {
       
   459     iapmap.clear();
       
   460     RCmManager cmManager;
       
   461     cmManager.OpenLC();
       
   462     RArray<TUint32> iapidlist;
       
   463     cmManager.ConnectionMethodL(iapidlist, EFalse, EFalse, ETrue);
       
   464     RCmConnectionMethod conn;
       
   465     for (TInt i = 0; i < iapidlist.Count(); i++)
       
   466         {
       
   467         TRAPD(err, conn = cmManager.ConnectionMethodL( iapidlist[i] ));
       
   468 
       
   469         if (err == KErrNone)//connection method exists
       
   470             {
       
   471             CleanupClosePushL(conn);
       
   472             HBufC* name = conn.GetStringAttributeL(CMManager::ECmName);
       
   473             QString iapname = QString::fromUtf16(name->Ptr(), name->Length());
       
   474             iaplist << iapname;
       
   475             iapmap[iapname] = iapidlist[i];
       
   476             if (iapselected == iapidlist[i])
       
   477                 {
       
   478                 RDebug::RawPrint(_L("omadm iap found"));
       
   479                 listindex = iapmap.count() - 1;
       
   480                 }
       
   481             delete name;
       
   482 
       
   483             CleanupStack::PopAndDestroy(1); // conn
       
   484             }
       
   485         }
       
   486     CleanupStack::PopAndDestroy(1); // cmManager
       
   487     }
       
   488 
       
   489 void DmInfo::synchronize(int& itemnum)
       
   490     {
       
   491     TBool fotanote = EFalse;
       
   492     DisableDbNotifications(ETrue);
       
   493     TRAPD( error, iAppEngine->SynchronizeL( iProfileList->At( itemnum ).iProfileName,
       
   494                     iProfileList->At( itemnum ).iProfileId,
       
   495                     iProfileList->At( itemnum ).iBearer,fotanote ) );
       
   496     if(error == KErrNone)   {}             
       
   497     }
       
   498 
       
   499 void DmInfo::sync(int aProfileId)
       
   500     {
       
   501     int itemNum = findProfile(aProfileId);
       
   502     if(itemNum!=KErrNotFound)
       
   503         {
       
   504         synchronize(itemNum);
       
   505         }
       
   506     }
       
   507 
       
   508 void DmInfo::synccomplete(int jobstatus)
       
   509     {
       
   510     if (jobstatus == ENSmlSyncComplete)
       
   511         {
       
   512         //iSyncProfileList->ReadProfileItemsL();
       
   513         //Update profile list
       
   514         refreshProfileList();
       
   515         }
       
   516     if(serversView!=NULL)
       
   517         {
       
   518         serversView->syncCompleted(jobstatus);
       
   519         }
       
   520     iDbEventsBlocked = EFalse;
       
   521     }
       
   522 
       
   523 // -----------------------------------------------------------------------------
       
   524 // HandleDbEventL
       
   525 // -----------------------------------------------------------------------------
       
   526 //
       
   527 void DmInfo::HandleDbEventL(TNSmlDMDbEvent aEvent)
       
   528     {
       
   529     FLOG( "[OMADM] DmInfo::HandleDbEventL:" );
       
   530 
       
   531     if (!iDbEventsBlocked)
       
   532         {
       
   533         switch (aEvent.iType)
       
   534             {
       
   535             case CNSmlDMDbNotifier::EClose:
       
   536                 iAppEngine->SyncCompleted(ENSmlRefreshMainView);
       
   537                 break;
       
   538 
       
   539             case CNSmlDMDbNotifier::EUpdate:
       
   540                 iSyncProfileList->ReadProfileItemL(aEvent.iProfileId);
       
   541                 iAppEngine->SyncCompleted(ENSmlRefreshMainView);
       
   542                 break;
       
   543 
       
   544             case CNSmlDMDbNotifier::EDelete:
       
   545                 iSyncProfileList->Remove(aEvent.iProfileId);
       
   546                 iAppEngine->SyncCompleted(ENSmlRefreshMainView);
       
   547                 break;
       
   548 
       
   549             case CNSmlDMDbNotifier::EUpdateAll:
       
   550                 iSyncProfileList->ReadProfileItemsL();
       
   551                 iAppEngine->SyncCompleted(ENSmlRefreshMainView);
       
   552                 break;
       
   553 
       
   554             default:
       
   555                 break;
       
   556             }
       
   557         }
       
   558     FLOG( "[OMADM] DmInfo::HandleDbEventL() completed" );
       
   559     }
       
   560 
       
   561 // -----------------------------------------------------------------------------
       
   562 // DisableDbNotifications
       
   563 // -----------------------------------------------------------------------------
       
   564 //
       
   565 void DmInfo::DisableDbNotifications(TBool aEvent)
       
   566     {
       
   567     iDbEventsBlocked = aEvent;
       
   568     FLOG( "[OMADM] DmInfo::DisableDbNotifications() completed" );
       
   569     }
       
   570 
       
   571 TInt DmInfo::findProfile(TInt aProfileId)
       
   572     {
       
   573     for(TInt i=0;i<iProfileList->Count();i++)
       
   574         {
       
   575         if(iProfileList->At(i).iProfileId == aProfileId)
       
   576             {
       
   577             return i;
       
   578             }
       
   579         }
       
   580     return KErrNotFound;
       
   581     }