harvesterplugins/calendar/src/ccalendarplugin.cpp
changeset 17 7d8c8d8f5eab
parent 11 773be20e0a25
child 20 68cdadcf169e
--- a/harvesterplugins/calendar/src/ccalendarplugin.cpp	Tue Jul 06 14:17:22 2010 +0300
+++ b/harvesterplugins/calendar/src/ccalendarplugin.cpp	Wed Aug 18 09:49:49 2010 +0300
@@ -385,64 +385,72 @@
 		// Add fields
 		index_item->AddFieldL(KCalendarSummaryField, entry->SummaryL());
 		index_item->AddFieldL(KCalendarDescriptionField, entry->DescriptionL());
-		index_item->AddFieldL(KCalendarLocationField, entry->LocationL());
-		
-		TUint priority = entry->PriorityL();
-		
-		switch(priority)
-		    {
-		    case 1:
-		        index_item->AddFieldL(KCalendarPriorityField, KCalendarPriorityHigh);
-		        break;
-		    case 2:
-		        index_item->AddFieldL(KCalendarPriorityField, KCalendarPriorityMedium);
-                break;
-		    case 3:
-		        index_item->AddFieldL(KCalendarPriorityField, KCalendarPriorityLow);
-                break;
-		    default:
-	            index_item->AddFieldL(KCalendarPriorityField, KNullDesC);
-	            break;
-		    }
+		index_item->AddFieldL(KCalendarLocationField, entry->LocationL());		
 
 		TBuf<30> dateString;
-		TDateTime datetime = entry->StartTimeL().TimeUtcL().DateTime();       
+		TDateTime datetime = entry->StartTimeL().TimeLocalL().DateTime();       
 		dateString.Format( KCalendarTimeFormat, datetime.Year(),
 		                                     TInt(datetime.Month()+ 1),
 		                                     datetime.Day() + 1,
-		                                     datetime.Hour()+ 1,
+		                                     datetime.Hour(),
 		                                     datetime.Minute());
 		index_item->AddFieldL(KCalendarStartTimeField, dateString, CDocumentField::EStoreYes | CDocumentField::EIndexUnTokenized);
 
-		TDateTime endTime = entry->EndTimeL().TimeUtcL().DateTime();		
+		TDateTime endTime = entry->EndTimeL().TimeLocalL().DateTime();		
 		dateString.Format( KCalendarTimeFormat, endTime.Year(),
                                                 TInt(endTime.Month()+ 1),
                                                 endTime.Day() + 1,
-                                                endTime.Hour()+ 1,
+                                                endTime.Hour(),
                                                 endTime.Minute());
 		index_item->AddFieldL(KCalendarEndTimeField, dateString, CDocumentField::EStoreYes | CDocumentField::EIndexUnTokenized);
 		
-		TTime completedTime = entry->CompletedTimeL().TimeUtcL();
-		if( completedTime != Time::NullTTime() && CCalEntry::ETodo == entry->EntryTypeL())
+		
+		if( CCalEntry::ETodo == entry->EntryTypeL())
 		    {
-            TDateTime compTime = completedTime.DateTime();
-            dateString.Format( KCalendarTimeFormat, compTime.Year(),
-                                                TInt(compTime.Month()+ 1),
-                                                compTime.Day() + 1,
-                                                compTime.Hour()+ 1,
-                                                compTime.Minute());
-            index_item->AddFieldL(KCalenderCompletedField, dateString, CDocumentField::EStoreYes | CDocumentField::EIndexUnTokenized);
+            TUint priority = entry->PriorityL();        
+            switch(priority)
+                {
+                case 1:
+                    index_item->AddFieldL(KCalendarPriorityField, KCalendarPriorityHigh);
+                    break;
+                case 2:
+                    index_item->AddFieldL(KCalendarPriorityField, KCalendarPriorityMedium);
+                    break;
+                case 3:
+                    index_item->AddFieldL(KCalendarPriorityField, KCalendarPriorityLow);
+                    break;
+                default:
+                    index_item->AddFieldL(KCalendarPriorityField, KNullDesC);
+                    break;
+                }
+            TTime completedTime = entry->CompletedTimeL().TimeLocalL();
+            if( completedTime != Time::NullTTime())
+                {
+                TDateTime compTime = completedTime.DateTime();
+                dateString.Format( KCalendarTimeFormat, compTime.Year(),
+                                                    TInt(compTime.Month()+ 1),
+                                                    compTime.Day() + 1,
+                                                    compTime.Hour(),
+                                                    compTime.Minute());
+                index_item->AddFieldL(KCalenderCompletedField, dateString, CDocumentField::EStoreYes | CDocumentField::EIndexUnTokenized);
+                }
 		    }
 		index_item->AddFieldL(KMimeTypeField, KMimeTypeCalendar, CDocumentField::EStoreYes | CDocumentField::EIndexUnTokenized);
