homesync/contentmanager/cmserver/cmfillmanager/src/cmfmfillrulefilleddatamngr.cpp
changeset 32 3785f754ee62
parent 0 7f85d04be362
equal deleted inserted replaced
27:03808033c9a2 32:3785f754ee62
    10 * Nokia Corporation - initial contribution.
    10 * Nokia Corporation - initial contribution.
    11 *
    11 *
    12 * Contributors:
    12 * Contributors:
    13 *
    13 *
    14 * Description:  Fill rule and filled data processing
    14 * Description:  Fill rule and filled data processing
    15 *  Version     : %version: tr1ido#17 % << Don't touch!
    15 *  Version     : %version: ou1s60rt#18 % << Don't touch!
    16 *
    16 *
    17 */
    17 */
    18 
    18 
    19 
    19 
    20 
    20 
   427         {
   427         {
   428         // checks that server is either inactive or deleted
   428         // checks that server is either inactive or deleted
   429         if( mediaServers[i]->DbId() != 0 && 
   429         if( mediaServers[i]->DbId() != 0 && 
   430             !( mediaServers[i]->FillUsage() ) )
   430             !( mediaServers[i]->FillUsage() ) )
   431             {
   431             {
   432             iMetadataServersToBeDeleted.Append( mediaServers[i]->DbId() );
   432             iMetadataServersToBeDeleted.AppendL( mediaServers[i]->DbId() );
   433             TRACE(Print(_L("[FILL MNGR]\t DbId = %ld"), 
   433             TRACE(Print(_L("[FILL MNGR]\t DbId = %ld"), 
   434                 mediaServers[i]->DbId() ));            
   434                 mediaServers[i]->DbId() ));            
   435                 
   435                 
   436             mediaServers[i]->SetSystemUpdateID( KErrNotFound );
   436             mediaServers[i]->SetSystemUpdateID( KErrNotFound );
   437                 
   437                 
   651         {
   651         {
   652         CCmMediaServerFull* server = CCmMediaServerFull::NewLC();
   652         CCmMediaServerFull* server = CCmMediaServerFull::NewLC();
   653         ret = iDBManager->QueryAllMediaServersL( server );
   653         ret = iDBManager->QueryAllMediaServersL( server );
   654         if( !ret )
   654         if( !ret )
   655             {
   655             {
   656             servers.Append( server );
   656             servers.AppendL( server );
   657             CleanupStack::Pop( server );
   657             CleanupStack::Pop( server );
   658             }
   658             }
   659         else
   659         else
   660             {
   660             {
   661             CleanupStack::PopAndDestroy( server );
   661             CleanupStack::PopAndDestroy( server );
   865     
   865     
   866     CCmFillRule* fillRule = CCmFillRule::NewLC();
   866     CCmFillRule* fillRule = CCmFillRule::NewLC();
   867     iDBManager->PrepareQueryCmdL(EFillRuleQuery);
   867     iDBManager->PrepareQueryCmdL(EFillRuleQuery);
   868     fillRule->SetNameL( aFillListName );
   868     fillRule->SetNameL( aFillListName );
   869     iDBManager->QueryFillRuleL( fillRule );
   869     iDBManager->QueryFillRuleL( fillRule );
   870     iRuleArray.Append( fillRule );   
   870     iRuleArray.AppendL( fillRule );   
   871     iContainer->AddFillRuleL( fillRule );
   871     iContainer->AddFillRuleL( fillRule );
   872     CleanupStack::Pop( fillRule );
   872     CleanupStack::Pop( fillRule );
   873     }
   873     }
   874 
   874 
   875 // ---------------------------------------------------------------------------
   875 // ---------------------------------------------------------------------------
   958                     ( ECmUnSelected == iItems[j]->Selected() && 
   958                     ( ECmUnSelected == iItems[j]->Selected() && 
   959                     ECmUnSelected == iItems[k]->Selected() ) ) )
   959                     ECmUnSelected == iItems[k]->Selected() ) ) )
   960                 {
   960                 {
   961                 if( iItems[k]->Priority() > iItems[j]->Priority() )
   961                 if( iItems[k]->Priority() > iItems[j]->Priority() )
   962                     {
   962                     {
   963                     refIds.InsertInOrder( k );
   963                     refIds.InsertInOrderL( k );
   964                     }
   964                     }
   965                 else if ( iItems[k]->Priority() < iItems[j]->Priority() )
   965                 else if ( iItems[k]->Priority() < iItems[j]->Priority() )
   966                     {
   966                     {
   967                     // Some of the items are on the higher priority than
   967                     // Some of the items are on the higher priority than
   968                     // iItems[ j ]
   968                     // iItems[ j ]
   969                     if( ECmUnSelected == iItems[k]->Selected() && 
   969                     if( ECmUnSelected == iItems[k]->Selected() && 
   970                         ECmSelected == iItems[j]->Selected() )
   970                         ECmSelected == iItems[j]->Selected() )
   971                         {
   971                         {
   972                         refIds.InsertInOrder( k );
   972                         refIds.InsertInOrderL( k );
   973                         }
   973                         }
   974                     else
   974                     else
   975                         {
   975                         {
   976                         ref = ETrue;
   976                         ref = ETrue;
   977                         }    
   977                         }    
  1089     TInt count( iItems.Count() );
  1089     TInt count( iItems.Count() );
  1090     for( TInt i = 0; i < count; i++ )
  1090     for( TInt i = 0; i < count; i++ )
  1091         {
  1091         {
  1092         if( iItems[i]->ListId() == aId )
  1092         if( iItems[i]->ListId() == aId )
  1093             {
  1093             {
  1094             aList.InsertInOrder( i );
  1094             aList.InsertInOrderL( i );
  1095             }
  1095             }
  1096         }    
  1096         }    
  1097     }
  1097     }
  1098 
  1098 
  1099 // ---------------------------------------------------------------------------
  1099 // ---------------------------------------------------------------------------
  1216 	    TRAP( err, iDBManager->SetFillListRealCountAndSizeL( 
  1216 	    TRAP( err, iDBManager->SetFillListRealCountAndSizeL( 
  1217              iRuleArray[0]->ListId(), realCount, ruleSize ) );
  1217              iRuleArray[0]->ListId(), realCount, ruleSize ) );
  1218             iUpdateItems.Reset();
  1218             iUpdateItems.Reset();
  1219             for( TInt j = 0; j < iItems.Count(); j++ )
  1219             for( TInt j = 0; j < iItems.Count(); j++ )
  1220                 {
  1220                 {
  1221                 iUpdateItems.Append( iItems[j] );
  1221                 iUpdateItems.AppendL( iItems[j] );
  1222                 }
  1222                 }
  1223 	    }
  1223 	    }
  1224      
  1224      
  1225     
  1225     
  1226     TRACE(Print(_L("FILL RULE INFORMATION UPDATE err = %d"), err ));
  1226     TRACE(Print(_L("FILL RULE INFORMATION UPDATE err = %d"), err ));
  1271         }
  1271         }
  1272     else if( iItems[iFileIds[aIndex]]->Status() == ECmToBeFilled ||
  1272     else if( iItems[iFileIds[aIndex]]->Status() == ECmToBeFilled ||
  1273          iItems[iFileIds[aIndex]]->Status() == ECmToBeShrinked )
  1273          iItems[iFileIds[aIndex]]->Status() == ECmToBeShrinked )
  1274         {
  1274         {
  1275         aRealSize -= iItems[iFileIds[aIndex]]->Size();
  1275         aRealSize -= iItems[iFileIds[aIndex]]->Size();
  1276         aDelIds.InsertInOrder( iFileIds[aIndex] );
  1276         aDelIds.InsertInOrderL( iFileIds[aIndex] );
  1277         aRealCount--;
  1277         aRealCount--;
  1278         }
  1278         }
  1279     else // ECmLocalCopy
  1279     else // ECmLocalCopy
  1280         {
  1280         {
  1281         TRACE(Print(_L("[FILL MNGR]\t No effect on size")));
  1281         TRACE(Print(_L("[FILL MNGR]\t No effect on size")));
  1429                 }
  1429                 }
  1430             else
  1430             else
  1431                 {
  1431                 {
  1432                 LOG(_L("[FILL MNGR]\t Random rule is not processed"));
  1432                 LOG(_L("[FILL MNGR]\t Random rule is not processed"));
  1433                 // Don't remove rule
  1433                 // Don't remove rule
  1434                 iRuleArray.Append( iContainer->FillRule( j ) );
  1434                 iRuleArray.AppendL( iContainer->FillRule( j ) );
  1435                 }                   
  1435                 }                   
  1436             }
  1436             }
  1437         else
  1437         else
  1438             {
  1438             {
  1439             LOG(_L("[FILL MNGR]\t Rule is not random rule"));
  1439             LOG(_L("[FILL MNGR]\t Rule is not random rule"));
  1440             iRuleArray.Append( iContainer->FillRule( j ) );
  1440             iRuleArray.AppendL( iContainer->FillRule( j ) );
  1441             }    
  1441             }    
  1442         }
  1442         }
  1443     }
  1443     }
  1444 
  1444 
  1445 // ---------------------------------------------------------------------------
  1445 // ---------------------------------------------------------------------------