creator/src/creator_contactelement.cpp
branchRCL_3
changeset 60 6646c35e558c
parent 50 9b2cffad4b5e
--- a/creator/src/creator_contactelement.cpp	Wed Sep 15 12:13:45 2010 +0300
+++ b/creator/src/creator_contactelement.cpp	Wed Oct 13 14:32:52 2010 +0300
@@ -171,173 +171,6 @@
     }
 
 #if(!defined __SERIES60_30__ && !defined __SERIES60_31__)
-void CCreatorContactElement::AsyncExecuteCommandL()
-    {    
-    LOGSTRING("Creator: CCreatorContactElement::AsyncExecuteCommandL");
-    // Find out how many contacts should we create:
-    const CCreatorScriptAttribute* contactAmountAttr = this->FindAttributeByName(KAmount);    
-    TInt contactAmount = 1;    
-    if( contactAmountAttr )
-        {
-        contactAmount = ConvertStrToIntL(contactAmountAttr->Value());
-        }
-    CCreatorScriptElement* fieldsElement = FindSubElement(KFields);
-    TInt fieldMappingTblSize = sizeof(fieldMappingTbl)/sizeof(FieldMapping);
-    if( iLoopIndex < contactAmount )
-        {
-        CVirtualPhonebookParameters* param = (CVirtualPhonebookParameters*) TCreatorFactory::CreatePhoneBookParametersL();
-        CleanupStack::PushL(param);
-        // Loop all the field elements
-        if( fieldsElement && fieldsElement->SubElements().Count() > 0 )
-            {
-            
-            const RPointerArray<CCreatorScriptElement>& fieldList = fieldsElement->SubElements();
-            
-            if( fieldList.Count() == 0 )
-                {
-                
-                }
-            for( TInt i = 0; i < fieldList.Count(); ++i )
-                {
-                TPtrC fieldName = fieldList[i]->Name();
-                const CCreatorScriptAttribute* amountAttr = fieldList[i]->FindAttributeByName(KAmount);
-                const CCreatorScriptAttribute* rndLenAttr = fieldList[i]->FindAttributeByName(KRandomLength);
-                const CCreatorScriptAttribute* increaseAttr = fieldList[i]->FindAttributeByName(KIncrease);
-                TBool increase( EFalse );
-                if ( increaseAttr )
-                    {
-                    increase = ConvertStrToBooleanL( increaseAttr->Value() );
-                    }
-                CCreatorContactField* field = 0;
-                for( TInt j = 0; j < fieldMappingTblSize; ++j )
-                    {
-                    const FieldMapping& mapping = fieldMappingTbl[j];
-                    if( fieldName == mapping.iElementName )
-                        {
-                        TInt rndLen = 0;
-                        TPtrC content = fieldList[i]->Content();
-                                                                        
-                        MCreatorRandomDataField::TRandomLengthType randomLenType = MCreatorRandomDataField::ERandomLengthUndefined;
-                    
-                        if( content == TPtrC(KEmpty) || content == TPtrC(KNullDesC) )
-                            {
-                            if( rndLenAttr == 0 )
-                                {
-                                randomLenType = MCreatorRandomDataField::ERandomLengthDefault;
-                                }
-                            else
-                                {
-                                randomLenType = ResolveRandomDataTypeL(*rndLenAttr, rndLen);
-                                }
-                            }
-                        else
-                            {
-                            // Special handling for file id content:
-                            if( fieldName == KThumbnailId )
-                                {
-                                // Thumbnail data is copied to the contact entry, so we can use temporary file:
-                                CCreatorEngine::TTestDataPath id = (CCreatorEngine::TTestDataPath) iEngine->GetAttachmentIdL(content);
-                                content.Set(iEngine->TestDataPathL(id));
-                                }
-                            else if( fieldName == KRingToneId )
-                                {
-                                // Contact entry contains just a link to the sound file, so we must 
-                                // copy the temporary file to a permanent location:
-                                CCreatorEngine::TTestDataPath id = (CCreatorEngine::TTestDataPath) iEngine->GetAttachmentIdL(content);
-                                TPtrC fullTargetPath(iEngine->CreateSoundFileL(id));                            
-                                content.Set(fullTargetPath);
-                                }
-                            }
-                        TInt amountValue = 1;
-                        if( amountAttr )
-                            {                        
-                            amountValue = ConvertStrToIntL(amountAttr->Value());
-                            }
-                        for( TInt k = 0; k < amountValue; ++k )
-                            {
-                            if ( increase &&
-                                 ( fieldName.FindF( _L("number") ) > KErrNotFound ||
-                                 fieldName.FindF( _L("phone") ) > KErrNotFound ) )
-                                {
-                                // increase phonenumber for each copy
-                                HBufC* incNum = HBufC::NewLC( content.Length() + 3 );
-                                if ( amountValue > 1 )
-                                    {
-                                    // amount defined in number field level
-                                    IncreasePhoneNumL( content, k, incNum );
-                                    }
-                                else
-                                    {
-                                    // amount defined in contact field level
-                                    IncreasePhoneNumL( content, iLoopIndex, incNum );
-                                    }
-                                field = CCreatorContactField::NewL( mapping.iFieldCode, *incNum );
-                                CleanupStack::PushL( field );
-                                field->SetRandomParametersL( randomLenType, rndLen );
-                                param->iContactFields.AppendL( field );
-                                CleanupStack::Pop( field );
-                                CleanupStack::PopAndDestroy( incNum );
-                                }
-                            else
-                                {
-                                field = CCreatorContactField::NewL(mapping.iFieldCode, content);
-                                CleanupStack::PushL(field);
-                                field->SetRandomParametersL(randomLenType, rndLen);
-                                param->iContactFields.AppendL(field);
-                                CleanupStack::Pop(field);                                
-                                }
-                            }
-                        break;
-                        }
-                    }
-                }
-            } 
-        else
-            {
-            // No fields specified, so add all fields with random content:
-            for( TInt i = 0; i < fieldMappingTblSize; ++i )
-                {
-                if( fieldMappingTbl[i].iElementName == KThumbnailId || 
-                    fieldMappingTbl[i].iElementName == KRingToneId )
-                    {
-                    // Skip thumbnail and ringtone IDs, since they are duplicates with thumbnailpath and ringtonepath
-                    continue;
-                    }
-                CCreatorContactField* field = 0;
-                if(fieldMappingTbl[i].iDataType == EDataTypeText )
-                    {
-                    field = CCreatorContactField::NewL(fieldMappingTbl[i].iFieldCode, KNullDesC);
-                    }
-                else if( fieldMappingTbl[i].iDataType == EDataTypeBinary )
-                    {
-                    field = CCreatorContactField::NewL(fieldMappingTbl[i].iFieldCode, KNullDesC8);
-                    }
-                else if( fieldMappingTbl[i].iDataType == EDataTypeDateTime )
-                    {                       
-                    TDateTime dateTime(Time::NullTTime().DateTime());
-                    field = CCreatorContactField::NewL(fieldMappingTbl[i].iFieldCode, dateTime);
-                    }
-                if( field )
-                    {
-                    CleanupStack::PushL(field);
-                    field->SetRandomParametersL(MCreatorRandomDataField::ERandomLengthDefault, 0);
-                    param->iContactFields.AppendL(field);
-                    CleanupStack::Pop(field);
-                    }
-                }
-            }
-        iEngine->AppendToCommandArrayL(ECmdCreatePhoneBookEntryContacts, param);
-        iParameters.AppendL(param); // Save the pointer to the parametes. 
-        CleanupStack::Pop(param);
-        StartNextLoop();
-        }
-    else
-        {
-        // stop loop and signal end of the executing command
-        AsyncCommandFinished();
-        }
-    }
-
 void CCreatorContactElement::ExecuteCommandL()
     {    
     LOGSTRING("Creator: CCreatorContactElement::ExecuteCommandL");
@@ -517,11 +350,6 @@
 CCreatorContactElementBase(aEngine)
     { }
 
-void CCreatorContactSetElement::AsyncExecuteCommand()
-    { 
-    AsyncCommandFinished();
-    }
-
 void CCreatorContactSetElement::ExecuteCommandL()
     { }
 
@@ -578,58 +406,6 @@
     }
 
 #if(!defined __SERIES60_30__ && !defined __SERIES60_31__ )