-
+#ifdef USE_HIGHLIGHTER		
+    	TInt excerptLength = 1 /*single 1-character delimiters*/ + entry->DescriptionL().Length() + entry->LocationL().Length() + 1 + entry->SummaryL().Length();
+#else    	
     	TInt excerptLength = 1 /*single 1-character delimiters*/ + entry->DescriptionL().Length() + entry->LocationL().Length();
+#endif    	
 		HBufC* excerpt = HBufC::NewLC(excerptLength);
 		TPtr excerptDes = excerpt->Des();
 		excerptDes.Append(entry->DescriptionL());
 		excerptDes.Append(KExcerptDelimiter);
 		excerptDes.Append(entry->LocationL());
-
-        index_item->AddExcerptL(*excerpt);
+#ifdef USE_HIGHLIGHTER		
+	    excerptDes.Append(KExcerptDelimiter);
+	    excerptDes.Append(entry->SummaryL());
+#endif	    
+	    index_item->AddExcerptL(*excerpt);
         CleanupStack::PopAndDestroy(excerpt);
         CleanupStack::PopAndDestroy(entry);
 
@@ -461,46 +469,19 @@
 		if (aActionType == ECPixAddAction)
 			{
 			TRAPD(err, iIndexer->AddL(*index_item));
-			if (err == KErrNone)
-				{
-				OstTrace0( TRACE_NORMAL, DUP2_CCALENDARPLUGIN_CREATEENTRYL, "CCalendarPlugin::CreateEntryL(): Added." );
-				CPIXLOGSTRING("CCalendarPlugin::CreateEntryL(): Added.");
-				}
-			else
-				{
-				OstTrace1( TRACE_NORMAL, DUP3_CCALENDARPLUGIN_CREATEENTRYL, "CCalendarPlugin::CreateEntryL();Error %d in adding", err );
-				CPIXLOGSTRING2("CCalendarPlugin::CreateEntryL(): Error %d in adding.", err);
-				}			
+			OstTrace1( TRACE_NORMAL, DUP8_CCALENDARPLUGIN_CREATEENTRYL, "CCalendarPlugin::CreateEntryL: Indexer->AddL;err=%d", err );			
 			}
-		else if (aActionType == ECPixUpdateAction)
+		else
 			{
 			TRAPD(err, iIndexer->UpdateL(*index_item));
-			if (err == KErrNone)
-				{
-				OstTrace0( TRACE_NORMAL, DUP4_CCALENDARPLUGIN_CREATEENTRYL, "CCalendarPlugin::CreateEntryL(): Updated." );
-				CPIXLOGSTRING("CCalendarPlugin::CreateEntryL(): Updated.");
-				}
-			else
-				{
-				OstTrace1( TRACE_NORMAL, DUP5_CCALENDARPLUGIN_CREATEENTRYL, "CCalendarPlugin::CreateEntryL();Error %d in updating", err );
-				CPIXLOGSTRING2("CCalendarPlugin::CreateEntryL(): Error %d in updating.", err);
-				}			
+			OstTrace1( TRACE_NORMAL, DUP9_CCALENDARPLUGIN_CREATEENTRYL, "CCalendarPlugin::CreateEntryL: iIndexer->UpdateL;err=%d", err );	
 			}
 		CleanupStack::PopAndDestroy(index_item);
 		}
 	else if (aActionType == ECPixRemoveAction)
 		{
 		TRAPD(err, iIndexer->DeleteL(docid_str));
-		if (err == KErrNone)
-			{
-			OstTrace0( TRACE_NORMAL, DUP6_CCALENDARPLUGIN_CREATEENTRYL, "CCalendarPlugin::CreateEntryL(): Deleted." );
-			CPIXLOGSTRING("CCalendarPlugin::CreateEntryL(): Deleted.");
-			}
-		else
-			{
-			OstTrace1( TRACE_NORMAL, DUP7_CCALENDARPLUGIN_CREATEENTRYL, "CCalendarPlugin::CreateEntryL();Error %d in deleting", err );
-			CPIXLOGSTRING2("CCalendarPlugin::CreateEntryL(): Error %d in deleting.", err);				
-			}
+		OstTrace1( TRACE_NORMAL, DUP2_CCALENDARPLUGIN_CREATEENTRYL, "CCalendarPlugin::CreateEntryL: iIndexer->RemoveL;err=%d", err );
 		}
 
 	}