harvesterplugins/notes/src/notesplugin.cpp
changeset 17 7d8c8d8f5eab
parent 11 773be20e0a25
child 20 68cdadcf169e
--- a/harvesterplugins/notes/src/notesplugin.cpp	Tue Jul 06 14:17:22 2010 +0300
+++ b/harvesterplugins/notes/src/notesplugin.cpp	Wed Aug 18 09:49:49 2010 +0300
@@ -55,6 +55,7 @@
 //Reference from CPix calender harvester plugin.
 _LIT(KNotesTimeFormat,"%04d %02d %02d %02d %02d");
 
+_LIT(KExcerptDelimiter, " ");
 // ---------------------------------------------------------------------------
 // CNotesPlugin::NewL
 // ---------------------------------------------------------------------------
@@ -346,11 +347,11 @@
 		index_item->AddFieldL(KNpdMemo, entry->DescriptionL());
 		// Add Date fields
 		TBuf<30> dateString;
-		TDateTime datetime = entry->EndTimeL().TimeUtcL().DateTime();		
+		TDateTime datetime = entry->EndTimeL().TimeLocalL().DateTime();		
 		dateString.Format( KNotesTimeFormat, datetime.Year(),
                                      TInt(datetime.Month()+ 1),
                                      datetime.Day() + 1,
-                                     datetime.Hour()+ 1,
+                                     datetime.Hour(),
                                      datetime.Minute());
 		 
 		index_item->AddFieldL(KNpdUpdateTime, dateString, CDocumentField::EStoreYes | CDocumentField::EIndexUnTokenized);
@@ -359,12 +360,16 @@
 
 		//For notes, no content is expected in excerpt for now.
 		//See appclass-hierarchy.txt for details.
-//    	TInt excerptLength = entry->DescriptionL().Length();
-//		HBufC* excerpt = HBufC::NewLC(excerptLength);
-//		TPtr excerptDes = excerpt->Des();		
-//		excerptDes.Append(entry->DescriptionL());
-//      index_item->AddExcerptL(*excerpt);
-//      CleanupStack::PopAndDestroy(excerpt);      
+#ifdef USE_HIGHLIGHTER		
+    	TInt excerptLength = entry->DescriptionL().Length() + 1 + dateString.Length();
+		HBufC* excerpt = HBufC::NewLC(excerptLength);
+		TPtr excerptDes = excerpt->Des();		
+		excerptDes.Append(entry->DescriptionL());
+		excerptDes.Append(KExcerptDelimiter);
+		excerptDes.Append(dateString);
+      index_item->AddExcerptL(*excerpt);
+      CleanupStack::PopAndDestroy(excerpt);
+#endif      
 		
 		// Send for indexing
 		if (aActionType == ECPixAddAction)
@@ -373,34 +378,16 @@
             TRAP_IGNORE( iIndexer->AddL(*index_item) );
 #else
 			TRAPD( err, iIndexer->AddL(*index_item) );
-			if ( err == KErrNone )
-				{
-				OstTrace0( TRACE_NORMAL, DUP3_CNOTESPLUGIN_CREATENOTEENTRYL, "CNotesPlugin::CreateNoteEntryL(): Added." );
-				CPIXLOGSTRING("CNotesPlugin::CreateNoteEntryL(): Added.");
-				}
-			else
-				{
-				OstTrace1( TRACE_NORMAL, DUP4_CNOTESPLUGIN_CREATENOTEENTRYL, "CNotesPlugin::CreateNoteEntryL;Error while adding=%d", err );
-				CPIXLOGSTRING2("CNotesPlugin::CreateNoteEntryL(): Error %d in adding.", err);
-				}
+			OstTrace1( TRACE_NORMAL, DUP9_CNOTESPLUGIN_CREATENOTEENTRYL, "CNotesPlugin::CreateNoteEntryL : iIndexer->AddL;err=%d", err );
 #endif
 			}
-		else if ( aActionType == ECPixUpdateAction )
+		else
 			{
 #ifndef _DEBUG
 		TRAP_IGNORE( iIndexer->UpdateL(*index_item) );
 #else
 			TRAPD( err, iIndexer->UpdateL(*index_item) );
-			if ( err == KErrNone )
-				{
-				OstTrace0( TRACE_NORMAL, DUP5_CNOTESPLUGIN_CREATENOTEENTRYL, "CNotesPlugin::CreateNoteEntryL(): Updated." );
-				CPIXLOGSTRING("CNotesPlugin::CreateNoteEntryL(): Updated.");
-				}
-			else
-				{
-				OstTrace1( TRACE_NORMAL, DUP6_CNOTESPLUGIN_CREATENOTEENTRYL, "CNotesPlugin::CreateNoteEntryL;Error while updating=%d", err );
-				CPIXLOGSTRING2("CNotesPlugin::CreateNoteEntryL(): Error %d in updating.", err);
-				}
+			OstTrace1( TRACE_NORMAL, DUP10_CNOTESPLUGIN_CREATENOTEENTRYL, "CNotesPlugin::CreateNoteEntryL: iIndexer->UpdateL;err=%d", err );
 #endif
 			}
 		CleanupStack::PopAndDestroy(index_item);
@@ -412,16 +399,7 @@
         TRAP_IGNORE( iIndexer->DeleteL(docid_str) );
 #else
 		TRAPD( err, iIndexer->DeleteL(docid_str) );
-		if (err == KErrNone)
-			{
-			OstTrace0( TRACE_NORMAL, DUP7_CNOTESPLUGIN_CREATENOTEENTRYL, "CNotesPlugin::CreateNoteEntryL(): Deleted." );
-			CPIXLOGSTRING("CNotesPlugin::CreateNoteEntryL(): Deleted.");
-			}
-		else
-			{
-			OstTrace1( TRACE_NORMAL, DUP8_CNOTESPLUGIN_CREATENOTEENTRYL, "CNotesPlugin::CreateNoteEntryL;Error while deleting=%d", err );
-			CPIXLOGSTRING2("CNotesPlugin::CreateNoteEntryL(): Error %d in deleting.", err);				
-			}
+		OstTrace1( TRACE_NORMAL, DUP3_CNOTESPLUGIN_CREATENOTEENTRYL, "CNotesPlugin::CreateNoteEntryL: iIndexer->RemoveL;err=%d", err );
 #endif
 		}	
 	}