-void CCreatorContactGroupElement::AsyncExecuteCommandL()
-    {
-    LOGSTRING("Creator: CCreatorContactGroupElement::AsyncExecuteCommandL");
-    // Get attributes (amount and name)
-    const CCreatorScriptAttribute* groupAmountAttr = this->FindAttributeByName(KAmount);        
-    const CCreatorScriptAttribute* groupNameAttr = this->FindAttributeByName(KName);
-    // How many groups to create:
-    TInt groupAmount = 1;        
-    if( groupAmountAttr )
-        {
-        groupAmount = ConvertStrToIntL(groupAmountAttr->Value());
-        }
-    
-    if( iLoopIndex <  groupAmount )
-        {        
-        CCreatorScriptElement* membersElement = FindSubElement(KMembers);
-        
-        if( membersElement )
-            {    
-            CVirtualPhonebookParameters* param = (CVirtualPhonebookParameters*) TCreatorFactory::CreatePhoneBookParametersL();            
-            CleanupStack::PushL(param);
-            
-            // Links to contact-sets:
-            const RPointerArray<CCreatorScriptElement>& linkList = membersElement->SubElements();
-            if( linkList.Count() > 0 )
-                {
-                for( TInt i = 0; i < linkList.Count(); ++i )
-                    {
-                    AppendContactSetReferenceL(*linkList[i], param->iLinkIds);
-                    }                
-                }
-            
-            if( groupNameAttr )
-                {
-                param->iGroupName->Des().Copy( groupNameAttr->Value() );
-                }
-            else
-                {
-                param->iGroupName->Des().Copy( iEngine->RandomString(CCreatorEngine::EGroupName) );
-                }                
-            iEngine->AppendToCommandArrayL(ECmdCreatePhoneBookEntryGroups, param);
-            CleanupStack::Pop(param);
-            }
-        StartNextLoop();
-        }
-    else
-        {
-        // stop loop and signal end of the executing command
-        AsyncCommandFinished();        
-        }
-    }
-
 void CCreatorContactGroupElement::ExecuteCommandL()
     {
     LOGSTRING("Creator: CCreatorContactGroupElement::ExecuteCommandL");