--- a/harvesterplugins/messaging/smsmms/src/cmessagedatahandler.cpp Wed Jun 23 18:13:49 2010 +0300
+++ b/harvesterplugins/messaging/smsmms/src/cmessagedatahandler.cpp Tue Jul 06 14:17:22 2010 +0300
@@ -198,16 +198,7 @@
if (iMessagePlugin.GetIndexer())
{
TRAPD(err, iMessagePlugin.GetIndexer()->DeleteL(docid_str));
- if (err == KErrNone)
- {
- OstTrace0( TRACE_NORMAL, DUP1_CMESSAGEDATAHANDLER_CREATEMESSAGEINDEXITEML, "CMessageDataHandler::CreateMessageIndexItemL(): Document deleted." );
- CPIXLOGSTRING("CMessageDataHandler::CreateMessageIndexItemL(): Document deleted.");
- }
- else
- {
- OstTrace1( TRACE_NORMAL, DUP2_CMESSAGEDATAHANDLER_CREATEMESSAGEINDEXITEML, "CMessageDataHandler::CreateMessageIndexItemL;Error in deleting the doc=%d", err );
- CPIXLOGSTRING2("CMessageDataHandler::CreateMessageIndexItemL(): Error %d in deleting the document.", err);
- }
+ OstTrace1( TRACE_NORMAL, DUP7_CMESSAGEDATAHANDLER_CREATEMESSAGEINDEXITEML, "CMessageDataHandler::CreateMessageIndexItemL():DeleteL;err=%d", err );
}
return;
}
@@ -224,52 +215,17 @@
case EMsgTypeSms:
{
TRAPD(err, index_item = CreateSmsDocumentL(aMsvId, aFolderId));
- if (err == KErrNone)
- {
- OstTrace0( TRACE_NORMAL, DUP3_CMESSAGEDATAHANDLER_CREATEMESSAGEINDEXITEML, "CMessageDataHandler::CreateMessageIndexItemL(): SMS document created." );
- CPIXLOGSTRING("CMessageDataHandler::CreateMessageIndexItemL(): SMS document created.");
- }
- else
- {
- OstTrace1( TRACE_NORMAL, DUP4_CMESSAGEDATAHANDLER_CREATEMESSAGEINDEXITEML, "CMessageDataHandler::CreateMessageIndexItemL;Error in creating the sms doc=%d", err );
- CPIXLOGSTRING2("CMessageDataHandler::CreateMessageIndexItemL(): Error %d in creating SMS document.", err);
- }
+ OstTrace1( TRACE_NORMAL, DUP1_CMESSAGEDATAHANDLER_CREATEMESSAGEINDEXITEML, "CMessageDataHandler::CreateMessageIndexItemL(): SMS document creation;err=%d", err );
break;
}
case EMsgTypeMms:
{
TRAPD(err, index_item = CreateMmsDocumentL(aMsvId, aFolderId));
- if (err == KErrNone)
- {
- OstTrace0( TRACE_NORMAL, DUP5_CMESSAGEDATAHANDLER_CREATEMESSAGEINDEXITEML, "CMessageDataHandler::CreateMessageIndexItemL(): MMS document created." );
- CPIXLOGSTRING("CMessageDataHandler::CreateMessageIndexItemL(): MMS document created.");
- }
- else
- {
- OstTrace1( TRACE_NORMAL, DUP6_CMESSAGEDATAHANDLER_CREATEMESSAGEINDEXITEML, "CMessageDataHandler::CreateMessageIndexItemL;Error in creating the mms doc=%d", err );
- CPIXLOGSTRING2("CMessageDataHandler::CreateMessageIndexItemL(): Error %d in creating MMS document.", err);
- }
- break;
- }
- case EMsgTypeEmailPop3:
- case EMsgTypeEmailImap4:
- case EMsgTypeEmailSmtp:
- {
- TRAPD(err, index_item = CreateEmailDocumentL(aMsvId, aFolderId));
- if (err == KErrNone)
- {
- OstTrace0( TRACE_NORMAL, DUP7_CMESSAGEDATAHANDLER_CREATEMESSAGEINDEXITEML, "CMessageDataHandler::CreateMessageIndexItemL(): E-mail document created." );
- CPIXLOGSTRING("CMessageDataHandler::CreateMessageIndexItemL(): E-mail document created.");
- }
- else
- {
- OstTrace1( TRACE_NORMAL, DUP8_CMESSAGEDATAHANDLER_CREATEMESSAGEINDEXITEML, "CMessageDataHandler::CreateMessageIndexItemL;Error in ccreating the email doc=%d", err );
- CPIXLOGSTRING2("CMessageDataHandler::CreateMessageIndexItemL(): Error %d in creating e-mail document.", err);
- }
+ OstTrace1( TRACE_NORMAL, DUP2_CMESSAGEDATAHANDLER_CREATEMESSAGEINDEXITEML, "CMessageDataHandler::CreateMessageIndexItemL(): MMS document created;err=%d", err );
break;
}
case EMsgTypeInvalid:
- // For EMsgTypeDraft there is no way to tell if it was a SMS, MMS or email,
+ // For EMsgTypeDraft there is no way to tell if it was a SMS, MMS ,
// so don't create index_item.
case EMsgTypeDraft:
default:
@@ -302,30 +258,12 @@
if (aActionType == ECPixAddAction)
{
TRAPD(err, iMessagePlugin.GetIndexer()->AddL(*index_item));
- if (err == KErrNone)
- {
- OstTrace0( TRACE_NORMAL, DUP10_CMESSAGEDATAHANDLER_CREATEMESSAGEINDEXITEML, "CMessageDataHandler::CreateMessageIndexItemL(): Added." );
- CPIXLOGSTRING("CMessageDataHandler::CreateMessageIndexItemL(): Added.");
- }
- else
- {
- OstTrace1( TRACE_NORMAL, DUP11_CMESSAGEDATAHANDLER_CREATEMESSAGEINDEXITEML, "CMessageDataHandler::CreateMessageIndexItemL;Error in Adding=%d", err );
- CPIXLOGSTRING2("CMessageDataHandler::CreateMessageIndexItemL(): Error %d in adding.", err);
- }
+ OstTrace1( TRACE_NORMAL, DUP3_CMESSAGEDATAHANDLER_CREATEMESSAGEINDEXITEML, "CMessageDataHandler::CreateMessageIndexItemL(): Added;err=%d", err );
}
else if (aActionType == ECPixUpdateAction)
{
TRAPD(err, iMessagePlugin.GetIndexer()->UpdateL(*index_item));
- if (err == KErrNone)
- {
- OstTrace0( TRACE_NORMAL, DUP12_CMESSAGEDATAHANDLER_CREATEMESSAGEINDEXITEML, "CMessageDataHandler::CreateMessageIndexItemL(): Updated." );
- CPIXLOGSTRING("CMessageDataHandler::CreateMessageIndexItemL(): Updated.");
- }
- else
- {
- OstTrace1( TRACE_NORMAL, DUP13_CMESSAGEDATAHANDLER_CREATEMESSAGEINDEXITEML, "CMessageDataHandler::CreateMessageIndexItemL;Error in Updating=%d", err );
- CPIXLOGSTRING2("CMessageDataHandler::CreateMessageIndexItemL(): Error %d in updating.", err);
- }
+ OstTrace1( TRACE_NORMAL, DUP4_CMESSAGEDATAHANDLER_CREATEMESSAGEINDEXITEML, "CMessageDataHandler::CreateMessageIndexItemL(): Updated;err=%d", err );
}
}
else
@@ -540,94 +478,6 @@
CleanupStack::Pop(index_item);
return index_item;
}
-
-// ---------------------------------------------------------------------------
-// CMessageDataHandler::CreateEmailDocumentL
-// ---------------------------------------------------------------------------
-//
-CSearchDocument* CMessageDataHandler::CreateEmailDocumentL(const TMsvId& aMsvId, const TMsvId& aFolderId)
- {
- // creating CSearchDocument object with unique ID for this application
- TBuf<KMaxDocId> docid_str;
- docid_str.AppendNum(aMsvId);
- CSearchDocument* index_item = CSearchDocument::NewLC(docid_str, _L(EMAILAPPCLASS));
-
- // Open the message entry
- CMsvEntry* message_entry = CMsvEntry::NewL(iMsvSession, aMsvId, TMsvSelectionOrdering());
- CleanupStack::PushL(message_entry);
-
- // Get body
- CParaFormatLayer* paraFormatLayer = CParaFormatLayer::NewL();
- CleanupStack::PushL(paraFormatLayer);
- CCharFormatLayer* charFormatLayer = CCharFormatLayer::NewL();
- CleanupStack::PushL(charFormatLayer);
- CRichText* richtext = CRichText::NewL(paraFormatLayer, charFormatLayer);
- CleanupStack::PushL(richtext);
- CImEmailMessage* message_body = CImEmailMessage::NewLC(*message_entry);
- message_body->GetBodyTextL(aMsvId, CImEmailMessage::EThisMessageOnly, *richtext, *paraFormatLayer, *charFormatLayer);
-
- // Read the message header
- CMsvStore* message_store = message_entry->ReadStoreL();
- CleanupStack::PushL(message_store);
- CImHeader* header = CImHeader::NewLC();
- header->RestoreL(*message_store);
-
- // Add from field
- index_item->AddFieldL(KFromField, header->From());
-
- // Add the ToRecipients as content items
- TBuf<64> to_field;
- for (TInt i = 0; i < header->ToRecipients().MdcaCount(); i++)
- {
- to_field = KToField;
- if (i>0)
- to_field.AppendNum(i);
- index_item->AddFieldL(to_field, header->ToRecipients().MdcaPoint(i));
- }
-
- // Add the CcRecipients as content items
- TBuf<64> cc_field;
- for (TInt i = 0; i < header->CcRecipients().MdcaCount(); i++)
- {
- cc_field = KCcField;
- if (i>0)
- cc_field.AppendNum(i);
- index_item->AddFieldL(cc_field, header->CcRecipients().MdcaPoint(i));
- }
-
- // Add the BccRecipients as content items
- TBuf<64> bcc_field;
- for (TInt i = 0; i < header->BccRecipients().MdcaCount(); i++)
- {
- bcc_field = KBccField;
- if (i>0)
- bcc_field.AppendNum(i);
- index_item->AddFieldL(bcc_field, header->BccRecipients().MdcaPoint(i));
- }
-
- const TInt richTxtLen = (richtext->DocumentLength() < KMaxDocumentSize) ? richtext->DocumentLength() : KMaxDocumentSize;
- HBufC* body_text = richtext->Read(0).Left(richTxtLen).AllocLC();
-
- // Add subject
- TPtrC subject(header->Subject());
- index_item->AddFieldL(KSubjectField, subject);
-
- // Add message body
- index_item->AddFieldL(KBodyField, *body_text);
-
- // Add excerpt
- HBufC* excerpt = CreateExcerptLC(header->From(), header->ToRecipients(), subject, *body_text, aFolderId);
- index_item->AddExcerptL(*excerpt);
- CleanupStack::PopAndDestroy(excerpt);
-
- // Cleanup everything last item message entry
- CleanupStack::PopAndDestroy(8, message_entry);
-
- // Pop the item
- CleanupStack::Pop(index_item);
- return index_item;
- }
-
// ---------------------------------------------------------------------------
// CMessageDataHandler::CreateExcerptLC
// ---------------------------------------------------------------------------