Revision: 201011
authorDremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
Mon, 19 Apr 2010 14:40:05 +0300
changeset 0 ccd0fd43f247
child 1 fa8dc2f261a9
child 2 208a4ba3894c
Revision: 201011 Kit: 201015
browserplugin/cpixnpplugin/bwins/npcpixplugin.def
browserplugin/cpixnpplugin/data/2001f6f9.rss
browserplugin/cpixnpplugin/data/cpixnpplugin.rls
browserplugin/cpixnpplugin/discussion.txt
browserplugin/cpixnpplugin/eabi/npcpixplugin.def
browserplugin/cpixnpplugin/group/bld.inf
browserplugin/cpixnpplugin/group/cpixnpplugin.mmp
browserplugin/cpixnpplugin/howto.txt
browserplugin/cpixnpplugin/inc/ccpixnpplugin.h
browserplugin/cpixnpplugin/inc/ccpixnppluginecom.h
browserplugin/cpixnpplugin/inc/ccpixnpplugininterface.h
browserplugin/cpixnpplugin/inc/ccpixnpsearcher.h
browserplugin/cpixnpplugin/inc/ccpixnpsearcherinterface.h
browserplugin/cpixnpplugin/inc/ccpixnpsearcherobserver.h
browserplugin/cpixnpplugin/inc/cmobileinfo.h
browserplugin/cpixnpplugin/inc/cnpdocumentfield.h
browserplugin/cpixnpplugin/inc/cnpdocumentfieldinterface.h
browserplugin/cpixnpplugin/inc/cnpsearchdocument.h
browserplugin/cpixnpplugin/inc/cnpsearchdocumentinterface.h
browserplugin/cpixnpplugin/inc/cobjectinterface.h
browserplugin/cpixnpplugin/inc/cpixnpexceptions.h
browserplugin/cpixnpplugin/inc/idl/icpixnpplugin.h
browserplugin/cpixnpplugin/inc/idl/icpixnpsearcher.h
browserplugin/cpixnpplugin/inc/idl/icpixnpsearcherobserver.h
browserplugin/cpixnpplugin/inc/idl/inpdocumentfield.h
browserplugin/cpixnpplugin/inc/idl/inpsearchdocument.h
browserplugin/cpixnpplugin/inc/msvui.h
browserplugin/cpixnpplugin/inc/nputils.h
browserplugin/cpixnpplugin/src/ccpixnpplugin.cpp
browserplugin/cpixnpplugin/src/ccpixnppluginecom.cpp
browserplugin/cpixnpplugin/src/ccpixnpplugininterface.cpp
browserplugin/cpixnpplugin/src/ccpixnpsearcher.cpp
browserplugin/cpixnpplugin/src/ccpixnpsearcherinterface.cpp
browserplugin/cpixnpplugin/src/ccpixnpsearcherobserver.cpp
browserplugin/cpixnpplugin/src/cmobileinfo.cpp
browserplugin/cpixnpplugin/src/cnpdocumentfield.cpp
browserplugin/cpixnpplugin/src/cnpdocumentfieldinterface.cpp
browserplugin/cpixnpplugin/src/cnpsearchdocument.cpp
browserplugin/cpixnpplugin/src/cnpsearchdocumentinterface.cpp
browserplugin/cpixnpplugin/src/cobjectinterface.cpp
browserplugin/cpixnpplugin/src/cpixnpexceptions.cpp
browserplugin/cpixnpplugin/src/msvui.cpp
browserplugin/cpixnpplugin/src/nputils.cpp
cenrep/20029ac7.cre
cenrep/20029ac7.txt
conf/s60/cpixplugincommon.confml
conf/s60/cpixplugincommon_20029ac7.crml
group/bld.inf
harvesterplugins/applications/data/2001a9d7.rss
harvesterplugins/applications/group/applicationsplugin.mmp
harvesterplugins/applications/group/bld.inf
harvesterplugins/applications/inc/applicationsplugin.h
harvesterplugins/applications/src/applicationsplugin.cpp
harvesterplugins/applications/src/tproxy.cpp
harvesterplugins/bookmarks/data/2001a9d3.rss
harvesterplugins/bookmarks/group/bld.inf
harvesterplugins/bookmarks/group/bookmarksplugin.mmp
harvesterplugins/bookmarks/inc/bookmarksplugin.h
harvesterplugins/bookmarks/src/bookmarksplugin.cpp
harvesterplugins/bookmarks/src/tproxy.cpp
harvesterplugins/calendar/data/2001f704.rss
harvesterplugins/calendar/group/bld.inf
harvesterplugins/calendar/group/calendarplugin.mmp
harvesterplugins/calendar/inc/ccalendarplugin.h
harvesterplugins/calendar/src/ccalendarplugin.cpp
harvesterplugins/calendar/src/tproxy.cpp
harvesterplugins/contacts/data/2001f702.rss
harvesterplugins/contacts/group/bld.inf
harvesterplugins/contacts/group/contactsplugin.mmp
harvesterplugins/contacts/inc/ccontactsplugin.h
harvesterplugins/contacts/src/ccontactsplugin.cpp
harvesterplugins/contacts/src/tproxy.cpp
harvesterplugins/file/data/2001f703.rss
harvesterplugins/file/fastfindfileserverplugin/group/bld.inf
harvesterplugins/file/fastfindfileserverplugin/group/fastfindfileserverplugin.mmp
harvesterplugins/file/fastfindfileserverplugin/inc/fastfindfileserverplugin.h
harvesterplugins/file/fastfindfileserverplugin/inc/fsutil.h
harvesterplugins/file/fastfindfileserverplugin/inc/fsutil.inl
harvesterplugins/file/fastfindfileserverplugin/inc/harvesterlog.h
harvesterplugins/file/fastfindfileserverplugin/src/fastfindfileserverplugin.cpp
harvesterplugins/file/group/bld.inf
harvesterplugins/file/group/fileplugin.mmp
harvesterplugins/file/inc/cfileharvester.h
harvesterplugins/file/inc/cfilemonitor.h
harvesterplugins/file/inc/cfileplugin.h
harvesterplugins/file/inc/cfolderrenamedharvester.h
harvesterplugins/file/inc/cmmcmonitor.h
harvesterplugins/file/inc/monitorplugin/fastfindfileserverpluginclient.h
harvesterplugins/file/inc/monitorplugin/fastfindfileserverpluginclient.inl
harvesterplugins/file/src/cfileharvester.cpp
harvesterplugins/file/src/cfilemonitor.cpp
harvesterplugins/file/src/cfileplugin.cpp
harvesterplugins/file/src/cfolderrenamedharvester.cpp
harvesterplugins/file/src/cmmcmonitor.cpp
harvesterplugins/file/src/tproxy.cpp
harvesterplugins/group/bld.inf
harvesterplugins/inc/s60performance.h
harvesterplugins/media/audio/data/20029ab9.rss
harvesterplugins/media/audio/group/audioplugin.mmp
harvesterplugins/media/audio/group/bld.inf
harvesterplugins/media/audio/inc/cpixmediaaudiodoc.h
harvesterplugins/media/audio/inc/mediaplugin.h
harvesterplugins/media/audio/src/cpixmediaaudiodoc.cpp
harvesterplugins/media/audio/src/mediaplugin.cpp
harvesterplugins/media/audio/src/tproxy.cpp
harvesterplugins/media/group/bld.inf
harvesterplugins/media/image/data/20029abb.rss
harvesterplugins/media/image/group/bld.inf
harvesterplugins/media/image/group/imageplugin.mmp
harvesterplugins/media/image/inc/cpixmediaimagedoc.h
harvesterplugins/media/image/inc/imageplugin.h
harvesterplugins/media/image/src/cpixmediaimagedoc.cpp
harvesterplugins/media/image/src/imageplugin.cpp
harvesterplugins/media/image/src/tproxy.cpp
harvesterplugins/media/mediautils/group/bld.inf
harvesterplugins/media/mediautils/group/mediautils.mmp
harvesterplugins/media/mediautils/inc/cpixdocfetcher.h
harvesterplugins/media/mediautils/inc/cpixindexerutils.h
harvesterplugins/media/mediautils/inc/cpixmdedbmanager.h
harvesterplugins/media/mediautils/inc/mdeharvester.h
harvesterplugins/media/mediautils/inc/mdeobjectqueuemanager.h
harvesterplugins/media/mediautils/inc/mdsitementity.h
harvesterplugins/media/mediautils/inc/mdsmediamonitor.h
harvesterplugins/media/mediautils/inc/mdssessionobjectutils.h
harvesterplugins/media/mediautils/inc/mediaobjecthandler.h
harvesterplugins/media/mediautils/inc/mmceventobserver.h
harvesterplugins/media/mediautils/inc/mmcmonitor.h
harvesterplugins/media/mediautils/src/cpixdocfetcher.cpp
harvesterplugins/media/mediautils/src/cpixindexerutils.cpp
harvesterplugins/media/mediautils/src/cpixmdedbmanager.cpp
harvesterplugins/media/mediautils/src/mdeharvester.cpp
harvesterplugins/media/mediautils/src/mdeobjectqueuemanager.cpp
harvesterplugins/media/mediautils/src/mdsitementity.cpp
harvesterplugins/media/mediautils/src/mdsmediamonitor.cpp
harvesterplugins/media/mediautils/src/mdssessionobjectutils.cpp
harvesterplugins/media/mediautils/src/mmcmonitor.cpp
harvesterplugins/media/video/data/20029aba.rss
harvesterplugins/media/video/group/bld.inf
harvesterplugins/media/video/group/videoplugin.mmp
harvesterplugins/media/video/inc/cpixmediavideodoc.h
harvesterplugins/media/video/inc/videoplugin.h
harvesterplugins/media/video/src/cpixmediavideodoc.cpp
harvesterplugins/media/video/src/tproxy.cpp
harvesterplugins/media/video/src/videoplugin.cpp
harvesterplugins/messaging/data/2001f701.rss
harvesterplugins/messaging/group/bld.inf
harvesterplugins/messaging/group/messageplugin.mmp
harvesterplugins/messaging/inc/cmessagedatahandler.h
harvesterplugins/messaging/inc/cmessageharvester.h
harvesterplugins/messaging/inc/cmessagemonitor.h
harvesterplugins/messaging/inc/cmessageplugin.h
harvesterplugins/messaging/src/cmessagedatahandler.cpp
harvesterplugins/messaging/src/cmessageharvester.cpp
harvesterplugins/messaging/src/cmessagemonitor.cpp
harvesterplugins/messaging/src/cmessageplugin.cpp
harvesterplugins/messaging/src/tproxy.cpp
harvesterplugins/notes/data/2001a9d8.rss
harvesterplugins/notes/group/bld.inf
harvesterplugins/notes/group/notesplugin.mmp
harvesterplugins/notes/inc/notesplugin.h
harvesterplugins/notes/src/notesplugin.cpp
harvesterplugins/notes/src/tproxy.cpp
harvesterplugins/tsrc/harvesterplugintester/Bmarm/harvesterplugintesteru.def
harvesterplugins/tsrc/harvesterplugintester/Bwins/harvesterplugintesteru.def
harvesterplugins/tsrc/harvesterplugintester/EABI/harvesterplugintesteru.def
harvesterplugins/tsrc/harvesterplugintester/conf/eagle_landed.mp3
harvesterplugins/tsrc/harvesterplugintester/conf/harvesterplugintester.cfg
harvesterplugins/tsrc/harvesterplugintester/conf/niagara.wmv
harvesterplugins/tsrc/harvesterplugintester/conf/notesalphanumerictest.txt
harvesterplugins/tsrc/harvesterplugintester/conf/noteslongtest.txt
harvesterplugins/tsrc/harvesterplugintester/conf/notestest.txt
harvesterplugins/tsrc/harvesterplugintester/conf/testattachment.txt
harvesterplugins/tsrc/harvesterplugintester/conf/testframework.ini
harvesterplugins/tsrc/harvesterplugintester/group/bld.inf
harvesterplugins/tsrc/harvesterplugintester/group/harvesterplugintester.mmp
harvesterplugins/tsrc/harvesterplugintester/group/harvesterplugintester.pkg
harvesterplugins/tsrc/harvesterplugintester/group/harvesterplugintester_doxyfile.txt
harvesterplugins/tsrc/harvesterplugintester/group/harvesterplugintester_nrm.mmp
harvesterplugins/tsrc/harvesterplugintester/inc/ccalendarobserver.h
harvesterplugins/tsrc/harvesterplugintester/inc/cmessagesessionobserver.h
harvesterplugins/tsrc/harvesterplugintester/inc/harvesterobserver.h
harvesterplugins/tsrc/harvesterplugintester/inc/harvesterplugintester.h
harvesterplugins/tsrc/harvesterplugintester/sis/cpixstiftest.pkg
harvesterplugins/tsrc/harvesterplugintester/src/capsmod_exe/group/bld.inf
harvesterplugins/tsrc/harvesterplugintester/src/capsmod_exe/group/capsmod_exe.mmp
harvesterplugins/tsrc/harvesterplugintester/src/capsmod_exe/group/capsmod_exe_nrm.mmp
harvesterplugins/tsrc/harvesterplugintester/src/capsmod_exe/src/capsmod_exe.cpp
harvesterplugins/tsrc/harvesterplugintester/src/ccalanderobserver.cpp
harvesterplugins/tsrc/harvesterplugintester/src/cmessagesessionobserver.cpp
harvesterplugins/tsrc/harvesterplugintester/src/harvesterobserver.cpp
harvesterplugins/tsrc/harvesterplugintester/src/harvesterplugintester.cpp
harvesterplugins/tsrc/harvesterplugintester/src/harvesterplugintesterblocks.cpp
harvesterplugins/tsrc/performanceSummary.pl
layers.sysdef.xml
rom/cpix_app.iby
searchui/Searchapplication/Searchapplication.pri
searchui/Searchapplication/Searchapplication.pro
searchui/Searchapplication/Searchapplication_installs_symbian.pri
searchui/Searchapplication/Searchapplication_installs_unix.pri
searchui/Searchapplication/Searchapplication_installs_win32.pri
searchui/Searchapplication/inc/Search.h
searchui/Searchapplication/resources/search_app_icon.svg
searchui/Searchapplication/src/Search.cpp
searchui/Searchapplication/src/main.cpp
searchui/bwins/searchindevicehandleru.def
searchui/eabi/searchindevicehandleru.def
searchui/inc/Search_global.h
searchui/indevicehandler/inc/indevicehandler.h
searchui/indevicehandler/indevicehandler.pri
searchui/indevicehandler/indevicehandler.pro
searchui/indevicehandler/src/indevicehandler.cpp
searchui/indevicehandler/tsrc/t_indevicehandler/inc/t_indevicehandler.h
searchui/indevicehandler/tsrc/t_indevicehandler/src/t_indevicehandler.cpp
searchui/indevicehandler/tsrc/t_indevicehandler/t_indevicehandler.pri
searchui/indevicehandler/tsrc/t_indevicehandler/t_indevicehandler.pro
searchui/indevicehandler/tsrc/t_src.pro
searchui/rom/search.iby
searchui/rom/searchresources.iby
searchui/runtimeproviders/runtimeproviders.pro
searchui/runtimeproviders/searchruntimeprovider/inc/searchruntime.h
searchui/runtimeproviders/searchruntimeprovider/inc/searchruntimeprovider.h
searchui/runtimeproviders/searchruntimeprovider/resource/searchruntimeprovider.manifest
searchui/runtimeproviders/searchruntimeprovider/searchruntimeprovider.pri
searchui/runtimeproviders/searchruntimeprovider/searchruntimeprovider.pro
searchui/runtimeproviders/searchruntimeprovider/searchruntimeprovider_installs_symbian.pri
searchui/runtimeproviders/searchruntimeprovider/searchruntimeprovider_installs_unix.pri
searchui/runtimeproviders/searchruntimeprovider/searchruntimeprovider_installs_win32.pri
searchui/runtimeproviders/searchruntimeprovider/src/searchruntime.cpp
searchui/runtimeproviders/searchruntimeprovider/src/searchruntimeprovider.cpp
searchui/search_exports_to_rom.pri
searchui/searchui.pro
searchui/stateproviders/searchstateprovider/inc/searchinitstate.h
searchui/stateproviders/searchstateprovider/inc/searchprogressivestate.h
searchui/stateproviders/searchstateprovider/inc/searchsettingsstate.h
searchui/stateproviders/searchstateprovider/inc/searchstateprovider.h
searchui/stateproviders/searchstateprovider/inc/settingswidget.h
searchui/stateproviders/searchstateprovider/resource/searchstateprovider.manifest
searchui/stateproviders/searchstateprovider/resources/calender.png
searchui/stateproviders/searchstateprovider/resources/camera.png
searchui/stateproviders/searchstateprovider/resources/email.png
searchui/stateproviders/searchstateprovider/resources/message.png
searchui/stateproviders/searchstateprovider/resources/phonebook.png
searchui/stateproviders/searchstateprovider/resources/resources.qrc
searchui/stateproviders/searchstateprovider/resources/sound.png
searchui/stateproviders/searchstateprovider/resources/video.png
searchui/stateproviders/searchstateprovider/searchstateprovider.pri
searchui/stateproviders/searchstateprovider/searchstateprovider.pro
searchui/stateproviders/searchstateprovider/searchstateprovider_installs_symbian.pri
searchui/stateproviders/searchstateprovider/searchstateprovider_installs_unix.pri
searchui/stateproviders/searchstateprovider/searchstateprovider_installs_win32.pri
searchui/stateproviders/searchstateprovider/src/searchinitstate.cpp
searchui/stateproviders/searchstateprovider/src/searchprogressivestate.cpp
searchui/stateproviders/searchstateprovider/src/searchsettingsstate.cpp
searchui/stateproviders/searchstateprovider/src/searchstateprovider.cpp
searchui/stateproviders/searchstateprovider/src/settingswidget.cpp
searchui/stateproviders/searchstateprovider/tsrc/t_searchstateprovider/inc/t_searchstateprovider.h
searchui/stateproviders/searchstateprovider/tsrc/t_searchstateprovider/src/t_searchinitstate.cpp
searchui/stateproviders/searchstateprovider/tsrc/t_searchstateprovider/src/t_searchprogressivestate.cpp
searchui/stateproviders/searchstateprovider/tsrc/t_searchstateprovider/src/t_searchsettingsstate.cpp
searchui/stateproviders/searchstateprovider/tsrc/t_searchstateprovider/src/t_searchstateprovider.cpp
searchui/stateproviders/searchstateprovider/tsrc/t_searchstateprovider/src/t_settingswidget.cpp
searchui/stateproviders/searchstateprovider/tsrc/t_searchstateprovider/t_searchstateprovider.pri
searchui/stateproviders/searchstateprovider/tsrc/t_searchstateprovider/t_searchstateprovider.pro
searchui/stateproviders/searchstateprovider/tsrc/tsrc.pro
searchui/stateproviders/stateproviders.pro
sysdef_1_5_1.dtd
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/browserplugin/cpixnpplugin/bwins/npcpixplugin.def	Mon Apr 19 14:40:05 2010 +0300
@@ -0,0 +1,5 @@
+EXPORTS
+	?ImplementationGroupProxy@@YAPBUTImplementationProxy@@AAH@Z @ 1 NONAME ; struct TImplementationProxy const * ImplementationGroupProxy(int &)
+	?InitializeFuncs@@YAFPAU_NPPluginFuncs@@@Z @ 2 NONAME ; short InitializeFuncs(struct _NPPluginFuncs *)
+	?NPP_Shutdown@@YAXXZ @ 3 NONAME ; void NPP_Shutdown(void)
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/browserplugin/cpixnpplugin/data/2001f6f9.rss	Mon Apr 19 14:40:05 2010 +0300
@@ -0,0 +1,57 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:   Registry file for Ecom style Browser Windowless Plugin.
+*
+*/
+
+
+#include "RegistryInfo.rh"
+#include "CPixNPPlugin.rls"
+
+//  RESOURCE DEFINITIONS 
+// -----------------------------------------------------------------------------
+//   
+// Registry info
+// The UIDs for the filters implemented in this DLL
+// -----------------------------------------------------------------------------
+
+RESOURCE REGISTRY_INFO theInfo
+    {
+    dll_uid = 0x2001f6f9;   // should match the name of the file. 
+                            // 3rd Uid of associated plugin dll (declared in the dll mmp file)
+    interfaces =
+        {
+        INTERFACE_INFO
+            { 
+            // Identifies plugin type (used by ECom)
+            interface_uid = 0x101F8810;
+                            
+            implementations = 
+                {
+                IMPLEMENTATION_INFO
+                    {
+                    // Specific implementation (must match an implementation entry in the dll)
+                    implementation_uid = 0x2001f6f9;
+                    version_no = 1;
+                    // File name;Plugin's name
+                    display_name = STRING_r_cpixnpplugin_name;
+                    // Mimetypes and mime extensions
+                    default_data = STRING_r_cpixnpplugin_mime;
+                    // Plugin's description
+                    opaque_data = STRING_r_cpixnpplugin_desc;
+                    }
+                };
+            }
+        };
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/browserplugin/cpixnpplugin/data/cpixnpplugin.rls	Mon Apr 19 14:40:05 2010 +0300
@@ -0,0 +1,21 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  This file contains all the strings for resources
+*
+*/
+
+
+rls_string STRING_r_cpixnpplugin_name "npCPixPlugin.dll;CPix Plugin"
+rls_string STRING_r_cpixnpplugin_description "CPix Plugin"
+rls_string STRING_r_cpixnpplugin_mime "application/x-nokia-search";
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/browserplugin/cpixnpplugin/discussion.txt	Mon Apr 19 14:40:05 2010 +0300
@@ -0,0 +1,27 @@
+
+About naming: 
+-------------
+
+- Example classess uses NP prefix
+- ECom plugin interfaces uses EComBrowserPlugin
+- The API is called NP (netscape plugin) plugin API. NP runtime is part of it 
+- The environment where we are aiming is WebKit 
+- Browser is main using WebKit
+- So, of which of these (NP, WebKit or Browser) we are developing plugin for? 
+  - NP apparently. The plugin should also work (not really) in other S60 NP 
+    compatible environments (like the old abandoned browser, all thought it 
+    didn't support npruntime)
+- The classes used in the plugin should be differentiated from S60 side classes
+  in some way. Currently it is done with NP 'prefix'. Inconsistently, it appears 
+  - In front of names: CNPSearchDocument
+  - And in the middle of names: CCPixNPSearchDocument
+  -> TODO? Switch CCPixNPSearchDocument to CNPCPixSearchDocument
+ 
+
+About design:
+-------------
+
+- Are the inc/idl classes meant to allow direct usage of the objects e.g. 
+  from other modules. If this is the case, are they allowed to expose 
+  S60 interfaces (with descriptors etc.), or should they expose some 
+  standard POSIX interfaces instead. 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/browserplugin/cpixnpplugin/eabi/npcpixplugin.def	Mon Apr 19 14:40:05 2010 +0300
@@ -0,0 +1,31 @@
+EXPORTS
+	_Z24ImplementationGroupProxyRi @ 1 NONAME
+	_Z12NPP_Shutdownv @ 2 NONAME
+	_Z15InitializeFuncsP14_NPPluginFuncs @ 3 NONAME
+	_ZTI11CMobileInfo @ 4 NONAME ; #<TI>#
+	_ZTI13CCPixNPPlugin @ 5 NONAME ; #<TI>#
+	_ZTI15CCPixNPSearcher @ 6 NONAME ; #<TI>#
+	_ZTI16CNPDocumentField @ 7 NONAME ; #<TI>#
+	_ZTI16CObjectInterface @ 8 NONAME ; #<TI>#
+	_ZTI17CCPixNPPluginEcom @ 9 NONAME ; #<TI>#
+	_ZTI17CNPSearchDocument @ 10 NONAME ; #<TI>#
+	_ZTI22CCPixNPPluginInterface @ 11 NONAME ; #<TI>#
+	_ZTI23CCPixNPSearcherObserver @ 12 NONAME ; #<TI>#
+	_ZTI24CCPixNPSearcherInterface @ 13 NONAME ; #<TI>#
+	_ZTI25CNPDocumentFieldInterface @ 14 NONAME ; #<TI>#
+	_ZTI26CNPSearchDocumentInterface @ 15 NONAME ; #<TI>#
+	_ZTI6CMsvUI @ 16 NONAME ; #<TI>#
+	_ZTV11CMobileInfo @ 17 NONAME ; #<VT>#
+	_ZTV13CCPixNPPlugin @ 18 NONAME ; #<VT>#
+	_ZTV15CCPixNPSearcher @ 19 NONAME ; #<VT>#
+	_ZTV16CNPDocumentField @ 20 NONAME ; #<VT>#
+	_ZTV16CObjectInterface @ 21 NONAME ; #<VT>#
+	_ZTV17CCPixNPPluginEcom @ 22 NONAME ; #<VT>#
+	_ZTV17CNPSearchDocument @ 23 NONAME ; #<VT>#
+	_ZTV22CCPixNPPluginInterface @ 24 NONAME ; #<VT>#
+	_ZTV23CCPixNPSearcherObserver @ 25 NONAME ; #<VT>#
+	_ZTV24CCPixNPSearcherInterface @ 26 NONAME ; #<VT>#
+	_ZTV25CNPDocumentFieldInterface @ 27 NONAME ; #<VT>#
+	_ZTV26CNPSearchDocumentInterface @ 28 NONAME ; #<VT>#
+	_ZTV6CMsvUI @ 29 NONAME ; #<VT>#
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/browserplugin/cpixnpplugin/group/bld.inf	Mon Apr 19 14:40:05 2010 +0300
@@ -0,0 +1,28 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  This file provides the information required for building the
+				whole of a CPixBrowserPlugin
+*
+*/
+
+#include <bldvariant.hrh>
+//#include <domain/osextensions/platform_paths.hrh>
+#include <platform_paths.hrh>
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_MMPFILES
+CPixNPPlugin.mmp
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/browserplugin/cpixnpplugin/group/cpixnpplugin.mmp	Mon Apr 19 14:40:05 2010 +0300
@@ -0,0 +1,104 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  This is the project specification file for CPixBrowserPlugin
+*
+*/
+
+//#include <domain/osextensions/platform_paths.hrh>
+#include <data_caging_paths.hrh>
+#include <platform_paths.hrh>
+
+TARGET		  npCPixPlugin.dll
+TARGETTYPE    PLUGIN
+UID			  0x10009D8D 0x2001f6f9 // old test UID 0x0F3DD41C
+
+EPOCALLOWDLLDATA
+CAPABILITY    CAP_GENERAL_DLL -DRM
+VENDORID   VID_DEFAULT
+
+DEFFILE         npCPixPlugin.def
+NOSTRICTDEF
+
+SOURCEPATH      ../data
+START RESOURCE 2001F6F9.rss
+	TARGET npCPixPlugin.rsc
+END
+
+APP_LAYER_SYSTEMINCLUDE
+SYSTEMINCLUDE   /epoc32/include/libc
+SYSTEMINCLUDE   /epoc32/include/ecom
+SYSTEMINCLUDE   /epoc32/include/CPixSearch
+//SYSTEMINCLUDE   /epoc32/include/domain/middleware
+
+USERINCLUDE ../inc
+USERINCLUDE ../inc/idl
+//USERINCLUDE ../../SearchClient/inc
+USERINCLUDE ../../../cfg
+
+SOURCEPATH ../src
+SOURCE CCPixNPPlugin.cpp 
+SOURCE CCPixNPPluginEcom.cpp 
+SOURCE CCPixNPPluginInterface.cpp 
+SOURCE CObjectInterface.cpp 
+SOURCE CNPSearchDocument.cpp 
+SOURCE CCPixNPSearcher.cpp 
+SOURCE CCPixNPSearcherInterface.cpp 
+SOURCE CNPDocumentFieldInterface.cpp 
+SOURCE CNPSearchDocumentInterface.cpp 
+SOURCE CCPixNPSearcherObserver.cpp
+SOURCE CNPDocumentField.cpp 
+SOURCE CPixNPExceptions.cpp 
+SOURCE NPUtils.cpp 
+SOURCE msvui.cpp // Message Viewer
+SOURCE CMobileInfo.cpp // Getting MCC
+
+LIBRARY ecom.lib
+LIBRARY euser.lib
+
+LIBRARY charconv.lib			// CnvUtfConverter
+LIBRARY fbscli.lib 				// CFbsBitmap
+LIBRARY bitgdi.lib				// CFbsBitGc
+LIBRARY cone.lib				// CCoeEnv
+LIBRARY CPixSearchClient.lib	// CPixSearchClient
+LIBRARY inetprotutil.lib
+
+//LIBRARY calenlauncher.lib		// Calendar Item View //@TODO: Not supported in TB10.1
+
+LIBRARY eikcore.lib				// Contact Item Viewer
+//LIBRARY pbkview.lib				// Contact Item Viewer //@TODO: Not supported in TB10.1
+
+LIBRARY msgs.lib				// Message Viewer
+LIBRARY mtur.lib				// Message Viewer
+
+LIBRARY mnclientlib.lib			// Maps
+LIBRARY lbs.lib 				// TCoordinate
+
+LIBRARY avkon.lib				// Application exit observation
+LIBRARY apparc.lib				// Application exit observation
+
+LIBRARY etel3rdparty.lib		// Obtaining IMSI code
+LIBRARY efsrv.lib               //For RFs
+LIBRARY           flogger.lib 	// Logging
+LIBRARY apgrfx.lib              //RApaLsSession
+LIBRARY ws32.lib                //RWsSession
+
+#ifdef __S60_50__
+LIBRARY npscript.lib
+#else
+#ifdef WINSCW
+LIBRARY JavaScriptCore_sdk.lib
+#else
+LIBRARY JavaScriptCore.lib
+#endif
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/browserplugin/cpixnpplugin/howto.txt	Mon Apr 19 14:40:05 2010 +0300
@@ -0,0 +1,58 @@
+The NPObject contains following important methods: 
+--------------------------------------------------
+
+/**
+ * Creates object for NP plugin npp of NPClass aClass. 
+ */
+NPObject* NPN_CreateObject(NPP npp, NPClass* class);
+
+/**
+ * Increases reference count for object
+ */
+NPObject* NPN_RetainObject(NPObject* object);
+
+/**
+ * Decreases reference count for object
+ */
+NPObject* NPN_RetainObject(NPObject* object);
+
+/**
+ * Calls object method
+ */
+... NPN_Invoke(...);
+ 
+ 
+NOTE:
+-----
+
+ - In the plugin architecture, objects have two forms 
+   - The NP 'wrapped' form of NPObject or e.g. CCPixNPSearcherObject
+   - And the nonwrapped form e.g. CCPixNPSearcher or MCPixNPSearcher
+ - Only the former form can be memory managed (Reference count set up and down) 
+   - This means that if object wishes to maintain references to an NP object, 
+     it needs to have access to the wrapped form. 
+ - Wrapped form vs. Nonwrapped form
+   - Wrapped form is more powerful, holding pointer also to the NP side handle
+   - Nonwrapped form is easier for the programmer
+   -> Still - to avoid refactoring - wrapped form should always be used 
+ 
+Open questions: 
+---------------
+
+ - How to handle const safety with wrapper objects?
+
+Nontrivial things: 
+------------------
+ 
+ - Should the /inc/idc/* interfaces contain refernces to NPVariants 
+    - At least the example code contains
+    - More difficult for the programmer 
+ - Who should create NP wrapping around objects? Interface or implementation class?
+   E.g. Should CCPixNPPlugin or CCPixNPPluginInterface wrap searcher into 
+   CPixNPSearcherObject form
+    - In CCPixNPPlugin case - it doesn't really matter. Ownership is given away in any 
+      case and the reference counting functionality is not needed in either side. 
+    - Generally the implementing class should hold responsibility
+    - E.g. If CNPSearchDocument wishes to hold ownership to its fields it needs
+      to be able to add references to the fields it creates. 
+ - Observers
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/browserplugin/cpixnpplugin/inc/ccpixnpplugin.h	Mon Apr 19 14:40:05 2010 +0300
@@ -0,0 +1,153 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: 
+*
+*/
+#ifndef CPIXBROWSERPLUGIN_H
+#define CPIXBROWSERPLUGIN_H
+
+// INCLUDES
+#include "CCPixNPPluginInterface.h" 
+#include <RSearchServerSession.h>
+#include <AknServerApp.h>
+
+#include <mnprovider.h>    // CMnProvider
+
+class CJSCallback;
+class CFbsBitmap;
+class CMsvUI;
+class CMnMapView;
+
+// CLASS DECLARATION
+
+/**
+ * Implements services described in MCPixNPPlugin. Provides
+ * the functionality for accessing the CPix services from NP Runtime 
+ * environment. In practice is used for creating searchers and 
+ * indexers at some latter point. 
+ */
+class CCPixNPPlugin : public CCPixNPPluginInterface, public MAknServerAppExitObserver
+{
+public: // Constructors and destructor
+
+	virtual ~CCPixNPPlugin();
+	static CCPixNPPlugin* NewL();
+	static CCPixNPPlugin* NewLC();
+	
+	void SetWindowL( NPWindow* aWindow );
+   
+private:
+	
+	CCPixNPPlugin();
+	void ConstructL();
+
+public: // From ICPixNPPlugin
+
+	virtual const TDesC& DocUidFieldName() const; 
+
+	virtual const TDesC& AppClassFieldName() const; 
+
+	virtual const TDesC& ExcerptFieldName() const; 
+
+	virtual const TDesC& MimeTypeFieldName() const; 
+
+	virtual const TDesC& AggregateFieldName() const; 
+
+	virtual const TDesC& DefaultFieldName() const; 
+	
+	virtual const TDesC& TermTextFieldName() const; 
+	
+	virtual const TDesC& TermDocFreqFieldName() const; 
+	
+	// Analysis related constants
+	
+	virtual const TDesC& StandardAnalyzerId() const; 
+
+	virtual const TDesC& StandardTokenizerId() const; 
+	
+	virtual const TDesC& WhitespaceTokenizerId() const;
+	
+	virtual const TDesC& LetterTokenizerId() const;
+	
+	virtual const TDesC& KeywordTokenizerId() const; 
+	
+	virtual const TDesC& StandardFilterId() const; 
+	
+	virtual const TDesC& LowercaseFilterId() const; 
+	
+	virtual const TDesC& AccentFilterId() const; 
+	
+	virtual const TDesC& StopFilterId() const; 
+	
+	virtual const TDesC& StemFilterId() const; 
+	
+	virtual const TDesC& LengthFilterId() const; 
+	
+	virtual const TDesC& EnglishLanguageId() const; 
+	
+	virtual const TDesC& FinnishLanguageId() const; 
+	
+	virtual const TDesC& HungarianLanguageId() const; 
+	
+	virtual const TDesC& RussianLanguageId() const; 
+
+	virtual CCPixNPSearcher* CreateSearcherL( const TDesC& aDomainSelector, const TDesC& aDefaultSearchField ) const;
+
+	virtual CCPixNPSearcher* CreateSearcherL( const TDesC& aDomainSelector ) const;
+
+	virtual void DefineVolumeL( const TDesC& aQualifiedBaseAppClass,
+								const TDesC& aIndexDbPath );
+
+	virtual void UnDefineVolumeL( const TDesC& aQualifiedBaseAppClass );
+	
+	
+	virtual void OpenContactL(TInt aContactId);	
+
+	virtual void OpenMessagingL(TInt aMesId);	
+
+	virtual void OpenCalendarL(TInt aCalId);
+	
+	virtual void OpenMapsL( TReal aLatitude, TReal aLongitude );
+	
+	//Added to launch Notes from Widget
+	virtual void OpenNoteL( const TInt aNoteId );
+	
+	virtual void GetDriveFromMediaIdL(HBufC* aMediaId,TDes& aDrive);
+	
+	virtual TInt GetVersionNumber() const;
+
+public: // From MAknServerAppExitObserver
+	
+    void HandleServerAppExit(TInt aReadon);
+	
+private: // member variables
+
+	// Search Server Session
+	RSearchServerSession iSearchServer;
+	
+	// Launches Message Viewer
+	CMsvUI* iMsvUI;
+	
+	// Maps content providers
+	RPointerArray<CMnProvider> iMnProviders;
+	
+	// Map view
+	CMnMapView* iMapView;
+	
+	//RFs file session
+	RFs     iFs;
+};
+
+#endif // WLESSPLUGIN_H
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/browserplugin/cpixnpplugin/inc/ccpixnppluginecom.h	Mon Apr 19 14:40:05 2010 +0300
@@ -0,0 +1,115 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: 
+*
+*/
+
+#ifndef CCPIXNPPLUGINECOM_H
+#define CCPIXNPPLUGINECOM_H
+
+//  INCLUDES
+#include <CEcomBrowserPluginInterface.h>
+
+#ifdef __S60_50__
+#include <npscript.h>
+#else
+#include <Javascriptcore/npruntime.h>
+#endif
+
+// CLASS DECLARATION
+
+/******************************************
+This class is specific to ECom Style Plugin.  This is used for passing
+plugin specific initialization information to and from browser.
+*******************************************/
+IMPORT_C NPError InitializeFuncs( NPPluginFuncs* aPpf );
+
+// CONSTANTS
+const TInt KCPixNPPluginImplementationValue = 0x2001f6f9; // Matches implementation_uid in rss file
+
+/**
+ *  CPixNPPluginEcom
+ *  Used for passing plugin specific initialization information to and from browser.
+ *  @since S60 v3.2
+ */
+class CCPixNPPluginEcom : public CEcomBrowserPluginInterface
+    {
+    public: // Functions from base classes
+
+        /**
+        * Two-phased constructor.
+        */
+        static CCPixNPPluginEcom* NewL( TAny* aInitParam );
+
+        /**
+        * Destructor
+        */
+        virtual ~CCPixNPPluginEcom();
+
+        /**
+        * Passed from the browser to the plugin and delcares what
+        * functions the browser makes available
+        */
+        NPNetscapeFuncs* Funcs() const { return iNpf; }
+
+    private:
+
+        // Default constructor
+        CCPixNPPluginEcom( NPNetscapeFuncs* aNpf );
+
+        // By default Symbian 2nd phase constructor is private.
+        void ConstructL( NPPluginFuncs* aPluginFuncs );
+
+        // Netscape Function Pointer
+        NPNetscapeFuncs* iNpf;
+    };
+
+/**
+********************************************************************************
+    Plugin API methods. Source located in CSystemInfoApi.cpp
+*********************************************************************************
+*/
+
+/**
+ * Create a plugin.
+ */
+
+NPError CPixPluginNewp( NPMIMEType pluginType, NPP instance, uint16 mode,
+                        CDesCArray* argn, CDesCArray* argv, NPSavedData* saved );
+
+/**
+ * Checks, whether it is ok to load the plugin. The page, which attempts
+ * to load plugin should be originated in a secure domain, like *.nokia.com or
+ * the local filesystem. 
+ */
+TBool CPixPluginAcceptLoadAttempt( NPP instance );
+/**
+ * Wrapper the errors
+ */
+void CPixPluginConstructL( NPP aInstance, CDesCArray* argn, CDesCArray* argv );
+
+/**
+ * Destroy a plugin.
+ */
+NPError CPixPluginDestroy( NPP aInstance, NPSavedData** save );
+
+/**
+ * Generic hook to retrieve values/attributes from the plugin.
+ */
+NPError CPixPluginGetvalue( NPP aInstance, NPPVariable variable, void *ret_value );
+
+
+#endif /*CCPIXNPPLUGINECOM_H*/
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/browserplugin/cpixnpplugin/inc/ccpixnpplugininterface.h	Mon Apr 19 14:40:05 2010 +0300
@@ -0,0 +1,106 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: 
+*
+*/
+
+
+#ifndef CPIXNPPLUGININTERFACE_H
+#define CPIXNPPLUGININTERFACE_H
+
+#include "e32def.h"
+
+//  INCLUDES
+#include "CObjectInterface.h"
+#include "idl/ICPixNPPlugin.h"
+
+// CLASS DECLARATION
+
+/**
+ * Provides the interface between browser and the actual functionality implemented
+ * in CCPixNPPlugin. Calls MCPixNPPlugin methods of the implementing class
+ * as a response to method invokation requests from the browser.
+ */
+class CCPixNPPluginInterface : public CObjectInterface, public MCPixNPPlugin
+    {
+public:
+    virtual ~CCPixNPPluginInterface();
+
+public:
+    bool InvokeL( NPIdentifier name, NPVariant *args, uint32_t argCount, NPVariant *result );
+    bool GetProperty( NPIdentifier name, NPVariant *variant );
+    bool SetPropertyL( NPIdentifier name, NPVariant *variant );
+
+protected:
+    void InitInterfaceL();
+
+private:
+    // calls RSearchServerSession::DefineVolume()
+    void InvokeDefineVolumeL(NPIdentifier name, NPVariant* args, uint32_t argCount, NPVariant *result);
+    // calls RSearchServerSession::UnDefineVolume()
+    void InvokeUnDefineVolumeL(NPIdentifier name, NPVariant* args, uint32_t argCount, NPVariant *result);
+    };
+    
+
+/**
+ ********************************************************************************
+     CPixPlugin API methods
+ *********************************************************************************
+ */
+ typedef struct
+     {
+     NPObject object;
+     CCPixNPPluginInterface *plugin;
+     } CPixPluginObject;
+
+ NPObject *CPixPluginAllocate();
+
+ void CPixPluginInvalidate();
+
+ void CPixPluginDeallocate( CPixPluginObject *obj );
+
+ bool CPixPluginHasMethod( CPixPluginObject *obj, NPIdentifier name );
+
+ bool CPixPluginInvokeFunctionL( CPixPluginObject* obj, NPIdentifier name,
+                                      NPVariant *args, uint32_t argCount, NPVariant *result );
+
+ bool CPixPluginHasProperty( CPixPluginObject *obj, NPIdentifier name );
+
+ bool CPixPluginGetProperty ( CPixPluginObject *obj, NPIdentifier name,
+                                    NPVariant *variant);
+
+ void CPixPluginSetProperty( CPixPluginObject *obj, NPIdentifier name,
+                                   NPVariant *variant);
+
+ static NPClass _CPixPluginClass =
+     {
+     0,
+     (NPAllocateFunctionPtr) CPixPluginAllocate,
+     (NPDeallocateFunctionPtr) CPixPluginDeallocate,
+     (NPInvalidateFunctionPtr) CPixPluginInvalidate,
+     (NPHasMethodFunctionPtr) CPixPluginHasMethod,
+     (NPInvokeFunctionPtr) CPixPluginInvokeFunctionL,
+     (NPInvokeDefaultFunctionPtr) 0,
+     (NPHasPropertyFunctionPtr) CPixPluginHasProperty,
+     (NPGetPropertyFunctionPtr) CPixPluginGetProperty,
+     (NPSetPropertyFunctionPtr) CPixPluginSetProperty,
+     (NPRemovePropertyFunctionPtr) 0
+     };
+
+ /**
+  * static instance of the function pointer table
+  */
+ static NPClass* CPixPluginClass = &_CPixPluginClass;
+    
+#endif // CPIXBROWSERPLUGININTERFACE_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/browserplugin/cpixnpplugin/inc/ccpixnpsearcher.h	Mon Apr 19 14:40:05 2010 +0300
@@ -0,0 +1,82 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: 
+*
+*/
+#ifndef CPIXNPSEARCHER_H_
+#define CPIXNPSEARCHER_H_
+
+//  INCLUDES
+#include "CCPixNPSearcherInterface.h"
+#include "CCPixNPSearcherObserver.h"
+#include "MCPixSearcherObserver.h"
+#include <RSearchServerSession.h>
+
+
+// Forward declarations
+
+// CLASS DECLARATION
+class CCPixSearcher;
+
+/**
+ * CCPixNPSearcher
+ * Implements services described in MCPixNPSearcher. Provides
+ * the functionality for committing searches into database associated
+ * with its base application class. 
+ */
+class CCPixNPSearcher : public CCPixNPSearcherInterface, MCPixSearchRequestObserver, MCPixNextDocumentRequestObserver 
+    {
+public:
+    static CCPixNPSearcher* NewL( const TDesC& aBaseAppClass, const TDesC& aDefaultSearchField );
+    static CCPixNPSearcher* NewL( const TDesC& aBaseAppClass );
+    virtual ~CCPixNPSearcher();
+    
+private:
+	CCPixNPSearcher();
+	
+    void ConstructL( const TDesC& aBaseAppClass, const TDesC& aDefaultSearchField );
+
+    void ConstructL( const TDesC& aBaseAppClass );
+
+    virtual void Invalidate(); 
+
+public: // From MCPixNPSearcher 
+	
+	virtual void SetObserverL( NPObject* aObserver ); 
+	
+	virtual void SetAnalyzerL( const TDesC& aAnalyzer ); 
+	
+	virtual void SearchL( const TDesC& aSearchTerms, const TDesC& aDocumentField = KNullDesC);
+
+	virtual void GetDocumentL(TInt aIndex);
+
+	virtual void Cancel();
+
+	virtual TBool IsActive();
+    
+public: // From MCPixSearcherObserver
+
+	virtual void HandleSearchResultsL(TInt aError, TInt aEstimatedResultCount);
+
+    virtual void HandleDocumentL(TInt aError, CSearchDocument* aDocument);
+	    
+private:
+	RSearchServerSession iSearchSession;
+	CCPixSearcher* iSearcher; 
+	
+	CCPixNPSearcherObserver* iObserver; 
+	
+    };
+
+#endif /*CPIXNPSEARCHER_H_*/
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/browserplugin/cpixnpplugin/inc/ccpixnpsearcherinterface.h	Mon Apr 19 14:40:05 2010 +0300
@@ -0,0 +1,99 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: 
+*
+*/
+#ifndef CCPIXNPSEARCHERINTERFACE_H_
+#define CCPIXNPSEARCHERINTERFACE_H_
+
+//  INCLUDES
+#include "CObjectInterface.h"
+#include "ICPixNPSearcher.h"
+
+// CLASS DECLARATION
+
+/**
+ * CCPixNPSearcherInterface
+ * Provides the interface between browser and the actual functionality implemented 
+ * in CCPixNPSearcher. Calls MCPixNPSearcher methods of the implementing class
+ * as a response to method invokation requests from the browser.
+ */
+class CCPixNPSearcherInterface : public CObjectInterface, public MCPixNPSearcher
+    {
+ public:
+    virtual ~CCPixNPSearcherInterface();
+
+ public:
+    bool InvokeL( NPIdentifier name, NPVariant *args, uint32_t argCount, NPVariant *result );
+    bool GetProperty( NPIdentifier name, NPVariant *variant );
+    bool SetPropertyL( NPIdentifier name, NPVariant *variant );
+    
+    virtual void Invalidate() = 0; 
+    
+ protected:
+	void InitInterfaceL();
+    };
+
+    
+/**
+ ********************************************************************************
+     CPixNPSearcherObject Plugin API methods
+ *********************************************************************************
+ */
+ typedef struct
+     {
+     NPObject object;
+     CCPixNPSearcherInterface *plugin;
+     } CPixNPSearcherObject;
+
+ NPObject* CPixNPSearcherAllocate();
+
+ void CPixNPSearcherInvalidate( CPixNPSearcherObject *obj );
+
+ void CPixNPSearcherDeallocate( CPixNPSearcherObject *obj );
+
+ bool CPixNPSearcherHasMethod( CPixNPSearcherObject *obj, NPIdentifier name );
+
+ bool CPixNPSearcherInvokeFunctionL( CPixNPSearcherObject* obj, NPIdentifier name,
+                                      NPVariant *args, uint32_t argCount, NPVariant *result );
+
+ bool CPixNPSearcherHasProperty( CPixNPSearcherObject *obj, NPIdentifier name );
+
+ bool CPixNPSearcherGetProperty ( CPixNPSearcherObject *obj, NPIdentifier name,
+                                    NPVariant *variant);
+
+ void CPixNPSearcherSetProperty( CPixNPSearcherObject *obj, NPIdentifier name,
+                                   NPVariant *variant);
+
+ static NPClass _CPixNPSearcherClass =
+     {
+     0,
+     (NPAllocateFunctionPtr) CPixNPSearcherAllocate,
+     (NPDeallocateFunctionPtr) CPixNPSearcherDeallocate,
+     (NPInvalidateFunctionPtr) CPixNPSearcherInvalidate,
+     (NPHasMethodFunctionPtr) CPixNPSearcherHasMethod,
+     (NPInvokeFunctionPtr) CPixNPSearcherInvokeFunctionL,
+     (NPInvokeDefaultFunctionPtr) 0,
+     (NPHasPropertyFunctionPtr) CPixNPSearcherHasProperty,
+     (NPGetPropertyFunctionPtr) CPixNPSearcherGetProperty,
+     (NPSetPropertyFunctionPtr) CPixNPSearcherSetProperty,
+     (NPRemovePropertyFunctionPtr) 0
+     };
+
+ /**
+  * static instance of the function pointer table
+  */
+ static NPClass* CPixNPSearcherClass = &_CPixNPSearcherClass;
+
+#endif /*CCPIXNPSEARCHERINTERFACE_H_*/
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/browserplugin/cpixnpplugin/inc/ccpixnpsearcherobserver.h	Mon Apr 19 14:40:05 2010 +0300
@@ -0,0 +1,65 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: 
+*
+*/
+#ifndef CCPIXNPSEARCHEROBSERVER_H_
+#define CCPIXNPSEARCHEROBSERVER_H_
+
+// INCLUDES
+#include <e32base.h>
+
+#ifdef __S60_50__
+#include <npscript.h>
+#else
+#include <stdint.h>
+#include <JavaScriptCore/npruntime.h>
+#endif
+
+#include "ICPixNPSearcherObserver.h"
+
+/**
+ * CCPixNPSearcherObserver
+ * Implements the functionality described in the MCPixNPSearcherObserver.
+ * This class represents and wraps a JavaScript object observing plugin's 
+ * searcher object. This class is used to invoke the observer methods of 
+ * the associated JavaScript object. 
+ */
+class CCPixNPSearcherObserver : public CBase, public MCPixNPSearcherObserver
+{
+public:
+	CCPixNPSearcherObserver( NPP& aNpp, NPObject* aSelf );
+	virtual ~CCPixNPSearcherObserver();
+
+public: // From MCPixNPSearcherObserver
+
+	virtual void HandleSearchResultsL(const TDesC8* aError, TInt aEstimatedResultCount);
+	virtual void HandleDocumentL(const TDesC8* aError, NPSearchDocumentObject* aDocument);
+
+private: // Utility
+	
+	/**
+	 * FIXME: This method is copied from CObjectInterface and is harmful redundancy
+	 */
+	void DescriptorToVariant(const TDesC8& aString, NPVariant& aVariant);
+
+private:
+    
+    NPP       &iNpp;
+    NPObject  *iSelf;
+
+};
+
+
+#endif // CCPIXNPSEARCHEROBSERVER_H_
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/browserplugin/cpixnpplugin/inc/cmobileinfo.h	Mon Apr 19 14:40:05 2010 +0300
@@ -0,0 +1,54 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: 
+*
+*/
+
+
+#ifndef __MOBILE_INFO_H__
+#define __MOBILE_INFO_H__
+
+#include <e32base.h>
+#include <Etel3rdParty.h>
+ 
+/*
+ * Helper class. Fetches Mobile Country Code information in order to pass it to widget to server Nokia Ovi Store. 
+ * Can be expanded with other Information functions, like fetching IMEI, Product Code etc.
+ */
+
+class CMobileInfo : public CActive
+	{
+	private:
+		CMobileInfo(TDes& aMCC);
+		virtual ~CMobileInfo();
+
+		void ConstructL();
+	public:	
+		// Static function, to be called to get information
+		static void GetInfoL(TDes& aMCC);
+	
+	private: // From CActive
+		void RunL();
+		void DoCancel();
+
+	private: // member variables
+		TDes& iMCC;
+		CActiveSchedulerWait* iWait;
+
+		CTelephony* iTelephony;
+		CTelephony::TNetworkInfoV1 iMCCMNCV1;
+		CTelephony::TNetworkInfoV1Pckg iMCCMNCV1Pkg;
+	};
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/browserplugin/cpixnpplugin/inc/cnpdocumentfield.h	Mon Apr 19 14:40:05 2010 +0300
@@ -0,0 +1,68 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: 
+*
+*/
+#ifndef CNPDOCUMENTFIELD_H
+#define CNPDOCUMENTFIELD_H
+
+//  INCLUDES
+#include "CNPDocumentFieldInterface.h"
+
+// FORWARD DECLARATION
+class CDocumentField; 
+class CNPSearchDocument; 
+
+// CLASS DECLARATION
+
+/**
+ * CNPDocumentField
+ * Implements services described in MCPixNPSearcher. 
+ * 
+ * Maintains a reference count in the surrounding CNPSearchDocument, because 
+ * CNPSearchDocument owns the object referred by iField. If CNPSearchDocument 
+ * were to be destroyed, iField reference would become a dangerous reference
+ * to invalid memory location. 
+ */
+class CNPDocumentField : public CNPDocumentFieldInterface
+    {
+public:
+	
+	/**
+	 * @param aDocument ownership transferred
+	 */
+    static CNPDocumentField *NewL( CNPSearchDocument& aOwner, const CDocumentField& aField );
+    virtual ~CNPDocumentField();
+    
+private:
+	
+	CNPDocumentField( CNPSearchDocument& aOwner, const CDocumentField& aField );
+    void ConstructL();
+    
+public: // from MNPDocumentField
+	
+	virtual const TDesC& Name() const;
+
+	virtual const TDesC& Value() const;
+	
+private:
+
+	CNPSearchDocument& iOwner;
+
+	// Don't held ownership 
+	const CDocumentField& iField;
+	
+    };
+
+#endif /*CNPDOCUMENTFIELD_H*/
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/browserplugin/cpixnpplugin/inc/cnpdocumentfieldinterface.h	Mon Apr 19 14:40:05 2010 +0300
@@ -0,0 +1,97 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: 
+*
+*/
+#ifndef CNPDOCUMENTFIELDINTERFACE_H_
+#define CNPDOCUMENTFIELDINTERFACE_H_
+
+//  INCLUDES
+#include "CObjectInterface.h"
+#include "INPDocumentField.h"
+
+// CLASS DECLARATION
+
+/**
+ * Provides the interface between browser and the actual functionality implemented 
+ * in CCPixNPSearcher. Calls MCPixNPPlugin methods of the implementing class
+ * as a response to method invokation requests from the browser.
+ */
+class CNPDocumentFieldInterface : public CObjectInterface, public MNPDocumentField
+    {
+ public:
+    virtual ~CNPDocumentFieldInterface();
+
+ public:
+    bool InvokeL( NPIdentifier name, NPVariant *args, uint32_t argCount, NPVariant *result );
+    bool GetProperty( NPIdentifier name, NPVariant *variant );
+    bool SetPropertyL( NPIdentifier name, NPVariant *variant );
+    
+ protected:
+	void InitInterfaceL();
+    };
+
+    
+/**
+ ********************************************************************************
+     NPDocumentFieldObject Plugin API methods
+ *********************************************************************************
+ */
+struct NPDocumentFieldObject
+     {
+     NPObject object;
+     CNPDocumentFieldInterface *plugin;
+     };
+
+ NPObject* NPDocumentFieldAllocate();
+
+ void NPDocumentFieldInvalidate();
+
+ void NPDocumentFieldDeallocate( NPDocumentFieldObject *obj );
+
+ bool NPDocumentFieldHasMethod( NPDocumentFieldObject *obj, NPIdentifier name );
+
+ bool NPDocumentFieldInvokeFunctionL( NPDocumentFieldObject* obj, NPIdentifier name,
+                                      NPVariant *args, uint32_t argCount, NPVariant *result );
+
+ bool NPDocumentFieldHasProperty( NPDocumentFieldObject *obj, NPIdentifier name );
+
+ bool NPDocumentFieldGetProperty ( NPDocumentFieldObject *obj, NPIdentifier name,
+                                    NPVariant *variant);
+
+ void NPDocumentFieldSetProperty( NPDocumentFieldObject *obj, NPIdentifier name,
+                                   NPVariant *variant);
+
+ static NPClass _NPDocumentFieldClass =
+     {
+     0,
+     (NPAllocateFunctionPtr) NPDocumentFieldAllocate,
+     (NPDeallocateFunctionPtr) NPDocumentFieldDeallocate,
+     (NPInvalidateFunctionPtr) NPDocumentFieldInvalidate,
+     (NPHasMethodFunctionPtr) NPDocumentFieldHasMethod,
+     (NPInvokeFunctionPtr) NPDocumentFieldInvokeFunctionL,
+     (NPInvokeDefaultFunctionPtr) 0,
+     (NPHasPropertyFunctionPtr) NPDocumentFieldHasProperty,
+     (NPGetPropertyFunctionPtr) NPDocumentFieldGetProperty,
+     (NPSetPropertyFunctionPtr) NPDocumentFieldSetProperty,
+     (NPRemovePropertyFunctionPtr) 0
+     };
+
+ /**
+  * static instance of the function pointer table
+  */
+ static NPClass* NPDocumentFieldClass = &_NPDocumentFieldClass;
+ 
+
+#endif /*CNPDOCUMENTFIELDINTERFACE_H_*/
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/browserplugin/cpixnpplugin/inc/cnpsearchdocument.h	Mon Apr 19 14:40:05 2010 +0300
@@ -0,0 +1,79 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: 
+*
+*/
+#ifndef CNPSEARCHDOCUMENT_H
+#define CNPSEARCHDOCUMENT_H
+
+//  INCLUDES
+#include "CNPSearchDocumentInterface.h"
+#include "CNPDocumentFieldInterface.h"
+
+// FORWARD DECLARATION
+class CSearchDocument; 
+
+// CLASS DECLARATION
+
+/**
+ * CCPixNPSearchDocument
+ * Implements services described in MCPixNPSearchDocument. Provides an access
+ * to the associated entity in the index database, e.g. information describing
+ * SMS messages, documents etc.  
+ * 
+ * NOTE: Because the CNPDocumentField:s hold dependency to data owned by this 
+ * class, this class MUST NOT be destroyed before all dependent CNPDocumentFields
+ * are released. For this reason this class introduces a simple reference counting
+ * for CNPDocumentField:s
+ */
+class CNPSearchDocument : public CNPSearchDocumentInterface
+    {
+    friend class CNPDocumentField; 
+    
+public:
+	/**
+	 * @param aDocument ownership transferred
+	 */
+    static CNPSearchDocument * NewL( CSearchDocument* aDocument );
+    virtual ~CNPSearchDocument();
+    
+    void Deallocate(); // From CObjectInterface
+    
+private:
+	CNPSearchDocument( CSearchDocument* aDocument );
+    void ConstructL();
+    
+protected: // for CNPDocumentField
+	
+	void Retain(); // increases reference count by one
+	void Release(); // decreases reference count by one
+    
+public: // from MNPSearchDocument
+	
+	virtual NPDocumentFieldObject* FieldL(const TDesC& aName);
+	virtual const TDesC& Id() const;
+	virtual const TDesC& AppClass() const;
+	virtual const TDesC& Excerpt() const;
+	virtual TInt FieldCount() const;
+	virtual NPDocumentFieldObject* FieldL( const TInt aIndex );
+
+private:
+	
+	CSearchDocument* iDocument;
+	
+	TInt iReferences; 
+	
+    };
+
+#endif /*CNPSEARCHDOCUMENT_H*/
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/browserplugin/cpixnpplugin/inc/cnpsearchdocumentinterface.h	Mon Apr 19 14:40:05 2010 +0300
@@ -0,0 +1,96 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: 
+*
+*/
+#ifndef CNPSEARCHDOCUMENTINTERFACE_H_
+#define CNPSEARCHDOCUMENTINTERFACE_H_
+
+//  INCLUDES
+#include "CObjectInterface.h"
+#include "INPSearchDocument.h"
+
+// CLASS DECLARATION
+
+/**
+ * Provides the interface between browser and the actual functionality implemented 
+ * in CNPSearchDocument. Calls MNPSearchDocument methods of the implementing class
+ * as a response to method invokation requests from the browser.
+ */
+class CNPSearchDocumentInterface : public CObjectInterface, public MNPSearchDocument
+    {
+ public:
+    virtual ~CNPSearchDocumentInterface();
+
+ public:
+    bool InvokeL( NPIdentifier name, NPVariant *args, uint32_t argCount, NPVariant *result );
+    bool GetProperty( NPIdentifier name, NPVariant *variant );
+    bool SetPropertyL( NPIdentifier name, NPVariant *variant );
+    
+ protected:
+	void InitInterfaceL();
+    };
+
+    
+/**
+ ********************************************************************************
+     NPSearchDocumentObject Plugin API methods
+ *********************************************************************************
+ */
+ struct NPSearchDocumentObject
+     {
+     NPObject object;
+     CNPSearchDocumentInterface *plugin;
+     };
+
+ NPObject* NPSearchDocumentAllocate();
+
+ void NPSearchDocumentInvalidate();
+
+ void NPSearchDocumentDeallocate( NPSearchDocumentObject *obj );
+
+ bool NPSearchDocumentHasMethod( NPSearchDocumentObject *obj, NPIdentifier name );
+
+ bool NPSearchDocumentInvokeFunctionL( NPSearchDocumentObject* obj, NPIdentifier name,
+                                      NPVariant *args, uint32_t argCount, NPVariant *result );
+
+ bool NPSearchDocumentHasProperty( NPSearchDocumentObject *obj, NPIdentifier name );
+
+ bool NPSearchDocumentGetProperty ( NPSearchDocumentObject *obj, NPIdentifier name,
+                                    NPVariant *variant);
+
+ void NPSearchDocumentSetProperty( NPSearchDocumentObject *obj, NPIdentifier name,
+                                   NPVariant *variant);
+
+ static NPClass _NPSearchDocumentClass =
+     {
+     0,
+     (NPAllocateFunctionPtr) NPSearchDocumentAllocate,
+     (NPDeallocateFunctionPtr) NPSearchDocumentDeallocate,
+     (NPInvalidateFunctionPtr) NPSearchDocumentInvalidate,
+     (NPHasMethodFunctionPtr) NPSearchDocumentHasMethod,
+     (NPInvokeFunctionPtr) NPSearchDocumentInvokeFunctionL,
+     (NPInvokeDefaultFunctionPtr) 0,
+     (NPHasPropertyFunctionPtr) NPSearchDocumentHasProperty,
+     (NPGetPropertyFunctionPtr) NPSearchDocumentGetProperty,
+     (NPSetPropertyFunctionPtr) NPSearchDocumentSetProperty,
+     (NPRemovePropertyFunctionPtr) 0
+     };
+
+ /**
+  * static instance of the function pointer table
+  */
+ static NPClass* NPSearchDocumentClass = &_NPSearchDocumentClass;
+ 
+#endif /*CNPSEARCHDOCUMENTINTERFACE_H_*/
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/browserplugin/cpixnpplugin/inc/cobjectinterface.h	Mon Apr 19 14:40:05 2010 +0300
@@ -0,0 +1,67 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: 
+*
+*/
+#ifndef OBJECTINTERFACE_H
+#define OBJECTINTERFACE_H
+
+#include <e32base.h>
+
+#ifdef __S60_50__
+#include <npscript.h>
+#include <npapi.h>
+#else
+#include <stdint.h>
+#include <JavaScriptCore/npruntime.h>
+#endif
+
+/**
+ * Provides utility functionality to make the commmunication between 
+ * NP Runtime interface and S60 functionality more convinient. 
+ */
+class CObjectInterface : public CBase
+{
+	// FIXME: This is an antipattern! Move required methods into 
+    // 
+
+public:
+	virtual ~CObjectInterface();
+
+public:
+	void SetInstance( NPP instance, NPObject* aNpObject ) { iInstanceHandle = instance; iNpObject = aNpObject; }
+	virtual void Deallocate();
+	
+	bool HasMethod( NPIdentifier name );
+	virtual bool HasProperty( NPIdentifier name );
+	virtual bool InvokeL( NPIdentifier name, NPVariant *args, uint32_t argCount, NPVariant *result ) = 0;
+	virtual bool GetProperty( NPIdentifier name, NPVariant *variant ) = 0;
+	virtual bool SetPropertyL( NPIdentifier name, NPVariant *variant ) = 0;
+	
+protected:
+	CObjectInterface();
+	void SetIdentifiersL( const NPUTF8** aPropertyNames, TInt aPropertyCount, const NPUTF8** aMethodNames, TInt aMethodCount );
+	
+protected:
+	NPP iInstanceHandle;
+	NPObject* iNpObject; // For raising exceptions and reference counting
+	
+    NPIdentifier* iPropertyIdentifiers;
+    NPIdentifier* iMethodIdentifiers;
+    
+    TInt          iPropertyCount;
+    TInt          iMethodCount;
+};
+
+#endif /*OBJECTINTERFACE_H*/
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/browserplugin/cpixnpplugin/inc/cpixnpexceptions.h	Mon Apr 19 14:40:05 2010 +0300
@@ -0,0 +1,59 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: 
+*
+*/
+#ifndef CPIXNPEXCEPTIONS_H_
+#define CPIXNPEXCEPTIONS_H_
+
+#include <e32std.h>
+
+/*
+ * CPix NP Plugin provides its own exceptions, that are 
+ * based on plain text codes. The reason for using strings to
+ * represent exceptions is simply, because NPN_SetException 
+ * accepts only strings as exception codes. Also strings are expected
+ * to be more informative and convinient for JavaScript programmers.
+ * 
+ * CPixNPException is used to declare CPix NP Plugin exceptions and 
+ * for convert both CPix error codes and S60 system wide error codes
+ * into CPix NP exception format. 
+ */
+
+_LIT8( KCPixNPCannotOpenDatabaseException, "CannotOpenDatabaseException" );
+_LIT8( KCPixNPQueryParsingFailedException, "QueryParsingFailedException" );
+_LIT8( KCPixNPDatabaseQueryFailedException, "DatabaseQueryFailedException" );
+_LIT8( KCPixNPDocumentAccessFailedException, "DocumentAccessFailedException" );
+
+_LIT8( KCPixNPIllegalArgumentException, "IllegalArgumentException" );
+_LIT8( KCPixNPNotEnoughArgumentsException, "NotEnoughArgumentsException" );
+_LIT8( KCPixNPInternalError, "InternalError" );
+
+// Translations from S60 System wide error codes
+_LIT8( KCPixNPInUseException, "InUseException" );
+_LIT8( KCPixNPServerTerminated, "ServerTerminatedException" );
+_LIT8( KCPixNPServerBusy, "ServerBusyException" );
+_LIT8( KCPixNPCouldNotConnect, "CouldNotConnectException" );
+
+_LIT8( KCPixNPUnknownException, "UnknownException" );
+
+/**
+ * Describes the given error code. Returns NULL if given code
+ * is KErrNone. 
+ * 
+ * @return CPix NPlugin error code string or NULL for KErrNone. Does not return ownership. 
+ */
+const TDesC8* DescribeErrorCode( TInt aErrorCode ); 
+
+#endif /*CPIXNPEXCEPTIONS_H_*/
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/browserplugin/cpixnpplugin/inc/idl/icpixnpplugin.h	Mon Apr 19 14:40:05 2010 +0300
@@ -0,0 +1,156 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: 
+*
+*/
+#ifndef ICPIXNPPLUGIN_H_
+#define ICPIXNPPLUGIN_H_
+
+class CCPixNPSearcher; 
+
+/**
+ * MCPixNPPlugin
+ * Represents the CPix NPPllugin providing the CPix search services for
+ * clients in the S60 NPRuntime environment (e.g. JavaScript applications in 
+ * S60 Browser). 
+ */
+class MCPixNPPlugin
+    {
+public: 
+	
+	/**
+     * The name of the mandatory field that will store the unique ID of
+     * a document.
+     */
+	virtual const TDesC& DocUidFieldName() const = 0; 
+
+    /**
+     * The name of the mandatory field that will store the application
+     * class of a document.
+     */
+	virtual const TDesC& AppClassFieldName() const = 0; 
+
+    /**
+	  * The name of the optional field that will store the excerpt text
+	  * for a document.
+	  */
+	virtual const TDesC& ExcerptFieldName() const = 0; 
+
+	/**
+     * The name of the optional field that will store the application
+     * ID of the document.
+     */
+	virtual const TDesC& MimeTypeFieldName() const = 0; 
+
+	/**
+     * Aaggregate of the contents of other fields.
+     */
+	virtual const TDesC& AggregateFieldName() const = 0; 
+
+	/**
+     * The default field to search for (currently aggregate field).
+     */
+	virtual const TDesC& DefaultFieldName() const = 0; 
+
+	/**
+	 * In the documents returned by searcher's suggest() method, 
+	 * this field will contain the term's text content.
+     */
+	virtual const TDesC& TermTextFieldName() const = 0; 
+
+	/**
+	 * In the documents returned by suggest() method, this field 
+	 * will contain the term's document frequence
+     */
+	virtual const TDesC& TermDocFreqFieldName() const = 0; 
+	
+	/*
+	 * Analysis constants 
+     */
+	
+	virtual const TDesC& StandardAnalyzerId() const = 0; 
+	virtual const TDesC& StandardTokenizerId() const = 0; 
+	virtual const TDesC& WhitespaceTokenizerId() const = 0; 
+	virtual const TDesC& LetterTokenizerId() const = 0; 
+	virtual const TDesC& KeywordTokenizerId() const = 0; 
+	virtual const TDesC& StandardFilterId() const = 0; 
+	virtual const TDesC& LowercaseFilterId() const = 0; 
+	virtual const TDesC& AccentFilterId() const = 0; 
+	virtual const TDesC& StopFilterId() const = 0; 
+	virtual const TDesC& StemFilterId() const = 0; 
+	virtual const TDesC& LengthFilterId() const = 0; 
+	virtual const TDesC& EnglishLanguageId() const = 0; 
+	virtual const TDesC& FinnishLanguageId() const = 0; 
+	virtual const TDesC& HungarianLanguageId() const = 0; 
+	virtual const TDesC& RussianLanguageId() const = 0; 
+
+	/**
+	 * CreateSearcherL
+	 * Returns ownership to NPObject struct. (The searcher object
+	 * itself is reference counted). 
+	 * @param aDomainSelector The domain selector that will be searched
+	 * E.g. "root", "root contacts,root file", "@c:root file"
+	 * @param aDefaultSearchField field to be searched.
+	 * @return CCPixNPSearcher searcher object
+	 */
+	virtual CCPixNPSearcher* CreateSearcherL( const TDesC& aDomainSelector, 
+											  const TDesC& aDefaultSearchField ) const = 0;
+
+	/**
+	 * CreateSearcherL
+	 * Returns ownership to NPObject struct. (The searcher object
+	 * itself is reference counted). 
+	 * @param aDomainSelector The domain selector that will be searched
+	 * E.g. "root", "root contacts,root file", "@c:root file"
+	 * @return CCPixNPSearcher searcher object
+	 */
+	virtual CCPixNPSearcher* CreateSearcherL( const TDesC& aDomainSelector ) const = 0;
+
+	/**
+	 * DefineVolumeL
+	 * Defines a new CPIX qualified base app class and the physical location of it on disk. 
+	 * @param aQualifiedBaseAppClass The qualified base application class of the database to be 
+	 * defined.
+	 * E.g. "@e:root file" when the MMC is inserted
+	 * @param aIndexDbPath The physical index database path.
+	 */
+	virtual void DefineVolumeL( const TDesC& aQualifiedBaseAppClass, const TDesC& aIndexDbPath ) = 0;
+
+	/**
+	 * UnDefineVolumeL
+	 * Undefines an existing CPIX qualified base app class. 
+	 * @param aQualifiedBaseAppClass The qualified base app class to be deleted. 
+	 * E.g. "@e:root file" when the MMC is ejected
+	 */
+	virtual void UnDefineVolumeL( const TDesC& aQualifiedBaseAppClass ) = 0;
+	
+	
+	virtual void OpenContactL(TInt aIndex) = 0;
+
+	virtual void OpenMessagingL(TInt aMesId) = 0;
+	
+	virtual void OpenCalendarL(TInt aCalId) = 0;
+	
+	virtual void OpenMapsL( TReal aLatitude, TReal aLongitude ) = 0;
+	
+	virtual TInt GetVersionNumber() const = 0;
+	
+	//Added to launch Notes from Widget
+	virtual void OpenNoteL( TInt aNoteId ) = 0;
+	
+	virtual void GetDriveFromMediaIdL(HBufC* aMediaId,TDes& aDrive) = 0;
+	
+    };
+
+#endif /*ICPIXNPPLUGIN_H_*/
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/browserplugin/cpixnpplugin/inc/idl/icpixnpsearcher.h	Mon Apr 19 14:40:05 2010 +0300
@@ -0,0 +1,79 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: 
+*
+*/
+#ifndef ICPIXNPSEARCHER_H
+#define ICPIXNPSEARCHER_H
+
+#include "ICPixNPSearcherObserver.h"
+
+/**
+ * An instance of CCPixSearcher is used to commit search operations to CSearchServer
+ * Is bound to a specific database identified by baseAppType
+ */
+class MCPixNPSearcher
+    {
+public: 
+
+    /**
+    * SetObserver
+    * Sets observer for this searcher
+    * @param aObserver A observer of this CCPixSearcher instance.
+    */
+	virtual void SetObserverL( NPObject* aObserver ) = 0; 
+
+    /**
+    * SetAnalyzer
+    * Sets analyzer for this searcher
+    * @param aAnalyzer Special syntax defining the analyzer
+    */
+	virtual void SetAnalyzerL( const TDesC& aAnalyzer ) = 0; 
+
+    /**
+    * SearchL
+    * Issues a search request. When request has been completed a callback to 
+    * MSearchObserver::HandleSearchResultL is issued. Leaves with KErrInUse, 
+    * if asynchronous request is already pending.
+    * @param aSearchTerms Search terms. May include wild card character. 
+    * @param aDocumentField to search
+    */
+	virtual void SearchL( const TDesC& aSearchTerms, const TDesC& aDocumentField = KNullDesC ) = 0;
+
+    /**
+     * GetDocumentL
+     * Iterates throught the search result's document list (hits), that is stored in the 
+	 * server side. The accessed list is ranked and the best matching document is heading 
+	 * the result lest. First call of this method, return best matching, then second best 
+	 * matching and so forth until all documents have been found. Method returns NULL, 
+	 * when no more documents can be found.
+	 * 
+     * Leaves with KErrInUse, if asynchronous request is pending and 
+	 * KErrNotReady, if no database has been succefullly opened.
+	 */
+	virtual void GetDocumentL(TInt aIndex) = 0;
+	
+    /**
+     * Cancels any outstanding operation.
+     */
+	virtual void Cancel() = 0;
+
+    /**
+     * Checks whether an outstanding request is still pending
+     */
+	virtual TBool IsActive() = 0;
+
+    };
+
+#endif /*ICPIXNPSEARCHER_*/
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/browserplugin/cpixnpplugin/inc/idl/icpixnpsearcherobserver.h	Mon Apr 19 14:40:05 2010 +0300
@@ -0,0 +1,53 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: 
+*
+*/
+#ifndef ICPIXSEARCHEROBSERVER_
+#define ICPIXSEARCHEROBSERVER_
+
+#include "INPSearchDocument.h"
+
+
+struct NPSearchDocumentObject;
+struct NPSearchTermListObject;
+
+/**
+ * MSearchObserver
+ * Mixin class.
+ * Observer which handles search results received from the server.
+ * 
+ * This interface represents a JavaScript object provided
+ * by a searcher client. Calling provided methods will invoke 
+ * corresponding methods in the JavaScript object. 
+ */
+class MCPixNPSearcherObserver 
+	{
+public:
+	
+	/**
+	 * Callback method of ICPixNPSearcher::SearchL
+	 * @param aError Description of error, may be NULL
+	 */
+    virtual void HandleSearchResultsL(const TDesC8* aError, TInt aEstimatedResultCount) = 0;
+    
+    /**
+	 * Callback method of ICPixNPSearcher::GetDocumentL
+	 * @param aError Description of error, may be NULL
+	 * @param aDocument Next document, may be NULL
+     */
+    virtual void HandleDocumentL(const TDesC8* aError, NPSearchDocumentObject* aDocument) = 0;
+	};
+
+#endif /*ICPIXSEARCHEROBSERVER_*/
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/browserplugin/cpixnpplugin/inc/idl/inpdocumentfield.h	Mon Apr 19 14:40:05 2010 +0300
@@ -0,0 +1,40 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: 
+*
+*/
+#ifndef INPDOCUMENTFIELD_
+#define INPDOCUMENTFIELD_
+
+/**
+ * CDocumentField. Instance of this class describes one field of a CSearchDocument. 
+ */
+class MNPDocumentField
+	{
+public:
+	/**
+	 * Name of the field.
+	 * @return Reference to the name of the field.
+	 */
+	virtual const TDesC& Name() const = 0;
+
+	/**
+	 * Value of the field.
+	 * @return Reference to the value of the field.
+	 */
+	virtual const TDesC& Value() const = 0;
+	
+	};
+
+#endif /*INPDOCUMENTFIELD_*/
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/browserplugin/cpixnpplugin/inc/idl/inpsearchdocument.h	Mon Apr 19 14:40:05 2010 +0300
@@ -0,0 +1,75 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: 
+*
+*/
+#ifndef INPSEARCHDOCUMENT_H_
+#define INPSEARCHDOCUMENT_H_
+
+struct NPDocumentFieldObject; 
+
+/**
+ * CSearchDocument represents one entity in index database, e.g. it can appear in search result.
+ * Each document may have multiple fields, which values may or may not be indexed and stored to database.
+ * See CDocumentField for details.
+ */
+class MNPSearchDocument
+	{
+public:
+	
+	/**
+	 * FIXME: Add L to mark leaving
+	 * 
+	 * Find field by name. Returns NULL, if field is not found with given name.
+	 * @param aName Name of the field.
+	 * @return First field with given name or NULL if no field is found.
+	 */
+	virtual NPDocumentFieldObject* FieldL(const TDesC& aName) = 0;
+	
+	/**
+	 * Id of this document.
+	 * @return Id of this document.
+	 */
+	virtual const TDesC& Id() const = 0;
+
+	/**
+	 * Application class of this document.
+	 * @return Id of this document.
+	 */
+	virtual const TDesC& AppClass() const = 0;
+
+	/**
+	 * Excerpt of this document.
+	 * @return Id of this document.
+	 */
+	virtual const TDesC& Excerpt() const = 0;
+
+	/**
+	 * Number of fields in this document.
+	 * @return Number of fields in this document.
+	 */
+	virtual TInt FieldCount() const = 0;
+
+	/**
+	 * FIXME: Add L to mark leaving
+	 * 
+	 * Returns a field specified by the index. 
+	 * Returns NULL if index is negative or greater than the number of fields currently in document.
+	 * @param aIndex Index of a field to be returned.
+	 * @return Field pointed by the index, or NULL, if index is out of bounds
+	 */
+	virtual NPDocumentFieldObject* FieldL( const TInt aIndex ) = 0;
+	};
+
+#endif /*INPSEARCHDOCUMENT_H_*/
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/browserplugin/cpixnpplugin/inc/msvui.h	Mon Apr 19 14:40:05 2010 +0300
@@ -0,0 +1,183 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  A helper object to open messagin entries (e.g. emails).
+*
+*/
+
+#ifndef AIS_MSV_UI_H
+#define AIS_MSV_UI_H
+
+
+// INCLUDES
+
+#include <e32base.h>
+#include <msvapi.h>
+
+
+// FORWARD DECLARATIONS
+
+class CBaseMtm;
+class CBaseMtmUi;
+class CClientMtmRegistry;
+class CMsvOperation;
+class CMsvSession;
+class CMtmUiRegistry;
+
+
+// CLASS DECLARATIONS
+
+/**
+* Interface for opening messaging entries (e.g. emails).
+*/
+class MMsvUI
+    {
+    public:     // New functions
+        
+        /**
+        * Opens the messaging entry.
+        * 
+        * @param   aMsvId   TMsvId of the entry to open, as TUid
+        */
+        virtual void OpenEntryL( const TUid& aMsvId ) = 0;
+    };
+
+/**
+* A helper object to open messaging entries (e.g. emails).
+* 
+* MTM UI, which is used to open emails (at least), is asyncronous API.  This 
+* is a helper class that is active while the UI is open.
+*/
+class CMsvUI : public CActive,
+               public MMsvUI,
+               public MMsvSessionObserver
+    {
+    public:     // Constructor and destructor
+        
+        /**
+        * C++ constructor.
+        */
+        CMsvUI();
+        
+        /**
+        * Destructor
+        */
+        virtual ~CMsvUI();
+        
+    public:     // Functions from base classes
+        
+        /**
+        * From MMsvUI.
+        * 
+        * Opens the messaging entry.
+        * 
+        * @param   aMsvId   TMsvId of the entry to open, as TUid
+        */
+        void OpenEntryL( const TUid& aMsvId  );
+        
+    private:    // Functions from base classes
+        
+        /**
+        * From CActive.
+        * 
+        * Handles an active object's request completion event.
+        * 
+        * The function is called by the active scheduler when a request 
+        * completion event occurs, i.e. after the active scheduler's 
+        * WaitForAnyRequest() function completes.
+        * 
+        * Before calling this active object's RunL() function, the active 
+        * scheduler has:
+        * 
+        * 1. decided that this is the highest priority active object with a 
+        *    completed request
+        * 
+        * 2. marked this active object's request as complete (i.e. the 
+        *    request is no longer outstanding)
+        * 
+        * RunL() runs under a trap harness in the active scheduler. If it 
+        * leaves, then the active scheduler calls RunError() to handle the 
+        * leave.
+        * 
+        * Note that once the active scheduler's Start() function has been 
+        * called, all user code is run under one of the program's active 
+        * object's RunL() or RunError() functions.
+        * 
+        * @see CActiveScheduler::Start 
+        * @see CActiveScheduler::Error 
+        * @see CActiveScheduler::WaitForAnyRequest 
+        * @see TRAPD
+        */
+        void RunL();
+        
+        /**
+        * From CActive.
+        * 
+        * Implements cancellation of an outstanding request.
+        * 
+        * This function is called as part of the active object's Cancel().
+        * 
+        * It must call the appropriate cancel function offered by the active 
+        * object's asynchronous service provider. The asynchronous service 
+        * provider's cancel is expected to act immediately.
+        * 
+        * DoCancel() must not wait for event completion; this is handled by 
+        * Cancel().
+        * 
+        * @see CActive::Cancel
+        */
+        void DoCancel();
+        
+        /**
+        * From MMsvSessionObserver.
+        * 
+        * Indicates an event has occurred.
+        * 
+        * The type of event is indicated by the value of aEvent. The 
+        * interpretation of the TAny arguments depends on this type.
+        *
+        * For most event types, the action that is taken, for example, 
+        * updating the display, is client-specific. All clients though 
+        * should respond to EMsvCloseSession and EMsvServerTerminated events.
+        * 
+        * @param   aEvent   Indicates the event type.
+        * @param   aArg1    Event type-specific argument value.
+        * @param   aArg2    Event type-specific argument value.
+        * @param   aArg3    Event type-specific argument value.
+        */
+        void  HandleSessionEventL( TMsvSessionEvent aEvent,
+                                   TAny* aArg1,
+                                   TAny* aArg2,
+                                   TAny* aArg3 );
+        
+    private:    // Data
+        // Represents a channel of communication between message client 
+        // application and the Message Server thread
+        CMsvSession* iSession;
+        // Accesses the Client-side MTM registry.
+        CClientMtmRegistry* iMtmReg;
+        // Accesses the User Interface MTM registry.
+        CMtmUiRegistry* iUIReg;
+        // Provides a high-level interface for accessing a  Message Server 
+        // entry
+        CBaseMtm* iMtm;
+        // Provides MTM-specific user interaction such as viewing of message 
+        // entries
+        CBaseMtmUi* iUI;
+        // Represents an ongoing action in the UI.
+        CMsvOperation* iOperation;
+    };
+
+#endif // AIS_MSV_UI_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/browserplugin/cpixnpplugin/inc/nputils.h	Mon Apr 19 14:40:05 2010 +0300
@@ -0,0 +1,42 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: 
+*
+*/
+
+#ifndef NPUTILS_H_
+#define NPUTILS_H_
+
+#include <e32cmn.h>
+
+#include <npapi.h>
+#include <npscript.h>
+#include <npupp.h>
+
+namespace nputils {
+
+	TInt VariantToInt( NPVariant& v );
+	TReal VariantToDouble( NPVariant& v );
+	TUint VariantToUnsigned( NPVariant& v );
+	void DescriptorToVariantL(const TDesC16& aString, NPVariant& aVariant);
+	void DescriptorToVariant(const TDesC8& aString, NPVariant& aVariant);
+	void VariantToDescriptor(NPVariant& aVariant, TDes8& aString);
+	void VariantToDescriptorL(NPVariant& aVariant, TDes16& aString);
+	HBufC16* VariantToHBufC16LC(NPVariant& aVariant);
+	HBufC8* VariantToHBufC8LC(NPVariant& aVariant);
+	HBufC8* GetLocationUrlLC();
+}
+
+
+#endif /* NPUTILS */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/browserplugin/cpixnpplugin/src/ccpixnpplugin.cpp	Mon Apr 19 14:40:05 2010 +0300
@@ -0,0 +1,412 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  CCPixNPPlugin implementation
+*
+*/
+
+#include <fbs.h>        // CFbsBitmap
+#include <bitdev.h>     // CFbsBitmapDevice
+#include <bitstd.h>     // CFbsBitGc
+#include <coemain.h>    // CCoeEnv
+
+#include <smsclnt.h> // SMS Headers
+#include <EIKENV.H>
+#include <eikappui.h>
+//@TODO: CPbkViewState not available in TB10.1 so removed
+//#include <cpbkviewstate.h>
+//#include <Pbk2ViewId.hrh>
+
+//@TODO: Not supported in TB10.1
+//#include <calenlauncher.h> // Calendar launching
+#include "mnproviderfinder.h"
+#include "mnmapview.h"
+
+#include "CCPixNPPlugin.h"
+#include "CCPixNPPluginEcom.h"
+#include "CCPixNPSearcher.h"
+
+#include "indevicecfg.h"
+#include "MsvUI.h"
+
+#include <APGCLI.H>
+#include <APGTASK.H> //TApaTaskList
+#include <W32STD.H>  //RWsSession
+//UID of PinbMdl
+const TInt KUidApaMessagePinboardValue(0x1000590C);
+//UID of NotepadApp
+const TInt KUidApaNotePad(0x10005907);
+//
+const TInt KNotePadIdMaxLength(10);
+
+_LIT( KCPixDocUidFieldName, CPIX_DOCUID_FIELD );
+_LIT( KCPixAppClassFieldName, CPIX_APPCLASS_FIELD );
+_LIT( KCPixExcerptFieldName, CPIX_EXCERPT_FIELD );
+_LIT( KCPixMimeTypeFieldName, CPIX_MIMETYPE_FIELD );
+_LIT( KCPixAggregateFieldName, CPIX_DEFAULT_FIELD );
+_LIT( KCPixDefaultFieldName, CPIX_DEFAULT_FIELD );
+_LIT( KCPixTermTextFieldName, TERM_TEXT_FIELD );
+_LIT( KCPixTermDocFreqFieldName, TERM_DOCFREQ_FIELD );
+
+_LIT( KCPixStandardAnalyzerId, 		"" CPIX_ANALYZER_STANDARD );
+
+_LIT( KCPixStandardTokenizerId, 	"" CPIX_TOKENIZER_STANDARD );
+_LIT( KCPixWhitespaceTokenizerId,  	"" CPIX_TOKENIZER_WHITESPACE );
+_LIT( KCPixLetterTokenizerId, 		"" CPIX_TOKENIZER_LETTER );
+_LIT( KCPixKeywordTokenizerId, 		"" CPIX_TOKENIZER_KEYWORD );
+
+_LIT( KCPixStandardFilterId, 		"" CPIX_FILTER_STANDARD );
+_LIT( KCPixLowercaseFilterId, 		"" CPIX_FILTER_LOWERCASE );
+_LIT( KCPixAccentFilterId, 			"" CPIX_FILTER_ACCENT );
+_LIT( KCPixStopFilterId, 			"" CPIX_FILTER_STOP );
+_LIT( KCPixStemFilterId, 			"" CPIX_FILTER_STEM );
+_LIT( KCPixLengthFilterId, 			"" CPIX_FILTER_LENGTH );
+
+_LIT( KCPixEnglishLanguageId, 		"" CPIX_WLANG_EN );
+_LIT( KCPixFinnishLanguageId, 		"" CPIX_WLANG_FI );
+_LIT( KCPixHungarianLanguageId, 	"" CPIX_WLANG_HU );
+_LIT( KCPixRussianLanguageId, 		"" CPIX_WLANG_RU );
+
+// Version number. This should be updated to current svn revision number
+const TInt KVersionNumber = 1339;
+
+CCPixNPPlugin::CCPixNPPlugin()
+	{
+	}
+
+CCPixNPPlugin::~CCPixNPPlugin()
+	{
+    iFs.Close();
+	iSearchServer.Close();
+	
+	iMnProviders.ResetAndDestroy();
+	iMnProviders.Close();
+	delete iMapView;
+	
+	delete iMsvUI;
+	}
+
+CCPixNPPlugin* CCPixNPPlugin::NewLC()
+	{
+	CCPixNPPlugin* self = new (ELeave)CCPixNPPlugin();
+	CleanupStack::PushL(self);
+	self->ConstructL();
+	return self;
+	}
+
+CCPixNPPlugin* CCPixNPPlugin::NewL()
+	{
+	CCPixNPPlugin* self = CCPixNPPlugin::NewLC();
+	CleanupStack::Pop(); // self;
+	return self;
+	}
+
+void CCPixNPPlugin::ConstructL()
+	{
+	InitInterfaceL();
+	User::LeaveIfError(iFs.Connect());
+	User::LeaveIfError( iSearchServer.Connect() );
+	iMsvUI = new (ELeave) CMsvUI();
+	}
+
+//
+// Exposed functions
+//
+
+const TDesC& CCPixNPPlugin::DocUidFieldName() const
+	{
+	return KCPixDocUidFieldName();  
+	}
+
+const TDesC& CCPixNPPlugin::AppClassFieldName() const
+	{
+	return KCPixAppClassFieldName(); 
+	}
+
+const TDesC& CCPixNPPlugin::ExcerptFieldName() const
+	{
+	return KCPixExcerptFieldName(); 
+	}
+
+ const TDesC& CCPixNPPlugin::MimeTypeFieldName() const
+	{
+	return KCPixMimeTypeFieldName(); 
+	}
+
+const TDesC& CCPixNPPlugin::AggregateFieldName() const
+	{
+	return KCPixAggregateFieldName(); 
+	}
+
+const TDesC& CCPixNPPlugin::DefaultFieldName() const
+	{
+	return KCPixDefaultFieldName(); 
+	}
+
+const TDesC& CCPixNPPlugin::TermTextFieldName() const
+	{
+	return KCPixTermTextFieldName(); 
+	}
+
+const TDesC& CCPixNPPlugin::TermDocFreqFieldName() const
+	{
+	return KCPixTermDocFreqFieldName(); 
+	}
+
+const TDesC& CCPixNPPlugin::StandardAnalyzerId() const
+	{
+	return KCPixStandardAnalyzerId();
+	}
+
+const TDesC& CCPixNPPlugin::StandardTokenizerId() const
+	{
+	return KCPixStandardTokenizerId();
+	}
+
+const TDesC& CCPixNPPlugin::WhitespaceTokenizerId() const
+	{
+	return KCPixWhitespaceTokenizerId();
+	}
+
+const TDesC& CCPixNPPlugin::LetterTokenizerId() const
+	{
+	return KCPixLetterTokenizerId();
+	}
+
+const TDesC& CCPixNPPlugin::KeywordTokenizerId() const
+	{
+	return KCPixKeywordTokenizerId();
+	}
+
+const TDesC& CCPixNPPlugin::StandardFilterId() const
+	{
+	return KCPixStandardFilterId();
+	}
+
+const TDesC& CCPixNPPlugin::LowercaseFilterId() const
+	{
+	return KCPixLowercaseFilterId();
+	}
+
+const TDesC& CCPixNPPlugin::AccentFilterId() const
+	{
+	return KCPixAccentFilterId();
+	}
+
+const TDesC& CCPixNPPlugin::StopFilterId() const	
+	{
+	return KCPixStopFilterId();
+	}
+
+const TDesC& CCPixNPPlugin::StemFilterId() const
+	{
+	return KCPixStemFilterId();
+	}
+
+const TDesC& CCPixNPPlugin::LengthFilterId() const
+	{
+	return KCPixLengthFilterId();
+	}
+
+const TDesC& CCPixNPPlugin::EnglishLanguageId() const
+	{
+	return KCPixEnglishLanguageId(); 
+	}
+
+const TDesC& CCPixNPPlugin::FinnishLanguageId() const
+	{
+	return KCPixFinnishLanguageId(); 
+	}
+
+const TDesC& CCPixNPPlugin::HungarianLanguageId() const
+	{
+	return KCPixHungarianLanguageId(); 
+	}
+
+const TDesC& CCPixNPPlugin::RussianLanguageId() const
+	{
+	return KCPixRussianLanguageId(); 
+	}
+
+CCPixNPSearcher* CCPixNPPlugin::CreateSearcherL( const TDesC& aDomainSelector, const TDesC& aDefaultSearchField ) const
+	{
+	return CCPixNPSearcher::NewL( aDomainSelector, aDefaultSearchField );
+	}
+
+CCPixNPSearcher* CCPixNPPlugin::CreateSearcherL( const TDesC& aDomainSelector ) const
+	{
+	return CCPixNPSearcher::NewL( aDomainSelector );
+	}
+
+void CCPixNPPlugin::DefineVolumeL( const TDesC& aQualifiedBaseAppClass, const TDesC& aIndexDbPath )
+	{
+	User::LeaveIfError(iSearchServer.DefineVolume( aQualifiedBaseAppClass, aIndexDbPath ));
+	}
+
+void CCPixNPPlugin::UnDefineVolumeL( const TDesC& aQualifiedBaseAppClass )
+	{
+	User::LeaveIfError(iSearchServer.UnDefineVolume( aQualifiedBaseAppClass ));
+	}
+
+
+void CCPixNPPlugin::OpenContactL( TInt aContactId )
+	{
+	//@TODO: Contact can not belaunched by this API in TB10.1
+	/*	
+	CPbkViewState* pbkViewParam = CPbkViewState::NewLC();
+	pbkViewParam->SetFocusedContactId(aContactId);
+	 
+	// Package and return object in a buffer.
+	HBufC8* paramBuf = pbkViewParam->PackLC();
+	 
+	// Uid for Contacts application
+	const TUid appUid = {0x101f4cce};
+	// Messaging: 0x100058C5
+	 
+	// Activate the view
+	// 3 is the Contact Group Info View's ID
+	CEikonEnv::Static()->EikAppUi()->ActivateViewL(TVwsViewId(appUid, TUid::Uid(EPbk2ContactInfoViewId)), CPbkViewState::Uid(), *paramBuf);
+	 
+	// Cleanup
+	CleanupStack::PopAndDestroy(2); // paramBuf, pbkViewParam	
+	*/
+	}
+
+
+void CCPixNPPlugin::OpenMessagingL( TInt aMessagingId )
+	{
+	iMsvUI->OpenEntryL(TUid::Uid(aMessagingId));
+	}
+
+void CCPixNPPlugin::OpenCalendarL( TInt aCalId )
+	{
+	//@TODO: Not supported in TB10.1
+	//CalenLauncher::ViewEntryL(aCalId);
+	}
+
+void CCPixNPPlugin::OpenMapsL( TReal aLatitude, TReal aLongitude )
+    {
+    const TReal KMapRadius = 500; // Radius in meters
+    
+    if ( !iMapView )
+        {
+        iMnProviders.ResetAndDestroy();
+        MnProviderFinder::FindProvidersL( iMnProviders, CMnProvider::EServiceMapView );
+
+        if ( iMnProviders.Count() > 0 )
+            {
+            iMapView = CMnMapView::NewL( *iMnProviders[0] );
+            iMapView->SetExitObserverL(*this);
+            }
+        }
+
+    TCoordinate coord(aLatitude, aLongitude);
+    
+    iMapView->ResetMapArea();
+    iMapView->SetMapAreaL( coord, KMapRadius );
+    iMapView->ShowMapL();
+    }
+
+TInt CCPixNPPlugin::GetVersionNumber() const
+    {
+    return KVersionNumber;
+    }
+
+void CCPixNPPlugin::HandleServerAppExit(TInt /*aReadon*/)
+    {
+    // Maps application close. We can't use maps handle anymore.
+    delete iMapView;
+    iMapView = 0;
+    }
+
+//Added to launch Notes from Widget
+void CCPixNPPlugin::OpenNoteL( const TInt aNoteId)
+    {
+    RWsSession wssession;
+    User::LeaveIfError( wssession.Connect() );
+    CleanupClosePushL( wssession );
+    TBuf8<KNotePadIdMaxLength> notesId;
+    notesId.AppendNum(aNoteId);
+    
+    //Get the tasklist from the Window server session
+    TApaTaskList taskList( wssession );
+    //Find the task related to NotePad app
+    TApaTask task = taskList.FindApp( TUid::Uid( KUidApaNotePad ) );
+
+    if ( task.Exists() )
+        {
+        // NotePad app is running
+        //Send a message to Notepad app with PinBoard UID as
+        //NotePad is handling the message only if it get Pinboard Uid
+        User::LeaveIfError( task.SendMessage( TUid::Uid( KUidApaMessagePinboardValue ), 
+                notesId ) );
+        //Bring the Notepad to Foreground
+        task.BringToForeground();
+        }
+    else
+        { // NotePad app not yet running
+        RApaLsSession appArcSession;
+        CleanupClosePushL( appArcSession );
+        User::LeaveIfError( appArcSession.Connect() );      
+        TApaAppInfo appInfo;
+        const TInt err = appArcSession.GetAppInfo( appInfo, 
+                                        TUid::Uid( KUidApaNotePad ) );
+        if( err == KErrNone )
+            {
+            CApaCommandLine* cmdLine = CApaCommandLine::NewLC();
+            cmdLine->SetExecutableNameL( appInfo.iFullName );
+            cmdLine->SetCommandL( EApaCommandRun );
+            //Send the Note Id as the tail
+            cmdLine->SetTailEndL( notesId );
+
+            User::LeaveIfError( appArcSession.StartApp( *cmdLine ) );
+            CleanupStack::PopAndDestroy( cmdLine );
+            }
+        CleanupStack::PopAndDestroy( &appArcSession ); 
+        } 
+    CleanupStack::PopAndDestroy( &wssession );
+    }
+
+void CCPixNPPlugin::GetDriveFromMediaIdL(HBufC* aMediaId,TDes& aDrive)
+    {
+    TUint32 mediaId;
+    TBuf<14> bufMedia;
+    bufMedia.Copy(*aMediaId);
+    TUint mediaNum;
+    TLex lex(bufMedia);
+    lex.Val(mediaNum);
+    TDriveNumber drive = TDriveNumber(KErrNotSupported);//Initialize to not supported first
+    TVolumeInfo volumeInfo;
+    TChar driveLetter;
+    for(TInt i=0;i<=EDriveZ;i++)
+       {
+       TInt err= iFs.Volume(volumeInfo,i);
+        if (err!=KErrNotReady) 
+            // Volume() returns KErrNotReady if no volume present.
+            // In this case, check next drive number
+            {
+            if(volumeInfo.iUniqueID == mediaNum)
+                {
+                drive = TDriveNumber(i);//Is the drive
+                User::LeaveIfError(iFs.DriveToChar(drive,driveLetter));
+                break;
+                }
+            }
+       }
+    aDrive.Append(driveLetter);
+    aDrive.Append(_L(":"));
+    //Convert to Int and get the drive
+    
+    }
+//  End of File
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/browserplugin/cpixnpplugin/src/ccpixnppluginecom.cpp	Mon Apr 19 14:40:05 2010 +0300
@@ -0,0 +1,265 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Interface to Browser
+*
+*/
+
+// INCLUDE FILES
+#include <implementationproxy.h>
+#include "CCPixNPPluginEcom.h"
+#include "CCPixNPPlugin.h"
+
+#include "NPUtils.h"
+
+#include <uri8.h>
+
+/***************************************************/
+/**********ECOM STYLE CPix PLUGIN ENTRY POINTS******/
+/***************************************************/
+
+_LIT8( KFileScheme, "file" );
+_LIT8( KHttpScheme, "http" );
+_LIT8( KNokiaDomain, "nokia.com" ); 
+
+// -----------------------------------------------------------------------------
+// CCPixNPPluginEcom::NewL
+// -----------------------------------------------------------------------------
+CCPixNPPluginEcom* CCPixNPPluginEcom::NewL( TAny* aInitParam )
+    {
+    TFuncs* funcs = REINTERPRET_CAST( TFuncs*, aInitParam );
+    CCPixNPPluginEcom* self = new (ELeave) CCPixNPPluginEcom( funcs->iNetscapeFuncs );
+    CleanupStack::PushL( self );
+    self->ConstructL( funcs->iPluginFuncs );
+    CleanupStack::Pop( self );
+    Dll::SetTls ( (void*) self );
+    
+        
+    return self;
+    }
+
+// -----------------------------------------------------------------------------
+// CCPixNPPluginEcom::ConstructL
+// -----------------------------------------------------------------------------
+void CCPixNPPluginEcom::ConstructL( NPPluginFuncs* aPluginFuncs )
+    {
+    InitializeFuncs( aPluginFuncs );
+    }
+
+// -----------------------------------------------------------------------------
+// CCPixNPPluginEcom::CCPixNPPluginEcom
+// -----------------------------------------------------------------------------
+CCPixNPPluginEcom::CCPixNPPluginEcom( NPNetscapeFuncs* aNpf )
+    : CEcomBrowserPluginInterface(),
+      iNpf( aNpf )
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// CCPixNPPluginEcom::~CCPixNPPluginEcom
+// -----------------------------------------------------------------------------
+CCPixNPPluginEcom::~CCPixNPPluginEcom()
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// KImplementationTable
+// -----------------------------------------------------------------------------
+const TImplementationProxy KImplementationTable[] =
+    {
+    {{KCPixNPPluginImplementationValue}, (TProxyNewLPtr)CCPixNPPluginEcom::NewL}
+    };
+
+// -----------------------------------------------------------------------------
+// ImplementationGroupProxy
+// Returns the filters implemented in this DLL
+// Returns: The filters implemented in this DLL
+// -----------------------------------------------------------------------------
+EXPORT_C const TImplementationProxy* ImplementationGroupProxy(TInt& aTableCount)
+    {
+    aTableCount = sizeof(KImplementationTable) / sizeof(TImplementationProxy);
+    return KImplementationTable;
+    }
+
+// -----------------------------------------------------------------------------
+// InitializeFuncs
+// -----------------------------------------------------------------------------
+EXPORT_C NPError InitializeFuncs( NPPluginFuncs* aPpf )
+    {
+    aPpf->size          = sizeof(NPPluginFuncs);
+    aPpf->version       = 1;
+    aPpf->newp          = NewNPP_NewProc(CPixPluginNewp);
+    aPpf->destroy       = NewNPP_DestroyProc(CPixPluginDestroy);
+    aPpf->setwindow     = 0;
+    aPpf->newstream     = 0;
+    aPpf->destroystream = 0;
+    aPpf->asfile        = 0;
+    aPpf->writeready    = 0;
+    aPpf->write         = 0;
+    aPpf->print         = 0;
+    aPpf->event         = 0;
+    aPpf->urlnotify     = 0;
+    aPpf->javaClass     = 0;
+    aPpf->getvalue      = NewNPP_GetValueProc(CPixPluginGetvalue);
+    aPpf->setvalue      = 0;
+    return NPERR_NO_ERROR;
+    }
+
+// -----------------------------------------------------------------------------
+// NPP_Shutdown
+// -----------------------------------------------------------------------------
+EXPORT_C void NPP_Shutdown(void)
+    {
+    CCPixNPPluginEcom* CPixPluginEcom = (CCPixNPPluginEcom*)Dll::Tls();
+    delete CPixPluginEcom;
+    Dll::SetTls( NULL );
+    }
+
+// ============================= LOCAL FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CPixPluginNewp
+// Create a new instance of a plugin. This is non-leaving method.
+// Returns: NPError: Error codes recognized by Browser
+// -----------------------------------------------------------------------------
+NPError CPixPluginNewp( NPMIMEType /*pluginType*/,  // Not used locally
+                  NPP aInstance,            // Stores pointer to SystemInfo 
+                  uint16 /*mode*/,          // 
+                  CDesCArray* argn,         // The number of arguments passed
+                  CDesCArray* argv,         // The values of arguments in the array
+                  NPSavedData* /*saved*/ )  // 
+    {
+    if ( !CPixPluginAcceptLoadAttempt( aInstance ) ) 
+    	{
+    	return NPERR_MODULE_LOAD_FAILED_ERROR; 
+    	}
+    TRAPD( err, CPixPluginConstructL( aInstance, argn, argv ) );
+    if ( err == KErrNoMemory )
+        {        
+        return NPERR_OUT_OF_MEMORY_ERROR;
+        }
+    if ( err != KErrNone )
+        {
+        return NPERR_MODULE_LOAD_FAILED_ERROR;
+        }
+        
+    return NPERR_NO_ERROR;
+    }
+
+TBool CPixPluginAcceptLoadAttempt( NPP aInstance )
+	{
+    CCPixNPPluginEcom* pluginEcom = (CCPixNPPluginEcom*) Dll::Tls();
+    NPNetscapeFuncs* netscapeFuncs = pluginEcom->Funcs();
+    
+	// Disabled, because NPN_GetValue was not found in npscript.lib
+	TBool accept = EFalse;
+    NPObject *windowObj = NULL;
+    if ( netscapeFuncs->getvalue( aInstance, NPNVWindowNPObject, &windowObj ) == NPERR_NO_ERROR 
+    	 && windowObj )
+    	{
+        NPIdentifier propertyId = NPN_GetStringIdentifier( "location" );
+        NPVariant location;
+        if ( NPN_GetProperty( aInstance, windowObj, propertyId, &location ) )
+        	{
+            NPObject* locationObj = location.value.objectValue;
+            if ( locationObj ) 
+            	{
+				propertyId = NPN_GetStringIdentifier( "href" );
+				NPVariant href;
+				if ( NPN_GetProperty( aInstance, locationObj, propertyId, &href ) ) 
+					{
+					TRAP_IGNORE( 
+						HBufC8* buf = nputils::VariantToHBufC8LC( href );
+						if ( buf ) 
+							{
+							TUriParser8 parser; 
+							parser.Parse( *buf );
+							if ( parser.Extract( EUriScheme ) == KFileScheme() ) 
+								{
+								accept = ETrue; 
+								}
+							else if ( parser.Extract( EUriScheme ) == KHttpScheme() )
+								{
+								TDesC8 host = parser.Extract( EUriHost );
+								if (host.Right( KNokiaDomain().Length() ) == KNokiaDomain() )
+									{
+									accept = ETrue;
+									}
+								}
+							CleanupStack::PopAndDestroy( buf ); 
+							}
+						); 
+					}
+            	}
+			}
+    	}
+    return accept; 
+	}
+
+
+
+// -----------------------------------------------------------------------------
+// CPixPluginConstructL
+// This is the leaving method to create the plugin.  We have leaving setters
+// that need to be wrapped.
+// Returns: void
+// -----------------------------------------------------------------------------
+void CPixPluginConstructL( NPP aInstance,      // Stores pointer to CPixPlugin 
+                     CDesCArray* /*argn*/,      // The number of arguments passed
+                     CDesCArray* /*argv*/ )     // The values of arguments in the array
+    {
+    CCPixNPPlugin* plugin = CCPixNPPlugin::NewL();
+    plugin->SetInstance( aInstance, NULL );
+    aInstance->pdata = plugin;
+     
+    CCPixNPPluginEcom* CPixPluginEcom = (CCPixNPPluginEcom*) Dll::Tls();
+    NPNetscapeFuncs* netscapeFuncs = CPixPluginEcom->Funcs();
+    NPBool value_false = 0;
+    netscapeFuncs->setvalue( aInstance, NPPVpluginWindowBool, (void*)&value_false );        // not owing the window
+    netscapeFuncs->setvalue( aInstance, NPPVpluginTransparentBool, (void*)&value_false );   // speed up drawing
+    }
+// -----------------------------------------------------------------------------
+// CPixDestroy(NPP aInstance, NPSavedData**)
+// Called by Browser to destroy the plugin
+// Returns: NPError: Error Code
+// -----------------------------------------------------------------------------
+NPError CPixPluginDestroy( NPP aInstance,               // Link to Browser
+                     NPSavedData** /*save*/ )   // Not used locally
+    {
+    CCPixNPPlugin* pluginInstance = STATIC_CAST( CCPixNPPlugin*, aInstance->pdata );
+    delete pluginInstance;
+    
+    return NPERR_NO_ERROR;
+    }
+
+        
+// -----------------------------------------------------------------------------
+// CPixPluginGetvalue		
+// -----------------------------------------------------------------------------
+//
+NPError CPixPluginGetvalue( NPP aInstance, NPPVariable variable, void* ret_value )	
+    {
+	if (variable == NPPVpluginScriptableNPObject)
+		{        
+		CCPixNPPlugin* plugin = (CCPixNPPlugin*)aInstance->pdata;
+		CPixPluginObject* pluginObject = (CPixPluginObject *)NPN_CreateObject (aInstance, CPixPluginClass);
+		pluginObject->plugin = plugin; 
+		plugin->SetInstance( aInstance, &pluginObject->object );
+		void** ret = (void**)ret_value;
+		*ret = (void*)pluginObject;
+		} 
+    return NPERR_NO_ERROR;        
+    }
+
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/browserplugin/cpixnpplugin/src/ccpixnpplugininterface.cpp	Mon Apr 19 14:40:05 2010 +0300
@@ -0,0 +1,405 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Interface to Browser for handling embedded system info requests.
+ *
+*/
+
+// INCLUDE FILES
+#include "CCPixNPPluginInterface.h"
+#include "HarvesterServerLogger.h"
+#include <string.h>
+#include <common.h>
+
+#include "utf.h"
+
+#include "CCPixNPSearcher.h"
+#include "CCPixNPPluginEcom.h"
+#include "CPixNPExceptions.h"
+#include "CMobileInfo.h"
+
+#include "NPUtils.h"
+using namespace nputils; 
+
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+CCPixNPPluginInterface::~CCPixNPPluginInterface()
+    {
+    }
+
+// -----------------------------------------------------------------------------
+
+const NPUTF8 *CPixNPPluginPropertyNames[] =
+	{ 
+	"DOCUID",				// 0
+	"APPCLASS",
+	"EXCERPT",
+	"MIMETYPE", 
+	"AGGREGATE",			
+	"DEFAULT"               // 5
+	"TERM",
+	"DOCFREQ",
+	"ANALYZER_STANDARD",
+	"TOKENIZER_STANDARD",   
+	"TOKENIZER_WHITESPACE", // 10
+	"TOKENIZER_LETTER",     
+	"TOKENIZER_KEYWORD",
+	"FILTER_STANDARD",
+	"FILTER_LOWERCASE",
+	"FILTER_ACCENT",        // 15
+	"FILTER_STOP",
+	"FILTER_STEM",
+   	"FILTER_LENGTH",
+   	"LANG_EN",
+  	"LANG_FI",              // 20
+  	"LANG_HU",
+  	"LANG_RU"
+    };
+
+
+
+typedef const TDesC& (CCPixNPPluginInterface::*CPixNPPluginGetPropertyMethod)() const;
+
+const CPixNPPluginGetPropertyMethod CPixNPPluginGetPropertyMethods[] =
+	{ 
+	&CCPixNPPluginInterface::DocUidFieldName,		// 0
+	&CCPixNPPluginInterface::AppClassFieldName,
+	&CCPixNPPluginInterface::ExcerptFieldName,
+	&CCPixNPPluginInterface::MimeTypeFieldName, 
+	&CCPixNPPluginInterface::AggregateFieldName, 
+	&CCPixNPPluginInterface::DefaultFieldName,	    // 5
+	&CCPixNPPluginInterface::TermTextFieldName,
+	&CCPixNPPluginInterface::TermDocFreqFieldName, 
+	&CCPixNPPluginInterface::StandardAnalyzerId,
+	&CCPixNPPluginInterface::StandardTokenizerId, 
+	&CCPixNPPluginInterface::WhitespaceTokenizerId,  // 10
+	&CCPixNPPluginInterface::LetterTokenizerId,
+	&CCPixNPPluginInterface::KeywordTokenizerId, 
+	&CCPixNPPluginInterface::StandardFilterId,
+	&CCPixNPPluginInterface::LowercaseFilterId, 
+	&CCPixNPPluginInterface::AccentFilterId, 		// 15
+	&CCPixNPPluginInterface::StopFilterId, 
+	&CCPixNPPluginInterface::StemFilterId, 
+	&CCPixNPPluginInterface::LengthFilterId, 
+	&CCPixNPPluginInterface::EnglishLanguageId, 
+	&CCPixNPPluginInterface::FinnishLanguageId, 		// 20
+	&CCPixNPPluginInterface::HungarianLanguageId, 
+	&CCPixNPPluginInterface::RussianLanguageId, 
+    };
+
+
+const NPUTF8 *CPixNPPluginMethodNames[] =
+	{
+	"createSearcher",
+	"defineVolume",
+	"undefineVolume",
+    "openContact",
+    "openMessaging",
+    "openCalendar",
+    "openMaps",
+    "getCountryCode",
+    "getVersionNumber",
+    "openNote",
+    "getDriveFromMediaId"
+	};
+
+void CCPixNPPluginInterface::InitInterfaceL()
+    {
+    SetIdentifiersL( CPixNPPluginPropertyNames, sizeof(CPixNPPluginPropertyNames)/sizeof(CPixNPPluginPropertyNames[0]),
+    				 CPixNPPluginMethodNames, sizeof(CPixNPPluginMethodNames)/sizeof(CPixNPPluginMethodNames[0]) );
+    }
+
+// -----------------------------------------------------------------------------
+
+bool CCPixNPPluginInterface::InvokeL(NPIdentifier name, NPVariant* args, uint32_t argCount, NPVariant *result)
+    {
+    VOID_TO_NPVARIANT( *result ); // sets the result empty
+    
+    if ( name == iMethodIdentifiers[0] ) // createSearcher
+        {
+        if ( argCount == 1 ) 
+        	{
+            CPIXLOGSTRING("CCPixNPPluginInterface::InvokeL(1) : Requesting search server session");
+			TRAPD(err, 
+				HBufC16* baseAppClass = VariantToHBufC16LC( args[0] );
+				
+				CPixNPSearcherObject *object = (CPixNPSearcherObject *)NPN_CreateObject (iInstanceHandle, CPixNPSearcherClass);
+				CCPixNPSearcher* customObject = CreateSearcherL( *baseAppClass  );
+				customObject->SetInstance( iInstanceHandle, &object->object );
+				object->plugin = customObject;
+				OBJECT_TO_NPVARIANT( (NPObject*)object, *result );
+				
+				CleanupStack::PopAndDestroy( baseAppClass ); 
+				);
+			// TODO: Report err
+        	} 
+        else if ( argCount == 2 ) 
+        	{ 
+            CPIXLOGSTRING("CCPixNPPluginInterface::InvokeL(2) : Requesting search server session");
+			TRAPD(err, 
+				HBufC16* baseAppClass = VariantToHBufC16LC( args[0] );
+				HBufC16* defaultField = VariantToHBufC16LC( args[1] );
+				
+				CPixNPSearcherObject *object = (CPixNPSearcherObject *)NPN_CreateObject (iInstanceHandle, CPixNPSearcherClass);
+				CCPixNPSearcher* customObject = CreateSearcherL( *baseAppClass, *defaultField );
+				customObject->SetInstance( iInstanceHandle, &object->object );
+				object->plugin = customObject;
+				OBJECT_TO_NPVARIANT( (NPObject*)object, *result );
+				
+				CleanupStack::PopAndDestroy( defaultField ); 
+				CleanupStack::PopAndDestroy( baseAppClass );
+				);
+			// TODO Report err
+        	}
+        else 
+        	{
+        	// FIXME: Doesn't work
+        	NPString string; 
+        	// ugly conversion? 
+        	string.UTF8Characters = reinterpret_cast<const char*>(KCPixNPNotEnoughArgumentsException().Ptr());
+        	string.UTF8Length = KCPixNPNotEnoughArgumentsException().Length(); 
+        	//NPN_SetException( this->iNpObject, &string );
+        	}		
+        return true;
+        }
+    else if ( name == iMethodIdentifiers[1] ) // defineVolume
+        {
+        TRAPD( err, InvokeDefineVolumeL( name, args, argCount, result ) );
+        if ( KErrNone == err )
+            {
+            return true; // TODO Report err
+            }
+        return true;
+        }
+    else if ( name == iMethodIdentifiers[2] ) // undefineVolume
+        {
+        TRAPD( err, InvokeUnDefineVolumeL( name, args, argCount, result ) );
+        if ( KErrNone == err )
+            {
+            return true; // TODO Report err
+            }
+        return true;
+        }
+    else if ( name == iMethodIdentifiers[3] ) // openContact
+        {
+    	if (argCount >= 1) 
+    		{
+			TInt contactId = VariantToInt( args[0] );
+			TRAPD(err, OpenContactL(contactId));
+			// TODO: report err
+    		}
+		// TODO: Report err
+        return true;
+        }    
+    else if ( name == iMethodIdentifiers[4] ) // openMessaging
+        {
+    	if (argCount >= 1) 
+    		{
+			TInt mesId = VariantToInt( args[0] );
+			TRAPD(err, OpenMessagingL(mesId));
+			// TODO: report err
+    		}
+		// TODO: Report err
+        return true;
+        }    
+    else if ( name == iMethodIdentifiers[5] ) // openCalendar
+        {
+    	if (argCount >= 1) 
+    		{
+			TInt calendarId = VariantToInt( args[0] );
+			TRAPD(err, OpenCalendarL(calendarId));
+			// TODO: report err
+    		}
+		// TODO: Report err
+        return true;
+        }        
+    else if ( name == iMethodIdentifiers[6] ) // openMaps
+        {
+        if (argCount >= 2) 
+            {
+            TReal latitude = VariantToDouble( args[0] );
+            TReal longitude = VariantToDouble( args[1] );
+            TRAPD(err, OpenMapsL(latitude, longitude));
+            // TODO: report err
+            }
+        // TODO: Report err
+        return true;
+        }        
+    else if ( name == iMethodIdentifiers[7] ) // getCountryCode
+        {
+		TInt mccInt(0);
+		TBuf<10> mcc; //MCC code has 3 digits 
+		TRAPD(err, CMobileInfo::GetInfoL(mcc));
+		if (KErrNone == err)
+			{
+			TLex lex(mcc);
+			lex.Val(mccInt);
+			}
+		INT32_TO_NPVARIANT(mccInt, *result); 
+        return true;
+        }
+    else if ( name == iMethodIdentifiers[8] ) // getVersionNumber
+        {
+		TInt versionNumber(0);
+		versionNumber = GetVersionNumber();
+		INT32_TO_NPVARIANT(versionNumber, *result); 
+        return true;
+        }
+	else if ( name == iMethodIdentifiers[9] ) // openNote
+        {
+        if (argCount >= 1) 
+            {
+            TInt noteId = VariantToInt( args[0] );
+            TRAPD(err, OpenNoteL(noteId));
+            // TODO: report err
+            }
+        // TODO: Report err
+        return true;
+        } 
+	else if( name == iMethodIdentifiers[10] ) //getDriveFromMediaId
+	    {
+	    if (argCount >= 1) 
+            {
+	        //Get arg[0] convert from Variant to Descriptor and get the drive
+	        HBufC16* mediaId = VariantToHBufC16LC( args[0] );
+	        TBuf<5> bufMedia;
+	        GetDriveFromMediaIdL(mediaId,bufMedia);
+	        DescriptorToVariantL(bufMedia,*result);
+	        //Convert bufMedia to variant
+	        CleanupStack::PopAndDestroy(mediaId);
+            }
+        // TODO: Report err
+        return true;
+	    }
+    return false;
+    }
+
+// -----------------------------------------------------------------------------
+
+
+
+bool CCPixNPPluginInterface::GetProperty (NPIdentifier name, NPVariant *variant)
+    {
+    // default variant value maps to javascript undefined
+    VOID_TO_NPVARIANT(*variant);
+    
+	for (int i = 0; i < iMethodCount; i++) 
+		{
+		if ( name == iPropertyIdentifiers[i] ) 
+			{
+			TRAP_IGNORE(
+				CPixNPPluginGetPropertyMethod method = CPixNPPluginGetPropertyMethods[i];
+				DescriptorToVariantL((*this.*method)(), *variant);
+			);
+			return true; 
+			}
+		}
+	
+    return false;
+    }
+
+// -----------------------------------------------------------------------------
+
+bool CCPixNPPluginInterface::SetPropertyL( NPIdentifier /*name*/, NPVariant* /*variant*/ )
+    {
+    return false;
+    }
+
+
+// -----------------------------------------------------------------------------
+// NPClass Function
+
+NPObject *CPixPluginAllocate ()
+    {
+    CPixPluginObject *newInstance = (CPixPluginObject *)User::Alloc (sizeof(CPixPluginObject));       
+    return (NPObject *)newInstance;
+    }
+
+void CPixPluginInvalidate ()
+    {
+    
+    }
+
+void CPixPluginDeallocate (CPixPluginObject* obj) 
+    {    
+    obj->plugin->Deallocate();
+    User::Free ((void *)obj);
+    }    
+ 
+bool CPixPluginHasMethod(CPixPluginObject* obj, NPIdentifier name)
+    {
+    return obj->plugin->HasMethod(name);
+    }
+
+bool CPixPluginInvokeFunctionL(CPixPluginObject* obj, NPIdentifier name, NPVariant *args, uint32_t argCount, NPVariant *result)
+    {
+    return obj->plugin->InvokeL(name, args, argCount, result);
+    }    
+
+bool CPixPluginHasProperty(CPixPluginObject* obj, NPIdentifier name)
+    {
+    return obj->plugin->HasProperty(name);
+    }    
+    
+bool CPixPluginGetProperty (CPixPluginObject* obj, NPIdentifier name, NPVariant *variant)
+    {
+    return obj->plugin->GetProperty(name,variant);
+    }
+
+void CPixPluginSetProperty (CPixPluginObject* obj, NPIdentifier name, NPVariant *variant)
+    {
+    TRAP_IGNORE(obj->plugin->SetPropertyL(name,variant));
+    }
+
+void CCPixNPPluginInterface::InvokeDefineVolumeL(NPIdentifier /*name*/, NPVariant* args, uint32_t argCount, NPVariant */*result*/)
+    {
+    if ( 2 == argCount )
+        {
+        HBufC16* baseAppClass = VariantToHBufC16LC( args[0] );
+        HBufC16* indexDbPath = VariantToHBufC16LC( args[1] );
+
+        if ( iInstanceHandle )
+            {
+            DefineVolumeL( *baseAppClass, *indexDbPath );
+            }
+
+        CleanupStack::PopAndDestroy( indexDbPath );
+        CleanupStack::PopAndDestroy( baseAppClass );
+        }
+    else
+        {
+        User::Leave( KErrArgument );
+        }
+    }
+
+void CCPixNPPluginInterface::InvokeUnDefineVolumeL(NPIdentifier /*name*/, NPVariant* args, uint32_t argCount, NPVariant */*result*/)
+    {
+    if ( 1 == argCount )
+        {
+        HBufC16* baseAppClass = VariantToHBufC16LC( args[0] );
+
+        if ( iInstanceHandle )
+            {
+            UnDefineVolumeL( *baseAppClass );
+            }
+
+        CleanupStack::PopAndDestroy( baseAppClass );
+        }
+    else
+        {
+        User::Leave( KErrArgument );
+        }
+    }
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/browserplugin/cpixnpplugin/src/ccpixnpsearcher.cpp	Mon Apr 19 14:40:05 2010 +0300
@@ -0,0 +1,178 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: 
+*
+*/
+#include <common.h>
+
+#include "CCPixNPSearcher.h"
+
+#include "CNPSearchDocument.h"
+#include "CPixNPExceptions.h"
+
+#include <CSearchDocument.h>
+#include <CCPixSearcher.h>
+
+CCPixNPSearcher::CCPixNPSearcher()
+:	iSearcher( NULL ),
+	iObserver( NULL )
+	{
+	}
+
+CCPixNPSearcher::~CCPixNPSearcher()
+	{
+	delete iSearcher; 
+	delete iObserver; 
+	iSearchSession.Close();
+	}
+    
+CCPixNPSearcher* CCPixNPSearcher::NewL( const TDesC& aBaseAppClass, const TDesC& aDefaultSearchField )
+	{
+	CCPixNPSearcher* self = new (ELeave)CCPixNPSearcher();
+    CleanupStack::PushL(self);
+    self->ConstructL( aBaseAppClass, aDefaultSearchField );
+    CleanupStack::Pop(); // self;
+    return self;
+	}
+
+CCPixNPSearcher* CCPixNPSearcher::NewL( const TDesC& aBaseAppClass )
+	{
+	CCPixNPSearcher* self = new (ELeave)CCPixNPSearcher();
+    CleanupStack::PushL(self);
+    self->ConstructL( aBaseAppClass );
+    CleanupStack::Pop(); // self;
+    return self;
+	}
+
+void CCPixNPSearcher::ConstructL( const TDesC& aBaseAppClass, const TDesC& aDefaultSearchField )
+	{
+	InitInterfaceL();
+	User::LeaveIfError(iSearchSession.Connect());
+	iSearcher = CCPixSearcher::NewL(iSearchSession, aDefaultSearchField);
+	iSearcher->OpenDatabaseL( aBaseAppClass  );
+	}
+
+void CCPixNPSearcher::ConstructL( const TDesC& aBaseAppClass  )
+	{
+	InitInterfaceL();
+	User::LeaveIfError(iSearchSession.Connect());
+	iSearcher = CCPixSearcher::NewL(iSearchSession);
+	iSearcher->OpenDatabaseL( aBaseAppClass  );
+	}
+
+void CCPixNPSearcher::Invalidate() 
+	{
+	// Get rid of observer. Trying to call JavaScript methods
+	delete iObserver; 
+	iObserver = NULL; 
+	
+	iSearcher->Cancel(); 
+	}
+
+void CCPixNPSearcher::SetObserverL( NPObject* aObserver )
+	{
+	delete iObserver; 
+	iObserver = NULL;
+	if ( aObserver != NULL ) 
+		{
+		iObserver = new (ELeave)CCPixNPSearcherObserver( iInstanceHandle, aObserver ); 
+		}
+	}
+
+void CCPixNPSearcher::SetAnalyzerL( const TDesC& aAnalyzer ) 
+	{
+	if ( !iSearcher->IsActive() )
+		{
+		iSearcher->SetAnalyzerL( aAnalyzer ); 
+		}
+	else 
+		{
+		// TODO Raise error
+		}
+	}
+
+void CCPixNPSearcher::SearchL( const TDesC& aSearchTerms, const TDesC& aDocumentField )
+	{
+	PERFORMANCE_LOG_START("CCPixNPSearcher::SearchL");
+	PERFORMANCE_LOG_MESSAGE(aSearchTerms);
+	
+	if ( !iSearcher->IsActive() ) 
+		{
+		iSearcher->SearchL( *this, aSearchTerms, aDocumentField );
+		}
+	else 
+		{
+		// TODO Raise error
+		}
+	
+	}
+
+void CCPixNPSearcher::GetDocumentL(TInt aIndex)
+	{
+    PERFORMANCE_LOG_START("CCPixNPSearcher::GetDocumentL");
+
+	if ( !iSearcher->IsActive() ) 
+		{
+		iSearcher->GetDocumentL( aIndex, *this );
+		}
+	else 
+		{
+		// TODO Raise error
+		}
+	}
+
+void CCPixNPSearcher::Cancel()
+	{
+	iSearcher->Cancel();
+	}
+
+TBool CCPixNPSearcher::IsActive()
+	{
+	return iSearcher->IsActive(); 
+	}
+
+void CCPixNPSearcher::HandleSearchResultsL(TInt aError, TInt aEstimatedResultCount)
+	{
+	PERFORMANCE_LOG_START("CCPixNPSearcher::HandleSearchResultsL");
+	if ( iObserver != NULL ) 
+		{
+		iObserver->HandleSearchResultsL( DescribeErrorCode( aError ), 
+										 aEstimatedResultCount ); 
+		}
+	}
+
+void CCPixNPSearcher::HandleDocumentL( TInt aError, CSearchDocument* aDocument )
+	{
+	if ( iObserver != NULL ) 
+		{
+		if ( aDocument != NULL ) 
+			{
+			NPSearchDocumentObject *object = reinterpret_cast<NPSearchDocumentObject *>(NPN_CreateObject (iInstanceHandle, NPSearchDocumentClass));
+			CNPSearchDocument* documentObject = CNPSearchDocument::NewL( aDocument );
+			documentObject->SetInstance( iInstanceHandle, &object->object );
+	        object->plugin = documentObject;
+			iObserver->HandleDocumentL( DescribeErrorCode( aError ), 
+											object ); 
+		} else {
+			iObserver->HandleDocumentL( DescribeErrorCode( aError ), 
+											NULL ); 
+			}
+		} 
+	else 
+		{
+		delete aDocument; 
+		}
+	}
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/browserplugin/cpixnpplugin/src/ccpixnpsearcherinterface.cpp	Mon Apr 19 14:40:05 2010 +0300
@@ -0,0 +1,204 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: 
+*
+*/
+
+// INCLUDE FILES
+#include <common.h>
+
+#include "CCPixNPSearcherInterface.h"
+#include "utf.h"
+
+#include "e32base.h"
+
+#include "NPUtils.h"
+using namespace nputils; 
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+CCPixNPSearcherInterface::~CCPixNPSearcherInterface()
+    {
+    }
+
+// -----------------------------------------------------------------------------
+
+void CCPixNPSearcherInterface::InitInterfaceL()
+    {
+    const NPUTF8 *CPixNPSearcherMethodNames[] =
+    	{
+        "setObserver",
+        "search",
+        "getDocument",
+        "setAnalyzer",
+        "cancel",
+        "isActive"
+    	};
+    SetIdentifiersL( NULL, 0, 
+    				 CPixNPSearcherMethodNames, sizeof(CPixNPSearcherMethodNames)/sizeof(CPixNPSearcherMethodNames[0]));
+    }
+
+// -----------------------------------------------------------------------------
+
+bool CCPixNPSearcherInterface::InvokeL(NPIdentifier name, NPVariant* args, uint32_t argCount, NPVariant *result)
+    {
+    
+    VOID_TO_NPVARIANT( *result );
+    if ( name == iMethodIdentifiers[0] ) // setObserver
+        {
+        if ( argCount >= 1 && NPVARIANT_IS_OBJECT( args[0] ) ) 
+        	{
+			TRAPD(err, 
+				NPObject* observer = NPVARIANT_TO_OBJECT( args[0] ); 
+				SetObserverL( observer );
+				); 
+			// TODO: Report err
+        	}
+        else 
+        	{
+        	// TODO: Exception handling: NotEnoughtArgumentsException & IllegalArgumentExceptions
+        	}
+        return true; 
+        }
+    else if ( name == iMethodIdentifiers[1] ) // search
+        {
+        PERFORMANCE_LOG_START("CCPixNPSearcherInterface::InvokeL");
+        PERFORMANCE_LOG_MESSAGE(_L("----------New search----------"));
+
+        if ( argCount >= 1 ) 
+        	{
+			TRAPD(err, 
+				HBufC16* query = VariantToHBufC16LC( args[0] );
+				SearchL( *query);
+				CleanupStack::PopAndDestroy( query ); 
+				); 
+			// TODO: Report err
+        	}
+        else 
+        	{
+        	// TODO: Exception handling: NotEnoughtArgumentsException & IllegalArgumentExceptions
+        	}
+
+        return true;
+        }
+    else if ( name == iMethodIdentifiers[2] ) // getDocument
+        {
+    	if (argCount >= 1) 
+    		{
+			TInt index = VariantToInt( args[0] );
+			TRAPD(err, GetDocumentL(index));
+			// TODO: report err
+    		}
+		// TODO: Report err
+        return true;
+        }
+    else if ( name == iMethodIdentifiers[3] ) // setAnalyzer
+        {
+        if ( argCount >= 1 ) 
+         	{
+ 			TRAPD(err, 
+ 				HBufC16* query = VariantToHBufC16LC( args[0] );
+ 				SetAnalyzerL( *query );
+ 				CleanupStack::PopAndDestroy( query ); 
+ 				); 
+ 			// TODO: Report err
+         	}
+         else 
+         	{
+         	// TODO: Exception handling: NotEnoughtArgumentsException & IllegalArgumentExceptions
+         	}
+        return true;
+        }
+    else if ( name == iMethodIdentifiers[4] ) // cancel
+        {
+		TRAPD(err,
+			Cancel(); 
+			); 
+		// TODO: Report err
+        return true;
+        }
+    else if ( name == iMethodIdentifiers[5] ) // isActive
+        {
+		TRAPD(err,
+			BOOLEAN_TO_NPVARIANT(IsActive(),  *result); 
+			); 
+		// TODO: Report err
+        return true;
+        }
+    
+    return false;
+    }
+
+// -----------------------------------------------------------------------------
+
+bool CCPixNPSearcherInterface::GetProperty (NPIdentifier name, NPVariant *variant)
+    {
+    // default variant value maps to javascript undefined
+    VOID_TO_NPVARIANT(*variant);
+    return false;
+    }
+
+// -----------------------------------------------------------------------------
+
+bool CCPixNPSearcherInterface::SetPropertyL( NPIdentifier name, NPVariant *variant )
+    {
+    return false;
+    }
+
+// -----------------------------------------------------------------------------
+// NPClass Function
+
+NPObject *CPixNPSearcherAllocate ()
+    {
+    CPixNPSearcherObject *newInstance = (CPixNPSearcherObject *)User::Alloc (sizeof(CPixNPSearcherObject));       
+    return (NPObject *)newInstance;
+    }
+
+void CPixNPSearcherInvalidate (CPixNPSearcherObject *obj)
+    {
+    obj->plugin->Invalidate();
+    }
+
+void CPixNPSearcherDeallocate (CPixNPSearcherObject* obj) 
+    {    
+    obj->plugin->Deallocate();
+    User::Free ((void *)obj);
+    }    
+ 
+bool CPixNPSearcherHasMethod(CPixNPSearcherObject* obj, NPIdentifier name)
+    {
+    return obj->plugin->HasMethod(name);
+    }
+
+bool CPixNPSearcherInvokeFunctionL(CPixNPSearcherObject* obj, NPIdentifier name, NPVariant *args, uint32_t argCount, NPVariant *result)
+    {
+    return obj->plugin->InvokeL(name, args, argCount, result);
+    }    
+
+bool CPixNPSearcherHasProperty(CPixNPSearcherObject* obj, NPIdentifier name)
+    {
+    return obj->plugin->HasProperty(name);
+    }    
+    
+bool CPixNPSearcherGetProperty (CPixNPSearcherObject* obj, NPIdentifier name, NPVariant *variant)
+    {
+    return obj->plugin->GetProperty(name,variant);
+    }
+
+void CPixNPSearcherSetProperty (CPixNPSearcherObject* obj, NPIdentifier name, NPVariant *variant)
+    {
+    TRAP_IGNORE(obj->plugin->SetPropertyL(name,variant));
+    }
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/browserplugin/cpixnpplugin/src/ccpixnpsearcherobserver.cpp	Mon Apr 19 14:40:05 2010 +0300
@@ -0,0 +1,100 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: 
+*
+*/
+#include "CCPixNPSearcherObserver.h"
+
+#include "CNPSearchDocumentInterface.h"
+#include <string.h>
+
+#include "CCPixNPPluginEcom.h"
+#include <utf.h>
+#include <common.h>
+
+/**
+ * These are the methods that are called in the script object,
+ * observer object is wrapping. 
+ */
+_LIT8( KHandleSearchResultsMethodName, "handleSearchResults"); 
+_LIT8( KHandleDocumentMethodName, "handleDocument"); 
+
+CCPixNPSearcherObserver::CCPixNPSearcherObserver( NPP& aNpp, NPObject* aSelf )
+: iNpp( aNpp ), iSelf( aSelf )
+    {
+    NPN_RetainObject( iSelf ); 
+    }
+
+CCPixNPSearcherObserver::~CCPixNPSearcherObserver()
+    {
+    if (iSelf) NPN_ReleaseObject( iSelf );
+    }
+
+void CCPixNPSearcherObserver::HandleSearchResultsL(const TDesC8* aError, TInt aEstimatedResultCount)
+	{
+	PERFORMANCE_LOG_START("CCPixNPSearcherObserver::HandleSearchResultsL");
+	
+    NPVariant result;
+    NPString function;
+    function.UTF8Characters = (const NPUTF8 *)KHandleSearchResultsMethodName().Ptr();
+    function.UTF8Length = KHandleSearchResultsMethodName().Length();
+
+    NPVariant args[2];
+    if ( aError ) {
+    	DescriptorToVariant( *aError, args[0] ); 
+    } else {
+    	NULL_TO_NPVARIANT( args[0] );
+    }
+    INT32_TO_NPVARIANT( aEstimatedResultCount, args[1] );
+    
+    PERFORMANCE_LOG_MESSAGE(_L("----------Start document fetching----------"));
+    NPN_Invoke( iNpp, iSelf, &function, args, 2, &result );
+	}
+
+void CCPixNPSearcherObserver::HandleDocumentL(const TDesC8* aError, NPSearchDocumentObject* aDocument)
+	{
+    NPVariant result;
+    NPString function;
+    function.UTF8Characters = (const NPUTF8 *)KHandleDocumentMethodName().Ptr();
+    function.UTF8Length = KHandleDocumentMethodName().Length();
+
+    NPVariant args[2];
+    if ( aError ) {
+    	DescriptorToVariant( *aError, args[0] ); 
+    } else {
+    	NULL_TO_NPVARIANT( args[0] );
+    }
+    if ( aDocument ) {
+    	OBJECT_TO_NPVARIANT( &aDocument->object, args[1] );
+    } else {
+    	NULL_TO_NPVARIANT( args[1] );
+    }
+
+    NPN_Invoke( iNpp, iSelf, &function, args, 2, &result );
+	}
+
+void CCPixNPSearcherObserver::DescriptorToVariant(const TDesC8& aString, NPVariant& aVariant)
+	{
+    CCPixNPPluginEcom* pluginEcom = (CCPixNPPluginEcom*) Dll::Tls();
+    NPNetscapeFuncs* netscapeFuncs = pluginEcom->Funcs(); 
+
+    int length = aString.Length();
+    char* newString = (char *)netscapeFuncs->memalloc( length );
+    if (newString)
+    	{
+        Mem::Copy(newString, aString.Ptr(), length);
+        STRINGN_TO_NPVARIANT(newString, length, aVariant);
+    	}
+	}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/browserplugin/cpixnpplugin/src/cmobileinfo.cpp	Mon Apr 19 14:40:05 2010 +0300
@@ -0,0 +1,68 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: 
+*
+*/
+
+#include "CMobileInfo.h"
+
+CMobileInfo::CMobileInfo(TDes& aMCC)
+	: CActive(CActive::EPriorityStandard),
+	iMCC(aMCC),
+	iMCCMNCV1Pkg(iMCCMNCV1)
+	{
+	CActiveScheduler::Add(this);
+	}
+
+CMobileInfo::~CMobileInfo()
+	{
+	Cancel();
+	delete iTelephony;
+	delete iWait;
+	}
+
+void CMobileInfo::GetInfoL(TDes& aMCC)
+	{
+	CMobileInfo* self= new (ELeave) CMobileInfo(aMCC);
+	CleanupStack::PushL(self);
+	self->ConstructL();
+	CleanupStack::PopAndDestroy(self);
+	}
+
+void CMobileInfo::ConstructL()
+	{
+	iWait = new (ELeave) CActiveSchedulerWait();
+
+	iTelephony = CTelephony::NewL();
+	iTelephony->GetCurrentNetworkInfo(iStatus, iMCCMNCV1Pkg);
+	SetActive();
+
+	iWait->Start();
+	}
+
+void CMobileInfo::RunL()
+	{
+	if(iStatus==KErrNone)
+		{
+		iMCC = iMCCMNCV1.iCountryCode;
+		}
+	iWait->AsyncStop();
+	}
+
+void CMobileInfo::DoCancel()
+	{
+	iTelephony->CancelAsync(CTelephony::EGetCurrentNetworkInfoCancel);
+	}
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/browserplugin/cpixnpplugin/src/cnpdocumentfield.cpp	Mon Apr 19 14:40:05 2010 +0300
@@ -0,0 +1,55 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: 
+*
+*/
+#include "CNPDocumentField.h"
+#include "CNPSearchDocument.h"
+#include "CDocumentField.h"
+
+CNPDocumentField *CNPDocumentField::NewL( CNPSearchDocument& aOwner, const CDocumentField& aField )
+	{
+	CNPDocumentField* self = new (ELeave)CNPDocumentField( aOwner, aField );
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop(); // self;
+    return self;
+	}
+
+CNPDocumentField::~CNPDocumentField()
+	{
+	iOwner.Release(); // After this moment, the owner may have become released
+	}
+	
+CNPDocumentField::CNPDocumentField( CNPSearchDocument& aOwner, const CDocumentField& aField  )
+: 	iOwner( aOwner ), 
+	iField( aField )
+	{
+	iOwner.Retain(); 
+	}
+
+void CNPDocumentField::ConstructL()
+	{
+	InitInterfaceL();
+	}
+
+const TDesC& CNPDocumentField::Name() const
+	{
+	return iField.Name(); 
+	}
+
+const TDesC& CNPDocumentField::Value() const
+	{
+	return iField.Value(); 
+	}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/browserplugin/cpixnpplugin/src/cnpdocumentfieldinterface.cpp	Mon Apr 19 14:40:05 2010 +0300
@@ -0,0 +1,129 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: 
+*
+*/
+
+#include "CNPDocumentFieldInterface.h"
+
+#include <utf.h>
+#include "CNPDocumentFieldInterface.h"
+
+#include "NPUtils.h"
+using namespace nputils; 
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+CNPDocumentFieldInterface::~CNPDocumentFieldInterface()
+    {
+    }
+
+
+void CNPDocumentFieldInterface::InitInterfaceL()
+    {
+    const NPUTF8 *NPDocumentFieldMethodNames[] =
+    	{ 
+        "getName",
+        "getValue"
+    	};
+
+    SetIdentifiersL( NULL, 0,
+    				 NPDocumentFieldMethodNames, sizeof(NPDocumentFieldMethodNames)/sizeof(NPDocumentFieldMethodNames[0]));
+    }
+
+// -----------------------------------------------------------------------------
+
+bool CNPDocumentFieldInterface::InvokeL(NPIdentifier name, NPVariant* args, uint32_t argCount, NPVariant *result)
+    {
+    VOID_TO_NPVARIANT(*result);
+    if ( name == iMethodIdentifiers[0] ) // getName
+    	{
+    	TRAP_IGNORE(
+    		DescriptorToVariantL( Name(), *result);
+    		);
+    	// TODO: Report error
+    	return true;
+    	}
+    else if ( name == iMethodIdentifiers[1] ) // getValue
+    	{
+    	TRAP_IGNORE(
+    		DescriptorToVariantL( Value(), *result);
+    		); 
+    	// TODO: Report error
+    	return true;
+    	}
+    return false;
+    }
+
+// -----------------------------------------------------------------------------
+
+bool CNPDocumentFieldInterface::GetProperty (NPIdentifier name, NPVariant *variant)
+    {
+    // default variant value maps to javascript undefined
+    VOID_TO_NPVARIANT(*variant);
+    return false;
+    }
+
+// -----------------------------------------------------------------------------
+
+bool CNPDocumentFieldInterface::SetPropertyL( NPIdentifier name, NPVariant *variant )
+    {
+    return false;
+    }
+
+// -----------------------------------------------------------------------------
+// NPClass Function
+
+NPObject *NPDocumentFieldAllocate ()
+    {
+    NPDocumentFieldObject *newInstance = (NPDocumentFieldObject *)User::Alloc (sizeof(NPDocumentFieldObject));       
+    return (NPObject *)newInstance;
+    }
+
+void NPDocumentFieldInvalidate ()
+    {
+    }
+
+void NPDocumentFieldDeallocate (NPDocumentFieldObject* obj) 
+    {
+    obj->plugin->Deallocate();
+    User::Free ((void *)obj);
+    }    
+ 
+bool NPDocumentFieldHasMethod(NPDocumentFieldObject* obj, NPIdentifier name)
+    {
+    return obj->plugin->HasMethod(name);
+    }
+
+bool NPDocumentFieldInvokeFunctionL(NPDocumentFieldObject* obj, NPIdentifier name, NPVariant *args, uint32_t argCount, NPVariant *result)
+    {
+    return obj->plugin->InvokeL(name, args, argCount, result);
+    }    
+
+bool NPDocumentFieldHasProperty(NPDocumentFieldObject* obj, NPIdentifier name)
+    {
+    return obj->plugin->HasProperty(name);
+    }    
+    
+bool NPDocumentFieldGetProperty (NPDocumentFieldObject* obj, NPIdentifier name, NPVariant *variant)
+    {
+    return obj->plugin->GetProperty(name,variant);
+    }
+
+void NPDocumentFieldSetProperty (NPDocumentFieldObject* obj, NPIdentifier name, NPVariant *variant)
+    {
+    TRAP_IGNORE(obj->plugin->SetPropertyL(name,variant));
+    }
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/browserplugin/cpixnpplugin/src/cnpsearchdocument.cpp	Mon Apr 19 14:40:05 2010 +0300
@@ -0,0 +1,115 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: 
+*
+*/
+#include "CNPSearchDocument.h"
+
+#include "CNPDocumentFieldInterface.h"
+#include "CNPDocumentField.h"
+#include <CSearchDocument.h>
+
+CNPSearchDocument *CNPSearchDocument::NewL( CSearchDocument* aDocument )
+	{
+	CNPSearchDocument* self = new (ELeave)CNPSearchDocument( aDocument );
+    CleanupStack::PushL(self);
+    self->ConstructL();
+    CleanupStack::Pop(); // self;
+    return self;
+	}
+
+CNPSearchDocument::~CNPSearchDocument()
+	{
+	delete iDocument; 
+	}
+    
+CNPSearchDocument::CNPSearchDocument( CSearchDocument* aDocument )
+:	iDocument( aDocument )
+	{
+	}
+
+void CNPSearchDocument::Deallocate() 
+	{
+	// NP Environment no more refers us directly. Still, there might
+	// references to fields left
+	Release();  
+	}
+
+void CNPSearchDocument::ConstructL()
+	{
+	InitInterfaceL();
+	Retain(); // Add one reference for the references held by NP enviroment
+	}
+
+void CNPSearchDocument::Retain()
+	{
+	iReferences++; 
+	}
+
+void CNPSearchDocument::Release()
+	{
+	if ( --iReferences == 0 ) 
+		{
+		delete this; 
+		}
+	}
+
+NPDocumentFieldObject* CNPSearchDocument::FieldL(const TDesC& aName)
+	{
+	const CDocumentField* field = iDocument->Field( aName );
+	
+	if ( field ) 
+		{
+	    NPDocumentFieldObject *object = 
+	    	( NPDocumentFieldObject * ) NPN_CreateObject( iInstanceHandle, NPDocumentFieldClass );
+	    object->plugin = CNPDocumentField::NewL( *this, *field );
+	    return object; 
+		}
+    
+	return NULL;
+	}
+
+const TDesC& CNPSearchDocument::Id() const
+	{
+	return iDocument->Id(); 
+	}
+	
+const TDesC& CNPSearchDocument::AppClass() const
+	{
+	return iDocument->AppClass(); 
+	}
+
+const TDesC& CNPSearchDocument::Excerpt() const
+	{
+	return iDocument->Excerpt(); 
+	}
+
+TInt CNPSearchDocument::FieldCount() const
+	{
+	return iDocument->FieldCount(); 
+	}
+
+NPDocumentFieldObject* CNPSearchDocument::FieldL( const TInt aIndex )
+	{
+	if ( aIndex >= 0 && aIndex < iDocument->FieldCount() ) 
+		{
+		const CDocumentField& field = iDocument->Field( aIndex );
+		
+	    NPDocumentFieldObject *object = 
+	    	( NPDocumentFieldObject * ) NPN_CreateObject( iInstanceHandle, NPDocumentFieldClass );
+	    object->plugin = CNPDocumentField::NewL( *this, field );
+	    return object; 
+		}
+	return NULL; 
+	}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/browserplugin/cpixnpplugin/src/cnpsearchdocumentinterface.cpp	Mon Apr 19 14:40:05 2010 +0300
@@ -0,0 +1,190 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: 
+*
+*/
+#include "CNPSearchDocumentInterface.h"
+
+#include <utf.h>
+#include "CNPDocumentFieldInterface.h"
+
+#include "NPUtils.h"
+using namespace nputils; 
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+CNPSearchDocumentInterface::~CNPSearchDocumentInterface()
+    {
+    }
+
+
+void CNPSearchDocumentInterface::InitInterfaceL()
+    {
+    const NPUTF8 *NPSearchDocumentMethodNames[] =
+    	{ 
+        "getFieldByName",
+        "getId",
+        "getAppClass",
+        "getExcerpt",
+        "getFieldCount"
+        "getFieldByIndex",
+    	};
+
+    SetIdentifiersL( NULL, 0,
+    				 NPSearchDocumentMethodNames, sizeof(NPSearchDocumentMethodNames)/sizeof(NPSearchDocumentMethodNames[0]));
+    }
+
+// -----------------------------------------------------------------------------
+
+bool CNPSearchDocumentInterface::InvokeL(NPIdentifier name, NPVariant* args, uint32_t argCount, NPVariant *result)
+    {
+    VOID_TO_NPVARIANT(*result);
+    if ( name == iMethodIdentifiers[0] ) // getFieldByName
+    	{
+        if ( argCount >= 1 ) 
+    		{
+    		TRAP_IGNORE( 
+				HBufC16* buf = VariantToHBufC16LC( args[0] );
+				if ( buf ) 
+					{
+					NPDocumentFieldObject* ret = FieldL( *buf );
+					CleanupStack::PopAndDestroy( buf ); 
+					if ( ret != NULL )
+						{
+						OBJECT_TO_NPVARIANT( ( NPObject* ) &ret->object, *result ); 
+						}
+					else 
+						{
+						NULL_TO_NPVARIANT( *result );
+						}
+					}
+				);
+    		// TODO: report err
+			return true; 
+			}
+    	}
+    else if ( name == iMethodIdentifiers[1] ) // getId
+    	{
+    	TRAP_IGNORE(
+    		DescriptorToVariantL( Id(), *result);
+    		);
+		// TODO: report err
+    	return true;
+    	}
+    else if ( name == iMethodIdentifiers[2] ) // getAppClass
+    	{
+    	TRAP_IGNORE(
+    		DescriptorToVariantL( AppClass(), *result);
+			);
+		// TODO: report err
+    	return true;
+    	}
+    else if ( name == iMethodIdentifiers[3] ) // getExcerpt
+    	{
+    	TRAP_IGNORE(
+			DescriptorToVariantL( Excerpt(), *result);
+			);
+		// TODO: report err
+    	return true;
+    	}
+    else if ( name == iMethodIdentifiers[4] ) // getFieldCount
+    	{
+    	INT32_TO_NPVARIANT( FieldCount(), *result);
+    	return true;
+    	}
+    else if ( name == iMethodIdentifiers[5] ) // getFieldByIndex
+    	{
+    	if (argCount >= 1) 
+    		{
+    		TRAP_IGNORE( 
+				TInt index = VariantToInt( args[0] );
+				NPDocumentFieldObject* ret = FieldL( index );
+				if ( ret != NULL ) 
+					{
+					OBJECT_TO_NPVARIANT( ( NPObject* ) &ret->object, *result ); 
+					}
+				else 
+					{
+					NULL_TO_NPVARIANT( *result ); 
+					}
+				); 
+			// TODO: report err
+    		}
+    	return true;
+    	}
+    
+    return false;
+    }
+
+// -----------------------------------------------------------------------------
+
+bool CNPSearchDocumentInterface::GetProperty (NPIdentifier name, NPVariant *variant)
+    {
+    // default variant value maps to javascript undefined
+    VOID_TO_NPVARIANT(*variant);
+    return false;
+    }
+
+// -----------------------------------------------------------------------------
+
+bool CNPSearchDocumentInterface::SetPropertyL( NPIdentifier name, NPVariant *variant )
+    {
+    return false;
+    }
+
+// -----------------------------------------------------------------------------
+// NPClass Function
+
+NPObject *NPSearchDocumentAllocate ()
+    {
+    NPSearchDocumentObject *newInstance = (NPSearchDocumentObject *)User::Alloc (sizeof(NPSearchDocumentObject));       
+    return (NPObject *)newInstance;
+    }
+
+void NPSearchDocumentInvalidate ()
+    {
+    }
+
+void NPSearchDocumentDeallocate (NPSearchDocumentObject* obj) 
+    {
+    obj->plugin->Deallocate();
+    User::Free ((void *)obj);
+    }    
+ 
+bool NPSearchDocumentHasMethod(NPSearchDocumentObject* obj, NPIdentifier name)
+    {
+    return obj->plugin->HasMethod(name);
+    }
+
+bool NPSearchDocumentInvokeFunctionL(NPSearchDocumentObject* obj, NPIdentifier name, NPVariant *args, uint32_t argCount, NPVariant *result)
+    {
+    return obj->plugin->InvokeL(name, args, argCount, result);
+    }    
+
+bool NPSearchDocumentHasProperty(NPSearchDocumentObject* obj, NPIdentifier name)
+    {
+    return obj->plugin->HasProperty(name);
+    }    
+    
+bool NPSearchDocumentGetProperty (NPSearchDocumentObject* obj, NPIdentifier name, NPVariant *variant)
+    {
+    return obj->plugin->GetProperty(name,variant);
+    }
+
+void NPSearchDocumentSetProperty (NPSearchDocumentObject* obj, NPIdentifier name, NPVariant *variant)
+    {
+    TRAP_IGNORE(obj->plugin->SetPropertyL(name,variant));
+    }
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/browserplugin/cpixnpplugin/src/cobjectinterface.cpp	Mon Apr 19 14:40:05 2010 +0300
@@ -0,0 +1,80 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: 
+*
+*/
+
+#include "CObjectInterface.h"
+#include "CCPixNPPluginEcom.h"
+#include <utf.h>
+
+
+// ============================ MEMBER FUNCTIONS ===============================
+CObjectInterface::CObjectInterface()
+	{
+	}
+
+// -----------------------------------------------------------------------------
+
+CObjectInterface::~CObjectInterface()
+	{
+    delete [] iPropertyIdentifiers;
+    delete [] iMethodIdentifiers; 
+	}
+
+void CObjectInterface::Deallocate () 
+    {
+    delete this; 
+    }
+
+// -----------------------------------------------------------------------------
+
+void CObjectInterface::SetIdentifiersL( const NPUTF8** aPropertyNames, TInt aPropertyCount, const NPUTF8** aMethodNames, TInt aMethodCount )
+	{
+	iPropertyCount = aPropertyCount;
+	if (aPropertyNames)
+	    {
+	    iPropertyIdentifiers = new (ELeave) NPIdentifier[iPropertyCount];
+	    NPN_GetStringIdentifiers( aPropertyNames, iPropertyCount, iPropertyIdentifiers );
+	    }
+	iMethodCount = aMethodCount;
+	if (aMethodNames)
+	    {
+	    iMethodIdentifiers = new (ELeave) NPIdentifier[iMethodCount];
+	    NPN_GetStringIdentifiers( aMethodNames, iMethodCount, iMethodIdentifiers );
+	    }
+	}
+
+// -----------------------------------------------------------------------------
+
+bool CObjectInterface::HasProperty( NPIdentifier name )
+    {
+    for ( TInt i= 0; i < iPropertyCount; ++i )
+        {
+        if ( name == iPropertyIdentifiers[i] ) return true;
+        }
+    return false;
+    }
+
+// -----------------------------------------------------------------------------
+
+bool CObjectInterface::HasMethod( NPIdentifier name )
+    {
+    for ( TInt i= 0; i < iMethodCount; ++i )
+        {
+        if ( name == iMethodIdentifiers[i] ) return true;
+        }
+    return false;
+    }
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/browserplugin/cpixnpplugin/src/cpixnpexceptions.cpp	Mon Apr 19 14:40:05 2010 +0300
@@ -0,0 +1,67 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: 
+*
+*/
+#include "CPixNPExceptions.h"
+#include <Common.h>
+
+#include <e32err.h>
+
+const TDesC8* DescribeErrorCode( TInt aErrorCode )
+	{
+	switch ( aErrorCode ) 
+		{
+		// CPix error codes
+		case KErrCannotOpenDatabase:
+			return &KCPixNPCannotOpenDatabaseException(); 
+		case KErrQueryParsingFailed:
+			return &KCPixNPQueryParsingFailedException();
+		case KErrDatabaseQueryFailed:
+			return &KCPixNPDatabaseQueryFailedException();
+		case KErrDocumentAccessFailed:
+			return &KCPixNPDocumentAccessFailedException();
+
+		// Indexing errors (should not be possible to occur)
+		case KErrCannotAddDocument:
+		case KErrCannotUpdateDocument:
+		case KErrDatabaseFlushFailed:
+		case KErrCannotCreateDocument:
+		case KErrCannotCreateDocumentField:
+		case KErrCannotCreateQueryParser:
+		case KErrCannotCreateAnalyzer:
+			return &KCPixNPInternalError();
+			
+		// System wide error codes
+		case KErrNone:
+			return NULL; 
+		case KErrInUse:
+			return &KCPixNPInUseException();
+		case KErrServerTerminated:
+			return &KCPixNPServerTerminated();
+		case KErrServerBusy:
+			return &KCPixNPServerBusy();
+		case KErrCouldNotConnect:
+			return &KCPixNPCouldNotConnect();
+
+		// At least this is our fault
+		case KErrArgument:
+			return &KCPixNPInternalError();
+
+		// Fallback	
+		default: 
+			return &KCPixNPUnknownException(); 
+
+		}
+	}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/browserplugin/cpixnpplugin/src/msvui.cpp	Mon Apr 19 14:40:05 2010 +0300
@@ -0,0 +1,190 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  A helper object to open messagin entries (e.g. emails).
+*
+*/
+
+// INCLUDE FILES
+
+#include "MsvUI.h"
+
+#include <mtclbase.h>
+#include <mtclreg.h>
+#include <mtmuibas.h>
+#include <mtuireg.h>
+
+
+// ============================ MEMBER FUNCTIONS =============================
+
+// ---------------------------------------------------------------------------
+// CMsvUI::CMsvUI
+// C++ constructor can NOT contain any code, that might leave.
+// ---------------------------------------------------------------------------
+//
+CMsvUI::CMsvUI()
+    : CActive( EPriorityStandard )
+    {
+    }
+
+// Destructor.
+CMsvUI::~CMsvUI()
+    {
+    Cancel();
+    if ( iOperation )
+        {
+        iOperation->Cancel();
+        }
+    delete iOperation;
+    iOperation = NULL;
+    delete iUI;
+    iUI = NULL;
+    delete iMtm;
+    iMtm = NULL;
+    delete iUIReg;
+    iUIReg = NULL;
+    delete iMtmReg;
+    iMtmReg = NULL;
+    delete iSession;
+    iSession = NULL;
+    }
+
+// ---------------------------------------------------------------------------
+// CMsvUI::OpenEntryL
+// From MMsvUI. Opens the messaging entry.
+// ---------------------------------------------------------------------------
+//
+void CMsvUI::OpenEntryL( const TUid& aMsvId )
+    {
+    if ( iOperation )
+        {
+        User::Leave( KErrInUse );
+        }
+    
+    if ( ! iSession )
+        {
+        iSession = CMsvSession::OpenSyncL( *this );
+        }
+    
+    if ( ! iMtmReg )
+        {
+        iMtmReg = CClientMtmRegistry::NewL( *iSession );
+        }
+    
+    if ( ! iUIReg )
+        {
+        iUIReg = CMtmUiRegistry::NewL( *iSession );
+        }
+    
+    TMsvId entryId( aMsvId.iUid ) ;
+    TMsvEntry entry;
+    User::LeaveIfError( iSession->GetEntry( entryId, entryId, entry ) );
+    // entryId now contains the service ID of the entry (not used currently)
+    
+    if ( ! iMtm || iMtm->Type() != entry.iMtm )
+        {
+        // MTM changed. UI will most probably change, too.
+        delete iUI;
+        iUI = NULL;
+        delete iMtm;
+        iMtm = NULL;
+        iMtm = iMtmReg->NewMtmL( entry.iMtm );
+        }
+    
+    if ( ! iUI )
+        {
+        iUI = iUIReg->NewMtmUiL( *iMtm );
+        }
+    
+    iMtm->SwitchCurrentEntryL( entry.Id() );
+    iOperation = iUI->OpenL( iStatus );
+    
+    if ( iOperation && iOperation->IsActive() )
+        {
+        if ( ! IsAdded() )
+            {
+            CActiveScheduler::Add(this);
+            }
+        SetActive();
+        }
+    else
+        {
+        Deque();
+        delete iOperation;
+        iOperation = NULL;
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// CMsvUI::RunL
+// From CActive. Handles an active object's request completion event.
+// ---------------------------------------------------------------------------
+//
+void CMsvUI::RunL()
+    {
+    Deque();
+    delete iOperation;
+    iOperation = NULL;
+    }
+
+// ---------------------------------------------------------------------------
+// CMsvUI::DoCancel
+// From CActive. Implements cancellation of an outstanding request.
+// ---------------------------------------------------------------------------
+//
+void CMsvUI::DoCancel()
+    {
+    if ( iOperation )
+        {
+        iOperation->Cancel();
+        }
+    delete iOperation;
+    iOperation = NULL;
+    }
+
+// ---------------------------------------------------------------------------
+// CIDSGenericResultItem::HandleSessionEventL
+// From MMsvSessionObserver. Indicates an event has occurred.
+// ---------------------------------------------------------------------------
+//
+void CMsvUI::HandleSessionEventL( TMsvSessionEvent aEvent,
+                                  TAny* /* aArg1 */,
+                                  TAny* /* aArg2 */,
+                                  TAny* /* aArg3 */ )
+    {
+    switch ( aEvent )
+        {
+        case EMsvCloseSession:
+        case EMsvServerTerminated:
+            {
+            Deque();
+            delete iOperation;
+            iOperation = NULL;
+            delete iUI;
+            iUI = NULL;
+            delete iMtm;
+            iMtm = NULL;
+            delete iUIReg;
+            iUIReg = NULL;
+            delete iMtmReg;
+            iMtmReg = NULL;
+            delete iSession;
+            iSession = NULL;
+            break;
+            }
+        default:
+            break;
+        }
+    }
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/browserplugin/cpixnpplugin/src/nputils.cpp	Mon Apr 19 14:40:05 2010 +0300
@@ -0,0 +1,144 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: 
+*
+*/
+#include "NPUtils.h"
+
+#include <utf.h>
+#include "CCPixNPPluginEcom.h"
+
+namespace nputils {
+
+
+// -----------------------------------------------------------------------------
+
+TInt VariantToInt( NPVariant& v )
+    {
+    if ( NPVARIANT_IS_INT32( v ) ) return NPVARIANT_TO_INT32( v );
+    if ( NPVARIANT_IS_DOUBLE( v ) )
+        {
+        TReal value = NPVARIANT_TO_DOUBLE( v );
+        if (value > 0) return value + 0.5; 
+        return value - 0.5;
+        }
+    if ( NPVARIANT_IS_BOOLEAN( v ) ) return NPVARIANT_TO_BOOLEAN( v );
+    return 0;
+    }
+
+// -----------------------------------------------------------------------------
+
+TUint VariantToUnsigned( NPVariant& v )
+    {
+    TInt value = 0;
+    if ( NPVARIANT_IS_INT32( v ) ) value = NPVARIANT_TO_INT32( v );
+    if ( NPVARIANT_IS_DOUBLE( v ) ) value = NPVARIANT_TO_DOUBLE( v ) + 0.5;
+    if ( NPVARIANT_IS_BOOLEAN( v ) ) value = NPVARIANT_TO_BOOLEAN( v );
+    if (value < 0) return 0;
+    return value;
+    }
+
+// -----------------------------------------------------------------------------
+
+TReal VariantToDouble( NPVariant& v )
+    {
+    if ( NPVARIANT_IS_INT32( v ) ) return NPVARIANT_TO_INT32( v );
+    if ( NPVARIANT_IS_DOUBLE( v ) ) return NPVARIANT_TO_DOUBLE( v );
+    if ( NPVARIANT_IS_BOOLEAN( v ) ) return NPVARIANT_TO_BOOLEAN( v );
+    return 0;
+    }
+
+// -----------------------------------------------------------------------------
+
+void DescriptorToVariantL(const TDesC16& aString, NPVariant& aVariant)
+	{
+    CCPixNPPluginEcom* pluginEcom = (CCPixNPPluginEcom*) Dll::Tls();
+    NPNetscapeFuncs* netscapeFuncs = pluginEcom->Funcs();
+    
+    HBufC8* utf8String = CnvUtfConverter::ConvertFromUnicodeToUtf8L(aString);
+    int length = utf8String->Length();
+        
+    char* newString = (char *)netscapeFuncs->memalloc( length );
+    if (newString)
+    	{
+        Mem::Copy(newString, utf8String->Des().Ptr(), length);
+        STRINGN_TO_NPVARIANT(newString, length, aVariant);
+    	}
+    delete utf8String;
+	}
+
+// -----------------------------------------------------------------------------
+
+void DescriptorToVariant(const TDesC8& aString, NPVariant& aVariant)
+    {
+    CCPixNPPluginEcom* pluginEcom = (CCPixNPPluginEcom*) Dll::Tls();
+    NPNetscapeFuncs* netscapeFuncs = pluginEcom->Funcs();
+    
+    int length = aString.Length();
+    char* newString = (char *)netscapeFuncs->memalloc( length );
+    
+    if (newString)
+        {
+        Mem::Copy(newString, aString.Ptr(), length);
+        STRINGN_TO_NPVARIANT(newString, length, aVariant);
+        }
+    }
+
+// -----------------------------------------------------------------------------
+
+void VariantToDescriptor(NPVariant& aVariant, TDes8& aString)
+    {
+    if ( !NPVARIANT_IS_STRING(aVariant) ) return;
+    NPString string = NPVARIANT_TO_STRING(aVariant);
+    aString.Copy((TUint8*)string.UTF8Characters, string.UTF8Length);
+    }
+
+// -----------------------------------------------------------------------------
+
+void VariantToDescriptorL(NPVariant& aVariant, TDes16& aString)
+    {
+    if ( !NPVARIANT_IS_STRING(aVariant) ) return;
+    NPString string = NPVARIANT_TO_STRING(aVariant);
+    RBuf8 buffer;
+    buffer.CreateL(string.UTF8Length);
+    buffer.Copy((TUint8*)string.UTF8Characters, string.UTF8Length);
+    CnvUtfConverter::ConvertToUnicodeFromUtf8(aString, buffer);
+    buffer.Close();
+    }
+
+HBufC16* VariantToHBufC16LC(NPVariant& aVariant)
+    {
+    if ( !NPVARIANT_IS_STRING(aVariant) ) return NULL; 
+    NPString string = NPVARIANT_TO_STRING(aVariant);
+    RBuf8 buffer;
+    buffer.CreateL(string.UTF8Length);
+    CleanupClosePushL( buffer ); 
+    buffer.Copy((TUint8*)string.UTF8Characters, string.UTF8Length);
+    HBufC16* ret = CnvUtfConverter::ConvertToUnicodeFromUtf8L( buffer );
+    CleanupStack::PopAndDestroy(); // buffer ;
+    CleanupStack::PushL( ret ); 
+    return ret; 
+    }
+
+HBufC8* VariantToHBufC8LC(NPVariant& aVariant)
+    {
+    if ( !NPVARIANT_IS_STRING(aVariant) ) return NULL; 
+    HBufC8* ret = HBufC8::NewLC( NPVARIANT_TO_STRING( aVariant ).UTF8Length );
+    TPtr8 des( ret->Des() );
+    VariantToDescriptor( aVariant, des ); 
+    return ret; 
+    }
+
+}
+
Binary file cenrep/20029ac7.cre has changed
Binary file cenrep/20029ac7.txt has changed
Binary file conf/s60/cpixplugincommon.confml has changed
Binary file conf/s60/cpixplugincommon_20029ac7.crml has changed
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/group/bld.inf	Mon Apr 19 14:40:05 2010 +0300
@@ -0,0 +1,36 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Build information file
+*
+*/
+
+
+#include <platform_paths.hrh>
+
+#include "../harvesterplugins/group/bld.inf"
+//#include "../browserplugin/CPixNPPlugin/group/bld.inf"
+
+PRJ_PLATFORMS
+    DEFAULT
+
+PRJ_EXPORTS
+../rom/cpix_app.iby	CORE_APP_LAYER_IBY_EXPORT_PATH(CPix_App.iby)
+ 
+../cenrep/20029ac7.cre                         /epoc32/winscw/c/private/10202be9/20029ac7.cre
+../cenrep/20029ac7.cre                         /epoc32/data/z/private/10202be9/20029ac7.cre
+
+PRJ_TESTMMPFILES
+
+PRJ_TESTEXPORTS
+//@ToDO IDy creation
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/harvesterplugins/applications/data/2001a9d7.rss	Mon Apr 19 14:40:05 2010 +0300
@@ -0,0 +1,48 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: 
+*
+*/
+// 0x2001A9D7.RSS
+
+#include <registryinfo.rh>
+
+// Declares info for one test implementation
+RESOURCE REGISTRY_INFO theInfo
+        {
+        // UID for the DLL       
+        dll_uid = 0x2001A9D7;
+        // Declare array of interface info
+        interfaces = 
+                {
+                INTERFACE_INFO
+                        {
+                        // UID of interface that is implemented
+                        interface_uid = 0x2001F700; // CPixSearch Plugin Interface UID
+                        implementations = 
+                                {
+                                // Info for CMessagePlugin
+                                IMPLEMENTATION_INFO
+                                        {
+                                        implementation_uid = 0x2001A9D7;
+                                        version_no = 1;
+                                        display_name = "CPix Applications plugin";
+                                        default_data = "CPiX Applications Plugin";
+                                        opaque_data = "";
+                                        }
+                                };
+                        }
+                };
+        }
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/harvesterplugins/applications/group/applicationsplugin.mmp	Mon Apr 19 14:40:05 2010 +0300
@@ -0,0 +1,55 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: 
+*
+*/
+
+CAPABILITY   CAP_GENERAL_DLL -AllFiles -DRM
+#include "../../../harvesterplugins/inc/s60performance.h"
+
+TARGET        cpixapplicationsplugin.dll
+TARGETTYPE    PLUGIN
+
+// ECom Dll recognition UID followed by the unique UID for this dll
+UID           0x10009D8D 0x2001A9D7 
+
+SOURCEPATH    ../src
+SOURCE        applicationsplugin.cpp
+SOURCE        tproxy.cpp
+
+USERINCLUDE   ../inc
+
+APP_LAYER_SYSTEMINCLUDE
+SYSTEMINCLUDE /epoc32/include/ecom
+
+SOURCEPATH    ../data
+start RESOURCE 2001a9d7.rss
+target  cpixapplicationsplugin.rsc
+end
+
+LIBRARY       euser.lib
+LIBRARY       ecom.lib
+LIBRARY       efsrv.lib
+LIBRARY       cntmodel.lib
+LIBRARY       cpixharvesterplugininterface.lib
+LIBRARY       cpixsearchclient.lib
+LIBRARY       apgrfx.lib //for RApaLsSession
+LIBRARY       apparc.lib //for TApaAppInfo 
+LIBRARY       widgetregistryclient.lib
+LIBRARY       centralrepository.lib    //for CRepository
+
+// For logging
+LIBRARY 	  flogger.lib 
+
+EXPORTUNFROZEN
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/harvesterplugins/applications/group/bld.inf	Mon Apr 19 14:40:05 2010 +0300
@@ -0,0 +1,20 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: 
+*
+*/
+
+PRJ_MMPFILES
+applicationsplugin.mmp
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/harvesterplugins/applications/inc/applicationsplugin.h	Mon Apr 19 14:40:05 2010 +0300
@@ -0,0 +1,99 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  
+*
+*/
+
+#ifndef CAPPLICATIONSPLUGIN_H
+#define CAPPLICATIONSPLUGIN_H
+
+#include <e32base.h>
+#include <cindexingplugin.h>
+#include <common.h>
+#include <apgcli.h> //RApaLsSession
+#include <apgnotif.h> //Notification
+#include <widgetregistryclient.h>
+#include "delayedcallback.h"
+
+class CCPixIndexer;
+class CRepository;
+/**
+ * Applications plugin class. Harvests applictions(exes), widgets and java apps.
+ * 
+ * Implements CIndexingPlugin, DelayedCallbackObserver & AppListServerObserver.
+ * 
+ */
+class CApplicationsPlugin : public CIndexingPlugin, public MDelayedCallbackObserver, public MApaAppListServObserver
+{
+public: // Constructors and destructor
+	static CApplicationsPlugin* NewL();
+	static CApplicationsPlugin* NewLC();
+	virtual ~CApplicationsPlugin();
+
+public: // From CIndexingPlugin
+	virtual void StartPluginL();
+	virtual void StartHarvestingL(const TDesC& aQualifiedBaseAppClass);
+	
+public: // From MDelayedCallbackObserver
+    void DelayedCallbackL(TInt aCode);
+    void DelayedError(TInt aErrorCode);
+
+public: // From MApaAppListServObserver
+    void HandleAppListEvent(TInt aEvent);
+
+private: // Constructors
+	CApplicationsPlugin();
+	void ConstructL();
+	
+    /*
+     * @description Add, update or delete application document with info in TApaAppInfo based on aActionType.
+     * @param aAppInfo: got via RApaLsSession::GetNextApp().
+     * @param aActionType: add, update or delete.
+     * @return void
+     * Leaves in case of error.
+     */
+	void CreateApplicationsIndexItemL( TApaAppInfo& aAppInfo, TCPixActionType aActionType );
+	
+    /*
+     * @description Adds necessary document fields to aDocument for widget with Uid aUid.
+     * @param aDocument search document. Not owned.
+     * @param aUid: Uid of the widget.
+     * @return void
+     * Leaves in case of error.
+     */
+	void AddWidgetInfoL( CSearchDocument* aDocument, TUid aUid );
+
+	/*
+	 * @description Returns true if applicaiton with uid aUid hidden, false otherwise
+	 * @param aUid The UID of the application to be checked for hidden property.
+	 * @return ETrue if hidden, EFalse otherwise.    
+	 */
+	TBool IsAppHiddenL(TUid aUid);
+	
+private:
+	CDelayedCallback* iAsynchronizer;  //Owned.	
+    CCPixIndexer* iIndexer; // CPix database. Owned.
+    RApaLsSession iApplicationServerSession; //to get application info.
+    CApaAppListNotifier* iNotifier; //Owned.
+    RWidgetRegistryClientSession iWidgetRegistry; //to get widget info.
+    CRepository* iHiddenApplicationsRepository;
+
+#ifdef __PERFORMANCE_DATA
+    TTime iStartTime;
+    TTime iCompleteTime;
+    void UpdatePerformaceDataL();
+#endif
+};
+
+#endif // CAPPLICATIONSPLUGIN_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/harvesterplugins/applications/src/applicationsplugin.cpp	Mon Apr 19 14:40:05 2010 +0300
@@ -0,0 +1,309 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  
+*
+*/
+
+#include "applicationsplugin.h"
+#include "harvesterserverlogger.h"
+#include <common.h>
+
+#include <ccpixindexer.h>
+#include <csearchdocument.h>
+#include <e32base.h>
+//#include <menu2internalcrkeys.h> //for KCRUidMenu
+#include <widgetpropertyvalue.h> // EBundleDisplayName 
+#include <centralrepository.h>
+
+//Hidden applications
+//#define KHiddenAppRepositoryUid KCRUidMenu
+
+_LIT( KMimeTypeField, CPIX_MIMETYPE_FIELD );
+_LIT( KMimeTypeApplication, APPLICATION_MIMETYPE);
+
+/** Field names */
+_LIT(KApplicationFieldCaption, "Name");
+_LIT(KApplicationFieldUid, "Uid");
+_LIT(KApplicationFieldAbsolutePath, "Path");
+
+// TAppInfo.Name() returns [121345678]. The below constants are used to extract '[' & ']'
+const TInt KUidStartIndex = 1;
+const TInt KUidEndIndex = 8;
+
+/** The delay between harvesting chunks. */
+const TInt KHarvestingDelay = 1000;
+
+// -----------------------------------------------------------------------------
+CApplicationsPlugin* CApplicationsPlugin::NewL()
+	{
+    CPIXLOGSTRING("CApplicationsPlugin::NewL()");
+	CApplicationsPlugin* instance = CApplicationsPlugin::NewLC();
+    CleanupStack::Pop(instance);
+    return instance;
+	}
+
+// -----------------------------------------------------------------------------
+CApplicationsPlugin* CApplicationsPlugin::NewLC()
+	{
+	CApplicationsPlugin* instance = new (ELeave) CApplicationsPlugin();
+    CleanupStack::PushL(instance);
+    instance->ConstructL();
+    return instance;
+	}
+
+// -----------------------------------------------------------------------------
+CApplicationsPlugin::CApplicationsPlugin()
+	{
+	}
+
+// -----------------------------------------------------------------------------
+CApplicationsPlugin::~CApplicationsPlugin()
+	{
+    if (iAsynchronizer)
+        iAsynchronizer->CancelCallback();
+    iApplicationServerSession.Close();
+    iWidgetRegistry.Close();
+    //delete iHiddenApplicationsRepository;
+	delete iAsynchronizer;
+	delete iNotifier;
+	delete iIndexer;
+	}
+
+// -----------------------------------------------------------------------------
+void CApplicationsPlugin::ConstructL()
+	{
+    iAsynchronizer = CDelayedCallback::NewL( CActive::EPriorityIdle );
+    iNotifier = CApaAppListNotifier::NewL( this, CActive::EPriorityHigh );
+    //iHiddenApplicationsRepository = CRepository::NewL( KHiddenAppRepositoryUid );
+    User::LeaveIfError( iWidgetRegistry.Connect() );
+    }
+
+// -----------------------------------------------------------------------------
+void CApplicationsPlugin::StartPluginL()
+	{
+    User::LeaveIfError( iApplicationServerSession.Connect() );
+	User::LeaveIfError(iSearchSession.DefineVolume( _L(APPLICATIONS_QBASEAPPCLASS), KNullDesC ));
+    
+	// Open database
+	iIndexer = CCPixIndexer::NewL(iSearchSession);
+	iIndexer->OpenDatabaseL( _L(APPLICATIONS_QBASEAPPCLASS) );
+
+	// Start harvester for this plugin
+	iObserver->AddHarvestingQueue( this, iIndexer->GetBaseAppClass() );
+	}
+
+// -----------------------------------------------------------------------------
+void CApplicationsPlugin::StartHarvestingL(const TDesC& /* aQualifiedBaseAppClass */)
+    {
+    // Harvest items on each call
+    User::LeaveIfError( iApplicationServerSession.GetAllApps() );//if not KErrNone
+    iIndexer->ResetL();
+    //No need to check IsStatred() since this is the first start. 
+#ifdef __PERFORMANCE_DATA
+    iStartTime.UniversalTime();
+#endif
+   	iAsynchronizer->Start( 0, this, KHarvestingDelay );
+    }
+
+// -----------------------------------------------------------------------------
+void CApplicationsPlugin::AddWidgetInfoL( CSearchDocument* aDocument, TUid aUid )
+    {
+    TBuf<KMaxFileName> temp;//we can reuse this.
+    
+    iWidgetRegistry.GetWidgetPath( aUid, temp );
+    aDocument->AddFieldL(KApplicationFieldAbsolutePath, temp,  CDocumentField::EStoreYes | CDocumentField::EIndexTokenized );
+    CPIXLOGSTRING2("AddApplicationInfo(): PATH = %S ", &temp);
+
+    //GetWidgetPropertyValueL returns CWidgetPropertyValue* which in turn has an operator to convert to TDesC
+    aDocument->AddFieldL(KApplicationFieldCaption, *(iWidgetRegistry.GetWidgetPropertyValueL( aUid, EBundleDisplayName )),  CDocumentField::EStoreYes | CDocumentField::EIndexTokenized );
+
+    iWidgetRegistry.GetWidgetBundleName( aUid, temp );
+    aDocument->AddExcerptL( temp );
+    CPIXLOGSTRING2("AddApplicationInfo(): DisplayName = %S ", &temp );
+    }
+
+// -----------------------------------------------------------------------------
+//This need not be a member function.
+void AddApplicationInfoL( CSearchDocument* aDocument, TApaAppInfo& aAppInfo )
+    {
+    TBuf<KMaxFileName> docidString = aAppInfo.iUid.Name(); //This returns stuff in the form "[UID]". So remove the brackets.
+    docidString = docidString.Mid( KUidStartIndex, KUidEndIndex );
+    
+    aDocument->AddFieldL(KApplicationFieldCaption, aAppInfo.iShortCaption, CDocumentField::EStoreYes | CDocumentField::EIndexTokenized );
+    aDocument->AddFieldL(KApplicationFieldAbsolutePath, aAppInfo.iFullName, CDocumentField::EStoreYes | CDocumentField::EIndexTokenized );
+    aDocument->AddExcerptL( aAppInfo.iCaption );
+    
+    CPIXLOGSTRING3("AddApplicationInfo(): UID = %S, PATH = %S ", &docidString, &aAppInfo.iFullName );
+    CPIXLOGSTRING3("AddApplicationInfo():  Excerpt = %S, Caption = %S ", &aAppInfo.iCaption, &aAppInfo.iShortCaption );
+    }
+
+// -----------------------------------------------------------------------------
+TBool CApplicationsPlugin::IsAppHiddenL(TUid aUid)
+    {
+    //Application should not have 'hidden' capability.
+    TBool ret( EFalse );
+    TApaAppCapabilityBuf cap;
+    CPIXLOGSTRING2("CApplicationsPlugin::IsAppHidden(): UID = %d", aUid );
+    if ( iApplicationServerSession.GetAppCapability(cap, aUid) == KErrNone )
+        {
+        CPIXLOGSTRING("CApplicationsPlugin::IsAppHidden(): GetCapability returned KErrNone");
+        ret = cap().iAppIsHidden;
+        }
+
+    //Application should not be listed hidden in application shell.
+//    TBuf<NCentralRepositoryConstants::KMaxUnicodeStringLength> uidResult;
+//    if( iHiddenApplicationsRepository->Get( KMenuHideApplication, uidResult ) == KErrNone )
+//        {
+//        CPIXLOGSTRING2("CApplicationsPlugin::CreateApplicationsIndexItemL(): Hidden UIDs = %S", &uidResult );
+//        TBufC16<NCentralRepositoryConstants::KMaxUnicodeStringLength> buf(uidResult);
+//        HBufC* uidString = buf.AllocLC();
+//        //If not in the list, it means it is hidden; so dont harvest
+//        if( uidString->FindF( aUid.Name().Mid( KUidStartIndex, KUidEndIndex ) ) != KErrNotFound ) 
+//            {
+//            CleanupStack::PopAndDestroy( uidString );
+//            CPIXLOGSTRING("CApplicationsPlugin::IsAppHidden(): UID in hidden app repository");
+//            return EFalse;
+//            }
+//        CleanupStack::PopAndDestroy( uidString );
+//        }
+
+    CPIXLOGSTRING2("CApplicationsPlugin::IsAppHidden(): %d", &ret);
+    return ret;
+    }
+
+// -----------------------------------------------------------------------------
+void CApplicationsPlugin::CreateApplicationsIndexItemL( TApaAppInfo& aAppInfo, TCPixActionType /*aActionType*/ )
+    {
+    //If application has 'hidden' capability, don't index.
+    if( IsAppHiddenL( aAppInfo.iUid ) ) return;
+    
+    TBuf<KMaxFileName> docidString;
+    docidString.Append( aAppInfo.iUid.Name() ); //This returns descriptor in the form "[UID]". So remove the brackets.
+    docidString = docidString.Mid( KUidStartIndex, KUidEndIndex  );
+    
+    CSearchDocument* document = CSearchDocument::NewLC( docidString, _L(APPLICATIONS_APPCLASS) );
+    document->AddFieldL(KMimeTypeField, KMimeTypeApplication, CDocumentField::EStoreYes | CDocumentField::EIndexUnTokenized );
+    document->AddFieldL(KApplicationFieldUid, docidString, CDocumentField::EStoreYes | CDocumentField::EIndexTokenized );
+
+    if( iWidgetRegistry.IsWidget( aAppInfo.iUid  ) )
+        AddWidgetInfoL( document, aAppInfo.iUid );
+    else
+        AddApplicationInfoL( document, aAppInfo );
+
+    TRAPD( error, iIndexer->AddL( *document ) );
+    if( KErrNone == error )
+        {
+        CPIXLOGSTRING("CApplicationsPlugin::CreateApplicationsIndexItemL(): No Error" );
+        }
+    else 
+        {
+        CPIXLOGSTRING2("CApplicationsPlugin::CreateApplicationsIndexItemL(): Error = %d", error );
+        }
+    CleanupStack::PopAndDestroy( document );
+    }
+
+// -----------------------------------------------------------------------------
+void CApplicationsPlugin::DelayedCallbackL( TInt /*aCode*/ )
+    {
+    TApaAppInfo appInfo;
+    const TInt error = iApplicationServerSession.GetNextApp( appInfo );
+    if(  error == KErrNone )
+        {
+        CreateApplicationsIndexItemL( appInfo, ECPixAddAction );
+        }
+
+    if ( error != RApaLsSession::ENoMoreAppsInList )
+        {
+        //No need to check IsStatred() since control reaches 
+        //here only on asynchornize complete.
+        iAsynchronizer->Start( 0, this, KHarvestingDelay );
+        }
+    else
+        {
+        Flush( *iIndexer );
+#ifdef __PERFORMANCE_DATA
+    UpdatePerformaceDataL();
+#endif
+        iObserver->HarvestingCompleted( this, iIndexer->GetBaseAppClass(), KErrNone );
+        }
+	}
+
+// -----------------------------------------------------------------------------
+void CApplicationsPlugin::DelayedError( TInt aCode )
+    {
+    Flush(*iIndexer);
+    iObserver->HarvestingCompleted(this, iIndexer->GetBaseAppClass(), aCode);
+    }
+   
+// -----------------------------------------------------------------------------
+void CApplicationsPlugin::HandleAppListEvent( TInt aEvent )
+    {
+    CPIXLOGSTRING2("CApplicationsPlugin::HandleAppListEvent: Start with Event = %d", aEvent );
+    if( aEvent == EAppListChanged )
+        {
+        if( iAsynchronizer->CallbackPending() )
+            {
+            iAsynchronizer->CancelCallback(); //first cancel any ongoing harvesting.
+            }
+        TRAP_IGNORE( StartHarvestingL( KNullDesC ) ); //simply reharvest
+        }
+    CPIXLOGSTRING("CApplicationsPlugin::HandleAppListEvent: Exit" );
+    }
+
+#ifdef __PERFORMANCE_DATA
+void CApplicationsPlugin::UpdatePerformaceDataL()
+    {
+    TTime now;
+   
+    
+    iCompleteTime.UniversalTime();
+    TTimeIntervalMicroSeconds timeDiff = iCompleteTime.MicroSecondsFrom(iStartTime);
+    
+    RFs fileSession;
+    RFile perfFile;
+    User::LeaveIfError( fileSession.Connect () );
+    
+    
+    /* Open file if it exists, otherwise create it and write content in it */
+    
+        if(perfFile.Open(fileSession, _L("c:\\data\\ApplicationsPerf.txt"), EFileWrite))
+                   User::LeaveIfError(perfFile.Create (fileSession, _L("c:\\data\\ApplicationsPerf.txt"), EFileWrite));
+    
+    HBufC8 *heap = HBufC8::NewL(100);
+    TPtr8 ptr = heap->Des();
+    now.HomeTime();
+    TBuf<50> timeString;             
+                
+    _LIT(KOwnTimeFormat,"%:0%H%:1%T%:2%S");
+    now.FormatL(timeString,KOwnTimeFormat);
+    ptr.AppendNum(now.DateTime().Day());
+    ptr.Append(_L("/"));
+    ptr.AppendNum(now.DateTime().Month());
+    ptr.Append(_L("/"));
+    ptr.AppendNum(now.DateTime().Year());
+    ptr.Append(_L(":"));
+    ptr.Append(timeString);
+    ptr.Append( _L(": Ani: Time took for Harvesting Applications is : "));
+    ptr.AppendNum(timeDiff.Int64()/1000) ;
+    ptr.Append(_L(" MilliSeonds \n"));
+    TInt myInt = 0;
+    perfFile.Seek(ESeekEnd,myInt);
+    perfFile.Write (ptr);
+    perfFile.Close ();
+    fileSession.Close ();
+    delete heap;
+    }
+#endif
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/harvesterplugins/applications/src/tproxy.cpp	Mon Apr 19 14:40:05 2010 +0300
@@ -0,0 +1,36 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Applications plugin
+*
+*/
+
+#include <e32std.h>
+#include <implementationproxy.h>
+#include <cindexingplugin.h>
+#include "applicationsplugin.h"
+
+
+// Map the interface UIDs to implementation factory functions
+const TImplementationProxy KImplementationTable[] = 
+	{
+	{{0x2001A9D7},( TProxyNewLPtr) CApplicationsPlugin::NewL}		
+	};
+
+// Exported proxy for instantiation method resolution
+EXPORT_C const TImplementationProxy* ImplementationGroupProxy( TInt& aTableCount )
+	{
+	aTableCount = sizeof( KImplementationTable ) / sizeof( TImplementationProxy );
+	return KImplementationTable;
+	}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/harvesterplugins/bookmarks/data/2001a9d3.rss	Mon Apr 19 14:40:05 2010 +0300
@@ -0,0 +1,47 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: 
+*
+*/
+#include <registryinfo.rh>
+
+// Declares info for one test implementation
+RESOURCE REGISTRY_INFO theInfo
+        {
+        // UID for the DLL       
+		// TODO: Rename dll_uid according to your plugin UID
+        dll_uid = 0x2001A9D3;
+        // Declare array of interface info
+        interfaces = 
+                {
+                INTERFACE_INFO
+                        {
+                        // UID of interface that is implemented
+                        interface_uid = 0x2001F700; // CPixSearch Plugin Interface UID
+                        implementations = 
+                                {
+                                // Info for CMessagePlugin
+                                IMPLEMENTATION_INFO
+                                        {
+                                        implementation_uid = 0x2001A9D3;
+                                        version_no = 1;
+                                        display_name = "Bookmars harvester plugin";
+                                        default_data = "Bookmarks";
+                                        opaque_data = "";
+                                        }
+                                };
+                        }
+                };
+        }
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/harvesterplugins/bookmarks/group/bld.inf	Mon Apr 19 14:40:05 2010 +0300
@@ -0,0 +1,20 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: 
+*
+*/
+
+PRJ_MMPFILES
+bookmarksplugin.mmp
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/harvesterplugins/bookmarks/group/bookmarksplugin.mmp	Mon Apr 19 14:40:05 2010 +0300
@@ -0,0 +1,52 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: 
+*
+*/
+
+CAPABILITY   CAP_GENERAL_DLL -AllFiles -DRM
+#include "../../../harvesterplugins/inc/s60performance.h"
+TARGET        cpixbookmarksplugin.dll
+TARGETTYPE    PLUGIN
+
+// ECom Dll recognition UID followed by the unique UID for this dll
+UID 0x10009D8D 0x2001A9D3
+
+SOURCEPATH    ../src
+SOURCE        bookmarksplugin.cpp
+SOURCE        tproxy.cpp
+
+USERINCLUDE   ../inc
+
+APP_LAYER_SYSTEMINCLUDE
+SYSTEMINCLUDE /epoc32/include/ecom
+
+SOURCEPATH    ../data
+start RESOURCE 2001a9d3.rss
+target  cpixbookmarksplugin.rsc
+end
+
+LIBRARY       euser.lib
+LIBRARY       ecom.lib
+LIBRARY       efsrv.lib
+LIBRARY       cntmodel.lib
+LIBRARY       cpixharvesterplugininterface.lib
+LIBRARY       cpixsearchclient.lib
+LIBRARY       favouritesengine.lib
+LIBRARY       inetprotutil.lib //Uri16.h 
+
+// For logging
+LIBRARY 	  flogger.lib 
+
+EXPORTUNFROZEN
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/harvesterplugins/bookmarks/inc/bookmarksplugin.h	Mon Apr 19 14:40:05 2010 +0300
@@ -0,0 +1,119 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Bookmarks harvester plugin header
+*
+*/
+
+#ifndef CBOOKMARKSPLUGIN_H
+#define CBOOKMARKSPLUGIN_H
+
+#include <cindexingplugin.h>
+
+#include <e32base.h>
+#include <favouritessession.h>
+#include <favouritesdb.h>
+#include <favouritesdbobserver.h>
+
+#include "common.h"
+#include "delayedcallback.h"
+
+class CSearchDocument;
+class CCPixIndexer;
+class CActiveFavouritesDbNotifier;
+
+#define KBookmarksDllUid 0x2001A9D3
+
+//Bookmark field name to be stored
+_LIT(KBookMarkFieldName, "Name");
+_LIT(KBookMarkUrl, "Url");
+_LIT(KBookMarkDomain, "Domain");
+
+_LIT(KMimeTypeField, CPIX_MIMETYPE_FIELD);
+_LIT(KMimeTypeBookmark, BOOKMARK_MIMETYPE);
+
+class CBookmarksPlugin : public CIndexingPlugin, public MDelayedCallbackObserver, public MFavouritesDbObserver
+{
+public:
+    // Constructor and Destructors.
+    static CBookmarksPlugin *NewL();
+    static CBookmarksPlugin *NewLC();
+    virtual ~CBookmarksPlugin();
+    
+public:
+    /* 
+     * Prepares the plugin for StartHarvesterL and also  starts
+     * the favourites db observer.  
+     */
+    void StartPluginL();
+    
+    /*
+     * @description Start the harvester.
+     * @param aQualifiedBaseAppClass the base app class. In this case
+     *        use BOOKMARK_QBASEAPPCLASS
+     * @return void
+     * Leaves in case of errors.
+     */
+    void StartHarvestingL(const TDesC& aQualifiedBaseAppClass);
+    
+    //From MFavouritesDbObserver.
+    void HandleFavouritesDbEventL(RDbNotifier::TEvent aEvent);
+    
+public:
+    // From MDelayedCallbackObserver
+    void DelayedCallbackL(TInt aCode);
+    void DelayedError(TInt aErrorCode);
+    
+private:
+    //private constructors.
+    CBookmarksPlugin();
+    void ConstructL();
+    
+    /*
+     * @description Add, update or delete bookmark with UID aBookMarkUid based on aActionType.
+     * @param aBookmarkUid: obtained from the array of UIDs got via GetUids().
+     * @param aActionType: add, update or delete.
+     * @return void
+     * Leaves in case of error.
+     */
+    void CreateBookmarksIndexItemL(TInt aBookMarkUid, TCPixActionType aActionType);
+    
+    /*
+     * @description Helper function to add/update index.
+     * @param aItem Item to be indexed.
+     * @param aDocidStr descriptor version of the bookmarkUid.
+     * @param aActionType add/update actions only.
+     * @return void
+     * Leaves in case of error.
+     * @note: aItem is a reference to a pointer. Ownership remains with the caller.
+     */
+    void DoIndexingL(CFavouritesItem*& aItem, const TDesC& aDocidStr, TCPixActionType& aActionType);
+    
+private:
+    CDelayedCallback *iAsynchronizer; //to schedule the harvesting into chunks. Owned.
+    CCPixIndexer *iIndexer; //Owned
+    RFavouritesSession iFavouritesSession; //Favourites session for use by FavouritesDb.
+    TInt iCurrentIndex; //Index of bookmark in UID array currently being added to index. 
+    TInt iCurrentCount; //Total number of bookmarks currently in the bookmarks DB.
+    RFavouritesDb iFavouritesDb; //THE bookmarks DB.
+    CActiveFavouritesDbNotifier *iFavoritesNotifier; //Active object that notifies commits to favourites DB. Owned.
+    CArrayFix<TInt> *iArrUidsCurrentBookmarkList; //List of UIDs obtained from Favourites DB that will be indexed.Owned.
+
+#ifdef __PERFORMANCE_DATA
+    TTime iStartTime;
+    TTime iCompleteTime;
+    void UpdatePerformaceDataL();
+#endif
+};
+
+#endif // CBOOKMARKSPLUGIN_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/harvesterplugins/bookmarks/src/bookmarksplugin.cpp	Mon Apr 19 14:40:05 2010 +0300
@@ -0,0 +1,373 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Bookmarks harvester plugin implementation
+*
+*/
+
+#include "bookmarksplugin.h"
+
+#include <favouritesitemlist.h>
+#include <activefavouritesdbnotifier.h>
+#include <e32base.h> 
+#include <uri8.h> //For parsing URL names.
+
+#include "harvesterserverlogger.h"
+#include "common.h"
+#include "csearchdocument.h"
+#include "ccpixindexer.h"
+
+/** The milliseconds delay between harvesting chunks. */
+const TInt KHarvestingDelay = 1000;
+/** Number of bookmarks to process in one active scheduler cycle */
+const TInt KBookmarksPerRunL = 1;
+_LIT(KExcerptDelimiter, " ");
+/** Bookmark list size for dynamic array*/
+const TInt KBookmarkListSize = 100;
+
+// -----------------------------------------------------------------------------
+CBookmarksPlugin* CBookmarksPlugin::NewL()
+	{
+	CBookmarksPlugin* instance = CBookmarksPlugin::NewLC();
+    CleanupStack::Pop(instance);
+    return instance;
+	}
+
+// -----------------------------------------------------------------------------
+CBookmarksPlugin* CBookmarksPlugin::NewLC()
+	{
+	CBookmarksPlugin* instance = new (ELeave) CBookmarksPlugin();
+    CleanupStack::PushL(instance);
+    instance->ConstructL();
+    return instance;
+	}
+
+// -----------------------------------------------------------------------------
+CBookmarksPlugin::CBookmarksPlugin()
+	{
+	//No implementation required. 
+	//Necessary things done in ConstructL()
+	}
+
+// -----------------------------------------------------------------------------
+CBookmarksPlugin::~CBookmarksPlugin()
+	{
+	if (iAsynchronizer)
+        iAsynchronizer->CancelCallback();
+	iFavoritesNotifier->Cancel();
+	delete iFavoritesNotifier;
+	delete iAsynchronizer;
+	delete iIndexer;
+	delete iArrUidsCurrentBookmarkList;
+	iFavouritesDb.Close();
+	iFavouritesSession.Close();
+	}
+	
+// -----------------------------------------------------------------------------
+void CBookmarksPlugin::ConstructL()
+	{
+	iArrUidsCurrentBookmarkList = new(ELeave) CArrayFixFlat<TInt>( KBookmarkListSize );
+	User::LeaveIfError( iFavouritesSession.Connect() );
+	User::LeaveIfError( iFavouritesDb.Open( iFavouritesSession, KBrowserBookmarks ) );
+	iFavoritesNotifier = new ( ELeave ) CActiveFavouritesDbNotifier( iFavouritesDb, *this );
+    iAsynchronizer = CDelayedCallback::NewL( CActive::EPriorityIdle );
+	}
+
+// -----------------------------------------------------------------------------
+void CBookmarksPlugin::StartPluginL()
+	{
+    iFavoritesNotifier->Start(); //Start the notifier. Guarenteed to be the first call to Start. So no check for IsActive().
+	// Define this base application class, use default location
+	User::LeaveIfError(iSearchSession.DefineVolume( _L(BOOKMARK_QBASEAPPCLASS), KNullDesC ));
+	// Open database
+	iIndexer = CCPixIndexer::NewL( iSearchSession );
+	iIndexer->OpenDatabaseL( _L(BOOKMARK_QBASEAPPCLASS) ); 
+	// Start harvester for this plugin
+	iObserver->AddHarvestingQueue(this, iIndexer->GetBaseAppClass() );
+	}
+
+// -----------------------------------------------------------------------------
+void CBookmarksPlugin::StartHarvestingL( const TDesC& /*aMedia*/ )
+    {
+    CPIXLOGSTRING("StartHarvestingL: resetting database");
+    iIndexer->ResetL();//reset any indexes if exist already
+    iCurrentIndex = 0; //Initialize to zero as it is started
+    iFavouritesDb.Count( iCurrentCount );
+    CPIXLOGSTRING2("StartHarvestingL::Current count = %d.", iCurrentCount);
+    //Get all the UID list from current database
+    //GetUids() appends items to the list. So, reset it first.
+    //From the documentation of GetUids(): "Existing items remain (new ones appended)"
+    iArrUidsCurrentBookmarkList->Reset();
+    iFavouritesDb.GetUids( *iArrUidsCurrentBookmarkList );
+#ifdef __PERFORMANCE_DATA
+    iStartTime.UniversalTime();
+#endif
+  	iAsynchronizer->Start( 0, this, KHarvestingDelay ); //Guarenteed to be the first call to Start. So no checking for IsActive().
+    }
+
+// -----------------------------------------------------------------------------
+void CBookmarksPlugin::DelayedCallbackL( TInt /*aCode*/ )
+    {
+    // Harvest items on each call
+
+    // Read the next set of bookmark.
+    for( TInt i = 0; i < KBookmarksPerRunL; i++ )
+        {
+        // Exit the loop if no more bookmarks
+        if (iCurrentIndex >= iCurrentCount)
+            break;
+        
+        //Create index item
+        CPIXLOGSTRING3("CBookmarksPlugin::DelayedCallbackL(): Harvesting id=%d, BookmarkUid = %d.", iCurrentIndex, iArrUidsCurrentBookmarkList->At(iCurrentIndex) );
+        //Create new bookmark document and add
+        CreateBookmarksIndexItemL(iArrUidsCurrentBookmarkList->At(iCurrentIndex),ECPixAddAction);
+        iCurrentIndex++;
+        }
+
+    if( iAsynchronizer && (iCurrentIndex < iCurrentCount) )
+        {
+        // Launch the next RunL
+        CPIXLOGSTRING2("CBookmarksPlugin::DelayedCallbackL(): scheduling item count: %d.", iCurrentIndex );
+        iAsynchronizer->Start(0, this, KHarvestingDelay);
+        CPIXLOGSTRING2("CBookmarksPlugin::DelayedCallbackL(): DONE scheduling item count: %d.", iCurrentIndex );
+        }
+    else
+        {
+        // Harvesting was successfully completed
+        Flush(*iIndexer);
+#ifdef __PERFORMANCE_DATA
+    UpdatePerformaceDataL();
+#endif
+        iObserver->HarvestingCompleted(this, iIndexer->GetBaseAppClass(), KErrNone);
+        CPIXLOGSTRING("CBookmarksPlugin::DelayedCallbackL(): Harvesting complete");
+        }
+	}
+
+// -----------------------------------------------------------------------------
+void CBookmarksPlugin::DelayedError( TInt aCode )
+    {
+    Flush(*iIndexer);
+    iObserver->HarvestingCompleted(this, iIndexer->GetBaseAppClass(), aCode);
+	}
+
+// -----------------------------------------------------------------------------
+/**
+ * If input is www2.google.com, this return google.com.
+ * If input is www2.google.com/someting, this returns google.com.
+ *
+ * @param aUrl URL from which to extract domain name.
+ * @param aDomain descriptor pointer in which domain will be returned.
+ *
+ * @note Leaves in case of error with KErrArgument
+ * @example
+ * TPtrC domain;
+ * GetDomainNameLC( myUrl, domain );
+ */
+void GetDomainNameL( const TDesC& aUrl, TPtrC& aDomain )
+    {
+    CPIXLOGSTRING2("CBookmarksPlugin::GetDomainNameL(): URL = %S", &aUrl );
+    //Convert to 8-bit descriptors.
+    HBufC8* url8 = HBufC8::NewLC( aUrl.Length() );
+    url8->Des().Copy( aUrl );
+    
+    TUriParser8  uriParser;
+    User::LeaveIfError( uriParser.Parse( *url8 ) );
+
+    //Get the host name
+    //This returns www.google.com if URL is http://www.google.com/something...
+    const TDesC8& host = uriParser.Extract( EUriHost );
+    if( host.Length() == 0  )
+        {
+        aDomain.Set( aUrl );
+        CleanupStack::PopAndDestroy( url8 );
+        return;
+        }
+    TLex8 lex( host );
+    //Check if starts with www.
+    TChar currentChar = 0;
+    int wwwCount = 0;
+    do{
+        if( ( currentChar = lex.Get() ) != 0 ) wwwCount++;
+    }while( currentChar == TChar('w') || currentChar == TChar('W') );
+    
+    if( currentChar != 0 )
+        {
+        lex.UnGet();
+        wwwCount--;
+        }
+
+    HBufC* domain16 = NULL; 
+    //if www34.google.com, skip anything after www, till '.'
+    if( 3 == wwwCount )
+        {
+        while( lex.Peek() != '.' ) lex.Inc();
+        //Now stopped at .google.com. So remove '.'
+        lex.Inc();
+        //The rest is the domain!
+        const TDesC8& domain = lex.Remainder();
+        if ( domain.Length() == 0 )
+            {
+            User::Leave( KErrArgument );
+            }
+        //Convert to 16-bit descriptors.
+        domain16 = HBufC::NewLC( domain.Length() );
+        domain16->Des().Copy( domain );
+        }
+    else 
+        {
+        domain16 = HBufC::NewLC( host.Length() );
+        domain16->Des().Copy( host );
+        }
+    aDomain.Set( *domain16 );
+    CleanupStack::Pop( domain16 );
+    CleanupStack::PopAndDestroy( url8 );
+    CPIXLOGSTRING2("CBookmarksPlugin::GetDomainNameL(): domain = %S", &aDomain );
+    }
+
+// -----------------------------------------------------------------------------
+void CBookmarksPlugin::DoIndexingL(CFavouritesItem*& aItem, const TDesC& aDocidStr, TCPixActionType& aActionType)
+    {
+    CPIXLOGSTRING("CBookmarksPlugin::DoIndexingL(): Entering");
+    if(aItem->Type() == CFavouritesItem::EItem ) //Store only Items not folders
+        {
+        CPIXLOGSTRING3("CBookmarksPlugin::DoIndexingL(): url = %S ,name = %S", &(aItem->Url()), &(aItem->Name()));
+        CSearchDocument* index_item = CSearchDocument::NewLC(aDocidStr, _L(BOOKMARKAPPCLASS));
+        index_item->AddFieldL(KMimeTypeField, KMimeTypeBookmark, CDocumentField::EStoreYes | CDocumentField::EIndexUnTokenized);
+        if(aItem->Name() != KNullDesC)
+            index_item->AddFieldL(KBookMarkFieldName,aItem->Name(),CDocumentField::EStoreYes | CDocumentField::EIndexTokenized);
+
+        TPtrC domain;
+        if(aItem->Url() != KNullDesC)
+            {
+            index_item->AddFieldL(KBookMarkUrl, aItem->Url(), CDocumentField::EStoreYes | CDocumentField::EIndexTokenized);
+            GetDomainNameL( aItem->Url(), domain );
+            index_item->AddFieldL(KBookMarkDomain, domain , CDocumentField::EStoreYes | CDocumentField::EIndexTokenized);
+            CPIXLOGSTRING2("CBookmarksPlugin::DoIndexingL(): domain = %S", &domain );
+            }
+        //Add Excerpt as it is must have field. What should be excerpt in bookmarks ?
+        HBufC* excerpt = HBufC::NewLC(aItem->Url().Length() + aItem->Name().Length() + 1);
+        TPtr ptr = excerpt->Des();
+        ptr.Append(aItem->Name());
+        ptr.Append(KExcerptDelimiter);
+        ptr.Append(aItem->Url());
+        index_item->AddExcerptL(*excerpt);
+        CleanupStack::PopAndDestroy(excerpt);
+
+        // Send for indexing
+        TRAPD(err, iIndexer->AddL(*index_item));
+        if (err == KErrNone)
+            {
+                CPIXLOGSTRING("CBookmarksPlugin::DoIndexingL(): Added.");
+                }
+            else
+                {
+                CPIXLOGSTRING2("CBookmarksPlugin::DoIndexingL(): Error %d in adding.", err);
+                }           
+        CPIXLOGSTRING("CBookmarksPlugin::DoIndexingL(): Logic complete");
+        CleanupStack::PopAndDestroy( index_item );
+        CPIXLOGSTRING("CBookmarksPlugin::DoIndexingL(): Pop complete complete");
+        }
+    CPIXLOGSTRING("CBookmarksPlugin::DoIndexingL(): Returning");
+    }
+
+// -----------------------------------------------------------------------------
+void CBookmarksPlugin::CreateBookmarksIndexItemL(TInt aBookMarkUid, TCPixActionType aActionType)
+    {
+    //@sai: CTC: Will never be null in normal usecase. Needs to be present for UTs.
+    if( !iIndexer )
+        return;
+    CPIXLOGSTRING2("CBookmarksPlugin::CreateBookmarkIndexItemL(): aBookMarkUid = %d ", aBookMarkUid );
+    // creating CSearchDocument object with unique ID for this application
+    TBuf<20> docid_str;
+    docid_str.AppendNum(aBookMarkUid);
+    //Add or update actions.
+    CFavouritesItem* item = CFavouritesItem::NewLC();
+    TInt err = iFavouritesDb.Get(aBookMarkUid,*item);
+    CPIXLOGSTRING2("CBookmarksPlugin::CreateBookmarkIndexItemL(): DB Get error = %d ", err );
+    //@sai: CTC: did not ever get 'false' for this check. Since this is a private function,
+    // we cannot UT this with an invalid bookmarkUid.
+    if(KErrNone != err)
+        {
+        CleanupStack::PopAndDestroy(item);
+        return;
+        }
+    CPIXLOGSTRING2("CBookmarksPlugin::CreateBookmarkIndexItemL(): item->Type() = %d ", item->Type() );
+    DoIndexingL(item, docid_str, aActionType); //add to / update index
+    CleanupStack::PopAndDestroy(item);
+    }
+
+// -----------------------------------------------------------------------------
+void CBookmarksPlugin::HandleFavouritesDbEventL( RDbNotifier::TEvent aEvent )
+    {
+    //Since we cannot efficiently identify updated item, it makes most
+    //sense to simply re-index the bookmarks - their numbers are not 
+    //prohibitively large.
+    //@sai:CTC: the DB does not seem to be sending any other event.
+    if( RDbNotifier::ECommit == aEvent )
+        {
+        if( iAsynchronizer->CallbackPending() )
+            {
+            CPIXLOGSTRING("HandleFavouritesDbEventL: Cancelling callback");
+            iAsynchronizer->CancelCallback(); //first cancel any ongoing harvesting.
+            }
+        CPIXLOGSTRING("HandleFavouritesDbEventL: calling StartHarvestingL");
+        StartHarvestingL( KNullDesC );
+        }
+    }
+	
+// -----------------------------------------------------------------------------
+#ifdef __PERFORMANCE_DATA
+void  CBookmarksPlugin::UpdatePerformaceDataL()
+    {
+    TTime now;
+   
+    
+    iCompleteTime.UniversalTime();
+    TTimeIntervalMicroSeconds timeDiff = iCompleteTime.MicroSecondsFrom(iStartTime);
+    
+    RFs fileSession;
+    RFile perfFile;
+    User::LeaveIfError( fileSession.Connect () );
+    
+    
+    /* Open file if it exists, otherwise create it and write content in it */
+    
+        if(perfFile.Open(fileSession, _L("c:\\data\\BookmarksPerf.txt"), EFileWrite))
+                   User::LeaveIfError(perfFile.Create (fileSession, _L("c:\\data\\BookmarksPerf.txt"), EFileWrite));
+    
+    HBufC8 *heap = HBufC8::NewL(100);
+    TPtr8 ptr = heap->Des();
+    now.HomeTime();
+    TBuf<50> timeString;             
+                
+    _LIT(KOwnTimeFormat,"%:0%H%:1%T%:2%S");
+    now.FormatL(timeString,KOwnTimeFormat);
+    ptr.AppendNum(now.DateTime().Day());
+    ptr.Append(_L("/"));
+    ptr.AppendNum(now.DateTime().Month());
+    ptr.Append(_L("/"));
+    ptr.AppendNum(now.DateTime().Year());
+    ptr.Append(_L(":"));
+    ptr.Append(timeString);
+    ptr.Append( _L(":Ani: Time took for Harvesting Bookmarks is : "));
+    ptr.AppendNum(timeDiff.Int64()/1000) ;
+    ptr.Append(_L(" MilliSeonds \n"));
+    TInt myInt = 0;
+    perfFile.Seek(ESeekEnd,myInt);
+    perfFile.Write (ptr);
+    perfFile.Close ();
+    fileSession.Close ();
+    delete heap;
+    }
+#endif
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/harvesterplugins/bookmarks/src/tproxy.cpp	Mon Apr 19 14:40:05 2010 +0300
@@ -0,0 +1,36 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Message plugin
+*
+*/
+
+#include <e32std.h>
+#include <implementationproxy.h>
+#include <cindexingplugin.h>
+#include "bookmarksplugin.h"
+
+
+// Map the interface UIDs to implementation factory functions
+const TImplementationProxy KImplementationTable[] = 
+	{
+	{{KBookmarksDllUid},( TProxyNewLPtr) CBookmarksPlugin::NewL}		
+	};
+
+// Exported proxy for instantiation method resolution
+EXPORT_C const TImplementationProxy* ImplementationGroupProxy( TInt& aTableCount )
+	{
+	aTableCount = sizeof( KImplementationTable ) / sizeof( TImplementationProxy );
+	return KImplementationTable;
+	}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/harvesterplugins/calendar/data/2001f704.rss	Mon Apr 19 14:40:05 2010 +0300
@@ -0,0 +1,48 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: 
+*
+*/
+// 0x2001F702.RSS
+
+#include <registryinfo.rh>
+
+// Declares info for one test implementation
+RESOURCE REGISTRY_INFO theInfo
+        {
+        // UID for the DLL       
+        dll_uid = 0x2001F704;
+        // Declare array of interface info
+        interfaces = 
+                {
+                INTERFACE_INFO
+                        {
+                        // UID of interface that is implemented
+                        interface_uid = 0x2001F700; // CPixSearch Plugin Interface UID
+                        implementations = 
+                                {
+                                // Info for CMessagePlugin
+                                IMPLEMENTATION_INFO
+                                        {
+                                        implementation_uid = 0x2001F704;
+                                        version_no = 1;
+                                        display_name = "CPix Search Calendar plugin";
+                                        default_data = "Calendar";
+                                        opaque_data = "";
+                                        }
+                                };
+                        }
+                };
+        }
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/harvesterplugins/calendar/group/bld.inf	Mon Apr 19 14:40:05 2010 +0300
@@ -0,0 +1,20 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: 
+*
+*/
+
+PRJ_MMPFILES
+calendarplugin.mmp
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/harvesterplugins/calendar/group/calendarplugin.mmp	Mon Apr 19 14:40:05 2010 +0300
@@ -0,0 +1,56 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: 
+*
+*/
+
+TARGET        cpixcalendarplugin.dll
+TARGETTYPE    PLUGIN
+ 
+#include          <platform_paths.hrh>
+CAPABILITY   CAP_GENERAL_DLL -AllFiles -DRM
+#include "../../../harvesterplugins/inc/s60performance.h"
+// ECom Dll recognition UID followed by the unique UID for this dll
+UID           0x10009D8D 0x2001F704 
+
+SOURCEPATH    ../src
+SOURCE        ccalendarplugin.cpp
+SOURCE        tproxy.cpp
+
+USERINCLUDE   ../inc
+
+APP_LAYER_SYSTEMINCLUDE
+SYSTEMINCLUDE /epoc32/include/ecom
+// CleanupResetAndDestroyPushL
+SYSTEMINCLUDE /epoc32/include/mmf/common
+
+SOURCEPATH    ../data
+start RESOURCE 2001f704.rss
+target  cpixcalendarplugin.rsc
+end
+
+LIBRARY       euser.lib
+LIBRARY       ecom.lib
+LIBRARY       efsrv.lib
+LIBRARY       calinterimapi.lib
+LIBRARY       cpixharvesterplugininterface.lib
+LIBRARY       cpixsearchclient.lib
+
+
+// For logging
+LIBRARY 	  flogger.lib 
+
+EXPORTUNFROZEN
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/harvesterplugins/calendar/inc/ccalendarplugin.h	Mon Apr 19 14:40:05 2010 +0300
@@ -0,0 +1,131 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: 
+ *
+*/
+
+#ifndef CCALENDARPLUGIN_H
+#define CCALENDARPLUGIN_H
+
+#include <e32base.h>
+#include <cindexingplugin.h>
+#include <calprogresscallback.h>
+#include <calchangecallback.h>
+#include <calcommon.h> // TCalLocalUid
+
+#include <common.h>
+#include "delayedcallback.h"
+
+// FORWARD DECLARATIONS
+class CCalSession;
+class CCalIter;
+class CCalEntryView;
+class CCPixIndexer;
+
+
+/** Field names */
+_LIT(KCalendarSummaryField, "Summary");
+_LIT(KCalendarDescriptionField, "Description");
+_LIT(KCalendarLocationField, "Location");
+_LIT(KCalendarStartTimeField, "StartTime");
+_LIT(KCalendarEndTimeField, "EndTime");
+_LIT(KCalendarAttendeesField, "Attendees");
+
+class CCalendarPlugin : public CIndexingPlugin, public MDelayedCallbackObserver, public MCalProgressCallBack, public MCalChangeCallBack2
+{
+public: // Constructors and destructor
+	
+	static CCalendarPlugin* NewL();
+	static CCalendarPlugin* NewLC();
+	virtual ~CCalendarPlugin();
+
+public: // From CIndexingPlugin
+	void StartPluginL();
+	void StartHarvestingL(const TDesC& aQualifiedBaseAppClass);
+	
+public: // From MCalProgressCallBack
+
+	/** Progress callback.
+	This calls the observing class with the percentage complete of the current operation.
+	@param aPercentageCompleted The percentage complete. */
+	void Progress(TInt aPercentageCompleted);
+	
+	/** Progress callback.
+	This calls the observing class when the current operation is finished.
+	@param aError The error if the operation failed, or KErrNone if successful. */
+	void Completed(TInt aError);
+	
+	/** Asks the observing class whether progress callbacks are required.
+	@return If the observing class returns EFalse, then the Progress() function will not be called. */
+	TBool NotifyProgress();
+	
+public:	// From MCalChangeCallBack2
+	
+	void CalChangeNotification( RArray< TCalChangeEntry >& aChangeItems );	
+	
+public: // From MDelayedCallbackObserver
+
+    void DelayedCallbackL(TInt aCode);
+    void DelayedError(TInt aError);
+    
+private: // New functions
+	
+	void HandleChangedEntryL(const TCalChangeEntry& changedEntry);
+	
+	void CreateEntryL( const TCalLocalUid& aLocalUid, TCPixActionType aActionType );	
+
+private: // Constructors
+	
+	/**
+	 * Default C++ constructor.
+	 */
+	CCalendarPlugin();
+	
+	/**
+	 * Symbian 2nd phase constructor.
+	 */
+	void ConstructL();
+
+private:
+	
+	/** The asynchronizer */
+	CDelayedCallback* iAsynchronizer;	
+	
+	// CPix database 
+    CCPixIndexer* iIndexer;
+    
+	/** Calendar session */
+	CCalSession* iSession;
+	
+	/** Calendar iterator */
+	CCalIter* iCalIterator;
+	
+	/** Calendar entry view */
+	CCalEntryView* iEntryView;
+	
+	/** Are we positioned at first entry? */
+	TBool iFirstEntry;
+	
+	// Start harvesting
+	TBool iStartHarvesting;    
+
+#ifdef __PERFORMANCE_DATA
+    TTime iStartTime;
+    TTime iCompleteTime;
+    void UpdatePerformaceDataL();
+    void UpdatePerformaceDataL(TCPixActionType);
+#endif
+};
+
+#endif // CCALENDARPLUGIN_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/harvesterplugins/calendar/src/ccalendarplugin.cpp	Mon Apr 19 14:40:05 2010 +0300
@@ -0,0 +1,538 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: 
+ *
+*/
+
+#include "ccalendarplugin.h"
+#include "harvesterserverlogger.h"
+#include <common.h>
+#include <csearchdocument.h>
+
+#include <ccpixindexer.h>
+#include <e32base.h> 
+#include <calsession.h>
+#include <calentry.h>
+#include <caliterator.h>
+#include <calentryview.h>
+#include <mmfcontrollerpluginresolver.h> // CleanupResetAndDestroyPushL
+
+_LIT(KMimeTypeField, CPIX_MIMETYPE_FIELD);
+_LIT(KMimeTypeCalendar, CALENDAR_MIMETYPE);
+
+_LIT(KExcerptDelimiter, " ");
+
+/** The delay between harvesting chunks. */
+const TInt KHarvestingDelay = 2000;
+
+_LIT(KCalendarTimeFormat,"%F%/0%Y%M%D%H%T"); // Locale independent YYYYMMDDHHSS
+
+// ---------------------------------------------------------------------------
+// CMessagePlugin::NewL
+// ---------------------------------------------------------------------------
+//  
+CCalendarPlugin* CCalendarPlugin::NewL()
+	{
+	CCalendarPlugin* instance = CCalendarPlugin::NewLC();
+    CleanupStack::Pop(instance);
+    return instance;
+	}
+
+// ---------------------------------------------------------------------------
+// CCalendarPlugin::NewLC
+// ---------------------------------------------------------------------------
+//  
+CCalendarPlugin* CCalendarPlugin::NewLC()
+	{
+	CCalendarPlugin* instance = new (ELeave) CCalendarPlugin();
+    CleanupStack::PushL(instance);
+    instance->ConstructL();
+    return instance;
+	}
+
+// ---------------------------------------------------------------------------
+// CCalendarPlugin::CCalendarPlugin
+// ---------------------------------------------------------------------------
+//  
+CCalendarPlugin::CCalendarPlugin()
+	{
+	}
+
+// ---------------------------------------------------------------------------
+// CCalendarPlugin::~CCalendarPlugin
+// ---------------------------------------------------------------------------
+//  
+CCalendarPlugin::~CCalendarPlugin()
+	{
+    if (iAsynchronizer)
+        iAsynchronizer->CancelCallback();
+	delete iAsynchronizer;
+	delete iIndexer;
+
+	delete iEntryView;
+	delete iCalIterator;
+	if( iSession )
+		{
+		iSession->StopChangeNotification();
+		}
+	delete iSession;
+	}
+	
+// ---------------------------------------------------------------------------
+// CCalendarPlugin::ConstructL
+// ---------------------------------------------------------------------------
+//  
+void CCalendarPlugin::ConstructL()
+	{
+	iAsynchronizer = CDelayedCallback::NewL( CActive::EPriorityIdle );
+	iSession = CCalSession::NewL();	
+	TRAPD ( err , iSession->OpenL( iSession->DefaultFileNameL() ) );
+	if ( err == KErrNotFound)
+	    {
+	    iSession->CreateCalFileL( iSession->DefaultFileNameL() );
+	    iSession->OpenL( iSession->DefaultFileNameL() );
+	    }
+	iCalIterator = CCalIter::NewL( *iSession );
+	iEntryView = CCalEntryView::NewL( *iSession, *this );
+	}
+
+// ---------------------------------------------------------------------------
+// CCalendarPlugin::StartPluginL
+// ---------------------------------------------------------------------------
+//  
+void CCalendarPlugin::StartPluginL()
+	{
+	// Define this base application class, use default location
+	User::LeaveIfError(iSearchSession.DefineVolume( _L(CALENDAR_QBASEAPPCLASS), KNullDesC ));
+
+	// Open the database
+	iIndexer = CCPixIndexer::NewL(iSearchSession);
+	iIndexer->OpenDatabaseL( _L(CALENDAR_QBASEAPPCLASS) ); 
+
+	// Start harvester for this plugin
+	iObserver->AddHarvestingQueue(this, iIndexer->GetBaseAppClass());
+	
+	// Start monitoring calendar events
+	TTime startTime( TDateTime( 1980, EJanuary, 0, 0, 0, 0, 0 ) );
+	TTime endTime( startTime + TTimeIntervalYears( 40 ) );
+	TCalTime startTimeCal;
+	TCalTime endTimeCal;
+	startTimeCal.SetTimeUtcL( startTime );
+	endTimeCal.SetTimeUtcL( endTime );
+	CCalChangeNotificationFilter* filter = CCalChangeNotificationFilter::NewL( MCalChangeCallBack2::EChangeEntryAll, ETrue, CalCommon::TCalTimeRange( startTimeCal, endTimeCal ) );
+	iSession->StartChangeNotification( *this, *filter );
+	delete filter;
+	}	
+
+// ---------------------------------------------------------------------------
+// CCalendarPlugin::StartHarvestingL
+// ---------------------------------------------------------------------------
+//  
+void CCalendarPlugin::StartHarvestingL(const TDesC& /*aQualifiedBaseAppClass*/)
+    {
+    iIndexer->ResetL();
+    iStartHarvesting = ETrue;
+#ifdef __PERFORMANCE_DATA
+    iStartTime.UniversalTime();
+#endif  
+    if (iFirstEntry)
+        {
+        iAsynchronizer->Start( 0, this, KHarvestingDelay );
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CCalendarPlugin::Progress
+// -----------------------------------------------------------------------------
+//
+void CCalendarPlugin::Progress( TInt /*aPercentageCompleted*/ )
+	{
+	// No implementation needed
+	}
+
+// -----------------------------------------------------------------------------
+// CCalendarPlugin::Completed
+// -----------------------------------------------------------------------------
+//
+void CCalendarPlugin::Completed( TInt aError )
+	{
+	// No error code and harvesting is needed star harvesting.
+	iFirstEntry = ETrue;
+	if (aError == KErrNone && iStartHarvesting)
+		{
+		// Calendar entry view constructed successfully, start harvesting
+		iAsynchronizer->Start( 0, this, KHarvestingDelay );
+		}
+	}
+
+// -----------------------------------------------------------------------------
+// CCalendarPlugin::NotifyProgress
+// -----------------------------------------------------------------------------
+//
+TBool CCalendarPlugin::NotifyProgress()
+	{
+	return EFalse;
+	}
+
+// -----------------------------------------------------------------------------
+// CContactsPlugin::DelayedCallbackL
+// -----------------------------------------------------------------------------
+//
+void CCalendarPlugin::DelayedCallbackL( TInt /*aCode*/ )
+    {
+    // Harvest items on each call
+	TPtrC8 uid( KNullDesC8 );
+
+	if( iFirstEntry )
+		{
+		uid.Set( iCalIterator->FirstL() );
+		iFirstEntry = EFalse;
+		}
+	else
+		{
+		uid.Set( iCalIterator->NextL() );
+		}
+
+	if( uid != KNullDesC8 )
+		{
+		RPointerArray<CCalEntry> entryArray;
+		CleanupResetAndDestroyPushL(entryArray);
+		iEntryView->FetchL( uid, entryArray );
+		// Handle only the first (i.e. parent entry)
+		if( entryArray.Count() > 0 )
+			{
+			CCalEntry* entry = (CCalEntry*)entryArray[ 0 ];
+			CPIXLOGSTRING2("CCalendarPlugin::DelayedCallbackL(): Harvesting id=%d.", entry->LocalUidL());
+			CreateEntryL( entry->LocalUidL(), ECPixAddAction );
+			}
+		CleanupStack::PopAndDestroy(&entryArray);
+
+		// Request next entry.
+		iAsynchronizer->Start( 0, this, KHarvestingDelay );
+		}
+	else
+		{
+		// Harvesting was successfully completed
+		iFirstEntry = ETrue; // Make sure we can harvest next time as well...
+		Flush(*iIndexer);
+#ifdef __PERFORMANCE_DATA
+    UpdatePerformaceDataL();
+#endif
+		iObserver->HarvestingCompleted(this, iIndexer->GetBaseAppClass(), KErrNone);		
+		}
+	}
+
+// ---------------------------------------------------------------------------
+// CCalendarPlugin::DelayedError
+// ---------------------------------------------------------------------------
+//  
+void CCalendarPlugin::DelayedError(TInt aError)
+	{
+	// Harvesting was completed
+	iFirstEntry = ETrue; // Make sure we can harvest next time as well...
+	Flush(*iIndexer);
+	iObserver->HarvestingCompleted(this, iIndexer->GetBaseAppClass(), aError);
+	}
+
+// ---------------------------------------------------------------------------
+// CCalendarPlugin::CalChangeNotification
+// ---------------------------------------------------------------------------
+//  
+void CCalendarPlugin::CalChangeNotification( RArray< TCalChangeEntry >& aChangeItems )
+	{
+	const TInt count(aChangeItems.Count());
+	CPIXLOGSTRING2("CCalendarPlugin::CalChangeNotification(): changed item count =%d.", count);
+	for( TInt i = 0; i < count; ++i )
+		{
+		TCalChangeEntry changedEntry = aChangeItems[ i ];
+		TRAP_IGNORE(HandleChangedEntryL(changedEntry));
+		}
+	}
+
+// ---------------------------------------------------------------------------
+// CCalendarPlugin::HandleChangedEntryL
+// ---------------------------------------------------------------------------
+//  
+void CCalendarPlugin::HandleChangedEntryL(const TCalChangeEntry& changedEntry)
+	{
+	switch( changedEntry.iChangeType )
+		{		
+		case EChangeAdd:
+			{
+			CPIXLOGSTRING2("CCalendarPlugin::HandleChangedEntryL(): Monitored add id=%d.", changedEntry.iEntryId);
+#ifdef __PERFORMANCE_DATA
+            iStartTime.UniversalTime();
+			CreateEntryL( changedEntry.iEntryId, ECPixAddAction );
+			UpdatePerformaceDataL(ECPixAddAction);
+#else
+			CreateEntryL( changedEntry.iEntryId, ECPixAddAction );
+#endif
+			break;
+			}
+
+		case EChangeDelete:
+			{	
+			CPIXLOGSTRING2("CCalendarPlugin::HandleChangedEntryL(): Monitored delete id=%d.", changedEntry.iEntryId);
+#ifdef __PERFORMANCE_DATA
+            iStartTime.UniversalTime();
+			CreateEntryL( changedEntry.iEntryId, ECPixAddAction );
+			UpdatePerformaceDataL(ECPixAddAction);
+#else
+			CreateEntryL( changedEntry.iEntryId, ECPixRemoveAction );
+#endif
+			break;
+			}
+
+		case EChangeModify:
+			{
+			CPIXLOGSTRING2("CCalendarPlugin::HandleChangedEntryL(): Monitored update id=%d.", changedEntry.iEntryId);
+#ifdef __PERFORMANCE_DATA
+            iStartTime.UniversalTime(); 
+			CreateEntryL( changedEntry.iEntryId, ECPixUpdateAction );
+			UpdatePerformaceDataL(ECPixUpdateAction);
+#else
+			CreateEntryL( changedEntry.iEntryId, ECPixUpdateAction );
+#endif
+			break;
+			}
+			
+		/* TCalChangeEntry documentation:
+			If iChangeType is EChangeUndefined or EChangeOverflowError, iEntryId and
+			iEntryType are undefined and should not be used by clients.
+		 */
+		case EChangeUndefined:
+			{
+			CPIXLOGSTRING("CCalendarPlugin::HandleChangedEntryL(): EChangeUndefined.");
+			// This event could be related to synchronization.
+			// Mark harvesting as cancelled.
+			// Remove it from the harvesting queue to cause it to enter 
+			// EHarvesterStatusHibernate state.
+			// Now add it to the harvesting queue and force a reharvest.
+
+			iFirstEntry = ETrue; // Make sure we can harvest next time as well...
+			Flush(*iIndexer);
+			iObserver->HarvestingCompleted(this, iIndexer->GetBaseAppClass(), KErrCancel);
+			iObserver->RemoveHarvestingQueue(this, iIndexer->GetBaseAppClass());
+			iObserver->AddHarvestingQueue(this, iIndexer->GetBaseAppClass(), ETrue);
+			break;
+			}
+		default:
+			// Ignore other events
+			break;
+		}	
+	}
+	
+// ---------------------------------------------------------------------------
+// CCalendarPlugin::CreateEntryL
+// ---------------------------------------------------------------------------
+//  
+void CCalendarPlugin::CreateEntryL( const TCalLocalUid& aLocalUid, TCPixActionType aActionType )
+	{
+	if (!iIndexer)
+    	return;
+
+	CPIXLOGSTRING2("CCalendarPlugin::CreateEntryL():  Uid = %d.", aLocalUid);
+	
+	// creating CSearchDocument object with unique ID for this application
+	TBuf<20> docid_str;
+	docid_str.AppendNum(aLocalUid);
+	
+	if (aActionType == ECPixAddAction || aActionType == ECPixUpdateAction)
+		{
+		CSearchDocument* index_item = CSearchDocument::NewLC(docid_str, _L(CALENDARAPPCLASS)); 
+		
+		// Return the entry that has been fetched, this will be NULL if there are 
+		// no entries with the cal unique id
+		CCalEntry* entry = iEntryView->FetchL(aLocalUid);
+		// TODO leave if entry is NULL
+		CleanupStack::PushL(entry);
+		// TODO Uncomment below portion of code when the latest Organiser code in MCL
+		if( CCalEntry::ENote == entry->EntryTypeL() )
+		    {
+            CleanupStack::PopAndDestroy(entry);
+            CleanupStack::PopAndDestroy(index_item);
+            CPIXLOGSTRING("CCalendarPlugin::CreateEntryL(): Donot harvest Note item.");
+            return;
+		    }
+
+		// Add fields
+		index_item->AddFieldL(KCalendarSummaryField, entry->SummaryL());
+		index_item->AddFieldL(KCalendarDescriptionField, entry->DescriptionL());
+		index_item->AddFieldL(KCalendarLocationField, entry->LocationL());
+
+		TBuf<30> dateString;
+
+		TTime startTime = entry->StartTimeL().TimeUtcL();
+		startTime.FormatL(dateString, KCalendarTimeFormat);
+		index_item->AddFieldL(KCalendarStartTimeField, dateString, CDocumentField::EStoreYes | CDocumentField::EIndexUnTokenized);
+
+		TTime endTime = entry->EndTimeL().TimeUtcL();
+		endTime.FormatL(dateString, KCalendarTimeFormat);
+		index_item->AddFieldL(KCalendarEndTimeField, dateString, CDocumentField::EStoreYes | CDocumentField::EIndexUnTokenized);
+
+		index_item->AddFieldL(KMimeTypeField, KMimeTypeCalendar, CDocumentField::EStoreYes | CDocumentField::EIndexUnTokenized);
+
+    	TInt excerptLength = 3 + entry->SummaryL().Length() + entry->DescriptionL().Length() + entry->LocationL().Length();
+		HBufC* excerpt = HBufC::NewLC(excerptLength);
+		TPtr excerptDes = excerpt->Des();
+		excerptDes.Copy(entry->SummaryL());
+		excerptDes.Append(KExcerptDelimiter);
+		excerptDes.Append(entry->DescriptionL());
+		excerptDes.Append(KExcerptDelimiter);
+		excerptDes.Append(entry->LocationL());
+
+        index_item->AddExcerptL(*excerpt);
+        CleanupStack::PopAndDestroy(excerpt);
+        CleanupStack::PopAndDestroy(entry);
+
+		/*
+		RPointerArray<CCalAttendee>& attendees = iEntry.AttendeesL();
+		for( TInt i = 0; i < attendees.Count(); i++ )
+			{
+			CCalAttendee* attendee = (CCalAttendee*)attendees[ i ];
+			TInt err = KErrNone;
+		    TRAP( err, AddContent( CIndexContent::NewL( attendee->CommonName(), ECalendarAttendee ) ) );
+			}
+		attendees.ResetAndDestroy();
+		*/
+		
+		// Send for indexing
+		if (aActionType == ECPixAddAction)
+			{
+			TRAPD(err, iIndexer->AddL(*index_item));
+			if (err == KErrNone)
+				{
+				CPIXLOGSTRING("CCalendarPlugin::CreateEntryL(): Added.");
+				}
+			else
+				{
+				CPIXLOGSTRING2("CCalendarPlugin::CreateEntryL(): Error %d in adding.", err);
+				}			
+			}
+		else if (aActionType == ECPixUpdateAction)
+			{
+			TRAPD(err, iIndexer->UpdateL(*index_item));
+			if (err == KErrNone)
+				{
+				CPIXLOGSTRING("CCalendarPlugin::CreateEntryL(): Updated.");
+				}
+			else
+				{
+				CPIXLOGSTRING2("CCalendarPlugin::CreateEntryL(): Error %d in updating.", err);
+				}			
+			}
+		CleanupStack::PopAndDestroy(index_item);
+		}
+	else if (aActionType == ECPixRemoveAction)
+		{
+		TRAPD(err, iIndexer->DeleteL(docid_str));
+		if (err == KErrNone)
+			{
+			CPIXLOGSTRING("CCalendarPlugin::CreateEntryL(): Deleted.");
+			}
+		else
+			{
+			CPIXLOGSTRING2("CCalendarPlugin::CreateEntryL(): Error %d in deleting.", err);				
+			}
+		}
+
+	}
+
+// ---------------------------------------------------------------------------
+// CCalendarPlugin::UpdatePerformaceDataL
+// ---------------------------------------------------------------------------
+//
+#ifdef __PERFORMANCE_DATA
+void CCalendarPlugin::UpdatePerformaceDataL()
+    {
+    TTime now;
+   
+    
+    iCompleteTime.UniversalTime();
+    TTimeIntervalMicroSeconds timeDiff = iCompleteTime.MicroSecondsFrom(iStartTime);
+    
+    RFs fileSession;
+    RFile perfFile;
+    User::LeaveIfError( fileSession.Connect () );
+    
+    
+    /* Open file if it exists, otherwise create it and write content in it */
+    
+        if(perfFile.Open(fileSession, _L("c:\\data\\CalenderPerf.txt"), EFileWrite))
+                   User::LeaveIfError(perfFile.Create (fileSession, _L("c:\\data\\CalenderPerf.txt"), EFileWrite));
+    
+    HBufC8 *heap = HBufC8::NewL(100);
+    TPtr8 ptr = heap->Des();
+    now.HomeTime();
+    TBuf<50> timeString;             
+                
+    _LIT(KOwnTimeFormat,"%:0%H%:1%T%:2%S");
+    now.FormatL(timeString,KOwnTimeFormat);
+    ptr.AppendNum(now.DateTime().Day());
+    ptr.Append(_L("/"));
+    ptr.AppendNum(now.DateTime().Month());
+    ptr.Append(_L("/"));
+    ptr.AppendNum(now.DateTime().Year());
+    ptr.Append(_L(":"));
+    ptr.Append(timeString);
+    ptr.Append( _L("Time taken for Harvesting Calendar is : "));
+    ptr.AppendNum(timeDiff.Int64()/1000) ;
+    ptr.Append(_L(" MilliSeonds \n"));
+    TInt myInt = 0;
+    perfFile.Seek(ESeekEnd,myInt);
+    perfFile.Write (ptr);
+    perfFile.Close ();
+    fileSession.Close ();
+    delete heap;
+    }
+
+// ---------------------------------------------------------------------------
+// CCalendarPlugin::UpdatePerformaceDataL
+// ---------------------------------------------------------------------------
+//
+void CCalendarPlugin::UpdatePerformaceDataL(TCPixActionType action)
+    {
+   
+    iCompleteTime.UniversalTime();
+    TTimeIntervalMicroSeconds timeDiff = iCompleteTime.MicroSecondsFrom(iStartTime);
+    
+    RFs fileSession;
+    RFile perfFile;
+    User::LeaveIfError( fileSession.Connect () );
+    
+    
+    /* Open file if it exists, otherwise create it and write content in it */
+    
+        if(perfFile.Open(fileSession, _L("c:\\data\\CalenderPerf.txt"), EFileWrite))
+                   User::LeaveIfError(perfFile.Create (fileSession, _L("c:\\data\\CalenderPerf.txt"), EFileWrite));
+    
+    HBufC8 *heap = HBufC8::NewL(100);
+    TPtr8 ptr = heap->Des();
+
+    switch (action) {
+        case ECPixAddAction: ptr.Append( _L("add "));break;
+        case ECPixUpdateAction: ptr.Append( _L("upd "));break;
+        case ECPixRemoveAction: ptr.Append( _L("del "));break;
+    } 
+    ptr.AppendNum(timeDiff.Int64()/1000) ;
+    ptr.Append(_L("\n"));
+    TInt myInt = 0;
+    perfFile.Seek(ESeekEnd,myInt);
+    perfFile.Write (ptr);
+    perfFile.Close ();
+    fileSession.Close ();
+    delete heap;
+    }
+#endif
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/harvesterplugins/calendar/src/tproxy.cpp	Mon Apr 19 14:40:05 2010 +0300
@@ -0,0 +1,36 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: 
+*
+*/
+
+#include <e32std.h>
+#include <implementationproxy.h>
+#include <cindexingplugin.h>
+#include "ccalendarplugin.h"
+
+
+// Map the interface UIDs to implementation factory functions
+const TImplementationProxy KImplementationTable[] = 
+	{
+	{{0x2001F704},( TProxyNewLPtr) CCalendarPlugin::NewL}		
+	};
+
+// Exported proxy for instantiation method resolution
+EXPORT_C const TImplementationProxy* ImplementationGroupProxy( TInt& aTableCount )
+	{
+	aTableCount = sizeof( KImplementationTable ) / sizeof( TImplementationProxy );
+	return KImplementationTable;
+	}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/harvesterplugins/contacts/data/2001f702.rss	Mon Apr 19 14:40:05 2010 +0300
@@ -0,0 +1,48 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: 
+*
+*/
+// 0x2001F702.RSS
+
+#include <registryinfo.rh>
+
+// Declares info for one test implementation
+RESOURCE REGISTRY_INFO theInfo
+        {
+        // UID for the DLL        
+        dll_uid = 0x2001F702; // ECOM Contacts Plugin dll UID
+        // Declare array of interface info
+        interfaces = 
+                {
+                INTERFACE_INFO
+                        {
+                        // UID of interface that is implemented
+                        interface_uid = 0x2001F700; // CPixSearch Plugin Interface UID
+                        implementations = 
+                                {
+                                // Info for CMessagePlugin
+                                IMPLEMENTATION_INFO
+                                        {
+                                        implementation_uid = 0x2001F702;
+                                        version_no = 1;
+                                        display_name = "CPix Search Contacts plugin";
+                                        default_data = "Contacts";
+                                        opaque_data = "";
+                                        }
+                                };
+                        }
+                };
+        }
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/harvesterplugins/contacts/group/bld.inf	Mon Apr 19 14:40:05 2010 +0300
@@ -0,0 +1,21 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: 
+*
+*/
+
+
+PRJ_MMPFILES
+contactsplugin.mmp
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/harvesterplugins/contacts/group/contactsplugin.mmp	Mon Apr 19 14:40:05 2010 +0300
@@ -0,0 +1,55 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: 
+*
+*/
+
+TARGET        cpixcontactsplugin.dll
+TARGETTYPE    PLUGIN
+ 
+#include        <platform_paths.hrh>
+
+CAPABILITY   CAP_GENERAL_DLL -AllFiles -DRM
+#include "../../../harvesterplugins/inc/s60performance.h"
+// ECom Dll recognition UID followed by the unique UID for this dll
+UID           0x10009D8D 0x2001F702 
+
+SOURCEPATH    ../src
+SOURCE        ccontactsplugin.cpp
+SOURCE        tproxy.cpp
+
+USERINCLUDE   ../inc
+
+APP_LAYER_SYSTEMINCLUDE
+SYSTEMINCLUDE /epoc32/include/ecom
+
+SOURCEPATH    ../data
+start RESOURCE 2001f702.rss
+target  cpixcontactsplugin.rsc
+end
+
+LIBRARY       euser.lib
+LIBRARY       ecom.lib
+LIBRARY       efsrv.lib
+LIBRARY       cntmodel.lib
+LIBRARY       cpixharvesterplugininterface.lib
+LIBRARY       cpixsearchclient.lib
+
+
+// For logging
+LIBRARY 	  flogger.lib 
+
+EXPORTUNFROZEN
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/harvesterplugins/contacts/inc/ccontactsplugin.h	Mon Apr 19 14:40:05 2010 +0300
@@ -0,0 +1,134 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: 
+ *
+*/
+
+#ifndef CCONTACTSPLUGIN_H
+#define CCONTACTSPLUGIN_H
+
+#include <e32base.h>
+#include <cntfldst.h>
+#include <cntitem.h>
+#include <cntdbobs.h>
+#include <cindexingplugin.h>
+#include <common.h>
+#include "delayedcallback.h"
+
+class CSearchDocument;
+class CContactItemFieldSet;
+class CCPixIndexer;
+
+/** Field names */
+_LIT(KContactsGivenNameField, "GivenName");
+_LIT(KContactsFamilyNameField, "FamilyName");
+_LIT(KContactsCompanyNameField, "CompanyName");
+_LIT(KContactsPhoneNumberField, "PhoneNumber");
+_LIT(KContactsAddressField, "Address");
+_LIT(KContactsNoteField, "Note");
+_LIT(KContactsJobTitleField, "JobTitle");
+_LIT(KContactsSecondNameField, "SecondName");
+
+_LIT(KContactsSuffixField, "Suffix");
+_LIT(KContactsEMailField, "EMail");
+_LIT(KContactsUrlField, "URL");
+
+_LIT(KContactsPostOfficeField, "PostOffice");
+_LIT(KContactsExtendedAddressField, "ExtendedAddress");
+_LIT(KContactsLocalityField, "Locality");
+_LIT(KContactsRegionField, "Region");
+_LIT(KContactsPostcodeField, "PostCode");
+_LIT(KContactsCountryField, "Country");
+_LIT(KContactsSIPIDField, "SIPID");
+_LIT(KContactsSpouseField, "Spouse");
+_LIT(KContactsChildrenField, "Children");
+_LIT(KContactsClassField, "Class");
+_LIT(KContactsPrefixField, "Prefix");
+_LIT(KContactsAdditionalNameField, "AdditionalName");
+_LIT(KContactsFaxField, "Fax");
+_LIT(KContactsGivenNamePronunciationField, "GivenNamePronunciation");
+_LIT(KContactsFamilyNamePronunciationField, "FamilyNamePronunciation");
+_LIT(KContactsCompanyNamePronunciationField, "CompanyNamePronunciation");
+
+
+class CContactsPlugin : public CIndexingPlugin, public MContactDbObserver, public MDelayedCallbackObserver
+{
+public:
+	static CContactsPlugin* NewL();
+	static CContactsPlugin* NewLC();
+	virtual ~CContactsPlugin();
+
+	/**
+	 * From CIndexingPlugin
+	 */
+	void StartPluginL();
+	void StartHarvestingL(const TDesC& aQualifiedBaseAppClass);
+
+	/**
+	 * From MContactDbObserver, HandleDatabaseEventL.
+	 */
+	void HandleDatabaseEventL(TContactDbObserverEvent aEvent);
+
+    /**
+     * From MDelayedCallbackObserver, DelayedCallbackL
+     */
+    void DelayedCallbackL(TInt aCode);
+    void DelayedError(TInt aError);
+
+protected:
+	CContactsPlugin();
+	void ConstructL();
+
+	/**
+	 *  Adds information field (if available)
+	 */
+	void AddFieldL(CSearchDocument& aDocument, CContactItemFieldSet& aFieldSet, TUid aFieldId, const TDesC& aFieldName );
+
+	/**
+	 *  Adds to excerpt
+	 */
+	void AddToExcerptL(CSearchDocument& aDocument, CContactItemFieldSet& aFieldSet, TUid aFieldId, const TDesC& aFieldName );
+
+	/**
+	 * Creates the actual contact book index item
+	 */
+	void CreateContactIndexItemL(TInt aContentId, TCPixActionType aActionType);
+
+private:
+	
+	/** Contact change notifier */
+	CContactChangeNotifier* iChangeNotifier;
+	/** Sorted contact id array */
+	const CContactIdArray* iContacts;
+	/** Contacts database. */
+	CContactDatabase* iDatabase;
+	/** The asynchronizer */
+	CDelayedCallback* iAsynchronizer;
+	/** Current harvested contact index */
+	TInt iCurrentIndex;	
+	/** placeholder for Excerpt text dynamic creation */
+	HBufC* iExcerpt;
+	
+	// CPix database 
+    CCPixIndexer* iIndexer;
+
+#ifdef __PERFORMANCE_DATA
+    TTime iStartTime;
+    TTime iCompleteTime;
+    void UpdatePerformaceDataL();
+    void UpdatePerformaceDataL(TCPixActionType);
+#endif	
+};
+
+#endif // CCONTACTSPLUGIN_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/harvesterplugins/contacts/src/ccontactsplugin.cpp	Mon Apr 19 14:40:05 2010 +0300
@@ -0,0 +1,506 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: 
+ *
+*/
+
+#include "ccontactsplugin.h"
+#include "harvesterserverlogger.h"
+#include <common.h>
+#include <csearchdocument.h>
+
+#include <ccpixindexer.h>
+#include <e32base.h> 
+
+_LIT(KMimeTypeField, CPIX_MIMETYPE_FIELD);
+_LIT(KMimeTypeContact, CONTACT_MIMETYPE);
+
+
+/** The delay between harvesting chunks. */
+const TInt KHarvestingDelay = 2000;
+
+/** Number of contacts to process in one active scheduler cycle */
+const TInt KContactsPerRunL = 1;
+
+_LIT(KExcerptDelimiter, " ");
+
+// -----------------------------------------------------------------------------
+// CContactsPlugin::NewL()
+// -----------------------------------------------------------------------------
+//
+CContactsPlugin* CContactsPlugin::NewL()
+	{
+	CContactsPlugin* instance = CContactsPlugin::NewLC();
+    CleanupStack::Pop(instance);
+    return instance;
+	}
+
+// -----------------------------------------------------------------------------
+// CContactsPlugin::NewLC()
+// -----------------------------------------------------------------------------
+//
+CContactsPlugin* CContactsPlugin::NewLC()
+	{
+	CContactsPlugin* instance = new (ELeave)CContactsPlugin();
+    CleanupStack::PushL(instance);
+    instance->ConstructL();
+    return instance;
+	}
+
+// -----------------------------------------------------------------------------
+// CContactsPlugin::CContactsPlugin()
+// -----------------------------------------------------------------------------
+//
+CContactsPlugin::CContactsPlugin()
+	{
+	}
+
+// -----------------------------------------------------------------------------
+// CContactsPlugin::~CContactsPlugin()
+// -----------------------------------------------------------------------------
+//
+CContactsPlugin::~CContactsPlugin()
+	{
+    if (iAsynchronizer)
+        iAsynchronizer->CancelCallback();
+	delete iAsynchronizer;
+	iContacts = NULL;
+	delete iChangeNotifier;
+	delete iDatabase;
+	delete iIndexer;
+	
+	if (iExcerpt)
+		delete iExcerpt;
+	}
+	
+// -----------------------------------------------------------------------------
+// CContactsPlugin::ConstructL()
+// -----------------------------------------------------------------------------
+//
+void CContactsPlugin::ConstructL()
+	{
+	iDatabase = CContactDatabase::OpenL();
+
+	// This pointer is valid until a change is made to the database or until 
+	// the database's active object is allowed to run. If the array is 
+	// required after one of the above two events has occurred, a copy of the 
+	// array must first be made.
+	iContacts = iDatabase->SortedItemsL();
+
+    iAsynchronizer = CDelayedCallback::NewL( CActive::EPriorityIdle );
+	}
+
+// -----------------------------------------------------------------------------
+// CContactsPlugin::StartPluginL()
+// -----------------------------------------------------------------------------
+//
+void CContactsPlugin::StartPluginL()
+	{
+	// Define this base application class, use default location
+	User::LeaveIfError(iSearchSession.DefineVolume( _L(CONTACT_QBASEAPPCLASS), KNullDesC ));
+
+	// Open database
+	iIndexer = CCPixIndexer::NewL(iSearchSession);
+	iIndexer->OpenDatabaseL( _L(CONTACT_QBASEAPPCLASS) ); 
+
+	// Start harvester for this plugin
+	iObserver->AddHarvestingQueue(this, iIndexer->GetBaseAppClass());
+
+	// Start monitoring when plugin is started
+	iChangeNotifier = CContactChangeNotifier::NewL(*iDatabase, this);	
+	}
+
+// -----------------------------------------------------------------------------
+// CContactsPlugin::StartHarvestingL()
+// -----------------------------------------------------------------------------
+//
+void CContactsPlugin::StartHarvestingL(const TDesC& /*aQualifiedBaseAppClass*/)
+    {
+	iIndexer->ResetL();
+	iCurrentIndex = 0;
+#ifdef __PERFORMANCE_DATA
+    iStartTime.UniversalTime();
+#endif  
+    iAsynchronizer->Start( 0, this, KHarvestingDelay );
+    }
+
+// -----------------------------------------------------------------------------
+// CContactsPlugin::HandleDatabaseEventL
+// -----------------------------------------------------------------------------
+// 
+void CContactsPlugin::HandleDatabaseEventL(TContactDbObserverEvent aEvent)
+	{
+	switch( aEvent.iType )
+		{
+		case EContactDbObserverEventContactChanged:
+		case EContactDbObserverEventGroupChanged:
+			CPIXLOGSTRING2("CContactsPlugin::DelayedCallbackL(): Monitored update id=%d.", aEvent.iContactId);
+#ifdef __PERFORMANCE_DATA
+            iStartTime.UniversalTime();
+            CreateContactIndexItemL(aEvent.iContactId, ECPixUpdateAction);
+            UpdatePerformaceDataL(ECPixUpdateAction);
+#else			
+			CreateContactIndexItemL(aEvent.iContactId, ECPixUpdateAction);
+#endif			
+			break;
+
+		case EContactDbObserverEventContactDeleted:
+		case EContactDbObserverEventGroupDeleted:
+			CPIXLOGSTRING2("CContactsPlugin::DelayedCallbackL(): Monitored delete id=%d.", aEvent.iContactId);
+#ifdef __PERFORMANCE_DATA
+            iStartTime.UniversalTime();			
+			CreateContactIndexItemL(aEvent.iContactId, ECPixRemoveAction);
+			UpdatePerformaceDataL(ECPixRemoveAction);
+#else
+			CreateContactIndexItemL(aEvent.iContactId, ECPixRemoveAction);
+#endif
+			break;
+
+		case EContactDbObserverEventContactAdded:
+		case EContactDbObserverEventGroupAdded:
+			CPIXLOGSTRING2("CContactsPlugin::DelayedCallbackL(): Monitored add id=%d.", aEvent.iContactId);
+#ifdef __PERFORMANCE_DATA
+            iStartTime.UniversalTime();			
+			CreateContactIndexItemL(aEvent.iContactId, ECPixUpdateAction);
+			UpdatePerformaceDataL(ECPixUpdateAction);
+#else
+			CreateContactIndexItemL(aEvent.iContactId, ECPixAddAction);
+#endif
+			break;
+
+		default:
+			// Ignore other events
+			break;
+		}
+	}
+
+// -----------------------------------------------------------------------------
+// CContactsPlugin::DelayedCallbackL
+// -----------------------------------------------------------------------------
+//
+void CContactsPlugin::DelayedCallbackL( TInt /*aCode*/ )
+    {
+	if (!iContacts || !iObserver)
+		return;
+
+	// may have changed - refresh the pointer
+	iContacts = iDatabase->SortedItemsL();
+
+	// Read the next set of contacts.
+	for( TInt i = 0; i < KContactsPerRunL; i++ )
+		{
+		// Exit the loop if no more contacts
+		if (iCurrentIndex >= iContacts->Count())
+			break;
+		
+		// Create index item
+		CPIXLOGSTRING2("CContactsPlugin::DelayedCallbackL(): Harvesting id=%d.", (*iContacts)[iCurrentIndex]);
+		CreateContactIndexItemL((*iContacts)[iCurrentIndex], ECPixAddAction);
+		iCurrentIndex++;
+		}
+
+	if( iAsynchronizer && (iCurrentIndex < iContacts->Count()) )
+	    {
+	    // Launch the next RunL
+        iAsynchronizer->Start(0, this, KHarvestingDelay);
+        }
+	else
+		{
+		// Harvesting was successfully completed
+		Flush(*iIndexer);
+#ifdef __PERFORMANCE_DATA
+    UpdatePerformaceDataL();
+#endif 
+		iObserver->HarvestingCompleted(this, iIndexer->GetBaseAppClass(), KErrNone);
+		}
+	}
+
+void CContactsPlugin::DelayedError(TInt aError)
+	{
+	// Harvesting was successfully completed
+	Flush(*iIndexer);
+	iObserver->HarvestingCompleted(this, iIndexer->GetBaseAppClass(), aError);
+	}
+
+// ---------------------------------------------------------------------------
+// CContactsPlugin::AddFieldL
+// Adds information field (if available)
+// If the contact has multiple values for the same Field (e.g. multiple 
+// PhoneNumber values), then the FieldNames of non-first values are appended a 
+// number.
+// ---------------------------------------------------------------------------
+void CContactsPlugin::AddFieldL(CSearchDocument& aDocument, CContactItemFieldSet& aFieldSet, TUid aFieldId, const TDesC& aFieldName)
+	{
+	HBufC* fieldName = HBufC::NewLC(aFieldName.Length() + 3); // +3 so can append variable 'i'.
+	TPtr fieldNamePtr = fieldName->Des();
+
+	// Find field
+	TInt findpos = aFieldSet.FindNext(aFieldId, 0);
+	for (TInt i = 0; findpos != KErrNotFound; i++)
+		{
+		fieldNamePtr.Copy(aFieldName);
+		if (i>0)
+			{
+			fieldNamePtr.AppendNum(i);
+			}
+		CContactItemField& additionalField = aFieldSet[findpos];
+		CContactTextField* fieldText = additionalField.TextStorage();
+		if (fieldText && fieldText->Text() != KNullDesC)
+	        aDocument.AddFieldL(fieldNamePtr, fieldText->Text(), CDocumentField::EStoreYes | CDocumentField::EIndexTokenized);
+		else
+	        aDocument.AddFieldL(fieldNamePtr, KNullDesC, CDocumentField::EStoreYes | CDocumentField::EIndexTokenized);
+		
+		findpos = aFieldSet.FindNext(aFieldId, findpos+1);
+		}
+	CleanupStack::PopAndDestroy(fieldName);
+	}
+
+
+// ---------------------------------------------------------------------------
+// CContactsPlugin::AddToExcerptL
+// Adds more text to excerpt
+// ---------------------------------------------------------------------------
+void CContactsPlugin::AddToExcerptL(CSearchDocument& /*aDocument*/, CContactItemFieldSet& aFieldSet, TUid aFieldId, const TDesC& /*aFieldName*/ )
+	{
+	// Find field
+	TInt findpos = aFieldSet.Find( aFieldId );
+	if (! (findpos < 0) || (findpos >= aFieldSet.Count() ) )
+		{
+		CContactItemField& additionalField = aFieldSet[ findpos ];
+		CContactTextField* fieldText = additionalField.TextStorage();
+		if ( fieldText && fieldText->Text() != KNullDesC )
+			{
+			TInt currentSize = iExcerpt->Size();
+			TInt newSize = currentSize + fieldText->Text().Size() + 1;
+			iExcerpt = iExcerpt->ReAllocL(newSize);
+			TPtr ptr = iExcerpt->Des();
+			ptr.Append(fieldText->Text());
+			ptr.Append(KExcerptDelimiter);
+			}
+		}
+	}
+
+
+// ---------------------------------------------------------------------------
+// CContactsPlugin::CreateMessageIndexItemL
+// ---------------------------------------------------------------------------
+//	    
+void CContactsPlugin::CreateContactIndexItemL(TInt aContentId, TCPixActionType aActionType )
+    {
+	if (!iIndexer)
+    	return;
+    
+	CPIXLOGSTRING2("CContactsPlugin::CreateContactIndexItemL(): aContentId = %d ", aContentId );
+    
+	// creating CSearchDocument object with unique ID for this application
+	TBuf<20> docid_str;
+	docid_str.AppendNum(aContentId);
+	
+	if (aActionType == ECPixAddAction || aActionType == ECPixUpdateAction )
+		{
+		CSearchDocument* index_item = CSearchDocument::NewLC(docid_str, _L(CONTACTAPPCLASS)); 
+		   
+	    // Add fields
+		CContactItem* contact = iDatabase->ReadMinimalContactL(aContentId);
+        CleanupStack::PushL( contact );
+		if( contact->Type() == KUidContactGroup )
+		    {
+            index_item->AddFieldL(KContactsGivenNameField, static_cast<CContactGroup*>( contact )->GetGroupLabelL(), CDocumentField::EStoreYes | CDocumentField::EIndexTokenized);
+            CPIXLOGSTRING2("Adding Contact Group %S", &( static_cast<CContactGroup*>( contact )->GetGroupLabelL() ) );
+            index_item->AddExcerptL( static_cast<CContactGroup*>( contact )->GetGroupLabelL() );
+		    }
+		else//If the contact item is a regular contact.
+		    {
+            CContactItemFieldSet& fieldSet = contact->CardFields();
+            AddFieldL( *index_item, fieldSet, KUidContactFieldGivenName, KContactsGivenNameField );
+            AddFieldL( *index_item, fieldSet, KUidContactFieldFamilyName, KContactsFamilyNameField );
+            AddFieldL( *index_item, fieldSet, KUidContactFieldCompanyName, KContactsCompanyNameField );
+            AddFieldL( *index_item, fieldSet, KUidContactFieldPhoneNumber, KContactsPhoneNumberField );
+            AddFieldL( *index_item, fieldSet, KUidContactFieldAddress, KContactsAddressField );
+            AddFieldL( *index_item, fieldSet, KUidContactFieldNote, KContactsNoteField );
+            AddFieldL( *index_item, fieldSet, KUidContactFieldJobTitle, KContactsJobTitleField );
+            AddFieldL( *index_item, fieldSet, KUidContactFieldSecondName, KContactsSecondNameField ); 
+            
+            AddFieldL( *index_item, fieldSet, KUidContactFieldPrefixName, KContactsPrefixField );
+            AddFieldL( *index_item, fieldSet, KUidContactFieldSuffixName, KContactsSuffixField );
+            AddFieldL( *index_item, fieldSet, KUidContactFieldAdditionalName, KContactsAdditionalNameField );
+            AddFieldL( *index_item, fieldSet, KUidContactFieldEMail, KContactsEMailField );
+            AddFieldL( *index_item, fieldSet, KUidContactFieldUrl, KContactsUrlField );
+    
+            AddFieldL( *index_item, fieldSet, KUidContactFieldPostOffice, KContactsPostOfficeField );
+            AddFieldL( *index_item, fieldSet, KUidContactFieldExtendedAddress, KContactsExtendedAddressField );
+            AddFieldL( *index_item, fieldSet, KUidContactFieldLocality, KContactsLocalityField );
+            AddFieldL( *index_item, fieldSet, KUidContactFieldRegion, KContactsRegionField );
+            AddFieldL( *index_item, fieldSet, KUidContactFieldPostcode, KContactsPostcodeField );
+            AddFieldL( *index_item, fieldSet, KUidContactFieldCountry, KContactsCountryField );
+    
+            AddFieldL( *index_item, fieldSet, KUidContactFieldSIPID, KContactsSIPIDField );
+            AddFieldL( *index_item, fieldSet, KUidContactFieldSpouse, KContactsSpouseField );
+            AddFieldL( *index_item, fieldSet, KUidContactFieldChildren, KContactsChildrenField );
+            AddFieldL( *index_item, fieldSet, KUidContactFieldClass, KContactsClassField );
+            AddFieldL( *index_item, fieldSet, KUidContactFieldFax, KContactsFaxField );				
+            
+            AddFieldL( *index_item, fieldSet, KUidContactFieldGivenNamePronunciation, KContactsGivenNamePronunciationField );
+            AddFieldL( *index_item, fieldSet, KUidContactFieldFamilyNamePronunciation, KContactsFamilyNamePronunciationField );
+            AddFieldL( *index_item, fieldSet, KUidContactFieldCompanyNamePronunciation, KContactsCompanyNamePronunciationField );
+            //left: Birthday; Anniversary (date kind of type), Picture, Logo..
+
+            if (iExcerpt)
+                {
+                delete iExcerpt;
+                iExcerpt = NULL;
+                }
+            iExcerpt = HBufC::NewL(2);
+            AddToExcerptL( *index_item, fieldSet, KUidContactFieldGivenName, KContactsGivenNameField );
+            AddToExcerptL( *index_item, fieldSet, KUidContactFieldFamilyName, KContactsFamilyNameField );
+            AddToExcerptL( *index_item, fieldSet, KUidContactFieldPhoneNumber, KContactsPhoneNumberField );
+            AddToExcerptL( *index_item, fieldSet, KUidContactFieldCompanyName, KContactsCompanyNameField );
+            AddToExcerptL( *index_item, fieldSet, KUidContactFieldLocality, KContactsLocalityField );
+            AddToExcerptL( *index_item, fieldSet, KUidContactFieldCountry, KContactsCountryField );
+            index_item->AddExcerptL(*iExcerpt);
+            }
+        
+    	index_item->AddFieldL(KMimeTypeField, KMimeTypeContact, CDocumentField::EStoreYes | CDocumentField::EIndexUnTokenized);
+        
+		CleanupStack::PopAndDestroy( contact );
+	
+		// Send for indexing
+		if (aActionType == ECPixAddAction)
+			{
+			TRAPD(err, iIndexer->AddL(*index_item));
+			if (err == KErrNone)
+				{
+				CPIXLOGSTRING("CContactsPlugin::CreateContactIndexItemL(): Added.");
+				}
+			else
+				{
+				CPIXLOGSTRING2("CContactsPlugin::CreateContactIndexItemL(): Error %d in adding.", err);
+				}			
+			}
+		else if (aActionType == ECPixUpdateAction)
+			{
+			TRAPD(err, iIndexer->UpdateL(*index_item));
+			if (err == KErrNone)
+				{
+				CPIXLOGSTRING("CContactsPlugin::CreateContactIndexItemL(): Updated.");
+				}
+			else
+				{
+				CPIXLOGSTRING2("CContactsPlugin::CreateContactIndexItemL(): Error %d in updating.", err);
+				}			
+			}
+		CleanupStack::PopAndDestroy(index_item); // Do not destroy
+		}
+	else if (aActionType == ECPixRemoveAction)
+		{
+		// Remove the document
+		TRAPD(err, iIndexer->DeleteL(docid_str));
+		if (err == KErrNone)
+			{
+			CPIXLOGSTRING("CContactsPlugin::CreateContactIndexItemL(): Deleted.");
+			}
+		else
+			{
+			CPIXLOGSTRING2("CContactsPlugin::CreateContactIndexItemL(): Error %d in deleting.", err);
+			}			
+		}
+    }
+
+// ---------------------------------------------------------------------------
+// CContactsPlugin::UpdatePerformaceDataL
+// ---------------------------------------------------------------------------
+//	
+#ifdef __PERFORMANCE_DATA
+void CContactsPlugin::UpdatePerformaceDataL()
+    {
+    TTime now;
+   
+    
+    iCompleteTime.UniversalTime();
+    TTimeIntervalMicroSeconds timeDiff = iCompleteTime.MicroSecondsFrom(iStartTime);
+    
+    RFs fileSession;
+    RFile perfFile;
+    User::LeaveIfError( fileSession.Connect () );
+    
+    
+    /* Open file if it exists, otherwise create it and write content in it */
+    
+        if(perfFile.Open(fileSession, _L("c:\\data\\ContactsPerf.txt"), EFileWrite))
+                   User::LeaveIfError(perfFile.Create (fileSession, _L("c:\\data\\ContactsPerf.txt"), EFileWrite));
+    
+    HBufC8 *heap = HBufC8::NewL(100);
+    TPtr8 ptr = heap->Des();
+    now.HomeTime();
+    TBuf<50> timeString;             
+                
+    _LIT(KOwnTimeFormat,"%:0%H%:1%T%:2%S");
+    now.FormatL(timeString,KOwnTimeFormat);
+    ptr.AppendNum(now.DateTime().Day());
+    ptr.Append(_L("/"));
+    ptr.AppendNum(now.DateTime().Month());
+    ptr.Append(_L("/"));
+    ptr.AppendNum(now.DateTime().Year());
+    ptr.Append(_L(":"));
+    ptr.Append(timeString);
+    ptr.Append( _L("Time taken for Harvesting Contacts is : "));
+    ptr.AppendNum(timeDiff.Int64()/1000) ;
+    ptr.Append(_L(" MilliSeonds \n"));
+    TInt myInt = 0;
+    perfFile.Seek(ESeekEnd,myInt);
+    perfFile.Write (ptr);
+    perfFile.Close ();
+    fileSession.Close ();
+    delete heap;
+    }
+
+// ---------------------------------------------------------------------------
+// CContactsPlugin::UpdatePerformaceDataL
+// ---------------------------------------------------------------------------
+//	
+void CContactsPlugin::UpdatePerformaceDataL(TCPixActionType action)
+    {
+ 
+    iCompleteTime.UniversalTime();
+    TTimeIntervalMicroSeconds timeDiff = iCompleteTime.MicroSecondsFrom(iStartTime);
+    
+    RFs fileSession;
+    RFile perfFile;
+    User::LeaveIfError( fileSession.Connect () );
+    
+    
+    /* Open file if it exists, otherwise create it and write content in it */
+    
+        if(perfFile.Open(fileSession, _L("c:\\data\\ContactsPerf.txt"), EFileWrite))
+                   User::LeaveIfError(perfFile.Create (fileSession, _L("c:\\data\\ContactsPerf.txt"), EFileWrite));
+    
+    HBufC8 *heap = HBufC8::NewL(100);
+    TPtr8 ptr = heap->Des();
+
+    switch (action) {
+        case ECPixUpdateAction: ptr.Append( _L("upd "));break;
+        case ECPixRemoveAction: ptr.Append( _L("del "));break;
+    } 
+    ptr.AppendNum(timeDiff.Int64()/1000) ;
+    ptr.Append(_L("\n"));
+    TInt myInt = 0;
+    perfFile.Seek(ESeekEnd,myInt);
+    perfFile.Write (ptr);
+    perfFile.Close ();
+    fileSession.Close ();
+    delete heap;
+    }
+#endif
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/harvesterplugins/contacts/src/tproxy.cpp	Mon Apr 19 14:40:05 2010 +0300
@@ -0,0 +1,36 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Message plugin
+*
+*/
+
+#include <e32std.h>
+#include <implementationproxy.h>
+#include <cindexingplugin.h>
+#include "ccontactsplugin.h"
+
+
+// Map the interface UIDs to implementation factory functions
+const TImplementationProxy KImplementationTable[] = 
+	{
+	{{0x2001F702},( TProxyNewLPtr) CContactsPlugin::NewL}		
+	};
+
+// Exported proxy for instantiation method resolution
+EXPORT_C const TImplementationProxy* ImplementationGroupProxy( TInt& aTableCount )
+	{
+	aTableCount = sizeof( KImplementationTable ) / sizeof( TImplementationProxy );
+	return KImplementationTable;
+	}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/harvesterplugins/file/data/2001f703.rss	Mon Apr 19 14:40:05 2010 +0300
@@ -0,0 +1,48 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: 
+*
+*/
+// 0x2001F703.RSS
+
+#include <registryinfo.rh>
+
+// Declares info for one test implementation
+RESOURCE REGISTRY_INFO theInfo
+        {
+        // UID for the DLL        
+        dll_uid = 0x2001F703; // ECOM Contacts Plugin dll UID
+        // Declare array of interface info
+        interfaces = 
+                {
+                INTERFACE_INFO
+                        {
+                        // UID of interface that is implemented
+                        interface_uid = 0x2001F700; // CPixSearch Plugin Interface UID
+                        implementations = 
+                                {
+                                // Info for CMessagePlugin
+                                IMPLEMENTATION_INFO
+                                        {
+                                        implementation_uid = 0x2001F703;
+                                        version_no = 1;
+                                        display_name = "CPix Search File plugin";
+                                        default_data = "File";
+                                        opaque_data = "";
+                                        }
+                                };
+                        }
+                };
+        }
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/harvesterplugins/file/fastfindfileserverplugin/group/bld.inf	Mon Apr 19 14:40:05 2010 +0300
@@ -0,0 +1,28 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Build info file for File Server Plugin
+*
+*/
+
+// Supported platforms
+prj_platforms
+WINSCW ARMV5
+
+// MMP files
+prj_mmpfiles
+fastfindfileserverplugin.mmp
+
+// Files to be exported
+prj_exports
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/harvesterplugins/file/fastfindfileserverplugin/group/fastfindfileserverplugin.mmp	Mon Apr 19 14:40:05 2010 +0300
@@ -0,0 +1,38 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Monitors file creations, modifications and deletions.
+ *
+*/
+
+#include        <platform_paths.hrh>
+ 
+CAPABILITY TCB ProtServ DiskAdmin AllFiles PowerMgmt CommDD
+
+TARGET        cpixfileserverplugin.pxt
+TARGETTYPE    fsy
+
+// Plugin File System (0x100039DF)
+UID           0x100039DF 0x2001F6FA 
+VENDORID	  0x70000001
+
+APP_LAYER_SYSTEMINCLUDE
+USERINCLUDE   ../inc
+USERINCLUDE   ../../inc/monitorplugin
+
+SOURCEPATH    ../src
+SOURCE        fastfindfileserverplugin.cpp 
+
+LIBRARY       euser.lib
+LIBRARY       efile.lib
+LIBRARY       efsrv.lib
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/harvesterplugins/file/fastfindfileserverplugin/inc/fastfindfileserverplugin.h	Mon Apr 19 14:40:05 2010 +0300
@@ -0,0 +1,169 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Monitors file creations, modifications and deletions.
+*
+*/
+
+#ifndef FASTFINDFILESERVERPLUGIN_H
+#define FASTFINDFILESERVERPLUGIN_H
+
+#include <f32plugin.h>
+#include "fastfindfileserverpluginclient.h"
+
+/**
+* File server plug-in.
+*/
+class CFastFindFileServerPlugin : public CFsPlugin
+	{
+    public:
+
+        /**
+         * Standard NewL()
+         * From CActive.
+         */
+        static CFastFindFileServerPlugin* NewL();
+
+        /**
+         * Virtual destructor.
+         */
+        virtual ~CFastFindFileServerPlugin();
+
+        /**
+         * Initialize plugin.
+         */
+        virtual void InitialiseL();
+
+        /**
+         * 
+         */
+        virtual TInt DoRequestL( TFsPluginRequest& aRequest );
+
+        /**
+         * 
+         */
+        virtual CFsPluginConn* NewPluginConnL();
+
+        /**
+         * 
+         */
+        TInt RegisterNotification( CFsPluginConnRequest& aRequest );
+
+        /**
+         * Add a new notification path.
+         */
+        TInt AddNotificationPath( CFsPluginConnRequest& aRequest );
+
+        /**
+         * Remove notification path.
+         */
+        TInt RemoveNotificationPath( CFsPluginConnRequest& aRequest );
+
+        /**
+         * Add a new path to ignore.
+         */
+        TInt AddIgnorePath( CFsPluginConnRequest& aRequest );
+
+        /**
+         * Remove a path from the ignore list.
+         */
+        TInt RemoveIgnorePath( CFsPluginConnRequest& aRequest );
+
+        /**
+         * 
+         */
+        void EnableL();
+
+        /**
+         * 
+         */
+        void DisableL();
+
+        /**
+         * Add CFastFindFileServerPluginConn connection to this file server plugin
+         */
+        void AddConnection();
+
+        /**
+         * Remove CFastFindFileServerPluginConn connection from this file server
+         * plugin
+         */
+        void RemoveConnection();
+
+    private:
+
+        /**
+         * Private constructor.
+         */
+        CFastFindFileServerPlugin();
+
+        /**
+         * Check if a path is listed.
+         * @param aFileName  Path to check.
+         * @return EFalse, if path is ignored.
+         *         ETrue, if the path is on the notification path list or
+         *         if there is no notification paths set.
+         *         Else EFalse.
+         */
+        TBool CheckPath( TFileName& aFileName );
+
+        /**
+         * Check if path/file hass hidden or system attribute.
+         * @param aFileName  Filename to check.
+         * @return ETrue, if path or file has a hidden or system attribute set.
+         */
+        TBool CheckAttribs( TFileName& aFileName );
+
+#ifdef _DEBUG_EVENTS
+        void RegisterDebugEventsL();
+        void UnregisterDebugEventsL();
+        void PrintDebugEvents( TInt aFunction );
+#endif
+    	
+    private:
+
+        /**
+         * 
+         */
+        CFsPluginConnRequest* iNotification;
+
+        /**
+         * An array of notification paths.
+         */
+        RPointerArray<TFileName> iPaths;
+
+        /**
+         * A queue of file server events.
+         */
+        RPointerArray<TFastFindFSPStatus> iQueue;
+
+        /**
+         * 
+         */
+        RPointerArray<TFileName> iIgnorePaths;
+
+        /**
+         * File system client session.
+         */
+        RFs iFsSession;
+
+        /**
+         * 
+         */
+        RPointerArray<TFileName> iCreatedFiles;
+        TInt iFormatDriveNumber;
+
+        TInt iConnectionCount;
+    };
+
+#endif // FASTFINDILESERVERPLUGIN_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/harvesterplugins/file/fastfindfileserverplugin/inc/fsutil.h	Mon Apr 19 14:40:05 2010 +0300
@@ -0,0 +1,38 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Some generic utilities.
+*
+*/
+
+#ifndef FSUTIL_H
+#define FSUTIL_H
+
+#include <e32base.h>
+
+class FSUtil
+    {
+	public:
+	    
+	    static inline TUint32 MediaID( const RFs& aFs, TInt aDrive );
+	        
+	    static inline TUint32 MediaID( const RFs& aFs, const TDesC& aUri );
+    
+	private:
+	
+	    static inline TInt DriveNumber( const TDesC& aUri );
+    };
+
+#include "fsutil.inl" // inlined methods
+
+#endif // FSUTIL_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/harvesterplugins/file/fastfindfileserverplugin/inc/fsutil.inl	Mon Apr 19 14:40:05 2010 +0300
@@ -0,0 +1,55 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Some generic utilities.
+*
+*/
+
+
+inline TUint32 FSUtil::MediaID( const RFs& aFs, TInt aDrive )
+    {
+    TVolumeInfo vi;
+    
+    TInt err = aFs.Volume(vi, aDrive);
+    if(err == KErrNone)
+        {
+        return vi.iUniqueID;
+        }
+        
+    return 0;
+    }
+
+inline TUint32 FSUtil::MediaID( const RFs& aFs, const TDesC& aUri )
+    {
+    TInt drive = DriveNumber(aUri);
+    if(drive == -1)
+        {
+        return 0;
+        }
+        
+    return MediaID(aFs, drive);
+    }
+
+inline TInt FSUtil::DriveNumber( const TDesC& aUri )
+    {
+    TChar ch = aUri[0];
+    TInt drive = 0;
+    TInt err = RFs::CharToDrive(ch, drive);
+    if(err == KErrNone)
+        {
+        return drive;
+        }
+        
+    return -1;
+    }
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/harvesterplugins/file/fastfindfileserverplugin/inc/harvesterlog.h	Mon Apr 19 14:40:05 2010 +0300
@@ -0,0 +1,134 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Harvester server commands
+*
+*/
+
+#ifndef HARVESTERLOG_H
+#define HARVESTERLOG_H
+
+#include <e32debug.h>
+#include <utf.h>
+
+#ifdef _DEBUG
+
+/**
+ * Function for debug string output.
+ *
+ * @param aLogText C-string to write to debug output.
+ * @lib charconv.lib
+ */
+ /*
+inline void HLOG( char* aLogText ) 
+    {
+    _LIT( KFormat, "%S");
+    TPtrC8 desc( (const TUint8*)aLogText );
+    HBufC* output = HBufC::NewLC( desc.Length() );  //FIXME: TRAP/ignore this line
+    TPtr outputText = output->Des();
+    CnvUtfConverter::ConvertToUnicodeFromUtf8( outputText, desc );
+    RDebug::Print( KFormat, &outputText );
+    CleanupStack::PopAndDestroy( output );
+    }
+*/
+/**
+ * Function for debug string output.
+ *
+ * @param aLogText String to write to debug output.
+ * @deprecated
+ */
+/*
+inline void HLOG( TPtrC16 aLogText ) 
+    {
+    RDebug::Print( aLogText );
+    }
+*/
+/**
+ * Function for debug string output.
+ *
+ * @param aLogText String to write to debug output.
+ * @deprecated
+ */
+/*
+inline void HLOG( TPtrC8 aLogText ) 
+    {
+    HBufC* output = HBufC::NewLC( aLogText.Length() );
+    TPtr outputText = output->Des();
+    CnvUtfConverter::ConvertToUnicodeFromUtf8( outputText, aLogText );
+    RDebug::Print( outputText );
+    CleanupStack::PopAndDestroy( output );
+    }
+*/
+/**
+ * Function for debug output.
+ *
+ * @param aFormat Format for output string.
+ * @param aLog Value to write to debug output. Any type accepted by RDebug is ok.
+ * @lib charconv.lib
+ */
+/*
+template<typename T>
+inline void HLOG1( char* aFormat, T aLog ) 
+    {
+    TPtrC8 fmt( (const TUint8*)aFormat );
+    HBufC* format = HBufC::NewLC( fmt.Length() );
+    TPtr formatPtr = format->Des();
+    CnvUtfConverter::ConvertToUnicodeFromUtf8( formatPtr, fmt );
+    RDebug::Print( formatPtr, aLog );
+    CleanupStack::PopAndDestroy( format );
+    }
+*/
+/**
+ * Function for debug output.
+ *
+ * @param aFormat Format for output string.
+ * @param aLogText String, int, etc to output.
+ * @deprecated
+ */
+/*
+template<typename T>    
+inline void HLOG1( TPtrC16 aFormat, T aLogText ) 
+    {
+    RDebug::Print( aFormat, aLogText );
+    }
+*/
+
+#define WRITELOG(a) RDebug::Print(_L(a))
+#define WRITELOG1(a,b) RDebug::Print(_L(a),(b))
+#define WRITELOG2(a,b,c) RDebug::Print(_L(a),(b),(c))
+#define WRITELOG3(a,b,c,d) RDebug::Print(_L(a),(b),(c),(d))
+
+#define HLOG(a)  RDebug::Print((a))
+#define HLOG1(a, b)  RDebug::Print((a), (b))
+#define HLOG2(a, b, c)  RDebug::Print((a), (b), (c))
+#define HLOG3(a, b, c, d)  RDebug::Print((a), (b), (c), (d))
+#define HLOG4(a, b, c, d, e)  RDebug::Print((a), (b), (c), (d), (e))
+#define HLOG5(a, b, c, d, e, f)  RDebug::Print((a), (b), (c), (d), (e), (f))
+
+#else 
+
+#define WRITELOG(a)
+#define WRITELOG1(a,b)
+#define WRITELOG2(a,b,c)
+#define WRITELOG3(a,b,c,d)
+
+#define HLOG(a)
+#define HLOG1(a, b)
+#define HLOG2(a, b, c) 
+#define HLOG3(a, b, c, d) 
+#define HLOG4(a, b, c, d, e) 
+#define HLOG5(a, b, c, d, e, f) 
+
+#endif
+
+#endif  // HARVESTERLOG_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/harvesterplugins/file/fastfindfileserverplugin/src/fastfindfileserverplugin.cpp	Mon Apr 19 14:40:05 2010 +0300
@@ -0,0 +1,1112 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Monitors file creations, modifications and deletions.
+*
+*/
+
+#include <f32pluginutils.h>
+#include "fastfindfileserverplugin.h"
+#include "harvesterlog.h"
+
+_LIT( KFastFindFileServerPlugin, "CPixFileServerPlugin" );
+
+//-----------------------------------------------------------------------------
+// CFastFindFileServerPlugin implementation
+//-----------------------------------------------------------------------------
+//
+CFastFindFileServerPlugin::CFastFindFileServerPlugin()
+: iFormatDriveNumber( -1 )
+	{
+	WRITELOG( "CFastFindFileServerPlugin::CFastFindFileServerPlugin()" );
+	}
+	
+//-----------------------------------------------------------------------------
+// 
+//-----------------------------------------------------------------------------
+//
+CFastFindFileServerPlugin::~CFastFindFileServerPlugin()
+    {
+    WRITELOG( "CFastFindFileServerPlugin::~CFastFindFileServerPlugin()" );
+    
+    TRAP_IGNORE( DisableL() );
+    iFsSession.Close();
+    
+    iCreatedFiles.ResetAndDestroy();
+    iCreatedFiles.Close();
+    
+    iPaths.ResetAndDestroy();
+    iPaths.Close();
+    
+    iIgnorePaths.ResetAndDestroy();
+    iIgnorePaths.Close();
+        
+    iQueue.ResetAndDestroy();
+    iQueue.Close();
+    }
+    
+//-----------------------------------------------------------------------------
+// 
+//-----------------------------------------------------------------------------
+//
+CFastFindFileServerPlugin* CFastFindFileServerPlugin::NewL()
+    {
+    WRITELOG( "CFastFindFileServerPlugin::NewL()" );
+    return new (ELeave) CFastFindFileServerPlugin;
+    }
+
+//-----------------------------------------------------------------------------
+// 
+//-----------------------------------------------------------------------------
+//
+void CFastFindFileServerPlugin::InitialiseL()
+    {
+    WRITELOG( "CFastFindFileServerPlugin::InitializeL()" );
+    User::LeaveIfError( iFsSession.Connect() );
+    }
+    
+//-----------------------------------------------------------------------------
+// 
+//-----------------------------------------------------------------------------
+//
+void CFastFindFileServerPlugin::EnableL()
+    {
+    WRITELOG( "CFastFindFileServerPlugin::EnableL()" );
+    User::LeaveIfError( RegisterIntercept(EFsFileCreate, EPostIntercept) );
+    User::LeaveIfError( RegisterIntercept(EFsFileRename, EPostIntercept) );
+    User::LeaveIfError( RegisterIntercept(EFsRename, EPostIntercept) );
+    User::LeaveIfError( RegisterIntercept(EFsDelete, EPostIntercept) );
+//    User::LeaveIfError( RegisterIntercept(EFsFileReplace, EPostIntercept) );
+    User::LeaveIfError( RegisterIntercept(EFsReplace, EPostIntercept) );
+//    User::LeaveIfError( RegisterIntercept(EFsFileModified, EPostIntercept) );
+    User::LeaveIfError( RegisterIntercept(EFsFileSetModified, EPostIntercept) );
+    User::LeaveIfError( RegisterIntercept(EFsFileSubClose, EPostIntercept) );
+	// format events
+	User::LeaveIfError( RegisterIntercept(EFsFormatSubClose, EPostIntercept) );
+	User::LeaveIfError( RegisterIntercept(EFsFormatOpen, EPostIntercept) );
+
+#ifdef _DEBUG_EVENTS
+    RegisterDebugEventsL();
+#endif
+    }
+    
+//-----------------------------------------------------------------------------
+// 
+//-----------------------------------------------------------------------------
+//
+void CFastFindFileServerPlugin::DisableL()
+    {
+    WRITELOG( "CFastFindFileServerPlugin::DisableL()" );
+    User::LeaveIfError( UnregisterIntercept(EFsFileCreate, EPrePostIntercept) );
+    User::LeaveIfError( UnregisterIntercept(EFsFileRename, EPrePostIntercept) );
+    User::LeaveIfError( UnregisterIntercept(EFsRename, EPrePostIntercept) );
+    User::LeaveIfError( UnregisterIntercept(EFsDelete, EPrePostIntercept) );
+//    User::LeaveIfError( UnregisterIntercept(EFsFileReplace, EPrePostIntercept) );
+    User::LeaveIfError( UnregisterIntercept(EFsReplace, EPrePostIntercept) );
+//    User::LeaveIfError( UnregisterIntercept(EFsFileModified, EPrePostIntercept) );
+    User::LeaveIfError( UnregisterIntercept(EFsFileSetModified, EPrePostIntercept) );
+    User::LeaveIfError( UnregisterIntercept(EFsFileSubClose, EPrePostIntercept) );
+	// format events
+	User::LeaveIfError( UnregisterIntercept(EFsFormatSubClose, EPostIntercept) );
+	User::LeaveIfError( UnregisterIntercept(EFsFormatOpen, EPostIntercept) );
+
+#ifdef _DEBUG_EVENTS
+    UnregisterDebugEventsL();
+#endif
+    }
+    
+
+//-----------------------------------------------------------------------------
+// AddConnection
+//-----------------------------------------------------------------------------
+//
+void CFastFindFileServerPlugin::AddConnection()
+    {
+    WRITELOG( "CFastFindFileServerPlugin::AddConnection()" );
+    
+    ++iConnectionCount;
+    }
+
+//-----------------------------------------------------------------------------
+// RemoveConnection
+//-----------------------------------------------------------------------------
+//
+void CFastFindFileServerPlugin::RemoveConnection()
+    {
+    WRITELOG( "CFastFindFileServerPlugin::RemoveConnection()" );
+    
+    --iConnectionCount;
+
+    // remove notification request if this was last connection
+    if ( iConnectionCount <= 0 )
+        {
+        WRITELOG( "CFastFindFileServerPlugin::RemoveConnection() last connection" );
+
+        iNotification = NULL;
+        }
+    }
+
+//-----------------------------------------------------------------------------
+// 
+//-----------------------------------------------------------------------------
+//
+TInt CFastFindFileServerPlugin::DoRequestL( TFsPluginRequest& aRequest )
+	{
+	TInt err = KErrNone;
+	TInt function = aRequest.Function();
+	const TBool formatFunction = function == EFsFormatOpen || function == EFsFormatSubClose;
+
+#ifdef _DEBUG_EVENTS
+    PrintDebugEvents( function );
+#endif
+
+    if ( function == EFsFileSubClose && iCreatedFiles.Count() == 0 )
+        {
+        return KErrNone;
+        }
+
+    WRITELOG1( "----- CFastFindFileServerPlugin::DoRequestL() - plugin function: %d -----", function );
+
+    TFileName fileName;
+    fileName.Zero();
+    TFileName newFileName;
+    newFileName.Zero();
+
+	if ( !formatFunction )
+		{
+		GetName( &aRequest, fileName );
+		WRITELOG1( "CFastFindFileServerPlugin::DoRequestL() - fileName: %S", &fileName );
+		}
+
+    // get process id
+	TUid processId = { 0 };
+
+    /*RThread clientThread;
+    RProcess clientProcess;
+    err = aRequest.Message().Client( clientThread, EOwnerThread );
+    if ( err == KErrNone )
+        {
+        err = clientThread.Process( clientProcess );
+        if ( err == KErrNone )
+            {
+            processId = clientProcess.Identity();
+            }
+        }
+    clientProcess.Close();
+    clientThread.Close();*/
+
+	processId = aRequest.Message().Identity();
+
+    // if rename, check destination path
+    if ( function == EFsRename || function == EFsFileRename || function == EFsReplace )
+        {
+        GetNewName( &aRequest, newFileName );
+        WRITELOG1( "CFastFindFileServerPlugin::DoRequestL() - newFileName: %S", &newFileName );
+        if ( !CheckPath(newFileName) )
+            {
+            WRITELOG( "CFastFindFileServerPlugin::DoRequestL() - path not supported" );
+            return KErrNone;
+            }
+        if ( !CheckAttribs(newFileName) )
+            {
+            WRITELOG( "CFastFindFileServerPlugin::DoRequestL() - attribute check failed" );
+            return KErrNone;
+            }
+        }
+    else if ( !formatFunction )
+        {
+        if ( !CheckPath(fileName) )
+            {
+            WRITELOG( "CFastFindFileServerPlugin::DoRequestL() - path not supported" );
+            return KErrNone;
+            }
+
+        if ( !CheckAttribs(fileName) )
+            {
+            WRITELOG( "CFastFindFileServerPlugin::DoRequestL() - attribute check failed" );
+            return KErrNone;
+            }
+        }
+
+    TInt fileEventType = EFastFindFileUnknown;
+    TInt drvNumber = aRequest.DriveNumber();
+
+    WRITELOG1( "CFastFindFileServerPlugin::DoRequestL() - drive number: %d", drvNumber );
+
+    switch( function )
+        {
+        case EFsFileCreate:
+            {
+            WRITELOG( "CFastFindFileServerPlugin::DoRequestL() - EFsFileCreate" );
+
+            TFileName* fn = new (ELeave) TFileName;
+            fn->Zero();
+            fn->Copy( fileName );
+            iCreatedFiles.Append( fn );
+            User::LeaveIfError( UnregisterIntercept(EFsFileSetModified, EPrePostIntercept) );
+            return KErrNone;
+            }
+
+        case EFsFileSubClose:
+            {
+            WRITELOG( "CFastFindFileServerPlugin::DoRequestL() - EFsFileSubClose" );
+
+            TBool found = EFalse;
+            for ( TInt i = 0; i < iCreatedFiles.Count(); i++ )
+                {
+                TFileName* fn = iCreatedFiles[i];
+                if ( fn->CompareC(fileName,1,NULL) == 0 )
+                    {
+                    fileEventType = EFastFindFileCreated;
+                    delete fn;
+                    fn = NULL;
+                    iCreatedFiles.Remove( i );
+                    found = ETrue;
+                    User::LeaveIfError( RegisterIntercept(EFsFileSetModified, EPostIntercept) );
+                    }
+                }
+
+            if ( !found )
+                {
+                return KErrNone;
+                }
+            }
+            break;
+
+        case EFsRename:
+            {
+            WRITELOG1( "CFastFindFileServerPlugin::DoRequestL() - EFsRenamed, new file: %S", &newFileName );
+            fileEventType = EFastFindFileRenamed;
+            }
+            break;
+
+        case EFsFileRename:
+            WRITELOG1( "CFastFindFileServerPlugin::DoRequestL() - EFsFileRenamed, new file: %S", &newFileName );
+            fileEventType = EFastFindFileRenamed;
+            break;
+
+        case EFsFileSetModified:
+            WRITELOG( "CFastFindFileServerPlugin::DoRequestL() - EFsFileModified" );
+            fileEventType = EFastFindFileModified;
+            break;
+
+        case EFsReplace:
+            WRITELOG1( "CFastFindFileServerPlugin::DoRequestL() - EFsReplace, new file: %S", &newFileName );
+            fileEventType = EFastFindFileReplaced;
+            break;
+
+        case EFsDelete:
+            WRITELOG( "CFastFindFileServerPlugin::DoRequestL() - EFsDelete" );
+            fileEventType = EFastFindFileDeleted;
+            break;
+
+		case EFsFormatOpen:
+			WRITELOG( "CFastFindFileServerPlugin::DoRequestL() - EFsFormatOpen" );
+			// get the drive letter
+			iFormatDriveNumber = drvNumber;
+			fileEventType = EFastFindDriveFormatted;
+			processId.iUid = 0;
+			//return KErrNone;
+			break;
+
+		case EFsFormatSubClose:
+			WRITELOG( "CFastFindFileServerPlugin::DoRequestL() - EFsFormatSubClose" );
+			if ( iFormatDriveNumber < 0 )
+				{
+				return KErrNone;
+				}
+			drvNumber = iFormatDriveNumber;
+			iFormatDriveNumber = -1;
+			fileEventType = EFastFindDriveFormatted;
+			if ( processId.iUid == 0 )
+				{
+				processId.iUid = 1;
+				}
+			break;
+
+        default:
+            WRITELOG( "CFastFindFileServerPlugin::DoRequestL() - Unknown function" );
+            return KErrNone;
+        }
+
+    if ( iNotification )
+        {
+        WRITELOG( "CFastFindFileServerPlugin::DoRequestL() - iNotification found" );
+        TFastFindFSPStatusPckg clientStatusBuf;
+        TFastFindFSPStatus& clientStatus = clientStatusBuf();
+        clientStatus.iDriveNumber = drvNumber;
+        clientStatus.iFileName.Copy( fileName );
+        if ( newFileName.Length() > 0 )
+            {
+            clientStatus.iNewFileName.Copy( newFileName );
+            }
+        clientStatus.iFileEventType = fileEventType;
+        clientStatus.iProcessId = processId;
+
+        TRAP( err, iNotification->WriteParam1L(clientStatusBuf) );
+        iNotification->Complete( err );
+        iNotification = NULL;
+        WRITELOG( "CFastFindFileServerPlugin::DoRequestL() - iNotification complete" );
+        }
+    else // no notification ready, put in the queue
+        {
+        WRITELOG( "CFastFindFileServerPlugin::DoRequestL() - iNotification not found. Put in the queue" );
+
+        TFastFindFSPStatus* clientStatus = new (ELeave) TFastFindFSPStatus;
+        clientStatus->iDriveNumber = drvNumber;
+        clientStatus->iFileName.Copy( fileName );
+        if ( newFileName.Length() > 0 )
+            {
+            clientStatus->iNewFileName.Copy( newFileName );
+            }
+        clientStatus->iFileEventType = fileEventType;
+        clientStatus->iProcessId = processId;
+
+        iQueue.Append( clientStatus ); // owenership is transferred
+        err = KErrNone;
+        WRITELOG( "CFastFindFileServerPlugin::DoRequestL() - added to queue" );
+        }
+
+    WRITELOG( "CFastFindFileServerPlugin::DoRequestL() - return" );
+    return err;
+    }
+
+//-----------------------------------------------------------------------------
+// CFastFindFileServerPluginConn implementation
+//-----------------------------------------------------------------------------
+class CFastFindFileServerPluginConn : public CFsPluginConn
+    {
+    public:
+        static CFastFindFileServerPluginConn* NewL( CFastFindFileServerPlugin& aPlugin );
+        virtual ~CFastFindFileServerPluginConn();
+
+        virtual TInt DoControl( CFsPluginConnRequest& aRequest );
+        virtual void DoRequest( CFsPluginConnRequest& aRequest );
+        virtual void DoCancel( TInt aReqMask );
+
+    private:
+        CFastFindFileServerPluginConn( CFastFindFileServerPlugin& aPlugin );
+
+        CFastFindFileServerPlugin& iPlugin;
+
+        RMessage2* iMessage;
+    };
+    
+/**
+* Leaving New function for the plugin
+* @internalComponent
+*/
+CFastFindFileServerPluginConn* CFastFindFileServerPluginConn::NewL( 
+		CFastFindFileServerPlugin& aPlugin )
+    {
+    WRITELOG( "CFastFindFileServerPluginConn::NewL()" );
+    return new (ELeave) CFastFindFileServerPluginConn( aPlugin );
+    }
+
+
+/**
+* Constructor for the plugin
+* @internalComponent
+*/
+CFastFindFileServerPluginConn::CFastFindFileServerPluginConn(
+               CFastFindFileServerPlugin& aPlugin )
+  : iPlugin( aPlugin )
+    {
+    WRITELOG( "CFastFindFileServerPluginConn::CFastFindFileServerPluginConn()" );
+
+    iPlugin.AddConnection();
+    }
+
+
+/**
+* The destructor for the test virus scanner hook.
+* @internalComponent
+*/
+CFastFindFileServerPluginConn::~CFastFindFileServerPluginConn()
+    {
+    WRITELOG( "CFastFindFileServerPluginConn::~CFastFindFileServerPluginConn()" );
+
+    iPlugin.RemoveConnection();
+    }
+
+//-----------------------------------------------------------------------------
+// 
+//-----------------------------------------------------------------------------
+//
+TInt CFastFindFileServerPluginConn::DoControl( CFsPluginConnRequest& aRequest )
+    {
+    WRITELOG( "CFastFindFileServerPluginConn::DoControl()" );
+    TInt err = KErrNotSupported;
+    
+    CFastFindFileServerPlugin& myPlugin = *(CFastFindFileServerPlugin*)Plugin();
+    
+    switch( aRequest.Function() )
+        {
+        case EFastFindFSPOpEnable:
+            {
+            WRITELOG( "CFastFindFileServerPluginConn::DoControl() - EFastFindFSPOpEnable" );
+            TRAP( err, myPlugin.EnableL() );
+            break;
+            }
+        
+        case EFastFindFSPOpDisable:
+            {
+            WRITELOG( "CFastFindFileServerPluginConn::DoControl() - EFastFindFSPOpDisable" );
+            TRAP( err, myPlugin.DisableL() );
+            break;
+            }
+        
+        default:
+            {
+            WRITELOG( "CFastFindFileServerPluginConn::DoControl() - Unknown Control" );
+            break;            
+            }
+        }
+
+    return err;
+    }
+    
+
+//-----------------------------------------------------------------------------
+// 
+//-----------------------------------------------------------------------------
+//
+void CFastFindFileServerPluginConn::DoRequest( CFsPluginConnRequest& aRequest )
+    {
+    WRITELOG( "CFastFindFileServerPluginConn::DoRequest()" );
+    CFastFindFileServerPlugin& myPlugin = *(CFastFindFileServerPlugin*)Plugin();
+    
+    switch( aRequest.Function() )
+        {
+        case EFastFindFSPOpRegisterNotification:
+            {
+            WRITELOG( "CFastFindFileServerPluginConn::DoControl() - EFastFindFSPOpRegisterNotification" );
+            TInt err = myPlugin.RegisterNotification( aRequest );
+            
+            if ( err != KErrNone )
+                {
+                aRequest.Complete( err );
+                }
+            break;
+            }
+            
+        case EFastFindFSPOpAddNotificationPath:
+            {
+            WRITELOG( "CFastFindFileServerPluginConn::DoControl() - EFastFindFSPOpAddNotificationPath" );
+            TInt err = myPlugin.AddNotificationPath( aRequest );
+            aRequest.Complete( err );
+            break;
+            }
+            
+        case EFastFindFSPOpRemoveNotificationPath:
+            {
+            WRITELOG( "CFastFindFileServerPluginConn::DoControl() - EFastFindFSPOpRemoveNotificationPath" );
+            TInt err = myPlugin.RemoveNotificationPath( aRequest );
+            aRequest.Complete( err );
+            break;
+            }
+            
+        case EFastFindFSPOpAddIgnorePath:
+            {
+            WRITELOG( "CFastFindFileServerPluginConn::DoControl() - EFastFindFSPOpAddIgnorePath" );
+            TInt err = myPlugin.AddIgnorePath( aRequest );
+            aRequest.Complete( err );
+            break;
+            }
+            
+        case EFastFindFSPOpRemoveIgnorePath:
+            {
+            WRITELOG( "CFastFindFileServerPluginConn::DoControl() - EFastFindFSPOpRemoveIgnorePath" );
+            TInt err = myPlugin.RemoveIgnorePath( aRequest );
+            aRequest.Complete( err );
+            break;
+            }
+        }
+    }
+
+//-----------------------------------------------------------------------------
+// 
+//-----------------------------------------------------------------------------
+//
+void CFastFindFileServerPluginConn::DoCancel( TInt /*aReqMask*/ )
+    {
+    WRITELOG( "CFastFindFileServerPluginConn::DoCancel()" );
+    iRequestQue.DoCancelAll( KErrCancel );
+    }
+    
+//-----------------------------------------------------------------------------
+// 
+//-----------------------------------------------------------------------------
+//
+CFsPluginConn* CFastFindFileServerPlugin::NewPluginConnL()
+    {
+    WRITELOG( "CFastFindFileServerPluginConn::NewPluginConnL()" );
+    return CFastFindFileServerPluginConn::NewL( *this );
+    }
+    
+//-----------------------------------------------------------------------------
+// 
+//-----------------------------------------------------------------------------
+//
+TInt CFastFindFileServerPlugin::RegisterNotification( CFsPluginConnRequest& aRequest )
+    {
+    WRITELOG( "CFastFindFileServerPlugin::RegisterNotification()" );
+    
+    if ( iNotification )
+        {
+        return KErrInUse;
+        }
+    
+    iNotification = &aRequest;
+    
+    if ( iQueue.Count() > 0 )
+        {
+        WRITELOG( "CFastFindFileServerPlugin::RegisterNotification() - item in queue" );
+        
+        TFastFindFSPStatus* queueStatus = iQueue[0];
+        
+        TFastFindFSPStatusPckg pckg;
+        TFastFindFSPStatus& status = pckg();
+        
+        status.iDriveNumber = queueStatus->iDriveNumber;
+        status.iFileEventType = queueStatus->iFileEventType;
+        status.iFileName.Copy( queueStatus->iFileName );
+        status.iNewFileName.Copy( queueStatus->iNewFileName );
+        status.iProcessId = queueStatus->iProcessId;
+        
+        TRAPD( err, iNotification->WriteParam1L(pckg) );
+        iNotification->Complete( err );
+        iNotification = NULL;
+        
+        delete queueStatus;
+        queueStatus = NULL;
+        iQueue.Remove( 0 );
+        }
+    
+    return KErrNone;
+    }
+    
+//-----------------------------------------------------------------------------
+// 
+//-----------------------------------------------------------------------------
+//
+TInt CFastFindFileServerPlugin::AddNotificationPath( CFsPluginConnRequest& aRequest )
+    {
+    WRITELOG( "CFastFindFileServerPlugin::AddNotificationPath()" );
+    TInt err = KErrNone;
+    
+    TFastFindFSPStatusPckg pckg;
+    TRAP( err, aRequest.ReadParam1L(pckg) );
+    
+    if ( err != KErrNone )
+        {
+        return err;
+        }
+    
+    TFastFindFSPStatus& status = pckg();
+    
+    if ( status.iFileName.Length() > 0 )
+        {
+        // check if already exists
+        for ( TInt i = 0; i < iPaths.Count(); i++ )
+            {
+            TFileName* tf = iPaths[i];
+            if ( tf->Compare(status.iFileName) == 0 )
+                {
+                return KErrNone;
+                }
+            }
+
+        WRITELOG1( "CFastFindFileServerPlugin::AddNotificationPath() - add path: %S", &status.iFileName );
+        TFileName* fn = new  TFileName;
+        
+        if ( fn )
+            {
+            fn->Copy( status.iFileName );
+            iPaths.Append( fn );
+            }
+        else
+        	{
+        	err = KErrNoMemory;
+        	}
+        }
+    else
+        {
+        err = KErrNotFound;
+        }
+        
+    return err;
+    }
+    
+//-----------------------------------------------------------------------------
+// 
+//-----------------------------------------------------------------------------
+//
+TInt CFastFindFileServerPlugin::RemoveNotificationPath( CFsPluginConnRequest& aRequest )
+    {
+    WRITELOG( "CFastFindFileServerPlugin::RemoveNotificationPath()" );
+    TInt err = KErrNone;
+    
+    TFastFindFSPStatusPckg pckg;
+    TRAP( err, aRequest.ReadParam1L(pckg) );
+    
+    if ( err != KErrNone )
+        {
+        return err;
+        }
+    
+    TFastFindFSPStatus& status = pckg();
+    
+    if ( status.iFileName.Length() > 0 )
+        {
+        // check if already exist
+        if ( iPaths.Count() > 0 )
+            {
+            for ( TInt i = 0; i < iPaths.Count(); i++ )
+                {
+                TFileName* tf = iPaths[i];
+                if ( tf->Compare(status.iFileName) == 0 )
+                    {
+                    WRITELOG1( "CFastFindFileServerPlugin::RemoveNotificationPath() - remove path: %S", &status.iFileName );
+                    delete tf;
+                    tf = NULL;
+                    iPaths.Remove( i );
+                    }
+                }
+            }
+        }
+    else
+        {
+        err = KErrNotFound;
+        }
+        
+    return err;
+    }
+    
+//-----------------------------------------------------------------------------
+// 
+//-----------------------------------------------------------------------------
+//
+TInt CFastFindFileServerPlugin::AddIgnorePath( CFsPluginConnRequest& aRequest )
+    {
+    WRITELOG( "CFastFindFileServerPlugin::AddIgnorePath()" );
+    TInt err = KErrNone;
+    
+    TFastFindFSPStatusPckg pckg;
+    TRAP( err, aRequest.ReadParam1L(pckg) );
+    
+    if ( err != KErrNone )
+        {
+        return err;
+        }
+    
+    TFastFindFSPStatus& status = pckg();
+    
+    if ( status.iFileName.Length() > 0 )
+        {
+        // check if already exist
+        if ( iIgnorePaths.Count() > 0 )
+            {
+            for ( TInt i = 0; i < iIgnorePaths.Count(); i++ )
+                {
+                TFileName* tf = iIgnorePaths[i];
+                if( tf->Compare(status.iFileName) == 0 )
+                    {
+                    return KErrNone;
+                    }
+                }
+            }
+            
+        WRITELOG1( "CFastFindFileServerPlugin::AddIgnorePath() - add path: %S", &status.iFileName );
+        TFileName* fn = new TFileName;
+        
+        if ( fn )
+            {
+            fn->Copy( status.iFileName );
+            iIgnorePaths.Append( fn ); // ownership is transferred
+            }
+        else
+        	{
+        	err = KErrNoMemory;
+        	}
+        }
+    else
+        {
+        err = KErrNotFound;
+        }
+        
+    return err;
+    }
+    
+//-----------------------------------------------------------------------------
+// 
+//-----------------------------------------------------------------------------
+//
+TInt CFastFindFileServerPlugin::RemoveIgnorePath( CFsPluginConnRequest& aRequest )
+    {
+    WRITELOG( "CFastFindFileServerPlugin::RemoveIgnorePath()" );
+    TInt err = KErrNone;
+    
+    TFastFindFSPStatusPckg pckg;
+    TRAP( err, aRequest.ReadParam1L(pckg) );
+    
+    if ( err != KErrNone )
+        {
+        return err;
+        }
+    
+    TFastFindFSPStatus& status = pckg();
+    
+    if ( status.iFileName.Length() > 0 )
+        {
+        // check if already exist
+        if ( iIgnorePaths.Count() > 0 )
+            {
+            for ( TInt i = 0; i < iIgnorePaths.Count(); i++ )
+                {
+                TFileName* tf = iIgnorePaths[i];
+                if ( tf->Compare(status.iFileName) == 0 )
+                    {
+                    WRITELOG1( "CFastFindFileServerPlugin::RemoveIgnorePath() - remove path: %S", &status.iFileName );
+                    delete tf;
+                    tf = NULL;
+                    iIgnorePaths.Remove( i );
+                    }
+                }
+            }
+        }
+    else
+        {
+        err = KErrNotFound;
+        }
+        
+    return err;
+    }
+    
+//-----------------------------------------------------------------------------
+// 
+//-----------------------------------------------------------------------------
+//
+TBool CFastFindFileServerPlugin::CheckPath( TFileName& aFileName )
+    {
+    // check if ignored pathlist
+    if ( iIgnorePaths.Count() > 0 )
+        {
+        for ( TInt i = 0; i < iIgnorePaths.Count(); i++ )
+            {    
+            TFileName* pathName = iIgnorePaths[i];
+            pathName->LowerCase();
+            TFileName tempFileName;
+            tempFileName.Copy( aFileName );
+            tempFileName.LowerCase();
+            // WRITELOG1("CFastFindFileServerPlugin::CheckPath() - search ignore path: %S", pathName);
+            if ( tempFileName.Find(*pathName) != KErrNotFound )
+                {
+                // WRITELOG( "CFastFindFileServerPlugin::CheckPath() - is ignore path" );
+                return EFalse;
+                }
+            }
+        }
+    
+    // check if notification path
+    if ( iPaths.Count() > 0 )
+        {
+        for ( TInt i = 0; i < iPaths.Count(); i++ )
+            {    
+            TFileName* pathName = iPaths[i];
+            pathName->LowerCase();
+            TFileName tempFileName;
+            tempFileName.Copy( aFileName );
+            tempFileName.LowerCase();
+            //WRITELOG1("CFastFindFileServerPlugin::CheckPath() - search path: %S", &pathName);
+            if ( tempFileName.Find(*pathName) != KErrNotFound )
+                {
+                //WRITELOG( "CFastFindFileServerPlugin::CheckPath() - path found" );
+                return ETrue;
+                }
+            }
+        }
+    else
+        {
+        // WRITELOG( "CFastFindFileServerPlugin::CheckPath() - no notification paths" );
+        return ETrue;
+        }
+            
+    return EFalse;
+    }
+    
+//-----------------------------------------------------------------------------
+// CFastFindFileServerPlugin::CheckAttribs()
+//-----------------------------------------------------------------------------
+//
+TBool CFastFindFileServerPlugin::CheckAttribs( TFileName& aFileName )
+    {
+    TParse parse;
+    parse.Set( aFileName, NULL, NULL );
+    TPath path( parse.DriveAndPath() );
+    
+    TUint att = 0;
+    
+    // check if path is hidden or system path
+    TInt err = iFsSession.Att( path, att );
+    if ( err == KErrNone )
+        {
+        if ( att & KEntryAttHidden || att & KEntryAttSystem )
+            {
+            return EFalse;
+            }
+        }
+        
+    // or is the file hidden or system file
+    att = 0;
+    err = iFsSession.Att( aFileName, att );
+    if ( err == KErrNone )
+        {
+        if ( att & KEntryAttHidden || att & KEntryAttSystem )
+            {
+            return EFalse;
+            }
+        }
+        
+    return ETrue;
+    }
+    
+//-----------------------------------------------------------------------------
+// CFastFindFileServerPluginFactory implementation
+//-----------------------------------------------------------------------------
+//
+class CFastFindFileServerPluginFactory : public CFsPluginFactory
+    {
+    public:
+        CFastFindFileServerPluginFactory();
+        virtual TInt Install();            
+        virtual CFsPlugin* NewPluginL();
+        virtual TInt UniquePosition();
+    };
+    
+// Constructor for the plugin factory
+// @internalComponent
+CFastFindFileServerPluginFactory::CFastFindFileServerPluginFactory()
+    {
+    WRITELOG( "CFastFindFileServerPluginFactory::CFastFindFileServerPluginFactory()" );
+    }
+
+// Install function for the plugin factory
+// @internalComponent
+TInt CFastFindFileServerPluginFactory::Install()
+    {
+    WRITELOG( "CFastFindFileServerPluginFactory::Install()" );
+    iSupportedDrives = KPluginAutoAttach;
+    
+    return( SetName(&KFastFindFileServerPlugin) );
+    }
+
+// @internalComponent
+TInt CFastFindFileServerPluginFactory::UniquePosition()
+    {
+    WRITELOG( "CFastFindFileServerPluginFactory::UniquePosition()" );
+    return( KFastFindFSPluginPosition );
+    }
+
+// Plugin factory function
+// @internalComponent
+CFsPlugin* CFastFindFileServerPluginFactory::NewPluginL()
+    {
+    WRITELOG( "CFastFindFileServerPluginFactory::NewPluginL()" );
+    return CFastFindFileServerPlugin::NewL();
+    }
+
+// Create a new Plugin
+// @internalComponent
+extern "C"
+    {
+    EXPORT_C CFsPluginFactory* CreateFileSystem()
+        {
+        WRITELOG( "CFastFindFileServerPluginFactory::CreateFileSystem" );
+        return( new CFastFindFileServerPluginFactory() );
+        }
+    }
+
+#ifdef _DEBUG_EVENTS
+
+//-----------------------------------------------------------------------------
+// 
+//-----------------------------------------------------------------------------
+//
+void CFastFindFileServerPlugin::RegisterDebugEventsL()
+    {
+    User::LeaveIfError( RegisterIntercept( EFsFileDuplicate, EPreIntercept) );
+    User::LeaveIfError( RegisterIntercept( EFsFileCreate, EPreIntercept) );
+    User::LeaveIfError( RegisterIntercept( EFsFileWrite, EPreIntercept) );
+    User::LeaveIfError( RegisterIntercept( EFsFileFlush, EPreIntercept) );
+    User::LeaveIfError( RegisterIntercept( EFsFileSetAtt, EPreIntercept) );
+    User::LeaveIfError( RegisterIntercept( EFsFileChangeMode, EPreIntercept) );
+    User::LeaveIfError( RegisterIntercept( EFsDelete, EPreIntercept) );
+    User::LeaveIfError( RegisterIntercept( EFsFileAdopt, EPreIntercept) );
+    User::LeaveIfError( RegisterIntercept( EFsFileReplace, EPreIntercept) );
+    User::LeaveIfError( RegisterIntercept( EFsFileLock, EPreIntercept) );
+    User::LeaveIfError( RegisterIntercept( EFsFileSize, EPreIntercept) );
+    User::LeaveIfError( RegisterIntercept( EFsFileRename, EPreIntercept) );
+    User::LeaveIfError( RegisterIntercept( EFsRename, EPreIntercept) );
+    User::LeaveIfError( RegisterIntercept( EFsFileOpen, EPreIntercept) );
+    User::LeaveIfError( RegisterIntercept( EFsFileTemp,    EPreIntercept) );
+    User::LeaveIfError( RegisterIntercept( EFsFileUnLock, EPreIntercept) );
+    User::LeaveIfError( RegisterIntercept( EFsFileSetSize, EPreIntercept) );
+    User::LeaveIfError( RegisterIntercept( EFsFileDrive, EPreIntercept) );
+    User::LeaveIfError( RegisterIntercept( EFsReplace, EPreIntercept) );
+    User::LeaveIfError( RegisterIntercept( EFsFileSubClose, EPreIntercept) );
+    User::LeaveIfError( RegisterIntercept( EFsFileRead, EPreIntercept) );
+    User::LeaveIfError( RegisterIntercept( EFsFileSeek, EPreIntercept) );
+    User::LeaveIfError( RegisterIntercept( EFsFileAtt, EPreIntercept) );
+    User::LeaveIfError( RegisterIntercept( EFsFileSet, EPreIntercept) );
+    User::LeaveIfError( RegisterIntercept( EFsFileName, EPreIntercept) );
+    User::LeaveIfError( RegisterIntercept( EFsDirOpen, EPreIntercept) );
+    }
+    
+//-----------------------------------------------------------------------------
+// 
+//-----------------------------------------------------------------------------
+//
+void CFastFindFileServerPlugin::UnregisterDebugEventsL()
+    {
+    User::LeaveIfError( UnregisterIntercept( EFsFileDuplicate, EPrePostIntercept) );
+    User::LeaveIfError( UnregisterIntercept( EFsFileCreate, EPrePostIntercept) );
+    User::LeaveIfError( UnregisterIntercept( EFsFileWrite, EPrePostIntercept) );
+    User::LeaveIfError( UnregisterIntercept( EFsFileFlush, EPrePostIntercept) );
+    User::LeaveIfError( UnregisterIntercept( EFsFileSetAtt, EPrePostIntercept) );
+    User::LeaveIfError( UnregisterIntercept( EFsFileChangeMode, EPrePostIntercept) );
+    User::LeaveIfError( UnregisterIntercept( EFsDelete, EPrePostIntercept) );
+    User::LeaveIfError( UnregisterIntercept( EFsFileAdopt, EPrePostIntercept) );
+    User::LeaveIfError( UnregisterIntercept( EFsFileReplace, EPrePostIntercept) );
+    User::LeaveIfError( UnregisterIntercept( EFsFileLock, EPrePostIntercept) );
+    User::LeaveIfError( UnregisterIntercept( EFsFileSize, EPrePostIntercept) );
+    User::LeaveIfError( UnregisterIntercept( EFsFileRename, EPrePostIntercept) );
+    User::LeaveIfError( UnregisterIntercept( EFsRename, EPrePostIntercept) );
+    User::LeaveIfError( UnregisterIntercept( EFsFileOpen, EPrePostIntercept) );
+    User::LeaveIfError( UnregisterIntercept( EFsFileTemp, EPrePostIntercept) );
+    User::LeaveIfError( UnregisterIntercept( EFsFileUnLock, EPrePostIntercept) );
+    User::LeaveIfError( UnregisterIntercept( EFsFileSetSize, EPrePostIntercept) );
+    User::LeaveIfError( UnregisterIntercept( EFsFileDrive, EPrePostIntercept) );
+    User::LeaveIfError( UnregisterIntercept( EFsReplace, EPrePostIntercept) );
+    User::LeaveIfError( UnregisterIntercept( EFsFileSubClose, EPrePostIntercept) );
+    User::LeaveIfError( UnregisterIntercept( EFsFileRead, EPrePostIntercept) );
+    User::LeaveIfError( UnregisterIntercept( EFsFileSeek, EPrePostIntercept) );
+    User::LeaveIfError( UnregisterIntercept( EFsFileAtt, EPrePostIntercept) );
+    User::LeaveIfError( UnregisterIntercept( EFsFileSet, EPrePostIntercept) );
+    User::LeaveIfError( UnregisterIntercept( EFsFileName, EPrePostIntercept) );
+    User::LeaveIfError( UnregisterIntercept( EFsDirOpen, EPrePostIntercept) );
+    }
+    
+//-----------------------------------------------------------------------------
+// 
+//-----------------------------------------------------------------------------
+//
+void CFastFindFileServerPlugin::PrintDebugEvents( TInt aFunction )
+    {
+    switch ( aFunction )
+        {
+        case EFsFileDuplicate:
+            WRITELOG( "CFastFindFileServerPlugin::PrintDebugEvents() - EFsFileDuplicate" );
+            break;
+            
+        case EFsFileCreate:
+            WRITELOG( "CFastFindFileServerPlugin::PrintDebugEvents() - EFsFileCreate" );
+            break;
+        case EFsFileWrite:
+            WRITELOG( "CFastFindFileServerPlugin::PrintDebugEvents() - EFsFileWrite" );
+            break;
+        case EFsFileFlush:
+            WRITELOG( "CFastFindFileServerPlugin::PrintDebugEvents() - EFsFileFlush" );
+            break;
+        case EFsFileSetAtt:
+            WRITELOG( "CFastFindFileServerPlugin::PrintDebugEvents() - EFsFileSetAtt" );
+            break;
+        case EFsFileChangeMode:
+            WRITELOG( "CFastFindFileServerPlugin::PrintDebugEvents() - EFsFileChangeMode" );
+            break;    
+        case EFsDelete:
+            WRITELOG( "CFastFindFileServerPlugin::PrintDebugEvents() - EFsDelete" );
+            break;    
+        case EFsFileAdopt:
+            WRITELOG( "CFastFindFileServerPlugin::PrintDebugEvents() - EFsFileAdopt" );
+            break;    
+        case EFsFileReplace:
+            WRITELOG( "CFastFindFileServerPlugin::PrintDebugEvents() - EFsFileReplace" );
+            break;    
+        case EFsFileLock:
+            WRITELOG( "CFastFindFileServerPlugin::PrintDebugEvents() - EFsFileLock" );
+            break;    
+        case EFsFileSize:
+            WRITELOG( "CFastFindFileServerPlugin::PrintDebugEvents() - EFsFileSize" );
+            break;    
+        case EFsFileModified:
+            WRITELOG( "CFastFindFileServerPlugin::PrintDebugEvents() - EFsFileModified" );
+            break;    
+        case EFsFileRename:
+            WRITELOG( "CFastFindFileServerPlugin::PrintDebugEvents() - EFsFileRename" );
+            break;    
+        case EFsRename:
+            WRITELOG( "CFastFindFileServerPlugin::PrintDebugEvents() - EFsRename" );
+            break;    
+        case EFsFileOpen:
+            WRITELOG( "CFastFindFileServerPlugin::PrintDebugEvents() - EFsFileOpen" );
+            break;    
+        case EFsFileTemp:
+            WRITELOG( "CFastFindFileServerPlugin::PrintDebugEvents() - EFsFileTemp" );
+            break;    
+        case EFsFileUnLock:
+            WRITELOG( "CFastFindFileServerPlugin::PrintDebugEvents() - EFsFileUnLock" );
+            break;    
+        case EFsFileSetSize:
+            WRITELOG( "CFastFindFileServerPlugin::PrintDebugEvents() - EFsFileSetSize" );
+            break;    
+        case EFsFileSetModified:
+            WRITELOG( "CFastFindFileServerPlugin::PrintDebugEvents() - EFsFileSetModified" );
+            break;
+        case EFsFileDrive:
+            WRITELOG( "CFastFindFileServerPlugin::PrintDebugEvents() - EFsFileDrive" );
+            break;    
+        case EFsReplace:
+            WRITELOG( "CFastFindFileServerPlugin::PrintDebugEvents() - EFsReplace" );
+            break;    
+        case EFsFileSubClose:
+            WRITELOG( "CFastFindFileServerPlugin::PrintDebugEvents() - EFsFileSubClose" );
+            break;    
+        case EFsFileRead:
+            WRITELOG( "CFastFindFileServerPlugin::PrintDebugEvents() - EFsFileRead" );
+            break;
+        case EFsFileSeek:
+            WRITELOG( "CFastFindFileServerPlugin::PrintDebugEvents() - EFsFileSeek" );
+            break;    
+        case EFsFileAtt:
+            WRITELOG( "CFastFindFileServerPlugin::PrintDebugEvents() - EFsFileAtt" );
+            break;    
+        case EFsFileSet:
+            WRITELOG( "CFastFindFileServerPlugin::PrintDebugEvents() - EFsFileSet" );
+            break;    
+        case EFsFileName:
+            WRITELOG( "CFastFindFileServerPlugin::PrintDebugEvents() - EFsFileName" );
+            break;    
+        case EFsDirOpen:
+            WRITELOG( "CFastFindFileServerPlugin::PrintDebugEvents() - EFsDirOpen" );
+            break;    
+        default:
+        break;
+        }
+    }
+#endif
+
+//#ifdef _FORCEDEBUG
+//#undef _DEBUG
+//#undef _FORCEDEBUG
+//#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/harvesterplugins/file/group/bld.inf	Mon Apr 19 14:40:05 2010 +0300
@@ -0,0 +1,23 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: 
+*
+*/
+
+// The file server plugin
+#include "../fastfindfileserverplugin/group/bld.inf"
+
+PRJ_MMPFILES
+fileplugin.mmp
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/harvesterplugins/file/group/fileplugin.mmp	Mon Apr 19 14:40:05 2010 +0300
@@ -0,0 +1,57 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: 
+*
+*/
+
+TARGET        cpixfileplugin.dll
+TARGETTYPE    PLUGIN
+ 
+#include        <platform_paths.hrh>
+CAPABILITY   CAP_GENERAL_DLL -AllFiles -DRM
+#include "../../../harvesterplugins/inc/s60performance.h"
+// ECom Dll recognition UID followed by the unique UID for this dll
+UID           0x10009D8D 0x2001F703 
+
+SOURCEPATH    ../src
+SOURCE        tproxy.cpp
+SOURCE        cfileplugin.cpp
+SOURCE        cfileharvester.cpp
+SOURCE        cfolderrenamedharvester.cpp
+SOURCE        cfilemonitor.cpp
+SOURCE        cmmcmonitor.cpp
+
+USERINCLUDE   ../inc
+USERINCLUDE   ../inc/monitorplugin
+
+APP_LAYER_SYSTEMINCLUDE
+SYSTEMINCLUDE /epoc32/include/ecom
+
+
+SOURCEPATH    ../data
+start RESOURCE 2001f703.rss
+target  cpixfileplugin.rsc
+end
+
+LIBRARY       euser.lib
+LIBRARY       ecom.lib
+LIBRARY       efsrv.lib
+LIBRARY       cpixharvesterplugininterface.lib
+LIBRARY       cpixsearchclient.lib
+LIBRARY       platformenv.lib // Path info
+
+// For logging
+LIBRARY       flogger.lib 
+
+EXPORTUNFROZEN
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/harvesterplugins/file/inc/cfileharvester.h	Mon Apr 19 14:40:05 2010 +0300
@@ -0,0 +1,145 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: 
+ *
+*/
+
+
+#ifndef CFILEHARVESTER_H
+#define CFILEHARVESTER_H
+
+//  INCLUDES 
+
+#include <e32base.h>
+
+#include "cfileplugin.h"
+
+class CFilePlugin;
+
+class CFileHarvester : public CActive
+    {
+    public:
+    
+    	enum TFileHarvesterState
+    		{
+    		EHarvesterIdleState,
+    		EHarvesterStartHarvest,
+    		EHarvesterGetFileId
+    		};
+
+        /**
+        * Construction
+        * @return Harvester image plugin
+        */
+        static CFileHarvester* NewL(CFilePlugin& aFilePlugin, RFs& aFs);
+
+        /**
+        * Destruction
+        */
+        virtual ~CFileHarvester();
+                
+        /**
+        * Start harvesting File items
+        * @param aDriveNumber drive to start harvesting
+        */
+        void StartL( const TDriveNumber aDriveNumber );
+
+        /**
+        * Add ignore paths
+        * @param aDriveNumber drive to add the ignore paths
+        */
+        void AddIgnorePathsL( const TDriveNumber aDriveNumber );
+
+        /**
+        * Remove ignore paths
+        * @param aDriveNumber drive to remove the paths from
+        */
+        void RemoveIgnorePaths( const TDriveNumber aDriveNumber );
+
+    private:  //From CActive
+
+	    /**
+	     * From CACtive.
+	     */
+        void DoCancel();
+
+        /**
+	     * From CACtive.
+         */
+        void RunL();
+
+        /**
+	     * From CACtive.
+	     * @param aError Leave code from RunL()
+	     * @return Error code, KErrNone if error was handled successfully.
+         */
+        TInt RunError( TInt aError );
+    
+    private:
+
+        /**
+        * Private constructor
+        */    
+        CFileHarvester( CFilePlugin& aFilePlugin, RFs& aFs );
+        
+        /**
+        * 2nd phase construction
+        */    
+        void ConstructL();
+        
+        /**
+        * Get next messaging folder 
+        */
+        void GetNextFolderL();
+        
+        /**
+        * Get File identifier
+        */ 
+        void GetFileIdL();
+        
+        /**
+        * Checks if harvesting is ready or not.
+        * @return ETrue, if ready.
+        */
+        void SetNextRequest( TFileHarvesterState aState );
+
+        TInt AddIgnorePathL( const TFileName& aIgnorePath );
+
+        TInt RemoveIgnorePath( const TFileName& aIgnorePath );
+
+        TBool CheckPath( const TFileName& aFileName );
+
+    private:
+        // File plugin for observing
+        CFilePlugin& iFilePlugin; 
+        
+        // File harvester state.
+        TFileHarvesterState iHarvestState;
+        
+        // RFs
+        RFs& iFs;
+
+        // The drive being harvested now
+        TDriveNumber iCurrentHarvestDrive;
+
+        CDir* iDir;
+        CDirScan* iDirscan;
+        TInt iCurrentIndex;
+        TInt iStepNumber;
+        RPointerArray<TFileName> iIgnorePaths;
+    };
+
+#endif // CFILEHARVESTER_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/harvesterplugins/file/inc/cfilemonitor.h	Mon Apr 19 14:40:05 2010 +0300
@@ -0,0 +1,131 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  
+*
+*/
+
+
+#ifndef CFILEMONITOR_H
+#define CFILEMONITOR_H
+
+//  INCLUDES 
+
+#include <e32base.h>
+
+#include "cfileplugin.h"
+#include "fastfindfileserverpluginclient.h"
+
+// FORWARD DECLARATIONS
+class CFolderRenamedHarvester;
+
+class CFileMonitor : public CActive
+  	{
+	public:
+		/**
+		* NewL
+		* @return
+		*/
+		static CFileMonitor* NewL(  CFilePlugin& aFilePlugin, RFs* aFsSession );
+
+		/**
+		* Destructor
+		*/
+		virtual ~CFileMonitor();
+		
+		/**
+		* From 
+		*/
+		TBool StartMonitoring();
+	
+		/**
+		* From 
+		*/
+		TInt Initialize();
+    	
+    	/**
+		* From 
+		*/
+    	TInt Release();
+    	
+    	/**
+		* From 
+		*/
+    	TInt OpenEngine();
+    	
+    	/**
+		* From 
+		*/
+    	void AddNotificationPathsL( const TDriveNumber aDriveNumber );
+    	
+    	/**
+		* From 
+		*/
+    	void RemoveNotificationPaths( const TDriveNumber aDriveNumber );
+    	
+    	/**
+		* From 
+		*/
+    	TInt Enable();
+    	
+    	/**
+		* From 
+		*/
+    	TInt Disable();
+    
+    protected: // CActivi
+        /**
+	     * From CActive.
+	     */
+        void DoCancel();
+
+        /**
+	     * From CActive.
+         */
+        void RunL();
+
+        /**
+	     * From CActive.
+	     * @param aError Leave code from RunL()
+	     * @return Error code, KErrNone if error was handled successfully.
+         */
+        TInt RunError( TInt aError );
+
+    protected:
+		/**
+		* From ConstructL
+		*/
+		void ConstructL( CFilePlugin& aFilePlugin, RFs* aFsSession );
+		
+	private:
+		/**
+		* From Constructor
+		*/
+		CFileMonitor( CFilePlugin& aFilePlugin, RFs* aFsSession );
+
+		/**
+		* Reset status of package
+		*/
+		void ResetStatus();
+
+	private:
+	
+		CFilePlugin&      iFilePlugin;
+		RFastFindFSPEngine iEngine;
+	    RFs* iFsSession;
+	    TFastFindFSPStatusPckg iPckg;
+	    // If a folder name is changed then files in that folder need to be indexed again as path changed.
+	    CFolderRenamedHarvester* iFolderRenamedHarvester;
+	};
+
+#endif // CFILEMONITOR_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/harvesterplugins/file/inc/cfileplugin.h	Mon Apr 19 14:40:05 2010 +0300
@@ -0,0 +1,147 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: 
+ *
+*/
+
+
+#ifndef CFILEPLUGIN_H
+#define CFILEPLUGIN_H
+
+#include <f32file.h> // TDriveNumber
+
+#include <cindexingplugin.h>
+#include <common.h>
+#include <rsearchserversession.h>
+
+class CFileHarvester;
+class CFileMonitor;
+class CMMCMonitor;
+class CCPixIndexer;
+
+// CONSTANTS
+_LIT( KExcludePathSystem, ":\\System\\" );
+_LIT( KExcludePathPrivate, ":\\Private\\" );
+_LIT( KExcludePathMapsCities, ":\\cities\\" );
+
+_LIT( KFastFindFSPluginFile, "cpixfileserverplugin" );
+_LIT( KFastFindFSPluginName, "CPixFileServerPlugin" );
+
+// maximum length that the fully qualified File Plugin base app class descriptor can be
+// e.g. "@c:root file"
+const TInt KFilePluginBaseAppClassMaxLen = 64;
+
+class CFilePlugin : public CIndexingPlugin
+{
+public:
+	static CFilePlugin* NewL();
+	static CFilePlugin* NewLC();
+	virtual ~CFilePlugin();
+	
+	/**
+	 * From CIndexingPlugin
+	 */
+	void StartPluginL();
+	void StartHarvestingL(const TDesC& aQualifiedBaseAppClass);
+
+	/**
+	 * CreateFileIndexItemL sends a file for indexing
+	 * @aFilename full path and filename of the file to be indexed
+	 * @aActionType action to be taken on the file
+	 */
+	void CreateFileIndexItemL(const TDesC& aFilename, TCPixActionType aActionType);
+
+public:
+	// 
+	// New Functions
+	//
+
+	/*
+	 * Notifies the indexing manager of completed harvesting, called by CMessageHarvester
+	 */
+	void HarvestingCompleted(TDriveNumber aDriveNumber, TInt aError);
+
+    /**
+     * Register notification paths to file observer
+     * @aDriveNumber drive to add notification paths
+     */
+    void AddNotificationPathsL(const TDriveNumber aDriveNumber);
+
+    /**
+     * Unregister notification paths to file observer
+     * @aDriveNumber drive to remove notification paths from
+     */
+    void RemoveNotificationPaths(const TDriveNumber aDriveNumber);
+
+	/**
+	 * MountL - Mount an IndexDB.
+	 * @aMedia drive to mount.
+	 * @aForceReharvest force a re-harvest of aMedia
+	 */
+	void MountL(TDriveNumber aMedia, TBool aForceReharvest = EFalse);
+
+	/**
+	 * UnMount - Dismount a IndexDB for drive aMedia.
+	 * @aMedia drive to unmount.
+	 * @aUndefineAsWell if ETrue then undefine the volume as well
+	 * 
+	 */
+	void UnMount(TDriveNumber aMedia, TBool aUndefineAsWell);
+
+	/**
+	 * FormBaseAppClass - constructs a baseAppClass for the given drive.
+	 * @aMedia drive to form the baseAppClass for.
+	 * @aBaseAppClass return descriptor containing the baseAppClass
+	 * returns KErrNone on success or a standard error code
+	 */
+	static TInt FormBaseAppClass(TDriveNumber aMedia, TDes& aBaseAppClass);
+	
+	
+	/**
+	 * DatabasePathL - Forms IndexDb path.
+	 * @param aMedia - The drive for which the path should be constructed.
+	 * returns pointer to the IndexDb path.
+	 */
+	HBufC* DatabasePathLC(TDriveNumber aMedia);
+
+protected:
+	CFilePlugin();
+	void ConstructL();
+
+private:
+    // CPix database 
+    CCPixIndexer* iIndexer[EDriveZ+1]; // EDriveZ enum value is 25, so add 1.
+
+    // File system session
+    RFs iFs;
+
+    // Harvester
+    CFileHarvester* iHarvester;
+
+    // Monitor
+    TBool iIsMonitorInit;
+    CFileMonitor* iMonitor;
+
+    // MMC monitor
+    CMMCMonitor* iMmcMonitor;
+
+#ifdef __PERFORMANCE_DATA
+    TTime iStartTime[26];// for the all drives
+    TTime iCompleteTime;
+    void UpdatePerformaceDataL(TDriveNumber aMedia);
+	TInt i;
+#endif
+};
+
+#endif // CFILEPLUGIN_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/harvesterplugins/file/inc/cfolderrenamedharvester.h	Mon Apr 19 14:40:05 2010 +0300
@@ -0,0 +1,142 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: 
+ *
+*/
+
+
+#ifndef CFOLDERRENAMEDHARVESTER_H
+#define CFOLDERRENAMEDHARVESTER_H
+
+//  INCLUDES 
+#include <e32base.h>
+
+class CFilePlugin;
+
+class CFolderRenamedItem : public CBase
+	{
+public:
+	static CFolderRenamedItem * NewL ( const TDesC &aOldName, const TDesC &aNewName );
+
+	virtual ~CFolderRenamedItem();
+
+	const TDesC& OldName();
+	const TDesC& NewName();
+
+private:
+	CFolderRenamedItem();
+	void ConstructL( const TDesC &aOldName, const TDesC &aNewName );
+
+private:
+	HBufC *iOldName;
+	HBufC *iNewName;
+	};
+
+class CFolderRenamedHarvester : public CActive
+    {
+    public:
+
+    	enum TFileHarvesterState
+    		{
+    		EFolderRenamedIdleState,
+    		EFolderRenamedStartHarvest,
+    		EFolderRenamedGetFileId
+    		};
+
+        /**
+        * Construction
+        * @return Harvester image plugin
+        */
+        static CFolderRenamedHarvester* NewL(CFilePlugin& aFilePlugin, RFs& aFs);
+
+        /**
+        * Destruction
+        */
+        virtual ~CFolderRenamedHarvester();
+
+        /**
+        * Start harvesting File items
+        * @return ETrue, if ready.
+        */
+        TBool StartL( const TFileName& aOldDirectoryName, const TFileName& aNewDirectoryName );
+
+    private:  //From CActive
+
+	    /**
+	     * From CACtive.
+	     */
+        void DoCancel();
+
+        /**
+	     * From CACtive.
+         */
+        void RunL();
+
+        /**
+	     * From CACtive.
+	     * @param aError Leave code from RunL()
+	     * @return Error code, KErrNone if error was handled successfully.
+         */
+        TInt RunError( TInt aError );
+
+    private:
+
+        /**
+        * Private constructor
+        */    
+    	CFolderRenamedHarvester( CFilePlugin& aFilePlugin, RFs& aFs );
+
+        /**
+        * 2nd phase construction
+        */    
+        void ConstructL();
+
+        /**
+        * Get next messaging folder 
+        */
+        void GetNextFolderL();
+
+        /**
+        * Get File identifier
+        */ 
+        void GetFileIdL();
+
+        /**
+        * Checks if harvesting is ready or not.
+        * @return ETrue, if ready.
+        */
+        void SetNextRequest( TFileHarvesterState aState );
+
+    private:
+        // File plugin for observing
+        CFilePlugin& iFilePlugin; 
+
+        // File harvester state.
+        TFileHarvesterState iHarvestState;
+
+        // RFs
+        RFs& iFs;
+        CDir* iDir;
+        CDirScan* iDirscan;
+        TInt iCurrentIndex;
+        TInt iStepNumber;
+
+        TFileName iOldFolderName;
+        TFileName iNewFolderName;
+        RPointerArray <CFolderRenamedItem> iRenamedFolders;
+    };
+
+#endif // CFOLDERRENAMEDHARVESTER_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/harvesterplugins/file/inc/cmmcmonitor.h	Mon Apr 19 14:40:05 2010 +0300
@@ -0,0 +1,115 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Mmc monitor
+*
+*/
+
+#ifndef CMMCMONITOR_H
+#define CMMCMONITOR_H
+
+//  INCLUDES 
+#include <e32base.h>
+#include <e32property.h>
+#include <driveinfo.h>
+#include <common.h>
+#include "fastfindfileserverpluginclient.h"
+
+// FORWARD DECLARATIONS
+class CFilePlugin;
+
+/**
+ * Mmc monitoring
+ * Implements CActive
+ */
+class CMMCMonitor : public CActive
+    {
+    public:
+        /**
+         * NewL
+         * @param CFilePlugin& aFilePlugin File plugin handle
+         * @param RFs* aFsSession File server handle
+         * @return CMMCMonitor Monitor item
+         */
+        static CMMCMonitor* NewL( CFilePlugin& aFilePlugin, RFs* aFsSession );
+
+        /**
+         * Destructor
+         */
+        virtual ~CMMCMonitor();
+
+        /**
+         * StartMonitoring
+         * Start monitoring mmc
+         * This function calls CMMCMonitor::RunL() to initiate the MMC status 
+         * checking.
+         * @return TBool success status
+         */
+        TBool StartMonitoring();
+
+        /**
+         * MmcStatus
+         * Utility function that checks the DriveInfo properties of drive
+         * aDriveNumber to decide if aDriveNumber is an MMC drive or not.
+         * @param aDriveNumber, the drive of the Mmc.
+         * @return ETrue indicates that aDriveNumber is a MMC drive.
+         */
+        TBool MmcStatus( TInt aDriveNumber );
+
+    protected: // CActive
+        /**
+         * From CActive.
+         */
+        void DoCancel();
+
+        /**
+         * From CActive.
+         * 
+         */
+        void RunL();
+
+        /**
+         * From CActive.
+         * @param aError Leave code from RunL()
+         * @return hard-coded KErrNone
+         */
+        TInt RunError( TInt aError );
+
+    private:
+        /**
+         * Constructor
+         * @param CFilePlugin& aFilePlugin File plugin
+         */
+        CMMCMonitor( CFilePlugin& aFilePlugin );
+
+        /**
+         * 2nd phase construction
+         * @param RFs* aFsSession File server session
+         */
+        void ConstructL( RFs* aFsSession );
+
+    private: // data members
+        // handle to file plugin main class
+        CFilePlugin& iFilePlugin;
+        // file monitor client engine
+        RFastFindFSPEngine iEngine;
+        // File system handle
+        RFs* iFsSession;
+        // inserted/ejected status of mmc
+        TBool iMmcStatus;
+        // MMC Inserted/ejected property
+        RProperty iProperty;
+    };
+
+#endif // CMMCMONITOR_H
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/harvesterplugins/file/inc/monitorplugin/fastfindfileserverpluginclient.h	Mon Apr 19 14:40:05 2010 +0300
@@ -0,0 +1,125 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Monitors file creations, modifications and deletions.
+ *
+*/
+
+
+#ifndef FASTFINDFILESERVERPLUGINCLIENT_H
+#define FASTFINDFILESERVERPLUGINCLIENT_H
+
+enum TFastFindFSPOperation
+	{
+	EFastFindFSPOpEnable,
+	EFastFindFSPOpDisable,
+	EFastFindFSPOpRegisterNotification,
+	EFastFindFSPOpAddNotificationPath,
+	EFastFindFSPOpRemoveNotificationPath,
+	EFastFindFSPOpAddIgnorePath,
+	EFastFindFSPOpRemoveIgnorePath,
+	EFastFindFSPOpNotificationCancel,
+	};
+
+class TFastFindFSPStatus
+	{
+	public:
+		TInt iFileEventType;
+		TInt iDriveNumber;
+		TFileName iFileName;
+		TFileName iNewFileName;
+        TUid iProcessId;
+	};
+
+enum TFastFindFileEventType
+	{
+	EFastFindFileCreated,
+	EFastFindFileRenamed,
+	EFastFindFileModified,
+	EFastFindFileReplaced,
+	EFastFindFileDeleted,
+	EFastFindDriveFormatted,
+	EFastFindFileUnknown,
+	};
+
+typedef TPckgBuf<TFastFindFSPStatus> TFastFindFSPStatusPckg;
+
+const TInt KFastFindFSPluginPosition = 0x2001F6FA; // 0x2000FB14;
+
+//#ifndef __FASTFINDFILESERVERPLUGIN_H__
+//#define __FASTFINDFILESERVERPLUGIN_H__
+
+#include <f32file.h>
+#include <f32file_private.h>
+
+/**
+ * 
+ */
+class RFastFindFSPEngine : public RPlugin
+	{
+	public:
+
+		/**
+		 * Register...
+		 * @param aFastFindFSPStatus ...
+		 * @param aStat  TRequestStatus for asyncronous operation.
+		 */
+		inline void RegisterNotification( TFastFindFSPStatusPckg& aFastFindFSPStatus,
+				TRequestStatus& aStat);
+
+		/**
+		 * Adds a new path to monitor.
+		 * @param aPath  Path to add.
+		 */
+		inline void AddNotificationPath( const TDesC& aPath );
+
+		/**
+		 * Removes a path from list of monitored paths.
+		 * @param aPath  Path to remove.
+		 */
+		inline void RemoveNotificationPath( const TDesC& aPath );
+
+		/**
+		 * Adds a new ignored path.
+		 * @param aPath Path descriptor.
+		 */
+		inline void AddIgnorePath( const TDesC& aPath );
+
+		/**
+		 * Removes a ignored path from the list.
+		 * @param aPath Path descriptor.
+		 */
+		inline void RemoveIgnorePath( const TDesC& aPath );
+
+		/**
+		 * Enable plugin.
+		 * @return Error code.
+		 */
+		inline TInt Enable();
+
+		/**
+		 * Disable plugin.
+		 * @return Error code.
+		 */
+		inline TInt Disable();
+
+		/**
+		 * Cancel notifications.
+		 */
+		inline void NotificationCancel();
+	};
+
+#include "fastfindfileserverpluginclient.inl"  // inlined methods
+
+#endif // FASTFINDFILESERVERPLUGINCLIENT_H
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/harvesterplugins/file/inc/monitorplugin/fastfindfileserverpluginclient.inl	Mon Apr 19 14:40:05 2010 +0300
@@ -0,0 +1,91 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Monitors file creations, modifications and deletions.
+ *
+*/
+
+
+inline TInt RFastFindFSPEngine::Enable()
+	{
+	return DoControl( EFastFindFSPOpEnable );
+	}
+
+inline TInt RFastFindFSPEngine::Disable()
+	{
+	return DoControl( EFastFindFSPOpDisable );
+	}
+
+inline void RFastFindFSPEngine::RegisterNotification(
+		TFastFindFSPStatusPckg& aFastFindFSPStatus, TRequestStatus& aStat )
+	{
+	DoRequest( EFastFindFSPOpRegisterNotification, aStat, aFastFindFSPStatus );
+	}
+
+inline void RFastFindFSPEngine::AddNotificationPath( const TDesC& aPath )
+	{
+	TFastFindFSPStatusPckg pckg;
+	TRequestStatus rs;
+	TFastFindFSPStatus& status = pckg();
+
+	status.iFileName.Zero();
+	status.iFileName.Copy( aPath );
+
+	DoRequest( EFastFindFSPOpAddNotificationPath, rs, pckg );
+	User::WaitForRequest( rs );
+	}
+
+inline void RFastFindFSPEngine::RemoveNotificationPath( const TDesC& aPath )
+	{
+	TFastFindFSPStatusPckg pckg;
+	TRequestStatus rs;
+	TFastFindFSPStatus& status = pckg();
+
+	status.iFileName.Zero();
+	status.iFileName.Copy( aPath );
+
+	DoRequest( EFastFindFSPOpRemoveNotificationPath, rs, pckg );
+	User::WaitForRequest( rs );
+	}
+
+inline void RFastFindFSPEngine::AddIgnorePath (const TDesC& aPath )
+	{
+	TFastFindFSPStatusPckg pckg;
+	TRequestStatus rs;
+	TFastFindFSPStatus& status = pckg();
+
+	status.iFileName.Zero();
+	status.iFileName.Copy( aPath );
+
+	DoRequest( EFastFindFSPOpAddIgnorePath, rs, pckg );
+	User::WaitForRequest( rs );
+	}
+
+inline void RFastFindFSPEngine::RemoveIgnorePath( const TDesC& aPath )
+	{
+	TFastFindFSPStatusPckg pckg;
+	TRequestStatus rs;
+	TFastFindFSPStatus& status = pckg();
+
+	status.iFileName.Zero();
+	status.iFileName.Copy( aPath );
+
+	DoRequest( EFastFindFSPOpRemoveIgnorePath, rs, pckg );
+	User::WaitForRequest( rs );
+	}
+
+inline void RFastFindFSPEngine::NotificationCancel()
+	{
+	DoCancel( EFastFindFSPOpNotificationCancel );
+	}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/harvesterplugins/file/src/cfileharvester.cpp	Mon Apr 19 14:40:05 2010 +0300
@@ -0,0 +1,458 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: 
+*
+*/
+
+
+//  INCLUDES 
+#include <e32base.h>
+#include <pathinfo.h>
+#include <bautils.h>
+
+// For Logging
+#include "harvesterserverlogger.h"
+#include "cfileharvester.h"
+
+// CONSTANTS
+_LIT( KFileMask, "*.*" );
+const TInt KItemsPerRun = 1;
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// ---------------------------------------------------------------------------
+// CFileHarvester::NewL
+// ---------------------------------------------------------------------------
+//
+CFileHarvester* CFileHarvester::NewL( CFilePlugin& aFilePlugin, RFs& aFs )
+	{
+	CFileHarvester* self = new (ELeave) CFileHarvester( aFilePlugin, aFs );
+	CleanupStack::PushL(self);
+	self->ConstructL();
+	CleanupStack::Pop(self);
+	return self;
+	}
+
+// ---------------------------------------------------------------------------
+// CFileHarvester::~CFileHarvester
+// ---------------------------------------------------------------------------
+//
+CFileHarvester::~CFileHarvester()
+    {
+    Cancel();
+    delete iDir;
+    delete iDirscan;
+    iIgnorePaths.ResetAndDestroy();
+    iIgnorePaths.Close();
+    }
+
+
+// ---------------------------------------------------------------------------
+// CFileHarvester::CFileHarvester
+// ---------------------------------------------------------------------------
+//
+CFileHarvester::CFileHarvester( CFilePlugin& aFilePlugin, RFs& aFs )
+  : CActive( CActive::EPriorityIdle ),
+    iFilePlugin( aFilePlugin ),
+    iFs( aFs )
+    {
+    CPIXLOGSTRING("ENTER CFileHarvester::CFileHarvester");
+    CActiveScheduler::Add( this );
+    CPIXLOGSTRING("END CFileHarvester::CFileHarvester");
+    }
+
+
+// ---------------------------------------------------------------------------
+// CFileHarvester::ConstructL
+// ---------------------------------------------------------------------------
+//
+void CFileHarvester::ConstructL()
+    {
+    iDirscan = CDirScan::NewL( iFs );
+    }
+
+
+// ---------------------------------------------------------------------------
+// CFileHarvester::StartL
+// ---------------------------------------------------------------------------
+//
+void CFileHarvester::StartL( const TDriveNumber aDriveNumber )
+    {
+    CPIXLOGSTRING("ENTER CFileHarvester::Start");
+
+    TFileName rootPath;
+    User::LeaveIfError( PathInfo::GetRootPath( rootPath, aDriveNumber ) );
+
+	iDirscan->SetScanDataL( rootPath, KEntryAttDir|KEntryAttMatchExclusive,
+				ESortNone, // No need to sort data
+				CDirScan::EScanDownTree );
+	iCurrentHarvestDrive = aDriveNumber;
+	SetNextRequest( EHarvesterStartHarvest );
+    CPIXLOGSTRING("END CFileHarvester::Start");
+    }
+
+
+// -----------------------------------------------------------------------------
+// CFileHarvester::AddIgnorePathsL
+// -----------------------------------------------------------------------------
+//
+void CFileHarvester::AddIgnorePathsL( const TDriveNumber aDriveNumber )
+    {
+    TFileName ignorePath;
+    TChar chr;
+    User::LeaveIfError( RFs::DriveToChar( aDriveNumber, chr ) );
+
+    ignorePath.Append( chr );
+    ignorePath.Append( KExcludePathSystem );
+    AddIgnorePathL( ignorePath );
+    CPIXLOGSTRING2("CFileHarvester::AddIgnorePathsL - AddIgnorePath: %S", &ignorePath );
+
+    ignorePath.Zero();
+
+    // As index databases are located under \\Private\\ path,
+    // this ignore path will mean index databases are also ignored.
+    ignorePath.Append( chr );
+    ignorePath.Append( KExcludePathPrivate );
+    AddIgnorePathL( ignorePath );
+    CPIXLOGSTRING2("CFileHarvester::AddIgnorePathsL - AddIgnorePath: %S", &ignorePath );
+
+    ignorePath.Zero();
+
+    // Maps data must not be indexed
+    ignorePath.Append( chr );
+    ignorePath.Append( KExcludePathMapsCities );
+    AddIgnorePathL( ignorePath );
+    CPIXLOGSTRING2("CFileHarvester::AddIgnorePathsL - AddIgnorePath: %S", &ignorePath );
+    }
+
+
+// -----------------------------------------------------------------------------
+// CFileHarvester::RemoveIgnorePaths
+// -----------------------------------------------------------------------------
+//
+void CFileHarvester::RemoveIgnorePaths( const TDriveNumber aDriveNumber )
+    {
+    TFileName ignorePath;
+    TChar chr;
+    RFs::DriveToChar( aDriveNumber, chr );
+
+    ignorePath.Append( chr );
+    ignorePath.Append( KExcludePathSystem );
+    RemoveIgnorePath( ignorePath );
+    CPIXLOGSTRING2("CFileHarvester::RemoveIgnorePaths - RemoveIgnorePath: %S", &ignorePath );
+
+    ignorePath.Zero();
+
+    // As index databases are located under \\Private\\ path,
+    // this ignore path will mean index databases are also ignored.
+    ignorePath.Append( chr );
+    ignorePath.Append( KExcludePathPrivate );
+    RemoveIgnorePath( ignorePath );
+    CPIXLOGSTRING2("CFileHarvester::RemoveIgnorePaths - RemoveIgnorePath: %S", &ignorePath );
+
+    ignorePath.Zero();
+
+    // Maps
+    ignorePath.Append( chr );
+    ignorePath.Append( KExcludePathMapsCities );
+    RemoveIgnorePath( ignorePath );
+    CPIXLOGSTRING2("CFileHarvester::RemoveIgnorePaths - RemoveIgnorePath: %S", &ignorePath );
+    }
+
+
+// -----------------------------------------------------------------------------
+// CFileHarvester::AddIgnorePathL
+// -----------------------------------------------------------------------------
+//
+TInt CFileHarvester::AddIgnorePathL( const TFileName& aIgnorePath )
+    {
+    TInt err( KErrNotFound );
+
+    if ( aIgnorePath.Length() > 0 )
+        {
+        // check if already exist
+        if ( iIgnorePaths.Count() > 0 )
+            {
+            for ( TInt i = 0; i < iIgnorePaths.Count(); i++ )
+                {
+                TFileName* tf = iIgnorePaths[i];
+                if( tf->Compare(aIgnorePath) == 0 )
+					{
+					return KErrNone;
+					}
+				}
+			}
+        TFileName* fn = new(ELeave) TFileName;
+        
+        if ( fn )
+            {
+            fn->Copy( aIgnorePath );
+            iIgnorePaths.Append( fn ); // ownership is transferred
+            }
+        else
+        	{
+        	err = KErrNoMemory;
+        	}
+        }
+    else
+        {
+        err = KErrNotFound;
+        }
+        
+    return err;
+	}
+
+
+// -----------------------------------------------------------------------------
+// CFileHarvester::RemoveIgnorePath
+// -----------------------------------------------------------------------------
+//
+TInt CFileHarvester::RemoveIgnorePath( const TFileName& aIgnorePath )
+    {
+    TInt err( KErrNotFound );
+
+    if ( aIgnorePath.Length() > 0 )
+        {
+        // check if already exist
+        if ( iIgnorePaths.Count() > 0 )
+            {
+            for ( TInt i = 0; i < iIgnorePaths.Count(); i++ )
+                {
+                TFileName* tf = iIgnorePaths[i];
+                if ( tf->Compare(aIgnorePath) == 0 )
+                    {
+                    CPIXLOGSTRING2( "CFileHarvester::RemoveIgnorePath() - remove path: %S", &aIgnorePath );
+                    delete tf;
+                    tf = NULL;
+                    iIgnorePaths.Remove( i );
+                    }
+                }
+            }
+        }
+    else
+        {
+        err = KErrNotFound;
+        }
+        
+    return err;
+    }
+
+
+// -----------------------------------------------------------------------------
+// CFileHarvester::CheckPath
+// -----------------------------------------------------------------------------
+//
+TBool CFileHarvester::CheckPath( const TFileName& aFileName )
+	{
+	// check if ignored pathlist
+	const TInt count( iIgnorePaths.Count() );
+
+	if ( count > 0 )
+		{
+		for ( TInt i = 0; i < count; i++ )
+			{    
+			TFileName* pathName = iIgnorePaths[i];
+			pathName->LowerCase();
+			TFileName tempFileName;
+			tempFileName.Copy( aFileName );
+			tempFileName.LowerCase();
+			if ( tempFileName.Find(*pathName) != KErrNotFound )
+				{
+				CPIXLOGSTRING( "CFileHarvester::CheckPath() - is ignore path" );
+				return EFalse;
+				}
+			}
+		}
+	return ETrue;
+	}
+
+
+// ---------------------------------------------------------------------------
+// CFileHarvester::GetNextFolderL
+// ---------------------------------------------------------------------------
+//		
+void CFileHarvester::GetNextFolderL()
+    {
+    CPIXLOGSTRING("ENTER CFileHarvester::GetNextFolderL");
+
+    delete iDir;
+    iDir = NULL;
+    // Documentation: CDirScan::NextL() The caller of this function 
+    // is responsible for deleting iDir after the function has returned.
+    iDirscan->NextL(iDir);
+
+    if ( iDir )
+    	{
+        // if folder is in ignore path then skip it
+        if ( !CheckPath( iDirscan->FullPath() ) )
+        	{
+			CPIXLOGSTRING("CFileHarvester::GetNextFolderL - IF EHarvesterStartHarvest");
+        	SetNextRequest( EHarvesterStartHarvest );
+        	}
+        else
+			{
+			CPIXLOGSTRING("CFileHarvester::GetNextFolderL - IF EHarvesterGetFileId");
+			SetNextRequest( EHarvesterGetFileId );
+			}
+    	}
+    else
+        {
+        CPIXLOGSTRING("CFileHarvester::GetNextFolderL - IF EHarvesterIdle");
+        SetNextRequest( EHarvesterIdleState );
+        }
+    CPIXLOGSTRING("END CFileHarvester::GetNextFolderL");
+    }
+
+
+// ---------------------------------------------------------------------------
+// CFileHarvester::GetFileIdL
+// 
+// ---------------------------------------------------------------------------
+//
+void CFileHarvester::GetFileIdL()
+    {
+    CPIXLOGSTRING("ENTER CFileHarvester::GetFileId");
+
+    if( iCurrentIndex == 0 )
+        {
+        TParse parse;
+        parse.Set(KFileMask(), &( iDirscan->FullPath() ), NULL);
+
+        // FindWildByPath assigns iDir = NULL, then allocates the memory for it.
+        // Therefore must delete iDir first.
+        delete iDir;
+        iDir = NULL;
+
+        TFindFile find( iFs );
+        find.FindWildByPath(parse.FullName(), NULL, iDir);
+        }
+
+    if( iDir )
+        {
+        const TInt count(iDir->Count());
+        while( ( iCurrentIndex < count ) && ( iStepNumber < KItemsPerRun ) )
+            {
+            TEntry aEntry = (*iDir)[iCurrentIndex];
+            // Check if entry is a hidden or system file
+            // if true -> continue until find something to index or have checked whole directory
+            if( !aEntry.IsHidden() && !aEntry.IsSystem() && !aEntry.IsDir() )
+                {
+                TParse fileParser;
+                fileParser.Set( iDirscan->FullPath(), &(*iDir)[iCurrentIndex].iName, NULL );
+                iFilePlugin.CreateFileIndexItemL(fileParser.FullName(), ECPixAddAction);
+                // TODO: If this is not TRAPPED, state machine breaks 
+                iStepNumber++;
+                }
+            iCurrentIndex++;
+            }
+
+        iStepNumber = 0;
+
+        if( iCurrentIndex >= count )
+            {
+            iCurrentIndex = 0;
+            SetNextRequest( EHarvesterStartHarvest );
+            }
+        else
+            {
+            SetNextRequest( EHarvesterGetFileId );
+            }
+        }
+    else
+        {
+        SetNextRequest( EHarvesterStartHarvest );
+        }
+    CPIXLOGSTRING("END CFileHarvester::GetFileId");
+    }
+
+
+// -----------------------------------------------------------------------------
+// CFileHarvester::DoCancel
+// -----------------------------------------------------------------------------
+//   
+void CFileHarvester::DoCancel()
+	{
+    CPIXLOGSTRING("CFileHarvester::DoCancel");
+	}
+
+
+// -----------------------------------------------------------------------------
+// CFileHarvester::RunL
+// -----------------------------------------------------------------------------
+//   
+void CFileHarvester::RunL()
+    {
+    CPIXLOGSTRING("ENTER CFileHarvester::RunL");
+    // Simple Round-Robin scheduling.
+    Deque();
+    CActiveScheduler::Add( this );
+
+    switch ( iHarvestState )
+        {
+		case EHarvesterIdleState:
+			{
+			iFilePlugin.HarvestingCompleted(iCurrentHarvestDrive, KErrNone);
+			break;
+			}
+
+		case EHarvesterGetFileId:
+			{
+			GetFileIdL();
+			break;
+			}
+		
+		case EHarvesterStartHarvest:
+			{
+			GetNextFolderL();
+			break;
+			}
+
+		default:
+			break;
+		}
+	CPIXLOGSTRING("END CFileHarvester::RunL");
+	}
+
+
+// -----------------------------------------------------------------------------
+// CFileHarvester::RunError
+// -----------------------------------------------------------------------------
+//   
+TInt CFileHarvester::RunError(TInt aError)
+	{
+    CPIXLOGSTRING2("CFileHarvester::RunError - aError: %d", aError );
+	iHarvestState = EHarvesterIdleState;
+    iFilePlugin.HarvestingCompleted(iCurrentHarvestDrive, aError);
+	return KErrNone;
+	}
+
+
+// ---------------------------------------------------------------------------
+// SetNextRequest
+// ---------------------------------------------------------------------------
+//
+void CFileHarvester::SetNextRequest( TFileHarvesterState aState )
+    {
+    CPIXLOGSTRING("CFileHarvester::SetNextRequest");
+    if ( !IsActive() )
+        {
+        iHarvestState = aState;
+        SetActive();
+        TRequestStatus* status = &iStatus;
+        User::RequestComplete( status, KErrNone );
+        }
+    }
+
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/harvesterplugins/file/src/cfilemonitor.cpp	Mon Apr 19 14:40:05 2010 +0300
@@ -0,0 +1,384 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  
+*
+*/
+
+
+// INCLUDE FILES
+#include <pathinfo.h>
+
+#include "cfilemonitor.h"
+#include "cfolderrenamedharvester.h"
+#include "harvesterserverlogger.h"
+
+// -----------------------------------------------------------------------------
+// CFileMonitor::NewL
+// -----------------------------------------------------------------------------
+//
+CFileMonitor* CFileMonitor::NewL(  CFilePlugin& aFilePlugin, RFs* aFsSession )
+	{
+	CFileMonitor* self = new ( ELeave ) CFileMonitor( aFilePlugin, aFsSession );
+	CleanupStack::PushL(self);
+	self->ConstructL(aFilePlugin, aFsSession);
+	CleanupStack::Pop(self);
+	return self;
+	}
+
+// -----------------------------------------------------------------------------
+// CFileMonitor::CFileMonitor
+// -----------------------------------------------------------------------------
+//
+CFileMonitor::CFileMonitor( CFilePlugin& aFilePlugin, RFs* aFsSession ) :
+                            CActive(CActive::EPriorityStandard),
+                            iFilePlugin( aFilePlugin )
+    {
+    CPIXLOGSTRING("ENTER CFileMonitor::CFileMonitor");
+    CActiveScheduler::Add(this);
+    iFsSession = aFsSession;
+    CPIXLOGSTRING("END CFileMonitor::CFileMonitor");
+    }
+
+// -----------------------------------------------------------------------------
+// CFileMonitor::~CFileMonitor
+// -----------------------------------------------------------------------------
+//
+CFileMonitor::~CFileMonitor() 
+	{
+	CPIXLOGSTRING("ENTER ~CFileMonitor");
+	Cancel();
+	iEngine.Disable();
+	iEngine.Close();
+	delete iFolderRenamedHarvester;
+	CPIXLOGSTRING("END ~CFileMonitor");	
+	}
+
+// -----------------------------------------------------------------------------
+// CFileMonitor::ConstructL
+// -----------------------------------------------------------------------------
+//
+void CFileMonitor::ConstructL( CFilePlugin& aFilePlugin, RFs* aFsSession )
+    {
+    iFolderRenamedHarvester = CFolderRenamedHarvester::NewL(aFilePlugin, *aFsSession);
+    }
+
+// -----------------------------------------------------------------------------
+// CFileMonitor::RunError
+// -----------------------------------------------------------------------------
+//
+TInt CFileMonitor::RunError( TInt aError )
+	{
+	CPIXLOGSTRING2( "CFileMonitor::RunError %d", aError );
+	return KErrNone;
+	}
+
+// -----------------------------------------------------------------------------
+// CFileMonitor::DoCancel
+// -----------------------------------------------------------------------------
+//
+void CFileMonitor::DoCancel()
+	{
+	iEngine.NotificationCancel();
+	}
+
+// -----------------------------------------------------------------------------
+// CFileMonitor::RunL
+// -----------------------------------------------------------------------------
+//	
+void CFileMonitor::RunL()
+    {
+    CPIXLOGSTRING("ENTER CFileMonitor::RunL");
+    Deque();
+    CActiveScheduler::Add( this );
+    
+    /*
+    Handle pkg here
+    It has event type and other stuff
+    Execute event and pass params to FilePlugin
+    */
+
+    // TODO TFileName on stack twice - consider allocating on heap!
+    TFastFindFSPStatus& status = iPckg();
+    const TDesC& fileNameOld = status.iFileName;
+    const TDesC& fileNameNew = status.iNewFileName;
+    
+    /*
+    * IMPORTANT:
+    * Rename of whole directory happens as change to every file in dir.
+    * We get an event of every file in dir.
+    */
+    CPIXLOGSTRING2("CFileMonitor::RunL, status.iFileEventType: %i", status.iFileEventType );    
+    switch(status.iFileEventType)
+		{
+		case EFastFindFileCreated:
+			{
+			CPIXLOGSTRING2("CFileMonitor::RunL, EFastFindFileCreated old = %S", &fileNameOld);
+			CPIXLOGSTRING2("CFileMonitor::RunL, EFastFindFileCreated new = %S", &fileNameNew);
+            // File creation (for example over PC suite) gives fileNameOld as the created files, fileNameOld is empty.
+            iFilePlugin.CreateFileIndexItemL(fileNameOld, ECPixAddAction);
+			}
+		break;
+		
+		case EFastFindFileModified:
+			{
+			// This event can be generated by some file manager applications 
+			// when copying a file to a new destination.
+			// Introduce a small delay, so that file copying can complete before
+			// cpix opens the file for indexing. Without the delay, sometimes file 
+			// indexing fails as CLucene cannot open the file for indexing.
+			
+			// Decided to block the CPiXHarvesterServer thread rather than introduce 
+			// new active object state into the CFileMonitor.
+			User::After(50000); // 0.05 seconds
+			
+			CPIXLOGSTRING2("CFileMonitor::RunL, EFastFindFileModified old = %S", &fileNameOld);
+			CPIXLOGSTRING2("CFileMonitor::RunL, EFastFindFileModified new = %S", &fileNameNew);
+			// File copy, fileNameOld contains the file name, fileNameNew is empty
+			iFilePlugin.CreateFileIndexItemL(fileNameOld, ECPixUpdateAction);
+			}
+		break;
+		
+		case EFastFindFileRenamed:
+			{
+			CPIXLOGSTRING2("CFileMonitor::RunL, EFastFindFileRenamed old = %S", &fileNameOld);
+			CPIXLOGSTRING2("CFileMonitor::RunL, EFastFindFileRenamed new = %S", &fileNameNew);
+			TEntry entry; 
+			if ( iFsSession->Entry( fileNameNew, entry ) == KErrNone ) 
+				{
+				if ( !entry.IsDir() )
+					{
+					if (fileNameOld.Length()>0 && fileNameOld.Compare(fileNameNew)!=0)
+						{
+						iFilePlugin.CreateFileIndexItemL(fileNameOld, ECPixRemoveAction);
+						}
+					iFilePlugin.CreateFileIndexItemL(fileNameNew, ECPixUpdateAction);
+					}
+				else
+					{
+					iFolderRenamedHarvester->StartL(fileNameOld, fileNameNew);
+					}
+				}
+			}
+		break;
+		
+		case EFastFindFileReplaced:
+			{
+			CPIXLOGSTRING2("CFileMonitor::RunL, EFastFindFileReplaced old = %S", &fileNameOld);
+			CPIXLOGSTRING2("CFileMonitor::RunL, EFastFindFileReplaced new = %S", &fileNameNew);
+			// File rename (funnily), fileNameOld contains the old file name, fileNameNew the new name
+			if (fileNameOld.Length()>0 && fileNameOld.Compare(fileNameNew)!=0)
+				iFilePlugin.CreateFileIndexItemL(fileNameOld, ECPixRemoveAction);
+			iFilePlugin.CreateFileIndexItemL(fileNameNew, ECPixUpdateAction);
+			}
+		break;
+				
+		case EFastFindFileDeleted:
+			{
+			CPIXLOGSTRING2("CFileMonitor::RunL, EFastFindFileDeleted old = %S", &fileNameOld);
+			CPIXLOGSTRING2("CFileMonitor::RunL, EFastFindFileDeleted new = %S", &fileNameNew);
+			// File delete, fileNameOld contains the name of the deleted file
+			iFilePlugin.CreateFileIndexItemL(fileNameOld, ECPixRemoveAction);
+			}
+		break;
+
+		default:
+			{
+			CPIXLOGSTRING2("CFileMonitor::RunL, unknown event old = %S", &fileNameOld);
+			CPIXLOGSTRING2("CFileMonitor::RunL, unknown event new = %S", &fileNameNew);
+			}
+		break;
+		}
+    ResetStatus();
+    iEngine.RegisterNotification(iPckg, iStatus);
+    CPIXLOGSTRING("END CFileMonitor::RunL");
+    SetActive();
+    }
+
+// -----------------------------------------------------------------------------
+// CFileMonitor::StartMonitoring
+// -----------------------------------------------------------------------------
+//
+TBool CFileMonitor::StartMonitoring()
+	{
+	CPIXLOGSTRING("ENTER CFileMonitor::StartMonitoring")
+    
+    if ( !IsActive() )
+		{
+		CPIXLOGSTRING("CFileMonitor::StartMonitoring - IF ")
+		iEngine.Enable();
+		ResetStatus();
+	    iEngine.RegisterNotification( iPckg, iStatus );
+	    SetActive();
+		}
+    
+	CPIXLOGSTRING("END CFileMonitor::StartMonitoring");	
+		
+	return ETrue;
+	}
+
+// ---------------------------------------------------------------------------
+// CFileMonitor::ResetStatus
+// ---------------------------------------------------------------------------
+//
+void CFileMonitor::ResetStatus()
+    {
+    CPIXLOGSTRING( "CFileMonitor::ResetStatus" );
+    
+    TFastFindFSPStatus& status = iPckg();
+    
+    status.iDriveNumber = 0;
+    status.iFileEventType = EFastFindFileUnknown;
+    status.iFileName.Zero();
+    status.iNewFileName.Zero();
+    status.iProcessId = TUid::Null();
+    }
+
+// -----------------------------------------------------------------------------
+// CFileMonitor::Initialize
+// -----------------------------------------------------------------------------
+//	
+TInt CFileMonitor::Initialize()
+    {
+    CPIXLOGSTRING("ENTER CFileMonitor::Initialize");
+    TInt err = OpenEngine();
+    CPIXLOGSTRING2("CFileMonitor::Initialize - OpenEngine: %i", err );
+	if ( err != KErrNone )
+		{
+		CPIXLOGSTRING("CFileMonitor::Initialize if( err != KErrNone ) ");
+		return err;
+		}
+	
+	CPIXLOGSTRING("END CFileMonitor::Initialize");
+	return err;
+    }
+
+// -----------------------------------------------------------------------------
+// CFileMonitor::Release
+// -----------------------------------------------------------------------------
+//
+TInt CFileMonitor::Release()
+    {
+    iEngine.Disable();
+	iEngine.Close();
+	
+	return KErrNone;
+    }
+    
+// -----------------------------------------------------------------------------
+// CFileMonitor::OpenEngine
+// -----------------------------------------------------------------------------
+//
+TInt CFileMonitor::OpenEngine()
+    {
+    TInt err = iEngine.Open( *iFsSession, KFastFindFSPluginPosition );
+	return err;
+    }
+    
+// -----------------------------------------------------------------------------
+// CFileMonitor::AddNotificationPathsL
+// -----------------------------------------------------------------------------
+//
+void CFileMonitor::AddNotificationPathsL( const TDriveNumber aDriveNumber )
+    {
+    TFileName notificationPath;
+    TChar chr;
+    User::LeaveIfError( RFs::DriveToChar( aDriveNumber, chr ) );
+
+    notificationPath.Append( chr );
+    notificationPath.Append( KExcludePathSystem );
+    iEngine.AddIgnorePath( notificationPath );
+	CPIXLOGSTRING2("CFileMonitor::AddNotificationPathsL - AddIgnorePath: %S", &notificationPath );
+
+    notificationPath.Zero();
+
+    // As index databases are located under \\Private\\ path,
+    // this ignore path will mean index databases are also ignored.
+    notificationPath.Append( chr );
+    notificationPath.Append( KExcludePathPrivate );
+    iEngine.AddIgnorePath( notificationPath );
+    CPIXLOGSTRING2("CFileMonitor::AddNotificationPathsL - AddIgnorePath: %S", &notificationPath );
+
+    notificationPath.Zero();
+
+    // Maps data must not be indexed
+    notificationPath.Append( chr );
+    notificationPath.Append( KExcludePathMapsCities );
+    iEngine.AddIgnorePath( notificationPath );
+    CPIXLOGSTRING2("CFileMonitor::AddNotificationPathsL - AddIgnorePath: %S", &notificationPath );
+
+    notificationPath.Zero();
+
+    User::LeaveIfError( PathInfo::GetRootPath( notificationPath, aDriveNumber ) );
+    iEngine.AddNotificationPath( notificationPath );
+    CPIXLOGSTRING2("CFileMonitor::AddNotificationPathsL - AddNotificationPath: %S", &notificationPath );
+    }
+
+// -----------------------------------------------------------------------------
+// CFileMonitor::RemoveNotificationPaths
+// -----------------------------------------------------------------------------
+//
+void CFileMonitor::RemoveNotificationPaths( const TDriveNumber aDriveNumber )
+    {
+    TFileName ignorePath;
+    TChar chr;
+    RFs::DriveToChar( aDriveNumber, chr );
+
+    ignorePath.Append( chr );
+    ignorePath.Append( KExcludePathSystem );
+    iEngine.RemoveIgnorePath( ignorePath );
+    CPIXLOGSTRING2("CFileMonitor::RemoveNotificationPaths - RemoveIgnorePath: %S", &ignorePath );
+
+    ignorePath.Zero();
+
+    // As index databases are located under \\Private\\ path,
+    // this ignore path will mean index databases are also ignored.
+    ignorePath.Append( chr );
+    ignorePath.Append( KExcludePathPrivate );
+    iEngine.RemoveIgnorePath( ignorePath );
+    CPIXLOGSTRING2("CFileMonitor::RemoveNotificationPaths - RemoveIgnorePath: %S", &ignorePath );
+
+    ignorePath.Zero();
+
+    // Maps
+    ignorePath.Append( chr );
+    ignorePath.Append( KExcludePathMapsCities );
+    iEngine.RemoveIgnorePath( ignorePath );
+    CPIXLOGSTRING2("CFileMonitor::RemoveNotificationPaths - RemoveIgnorePath: %S", &ignorePath );
+
+    ignorePath.Zero();
+
+    PathInfo::GetRootPath( ignorePath, aDriveNumber );
+    iEngine.RemoveNotificationPath( ignorePath );
+    CPIXLOGSTRING2("CFileMonitor::RemoveNotificationPaths - RemoveNotificationPath: %S", &ignorePath );
+    }
+
+// -----------------------------------------------------------------------------
+// CFileMonitor::Enable
+// -----------------------------------------------------------------------------
+//
+TInt CFileMonitor::Enable()
+    {
+    return iEngine.Enable();
+    }
+    
+// -----------------------------------------------------------------------------
+// CFileMonitor::Disable
+// -----------------------------------------------------------------------------
+//
+TInt CFileMonitor::Disable()
+    {
+    return iEngine.Disable();
+    }
+
+// End Of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/harvesterplugins/file/src/cfileplugin.cpp	Mon Apr 19 14:40:05 2010 +0300
@@ -0,0 +1,486 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  
+*
+*/
+
+
+#include <e32base.h>
+#include <pathinfo.h> // PathInfo
+#include <driveinfo.h> // TDriveInfo
+#include "cfileplugin.h"
+#include "harvesterserverlogger.h"
+#include "cfileharvester.h"
+#include "cfileplugin.h"
+#include "cfilemonitor.h"
+#include "cmmcmonitor.h"
+#include <rsearchserversession.h>
+#include <csearchdocument.h>
+#include <common.h>
+
+#include <ccpixindexer.h>
+
+// local declarations and functions
+namespace {
+
+_LIT(KCPixSearchServerPrivateDirectory, "\\Private\\2001f6f7\\");
+_LIT(KPathIndexDbPath, CPIX_INDEVICE_INDEXDB);
+
+_LIT(KPathTrailer, "\\root\\file");
+_LIT(KFileBaseAppClassGeneric, ":root file");
+_LIT(KFilePluginAtSign, "@");
+_LIT(KFilePluginColon, ":");
+
+/**
+* MapFileToDrive - returns the TDriveNumber that the file is located on.
+* @aFilename filename
+* @aDrive returns the TDriveNumber
+* returns KErrNone on success or a standard error code
+*/
+TInt MapFileToDrive(const TDesC& aFilename, TDriveNumber& aDrive)
+    {
+    TParse file;
+    file.Set(aFilename, NULL, NULL);
+    TPtrC drvChar = file.Drive().Left(1);
+    TChar d(drvChar[0]);
+
+    TInt drive;
+    const TInt ret = RFs::CharToDrive(d, drive);
+    if (!ret)
+        {
+        aDrive = TDriveNumber(drive);
+        }
+    return ret;
+    }
+
+/**
+* MapBaseAppClassToDrive - gets the TDriveNumber associated with the aBaseAppClass.
+* @aBaseAppClass e.g. "@c:root file"
+* @aDrive returns the TDriveNumber for the aBaseAppClass
+* returns KErrNone on success or a standard error code
+*/
+TInt MapBaseAppClassToDrive(const TDesC& aBaseAppClass, TDriveNumber& aDrive)
+    {
+    if (KErrNone != aBaseAppClass.Left(1).Compare(KFilePluginAtSign))
+        {
+        return KErrGeneral;
+        }
+
+    TPtrC drvChar = aBaseAppClass.Left(2).Right(1);
+    TChar d(drvChar[0]);
+    TInt drive;
+    const TInt ret = RFs::CharToDrive(d, drive);
+    if (!ret)
+        {
+        aDrive = TDriveNumber(drive);
+        }
+
+    return ret;
+    }
+
+} // anonymous namespace
+
+CFilePlugin* CFilePlugin::NewL()
+    {
+    CFilePlugin* instance = CFilePlugin::NewLC();
+    CleanupStack::Pop(instance);
+    return instance;
+    }
+
+CFilePlugin* CFilePlugin::NewLC()
+    {
+    CFilePlugin* instance = new (ELeave)CFilePlugin();
+    CleanupStack::PushL(instance);
+    instance->ConstructL();
+    return instance;
+    }
+
+CFilePlugin::CFilePlugin()
+    {
+    for (TInt i=EDriveA; i<=EDriveZ; i++)
+        {
+        iIndexer[i] = NULL; //Initialize to NULL
+        }
+    }
+
+CFilePlugin::~CFilePlugin()
+	{
+	CPIXLOGSTRING("CFilePlugin::~CFilePlugin()");
+
+	// remove notification paths before destroying iMonitor
+	for (TInt i=EDriveA; i<=EDriveZ; i++)
+		{
+		UnMount(TDriveNumber(i), EFalse);
+		}
+	delete iHarvester;
+	delete iMonitor;
+	delete iMmcMonitor;
+
+	TInt err = iFs.DismountPlugin(KFastFindFSPluginName);
+	CPIXLOGSTRING2("CFilePlugin::~CFilePlugin(), iFs.DismountPlugin: %i", err);
+	err = iFs.RemovePlugin(KFastFindFSPluginName);
+	CPIXLOGSTRING2("CFilePlugin::~CFilePlugin(), iFs.RemovePlugin: %i", err);
+	iFs.Close();
+	}
+
+void CFilePlugin::ConstructL()
+	{
+    User::LeaveIfError( iFs.Connect() );
+    TInt err = iFs.AddPlugin(KFastFindFSPluginFile);
+    CPIXLOGSTRING2("CFilePlugin::ConstructL, iFs.AddPlugin: %i", err);
+    if ( err != KErrAlreadyExists )
+    	{
+    	err = iFs.MountPlugin(KFastFindFSPluginName);
+    	CPIXLOGSTRING2("CFilePlugin::ConstructL, iFs.MountPlugin: %i", err);
+    	}
+    // check if already up, unload and reload
+    else if ( err == KErrAlreadyExists )
+    	{
+    	// dismount
+    	TInt err = iFs.DismountPlugin(KFastFindFSPluginName);
+	    CPIXLOGSTRING2("CFilePlugin::ConstructL(), iFs.DismountPlugin: %i", err);
+		err = iFs.RemovePlugin(KFastFindFSPluginName);
+		CPIXLOGSTRING2("CFilePlugin::ConstructL(), iFs.RemovePlugin: %i", err);
+		// if no error reload
+		if ( err == KErrNone )
+			{
+			err = iFs.AddPlugin(KFastFindFSPluginFile);
+			CPIXLOGSTRING2("CFilePlugin::ConstructL, iFs.AddPlugin: %i", err);
+			err = iFs.MountPlugin(KFastFindFSPluginName);
+			CPIXLOGSTRING2("CFilePlugin::ConstructL, iFs.MountPlugin: %i", err);
+			}
+    	}
+
+    iHarvester = CFileHarvester::NewL(*this, iFs);
+    iMonitor = CFileMonitor::NewL(*this, &iFs);
+    iMmcMonitor = CMMCMonitor::NewL(*this, &iFs);
+    }
+
+void CFilePlugin::StartPluginL()
+	{
+    TInt error = KErrNone;
+
+    if (!iIsMonitorInit)
+        {
+        error = iMonitor->Initialize();
+        CPIXLOGSTRING2("CFilePlugin::StartMonitoring, error: %i", error );
+        iIsMonitorInit = ETrue;
+        }
+
+    // Start the monitoring
+    if (error == KErrNone && iIsMonitorInit)
+        {
+        iMonitor->StartMonitoring();
+        CPIXLOGSTRING("CFilePlugin::StartMonitoring - iFileMonitor->StartMonitoring ");
+        }
+
+    iMmcMonitor->StartMonitoring();
+
+    CPIXLOGSTRING("END CFilePlugin::StartMonitoring");
+
+    // Add harvesters for each non removable drive
+    for ( TInt driveNumber = EDriveA; driveNumber <= EDriveZ; driveNumber++ )
+        {
+        if ( iFs.IsValidDrive( driveNumber ) )
+            {
+    		TUint drvStatus( 0 );
+    		TInt err = DriveInfo::GetDriveStatus(iFs, TDriveNumber(driveNumber), drvStatus);
+    		if ( err != KErrNone )
+    			{
+    			continue;
+    			}
+
+    		// Harvest drive that are internal, non-removable, user visible, present
+    		if ( ( drvStatus & DriveInfo::EDriveInternal ) &&
+    			!( drvStatus & DriveInfo::EDriveRemovable ) && // NOT removable
+    			 ( drvStatus & DriveInfo::EDriveUserVisible ) &&
+    			 ( drvStatus & DriveInfo::EDrivePresent ) )
+    			{
+    		    MountL(TDriveNumber(driveNumber));
+    			}
+            }
+        }
+}
+
+void CFilePlugin::MountL(TDriveNumber aMedia, TBool aForceReharvest)
+    {
+    CPIXLOGSTRING("ENTER CFilePlugin::MountL");
+    // Check if already exists
+    if (iIndexer[aMedia])
+        return;
+
+    // Add Notifications paths prior to opening IndexDB.
+    AddNotificationPathsL(aMedia);
+
+    // Form the baseappclass for this media
+    TBuf<KFilePluginBaseAppClassMaxLen> baseAppClass;
+    FormBaseAppClass(aMedia, baseAppClass);
+
+    // Define this volume
+    HBufC* path = DatabasePathLC(aMedia);
+    User::LeaveIfError(iSearchSession.DefineVolume(baseAppClass, *path));
+    CleanupStack::PopAndDestroy(path);
+    
+    // construct and open the database
+    iIndexer[aMedia] = CCPixIndexer::NewL(iSearchSession);
+    iIndexer[aMedia]->OpenDatabaseL(baseAppClass);
+
+    // Add to harvesting queue
+    iObserver->AddHarvestingQueue(this, baseAppClass, aForceReharvest);
+    CPIXLOGSTRING("END CFilePlugin::MountL");
+    }
+
+void CFilePlugin::UnMount(TDriveNumber aMedia, TBool aUndefineAsWell)
+    {
+    CPIXLOGSTRING("ENTER CFilePlugin::UnMount ");
+    // Check if already exists
+    if (!iIndexer[aMedia])
+        {
+        return;
+        }
+
+    // Form the baseappclass for this media
+    TBuf<KFilePluginBaseAppClassMaxLen> baseAppClass;
+    FormBaseAppClass(aMedia, baseAppClass);
+
+    // Remove from harvesting queue
+    iObserver->RemoveHarvestingQueue(this, baseAppClass);
+    
+    // Delete the index object
+    if (iIndexer[aMedia])
+        {
+        delete iIndexer[aMedia];
+        iIndexer[aMedia] = NULL;
+        }
+
+    RemoveNotificationPaths(aMedia);
+
+    if (aUndefineAsWell)
+        {
+        iSearchSession.UnDefineVolume(baseAppClass);
+        }
+    CPIXLOGSTRING("END CFilePlugin::UnMount ");
+    }
+
+void CFilePlugin::StartHarvestingL(const TDesC& aQualifiedBaseAppClass)
+    {
+    CPIXLOGSTRING("ENTER CFilePlugin::StartHarvestingL ");
+    // Map base app class to a drive number
+    TDriveNumber drive(EDriveA); //Initialize to get rid of compiler warning.
+    if (KErrNone != MapBaseAppClassToDrive(aQualifiedBaseAppClass, drive))
+        {
+        User::Leave(KErrGeneral);
+        }
+
+    // Leave if no indexer for this drive
+    if (!iIndexer[drive])
+        {
+        User::Leave(KErrGeneral);
+        }
+
+#ifdef __PERFORMANCE_DATA
+    	iStartTime[drive].UniversalTime();
+#endif
+    // Reset the database
+    iIndexer[drive]->ResetL();
+
+    // Start the actual harvest
+    iHarvester->StartL(drive);
+    CPIXLOGSTRING("END CFilePlugin::StartHarvestingL ");
+    }
+
+void CFilePlugin::CreateFileIndexItemL(const TDesC& aFilename, TCPixActionType aActionType)
+    {
+    TFileName lowerCaseFilename(aFilename);
+    lowerCaseFilename.LowerCase();
+
+    CPIXLOGSTRING3("CFilePlugin::CreateFileIndexItemL lowerCaseFilename = %S aActionType = %d ", 
+					&lowerCaseFilename, aActionType);
+
+	TDriveNumber drive(EDriveA);
+	User::LeaveIfError( MapFileToDrive( lowerCaseFilename, drive ) );
+
+	CCPixIndexer* indexer = iIndexer[drive];
+	if (!indexer)
+		{
+		CPIXLOGSTRING("CFilePlugin::CreateFileIndexItemL(): Could not map file to drive.");
+		return;
+		}
+
+	// Index an empty item if removal action
+	if (aActionType == ECPixRemoveAction)
+		{
+#ifdef _DEBUG
+		TRAPD(err, indexer->DeleteL(lowerCaseFilename));
+		CPIXLOGSTRING2("CFilePlugin::CreateFileIndexItemL(): DeleteL returned %d.", err);
+#else   
+		TRAP_IGNORE( indexer->DeleteL(lowerCaseFilename) );
+#endif
+		}
+	else
+		{
+		// creating CSearchDocument object with unique ID for this application
+		CSearchDocument* index_item = CSearchDocument::NewLC(lowerCaseFilename, KNullDesC, KNullDesC, CSearchDocument::EFileParser);
+
+		// Send for indexing
+		if (aActionType == ECPixAddAction)
+			{
+#ifdef _DEBUG
+			TRAPD(err, indexer->AddL(*index_item));
+	        CPIXLOGSTRING2("CFilePlugin::CreateFileIndexItemL(): AddL returned %d.", err);
+#else
+			TRAP_IGNORE( indexer->AddL(*index_item) );
+#endif
+			}
+		else if (aActionType == ECPixUpdateAction)
+			{
+#ifdef _DEBUG		
+			TRAPD(err, indexer->UpdateL(*index_item));
+	        CPIXLOGSTRING2("CFilePlugin::CreateFileIndexItemL(): UpdateL returned %d.", err);
+#else
+			TRAP_IGNORE( indexer->UpdateL(*index_item) );
+#endif
+			}
+		CleanupStack::PopAndDestroy(index_item);
+		}
+    }
+
+void CFilePlugin::HarvestingCompleted(TDriveNumber aDriveNumber, TInt aError)
+    {
+    CPIXLOGSTRING("ENTER CFilePlugin::HarvestingCompleted ");
+
+    if (iIndexer[aDriveNumber])
+        {
+        Flush(*iIndexer[aDriveNumber]);
+        }
+    TBuf<KFilePluginBaseAppClassMaxLen> baseAppClass;
+    FormBaseAppClass(TDriveNumber(aDriveNumber), baseAppClass);
+#ifdef __PERFORMANCE_DATA
+    TRAP_IGNORE( UpdatePerformaceDataL(aDriveNumber) );
+#endif
+    iObserver->HarvestingCompleted(this, baseAppClass, aError);
+
+    CPIXLOGSTRING("END CFilePlugin::HarvestingCompleted ");
+    }
+
+void CFilePlugin::AddNotificationPathsL(const TDriveNumber aDriveNumber)
+    {
+    CPIXLOGSTRING("ENTER CFilePlugin::AddNotificationPathsL ");
+    iMonitor->AddNotificationPathsL(aDriveNumber);
+    iHarvester->AddIgnorePathsL(aDriveNumber);
+    CPIXLOGSTRING("END CFilePlugin::AddNotificationPathsL ");
+    }
+
+void CFilePlugin::RemoveNotificationPaths(const TDriveNumber aDriveNumber)
+    {
+    CPIXLOGSTRING("ENTER CFilePlugin::RemoveNotificationPaths");
+    iMonitor->RemoveNotificationPaths(aDriveNumber);
+    iHarvester->RemoveIgnorePaths(aDriveNumber);
+    CPIXLOGSTRING("END CFilePlugin::RemoveNotificationPaths");
+    }
+
+TInt CFilePlugin::FormBaseAppClass(TDriveNumber aMedia, TDes& aBaseAppClass)
+    {
+    CPIXLOGSTRING("ENTER CFilePlugin::FormBaseAppClass");
+    TChar chr;
+    const TInt ret = RFs::DriveToChar(aMedia, chr);
+    if (KErrNone == ret)
+        {
+        aBaseAppClass.Copy(KFilePluginAtSign);
+        aBaseAppClass.Append(chr);
+        aBaseAppClass.LowerCase();
+        aBaseAppClass.Append(KFileBaseAppClassGeneric);
+        }
+
+    CPIXLOGSTRING("END CFilePlugin::FormBaseAppClass");
+    return ret;
+    }
+
+HBufC* CFilePlugin::DatabasePathLC(TDriveNumber aMedia)
+    {
+    CPIXLOGSTRING("ENTER CFilePlugin::DatabasePathLC");
+    // Allocate extra space for root path e.g. "C:\\Private\\2001f6f7\\"
+    const TInt KRootPathMaxLength = 30;
+    HBufC* indexDbPath = HBufC::NewLC(KRootPathMaxLength + KPathIndexDbPath().Length() + KPathTrailer().Length());
+    TPtr indexDbPathPtr = indexDbPath->Des();
+
+    // Data caging implementation
+    iFs.CreatePrivatePath(aMedia);
+
+    TChar chr;
+    RFs::DriveToChar(aMedia, chr);
+    indexDbPathPtr.Append(chr);
+    indexDbPathPtr.Append(KFilePluginColon);
+
+    TFileName pathWithoutDrive;
+    iFs.PrivatePath(pathWithoutDrive);
+    indexDbPathPtr.Append(KCPixSearchServerPrivateDirectory);
+
+    indexDbPathPtr.Append(KPathIndexDbPath);
+    indexDbPathPtr.Append(KPathTrailer);
+
+    CPIXLOGSTRING("END CFilePlugin::DatabasePathLC");
+    return indexDbPath;
+    }
+
+#ifdef __PERFORMANCE_DATA
+void CFilePlugin::UpdatePerformaceDataL(TDriveNumber aDriveNumber)
+    {
+    TTime now;
+  	TChar aChar;
+    
+    iCompleteTime.UniversalTime();
+    TTimeIntervalMicroSeconds timeDiff = iCompleteTime.MicroSecondsFrom(iStartTime[aDriveNumber]);
+    
+    RFs fileSession;
+    RFile perfFile;
+    User::LeaveIfError( fileSession.Connect () );
+	RFs::DriveToChar((TInt)aDriveNumber, aChar);	
+    
+    
+    /* Open file if it exists, otherwise create it and write content in it */
+    
+        if(perfFile.Open(fileSession, _L("c:\\data\\FilePerf.txt"), EFileWrite))
+                   User::LeaveIfError(perfFile.Create (fileSession, _L("c:\\data\\FilePerf.txt"), EFileWrite));
+    
+    HBufC8 *heap = HBufC8::NewL(100);
+    TPtr8 ptr = heap->Des();
+    now.HomeTime();
+    TBuf<50> timeString;             
+                
+    _LIT(KOwnTimeFormat,"%:0%H%:1%T%:2%S");
+    now.FormatL(timeString,KOwnTimeFormat);
+    ptr.AppendNum(now.DateTime().Day());
+    ptr.Append(_L("/"));
+    ptr.AppendNum(now.DateTime().Month());
+    ptr.Append(_L("/"));
+    ptr.AppendNum(now.DateTime().Year());
+    ptr.Append(_L(":"));
+    ptr.Append(timeString);
+    ptr.Append(_L("Drive "));
+    ptr.Append(aChar);
+    ptr.Append( _L(" Ani: Time took for Harvesting File is : "));
+    ptr.AppendNum(timeDiff.Int64()/1000) ;
+    ptr.Append(_L(" MilliSeonds \n"));
+    TInt myInt = 0;
+    perfFile.Seek(ESeekEnd,myInt);
+    perfFile.Write (ptr);
+    perfFile.Close ();
+    fileSession.Close ();
+    delete heap;
+    }
+#endif
+
+// End of file
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/harvesterplugins/file/src/cfolderrenamedharvester.cpp	Mon Apr 19 14:40:05 2010 +0300
@@ -0,0 +1,377 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  
+*
+*/
+
+
+//  INCLUDES 
+#include <e32base.h>
+#include <pathinfo.h>
+#include <bautils.h>
+
+// For Logging
+#include "harvesterserverlogger.h"
+
+#include "cfileplugin.h"
+#include "cfolderrenamedharvester.h"
+
+// CONSTANTS
+_LIT( KFileMask, "*.*" );
+const TInt KItemsPerRun = 1;
+
+namespace {
+
+void AppendBackslash( TDes& aDirectory )
+    {
+    const TChar KBackslashChar( '\\' );
+    const TInt lastChar = aDirectory.Length() - 1;
+
+    // If it is directory which not contain backslash. 
+    if ( KBackslashChar != aDirectory[lastChar] )
+       {
+       aDirectory.Append( KBackslashChar );
+       }
+    }
+
+} // namespace
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+
+// ---------------------------------------------------------------------------
+// CFolderRenamedItem::NewL
+// ---------------------------------------------------------------------------
+//
+CFolderRenamedItem * CFolderRenamedItem::NewL(const TDesC &aOldName, const TDesC &aNewName)
+	{
+	CFolderRenamedItem *self = new (ELeave) CFolderRenamedItem();
+	CleanupStack::PushL( self );
+	self->ConstructL( aOldName, aNewName );
+	CleanupStack::Pop( self );
+	return self;
+	}
+
+
+// ---------------------------------------------------------------------------
+// CFolderRenamedItem::~CFolderRenamedItem
+// ---------------------------------------------------------------------------
+//
+CFolderRenamedItem::~CFolderRenamedItem()
+    {
+    delete iOldName;
+    delete iNewName;
+    }
+
+// ---------------------------------------------------------------------------
+// CFolderRenamedItem::CFolderRenamedItem
+// ---------------------------------------------------------------------------
+//
+CFolderRenamedItem::CFolderRenamedItem()
+	{
+	}
+
+
+// ---------------------------------------------------------------------------
+// CFolderRenamedItem::ConstructL
+// ---------------------------------------------------------------------------
+//
+void CFolderRenamedItem::ConstructL(const TDesC &aOldName, const TDesC &aNewName)
+	{
+	iOldName = aOldName.AllocL();
+	iNewName = aNewName.AllocL();
+	}
+
+
+// ---------------------------------------------------------------------------
+// CFolderRenamedItem::OldName
+// ---------------------------------------------------------------------------
+//
+const TDesC& CFolderRenamedItem::OldName()
+	{
+	return *iOldName;
+	}
+
+
+// ---------------------------------------------------------------------------
+// CFolderRenamedItem::NewName
+// ---------------------------------------------------------------------------
+//
+const TDesC& CFolderRenamedItem::NewName()
+	{
+	return *iNewName;
+	}
+
+// ---------------------------------------------------------------------------
+// CFolderRenamedHarvester::NewL
+// ---------------------------------------------------------------------------
+//
+CFolderRenamedHarvester* CFolderRenamedHarvester::NewL(  CFilePlugin& aFilePlugin, RFs& aFs )
+	{
+	CFolderRenamedHarvester* self = new (ELeave) CFolderRenamedHarvester( aFilePlugin, aFs );
+	CleanupStack::PushL(self);
+	self->ConstructL();
+	CleanupStack::Pop(self);
+	return self;
+	}
+
+// ---------------------------------------------------------------------------
+// CFolderRenamedHarvester::~CFolderRenamedHarvester
+// ---------------------------------------------------------------------------
+//
+CFolderRenamedHarvester::~CFolderRenamedHarvester()
+    {
+    delete iDir;
+    delete iDirscan;
+    iRenamedFolders.ResetAndDestroy();
+    iRenamedFolders.Close();
+    Cancel();
+    }
+
+// ---------------------------------------------------------------------------
+// CFolderRenamedHarvester::CFolderRenamedHarvester
+
+// ---------------------------------------------------------------------------
+//
+CFolderRenamedHarvester::CFolderRenamedHarvester(  CFilePlugin& aFilePlugin, RFs& aFs  ) 
+  : CActive( CActive::EPriorityIdle ),
+    iFilePlugin( aFilePlugin ),
+    iFs( aFs )
+    {
+    CPIXLOGSTRING("ENTER CFolderRenamedHarvester::CFolderRenamedHarvester");
+    CActiveScheduler::Add( this );
+    CPIXLOGSTRING("END CFolderRenamedHarvester::CFolderRenamedHarvester");
+    }
+
+
+// ---------------------------------------------------------------------------
+// CFolderRenamedHarvester::ConstructL
+// ---------------------------------------------------------------------------
+//
+void CFolderRenamedHarvester::ConstructL()
+    {
+    iDirscan = CDirScan::NewL( iFs );
+    }
+
+// ---------------------------------------------------------------------------
+// CFolderRenamedHarvester::StartL
+// ---------------------------------------------------------------------------
+//
+TBool CFolderRenamedHarvester::StartL( const TFileName& aOldDirectoryName, 
+									   const TFileName& aNewDirectoryName )
+    {
+    CPIXLOGSTRING("ENTER CFolderRenamedHarvester::Start");
+
+    // Append trailing backslash if required
+    TFileName oldName ( aOldDirectoryName );
+    AppendBackslash( oldName );
+    TFileName newName ( aNewDirectoryName );
+    AppendBackslash( newName );
+
+    CFolderRenamedItem *renameItem = CFolderRenamedItem::NewL( oldName, newName );
+    iRenamedFolders.AppendL( renameItem );
+
+	SetNextRequest( EFolderRenamedIdleState );
+    CPIXLOGSTRING("END CFolderRenamedHarvester::Start");
+    return ETrue;
+    }
+
+// ---------------------------------------------------------------------------
+// CFolderRenamedHarvester::GetNextFolderL
+// ---------------------------------------------------------------------------
+//		
+void CFolderRenamedHarvester::GetNextFolderL()
+    {
+    CPIXLOGSTRING("ENTER CFolderRenamedHarvester::GetNextFolderL");   
+
+    delete iDir;
+    iDir = NULL;
+    // Documentation: CDirScan::NextL() The caller of this function 
+    // is responsible for deleting iDir after the function has returned.
+    iDirscan->NextL(iDir); 
+
+    if( iDir )
+        {
+        CPIXLOGSTRING("CFolderRenamedHarvester::GetNextFolderL - IF EHarvesterGetFileId"); 
+        SetNextRequest( EFolderRenamedGetFileId );
+        }
+    else
+        {
+        CPIXLOGSTRING("CFolderRenamedHarvester::GetNextFolderL - IF EHarvesterIdle");
+
+        // finished folder rename, delete the folder from the array.
+        CFolderRenamedItem *item = iRenamedFolders[0];
+        iRenamedFolders.Remove(0);
+        delete item;
+
+        SetNextRequest( EFolderRenamedIdleState );
+        }
+    CPIXLOGSTRING("END CFolderRenamedHarvester::GetNextFolderL");
+    }
+
+// ---------------------------------------------------------------------------
+// CFolderRenamedHarvester::GetFileIdL
+// 
+// ---------------------------------------------------------------------------
+//		    
+void CFolderRenamedHarvester::GetFileIdL()
+    {
+    CPIXLOGSTRING("ENTER CFolderRenamedHarvester::GetFileId");
+
+    if( iCurrentIndex == 0 )
+        {
+        TParse parse;
+        parse.Set(KFileMask(), &iDirscan->FullPath(), NULL);
+
+        // FindWildByPath assigns iDir = NULL, then allocates the memory for it.
+        // Therefore must delete iDir first.
+        delete iDir;
+        iDir = NULL;
+
+        TFindFile find( iFs );
+        find.FindWildByPath(parse.FullName(), NULL, iDir);
+        }
+
+    if( iDir )
+        {
+        const TInt count(iDir->Count());
+        while( ( iCurrentIndex < count ) && ( iStepNumber < KItemsPerRun ) )
+            {
+            TEntry entry = (*iDir)[iCurrentIndex];
+            // Check if entry is a hidden or system file
+            // if true -> continue until find something to index or have checked whole directory
+            if( !entry.IsHidden() && !entry.IsSystem() && !entry.IsDir() )
+                {
+                TParse fileParser;
+                fileParser.Set( iDirscan->FullPath(), &(*iDir)[iCurrentIndex].iName, NULL );
+
+                TPtrC fileNamePtr = fileParser.FullName();
+                TPtrC leaf( fileNamePtr.Right( fileNamePtr.Length() - iNewFolderName.Length() ) );
+                TFileName oldFileName( iOldFolderName );
+                oldFileName.Append( leaf );
+
+                iFilePlugin.CreateFileIndexItemL( oldFileName, ECPixRemoveAction );
+                iFilePlugin.CreateFileIndexItemL( fileParser.FullName(), ECPixAddAction );
+                // TODO: If this is not TRAPPED, state machine breaks 
+                iStepNumber++;
+                }
+            iCurrentIndex++;
+            }
+            
+        iStepNumber = 0;
+        
+        if( iCurrentIndex >= count )
+            {
+            iCurrentIndex = 0;
+            SetNextRequest( EFolderRenamedStartHarvest );
+            }
+        else
+            {
+            SetNextRequest( EFolderRenamedGetFileId );
+            }
+        }
+    else
+        {
+        SetNextRequest( EFolderRenamedStartHarvest );
+        }
+    CPIXLOGSTRING("END CFolderRenamedHarvester::GetFileId"); 
+    }			
+
+      
+// -----------------------------------------------------------------------------
+// CFolderRenamedHarvester::DoCancel
+// -----------------------------------------------------------------------------
+//   
+void CFolderRenamedHarvester::DoCancel()
+	{
+	CPIXLOGSTRING("CFolderRenamedHarvester::DoCancel");
+	}
+
+// -----------------------------------------------------------------------------
+// CFolderRenamedHarvester::RunL
+// -----------------------------------------------------------------------------
+//   
+void CFolderRenamedHarvester::RunL()
+    {
+    CPIXLOGSTRING("ENTER CFolderRenamedHarvester::RunL");
+     // Simple Round-Robin scheduling.
+    Deque();
+    CActiveScheduler::Add( this );
+
+    switch ( iHarvestState )
+        {
+		case EFolderRenamedIdleState:
+			{
+			if ( iRenamedFolders.Count() == 0 )
+				{
+				return; // Nothing to do.
+				}
+
+			// Some rename folder action to perform
+			iOldFolderName.Copy( iRenamedFolders[0]->OldName() );
+			iNewFolderName.Copy( iRenamedFolders[0]->NewName() );
+
+			iDirscan->SetScanDataL( iRenamedFolders[0]->NewName(),
+						KEntryAttMatchExclusive|KEntryAttNormal,
+						ESortNone, // No need to sort data
+						CDirScan::EScanDownTree );
+			// No break, fall through to EFolderRenamedStartHarvest case
+			}
+		case EFolderRenamedStartHarvest:
+			{
+			GetNextFolderL();
+			break;
+			}
+		case EFolderRenamedGetFileId:
+			{
+			GetFileIdL();
+			break;
+			}
+		default:
+			break;
+        }
+    CPIXLOGSTRING("END CFolderRenamedHarvester::RunL");
+    }
+
+// -----------------------------------------------------------------------------
+// CFolderRenamedHarvester::RunError
+// -----------------------------------------------------------------------------
+//   
+TInt CFolderRenamedHarvester::RunError(TInt aError)
+	{
+    CPIXLOGSTRING2("CFolderRenamedHarvester::RunError - aError: %d", aError );
+    iRenamedFolders.ResetAndDestroy();
+	iHarvestState = EFolderRenamedIdleState;
+	return KErrNone;
+	}
+	
+
+// ---------------------------------------------------------------------------
+// SetNextRequest
+// ---------------------------------------------------------------------------
+//
+void CFolderRenamedHarvester::SetNextRequest( TFileHarvesterState aState )
+    {
+    CPIXLOGSTRING("CFolderRenamedHarvester::SetNextRequest");
+    if ( !IsActive() )
+        {
+        iHarvestState = aState;
+        SetActive();
+        TRequestStatus* status = &iStatus;
+        User::RequestComplete( status, KErrNone );
+        }
+    }
+
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/harvesterplugins/file/src/cmmcmonitor.cpp	Mon Apr 19 14:40:05 2010 +0300
@@ -0,0 +1,232 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Mmc monitor
+*
+*/
+
+
+// INCLUDE FILES
+#include "cmmcmonitor.h"
+#include "cfileplugin.h"
+#include "harvesterserverlogger.h"
+
+#include <pathinfo.h>
+#include <s32file.h>
+#include <f32file.h> // TDriveNumber
+#include <driveinfo.h> // TDriveInfo
+
+#include <uikoninternalpskeys.h>
+
+// CONSTANTS
+// 
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CMMCMonitor::NewL
+// -----------------------------------------------------------------------------
+//
+CMMCMonitor* CMMCMonitor::NewL( CFilePlugin& aFilePlugin, RFs* aFsSession )
+    {
+    CMMCMonitor* self = new ( ELeave ) CMMCMonitor( aFilePlugin );
+    CleanupStack::PushL( self );
+    self->ConstructL( aFsSession );
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+
+// -----------------------------------------------------------------------------
+// CMMCMonitor::CMMCMonitor
+// -----------------------------------------------------------------------------
+//
+CMMCMonitor::CMMCMonitor( CFilePlugin& aFilePlugin )
+    : CActive( CActive::EPriorityStandard ),
+      iFilePlugin( aFilePlugin )
+    {
+    CPIXLOGSTRING("ENTER CMMCMonitor::CMMCMonitor");
+    CActiveScheduler::Add( this );
+    CPIXLOGSTRING("END CMMCMonitor::CMMCMonitor");
+    }
+
+
+// -----------------------------------------------------------------------------
+// CMMCMonitor::~CMMCMonitor
+// -----------------------------------------------------------------------------
+//
+CMMCMonitor::~CMMCMonitor()
+    {
+    CPIXLOGSTRING("ENTER ~CMMCMonitor");
+
+    Cancel();
+    iProperty.Close();
+    CPIXLOGSTRING("END ~CMMCMonitor");
+    }
+
+
+// -----------------------------------------------------------------------------
+// CMMCMonitor::ConstructL
+// -----------------------------------------------------------------------------
+//
+void CMMCMonitor::ConstructL( RFs* aFsSession )
+    {
+    CPIXLOGSTRING("ENTER CMMCMonitor::ConstructL Foobar");
+    iFsSession = aFsSession;
+    
+    TInt error = iProperty.Attach( KPSUidUikon, KUikMMCInserted );
+    if ( error != KErrNone ) CPIXLOGSTRING("END CMMCMonitor::Attach to MMCInserted failed");
+    
+    error = iProperty.Get( KPSUidUikon, KUikMMCInserted, iMmcStatus );
+    if ( error != KErrNone ) 
+    	{
+		CPIXLOGSTRING("CMMCMonitor::Get MMCInserted failed");
+    	} 
+    else if ( iMmcStatus ) 	 
+    	{
+    	CPIXLOGSTRING("CMMCMonitor::MMC card is in");
+    	}
+    else 
+    	{
+    	CPIXLOGSTRING("CMMCMonitor::no MMC card");
+    	}
+
+    // The CFilePlugin::StartMonitoring() will call
+    // CMMCMonitor::StartMonitoring() which will call
+    // CMMCMonitor::RunL().
+    //
+    CPIXLOGSTRING("END CMMCMonitor::ConstructL");
+    }
+
+
+// -----------------------------------------------------------------------------
+// CMMCMonitor::StartMonitoring
+// -----------------------------------------------------------------------------
+//
+TBool CMMCMonitor::StartMonitoring()
+    {
+    CPIXLOGSTRING("ENTER CMMCMonitor::StartMonitoring");
+    TRAP_IGNORE( RunL() ); // Need to TRAP this rather than use RunError
+    CPIXLOGSTRING("END CMMCMonitor::StartMonitoring");
+    return ETrue;
+    }
+
+
+// -----------------------------------------------------------------------------
+// CMMCMonitor::MmcStatus
+// -----------------------------------------------------------------------------
+//
+TBool CMMCMonitor::MmcStatus( TInt aDriveNumber )
+    {
+    TBool isMmcPresent(EFalse);
+
+    if ( iFsSession->IsValidDrive( aDriveNumber ) )
+        {
+        TUint drvStatus( 0 );
+        TInt err = DriveInfo::GetDriveStatus( *iFsSession, aDriveNumber, drvStatus );
+        if ( err )
+            {
+            return EFalse;
+            }
+        // MMC drives are removable and user visible
+        if ( ( drvStatus & DriveInfo::EDriveRemovable ) &&
+             ( drvStatus & DriveInfo::EDriveUserVisible ) )
+                {
+                CPIXLOGSTRING2("CMMCMonitor::MmcStatus Drive Number %d", aDriveNumber);
+                isMmcPresent = ETrue;
+                }
+        }
+    return isMmcPresent;
+    }
+
+
+// -----------------------------------------------------------------------------
+// CMMCMonitor::RunError
+// -----------------------------------------------------------------------------
+//
+TInt CMMCMonitor::RunError( TInt aError )
+    {
+    CPIXLOGSTRING2("CMMCMonitor::RunError Error:",aError);
+    return KErrNone;
+    }
+
+
+// -----------------------------------------------------------------------------
+// CMMCMonitor::DoCancel
+// -----------------------------------------------------------------------------
+//
+void CMMCMonitor::DoCancel()
+    {
+    CPIXLOGSTRING("ENTER CMMCMonitor::DoCancel");
+    iProperty.Cancel();
+    CPIXLOGSTRING("END CMMCMonitor::DoCancel");
+    }
+
+
+// -----------------------------------------------------------------------------
+// CMMCMonitor::RunL
+// -----------------------------------------------------------------------------
+//
+void CMMCMonitor::RunL()
+    {
+    CPIXLOGSTRING("ENTER CMMCMonitor::RunL");
+    iProperty.Subscribe( iStatus );
+    SetActive();
+    User::LeaveIfError( iProperty.Get( KPSUidUikon, KUikMMCInserted, iMmcStatus ) );
+    
+    if ( iMmcStatus )
+    	{
+    	CPIXLOGSTRING("CMMCMonitor::MMC card is in");
+    	}
+    else 
+    	{
+		CPIXLOGSTRING("CMMCMonitor::no MMC card");
+    	}
+
+    for ( TInt driveNumber = EDriveA; driveNumber <= EDriveZ; driveNumber++ )
+        {
+        const TBool foundMmc = MmcStatus( driveNumber );
+        if ( !foundMmc )
+            {
+            continue;
+            }
+
+        // This drive has been recognized as MMC. 
+        TDriveNumber drv = TDriveNumber( driveNumber );
+
+        TUint drvStatus( 0 );
+
+        const TInt err = DriveInfo::GetDriveStatus( *iFsSession, driveNumber, drvStatus );
+        if ( err ) 
+            {
+            continue;  // should not happen
+            }
+
+        if ( drvStatus & DriveInfo::EDrivePresent )
+            {
+            CPIXLOGSTRING("CMMCMonitor::RunL insert event");
+            // Mount MMC and force reharvest
+            iFilePlugin.MountL(drv, ETrue);
+            }
+        else
+            {
+            CPIXLOGSTRING("CMMCMonitor::RunL eject event");
+            // If the MMC has been ejected, then need to dismount 
+            // and undefine the volume
+            iFilePlugin.UnMount(drv, ETrue);
+            }
+        }
+    CPIXLOGSTRING("END CMMCMonitor::RunL");
+    }
+
+// End Of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/harvesterplugins/file/src/tproxy.cpp	Mon Apr 19 14:40:05 2010 +0300
@@ -0,0 +1,38 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Message plugin
+*
+*/
+
+
+
+#include <e32std.h>
+#include <implementationproxy.h>
+#include <cindexingplugin.h>
+#include "cfileplugin.h"
+
+
+// Map the interface UIDs to implementation factory functions
+const TImplementationProxy KImplementationTable[] = 
+	{
+	{{0x2001F703},( TProxyNewLPtr) CFilePlugin::NewL}		
+	};
+
+// Exported proxy for instantiation method resolution
+EXPORT_C const TImplementationProxy* ImplementationGroupProxy( TInt& aTableCount )
+	{
+	aTableCount = sizeof( KImplementationTable ) / sizeof( TImplementationProxy );
+	return KImplementationTable;
+	}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/harvesterplugins/group/bld.inf	Mon Apr 19 14:40:05 2010 +0300
@@ -0,0 +1,29 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: 
+*
+*/
+#include "../contacts/group/bld.inf"
+#include "../messaging/group/bld.inf"
+#include "../file/group/bld.inf"
+#include "../calendar/group/bld.inf"
+#include "../bookmarks/group/bld.inf"
+#include "../applications/group/bld.inf"
+#include "../notes/group/bld.inf"
+#include "../media/group/bld.inf"
+
+
+#include "../tsrc/harvesterplugintester/group/bld.inf"
+
+PRJ_TESTEXPORTS
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/harvesterplugins/inc/s60performance.h	Mon Apr 19 14:40:05 2010 +0300
@@ -0,0 +1,20 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: 
+*
+*/
+
+
+// Uncomment to get harvester plugin performance logs
+//MACRO __PERFORMANCE_DATA
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/harvesterplugins/media/audio/data/20029ab9.rss	Mon Apr 19 14:40:05 2010 +0300
@@ -0,0 +1,47 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: 
+*
+*/
+#include <registryinfo.rh>
+
+// Declares info for one test implementation
+RESOURCE REGISTRY_INFO theInfo
+        {
+        // UID for the DLL       
+		// TODO: Rename dll_uid according to your plugin UID
+        dll_uid = 0x20029AB9;
+        // Declare array of interface info
+        interfaces = 
+                {
+                INTERFACE_INFO
+                        {
+                        // UID of interface that is implemented
+                        interface_uid = 0x2001F700; // CPixSearch Plugin Interface UID
+                        implementations = 
+                                {
+                                // Info for CMessagePlugin
+                                IMPLEMENTATION_INFO
+                                        {
+                                        implementation_uid = 0x20029AB9;
+                                        version_no = 1;
+                                        display_name = "Media harvester plugin";
+                                        default_data = "Media";
+                                        opaque_data = "";
+                                        }
+                                };
+                        }
+                };
+        }
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/harvesterplugins/media/audio/group/audioplugin.mmp	Mon Apr 19 14:40:05 2010 +0300
@@ -0,0 +1,63 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: 
+*
+*/
+
+CAPABILITY   CAP_GENERAL_DLL -AllFiles -DRM
+#include "../../../../harvesterplugins/inc/s60performance.h"
+TARGET        cpixaudioplugin.dll
+TARGETTYPE    PLUGIN
+
+// ECom Dll recognition UID followed by the unique UID for this dll
+UID 0x10009D8D 0x20029AB9
+EPOCSTACKSIZE     0x5000
+EPOCHEAPSIZE      0x50000 0x2000000 // From about 65KB to about 32 MB
+
+SOURCEPATH    ../src
+SOURCE        mediaplugin.cpp
+SOURCE cpixmediaaudiodoc.cpp
+SOURCE        tproxy.cpp
+
+USERINCLUDE   ../inc
+USERINCLUDE   ../../mediautils/inc
+
+APP_LAYER_SYSTEMINCLUDE
+SYSTEMINCLUDE /epoc32/include/ecom
+
+
+SOURCEPATH    ../data
+start RESOURCE 20029ab9.rss
+target  cpixaudioplugin.rsc
+end
+
+LIBRARY       euser.lib
+LIBRARY       ecom.lib
+LIBRARY       efsrv.lib
+STATICLIBRARY cpixmediautils.lib //Media utility library
+LIBRARY       platformenv.lib // Path info
+LIBRARY       cpixharvesterplugininterface.lib
+LIBRARY       cpixsearchclient.lib
+LIBRARY       mdccommon.lib           // mds
+LIBRARY       mdeclient.lib           // mds
+LIBRARY       edbms.lib
+LIBRARY       estor.lib
+LIBRARY       bafl.lib
+// For logging
+LIBRARY 	  flogger.lib 
+//Enable this macro to get harvester performance data
+//MACRO __PERFORMANCE_DATA
+EXPORTUNFROZEN
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/harvesterplugins/media/audio/group/bld.inf	Mon Apr 19 14:40:05 2010 +0300
@@ -0,0 +1,21 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: 
+*
+*/
+
+
+PRJ_MMPFILES
+audioplugin.mmp
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/harvesterplugins/media/audio/inc/cpixmediaaudiodoc.h	Mon Apr 19 14:40:05 2010 +0300
@@ -0,0 +1,62 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  MDS to CPIX Audio Document fetcher 
+ *
+*/
+
+#ifndef CPIXMEDIAAUDIODOC_H_
+#define CPIXMEDIAAUDIODOC_H_
+
+#include "cpixdocfetcher.h"
+
+NONSHARABLE_CLASS(CCPIXMediaAudioDoc) : public CCPIXDocFetcher
+    {
+public:
+    /*
+     * NewL
+     * @return instance of media audio doc
+     */
+    static CCPIXMediaAudioDoc* NewL();
+    /*
+     * NewLC
+     * @return instance of media audio doc
+     */    
+    static CCPIXMediaAudioDoc* NewLC();
+    /*
+     * Destructor
+     */
+    ~CCPIXMediaAudioDoc();
+    //Overwride
+    /*
+     * GetCpixDocumentL get cpix document from mde object
+     * @param CMdEObject& aObject mde object
+     * @param TDesC& aAppClass app class
+     * @param CMdEObjectDef& aObjectDef mde object def
+     * @return instance of CPIX document 
+     */
+    CSearchDocument* GetCpixDocumentL(const CMdEObject& aObject, 
+                                      const TDesC& aAppClass,
+                                      CMdEObjectDef& aObjectDef);    
+private:
+    /*
+     * Second phase constructor
+     */
+    void ConstructL();
+    /*
+     * Default constructor
+     */
+    CCPIXMediaAudioDoc();
+    };
+
+#endif /* CPIXMEDIAAUDIODOC_H_ */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/harvesterplugins/media/audio/inc/mediaplugin.h	Mon Apr 19 14:40:05 2010 +0300
@@ -0,0 +1,134 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Media Audio harvester plugin header
+*
+*/
+
+
+#ifndef CAUDIOPLUGIN_H
+#define CAUDIOPLUGIN_H
+
+#include <cindexingplugin.h>
+#include <e32base.h>
+#include "common.h"
+#include "mediaobjecthandler.h"
+#include "mmceventobserver.h"
+
+//Forward declaration
+class CSearchDocument;
+class CCPixIndexer;
+class CMdeHarvester;
+class CMdeObjectQueueManager;
+class CMdsMediaMonitor;
+class CMdsSessionObjectUtils;
+class CCPIXMediaAudioDoc;
+class CCPixIndexerUtils;
+class CMMCMonitorUtil;
+class CCPIXMDEDbManager;
+class CMDSEntity;
+
+// to get perf data
+//#ifndef __PERFORMANCE_DATA
+//#define __PERFORMANCE_DATA
+//#endif //__PERFORMANCE_DATA
+
+NONSHARABLE_CLASS(CAudioPlugin) : public CIndexingPlugin, 
+                     public MdeMEdiaObserver,
+                     public MMediaObjectHandler,
+                     public MMMCEventObserver
+{
+public:
+    // Constructor and Destructors.
+    /*
+     * NewL
+     * @return instance of Media plugin
+     */
+    static CAudioPlugin *NewL();
+    /*
+     * NewLC
+     * @return instance of Media plugin
+     */
+    static CAudioPlugin *NewLC();
+    /*
+     * Destructor
+     */
+    virtual ~CAudioPlugin();
+    
+public:
+    /* 
+     * Prepares the plugin for StartHarvesterL and also  starts
+     * the favourites db observer.  
+     */
+    void StartPluginL();
+    
+    /*
+     * @description Start the harvester.
+     * @param aQualifiedBaseAppClass the base app class. In this case
+     *        use BOOKMARK_QBASEAPPCLASS
+     * @return void
+     * Leaves in case of errors.
+     */
+    void StartHarvestingL(const TDesC & aQualifiedBaseAppClass);
+    /*
+     * HandleMdeItemL callback from MMediaObjectHandler
+     * @param TItemId aObjId object Id
+     * @param TCPixActionType aActionType cpix action type
+     */
+    void HandleMdeItemL( TItemId aObjId, TCPixActionType aActionType);
+#ifdef __PERFORMANCE_DATA
+    void UpdateLogL();
+#endif
+    /*
+     * HarvestingCompletedL callback from MdeEventHandler
+     */
+    void HarvestingCompletedL();
+    
+    /*
+     * HandleMMCEventL callback from MMMCEventObserver
+     * @param TDriveNumber aDrive drive number of MMC
+     * @param TBool aMMCInsertRemoval ETrue if inserted else EFalse
+     */
+    void HandleMMCEventL(const TDriveNumber aDrive,const TBool aMMCInsertRemoval);
+private:
+    //private constructors.
+    /*
+     * Default constructor
+     */
+    CAudioPlugin();
+    /*
+     * Second phase constructor
+     */
+    void ConstructL();
+    
+private:
+    CCPixIndexer *iIndexer; //Indexer
+    CMdeHarvester* iMdeHarvester; //Mde harvester owned
+    CMdeObjectQueueManager* iObjectJobQueueManager; //Objectqueue manager owned
+    CMdsMediaMonitor*       iMdsMonitor;//MDS monitor owned
+    CMdsSessionObjectUtils* iMdsUtils;//Mds utils owned
+    CCPIXMediaAudioDoc*     iAudioDocument;//MDS audio doc owned
+    CCPixIndexerUtils*      iIndexerUtil;//Indexer util owned
+    CMMCMonitorUtil*        iMMcMonitor;//MMC monitor owned
+    CCPIXMDEDbManager*      iDBManager;
+    CMDSEntity*             iMdsItem;
+    
+#ifdef __PERFORMANCE_DATA
+    TTime iStartTime;
+    TTime iCompleteTime;
+    void UpdatePerformaceDataL();
+	TInt count;
+#endif
+};
+
+#endif // CAUDIOPLUGIN_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/harvesterplugins/media/audio/src/cpixmediaaudiodoc.cpp	Mon Apr 19 14:40:05 2010 +0300
@@ -0,0 +1,139 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  MDS to CPIX Audio Document fetcher 
+*
+*/
+
+
+#include "cpixmediaaudiodoc.h"
+#include <mdeobject.h>
+#include <mdccommon.h>
+#include <mdeitem.h>
+#include <mdeconstants.h>
+#include <mdeobjectdef.h>
+#include "harvesterserverlogger.h"
+
+// -----------------------------------------------------------------------------
+// CCPIXDocFetcher::NewL()
+// -----------------------------------------------------------------------------
+//
+CCPIXMediaAudioDoc* CCPIXMediaAudioDoc::NewL()
+    {
+    CCPIXMediaAudioDoc* self = CCPIXMediaAudioDoc::NewLC();
+    CleanupStack::Pop(self);
+    return self;
+    }
+
+// -----------------------------------------------------------------------------
+// CCPIXDocFetcher::NewLC()
+// -----------------------------------------------------------------------------
+//
+CCPIXMediaAudioDoc* CCPIXMediaAudioDoc::NewLC()
+    {
+    CCPIXMediaAudioDoc* self = new (ELeave) CCPIXMediaAudioDoc();
+    CleanupStack::PushL(self);
+    self->ConstructL();
+    return self;
+    }
+
+// -----------------------------------------------------------------------------
+// CCPIXDocFetcher::~CCPIXMediaAudioDoc()
+// -----------------------------------------------------------------------------
+//
+CCPIXMediaAudioDoc::~CCPIXMediaAudioDoc()
+    {
+    
+    }
+
+// -----------------------------------------------------------------------------
+// CCPIXDocFetcher::CCPIXMediaAudioDoc()
+// -----------------------------------------------------------------------------
+//
+CCPIXMediaAudioDoc::CCPIXMediaAudioDoc()
+    {
+    
+    }
+
+// -----------------------------------------------------------------------------
+// CCPIXDocFetcher::ConstructL()
+// -----------------------------------------------------------------------------
+//
+void CCPIXMediaAudioDoc::ConstructL()
+    {
+    CCPIXDocFetcher::ConstructL();//Must have
+    
+    }
+
+// -----------------------------------------------------------------------------
+// CCPIXDocFetcher::GetCpixDocumentL()
+// -----------------------------------------------------------------------------
+//
+CSearchDocument* CCPIXMediaAudioDoc::GetCpixDocumentL(const CMdEObject& aObject, 
+                                              const TDesC& aAppClass,
+                                              CMdEObjectDef& aObjectDef)
+    {
+    CPIXLOGSTRING("START CCPIXMediaAudioDoc::GetCpixDocumentL");
+    //Get basic document
+    CSearchDocument* index_item = CCPIXDocFetcher::GetCpixDocumentL(aObject,aAppClass,aObjectDef);
+    //URI and Excerpt is done add additional properties here 
+    CMdEProperty* property(NULL);
+    CMdEPropertyDef& albumPropDef = aObjectDef.GetPropertyDefL(MdeConstants::Audio::KAlbumProperty );
+    if(aObject.Property( albumPropDef, property )!= KErrNotFound)
+       {
+       //Add field to document
+       CMdETextProperty* textProperty = ( CMdETextProperty* ) property;
+       AddFiledtoDocumentL(*index_item,
+                           MdeConstants::Audio::KAlbumProperty,
+                           textProperty->Value());
+       }
+    CMdEPropertyDef& artistPropDef = aObjectDef.GetPropertyDefL(MdeConstants::Audio::KAlbumArtistProperty );
+    if(aObject.Property( artistPropDef, property ) != KErrNotFound)
+      {
+      //Add field to document
+      CMdETextProperty* textProperty = ( CMdETextProperty* ) property;
+      AddFiledtoDocumentL(*index_item,
+                         MdeConstants::Audio::KAlbumArtistProperty,
+                         textProperty->Value());
+      }
+    CMdEPropertyDef& origartistPropDef = aObjectDef.GetPropertyDefL(MdeConstants::Audio::KOriginalArtistProperty );
+    if(aObject.Property( origartistPropDef, property ) != KErrNotFound)
+     {
+     //Add field to document
+     CMdETextProperty* textProperty = ( CMdETextProperty* ) property;
+     AddFiledtoDocumentL(*index_item,
+                      MdeConstants::Audio::KOriginalArtistProperty,
+                      textProperty->Value());
+     }   
+    CMdEPropertyDef& composerPropDef = aObjectDef.GetPropertyDefL(MdeConstants::Audio::KComposerProperty );
+    if(aObject.Property( composerPropDef, property ) != KErrNotFound)
+    {
+    //Add field to document
+    CMdETextProperty* textProperty = ( CMdETextProperty* ) property;
+    AddFiledtoDocumentL(*index_item,
+                  MdeConstants::Audio::KComposerProperty,
+                  textProperty->Value());
+    }
+    CMdEPropertyDef& artistPropDef1 = aObjectDef.GetPropertyDefL(MdeConstants::MediaObject::KArtistProperty );
+    if(aObject.Property( artistPropDef1, property ) != KErrNotFound)
+       {
+       //Add field to document
+       CMdETextProperty* textProperty = ( CMdETextProperty* ) property;
+       AddFiledtoDocumentL(*index_item,
+                             MdeConstants::MediaObject::KArtistProperty,
+                             textProperty->Value());
+       }   
+    CPIXLOGSTRING("END CCPIXMediaAudioDoc::GetCpixDocumentL");
+    return index_item;
+    }
+//End of life
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/harvesterplugins/media/audio/src/mediaplugin.cpp	Mon Apr 19 14:40:05 2010 +0300
@@ -0,0 +1,362 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Media Audio harvester plugin implementation
+*
+*/
+
+
+#include "mediaplugin.h"
+
+#include <e32base.h> 
+
+#include "harvesterserverlogger.h"
+#include "common.h"
+#include "csearchdocument.h"
+#include "ccpixindexer.h"
+#include "mdeharvester.h"
+#include "mdeobjectqueuemanager.h"
+#include "mdsmediamonitor.h"
+#include "mdssessionobjectutils.h"
+#include "cpixmediaaudiodoc.h"
+#include "cpixindexerutils.h"
+#include "mmcmonitor.h"
+#include "cpixmdedbmanager.h"
+#include "mdsitementity.h"
+
+//Constants
+_LIT(KPathTrailer, "\\root\\media\\audio");
+
+//***** MEDAI AUDIO*****
+#define MEDIA_QBASEAPPCLASS   "@0:root media audio"
+#define LMEDIA_QBASEAPPCLASS  L"@0:root media audio"
+#define MEDIAAPPCLASS   "root media audio"
+#define LMEDIAAPPCLASS  L"root media audio"
+
+#define MEDIAGENERICAPPCLASS   ":root media audio"
+#define LMEDIAGENERICAPPCLASS  L":root media audio"
+#define DATABASEPATH           "\\root\\media\\audio"
+#define LDATABASEPATH           "\\root\\media\\audio"
+
+// -----------------------------------------------------------------------------
+CAudioPlugin* CAudioPlugin::NewL()
+	{
+	CAudioPlugin* instance = CAudioPlugin::NewLC();
+    CleanupStack::Pop(instance);
+    return instance;
+	}
+
+// -----------------------------------------------------------------------------
+CAudioPlugin* CAudioPlugin::NewLC()
+	{
+	CAudioPlugin* instance = new (ELeave) CAudioPlugin();
+    CleanupStack::PushL(instance);
+    instance->ConstructL();
+    return instance;
+	}
+
+// -----------------------------------------------------------------------------
+CAudioPlugin::CAudioPlugin()
+	{
+	//No implementation required. 
+	//Necessary things done in ConstructL()
+#ifdef __PERFORMANCE_DATA
+    count = 0;
+#endif
+	}
+
+// -----------------------------------------------------------------------------
+CAudioPlugin::~CAudioPlugin()
+	{
+	delete iMdeHarvester;
+	delete iMdsMonitor;
+	delete iObjectJobQueueManager;
+	delete iMdsUtils;
+	delete iAudioDocument;
+	delete iIndexerUtil;
+	delete iMMcMonitor;
+	delete iDBManager;
+	delete iMdsItem;
+	}
+	
+// -----------------------------------------------------------------------------
+void CAudioPlugin::ConstructL()
+	{
+	
+	}
+
+// -----------------------------------------------------------------------------
+void CAudioPlugin::StartPluginL()
+	{
+    CPIXLOGSTRING("CAudioPlugin::StartPluginL");
+	// Define this base application class, use default location
+	iIndexerUtil = CCPixIndexerUtils::NewL(iSearchSession);
+	//Test well before use
+	TBuf<KMaxFileName> databasePathTemp;
+	databasePathTemp.Append(KPathTrailer);
+	iIndexerUtil->MountAllAvailableDriveL(_L(MEDIAGENERICAPPCLASS),databasePathTemp);
+	//Instantiate all monitoring and harvesting class here
+	iMdsUtils = CMdsSessionObjectUtils::NewL();
+	iMdsUtils->InitializeL(); //Create valid session in it
+	iObjectJobQueueManager = CMdeObjectQueueManager::NewL(this);
+	iMdeHarvester = CMdeHarvester::NewL(iMdsUtils->GetSession(),
+	                                    this,iObjectJobQueueManager);
+	iMdsMonitor = CMdsMediaMonitor::NewL(iMdsUtils->GetSession(),iObjectJobQueueManager);
+	iMMcMonitor = CMMCMonitorUtil::NewL(this);//Observer is self
+	iMMcMonitor->StartMonitoring();
+	//Start Monitoring now
+	iMdsMonitor->StartMonitoringL(MdeConstants::Audio::KAudioObject);//Start monitoring Audio objects
+	iAudioDocument = CCPIXMediaAudioDoc::NewL(); //Doc fetcher
+	// Start harvester for this plugin
+	iObserver->AddHarvestingQueue(this, _L(MEDIA_QBASEAPPCLASS) );
+	TUid uidOfPlugin = {0x20029AB9};
+	iDBManager = CCPIXMDEDbManager::NewL(uidOfPlugin);
+	iMdsItem = CMDSEntity::NewL();
+	}
+
+void CAudioPlugin::HarvestingCompletedL()
+    {
+#ifdef __PERFORMANCE_DATA
+    UpdatePerformaceDataL();
+#endif 
+    iObserver->HarvestingCompleted(this, _L(MEDIA_QBASEAPPCLASS), KErrNone);
+    }
+// -----------------------------------------------------------------------------
+void CAudioPlugin::StartHarvestingL( const TDesC& /*aMedia*/ )
+    {
+    //iIndexer->ResetL();//reset any indexes if exist already
+    CPIXLOGSTRING("CAudioPlugin::StartHarvestingL");
+    iDBManager->ResetL();
+    iIndexerUtil->ResetAllL();
+    //Start Media harvesting here
+#ifdef __PERFORMANCE_DATA  
+    iStartTime.UniversalTime();
+#endif  
+    iMdeHarvester->DoHarvesetL(MdeConstants::Audio::KAudioObject);//Start Harvesting
+    }
+
+//handle MMC event for the Drive
+void CAudioPlugin::HandleMMCEventL(const TDriveNumber aDrive,const TBool aMMCInsertRemoval)
+    {
+    TBuf<KMaxFileName> databasePathTemp;
+    databasePathTemp.Append(KPathTrailer);
+    if(aMMCInsertRemoval) //MMC inserted
+        {
+        //Test well before use
+        iIndexerUtil->MountDriveL(aDrive,_L(MEDIAGENERICAPPCLASS),databasePathTemp);
+        //reset indexes existing first
+        //With new Implementation no need to reset
+        //iIndexerUtil->GetIndexerFromDrive(aDrive)->ResetL();
+        }
+    else
+        {
+        //MMC is removed but we can not reset index here as Media physically not avilable so
+        // we have to do at the time of insertion only
+        //Unmount drive and also reset the index as we anyhow has to reindex on insertion back 
+        iIndexerUtil->UnMountDriveL(aDrive,_L(MEDIAGENERICAPPCLASS),ETrue);
+        }
+    }
+
+void CAudioPlugin::HandleMdeItemL( TItemId aObjId, TCPixActionType aActionType)
+    {
+    //Get the object from object utils and get the CPIX document and add delete or update
+    CPIXLOGSTRING2("CAudioPlugin::HandleMdeItemL(): aObjId = %d ", aObjId );
+    // creating CSearchDocument object with unique ID for this application
+    TBuf<KMaxFileName> docid_str;
+    if (aActionType == ECPixAddAction || aActionType == ECPixUpdateAction )
+        {
+        //To Improve performance check here only before Getobject if it is Add event
+        //and we already have in our database just return in case of update move forward
+        if(iDBManager->IsAlreadyExistL(aObjId) && aActionType == ECPixAddAction)//Avoid reharvesting
+            {
+            CPIXLOGSTRING("CAudioPlugin::HandleMdeItemL(): Already harvested returning");
+            return;
+            }
+        //The caller should always handle leave of HandleMdeItemL
+        CMdEObject& object= iMdsUtils->GetObjectL(aObjId,MdeConstants::Audio::KAudioObject);
+        CMdENamespaceDef& defaultNamespaceDef = iMdsUtils->GetSession()->GetDefaultNamespaceDefL();
+        CMdEObjectDef& audioObjDef = defaultNamespaceDef.GetObjectDefL(MdeConstants::Audio::KAudioObject );
+        CSearchDocument* index_item = iAudioDocument->GetCpixDocumentL(object,_L(MEDIAAPPCLASS),audioObjDef);
+        iIndexer = iIndexerUtil->GetIndexerFromMediaId(object.MediaId());
+        if(!iIndexer)
+            {
+            delete index_item;//Remove
+            CPIXLOGSTRING("CAudioPlugin::HandleMdeItemL(): Indexer not found");
+            return;
+            }
+        // Send for indexing
+        if (aActionType == ECPixAddAction)
+            {
+#ifdef __PERFORMANCE_DATA
+            ++count;
+#endif
+            CPIXLOGSTRING("CAudioPlugin::HandleMdeItemL(): Indexer found calling AddL");
+            //First check if it already exist in database
+            TRAPD(err, iIndexer->UpdateL(*index_item)); //Always Update to avoid reharvesting
+            if (err == KErrNone)
+                {
+                //Add entity to database for later use
+                iMdsItem->Reset();//reset existing values
+                iMdsItem->Setkey(aObjId);
+                iMdsItem->SetUri(iAudioDocument->GetUri());//Use the Absolute URI
+                TDriveNumber drive;
+                iIndexerUtil->GetDriveFromMediaId(object.MediaId(),drive);
+                iMdsItem->SetDrive(drive);
+                iDBManager->AddL(aObjId,*iMdsItem);//Add to SyncDB
+                CPIXLOGSTRING("CAudioPlugin::HandleMdeItemL(): Added.");
+                }
+            else
+                {
+                CPIXLOGSTRING2("CAudioPlugin::HandleMdeItemL(): Error %d in adding.", err);
+                }
+            }
+        else if (aActionType == ECPixUpdateAction)
+            {
+            //If DocID for e.g \music\something.mp3 itself changes the we have to compare
+            //existing URI with new one and Remove that first and Update to avoid 
+            //Duplicate entries
+            iMdsItem->Reset();//reset existing values
+            TRAPD(err, iDBManager->GetItemL(aObjId,*iMdsItem));
+            if(err == KErrNone)
+               {
+               //Get the drivenumber from the syncDB to delete the appropriate docId 
+               //in case an item is moved to different drive, delete from the old drive first and later update.
+               //comparing the absolute paths along with the root drives
+                if(iMdsItem->GetPath().Compare(object.Uri()) != 0)
+                   {                        
+                   CCPixIndexer *tempIndexer;            
+                   tempIndexer = iIndexerUtil->GetIndexerFromDrive(iMdsItem->DriveNumber());
+                   tempIndexer->DeleteL(iMdsItem->Uri());
+                   CPIXLOGSTRING("CAudioPlugin::HandleMdeItemL(): Deleted existing URI for update");
+                   }
+                TRAPD(error, iIndexer->UpdateL(*index_item));
+                if (error == KErrNone)
+                    {
+                    //Add as new
+                    iMdsItem->Reset();//reset existing values
+                    TDriveNumber drive;
+                    iIndexerUtil->GetDriveFromMediaId(object.MediaId(),drive);
+                    iMdsItem->Set(aObjId,iAudioDocument->GetUri(),drive);
+                    iDBManager->UpdateL(aObjId,*iMdsItem);//Add to SyncDB
+                    CPIXLOGSTRING("CAudioPlugin::HandleMdeItemL(): Updated.");
+                    }
+                else
+                    {
+                    CPIXLOGSTRING2("CAudioPlugin::HandleMdeItemL(): Error %d in updating.", error);
+                    }
+               }
+            //If a media item is added when downloading or streaming begins, add event is surpassed
+            //by update or delete event because of delay introduced on monitered object by objectqueue manager
+            //So add the Item first, when GetItemL() leaves with item not found
+            else if(err == KErrNotFound)
+                {
+                TRAPD(error, iIndexer->UpdateL(*index_item));
+                if (error == KErrNone)
+                    {
+                    //Add entity to database for later use
+                    iMdsItem->Reset();//reset existing values
+                    iMdsItem->Setkey(aObjId);
+                    iMdsItem->SetUri(iAudioDocument->GetUri());//Use the Absolute URI
+                    TDriveNumber drive;
+                    iIndexerUtil->GetDriveFromMediaId(object.MediaId(),drive);
+                    iMdsItem->SetDrive(drive);
+                    iDBManager->AddL(aObjId,*iMdsItem);//Add to SyncDB
+                    CPIXLOGSTRING("CAudioPlugin::HandleMdeItemL(): Added Item before Update.");
+                    }
+                }            
+            }
+        delete index_item;
+        iIndexer = NULL;//Assign to null not pointing to any memory
+        }
+    else if (aActionType == ECPixRemoveAction)
+        {
+        // Remove the document
+        //Get the Item from SyncDB for removed Item
+        iMdsItem->Reset();//reset existing values
+        TRAPD(error, iDBManager->GetItemL(aObjId,*iMdsItem));
+        if (error == KErrNone)
+            {
+            iIndexer = iIndexerUtil->GetIndexerFromDrive(iMdsItem->DriveNumber());//Get Indexer from drive
+            if(iIndexer) //If indexer found delete
+                {
+                docid_str.Copy(iMdsItem->Uri());
+                TRAPD(err, iIndexer->DeleteL(docid_str));//Delete it
+                if (err == KErrNone)
+                    {
+                    CPIXLOGSTRING("CAudioPlugin::HandleMdeItemL(): Deleted.");
+                    }
+                else
+                    {
+                    CPIXLOGSTRING2("CAudioPlugin::HandleMdeItemL(): Error %d in deleting.", err);
+                    }
+                }
+            //delete entry from database
+            iDBManager->RemoveL(iMdsItem->Key());
+            }
+        iIndexer = NULL;//Assign to null not pointing to any memory
+        }    
+    }
+
+#ifdef __PERFORMANCE_DATA
+void CAudioPlugin::UpdateLogL()
+    {
+    UpdatePerformaceDataL();
+    }
+
+void CAudioPlugin::UpdatePerformaceDataL()
+    {
+    TTime now;
+   
+    
+    iCompleteTime.UniversalTime();
+    TTimeIntervalMicroSeconds timeDiff = iCompleteTime.MicroSecondsFrom(iStartTime);
+    
+    RFs fileSession;
+    RFile perfFile;
+    User::LeaveIfError(fileSession.Connect ());
+    
+    
+    /* Open file if it exists, otherwise create it and write content in it */
+    
+    if(perfFile.Open(fileSession, _L("c:\\data\\AudioPerf.txt"), EFileWrite))
+    User::LeaveIfError(perfFile.Create (fileSession, _L("c:\\data\\AudioPerf.txt"), EFileWrite));
+    
+    HBufC8 *heap = HBufC8::NewL(100);
+    TPtr8 ptr = heap->Des();
+    now.HomeTime();
+    TBuf<100> timeString;             
+                
+    _LIT(KOwnTimeFormat,"%:0%H%:1%T%:2%S");
+    now.FormatL(timeString,KOwnTimeFormat);
+    ptr.AppendNum(now.DateTime().Day());
+    ptr.Append(_L("/"));
+    ptr.AppendNum(now.DateTime().Month());
+    ptr.Append(_L("/"));
+    ptr.AppendNum(now.DateTime().Year());
+    ptr.Append(_L(":"));
+    ptr.Append(timeString);
+    ptr.Append(_L("--"));
+    ptr.AppendNum(count);
+    ptr.Append( _L(" :Time took for Harvesting Audio is : "));
+    ptr.AppendNum(timeDiff.Int64()/1000) ;
+    ptr.Append(_L(" MilliSeonds \n"));
+    TInt myInt = 0;
+    perfFile.Seek(ESeekEnd,myInt);
+    perfFile.Write (ptr);
+    perfFile.Close ();
+    fileSession.Close ();
+    delete heap;
+    }
+#endif
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/harvesterplugins/media/audio/src/tproxy.cpp	Mon Apr 19 14:40:05 2010 +0300
@@ -0,0 +1,37 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Message plugin
+*
+*/
+
+
+#include <e32std.h>
+#include <implementationproxy.h>
+#include <cindexingplugin.h>
+#include "mediaplugin.h"
+
+
+// Map the interface UIDs to implementation factory functions
+const TImplementationProxy KImplementationTable[] = 
+	{
+	{{0x20029AB9},( TProxyNewLPtr) CAudioPlugin::NewL}		
+	};
+
+// Exported proxy for instantiation method resolution
+EXPORT_C const TImplementationProxy* ImplementationGroupProxy( TInt& aTableCount )
+	{
+	aTableCount = sizeof( KImplementationTable ) / sizeof( TImplementationProxy );
+	return KImplementationTable;
+	}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/harvesterplugins/media/group/bld.inf	Mon Apr 19 14:40:05 2010 +0300
@@ -0,0 +1,22 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: 
+*
+*/
+
+PRJ_MMPFILES
+#include "../mediautils/group/bld.inf"
+#include "../audio/group/bld.inf"
+#include "../image/group/bld.inf"
+#include "../video/group/bld.inf"
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/harvesterplugins/media/image/data/20029abb.rss	Mon Apr 19 14:40:05 2010 +0300
@@ -0,0 +1,47 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: 
+*
+*/
+#include <registryinfo.rh>
+
+// Declares info for one test implementation
+RESOURCE REGISTRY_INFO theInfo
+        {
+        // UID for the DLL       
+		// TODO: Rename dll_uid according to your plugin UID
+        dll_uid = 0x20029ABB;
+        // Declare array of interface info
+        interfaces = 
+                {
+                INTERFACE_INFO
+                        {
+                        // UID of interface that is implemented
+                        interface_uid = 0x2001F700; // CPixSearch Plugin Interface UID
+                        implementations = 
+                                {
+                                // Info for CMessagePlugin
+                                IMPLEMENTATION_INFO
+                                        {
+                                        implementation_uid = 0x20029ABB;
+                                        version_no = 1;
+                                        display_name = "Media harvester Images plugin";
+                                        default_data = "Images";
+                                        opaque_data = "";
+                                        }
+                                };
+                        }
+                };
+        }
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/harvesterplugins/media/image/group/bld.inf	Mon Apr 19 14:40:05 2010 +0300
@@ -0,0 +1,21 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: 
+*
+*/
+
+
+PRJ_MMPFILES
+imageplugin.mmp
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/harvesterplugins/media/image/group/imageplugin.mmp	Mon Apr 19 14:40:05 2010 +0300
@@ -0,0 +1,61 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: 
+*
+*/
+
+
+CAPABILITY   CAP_GENERAL_DLL -AllFiles -DRM
+#include "../../../../harvesterplugins/inc/s60performance.h"
+TARGET        cpiximageplugin.dll
+TARGETTYPE    PLUGIN
+
+// ECom Dll recognition UID followed by the unique UID for this dll
+UID 0x10009D8D 0x20029ABB
+EPOCSTACKSIZE     0x5000
+EPOCHEAPSIZE      0x50000 0x2000000 // From about 65KB to about 32 MB
+
+SOURCEPATH    ../src
+SOURCE        cpixmediaimagedoc.cpp
+SOURCE        imageplugin.cpp
+SOURCE        tproxy.cpp
+
+USERINCLUDE   ../inc
+USERINCLUDE   ../../mediautils/inc
+SYSTEMINCLUDE /epoc32/include/ecom
+APP_LAYER_SYSTEMINCLUDE
+
+SOURCEPATH    ../data
+start RESOURCE 20029abb.rss
+target  cpiximageplugin.rsc
+end
+
+LIBRARY       euser.lib
+LIBRARY       ecom.lib
+LIBRARY       efsrv.lib
+STATICLIBRARY cpixmediautils.lib //Media utility library
+LIBRARY       platformenv.lib // Path info
+LIBRARY       cpixharvesterplugininterface.lib
+LIBRARY       cpixsearchclient.lib
+LIBRARY       mdccommon.lib           // mds
+LIBRARY       mdeclient.lib           // mds
+LIBRARY       edbms.lib
+LIBRARY       estor.lib
+LIBRARY       bafl.lib
+
+// For logging
+LIBRARY 	  flogger.lib 
+//Enable this macro to get harvester performance data
+//MACRO __PERFORMANCE_DATA
+EXPORTUNFROZEN
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/harvesterplugins/media/image/inc/cpixmediaimagedoc.h	Mon Apr 19 14:40:05 2010 +0300
@@ -0,0 +1,62 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  MDS to CPIX Image Document fetcher 
+ *
+*/
+
+#ifndef CPIXMEDIAIMAGEDOC_H_
+#define CPIXMEDIAIMAGEDOC_H_
+
+#include "cpixdocfetcher.h"
+
+class CCPIXMediaImageDoc : public CCPIXDocFetcher
+    {
+public:
+    /*
+     * NewL
+     * @return instance of media Image doc
+     */
+    static CCPIXMediaImageDoc* NewL();
+    /*
+     * NewLC
+     * @return instance of media Image doc
+     */    
+    static CCPIXMediaImageDoc* NewLC();
+    /*
+     * Destructor
+     */
+    ~CCPIXMediaImageDoc();
+    //Overwride
+    /*
+     * GetCpixDocumentL get cpix document from mde object
+     * @param CMdEObject& aObject mde object
+     * @param TDesC& aAppClass app class
+     * @param CMdEObjectDef& aObjectDef mde object def
+     * @return instance of CPIX document 
+     */
+    CSearchDocument* GetCpixDocumentL(const CMdEObject& aObject, 
+                                      const TDesC& aAppClass,
+                                      CMdEObjectDef& aObjectDef);    
+private:
+    /*
+     * Second phase constructor
+     */
+    void ConstructL();
+    /*
+     * Default constructor
+     */
+    CCPIXMediaImageDoc();
+    };
+
+#endif /* CPIXMEDIAIMAGEDOC_H_ */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/harvesterplugins/media/image/inc/imageplugin.h	Mon Apr 19 14:40:05 2010 +0300
@@ -0,0 +1,133 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Media Audio harvester plugin header
+*
+*/
+
+
+#ifndef CIMAGEPLUGIN_H
+#define CIMAGEPLUGIN_H
+
+#include <cindexingplugin.h>
+#include <e32base.h>
+#include "common.h"
+#include "mediaobjecthandler.h"
+#include "mmceventobserver.h"
+
+//Forward declaration
+class CSearchDocument;
+class CCPixIndexer;
+class CMdeHarvester;
+class CMdeObjectQueueManager;
+class CMdsMediaMonitor;
+class CMdsSessionObjectUtils;
+class CCPIXMediaImageDoc;
+class CCPixIndexerUtils;
+class CMMCMonitorUtil;
+class CCPIXMDEDbManager;
+class CMDSEntity;
+
+// to get perf data
+//#ifndef __PERFORMANCE_DATA
+//#define __PERFORMANCE_DATA
+//#endif //__PERFORMANCE_DATA
+
+class CImagePlugin : public CIndexingPlugin, 
+                     public MdeMEdiaObserver,
+                     public MMediaObjectHandler,
+                     public MMMCEventObserver
+{
+public:
+    // Constructor and Destructors.
+    /*
+     * NewL
+     * @return instance of Media plugin
+     */
+    static CImagePlugin *NewL();
+    /*
+     * NewLC
+     * @return instance of Media plugin
+     */
+    static CImagePlugin *NewLC();
+    /*
+     * Destructor
+     */
+    virtual ~CImagePlugin();
+    
+public:
+    /* 
+     * Prepares the plugin for StartHarvesterL and also  starts
+     * the favourites db observer.  
+     */
+    void StartPluginL();
+    
+    /*
+     * @description Start the harvester.
+     * @param aQualifiedBaseAppClass the base app class. In this case
+     *        use BOOKMARK_QBASEAPPCLASS
+     * @return void
+     * Leaves in case of errors.
+     */
+    void StartHarvestingL(const TDesC & aQualifiedBaseAppClass);
+    /*
+     * HandleMdeItemL callback from MMediaObjectHandler
+     * @param TItemId aObjId object Id
+     * @param TCPixActionType aActionType cpix action type
+     */
+    void HandleMdeItemL( TItemId aObjId, TCPixActionType aActionType);
+#ifdef __PERFORMANCE_DATA
+    void UpdateLogL();
+#endif	
+    /*
+     * HarvestingCompletedL callback from MdeEventHandler
+     */
+    void HarvestingCompletedL();
+    
+    /*
+     * HandleMMCEventL callback from MMMCEventObserver
+     * @param TDriveNumber aDrive drive number of MMC
+     * @param TBool aMMCInsertRemoval ETrue if inserted else EFalse
+     */
+    void HandleMMCEventL(const TDriveNumber aDrive,const TBool aMMCInsertRemoval);
+private:
+    //private constructors.
+    /*
+     * Default constructor
+     */
+    CImagePlugin();
+    /*
+     * Second phase constructor
+     */
+    void ConstructL();
+    
+private:
+    CCPixIndexer *iIndexer; //Indexer
+    CMdeHarvester* iMdeHarvester; //Mde harvester owned
+    CMdeObjectQueueManager* iObjectJobQueueManager; //Objectqueue manager owned
+    CMdsMediaMonitor*       iMdsMonitor;//MDS monitor owned
+    CMdsSessionObjectUtils* iMdsUtils;//Mds utils owned
+    CCPIXMediaImageDoc*     iImageDocument;//MDS audio doc owned
+    CCPixIndexerUtils*      iIndexerUtil;//Indexer util owned
+    CMMCMonitorUtil*        iMMcMonitor;//MMC monitor owned
+    CCPIXMDEDbManager*      iDBManager;
+    CMDSEntity*             iMdsItem;
+#ifdef __PERFORMANCE_DATA
+    TTime iStartTime;
+    TTime iCompleteTime;
+    void UpdatePerformaceDataL();
+	TInt count;
+#endif
+};
+
+#endif // CImagePlugin_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/harvesterplugins/media/image/src/cpixmediaimagedoc.cpp	Mon Apr 19 14:40:05 2010 +0300
@@ -0,0 +1,181 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  MDS to CPIX Image Document fetcher 
+ *
+*/
+
+
+#include "cpixmediaimagedoc.h"
+#include <mdeobject.h>
+#include <mdccommon.h>
+#include <mdeitem.h>
+#include <mdeconstants.h>
+#include <mdeobjectdef.h>
+#include "harvesterserverlogger.h"
+
+_LIT( KFormatDateTime, "%04d-%02d-%02dT%02d:%02d:%02dZ");    // yyyy-mm-ddThh:mm:ssZ
+
+// -----------------------------------------------------------------------------
+// CCPIXDocFetcher::NewL()
+// -----------------------------------------------------------------------------
+//
+CCPIXMediaImageDoc* CCPIXMediaImageDoc::NewL()
+    {
+    CCPIXMediaImageDoc* self = CCPIXMediaImageDoc::NewLC();
+    CleanupStack::Pop(self);
+    return self;
+    }
+
+// -----------------------------------------------------------------------------
+// CCPIXDocFetcher::NewLC()
+// -----------------------------------------------------------------------------
+//
+CCPIXMediaImageDoc* CCPIXMediaImageDoc::NewLC()
+    {
+    CCPIXMediaImageDoc* self = new (ELeave) CCPIXMediaImageDoc();
+    CleanupStack::PushL(self);
+    self->ConstructL();
+    return self;
+    }
+
+// -----------------------------------------------------------------------------
+// CCPIXDocFetcher::~CCPIXMediaImageDoc()
+// -----------------------------------------------------------------------------
+//
+CCPIXMediaImageDoc::~CCPIXMediaImageDoc()
+    {
+    
+    }
+
+// -----------------------------------------------------------------------------
+// CCPIXDocFetcher::CCPIXMediaImageDoc()
+// -----------------------------------------------------------------------------
+//
+CCPIXMediaImageDoc::CCPIXMediaImageDoc()
+    {
+    
+    }
+
+// -----------------------------------------------------------------------------
+// CCPIXDocFetcher::ConstructL()
+// -----------------------------------------------------------------------------
+//
+void CCPIXMediaImageDoc::ConstructL()
+    {
+    CCPIXDocFetcher::ConstructL();//Must have
+    
+    }
+
+// -----------------------------------------------------------------------------
+// CCPIXDocFetcher::GetCpixDocumentL()
+// -----------------------------------------------------------------------------
+//
+CSearchDocument* CCPIXMediaImageDoc::GetCpixDocumentL(const CMdEObject& aObject, 
+                                              const TDesC& aAppClass,
+                                              CMdEObjectDef& aObjectDef)
+    {
+    //Get basic document
+    CPIXLOGSTRING("START CCPIXMediaImageDoc::GetCpixDocumentL");
+    CSearchDocument* index_item = CCPIXDocFetcher::GetCpixDocumentL(aObject,aAppClass,aObjectDef);
+    //URI and Excerpt is done add additional properties here 
+    CMdEProperty* property(NULL);
+    //Get user comment field
+    CMdEPropertyDef& commentPropDef = aObjectDef.GetPropertyDefL(MdeConstants::MediaObject::KCommentProperty );
+    if(aObject.Property( commentPropDef, property )!= KErrNotFound)
+       {
+       //Add field to document
+       CMdETextProperty* textProperty = ( CMdETextProperty* ) property;
+       AddFiledtoDocumentL(*index_item,
+                           MdeConstants::MediaObject::KCommentProperty,
+                           textProperty->Value());
+       }
+    CMdEPropertyDef& dateTimePropDef = aObjectDef.GetPropertyDefL(MdeConstants::Image::KDateTimeOriginalProperty);
+    if(aObject.Property( dateTimePropDef, property ) != KErrNotFound)
+      {
+      //Add field to document
+      if(EPropertyTime == property->Def().PropertyType())
+          {
+          CMdETimeProperty& timeProperty = static_cast < CMdETimeProperty& > (*property);
+          TDateTime time = timeProperty.Value().DateTime();
+          TBuf<32> buf;
+          buf.Format( KFormatDateTime, time.Year(), 
+                                       time.Month() + 1, 
+                                       time.Day() + 1, 
+                                       time.Hour(), 
+                                       time.Minute(), 
+                                       time.Second() );
+          AddFiledtoDocumentL(*index_item,
+                             MdeConstants::Image::KDateTimeOriginalProperty,
+                             buf,
+                             CDocumentField::EStoreYes | CDocumentField::EIndexUnTokenized);
+          }
+      }
+    //Latitude error currently 
+    /* TODO- Bhuvi Location is a seperate object for each image object if any such relation
+     * exist it has to be searched from Relation table and from there we have to open 
+     * location object and query Longitude and Latitudes
+     */
+    /*
+    CMdEPropertyDef& latitudePropDef = aObjectDef.GetPropertyDefL(MdeConstants::Location::KLatitudeProperty);
+    if(aObject.Property( latitudePropDef, property ) != KErrNotFound)
+      {
+      TBuf<32> buf;
+      TRealFormat format(32,16); //Real format
+      format.iTriLen = 0;
+      //Add field to document
+      if(EPropertyReal32 == property->Def().PropertyType())
+          {
+          CMdEReal32Property& real32Property = (CMdEReal32Property&) property;
+          buf.Num( real32Property.Value(), format );
+          }
+      else
+          if(EPropertyReal64 == property->Def().PropertyType())
+          {
+          CMdEReal64Property& real64Property = (CMdEReal64Property&) property;
+          buf.Num( real64Property.Value(), format );
+          }
+      AddFiledtoDocumentL(*index_item,
+                         MdeConstants::Location::KLatitudeProperty,
+                         buf,
+                         CDocumentField::EStoreYes | CDocumentField::EIndexUnTokenized);
+      }
+    //Longitude
+    CMdEPropertyDef& longitudePropDef = aObjectDef.GetPropertyDefL(MdeConstants::Location::KLongitudeProperty);
+    if(aObject.Property( longitudePropDef, property ) != KErrNotFound)
+      {
+      TBuf<32> buf;
+      TRealFormat format(32,16); //Real format
+      format.iTriLen = 0;
+      //Add field to document
+      if(EPropertyReal32 == property->Def().PropertyType())
+          {
+          CMdEReal32Property& real32Property = (CMdEReal32Property&) property;
+          buf.Num( real32Property.Value(), format );
+          }
+      else
+          if(EPropertyReal64 == property->Def().PropertyType())
+          {
+          CMdEReal64Property& real64Property = (CMdEReal64Property&) property;
+          buf.Num( real64Property.Value(), format );
+          }
+      AddFiledtoDocumentL(*index_item,
+                         MdeConstants::Location::KLongitudeProperty,
+                         buf,
+                         CDocumentField::EStoreYes | CDocumentField::EIndexUnTokenized);
+      }
+      */
+    CPIXLOGSTRING("END CCPIXMediaImageDoc::GetCpixDocumentL");
+    return index_item;
+    }
+//End of life
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/harvesterplugins/media/image/src/imageplugin.cpp	Mon Apr 19 14:40:05 2010 +0300
@@ -0,0 +1,360 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Media Image harvester plugin implementation
+*
+*/
+
+
+#include "imageplugin.h"
+#include <e32base.h> 
+#include "harvesterserverlogger.h"
+#include "common.h"
+#include "csearchdocument.h"
+#include "ccpixindexer.h"
+#include "mdeharvester.h"
+#include "mdeobjectqueuemanager.h"
+#include "mdsmediamonitor.h"
+#include "mdssessionobjectutils.h"
+#include "cpixmediaimagedoc.h"
+#include "cpixindexerutils.h"
+#include "mmcmonitor.h"
+#include "cpixmdedbmanager.h"
+#include "mdsitementity.h"
+
+//Constants
+_LIT(KPathTrailer, "\\root\\media\\image");
+
+//***** MEDAI AUDIO*****
+#define MEDIA_QBASEAPPCLASS   "@0:root media image"
+#define LMEDIA_QBASEAPPCLASS  L"@0:root media image"
+#define MEDIAAPPCLASS   "root media image"
+#define LMEDIAAPPCLASS  L"root media image"
+
+#define MEDIAGENERICAPPCLASS   ":root media image"
+#define LMEDIAGENERICAPPCLASS  L":root media image"
+#define DATABASEPATH           "\\root\\media\\image"
+#define LDATABASEPATH           "\\root\\media\\image"
+
+// -----------------------------------------------------------------------------
+CImagePlugin* CImagePlugin::NewL()
+	{
+	CImagePlugin* instance = CImagePlugin::NewLC();
+    CleanupStack::Pop(instance);
+    return instance;
+	}
+
+// -----------------------------------------------------------------------------
+CImagePlugin* CImagePlugin::NewLC()
+	{
+	CImagePlugin* instance = new (ELeave) CImagePlugin();
+    CleanupStack::PushL(instance);
+    instance->ConstructL();
+    return instance;
+	}
+
+// -----------------------------------------------------------------------------
+CImagePlugin::CImagePlugin()
+	{
+	//No implementation required. 
+	//Necessary things done in ConstructL()
+#ifdef __PERFORMANCE_DATA
+    count = 0;
+# endif	
+	}
+
+// -----------------------------------------------------------------------------
+CImagePlugin::~CImagePlugin()
+	{
+	delete iMdeHarvester;
+	delete iMdsMonitor;
+	delete iObjectJobQueueManager;
+	delete iMdsUtils;
+	delete iImageDocument;
+	delete iIndexerUtil;
+	delete iMMcMonitor;
+	delete iDBManager;
+	delete iMdsItem;
+	}
+	
+// -----------------------------------------------------------------------------
+void CImagePlugin::ConstructL()
+	{
+	
+	}
+
+// -----------------------------------------------------------------------------
+void CImagePlugin::StartPluginL()
+	{
+    CPIXLOGSTRING("CImagePlugin::StartPluginL");
+	// Define this base application class, use default location
+	iIndexerUtil = CCPixIndexerUtils::NewL(iSearchSession);
+	//Test well before use
+	TBuf<KMaxFileName> databasePathTemp;
+	databasePathTemp.Append(KPathTrailer);
+	iIndexerUtil->MountAllAvailableDriveL(_L(MEDIAGENERICAPPCLASS),databasePathTemp);
+	//Instantiate all monitoring and harvesting class here
+	iMdsUtils = CMdsSessionObjectUtils::NewL();
+	iMdsUtils->InitializeL(); //Create valid session in it
+	iObjectJobQueueManager = CMdeObjectQueueManager::NewL(this);
+	iMdeHarvester = CMdeHarvester::NewL(iMdsUtils->GetSession(),
+	                                    this,iObjectJobQueueManager);
+	iMdsMonitor = CMdsMediaMonitor::NewL(iMdsUtils->GetSession(),iObjectJobQueueManager);
+	iMMcMonitor = CMMCMonitorUtil::NewL(this);//Observer is self
+	iMMcMonitor->StartMonitoring();
+	//Start Monitoring now
+	iMdsMonitor->StartMonitoringL(MdeConstants::Image::KImageObject);//Start monitoring Image objects
+	iImageDocument = CCPIXMediaImageDoc::NewL(); //Doc fetcher
+	// Start harvester for this plugin
+	iObserver->AddHarvestingQueue(this, _L(MEDIA_QBASEAPPCLASS) );
+	TUid uidOfPlugin = {0x20029ABB};
+	iDBManager = CCPIXMDEDbManager::NewL(uidOfPlugin);
+	iMdsItem = CMDSEntity::NewL();
+	}
+
+void CImagePlugin::HarvestingCompletedL()
+    {
+#ifdef __PERFORMANCE_DATA
+    UpdatePerformaceDataL();
+#endif 
+    iObserver->HarvestingCompleted(this, _L(MEDIA_QBASEAPPCLASS), KErrNone);
+    }
+// -----------------------------------------------------------------------------
+void CImagePlugin::StartHarvestingL( const TDesC& /*aMedia*/ )
+    {
+    //iIndexer->ResetL();//reset any indexes if exist already
+    CPIXLOGSTRING("CImagePlugin::StartHarvestingL");
+    iDBManager->ResetL();
+    iIndexerUtil->ResetAllL();
+    //Start Media harvesting here
+#ifdef __PERFORMANCE_DATA  
+    iStartTime.UniversalTime();
+#endif  
+    iMdeHarvester->DoHarvesetL(MdeConstants::Image::KImageObject);//Start Harvesting
+    }
+
+//handle MMC event for the Drive
+void CImagePlugin::HandleMMCEventL(const TDriveNumber aDrive,const TBool aMMCInsertRemoval)
+    {
+    TBuf<KMaxFileName> databasePathTemp;
+    databasePathTemp.Append(KPathTrailer);
+    if(aMMCInsertRemoval) //MMC inserted
+        {
+        //Test well before use
+        iIndexerUtil->MountDriveL(aDrive,_L(MEDIAGENERICAPPCLASS),databasePathTemp);
+        //reset indexes existing first
+        //With new Implementation no need to reset
+        //iIndexerUtil->GetIndexerFromDrive(aDrive)->ResetL();
+        }
+    else
+        {
+        //MMC is removed but we can not reset index here as Media physically not avilable so
+        // we have to do at the time of insertion only
+        //Unmount drive and also reset the index as we anyhow has to reindex on insertion back 
+        iIndexerUtil->UnMountDriveL(aDrive,_L(MEDIAGENERICAPPCLASS),ETrue);
+        }
+    }
+
+void CImagePlugin::HandleMdeItemL( TItemId aObjId, TCPixActionType aActionType)
+    {
+    //Get the object from object utils and get the CPIX document and add delete or update
+    CPIXLOGSTRING2("CImagePlugin::HandleMdeItemL(): aObjId = %d ", aObjId );
+    // creating CSearchDocument object with unique ID for this application
+    TBuf<KMaxFileName> docid_str;
+    if (aActionType == ECPixAddAction || aActionType == ECPixUpdateAction )
+        {
+        //The caller should always handle leave of HandleMdeItemL
+        if(iDBManager->IsAlreadyExistL(aObjId) && aActionType == ECPixAddAction)//Avoid reharvesting
+            {
+            CPIXLOGSTRING("CImagePlugin::HandleMdeItemL(): Already harvested returning");
+            return;
+            }
+        CMdEObject& object= iMdsUtils->GetObjectL(aObjId,MdeConstants::Image::KImageObject);
+        CMdENamespaceDef& defaultNamespaceDef = iMdsUtils->GetSession()->GetDefaultNamespaceDefL();
+        CMdEObjectDef& audioObjDef = defaultNamespaceDef.GetObjectDefL(MdeConstants::Image::KImageObject);
+        CSearchDocument* index_item = iImageDocument->GetCpixDocumentL(object,_L(MEDIAAPPCLASS),audioObjDef);
+        iIndexer = iIndexerUtil->GetIndexerFromMediaId(object.MediaId());
+        if(!iIndexer)
+            {
+            delete index_item;
+            CPIXLOGSTRING("CImagePlugin::HandleMdeItemL(): Indexer not found");
+            return;
+            }
+        // Send for indexing
+        if (aActionType == ECPixAddAction)
+            {
+#ifdef __PERFORMANCE_DATA
+            ++count;
+# endif
+            CPIXLOGSTRING("CImagePlugin::HandleMdeItemL(): Indexer found calling AddL");
+            //First check if it already exist in database
+            TRAPD(err, iIndexer->UpdateL(*index_item)); //Always Update to avoid reharvesting
+            if (err == KErrNone)
+                {
+                    //Add entity to database for later use
+                    iMdsItem->Reset();//reset existing values
+                    iMdsItem->Setkey(aObjId);
+                    iMdsItem->SetUri(iImageDocument->GetUri());
+                    TDriveNumber drive;
+                    iIndexerUtil->GetDriveFromMediaId(object.MediaId(),drive);
+                    iMdsItem->SetDrive(drive);
+                    iDBManager->AddL(aObjId,*iMdsItem);//Add to SyncDB
+                CPIXLOGSTRING("CImagePlugin::HandleMdeItemL(): Added.");
+                }
+            else
+                {
+                CPIXLOGSTRING2("CImagePlugin::HandleMdeItemL(): Error %d in adding.", err);
+                }
+            }
+        else if (aActionType == ECPixUpdateAction)
+            {
+            //If DocID for e.g \image\something.jpeg itself changes the we have to compare
+            //existing URI with new one and Remove that first and Update to avoid 
+            //Duplicate entries
+            iMdsItem->Reset();//reset existing values
+            TRAPD(err, iDBManager->GetItemL(aObjId,*iMdsItem));
+            if (err == KErrNone)
+                {
+                //Get the drivenumber from the syncDB to delete the appropriate docId 
+                //in case an item is moved to different drive, delete from the old drive first and later update.
+                //comparing the absolute paths along with the root drives
+                if(iMdsItem->GetPath().Compare(object.Uri()) != 0)
+                    {
+                    CCPixIndexer *tempIndexer;            
+                    tempIndexer = iIndexerUtil->GetIndexerFromDrive(iMdsItem->DriveNumber());
+                    tempIndexer->DeleteL(iMdsItem->Uri());
+                    CPIXLOGSTRING("CImagePlugin::HandleMdeItemL(): Deleted existing URI for update");
+                    }
+                TRAPD(error, iIndexer->UpdateL(*index_item));
+                if (error == KErrNone)
+                    {
+                    //Add as new
+                    iMdsItem->Reset();//reset existing values
+                    TDriveNumber drive;
+                    iIndexerUtil->GetDriveFromMediaId(object.MediaId(),drive);
+                    iMdsItem->Set(aObjId,iImageDocument->GetUri(),drive);
+                    iDBManager->UpdateL(aObjId,*iMdsItem);//Add to SyncDB
+                    CPIXLOGSTRING("CImagePlugin::HandleMdeItemL(): Updated.");
+                    }
+                else
+                    {
+                    CPIXLOGSTRING2("CImagePlugin::HandleMdeItemL(): Error %d in updating.", error);
+                    }
+                }
+            //If a media item is added when downloading or streaming begins, add event is surpassed
+            //by update or delete event because of delay introduced on monitered object by objectqueue manager
+            //So add the Item first, when GetItemL() leaves with item not found
+            else if(err == KErrNotFound)
+                {
+                TRAPD(error, iIndexer->UpdateL(*index_item));
+                if (error == KErrNone)
+                    {
+                    //Add entity to database for later use
+                    iMdsItem->Reset();//reset existing values
+                    iMdsItem->Setkey(aObjId);
+                    iMdsItem->SetUri(iImageDocument->GetUri());//Use the Absolute URI
+                    TDriveNumber drive;
+                    iIndexerUtil->GetDriveFromMediaId(object.MediaId(),drive);
+                    iMdsItem->SetDrive(drive);
+                    iDBManager->AddL(aObjId,*iMdsItem);//Add to SyncDB
+                    CPIXLOGSTRING("CImagePlugin::HandleMdeItemL(): Added Item before Update.");
+                    }
+                }                       
+            }
+        delete index_item;
+        iIndexer = NULL;//Assign to null not pointing to any memory
+        }
+    else if (aActionType == ECPixRemoveAction)
+        {
+        //We can not get media id of removed doc from MDS as it is deleed so we have to remove from 
+        //all available Indexers
+        // Remove the document
+        //Get the Item from SyncDB for removed Item
+        iMdsItem->Reset();//reset existing values
+        TRAPD(error, iDBManager->GetItemL(aObjId,*iMdsItem));
+        if (error == KErrNone)
+            {
+            iIndexer = iIndexerUtil->GetIndexerFromDrive(iMdsItem->DriveNumber());//Get Indexer from drive
+            if(iIndexer) //If indexer found delete
+               {
+               docid_str.Copy(iMdsItem->Uri());
+               TRAPD(err, iIndexer->DeleteL(docid_str));//Delete it
+               if (err == KErrNone)
+                   {
+                    CPIXLOGSTRING("CImagePlugin::HandleMdeItemL(): Deleted.");
+                   }
+               else
+                   {
+                    CPIXLOGSTRING2("CImagePlugin::HandleMdeItemL(): Error %d in deleting.", err);
+                   }
+               }
+            //delete entry from database
+            iDBManager->RemoveL(iMdsItem->Key());
+            }
+        iIndexer = NULL;//Assign to null not pointing to any memory
+        }    
+    }
+
+#ifdef __PERFORMANCE_DATA
+void CImagePlugin::UpdateLogL()
+    {
+    UpdatePerformaceDataL();
+    }
+
+void CImagePlugin::UpdatePerformaceDataL()
+    {
+    TTime now;
+   
+    
+    iCompleteTime.UniversalTime();
+    TTimeIntervalMicroSeconds timeDiff = iCompleteTime.MicroSecondsFrom(iStartTime);
+    
+    RFs fileSession;
+    RFile perfFile;
+    User::LeaveIfError(fileSession.Connect ());
+    
+    
+    /* Open file if it exists, otherwise create it and write content in it */
+    
+    if(perfFile.Open(fileSession, _L("c:\\data\\ImagePerf.txt"), EFileWrite))
+    User::LeaveIfError(perfFile.Create (fileSession, _L("c:\\data\\ImagePerf.txt"), EFileWrite));
+    
+    HBufC8 *heap = HBufC8::NewL(100);
+    TPtr8 ptr = heap->Des();
+    now.HomeTime();
+    TBuf<100> timeString;             
+                
+    _LIT(KOwnTimeFormat,"%:0%H%:1%T%:2%S");
+    now.FormatL(timeString,KOwnTimeFormat);
+    ptr.AppendNum(now.DateTime().Day());
+    ptr.Append(_L("/"));
+    ptr.AppendNum(now.DateTime().Month());
+    ptr.Append(_L("/"));
+    ptr.AppendNum(now.DateTime().Year());
+    ptr.Append(_L(":"));
+    ptr.Append(timeString);
+    ptr.Append(_L("--"));
+    ptr.AppendNum(count);
+    ptr.Append( _L(" :Time took for Harvesting Image is : "));
+    ptr.AppendNum(timeDiff.Int64()/1000) ;
+    ptr.Append(_L(" MilliSeonds \n"));
+    TInt myInt = 0;
+    perfFile.Seek(ESeekEnd,myInt);
+    perfFile.Write (ptr);
+    perfFile.Close ();
+    fileSession.Close ();
+    delete heap;
+    }
+#endif
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/harvesterplugins/media/image/src/tproxy.cpp	Mon Apr 19 14:40:05 2010 +0300
@@ -0,0 +1,36 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Image plugin
+*
+*/
+
+#include <e32std.h>
+#include <implementationproxy.h>
+#include <cindexingplugin.h>
+#include "imageplugin.h"
+
+
+// Map the interface UIDs to implementation factory functions
+const TImplementationProxy KImplementationTable[] = 
+	{
+	{{0x20029ABB},( TProxyNewLPtr) CImagePlugin::NewL}		
+	};
+
+// Exported proxy for instantiation method resolution
+EXPORT_C const TImplementationProxy* ImplementationGroupProxy( TInt& aTableCount )
+	{
+	aTableCount = sizeof( KImplementationTable ) / sizeof( TImplementationProxy );
+	return KImplementationTable;
+	}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/harvesterplugins/media/mediautils/group/bld.inf	Mon Apr 19 14:40:05 2010 +0300
@@ -0,0 +1,21 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: 
+*
+*/
+
+
+PRJ_MMPFILES
+mediautils.mmp
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/harvesterplugins/media/mediautils/group/mediautils.mmp	Mon Apr 19 14:40:05 2010 +0300
@@ -0,0 +1,37 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: 
+*
+*/
+
+
+TARGET            cpixmediautils.lib
+TARGETTYPE        lib
+
+USERINCLUDE   ../inc
+APP_LAYER_SYSTEMINCLUDE
+#include "../../../../harvesterplugins/inc/s60performance.h"
+
+SOURCEPATH ../src
+SOURCE mdsmediamonitor.cpp 
+SOURCE mdssessionobjectutils.cpp 
+SOURCE mdeobjectqueuemanager.cpp 
+SOURCE mdeharvester.cpp 
+SOURCE cpixdocfetcher.cpp 
+SOURCE cpixindexerutils.cpp 
+SOURCE mmcmonitor.cpp cpixmdedbmanager.cpp mdsitementity.cpp
+
+EXPORTUNFROZEN
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/harvesterplugins/media/mediautils/inc/cpixdocfetcher.h	Mon Apr 19 14:40:05 2010 +0300
@@ -0,0 +1,118 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  MDS to CPIX Document fetcher 
+ *
+*/
+
+
+#ifndef CPIXDOCFETCHER_H_
+#define CPIXDOCFETCHER_H_
+
+#include <e32def.h>
+#include <e32base.h>
+#include <f32file.h>
+#include "cdocumentfield.h"
+
+//Forward declaration
+class CSearchDocument;
+class CMdEObject;
+class CMdEObjectDef;
+
+class CCPIXDocFetcher : public CBase
+    {
+public:
+    /**
+     * Construction
+     * @return instance of CCPIXDocFetcher
+     */
+    static CCPIXDocFetcher* NewL();
+    /**
+     * Construction
+     * @return instance of CCPIXDocFetcher
+     */
+    static CCPIXDocFetcher* NewLC();
+    /**
+     * Destructor
+     */    
+    virtual ~CCPIXDocFetcher();
+    /**
+     * Get the search document from MDE object
+     * @param CMdEObject& aObject mde object
+     * @param TDesC& aAppClass app class require to create cpix 
+     * @param CMdEObjectDef& aObjectDef object def of passed object
+     * @return instance of CSearchDocument document
+     */
+    //Process base object properties here and let specific media handler "video" "music"
+    //Overwride this in order to handle specific items client should call this method
+    // from overwridden method to get common entries
+    virtual CSearchDocument* GetCpixDocumentL(const CMdEObject& aObject, 
+                                              const TDesC& aAppClass,
+                                              CMdEObjectDef& aObjectDef);
+    /**
+     * Utility method Add field to created document
+     * @param CSearchDocument& aSearchDoc search document
+     * @param TDesC& aFiledName filed name to be added 
+     * @param CTDesC& aValue field value
+     * @return none
+     */    
+    void AddFiledtoDocumentL(CSearchDocument& aSearchDoc,const TDesC& aFiledName,
+                             const TDesC& aValue,
+                             TInt aConfig = CDocumentField::EStoreYes | CDocumentField::EIndexTokenized);
+    
+    /*
+     * Get the Absolute URI without path 
+     * @return TDesC& URI absolute path
+     */
+    const TDesC& GetUri();
+    
+    /*
+     * Convert Media ID from integer to descriptor for storage
+     * @param aMediaId media id in integer
+     * @param aMediaIDBuf reference of descriptor buffer to be filled
+     */
+    void GetMediaIdDescriptor(const TUint32& aMediaId,TDes& aMediaIDBuf);
+    /*
+     * Get the Media ID from the filesystem and convert Media ID from integer to descriptor for storage
+     * @param TDesC& aURI Uri of the object 
+     * @param aMediaIDBuf reference of descriptor buffer to be filled
+     */    
+    void GetMediaIdDescriptorFromFsL(const TDesC& aUri,TDes& aMediaIDBuf);
+    /*
+     * Get the file extension from uri
+     * @param TDesC& aURI Uri of the object 
+     * @param aExtension reference of descriptor buffer to be filled with file extension
+     */
+    void GetExtension(const TDesC& aUri, TDes& aExtension);
+protected:
+    /*
+     * second phase constructor ConstructL
+     */
+    void ConstructL();
+    /*
+     * Default constructor
+     */
+    CCPIXDocFetcher(); //Default constructor
+private:
+    /*
+     * Convert URI to Absolute URI
+     * exp. from f:\music\something.mp3 will be stored as \music\something.mp3
+     */
+    void SetAbsoluteURI(const TDesC& aUri);
+private:
+    // File system handle
+    RFs iFs;
+    TBuf<KMaxFileName> iUri; //Absolute URI of MDS Items  
+    };
+
+#endif /* CPIXDOCFETCHER_H_ */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/harvesterplugins/media/mediautils/inc/cpixindexerutils.h	Mon Apr 19 14:40:05 2010 +0300
@@ -0,0 +1,154 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Indexer utility create indexes for each drive
+ *
+*/
+
+
+#ifndef CPIXINDERUTILS_H_
+#define CPIXINDERUTILS_H_
+#include <e32base.h>
+#include <f32file.h>
+#include <rsearchserversession.h>
+
+//Forward declaration
+class CCPixIndexer;
+
+NONSHARABLE_CLASS(CCPixIndexerUtils) : public CBase
+    {
+public:
+    /*
+     * Constructrion
+     * @param RSearchServerSession& aSession valid search session
+     * @return instance of Indexer util 
+     */
+    static CCPixIndexerUtils* NewL(RSearchServerSession& aSession);
+    /*
+     * Constructrion
+     * @param RSearchServerSession& aSession valid search session
+     * @return instance of Indexer util 
+     */
+    static CCPixIndexerUtils* NewLC(RSearchServerSession& aSession);
+    /*
+     * Destruction
+     */
+    virtual ~CCPixIndexerUtils();
+    /*
+     * Mount all available drives 
+     * TDesC& aBaseAppClassGeneric generic base app class
+     * TDesC& aPath path of database e.g. \\root\\media\\audio
+     */
+    void MountAllAvailableDriveL(const TDesC& aBaseAppClassGeneric,const TDesC& aPath);
+    /*
+     * Unmount all available drives 
+     * TDesC& aBaseAppClassGeneric generic base app class
+     * TBool aUndefine needs to be undefined or not
+     */    
+    void UnMountAllDrivesL(const TDesC& aBaseAppClassGeneric,TBool aUndefine = EFalse);
+    /*
+     * Mount drive
+     * TDriveNumber aMedia drive to be mounted
+     * TDesC& aBaseAppClassGeneric generic base app class
+     * TDesC& aPath path of database
+     */
+    void MountDriveL(TDriveNumber aMedia,const TDesC& aBaseAppClassGeneric,const TDesC& aPath);
+    /*
+     * UnMount drive
+     * TDriveNumber aMedia drive to be mounted
+     * TDesC& aBaseAppClassGeneric generic base app class
+     * TBool aUndefine needs to be undefined or not
+     */
+    void UnMountDriveL(TDriveNumber aMedia,const TDesC& aBaseAppClassGeneric,TBool aUndefine = EFalse);
+    /*
+     * Checks Media is removable or not
+     * TDriveNumber& aDrive drive to check
+     * @return ETrue if removable else EFalse
+     */
+    TBool IsMediaRemovableL(const TDriveNumber& aDrive);
+    /*
+     * Checks drive can be mounted not
+     * TDriveNumber aDrive drive to check
+     * @return ETrue if mountable else EFalse
+     */
+    TBool IsDriveCanbeMountedL(TDriveNumber aDrive);
+    /*
+     * Get Indexer for drive
+     * TDriveNumber aDrive drive to check
+     * @return instance of CCPixIndexer* ownership not passed
+     */
+    CCPixIndexer* GetIndexerFromDrive(TDriveNumber aMedia);
+    /*
+     * Get Indexer From media Id
+     * TUint aUniqueID media Id 
+     * @return instance of CCPixIndexer* ownership not passed
+     */
+    CCPixIndexer* GetIndexerFromMediaId(TUint aUniqueID);
+    /*
+     * Checks if Drive already mounted
+     * TDriveNumber aMedia 
+     * @return ETrue if mounted else EFalse
+     */
+    TBool IsAlreadyAvilable(TDriveNumber aMedia);
+    /*
+     * Reset all indexes
+     */
+    void ResetAllL();
+    /*
+     * Get array of all mounted drives
+     * @return array of mounted drives
+     */
+    RArray<TDriveNumber>& GetMountedDriveList();
+    /* 
+     * Internale method GetDrive from media Id
+     * @param TUint aUniqueID media Id
+     * TDriveNumber& drive number in return
+     */
+    void GetDriveFromMediaId(TUint aUniqueID,TDriveNumber&);
+private:
+    /*
+     * Default constructor
+     */
+    CCPixIndexerUtils();
+    /*
+     * Second phase constructor
+     */
+    void ConstructL(RSearchServerSession& aSession);
+    /*
+     * Form base app class for media
+     * @param TDriveNumber aMedia media drive
+     * @param TDesC& aBaseAppClassGeneric base app class
+     * @param TDes& aBaseAppClass generated value of base app class
+     * @return KErrNone on success else error 
+     */
+    TInt FormBaseAppClass(TDriveNumber aMedia, const TDesC& aBaseAppClassGeneric, TDes& aBaseAppClass);
+    /*
+     * Database path for drive
+     * @param TDriveNumber aMedia media drive
+     * @param TDesC& aPath path of database
+     * @return database path generated
+     */
+    HBufC* DatabasePathLC(TDriveNumber aMedia,const TDesC& aPath);
+    /*
+     * Remove unmounted drive from Mounted list
+     * @param TDriveNumber aMedia drive
+     */
+    void RemoveUnmountedDrive(TDriveNumber aMedia);
+private:
+    RArray<TDriveNumber>  iMountedDrives; //Array of mounted drives
+    CCPixIndexer *iIndexer[EDriveZ + 1];//Array of all Indexers
+    RFs           iFs; //File session
+    RSearchServerSession iSearchSession; //Search session
+    };
+
+#endif /* CPIXINDERUTILS_H_ */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/harvesterplugins/media/mediautils/inc/cpixmdedbmanager.h	Mon Apr 19 14:40:05 2010 +0300
@@ -0,0 +1,142 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  This class keeps a snap shot of the object id present in the MDS DB
+*                Any change monitored by the mde harvester plugin, first checks in this
+*                table and then updates the content in the lucene database
+*
+*/
+
+
+#ifndef CPIX_MDE_DB_MANAGER_H_
+#define CPIX_MDE_DB_MANAGER_H_
+
+#include <e32def.h>
+#include <e32base.h>
+#include <d32dbms.h>
+
+enum TCPixMdeDBManagerAPIReturnType
+    {
+    EOperationSuccess=0,
+    EOperationFailure,
+    EItemPresent,
+    EItemNotPresent,
+    EOperationUndefined
+    };
+typedef enum TCPixMdeDBManagerAPIReturnType TCPIXMDEDBAPIReturnType;
+
+//Forward declaration
+class CMDSEntity;
+
+class CCPIXMDEDbManager : public CBase
+    {
+public:
+
+    /**
+     * Construction
+     * @return instance of CCPIXMDEDbManager
+     */
+    static CCPIXMDEDbManager* NewL(const TUid& aPluginImplUid);
+    /**
+     * Construction
+     * @return instance of CCPIXMDEDbManager
+     */
+    static CCPIXMDEDbManager* NewLC(const TUid& aPluginImplUid);
+    /**
+     * Destructor
+     */    
+    virtual ~CCPIXMDEDbManager();
+    
+    /**
+     * Utility method Add an Object ID in the database
+     * @param TUint& aObjectId
+     * @param aMdsItem mds entity to be added
+     * @return TCPixMdeDBManagerAPIReturnType
+     */    
+    TCPIXMDEDBAPIReturnType AddL(const TUint& aObjectId,CMDSEntity& aMdsItem);
+    
+    /**
+     * Utility method Update an Object 
+     * @param TUint& aObjectId
+     * @param aMdsItem mds entity to be added
+     * @return TCPixMdeDBManagerAPIReturnType
+     */
+    TCPIXMDEDBAPIReturnType UpdateL(const TUint& aObjId,CMDSEntity& aMdsItem);
+    /*
+     * Checks if item already exist in database
+     * @param aObjectId object id of MDS Items
+     * @return ETrue if exist else EFalse
+     */
+    TBool IsAlreadyExistL(const TUint& aObjectId);
+    
+    /*
+     * Get the MDS item from Database
+     * @param aKey object Id of item
+     * @param aMdsItem reference of entity
+     */
+    void GetItemL(const TInt aKey, CMDSEntity& aMdsItem); 
+
+    /**
+     * Utility method remove an Object ID in the database
+     * @param aObjectId Object ID
+     * @return TCPixMdeDBManagerAPIReturnType
+     */    
+    TCPIXMDEDBAPIReturnType RemoveL(const TUint& aObjectId);
+    
+    /**
+     * Utility method remove all items from database
+     * @return TCPixMdeDBManagerAPIReturnType
+     */    
+    TCPIXMDEDBAPIReturnType ResetL();    
+    
+protected:
+    /*
+     * second phase constructor ConstructL
+     */
+    void ConstructL(const TUid& aPluginImplUid);
+    /*
+     * Default constructor
+     */
+    CCPIXMDEDbManager(); //Default constructor
+    
+    
+private:
+    void CreateMdeCPIXSyncDBL(const TDesC& aDatabaseFile); 
+    
+    /**
+     * Creates a column set used to create a new database file.
+     * @return column set.
+     */
+    CDbColSet* CreateColumnSetLC();
+    void Rollback();
+        
+    
+private:
+    /**
+     *  Session to File system
+     */
+    RFs  iFs;
+    
+    //Flag to check if database is opened or not
+    TBool iOpened;
+    /**
+     * Interface to Notepad database     
+     */ 
+    RDbNamedDatabase iDatabase;    
+    /**
+     * handle to the table.owned
+     */ 
+    RDbTable iTable;
+    };
+
+#endif /* CPIXDOCFETCHER_H_ */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/harvesterplugins/media/mediautils/inc/mdeharvester.h	Mon Apr 19 14:40:05 2010 +0300
@@ -0,0 +1,124 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  MDE harvester utility class
+*
+*/
+
+#ifndef MDEHARVESTER_H_
+#define MDEHARVESTER_H_
+
+#include <e32def.h>
+#include <e32base.h>
+#include <mdesession.h>
+#include <mdequery.h>
+#include <mdeconstants.h>
+#include <mdeobjectquery.h>
+#include <mdccommon.h>
+#include <mdeitem.h>
+#include <mdeobject.h>
+#include "mdeobjectqueuemanager.h"
+
+class CMdeHarvester : public CActive,
+                      public MMdEQueryObserver
+   {
+   public:
+    /*
+     * Construction
+     * @param CMdESession* aSession valid mde session donot own
+     * @param MdeMEdiaObserver* aObserver media observer for completion donot own
+     * @param CMdeObjectQueueManager* aObjJobQueue object queue manager donot own
+     * @return instance of mde harvester
+     */
+   static CMdeHarvester* NewL(CMdESession* aSession,
+                              MdeMEdiaObserver* aObserver,
+                              CMdeObjectQueueManager* aObjJobQueue);
+   /*
+    * Construction
+    * @param CMdESession* aSession valid mde session
+    * @param MdeMEdiaObserver* aObserver media observer for completion
+    * @param CMdeObjectQueueManager* aObjJobQueue object queue manager
+    * @return instance of mde harvester
+    */   
+   static CMdeHarvester* NewLC(CMdESession* aSession,
+                               MdeMEdiaObserver* aObserver,
+                               CMdeObjectQueueManager* aObjJobQueue);
+   /*
+    * destruction
+    */
+   virtual ~CMdeHarvester();
+   public:
+   /*
+    * Callback from MMdEQueryObserver
+    * @param CMdEQuery& aQuery query instance
+    * @param TInt aFirstNewItemIndex
+    * @param TInt aNewItemCount
+    */
+   void HandleQueryNewResults(CMdEQuery& aQuery,
+                                          TInt aFirstNewItemIndex,
+                                          TInt aNewItemCount);
+   /*
+    * Callback from MMdEQueryObserver
+    * @param CMdEQuery& aQuery query instance
+    * @param TInt aError
+    */
+   void HandleQueryCompleted(CMdEQuery& aQuery, TInt aError);
+   /*
+    * DoHarvestL start harvesting 
+    * @param TDesC& aNameSpaceDef namespace definition
+    */
+   void DoHarvesetL(const TDesC& aNameSpaceDef);
+   //from CActive
+   void RunL();
+   void DoCancel();
+   TInt RunError();
+private:
+   /*
+    * Second phase constructor
+    * @param CMdESession* aSession valid mde session do not own
+    * @param MdeMEdiaObserver* aObserver media event observer completion do notown
+    * @param CMdeObjectQueueManager* aObjJobQueue job queue manager donot own
+    */
+   void ConstructL(CMdESession* aSession,
+                   MdeMEdiaObserver* aObserver,
+                   CMdeObjectQueueManager* aObjJobQueue);
+   /*
+    * Default constructor
+    */
+   CMdeHarvester();
+   /*
+    * Queryall media objects
+    * @param TDesC& aNameSpaceDef namespace definition
+    */
+   void QueryAllMediaObjectsL(const TDesC& aNameSpaceDef);
+   /*
+    * HandleNextRequest
+    */
+   void HandleNextRequestL();
+   /*
+    * AO completion on self
+    */
+   void CompleteSelf();
+private:
+   MdeMEdiaObserver* iObserver;//Media observer for event completion    
+   // session to metadata engine
+   CMdESession* iSession;
+   // metadata query
+   CMdEObjectQuery* iQuery;
+   CActiveSchedulerWait* iWait; //Nested AO wait
+   CMdeObjectQueueManager* iJobQueue;//Pass the Object for Metadata processing
+   TInt         iCurrentIndex; //Current index for MDE items
+   };
+
+
+#endif /* MDEHARVESTER_H_ */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/harvesterplugins/media/mediautils/inc/mdeobjectqueuemanager.h	Mon Apr 19 14:40:05 2010 +0300
@@ -0,0 +1,97 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  MDE object queuemanager for indexing scheduling
+ *
+*/
+
+
+#ifndef MDEOBJECTQUEUEMANAGER_H_
+#define MDEOBJECTQUEUEMANAGER_H_
+#include <e32def.h>
+#include <mdccommon.h>
+#include "mediaobjecthandler.h"
+
+class CMdeObjectQueueManager : public CActive
+    {
+public:
+    /*
+     * Construction
+     * @param MMediaObjectHandler* callback to media object handler dont own
+     * @return instance of object queue manager
+     */
+    static CMdeObjectQueueManager* NewL(MMediaObjectHandler* ); //For callback
+    /*
+     * Construction
+     * @param MMediaObjectHandler* callback to media object handler dont own
+     * @return instance of object queue manager
+     */
+    static CMdeObjectQueueManager* NewLC(MMediaObjectHandler* );
+    /*
+     * Destructor
+     */
+    virtual ~CMdeObjectQueueManager();
+public:
+    /*
+     * AddMedItemtoQueueL
+     * @param TItemId aObjId item id to be added to queue
+     * @param TCPixActionType aActionType CPIX action on item
+     */
+    void AddMdeItemToQueueL( TItemId aObjId, TCPixActionType aActionType);
+    //From CActive
+    void RunL();
+    void DoCancel();
+    TInt RunError();
+private:
+    /*
+     * OverWriteOrAddToQueueL add or update item to queue
+     * @param TItemId aObjId itemd id
+     * @param TCPixActionType aActionType action cpix
+     */
+    void OverWriteOrAddToQueueL( TItemId aObjId, TCPixActionType aActionType);
+    /*
+     * First phase Constructor
+     * @parm MMediaObjectHandler* media object handler callback
+     */
+    CMdeObjectQueueManager(MMediaObjectHandler* );
+    /*
+     * Second phase constructor
+     */
+    void ConstructL();
+private:
+    enum TState 
+    { 
+        EStateNone = 0, 
+        EStateWaiting 
+    };
+    struct TMdeActionRecord 
+    {
+    TItemId iObjectId;
+    TCPixActionType iAction;
+    TInt    iRetryCount;
+    TMdeActionRecord()
+        {
+        iRetryCount = 0;
+        }
+    };
+private:
+    // Queue of documents to be indexed
+    RArray<TMdeActionRecord> iJobQueue; 
+    // State machine's state
+    TState iState;
+    // Timer which is used to delay indexing messages
+    RTimer iTimer; //Timer for self activation of AO
+    MMediaObjectHandler* iMdeObjectHandler; //media object handler
+    };
+
+#endif /* MDEOBJECTQUEUEMANAGER_H_ */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/harvesterplugins/media/mediautils/inc/mdsitementity.h	Mon Apr 19 14:40:05 2010 +0300
@@ -0,0 +1,135 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: 
+*
+*/
+
+#ifndef MDSITEMENTITY_H_
+#define MDSITEMENTITY_H_
+
+#include <e32base.h>
+#include <f32file.h>
+
+class CMDSEntity : public CBase
+    {
+public:
+    /**
+    * Creates new instance of CMDSEntity based class.
+    * @return CMDSEntity* Newly created instance.
+    */
+    static CMDSEntity* NewLC();
+
+    /**
+    * Creates new instance of CMDSEntity based class.
+    * @return CMDSEntity* Newly created instance.
+    */
+    static CMDSEntity* NewL();
+
+    /**
+    * Creates new instance of CMDSEntity based class.
+    * @param aKey database index key
+    * @param aUri aUri
+    * @param aDrive drive number
+    * @return CMDSEntity* Newly created instance.
+    */
+    static CMDSEntity* NewLC(TInt aKey, const TDesC& aUri, TDriveNumber& aDrive);
+
+    /**
+    *Destructor
+    */
+    virtual ~CMDSEntity();
+    
+private:
+
+    /**
+    * Two-Phase Constructor 
+    */  
+    CMDSEntity();
+    
+    /**
+    * Over-loaded Constructor
+    */  
+    CMDSEntity(TInt aKey, const TDesC& aUri, TDriveNumber& aDrive);
+
+public:
+    /**
+    * Returns database key.
+    * @return TInt key value.
+    */
+    TInt Key() const;
+
+    /**
+    * Returns the Uri of Entity.
+    * @return TDesC .
+    */
+    const TDesC& Uri() const;
+
+    /**
+     * Returns the Drive number of Entity. 
+     * @return TDriveNumber reference of the Segmneted Content 
+     */
+    TDriveNumber DriveNumber();
+
+    /**
+    * Set Entity data.
+    * @param aKey database index
+    * @param aUri URI of entity
+    * @param aDrive drive
+    */
+    void Set(TInt aKey, const TDesC& aUri, TDriveNumber& aDrive);
+
+    /**
+     * Set the Key of entity. 
+     */
+    void Setkey(TInt aKey);
+    
+    /**
+    * Set Uri of entity
+    * @param aUritext of the note.
+    */
+    void SetUri(const TDesC& aUri);
+
+    /**
+    * Set Drive number of entity
+    * @param aDrive of entity
+    */
+    void SetDrive(TDriveNumber& aDrive);
+    
+    /*
+     * Reset the state of entity variables
+     */
+    void Reset();
+    
+    /**
+    * Returns the Path of Entity with root drive.
+    * @return TDesC .
+    */
+    const TDesC& GetPath();
+
+private:
+    
+    // The Unique Identifier
+    TInt iKey; //Mapped to ObjectId of MDS item
+    
+    //URI Can never exceed System Limit
+    TBuf<KMaxFileName> iUri;  
+    
+    //Drive number on which items stored
+    TDriveNumber  iDriveNumber;
+    
+    //Absolute path with root drive 
+    TBuf<KMaxFileName> iPath;
+    };
+
+#endif /* MDSITEMENTITY_H_ */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/harvesterplugins/media/mediautils/inc/mdsmediamonitor.h	Mon Apr 19 14:40:05 2010 +0300
@@ -0,0 +1,85 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  MDE media monitor utility
+ *
+*/
+
+
+#ifndef MDSAUDIOMONITOR_H_
+#define MDSAUDIOMONITOR_H_
+
+#include <e32def.h>
+#include <mdesession.h>
+
+//Forward declaration
+class CMdeObjectQueueManager; //Queue all Audio objects for Indexing
+class CMdESession;
+
+class CMdsMediaMonitor : public CBase,
+                         public MMdEObjectObserver,
+                         public MMdEObjectPresentObserver
+    {
+public:
+    /*
+     * NewL construction
+     * @param CMdESession* valid mde session donot own
+     * @param CMdeObjectQueueManager* object queue manager do not own
+     * @return instance of media monitor
+     */
+    static CMdsMediaMonitor* NewL(CMdESession* ,CMdeObjectQueueManager* );
+    /*
+     * NewLC construction
+     * @param CMdESession* valid mde session do not own
+     * @param CMdeObjectQueueManager* object queue manager do not own
+     * @return instance of media monitor
+     */
+    static CMdsMediaMonitor* NewLC(CMdESession* ,CMdeObjectQueueManager* );
+    /*
+     * Destructor
+     */
+    virtual ~CMdsMediaMonitor();
+private:
+    /*
+     * parameterized constructor
+     * @param CMdESession* valid mde session do not own
+     * @param CMdeObjectQueueManager* mde object queue manager donot own
+     */
+    CMdsMediaMonitor(CMdESession* ,CMdeObjectQueueManager* ); //default constructor
+    /*
+     * Second phase constructor
+     */
+    void ConstructL();  //Second phase constructor
+public:
+    /*
+     * StartMonitoring
+     * @param TDesC& aNameSpaceDef name space
+     */
+    void StartMonitoringL(const TDesC& aNameSpaceDef); //Controlled by owner
+    /*
+     * StopMonitoring stops sending events
+     */
+    void StopMonitoringL();
+    //From MMdEObjectObserver
+    void HandleObjectNotification(CMdESession& aSession, 
+                            TObserverNotificationType aType,
+                            const RArray<TItemId>& aObjectIdArray);
+    void HandleObjectPresentNotification(CMdESession& aSession, 
+                TBool aPresent, const RArray<TItemId>& aObjectIdArray);
+private:
+    CMdESession* iMdsSession; //do not own
+    //Maintain queue of object array with actions for indexing
+    CMdeObjectQueueManager* iMdeObjectQueueManager; 
+    };
+
+#endif /* MDSAUDIOMONITOR_H_ */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/harvesterplugins/media/mediautils/inc/mdssessionobjectutils.h	Mon Apr 19 14:40:05 2010 +0300
@@ -0,0 +1,90 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  MDE session utility class
+ *
+*/
+
+#ifndef MDSSESSIONOBJECTUTILS_H_
+#define MDSSESSIONOBJECTUTILS_H_
+
+#include <mdccommon.h>
+#include <mdesession.h>
+#include <mdequery.h>
+
+//Forward declaration
+class CMdeObject;
+
+class CMdsSessionObjectUtils : public CBase,
+                               public MMdESessionObserver,
+                               public MMdEQueryObserver
+    {
+public:
+    /*
+     * NewL construction
+     * @return instance of mds session utils
+     */
+    static CMdsSessionObjectUtils* NewL();
+    /*
+     * NewLC construction
+     * @return instance of mds session utils
+     */
+    static CMdsSessionObjectUtils* NewLC();
+    /*
+     * Destructor
+     */
+    virtual ~CMdsSessionObjectUtils();
+    /*
+     * InitializeL 
+     */
+    void InitializeL(); //Open valid mde Sessions
+
+public:
+    //From MMdESessionObserver
+    void HandleSessionOpened(CMdESession& aSession, TInt aError);
+    void HandleSessionError(CMdESession& aSession, TInt aError);
+    //From MMdEQueryObserver
+    void HandleQueryNewResults(CMdEQuery& aQuery,
+                               TInt aFirstNewItemIndex,
+                               TInt aNewItemCount);
+    void HandleQueryCompleted(CMdEQuery& aQuery, TInt aError);
+    
+private:
+    /*
+     * Second phase constructor
+     */
+    void ConstructL();
+    /*
+     * default constructor
+     */
+    CMdsSessionObjectUtils();
+public:
+    /*
+     * GetSession
+     * @return instance of valid mde session
+     */
+    CMdESession* GetSession(); //get valid session
+    /*
+     * GetObjectL
+     * @param TItemId& aItemId mde item id to get
+     * @param TDesC& aObjectDefName object definition
+     * @return reference of object 
+     */
+    CMdEObject& GetObjectL(const TItemId& aItemId,const TDesC& aObjectDefName);
+private:
+    CMdESession*     iMdeSession; //Valid mde session
+    CMdEObjectQuery* iQuery; // metadata query
+    CActiveSchedulerWait* iWait; //Nested AO wait
+    };
+
+#endif /* MDSSESSIONOBJECTUTILS_H_ */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/harvesterplugins/media/mediautils/inc/mediaobjecthandler.h	Mon Apr 19 14:40:05 2010 +0300
@@ -0,0 +1,47 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  media object handler callbacks
+ *
+*/
+
+
+#ifndef MEDIAOBJECTHANDLER_H_
+#define MEDIAOBJECTHANDLER_H_
+#include <mdccommon.h>
+#include "common.h"
+
+class MdeMEdiaObserver
+   {
+public:
+   /*
+    * HarvestingCompletedL signals when harvesting completed
+    */
+   virtual void HarvestingCompletedL() = 0;
+   };
+
+class MMediaObjectHandler
+    {
+public:
+    /*
+     * HandleMdeItemL callback to notify for Mde item
+     * @param TItemId aObjId object id of item
+     * @param TCPixActionType aActionType cpix action type
+     */
+    virtual void HandleMdeItemL( TItemId aObjId, TCPixActionType aActionType) = 0;
+#ifdef __PERFORMANCE_DATA
+    virtual void UpdateLogL() = 0;
+# endif	
+    };
+
+#endif /* MEDIAOBJECTHANDLER_H_ */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/harvesterplugins/media/mediautils/inc/mmceventobserver.h	Mon Apr 19 14:40:05 2010 +0300
@@ -0,0 +1,34 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  mmc instertion removal event observer callback
+ *
+*/
+
+
+#ifndef MMCEVENTOBSERVER_H_
+#define MMCEVENTOBSERVER_H_
+
+class MMMCEventObserver
+    {
+public:
+    //Observer implement this to get MMC events on mounted drive
+    //aMMCInsertRemoval is ETrue when MMC inserted EFalse otherwise
+    /*
+     * HandleMMCEventL
+     * @param TDriveNumber aDrive drive number of MMC
+     * @param TBool aMMCInsertRemoval ETrue if inserted else EFalse
+     */
+    virtual void HandleMMCEventL(const TDriveNumber aDrive,const TBool aMMCInsertRemoval) = 0;
+    };
+#endif /* MMCEVENTOBSERVER_H_ */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/harvesterplugins/media/mediautils/inc/mmcmonitor.h	Mon Apr 19 14:40:05 2010 +0300
@@ -0,0 +1,108 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Mmc monitor
+*
+*/
+
+
+
+#ifndef MMCMONITORUTIL_H
+#define MMCMONITORUTIL_H
+
+//  INCLUDES 
+#include <e32base.h>
+#include <e32property.h>
+#include <driveinfo.h>
+#include <common.h>
+#include <f32file.h>
+#include "mmceventobserver.h"
+
+/**
+ * Mmc monitoring
+ * Implements CActive
+ */
+class CMMCMonitorUtil : public CActive
+    {
+public:
+    /**
+     * NewL
+     * @param MMMCEventObserver* aObserver event observer
+     * @return CMMCMonitorUtil Monitor item
+     */
+    static CMMCMonitorUtil* NewL( MMMCEventObserver* aObserver);
+
+    /**
+     * Destructor
+     */
+    virtual ~CMMCMonitorUtil();
+
+    /**
+     * StartMonitoring
+     * Start monitoring mmc
+     * This function calls CMMCMonitorUtil::RunL() to initiate the MMC status 
+     * checking.
+     * @return TBool success status
+     */
+    TBool StartMonitoring();
+protected: // CActive
+    /**
+     * From CActive.
+     */
+    void DoCancel();
+
+    /**
+     * From CActive.
+     * 
+     */
+    void RunL();
+
+    /**
+     * From CActive.
+     * @param aError Leave code from RunL()
+     * @return hard-coded KErrNone
+     */
+    TInt RunError( TInt aError );
+private:
+    /**
+     * MmcStatus
+     * Utility function that checks the DriveInfo properties of drive
+     * aDriveNumber to decide if aDriveNumber is an MMC drive or not.
+     * @param aDriveNumber, the drive of the Mmc.
+     * @return ETrue indicates that aDriveNumber is a MMC drive.
+     */
+    TBool MmcStatus( TInt aDriveNumber );
+    
+    /**
+     * Constructor
+     * @param MMMCEventObserver* aObserver event observer
+     */
+    CMMCMonitorUtil( MMMCEventObserver* aObserver );
+
+    /**
+     * 2nd phase construction
+     * @param RFs* aFsSession File server session
+     */
+    void ConstructL();
+private: // data members
+    // File system handle
+    RFs iFsSession;
+    // inserted/ejected status of mmc
+    TBool iMmcStatus;
+    // MMC Inserted/ejected property
+    RProperty iProperty;
+    //Notify MMC event back to observer
+    MMMCEventObserver* iObserver;
+    };
+#endif // MMCMONITORUTIL_H
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/harvesterplugins/media/mediautils/src/cpixdocfetcher.cpp	Mon Apr 19 14:40:05 2010 +0300
@@ -0,0 +1,235 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  MDS to CPIX Document fetcher 
+ *
+*/
+
+
+#include "cpixdocfetcher.h"
+#include "csearchdocument.h"
+#include <mdeobject.h>
+#include <mdccommon.h>
+#include <mdeitem.h>
+#include <mdeconstants.h>
+#include <mdeobjectdef.h>
+#include "harvesterserverlogger.h"
+
+#define CPIX_MIMETYPE_FIELD      L"_mimetype"
+#define LCPIX_MIMETYPE_FIELD     L"_mimetype"
+const TInt KStartPosition = 2; //Start position of absolute path
+const TInt KDrivePosition = 0; //Drive position in object Uri
+const TInt KMaxMediaLength = 14;
+const TInt KMaxExtLength = 5;
+//To unsigned decimal representation as UIds are out of range for signed decimal
+_LIT(KFormat, "%u");
+_LIT(KNameField, "Name");
+_LIT(KMediaIdField, "MediaId");
+_LIT(KExtensionField, "Extension");
+
+// -----------------------------------------------------------------------------
+// CCPIXDocFetcher::NewL()
+// -----------------------------------------------------------------------------
+//
+CCPIXDocFetcher* CCPIXDocFetcher::NewL()
+    {
+    CCPIXDocFetcher* self = CCPIXDocFetcher::NewLC();
+    CleanupStack::Pop(self);
+    return self;
+    }
+
+// -----------------------------------------------------------------------------
+// CCPIXDocFetcher::NewLC()
+// -----------------------------------------------------------------------------
+//
+CCPIXDocFetcher* CCPIXDocFetcher::NewLC()
+    {
+    CCPIXDocFetcher* self = new (ELeave) CCPIXDocFetcher();
+    CleanupStack::PushL(self);
+    self->ConstructL();
+    return self;
+    }
+
+// -----------------------------------------------------------------------------
+// CCPIXDocFetcher::~CCPIXDocFetcher()
+// -----------------------------------------------------------------------------
+//
+CCPIXDocFetcher::~CCPIXDocFetcher()
+    {
+    iFs.Close();
+    }
+
+// -----------------------------------------------------------------------------
+// CCPIXDocFetcher::~ConstructL() 
+// -----------------------------------------------------------------------------
+//
+void CCPIXDocFetcher::ConstructL()
+    {
+    //Heap variables if any
+    User::LeaveIfError(iFs.Connect());
+    }
+
+// -----------------------------------------------------------------------------
+// CCPIXDocFetcher::CCPIXDocFetcher() 
+// -----------------------------------------------------------------------------
+//
+CCPIXDocFetcher::CCPIXDocFetcher()
+    {
+    
+    }
+
+// -----------------------------------------------------------------------------
+// CCPIXDocFetcher::GetCpixDocumentL() 
+// -----------------------------------------------------------------------------
+//
+CSearchDocument* CCPIXDocFetcher::GetCpixDocumentL(const CMdEObject& aObject,
+                                                   const TDesC& aAppClass,
+                                                   CMdEObjectDef& aObjectDef)
+    {
+    CPIXLOGSTRING("START CCPIXDocFetcher::GetCpixDocumentL");
+    CSearchDocument* index_item = NULL;
+    if(aObject.Uri() != KNullDesC) //Uri is must have property we will store items which has URI
+        {
+        SetAbsoluteURI(aObject.Uri());//Convert URI to absolute path 
+        index_item = CSearchDocument::NewLC(GetUri(), aAppClass);
+        //Uri is our Document ID
+        AddFiledtoDocumentL(*index_item,
+                               KNameField, //URI as Name field
+                               GetUri());
+        //Store media ID for client to generate path and launch corresponding Item
+        TBuf<KMaxMediaLength> mediaBuf;        
+        
+        //As the MDS database is storing incorrect MediaIds, fetch the uniqueid from the 
+        //file system.If the issue is fixed in 10.1 then Ids from MDS can be directly used
+        
+        //GetMediaIdDescriptor(aObject.MediaId(),mediaBuf);
+        GetMediaIdDescriptorFromFsL(aObject.Uri(),mediaBuf);
+        //Uri is our Document ID
+        AddFiledtoDocumentL(*index_item, KMediaIdField, mediaBuf,
+                             CDocumentField::EStoreYes | CDocumentField::EIndexUnTokenized);
+        CPIXLOGSTRING("CCPIXDocFetcher::GetCpixDocumentL Standard Property URI, Media ID Added");
+        
+        //Get the media file extension and store
+        TBuf<KMaxExtLength> extension;        
+        GetExtension(aObject.Uri(),extension);
+        AddFiledtoDocumentL( *index_item, KExtensionField, extension );
+        
+        CMdEProperty* property(NULL);
+        CMdEPropertyDef& titlePropDef = aObjectDef.GetPropertyDefL(MdeConstants::Object::KTitleProperty );
+        if(aObject.Property( titlePropDef, property ) != KErrNotFound)
+           {
+           //Add field to document
+           CMdETextProperty* textProperty = ( CMdETextProperty* ) property;
+           if(textProperty->Value() != KNullDesC)
+               {
+               AddFiledtoDocumentL(*index_item,
+                                     MdeConstants::Object::KTitleProperty,
+                                     textProperty->Value());
+               index_item->AddExcerptL(textProperty->Value());
+               }
+           else
+               {
+               index_item->AddExcerptL(aObject.Uri());
+               }
+           }
+        else
+           {
+           //No property title
+           index_item->AddExcerptL(aObject.Uri());
+           }
+        //Item type as MIME type
+        CMdEPropertyDef& mimeTypePropDef = aObjectDef.GetPropertyDefL(MdeConstants::Object::KItemTypeProperty);
+        if(aObject.Property( mimeTypePropDef, property )!= KErrNotFound)
+           {
+           //Add field to document
+           CMdETextProperty* textProperty = ( CMdETextProperty* ) property;
+           AddFiledtoDocumentL(*index_item,
+                               _L(CPIX_MIMETYPE_FIELD),
+                               textProperty->Value(),
+                               CDocumentField::EStoreYes | CDocumentField::EIndexUnTokenized);
+           }
+        CleanupStack::Pop(index_item);//pop up
+        }    
+    CPIXLOGSTRING("END CCPIXDocFetcher::GetCpixDocumentL");
+    return index_item;
+    }
+
+// -----------------------------------------------------------------------------
+// CCPIXDocFetcher::GetUri() 
+// -----------------------------------------------------------------------------
+//
+const TDesC& CCPIXDocFetcher::GetUri()
+    {
+    return iUri;
+    }
+
+// -----------------------------------------------------------------------------
+// CCPIXDocFetcher::GetMediaIdDescriptor() 
+// -----------------------------------------------------------------------------
+//
+void CCPIXDocFetcher::GetMediaIdDescriptor(const TUint32& aMediaId,
+                                           TDes& aMediaIDBuf)
+    {
+    aMediaIDBuf.Format(_L("%d"),aMediaId);
+    }
+
+// -----------------------------------------------------------------------------
+// CCPIXDocFetcher::GetMediaIdDescriptorFromFs() 
+// -----------------------------------------------------------------------------
+//
+void CCPIXDocFetcher::GetMediaIdDescriptorFromFsL(const TDesC& aUri,
+                                           TDes& aMediaIDBuf)
+    {
+    TVolumeInfo volumeInfo;
+    TInt driveNumber;
+    TChar driveLetter;
+    driveLetter = aUri[KDrivePosition];    
+    User::LeaveIfError(iFs.CharToDrive(driveLetter,driveNumber));
+    User::LeaveIfError(iFs.Volume(volumeInfo,driveNumber));
+    aMediaIDBuf.Format(KFormat, volumeInfo.iUniqueID);    
+    }
+
+void CCPIXDocFetcher::GetExtension(const TDesC& aUri,
+                              TDes& aExtension)
+    {
+    TInt pos = aUri.LocateReverse('.');
+    if(pos > 0)
+        {
+         aExtension.Copy(aUri.Mid(pos+1));
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CCPIXDocFetcher::SetAbsoluteURI() 
+// -----------------------------------------------------------------------------
+//
+void CCPIXDocFetcher::SetAbsoluteURI(const TDesC& aUri)
+    {
+    iUri.Copy(aUri.Mid(KStartPosition));
+    }
+
+// -----------------------------------------------------------------------------
+// CCPIXDocFetcher::AddFiledtoDocumentL() 
+// -----------------------------------------------------------------------------
+//
+void CCPIXDocFetcher::AddFiledtoDocumentL(CSearchDocument& aSearchDoc,
+                                          const TDesC& aFiledName,
+                                          const TDesC& aValue,
+                                          TInt aConfig)
+    {
+    if(aValue != KNullDesC)
+        aSearchDoc.AddFieldL(aFiledName, aValue, aConfig);
+    else
+        aSearchDoc.AddFieldL(aFiledName, KNullDesC, aConfig);    
+    }
+//End of life
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/harvesterplugins/media/mediautils/src/cpixindexerutils.cpp	Mon Apr 19 14:40:05 2010 +0300
@@ -0,0 +1,470 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Indexer utility create indexes for each drive
+ *
+*/
+
+
+#include "cpixindexerutils.h"
+#include <ccpixindexer.h>
+#include "harvesterserverlogger.h"
+#include <driveinfo.h> // TDriveInfo
+
+// maximum length that the fully qualified msg Plugin base app class descriptor can be
+// e.g. "@c:root media"
+const TInt KMsgPluginBaseAppClassMaxLen = 64;
+
+// local declarations and functions
+namespace {
+_LIT(KCPixSearchServerPrivateDirectory, "\\Private\\2001f6f7\\");
+_LIT(KPathIndexDbPath, CPIX_INDEVICE_INDEXDB);
+
+_LIT(KAtSign, "@");
+_LIT(KColon, ":");
+};
+
+// -----------------------------------------------------------------------------
+// CCPixIndexerUtils::NewL()
+// -----------------------------------------------------------------------------
+//
+CCPixIndexerUtils* CCPixIndexerUtils::NewL(RSearchServerSession& aSession)
+    {
+    CCPixIndexerUtils* self = CCPixIndexerUtils::NewLC(aSession);
+    CleanupStack::Pop(self);
+    return self;
+    }
+
+// -----------------------------------------------------------------------------
+// CCPixIndexerUtils::NewLC()
+// -----------------------------------------------------------------------------
+//
+CCPixIndexerUtils* CCPixIndexerUtils::NewLC(RSearchServerSession& aSession)
+    {
+    CCPixIndexerUtils* self = new (ELeave) CCPixIndexerUtils();
+    CleanupStack::PushL(self);
+    self->ConstructL(aSession);
+    return self;
+    }
+
+// -----------------------------------------------------------------------------
+// CCPixIndexerUtils::~CCPixIndexerUtils()
+// -----------------------------------------------------------------------------
+//
+CCPixIndexerUtils::~CCPixIndexerUtils()
+    {
+    iFs.Close();
+    for(TInt i=0;i<(EDriveZ+1);i++)
+        {
+        delete iIndexer[i];
+        iIndexer[i] = NULL;
+        }
+    iMountedDrives.Reset();
+    }
+    
+
+// -----------------------------------------------------------------------------
+// CCPixIndexerUtils::CCPixIndexerUtils()
+// -----------------------------------------------------------------------------
+//
+CCPixIndexerUtils::CCPixIndexerUtils()
+    {
+    
+    }
+
+// -----------------------------------------------------------------------------
+// CCPixIndexerUtils::ConstructL()
+// -----------------------------------------------------------------------------
+//
+void CCPixIndexerUtils::ConstructL(RSearchServerSession& aSession)
+    {
+    User::LeaveIfError(iFs.Connect());
+    iSearchSession = aSession;
+    for(TInt i=0;i<(EDriveZ+1);i++)
+        {
+        iIndexer[i] = NULL;
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CCPixIndexerUtils::GetDriveFromMediaId()
+// -----------------------------------------------------------------------------
+//
+void CCPixIndexerUtils::GetDriveFromMediaId(TUint aUniqueID,TDriveNumber& aDrive)
+    {
+    aDrive = TDriveNumber(KErrNotSupported);//Initialize to not supported first
+    TVolumeInfo volumeInfo;
+    for(TInt i=0;i<=EDriveZ;i++)
+       {
+       TInt err= iFs.Volume(volumeInfo,i);
+        if (err!=KErrNotReady) 
+            // Volume() returns KErrNotReady if no volume present.
+            // In this case, check next drive number
+            {
+            if(volumeInfo.iUniqueID == aUniqueID)
+                {
+                aDrive = TDriveNumber(i);//Is the drive
+                break;
+                }
+            }
+       }
+    }
+
+//Where Genreic is :root media and base app class is the return
+// -----------------------------------------------------------------------------
+// CCPixIndexerUtils::FormBaseAppClass()
+// -----------------------------------------------------------------------------
+//
+TInt CCPixIndexerUtils::FormBaseAppClass(TDriveNumber aMedia,const 
+                                         TDesC& aBaseAppClassGeneric,
+                                         TDes& aBaseAppClass)
+    {
+    TChar chr;
+    const TInt ret = RFs::DriveToChar(aMedia, chr);
+    if (KErrNone == ret)
+        {
+        aBaseAppClass.Copy(KAtSign);
+        aBaseAppClass.Append(chr);
+        aBaseAppClass.LowerCase();
+        //Append generic class like :root media audio or :root media video
+        aBaseAppClass.Append(aBaseAppClassGeneric);
+        }
+    return ret;    
+    }
+    
+//Where path is trailer e.g. \\root\\media\\audio
+// -----------------------------------------------------------------------------
+// CCPixIndexerUtils::MountAllAvailableDriveL()
+// -----------------------------------------------------------------------------
+//
+void CCPixIndexerUtils::MountAllAvailableDriveL(const TDesC& aBaseAppClassGeneric,
+                                                const TDesC& aPath)
+    {
+    CPIXLOGSTRING("START CCPixIndexerUtils::MountAllAvailableDriveL");
+    TDriveList drivelist; 
+    User::LeaveIfError(iFs.DriveList(drivelist));
+    TInt driveNumber;
+    TChar driveLetter;
+    for (driveNumber=EDriveA; driveNumber<=EDriveZ;driveNumber++)
+        {
+        if (drivelist[driveNumber] && 
+                IsDriveCanbeMountedL(TDriveNumber(driveNumber))) // if drive-list entry non-zero, drive is available
+            {
+            User::LeaveIfError(iFs.DriveToChar(driveNumber,driveLetter));
+            // The following line prints the drive letter followed by the hex value 
+            // of the integer indicating that drive's attributes 
+            
+            // Check if already exists
+            if (iIndexer[driveNumber])
+                return;
+            
+            // Form the baseappclass for this media
+            TBuf<KMsgPluginBaseAppClassMaxLen> baseAppClass;
+            FormBaseAppClass(TDriveNumber(driveNumber),aBaseAppClassGeneric,baseAppClass);
+
+            // Define this volume
+            HBufC* path = DatabasePathLC(TDriveNumber(driveNumber),aPath);
+            User::LeaveIfError(iSearchSession.DefineVolume(baseAppClass, *path));
+            CleanupStack::PopAndDestroy(path);
+            
+            // construct and open the database
+            TRAPD(err,iIndexer[driveNumber] = CCPixIndexer::NewL(iSearchSession));
+            CPIXLOGSTRING2("CCPixIndexer::NewL returned : %d", err );
+            TRAP(err,iIndexer[driveNumber]->OpenDatabaseL(baseAppClass));
+            if(err == KErrNone)
+                {
+                iMountedDrives.Append(TDriveNumber(driveNumber));
+                CPIXLOGSTRING2("CCPixIndexerUtils::MountAllAvailableDriveL Drive %d Mounted",driveNumber);
+                }
+            }
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CCPixIndexerUtils::UnMountAllDrivesL()
+// -----------------------------------------------------------------------------
+//
+void CCPixIndexerUtils::UnMountAllDrivesL(const TDesC& aBaseAppClassGeneric,TBool aUndefine )
+    {
+    CPIXLOGSTRING("START CCPixIndexerUtils::UnMountAllDrivesL");
+    TInt driveNumber;
+    for (driveNumber=EDriveA; driveNumber<=EDriveZ;driveNumber++)
+       {
+        // Check if already exists
+        if (!iIndexer[driveNumber])
+            continue;
+        
+        // Form the baseappclass for this media
+        TBuf<KMsgPluginBaseAppClassMaxLen> baseAppClass;
+        FormBaseAppClass(TDriveNumber(driveNumber), aBaseAppClassGeneric,baseAppClass);             
+            
+        // Delete the index object
+        if (iIndexer[driveNumber])
+            {
+            delete iIndexer[driveNumber];
+            iIndexer[driveNumber] = NULL;
+            }
+        
+        // if the aActionType is EFFMmcDismount, then the
+        // parameter aFilename is the baseAppClass of the Index database
+        // to be dropped.
+        if (aUndefine)
+            iSearchSession.UnDefineVolume(baseAppClass);
+       }
+    iMountedDrives.Reset();//Reset all available
+    }
+
+// -----------------------------------------------------------------------------
+// CCPixIndexerUtils::DatabasePathLC()
+// -----------------------------------------------------------------------------
+//
+HBufC* CCPixIndexerUtils::DatabasePathLC(TDriveNumber aMedia,const TDesC& aPath)
+    {
+    CPIXLOGSTRING("START CCPixIndexerUtils::DatabasePathLC");
+    // Allocate extra space for root path e.g. "C:\\Private\\2001f6f7\\"
+    const TInt KRootPathMaxLength = 30;
+    HBufC* indexDbPath = HBufC::NewLC(KRootPathMaxLength + KPathIndexDbPath().Length() + aPath.Length());
+    TPtr indexDbPathPtr = indexDbPath->Des();
+
+#if 1 // Data caging implementation
+    iFs.CreatePrivatePath(aMedia);
+
+    TChar chr;
+    RFs::DriveToChar(aMedia, chr);
+    indexDbPathPtr.Append(chr);
+    indexDbPathPtr.Append(KColon);
+
+    TFileName pathWithoutDrive;
+    iFs.PrivatePath(pathWithoutDrive);
+    indexDbPathPtr.Append(KCPixSearchServerPrivateDirectory);
+#else // here is the way to calculate the path if data caging is not being used.
+    TFileName rootPath;
+    PathInfo::GetRootPath(rootPath, aMedia);
+    indexDbPathPtr.Append(rootPath);
+#endif 
+
+    indexDbPathPtr.Append(KPathIndexDbPath);
+    indexDbPathPtr.Append(aPath);
+
+    return indexDbPath;
+    }
+
+// -----------------------------------------------------------------------------
+// CCPixIndexerUtils::MountDriveL()
+// -----------------------------------------------------------------------------
+//
+void CCPixIndexerUtils::MountDriveL(TDriveNumber aMedia,
+                                    const TDesC& aBaseAppClassGeneric,
+                                    const TDesC& aPath)
+    {
+    CPIXLOGSTRING("START CCPixIndexerUtils::MountL");
+    // Check if already exists
+    if (iIndexer[aMedia])
+        {
+        CPIXLOGSTRING2("CCPixIndexerUtils::MountL Drive %d already Mounted",aMedia);
+        return;
+        }
+    if(IsDriveCanbeMountedL(aMedia))
+        {
+        // Form the baseappclass for this media
+        TBuf<KMsgPluginBaseAppClassMaxLen> baseAppClass;
+        FormBaseAppClass(TDriveNumber(aMedia), aBaseAppClassGeneric,baseAppClass);
+    
+        // Define this volume
+        HBufC* path = DatabasePathLC(TDriveNumber(aMedia),aPath);
+        User::LeaveIfError(iSearchSession.DefineVolume(baseAppClass, *path));
+        CleanupStack::PopAndDestroy(path);
+        
+        // construct and open the database
+        TRAPD(err,iIndexer[aMedia] = CCPixIndexer::NewL(iSearchSession));
+        CPIXLOGSTRING2("CCPixIndexer::NewL returned : %d", err );
+        TRAP(err,iIndexer[aMedia]->OpenDatabaseL(baseAppClass));
+        iMountedDrives.AppendL(TDriveNumber(aMedia));
+        CPIXLOGSTRING2("CCPixIndexerUtils::MountDriveL Drive %d Mounted",aMedia);
+        CPIXLOGSTRING("END CCPixIndexerUtils::MountL");
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CCPixIndexerUtils::UnMountDriveL()
+// -----------------------------------------------------------------------------
+//
+void CCPixIndexerUtils::UnMountDriveL(TDriveNumber aMedia,
+                                      const TDesC& aBaseAppClassGeneric,
+                                      TBool aUndefine )
+    {
+    CPIXLOGSTRING("START CCPixIndexerUtils::UnMount");
+    // Check if already exists
+    if (!iIndexer[aMedia])
+        return;
+    // Form the baseappclass for this media
+    TBuf<KMsgPluginBaseAppClassMaxLen> baseAppClass;
+    FormBaseAppClass(aMedia, aBaseAppClassGeneric,baseAppClass);             
+        
+    // Remove from harvesting queue
+    //iObserver->RemoveHarvestingQueue(this, baseAppClass);   
+    
+    // Delete the index object
+    if (iIndexer[aMedia])
+        {
+        delete iIndexer[aMedia];
+        iIndexer[aMedia] = NULL;
+        }
+    
+    // if the aActionType is EFFMmcDismount, then the
+    // parameter aFilename is the baseAppClass of the Index database
+    // to be dropped.
+    if (aUndefine)
+        iSearchSession.UnDefineVolume(baseAppClass);
+    //Remove from Mounted List
+    RemoveUnmountedDrive(aMedia);
+    CPIXLOGSTRING("END CCPixIndexerUtils::UnMount");
+    }
+
+// -----------------------------------------------------------------------------
+// CCPixIndexerUtils::RemoveUnmountedDrive()
+// -----------------------------------------------------------------------------
+//
+void CCPixIndexerUtils::RemoveUnmountedDrive(TDriveNumber aMedia)
+    {
+    for(TInt i=0;i<iMountedDrives.Count();i++)
+        {
+        TDriveNumber drive = iMountedDrives[i];
+        if(drive == aMedia)
+            {
+            iMountedDrives.Remove(i);
+            break;
+            }
+        }
+    return;
+    }
+
+// -----------------------------------------------------------------------------
+// CCPixIndexerUtils::IsMediaRemovableL()
+// -----------------------------------------------------------------------------
+//
+TBool CCPixIndexerUtils::IsMediaRemovableL(const TDriveNumber& aDrive)
+    {
+    TDriveInfo driveInfo; 
+    User::LeaveIfError(iFs.Drive(driveInfo,aDrive));
+    TBool mediaRemovable(EFalse);
+    driveInfo.iDriveAtt & KDriveAttRemovable ? mediaRemovable = ETrue : mediaRemovable = EFalse;
+    return mediaRemovable;
+    }
+
+// -----------------------------------------------------------------------------
+// CCPixIndexerUtils::IsDriveCanbeMountedL()
+// -----------------------------------------------------------------------------
+//
+TBool CCPixIndexerUtils::IsDriveCanbeMountedL(TDriveNumber aDrive)
+    {
+    TBool driveCanBeMount(ETrue);
+    TUint drvStatus( 0 );
+    TInt err = DriveInfo::GetDriveStatus(iFs, TDriveNumber(aDrive), drvStatus);
+    if ( err != KErrNone )
+        {
+        return EFalse;
+        }
+    // Harvest drive that are not ROM and Uservisible and Present
+    if (!( drvStatus & DriveInfo::EDriveRom ) && // NOT ROM Drive
+         ( drvStatus & DriveInfo::EDriveUserVisible ) &&
+         ( drvStatus & DriveInfo::EDrivePresent ) )
+        {
+        driveCanBeMount = ETrue;
+        }
+    else
+        {
+        driveCanBeMount = EFalse;
+        }
+    return driveCanBeMount;
+    }
+
+// -----------------------------------------------------------------------------
+// CCPixIndexerUtils::GetIndexerFromDrive()
+// -----------------------------------------------------------------------------
+//
+CCPixIndexer* CCPixIndexerUtils::GetIndexerFromDrive(TDriveNumber aMedia)
+    {
+    if(iIndexer[aMedia])
+        {
+        return iIndexer[aMedia];
+        }
+    else
+        {
+        return NULL;
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CCPixIndexerUtils::GetIndexerFromMediaId()
+// -----------------------------------------------------------------------------
+//
+CCPixIndexer* CCPixIndexerUtils::GetIndexerFromMediaId(TUint aUniqueID)
+    {
+    TDriveNumber drive;
+    GetDriveFromMediaId(aUniqueID,drive);
+    if(iFs.IsValidDrive(drive)) //If in case drive removed
+        {
+        return iIndexer[drive];
+        }
+    else
+        {
+        return NULL;
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CCPixIndexerUtils::IsAlreadyAvilable()
+// -----------------------------------------------------------------------------
+//
+TBool CCPixIndexerUtils::IsAlreadyAvilable(TDriveNumber aMedia)
+    {
+    TBool bAlready(EFalse);
+    for(TInt i=0;i<iMountedDrives.Count();i++)
+        {
+        TDriveNumber drive = iMountedDrives[i];
+        if(drive == aMedia)
+            {
+            bAlready = ETrue;
+            break;
+            }
+        }
+    return bAlready;
+    }
+
+// -----------------------------------------------------------------------------
+// CCPixIndexerUtils::ResetAllL()
+// -----------------------------------------------------------------------------
+//
+void CCPixIndexerUtils::ResetAllL()
+    {
+    for(TInt i=0;i<iMountedDrives.Count();i++)
+        {
+        TDriveNumber drive = iMountedDrives[i];
+        if(iIndexer[drive])
+            {
+            iIndexer[drive]->ResetL();
+            }
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CCPixIndexerUtils::GetMountedDriveList()
+// -----------------------------------------------------------------------------
+//
+RArray<TDriveNumber>& CCPixIndexerUtils::CCPixIndexerUtils::GetMountedDriveList()
+    {
+    return iMountedDrives;
+    }
+
+//End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/harvesterplugins/media/mediautils/src/cpixmdedbmanager.cpp	Mon Apr 19 14:40:05 2010 +0300
@@ -0,0 +1,478 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Utility class for creating and accessing the mde and Cpix Sync Table 
+*
+*/
+
+
+#include "cpixmdedbmanager.h"
+#include <harvesterserverlogger.h>
+#include <s32strm.h> //to support RDbColReadStream::ReadL
+#include <bautils.h>
+#include "mdsitementity.h"
+
+//database name
+_LIT(KDriveC, "c:");
+_LIT(KDBNAME, "_Sync.db");
+_LIT(KMDECPIXSYNCTable,"MdeCpixSync");
+_LIT(KObjectId, "ObjectId");
+_LIT(KUri, "Uri");
+_LIT(KDrive, "Drive");
+_LIT(KMdeCpixSyncDbSqlInsert, "SELECT * FROM MdeCpixSync");
+_LIT(KMdeCpixSyncDbSqlCheckExist, "SELECT * FROM MdeCpixSync WHERE ObjectId=%d");
+//Not used. Can be deleted.
+//_LIT(KMdeCpixSyncDbSqlDelete, "DELETE FROM MdeCpixSync WHERE ObjectId="); //39 chars
+const TInt KMdeCpixSyncDbSqlDeleteSize(100); // %d costs 10 chars in max
+_LIT(KUIDSTRINGHEX,"%x");
+
+enum TNotepadColumnType
+    {
+    EKey = 1, // this must be 1 (DBMS/SQL restriction) mapped to ObjectID of MDS
+    EUri,
+    EDrive
+    };
+
+// -----------------------------------------------------------------------------
+// CCPixIndexerUtils::NewL()
+// -----------------------------------------------------------------------------
+//
+CCPIXMDEDbManager* CCPIXMDEDbManager::NewL(const TUid& aPluginImplUid)
+    {
+    CCPIXMDEDbManager* self = CCPIXMDEDbManager::NewLC(aPluginImplUid);
+    CleanupStack::Pop(self);
+    return self;
+    }
+
+// -----------------------------------------------------------------------------
+// CCPIXMDEDbManager::NewLC()
+// -----------------------------------------------------------------------------
+//
+CCPIXMDEDbManager* CCPIXMDEDbManager::NewLC(const TUid& aPluginImplUid)
+    {
+    CCPIXMDEDbManager* self = new (ELeave) CCPIXMDEDbManager();
+    CleanupStack::PushL(self);
+    self->ConstructL(aPluginImplUid);
+    return self;
+    }
+
+// -----------------------------------------------------------------------------
+// CCPIXMDEDbManager::~CCPIXMDEDbManager()
+// -----------------------------------------------------------------------------
+//
+CCPIXMDEDbManager::~CCPIXMDEDbManager()
+    {
+    if(iOpened)
+        {    
+        iDatabase.Close();        
+        }
+    iFs.Close();
+    }
+    
+
+// -----------------------------------------------------------------------------
+// CCPixIndexerUtils::CCPixIndexerUtils()
+// -----------------------------------------------------------------------------
+//
+CCPIXMDEDbManager::CCPIXMDEDbManager()
+    {    
+    }
+
+// -----------------------------------------------------------------------------
+// CCPixIndexerUtils::ConstructL()
+// -----------------------------------------------------------------------------
+//
+void CCPIXMDEDbManager::ConstructL(const TUid& aPluginImplUid)
+    {
+    CPIXLOGSTRING("START CCPIXMDEDbManager::ConstructL : Enter");
+    User::LeaveIfError(iFs.Connect());
+    //Secure database needes policy file for every database and it is comparitively
+    //lacks in performance from non secure database so we can use non secure
+    //Create the database filename.
+    HBufC* dataFile = HBufC::NewLC( KMaxFileName );    
+    TBuf <10> aUidString;
+    aUidString.Format(KUIDSTRINGHEX, aPluginImplUid);
+    TFileName  privatePath;
+    iFs.CreatePrivatePath(EDriveC);
+    iFs.PrivatePath(privatePath);//data caged path of loading process
+    dataFile->Des().Copy(KDriveC);
+    dataFile->Des().Append(privatePath);//data caged path of Plugin        
+    dataFile->Des().Append( aUidString );
+    dataFile->Des().Append( KDBNAME );
+    //Open the database
+    TInt err(iDatabase.Open(iFs,*dataFile));
+    switch (err)
+         {
+         case KErrNone:
+             {
+             iOpened = ETrue;            
+             }
+             break;
+         case KErrNotFound:
+             {
+             //create the database and register for notifier
+             TRAP( err , CreateMdeCPIXSyncDBL(*dataFile));
+             if(err == KErrNone)
+                 {
+                 iOpened = ETrue;
+                 }
+             }
+             break;
+         default:            
+             CPIXLOGSTRING("CNotesPlugin::ConstructL : Error in Database Open");
+             break;
+         }    
+     CleanupStack::PopAndDestroy( dataFile );  
+     CPIXLOGSTRING("END CCPIXMDEDbManager::ConstructL : Enter");
+    }
+
+void CCPIXMDEDbManager::CreateMdeCPIXSyncDBL(const TDesC& aDatabaseFile)
+    {
+    CPIXLOGSTRING("START CCPIXMDEDbManager::CreateMdeCPIXSyncDBL");
+    iDatabase.Close();
+    //Create the database filename.
+    //create the database
+    User::LeaveIfError(iDatabase.Create(iFs,aDatabaseFile));
+    CDbColSet* columns = CreateColumnSetLC();//creates the columns and push to cleanupstack
+    User::LeaveIfError( iDatabase.CreateTable( KMDECPIXSYNCTable , *columns ) );
+    //clean up of variables (columns and dataFile)
+    CleanupStack::PopAndDestroy( 1 ); //columns    
+    CPIXLOGSTRING("END CCPixIndexerUtils::MountAllAvailableDriveL");
+    }
+
+
+// -----------------------------------------------------------------------------
+// CNotesPlugin::CreateColSetLC
+// -----------------------------------------------------------------------------
+//
+CDbColSet* CCPIXMDEDbManager::CreateColumnSetLC()
+    {
+    CPIXLOGSTRING("CCPIXMDEDbManager::CreateColSetLC: Entered");
+    CDbColSet* columns = CDbColSet::NewLC();
+    
+    //Add Key column
+    TDbCol col( KObjectId , EDbColInt32 );
+    col.iAttributes = TDbCol::ENotNull;
+    columns->AddL( col );
+    
+    col.iName = KUri;
+    col.iType = EDbColLongText;
+    col.iAttributes = TDbCol::ENotNull;
+    columns->AddL(col);
+
+    col.iName = KDrive;
+    col.iType = EDbColInt32;
+    col.iAttributes = TDbCol::ENotNull;
+    columns->AddL(col);
+    
+    return columns; // columns stays on CleanupStack
+    }
+
+// -----------------------------------------------------------------------------
+// CCPIXMDEDbManager::AddL
+// -----------------------------------------------------------------------------
+//
+TCPIXMDEDBAPIReturnType CCPIXMDEDbManager::AddL(const TUint& aObjId,CMDSEntity& aMdsItem)
+    {
+    CPIXLOGSTRING("START CCPIXMDEDbManager::AddL");
+    TCPIXMDEDBAPIReturnType retVal = EOperationUndefined;
+    // Database is not openend
+    // return Not ready
+    if(!iOpened)
+     {
+     User::Leave(KErrNotReady);
+     }
+    iDatabase.Begin();    
+    RDbView dbView;
+    CleanupClosePushL(dbView);
+    TBuf<KMdeCpixSyncDbSqlDeleteSize> sql;
+    sql.Copy(KMdeCpixSyncDbSqlInsert);
+    TInt err =  dbView.Prepare(iDatabase, TDbQuery(sql));
+    User::LeaveIfError(dbView.EvaluateAll());
+    //Getthe pointer to the Content recieved as part of the Command
+    if(KErrNone == err) 
+     {       
+     dbView.InsertL();
+     dbView.SetColL(EKey,aObjId);
+     dbView.SetColL(EDrive, aMdsItem.DriveNumber());
+     dbView.SetColL(EUri,aMdsItem.Uri());
+     //Inserts the row       
+     dbView.PutL();
+     CPIXLOGSTRING("CCPIXMDEDbManager::AddL PutL");          
+     retVal = EOperationSuccess;         
+     }
+    CleanupStack::PopAndDestroy(&dbView); // dbView
+    if(retVal == EOperationSuccess)
+        {
+        iDatabase.Commit();
+        iDatabase.Compact();
+        }
+    else
+        {
+        iDatabase.Rollback();
+        }
+    User::LeaveIfError(err);
+    CPIXLOGSTRING("END CCPIXMDEDbManager::AddL");
+    return retVal;
+    }
+
+// -----------------------------------------------------------------------------
+// CCPIXMDEDbManager::UpdateL
+// -----------------------------------------------------------------------------
+//
+TCPIXMDEDBAPIReturnType CCPIXMDEDbManager::UpdateL(const TUint& aObjId,CMDSEntity& aMdsItem)
+    {
+    CPIXLOGSTRING("START CCPIXMDEDbManager::UpdateL");
+    TCPIXMDEDBAPIReturnType retVal = EOperationUndefined;
+    // Database is not openend return Not ready
+    if(!iOpened)
+     {
+     User::Leave(KErrNotReady);
+     }
+    iDatabase.Begin();
+    RDbView dbView;
+    CleanupClosePushL(dbView);
+    TBuf<KMdeCpixSyncDbSqlDeleteSize> sql;
+    sql.Format(KMdeCpixSyncDbSqlCheckExist,aObjId);
+    User::LeaveIfError(dbView.Prepare(iDatabase, TDbQuery(sql)));
+    User::LeaveIfError(dbView.EvaluateAll());
+    dbView.FirstL();
+    if(dbView.AtRow())
+        {
+        dbView.UpdateL();
+        dbView.SetColL(EKey,aObjId);
+        dbView.SetColL(EDrive, aMdsItem.DriveNumber());
+        dbView.SetColL(EUri,aMdsItem.Uri());
+        //Update record 
+        dbView.PutL();
+        retVal = EOperationSuccess;
+        }
+    CleanupStack::PopAndDestroy(&dbView); // dbView
+    if(retVal == EOperationSuccess)
+        {
+        iDatabase.Commit();
+        iDatabase.Compact();
+        }
+    else
+        {
+        iDatabase.Rollback();
+        }
+    CPIXLOGSTRING("END CCPIXMDEDbManager::UpdateL");
+    return retVal;
+    }
+
+// -----------------------------------------------------------------------------
+// CNotesPlugin::RemoveL
+// -----------------------------------------------------------------------------
+//
+TCPIXMDEDBAPIReturnType CCPIXMDEDbManager::RemoveL(const TUint& aObjId)
+    {
+    CPIXLOGSTRING("START CCPIXMDEDbManager::RemoveL");
+    TCPIXMDEDBAPIReturnType retVal = EOperationUndefined;
+    //If the database was not opened.
+    // return Not ready
+    if(!iOpened)
+        {
+        User::Leave(KErrNotReady);
+        }
+    TBuf<KMdeCpixSyncDbSqlDeleteSize> sql;
+    sql.Format(KMdeCpixSyncDbSqlCheckExist,aObjId);
+    iDatabase.Begin();
+    //Prepare the view
+    RDbView dbView;
+    CleanupClosePushL(dbView);
+    User::LeaveIfError(dbView.Prepare(iDatabase, TDbQuery(sql)));
+    User::LeaveIfError(dbView.EvaluateAll());
+    //Get the note property from the database for the given key.
+    TBool isAtRow(dbView.FirstL());
+    if ( isAtRow )
+        {
+        dbView.DeleteL();
+        retVal = EOperationSuccess;
+        CPIXLOGSTRING("CCPIXMDEDbManager::RemoveL Successful!");
+        }
+    else
+        {
+        //If the specified key was not found.
+        retVal= EOperationFailure;
+        }
+    CleanupStack::PopAndDestroy(&dbView); // dbView
+    if(EOperationSuccess == retVal)
+        {
+        iDatabase.Commit();
+        iDatabase.Compact();
+        }
+    else
+        {
+        iDatabase.Rollback();
+        }
+    CPIXLOGSTRING("END CCPIXMDEDbManager::RemoveL");
+    return retVal; 
+    }
+
+TBool CCPIXMDEDbManager::IsAlreadyExistL(const TUint& aObjectId)
+    {
+    CPIXLOGSTRING("START CCPIXMDEDbManager::IsAlreadyExistL");
+    TBool retVal(EFalse);
+    //If the database was not opened.
+    // return Not ready
+    if(!iOpened)
+        {
+        User::Leave(KErrNotReady);
+        }
+    TBuf<KMdeCpixSyncDbSqlDeleteSize> sql;
+    sql.Format(KMdeCpixSyncDbSqlCheckExist,aObjectId);
+    //Prepare the view
+    RDbView dbView;
+    CleanupClosePushL(dbView);
+    User::LeaveIfError(dbView.Prepare(iDatabase, TDbQuery(sql), RDbView::EReadOnly ));
+    User::LeaveIfError(dbView.EvaluateAll());
+    //Get the note property from the database for the given key.
+    TBool isAtRow(dbView.FirstL());
+    if ( isAtRow )
+        {
+        retVal= ETrue; //Found 
+        }
+    CleanupStack::PopAndDestroy(&dbView); // dbView
+    CPIXLOGSTRING("END CCPIXMDEDbManager::IsAlreadyExistL");
+    return retVal; 
+    }
+
+void CCPIXMDEDbManager::GetItemL(const TInt aKey, CMDSEntity& aMdsItem)
+    {
+    CPIXLOGSTRING2("START CCPIXMDEDbManager::GetItemL aKey = %d",aKey);
+    TInt err(KErrNone);
+    //dataBase is not opened. return Not Ready
+    if(!iOpened)
+        {
+        User::Leave(KErrNotReady);
+        }
+    TBuf<KMdeCpixSyncDbSqlDeleteSize> sql;
+    sql.Format(KMdeCpixSyncDbSqlCheckExist, aKey);
+    //Prepare the view
+    RDbView dbView;
+    CleanupClosePushL(dbView);
+    User::LeaveIfError(dbView.Prepare(iDatabase, TDbQuery(sql), RDbView::EReadOnly ));
+    User::LeaveIfError(dbView.EvaluateAll());
+    //Get the note property from the database for the given key.
+    TBool isAtRow(dbView.FirstL());
+    if ( isAtRow )
+        {
+        //HBufC* content = NULL;
+        dbView.GetL();
+        //Get the key and modified time
+        TInt key = dbView.ColInt32(EKey);
+        TInt drive = dbView.ColInt32(EDrive);
+        RDbColReadStream blob;
+        blob.OpenLC(dbView, EUri);
+        //Get the length of the content.
+        TInt colLength( dbView.ColLength(EUri));
+        //Get the length of the content to be read as filename       
+        TInt uriLength(0);
+        if(colLength > KMaxFileName )
+            {
+            uriLength = KMaxFileName;            
+            }
+        else
+            {
+            uriLength = colLength;
+            }       
+        
+        //Create the buffer to get the filename
+        HBufC* content = HBufC::NewLC(uriLength);
+        TPtr ptr = content->Des();            
+        //read the data from the database for the given length
+        blob.ReadL(ptr,uriLength);         
+        //Set the properties of the note to the Note Entity.
+        TDriveNumber drivenumber = TDriveNumber(drive);
+        aMdsItem.Set(key,*content,drivenumber);
+        CleanupStack::PopAndDestroy( content ); // content
+        //CleanupStack::Pop(content); // content
+        //delete content;
+        CleanupStack::PopAndDestroy(&blob); // blob
+        }
+    else 
+        {
+        //return not found for an invlaid key.
+        err = KErrNotFound;
+        }
+    CleanupStack::PopAndDestroy(&dbView); // dbView/
+    CPIXLOGSTRING2("END CCPIXMDEDbManager::GetItemL err = %d",err);
+    User::LeaveIfError(err);      
+    }
+
+// -----------------------------------------------------------------------------
+// CNotesPlugin::ResetL
+// -----------------------------------------------------------------------------
+//
+TCPIXMDEDBAPIReturnType CCPIXMDEDbManager::ResetL()
+    {
+    CPIXLOGSTRING("START CCPIXMDEDbManager::ResetL");
+    TCPIXMDEDBAPIReturnType retVal = EOperationUndefined;
+    TBuf<KMdeCpixSyncDbSqlDeleteSize> sql;
+    sql.Copy(KMdeCpixSyncDbSqlInsert);
+    iDatabase.Begin();
+    //Prepare the view
+    RDbView dbView;
+    CleanupClosePushL(dbView);
+    User::LeaveIfError(dbView.Prepare(iDatabase, TDbQuery(sql)));
+    User::LeaveIfError(dbView.EvaluateAll());
+    CPIXLOGSTRING2("CCPIXMDEDbManager::ResetL dbView.CountL = %d",dbView.CountL());
+    while(dbView.NextL())
+        {
+#ifdef _DEBUG
+        TRAPD(err,dbView.DeleteL());
+        CPIXLOGSTRING2("CCPIXMDEDbManager::ResetL dbView.DeleteL success err = %d",err);
+#else
+        TRAP_IGNORE( dbView.DeleteL() );
+#endif
+        }
+    if(dbView.CountL() == 0)
+        {
+        CPIXLOGSTRING("CCPIXMDEDbManager::ResetL Success!"); 
+        retVal= EOperationSuccess;
+        }
+    else
+        {
+        CPIXLOGSTRING("CCPIXMDEDbManager::ResetL Failure!");
+        retVal= EOperationFailure;
+        }
+    CleanupStack::PopAndDestroy(1); // Myview
+    if(retVal == EOperationSuccess)
+        {
+        iDatabase.Commit();
+        iDatabase.Compact();
+        }
+    else
+        {
+        iDatabase.Rollback();
+        }
+    CPIXLOGSTRING("END CCPIXMDEDbManager::ResetL");
+    return retVal; 
+    }
+
+// -----------------------------------------------------------------------------
+// CMTPNotesDpDataController::Rollback
+// -----------------------------------------------------------------------------
+//
+void CCPIXMDEDbManager::Rollback()
+    {
+    iDatabase.Rollback();
+    if ( iDatabase.IsDamaged() )
+        {
+        iDatabase.Recover();
+        }
+    }
+
+// End of file
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/harvesterplugins/media/mediautils/src/mdeharvester.cpp	Mon Apr 19 14:40:05 2010 +0300
@@ -0,0 +1,211 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  MDE harvester utility class
+ *
+*/
+
+
+#include "mdeharvester.h"
+
+// -----------------------------------------------------------------------------
+// CCPixIndexerUtils::NewL()
+// -----------------------------------------------------------------------------
+//
+CMdeHarvester* CMdeHarvester::NewL(CMdESession* aSession,
+                                   MdeMEdiaObserver* aObserver,
+                                   CMdeObjectQueueManager* aObjJobQueue)
+    {
+    CMdeHarvester* self = CMdeHarvester::NewLC(aSession,aObserver,aObjJobQueue);
+    CleanupStack::Pop(self);
+    return self;
+    }
+
+// -----------------------------------------------------------------------------
+// CCPixIndexerUtils::NewLC()
+// -----------------------------------------------------------------------------
+//
+CMdeHarvester* CMdeHarvester::NewLC(CMdESession* aSession,
+                                    MdeMEdiaObserver* aObserver,
+                                    CMdeObjectQueueManager* aObjJobQueue)
+    {
+    CMdeHarvester* self = new (ELeave) CMdeHarvester();
+    CleanupStack::PushL(self);
+    self->ConstructL(aSession,aObserver,aObjJobQueue);
+    return self;
+    }
+
+// -----------------------------------------------------------------------------
+// CCPixIndexerUtils::~CMdeHarvester()
+// -----------------------------------------------------------------------------
+//
+CMdeHarvester::~CMdeHarvester()
+   {
+   Cancel();
+   delete iWait;
+   delete iQuery;
+   }
+
+// -----------------------------------------------------------------------------
+// CCPixIndexerUtils::ConstructL()
+// -----------------------------------------------------------------------------
+//
+void CMdeHarvester::ConstructL(CMdESession* aSession,
+                               MdeMEdiaObserver* aObserver,
+                               CMdeObjectQueueManager* aObjJobQueue)
+    {
+    iSession = aSession;
+    iObserver = aObserver;
+    iJobQueue = aObjJobQueue;
+    iWait = new (ELeave) CActiveSchedulerWait;
+    CActiveScheduler::Add(this);
+    }
+
+// -----------------------------------------------------------------------------
+// CCPixIndexerUtils::CMdeHarvester()
+// -----------------------------------------------------------------------------
+//
+CMdeHarvester::CMdeHarvester():CActive(CActive::EPriorityStandard)
+    {
+    iCurrentIndex = 0;
+    }
+
+// -----------------------------------------------------------------------------
+// CCPixIndexerUtils::RunL()
+// -----------------------------------------------------------------------------
+//
+//from CActive
+void CMdeHarvester::RunL()
+    {
+    if(KErrNone == iStatus.Int())
+      {
+      HandleNextRequestL();
+      }
+    else
+      {
+      iObserver->HarvestingCompletedL(/*iStatus.Int()*/);//Introduce Error
+      }
+    }
+
+// -----------------------------------------------------------------------------
+// CCPixIndexerUtils::DoCancel()
+// -----------------------------------------------------------------------------
+//
+void CMdeHarvester::DoCancel()
+    {
+    
+    }
+
+// -----------------------------------------------------------------------------
+// CCPixIndexerUtils::RunError()
+// -----------------------------------------------------------------------------
+//
+TInt CMdeHarvester::RunError()
+    {
+    //@TODO: handle next items here incrementing count index 
+    return KErrNone;
+    }
+   
+
+// -----------------------------------------------------------------------------
+// CCPixIndexerUtils::handleQueryNewResults()
+// -----------------------------------------------------------------------------
+//
+void CMdeHarvester::HandleQueryNewResults(CMdEQuery& aQuery,
+                                          TInt aFirstNewItemIndex,
+                                          TInt aNewItemCount)
+    {
+    
+    }
+
+// -----------------------------------------------------------------------------
+// CCPixIndexerUtils::HandleQueryCOmpleted()
+// -----------------------------------------------------------------------------
+//
+void CMdeHarvester::HandleQueryCompleted(CMdEQuery& aQuery, TInt aError)
+    {
+    if(aError !=KErrNone)
+        {
+        TInt count = aQuery.Count();
+        }
+    if(iWait->IsStarted()) //Complete in Handle
+        iWait->AsyncStop();
+    }
+
+// -----------------------------------------------------------------------------
+// CCPixIndexerUtils::DoHarvestL()
+// -----------------------------------------------------------------------------
+//
+void CMdeHarvester::DoHarvesetL(const TDesC& aNameSpaceDef)
+    {
+    iCurrentIndex = 0;
+    QueryAllMediaObjectsL(aNameSpaceDef);
+    }
+   
+
+// -----------------------------------------------------------------------------
+// CCPixIndexerUtils::QueryAllMediaObjectsL()
+// -----------------------------------------------------------------------------
+//
+void CMdeHarvester::QueryAllMediaObjectsL(const TDesC& aNameSpaceDef)
+    {
+    //delete iQuery;
+	iQuery->Delete(iQuery);
+	iQuery = NULL;
+    CMdENamespaceDef& defaultNamespaceDef = iSession->GetDefaultNamespaceDefL();
+    CMdEObjectDef& audioObjDef = defaultNamespaceDef.GetObjectDefL(aNameSpaceDef);    
+    // query objects with object definition "Audio" "video" "images" etc..
+    iQuery = iSession->NewObjectQueryL( defaultNamespaceDef, audioObjDef, this );
+    iQuery->FindL();
+    iWait->Start();  //Complete in Handle
+    TInt count = iQuery->Count();
+    CompleteSelf();    
+    }
+
+// -----------------------------------------------------------------------------
+// CCPixIndexerUtils::HandleNextRequestL()
+// -----------------------------------------------------------------------------
+//
+void CMdeHarvester::HandleNextRequestL()
+    {
+    if(iCurrentIndex < iQuery->Count())
+        {
+        //Get the Object ID and pass to ObjectQueue manager
+        CMdEObject& object = static_cast<CMdEObject&>( iQuery->ResultItem( iCurrentIndex ) );
+        //@TODO: ResultId does'nt work need to check with MDS 
+        //iJobQueue->AddMdeItemToQueueL(iQuery->ResultId(iCurrentIndex),ECPixAddAction);
+        iJobQueue->AddMdeItemToQueueL(object.Id(),ECPixAddAction);
+        iCurrentIndex++;
+        CompleteSelf();
+        }
+    else
+        {
+        iObserver->HarvestingCompletedL();
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CCPixIndexerUtils::CompleteSelf()
+// -----------------------------------------------------------------------------
+//
+void CMdeHarvester::CompleteSelf()
+    {
+    // trigger our RunL
+    TRequestStatus*  caller;
+    caller = &iStatus;
+    iStatus = KRequestPending;
+    User::RequestComplete(caller, KErrNone);
+    SetActive();    
+    }
+
+//End of life
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/harvesterplugins/media/mediautils/src/mdeobjectqueuemanager.cpp	Mon Apr 19 14:40:05 2010 +0300
@@ -0,0 +1,197 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  MDE object queuemanager for indexing scheduling
+ *
+*/
+
+#include "mdeobjectqueuemanager.h"
+#include "harvesterserverlogger.h"
+
+// DEFINES
+#define INDEXING_QUEUE_MAX 300 // Maximum number of objects in the queue
+#define INDEXING_DELAY 3000000 // Nano seconds to delay the monitored object
+#define MAX_RETRY_COUNT    3   //maximum number of retry on not found object
+
+
+// -----------------------------------------------------------------------------
+// CCPixIndexerUtils::NewL()
+// -----------------------------------------------------------------------------
+//
+CMdeObjectQueueManager* CMdeObjectQueueManager::NewL(MMediaObjectHandler* aHandler)
+    {
+    CMdeObjectQueueManager* self = CMdeObjectQueueManager::NewLC(aHandler);
+    CleanupStack::Pop();
+    return self;
+    }
+// -----------------------------------------------------------------------------
+// CCPixIndexerUtils::NewLC()
+// -----------------------------------------------------------------------------
+//
+CMdeObjectQueueManager* CMdeObjectQueueManager::NewLC(MMediaObjectHandler* aHandler)
+    {
+    CMdeObjectQueueManager* self = new (ELeave) CMdeObjectQueueManager(aHandler);
+    CleanupStack::PushL(self);
+    self->ConstructL();
+    return self;
+    }
+
+// -----------------------------------------------------------------------------
+// CCPixIndexerUtils::~CMdeObjectQueueManager()
+// -----------------------------------------------------------------------------
+//
+CMdeObjectQueueManager::~CMdeObjectQueueManager()
+    {
+    Cancel();
+    iTimer.Close();
+    }
+
+// -----------------------------------------------------------------------------
+// CCPixIndexerUtils::CMdeObjectQueueManager()
+// -----------------------------------------------------------------------------
+//
+CMdeObjectQueueManager::CMdeObjectQueueManager(MMediaObjectHandler* aHandler):
+                        CActive(CActive::EPriorityStandard),
+                        iState(EStateNone),
+                        iMdeObjectHandler(aHandler)
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// CCPixIndexerUtils::ConstructL()
+// -----------------------------------------------------------------------------
+//
+void CMdeObjectQueueManager::ConstructL()
+    {
+    CActiveScheduler::Add(this);
+    User::LeaveIfError(iTimer.CreateLocal());
+    }
+
+// -----------------------------------------------------------------------------
+// CCPixIndexerUtils::AddMdeItemToQueueL()
+// -----------------------------------------------------------------------------
+//
+void CMdeObjectQueueManager::AddMdeItemToQueueL( TItemId aMsgId, 
+                                                 TCPixActionType aActionType)
+    {
+    OverWriteOrAddToQueueL(aMsgId,aActionType);
+    // Check the size against maximum queue size
+    if (iJobQueue.Count() > INDEXING_QUEUE_MAX)
+        {
+        // Maximum is exceeded, force the write immediately
+        if (iState == EStateWaiting)
+            {
+            iTimer.Cancel(); // RunL will be called with iStatus of KErrCancelled
+            }
+        else if (iState == EStateNone)
+            {
+            SetActive();
+            TRequestStatus* status = &iStatus;
+            User::RequestComplete(status, KErrNone); // RunL will be called with iStatus of KErrNone
+            }
+        }
+        else
+        {
+            // Maximum is not exceeded, keep waiting
+            if (iState == EStateNone)
+            {
+            iState = EStateWaiting;
+            iTimer.After(iStatus, INDEXING_DELAY); // Wait 5 seconds before putting this to index
+            SetActive();
+            }
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CCPixIndexerUtils::OverWriteOrAddToQueueL()
+// -----------------------------------------------------------------------------
+//
+void CMdeObjectQueueManager::OverWriteOrAddToQueueL( TItemId aObjId, 
+                                                     TCPixActionType aActionType)
+    {
+    // Overwrite or add the index to the queue
+    TMdeActionRecord object;
+    object.iObjectId = aObjId;
+    object.iAction = aActionType;
+    for (TInt i=0; i<iJobQueue.Count(); i++)
+    {
+        if (iJobQueue[i].iObjectId ==aObjId)
+        {
+            // Older version found
+            iJobQueue[i] = object;
+            return;
+        }
+    }
+    
+    // older not found, append
+    iJobQueue.AppendL(object);    
+    }
+
+// -----------------------------------------------------------------------------
+// CCPixIndexerUtils::RunL()
+// -----------------------------------------------------------------------------
+//
+void CMdeObjectQueueManager::RunL()
+    {
+    CPIXLOGSTRING("START CMdeObjectQueueManager::RunL");
+    while (iJobQueue.Count()>0)
+        {
+        TMdeActionRecord object = iJobQueue[0];
+        //iJobQueue.Remove(0);
+        //Let the indexer handle this object TRAP it as it can leave
+        TRAPD(err,iMdeObjectHandler->HandleMdeItemL(object.iObjectId, object.iAction));
+        /*Process the Item for three time maximum if in case not able to be found from
+          MDS*/
+        if(KErrNone == err)
+            {
+            iJobQueue.Remove(0);
+            }
+        else if(KErrNotFound == err && object.iRetryCount < MAX_RETRY_COUNT)
+                {
+                iJobQueue.Remove(0); //remove existing and add new one 
+                object.iRetryCount++;
+                iJobQueue.AppendL(object);
+                CPIXLOGSTRING3("CMdeObjectQueueManager::RunL HandleMdeItemL Item Not found err = %d, iRetry = %d",err,object.iRetryCount); 
+                }
+        else
+            {
+            iJobQueue.Remove(0);  //retry count exceeded remove it
+            }
+        }
+#ifdef __PERFORMANCE_DATA
+        iMdeObjectHandler->UpdateLogL();
+#endif
+        // Everything is indexed no need to be waiting anymore
+        iState = EStateNone;    
+        CPIXLOGSTRING("END CMdeObjectQueueManager::RunL");    
+    }
+
+// -----------------------------------------------------------------------------
+// CCPixIndexerUtils::DoCancel()
+// -----------------------------------------------------------------------------
+//
+void CMdeObjectQueueManager::DoCancel()
+    {
+    iTimer.Cancel();
+    iState = EStateNone; 
+    }
+
+// -----------------------------------------------------------------------------
+// CCPixIndexerUtils::RunError()
+// -----------------------------------------------------------------------------
+//
+TInt CMdeObjectQueueManager::RunError()
+    {
+    return KErrNone;
+    }
+//End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/harvesterplugins/media/mediautils/src/mdsitementity.cpp	Mon Apr 19 14:40:05 2010 +0300
@@ -0,0 +1,147 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: 
+*
+*/
+
+
+#include "mdsitementity.h"
+_LIT(KColon, ":");
+
+// -----------------------------------------------------------------------------
+// CMDSEntity::NewLC
+// -----------------------------------------------------------------------------
+//
+CMDSEntity* CMDSEntity::NewLC()
+    {
+    CMDSEntity* self = new (ELeave) CMDSEntity();
+    CleanupStack::PushL(self);
+    return self;
+    }
+    
+// -----------------------------------------------------------------------------
+// CMDSEntity::NewL
+// -----------------------------------------------------------------------------
+//
+CMDSEntity* CMDSEntity::NewL()
+    {
+    CMDSEntity* self = CMDSEntity::NewLC();
+    CleanupStack::Pop(self); // self
+    return self;
+    }   
+
+// -----------------------------------------------------------------------------
+// CMDSEntity::NewLC
+// -----------------------------------------------------------------------------
+//
+CMDSEntity* CMDSEntity::NewLC(TInt aKey, const TDesC& aUri, TDriveNumber& aDrive)
+    {
+    CMDSEntity* self = new (ELeave) CMDSEntity(aKey,aUri,aDrive);
+    CleanupStack::PushL(self);  
+    return self;
+    }
+
+// -----------------------------------------------------------------------------
+// CMDSEntity::CMDSEntity()
+// -----------------------------------------------------------------------------
+//
+CMDSEntity::CMDSEntity()
+    {
+    iKey = 0;
+    iUri.Copy(KNullDesC);
+    iDriveNumber = TDriveNumber(KErrNotSupported);
+    iPath.Copy(KNullDesC);
+    }
+
+void CMDSEntity::Reset()
+    {
+    iKey = 0;
+    iUri.Copy(KNullDesC);
+    iDriveNumber = TDriveNumber(KErrNotSupported);
+    iPath.Copy(KNullDesC);
+    }
+
+CMDSEntity::CMDSEntity(TInt aKey, 
+                       const TDesC& aUri, 
+                       TDriveNumber& aDrive)                                        
+    {   
+    iKey = aKey;
+    iUri.Copy(aUri);
+    iDriveNumber = aDrive;
+    }   
+
+// -----------------------------------------------------------------------------
+// CMDSEntity::~CMDSEntity
+// -----------------------------------------------------------------------------
+//
+CMDSEntity::~CMDSEntity()
+    {
+    
+    }
+
+// -----------------------------------------------------------------------------
+// CMDSEntity::Key
+// -----------------------------------------------------------------------------
+//
+TInt CMDSEntity::Key() const
+    {
+    //unique identifier of the note
+    return iKey;
+    }
+
+
+const TDesC& CMDSEntity::Uri() const
+    {
+    return iUri;
+    }
+
+TDriveNumber CMDSEntity::DriveNumber()
+    {
+    return iDriveNumber;
+    }
+
+void CMDSEntity::Set(TInt aKey, const TDesC& aUri, TDriveNumber& aDrive)
+    {
+    iKey = aKey;
+    iUri.Copy(aUri);
+    iDriveNumber = aDrive;
+    }
+
+void CMDSEntity::Setkey(TInt aKey)
+    {
+    iKey = aKey;
+    }
+
+void CMDSEntity::SetUri(const TDesC& aUri)
+    {
+    iUri.Copy(aUri);
+    }
+
+void CMDSEntity::SetDrive(TDriveNumber& aDrive)
+    {
+    iDriveNumber = aDrive;
+    }
+
+const TDesC& CMDSEntity::GetPath()
+    {
+    TChar chr;
+    const TInt ret = RFs::DriveToChar(iDriveNumber, chr);
+    if(KErrNone == ret)
+        {
+         iPath.Append(chr);
+         iPath.Append(KColon);
+         iPath.Append(iUri);
+        }
+    return iPath;
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/harvesterplugins/media/mediautils/src/mdsmediamonitor.cpp	Mon Apr 19 14:40:05 2010 +0300
@@ -0,0 +1,192 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  MDE media monitor utility
+*
+*/
+
+
+#include "mdsmediamonitor.h"
+#include <mdesession.h>
+#include <mdelogiccondition.h>
+#include <mdeconstants.h>
+#include "mdeobjectqueuemanager.h"
+#include "common.h"
+#include "harvesterserverlogger.h"
+
+
+namespace
+    {
+// -----------------------------------------------------------------------------
+// CCPixIndexerUtils::GetCpixAction()
+// -----------------------------------------------------------------------------
+//
+    TCPixActionType GetCpixAction(TObserverNotificationType aType)
+        {
+        TCPixActionType action( ECPixAddAction );//Initializing to silence compiler warning. 
+        switch(aType)
+            {
+            case ENotifyAdd:
+                action = ECPixAddAction;
+                break;
+            case ENotifyModify:
+                action = ECPixUpdateAction;
+                break;
+            case ENotifyRemove:
+                action = ECPixRemoveAction;
+                break;
+            default:
+                break;
+            }
+        return action;
+        }
+    };
+
+// -----------------------------------------------------------------------------
+// CCPixIndexerUtils::NewL()
+// -----------------------------------------------------------------------------
+//
+CMdsMediaMonitor* CMdsMediaMonitor::NewL(CMdESession* aSession,CMdeObjectQueueManager* aJobQueue)
+    {
+    CMdsMediaMonitor* self = CMdsMediaMonitor::NewLC(aSession,aJobQueue);
+    CleanupStack::Pop(self);
+    return self;
+    }
+
+// -----------------------------------------------------------------------------
+// CCPixIndexerUtils::NewLC()
+// -----------------------------------------------------------------------------
+//
+CMdsMediaMonitor* CMdsMediaMonitor::NewLC(CMdESession* aSession,CMdeObjectQueueManager* aJobQueue)
+    {
+    CMdsMediaMonitor* self = new (ELeave) CMdsMediaMonitor(aSession,aJobQueue);
+    CleanupStack::PushL(self);
+    self->ConstructL();
+    return self;
+    }
+
+// -----------------------------------------------------------------------------
+// CCPixIndexerUtils::~CMdsMediaMonitor()
+// -----------------------------------------------------------------------------
+//
+CMdsMediaMonitor::~CMdsMediaMonitor()
+    {
+    
+    }
+
+// -----------------------------------------------------------------------------
+// CCPixIndexerUtils::CMdsMediaMonitor()
+// -----------------------------------------------------------------------------
+//
+CMdsMediaMonitor::CMdsMediaMonitor(CMdESession* aSession,
+                                   CMdeObjectQueueManager* aJobQueue):
+                                   iMdsSession(aSession),
+                                   iMdeObjectQueueManager(aJobQueue)
+    {
+    
+    }
+
+// -----------------------------------------------------------------------------
+// CCPixIndexerUtils::ConstructL()
+// -----------------------------------------------------------------------------
+//
+void CMdsMediaMonitor::ConstructL()
+    {
+    
+    }
+
+// -----------------------------------------------------------------------------
+// CCPixIndexerUtils::StartMonitoringL()
+// -----------------------------------------------------------------------------
+//
+void CMdsMediaMonitor::StartMonitoringL(const TDesC& aNameSpaceDef)
+    {
+    CMdELogicCondition* condition = CMdELogicCondition::NewL( ELogicConditionOperatorAnd );
+    CleanupStack::PushL( condition );
+    CMdENamespaceDef& defaultNamespace = iMdsSession->GetDefaultNamespaceDefL();
+    CMdEObjectDef& audioObjDef = defaultNamespace.GetObjectDefL(aNameSpaceDef );
+    condition->AddObjectConditionL( audioObjDef );
+    //Start receiveing events for Audio objects
+    iMdsSession->AddObjectObserverL( *this, condition);
+    iMdsSession->AddObjectPresentObserverL( *this );
+    CleanupStack::Pop(condition);
+    }
+
+// -----------------------------------------------------------------------------
+// CCPixIndexerUtils::StopMonitoringL()
+// -----------------------------------------------------------------------------
+//
+void CMdsMediaMonitor::StopMonitoringL()
+    {
+    if(iMdsSession)
+        {
+        iMdsSession->RemoveObjectObserverL(*this,&iMdsSession->GetDefaultNamespaceDefL());
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CCPixIndexerUtils::HandleObjectNotification()
+// -----------------------------------------------------------------------------
+//
+void CMdsMediaMonitor::HandleObjectNotification(CMdESession& aSession, 
+                            TObserverNotificationType aType,
+                            const RArray<TItemId>& aObjectIdArray)
+    {
+    /*Bhuvi: Observed when MMC card removed and inserted back the Add event
+    Comes we have to reharvest if in case media is MMC card this way the
+    search results are acqurate and also index is synchronized*/
+    CPIXLOGSTRING2("CMdsMediaMonitor::HandleObjectNotification ActionType = %d",aType);
+    TCPixActionType action = GetCpixAction(aType);
+    //handle items here push it to Queue manager
+    for (TInt i=0;i<aObjectIdArray.Count();i++)
+        {
+        TItemId objectId = aObjectIdArray[i];
+        TRAP_IGNORE( iMdeObjectQueueManager->AddMdeItemToQueueL(objectId,action) );
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CCPixIndexerUtils::HandleObjectPresentNotification()
+// -----------------------------------------------------------------------------
+//
+void CMdsMediaMonitor::HandleObjectPresentNotification(CMdESession& aSession, 
+                TBool aPresent, const RArray<TItemId>& aObjectIdArray)
+    {
+    CPIXLOGSTRING2("CMdsMediaMonitor::HandleObjectPresentNotification aPresent = %d",aPresent);
+    //Handle only Presence true events 
+    if(aPresent)
+        {
+        CPIXLOGSTRING("CMdsMediaMonitor::HandleObjectPresentNotification Add Actions");
+        // Add in the queue for Addition
+        for (TInt i=0;i<aObjectIdArray.Count();i++)
+            {
+            TItemId objectId = aObjectIdArray[i];
+            TRAP_IGNORE( iMdeObjectQueueManager->AddMdeItemToQueueL(objectId,ECPixAddAction) );
+            }
+        }
+    //Dont handle presence false notification for performance as it is only for MMC items
+    /*
+    else
+        {
+        CPIXLOGSTRING("CMdsMediaMonitor::HandleObjectPresentNotification remove Actions");
+        // Add in the queue for removal
+        for (TInt i=0;i<aObjectIdArray.Count();i++)
+            {
+            TItemId objectId = aObjectIdArray[i];
+            iMdeObjectQueueManager->AddMdeItemToQueueL(objectId,ECPixRemoveAction);
+            }
+        }
+    */
+    }
+
+//End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/harvesterplugins/media/mediautils/src/mdssessionobjectutils.cpp	Mon Apr 19 14:40:05 2010 +0300
@@ -0,0 +1,188 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  MDE session utility class
+ *
+*/
+
+
+#include "mdssessionobjectutils.h"
+#include "harvesterserverlogger.h"
+// -----------------------------------------------------------------------------
+// CCPixIndexerUtils::NewL()
+// -----------------------------------------------------------------------------
+//
+CMdsSessionObjectUtils* CMdsSessionObjectUtils::NewL()
+    {
+    CMdsSessionObjectUtils* self = CMdsSessionObjectUtils::NewLC();
+    CleanupStack::Pop(self);
+    return self;
+    }
+
+// -----------------------------------------------------------------------------
+// CCPixIndexerUtils::NewL()
+// -----------------------------------------------------------------------------
+//
+CMdsSessionObjectUtils* CMdsSessionObjectUtils::NewLC()
+    {
+    CMdsSessionObjectUtils* self  = new (ELeave) CMdsSessionObjectUtils();
+    CleanupStack::PushL(self);
+    self->ConstructL();
+    return self;
+    }
+
+// -----------------------------------------------------------------------------
+// CCPixIndexerUtils::~CMdsSessionObjectUtils()
+// -----------------------------------------------------------------------------
+//
+CMdsSessionObjectUtils::~CMdsSessionObjectUtils()
+    {
+    if(iWait->IsStarted())
+      iWait->AsyncStop();
+    delete iWait;
+    if (iQuery)
+        {
+        delete iQuery;
+        iQuery = NULL;
+        }
+    delete iMdeSession;    
+    }
+
+// -----------------------------------------------------------------------------
+// CCPixIndexerUtils::CMdsSessionObjectUtils()
+// -----------------------------------------------------------------------------
+//
+CMdsSessionObjectUtils::CMdsSessionObjectUtils()
+    {
+    
+    }
+
+// -----------------------------------------------------------------------------
+// CCPixIndexerUtils::ConstructL()
+// -----------------------------------------------------------------------------
+//
+void CMdsSessionObjectUtils::ConstructL()
+    {
+    iWait = new (ELeave) CActiveSchedulerWait;
+    //iMdeSession = NULL;
+    }
+
+// -----------------------------------------------------------------------------
+// CCPixIndexerUtils::InitializeL()
+// -----------------------------------------------------------------------------
+//
+void CMdsSessionObjectUtils::InitializeL()
+    {
+    if(!iMdeSession)
+       {
+       iMdeSession = CMdESession::NewL(*this);
+       }
+    iWait->Start();  //Complete in Handle
+    }
+
+// -----------------------------------------------------------------------------
+// CCPixIndexerUtils::GetSession()
+// -----------------------------------------------------------------------------
+//
+CMdESession* CMdsSessionObjectUtils::GetSession()
+    {
+    return iMdeSession;
+    }
+
+// -----------------------------------------------------------------------------
+// CCPixIndexerUtils::GetObjectL()
+// -----------------------------------------------------------------------------
+//
+CMdEObject& CMdsSessionObjectUtils::GetObjectL(const TItemId& aItemId,
+                                               const TDesC& aObjectDefName)
+    {
+    CPIXLOGSTRING("START CMdsSessionObjectUtils::GetObjectL()");
+    //delete iQuery;//remove old instance if any
+	iQuery->Delete(iQuery);
+	iQuery = NULL;
+    CMdENamespaceDef& defaultNamespaceDef = iMdeSession->GetDefaultNamespaceDefL();
+    //Made reusable so that other objectdefs can also use this as it is
+    CMdEObjectDef& audioObjDef = defaultNamespaceDef.GetObjectDefL(aObjectDefName );    
+    // query objects with object definition e.g "Audio" "video" "images" etc..
+    iQuery = iMdeSession->NewObjectQueryL( defaultNamespaceDef, audioObjDef, this );
+    //Add object condition to match object id as aItemId
+    CMdELogicCondition& rootCondition = iQuery->Conditions();
+    (void)rootCondition.AddObjectConditionL(aItemId);
+    iQuery->FindL();
+    iWait->Start();  //Complete in Handle
+    CPIXLOGSTRING("CMdsSessionObjectUtils::GetObjectL() FindL and Started");
+    TInt count = iQuery->Count();
+    if(count!=1)
+        {
+        CPIXLOGSTRING("CMdsSessionObjectUtils::GetObjectL() count!=1 Leaving");
+        User::Leave(KErrNotFound);
+        }
+    CMdEObject& mediaObject = static_cast<CMdEObject&>( iQuery->ResultItem( 0));
+    CPIXLOGSTRING("END CMdsSessionObjectUtils::GetObjectL()");
+    return mediaObject;
+    }
+
+// -----------------------------------------------------------------------------
+// CCPixIndexerUtils::HandleSessionOpened()
+// -----------------------------------------------------------------------------
+//
+void CMdsSessionObjectUtils::HandleSessionOpened(CMdESession& aSession, TInt aError)
+    {
+    if ( aError != KErrNone )
+        {
+        delete iMdeSession;
+        iMdeSession = NULL;
+        }
+    if(iWait->IsStarted())
+        {
+        iWait->AsyncStop();//Signal it
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CCPixIndexerUtils::HandleQueryNewResults()
+// -----------------------------------------------------------------------------
+//
+void CMdsSessionObjectUtils::HandleQueryNewResults(CMdEQuery& aQuery,
+                                                   TInt aFirstNewItemIndex,
+                                                   TInt aNewItemCount)
+    {
+    TInt count = aQuery.Count();
+    }
+
+// -----------------------------------------------------------------------------
+// CCPixIndexerUtils::HandleQueryCompleted()
+// -----------------------------------------------------------------------------
+//
+void CMdsSessionObjectUtils::HandleQueryCompleted(CMdEQuery& aQuery, TInt aError)
+    {
+    if(aError !=KErrNone)
+        {
+        TInt count = aQuery.Count();
+        }
+    if(iWait->IsStarted()) //Complete in Handle)
+        iWait->AsyncStop();
+    }
+
+// -----------------------------------------------------------------------------
+// CCPixIndexerUtils::HandleSessionError()
+// -----------------------------------------------------------------------------
+//
+void CMdsSessionObjectUtils::HandleSessionError(CMdESession& aSession, TInt aError)
+    {
+    if(aError != KErrNone)
+        {
+        delete iMdeSession;
+        iMdeSession = NULL;
+        }
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/harvesterplugins/media/mediautils/src/mmcmonitor.cpp	Mon Apr 19 14:40:05 2010 +0300
@@ -0,0 +1,227 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Mmc monitor
+*
+*/
+
+
+// INCLUDE FILES
+#include "mmcmonitor.h"
+#include "harvesterserverlogger.h"
+
+#include <pathinfo.h>
+#include <s32file.h>
+#include <f32file.h> // TDriveNumber
+#include <driveinfo.h> // TDriveInfo
+
+#include <uikoninternalpskeys.h>
+
+// CONSTANTS
+// 
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CMMCMonitorUtil::NewL
+// -----------------------------------------------------------------------------
+//
+CMMCMonitorUtil* CMMCMonitorUtil::NewL( MMMCEventObserver* aObserver)
+    {
+    CMMCMonitorUtil* self = new ( ELeave ) CMMCMonitorUtil( aObserver );
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+
+// -----------------------------------------------------------------------------
+// CMMCMonitorUtil::CMMCMonitorUtil
+// -----------------------------------------------------------------------------
+//
+CMMCMonitorUtil::CMMCMonitorUtil( MMMCEventObserver* aObserver )
+    : CActive( CActive::EPriorityStandard ),
+      iObserver( aObserver )
+    {
+    CPIXLOGSTRING("ENTER CMMCMonitorUtil::CMMCMonitorUtil");
+    CActiveScheduler::Add( this );
+    CPIXLOGSTRING("END CMMCMonitorUtil::CMMCMonitorUtil");
+    }
+
+
+// -----------------------------------------------------------------------------
+// CMMCMonitorUtil::~CMMCMonitorUtil
+// -----------------------------------------------------------------------------
+//
+CMMCMonitorUtil::~CMMCMonitorUtil()
+    {
+    CPIXLOGSTRING("ENTER ~CMMCMonitorUtil");
+    Cancel();
+    iProperty.Close();
+    CPIXLOGSTRING("END ~CMMCMonitorUtil");
+    }
+
+
+// -----------------------------------------------------------------------------
+// CMMCMonitorUtil::ConstructL
+// -----------------------------------------------------------------------------
+//
+void CMMCMonitorUtil::ConstructL()
+    {
+    CPIXLOGSTRING("ENTER CMMCMonitorUtil::ConstructL Foobar");
+    User::LeaveIfError(iFsSession.Connect());    
+    TInt error = iProperty.Attach( KPSUidUikon, KUikMMCInserted );
+    if ( error != KErrNone ) CPIXLOGSTRING("END CMMCMonitorUtil::Attach to MMCInserted failed");
+    
+    error = iProperty.Get( KPSUidUikon, KUikMMCInserted, iMmcStatus );
+    if ( error != KErrNone ) 
+    	{
+		CPIXLOGSTRING("CMMCMonitorUtil::Get MMCInserted failed");
+    	} 
+    else if ( iMmcStatus ) 	 
+    	{
+    	CPIXLOGSTRING("CMMCMonitorUtil::MMC card is in");
+    	}
+    else 
+    	{
+    	CPIXLOGSTRING("CMMCMonitorUtil::no MMC card");
+    	}
+    CPIXLOGSTRING("END CMMCMonitorUtil::ConstructL");
+    }
+
+
+// -----------------------------------------------------------------------------
+// CMMCMonitorUtil::StartMonitoring
+// -----------------------------------------------------------------------------
+//
+TBool CMMCMonitorUtil::StartMonitoring()
+    {
+    CPIXLOGSTRING("ENTER CMMCMonitorUtil::StartMonitoring");
+    //Subscribe for property value change once modified get update      
+    iStatus = KRequestPending;
+    iProperty.Subscribe( iStatus );
+    SetActive();
+    CPIXLOGSTRING("END CMMCMonitorUtil::StartMonitoring");
+    return ETrue;
+    }
+
+
+// -----------------------------------------------------------------------------
+// CMMCMonitorUtil::MmcStatus
+// -----------------------------------------------------------------------------
+//
+TBool CMMCMonitorUtil::MmcStatus( TInt aDriveNumber )
+    {
+    TBool isMmcPresent(EFalse);
+
+    if ( iFsSession.IsValidDrive( aDriveNumber ) )
+        {
+        TUint drvStatus( 0 );
+        TInt err = DriveInfo::GetDriveStatus( iFsSession, aDriveNumber, drvStatus );
+        if ( err )
+            {
+            return EFalse;
+            }
+        // MMC drives are removable and user visible
+        if ( ( drvStatus & DriveInfo::EDriveRemovable ) &&
+             ( drvStatus & DriveInfo::EDriveUserVisible ) )
+                {
+                CPIXLOGSTRING2("CMMCMonitorUtil::MmcStatus Drive Number %d", aDriveNumber);
+                isMmcPresent = ETrue;
+                }
+        }
+    return isMmcPresent;
+    }
+
+
+// -----------------------------------------------------------------------------
+// CMMCMonitorUtil::RunError
+// -----------------------------------------------------------------------------
+//
+TInt CMMCMonitorUtil::RunError( TInt aError )
+    {
+    CPIXLOGSTRING2("CMMCMonitorUtil::RunError Error:",aError);
+    return KErrNone;
+    }
+
+
+// -----------------------------------------------------------------------------
+// CMMCMonitorUtil::DoCancel
+// -----------------------------------------------------------------------------
+//
+void CMMCMonitorUtil::DoCancel()
+    {
+    CPIXLOGSTRING("ENTER CMMCMonitorUtil::DoCancel");
+    iProperty.Cancel();
+    CPIXLOGSTRING("END CMMCMonitorUtil::DoCancel");
+    }
+
+
+// -----------------------------------------------------------------------------
+// CMMCMonitorUtil::RunL
+// -----------------------------------------------------------------------------
+//
+void CMMCMonitorUtil::RunL()
+    {
+    CPIXLOGSTRING("ENTER CMMCMonitorUtil::RunL");
+    iProperty.Subscribe( iStatus );
+    SetActive();
+    User::LeaveIfError( iProperty.Get( KPSUidUikon, KUikMMCInserted, iMmcStatus ) );
+    
+    if ( iMmcStatus )
+    	{
+    	CPIXLOGSTRING("CMMCMonitorUtil::MMC card is in");
+    	}
+    else 
+    	{
+		CPIXLOGSTRING("CMMCMonitorUtil::no MMC card");
+    	}
+
+    for ( TInt driveNumber = EDriveA; driveNumber <= EDriveZ; driveNumber++ )
+        {
+        const TBool foundMmc = MmcStatus( driveNumber );
+        if ( !foundMmc )
+            {
+            continue;
+            }
+
+        // This drive has been recognized as MMC. 
+        TDriveNumber drv = TDriveNumber( driveNumber );
+
+        TUint drvStatus( 0 );
+
+        const TInt err = DriveInfo::GetDriveStatus( iFsSession, driveNumber, drvStatus );
+        if ( err ) 
+            {
+            continue;  // should not happen
+            }
+
+        if ( drvStatus & DriveInfo::EDrivePresent )
+            {
+            CPIXLOGSTRING("CMMCMonitorUtil::RunL insert event");
+            // Notify observer for handleing event
+            iObserver->HandleMMCEventL(drv,ETrue);
+            }
+        else
+            {
+            CPIXLOGSTRING("CMMCMonitorUtil::RunL eject event");
+            // If the MMC has been ejected, then need to dismount 
+            // Notify observer for handleing event
+            iObserver->HandleMMCEventL(drv,EFalse);
+            }
+        }
+    CPIXLOGSTRING("END CMMCMonitorUtil::RunL");
+    }
+
+// End Of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/harvesterplugins/media/video/data/20029aba.rss	Mon Apr 19 14:40:05 2010 +0300
@@ -0,0 +1,46 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: 
+*
+*/
+#include <registryinfo.rh>
+
+// Declares info for one test implementation
+RESOURCE REGISTRY_INFO theInfo
+        {
+        // UID for the DLL       
+        // TODO: Rename dll_uid according to your plugin UID
+        dll_uid = 0x20029ABA;
+        // Declare array of interface info
+        interfaces = 
+                {
+                INTERFACE_INFO
+                        {
+                        // UID of interface that is implemented
+                        interface_uid = 0x2001F700; // CPixSearch Plugin Interface UID
+                        implementations = 
+                                {
+                                // Info for VideoPlugin
+                                IMPLEMENTATION_INFO
+                                        {
+                                        implementation_uid = 0x20029ABA;
+                                        version_no = 1;
+                                        display_name = "Media harvester Video plugin";
+                                        default_data = "Videos";
+                                        opaque_data = "";
+                                        }
+                                };
+                        }
+                };
+        }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/harvesterplugins/media/video/group/bld.inf	Mon Apr 19 14:40:05 2010 +0300
@@ -0,0 +1,20 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: 
+*
+*/
+
+
+PRJ_MMPFILES
+videoplugin.mmp
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/harvesterplugins/media/video/group/videoplugin.mmp	Mon Apr 19 14:40:05 2010 +0300
@@ -0,0 +1,61 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: 
+*
+*/
+
+CAPABILITY   CAP_GENERAL_DLL -AllFiles -DRM
+#include "../../../../harvesterplugins/inc/s60performance.h"
+TARGET		  cpixvideoplugin.dll
+TARGETTYPE	  PLUGIN
+
+// ECom Dll recognition UID followed by the unique UID for this dll
+UID 0x10009D8D 0x20029ABA
+EPOCSTACKSIZE 0x5000
+EPOCHEAPSIZE 0x50000 0x2000000
+
+SOURCEPATH	  ../src
+SOURCE 		  tproxy.cpp
+SOURCE		  videoplugin.cpp
+SOURCE 		  cpixmediavideodoc.cpp
+
+USERINCLUDE   ../inc
+USERINCLUDE   ../../mediautils/inc
+APP_LAYER_SYSTEMINCLUDE
+SYSTEMINCLUDE /epoc32/include/ecom
+
+
+SOURCEPATH    ../data
+start RESOURCE 20029aba.rss
+target  cpixvideoplugin.rsc
+end
+
+LIBRARY       euser.lib
+LIBRARY       ecom.lib
+LIBRARY       efsrv.lib
+STATICLIBRARY cpixmediautils.lib //Media utility library
+LIBRARY       platformenv.lib // Path info
+LIBRARY       cpixharvesterplugininterface.lib
+LIBRARY       cpixsearchclient.lib
+LIBRARY       mdccommon.lib           // mds
+LIBRARY       mdeclient.lib           // mds
+LIBRARY       edbms.lib
+LIBRARY       estor.lib
+LIBRARY       bafl.lib
+
+// For logging
+LIBRARY 	  flogger.lib 
+//Enable this macro to get harvester performance data
+//MACRO __PERFORMANCE_DATA
+EXPORTUNFROZEN
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/harvesterplugins/media/video/inc/cpixmediavideodoc.h	Mon Apr 19 14:40:05 2010 +0300
@@ -0,0 +1,63 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  MDS to CPIX Video Document fetcher 
+ *
+*/
+
+
+#ifndef CPIXMEDIAVIDEODOC_H_
+#define CPIXMEDIAVIDEODOC_H_
+
+#include "cpixdocfetcher.h"
+
+class CCPIXMediaVideoDoc : public CCPIXDocFetcher
+    {
+public:
+    /*
+     * NewL
+     * @return instance of media Image doc
+     */
+    static CCPIXMediaVideoDoc* NewL();
+    /*
+     * NewLC
+     * @return instance of media Image doc
+     */    
+    static CCPIXMediaVideoDoc* NewLC();
+    /*
+     * Destructor
+     */
+    ~CCPIXMediaVideoDoc();
+    //Overwride
+    /*
+     * GetCpixDocumentL get cpix document from mde object
+     * @param CMdEObject& aObject mde object
+     * @param TDesC& aAppClass app class
+     * @param CMdEObjectDef& aObjectDef mde object def
+     * @return instance of CPIX document 
+     */
+    CSearchDocument* GetCpixDocumentL(const CMdEObject& aObject, 
+                                      const TDesC& aAppClass,
+                                      CMdEObjectDef& aObjectDef);    
+private:
+    /*
+     * Second phase constructor
+     */
+    void ConstructL();
+    /*
+     * Default constructor
+     */
+    CCPIXMediaVideoDoc();
+    };
+
+#endif /* CPIXMEDIAVIDEODOC_H_ */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/harvesterplugins/media/video/inc/videoplugin.h	Mon Apr 19 14:40:05 2010 +0300
@@ -0,0 +1,119 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Media Video harvester plugin header
+*
+*/
+
+
+#ifndef CVIDEOPLUGIN_H
+#define CVIDEOPLUGIN_H
+
+#include <cindexingplugin.h>
+#include <e32base.h>
+#include "common.h"
+#include "mediaobjecthandler.h"
+#include "mmceventobserver.h"
+
+//Forward declaration
+class CSearchDocument;
+class CCPixIndexer;
+class CMdeHarvester;
+class CMdeObjectQueueManager;
+class CMdsMediaMonitor;
+class CMdsSessionObjectUtils;
+class CCPIXMediaVideoDoc;
+class CCPixIndexerUtils;
+class CMMCMonitorUtil;
+class CCPIXMDEDbManager;
+class CMDSEntity;
+
+class CVideoPlugin : public CIndexingPlugin, public MdeMEdiaObserver,
+                     public MMediaObjectHandler, public MMMCEventObserver
+    {
+public:
+    // Constructor and Destructors.
+    /*
+    * NewL
+    * @return instance of Media video plugin
+    */
+    static CVideoPlugin* NewL();    
+    /*
+    * Destructor
+    */
+    ~CVideoPlugin();
+
+public:
+    /* 
+    * Prepares the plugin for StartHarvesterL
+    */
+    void StartPluginL();
+    
+    /*
+    * @description Start the harvester.
+    * @param aQualifiedBaseAppClass the base app class. In this case
+    *        use MEDIA_QBASEAPPCLASS
+    * @return void
+    * Leaves in case of errors.
+    */
+    void StartHarvestingL(const TDesC & aQualifiedBaseAppClass);
+    /*
+    * HandleMdeItemL callback from MMediaObjectHandler
+    * @param TItemId aObjId object Id
+    * @param TCPixActionType aActionType cpix action type
+    */
+    void HandleMdeItemL( TItemId aObjId, TCPixActionType aActionType);
+#ifdef __PERFORMANCE_DATA
+    void UpdateLogL();
+#endif
+    /*
+    * HarvestingCompletedL callback from MdeEventHandler
+    */
+    void HarvestingCompletedL();
+    
+    /*
+    * HandleMMCEventL callback from MMMCEventObserver
+    * @param TDriveNumber aDrive drive number of MMC
+    * @param TBool aMMCInsertRemoval ETrue if inserted else EFalse
+    */
+    void HandleMMCEventL(const TDriveNumber aDrive,const TBool aMMCInsertRemoval);
+private:
+    //private constructors.
+    /*
+    * Default constructor
+    */
+    CVideoPlugin();    
+
+private:
+    // data
+    CCPixIndexer*           iIndexer; //Indexer
+    CMdeHarvester*          iMdeHarvester; //Mde harvester owned
+    CMdeObjectQueueManager* iObjectJobQueueManager; //Objectqueue manager owned
+    CMdsMediaMonitor*       iMdsMonitor;//MDS monitor owned
+    CMdsSessionObjectUtils* iMdsUtils;//Mds utils owned
+    CCPIXMediaVideoDoc*     iVideoDocument;//MDS video doc owned
+    CCPixIndexerUtils*      iIndexerUtil;//Indexer util owned
+    CMMCMonitorUtil*        iMMcMonitor;//MMC monitor owned
+    CCPIXMDEDbManager*      iDBManager;
+    CMDSEntity*             iMdsItem;
+
+#ifdef __PERFORMANCE_DATA
+    TTime iStartTime;
+    TTime iCompleteTime;
+    void UpdatePerformaceDataL();
+	TInt count;
+#endif	
+    };
+
+#endif  // CVIDEOPLUGIN_H
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/harvesterplugins/media/video/src/cpixmediavideodoc.cpp	Mon Apr 19 14:40:05 2010 +0300
@@ -0,0 +1,138 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  MDS to CPIX Audio Document fetcher 
+*
+*/
+
+
+#include "cpixmediavideodoc.h"
+#include <mdeobject.h>
+#include <mdccommon.h>
+#include <mdeitem.h>
+#include <mdeconstants.h>
+#include <mdeobjectdef.h>
+#include "harvesterserverlogger.h"
+
+// -----------------------------------------------------------------------------
+// CCPIXDocFetcher::NewL()
+// -----------------------------------------------------------------------------
+//
+CCPIXMediaVideoDoc* CCPIXMediaVideoDoc::NewL()
+    {
+    CCPIXMediaVideoDoc* self = CCPIXMediaVideoDoc::NewLC();
+    CleanupStack::Pop(self);
+    return self;
+    }
+
+// -----------------------------------------------------------------------------
+// CCPIXDocFetcher::NewLC()
+// -----------------------------------------------------------------------------
+//
+CCPIXMediaVideoDoc* CCPIXMediaVideoDoc::NewLC()
+    {
+    CCPIXMediaVideoDoc* self = new (ELeave) CCPIXMediaVideoDoc();
+    CleanupStack::PushL(self);
+    self->ConstructL();
+    return self;
+    }
+
+// -----------------------------------------------------------------------------
+// CCPIXDocFetcher::~CCPIXMediaAudioDoc()
+// -----------------------------------------------------------------------------
+//
+CCPIXMediaVideoDoc::~CCPIXMediaVideoDoc()
+    {
+    
+    }
+
+// -----------------------------------------------------------------------------
+// CCPIXDocFetcher::CCPIXMediaAudioDoc()
+// -----------------------------------------------------------------------------
+//
+CCPIXMediaVideoDoc::CCPIXMediaVideoDoc()
+    {
+    
+    }
+
+// -----------------------------------------------------------------------------
+// CCPIXDocFetcher::ConstructL()
+// -----------------------------------------------------------------------------
+//
+void CCPIXMediaVideoDoc::ConstructL()
+    {
+    CCPIXDocFetcher::ConstructL();//Must have
+    
+    }
+
+// -----------------------------------------------------------------------------
+// CCPIXDocFetcher::GetCpixDocumentL()
+// -----------------------------------------------------------------------------
+//
+CSearchDocument* CCPIXMediaVideoDoc::GetCpixDocumentL(const CMdEObject& aObject, 
+                                              const TDesC& aAppClass,
+                                              CMdEObjectDef& aObjectDef)
+    {
+    //Get basic document
+    CPIXLOGSTRING("CCPIXMediaVideoDoc::GetCpixDocumentL()");
+    CSearchDocument* index_item = CCPIXDocFetcher::GetCpixDocumentL(aObject,aAppClass,aObjectDef);
+    //URI and Excerpt is done add additional properties here 
+    CMdEProperty* property(NULL);
+    CMdEPropertyDef& artistPropDef = aObjectDef.GetPropertyDefL(MdeConstants::MediaObject::KArtistProperty );
+    if(aObject.Property( artistPropDef, property )!= KErrNotFound)
+       {
+       //Add field to document
+       CMdETextProperty* textProperty = ( CMdETextProperty* ) property;
+       AddFiledtoDocumentL(*index_item,
+                           MdeConstants::MediaObject::KArtistProperty,
+                           textProperty->Value());
+       }
+    CMdEPropertyDef& authorPropDef = aObjectDef.GetPropertyDefL(MdeConstants::MediaObject::KAuthorProperty );
+    if(aObject.Property( authorPropDef, property ) != KErrNotFound)
+       {
+      //Add field to document
+      CMdETextProperty* textProperty = ( CMdETextProperty* ) property;
+      AddFiledtoDocumentL(*index_item,
+                         MdeConstants::MediaObject::KAuthorProperty,
+                         textProperty->Value());
+       }
+    CMdEPropertyDef& copyrightPropDef = aObjectDef.GetPropertyDefL(MdeConstants::MediaObject::KCopyrightProperty );
+    if(aObject.Property( copyrightPropDef, property ) != KErrNotFound)
+       {
+     //Add field to document
+     CMdETextProperty* textProperty = ( CMdETextProperty* ) property;
+     AddFiledtoDocumentL(*index_item,
+                      MdeConstants::MediaObject::KCopyrightProperty,
+                      textProperty->Value());
+       }   
+    CMdEPropertyDef& descriptionPropDef = aObjectDef.GetPropertyDefL(MdeConstants::MediaObject::KDescriptionProperty );
+    if(aObject.Property( descriptionPropDef, property ) != KErrNotFound)
+       {
+    //Add field to document
+    CMdETextProperty* textProperty = ( CMdETextProperty* ) property;
+    AddFiledtoDocumentL(*index_item,
+                  MdeConstants::MediaObject::KDescriptionProperty,
+                  textProperty->Value());
+       }
+    CMdEPropertyDef& commentPropDef = aObjectDef.GetPropertyDefL(MdeConstants::MediaObject::KCommentProperty );
+    if(aObject.Property( commentPropDef, property ) != KErrNotFound)
+       {
+    //Add field to document
+    CMdETextProperty* textProperty = ( CMdETextProperty* ) property;
+    AddFiledtoDocumentL(*index_item,
+                   MdeConstants::MediaObject::KCommentProperty,
+                   textProperty->Value());
+       }
+    return index_item;
+    }
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/harvesterplugins/media/video/src/tproxy.cpp	Mon Apr 19 14:40:05 2010 +0300
@@ -0,0 +1,38 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Media Video plugin
+*
+*/
+
+
+
+#include <e32std.h>
+#include <implementationproxy.h>
+#include <cindexingplugin.h>
+#include "videoplugin.h"
+
+
+// Map the interface UIDs to implementation factory functions
+const TImplementationProxy KImplementationTable[] = 
+    {    
+    {{0x20029ABA},( TProxyNewLPtr) CVideoPlugin::NewL}      
+    };
+
+// Exported proxy for instantiation method resolution
+EXPORT_C const TImplementationProxy* ImplementationGroupProxy( TInt& aTableCount )
+    {    
+    aTableCount = sizeof( KImplementationTable ) / sizeof( TImplementationProxy );
+    return KImplementationTable;
+    }
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/harvesterplugins/media/video/src/videoplugin.cpp	Mon Apr 19 14:40:05 2010 +0300
@@ -0,0 +1,333 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Media Video harvester plugin implementation
+*
+*/
+
+//  Include Files
+#include "videoplugin.h" //CVideoPlugin
+#include <e32base.h>
+#include "harvesterserverlogger.h"
+#include "common.h"
+#include "csearchdocument.h"
+#include "ccpixindexer.h"
+#include "mdeharvester.h"
+#include "mdeobjectqueuemanager.h"
+#include "mdsmediamonitor.h"
+#include "mdssessionobjectutils.h"
+#include "cpixmediavideodoc.h"
+#include "cpixindexerutils.h"
+#include "mmcmonitor.h"
+#include "cpixmdedbmanager.h"
+#include "mdsitementity.h"
+
+//Constants
+_LIT(KPathTrailer, "\\root\\media\\video");
+#define MEDIA_QBASEAPPCLASS   "@0:root media video"
+#define LMEDIA_QBASEAPPCLASS  L"@0:root media video"
+#define MEDIAAPPCLASS   "root media video"
+#define LMEDIAAPPCLASS  L"root media video"
+
+#define MEDIAGENERICAPPCLASS   ":root media video"
+#define LMEDIAGENERICAPPCLASS  L":root media video"
+#define DATABASEPATH           "\\root\\media\\video"
+#define LDATABASEPATH           "\\root\\media\\video"
+
+//Member Functions
+
+
+CVideoPlugin* CVideoPlugin::NewL()
+    {
+    CVideoPlugin* self = new (ELeave) CVideoPlugin;    
+    return self;
+    }
+
+CVideoPlugin::CVideoPlugin()
+    {
+#ifdef __PERFORMANCE_DATA
+    count = 0;
+#endif
+    //No implementation required.    
+    }
+
+CVideoPlugin::~CVideoPlugin()
+    {    
+    delete iMdeHarvester;
+    delete iMdsMonitor;
+    delete iObjectJobQueueManager;
+    delete iMdsUtils;
+    delete iVideoDocument;
+    delete iIndexerUtil;
+    delete iMMcMonitor;
+    delete iDBManager;
+    delete iMdsItem;
+    }
+
+void CVideoPlugin::StartPluginL()
+    {
+    //Define the basic application class 
+    CPIXLOGSTRING("CVideoPlugin::StartPluginL");
+    iIndexerUtil = CCPixIndexerUtils::NewL( iSearchSession );
+    TBuf<KMaxFileName> databasePathTemp;
+    databasePathTemp.Append( KPathTrailer );
+    iIndexerUtil->MountAllAvailableDriveL( _L(MEDIAGENERICAPPCLASS), databasePathTemp );
+    // Instansiate harvesting and monitering
+    iMdsUtils = CMdsSessionObjectUtils::NewL();
+    iMdsUtils->InitializeL();
+    iObjectJobQueueManager = CMdeObjectQueueManager::NewL( this );
+    iMdeHarvester = CMdeHarvester::NewL( iMdsUtils->GetSession(), this,
+                                         iObjectJobQueueManager );   
+    iMdsMonitor = CMdsMediaMonitor::NewL( iMdsUtils->GetSession(), iObjectJobQueueManager );
+    iMMcMonitor = CMMCMonitorUtil::NewL( this );//Observer is self
+    iMMcMonitor->StartMonitoring();
+    //start monitoring video items
+    iMdsMonitor->StartMonitoringL( MdeConstants::Video::KVideoObject );
+    iVideoDocument = CCPIXMediaVideoDoc::NewL(); //Doc fetcher
+    // Start harvester for this plugin
+    iObserver->AddHarvestingQueue(this, _L(MEDIA_QBASEAPPCLASS) );
+    TUid uidOfPlugin = {0x20029ABA};
+    iDBManager = CCPIXMDEDbManager::NewL(uidOfPlugin);
+    iMdsItem = CMDSEntity::NewL();
+    }
+
+void CVideoPlugin::StartHarvestingL( const TDesC& /*aMedia*/ )
+    {
+    CPIXLOGSTRING("CVideoPlugin::StartHarvestingL");
+    iDBManager->ResetL();
+    iIndexerUtil->ResetAllL();
+    //start video harvesting
+#ifdef __PERFORMANCE_DATA
+    iStartTime.UniversalTime();
+#endif
+    iMdeHarvester->DoHarvesetL( MdeConstants::Video::KVideoObject );      
+    }
+
+void CVideoPlugin::HarvestingCompletedL()
+    {
+    CPIXLOGSTRING("CVideoPlugin::HarvestingCompletedL");
+#ifdef __PERFORMANCE_DATA
+    UpdatePerformaceDataL();
+#endif
+    iObserver->HarvestingCompleted(this, _L(MEDIA_QBASEAPPCLASS), KErrNone);    
+    }
+
+//handle MMC event for the Drive
+void CVideoPlugin::HandleMMCEventL(const TDriveNumber aDrive,const TBool aMMCInsertRemoval)
+    {
+    TBuf<KMaxFileName> databasePathTemp;
+    databasePathTemp.Append(KPathTrailer);
+    if(aMMCInsertRemoval) //MMC inserted
+        {        
+        iIndexerUtil->MountDriveL(aDrive,_L(MEDIAGENERICAPPCLASS),databasePathTemp);        
+        //iIndexerUtil->GetIndexerFromDrive(aDrive)->ResetL();
+        }
+    else
+        {
+        //MMC is removed but we can not reset index here as Media physically not avilable so
+        // we have to do at the time of insertion only
+        //Unmount drive and also reset the index as we anyhow has to reindex on insertion back 
+        iIndexerUtil->UnMountDriveL(aDrive,_L(MEDIAGENERICAPPCLASS),ETrue);
+        }
+    }
+
+void CVideoPlugin::HandleMdeItemL( TItemId aObjId, TCPixActionType aActionType)
+    {
+    //Get the object from object utils and get the CPIX document and add delete or update
+    CPIXLOGSTRING2("CVideoPlugin::HandleMdeItemL(): aObjId = %d ", aObjId );
+    // creating CSearchDocument object with unique ID for this application
+    TBuf<KMaxFileName> docid_str;
+    if (aActionType == ECPixAddAction || aActionType == ECPixUpdateAction )
+        {
+        //To Improve performance check here only before Getobject if it is Add event
+        //and we already have in our database just return in case of update move forward
+        if(iDBManager->IsAlreadyExistL(aObjId) && aActionType == ECPixAddAction)//Avoid reharvesting
+           {
+           CPIXLOGSTRING("CVideoPlugin::HandleMdeItemL(): Already harvested returning");
+           return;
+           }
+        CMdEObject& object= iMdsUtils->GetObjectL( aObjId,MdeConstants::Video::KVideoObject );        
+        CMdENamespaceDef& defaultNamespaceDef = iMdsUtils->GetSession()->GetDefaultNamespaceDefL();        
+        CMdEObjectDef& videoObjDef = defaultNamespaceDef.GetObjectDefL( MdeConstants::Video::KVideoObject );        
+        CSearchDocument* index_item = iVideoDocument->GetCpixDocumentL(object,_L(MEDIAAPPCLASS),videoObjDef);
+        iIndexer = iIndexerUtil->GetIndexerFromMediaId(object.MediaId());
+        
+        if (!iIndexer)
+            {
+            delete index_item;
+            CPIXLOGSTRING("CVideoPlugin::HandleMdeItemL(): Indexer not found");
+            return;
+            }
+        // Send for indexing
+        if (aActionType == ECPixAddAction)
+            {
+#ifdef __PERFORMANCE_DATA
+            ++count;
+#endif
+            CPIXLOGSTRING("CVideoPlugin::HandleMdeItemL(): Indexer found calling AddL");
+            //First check if it already exist in database
+            TRAPD(err, iIndexer->UpdateL(*index_item)); //Always Update to avoid reharvesting
+            if (err == KErrNone)
+                {
+                //Add entity to database for later use
+                iMdsItem->Reset();//reset existing values
+                iMdsItem->Setkey(aObjId);
+                iMdsItem->SetUri(iVideoDocument->GetUri());//Use the Absolute URI
+                TDriveNumber drive;
+                iIndexerUtil->GetDriveFromMediaId(object.MediaId(),drive);
+                iMdsItem->SetDrive(drive);
+                iDBManager->AddL(aObjId,*iMdsItem);//Add to SyncDB
+                CPIXLOGSTRING("CVideoPlugin::HandleMdeItemL(): Added.");
+                }
+            else
+                {
+                CPIXLOGSTRING2("CVideoPlugin::HandleMdeItemL(): Error %d in adding.", err);
+                }           
+            }
+        else if (aActionType == ECPixUpdateAction)
+            {
+            //If DocID for e.g \video\something.3gpp itself changes the we have to compare
+            //existing URI with new one and Remove that first and Update to avoid 
+            //Duplicate entries
+            iMdsItem->Reset();//reset existing values
+            TRAPD(err, iDBManager->GetItemL(aObjId,*iMdsItem));
+            if(err == KErrNone)
+                {
+                //Get the drivenumber from the syncDB to delete the appropriate docId 
+                //in case an item is moved to different drive, delete from the old drive first and later update.
+                //comparing the absolute paths along with the root drives
+                if(iMdsItem->GetPath().Compare(object.Uri()) != 0)
+                    {
+                    CCPixIndexer *tempIndexer;                
+                    tempIndexer = iIndexerUtil->GetIndexerFromDrive(iMdsItem->DriveNumber());
+                    tempIndexer->DeleteL(iMdsItem->Uri());
+                    CPIXLOGSTRING("CVideoPlugin::HandleMdeItemL(): Deleted existing URI for update");
+                    }
+                TRAPD(error, iIndexer->UpdateL(*index_item));
+                if (error == KErrNone)
+                    {
+                    //Add as new
+                    iMdsItem->Reset();//reset existing values
+                    TDriveNumber drive;
+                    iIndexerUtil->GetDriveFromMediaId(object.MediaId(),drive);
+                    iMdsItem->Set(aObjId,iVideoDocument->GetUri(),drive);
+                    iDBManager->UpdateL(aObjId,*iMdsItem);//Add to SyncDB
+                    CPIXLOGSTRING("CVideoPlugin::HandleMdeItemL(): Updated.");
+                    }
+                else
+                    {
+                    CPIXLOGSTRING2("CVideoPlugin::HandleMdeItemL(): Error %d in updating.", error);
+                    }   
+                }
+            //If a media item is added when downloading or streaming begins, add event is surpassed
+            //by update or delete event because of delay introduced on monitered object by objectqueue manager
+            //So add the Item first, when GetItemL() leaves with item not found
+            else if(err == KErrNotFound)
+                {
+                TRAPD(error, iIndexer->UpdateL(*index_item));
+                if (error == KErrNone)
+                    {
+                    //Add entity to database for later use
+                    iMdsItem->Reset();//reset existing values
+                    iMdsItem->Setkey(aObjId);
+                    iMdsItem->SetUri(iVideoDocument->GetUri());//Use the Absolute URI
+                    TDriveNumber drive;
+                    iIndexerUtil->GetDriveFromMediaId(object.MediaId(),drive);
+                    iMdsItem->SetDrive(drive);
+                    iDBManager->AddL(aObjId,*iMdsItem);//Add to SyncDB
+                    CPIXLOGSTRING("CVideoPlugin::HandleMdeItemL(): Added Item before Update.");
+                    }
+                }                    
+            }
+        delete index_item;
+        iIndexer = NULL;        
+        }
+    else if (aActionType == ECPixRemoveAction)
+            {
+            // Remove the document
+            //Get the Item from SyncDB for removed Item
+            iMdsItem->Reset();//reset existing values
+            TRAPD(error, iDBManager->GetItemL(aObjId,*iMdsItem));
+            if (error == KErrNone)
+                {
+                iIndexer = iIndexerUtil->GetIndexerFromDrive(iMdsItem->DriveNumber());//Get Indexer from drive
+                if(iIndexer) //If indexer found delete
+                    {
+                    docid_str.Copy(iMdsItem->Uri());
+                    TRAPD(err, iIndexer->DeleteL(docid_str));//Delete it
+                    if (err == KErrNone)
+                        {
+                        CPIXLOGSTRING("CVideoPlugin::HandleMdeItemL(): Deleted.");
+                        }
+                    else
+                        {
+                        CPIXLOGSTRING2("CVideoPlugin::HandleMdeItemL(): Error %d in deleting.", err);
+                        }
+                    }
+                //delete entry from database
+                iDBManager->RemoveL(iMdsItem->Key());
+                }
+            iIndexer = NULL;//Assign to null not pointing to any memory
+            }    
+    }
+
+#ifdef __PERFORMANCE_DATA
+void CVideoPlugin::UpdateLogL()
+    {
+    UpdatePerformaceDataL();
+    }
+
+void CVideoPlugin::UpdatePerformaceDataL()
+    {
+    TTime now;
+    
+    iCompleteTime.UniversalTime();
+    TTimeIntervalMicroSeconds timeDiff = iCompleteTime.MicroSecondsFrom(iStartTime);
+    
+    RFs fileSession;
+    RFile perfFile;
+    User::LeaveIfError( fileSession.Connect () );
+    
+    
+    /* Open file if it exists, otherwise create it and write content in it */
+    
+        if(perfFile.Open(fileSession, _L("c:\\data\\VideoPerf.txt"), EFileWrite))
+                   User::LeaveIfError(perfFile.Create (fileSession, _L("c:\\data\\VideoPerf.txt"), EFileWrite));
+    
+    HBufC8 *heap = HBufC8::NewL(100);
+    TPtr8 ptr = heap->Des();
+    now.HomeTime();
+    TBuf<50> timeString;             
+                
+    _LIT(KOwnTimeFormat,"%:0%H%:1%T%:2%S");
+    now.FormatL(timeString,KOwnTimeFormat);
+    ptr.AppendNum(now.DateTime().Day());
+    ptr.Append(_L("/"));
+    ptr.AppendNum(now.DateTime().Month());
+    ptr.Append(_L("/"));
+    ptr.AppendNum(now.DateTime().Year());
+    ptr.Append(_L(":"));
+    ptr.Append(timeString);
+    ptr.Append(_L("--"));
+    ptr.AppendNum(count);
+    ptr.Append( _L(" :Time took for Harvesting Video is : "));
+    ptr.AppendNum(timeDiff.Int64()/1000) ;
+    ptr.Append(_L(" MilliSeonds \n"));
+    TInt myInt = 0;
+    perfFile.Seek(ESeekEnd,myInt);
+    perfFile.Write (ptr);
+    perfFile.Close ();
+    fileSession.Close ();
+    delete heap;
+    }
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/harvesterplugins/messaging/data/2001f701.rss	Mon Apr 19 14:40:05 2010 +0300
@@ -0,0 +1,48 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: 
+*
+*/
+// 0x2001F701.RSS
+
+#include <registryinfo.rh>
+
+// Declares info for one test implementation
+RESOURCE REGISTRY_INFO theInfo
+        {
+        // UID for the DLL        
+        dll_uid = 0x2001F701; // ECOM Messaging Plugin dll UID
+        // Declare array of interface info
+        interfaces = 
+                {
+                INTERFACE_INFO
+                        {
+                        // UID of interface that is implemented
+                        interface_uid = 0x2001F700; // CPixSearch Plugin Interface UID
+                        implementations = 
+                                {
+                                // Info for CMessagePlugin
+                                IMPLEMENTATION_INFO
+                                        {
+                                        implementation_uid = 0x2001F701;
+                                        version_no = 1;
+                                        display_name = "CPix Search Messaging plugin";
+                                        default_data = "Messaging";
+                                        opaque_data = "";
+                                        }
+                                };
+                        }
+                };
+        }
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/harvesterplugins/messaging/group/bld.inf	Mon Apr 19 14:40:05 2010 +0300
@@ -0,0 +1,22 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: 
+*
+*/
+
+
+PRJ_MMPFILES
+
+messageplugin.mmp
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/harvesterplugins/messaging/group/messageplugin.mmp	Mon Apr 19 14:40:05 2010 +0300
@@ -0,0 +1,60 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: 
+*
+*/
+
+TARGET        cpixmessageplugin.dll
+TARGETTYPE    PLUGIN
+ 
+#include          <platform_paths.hrh>
+CAPABILITY   CAP_GENERAL_DLL -AllFiles -DRM
+#include "../../../harvesterplugins/inc/s60performance.h"
+// ECom Dll recognition UID followed by the unique UID for this dll
+UID           0x10009D8D 0x2001F701 
+
+SOURCEPATH    ../src
+SOURCE        cmessageplugin.cpp
+SOURCE        cmessagedatahandler.cpp
+SOURCE        cmessageharvester.cpp
+SOURCE        cmessagemonitor.cpp
+SOURCE        tproxy.cpp
+
+USERINCLUDE   ../inc
+
+APP_LAYER_SYSTEMINCLUDE
+SYSTEMINCLUDE /epoc32/include/ecom
+
+
+SOURCEPATH    ../data
+start RESOURCE 2001f701.rss
+target  cpixmessageplugin.rsc
+end
+
+LIBRARY       euser.lib
+LIBRARY       ecom.lib
+LIBRARY       efsrv.lib
+LIBRARY		  msgs.lib
+LIBRARY		  gsmu.lib
+LIBRARY       cpixharvesterplugininterface.lib
+LIBRARY       cpixsearchclient.lib
+LIBRARY		  charconv.lib
+LIBRARY		  imcm.lib // CImHeader, CImEmailMessage
+LIBRARY		  etext.lib // CParaFormatLayer etc
+
+// For logging
+LIBRARY 	  flogger.lib 
+
+EXPORTUNFROZEN
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/harvesterplugins/messaging/inc/cmessagedatahandler.h	Mon Apr 19 14:40:05 2010 +0300
@@ -0,0 +1,169 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Harvester message plugin
+ *
+*/
+
+
+#ifndef CMESSAGEDATAHANDLER_H
+#define CMESSAGEDATAHANDLER_H
+
+//  INCLUDES 
+
+#include <e32base.h>
+#include <msvapi.h>
+#include "cmessageplugin.h"
+
+// FORWARD DECLARATIONS
+class CMmsClientMtm;
+class CSmsClientMtm;
+class CClientMtmRegistry;
+class CSmtpClientMtm;
+class CPop3ClientMtm;
+class CImap4ClientMtm;
+
+class CMessageDataHandler : public CActive
+	{
+public:
+	/**
+	 * Construction
+	 * @return Harvester image plugin
+	 */
+	static CMessageDataHandler* NewL(CMessagePlugin& aMessagePlugin,
+			CMsvSession& aSession);
+
+	/**
+	 * Destruction
+	 */
+	virtual ~CMessageDataHandler();
+
+	/**
+	 * Set a item to be indexed.
+	 * @param TMsvId& aMessageId Id of message
+	 * @param TCPixActionType aActionType Action type of item
+	 * @param TMsvId& aFolderId Id of the folder where message is located
+	 */
+	void GatherDataL(TMsvId& aMessageId, TCPixActionType aActionType, TMsvId& aFolderId);
+
+private:
+	//From CActive
+
+	/**
+	 * From CACtive.
+	 */
+	void DoCancel();
+
+	/**
+	 * From CACtive.
+	 */
+	void RunL();
+
+	/**
+	 * From CActive.
+	 * @param aError Leave code from RunL()
+	 * @return Error code, KErrNone if error was handled successfully.
+	 */
+	TInt RunError(TInt aError);
+
+	/**
+	 * Check if the message is valid and what type it is.
+	 * @param TMsvId aIdToCheck Id of the message
+	 * @param TMsgInfo& aMessageType Reference to put message type
+	 * @return TInt error, if any
+	 */
+	TInt IsValidMessageType(TMsvId aIdToCheck, TMsgType& aMessageType);
+	
+	/**
+	 * Launch the next request. 
+	 */
+	void HandleNextRequest();
+
+private:
+
+	/**
+	 * Private constructor
+	 */
+	CMessageDataHandler(CMessagePlugin& aMessagePlugin, CMsvSession& aSession);
+
+	/**
+	 * 2nd phase construction
+	 */
+	void ConstructL();
+
+	/**
+	 * Create a message item to be indexed based on the params.
+	 * @param TMsvId& aMsvId Id of the item to be indexed
+	 * @param TCPixActionType aAction type of the indexing event
+	 * @param TFolderId& aFolderId Id of the folder where indexed message is located
+	 */
+	 void CreateMessageIndexItemL(const TMsvId& aMsvId, TCPixActionType aActionType, const TMsvId& aFolderId);
+
+	 /**
+	  * Creates general message excerpt
+	  */
+	 HBufC* CreateExcerptLC(const TDesC& aFromAddress, 
+							const CDesCArray& aRecipientArray,
+							const TDesC& aSubject,
+							const TDesC& aBodyText,
+							const TMsvId& aFolderId);
+	 
+	 CSearchDocument* CreateSmsDocumentL(const TMsvId& aMsvId, const TMsvId& aFolderId);
+	 CSearchDocument* CreateMmsDocumentL(const TMsvId& aMsvId, const TMsvId& aFolderId);
+	 CSearchDocument* CreateEmailDocumentL(const TMsvId& aMsvId, const TMsvId& aFolderId);
+	 TUint TextFileCharsetL(RFs aFs, RFile aFile);
+	 void ConvertToUcs2FromUtfL(RFs& aFs,
+								  TDes& aUcs2Text,
+								  const TDesC8& aUtfText,
+								  TUint aMibCharset);
+	 TBool IsTextUcs2(const TDesC8& aText);
+	 TBool TextContainsUtf8Bom(const TDesC8& aText);
+
+private:
+	class TMessageItem
+		{
+		public:
+			TMessageItem(TMsvId aMessageId, TCPixActionType aActionType, TMsvId aFolderId)
+				{
+				iMessageId = aMessageId;
+				iActionType = aActionType;
+				iFolderId = aFolderId;
+				}
+			;
+
+		public:
+			TMsvId iMessageId;
+			TCPixActionType iActionType;
+			TMsvId iFolderId;
+		};
+
+private:
+	// Message plugin handle
+	CMessagePlugin& iMessagePlugin;
+	// Session Message server session, own
+	CMsvSession& iMsvSession;
+	// Messages to be handled
+	RArray<TMessageItem> iMessageArray;
+
+	// Data sources
+	CClientMtmRegistry*         iMtmReg;
+	CMmsClientMtm*              iMmsMtm;
+	CSmsClientMtm*              iSmsMtm;
+	CSmtpClientMtm*             iSmtpMtm;                 // client for opening smtp
+	CPop3ClientMtm*				iPop3Mtm;                   // client for opening pop3
+	CImap4ClientMtm*			iImap4Mtm;                  // client for opening imap4
+	RFs							iFs;
+	};
+
+#endif // CMESSAGEDATAHANDLER_H
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/harvesterplugins/messaging/inc/cmessageharvester.h	Mon Apr 19 14:40:05 2010 +0300
@@ -0,0 +1,136 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Harvester message plugin
+*
+*/
+
+
+#ifndef CMESSAGEHARVESTER_H
+#define CMESSAGEHARVESTER_H
+
+//  INCLUDES 
+
+#include <e32base.h>
+#include <msvapi.h>
+//#include <mdeitem.h>
+
+#include "cmessageplugin.h"
+
+
+class CMessageHarvester : public CActive
+    {
+    public:
+        /**
+        * Construction
+        * @return Harvester image plugin
+        */
+        static CMessageHarvester* NewL( CMessagePlugin& aMessagePlugin, CMsvSession& aSession );
+
+        /**
+        * Destruction
+        */
+        virtual ~CMessageHarvester();
+                
+        /**
+        * Start harvesting message items
+        */
+        void StartHarvestingL();
+
+    private:  //From CActive
+
+	    /**
+	     * From CACtive.
+	     */
+        void DoCancel();
+
+        /**
+	     * From CACtive.
+         */
+        void RunL();
+
+        /**
+	     * From CACtive.
+	     * @param aError Leave code from RunL()
+	     * @return Error code, KErrNone if error was handled successfully.
+         */
+        TInt RunError( TInt aError );
+
+    
+    private:
+
+        /**
+        * Private constructor
+        */    
+        CMessageHarvester( CMessagePlugin& aMessagePlugin, CMsvSession& aSession );
+
+        /**
+        * Get next messaging folder 
+        */
+        void GetNextFolderL();
+        
+        /**
+        * List subfolder from current folder
+        * @param aFolderEntry Folder entry
+        */        
+        void ListSubFoldersL(  const CMsvEntry& aFolderEntry );
+        
+        /**
+        * List subfolder from current folder
+        * @param aFolderId a folder identifier
+        */ 
+        void AddFolderWithSubFoldersL( const TMsvId& aFolderId );
+        
+        /**
+        * Get message folders under the messaging   
+        */ 
+        void GetMessageFoldersL();
+        
+        /**
+        * Get message identifier
+        */ 
+        void GetMessageIdL();
+
+        /**
+        * Handles next request
+        */
+        void HandleNextRequest();      
+
+    private:
+    	enum TState
+    		{
+    		EStateIdle, // Stopped
+    		EStateNextFolder, // Getting the next folder 
+    		EStateNextMessage, // Getting the next message
+    		};
+    	
+    private:
+        // Whether Harvesting is ready   
+        TBool iHarvestCompleted;
+        // Message plugin for observing
+        CMessagePlugin& iMessagePlugin; 
+        // Session Message server session, own
+        CMsvSession& iMsvSession;
+        // Internal state machine state
+        TState iState;
+        // Array of folders to be searched  
+        RArray<TMsvId> iToBeSearchedFolders;
+        // UID of current folder searched
+        TMsvId iCurrentFolder;
+        // Current folder message items 
+        CMsvEntrySelection* iChildren;         
+    };
+
+#endif // CMESSAGEHARVESTER_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/harvesterplugins/messaging/inc/cmessagemonitor.h	Mon Apr 19 14:40:05 2010 +0300
@@ -0,0 +1,132 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  
+*
+*/
+
+
+#ifndef CMESSAGEMONITOR_H
+#define CMESSAGEMONITOR_H
+
+//  INCLUDES 
+
+#include <e32base.h>
+#include <msvapi.h>
+#include "cmessageplugin.h"
+#include <common.h>
+
+// FORWARD DECLARATIONS
+
+class CMessageMonitor : public CActive
+  	{
+	public:
+		/**
+		* NewL
+		* @return
+		*/
+		static CMessageMonitor* NewL(  CMessagePlugin& aMessagePlugin, CMsvSession& aSession );
+
+		/**
+		* Destructor
+		*/
+		virtual ~CMessageMonitor();
+				
+		/**
+		 * HandleMsgMovedL handle a moved message
+		 */
+		void HandleMsgMovedL( const TMsvId aNewFolderId, 
+							  const TMsvId aOldFolderId, 
+							  const CMsvEntrySelection& aSelection );
+
+		/**
+		 * HandleMsgCreatedChangedL handles a new or changed message
+		 * @param CMsvEntrySelection aSelection list of messages TMsvIds that have changed
+		 * @param TMsvId aFolderId Folder that contains these changed messages
+		 * @param MMsvSessionObserver::TMsvSessionEvent aEvent type of event, not used currently
+		 */	
+	    void HandleMsgCreatedChangedL( const CMsvEntrySelection& aSelection,
+                                          	        const TMsvId aFolderId,
+                                          	        const MMsvSessionObserver::TMsvSessionEvent aEvent );
+	    
+		/**
+		 * HandleMsgCreatedChangedL handles a deleted message
+		 * @param CMsvEntrySelection aSelection list of messages TMsvIds that have been deleted
+		 */		
+        void HandleMsgDeletedL( const CMsvEntrySelection& aSelection );
+        
+	protected:
+		/** 
+		 * inherited from CActive
+		 */
+		void RunL();
+		void DoCancel();
+		TInt RunError(TInt aError);
+        
+	private:
+
+		/**
+		* From Constructor
+		*/
+		CMessageMonitor(  CMessagePlugin& aMessagePlugin, CMsvSession& aSession );
+		
+		/**
+		* 2nd phase construction
+		*/
+		void ConstructL();
+
+		/**
+		 * OverwriteOrAddToQuereL is a helper for MessageItemL. Adds only unique TMsvId's to the processing queue.
+		 * @param TMsvId aMsvId message to be added to the list
+		 * @param TCPixActionType aAction action type to be added to the list
+		 * @param TMsvId aFolderId id of the folder where message is located
+		 */
+		void OverwriteOrAddToQuereL(TMsvId aMsvId, TCPixActionType aAction, TMsvId aFolderId);
+		
+		/**
+		 * MessageItemL adds a message to the delayed queue, and schedules the RunL
+		 * @param TMsvId aMsvId message to be added to the list
+		 * @param TCPixActionType aAction action type to be added to the list
+		 * @param TMsvId aFolderId id of the folder where message is located
+		 */
+		void MessageItemL(TMsvId aMsvId, TCPixActionType aAction, TMsvId aFolderId);
+
+	private:
+		enum TState 
+		{ 
+			EStateNone = 0, 
+			EStateWaiting 
+		};
+		
+		struct TMessageRecord 
+		{
+			TMsvId iMsvId;
+			TCPixActionType iAction;
+			TMsvId iFolderId;
+		};
+	
+	private:
+		// Queue of documents to be indexed
+		RArray<TMessageRecord> iMessages; 
+		
+		// State machine's state
+		TState iState;
+
+		// Timer which is used to delay indexing messages
+		RTimer iTimer;
+		
+		CMsvSession&		iMsvSession;
+		CMessagePlugin&      iMessagePlugin;
+	};
+
+#endif //  CMESSAGEMONITOR_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/harvesterplugins/messaging/inc/cmessageplugin.h	Mon Apr 19 14:40:05 2010 +0300
@@ -0,0 +1,153 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  
+*
+*/
+
+
+#ifndef CMESSAGEPLUGIN_H
+#define CMESSAGEPLUGIN_H
+
+#include <e32base.h>
+#include <msvapi.h>
+#include <cindexingplugin.h>
+#include <common.h>
+
+class CMessageMonitor;
+class CMessageHarvester;
+class CMessageDataHandler;
+class CCPixIndexer;
+
+enum TMsgType
+{
+	EMsgTypeInvalid,
+	EMsgTypeSms,
+	EMsgTypeMms,
+	EMsgTypeDraft,
+	EMsgTypeEmailPop3,
+	EMsgTypeEmailSmtp,
+	EMsgTypeEmailImap4
+};
+
+class CMessagePlugin : public CIndexingPlugin, public MMsvSessionObserver
+{
+public:
+	static CMessagePlugin* NewL();
+	static CMessagePlugin* NewLC();
+	virtual ~CMessagePlugin();
+	
+	/**
+	 * From CIndexingPlugin
+	 */
+	void StartPluginL();
+	void StartHarvestingL(const TDesC& aQualifiedBaseAppClass);
+	
+	/**
+	* callback from MMsvSessionObserver
+	*/
+	virtual void HandleSessionEventL(TMsvSessionEvent aEvent, 
+									 TAny* aArg1, 
+									 TAny* aArg2, 
+									 TAny* aArg3);
+
+	/**
+	* Called by Message monitor or harvester when new item is found.
+	*
+	* @param aMsgId Message item identifier
+	* @param TCPixActionType aActionType action type
+	* @param aFolderId identifier of the folder where message is stored 
+	*/
+    void MessageItemL( TMsvId aMsgId, TCPixActionType aActionType, TMsvId aFolderId );
+    	
+	/**
+	* Indentify the message type from TMsvEntry
+	*
+	* @param TMsvEntry& aEntry a entry item to identify
+	*/
+    TMsgType CalculateMessageType (const TMsvEntry& aEntry );
+    
+    /**
+     * Gets the database observer class
+     */
+    CCPixIndexer* GetIndexer(); //SPB { return iIndexer; }
+    /**
+     * MountL - Mount an IndexDB.
+     * @aMedia drive to mount.
+     * @aForceReharvesting to reharvest or not
+     */
+    void MountL(TDriveNumber aMedia, TBool aForceReharvesting=EFalse);
+
+    /**
+     * UnMount - Dismount a IndexDB for drive aMedia.
+     * @aMedia drive to unmount.
+     * @aUndefineAsWell if ETrue then undefine the volume as well
+     * 
+     */
+    void UnMount(TDriveNumber aMedia, TBool aUndefineAsWell = ETrue);
+    
+    /**
+     * FormBaseAppClass - constructs a baseAppClass for the given drive.
+     * @aMedia drive to form the baseAppClass for.
+     * @aBaseAppClass return descriptor containing the baseAppClass
+     * returns KErrNone on success or a standard error code
+     */
+    static TInt FormBaseAppClass(TDriveNumber aMedia, TDes& aBaseAppClass);
+    
+    /**
+     * DatabasePathL - Forms IndexDb path.
+     * @param aMedia - The drive for which the path should be constructed.
+     * returns pointer to the IndexDb path.
+     */
+    HBufC* DatabasePathLC(TDriveNumber aMedia);
+    
+    /**
+     * IsMediaRemovableL - Check media is removable or not.
+     * @param aDrive - The drive for which it is checked.
+     * returns ETrue if it is removable else EFalse.
+     */
+    TBool IsMediaRemovableL(TDriveNumber& aDrive);
+
+public:
+	/*
+	 * Notifies the indexing manager of completed harvesting, called by CMessageHarvester
+	 */
+	void HarvestingCompleted(TInt aError);
+
+protected:
+	CMessagePlugin();
+	void ConstructL();
+
+private:
+    // Session to Messge server session
+    CMsvSession* iMsvSession;
+    CMessageMonitor* iMessageMonitor;    
+    CMessageHarvester* iMessageHarvester;
+    CMessageDataHandler* iMessageDataHandler;
+
+    // File system session
+    RFs iFs;
+    //Currently used Drive by messaging application
+    TInt     iCurrentDrive;
+    // CPix indexer 
+    CCPixIndexer* iIndexer[EDriveZ+1]; // EDriveZ enum value is 25, so add 1.
+
+#ifdef __PERFORMANCE_DATA
+    TTime iStartTime;
+    TTime iCompleteTime;
+    void UpdatePerformaceDataL();
+    void UpdatePerformaceDataL(TMsvSessionEvent);
+#endif
+};
+
+#endif // CMESSAGEPLUGIN_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/harvesterplugins/messaging/src/cmessagedatahandler.cpp	Mon Apr 19 14:40:05 2010 +0300
@@ -0,0 +1,892 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Harvester message plugin
+ *
+*/
+
+
+//  INCLUDES 
+
+#include <e32base.h>
+
+#include <mtclreg.h>
+#include <smsclnt.h> // SMS Headers
+#include <mmsclient.h> // MMS Headers
+#include <mmsvattachmentmanager.h>
+#include <impcmtm.h> // IMAP Headers
+#include <smtcmtm.h> // SMTP
+#include <popcmtm.h> // POP
+
+#include "harvesterserverlogger.h"
+#include "cmessagedatahandler.h"
+#include "cmessageplugin.h"
+#include <csearchdocument.h>
+#include <common.h>
+
+#include <ccpixindexer.h>
+
+/** Number of symbols from MsgBody taken to excerpt */
+const TInt KMsgBodyExcerptSymbols = 90;
+
+// For Ucs2 detection
+const TInt KUtf8BomLength = 3;
+const TUint8 KUtf8Bom[KUtf8BomLength] = {0xEF, 0xBB, 0xBF};
+
+// CSearchDocument ID max length
+const TUint KMaxDocId = 20;
+// Hardcoded limit for the body size to index (and store)
+const TInt KMaxDocumentSize = 1024;
+
+_LIT8(KMimeTypeText, "text/plain" );
+
+_LIT(KMimeTypeField, CPIX_MIMETYPE_FIELD);
+_LIT(KMimeTypeMessaging, MESSAGING_MIMETYPE);
+
+/** Field names */
+_LIT(KToField, TO_FIELD);
+_LIT(KCcField, CC_FIELD);
+_LIT(KBccField, BCC_FIELD);
+_LIT(KFromField, FROM_FIELD);
+_LIT(KFolderField, FOLDER_FIELD);
+_LIT(KBodyField, BODY_FIELD);
+_LIT(KSubjectField, SUBJECT_FIELD);
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// ---------------------------------------------------------------------------
+// CMessageDataHandler::NewL
+// ---------------------------------------------------------------------------
+//
+CMessageDataHandler* CMessageDataHandler::NewL(CMessagePlugin& aMessagePlugin,
+		CMsvSession& aSession)
+	{
+		CPIXLOGSTRING( "CMessageDataHandler::NewL() - enter" );
+
+	CMessageDataHandler* self = new (ELeave) CMessageDataHandler(
+			aMessagePlugin, aSession);
+	CleanupStack::PushL(self);
+	self->ConstructL();
+	CleanupStack::Pop(self);
+
+		CPIXLOGSTRING( "CMessageDataHandler::NewL() - return" );
+	return self;
+	}
+
+// ---------------------------------------------------------------------------
+// CMessageDataHandler::~CMessageDataHandler
+// ---------------------------------------------------------------------------
+//
+CMessageDataHandler::~CMessageDataHandler()
+	{
+	Cancel();
+	iFs.Close();
+	delete iMmsMtm;
+	delete iSmsMtm;
+	delete iSmtpMtm;
+	delete iPop3Mtm;
+	delete iImap4Mtm;
+	delete iMtmReg;
+	}
+
+// ---------------------------------------------------------------------------
+// CMessageDataHandler::CMessageDataHandler
+// ---------------------------------------------------------------------------
+//
+CMessageDataHandler::CMessageDataHandler(CMessagePlugin& aMessagePlugin, CMsvSession& aSession)
+	: CActive(EPriorityLow), iMessagePlugin(aMessagePlugin), iMsvSession(aSession)
+	{
+	CActiveScheduler::Add(this);
+	}
+
+// ---------------------------------------------------------------------------
+// CMessageDataHandler::ConstructL
+// ---------------------------------------------------------------------------
+//
+void CMessageDataHandler::ConstructL()
+	{
+	// TODO iFs only used in MMS attachment logic, 
+	// from a performance perspective, is it worthwhile connecting here?
+	User::LeaveIfError(iFs.Connect());
+	iMtmReg = CClientMtmRegistry::NewL(iMsvSession);
+	TRAPD(err,iSmsMtm = static_cast<CSmsClientMtm*> (iMtmReg->NewMtmL(KUidMsgTypeSMS)));
+	CPIXLOGSTRING2( "CMessageDataHandler::ConstructL() iSmsMtm err = %d",err);
+	TRAP(err,iMmsMtm = static_cast<CMmsClientMtm*> (iMtmReg->NewMtmL(KUidMsgTypeMultimedia)));
+	CPIXLOGSTRING2( "CMessageDataHandler::ConstructL() iMmsMtm err = %d",err);
+	/*
+	TRAP(err,iSmtpMtm = static_cast<CSmtpClientMtm*> (iMtmReg->NewMtmL(KUidMsgTypeSMTP)));
+	CPIXLOGSTRING2( "CMessageDataHandler::ConstructL() iSmtpMtm err = %d",err);
+	TRAP(err, iPop3Mtm = static_cast<CPop3ClientMtm*> (iMtmReg->NewMtmL(KUidMsgTypePOP3)));
+	CPIXLOGSTRING2( "CMessageDataHandler::ConstructL() iPop3Mtm err = %d",err);
+	TRAP(err,iImap4Mtm = static_cast<CImap4ClientMtm*> (iMtmReg->NewMtmL(KUidMsgTypeIMAP4)));
+	CPIXLOGSTRING2( "CMessageDataHandler::ConstructL() iImap4Mtm err = %d",err);
+	*/
+	}
+
+// ---------------------------------------------------------------------------
+// CMessageDataHandler::GatherData
+// ---------------------------------------------------------------------------
+//
+void CMessageDataHandler::GatherDataL(TMsvId& aMessageId,
+		TCPixActionType aActionType, TMsvId& aFolderId)
+	{
+	TMessageItem item(aMessageId, aActionType, aFolderId);
+	iMessageArray.AppendL(item);
+	HandleNextRequest();
+	}
+
+// ---------------------------------------------------------------------------
+// CMessageDataHandler::IsValidMessageTypeL
+// ---------------------------------------------------------------------------
+//	    
+TInt CMessageDataHandler::IsValidMessageType(TMsvId aIdToCheck,
+		TMsgType& aMessageType)
+	{
+		CPIXLOGSTRING("ENTER CMessageDataHandler::IsValidMessageType");
+	TMsvEntry entry;
+	TMsvId service = 0;
+	TInt err = iMsvSession.GetEntry(aIdToCheck, service, entry);
+		CPIXLOGSTRING2("CMessageDataHandler::IsValidMessageType GetEntry: %d", err);
+	if (!err)
+		{
+		aMessageType = iMessagePlugin.CalculateMessageType(entry);
+			CPIXLOGSTRING2("CMessageDataHandler::IsValidMessageType type: %d", aMessageType );
+		}
+		CPIXLOGSTRING("END CMessageDataHandler::IsValidMessageType");
+	return err;
+	}
+
+// ---------------------------------------------------------------------------
+// CMessageDataHandler::CreateSmsIndexItemLC
+// ---------------------------------------------------------------------------
+//	    
+void CMessageDataHandler::CreateMessageIndexItemL(const TMsvId& aMsvId,
+		TCPixActionType aActionType, const TMsvId& aFolderId)
+	{
+	CPIXLOGSTRING2("CMessageDataHandler::CreateMessageIndexItemL(): aMsvId = %d ", aMsvId );
+
+	// Index an empty item if removal action
+	if (aActionType == ECPixRemoveAction)
+		{
+		TBuf<20> docid_str;
+		docid_str.AppendNum(aMsvId);
+		if (iMessagePlugin.GetIndexer())
+			{
+			TRAPD(err, iMessagePlugin.GetIndexer()->DeleteL(docid_str));
+			if (err == KErrNone)
+				{
+				CPIXLOGSTRING("CMessageDataHandler::CreateMessageIndexItemL(): Document deleted.");
+				}
+			else
+				{
+				CPIXLOGSTRING2("CMessageDataHandler::CreateMessageIndexItemL(): Error %d in deleting the document.", err);				
+				}
+			}
+		return;
+		}
+
+	// Check message type
+	TMsgType messageType = EMsgTypeInvalid; // initialisation
+	TInt error = IsValidMessageType(aMsvId, messageType);
+
+	// creating CSearchDocument object with unique ID for this application
+	CSearchDocument* index_item = NULL;
+
+	switch (messageType)
+		{
+		case EMsgTypeSms:
+			{
+			TRAPD(err, index_item = CreateSmsDocumentL(aMsvId, aFolderId));
+			if (err == KErrNone)
+				{
+				CPIXLOGSTRING("CMessageDataHandler::CreateMessageIndexItemL(): SMS document created.");
+				}
+			else
+				{
+				CPIXLOGSTRING2("CMessageDataHandler::CreateMessageIndexItemL(): Error %d in creating SMS document.", err);
+				}
+			break;
+			}
+		case EMsgTypeMms:
+			{
+			TRAPD(err, index_item = CreateMmsDocumentL(aMsvId, aFolderId));
+			if (err == KErrNone)
+				{
+				CPIXLOGSTRING("CMessageDataHandler::CreateMessageIndexItemL(): MMS document created.");
+				}
+			else
+				{
+				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)
+				{
+				CPIXLOGSTRING("CMessageDataHandler::CreateMessageIndexItemL(): E-mail document created.");
+				}
+			else
+				{
+				CPIXLOGSTRING2("CMessageDataHandler::CreateMessageIndexItemL(): Error %d in creating e-mail document.", err);
+				}
+			break;
+			}
+		case EMsgTypeInvalid:
+		// For EMsgTypeDraft there is no way to tell if it was a SMS, MMS or email,
+		// so don't create index_item.
+		case EMsgTypeDraft:
+		default:
+			// Error occurred
+			break;
+		}
+
+	// Exit if wrong message type
+	if (index_item == NULL)
+		{
+		CPIXLOGSTRING("CMessageDataHandler::CreateMessageIndexItemL(): Document was not created.");
+		return;
+		}
+	CleanupStack::PushL(index_item);
+		
+	// Folder field
+	TMsvEntry entry;
+	TMsvId service = 0;
+	iMsvSession.GetEntry(aFolderId, service, entry);
+	HBufC *folder_str = entry.iDetails.AllocLC();
+	index_item->AddFieldL(KFolderField, *folder_str, CDocumentField::EStoreYes | CDocumentField::EIndexNo);
+
+	// Mime type field
+	index_item->AddFieldL(KMimeTypeField, KMimeTypeMessaging, CDocumentField::EStoreYes | CDocumentField::EIndexUnTokenized);		
+	
+		// Send for indexing
+	if (iMessagePlugin.GetIndexer())
+		{
+		if (aActionType == ECPixAddAction)
+			{
+			TRAPD(err, iMessagePlugin.GetIndexer()->AddL(*index_item));
+			if (err == KErrNone)
+				{
+				CPIXLOGSTRING("CMessageDataHandler::CreateMessageIndexItemL(): Added.");
+				}
+			else
+				{
+				CPIXLOGSTRING2("CMessageDataHandler::CreateMessageIndexItemL(): Error %d in adding.", err);
+				}
+			}
+		else if (aActionType == ECPixUpdateAction)
+			{
+			TRAPD(err, iMessagePlugin.GetIndexer()->UpdateL(*index_item));
+			if (err == KErrNone)
+				{
+				CPIXLOGSTRING("CMessageDataHandler::CreateMessageIndexItemL(): Updated.");
+				}
+			else
+				{
+				CPIXLOGSTRING2("CMessageDataHandler::CreateMessageIndexItemL(): Error %d in updating.", err);
+				}
+			}
+		}
+	else
+		{
+		CPIXLOGSTRING("END CMessageDataHandler::CreateMessageIndexItemL(): No indexer present.");
+		}
+		
+	CleanupStack::PopAndDestroy(folder_str);
+	CleanupStack::PopAndDestroy(index_item);
+	}
+
+// ---------------------------------------------------------------------------
+// CMessageDataHandler::CreateSmsDocumentL
+// ---------------------------------------------------------------------------
+//
+CSearchDocument* CMessageDataHandler::CreateSmsDocumentL(const TMsvId& aMsvId, const TMsvId& aFolderId)
+	{
+	// Select mtm for this type
+	iSmsMtm->SwitchCurrentEntryL(aMsvId);
+	iSmsMtm->LoadMessageL();
+
+	// 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(SMSAPPCLASS));
+
+	// Add from field use the name instead of number if in the contacts db.
+	// (iSmsMtm->SmsHeader().FromAddress() - only returns the number)
+	TMsvEntry entry;
+	TMsvId service = 0;
+	iMsvSession.GetEntry(aMsvId, service, entry);
+	HBufC *fromNameOrNumberBuf = entry.iDetails.AllocLC();
+	index_item->AddFieldL(KFromField, *fromNameOrNumberBuf);
+
+	// Add the recipients as content items
+	TBuf<64> to_field;
+	const CDesCArray
+			& recipientArray =
+					static_cast<const CDesCArray&> (iSmsMtm->AddresseeList().RecipientList());
+	for (TInt i = 0; i < recipientArray.MdcaCount(); i++)
+		{
+		to_field = KToField;
+		if (i>0)
+			to_field.AppendNum(i);
+		index_item->AddFieldL(to_field, recipientArray.MdcaPoint(i));
+		}
+
+	// Add the body text as a content item
+	TInt msgLength = iSmsMtm->Body().DocumentLength();
+	HBufC* bodyText = HBufC::NewLC(msgLength);
+	TPtr body_ptr = bodyText->Des();
+	iSmsMtm->Body().Extract(body_ptr);
+	index_item->AddFieldL(KBodyField, *bodyText);
+	
+	// Add excerpt
+	// Note SMS does not have a subject field.
+	HBufC* excerpt = CreateExcerptLC(*fromNameOrNumberBuf, recipientArray, KNullDesC(), body_ptr, aFolderId);
+	index_item->AddExcerptL(*excerpt);
+	CleanupStack::PopAndDestroy(excerpt);	
+	CleanupStack::PopAndDestroy(bodyText);
+
+	CleanupStack::PopAndDestroy(fromNameOrNumberBuf);
+
+	// Pop the item
+	CleanupStack::Pop(index_item);
+	return index_item;
+	}
+
+// ---------------------------------------------------------------------------
+// CMessageDataHandler::CreateMmsDocumentL
+// ---------------------------------------------------------------------------
+//
+CSearchDocument* CMessageDataHandler::CreateMmsDocumentL(const TMsvId& aMsvId, const TMsvId& aFolderId)
+	{
+	// Select mtm for this type
+ 	iMmsMtm->SwitchCurrentEntryL(aMsvId);
+	iMmsMtm->LoadMessageL();
+
+	// 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(MMSAPPCLASS));
+	
+	// Add from field
+	index_item->AddFieldL(KFromField, iMmsMtm->Sender());
+
+	// Add the recipients as content items
+	TBuf<64> to_field;
+	const CDesCArray
+			& recipientArray =
+					static_cast<const CDesCArray&> (iMmsMtm->AddresseeList().RecipientList());
+	for (TInt i = 0; i < recipientArray.MdcaCount(); i++)
+		{
+		to_field = KToField;
+		if (i>0)
+			to_field.AppendNum(i);
+		index_item->AddFieldL(to_field, recipientArray.MdcaPoint(i));
+		}
+
+	// Add subject
+	TPtrC subject(iMmsMtm->SubjectL());
+	index_item->AddFieldL(KSubjectField, subject);
+
+	// Add the body parts as a content items
+    // See if the MMS contains a text file attachment
+    TBool excerptFieldAdded(EFalse);
+    TInt bodycount = 0;
+    CMsvStore* msvStore = iMmsMtm->Entry().ReadStoreL();
+	CleanupStack::PushL( msvStore );
+	MMsvAttachmentManager& attManager = msvStore->AttachmentManagerL();
+	for ( TInt i = 0; i < attManager.AttachmentCount(); i++ )
+	    {
+		CMsvAttachment* attInfo = attManager.GetAttachmentInfoL(i);
+		CleanupStack::PushL( attInfo );
+		
+        if (attInfo->MimeType() == KMimeTypeText())
+            {
+            // Mime type
+            RFile attFile = attManager.GetAttachmentFileL(i);
+            CleanupClosePushL( attFile );
+            TInt charsetMIB = TextFileCharsetL(iFs, attFile);
+            
+            // Get the file size
+            TInt fileSize = 0;
+            User::LeaveIfError(attFile.Size(fileSize));
+            
+            // Read the file
+            HBufC8* textSource = HBufC8::NewLC(fileSize);
+            TPtr8 ptr8 = textSource->Des();
+            attFile.Read(ptr8);
+  
+  			// Convert character set
+            HBufC* text = HBufC::NewLC( fileSize );
+            TPtr buf = text->Des();
+            if ( KMmsIso10646Ucs2 != charsetMIB )
+                {
+                if ( KMmsUsAscii == charsetMIB )
+                    buf.Copy(*textSource);
+                else
+                    ConvertToUcs2FromUtfL(iFs, buf, *textSource, charsetMIB);
+                }
+            else
+                {
+                TPtrC ptr(reinterpret_cast<const TUint16*>(textSource->Des().Ptr()), 
+                                  textSource->Length() / sizeof(TText));
+        
+                // Ignore the first unicode charcter FFFE
+                ptr.Set( ptr.Mid( 1 ) );
+                buf = ptr;
+                }
+
+        
+            // Add the text of the file as a content item
+            // MMS message body is in attachment
+			TBuf<64> body_field;
+			body_field = KBodyField;
+			if (bodycount>0)
+			{
+				// Add additional body fields
+				body_field.AppendNum(bodycount);
+			}
+			else
+			{
+				// Add excerpt for the first body field
+				HBufC* excerpt = CreateExcerptLC(iMmsMtm->Sender(), recipientArray, subject, *text, aFolderId);
+				index_item->AddExcerptL(*excerpt);
+				CleanupStack::PopAndDestroy(excerpt);
+				excerptFieldAdded  = ETrue;
+			}
+
+            // TODO: add only few kilobytes of the body?
+            index_item->AddFieldL(body_field, *text);
+            ++bodycount;
+
+            CleanupStack::PopAndDestroy( 3, &attFile ); // text, textSource, attFile
+            }		
+        else 
+            {
+            // add attachment name when binary file.
+            if ( !excerptFieldAdded )
+                {
+                // attachment name might not be set
+                HBufC* excerpt = CreateExcerptLC(iMmsMtm->Sender(), recipientArray, subject, attInfo->AttachmentName(), aFolderId);
+                index_item->AddExcerptL(*excerpt);
+                CleanupStack::PopAndDestroy(excerpt);
+                excerptFieldAdded  = ETrue;
+                }
+            }
+	    CleanupStack::PopAndDestroy( attInfo );		
+	    }
+
+    // If no excerpt has been added yet, then add information have
+    if ( !excerptFieldAdded )
+        {
+        HBufC* excerpt = CreateExcerptLC(iMmsMtm->Sender(), recipientArray, subject, KNullDesC(), aFolderId);
+        index_item->AddExcerptL(*excerpt);
+        CleanupStack::PopAndDestroy(excerpt);
+        }
+
+    // Cleanup
+    CleanupStack::PopAndDestroy( msvStore );
+
+    // Pop the item
+    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
+// ---------------------------------------------------------------------------
+//
+HBufC* CMessageDataHandler::CreateExcerptLC(const TDesC& aFromAddress,
+											const CDesCArray& aRecipientArray,
+											const TDesC& aSubject,
+											const TDesC& aBodyText,
+											const TMsvId& aFolderId)
+	{
+	_LIT(KEllipsis, "...");
+	_LIT(KSpace, " ");
+	TInt excerptLength = KMsgBodyExcerptSymbols + KEllipsis().Length(); 
+
+	TMsvEntry entry;
+	TMsvId service = 0;
+	iMsvSession.GetEntry(aFolderId, service, entry);
+	HBufC *folder_str = entry.iDetails.AllocLC();
+
+	excerptLength += folder_str->Length();
+	excerptLength += KSpace().Length();
+
+	if ((aFromAddress.Length() > 0) && (aFolderId == KMsvGlobalInBoxIndexEntryIdValue))
+		{
+		excerptLength += aFromAddress.Length();
+		excerptLength += KSpace().Length();
+		}
+	if ((aRecipientArray.MdcaCount() > 0) && (aFolderId != KMsvGlobalInBoxIndexEntryIdValue))
+		{
+		excerptLength += aRecipientArray.MdcaPoint(0).Length();
+		excerptLength += KSpace().Length(); 
+		}
+	if (aSubject.Length() > 0)
+		{
+		excerptLength += aSubject.Length();
+		excerptLength += KSpace().Length();
+		}
+
+	HBufC* excerpt = HBufC::NewL(excerptLength);
+	TPtr excerptPtr = excerpt->Des();
+
+	excerptPtr.Copy(*folder_str);
+	excerptPtr.Append(KSpace);
+	
+	if ((aFromAddress.Length() > 0) && (aFolderId == KMsvGlobalInBoxIndexEntryIdValue))
+		{
+		excerptPtr.Append(aFromAddress);
+		excerptPtr.Append(KSpace);
+		}
+	if ((aRecipientArray.MdcaCount() > 0) && (aFolderId != KMsvGlobalInBoxIndexEntryIdValue))
+		{
+		excerptPtr.Append(aRecipientArray.MdcaPoint(0));
+		excerptPtr.Append(KSpace);
+		}
+	if (aSubject.Length() > 0)
+		{
+		excerptPtr.Append(aSubject);
+		excerptPtr.Append(KSpace);
+		}
+
+	excerptPtr.Append(aBodyText.Left(KMsgBodyExcerptSymbols));
+	if (aBodyText.Length() > KMsgBodyExcerptSymbols)
+		excerptPtr.Append(KEllipsis);
+
+	CleanupStack::PopAndDestroy(folder_str);
+	CleanupStack::PushL(excerpt);
+	return excerpt;
+	}
+
+// ---------------------------------------------------------------------------
+// CMessageDataHandler::IsTextUcs2
+// ---------------------------------------------------------------------------
+//
+TBool CMessageDataHandler::IsTextUcs2(const TDesC8& aText)
+    {
+    TBool ret = EFalse;
+    // Check UCS-2 Byte order mark is in the first two bytes of aText
+    if (aText.Length() >= sizeof(KMmsByteOrderMark))
+        {
+        TPtrC ptr(reinterpret_cast<const TUint16*>(aText.Ptr()), 
+                        aText.Length() / sizeof(TText));
+
+        if (KMmsByteOrderMark == ptr[0] ||
+            KMmsReversedByteOrderMark == ptr[0])
+            {
+            ret = ETrue;
+            }
+        }
+    return ret;
+    }   	
+
+// ---------------------------------------------------------------------------
+// CMessageDataHandler::TextContainsUtf8Bom
+// ---------------------------------------------------------------------------
+//
+TBool CMessageDataHandler::TextContainsUtf8Bom(const TDesC8& aText)
+    {    
+    TBool ret = EFalse;
+    // Check to see if there is the UTF8 BOM at the begining
+    TPtrC8 utf8Id(KUtf8Bom, KUtf8BomLength);
+    if (aText.Length() >= KUtf8BomLength &&
+        aText.Left(KUtf8BomLength) == utf8Id)
+        {
+        ret = ETrue;
+        }
+    return ret;
+    }
+
+// ---------------------------------------------------------------------------
+// CMessageDataHandler::TextFileCharsetL
+// ---------------------------------------------------------------------------
+//
+TUint CMessageDataHandler::TextFileCharsetL(RFs aFs, RFile aFile)
+    {
+    TUint ret = KMmsUsAscii;
+    TBuf8<sizeof(KMmsByteOrderMark)> ucs2Buf;
+
+    TInt size;
+    User::LeaveIfError(aFile.Size(size));
+    if (size >= sizeof(KMmsByteOrderMark))
+        {
+        // Check for the UCS-2 Byte Order Mark (BOM) at the beginning 
+        // beginning of the file
+        User::LeaveIfError(aFile.Read(ucs2Buf));
+        if(IsTextUcs2(ucs2Buf))
+            {
+            ret = KMmsIso10646Ucs2;
+            }
+        }
+
+    if (KMmsIso10646Ucs2 != ret)
+        {
+        // If the text is not UCS-2 it will probably be Utf8 or Ascii
+
+        TInt seekPos = 0;
+        User::LeaveIfError(aFile.Seek(ESeekStart, seekPos));
+        
+        HBufC8* buf = HBufC8::NewLC(size);
+        TPtr8 ptr = buf->Des();
+        User::LeaveIfError(aFile.Read(ptr));
+
+        // Check to see if there is the UTF8 BOM at the begining
+        if (TextContainsUtf8Bom(ptr))
+            {
+            ret = KMmsUtf8;
+            }
+        else
+            {
+            CCnvCharacterSetConverter* converter = 
+                              CCnvCharacterSetConverter::NewLC();
+            CArrayFix<CCnvCharacterSetConverter::SCharacterSet>* availCharSets =
+                CCnvCharacterSetConverter::CreateArrayOfCharacterSetsAvailableLC(aFs);
+
+            CArrayFix<CCnvCharacterSetConverter::SCharacterSet>* utf8CharSet = 
+                new (ELeave) CArrayFixFlat<CCnvCharacterSetConverter::SCharacterSet>(1); 
+            CleanupStack::PushL(utf8CharSet);
+
+            TInt count = availCharSets->Count();
+            for (TInt i = 0; i < count; i++)
+                {
+                CCnvCharacterSetConverter::SCharacterSet& charSet = (*availCharSets)[i];
+                if (KCharacterSetIdentifierUtf8 == charSet.Identifier())
+                    {
+                    utf8CharSet->AppendL(charSet);
+                    break;
+                    }
+                }
+            TInt confidence;
+            TUint charSetId;
+            converter->AutoDetectCharacterSetL(confidence, 
+                                               charSetId, 
+                                               *utf8CharSet,
+                                               *buf);
+            const TInt KMaxConfidence = 100;
+            if (KMaxConfidence == confidence)
+                {
+                ret = KMmsUtf8;
+                }
+            CleanupStack::PopAndDestroy(3, converter);
+
+            }
+
+        CleanupStack::PopAndDestroy(buf);
+        }
+
+    TInt zero = 0;
+    User::LeaveIfError(aFile.Seek(ESeekStart, zero));
+
+    return ret;
+    }
+
+// ---------------------------------------------------------------------------
+// CMessageDataHandler::ConvertToUcs2FromUtfL
+// ---------------------------------------------------------------------------
+//
+void CMessageDataHandler::ConvertToUcs2FromUtfL(RFs& aFs,
+                                                 TDes& aUcs2Text,
+                                                 const TDesC8& aUtfText,
+                                                 TUint aMibCharset)
+    {
+    TPtrC8 toConvert(aUtfText);
+    if (KMmsUtf8 == aMibCharset)
+        {
+        if (TextContainsUtf8Bom(toConvert))
+            {
+            toConvert.Set(toConvert.Mid(KUtf8BomLength));
+            }
+        }
+    // prepare to convert character set to unicode
+    CCnvCharacterSetConverter* converter = 
+                          CCnvCharacterSetConverter::NewLC();
+    // change character set ID from MIB to Symbian
+    TUint charsetID = converter->ConvertMibEnumOfCharacterSetToIdentifierL(
+                                     aMibCharset, aFs);
+    CCnvCharacterSetConverter::TAvailability availability =
+            converter->PrepareToConvertToOrFromL(charsetID, aFs);
+
+    if (availability == CCnvCharacterSetConverter::ENotAvailable)
+        {
+        User::Leave(KErrNotSupported);
+        }
+    TInt state = CCnvCharacterSetConverter::KStateDefault;
+
+    User::LeaveIfError(converter->ConvertToUnicode(aUcs2Text, toConvert, state));
+
+    CleanupStack::PopAndDestroy(converter);
+    }
+    
+	
+// -----------------------------------------------------------------------------
+// CMessageDataHandler::DoCancel
+// -----------------------------------------------------------------------------
+//   
+void CMessageDataHandler::DoCancel()
+	{
+	}
+
+// -----------------------------------------------------------------------------
+// CMessageDataHandler::RunL
+// -----------------------------------------------------------------------------
+//   
+void CMessageDataHandler::RunL()
+	{
+		CPIXLOGSTRING2( "CMessageDataHandler::RunL status %d",iStatus.Int() );
+
+	// Implement round robin for the CActives
+	Deque();
+	CActiveScheduler::Add(this);
+
+	// Handle next message
+	if (iMessageArray.Count() > 0)
+		{
+		// Take first id from array
+		CreateMessageIndexItemL(iMessageArray[0].iMessageId,
+				iMessageArray[0].iActionType, iMessageArray[0].iFolderId);
+		
+		// Remove item that is handled
+		iMessageArray.Remove(0);
+
+		// Handle next
+		HandleNextRequest();
+		}
+	}
+
+// -----------------------------------------------------------------------------
+// CMessageDataHandler::RunError
+// -----------------------------------------------------------------------------
+//   
+TInt CMessageDataHandler::RunError(TInt aError)
+	{
+		CPIXLOGSTRING2( "CMessageDataHandler::RunError err %d", aError );
+	if (iMessageArray.Count() > 0)
+		{
+		// Remove item that is handled
+		iMessageArray.Remove(0);
+
+		// Handle next after the error
+		HandleNextRequest();
+		}
+	return KErrNone;
+	}
+
+// ---------------------------------------------------------------------------
+// HandleNextRequest
+// ---------------------------------------------------------------------------
+//
+void CMessageDataHandler::HandleNextRequest()
+	{
+	if (!IsActive())
+		{
+		SetActive();
+		TRequestStatus* status = &iStatus;
+		User::RequestComplete(status, KErrNone);
+		}
+	}
+
+// End of File
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/harvesterplugins/messaging/src/cmessageharvester.cpp	Mon Apr 19 14:40:05 2010 +0300
@@ -0,0 +1,288 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Harvester message plugin
+*
+*/
+
+
+//  INCLUDES 
+
+#include <e32base.h>
+#include <mtclreg.h>
+#include <mmsclient.h>
+#include <smsclnt.h>
+#include <smuthdr.h>
+#include <smsclnt.h>
+#include <smut.h>
+#include <gsmuelem.h>
+#include <msventry.h>
+#include <msvuids.h>
+#include <mmsconst.h>
+#include "cmessageharvester.h"
+
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// ---------------------------------------------------------------------------
+// CMessageHarvester::NewL
+// ---------------------------------------------------------------------------
+//
+CMessageHarvester* CMessageHarvester::NewL(  CMessagePlugin& aMessagePlugin, CMsvSession& aSession )
+	{
+	CMessageHarvester* self = new (ELeave) CMessageHarvester(  aMessagePlugin, aSession );
+	return self;
+	}
+
+// ---------------------------------------------------------------------------
+// CMessageHarvester::~CMessageHarvester
+// ---------------------------------------------------------------------------
+//
+CMessageHarvester::~CMessageHarvester()
+	{   
+	Cancel();  
+    delete iChildren;
+    iToBeSearchedFolders.Close();
+	}
+	  
+// ---------------------------------------------------------------------------
+// CMessageHarvester::CMessageHarvester
+// ---------------------------------------------------------------------------
+//
+CMessageHarvester::CMessageHarvester( CMessagePlugin& aMessagePlugin, CMsvSession& aSession  ) :
+	CActive(CActive::EPriorityIdle),
+	iMessagePlugin( aMessagePlugin ),
+	iMsvSession( aSession ),
+	iState(EStateIdle)
+	{
+	CActiveScheduler::Add( this );
+	}
+
+// ---------------------------------------------------------------------------
+// CMessageHarvester::StartHarvesting
+// ---------------------------------------------------------------------------
+//	
+void CMessageHarvester::StartHarvestingL()
+	{
+	// First, get message folders
+	GetMessageFoldersL();
+	
+	// Then, harvest them
+	iState = EStateNextFolder;
+	HandleNextRequest();
+	}
+
+// ---------------------------------------------------------------------------
+// CMessageHarvester::AddFolderWithSubFoldersL
+// ---------------------------------------------------------------------------
+//		
+void CMessageHarvester::AddFolderWithSubFoldersL( const TMsvId& aFolderId )
+	{
+	// Add a folder to the search list
+	User::LeaveIfError(iToBeSearchedFolders.Append(aFolderId));	
+	CMsvEntry* folderEntry = CMsvEntry::NewL(iMsvSession, aFolderId, TMsvSelectionOrdering(KMsvGroupByStandardFolders, EMsvSortByDetails, EFalse));
+	CleanupStack::PushL(folderEntry);	
+	ListSubFoldersL(*folderEntry);
+	CleanupStack::PopAndDestroy(folderEntry);
+	}
+
+// ---------------------------------------------------------------------------
+// CMessageHarvester::ListSubFoldersL
+// ---------------------------------------------------------------------------
+//	
+void CMessageHarvester::ListSubFoldersL(  const CMsvEntry& aFolderEntry ) 
+	{
+	// Only list "folder" children
+    CMsvEntrySelection* children = aFolderEntry.ChildrenL();
+	CleanupStack::PushL( children );
+
+	for ( TInt i=0; i < children->Count(); i++ )
+		{
+		TMsvId& childId = ( *children )[i];
+		const TMsvEntry& childEntry ( aFolderEntry.ChildDataL( childId ) );
+		if ( ( childEntry.iType == KUidMsvServiceEntry ) || 
+    		 ( childEntry.iType == KUidMsvFolderEntry ) )
+		    {
+		    // Add this folder to search list
+            AddFolderWithSubFoldersL( childId );		
+		    }
+		}
+	CleanupStack::PopAndDestroy();  // children
+	}
+	
+// ---------------------------------------------------------------------------
+// CMessageHarvester::GetMessageFoldersL
+// ---------------------------------------------------------------------------
+//
+void CMessageHarvester::GetMessageFoldersL()
+    {
+    // Get list of folders
+    CMsvEntry* rootEntry;
+    rootEntry = CMsvEntry::NewL( iMsvSession, KMsvRootIndexEntryIdValue,
+    TMsvSelectionOrdering( KMsvGroupByStandardFolders, EMsvSortByDetails, EFalse ) );
+    CleanupStack::PushL( rootEntry );
+	ListSubFoldersL( *rootEntry);
+	CleanupStack::PopAndDestroy( rootEntry );
+    }
+
+			
+// ---------------------------------------------------------------------------
+// CMessageHarvester::GetNextFolderL
+// ---------------------------------------------------------------------------
+//		
+void CMessageHarvester::GetNextFolderL()
+    {
+    if ( iToBeSearchedFolders.Count() > 0 )
+        
+    	{
+    	// Open the new folder
+        CMsvEntry* folder = CMsvEntry::NewL(
+	                            iMsvSession, 
+	                            iToBeSearchedFolders[0],
+	                            TMsvSelectionOrdering( KMsvGroupByStandardFolders, EMsvSortByDetails ));
+        
+        iCurrentFolder = iToBeSearchedFolders[0];
+        
+        // Get the message items from the folder
+        CleanupStack::PushL(folder);        
+        iChildren = folder->ChildrenWithTypeL( KUidMsvMessageEntry );
+        CleanupStack::PopAndDestroy( folder );
+        
+        // Remove current folder from the queue
+        iToBeSearchedFolders.Remove(0);
+        iState = EStateNextMessage;
+        HandleNextRequest();
+        }
+    else
+        {
+        // No more folders in the queue
+        iState = EStateIdle;
+        HandleNextRequest();      
+        }
+    }
+
+			
+// ---------------------------------------------------------------------------
+// CMessageHarvester::GetMessageId
+// ---------------------------------------------------------------------------
+//		    
+void CMessageHarvester::GetMessageIdL()
+    { 
+    if (iChildren && iChildren->Count() > 0)
+        {
+        // Take first item from list of message items, and give it for indexing
+        iMessagePlugin.MessageItemL((*iChildren)[0], ECPixAddAction, iCurrentFolder);
+        
+        // Delete the item from list
+        iChildren->Delete( 0 );   
+        if ( iChildren->Count() > 0 )
+            {
+            // Get the next message
+            iState = EStateNextMessage;
+            HandleNextRequest();      
+            }
+        else 
+            {
+            // No messages in this folder
+            iState = EStateNextFolder;
+            HandleNextRequest();      
+            }
+        }
+    else 
+        {
+        // Current folder dosen't contain any message items so change folder
+        iState = EStateNextFolder;
+        HandleNextRequest();      
+        }
+    }
+      
+// -----------------------------------------------------------------------------
+// CMessageHarvester::DoCancel
+// -----------------------------------------------------------------------------
+//   
+void CMessageHarvester::DoCancel()
+	{
+	}
+
+// -----------------------------------------------------------------------------
+// CMessageHarvester::RunL
+// -----------------------------------------------------------------------------
+//   
+void CMessageHarvester::RunL()	
+	{
+	
+	 // Simple Round-Robin scheduling.
+    Deque();
+    CActiveScheduler::Add( this );
+    
+	switch (iState)
+		{
+	       case EStateIdle:
+	            {
+	            // Delete current folder items
+	            delete iChildren; 
+	            iChildren = NULL;
+	            
+	            // Started idling, close the folders
+	            iToBeSearchedFolders.Reset();
+
+	            // Update harvester status
+	            iMessagePlugin.HarvestingCompleted(KErrNone);	            
+	            break; 
+	    	    }    
+		    case EStateNextMessage:
+		        {
+		        // Get the next message
+		        GetMessageIdL();	
+		        break;	        
+		        }
+	        case EStateNextFolder:
+	            {
+	            // Delete current folder items
+	            delete iChildren; 
+	            iChildren = NULL;
+	            
+	            // Start harvesting folders. 
+	            GetNextFolderL();	         
+				break;
+	            }
+		}
+	}
+	         				
+// -----------------------------------------------------------------------------
+// CMessageHarvester::RunError
+// -----------------------------------------------------------------------------
+//   
+TInt CMessageHarvester::RunError( TInt aError )	
+	{
+	iState = EStateIdle;
+    iMessagePlugin.HarvestingCompleted(aError);
+	return KErrNone;
+	}
+	
+// ---------------------------------------------------------------------------
+// SetNextRequest
+// ---------------------------------------------------------------------------
+//
+void CMessageHarvester::HandleNextRequest()
+    {
+    if (!IsActive())
+        {
+        SetActive();
+        TRequestStatus* status = &iStatus;
+        User::RequestComplete( status, KErrNone );
+        }
+    }
+
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/harvesterplugins/messaging/src/cmessagemonitor.cpp	Mon Apr 19 14:40:05 2010 +0300
@@ -0,0 +1,258 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  
+*
+*/
+
+
+// INCLUDE FILES
+#include "cmessagemonitor.h"
+#include "harvesterserverlogger.h"
+
+#include <smut.h>
+#include <mmsvattachmentmanager.h>	// MMsvAttachmentManager
+#include <msventry.h>	// CMsvEntry
+#include <msvuids.h>
+#include <mmsconst.h>
+#include <mtclreg.h>
+#include <smsclnt.h>
+#include <senduiconsts.h>
+
+
+// DEFINES
+#define INDEXING_QUEUE_MAX 100 // Maximum number of messages in the queue
+#define INDEXING_DELAY 5000000 // Nano seconds to delay the monitored messages 
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CMessageMonitor::NewL
+// -----------------------------------------------------------------------------
+//
+CMessageMonitor* CMessageMonitor::NewL(  CMessagePlugin& aMessagePlugin, CMsvSession& aSession )
+	{
+	CMessageMonitor* self = new ( ELeave ) CMessageMonitor( aMessagePlugin, aSession );
+	CleanupStack::PushL( self );
+	self->ConstructL();
+	CleanupStack::Pop( self );
+	return self;
+	}
+
+// -----------------------------------------------------------------------------
+// CMessageMonitor::CMessageMonitor
+// -----------------------------------------------------------------------------
+//
+CMessageMonitor::CMessageMonitor( CMessagePlugin& aMessagePlugin, CMsvSession& aSession )
+	: CActive(CActive::EPriorityStandard),
+	iState(EStateNone),
+	iMsvSession(aSession),
+	iMessagePlugin(aMessagePlugin)
+	{
+	CPIXLOGSTRING("ENTER CMessageMonitor::CMessageMonitor");
+
+	CActiveScheduler::Add(this);
+
+	CPIXLOGSTRING("END CMessageMonitor::CMessageMonitor");
+	}
+
+// -----------------------------------------------------------------------------
+// CMessageMonitor::ConstructL
+// -----------------------------------------------------------------------------
+//
+void CMessageMonitor::ConstructL() 
+	{
+	CPIXLOGSTRING("ENTER CMessageMonitor::ConstructL");
+
+	// Create timer 
+	User::LeaveIfError(iTimer.CreateLocal());
+	
+	CPIXLOGSTRING("END CMessageMonitor::ConstructL");
+	}
+	
+
+
+// -----------------------------------------------------------------------------
+// CMessageMonitor::~CMessageMonitor
+// -----------------------------------------------------------------------------
+//
+CMessageMonitor::~CMessageMonitor() 
+	{
+	CPIXLOGSTRING("ENTER ~CMessageMonitor");
+	Cancel();
+	iMessages.Close();
+	iTimer.Close();
+	CPIXLOGSTRING("END ~CMessageMonitor");
+	}
+
+// -----------------------------------------------------------------------------
+// CMessageMonitor::HandleMsgMovedL
+// -----------------------------------------------------------------------------
+//
+void CMessageMonitor::HandleMsgMovedL( const TMsvId aNewFolderId, 
+									   const TMsvId /* aOldFolderId */, 
+								   	   const CMsvEntrySelection& aSelection )
+	{
+	CPIXLOGSTRING("ENTER CMessageMonitor::HandleMsgMovedL");
+	
+	const TInt count( aSelection.Count() );
+	// cycle through every message in the CMsvEntrySelection
+	for ( TInt i=0; i < count; ++i )
+		{
+		TMsvId msgId = aSelection[i];
+		CPIXLOGSTRING2("msgId: %d", msgId );
+        MessageItemL( msgId, ECPixUpdateAction, aNewFolderId );
+		}
+	CPIXLOGSTRING("END CMessageMonitor::HandleMsgMovedL");
+	}
+
+
+// -----------------------------------------------------------------------------
+// CMessageMonitor::0
+// -----------------------------------------------------------------------------
+//
+void CMessageMonitor::HandleMsgCreatedChangedL( const CMsvEntrySelection& aSelection,
+                                          	    const TMsvId aFolderId,
+                                          	    const MMsvSessionObserver::TMsvSessionEvent /*aEvent*/ )
+	{
+	CPIXLOGSTRING("ENTER CMessageMonitor::HandleMsgCreatedChangedL");	
+	const TInt count( aSelection.Count() );
+	//MMsvSessionObserver::TMsvSessionEvent theEvent = aEvent;
+    // cycle through every message in the CMsvEntrySelection
+	for ( TInt i=0; i < count; ++i )
+		{
+		// extract the message server entry from the parameters
+		TMsvId msgId = aSelection[i];
+		CPIXLOGSTRING2("msgId: %d", msgId );							
+        TMsvId service = 0;
+        TMsvEntry entry;
+        const TInt err = iMsvSession.GetEntry( msgId, service, entry );
+        if ( ( !err ) && 
+            ( KUidMsvMessageEntry == entry.iType ) && 
+            ( entry.Visible() && entry.Complete() && !entry.InPreparation() ) &&
+            ( iMessagePlugin.CalculateMessageType( entry ) != EMsgTypeInvalid ) )
+            {
+            CPIXLOGSTRING("CMessageMonitor::HandleMsgCreatedChangedL Called # MonitorEvent #");
+            MessageItemL( msgId, ECPixUpdateAction, aFolderId );
+            }   
+        CPIXLOGSTRING2(" Folder TYPE %x", aFolderId );	     
+        CPIXLOGSTRING2(" Entry TYPE %x", entry.iType );	           
+        CPIXLOGSTRING2(" Entry VISIBLE %d", entry.Visible() );	          
+        CPIXLOGSTRING2(" Entry COMPLETE %d", entry.Complete() );
+        CPIXLOGSTRING2(" Entry INPREPARATION %d", entry.InPreparation() );
+        CPIXLOGSTRING2(" Message TYPE %d", iMessagePlugin.CalculateMessageType( entry ));
+        }
+	CPIXLOGSTRING("END CMessageMonitor::HandleMsgCreatedChangedL");	        
+	}
+	
+// -----------------------------------------------------------------------------
+// CMessageMonitor::HandleMsgDeletedL
+// -----------------------------------------------------------------------------
+//
+void CMessageMonitor::HandleMsgDeletedL( const CMsvEntrySelection& aSelection )
+	{
+	CPIXLOGSTRING("ENTER CMessageMonitor::HandleMsgDeletedL");
+	
+	const TInt count( aSelection.Count() );
+	// cycle through every message in the CMsvEntrySelection
+	for( TInt i = 0; i < count; ++i )
+		{
+		TMsvId msgId = aSelection[i];	
+		CPIXLOGSTRING2("msgId: %d", msgId );								
+		MessageItemL( msgId, ECPixRemoveAction, NULL);
+		}
+	CPIXLOGSTRING("END CMessageMonitor::HandleMsgDeletedL");	
+	}	
+
+
+void CMessageMonitor::OverwriteOrAddToQuereL(TMsvId aMsvId, TCPixActionType aAction, TMsvId aFolderId)
+{
+	// Overwrite or add the index to the queue
+	TMessageRecord message;
+	message.iMsvId = aMsvId;
+	message.iAction = aAction;
+	message.iFolderId = aFolderId;
+	for (TInt i=0; i<iMessages.Count(); i++)
+	{
+		if (iMessages[i].iMsvId==aMsvId)
+		{
+			// Older version found
+			iMessages[i] = message;
+			return;
+		}
+	}
+	
+	// older not found, append
+	iMessages.AppendL(message);
+}
+
+void CMessageMonitor::MessageItemL(TMsvId aMsvId, TCPixActionType aAction, TMsvId aFolderId)
+	{	
+		// Overwrite or add the index to the queue
+		OverwriteOrAddToQuereL(aMsvId, aAction, aFolderId);
+			
+		// Check the size against maximum queue size
+		if (iMessages.Count() > INDEXING_QUEUE_MAX)
+		{
+			// Maximum is exceeded, force the write immediately
+			if (iState == EStateWaiting)
+			{
+				iTimer.Cancel(); // RunL will be called with iStatus of KErrCancelled
+			}
+			else if (iState == EStateNone)
+			{
+		        SetActive();
+		        TRequestStatus* status = &iStatus;
+		        User::RequestComplete(status, KErrNone); // RunL will be called with iStatus of KErrNone
+			}
+		}
+		else
+		{
+			// Maximum is not exceeded, keep waiting
+			if (iState == EStateNone)
+			{
+				iState = EStateWaiting;
+				iTimer.After(iStatus, INDEXING_DELAY); // Wait 5 seconds before putting this to index
+				SetActive();
+			}
+		}
+	}
+
+void CMessageMonitor::RunL()
+	{
+		// Index the current queue	
+		while (iMessages.Count()>0)
+		{
+			TMessageRecord message = iMessages[0];
+			iMessages.Remove(0);
+			iMessagePlugin.MessageItemL(message.iMsvId, message.iAction, message.iFolderId);
+		}
+		
+		// Everything is indexed no need to be waiting anymore
+		iState = EStateNone;
+	}
+
+void CMessageMonitor::DoCancel()
+	{
+		iTimer.Cancel();
+		iState = EStateNone;
+	}
+
+TInt CMessageMonitor::RunError(TInt /* aError */)
+	{
+		// TODO handle indexing errors here
+		return KErrNone; // Don't panic
+	}
+
+// End Of File
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/harvesterplugins/messaging/src/cmessageplugin.cpp	Mon Apr 19 14:40:05 2010 +0300
@@ -0,0 +1,612 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  
+*
+*/
+
+
+#include <e32base.h> 
+#include <msvids.h>
+#include <msvuids.h>
+#include <mmsconst.h>
+#include <mmsclient.h>
+#include <smsclnt.h>
+#include <txtrich.h>
+#include <smuthdr.h>
+#include <smut.h>
+#include <miutset.h>
+#include <senduiconsts.h>
+#include <mtclreg.h>
+#include <gsmuelem.h>
+#include <msventry.h>
+#include <ccpixindexer.h>
+
+#include "cmessageplugin.h"
+#include "cmessagemonitor.h"
+#include "cmessageharvester.h"
+#include "cmessagedatahandler.h"
+#include "harvesterserverlogger.h"
+
+// maximum length that the fully qualified msg Plugin base app class descriptor can be
+// e.g. "@c:root msg"
+const TInt KMsgPluginBaseAppClassMaxLen = 64;
+
+
+// local declarations and functions
+namespace {
+
+_LIT(KCPixSearchServerPrivateDirectory, "\\Private\\2001f6f7\\");
+_LIT(KPathIndexDbPath, CPIX_INDEVICE_INDEXDB);
+
+_LIT(KPathTrailer, "\\root\\msg");
+_LIT(KMsgBaseAppClassGeneric, ":root msg");
+_LIT(KAtSign, "@");
+_LIT(KColon, ":");
+
+/**
+* MapFileToDrive - gets the TDriveNumber associated with the aBaseAppClass.
+* @aBaseAppClass e.g. "@c:root file"
+* @aDrive returns the TDriveNumber for the aBaseAppClass
+* returns KErrNone on success or a standard error code
+*/
+TInt MapBaseAppClassToDrive(const TDesC& aBaseAppClass, TDriveNumber& aDrive)
+    {
+    if (KErrNone != aBaseAppClass.Left(1).Compare(KAtSign))
+        {
+        return KErrGeneral;
+        }
+
+    TPtrC drvChar = aBaseAppClass.Left(2).Right(1);
+    TChar d(drvChar[0]);
+    TInt drive;
+    const TInt ret = RFs::CharToDrive(d, drive);
+    if (!ret)
+        {
+        aDrive = TDriveNumber(drive);
+        }
+
+    return ret;
+    }
+
+}// anonymous namespace
+
+
+// ---------------------------------------------------------------------------
+// CMessagePlugin::NewL
+// ---------------------------------------------------------------------------
+//  
+CMessagePlugin* CMessagePlugin::NewL()
+{
+	CMessagePlugin* instance = CMessagePlugin::NewLC();
+    CleanupStack::Pop(instance);
+    return instance;
+}
+
+// ---------------------------------------------------------------------------
+// CMessagePlugin::NewLC
+// ---------------------------------------------------------------------------
+//  
+CMessagePlugin* CMessagePlugin::NewLC()
+{
+	CMessagePlugin* instance = new (ELeave)CMessagePlugin();
+    CleanupStack::PushL(instance);
+    instance->ConstructL();
+    return instance;
+}
+
+// ---------------------------------------------------------------------------
+// CMessagePlugin::CMessagePlugin
+// ---------------------------------------------------------------------------
+//  
+CMessagePlugin::CMessagePlugin()
+{
+	iMessageDataHandler = NULL;
+	iMessageHarvester = NULL;
+	iMessageMonitor = NULL;
+	iMsvSession = NULL;
+}
+
+// ---------------------------------------------------------------------------
+// CMessagePlugin::~CMessagePlugin
+// ---------------------------------------------------------------------------
+//  
+CMessagePlugin::~CMessagePlugin()
+{
+    // remove notification paths before destroying iMonitor
+    for (TInt i=EDriveA; i<=EDriveZ; i++)
+        UnMount(TDriveNumber(i), EFalse);
+	delete iMessageDataHandler;
+	delete iMessageHarvester;	
+	delete iMessageMonitor;	
+	delete iMsvSession;
+	iFs.Close();
+}
+
+// ---------------------------------------------------------------------------
+// CMessagePlugin::ConstructL
+// ---------------------------------------------------------------------------
+//  
+void CMessagePlugin::ConstructL()
+{
+    TInt err = iFs.Connect();
+    CPIXLOGSTRING2("CMessagePlugin::ConstructL, iFs.Connect: %i", err);
+    User::LeaveIfError(err);
+    iCurrentDrive = EDriveC; //Default drive is C drive
+    iMsvSession = CMsvSession::OpenSyncL(*this);
+    iMessageMonitor = CMessageMonitor::NewL( *this, *iMsvSession );    
+    iMessageHarvester = CMessageHarvester::NewL( *this, *iMsvSession );    
+    iMessageDataHandler = CMessageDataHandler::NewL( *this, *iMsvSession );    
+    for (TInt i=EDriveA; i<=EDriveZ; i++)
+        {
+        iIndexer[i] = NULL; //Initialize to NULL
+        }
+}
+
+// ---------------------------------------------------------------------------
+// CMessagePlugin::StartPluginL
+// ---------------------------------------------------------------------------
+//  
+void CMessagePlugin::StartPluginL()
+	{
+	//Get the current Drive for storage
+	iCurrentDrive = iMsvSession->CurrentDriveL();
+	CPIXLOGSTRING2("currentDrive from messaging app : %d", iCurrentDrive );
+	MountL(TDriveNumber(iCurrentDrive)); //Mount current drive
+	// Define this base application class, use default location
+	}
+
+// ---------------------------------------------------------------------------
+// CMessagePlugin::StartHarvestingL
+// ---------------------------------------------------------------------------
+//  
+void CMessagePlugin::StartHarvestingL(const TDesC& aQualifiedBaseAppClass)
+	{
+	CPIXLOGSTRING("START CMessagePlugin::StartHarvestingL");
+	// Map base app class to a drive number
+	TDriveNumber drive ( EDriveA );//Initialize to silence compiler warnings.
+	if (KErrNone != MapBaseAppClassToDrive(aQualifiedBaseAppClass, drive))
+	   User::Leave(KErrGeneral);
+
+    // Leave if no indexer for this drive
+	if (!iIndexer[drive])
+	   User::Leave(KErrGeneral);
+	        
+    // Reset the database
+	iIndexer[drive]->ResetL();
+#ifdef __PERFORMANCE_DATA
+    iStartTime.UniversalTime();
+#endif
+    iMessageHarvester->StartHarvestingL();
+	}
+
+// ---------------------------------------------------------------------------
+// CMessagePlugin::MountL
+// ---------------------------------------------------------------------------
+//
+void CMessagePlugin::MountL(TDriveNumber aMedia,TBool aForceReharvesting)
+    {
+    CPIXLOGSTRING("START CMessagePlugin::MountL");
+    // Check if already exists
+    if (iIndexer[aMedia])
+        return;
+    
+    // Form the baseappclass for this media
+    TBuf<KMsgPluginBaseAppClassMaxLen> baseAppClass;
+    FormBaseAppClass(aMedia, baseAppClass);
+
+    // Define this volume
+    HBufC* path = DatabasePathLC(aMedia);
+    User::LeaveIfError(iSearchSession.DefineVolume(baseAppClass, *path));
+    CleanupStack::PopAndDestroy(path);
+    
+    // construct and open the database
+    TRAPD(err,iIndexer[aMedia] = CCPixIndexer::NewL(iSearchSession));
+    CPIXLOGSTRING2("CCPixIndexer::NewL returned : %d", err );
+    TRAP(err,iIndexer[aMedia]->OpenDatabaseL(baseAppClass));
+
+    // Add to harvesting queue
+    iObserver->AddHarvestingQueue(this, baseAppClass,aForceReharvesting);  
+    CPIXLOGSTRING("END CMessagePlugin::MountL");
+    }
+
+// ---------------------------------------------------------------------------
+// CMessagePlugin::UnMount
+// ---------------------------------------------------------------------------
+//
+void CMessagePlugin::UnMount(TDriveNumber aMedia, TBool aUndefineAsWell)
+    {
+    CPIXLOGSTRING("START CMessagePlugin::UnMount");
+    // Check if already exists
+    if (!iIndexer[aMedia])
+        return;
+    
+    // Form the baseappclass for this media
+    TBuf<KMsgPluginBaseAppClassMaxLen> baseAppClass;
+    FormBaseAppClass(aMedia, baseAppClass);             
+        
+    // Remove from harvesting queue
+    iObserver->RemoveHarvestingQueue(this, baseAppClass);   
+    
+    // Delete the index object
+    if (iIndexer[aMedia])
+        {
+        delete iIndexer[aMedia];
+        iIndexer[aMedia] = NULL;
+        }
+    
+    // if the aActionType is EFFMmcDismount, then the
+    // parameter aFilename is the baseAppClass of the Index database
+    // to be dropped.
+    if (aUndefineAsWell)
+        iSearchSession.UnDefineVolume(baseAppClass);
+    }
+
+
+// ---------------------------------------------------------------------------
+// CMessagePlugin::FormBaseAppClass
+// ---------------------------------------------------------------------------
+//  
+TInt CMessagePlugin::FormBaseAppClass(TDriveNumber aMedia, TDes& aBaseAppClass)
+    {
+    TChar chr;
+    const TInt ret = RFs::DriveToChar(aMedia, chr);
+    if (KErrNone == ret)
+        {
+        aBaseAppClass.Copy(KAtSign);
+        aBaseAppClass.Append(chr);
+        aBaseAppClass.LowerCase();
+        aBaseAppClass.Append(KMsgBaseAppClassGeneric);
+        }
+
+    return ret;
+    }
+
+// ---------------------------------------------------------------------------
+// CMessagePlugin::DatabasePathLC
+// ---------------------------------------------------------------------------
+//
+HBufC* CMessagePlugin::DatabasePathLC(TDriveNumber aMedia)
+    {
+    CPIXLOGSTRING("START CMessagePlugin::DatabasePathLC");
+    // Allocate extra space for root path e.g. "C:\\Private\\2001f6f7\\"
+    const TInt KRootPathMaxLength = 30;
+    HBufC* indexDbPath = HBufC::NewLC(KRootPathMaxLength + KPathIndexDbPath().Length() + KPathTrailer().Length());
+    TPtr indexDbPathPtr = indexDbPath->Des();
+
+#if 1 // Data caging implementation
+    iFs.CreatePrivatePath(aMedia);
+
+    TChar chr;
+    RFs::DriveToChar(aMedia, chr);
+    indexDbPathPtr.Append(chr);
+    indexDbPathPtr.Append(KColon);
+
+    TFileName pathWithoutDrive;
+    iFs.PrivatePath(pathWithoutDrive);
+    indexDbPathPtr.Append(KCPixSearchServerPrivateDirectory);
+#else // here is the way to calculate the path if data caging is not being used.
+    TFileName rootPath;
+    PathInfo::GetRootPath(rootPath, aMedia);
+    indexDbPathPtr.Append(rootPath);
+#endif 
+
+    indexDbPathPtr.Append(KPathIndexDbPath);
+    indexDbPathPtr.Append(KPathTrailer);
+
+    return indexDbPath;
+    }
+
+// ---------------------------------------------------------------------------
+// CMessagePlugin::GetIndexer
+// ---------------------------------------------------------------------------
+//
+CCPixIndexer* CMessagePlugin::GetIndexer()
+    {
+    return iIndexer[iCurrentDrive];
+    }
+
+// ---------------------------------------------------------------------------
+// CMessagePlugin::IsMediaRemovableL
+// ---------------------------------------------------------------------------
+// 
+TBool CMessagePlugin::IsMediaRemovableL(TDriveNumber& aDrive)
+    {
+    TDriveInfo driveInfo; 
+    User::LeaveIfError(iFs.Drive(driveInfo,aDrive));
+    TBool mediaRemovable(EFalse);
+    driveInfo.iDriveAtt & KDriveAttRemovable ? mediaRemovable = ETrue : mediaRemovable = EFalse;
+    return mediaRemovable;
+    }
+// ---------------------------------------------------------------------------
+// CMessagePlugin::HandleSessionEventL
+// ---------------------------------------------------------------------------
+//  
+void CMessagePlugin::HandleSessionEventL( TMsvSessionEvent aEvent, 
+										  		 TAny* aArg1, 
+										  		 TAny* aArg2, 
+										  		 TAny* aArg3 )
+	{		
+	CPIXLOGSTRING("ENTER CMessagePlugin::HandleSessionEventL");
+	CPIXLOGSTRING2("TMsvSessionEvent aEvent: %d", aEvent );			
+		
+	switch( aEvent )
+		{
+		case EMsvEntriesCreated:
+		case EMsvEntriesChanged:
+			{
+			// Handle changed / created event
+            CMsvEntrySelection* selection = reinterpret_cast<CMsvEntrySelection*>(aArg1);
+            TMsvId folderId = *( reinterpret_cast<TMsvId*>(aArg2));
+#ifdef __PERFORMANCE_DATA
+            iStartTime.UniversalTime();
+		    iMessageMonitor->HandleMsgCreatedChangedL(*selection, folderId, aEvent);
+		    UpdatePerformaceDataL(EMsvEntriesChanged);
+#else
+		    iMessageMonitor->HandleMsgCreatedChangedL(*selection, folderId, aEvent);
+#endif		    
+			break;
+			}		
+		case EMsvEntriesDeleted:
+			{
+			// Handle deletion event
+		    CMsvEntrySelection* selection = reinterpret_cast<CMsvEntrySelection*> ( aArg1 );
+#ifdef __PERFORMANCE_DATA
+            iStartTime.UniversalTime();
+		    iMessageMonitor->HandleMsgDeletedL( *selection );
+		    UpdatePerformaceDataL(EMsvEntriesDeleted);
+#else
+		    iMessageMonitor->HandleMsgDeletedL( *selection );
+#endif
+			break;
+			}
+		case EMsvEntriesMoved:
+			{
+			// track move operations
+			// or sent folder
+			// ... extract the useful parameters
+            if( aArg1 && aArg2 && aArg3 )
+                {
+                CMsvEntrySelection* selection = reinterpret_cast<CMsvEntrySelection*> ( aArg1 );
+                // aArg2 is the TMsvId of the new parent. aArg3 is the TMsvId of 
+                // the old parent entry.
+                TMsvId newFolderId = *(reinterpret_cast<TMsvId*>(aArg2));
+                TMsvId oldFolderId = *(reinterpret_cast<TMsvId*>(aArg3));
+#ifdef __PERFORMANCE_DATA
+                iStartTime.UniversalTime();
+                iMessageMonitor->HandleMsgMovedL(newFolderId, oldFolderId, *selection);
+                UpdatePerformaceDataL(EMsvEntriesMoved);
+#else
+                iMessageMonitor->HandleMsgMovedL(newFolderId, oldFolderId, *selection);
+#endif
+                }
+			break;
+			}			
+		case EMsvMediaChanged:
+		    {
+		    //Unmount old media drive
+		    CPIXLOGSTRING("ENTER CMessagePlugin::HandleSessionEventL EMsvMediaChanged");
+		    TDriveNumber drive = *(reinterpret_cast<TDriveNumber*>(aArg1));
+		    UnMount(drive);
+		    drive = *(reinterpret_cast<TDriveNumber*>(aArg2));
+		    //Check if Media is removable then force reharvesting else keep indexes same
+		    MountL(drive,IsMediaRemovableL(drive)); //Mount new media drive for harvesting
+		    iCurrentDrive = drive;//Index of current drive
+		    }
+		    break;
+		case EMsvMediaUnavailable:
+		    {
+		    //No need to handle as when drive will be removed EMsvMediaChanged event
+		    //will be received for default media drive can be handled there
+		    //Unmount old media drive
+		    CPIXLOGSTRING("ENTER CMessagePlugin::HandleSessionEventL EMsvMediaUnavailable");
+		    TDriveNumber drive = *(reinterpret_cast<TDriveNumber*>(aArg1));
+		    UnMount(drive);
+		    }
+		    break;
+		case EMsvMediaAvailable:
+			{
+			CPIXLOGSTRING("ENTER CMessagePlugin::HandleSessionEventL EMsvMediaAvailable");
+			//Removed media drive available again mount media drive and unmount default
+			UnMount(TDriveNumber(iCurrentDrive)); //Unmount current drive
+			TDriveNumber drive = *(reinterpret_cast<TDriveNumber*>(aArg1));
+			MountL(drive,IsMediaRemovableL(drive)); //Mount avilable media drive for harvesting
+			}
+			break;
+		case EMsvServerFailedToStart:			
+		case EMsvCloseSession:
+		case EMsvServerTerminated:
+			{
+			User::Panic(_L("CMessagePlugin PANIC"), KErrServerTerminated);
+			break;				
+			}			
+		case EMsvMtmGroupInstalled:
+		case EMsvMtmGroupDeInstalled:
+		case EMsvGeneralError: // not used after v5
+		case EMsvServerReady:
+		case EMsvCorruptedIndexRebuilt:
+		case EMsvMediaIncorrect:
+		case EMsvCorruptedIndexRebuilding:
+		default:
+			{
+			break;
+			}							
+		}	
+	CPIXLOGSTRING("END CMessagePlugin::HandleSessionEventL");	
+		
+	}	
+
+// ---------------------------------------------------------------------------
+// CMessageDataHandler::CalculateMessageType
+// ---------------------------------------------------------------------------
+//	    
+TMsgType CMessagePlugin::CalculateMessageType (const TMsvEntry& aEntry )
+{
+    CPIXLOGSTRING("ENTER CMessagePlugin::CalculateMessageType");
+	TMsgType ret = EMsgTypeInvalid;
+	CPIXLOGSTRING2("CMessagePlugin::CalculateMessageType uid: %x", aEntry.iMtm.iUid );
+    if( aEntry.iMtm.iUid  == KUidMsgTypeMultimedia.iUid ) 
+        {
+        CPIXLOGSTRING("CMessagePlugin:CalculateMessageType  ###  Mms Message ###");
+        ret = EMsgTypeMms;
+        }
+    else if( aEntry.iMtm.iUid  == KUidMsgTypeSMTP.iUid )
+		{
+		CPIXLOGSTRING("CMessagePlugin:CalculateMessageType  ### ESmtpEmail ###");
+        ret = EMsgTypeEmailSmtp;
+		}
+	else if( aEntry.iMtm.iUid  == KUidMsgTypePOP3.iUid )
+		{
+		CPIXLOGSTRING("CMessagePlugin:CalculateMessageType  ### EPop3Email ###");
+        ret = EMsgTypeEmailPop3;
+		}
+	else if( aEntry.iMtm.iUid  == KUidMsgTypeIMAP4.iUid )
+		{
+		CPIXLOGSTRING("CMessagePlugin:CalculateMessageType  ### EImap4Email ###");
+        ret = EMsgTypeEmailImap4;
+		}
+	// Add J.J	
+#ifndef __SERIES60_30__ // Not supported before S60 3d FP1
+   	else if ( aEntry.iMtm.iUid == KSenduiMtmUniMessageUid.iUid )
+	    {
+	    CPIXLOGSTRING("CMessagePlugin:CalculateMessageType  ### EDraftMessage ###");
+        ret = EMsgTypeDraft;
+	    }
+#endif
+    // else if we have a normal text based SMS it is valid    
+ 	else if ( aEntry.iMtm.iUid == KUidMsgTypeSMS.iUid )
+ 		{
+ 		CPIXLOGSTRING("CMessagePlugin:CalculateMessageType  ###  SMS Message ###");
+        ret = EMsgTypeSms;
+ 		}
+   	else if ( aEntry.iMtm.iUid == KSenduiMtmSmsUid.iUid )
+		{
+		CPIXLOGSTRING("CMessagePlugin:CalculateMessageType  ### Sms Message ###");
+        ret = EMsgTypeSms;
+		}
+    CPIXLOGSTRING("END CMessagePlugin::CalculateMessageType");
+	return ret;
+}
+
+// ---------------------------------------------------------------------------
+// CMessagePlugin::MessageItemL
+// ---------------------------------------------------------------------------
+//  
+void CMessagePlugin::MessageItemL( TMsvId aMsgId, TCPixActionType aActionType, TMsvId aFolderId  )	
+    {
+    //New item found gather data from that.
+     iMessageDataHandler->GatherDataL( aMsgId, aActionType, aFolderId ); 
+    }
+
+// ---------------------------------------------------------------------------
+// CMessagePlugin::HarvestingCompleted
+// ---------------------------------------------------------------------------
+//  
+void CMessagePlugin::HarvestingCompleted(TInt aError)
+{
+	// Notifies the indexing manager of completed harvesting, called by CMessageHarvester
+    Flush( *GetIndexer() );
+    TBuf<KMsgPluginBaseAppClassMaxLen> baseAppClass;
+    FormBaseAppClass(TDriveNumber(iCurrentDrive), baseAppClass);
+#ifdef __PERFORMANCE_DATA
+    TRAP_IGNORE( UpdatePerformaceDataL() );
+#endif
+    iObserver->HarvestingCompleted(this, baseAppClass, aError);
+}
+
+// ---------------------------------------------------------------------------
+// CMessagePlugin::UpdatePerformaceDataL
+// ---------------------------------------------------------------------------
+//
+#ifdef __PERFORMANCE_DATA
+void CMessagePlugin::UpdatePerformaceDataL()
+    {
+    TTime now;
+   
+    
+    iCompleteTime.UniversalTime();
+    TTimeIntervalMicroSeconds timeDiff = iCompleteTime.MicroSecondsFrom(iStartTime);
+    
+    RFs fileSession;
+    RFile perfFile;
+    User::LeaveIfError( fileSession.Connect () );
+    
+    
+    /* Open file if it exists, otherwise create it and write content in it */
+    
+        if(perfFile.Open(fileSession, _L("c:\\data\\MessagePerf.txt"), EFileWrite))
+                   User::LeaveIfError(perfFile.Create (fileSession, _L("c:\\data\\MessagePerf.txt"), EFileWrite));
+    
+    HBufC8 *heap = HBufC8::NewL(100);
+    TPtr8 ptr = heap->Des();
+    now.HomeTime();
+    TBuf<50> timeString;             
+                
+    _LIT(KOwnTimeFormat,"%:0%H%:1%T%:2%S");
+    now.FormatL(timeString,KOwnTimeFormat);
+    ptr.AppendNum(now.DateTime().Day());
+    ptr.Append(_L("/"));
+    ptr.AppendNum(now.DateTime().Month());
+    ptr.Append(_L("/"));
+    ptr.AppendNum(now.DateTime().Year());
+    ptr.Append(_L(":"));
+    ptr.Append(timeString);
+    ptr.Append( _L("Time taken for Harvesting Message is : "));
+    ptr.AppendNum(timeDiff.Int64()/1000) ;
+    ptr.Append(_L(" MilliSeonds \n"));
+    TInt myInt = 0;
+    perfFile.Seek(ESeekEnd,myInt);
+    perfFile.Write (ptr);
+    perfFile.Close ();
+    fileSession.Close ();
+    delete heap;
+    }
+
+// ---------------------------------------------------------------------------
+// CMessagePlugin::UpdatePerformaceDataL
+// ---------------------------------------------------------------------------
+//
+void CMessagePlugin::UpdatePerformaceDataL(TMsvSessionEvent action) {
+    
+        iCompleteTime.UniversalTime();
+        TTimeIntervalMicroSeconds timeDiff = iCompleteTime.MicroSecondsFrom(iStartTime);
+        
+        RFs fileSession;
+        RFile perfFile;
+        User::LeaveIfError( fileSession.Connect () );
+        
+        
+        /* Open file if it exists, otherwise create it and write content in it */
+        
+            if(perfFile.Open(fileSession, _L("c:\\data\\MessagePerf.txt"), EFileWrite))
+                       User::LeaveIfError(perfFile.Create (fileSession, _L("c:\\data\\MessagePerf.txt"), EFileWrite));
+        
+        HBufC8 *heap = HBufC8::NewL(100);
+        TPtr8 ptr = heap->Des();
+
+        switch (action) {
+            case EMsvEntriesDeleted: ptr.Append( _L("del "));break;
+            case EMsvEntriesChanged: ptr.Append( _L("upd "));break;
+            case EMsvEntriesMoved: ptr.Append( _L("mov "));break;
+        }
+        ptr.AppendNum(timeDiff.Int64()/1000) ;
+        ptr.Append(_L("\n"));
+        TInt myInt = 0;
+        perfFile.Seek(ESeekEnd,myInt);
+        perfFile.Write (ptr);
+        perfFile.Close ();
+        fileSession.Close ();
+        delete heap;
+    }
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/harvesterplugins/messaging/src/tproxy.cpp	Mon Apr 19 14:40:05 2010 +0300
@@ -0,0 +1,38 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Message plugin
+*
+*/
+
+
+
+#include <e32std.h>
+#include <implementationproxy.h>
+#include <cindexingplugin.h>
+#include "cmessageplugin.h"
+
+
+// Map the interface UIDs to implementation factory functions
+const TImplementationProxy KImplementationTable[] = 
+	{
+	{{0x2001F701},( TProxyNewLPtr) CMessagePlugin::NewL}		
+	};
+
+// Exported proxy for instantiation method resolution
+EXPORT_C const TImplementationProxy* ImplementationGroupProxy( TInt& aTableCount )
+	{
+	aTableCount = sizeof( KImplementationTable ) / sizeof( TImplementationProxy );
+	return KImplementationTable;
+	}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/harvesterplugins/notes/data/2001a9d8.rss	Mon Apr 19 14:40:05 2010 +0300
@@ -0,0 +1,47 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: 
+*
+*/
+#include <registryinfo.rh>
+
+// Declares info for one test implementation
+RESOURCE REGISTRY_INFO theInfo
+        {
+        // UID for the DLL       
+		// TODO: Rename dll_uid according to your plugin UID
+        dll_uid = 0x2001A9D8;
+        // Declare array of interface info
+        interfaces = 
+                {
+                INTERFACE_INFO
+                        {
+                        // UID of interface that is implemented
+                        interface_uid = 0x2001F700; // CPixSearch Plugin Interface UID
+                        implementations = 
+                                {
+                                // Info for CNotesPlugin
+                                IMPLEMENTATION_INFO
+                                        {
+                                        implementation_uid = 0x2001A9D8;
+                                        version_no = 1;
+                                        display_name = "Notes harvester plugin";
+                                        default_data = "Notes";
+                                        opaque_data = "";
+                                        }
+                                };
+                        }
+                };
+        }
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/harvesterplugins/notes/group/bld.inf	Mon Apr 19 14:40:05 2010 +0300
@@ -0,0 +1,21 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: 
+*
+*/
+
+
+PRJ_MMPFILES
+notesplugin.mmp
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/harvesterplugins/notes/group/notesplugin.mmp	Mon Apr 19 14:40:05 2010 +0300
@@ -0,0 +1,57 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: 
+*
+*/
+
+
+TARGET        cpixnotesplugin.dll
+TARGETTYPE    PLUGIN 
+
+CAPABILITY   CAP_GENERAL_DLL -AllFiles -DRM
+
+// ECom Dll recognition UID followed by the unique UID for this dll
+UID           0x10009D8D 0x2001A9D8 
+
+#include "../../../harvesterplugins/inc/s60performance.h"
+
+SOURCEPATH    ../src
+SOURCE        notesplugin.cpp
+SOURCE        tproxy.cpp
+
+USERINCLUDE   ../inc
+
+APP_LAYER_SYSTEMINCLUDE
+SYSTEMINCLUDE /epoc32/include/ecom
+
+SOURCEPATH    ../data
+start RESOURCE 2001a9d8.rss
+target  cpixnotesplugin.rsc
+end
+
+LIBRARY       euser.lib
+LIBRARY       ecom.lib
+LIBRARY       efsrv.lib
+LIBRARY       calinterimapi.lib
+LIBRARY       cpixharvesterplugininterface.lib
+LIBRARY       cpixsearchclient.lib
+LIBRARY       centralrepository.lib
+
+
+// For logging
+LIBRARY 	  flogger.lib 
+
+EXPORTUNFROZEN
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/harvesterplugins/notes/inc/notesplugin.h	Mon Apr 19 14:40:05 2010 +0300
@@ -0,0 +1,137 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: 
+ *
+*/
+
+
+#ifndef CNOTESPLUGIN_H
+#define CNOTESPLUGIN_H
+
+#include <e32base.h>
+#include <cindexingplugin.h>
+#include <calchangecallback.h>
+#include <calcommon.h> // TCalLocalUid
+
+#include <common.h>
+#include "delayedcallback.h"
+
+// FORWARD DECLARATIONS
+class CCalSession;
+class CCalEntryView;
+class CCPixIndexer;
+class CCalInstanceView;
+class CCalInstance;
+
+#define KNotesDllUid 0x2001A9D8
+
+class CNotesPlugin : public CIndexingPlugin, public MDelayedCallbackObserver, public MCalChangeCallBack2
+{
+public: // Constructors and destructor
+    /*
+     * NewL
+     * @return instance of Notes plugin
+     */
+	static CNotesPlugin* NewL();
+	/*
+     * NewLC
+     * @return instance of Notes plugin
+     */
+	static CNotesPlugin* NewLC();
+	/*
+     * Destructor
+     */
+	virtual ~CNotesPlugin();
+
+public: // From CIndexingPlugin
+	void StartPluginL();
+	void StartHarvestingL(const TDesC& aQualifiedBaseAppClass);
+	
+public:	// From MCalChangeCallBack2
+	
+	void CalChangeNotification( RArray< TCalChangeEntry >& aChangeItems );	
+	
+public: // From MDelayedCallbackObserver
+
+    void DelayedCallbackL(TInt aCode);
+    void DelayedError(TInt aError);
+    
+private: 
+    /*
+     * @description Prepares the CPix action to be done.
+     * @param TCalChangeEntry changedEntry details of the modified calendar entry
+     * Leaves in case of errors.
+     */
+	void HandleNoteChangedEntryL(const TCalChangeEntry& changedEntry);
+	
+	/*
+     * @description Prepares the search document and update the CPix engine 
+     * according to the passed aActionType.
+     * @param TCalLocalUid aLocalUid uid of the cal entry
+     * @param TCPixActionType aActionType Add/update/remove option
+     * Leaves in case of errors.
+     */
+	void CreateNoteEntryL( const TCalLocalUid& aLocalUid, TCPixActionType aActionType );
+	/*
+     * @description Reads the default start and end times from the config file.
+     * @param TTime& aStartTime   Start time for creating calendar views
+     * @param TTime& aEndTime  End time for creating calendar views   
+     * Leaves in case of errors.
+     */
+	void InitTimeValuesL( TTime& aStartTime, TTime& aEndTime );
+
+private: // Constructors
+	
+	/**
+	 * Default C++ constructor.
+	 */
+	CNotesPlugin();
+	
+	/**
+	 * Symbian 2nd phase constructor.
+	 */
+	void ConstructL();
+
+private:
+	
+	// The asynchronizer .owned
+	CDelayedCallback* iAsynchronizer;	
+	
+	// CPix database .owned
+    CCPixIndexer* iIndexer;
+    
+	// Calendar session .owned
+	CCalSession* iSession;
+	
+	// Calendar entry view to fetch the details of Note entry for given LocalUid .owned
+	CCalEntryView* iEntryView;
+	
+	//Calinstance view to retrive notes .owned
+	CCalInstanceView* iNotesInstanceView;
+	
+	//Array of calinstances of Notes .owned
+	RPointerArray<CCalInstance> iNotesInstanceArray;
+	
+	//Notes count
+	TInt iNoteCount;
+	
+#ifdef __PERFORMANCE_DATA
+    TTime iStartTime;
+    TTime iCompleteTime;
+    void UpdatePerformaceDataL();
+#endif
+	
+};
+
+#endif // CNOTESPLUGIN_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/harvesterplugins/notes/src/notesplugin.cpp	Mon Apr 19 14:40:05 2010 +0300
@@ -0,0 +1,472 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: 
+ *
+*/
+
+
+#include "notesplugin.h"
+#include "harvesterserverlogger.h"
+#include <common.h>
+#include <csearchdocument.h>
+#include <ccpixindexer.h>
+#include <e32base.h> 
+#include <calsession.h>
+#include <calentry.h>
+#include <calinstanceview.h>
+#include <calentryview.h>
+#include <e32std.h>
+#include <centralrepository.h>
+
+_LIT(KMimeTypeNotes , NOTES_MIMETYPE);
+_LIT(KMimeTypeField , CPIX_MIMETYPE_FIELD);
+
+const TUid KCPIXrepoUidMenu = {0x20029ac7};
+/** The delay between harvesting chunks. */
+const TInt KHarvestingDelay = 2000;
+//Length of date string in cenrep
+const TInt KDateStringLength = 10;
+//Key value for start date in cenrep
+const TUint32 KStartDateKey = 0x1;
+//Key value for end date in cenrep
+const TUint32 KEndDateKey = 0x2;
+/** Field names */
+//Memo Field name in CPIX indexer for notepad record
+_LIT(KNpdMemo , "Memo");
+//date Field name in CPIX indexer for notepad record
+_LIT(KNpdUpdateTime , "Date");
+
+//Reference from CPix calender harvester plugin.
+_LIT(KNotesTimeFormat , "%F%/0%Y%M%D%H%T"); // Locale independent YYYYMMDDHHMM
+
+// ---------------------------------------------------------------------------
+// CNotesPlugin::NewL
+// ---------------------------------------------------------------------------
+//  
+CNotesPlugin* CNotesPlugin::NewL()
+	{
+	CNotesPlugin* instance = CNotesPlugin::NewLC();
+    CleanupStack::Pop(instance);
+    return instance;
+	}
+
+// ---------------------------------------------------------------------------
+// CNotesPlugin::NewLC
+// ---------------------------------------------------------------------------
+//  
+CNotesPlugin* CNotesPlugin::NewLC()
+	{
+	CNotesPlugin* instance = new (ELeave) CNotesPlugin();
+    CleanupStack::PushL(instance);
+    instance->ConstructL();
+    return instance;
+	}
+
+// ---------------------------------------------------------------------------
+// CNotesPlugin::CNotesPlugin
+// ---------------------------------------------------------------------------
+//  
+CNotesPlugin::CNotesPlugin()
+	{
+	}
+
+// ---------------------------------------------------------------------------
+// CNotesPlugin::~CNotesPlugin
+// ---------------------------------------------------------------------------
+//  
+CNotesPlugin::~CNotesPlugin()
+	{
+    if (iAsynchronizer)
+        iAsynchronizer->CancelCallback();
+	delete iAsynchronizer;
+	delete iIndexer;
+    delete iNotesInstanceView;
+	delete iEntryView;
+	iNotesInstanceArray.ResetAndDestroy();
+	if( iSession )
+		{
+		iSession->StopChangeNotification();
+		}
+	delete iSession;
+	}
+	
+// ---------------------------------------------------------------------------
+// CNotesPlugin::ConstructL
+// ---------------------------------------------------------------------------
+//  
+void CNotesPlugin::ConstructL()
+	{
+	iAsynchronizer = CDelayedCallback::NewL( CActive::EPriorityIdle );
+	iSession = CCalSession::NewL();
+	TRAPD ( err , iSession->OpenL( iSession->DefaultFileNameL() ) );
+    if ( err == KErrNotFound)
+        {
+        iSession->CreateCalFileL( iSession->DefaultFileNameL() );
+        iSession->OpenL( iSession->DefaultFileNameL() );
+        }
+	iNotesInstanceView = CCalInstanceView::NewL( *iSession );	
+	iEntryView = CCalEntryView::NewL( *iSession );	
+	}
+
+// ---------------------------------------------------------------------------
+// CNotesPlugin::StartPluginL
+// ---------------------------------------------------------------------------
+//  
+void CNotesPlugin::StartPluginL()
+	{
+    CPIXLOGSTRING("CNotesPlugin::StartPluginL: Enter");
+	// Define this base application class, use default location
+	User::LeaveIfError(iSearchSession.DefineVolume( _L(NOTES_QBASEAPPCLASS), KNullDesC ));
+
+	// Open the database
+	iIndexer = CCPixIndexer::NewL(iSearchSession);
+	iIndexer->OpenDatabaseL( _L(NOTES_QBASEAPPCLASS) ); 
+
+	// Start harvester for this plugin
+	iObserver->AddHarvestingQueue(this, iIndexer->GetBaseAppClass());
+	
+	// Start monitoring Notes events
+	//Have taken start time and end time reference from calender plugin
+	TTime startTime , endTime;
+	InitTimeValuesL ( startTime , endTime );
+	TCalTime startTimeCal , endTimeCal;
+	startTimeCal.SetTimeUtcL( startTime );
+	endTimeCal.SetTimeUtcL( endTime );
+	
+	//Created the filter for monitoring. As of now there is no TChangeEntryType for monitoring Notes,
+	//Monitoring done for all the calendar entry types and a check included while updating CPix database for Notes item.
+	CCalChangeNotificationFilter* filter = CCalChangeNotificationFilter::NewL( MCalChangeCallBack2::EChangeEntryAll, ETrue, 
+                                                                               CalCommon::TCalTimeRange( startTimeCal, endTimeCal ) );
+	//Start the Monitoring
+	iSession->StartChangeNotification( *this, *filter );
+	delete filter;
+	CPIXLOGSTRING("CNotesPlugin::StartPluginL: Exit");
+	}	
+
+// ---------------------------------------------------------------------------
+// CNotesPlugin::StartHarvestingL
+// ---------------------------------------------------------------------------
+//  
+void CNotesPlugin::StartHarvestingL(const TDesC& /*aQualifiedBaseAppClass*/)
+    {
+    CPIXLOGSTRING("CNotesPlugin::StartHarvestingL: Enter");
+    iIndexer->ResetL();
+    //Have taken start time and end time reference from calender plugin
+    TTime startTime , endTime;
+    InitTimeValuesL( startTime , endTime );
+    TCalTime startTimeCal , endTimeCal ;
+    startTimeCal.SetTimeUtcL( startTime );
+    endTimeCal.SetTimeUtcL( endTime );
+    //Create an instance for list of Notes items in the system
+    iNotesInstanceView->FindInstanceL( iNotesInstanceArray , CalCommon::EIncludeNotes , CalCommon::TCalTimeRange( startTimeCal, endTimeCal ));    
+    iNoteCount = iNotesInstanceArray.Count();
+    CPIXLOGSTRING2("CNotesPlugin::StartHarvestingL(): Notes count =%d.", iNoteCount);
+#ifdef __PERFORMANCE_DATA
+    iStartTime.UniversalTime();
+#endif
+    iAsynchronizer->Start( 0, this, KHarvestingDelay );
+    CPIXLOGSTRING("CNotesPlugin::StartHarvestingL: Exit");
+    }
+
+// -----------------------------------------------------------------------------
+// CNotesPlugin::DelayedCallbackL
+// -----------------------------------------------------------------------------
+//
+void CNotesPlugin::DelayedCallbackL( TInt /*aCode*/ )
+    {
+    // Harvest items on each call
+    CPIXLOGSTRING("CNotesPlugin::DelayedCallbackL: Enter");
+    if( iNoteCount )
+        {
+        CPIXLOGSTRING2("CNotesPlugin::DelayedCallbackL(): remaining Note count=%d.", iNoteCount);
+        // Retrieve the calendar entry for the calinstance and update the CPix database.
+        CCalEntry& noteentry =  iNotesInstanceArray[iNoteCount - 1]->Entry();        
+        CreateNoteEntryL( noteentry.LocalUidL(), ECPixAddAction );        
+        iNoteCount--;    
+        // Request next entry.
+        iAsynchronizer->Start( 0, this, KHarvestingDelay );           
+        }
+	else
+		{
+        CPIXLOGSTRING("CNotesPlugin::DelayedCallbackL: Completed Harvesting");
+		// Harvesting was successfully completed		
+		Flush(*iIndexer);
+#ifdef __PERFORMANCE_DATA
+    UpdatePerformaceDataL();
+#endif
+		iObserver->HarvestingCompleted(this, iIndexer->GetBaseAppClass(), KErrNone);		
+		}
+	}
+
+// ---------------------------------------------------------------------------
+// CNotesPlugin::DelayedError
+// ---------------------------------------------------------------------------
+//  
+void CNotesPlugin::DelayedError(TInt aError)
+	{
+	// Harvesting was completed
+	Flush(*iIndexer);
+	iObserver->HarvestingCompleted(this, iIndexer->GetBaseAppClass(), aError);
+	}
+
+// ---------------------------------------------------------------------------
+// CNotesPlugin::CalChangeNotification
+// ---------------------------------------------------------------------------
+//  
+void CNotesPlugin::CalChangeNotification( RArray< TCalChangeEntry >& aChangeItems )
+	{
+    CPIXLOGSTRING("CNotesPlugin::CalChangeNotification: Enter");
+	const TInt count(aChangeItems.Count());
+	CPIXLOGSTRING2("CNotesPlugin::CalChangeNotification(): changed item count =%d.", count);
+	for( TInt i = 0; i < count; ++i )
+		{
+        TRAP_IGNORE(HandleNoteChangedEntryL( aChangeItems[ i ] ));
+		}
+	CPIXLOGSTRING("CNotesPlugin::CalChangeNotification: Exit");
+	}
+
+// ---------------------------------------------------------------------------
+// CNotesPlugin::HandleChangedEntryL
+// ---------------------------------------------------------------------------
+//  
+void CNotesPlugin::HandleNoteChangedEntryL(const TCalChangeEntry& changedEntry)
+	{
+	switch( changedEntry.iChangeType )
+		{		
+		case EChangeAdd:
+			{
+			CPIXLOGSTRING2("CNotesPlugin::HandleNoteChangedEntryL(): Monitored add id=%d.", changedEntry.iEntryId);
+			CreateNoteEntryL( changedEntry.iEntryId, ECPixAddAction );
+			break;
+			}
+
+		case EChangeDelete:
+			{	
+			CPIXLOGSTRING2("CNotesPlugin::HandleNoteChangedEntryL(): Monitored delete id=%d.", changedEntry.iEntryId);
+			CreateNoteEntryL( changedEntry.iEntryId, ECPixRemoveAction );
+			break;
+			}
+
+		case EChangeModify:
+			{
+			CPIXLOGSTRING2("CNotesPlugin::HandleNoteChangedEntryL(): Monitored update id=%d.", changedEntry.iEntryId);
+			CreateNoteEntryL( changedEntry.iEntryId, ECPixUpdateAction );
+			break;
+			}
+
+		case EChangeUndefined:
+			{
+			CPIXLOGSTRING("CNotesPlugin::HandleNoteChangedEntryL(): EChangeUndefined.");
+			// This event could be related to synchronization.
+			// Mark harvesting as cancelled.
+			// Remove it from the harvesting queue to cause it to enter 
+			// EHarvesterStatusHibernate state.
+			// Now add it to the harvesting queue and force a reharvest.
+
+			Flush(*iIndexer);
+			iObserver->HarvestingCompleted(this, iIndexer->GetBaseAppClass(), KErrCancel);
+			iObserver->RemoveHarvestingQueue(this, iIndexer->GetBaseAppClass());
+			iObserver->AddHarvestingQueue(this, iIndexer->GetBaseAppClass(), ETrue);
+			break;
+			}
+		default:
+			// Ignore other events
+			break;
+		}	
+	}
+	
+// ---------------------------------------------------------------------------
+// CNotesPlugin::CreateEntryL
+// ---------------------------------------------------------------------------
+//  
+void CNotesPlugin::CreateNoteEntryL( const TCalLocalUid& aLocalUid, TCPixActionType aActionType )
+	{
+	if (!iIndexer)
+    	return;
+
+	CPIXLOGSTRING2("CNotesPlugin::CreateNoteEntryL():  Uid = %d.", aLocalUid);
+	
+	
+	// create CSearchDocument object with unique ID for this application
+	TBuf<20> docid_str;
+	docid_str.AppendNum(aLocalUid);
+	
+	if (aActionType == ECPixAddAction || aActionType == ECPixUpdateAction)
+		{
+        // Return the entry that has been fetched, this will be NULL if there are 
+	    // no entries with the cal unique id
+	    CCalEntry* entry = iEntryView->FetchL(aLocalUid);    
+	    CleanupStack::PushL(entry);
+	    
+	    if( CCalEntry::ENote != entry->EntryTypeL() )
+	        {
+            CPIXLOGSTRING("CNotesPlugin::CreateNoteEntryL(): return as not a Note entry.");
+	        CleanupStack::PopAndDestroy(entry);
+	        return;
+	        }
+	    CPIXLOGSTRING("CNotesPlugin::CreateNoteEntryL(): Creating document.");
+		CSearchDocument* index_item = CSearchDocument::NewLC(docid_str, _L(NOTESAPPCLASS));
+		// Add Description fields		
+		index_item->AddFieldL(KNpdMemo, entry->DescriptionL());
+		// Add Date fields
+		TBuf<30> dateString;
+		TTime endTime = entry->EndTimeL().TimeUtcL();
+		endTime.FormatL(dateString, KNotesTimeFormat);
+		index_item->AddFieldL(KNpdUpdateTime, dateString, CDocumentField::EStoreYes | CDocumentField::EIndexUnTokenized);
+
+		index_item->AddFieldL(KMimeTypeField, KMimeTypeNotes, CDocumentField::EStoreYes | CDocumentField::EIndexUnTokenized);
+
+    	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);      
+		
+		// Send for indexing
+		if (aActionType == ECPixAddAction)
+			{
+#ifndef _DEBUG
+            TRAP_IGNORE( iIndexer->AddL(*index_item) );
+#else
+			TRAPD( err, iIndexer->AddL(*index_item) );
+			if ( err == KErrNone )
+				{
+				CPIXLOGSTRING("CNotesPlugin::CreateNoteEntryL(): Added.");
+				}
+			else
+				{
+				CPIXLOGSTRING2("CNotesPlugin::CreateNoteEntryL(): Error %d in adding.", err);
+				}
+#endif
+			}
+		else if ( aActionType == ECPixUpdateAction )
+			{
+#ifndef _DEBUG
+		TRAP_IGNORE( iIndexer->UpdateL(*index_item) );
+#else
+			TRAPD( err, iIndexer->UpdateL(*index_item) );
+			if ( err == KErrNone )
+				{
+				CPIXLOGSTRING("CNotesPlugin::CreateNoteEntryL(): Updated.");
+				}
+			else
+				{
+				CPIXLOGSTRING2("CNotesPlugin::CreateNoteEntryL(): Error %d in updating.", err);
+				}
+#endif
+			}
+		CleanupStack::PopAndDestroy(index_item);
+		CleanupStack::PopAndDestroy(entry);
+		}
+	else if (aActionType == ECPixRemoveAction)
+		{
+#ifndef _DEBUG
+        TRAP_IGNORE( iIndexer->DeleteL(docid_str) );
+#else
+		TRAPD( err, iIndexer->DeleteL(docid_str) );
+		if (err == KErrNone)
+			{
+			CPIXLOGSTRING("CNotesPlugin::CreateNoteEntryL(): Deleted.");
+			}
+		else
+			{
+			CPIXLOGSTRING2("CNotesPlugin::CreateNoteEntryL(): Error %d in deleting.", err);				
+			}
+#endif
+		}	
+	}
+
+// ---------------------------------------------------------------------------
+// CNotesPlugin::InitTimeValuesL
+// ---------------------------------------------------------------------------
+//  
+void CNotesPlugin::InitTimeValuesL( TTime& aStartTime, TTime& aEndTime )
+    {
+    CPIXLOGSTRING("CNotesPlugin::InitTimeValuesL: Enter");
+    //Open the cpix common repository
+    CRepository* cpixrepo = CRepository::NewL( KCPIXrepoUidMenu );    
+    TBuf<KDateStringLength> temp;
+    //Read the Start date from the cenrep
+    TInt error = cpixrepo->Get( KStartDateKey , temp);
+    //Parse the date and update sStartTime
+    TInt day,month,year;
+    TLex svalue(temp);
+    svalue.Val(day);
+    svalue.Inc(1);
+    svalue.Val(month);
+    svalue.Inc(1);
+    svalue.Val(year);
+    TDateTime startdate(year,(TMonth)(month-1),day , 0 , 0 , 0 , 0);
+    aStartTime = startdate;
+    //Read the end date from the cenrep
+    error = cpixrepo->Get( KEndDateKey , temp);
+    //Parse the date and update aEndTime
+    TLex evalue(temp);
+    evalue.Val(day);
+    evalue.Inc(1);
+    evalue.Val(month);
+    evalue.Inc(1);
+    evalue.Val(year);
+    TDateTime enddate(year,(TMonth)(month-1),day , 0 , 0 , 0 , 0);
+    aEndTime = enddate;
+    CPIXLOGSTRING2("CNotesPlugin::InitTimeValuesL: Exit with Error = %d", error);     
+    }
+
+#ifdef __PERFORMANCE_DATA
+void CNotesPlugin::UpdatePerformaceDataL()
+    {
+    TTime now;
+   
+    
+    iCompleteTime.UniversalTime();
+    TTimeIntervalMicroSeconds timeDiff = iCompleteTime.MicroSecondsFrom(iStartTime);
+    
+    RFs fileSession;
+    RFile perfFile;
+    User::LeaveIfError( fileSession.Connect () );
+    
+    
+    /* Open file if it exists, otherwise create it and write content in it */
+    
+        if(perfFile.Open(fileSession, _L("c:\\data\\NotesPerf.txt"), EFileWrite))
+                   User::LeaveIfError(perfFile.Create (fileSession, _L("c:\\data\\NotesPerf.txt"), EFileWrite));
+    
+    HBufC8 *heap = HBufC8::NewL(100);
+    TPtr8 ptr = heap->Des();
+    now.HomeTime();
+    TBuf<50> timeString;             
+                
+    _LIT(KOwnTimeFormat,"%:0%H%:1%T%:2%S");
+    now.FormatL(timeString,KOwnTimeFormat);
+    ptr.AppendNum(now.DateTime().Day());
+    ptr.Append(_L("/"));
+    ptr.AppendNum(now.DateTime().Month());
+    ptr.Append(_L("/"));
+    ptr.AppendNum(now.DateTime().Year());
+    ptr.Append(_L(":"));
+    ptr.Append(timeString);
+    ptr.Append( _L(":Ani: Time took for Harvesting Notes is : "));
+    ptr.AppendNum(timeDiff.Int64()/1000) ;
+    ptr.Append(_L(" MilliSeonds \n"));
+    TInt myInt = 0;
+    perfFile.Seek(ESeekEnd,myInt);
+    perfFile.Write (ptr);
+    perfFile.Close ();
+    fileSession.Close ();
+    delete heap;
+    }
+#endif
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/harvesterplugins/notes/src/tproxy.cpp	Mon Apr 19 14:40:05 2010 +0300
@@ -0,0 +1,36 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: 
+*
+*/
+
+#include <e32std.h>
+#include <implementationproxy.h>
+#include <cindexingplugin.h>
+#include "notesplugin.h"
+
+
+// Map the interface UIDs to implementation factory functions
+const TImplementationProxy KImplementationTable[] = 
+	{
+	{{KNotesDllUid},( TProxyNewLPtr) CNotesPlugin::NewL}		
+	};
+
+// Exported proxy for instantiation method resolution
+EXPORT_C const TImplementationProxy* ImplementationGroupProxy( TInt& aTableCount )
+	{
+	aTableCount = sizeof( KImplementationTable ) / sizeof( TImplementationProxy );
+	return KImplementationTable;
+	}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/harvesterplugins/tsrc/harvesterplugintester/Bmarm/harvesterplugintesteru.def	Mon Apr 19 14:40:05 2010 +0300
@@ -0,0 +1,3 @@
+EXPORTS
+	LibEntryL__FR13CTestModuleIf @ 1 NONAME R3UNUSED ; LibEntryL(CTestModuleIf &)
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/harvesterplugins/tsrc/harvesterplugintester/Bwins/harvesterplugintesteru.def	Mon Apr 19 14:40:05 2010 +0300
@@ -0,0 +1,3 @@
+EXPORTS
+	?LibEntryL@@YAPAVCScriptBase@@AAVCTestModuleIf@@@Z @ 1 NONAME ; class CScriptBase * __cdecl LibEntryL(class CTestModuleIf &)
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/harvesterplugins/tsrc/harvesterplugintester/EABI/harvesterplugintesteru.def	Mon Apr 19 14:40:05 2010 +0300
@@ -0,0 +1,65 @@
+EXPORTS
+	_Z9LibEntryLR13CTestModuleIf @ 1 NONAME
+	_ZTI10CMDSEntity @ 2 NONAME
+	_ZTI11CFilePlugin @ 3 NONAME
+	_ZTI11CMMCMonitor @ 4 NONAME
+	_ZTI12CFileMonitor @ 5 NONAME
+	_ZTI12CImagePlugin @ 6 NONAME
+	_ZTI12CNotesPlugin @ 7 NONAME
+	_ZTI12CVideoPlugin @ 8 NONAME
+	_ZTI13CMdeHarvester @ 9 NONAME
+	_ZTI14CFileHarvester @ 10 NONAME
+	_ZTI14CMessagePlugin @ 11 NONAME
+	_ZTI15CCPIXDocFetcher @ 12 NONAME
+	_ZTI15CCalendarPlugin @ 13 NONAME
+	_ZTI15CContactsPlugin @ 14 NONAME
+	_ZTI15CMMCMonitorUtil @ 15 NONAME
+	_ZTI15CMessageMonitor @ 16 NONAME
+	_ZTI16CBookmarksPlugin @ 17 NONAME
+	_ZTI16CMdsMediaMonitor @ 18 NONAME
+	_ZTI16CMessAsyncWaiter @ 19 NONAME
+	_ZTI17CCPIXMDEDbManager @ 20 NONAME
+	_ZTI17CCalendarObserver @ 21 NONAME
+	_ZTI17CMessageHarvester @ 22 NONAME
+	_ZTI18CCPIXMediaImageDoc @ 23 NONAME
+	_ZTI18CCPIXMediaVideoDoc @ 24 NONAME
+	_ZTI18CFolderRenamedItem @ 25 NONAME
+	_ZTI18CHarvesterObserver @ 26 NONAME
+	_ZTI19CApplicationsPlugin @ 27 NONAME
+	_ZTI19CMessageDataHandler @ 28 NONAME
+	_ZTI22CMdeObjectQueueManager @ 29 NONAME
+	_ZTI22CMdsSessionObjectUtils @ 30 NONAME
+	_ZTI23CFolderRenamedHarvester @ 31 NONAME
+	_ZTI23CMessageSessionObserver @ 32 NONAME
+	_ZTV10CMDSEntity @ 33 NONAME
+	_ZTV11CFilePlugin @ 34 NONAME
+	_ZTV11CMMCMonitor @ 35 NONAME
+	_ZTV12CFileMonitor @ 36 NONAME
+	_ZTV12CImagePlugin @ 37 NONAME
+	_ZTV12CNotesPlugin @ 38 NONAME
+	_ZTV12CVideoPlugin @ 39 NONAME
+	_ZTV13CMdeHarvester @ 40 NONAME
+	_ZTV14CFileHarvester @ 41 NONAME
+	_ZTV14CMessagePlugin @ 42 NONAME
+	_ZTV15CCPIXDocFetcher @ 43 NONAME
+	_ZTV15CCalendarPlugin @ 44 NONAME
+	_ZTV15CContactsPlugin @ 45 NONAME
+	_ZTV15CMMCMonitorUtil @ 46 NONAME
+	_ZTV15CMessageMonitor @ 47 NONAME
+	_ZTV16CBookmarksPlugin @ 48 NONAME
+	_ZTV16CMdsMediaMonitor @ 49 NONAME
+	_ZTV16CMessAsyncWaiter @ 50 NONAME
+	_ZTV17CCPIXMDEDbManager @ 51 NONAME
+	_ZTV17CCalendarObserver @ 52 NONAME
+	_ZTV17CMessageHarvester @ 53 NONAME
+	_ZTV18CCPIXMediaImageDoc @ 54 NONAME
+	_ZTV18CCPIXMediaVideoDoc @ 55 NONAME
+	_ZTV18CFolderRenamedItem @ 56 NONAME
+	_ZTV18CHarvesterObserver @ 57 NONAME
+	_ZTV19CApplicationsPlugin @ 58 NONAME
+	_ZTV19CMessageDataHandler @ 59 NONAME
+	_ZTV22CMdeObjectQueueManager @ 60 NONAME
+	_ZTV22CMdsSessionObjectUtils @ 61 NONAME
+	_ZTV23CFolderRenamedHarvester @ 62 NONAME
+	_ZTV23CMessageSessionObserver @ 63 NONAME
+
Binary file harvesterplugins/tsrc/harvesterplugintester/conf/eagle_landed.mp3 has changed
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/harvesterplugins/tsrc/harvesterplugintester/conf/harvesterplugintester.cfg	Mon Apr 19 14:40:05 2010 +0300
@@ -0,0 +1,332 @@
+[StifSettings]
+CapsModifier= capsmod.exe
+[EndStifSettings]
+
+[Test]
+title TestStartHarvester
+create HarvesterPluginTester foobar
+foobar TestStartHarvester pa ra me ters
+delete foobar
+[Endtest] 
+
+[Test]
+title TestFolderRename
+create HarvesterPluginTester foobar
+foobar TestFolderRename
+delete foobar
+[Endtest] 
+
+[Test]
+title TestFormBaseAppClass
+create HarvesterPluginTester foobar
+foobar TestFormBaseAppClass -2 a -1
+foobar TestFormBaseAppClass 2 c 0
+foobar TestFormBaseAppClass 100 z -1
+delete foobar
+[Endtest]
+
+[Test]
+title TestDatabasePath
+create HarvesterPluginTester foobar
+foobar TestDatabasePath -2 a -1
+foobar TestDatabasePath 2 C 0
+foobar TestDatabasePath 100 z -1
+delete foobar
+[Endtest]
+
+[Test]
+title TestCreateIndexItemL_Add
+create HarvesterPluginTester foobar
+foobar TestCreateIndexItemL_Add add testfile1.txt Sai
+delete foobar
+[Endtest]
+
+[Test]
+title TestCreateIndexItemL_Update
+create HarvesterPluginTester foobar
+foobar TestCreateIndexItemL_Update update testfile1.txt Sai sai Keyword
+delete foobar
+[Endtest]
+
+[Test]
+title TestCreateIndexItemL_Delete
+create HarvesterPluginTester foobar
+foobar TestCreateIndexItemL_Delete delete testfile1.txt Sai
+delete foobar
+[Endtest]
+
+[Test]
+title TestMessaging
+create HarvesterPluginTester foobar
+foobar TestMessaging
+delete foobar
+[Endtest] 
+
+[Test]
+title TestMessageHarvesting
+create HarvesterPluginTester foobar
+foobar TestMessageHarvesting 
+delete foobar
+[Endtest] 
+
+[Test]
+title TestMessageDriveChange
+create HarvesterPluginTester foobar
+foobar TestMessageDriveChange
+delete foobar
+[Endtest]
+
+[Test]
+title TestStartBookmarksHarvesterL
+create HarvesterPluginTester foobar
+foobar TestStartBookmarksHarvesterL
+delete foobar
+[Endtest]
+
+[Test]
+title TestAddBookmarkL
+create HarvesterPluginTester foobar
+foobar TestAddBookmarkL TestBookmark http:\/\/testbookmark.com testbookmark.com
+delete foobar
+[Endtest]
+
+[Test]
+title TestAddBookmarkL
+create HarvesterPluginTester foobar
+foobar TestAddBookmarkL TestBookmark2 http:\/\/testbookmark2.com testbookmark2.com
+delete foobar
+[Endtest]
+
+[Test]
+title TestAddBookmarkL
+create HarvesterPluginTester foobar
+foobar TestAddBookmarkL TestBookmark2 http:\/\/www2.testbookmark2.com testbookmark2.com
+delete foobar
+[Endtest]
+
+[Test]
+title TestAddGetDomainL
+create HarvesterPluginTester foobar
+foobar TestAddGetDomainL http:\/\/www.google.com google.com
+foobar TestAddGetDomainL http:\/\/www2234.google.com google.com
+foobar TestAddGetDomainL http:\/\/google.com google.com
+foobar TestAddGetDomainL http:\/\/100.225.225.136 100.225.225.136
+foobar TestAddGetDomainL http\/\/www.google.com http\/\/www.google.com
+delete foobar
+[Endtest]
+
+[Test]
+title TestStartApplicationsHarvesterL
+create HarvesterPluginTester foobar
+foobar TestStartApplicationsHarvesterL
+delete foobar
+[Endtest]
+
+[Test]
+title TestCreateApplicationsIndexItemL
+create HarvesterPluginTester foobar
+foobar TestCreateApplicationsIndexItemL
+delete foobar
+[Endtest]
+
+[Test]
+title TestStartNotesHarvesterL
+create HarvesterPluginTester foobar
+foobar TestStartNotesHarvesterL
+delete foobar
+[Endtest]
+
+[Test]
+title TestAddNoteL
+create HarvesterPluginTester foobar
+foobar TestAddNoteL C:\TestFramework\Notestest.txt Testcase
+delete foobar
+[Endtest]
+
+[Test]
+title TestAddLongNoteL
+create HarvesterPluginTester foobar
+foobar TestAddLongNoteL C:\TestFramework\NotesLongtest.txt opportunities
+delete foobar
+[Endtest]
+
+[Test]
+title TestAddAlphaNumericNoteL
+create HarvesterPluginTester foobar
+foobar TestAddAlphaNumericNoteL C:\TestFramework\NotesAlphanumerictest.txt September2009
+delete foobar
+[Endtest]
+
+[Test]
+title TestDeleteNoteL
+create HarvesterPluginTester foobar
+foobar TestDeleteNoteL TestNote
+delete foobar
+[Endtest]
+
+[Test]
+title TestUpdateNoteL
+create HarvesterPluginTester foobar
+foobar TestUpdateNoteL Salarpuria Hallmark
+delete foobar
+[Endtest]
+
+[Test]
+title TestContactsHarvesting
+create HarvesterPluginTester foobar
+foobar TestContactsHarvesting
+delete foobar
+[Endtest]
+
+[Test]
+title TestCreateContactIndexItemL_Add
+create HarvesterPluginTester foobar
+foobar TestCreateContactIndexItemL_Add add ContactAdded
+delete foobar
+[Endtest]
+
+[Test]
+title TestCreateContactIndexItemL_Edit
+create HarvesterPluginTester foobar
+foobar TestCreateContactIndexItemL_Edit update ContactNew ContactModified
+delete foobar
+[Endtest]
+
+[Test]
+title TestCreateContactIndexItemL_Delete
+create HarvesterPluginTester foobar
+foobar TestCreateContactIndexItemL_Delete delete ContactDel
+delete foobar
+[Endtest]
+
+[Test]
+title TestCreateContactGroup
+create HarvesterPluginTester foobar
+foobar TestCreateContactGroup TestGroup
+delete foobar
+[Endtest]
+
+[Test]
+title TestCalenderHarvesting
+create HarvesterPluginTester foobar
+foobar TestCalenderHarvesting
+delete foobar
+[Endtest]
+
+[Test]
+title TestCalenderEntry
+create HarvesterPluginTester foobar
+foobar TestCalenderEntry
+delete foobar
+[Endtest]
+
+[Test]
+title TestCreateMMS
+create HarvesterPluginTester foobar
+foobar TestCreateMMS C:\TestFramework\TestAttachment.txt
+delete foobar
+[Endtest]
+
+[Test]
+title TestCreateEmail
+create HarvesterPluginTester foobar
+foobar TestCreateEmail
+delete foobar
+[Endtest]
+
+[Test]
+title TestAudioHarvesting
+create HarvesterPluginTester foobar
+foobar TestAudioHarvesting
+delete foobar
+[Endtest]
+
+[Test]
+title TestMdsSyncController
+create HarvesterPluginTester foobar
+foobar TestMdsSyncController
+delete foobar
+[Endtest]
+
+[Test]
+title TestVideoHarvestingIndex
+create HarvesterPluginTester foobar 
+foobar TestVideoHarvestingIndex c:\data\Niagara.wmv Niagara.wmv
+delete foobar
+[Endtest]
+[Test]
+title TestVideoHarvestingUpdateIndex
+create HarvesterPluginTester foobar 
+foobar TestVideoHarvestingUpdateIndex c:\data\Niagara.wmv Niagara.wmv Falls.wmv
+delete foobar
+[Endtest]
+
+[Test]
+title TestVideoHarvestingDeleteIndex
+create HarvesterPluginTester foobar 
+foobar TestVideoHarvestingDeleteIndex c:\data\Niagara.wmv Niagara.wmv
+delete foobar
+[Endtest]
+
+[Test]
+title TestImageHarvestingAddIndex
+create HarvesterPluginTester foobar 
+foobar TestImageHarvestingAddIndex c:\data\Square.jpg Square.jpg
+delete foobar
+[Endtest]
+
+[Test]
+title TestImageHarvestingUpdateIndex
+create HarvesterPluginTester foobar 
+foobar TestImageHarvestingUpdateIndex c:\data\Square.jpg Square.jpg Portrait.jpg
+delete foobar
+[Endtest]
+
+[Test]
+title TestImageHarvestingDeleteIndex
+create HarvesterPluginTester foobar 
+foobar TestImageHarvestingDeleteIndex c:\data\Square.jpg Square.jpg
+delete foobar
+[Endtest]
+
+[Test]
+title TestAudioMMCEventL
+create HarvesterPluginTester foobar 
+foobar TestAudioMMCEventL 2 0
+delete foobar
+[Endtest]
+
+[Test]
+title TestAudioMMCEventL
+create HarvesterPluginTester foobar 
+foobar TestAudioMMCEventL 2 1
+delete foobar
+[Endtest]
+
+[Test]
+title TestVideoMMCEventL
+create HarvesterPluginTester foobar 
+foobar TestVideoMMCEventL 2 0
+delete foobar
+[Endtest]
+
+[Test]
+title TestVideoMMCEventL
+create HarvesterPluginTester foobar 
+foobar TestVideoMMCEventL 2 1
+delete foobar
+[Endtest]
+
+[Test]
+title TestImageMMCEventL
+create HarvesterPluginTester foobar 
+foobar TestImageMMCEventL 2 0
+delete foobar
+[Endtest]
+
+[Test]
+title TestImageMMCEventL
+create HarvesterPluginTester foobar 
+foobar TestImageMMCEventL 2 1
+delete foobar
+[Endtest]
Binary file harvesterplugins/tsrc/harvesterplugintester/conf/niagara.wmv has changed
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/harvesterplugins/tsrc/harvesterplugintester/conf/notesalphanumerictest.txt	Mon Apr 19 14:40:05 2010 +0300
@@ -0,0 +1,7 @@
+Don’t miss this opportunity to showcase your work that have successfully moved our Sales and Marketing strategies forward!
+
+We want to hear from you! Send in your entries now!
+
+Program Launch: 14 September2009
+Entry Deadline: 23 November 2009
+Award Ceremony: January 2010
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/harvesterplugins/tsrc/harvesterplugintester/conf/noteslongtest.txt	Mon Apr 19 14:40:05 2010 +0300
@@ -0,0 +1,5 @@
+Our organizational structure is designed to position us for a world where the mobile device, the Internet and and the computer are fusing together.
+
+Our Devices unit is responsible for developing and managing our portfolio of mobile devices, which we make for all major consumer segments.
+
+Services designs and develops Internet services that enrich the experience people have with their mobile devices and the web. Messaging, music, maps, media as well as Ovi developer tools are key focus areas as we continue to expand our services offering to consumers and create opportunities for developers and content providers.
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/harvesterplugins/tsrc/harvesterplugintester/conf/notestest.txt	Mon Apr 19 14:40:05 2010 +0300
@@ -0,0 +1,1 @@
+This is Testcase to test Notes Plugin
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/harvesterplugins/tsrc/harvesterplugintester/conf/testattachment.txt	Mon Apr 19 14:40:05 2010 +0300
@@ -0,0 +1,1 @@
+This text message is encoded in UTF format.
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/harvesterplugins/tsrc/harvesterplugintester/conf/testframework.ini	Mon Apr 19 14:40:05 2010 +0300
@@ -0,0 +1,175 @@
+#
+# This is STIFTestFramework initialization file
+# Comment lines start with '#'-character.
+# See STIF TestFramework users guide.doc for instructions
+
+# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
+# Set following test engine settings:
+#	- Set Test Reporting mode. TestReportMode's possible values are:
+#		+ 'Summary': Summary of the tested test cases.
+#		+ 'Environment': Hardware and software info.
+#		+ 'TestCases': Test case report.
+#		+ 'FullReport': Set of all above ones.
+#		+ Example 'TestReportMode= Summary TestCases'
+#
+# 	- CreateTestReport setting controls report creation mode
+#		+ YES, Test report will created.
+#		+ NO, No Test report.
+#
+# 	- File path indicates the base path of the test report.
+# 	- File name indicates the name of the test report.
+#
+# 	- File format indicates the type of the test report.
+#		+ TXT, Test report file will be txt type, for example 'TestReport.txt'.
+#		+ HTML, Test report will be html type, for example 'TestReport.html'.
+#
+# 	- File output indicates output source of the test report.
+#		+ FILE, Test report logging to file.
+#		+ RDEBUG, Test report logging to using rdebug.
+#
+# 	- File Creation Mode indicates test report overwriting if file exist.
+#		+ OVERWRITE, Overwrites if the Test report file exist.
+#		+ APPEND, Continue logging after the old Test report information if 
+#                 report exist.
+# 	- Sets a device reset module's dll name(Reboot).
+#		+ If Nokia specific reset module is not available or it is not correct one
+#		  StifHWResetStub module may use as a template for user specific reset
+#		  module. 
+
+[Engine_Defaults]
+
+TestReportMode= FullReport		# Possible values are: 'Empty', 'Summary', 'Environment',
+                                                               'TestCases' or 'FullReport'
+
+CreateTestReport= YES			# Possible values: YES or NO
+
+TestReportFilePath= C:\LOGS\TestFramework\
+TestReportFileName= TestReport
+
+TestReportFormat= TXT			# Possible values: TXT or HTML
+TestReportOutput= FILE			# Possible values: FILE or RDEBUG
+TestReportFileCreationMode= OVERWRITE	# Possible values: OVERWRITE or APPEND
+
+DeviceResetDllName= StifResetForNokia.dll # e.g. 'StifHWResetStub.dll' for user specific reseting
+
+[End_Defaults]
+# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
+
+
+
+# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
+# Module configurations start
+# Modules are added between module tags
+# tags. Module name is specified after ModuleName= tag, like
+# ModuleName= XXXXXXXXX
+# Modules might have initialisation file, specified as
+# IniFile= c:\testframework\YYYYYY
+# Modules might have several configuration files, like
+# TestCaseFile= c:\testframework\NormalCases.txt
+# TestCaseFile= c:\testframework\SmokeCases.txt
+# TestCaseFile= c:\testframework\ManualCases.txt
+
+# (TestCaseFile is synonym for old term ConfigFile)
+
+# Following case specifies demo module settings. Demo module
+# does not read any settings from file, so tags 
+# IniFile and TestCaseFile are not used.
+# In the simplest case it is enough to specify only the
+# name of the test module when adding new test module
+
+#[New_Module]
+#ModuleName= demomodule
+#[End_Module]
+
+
+# Load testmoduleXXX, optionally with initialization file and/or test case files
+[New_Module]
+ModuleName= testscripter
+
+#TestModuleXXX used initialization file
+#IniFile= c:\testframework\init.txt
+
+#TestModuleXXX used configuration file(s)
+TestCaseFile= c:\testframework\HarvesterPluginTester.cfg
+[End_Module]
+# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
+
+
+
+# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
+# Set STIFTestFramework logging overwrite parameters for Logger.
+# 	Hardware and emulator environment logging path and styles can
+# 	be configured from here to overwrite the Logger's implemented values.
+#	
+#	Settings description:
+#	- Indicates option for creation log directory/directories. If log directory/directories
+#         is/are not created by user they will make by software.
+#		+ YES, Create log directory/directories if not allready exist.
+#		+ NO, Log directory/directories not created. Only created one is used.
+#
+#	- Overwrite emulator path setting.
+#		+ Example: If 'EmulatorBasePath= C:\LOGS\TestFramework\' and in code is defined 
+#		           Logger's path 'D:\\LOGS\\Module\\' with those definition the path
+#		           will be 'C:\LOGS\TestFramework\LOGS\Module\'
+#
+#	- Overwrite emulator's logging format.
+#		+ TXT, Log file(s) will be txt type(s), for example 'Module.txt'.
+#		+ HTML, Log file(s) will be html type(s), for example 'Module.html'.
+#
+#	- Overwrited emulator logging output source.
+#		+ FILE, Logging to file(s).
+#		+ RDEBUG, Logging to using rdebug(s).
+#
+#	- Overwrite hardware path setting (Same description as above in emulator path).
+#	- Overwrite hardware's logging format(Same description as above in emulator format).
+#	- Overwrite hardware's logging output source(Same description as above in emulator output).
+#
+#	- File Creation Mode indicates file overwriting if file exist.
+#		+ OVERWRITE, Overwrites if file(s) exist.
+#		+ APPEND, Continue logging after the old logging information if file(s) exist.
+#
+#	- Will thread id include to the log filename.
+#		+ YES, Thread id to log file(s) name, Example filename 'Module_b9.txt'.
+#		+ NO, No thread id to log file(s), Example filename 'Module.txt'.
+#
+#	- Will time stamps include the to log file.
+#		+ YES, Time stamp added to each line in log file(s). Time stamp is 
+#                 for example'12.Nov.2003 115958    LOGGING INFO'
+#		+ NO, No time stamp(s).
+#
+#	- Will line breaks include to the log file.
+#		+ YES, Each logging event includes line break and next log event is in own line.
+#		+ NO, No line break(s).
+#
+#	- Will event ranking include to the log file.
+#		+ YES, Event ranking number added to each line in log file(s). Ranking number 
+#                 depends on environment's tics, for example(includes time stamp also)
+#                 '012   12.Nov.2003 115958    LOGGING INFO'
+#		+ NO, No event ranking.
+#
+
+[Logger_Defaults]
+
+#NOTE: If you want to set Logger using next setting(s) remove comment(s)'#' 
+
+CreateLogDirectories= YES		# Possible values: YES or NO
+
+#EmulatorBasePath= C:\LOGS\TestFramework\
+#EmulatorFormat= HTML			# Possible values: TXT or HTML
+EmulatorOutput= FILE			# Possible values: FILE or RDEBUG
+
+#HardwareBasePath= D:\LOGS\TestFramework\
+#HardwareFormat= HTML			# Possible values: TXT or HTML
+#HardwareOutput= FILE			# Possible values: FILE or RDEBUG
+
+FileCreationMode= APPEND		# Possible values: OVERWRITE or APPEND
+
+#ThreadIdToLogFile= YES			# Possible values: YES or NO
+#WithTimeStamp= YES			# Possible values: YES or NO
+#WithLineBreak= YES			# Possible values: YES or NO
+#WithEventRanking= YES			# Possible values: YES or NO
+
+[End_Logger_Defaults]
+# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
+
+# End of file
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/harvesterplugins/tsrc/harvesterplugintester/group/bld.inf	Mon Apr 19 14:40:05 2010 +0300
@@ -0,0 +1,78 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+* 
+* Description:
+*
+*/
+
+PRJ_PLATFORMS
+// specify the platforms your component needs to be built for here
+// defaults to WINS MARM so you can ignore this if you just build these
+	
+	DEFAULT
+
+PRJ_TESTEXPORTS
+// NOTE: If using ARS requirements all export operations should be done under this.
+// 'abld test export'
+../conf/harvesterplugintester.cfg /epoc32/winscw/c/TestFramework/harvesterplugintester.cfg
+../conf/testframework.ini /epoc32/winscw/c/TestFramework/testframework.ini
+../conf/notestest.txt              /epoc32/winscw/c/TestFramework/notestest.txt
+../conf/notesalphanumerictest.txt  /epoc32/winscw/c/TestFramework/notesalphanumerictest.txt
+../conf/noteslongtest.txt          /epoc32/winscw/c/TestFramework/noteslongtest.txt
+../conf/testattachment.txt         /epoc32/winscw/c/TestFramework/testattachment.txt
+../conf/eagle_landed.mp3           /epoc32/winscw/c/data/eagle_landed.mp3
+../conf/niagara.wmv           	  /epoc32/winscw/c/data/niagara.wmv
+
+//Note: Export for ROM build 
+../conf/testframework.ini         z:/system/data/testframework.ini
+../conf/harvesterplugintester.cfg z:/ids/harvesterplugintester.cfg
+../conf/notestest.txt             z:/ids/notestest.txt
+../conf/notesalphanumerictest.txt z:/ids/notesalphanumerictest.txt
+../conf/noteslongtest.txt         z:/ids/noteslongtest.txt
+../conf/testattachment.txt        z:/ids/testattachment.txt
+../conf/eagle_landed.mp3          z:/ids/eagle_landed.mp3
+../conf/niagara.wmv           	  z:/ids/niagara.wmv
+PRJ_EXPORTS
+// Specify the source file followed by its destination here
+// copy will be used to copy the source file to its destination
+// If there's no destination then the source file will be copied
+// to the same name in /epoc32/include
+// Example: 
+/*
+/agnmodel/inc/AGMCOMON.H
+*/
+//../conf/HarvesterPluginTester.cfg /epoc32/winscw/c/TestFramework/HarvesterPluginTester.cfg
+
+PRJ_TESTMMPFILES
+../src/capsmod_exe/group/capsmod_exe.mmp
+harvesterplugintester.mmp
+
+PRJ_MMPFILES
+
+//	HarvesterPluginTester_nrm.mmp
+
+// Specify the .mmp files required for building the important component
+// releasables.
+//
+// Specify "tidy" if the component you need to build doesn't need to be
+// released. Specify "ignore" if the MMP file exists but should be
+// ignored.
+// Example:
+/*
+/agnmodel/group/agnmodel.mmp
+#if defined(MARM)
+/agnmodel/group/agsvexe.mmp
+#endif
+*/
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/harvesterplugins/tsrc/harvesterplugintester/group/harvesterplugintester.mmp	Mon Apr 19 14:40:05 2010 +0300
@@ -0,0 +1,208 @@
+/*TYPE TESTCLASS*/
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+* 
+* Description: MMP file for STIF Test Framework's TestScripter 
+* testclass test module.
+*
+*/
+
+#include <platform_paths.hrh>
+
+TARGET          HarvesterPluginTester.dll
+TARGETTYPE      dll
+UID             0x1000008D 0x101FB3E3
+
+CAPABILITY        CAP_GENERAL_DLL -AllFiles -DRM
+//CAPABILITY      ALL -TCB
+/* Remove comments and replace 0x00000000 with correct vendor id */
+// VENDORID     0x00000000
+/* Remove comments and replace 0x00000000 with correct secure id */
+// SECUREID     0x00000000
+
+//TARGETPATH      ?target_path
+DEFFILE         harvesterplugintester.def
+
+USERINCLUDE     ../inc 
+
+APP_LAYER_SYSTEMINCLUDE
+OS_LAYER_SYSTEMINCLUDE
+SYSTEMINCLUDE /epoc32/include/ecom
+SYSTEMINCLUDE /epoc32/include/mmf/common
+
+SOURCEPATH      ../src
+
+SOURCE          harvesterplugintester.cpp
+SOURCE          harvesterplugintesterblocks.cpp
+SOURCE          harvesterobserver.cpp
+
+//RESOURCE        resource_file
+//RESOURCE        resource_file2
+
+LIBRARY         euser.lib
+LIBRARY         stiftestinterface.lib
+LIBRARY         stiftestengine.lib
+
+LANG            SC
+
+/*
+START WINS      
+?wins_specific_information
+END
+
+START MARM
+?marm_specific_information
+END
+*/
+// Other possible keywords:
+ 
+// DOCUMENT     ?file, that is not compiled, but added to MSVC project workspace (i.e. release notes)
+/*
+START BITMAP ?target
+TARGETPATH   ?emulated_path_on_target_machine
+HEADER
+SOURCE       ?color_depth ?source_bitmap
+END
+*/
+// DEFFILE ?filename
+// AIF ?filename
+
+//------------------------Added for testing FilePlugin-------------------
+USERINCLUDE ./../../../file/inc
+USERINCLUDE ./../../../file/inc/monitorplugin
+USERINCLUDE ./../../../file/fastfindfileserverplugin/inc
+
+SOURCEPATH ./../../../file/src
+SOURCE 	cfileplugin.cpp cfileharvester.cpp cfilemonitor.cpp cmmcmonitor.cpp
+SOURCE  cfolderrenamedharvester.cpp
+//---------------End of additions for testing FilePlugin-------------------
+
+//------------------Added for testing Messaging plugin-------------------
+USERINCLUDE ./../../../messaging/inc
+
+SOURCEPATH ./../../../messaging/src
+SOURCE        cmessageplugin.cpp cmessagedatahandler.cpp cmessageharvester.cpp cmessagemonitor.cpp
+
+SOURCEPATH ../src
+SOURCE cmessagesessionobserver.cpp
+
+LIBRARY       msgs.lib
+LIBRARY		  etext.lib // CParaFormatLayer etc
+LIBRARY       charconv.lib
+LIBRARY       imcm.lib
+LIBRARY       smcm.lib
+LIBRARY       gsmu.lib
+LIBRARY       mmscli.lib
+//------------------End for Messaging plugin ----------------------------  
+
+LIBRARY       efile.lib
+LIBRARY       flogger.lib  
+LIBRARY 	  cpixharvesterplugininterface.lib
+LIBRARY       ecom.lib
+LIBRARY       efsrv.lib
+LIBRARY       cpixsearchclient.lib
+LIBRARY       platformenv.lib // Path info
+//---------------End of additions for testing FilePlugin-------------------
+
+//------------------End for Bookmarks plugin ----------------------------  
+USERINCLUDE ./../../../bookmarks/inc
+
+SOURCEPATH ./../../../bookmarks/src
+SOURCE  bookmarksplugin.cpp
+
+LIBRARY       favouritesengine.lib
+LIBRARY       inetprotutil.lib //Uri16.h
+//---------------End of additions for Bookmarks Plugin-------------------
+
+//------------------Additions for Applications plugin ----------------------------  
+USERINCLUDE ./../../../applications/inc
+
+SOURCEPATH ./../../../applications/src
+SOURCE  applicationsplugin.cpp
+
+LIBRARY       apgrfx.lib //for RApaLsSession
+LIBRARY       apparc.lib //for TApaAppInfo 
+LIBRARY       widgetregistryclient.lib
+LIBRARY       centralrepository.lib    //for CRepository
+//---------------End of additions for Applications Plugin-------------------
+
+//------------------Added for Notes plugin ---------------------------- 
+USERINCLUDE ./../../../notes/inc
+
+SOURCEPATH ./../../../notes/src
+SOURCE  notesplugin.cpp  
+
+LIBRARY       estor.lib    //RDbColReadStream
+LIBRARY       edbms.lib    //RDbNamedDatabase
+//---------------End of additions for Notes Plugin-------------------
+
+//---------------Additions for Contacts Plugin----------------------------
+USERINCLUDE ./../../../contacts/inc
+SOURCEPATH ./../../../contacts/src
+SOURCE        ccontactsplugin.cpp
+LIBRARY       cntmodel.lib
+//------------------End for Contacts  plugin ----------------------------
+
+//---------------Additions for Calendar Plugin----------------------------
+USERINCLUDE ./../../../calendar/inc
+
+SOURCEPATH ../src
+SOURCE ccalanderobserver.cpp
+SOURCEPATH ./../../../calendar/src
+SOURCE        ccalendarplugin.cpp
+
+LIBRARY       calinterimapi.lib
+//------------------End for Calendar  plugin ----------------------------
+
+//Audio media plugin
+USERINCLUDE ./../../../media/mediautils/inc
+USERINCLUDE ./../../../media/audio/inc
+SOURCEPATH  ./../../../media/audio/src
+
+SOURCE        cpixmediaaudiodoc.cpp
+SOURCE        mediaplugin.cpp
+
+//------------------Added for Blacklist database ----------------------------
+//USERINCLUDE ./../../../harvesterserver/inc
+
+//SOURCEPATH  ./../../../harvesterserver/src
+//SOURCE        cblacklistdb.cpp  cblacklistmgr.cpp
+//------------------End for Blacklist database ----------------------------
+
+//SOURCEPATH  ./../../../pluginfw/src
+
+//SOURCE        delayedcallback.cpp //Linked to CPixHarvesterPluginInterface.lib
+
+STATICLIBRARY cpixmediautils.lib
+//LIBRARY       mediautils.lib
+LIBRARY       bafl.lib
+LIBRARY       mdeclient.lib
+LIBRARY       mdccommon.lib           // mds
+LIBRARY       harvesterclient.lib
+//End
+//---------------Additions for video plugin----------------------------
+USERINCLUDE ./../../../media/video/inc
+SOURCEPATH  ./../../../media/video/src
+
+SOURCE        cpixmediavideodoc.cpp
+SOURCE        videoplugin.cpp
+//------------------End for video plugin -----------------------------
+
+//---------------Additions for image plugin----------------------------
+USERINCLUDE ./../../../media/image/inc
+SOURCEPATH  ./../../../media/image/src
+
+SOURCE        cpixmediaimagedoc.cpp
+SOURCE        imageplugin.cpp
+//------------------End for image plugin -----------------------------
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/harvesterplugins/tsrc/harvesterplugintester/group/harvesterplugintester.pkg	Mon Apr 19 14:40:05 2010 +0300
@@ -0,0 +1,60 @@
+;
+; Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). 
+; All rights reserved.
+; This component and the accompanying materials are made available
+; under the terms of "Eclipse Public License v1.0"
+; which accompanies this distribution, and is available
+; at the URL "http://www.eclipse.org/legal/epl-v10.html".
+;
+; Initial Contributors:
+; Nokia Corporation - initial contribution.
+;
+; Contributors:
+; 
+; Description:
+;
+; 	Installation file for STIF
+;
+
+; Languages
+&EN
+
+; Provide value for uid
+#{"STIF"},(0x00000000),1,1,0,TYPE=SA
+
+; Series60 product id for S60 3.0
+[0x101F7961], 0, 0, 0, {"Series60ProductID"}
+
+; Localised Vendor name
+%{"Nokia"}
+
+; Unique Vendor name
+:"Nokia"
+
+; Logo
+; None
+
+; Package signature - Optional
+; None
+
+; Start of Package body
+
+; Condition blocks
+; None
+
+; Options list
+; None
+
+; Install files
+"\epoc32\release\armv5\udeb\HarvesterPluginTester.dll"   -   "!:\Sys\Bin\HarvesterPluginTester.dll"
+  
+; Embedded SIS 
+; None
+
+; End of Package body
+
+; PKG dependencies
+; None
+
+; PKG capabilities
+; None
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/harvesterplugins/tsrc/harvesterplugintester/group/harvesterplugintester_doxyfile.txt	Mon Apr 19 14:40:05 2010 +0300
@@ -0,0 +1,239 @@
+#
+# Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). 
+# All rights reserved.
+# This component and the accompanying materials are made available
+# under the terms of "Eclipse Public License v1.0"
+# which accompanies this distribution, and is available
+# at the URL "http://www.eclipse.org/legal/epl-v10.html".
+#
+# Initial Contributors:
+# Nokia Corporation - initial contribution.
+#
+# Contributors:
+# 
+# Description:
+#
+#
+
+# Doxyfile 1.4.1
+
+#---------------------------------------------------------------------------
+# Project related configuration options
+#---------------------------------------------------------------------------
+PROJECT_NAME           = HarvesterPluginTester
+PROJECT_NUMBER         = 
+OUTPUT_DIRECTORY       = \trunk\s60\test\HarvesterPluginTester\
+CREATE_SUBDIRS         = NO
+OUTPUT_LANGUAGE        = English
+USE_WINDOWS_ENCODING   = YES
+BRIEF_MEMBER_DESC      = YES
+REPEAT_BRIEF           = YES
+ABBREVIATE_BRIEF       = 
+ALWAYS_DETAILED_SEC    = NO
+INLINE_INHERITED_MEMB  = NO
+FULL_PATH_NAMES        = NO
+STRIP_FROM_PATH        = 
+STRIP_FROM_INC_PATH    = 
+SHORT_NAMES            = NO
+JAVADOC_AUTOBRIEF      = NO
+MULTILINE_CPP_IS_BRIEF = NO
+DETAILS_AT_TOP         = NO
+INHERIT_DOCS           = YES
+DISTRIBUTE_GROUP_DOC   = NO
+TAB_SIZE               = 8
+ALIASES                = 
+OPTIMIZE_OUTPUT_FOR_C  = YES
+OPTIMIZE_OUTPUT_JAVA   = NO
+SUBGROUPING            = YES
+#---------------------------------------------------------------------------
+# Build related configuration options
+#---------------------------------------------------------------------------
+EXTRACT_ALL            = YES
+EXTRACT_PRIVATE        = NO
+EXTRACT_STATIC         = NO
+EXTRACT_LOCAL_CLASSES  = NO
+EXTRACT_LOCAL_METHODS  = NO
+HIDE_UNDOC_MEMBERS     = NO
+HIDE_UNDOC_CLASSES     = NO
+HIDE_FRIEND_COMPOUNDS  = NO
+HIDE_IN_BODY_DOCS      = NO
+INTERNAL_DOCS          = YES
+CASE_SENSE_NAMES       = YES
+HIDE_SCOPE_NAMES       = NO
+SHOW_INCLUDE_FILES     = YES
+INLINE_INFO            = YES
+SORT_MEMBER_DOCS       = YES
+SORT_BRIEF_DOCS        = NO
+SORT_BY_SCOPE_NAME     = NO
+GENERATE_TODOLIST      = NO
+GENERATE_TESTLIST      = NO
+GENERATE_BUGLIST       = NO
+GENERATE_DEPRECATEDLIST= YES
+ENABLED_SECTIONS       = 
+MAX_INITIALIZER_LINES  = 30
+SHOW_USED_FILES        = YES
+SHOW_DIRECTORIES       = YES
+FILE_VERSION_FILTER    = 
+#---------------------------------------------------------------------------
+# configuration options related to warning and progress messages
+#---------------------------------------------------------------------------
+QUIET                  = NO
+WARNINGS               = YES
+WARN_IF_UNDOCUMENTED   = YES
+WARN_IF_DOC_ERROR      = YES
+WARN_NO_PARAMDOC       = NO
+WARN_FORMAT            = "$file:$line: $text"
+WARN_LOGFILE           = 
+#---------------------------------------------------------------------------
+# configuration options related to the input files
+#---------------------------------------------------------------------------
+INPUT                  = \trunk\s60\test\HarvesterPluginTester\
+FILE_PATTERNS          = *.h \
+                         *.rh \
+                         *.hrh
+RECURSIVE              = YES
+EXCLUDE                = 
+EXCLUDE_SYMLINKS       = NO
+EXCLUDE_PATTERNS       = 
+EXAMPLE_PATH           = 
+EXAMPLE_PATTERNS       = 
+EXAMPLE_RECURSIVE      = NO
+IMAGE_PATH             = 
+INPUT_FILTER           = 
+FILTER_PATTERNS        = 
+FILTER_SOURCE_FILES    = NO
+#---------------------------------------------------------------------------
+# configuration options related to source browsing
+#---------------------------------------------------------------------------
+SOURCE_BROWSER         = NO
+INLINE_SOURCES         = NO
+STRIP_CODE_COMMENTS    = YES
+REFERENCED_BY_RELATION = YES
+REFERENCES_RELATION    = YES
+VERBATIM_HEADERS       = YES
+#---------------------------------------------------------------------------
+# configuration options related to the alphabetical class index
+#---------------------------------------------------------------------------
+ALPHABETICAL_INDEX     = NO
+COLS_IN_ALPHA_INDEX    = 5
+IGNORE_PREFIX          = 
+#---------------------------------------------------------------------------
+# configuration options related to the HTML output
+#---------------------------------------------------------------------------
+GENERATE_HTML          = NO
+HTML_OUTPUT            = html
+HTML_FILE_EXTENSION    = .html
+HTML_HEADER            = 
+HTML_FOOTER            = 
+HTML_STYLESHEET        = 
+HTML_ALIGN_MEMBERS     = YES
+GENERATE_HTMLHELP      = YES
+CHM_FILE               = 
+HHC_LOCATION           = 
+GENERATE_CHI           = NO
+BINARY_TOC             = YES
+TOC_EXPAND             = YES
+DISABLE_INDEX          = YES
+ENUM_VALUES_PER_LINE   = 4
+GENERATE_TREEVIEW      = YES
+TREEVIEW_WIDTH         = 250
+#---------------------------------------------------------------------------
+# configuration options related to the LaTeX output
+#---------------------------------------------------------------------------
+GENERATE_LATEX         = NO
+LATEX_OUTPUT           = latex
+LATEX_CMD_NAME         = latex
+MAKEINDEX_CMD_NAME     = makeindex
+COMPACT_LATEX          = NO
+PAPER_TYPE             = a4wide
+EXTRA_PACKAGES         = 
+LATEX_HEADER           = 
+PDF_HYPERLINKS         = NO
+USE_PDFLATEX           = NO
+LATEX_BATCHMODE        = NO
+LATEX_HIDE_INDICES     = NO
+#---------------------------------------------------------------------------
+# configuration options related to the RTF output
+#---------------------------------------------------------------------------
+GENERATE_RTF           = YES
+RTF_OUTPUT             = Doc
+COMPACT_RTF            = YES
+RTF_HYPERLINKS         = YES
+RTF_STYLESHEET_FILE    = 
+RTF_EXTENSIONS_FILE    = 
+#---------------------------------------------------------------------------
+# configuration options related to the man page output
+#---------------------------------------------------------------------------
+GENERATE_MAN           = NO
+MAN_OUTPUT             = man
+MAN_EXTENSION          = .3
+MAN_LINKS              = NO
+#---------------------------------------------------------------------------
+# configuration options related to the XML output
+#---------------------------------------------------------------------------
+GENERATE_XML           = NO
+XML_OUTPUT             = xml
+XML_SCHEMA             = 
+XML_DTD                = 
+XML_PROGRAMLISTING     = YES
+#---------------------------------------------------------------------------
+# configuration options for the AutoGen Definitions output
+#---------------------------------------------------------------------------
+GENERATE_AUTOGEN_DEF   = NO
+#---------------------------------------------------------------------------
+# configuration options related to the Perl module output
+#---------------------------------------------------------------------------
+GENERATE_PERLMOD       = NO
+PERLMOD_LATEX          = NO
+PERLMOD_PRETTY         = YES
+PERLMOD_MAKEVAR_PREFIX = 
+#---------------------------------------------------------------------------
+# Configuration options related to the preprocessor   
+#---------------------------------------------------------------------------
+ENABLE_PREPROCESSING   = YES
+MACRO_EXPANSION        = YES
+EXPAND_ONLY_PREDEF     = NO
+SEARCH_INCLUDES        = YES
+INCLUDE_PATH           = 
+INCLUDE_FILE_PATTERNS  = 
+PREDEFINED             = NONSHARABLE_CLASS
+EXPAND_AS_DEFINED      = 
+SKIP_FUNCTION_MACROS   = YES
+#---------------------------------------------------------------------------
+# Configuration::additions related to external references   
+#---------------------------------------------------------------------------
+TAGFILES               = 
+GENERATE_TAGFILE       = 
+ALLEXTERNALS           = NO
+EXTERNAL_GROUPS        = YES
+PERL_PATH              = /usr/bin/perl
+#---------------------------------------------------------------------------
+# Configuration options related to the dot tool   
+#---------------------------------------------------------------------------
+CLASS_DIAGRAMS         = YES
+HIDE_UNDOC_RELATIONS   = YES
+HAVE_DOT               = NO
+CLASS_GRAPH            = YES
+COLLABORATION_GRAPH    = YES
+GROUP_GRAPHS           = YES
+UML_LOOK               = NO
+TEMPLATE_RELATIONS     = YES
+INCLUDE_GRAPH          = YES
+INCLUDED_BY_GRAPH      = YES
+CALL_GRAPH             = NO
+GRAPHICAL_HIERARCHY    = YES
+DIRECTORY_GRAPH        = YES
+DOT_IMAGE_FORMAT       = png
+DOT_PATH               = 
+DOTFILE_DIRS           = 
+MAX_DOT_GRAPH_WIDTH    = 1024
+MAX_DOT_GRAPH_HEIGHT   = 1024
+MAX_DOT_GRAPH_DEPTH    = 0
+DOT_TRANSPARENT        = NO
+DOT_MULTI_TARGETS      = NO
+GENERATE_LEGEND        = YES
+DOT_CLEANUP            = YES
+#---------------------------------------------------------------------------
+# Configuration::additions related to the search engine   
+#---------------------------------------------------------------------------
+SEARCHENGINE           = NO
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/harvesterplugins/tsrc/harvesterplugintester/group/harvesterplugintester_nrm.mmp	Mon Apr 19 14:40:05 2010 +0300
@@ -0,0 +1,92 @@
+/*TYPE TESTCLASS*/
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+* 
+* Description: MMP file for STIF Test Framework's TestScripter 
+* testclass test module.
+*
+*/
+
+#include <platform_paths.hrh>
+
+TARGET          HarvesterPluginTester.dll
+TARGETTYPE      dll
+UID             0x1000008D 0x101FB3E3
+
+CAPABILITY      ALL -TCB
+/* Remove comments and replace 0x00000000 with correct vendor id */
+// VENDORID     0x00000000
+/* Remove comments and replace 0x00000000 with correct secure id */
+// SECUREID     0x00000000
+
+//TARGETPATH      ?target_path
+DEFFILE         HarvesterPluginTester.def
+
+USERINCLUDE     ../inc 
+
+OS_LAYER_SYSTEMINCLUDE
+
+SOURCEPATH      ../src
+
+SOURCE          HarvesterPluginTester.cpp
+SOURCE          HarvesterPluginTesterBlocks.cpp
+
+//RESOURCE        resource_file
+//RESOURCE        resource_file2
+
+LIBRARY         euser.lib
+LIBRARY         stiftestinterface.lib
+LIBRARY         stiftestengine.lib
+
+LANG            SC
+
+/*
+START WINS      
+?wins_specific_information
+END
+
+START MARM
+?marm_specific_information
+END
+*/
+// Other possible keywords:
+ 
+// DOCUMENT     ?file, that is not compiled, but added to MSVC project workspace (i.e. release notes)
+/*
+START BITMAP ?target
+TARGETPATH   ?emulated_path_on_target_machine
+HEADER
+SOURCE       ?color_depth ?source_bitmap
+END
+*/
+// DEFFILE ?filename
+// AIF ?filename
+
+USERINCLUDE /trunk/s60/HarvesterPlugins/File/inc
+USERINCLUDE /trunk/s60/HarvesterPlugins/File/inc/monitorplugin
+USERINCLUDE /trunk/s60/HarvesterPlugins/File/fastfindfileserverplugin/inc
+USERINCLUDE /trunk/s60/HarvesterPlugins/pluginfw/inc
+
+SOURCEPATH /trunk/s60/HarvesterPlugins/File/src
+SOURCE 	CFilePlugin.cpp CFileHarvester.cpp CFileMonitor.cpp CFolderRenamedHarvester.cpp CMMCMonitor.cpp
+
+SOURCEPATH /trunk/s60/HarvesterPlugins/File/fastfindfileserverplugin/src
+SOURCE fastfindfileserverplugin.cpp
+
+SYSTEMINCLUDE /epoc32/include/platform/mw //for UikonInternalPSKeys.h
+
+LIBRARY       efile.lib
+LIBRARY       flogger.lib  
+LIBRARY 	  CPixHarvesterPluginInterface.lib
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/harvesterplugins/tsrc/harvesterplugintester/inc/ccalendarobserver.h	Mon Apr 19 14:40:05 2010 +0300
@@ -0,0 +1,56 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: 
+*
+*/
+
+
+#ifndef CCALENDAROBSERVER_H_
+#define CCALENDAROBSERVER_H_
+#include "calsession.h"
+#include "calentryview.h"
+#include <calentry.h>
+#include "calprogresscallback.h"
+_LIT8(KGuid, "AGlobalUid");
+
+class CCalendarObserver : public MCalProgressCallBack 
+{
+public:
+    static CCalendarObserver* NewL();   
+    virtual ~CCalendarObserver();
+    
+private:
+    void ConstructL();
+    CCalendarObserver();
+    
+public:    
+    
+    void Progress(TInt aPercentageCompleted);
+    void Completed(TInt aError);
+    TBool NotifyProgress();
+    
+    void AddEntryL();
+    void DeleteEntryL();
+    void AddNoteL( TPtr8 aMemo);
+    void DeleteNoteEntryL();
+    void UpdateNoteEntryL( TPtr8 aOldString, TPtr8 aNewString );
+    
+private:
+    CCalSession* iSession;
+    CCalEntryView* iCalEntryView;
+    CActiveSchedulerWait* iWaiter;
+    HBufC8* iUid;
+};
+
+#endif /* CCALENDAROBSERVER_H_ */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/harvesterplugins/tsrc/harvesterplugintester/inc/cmessagesessionobserver.h	Mon Apr 19 14:40:05 2010 +0300
@@ -0,0 +1,76 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: 
+*
+*/
+
+#ifndef CMESSAGESESSIONOBSERVER_H_
+#define CMESSAGESESSIONOBSERVER_H_
+
+#include <msvapi.h>
+
+class CMessageSessionObserver : public MMsvSessionObserver 
+{
+public:
+    static CMessageSessionObserver* NewL();
+    static CMessageSessionObserver* NewLC();
+    virtual ~CMessageSessionObserver();
+private:
+    void ConstructL();
+    CMessageSessionObserver();
+    /**
+     * callback from MMsvSessionObserver
+     */
+    virtual void HandleSessionEventL(TMsvSessionEvent aEvent, 
+                                         TAny* aArg1, 
+                                         TAny* aArg2, 
+                                         TAny* aArg3);
+};
+
+class MessagingUtils
+{
+public:
+    static TInt CreateMessageL(CMsvSession* aMsgSession, 
+                               const TDesC& aMsgFrom,
+                               const TDesC& aMsgTo,
+                               const TDesC& aMsgBody
+                               );
+    static TInt RemoveEntryL(CMsvSession* aMsgSession,TMsvId aMsgId);
+    
+    static TInt CreateMmsMessageL(CMsvSession* aMsgSession, 
+                                  const TDesC& aMsgFrom,
+                                  const TDesC& aMsgTo,
+                                  const TDesC& aMsgBody);
+    
+    static TInt RemoveMmsEntryL(CMsvSession* aMsgSession,TMsvId aMsgId);
+    
+    static TInt CreateEmailEntryL(CMsvSession* aMsgSession );
+};
+
+class CMessAsyncWaiter: public CActive
+{
+public:    
+     static CMessAsyncWaiter* NewL();
+     virtual ~CMessAsyncWaiter();
+     void StartAndWait();
+     TInt Result() const;
+     void DoCancel();
+     
+private:
+     CMessAsyncWaiter();
+     void RunL();
+     TInt iError;
+};
+ 
+#endif /* CMESSAGESESSIONOBSERVER_H_ */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/harvesterplugins/tsrc/harvesterplugintester/inc/harvesterobserver.h	Mon Apr 19 14:40:05 2010 +0300
@@ -0,0 +1,60 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: 
+*
+*/
+
+#ifndef HARVESTEROBSERVER_H_
+#define HARVESTEROBSERVER_H_
+
+#include <mindexingpluginobserver.h>
+#include "rsearchserversession.h"
+#include <cindexingplugin.h>
+#include "delayedcallback.h"
+
+class CHarvesterObserver: public CBase, public MIndexingService,
+                          public MDelayedCallbackObserver
+    {
+public:
+    //Does not take ownership of aPluginToObserve
+    static CHarvesterObserver* NewL( CIndexingPlugin* aPluginToObserve );
+    static CHarvesterObserver* NewLC( CIndexingPlugin* aPluginToObserve );
+    void ConstructL();
+    ~CHarvesterObserver();
+    
+    void SetWaitTime(TTimeIntervalMicroSeconds32 aTimetoWait);
+    
+    void DelayedCallbackL(TInt aCode);
+    void DelayedError(TInt aErrorCode);
+    
+//from MIndexingService
+    void AddHarvestingQueue(CIndexingPlugin* aPlugin, const TDesC& aQualifiedBaseAppClass, TBool aForceReharvest = EFalse);
+    void RemoveHarvestingQueue(CIndexingPlugin* /*aPlugin*/, const TDesC& /*aQualifiedBaseAppClass*/) {};
+    void HarvestingCompleted(CIndexingPlugin* aPlugin, const TDesC& aQualifiedBaseAppClass, TInt aError);
+
+private:
+    CHarvesterObserver( CIndexingPlugin* aPluginToObserve );
+    
+private:
+    CIndexingPlugin* iObservedPlugin;
+    RSearchServerSession iSearchSession;
+
+public:
+    CActiveSchedulerWait* iWaitForHarvester; //Needed public for finer grained control. 
+    TTimeIntervalMicroSeconds32 iWaitTime;
+    CDelayedCallback* iCallback;
+    };
+
+
+#endif /* HARVESTEROBSERVER_H_ */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/harvesterplugins/tsrc/harvesterplugintester/inc/harvesterplugintester.h	Mon Apr 19 14:40:05 2010 +0300
@@ -0,0 +1,285 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+* 
+* Description: STIF testclass declaration
+*
+*/
+
+#ifndef HARVESTERPLUGINTESTER_H
+#define HARVESTERPLUGINTESTER_H
+
+//  INCLUDES
+#include <stiflogger.h>
+#include <testscripterinternal.h>
+#include <stiftestmodule.h>
+#include <testclassassert.h>
+
+#include <cntdb.h> //For contact test cases
+#include <cntitem.h>
+#include <cntfield.h>
+#include <cntfldst.h>
+
+// CONSTANTS
+//const ?type ?constant_var = ?constant;
+#include "cfileplugin.h"
+
+// MACROS
+//#define ?macro ?macro_def
+#define TEST_CLASS_VERSION_MAJOR 0
+#define TEST_CLASS_VERSION_MINOR 0
+#define TEST_CLASS_VERSION_BUILD 0
+
+// Logging path
+_LIT( KHarvesterPluginTesterLogPath, "\\logs\\testframework\\HarvesterPluginTester\\" ); 
+// Log file
+_LIT( KHarvesterPluginTesterLogFile, "HarvesterPluginTester.txt" ); 
+_LIT( KHarvesterPluginTesterLogFileWithTitle, "HarvesterPluginTester_[%S].txt" );
+
+// FUNCTION PROTOTYPES
+//?type ?function_name(?arg_list);
+
+// FORWARD DECLARATIONS
+//class ?FORWARD_CLASSNAME;
+class CHarvesterPluginTester;
+
+// DATA TYPES
+//enum ?declaration
+//typedef ?declaration
+//extern ?data_type;
+
+// CLASS DECLARATION
+
+/**
+*  CHarvesterPluginTester test class for STIF Test Framework TestScripter.
+*  ?other_description_lines
+*
+*  @lib ?library
+*  @since ?Series60_version
+*/
+NONSHARABLE_CLASS(CHarvesterPluginTester) : public CScriptBase
+    {
+    public:  // Constructors and destructor
+
+        /**
+        * Two-phased constructor.
+        */
+        static CHarvesterPluginTester* NewL( CTestModuleIf& aTestModuleIf );
+
+        /**
+        * Destructor.
+        */
+        virtual ~CHarvesterPluginTester();
+
+    public: // New functions
+
+        /**
+        * ?member_description.
+        * @since ?Series60_version
+        * @param ?arg1 ?description
+        * @return ?description
+        */
+        //?type ?member_function( ?type ?arg1 );
+
+    public: // Functions from base classes
+
+        /**
+        * From CScriptBase Runs a script line.
+        * @since ?Series60_version
+        * @param aItem Script line containing method name and parameters
+        * @return Symbian OS error code
+        */
+        virtual TInt RunMethodL( CStifItemParser& aItem );
+
+    protected:  // New functions
+
+        /**
+        * ?member_description.
+        * @since ?Series60_version
+        * @param ?arg1 ?description
+        * @return ?description
+        */
+        //?type ?member_function( ?type ?arg1 );
+
+    protected:  // Functions from base classes
+
+        /**
+        * From ?base_class ?member_description
+        */
+        //?type ?member_function();
+
+    private:
+
+        /**
+        * C++ default constructor.
+        */
+        CHarvesterPluginTester( CTestModuleIf& aTestModuleIf );
+
+        /**
+        * By default Symbian 2nd phase constructor is private.
+        */
+        void ConstructL();
+
+        // Prohibit copy constructor if not deriving from CBase.
+        // ?classname( const ?classname& );
+        // Prohibit assigment operator if not deriving from CBase.
+        // ?classname& operator=( const ?classname& );
+
+        /**
+        * Frees all resources allocated from test methods.
+        * @since ?Series60_version
+        */
+        void Delete();
+
+        /**
+        * Test methods are listed below. 
+        */
+
+        /**
+        * Example test method.
+        * @since ?Series60_version
+        * @param aItem Script line containing parameters.
+        * @return Symbian OS error code.
+        */
+        virtual TInt TestStartHarvesterL( CStifItemParser& aItem );
+		
+        virtual TInt TestFolderRenamingL( CStifItemParser& aItem );
+		
+        virtual TInt TestFormBaseAppClass( CStifItemParser& aItem );
+		
+		virtual TInt TestDatabasePathL( CStifItemParser& aItem );
+		
+		virtual TInt TestCreateIndexItemL( CStifItemParser& aItem );
+		
+        /**
+         * Message harvester test method.
+         * @since ?Series60_version
+         * @param aItem Script line containing parameters.
+         * @return Symbian OS error code.
+         */
+        virtual TInt TestMessageHarvesterL( CStifItemParser& aItem );
+        
+        /**
+         * Message harvester test method.
+         * @since ?Series60_version
+         * @param aItem Script line containing parameters.
+         * @return Symbian OS error code.
+         */
+        virtual TInt TestMessageHarvesterWithMessageL( CStifItemParser& aItem );
+        
+        /**
+         * Message harvester test method.
+         * @since ?Series60_version
+         * @param aItem Script line containing parameters.
+         * @return Symbian OS error code.
+         */
+        virtual TInt TestMessageHarvesterChangeDriveL( CStifItemParser& aItem );
+        
+        virtual TInt TestStartBookmarksHarvesterL( CStifItemParser& aItem );
+        
+        virtual TInt TestAddBookmarkL( CStifItemParser& aItem );
+        
+        virtual TInt TestAddGetDomainL( CStifItemParser& aItem );
+        
+        TInt SearchForTextL(const TDesC& aText, const TDesC& aBaseAppclass,const TDesC& aDefaultField);
+        
+        /*** Start of Applications plugin tests ***/
+        virtual TInt TestStartApplicationsHarvesterL( CStifItemParser& aItem );
+        virtual TInt TestCreateApplicationsIndexItemL( CStifItemParser& aItem );
+        /*** End of Applications plugin tests   ***/
+		
+        /*** Start of Notes plugin tests ***/
+        virtual TInt TestStartNotesHarvesterL( CStifItemParser& aItem );
+        virtual TInt TestAddNoteL( CStifItemParser& aItem );
+        virtual TInt TestAddLongNoteL( CStifItemParser& aItem );
+        virtual TInt TestAddAlphaNumericNoteL( CStifItemParser& aItem );
+        TInt PerformNotesTestL( TPtrC aString1 , TPtrC aString2 );
+        virtual TInt TestDeleteNoteL( CStifItemParser& aItem);
+        virtual TInt TestUpdateNoteL( CStifItemParser& aItem );
+        /*** End of Notes plugin tests   ***/
+        
+        virtual TInt TestStartContactsHarvesterL( CStifItemParser& aItem );
+                        
+        TContactItemId CreateNewContactL(CContactDatabase& database,const TDesC& aName,const TDesC& aPhoneNumber);
+                        
+        virtual TInt TestCreateContactIndexItemL( CStifItemParser& aItem );
+        
+        virtual TInt TestCreateContactGroupL( CStifItemParser& aItem );
+        
+        virtual TInt TestStartCalenderHarvesterL( CStifItemParser& aItem );
+                
+        virtual TInt TestCalenderEntryL( CStifItemParser& aItem );        
+        
+        virtual TInt TestCreateMmsL( CStifItemParser& aItem );
+        
+        virtual TInt TestCreateEmailL( CStifItemParser& aItem );
+		
+		virtual TInt TestAudioHarvestingL( CStifItemParser& aItem );
+		
+		virtual TInt TestMdsSyncControllerL( CStifItemParser& aItem );
+		
+		virtual TInt TestBlacklistPluginL( CStifItemParser& aItem );
+		
+		virtual TInt TestBlacklistPluginVersionL( CStifItemParser& aItem );
+		
+		virtual TInt TestVideoHarvestingIndexL( CStifItemParser& aItem );
+
+        virtual TInt TestVideoHarvestingUpdateIndexL( CStifItemParser& aItem );
+		
+		virtual TInt TestVideoHarvestingDeleteIndexL( CStifItemParser& aItem );
+		
+		virtual TInt TestImageHarvestingAddIndexL( CStifItemParser& aItem );
+		
+		virtual TInt TestImageHarvestingUpdateIndexL( CStifItemParser& aItem );
+		
+		virtual TInt TestImageHarvestingDeleteIndexL( CStifItemParser& aItem );
+		
+		virtual TInt TestAudioMMCEventL( CStifItemParser& aItem );
+		
+		virtual TInt TestVideoMMCEventL( CStifItemParser& aItem );
+		
+		virtual TInt TestImageMMCEventL( CStifItemParser& aItem );
+        /**
+         * Method used to log version of test class
+         */
+        void SendTestClassVersion();
+
+        //ADD NEW METHOD DEC HERE
+        //[TestMethods] - Do not remove
+
+    public:     // Data
+        // ?one_line_short_description_of_data
+        //?data_declaration;
+
+    protected:  // Data
+        // ?one_line_short_description_of_data
+        //?data_declaration;
+
+    private:    // Data
+        // ?one_line_short_description_of_data
+        //?data_declaration;
+
+        // Reserved pointer for future extension
+        //TAny* iReserved;
+
+    public:     // Friend classes
+        //?friend_class_declaration;
+    protected:  // Friend classes
+        //?friend_class_declaration;
+    private:    // Friend classes
+        //?friend_class_declaration;
+
+    };
+
+#endif      // HARVESTERPLUGINTESTER_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/harvesterplugins/tsrc/harvesterplugintester/sis/cpixstiftest.pkg	Mon Apr 19 14:40:05 2010 +0300
@@ -0,0 +1,73 @@
+;
+; Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+; All rights reserved.
+; This component and the accompanying materials are made available
+; under the terms of "Eclipse Public License v1.0"
+; which accompanies this distribution, and is available
+; at the URL "http://www.eclipse.org/legal/epl-v10.html".
+;
+; Initial Contributors:
+; Nokia Corporation - initial contribution.
+;
+; Contributors:
+;
+; Description: 
+;
+; Installation file for Search application
+;
+; This is an auto-generated PKG file by Carbide.
+; This file uses variables specific to Carbide builds that will not work
+; on command-line builds. If you want to use this generated PKG file from the
+; command-line tools you will need to modify the variables with the appropriate
+; values: \, $(PLATFORM), UDEB
+;
+;Languages
+&EN
+
+;
+; UID is the app's UID
+;
+; Provide value for uid
+#{"STIF"},(0x00000000),1,1,0,TYPE=SA
+
+; Series60 product id for S60 3.0
+[0x101F7961], 0, 0, 0, {"Series60ProductID"}
+
+; Vendor names
+%{"Nokia-EN"}
+:"Nokia"
+
+; Files to install
+; Symbols set up for the source location are Carbide.c++ specific symbols
+
+; Capsmod.exe for modifying stif capability at runtime
+; Commented out as it can not be installed
+;"\epoc32\release\armv5\udeb\capsmod.exe" - "c:\sys\bin\capsmod.exe"
+
+; Harvesterplugin tester DLL
+;"\epoc32\release\armv5\udeb\HarvesterPluginTester.dll" - "c:\sys\bin\HarvesterPluginTester.dll"
+
+; CPiX STIF test data
+
+"\epoc32\data\z\ids\HarvesterPluginTester.cfg"
+-"c:\TestFramework\HarvesterPluginTester.cfg"
+
+"\epoc32\data\z\ids\Notestest.txt"
+-"c:\TestFramework\Notestest.txt"
+
+"\epoc32\data\z\ids\NotesAlphanumerictest.txt"
+-"c:\TestFramework\NotesAlphanumerictest.txt"
+
+"\epoc32\data\z\ids\NotesLongtest.txt"
+-"c:\TestFramework\NotesLongtest.txt"
+
+"\epoc32\data\z\ids\TestAttachment.txt"
+-"c:\TestFramework\TestAttachment.txt"
+
+"\epoc32\data\z\ids\Eagle_Landed.mp3"
+-"c:\data\Eagle_Landed.mp3"
+
+"\epoc32\data\z\ids\Niagara.wmv"
+-"c:\data\Niagara.wmv"
+
+;End test data
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/harvesterplugins/tsrc/harvesterplugintester/src/capsmod_exe/group/bld.inf	Mon Apr 19 14:40:05 2010 +0300
@@ -0,0 +1,36 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: bld.inf Toplevel build information for STIF Test Framework's
+                capsmod capability modifier module
+*/
+
+
+PRJ_PLATFORMS
+// Specify the platforms your component needs to be built for here.
+// If not specified all platforms can be built.
+
+DEFAULT
+
+PRJ_EXPORTS
+
+PRJ_TESTEXPORTS
+
+PRJ_MMPFILES
+capsmod_exe_nrm.mmp
+
+PRJ_TESTMMPFILES
+capsmod_exe.mmp
+
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/harvesterplugins/tsrc/harvesterplugintester/src/capsmod_exe/group/capsmod_exe.mmp	Mon Apr 19 14:40:05 2010 +0300
@@ -0,0 +1,63 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: 
+*
+*
+*/
+
+
+#include   <platform_paths.hrh>
+
+TARGET          capsmod.exe
+TARGETTYPE      exe
+
+/* Specify the capabilities according to your test environment */
+CAPABILITY        CAP_GENERAL_DLL DiskAdmin -AllFiles -DRM
+
+/* Remove comments and replace 0x00000000 with correct vendor id */
+// VENDORID     0x00000000
+/* Remove comments and replace 0x00000000 with correct secure id */
+// SECUREID     0x00000000
+
+#ifdef SBSV2
+	#if defined(__S60_)
+	    OSEXT_LAYER_SYSTEMINCLUDE
+	#else // __S60_ not defined
+	    SYSTEMINCLUDE   /epoc32/include 
+	    SYSTEMINCLUDE   /epoc32/include/internal
+	#endif // __S60_
+
+	/* Source files */
+	SOURCEPATH      ../src
+#else // SBSV2 not defined
+	#if defined(__S60_)
+	    MW_LAYER_SYSTEMINCLUDE
+	#else // __S60_ not defined
+	    SYSTEMINCLUDE   /epoc32/include 
+	    SYSTEMINCLUDE   /epoc32/include/internal
+	#endif // __S60_
+
+	/* Source files */
+	SOURCEPATH      ../src
+#endif // SBSV2
+
+SOURCE          capsmod_exe.cpp
+
+/* Used libraries */
+LIBRARY         euser.lib
+LIBRARY         stiftestinterface.lib
+
+EPOCSTACKSIZE   40960
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/harvesterplugins/tsrc/harvesterplugintester/src/capsmod_exe/group/capsmod_exe_nrm.mmp	Mon Apr 19 14:40:05 2010 +0300
@@ -0,0 +1,63 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: 
+*
+*
+*/
+
+
+#include   <platform_paths.hrh>
+
+TARGET          capsmod.exe
+TARGETTYPE      exe
+
+/* Specify the capabilities according to your test environment */
+CAPABILITY        CAP_GENERAL_DLL DiskAdmin -AllFiles -DRM
+
+/* Remove comments and replace 0x00000000 with correct vendor id */
+// VENDORID     0x00000000
+/* Remove comments and replace 0x00000000 with correct secure id */
+// SECUREID     0x00000000
+
+#ifdef SBSV2
+	#if defined(__S60_)
+	    OSEXT_LAYER_SYSTEMINCLUDE
+	#else // __S60_ not defined
+	    SYSTEMINCLUDE   /epoc32/include 
+	    SYSTEMINCLUDE   /epoc32/include/internal
+	#endif // __S60_
+
+	/* Source files */
+	SOURCEPATH      ../src
+#else // SBSV2 not defined
+	#if defined(__S60_)
+	    MW_LAYER_SYSTEMINCLUDE
+	#else // __S60_ not defined
+	    SYSTEMINCLUDE   /epoc32/include 
+	    SYSTEMINCLUDE   /epoc32/include/internal
+	#endif // __S60_
+
+	/* Source files */
+SOURCEPATH      ../src
+#endif // SBSV2
+
+SOURCE          capsmod_exe.cpp
+
+/* Used libraries */
+LIBRARY         euser.lib
+LIBRARY         stiftestinterface.lib
+
+EPOCSTACKSIZE   40960
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/harvesterplugins/tsrc/harvesterplugintester/src/capsmod_exe/src/capsmod_exe.cpp	Mon Apr 19 14:40:05 2010 +0300
@@ -0,0 +1,66 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: 
+*
+*
+*/
+
+
+// INCLUDE FILES
+#include <e32base.h>
+#include <e32svr.h>
+#include <stiftestinterface.h>
+// EXTERNAL DATA STRUCTURES
+
+// EXTERNAL FUNCTION PROTOTYPES  
+
+// ================= OTHER EXPORTED FUNCTIONS =================================
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: -
+
+    Method: E32Main
+
+    Description: 
+
+    Parameters: None
+
+    Return Values: TInt: Symbian error code
+
+    Errors/Exceptions: None
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+GLDEF_C TInt E32Main()
+    {
+    _LIT( KProcessMsgStart, "New process starting" );
+    RDebug::Print( KProcessMsgStart );
+
+
+    // This starts a new session that get capabilites that is used in 
+    // capsmod_exe.mmp file.
+    TInt r = StartSession();
+
+    _LIT( KProcessMsgEnd, "New process ends" );
+    RDebug::Print( KProcessMsgEnd );
+
+    return r;
+
+    }
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/harvesterplugins/tsrc/harvesterplugintester/src/ccalanderobserver.cpp	Mon Apr 19 14:40:05 2010 +0300
@@ -0,0 +1,205 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: 
+*
+*/
+
+
+#include "ccalendarobserver.h"
+
+
+CCalendarObserver* CCalendarObserver::NewL()
+    {
+    CCalendarObserver* self= new (ELeave) CCalendarObserver();
+    CleanupStack::PushL(self);
+    self->ConstructL();
+    CleanupStack::Pop(); 
+    return self;
+    }
+
+void CCalendarObserver::ConstructL()
+    {
+    iSession = CCalSession::NewL();    
+    /*_LIT(KFileName,"calendarfile");
+    TRAPD(err, session->CreateCalFileL(KFileName));
+    // ignore KErrAlreadyExists leave code
+    if (err != KErrAlreadyExists)
+        {
+        User::LeaveIfError(err);
+        }*/
+    // Open the calendar file
+    iSession->OpenL(iSession->DefaultFileNameL());
+    iWaiter = new (ELeave) CActiveSchedulerWait();
+    iCalEntryView = CCalEntryView::NewL(*iSession, *this);
+    iWaiter->Start();
+    }
+
+CCalendarObserver::CCalendarObserver()
+    {    
+    }
+
+CCalendarObserver::~CCalendarObserver()
+    {
+    
+    delete iCalEntryView;
+    delete iSession;    
+    delete iWaiter;
+    }
+
+void DestroyRPointerArray(TAny* aPtr)
+    {
+    RPointerArray<CCalEntry>* self = static_cast<RPointerArray<CCalEntry>*> (aPtr);
+    self->ResetAndDestroy();
+    }
+
+void CCalendarObserver::AddEntryL()
+    {
+    _LIT(KDescription,"Meeting is scheduled in 1st week of January");
+    const TDesC8& guidDes = KGuid;
+    iUid = guidDes.AllocL();        
+    CCalEntry* entry = CCalEntry::NewL(CCalEntry::EAppt, iUid, CCalEntry::EMethodNone, 0);    
+    CleanupStack::PushL(entry);
+            
+    // For an appointment, the time as well as the date is relevant
+    TDateTime startTime(2010, EJanuary, 04, 10, 0, 0, 0);
+    TDateTime endTime(2010, EJanuary, 05, 16, 0, 0, 0);
+    
+    TCalTime calstart;
+    TCalTime calstop;
+    calstart.SetTimeLocalL(startTime);
+    calstop.SetTimeLocalL(endTime);    
+    entry->SetStartAndEndTimeL(calstart, calstop); 
+    // Set the description text
+    entry->SetDescriptionL(KDescription);
+    
+    RPointerArray<CCalEntry> array;    
+    CleanupClosePushL(array);
+    array.AppendL(entry);
+    
+    TInt numEntriesAdded = 0;
+    iCalEntryView->StoreL(array, numEntriesAdded);    
+
+    CleanupStack::PopAndDestroy(&array);    
+    CleanupStack::PopAndDestroy(entry);    
+    }
+
+void CCalendarObserver::AddNoteL( TPtr8 aMemo)
+    {	
+    const TDesC8& guidDes = KGuid;
+    iUid = guidDes.AllocL();        
+    CCalEntry* entry = CCalEntry::NewL(CCalEntry::ENote, iUid, CCalEntry::EMethodNone, 0);    
+    CleanupStack::PushL(entry);    
+    
+    HBufC16* buf16 = HBufC16::NewL(aMemo.Length());
+    buf16->Des().Copy(aMemo);
+
+    // Set the description text
+    entry->SetDescriptionL(buf16->Des());
+    
+    RPointerArray<CCalEntry> array;    
+    CleanupClosePushL(array);
+    array.AppendL(entry);
+    
+    TInt numEntriesAdded = 0;
+    iCalEntryView->StoreL(array, numEntriesAdded);    
+    
+    delete buf16;
+    CleanupStack::PopAndDestroy(&array);    
+    CleanupStack::PopAndDestroy(entry);
+    }
+
+void CCalendarObserver::DeleteEntryL()
+    {
+   
+    RPointerArray<CCalEntry> entryarray; 
+    CleanupStack::PushL(TCleanupItem(DestroyRPointerArray, &entryarray));       
+    
+    //Fetch the entry to be deleted and delete it
+    iCalEntryView->FetchL(KGuid,entryarray);
+    CCalEntry* entry = entryarray[0];
+    
+    iCalEntryView->DeleteL(*entry);
+    CleanupStack::PopAndDestroy(&entryarray);
+    
+    }
+
+void CCalendarObserver::DeleteNoteEntryL()
+    {
+    RPointerArray<CCalEntry> entryarray; 
+    CleanupStack::PushL(TCleanupItem(DestroyRPointerArray, &entryarray));       
+    
+    //Fetch the entry to be deleted and delete it
+    iCalEntryView->FetchL(KGuid,entryarray);    
+    for( int i = 0; i < entryarray.Count(); i++)
+        {
+        CCalEntry* entry = entryarray[i];
+        if ( entry->EntryTypeL() == CCalEntry::ENote )
+            {
+            iCalEntryView->DeleteL(*entry);
+            break;
+            }
+        }
+    CleanupStack::PopAndDestroy(&entryarray);
+    }
+
+void CCalendarObserver::UpdateNoteEntryL( TPtr8 aOldString, TPtr8 aNewString )
+    {
+    RPointerArray<CCalEntry> entryarray; 
+    CleanupStack::PushL(TCleanupItem(DestroyRPointerArray, &entryarray));       
+    HBufC16* buf16 = HBufC16::NewL(aOldString.Length());
+    buf16->Des().Copy(aOldString);
+    HBufC16* newbuf16 = HBufC16::NewL(aNewString.Length());
+    newbuf16->Des().Copy(aNewString);
+    TBuf<32> oldstring;
+    oldstring.Copy( buf16->Des() );
+    //Fetch the entry to be deleted and delete it
+    iCalEntryView->FetchL(KGuid,entryarray);    
+    for( int i = 0; i < entryarray.Count(); i++)
+        {
+        CCalEntry* entry = entryarray[i];
+        if ( entry->EntryTypeL() == CCalEntry::ENote )
+            {
+            if ( entry->DescriptionL().Compare ( oldstring ) == 0)            
+                {
+                TBuf<32> newstring;
+                newstring.Copy(newbuf16->Des());
+                entry->SetDescriptionL( newstring);
+                break;
+                }
+            }
+        }
+    delete buf16;
+    delete newbuf16;
+    TInt numEntriesAdded = 0;
+    iCalEntryView->StoreL(entryarray, numEntriesAdded);    
+    CleanupStack::PopAndDestroy(&entryarray);
+    }
+
+// Called during calendar entry view creation
+void CCalendarObserver::Progress(TInt /*aProgress*/)
+    {    
+    }
+
+// Called on completion of calendar entry view creation
+void CCalendarObserver::Completed(TInt /*aError*/)
+    {
+     iWaiter->AsyncStop();
+    }
+
+// Returns whether or not progress notification is required
+TBool CCalendarObserver::NotifyProgress()
+    {
+        // Progress notification is required
+        return ETrue;
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/harvesterplugins/tsrc/harvesterplugintester/src/cmessagesessionobserver.cpp	Mon Apr 19 14:40:05 2010 +0300
@@ -0,0 +1,291 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: 
+*
+*/
+
+#include "cmessagesessionobserver.h"
+#include <mtclreg.h>
+#include <smsclnt.h>
+#include <txtrich.h>
+#include <mmsclient.h>
+#include <cmsvmimeheaders.h>
+#include <cmsvattachment.h>
+#include <smtcmtm.h>
+
+
+CMessageSessionObserver* CMessageSessionObserver::NewL()
+    {
+    CMessageSessionObserver* self = CMessageSessionObserver::NewLC();
+    CleanupStack::Pop();
+    return self;
+    }
+
+CMessageSessionObserver* CMessageSessionObserver::NewLC()
+    {
+    CMessageSessionObserver* self = new (ELeave) CMessageSessionObserver();
+    CleanupStack::PushL(self);
+    self->ConstructL();
+    return self;
+    }
+
+void CMessageSessionObserver::ConstructL()
+    {
+    }
+
+CMessageSessionObserver::CMessageSessionObserver()
+    {
+    
+    }
+
+CMessageSessionObserver::~CMessageSessionObserver()
+    {
+    
+    }
+
+void CMessageSessionObserver::HandleSessionEventL(TMsvSessionEvent /*aEvent*/, 
+                                                  TAny* /*aArg1*/, TAny* /*aArg2*/, TAny* /*aArg3*/)
+    {
+    //Dummy implementation    
+    }
+
+CMessAsyncWaiter* CMessAsyncWaiter::NewL()
+    {
+    CMessAsyncWaiter* self = new(ELeave) CMessAsyncWaiter();
+    return self;
+    }
+
+//Adds the active object to the scheduler
+CMessAsyncWaiter::CMessAsyncWaiter() : CActive(EPriorityStandard)
+    {
+    CActiveScheduler::Add(this);
+    }
+
+CMessAsyncWaiter::~CMessAsyncWaiter()
+    {
+    Cancel();
+    }    
+
+//Indicates that the active object has issued a request and that it is now outstanding
+void CMessAsyncWaiter::StartAndWait()
+    {
+    SetActive();
+    CActiveScheduler::Start();
+    }  
+
+TInt CMessAsyncWaiter::Result() const
+    {
+    return iError;
+    }
+    
+/**
+Handles an active object’s request completion event.
+It sets to run the desired task.
+*/ 
+void CMessAsyncWaiter::RunL()
+    {
+    iError = iStatus.Int();
+    CActiveScheduler::Stop();
+    }
+
+//Implements cancellation of an outstanding request,called as part of the active object's Cancel()
+void CMessAsyncWaiter::DoCancel()
+    {
+    iError = KErrCancel;
+    CActiveScheduler::Stop();
+    }
+
+TInt MessagingUtils::CreateMessageL(CMsvSession* aMsgSession, const TDesC& aMsgFrom,
+                                    const TDesC& aMsgTo,const TDesC& aMsgBody)
+    {
+    CClientMtmRegistry* mtmReg = CClientMtmRegistry::NewL( *aMsgSession );
+    CSmsClientMtm* smsMtm = static_cast<CSmsClientMtm*>( mtmReg->NewMtmL( KUidMsgTypeSMS )); 
+    smsMtm->SwitchCurrentEntryL( KMsvGlobalInBoxIndexEntryId );
+    smsMtm->CreateMessageL( KUidMsgTypeSMS.iUid );
+    TMsvId newMsgId = smsMtm->Entry().EntryId();
+    smsMtm->AddAddresseeL( aMsgTo ); //to address if need
+    CMsvStore* messageStore = smsMtm->Entry().EditStoreL();
+    CleanupStack::PushL( messageStore );
+    CSmsHeader& header = smsMtm->SmsHeader();
+    header.SetFromAddressL(aMsgFrom);
+    header.StoreL( *messageStore );
+    CleanupStack::PopAndDestroy( messageStore );
+    CRichText& body = smsMtm->Body();
+    body.Reset();
+    // Put 16bits stream stored in 8bits buffer back to 16bits buffer.
+    body.InsertL( 0, aMsgBody);
+    TMsvEntry entry = smsMtm->Entry().Entry();
+    entry.SetInPreparation( EFalse );
+    entry.SetVisible( ETrue );
+    entry.iDate.HomeTime();
+    entry.iDetails.Set(aMsgFrom);
+    entry.SetUnread( EFalse );
+    smsMtm->Entry().ChangeL( entry );
+    smsMtm->SaveMessageL(); 
+    delete smsMtm;
+    delete mtmReg;
+    return newMsgId;
+    }
+
+TInt MessagingUtils::RemoveEntryL(CMsvSession* aMsgSession,TMsvId aMsgId)
+    {
+    aMsgSession->RemoveEntry(aMsgId);
+    return KErrNone;
+    }
+
+TInt MessagingUtils::CreateMmsMessageL(CMsvSession* aMsgSession, const TDesC& aMsgFrom,
+                                        const TDesC& aMsgTo,const TDesC& afilename)
+    {
+    _LIT(KMessageSubject, "MMS Test");
+    CClientMtmRegistry* mtmReg = CClientMtmRegistry::NewL( *aMsgSession );
+    CMmsClientMtm* iMmsClient = static_cast<CMmsClientMtm*>( mtmReg->NewMtmL( KUidMsgTypeMultimedia ));
+    
+    iMmsClient->SwitchCurrentEntryL( KMsvGlobalInBoxIndexEntryId );
+    iMmsClient->CreateMessageL( KUidMsgTypeMultimedia.iUid );
+    TMsvId newMsgId = iMmsClient->Entry().EntryId();
+    iMmsClient->AddAddresseeL( aMsgTo ); //to address if need    
+    iMmsClient->SetSubjectL(KMessageSubject);
+
+    CMsvStore* store = iMmsClient->Entry().EditStoreL();
+    CleanupStack::PushL( store );    
+    
+    CMsvAttachment* attaInfo = NULL;
+    TMsvAttachmentId attaId = KMsvNullIndexEntryId;    
+    
+    RFs iFSsession;
+    iFSsession.Connect();
+    RFile testfile;
+    
+    CMsvMimeHeaders* mimeHeaders = CMsvMimeHeaders::NewL();
+    CleanupStack::PushL( mimeHeaders );    
+   
+    mimeHeaders->SetContentTypeL( _L8("text") );
+    mimeHeaders->SetContentSubTypeL( _L8("plain") );
+    mimeHeaders->SetMimeCharset( KMmsUtf8 );
+    mimeHeaders->SetSuggestedFilenameL( _L("body.txt") );
+
+    _LIT8(KMimeType, "text/plain");
+    TBufC8<10> mimeType(KMimeType);
+    // CreateAttachment2L will set the content type to attachment Info
+    TInt error = testfile.Open(iFSsession, afilename ,EFileShareReadersOnly | EFileRead);
+    
+    CleanupClosePushL(testfile);
+    
+    attaInfo = CMsvAttachment::NewL(CMsvAttachment::EMsvFile);
+    // attaInfo ownerhip will be transferred to Attachment Manager
+    // It must not be pushed onto the cleanupStack before calling CreateAttachment2L
+
+    iMmsClient->CreateAttachment2L(
+                *store,   // edit store
+                testfile, // open file handle
+                mimeType, 
+                *mimeHeaders,
+                attaInfo,
+                attaId);
+    // Now Attachment Manager owns the attaInfo
+    attaInfo = NULL;
+
+    CleanupStack::PopAndDestroy(); // testfile.Close()
+    CleanupStack::PopAndDestroy(); // mimeHeaders
+    
+    store->CommitL();
+    CleanupStack::PopAndDestroy(); // store
+    
+    TMsvEntry entry = iMmsClient->Entry().Entry();
+    
+    entry.SetInPreparation( EFalse );
+    entry.SetVisible( ETrue );
+    entry.iDate.HomeTime();
+    entry.iDetails.Set(aMsgFrom);
+    entry.SetUnread( EFalse );
+    iMmsClient->Entry().ChangeL( entry );
+    iMmsClient->SaveMessageL();
+    
+    delete iMmsClient;
+    delete mtmReg;
+    return newMsgId;
+    }
+
+TInt MessagingUtils::RemoveMmsEntryL(CMsvSession* aMsgSession,TMsvId aMsgId)
+    {
+    CMsvEntry* cEntry = aMsgSession->GetEntryL( aMsgId );
+    CleanupStack::PushL( cEntry );
+    cEntry->SetEntryL( cEntry->Entry().Parent() );
+    cEntry->DeleteL( aMsgId );
+    CleanupStack::PopAndDestroy();
+    return KErrNone;
+    }
+
+TInt MessagingUtils::CreateEmailEntryL(CMsvSession* aMsgSession)
+    {
+    _LIT8(KFrom, "test@email.in");
+    _LIT(KSubject, "SampleEmail");
+    _LIT(KBodyContents, "This is a Email entry");
+    CClientMtmRegistry* mtmReg = CClientMtmRegistry::NewL( *aMsgSession );
+    CSmtpClientMtm* iSmtpClient = static_cast<CSmtpClientMtm*>( mtmReg->NewMtmL( KUidMsgTypeSMTP ));
+    
+    TMsvId outboxId = KMsvGlobalOutBoxIndexEntryId; 
+            
+    // Set the context to the folder in which message has to be created
+    CMsvEntry*  entry = CMsvEntry::NewL(*aMsgSession,outboxId,TMsvSelectionOrdering());
+    CleanupStack::PushL(entry);
+    entry->SetEntryL(outboxId);
+    
+    CMessAsyncWaiter* waiter = CMessAsyncWaiter::NewL();
+    CleanupStack::PushL(waiter);
+        
+    TMsvEmailTypeList msvEmailTypeList = 0;
+    TMsvPartList partList = (KMsvMessagePartBody | KMsvMessagePartAttachments);
+        
+    CImEmailOperation* emailOperation = CImEmailOperation::CreateNewL(waiter->iStatus, *aMsgSession, KMsvGlobalOutBoxIndexEntryId, partList, msvEmailTypeList, KUidMsgTypeSMTP);
+    CleanupStack::PushL(emailOperation);
+    waiter->StartAndWait();
+        
+    TMsvId temp;
+    TPckgC<TMsvId> paramPack(temp);
+    const TDesC8& progBuf = emailOperation->ProgressL();
+    paramPack.Set(progBuf);
+    TMsvId newMsgId;
+    newMsgId = paramPack();    
+    entry->SetEntryL(newMsgId);
+
+    CMsvStore* store = entry->EditStoreL();
+    CleanupStack::PushL(store);
+    CImHeader* emailEntry = CImHeader::NewLC();
+    //emailEntry->RestoreL(*store);
+    emailEntry->SetFromL((TDesC8&)KFrom);
+    emailEntry->SetSubjectL((TDesC&)KSubject);
+        
+    // Paragraph format layer for the rich text object 
+    CParaFormatLayer* paraFormatLayer = CParaFormatLayer::NewL();
+    CleanupStack::PushL(paraFormatLayer);
+    // Character format layer for the rich text object
+    CCharFormatLayer* charFormatLayer = CCharFormatLayer::NewL(); 
+    CleanupStack::PushL(charFormatLayer);
+    CRichText* bodyText = CRichText::NewL(paraFormatLayer, charFormatLayer, CEditableText::EFlatStorage, 256);
+    CleanupStack::PushL(bodyText);
+    // Inserts the contents of a buffer into the document at specified position
+    bodyText->InsertL(0, KBodyContents);
+    store->StoreBodyTextL(*bodyText);
+    emailEntry->StoreL(*store);
+    // Store the changes permanently
+    store->CommitL();
+    CleanupStack::PopAndDestroy(8,entry);
+    
+ 
+    delete iSmtpClient;
+    delete mtmReg;
+    return newMsgId;
+    }
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/harvesterplugins/tsrc/harvesterplugintester/src/harvesterobserver.cpp	Mon Apr 19 14:40:05 2010 +0300
@@ -0,0 +1,87 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: 
+*
+*/
+
+#include "harvesterobserver.h"
+
+CHarvesterObserver* CHarvesterObserver::NewL( CIndexingPlugin* aPluginToObserve )
+    {
+    __ASSERT_ALWAYS( aPluginToObserve, User::Leave( KErrArgument ) );
+    CHarvesterObserver* observer = CHarvesterObserver::NewLC( aPluginToObserve );
+    CleanupStack::Pop( observer );
+    return observer;
+    }
+
+CHarvesterObserver* CHarvesterObserver::NewLC( CIndexingPlugin* aPluginToObserve )
+    {
+    CHarvesterObserver* observer = new ( ELeave ) CHarvesterObserver( aPluginToObserve );
+    CleanupStack::PushL( observer );
+    observer->ConstructL();
+    return observer;
+    }
+
+void CHarvesterObserver::ConstructL()
+    {
+    iWaitForHarvester = new (ELeave) CActiveSchedulerWait;
+    User::LeaveIfError( iSearchSession.Connect() );
+    iObservedPlugin->SetSearchSession( iSearchSession );
+    iObservedPlugin->SetObserver( *this );
+    iWaitTime = TTimeIntervalMicroSeconds32(0); //Zero initially
+    iCallback = CDelayedCallback::NewL(CActive::EPriorityIdle);
+    }
+
+void CHarvesterObserver::SetWaitTime(TTimeIntervalMicroSeconds32 aTimetoWait)
+    {
+    iWaitTime = aTimetoWait;
+    }
+CHarvesterObserver::CHarvesterObserver( CIndexingPlugin* aPluginToObserve )
+    {
+    iObservedPlugin = aPluginToObserve;
+    };
+
+CHarvesterObserver::~CHarvesterObserver()
+    {
+    delete iWaitForHarvester;
+    iSearchSession.Close();
+	delete iCallback;
+    }
+
+void CHarvesterObserver::HarvestingCompleted( CIndexingPlugin* /*aPlugin*/, const TDesC& /*aQualifiedBaseAppClass*/, TInt /*aError*/)
+    {
+    if(iWaitTime > TTimeIntervalMicroSeconds32(0)) //harvesters requested to wait so wait before completion
+        {
+        iCallback->Start( 0, this, iWaitTime.Int()); //Stop wait AO in callback
+        }
+    else
+        {
+        //Stop WAIT AO here
+        iWaitForHarvester->AsyncStop();
+        }
+    }
+
+void CHarvesterObserver::DelayedCallbackL(TInt aCode)
+    {
+    iWaitForHarvester->AsyncStop();
+    }
+    
+void CHarvesterObserver::DelayedError(TInt aErrorCode)
+    {
+    iWaitForHarvester->AsyncStop();
+    }
+
+void CHarvesterObserver::AddHarvestingQueue(CIndexingPlugin* /*aPlugin*/, const TDesC& /*aQualifiedBaseAppClass*/,TBool aForceReharvest)
+    {
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/harvesterplugins/tsrc/harvesterplugintester/src/harvesterplugintester.cpp	Mon Apr 19 14:40:05 2010 +0300
@@ -0,0 +1,199 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+* 
+* Description: This file contains testclass implementation.
+*
+*/
+
+// INCLUDE FILES
+#include <stiftestinterface.h>
+#include "harvesterplugintester.h"
+#include <settingserverclient.h>
+
+// EXTERNAL DATA STRUCTURES
+//extern  ?external_data;
+
+// EXTERNAL FUNCTION PROTOTYPES  
+//extern ?external_function( ?arg_type,?arg_type );
+
+// CONSTANTS
+//const ?type ?constant_var = ?constant;
+
+// MACROS
+//#define ?macro ?macro_def
+
+// LOCAL CONSTANTS AND MACROS
+//const ?type ?constant_var = ?constant;
+//#define ?macro_name ?macro_def
+
+// MODULE DATA STRUCTURES
+//enum ?declaration
+//typedef ?declaration
+
+// LOCAL FUNCTION PROTOTYPES
+//?type ?function_name( ?arg_type, ?arg_type );
+
+// FORWARD DECLARATIONS
+//class ?FORWARD_CLASSNAME;
+
+// ============================= LOCAL FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// ?function_name ?description.
+// ?description
+// Returns: ?value_1: ?description
+//          ?value_n: ?description_line1
+//                    ?description_line2
+// -----------------------------------------------------------------------------
+//
+/*
+?type ?function_name(
+    ?arg_type arg,  // ?description
+    ?arg_type arg)  // ?description
+    {
+
+    ?code  // ?comment
+
+    // ?comment
+    ?code
+    }
+*/
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CHarvesterPluginTester::CHarvesterPluginTester
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+CHarvesterPluginTester::CHarvesterPluginTester( 
+    CTestModuleIf& aTestModuleIf ):
+        CScriptBase( aTestModuleIf )
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// CHarvesterPluginTester::ConstructL
+// Symbian 2nd phase constructor can leave.
+// -----------------------------------------------------------------------------
+//
+void CHarvesterPluginTester::ConstructL()
+    {
+    //Read logger settings to check whether test case name is to be
+    //appended to log file name.
+    RSettingServer settingServer;
+    TInt ret = settingServer.Connect();
+    if(ret != KErrNone)
+        {
+        User::Leave(ret);
+        }
+    // Struct to StifLogger settigs.
+    TLoggerSettings loggerSettings; 
+    // Parse StifLogger defaults from STIF initialization file.
+    ret = settingServer.GetLoggerSettings(loggerSettings);
+    if(ret != KErrNone)
+        {
+        User::Leave(ret);
+        } 
+    // Close Setting server session
+    settingServer.Close();
+
+    TFileName logFileName;
+    
+    if(loggerSettings.iAddTestCaseTitle)
+        {
+        TName title;
+        TestModuleIf().GetTestCaseTitleL(title);
+        logFileName.Format(KHarvesterPluginTesterLogFileWithTitle, &title);
+        }
+    else
+        {
+        logFileName.Copy(KHarvesterPluginTesterLogFile);
+        }
+
+    iLog = CStifLogger::NewL( KHarvesterPluginTesterLogPath, 
+                          logFileName,
+                          CStifLogger::ETxt,
+                          CStifLogger::EFile,
+                          EFalse );
+    
+    SendTestClassVersion();
+    }
+
+// -----------------------------------------------------------------------------
+// CHarvesterPluginTester::NewL
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+CHarvesterPluginTester* CHarvesterPluginTester::NewL( 
+    CTestModuleIf& aTestModuleIf )
+    {
+    CHarvesterPluginTester* self = new (ELeave) CHarvesterPluginTester( aTestModuleIf );
+
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop();
+
+    return self;
+
+    }
+
+// Destructor
+CHarvesterPluginTester::~CHarvesterPluginTester()
+    { 
+
+    // Delete resources allocated from test methods
+    Delete();
+
+    // Delete logger
+    delete iLog; 
+
+    }
+
+//-----------------------------------------------------------------------------
+// CHarvesterPluginTester::SendTestClassVersion
+// Method used to send version of test class
+//-----------------------------------------------------------------------------
+//
+void CHarvesterPluginTester::SendTestClassVersion()
+	{
+	TVersion moduleVersion;
+	moduleVersion.iMajor = TEST_CLASS_VERSION_MAJOR;
+	moduleVersion.iMinor = TEST_CLASS_VERSION_MINOR;
+	moduleVersion.iBuild = TEST_CLASS_VERSION_BUILD;
+	
+	TFileName moduleName;
+	moduleName = _L("HarvesterPluginTester.dll");
+
+	TBool newVersionOfMethod = ETrue;
+	TestModuleIf().SendTestModuleVersion(moduleVersion, moduleName, newVersionOfMethod);
+	}
+
+// ========================== OTHER EXPORTED FUNCTIONS =========================
+
+// -----------------------------------------------------------------------------
+// LibEntryL is a polymorphic Dll entry point.
+// Returns: CScriptBase: New CScriptBase derived object
+// -----------------------------------------------------------------------------
+//
+EXPORT_C CScriptBase* LibEntryL( 
+    CTestModuleIf& aTestModuleIf ) // Backpointer to STIF Test Framework
+    {
+
+    return ( CScriptBase* ) CHarvesterPluginTester::NewL( aTestModuleIf );
+
+    }
+
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/harvesterplugins/tsrc/harvesterplugintester/src/harvesterplugintesterblocks.cpp	Mon Apr 19 14:40:05 2010 +0300
@@ -0,0 +1,1547 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+* 
+* Description: This file contains testclass implementation.
+*
+*/
+
+// change the level of RVCT compiler warning 'non-POD class passed thru ellipses' to a remark.
+#ifdef __MARM__
+#pragma diag_remark 1446
+#endif
+
+// [INCLUDE FILES] - do not remove
+#include "harvesterplugintester.h"
+#include <e32svr.h>
+#include <f32file.h> 
+#include <stifparser.h>
+#include <stiftestinterface.h>
+#include <favouritesdb.h>
+#include <msvapi.h>
+#include <bautils.h>
+#include "harvesterobserver.h"
+#include "cmessageplugin.h"
+#include "cmessagesessionobserver.h" //For CMsvSession
+#include "ccpixsearcher.h"
+#include "bookmarksplugin.h"
+#include "applicationsplugin.h"
+#include "ccontactsplugin.h"
+#include "ccalendarplugin.h"
+#include "ccalendarobserver.h"
+#include "mediaplugin.h"
+#include <harvesterclient.h>
+#include "mdsitementity.h"
+#include "cpixmdedbmanager.h"
+//#include "CBlacklistMgr.h"
+#include "videoplugin.h"
+#include "imageplugin.h"
+
+_LIT(KAppBasePath,"@c:root file");
+const TInt KMsgPluginBaseAppClassMaxLen = 64;
+
+// For Notes --Start
+#include <d32dbms.h>
+#include <utf.h>
+#include "notesplugin.h"
+
+//Test Uid for testing Blacklist manager
+
+//const TUid KTestUid = { 0x101D6348 };
+
+#define MEDIA_QBASEAPPCLASS   "@c:root media audio"
+#define LMEDIA_QBASEAPPCLASS  L"@c:root media audio"
+#define VIDEO_QBASEAPPCLASS   "@c:root media video"
+#define LVIDEO_QBASEAPPCLASS  L"@c:root media video"
+#define IMAGE_QBASEAPPCLASS   "@c:root media image"
+#define LIMAGE_QBASEAPPCLASS  L"@c:root media image"
+
+// For Notes --End
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// Delete here all resources allocated and opened from test methods. 
+// Called from destructor. 
+void CHarvesterPluginTester::Delete() 
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// Run specified method. Contains also table of test mothods and their names.
+TInt CHarvesterPluginTester::RunMethodL( 
+    CStifItemParser& aItem ) 
+    {
+
+    static TStifFunctionInfo const KFunctions[] =
+        {  
+        // Copy this line for every implemented function.
+        // First string is the function name used in TestScripter script file.
+        // Second is the actual implementation member function. 
+        ENTRY( "TestStartHarvester", CHarvesterPluginTester::TestStartHarvesterL ),
+        ENTRY( "TestFolderRename", CHarvesterPluginTester::TestFolderRenamingL ),
+        ENTRY( "TestFormBaseAppClass", CHarvesterPluginTester::TestFormBaseAppClass ),
+        ENTRY( "TestDatabasePath", CHarvesterPluginTester::TestDatabasePathL ),
+        ENTRY( "TestCreateIndexItemL_Add", CHarvesterPluginTester::TestCreateIndexItemL ),
+        ENTRY( "TestCreateIndexItemL_Update", CHarvesterPluginTester::TestCreateIndexItemL ),
+        ENTRY( "TestCreateIndexItemL_Delete", CHarvesterPluginTester::TestCreateIndexItemL ),
+        ENTRY( "TestMessaging", CHarvesterPluginTester::TestMessageHarvesterL ),
+        ENTRY( "TestMessageHarvesting", CHarvesterPluginTester::TestMessageHarvesterWithMessageL ),
+        ENTRY( "TestMessageDriveChange", CHarvesterPluginTester::TestMessageHarvesterChangeDriveL ),
+        ENTRY( "TestStartBookmarksHarvesterL", CHarvesterPluginTester::TestStartBookmarksHarvesterL ),
+        ENTRY( "TestAddBookmarkL", CHarvesterPluginTester::TestAddBookmarkL ),
+        ENTRY( "TestAddGetDomainL", CHarvesterPluginTester::TestAddGetDomainL ),
+        ENTRY( "TestStartApplicationsHarvesterL", CHarvesterPluginTester::TestStartApplicationsHarvesterL ),        
+        ENTRY( "TestCreateApplicationsIndexItemL", CHarvesterPluginTester::TestCreateApplicationsIndexItemL ),
+		ENTRY( "TestStartNotesHarvesterL", CHarvesterPluginTester::TestStartNotesHarvesterL ),
+        ENTRY( "TestAddNoteL", CHarvesterPluginTester::TestAddNoteL ),
+        ENTRY( "TestAddLongNoteL", CHarvesterPluginTester::TestAddLongNoteL ),
+        ENTRY( "TestAddAlphaNumericNoteL", CHarvesterPluginTester::TestAddAlphaNumericNoteL ),
+        ENTRY( "TestDeleteNoteL", CHarvesterPluginTester::TestDeleteNoteL ),
+        ENTRY( "TestUpdateNoteL", CHarvesterPluginTester::TestUpdateNoteL ),                
+        ENTRY( "TestContactsHarvesting", CHarvesterPluginTester::TestStartContactsHarvesterL ),
+        ENTRY( "TestCreateContactIndexItemL_Add", CHarvesterPluginTester::TestCreateContactIndexItemL ),
+        ENTRY( "TestCreateContactIndexItemL_Edit", CHarvesterPluginTester::TestCreateContactIndexItemL ),
+        ENTRY( "TestCreateContactIndexItemL_Delete", CHarvesterPluginTester::TestCreateContactIndexItemL ),
+        ENTRY( "TestCreateContactGroup", CHarvesterPluginTester::TestCreateContactGroupL ),
+        ENTRY( "TestCalenderHarvesting", CHarvesterPluginTester::TestStartCalenderHarvesterL ),
+        ENTRY( "TestCalenderEntry",CHarvesterPluginTester::TestCalenderEntryL ),
+        ENTRY( "TestCreateMMS",CHarvesterPluginTester::TestCreateMmsL ),
+        ENTRY( "TestCreateEmail",CHarvesterPluginTester::TestCreateEmailL ),
+		ENTRY( "TestAudioHarvesting",CHarvesterPluginTester::TestAudioHarvestingL ),
+		ENTRY( "TestMdsSyncController",CHarvesterPluginTester::TestMdsSyncControllerL ),
+		//ENTRY( "TestBlacklistPlugin",CHarvesterPluginTester::TestBlacklistPluginL ),
+		//ENTRY( "TestBlacklistPluginVersion",CHarvesterPluginTester::TestBlacklistPluginVersionL ),
+		ENTRY( "TestVideoHarvestingIndex",CHarvesterPluginTester::TestVideoHarvestingIndexL ),		
+		ENTRY( "TestVideoHarvestingUpdateIndex",CHarvesterPluginTester::TestVideoHarvestingUpdateIndexL ),
+		ENTRY( "TestVideoHarvestingDeleteIndex",CHarvesterPluginTester::TestVideoHarvestingDeleteIndexL ),
+		ENTRY( "TestImageHarvestingAddIndex",CHarvesterPluginTester::TestImageHarvestingAddIndexL ),
+		ENTRY( "TestImageHarvestingUpdateIndex",CHarvesterPluginTester::TestImageHarvestingUpdateIndexL ),
+		ENTRY( "TestImageHarvestingDeleteIndex",CHarvesterPluginTester::TestImageHarvestingDeleteIndexL ),
+		ENTRY( "TestAudioMMCEventL",CHarvesterPluginTester::TestAudioMMCEventL ),
+		ENTRY( "TestVideoMMCEventL",CHarvesterPluginTester::TestVideoMMCEventL ),
+		ENTRY( "TestImageMMCEventL",CHarvesterPluginTester::TestImageMMCEventL ),
+        //ADD NEW ENTRY HERE
+        // [test cases entries] - Do not remove
+        };
+
+    const TInt count = sizeof( KFunctions ) / 
+                        sizeof( TStifFunctionInfo );
+
+    return RunInternalL( KFunctions, count, aItem );
+
+    }
+
+_LIT( KNoErrorString, "No Error" );
+//_LIT( KErrorString, " *** Error ***" );
+
+void doLog( CStifLogger* logger, TInt error, const TDesC& errorString )
+    {
+    if( KErrNone == error ) logger->Log( KNoErrorString );
+    else logger->Log( errorString );
+    }
+
+// Example test method function.
+// -----------------------------------------------------------------------------
+TInt CHarvesterPluginTester::TestStartHarvesterL( CStifItemParser& /*aItem*/ )
+    {
+    // Print to UI
+    _LIT( KHarvesterPluginTester, "HarvesterPluginTester: %S" );
+    _LIT( KExample, "In TestStartHarvesterL" );
+    TestModuleIf().Printf( 0, KHarvesterPluginTester, KExample );
+
+    // Print to log file
+    iLog->Log( KExample );
+    CFilePlugin* filePlugin = CFilePlugin::NewL();
+    CHarvesterObserver* iPluginTester = CHarvesterObserver::NewL( filePlugin );
+    filePlugin->StartPluginL(); //Calls Add
+    filePlugin->StartHarvestingL( KAppBasePath );
+    iPluginTester->iWaitForHarvester->Start();//Wait here till Harvesting is complete.
+    delete filePlugin;
+    delete iPluginTester;
+    doLog( iLog, KErrNone, KNoErrorString );
+    return KErrNone;
+    }
+
+//Same as before, except we rename a directory before calling wait->Start()
+TInt CHarvesterPluginTester::TestFolderRenamingL( CStifItemParser& /*aItem*/ )
+    {
+    CFilePlugin* filePlugin = CFilePlugin::NewL();
+    CHarvesterObserver* iPluginTester = CHarvesterObserver::NewL( filePlugin );
+    filePlugin->StartPluginL(); //Calls Add
+    filePlugin->StartHarvestingL( KAppBasePath );
+    
+    _LIT( KDirectoryToRenameFrom, "C:\\data\\FileToTestRename" );
+    _LIT( KDirectoryToRenameTo, "C:\\data\\FileToTestRenamed" );
+    RFs fs;
+    fs.Connect();
+    TInt error = fs.Rename( KDirectoryToRenameFrom, KDirectoryToRenameTo );
+    iPluginTester->iWaitForHarvester->Start();//Wait here till Harvesting is complete.
+    //rename it back to what it was.
+    error = fs.Rename( KDirectoryToRenameTo, KDirectoryToRenameFrom );
+
+    delete filePlugin;
+    delete iPluginTester;
+    doLog( iLog, error, _L("Error: TestFolderRename.") );
+    
+    return error;
+    }
+
+TInt CHarvesterPluginTester::TestFormBaseAppClass( CStifItemParser& aItem )
+    {
+    // Print to UI
+    _LIT( KFilePluginBaseAppClass, "FormBaseAppClass" );
+    _LIT( KExample, "In TestFormBaseAppClass" );
+    TestModuleIf().Printf( 0, KFilePluginBaseAppClass, KExample );
+    
+    TInt driveNumber;
+    TBuf<100> formedBaseAppClass;
+    TBuf<100> expectedBaseAppClass;
+    TChar driveChar;
+    CFilePlugin* filePlugin = CFilePlugin::NewL();
+    CHarvesterObserver* iPluginTester = CHarvesterObserver::NewL( filePlugin );
+    filePlugin->StartPluginL();
+
+    TInt error = KErrNone;
+    TInt errorNumber = 0;
+    _LIT( KBaseAppClassFormatString, "@%c:root file");
+    _LIT( KTestFormBaseAppClassNoError, "TestFormBaseAppClass: No Error" );
+    
+    if( aItem.GetNextInt ( driveNumber ) == KErrNone  && error == KErrNone )
+        {
+        filePlugin->FormBaseAppClass(  static_cast<TDriveNumber>( driveNumber ), formedBaseAppClass  );
+        if( aItem.GetNextChar ( driveChar ) == KErrNone )
+            {
+            expectedBaseAppClass.Format( KBaseAppClassFormatString, driveChar );
+            error = expectedBaseAppClass.Compare( formedBaseAppClass );
+            if( aItem.GetNextInt ( errorNumber ) == KErrNone )
+                error = ( KErrNone == error || -1 == errorNumber ) ? KErrNone : KErrGeneral ;
+            }
+        }
+    delete filePlugin;
+    delete iPluginTester;
+    
+    doLog( iLog, error, KTestFormBaseAppClassNoError );
+    return error;
+    }
+
+TInt CHarvesterPluginTester::TestDatabasePathL( CStifItemParser& aItem )
+    {
+    TInt driveNumber;
+    CFilePlugin* filePlugin = CFilePlugin::NewL();
+    CHarvesterObserver* iPluginTester = CHarvesterObserver::NewL( filePlugin );
+    filePlugin->StartPluginL();
+    
+    HBufC* buffer;
+    TBuf<KMaxFileName> returnedDbPath;
+    TBuf<KMaxFileName> expectedDbPath;
+    TInt error = KErrNone;
+    TInt errorNumber;
+    TChar driveChar;
+    _LIT( KTestDatabasePathNoError, "TestDatabasePathL: No Error" );
+    
+    _LIT( KDbFormatString, "%c:\\Private\\2001f6f7\\indexing\\indexdb\\root\\file" );
+    if( aItem.GetNextInt ( driveNumber ) == KErrNone  && error == KErrNone )
+        {
+        buffer = filePlugin->DatabasePathLC( static_cast<TDriveNumber>( driveNumber ) );
+        returnedDbPath.Copy( *buffer );
+        if( aItem.GetNextChar ( driveChar ) == KErrNone )
+            {
+            expectedDbPath.Format( KDbFormatString, driveChar );
+            error = expectedDbPath.Compare( returnedDbPath );
+            if( aItem.GetNextInt ( errorNumber ) == KErrNone )
+                error = ( KErrNone == error || -1 == errorNumber ) ? KErrNone : KErrGeneral ;
+            }
+        }
+    CleanupStack::PopAndDestroy( buffer );
+    delete filePlugin;
+    delete iPluginTester;
+    doLog( iLog, error, KTestDatabasePathNoError );
+    return error;
+    }
+
+//Helper functions
+enum TSearchType
+    {
+    ESearchTypeResultsExpected=0,
+    ESearchTypeNoResultsExpected
+    };
+
+TInt doSearch( const TDesC& aSearchString, const TDesC& aBaseAppClass, TSearchType aSearchType )
+    {
+    RSearchServerSession session;
+    User::LeaveIfError( session.Connect() );
+    CCPixSearcher* searcher = CCPixSearcher::NewLC( session );
+    searcher->OpenDatabaseL( aBaseAppClass );
+    
+    TInt docCount = searcher->SearchL( aSearchString, KNullDesC);
+    
+    CleanupStack::PopAndDestroy( searcher );
+    session.Close();
+    
+    if( aSearchType == ESearchTypeResultsExpected )
+        {
+        return docCount > 0 ? KErrNone : KErrNotFound;
+        }
+    else
+        {
+        return 0 == docCount ? KErrNone : KErrNotFound;
+        }
+    }
+
+TInt CHarvesterPluginTester::TestCreateIndexItemL( CStifItemParser& aItem )
+    {
+    TInt error = KErrNone;
+    TPtrC fileName;
+    TPtrC createIndexAction;
+    CFilePlugin* filePlugin = CFilePlugin::NewL();
+    CHarvesterObserver* observer = CHarvesterObserver::NewL( filePlugin );
+    filePlugin->StartPluginL();
+    _LIT( KFileNameFormat, "C:\\TestFramework\\" );
+    _LIT( KActionAdd, "add" );
+    _LIT( KActionDelete, "delete" );
+    _LIT( KActionUpdate, "update" );
+    _LIT( KCreateIndexItemNoError, "CreateIndexItemL: Error" );
+
+    TBuf<KMaxFileName> filePathName( KFileNameFormat );
+    
+    if( aItem.GetNextString ( createIndexAction ) == KErrNone )
+        {
+        if( createIndexAction.Compare( KActionAdd ) == 0 )
+            {
+            if( aItem.GetNextString ( fileName ) == KErrNone  && error == KErrNone )
+                {
+                filePathName.Append( fileName );
+                filePlugin->CreateFileIndexItemL( filePathName, ECPixAddAction );
+                TPtrC searchString;
+                while( aItem.GetNextString ( searchString ) == KErrNone  && error == KErrNone )
+                    {
+                    error = doSearch( searchString, _L(FILE_QBASEAPPCLASS), ESearchTypeResultsExpected );
+                    }
+                filePlugin->CreateFileIndexItemL( filePathName, ECPixRemoveAction );
+                }
+            }
+        if( createIndexAction.Compare( KActionDelete ) == 0 )
+            {
+            if( aItem.GetNextString ( fileName ) == KErrNone  && error == KErrNone )
+                {
+                filePathName.Append( fileName );
+                filePlugin->CreateFileIndexItemL( filePathName, ECPixRemoveAction );
+                TPtrC searchString;
+                while( aItem.GetNextString ( searchString ) == KErrNone  && error == KErrNone )
+                    {
+                    error = doSearch( searchString, _L(FILE_QBASEAPPCLASS), ESearchTypeNoResultsExpected );
+                    }
+                }
+            }
+        if( createIndexAction.Compare( KActionUpdate ) == 0 )
+            {
+            if( aItem.GetNextString ( fileName ) == KErrNone  && error == KErrNone )
+                {
+                filePathName.Append( fileName );
+                filePlugin->CreateFileIndexItemL( filePathName, ECPixUpdateAction );
+                TPtrC searchString;
+                while( aItem.GetNextString ( searchString ) == KErrNone  && error == KErrNone )
+                    {
+                    error = doSearch( searchString, _L(FILE_QBASEAPPCLASS), ESearchTypeResultsExpected );
+                    }
+                }
+            }
+        }
+    delete filePlugin;
+    delete observer;
+    doLog( iLog, error, KCreateIndexItemNoError );
+    return error;
+    }
+	
+/**
+* Message harvester test method.
+* @since ?Series60_version
+* @param aItem Script line containing parameters.
+* @return Symbian OS error code.
+*/
+TInt CHarvesterPluginTester::TestMessageHarvesterL( CStifItemParser& /*aItem*/ )
+    {
+    // Print to UI
+    _LIT( KHarvesterPluginTester, "HarvesterPluginTester" );
+    _LIT( KExample, "In TestMessageHarvesterL" );
+    TestModuleIf().Printf( 0, KHarvesterPluginTester, KExample );
+    // Print to log file
+    iLog->Log( KExample );
+    
+    CMessagePlugin* plugin = CMessagePlugin::NewL();
+    CHarvesterObserver* iPluginTester = CHarvesterObserver::NewL( plugin );
+    plugin->StartPluginL();
+    CMessageSessionObserver* sessionobserver = CMessageSessionObserver::NewL();
+    CMsvSession* msgSession = CMsvSession::OpenSyncL(*sessionobserver);
+    // Form the baseappclass for this media
+    TBuf<KMsgPluginBaseAppClassMaxLen> baseAppClass;
+    TInt drive = msgSession->CurrentDriveL();
+    CMessagePlugin::FormBaseAppClass(TDriveNumber(drive),baseAppClass);
+    //Get current base app class for drive
+    //CMessagePlugin::FormBaseAppClass
+    plugin->StartHarvestingL( baseAppClass );
+    iPluginTester->iWaitForHarvester->Start();
+    
+    delete plugin; 
+    delete iPluginTester;
+    delete sessionobserver;
+    delete msgSession;
+    doLog(iLog,KErrNone,KNoErrorString);
+    return KErrNone;
+    }
+
+TInt CHarvesterPluginTester::TestMessageHarvesterWithMessageL( CStifItemParser& /*aItem*/ )
+    {
+    _LIT( KHarvesterPluginTester, "HarvesterPluginTester" );
+    _LIT( KExample, "In TestMessageHarvesterWithMessageL" );
+    TInt error(KErrNone);
+    
+    TestModuleIf().Printf( 0, KHarvesterPluginTester, KExample );
+    // Print to log file
+    iLog->Log( KExample );
+    CMessagePlugin* plugin = CMessagePlugin::NewL();
+    CHarvesterObserver* iPluginTester = CHarvesterObserver::NewL( plugin );
+    plugin->StartPluginL();
+    CMessageSessionObserver* sessionobserver = CMessageSessionObserver::NewL();
+    CMsvSession* msgSession = CMsvSession::OpenSyncL(*sessionobserver);
+    // Form the baseappclass for this media
+    TBuf<KMsgPluginBaseAppClassMaxLen> baseAppClass;
+    TInt drive = msgSession->CurrentDriveL();
+    //Get current base app class for drive
+    CMessagePlugin::FormBaseAppClass(TDriveNumber(drive),baseAppClass);
+    plugin->StartHarvestingL( baseAppClass );
+    //Create a new SMS message
+    TMsvId msgid = MessagingUtils::CreateMessageL(msgSession,
+                                                 _L("+3584400220055"),
+                                                 _L("+919845062437"),
+                                                 _L("This is test from bhuvnesh"));
+    iPluginTester->iWaitForHarvester->Start();
+    TInt count = SearchForTextL(_L("+919845062437"),baseAppClass,KNullDesC);
+    MessagingUtils::RemoveEntryL(msgSession,msgid);
+    if(count <= 0)
+        {
+        error = KErrNotFound;
+        }
+    
+    delete plugin; 
+    delete iPluginTester;
+    delete sessionobserver;
+    delete msgSession;
+    doLog(iLog,error,_L("Error in TestMessageHarvesterWithMessageL"));
+    return error;
+    }
+
+TInt CHarvesterPluginTester::TestMessageHarvesterChangeDriveL( CStifItemParser& /*aItem*/ )
+    {
+    _LIT( KHarvesterPluginTester, "HarvesterPluginTester" );
+    _LIT( KExample, "In TestMessageHarvesterChangeDriveL" );
+    TInt error(KErrNone);
+    
+    TestModuleIf().Printf( 0, KHarvesterPluginTester, KExample );
+    // Print to log file
+    iLog->Log( KExample );
+    CMessagePlugin* plugin = CMessagePlugin::NewL();
+    CHarvesterObserver* iPluginTester = CHarvesterObserver::NewL( plugin );
+    plugin->StartPluginL();
+    CMessageSessionObserver* sessionobserver = CMessageSessionObserver::NewL();
+    CMsvSession* msgSession = CMsvSession::OpenSyncL(*sessionobserver);
+    // Form the baseappclass for this media
+    TBuf<KMsgPluginBaseAppClassMaxLen> baseAppClass;
+    TInt drive = msgSession->CurrentDriveL();
+    //Get current base app class for drive
+    CMessagePlugin::FormBaseAppClass(TDriveNumber(drive),baseAppClass);
+    plugin->StartHarvestingL( baseAppClass );
+    iPluginTester->iWaitForHarvester->Start();
+    //Harvesting completed change the drive and make sure new message harvested
+    drive == EDriveC ? drive = EDriveE : drive = EDriveC;
+    TRequestStatus status = KRequestPending;
+    msgSession->ChangeDriveL(drive,status);
+    User::WaitForAnyRequest();
+    //User::WaitForRequest(status);//Wait to complete this request
+    plugin->StartHarvestingL( baseAppClass );
+    TMsvId msgid = MessagingUtils::CreateMessageL(msgSession,
+                                                 _L("+3584400220055"),
+                                                 _L("+919845062437"),
+                                                 _L("This is test from bhuvnesh"));
+    iPluginTester->iWaitForHarvester->Start();//Start again
+    drive = msgSession->CurrentDriveL();
+    CMessagePlugin::FormBaseAppClass(TDriveNumber(drive),baseAppClass);
+    TInt count = SearchForTextL(_L("+919845062437"),baseAppClass,KNullDesC);
+    if(count <= 0)
+        {
+        error = KErrNotFound;
+        }
+    MessagingUtils::RemoveEntryL(msgSession,msgid);
+    
+    delete plugin;
+    delete iPluginTester;
+    delete sessionobserver;
+    delete msgSession;
+    doLog(iLog,error,_L("Error in TestMessageHarvesterChangeDriveL"));
+    return error;
+    }
+
+TInt CHarvesterPluginTester::SearchForTextL(const TDesC& aQueryString, const TDesC& aBaseAppclass,const TDesC& aDefaultField)
+    {
+    TInt DocumentCount(KErrNotFound);
+    RSearchServerSession session;
+    User::LeaveIfError(session.Connect());
+    CCPixSearcher* searcher = CCPixSearcher::NewL(session);
+    searcher->OpenDatabaseL(aBaseAppclass);
+    // Send for indexing
+    if ( searcher )
+        {
+        DocumentCount = searcher->SearchL(aQueryString, aDefaultField);
+        }
+    return DocumentCount;
+    }
+
+TInt CHarvesterPluginTester::TestStartBookmarksHarvesterL( CStifItemParser& /*aItem */)
+    {
+    CBookmarksPlugin* plugin = CBookmarksPlugin::NewL();
+    CHarvesterObserver* iPluginTester = CHarvesterObserver::NewL( plugin );
+    plugin->StartPluginL();
+    plugin->StartHarvestingL( _L(BOOKMARK_QBASEAPPCLASS) );
+    iPluginTester->iWaitForHarvester->Start();//Wait here till Harvesting is complete.
+    delete plugin;
+    delete iPluginTester;
+    doLog( iLog, KErrNone, KNoErrorString );
+    return KErrNone;
+    }
+
+TInt CHarvesterPluginTester::TestAddBookmarkL( CStifItemParser& aItem )
+    {
+    TInt error = KErrNone;
+    CBookmarksPlugin* plugin = CBookmarksPlugin::NewL();
+    CHarvesterObserver* iPluginTester = CHarvesterObserver::NewL( plugin );
+    plugin->StartPluginL(); //starts the bookmarks db monitor.
+
+    //now add a bookmark.
+    CFavouritesItem* item = CFavouritesItem::NewL();
+    RFavouritesDb favoritesDb;
+    RFavouritesSession favSession;
+    error = favSession.Connect();
+    if( KErrNone == error ) error = favoritesDb.Open( favSession, KBrowserBookmarks ) ;
+    if( KErrNone != error ) return error;
+    
+    item->SetType( CFavouritesItem::EItem );
+    item->SetParentFolder( KFavouritesRootUid );
+    
+    TPtrC string;
+    error = aItem.GetNextString( string );
+    if( KErrNone == error ) 
+        item->SetNameL( string );
+    
+    error = aItem.GetNextString( string );
+    if( KErrNone == error ) 
+        item->SetUrlL( string );
+    
+    if( KErrNone == error ) 
+        {
+        error = favoritesDb.Begin( ETrue );
+        if( KErrNone == error ) error = favoritesDb.Add( *item, ETrue ); //ETrue for Autorename. We are searching only by URL so this is fine.
+        if( KErrNone == error ) error = favoritesDb.Commit();
+        plugin->StartHarvestingL( _L(BOOKMARK_QBASEAPPCLASS) );
+        if( KErrNone == error ) iPluginTester->iWaitForHarvester->Start();//Wait here till Harvesting is complete.
+        }
+    
+    //now, search for URL.
+    if( KErrNone == error )
+        {
+        error = aItem.GetNextString( string );
+        if( KErrNone == error ) 
+            error = doSearch( string , _L( BOOKMARK_QBASEAPPCLASS ), ESearchTypeResultsExpected );
+        }
+
+    delete plugin;
+    delete iPluginTester;
+    
+    favoritesDb.Close();
+    favSession.Close();
+    
+    doLog( iLog, error, _L("Error in AddBookmarkL") );
+    return error;
+    }
+
+//Forward declare this function.
+//It is a local function in the .cpp file and hence not listed in .h file.
+//Forward declare it so that the compilation can go thru - the implementation
+//will be picked up by the linker.
+void GetDomainNameL( const TDesC& aUrl, TPtrC& aDomain );
+
+TInt CHarvesterPluginTester::TestAddGetDomainL( CStifItemParser& aItem )
+    {
+    TInt error = KErrNone;
+    TPtrC inputString;
+    TPtrC domain;
+    while( aItem.GetNextString( inputString ) == KErrNone )
+        {
+        GetDomainNameL( inputString, domain );
+        if( aItem.GetNextString( inputString ) == KErrNone )
+            error = domain.Compare( inputString );
+            if( error != KErrNone ) return error;
+        }
+    return KErrNone;
+    }
+
+TInt CHarvesterPluginTester::TestStartApplicationsHarvesterL( CStifItemParser& /*aItem*/ )
+    {
+    CApplicationsPlugin* appsPlugin = CApplicationsPlugin::NewL();
+    CHarvesterObserver* iPluginTester = CHarvesterObserver::NewL( appsPlugin );
+    appsPlugin->StartPluginL(); //Calls Add
+    appsPlugin->StartHarvestingL( KNullDesC );
+    iPluginTester->iWaitForHarvester->Start();//Wait here till Harvesting is complete.
+    delete appsPlugin;
+    delete iPluginTester;
+    doLog( iLog, KErrNone, KNoErrorString );
+    return KErrNone;
+    }
+
+TInt CHarvesterPluginTester::TestCreateApplicationsIndexItemL( CStifItemParser& /*aItem*/ )
+    {
+    CApplicationsPlugin* appsPlugin = CApplicationsPlugin::NewL();
+    CHarvesterObserver* iPluginTester = CHarvesterObserver::NewL( appsPlugin );
+    appsPlugin->StartPluginL();
+    
+    //Force reharvesting:
+    appsPlugin->HandleAppListEvent( 1 ); //EListChanged = 1
+    iPluginTester->iWaitForHarvester->Start();//Wait here till Harvesting is complete.
+
+    delete appsPlugin;
+    delete iPluginTester;
+    doLog( iLog, KErrNone, KNoErrorString );
+    return KErrNone;
+    }
+	
+	TInt CHarvesterPluginTester::TestStartNotesHarvesterL( CStifItemParser& /*aItem*/ )
+    {	
+    CNotesPlugin* plugin = CNotesPlugin::NewL();
+    CHarvesterObserver* iPluginTester = CHarvesterObserver::NewL( plugin );
+    plugin->StartPluginL();
+    plugin->StartHarvestingL( _L(NOTES_QBASEAPPCLASS) );
+    iPluginTester->iWaitForHarvester->Start();//Wait here till Harvesting is complete.
+    delete plugin;
+    delete iPluginTester;    
+    doLog( iLog, KErrNone, KNoErrorString );	
+    return KErrNone;
+    }
+
+TInt CHarvesterPluginTester::TestAddNoteL( CStifItemParser& aItem )
+    {    
+    TPtrC string;
+    TPtrC searchstring;
+    TInt error = aItem.GetNextString( string );
+    error = aItem.GetNextString( searchstring );
+    error = PerformNotesTestL(string , searchstring);
+    return error;
+    }
+
+TInt CHarvesterPluginTester::TestAddLongNoteL( CStifItemParser& aItem )
+    {
+    TPtrC string;
+    TPtrC searchstring;
+    TInt error = aItem.GetNextString( string );
+    error = aItem.GetNextString( searchstring );
+    error = PerformNotesTestL(string , searchstring);
+    return error;
+    }
+TInt CHarvesterPluginTester::TestAddAlphaNumericNoteL( CStifItemParser& aItem )
+    {
+    TPtrC string;
+    TPtrC searchstring;
+    TInt error = aItem.GetNextString( string );
+    error = aItem.GetNextString( searchstring );
+    error = PerformNotesTestL(string , searchstring);
+    return error;
+    }
+TInt CHarvesterPluginTester::PerformNotesTestL( TPtrC aString1 , TPtrC aString2)
+    {	
+    TInt error = KErrNone;	
+    HBufC8* memo = NULL;    
+    CNotesPlugin* plugin = CNotesPlugin::NewL();
+    CHarvesterObserver* iPluginTester = CHarvesterObserver::NewL( plugin );
+    plugin->StartPluginL(); //starts the Notes database notifier    
+    if(aString1.Length() > 0)
+        {
+        RFs fssession;
+        User::LeaveIfError( fssession.Connect() );
+        RFile testfile;        
+        error = testfile.Open(fssession,aString1,EFileRead);
+        if(error == KErrNone)
+            {
+            TInt size(0);
+            testfile.Size(size);
+            memo = HBufC8::NewL(size);
+            TPtr8 memoptr = memo->Des();
+            User::LeaveIfError( testfile.Read(memoptr, size ) );
+            //testfile.Read(memoptr,size);
+            testfile.Close();                
+            fssession.Close();
+            }
+        } 
+    if(error == KErrNone)
+        {
+        CCalendarObserver* session = CCalendarObserver::NewL();
+        session->AddNoteL(memo->Des());
+        plugin->StartHarvestingL( _L(NOTES_QBASEAPPCLASS) );
+        iPluginTester->iWaitForHarvester->Start();//Wait here till Harvesting is complete.
+        error = doSearch( aString2, _L(NOTES_QBASEAPPCLASS), ESearchTypeResultsExpected );
+        
+        delete session;
+        doLog( iLog, error, KNoErrorString );
+        }
+    delete memo;
+    delete plugin;
+    delete iPluginTester;
+    return error;
+    }
+
+TInt CHarvesterPluginTester::TestDeleteNoteL( CStifItemParser& aItem )
+    {	
+    TInt error = KErrNone;
+    _LIT( KSearchError, "Search Failed" );
+    
+    CNotesPlugin* plugin = CNotesPlugin::NewL();
+    CHarvesterObserver* iPluginTester = CHarvesterObserver::NewL( plugin );
+    plugin->StartPluginL();   
+    
+    CCalendarObserver* session = CCalendarObserver::NewL();
+    plugin->StartHarvestingL( _L(NOTES_QBASEAPPCLASS) );
+    // Add a Note entry
+    TPtrC searchstring;
+    error = aItem.GetNextString( searchstring );
+    HBufC8* buf8 = HBufC8::NewL(2*searchstring.Length());
+    buf8->Des().Copy(searchstring);
+    session->AddNoteL( buf8->Des());
+    delete buf8;
+    iPluginTester->iWaitForHarvester->Start();
+    error = doSearch( _L("TestNote"), _L( NOTES_QBASEAPPCLASS ), ESearchTypeResultsExpected );
+    doLog( iLog, error, KSearchError );    
+    if( error == KErrNone)
+        {
+        session->DeleteNoteEntryL();
+        plugin->StartHarvestingL( _L(NOTES_QBASEAPPCLASS) );
+        iPluginTester->iWaitForHarvester->Start();
+        //Delete the Note entry added previously and search for result    
+        error = doSearch( _L("TestNote"), _L( NOTES_QBASEAPPCLASS ), ESearchTypeResultsExpected );             
+        //If the entery is succesfully deleted, make error to KErrNone.To show testcase success
+        if(error == KErrNotFound)
+            error = KErrNone;    
+        }
+    delete session;
+    delete plugin;
+    delete iPluginTester;
+    doLog( iLog, error, KSearchError );
+    return KErrNone;
+    }
+
+TInt CHarvesterPluginTester::TestUpdateNoteL( CStifItemParser& aItem )
+    {
+    TInt error = KErrNone;
+    _LIT( KSearchError, "Search Failed" );
+    TPtrC oldString;
+    error = aItem.GetNextString( oldString );
+    TPtrC newString;
+    error = aItem.GetNextString( newString );
+    CNotesPlugin* plugin = CNotesPlugin::NewL();
+    CHarvesterObserver* iPluginTester = CHarvesterObserver::NewL( plugin );
+    plugin->StartPluginL();     
+    CCalendarObserver* session = CCalendarObserver::NewL();
+    plugin->StartHarvestingL( _L(NOTES_QBASEAPPCLASS) );
+    // Add a Note entry
+    HBufC8* oldbuf8 = HBufC8::NewL(2*oldString.Length());
+    oldbuf8->Des().Copy(oldString);
+    session->AddNoteL( oldbuf8->Des());
+    TBuf<20> oldsearchstring;
+    oldsearchstring.Copy( oldString );
+    iPluginTester->iWaitForHarvester->Start();
+    error = doSearch( oldsearchstring, _L( NOTES_QBASEAPPCLASS ), ESearchTypeResultsExpected );
+    doLog( iLog, error, KSearchError );
+    
+    TBuf<20> newsearchstring;
+    newsearchstring.Copy( newString );
+    HBufC8* newbuf8 = HBufC8::NewL(2*newString.Length());
+    newbuf8->Des().Copy(newString);
+    //update the Note entry and search for result 
+    session->UpdateNoteEntryL( oldbuf8->Des(), newbuf8->Des() );
+    plugin->StartHarvestingL( _L(NOTES_QBASEAPPCLASS) );
+    iPluginTester->iWaitForHarvester->Start();
+    error = doSearch( newsearchstring, _L( NOTES_QBASEAPPCLASS ), ESearchTypeResultsExpected );
+    doLog( iLog, error, KSearchError );
+    
+    delete newbuf8;
+    delete oldbuf8;
+    delete session;
+    delete plugin;
+    delete iPluginTester;    
+    return error;    
+    }
+
+TInt CHarvesterPluginTester::TestStartContactsHarvesterL( CStifItemParser& /*aItem*/ )
+    {
+    CContactsPlugin* plugin = CContactsPlugin::NewL();
+    CHarvesterObserver* iPluginTester = CHarvesterObserver::NewL( plugin );
+    plugin->StartPluginL(); //start to moniter contacts db
+    plugin->StartHarvestingL( _L(CONTACT_QBASEAPPCLASS) );
+    iPluginTester->iWaitForHarvester->Start();//Wait here till Harvesting is complete.
+    delete plugin;
+    delete iPluginTester;
+    doLog( iLog, KErrNone, KNoErrorString );
+    return KErrNone;
+    }
+
+TContactItemId CHarvesterPluginTester::CreateNewContactL( CContactDatabase& database,const TDesC& aName,const TDesC& aPhoneNumber )
+    {
+    // Create a  contact card to contain the data
+    CContactCard* newCard = CContactCard::NewLC();
+    
+    // Create the firstName field and add the data to it
+    CContactItemField* firstName = CContactItemField::NewLC( KStorageTypeText, KUidContactFieldGivenName );
+    firstName->TextStorage()->SetTextL(aName);    
+    newCard->AddFieldL(*firstName);
+    CleanupStack::Pop(firstName);
+      
+    // Create the phoneNo field and add the data to it
+    CContactItemField* phoneNumber = CContactItemField::NewLC( KStorageTypeText, KUidContactFieldPhoneNumber );
+    phoneNumber->SetMapping(KUidContactFieldVCardMapTEL);
+    phoneNumber ->TextStorage()->SetTextL(aPhoneNumber);
+    newCard->AddFieldL(*phoneNumber);
+    CleanupStack::Pop(phoneNumber);
+    
+    // Add newCard to the database     
+    const TContactItemId contactId = database.AddNewContactL(*newCard);    
+    CleanupStack::PopAndDestroy(newCard);    
+    return contactId;
+    }
+
+TInt CHarvesterPluginTester::TestCreateContactIndexItemL( CStifItemParser& aItem )
+    {
+    TInt error = KErrNone;
+    TPtrC IndexAction;
+    TPtrC ContactName;
+    TPtrC NewContactName;
+    _LIT( KActionAdd, "add" );
+    _LIT( KSearchError, "Search Failed" );
+    _LIT( KActionDelete, "delete" );
+    _LIT( KActionUpdate, "update" );
+    
+    CContactsPlugin* plugin = CContactsPlugin::NewL();
+    CHarvesterObserver* iPluginTester = CHarvesterObserver::NewL( plugin );
+    plugin->StartPluginL(); //start to moniter contacts db
+    CContactDatabase* db = CContactDatabase::OpenL();
+    
+    if( aItem.GetNextString ( IndexAction ) == KErrNone )
+        {
+         if( IndexAction.Compare( KActionAdd ) == 0 )
+             {
+             if( aItem.GetNextString ( ContactName ) == KErrNone )
+                 {
+                 TInt aContactId;
+                 plugin->StartHarvestingL( _L(CONTACT_QBASEAPPCLASS) );
+                 aContactId = CreateNewContactL( *db, ContactName, _L("1234") );                 
+                 iPluginTester->iWaitForHarvester->Start();//Wait here till Harvesting is complete.                 
+                                                       
+                 error = doSearch( ContactName, _L( CONTACT_QBASEAPPCLASS ), ESearchTypeResultsExpected ); 
+                 db->DeleteContactL(aContactId);
+                 }
+             }
+         if( IndexAction.Compare( KActionUpdate ) == 0 )
+             {
+             if( aItem.GetNextString ( ContactName ) == KErrNone )
+                 {
+                  TInt aContactId;
+                  //Add a contact first and later edit the contact
+                  aContactId = CreateNewContactL( *db, ContactName, _L("123") );
+                  
+                  CContactItem* contactItem = db->OpenContactL( aContactId );
+                  CleanupStack::PushL( contactItem );                           
+                  // First get the item's field set
+                  CContactItemFieldSet& fieldSet=contactItem->CardFields();                              
+                  // Search the field set for the given name field
+                  TInt index = fieldSet.Find( KUidContactFieldGivenName );
+                  CContactItemField &field= fieldSet[index];                          
+                  if( aItem.GetNextString ( NewContactName ) == KErrNone )
+                      {                      
+                      field.TextStorage()->SetTextL( NewContactName );                          
+                      // Commit the change back to database and clean up
+                      db->CommitContactL( *contactItem );
+                      }
+                  CleanupStack::PopAndDestroy(contactItem);                
+                  
+                  plugin->StartHarvestingL( _L(CONTACT_QBASEAPPCLASS) );
+                  iPluginTester->iWaitForHarvester->Start();
+                  error = doSearch( NewContactName, _L( CONTACT_QBASEAPPCLASS ), ESearchTypeResultsExpected );
+                  db->DeleteContactL( aContactId );
+                  }                 
+             }
+         if( IndexAction.Compare( KActionDelete ) == 0 )
+             {
+             if( aItem.GetNextString ( ContactName ) == KErrNone )
+                 {
+                 TInt aContactId;
+                 plugin->StartHarvestingL( _L(CONTACT_QBASEAPPCLASS));
+                 //Add a contact to contactdatabase and later delete it
+                 aContactId = CreateNewContactL( *db, ContactName, _L("123455"));
+                 db->DeleteContactL(aContactId);
+                 iPluginTester->iWaitForHarvester->Start();                 
+                 error = doSearch( ContactName, _L( CONTACT_QBASEAPPCLASS ), ESearchTypeResultsExpected );
+                 //If the contact is succesfully deleted, make error to KErrNone.To show testcase success
+                 if(error == KErrNotFound)
+                     error = KErrNone;                 
+                 }             
+             }
+        }
+        
+        delete db;
+        delete plugin;
+        delete iPluginTester;
+        
+        doLog( iLog, error, KSearchError );
+        return KErrNone;    
+    }
+TInt CHarvesterPluginTester::TestCreateContactGroupL( CStifItemParser& aItem )
+    {
+    TInt error = KErrNone;
+    _LIT( KSearchError, "Search Failed" );
+    TPtrC GroupName;
+    CContactsPlugin* plugin = CContactsPlugin::NewL();
+    CHarvesterObserver* iPluginTester = CHarvesterObserver::NewL( plugin );
+    plugin->StartPluginL(); //start to moniter contacts db
+    CContactDatabase* db = CContactDatabase::OpenL();    
+    
+    if( aItem.GetNextString ( GroupName ) == KErrNone )
+        {
+        plugin->StartHarvestingL( _L(CONTACT_QBASEAPPCLASS) );
+        TInt aContactId = CreateNewContactL( *db, _L("Group Contact"), _L("123455") );
+        CContactItem* newitem = db->CreateContactGroupL( _L("TestGroup") );
+        db->AddContactToGroupL( aContactId, newitem->Id() );       
+        iPluginTester->iWaitForHarvester->Start();    
+        error = doSearch( GroupName, _L( CONTACT_QBASEAPPCLASS ), ESearchTypeResultsExpected );    
+        db->DeleteContactL(aContactId);
+        db->DeleteContactL( newitem->Id() );
+        }
+    
+    delete plugin;
+    delete iPluginTester;
+    delete db;
+    doLog( iLog, error, KSearchError );
+    return KErrNone;    
+    }
+
+TInt CHarvesterPluginTester::TestStartCalenderHarvesterL( CStifItemParser& /*aItem*/ )
+    {
+    CCalendarPlugin* plugin = CCalendarPlugin::NewL();
+    CHarvesterObserver* iPluginTester = CHarvesterObserver::NewL( plugin );
+    plugin->StartPluginL(); //start to moniter contacts db
+    plugin->StartHarvestingL( _L(CALENDAR_QBASEAPPCLASS) );
+    iPluginTester->iWaitForHarvester->Start();//Wait here till Harvesting is complete.
+    delete plugin;
+    delete iPluginTester;
+    doLog( iLog, KErrNone, KNoErrorString );
+    return KErrNone;    
+    }
+
+TInt CHarvesterPluginTester::TestCalenderEntryL( CStifItemParser& /*aItem*/ )
+    {
+    TInt error = KErrNone;
+    _LIT( KSearchError, "Search Failed" );
+    CCalendarPlugin* plugin = CCalendarPlugin::NewL();
+    CHarvesterObserver* iPluginTester = CHarvesterObserver::NewL( plugin );
+    plugin->StartPluginL();   
+    
+    CCalendarObserver* session = CCalendarObserver::NewL();
+    plugin->StartHarvestingL( _L(CALENDAR_QBASEAPPCLASS) );
+    // Add a calender entry
+    session->AddEntryL();
+    iPluginTester->iWaitForHarvester->Start();
+    User::After((TTimeIntervalMicroSeconds32)30000000);
+    error = doSearch( _L("scheduled"), _L( CALENDAR_QBASEAPPCLASS ), ESearchTypeResultsExpected );
+    doLog( iLog, error, KSearchError );
+    
+    plugin->StartHarvestingL( _L(CALENDAR_QBASEAPPCLASS) );
+    session->DeleteEntryL();
+    iPluginTester->iWaitForHarvester->Start();
+    //Delete the calender entry added previously and search for result    
+    error = doSearch( _L("scheduled"), _L( CALENDAR_QBASEAPPCLASS ), ESearchTypeResultsExpected );
+        
+    //If the entery is succesfully deleted, make error to KErrNone.To show testcase success
+    if(error == KErrNotFound)
+       error = KErrNone;    
+    
+    delete session;
+    delete plugin;
+    delete iPluginTester;
+    doLog( iLog, error, KSearchError );     
+    return KErrNone;
+    }
+
+TInt CHarvesterPluginTester::TestCreateMmsL( CStifItemParser& aItem )
+    {
+    TInt error = KErrNone;
+    _LIT( KSearchError, "Search Failed" );
+    TPtrC filepath;
+    CMessagePlugin* plugin = CMessagePlugin::NewL();
+    CHarvesterObserver* iPluginTester = CHarvesterObserver::NewL( plugin );
+    plugin->StartPluginL();
+    CMessageSessionObserver* sessionobserver = CMessageSessionObserver::NewL();
+    CMsvSession* msgSession = CMsvSession::OpenSyncL(*sessionobserver);    
+    TInt found = aItem.GetNextString( filepath );
+    TBuf<KMsgPluginBaseAppClassMaxLen> baseAppClass;
+    TInt drive = msgSession->CurrentDriveL();
+    CMessagePlugin::FormBaseAppClass(TDriveNumber(drive),baseAppClass);
+    
+    plugin->StartHarvestingL( baseAppClass );
+    
+    //Create MMS with text attachment for UTF encoded data
+    TMsvId msgid = MessagingUtils::CreateMmsMessageL(msgSession,
+                                                 _L("+358440067886"),
+                                                 _L("+919845062437"),
+                                                 filepath);
+    
+    iPluginTester->iWaitForHarvester->Start();
+    
+    TInt count = SearchForTextL(_L("UTF"),baseAppClass,KNullDesC);
+    if(count <= 0)
+       {
+       error = KErrNotFound;
+       }
+    MessagingUtils::RemoveMmsEntryL( msgSession, msgid );
+    delete plugin;
+    delete iPluginTester;
+    delete sessionobserver;
+    delete msgSession;    
+    doLog(iLog,error,KSearchError);
+    return KErrNone;
+    }
+
+TInt CHarvesterPluginTester::TestCreateEmailL( CStifItemParser& /*aItem */)
+    {
+    TInt error = KErrNone;
+    _LIT( KSearchError, "Search Failed" );
+    CMessagePlugin* plugin = CMessagePlugin::NewL();
+    CHarvesterObserver* iPluginTester = CHarvesterObserver::NewL( plugin );
+    plugin->StartPluginL();
+    CMessageSessionObserver* sessionobserver = CMessageSessionObserver::NewL();
+    CMsvSession* msgSession = CMsvSession::OpenSyncL( *sessionobserver );
+    
+    TBuf<KMsgPluginBaseAppClassMaxLen> baseAppClass;
+    TInt drive = msgSession->CurrentDriveL();
+    CMessagePlugin::FormBaseAppClass( TDriveNumber(drive), baseAppClass );        
+    plugin->StartHarvestingL( baseAppClass );
+    //Create Email entry using SMTP client 
+    TMsvId msgid = MessagingUtils::CreateEmailEntryL( msgSession );
+    iPluginTester->iWaitForHarvester->Start();
+    TInt count = SearchForTextL( _L("SampleEmail"), baseAppClass, KNullDesC );
+    if(count <= 0)
+       {
+       error = KErrNotFound;
+       }
+    MessagingUtils::RemoveMmsEntryL( msgSession, msgid );
+    delete plugin;
+    delete iPluginTester;
+    delete sessionobserver;
+    delete msgSession;    
+    doLog(iLog,error,KSearchError);
+    return KErrNone;
+    }
+
+TInt CHarvesterPluginTester::TestAudioHarvestingL( CStifItemParser& /*aItem*/ )
+    {
+    _LIT( KHarvesterPluginTester, "HarvesterPluginTester" );
+    _LIT( KExample, "In TestAudioHarvestingL" );
+    TInt error(KErrNone);
+    TestModuleIf().Printf( 0, KHarvesterPluginTester, KExample );
+    // Print to log file
+    iLog->Log( KExample );
+    CAudioPlugin* plugin = CAudioPlugin::NewL();
+    CHarvesterObserver* iPluginTester = CHarvesterObserver::NewL( plugin );
+    plugin->StartPluginL(); //Initialize the Plugin
+    //Copy file path
+    RFs fileSession;
+    fileSession.Connect();
+    _LIT(KPathToMusic,"c:\\data\\music\\");
+    fileSession.Delete(_L("c:\\data\\music\\Eagle_Landed.mp3")); //Delete if already exist
+    //pause harvester while copy
+    RHarvesterClient   harvester;
+    User::LeaveIfError(harvester.Connect() );
+    harvester.Pause();
+    TRAP_IGNORE( BaflUtils::EnsurePathExistsL(fileSession,KPathToMusic) );//Create folder
+    BaflUtils::CopyFile(fileSession,_L("c:\\data\\Eagle_Landed.mp3"),KPathToMusic);
+    //Resume harvester for this harvesting
+    harvester.Resume();
+    harvester.Close();
+    //Do harvesting and search for Eagle it should be available
+    plugin->StartHarvestingL(_L(MEDIA_QBASEAPPCLASS));
+    //Wait for one minutes after doc processing to Index and Flush to happen
+    iPluginTester->SetWaitTime((TTimeIntervalMicroSeconds32)60000000);
+    iPluginTester->iWaitForHarvester->Start(); //Start Wait AO and let it complete
+    TInt count = SearchForTextL(_L("Eagle"),_L(MEDIA_QBASEAPPCLASS),KNullDesC);
+    if(count <= 0)
+        {
+        error = KErrNotFound;
+        }
+    doLog(iLog,error,_L("Error in TestAudioHarvestingL"));
+    delete plugin;
+    delete iPluginTester;
+    fileSession.Close();    
+    //End search
+    return error;
+    }
+
+TInt CHarvesterPluginTester::TestMdsSyncControllerL( CStifItemParser& /*aItem*/ )
+    {
+    _LIT( KHarvesterPluginTester, "HarvesterPluginTester" );
+    _LIT( KExample, "In TestMdsSyncControllerL" );
+    TInt error(KErrNone);
+    TestModuleIf().Printf( 0, KHarvesterPluginTester, KExample );
+    // Print to log file
+    iLog->Log( KExample );
+    CMDSEntity* entity;
+    CCPIXMDEDbManager* dbcontroller;
+    entity = CMDSEntity::NewL();
+    TUid uid = {0x101FB3E3};
+    dbcontroller = CCPIXMDEDbManager::NewL(uid);
+    entity->Setkey(1);
+    entity->SetUri(_L("\\music\\bhuvnesh.mp3"));
+    TDriveNumber drive = TDriveNumber(EDriveC);
+    entity->SetDrive(drive);
+    dbcontroller->AddL(entity->Key(),*entity);
+    error = dbcontroller->IsAlreadyExistL(entity->Key());
+    if( error )
+        {
+        iLog->Log( _L("Already exist") );
+        }
+    entity->Reset();
+    dbcontroller->GetItemL(1,*entity);
+    dbcontroller->RemoveL(entity->Key());
+    error = dbcontroller->IsAlreadyExistL( entity->Key() );
+    if( error )
+        {
+        iLog->Log( _L("Already exist") );
+        }
+    dbcontroller->ResetL();
+    delete entity;
+    delete dbcontroller;
+    return error;
+    }
+	
+TInt CHarvesterPluginTester::TestBlacklistPluginL( CStifItemParser& /*aItem*/ )
+    {
+    //@todo: This test case shoud be in IDS middleware harvester STIF cases
+    TInt err = KErrNone;
+    /*
+    CBlacklistMgr* blacklistmanager = CBlacklistMgr::NewL();
+    CleanupStack::PushL( blacklistmanager );
+    TInt version = 0;
+    aItem.GetNextInt(version);
+    //Add an Uid to Blacklist DB
+    blacklistmanager->AddL( KTestUid , version );
+    //Check if the Uid is added to database or not
+    TBool found = blacklistmanager->FindL(KTestUid , version );
+    
+    if(!found) err = KErrNotFound;
+    //clear the UID from the database
+    blacklistmanager->Remove(KTestUid);
+    CleanupStack::PopAndDestroy( blacklistmanager ); 
+    doLog( iLog, err, KNoErrorString );
+    */
+    return err;
+    }
+
+TInt CHarvesterPluginTester::TestBlacklistPluginVersionL( CStifItemParser& /*aItem*/ )
+    {
+    //@todo: This test case shoud be in IDS middleware harvester STIF cases
+    TInt err = KErrNone;
+    /*	
+    CBlacklistMgr* blacklistmanager = CBlacklistMgr::NewL();
+    CleanupStack::PushL( blacklistmanager );
+    TInt oldversion = 0;
+    TInt newversion = 0;
+    aItem.GetNextInt(oldversion);
+    aItem.GetNextInt(newversion);
+    //Add an Uid to Blacklist DB with old version
+    blacklistmanager->AddL( KTestUid , oldversion );
+    //Add an Uid to Blacklist DB with new version
+    blacklistmanager->AddL( KTestUid , newversion );
+    //Check if the Uid with old version exists
+    TBool found = blacklistmanager->FindL(KTestUid , oldversion );
+    if( found )
+        {
+        err = KErrNotFound;
+        }
+    else
+        {
+        //check with new version
+        found = blacklistmanager->FindL(KTestUid , newversion );
+        if(!found) err = KErrNotFound;
+        }    
+    //clear the UID from the database
+    blacklistmanager->Remove(KTestUid);
+    CleanupStack::PopAndDestroy( blacklistmanager );    
+    doLog( iLog, err, KNoErrorString );*/
+    return err;
+    }
+TInt CHarvesterPluginTester::TestVideoHarvestingIndexL( CStifItemParser& aItem )
+    {
+    TInt error = KErrNone;
+    TPtrC filepath;
+    TPtrC filename;
+    TPtrC newFile;
+    CVideoPlugin* plugin = CVideoPlugin::NewL();
+    CHarvesterObserver* iPluginTester = CHarvesterObserver::NewL( plugin );
+    plugin->StartPluginL();
+    RFs fSession;
+    fSession.Connect();
+    CleanupClosePushL( fSession );
+    if((aItem.GetNextString(filepath)==KErrNone) && (aItem.GetNextString(filename) == KErrNone))
+        {        
+        TBuf<KMaxFileName> desPath(_L("c:\\data\\Videos\\"));
+        desPath.Append( filename );
+        //Delete the file if it already exists
+        fSession.Delete( desPath ); 
+        //To ensure video plugin is loaded, pause the harvester
+        RHarvesterClient harvester;
+        User::LeaveIfError(harvester.Connect());
+        harvester.Pause();
+        BaflUtils::EnsurePathExistsL( fSession, desPath );//Create folder
+        BaflUtils::CopyFile( fSession, filepath, desPath );
+        //Resume harvester for this harvesting
+        harvester.Resume();
+        harvester.Close();
+        //Now start video plugin harvesting
+        plugin->StartHarvestingL( _L(VIDEO_QBASEAPPCLASS) );
+        //wait for index to flush
+        iPluginTester->SetWaitTime( (TTimeIntervalMicroSeconds32)60000000 );
+        //wait till video harvesting completes
+        iPluginTester->iWaitForHarvester->Start();
+        TInt count = SearchForTextL( filename, _L(VIDEO_QBASEAPPCLASS), KNullDesC );
+        if(count <= 0)
+           {
+           error = KErrNotFound;
+           }
+        }
+        else
+           error = KErrNotFound;
+    CleanupStack::PopAndDestroy();
+    delete plugin;
+    delete iPluginTester;
+    doLog( iLog, error, _L("Error in TestVideoHarvestingIndexL") );
+    return error;
+    }
+
+TInt CHarvesterPluginTester::TestVideoHarvestingUpdateIndexL( CStifItemParser& aItem )
+    {
+    TInt error = KErrNone;
+    TPtrC filepath;
+    TPtrC filename;
+    TPtrC newFile;
+    TBuf<KMaxFileName> srcPath(_L("c:\\data\\Videos\\"));
+    TBuf<KMaxFileName> desPath;
+    desPath.Copy( srcPath );
+    CVideoPlugin* plugin = CVideoPlugin::NewL();
+    CHarvesterObserver* iPluginTester = CHarvesterObserver::NewL( plugin );
+    plugin->StartPluginL();
+    RFs fSession;
+    fSession.Connect();
+    CleanupClosePushL( fSession );
+    if((aItem.GetNextString(filepath)==KErrNone) && (aItem.GetNextString(filename) == KErrNone))
+        {
+        srcPath.Append( filename );
+        if( aItem.GetNextString(newFile) == KErrNone )
+            {
+            desPath.Append( newFile );
+            RHarvesterClient harvester;
+            User::LeaveIfError(harvester.Connect());
+            harvester.Pause();
+            TBool fileExist = BaflUtils::FileExists( fSession, srcPath );        
+            if(!fileExist)
+            {
+            BaflUtils::EnsurePathExistsL( fSession, srcPath );//Create folder
+            BaflUtils::CopyFile( fSession, filepath, srcPath );                    
+            }            
+            BaflUtils::RenameFile( fSession, srcPath, desPath );
+            harvester.Resume();
+            harvester.Close();
+            plugin->StartHarvestingL( _L(VIDEO_QBASEAPPCLASS) );
+            //wait for index to flush
+            iPluginTester->SetWaitTime( (TTimeIntervalMicroSeconds32)60000000 );
+            //wait till video harvesting completes
+            iPluginTester->iWaitForHarvester->Start();
+            TInt count = SearchForTextL(_L("Falls"), _L(VIDEO_QBASEAPPCLASS), KNullDesC );
+            if(count <= 0)
+               {
+               error = KErrNotFound;
+               }
+            doLog( iLog, error, _L("Error in TestVideoHarvestingUpdateIndexL") );
+            }        
+        }
+    else
+        doLog( iLog, KErrNotFound, _L("Error in TestVideoHarvestingUpdateIndexL") );           
+    CleanupStack::PopAndDestroy();
+    delete plugin;
+    delete iPluginTester;
+    return error;
+    }
+
+TInt CHarvesterPluginTester::TestVideoHarvestingDeleteIndexL( CStifItemParser& aItem )
+    {
+    TInt error = KErrNone;
+    TPtrC filepath;
+    TPtrC filename;    
+    TBuf<KMaxFileName> srcPath(_L("c:\\data\\Videos\\"));
+    CVideoPlugin* plugin = CVideoPlugin::NewL();
+    CHarvesterObserver* iPluginTester = CHarvesterObserver::NewL( plugin );
+    plugin->StartPluginL();
+    RFs fSession;
+    fSession.Connect();
+    CleanupClosePushL( fSession );
+    if((aItem.GetNextString(filepath)==KErrNone) && (aItem.GetNextString(filename) == KErrNone))
+        {
+        srcPath.Append( filename );        
+        RHarvesterClient harvester;
+        User::LeaveIfError(harvester.Connect());
+        harvester.Pause();
+        TBool fileExist = BaflUtils::FileExists( fSession, srcPath );        
+        if(!fileExist)
+        {
+        BaflUtils::EnsurePathExistsL( fSession, srcPath );//Create folder
+        BaflUtils::CopyFile( fSession, filepath, srcPath );                    
+        }            
+        BaflUtils::DeleteFile( fSession, srcPath );        
+        harvester.Resume();
+        harvester.Close();
+        plugin->StartHarvestingL( _L(VIDEO_QBASEAPPCLASS) );
+        //wait for index to flush
+        iPluginTester->SetWaitTime( (TTimeIntervalMicroSeconds32)60000000 );
+        //wait till video harvesting completes
+        iPluginTester->iWaitForHarvester->Start();
+        TInt count = SearchForTextL(_L("Niagara"), _L(VIDEO_QBASEAPPCLASS), KNullDesC );
+        if(count <= 0)
+           {
+           // If the search is not found,then testcase is success
+           doLog( iLog, error, _L("Error in TestVideoHarvestingDeleteIndexL") );
+           }
+        }
+    else
+        doLog( iLog, KErrNotFound, _L("Error in TestVideoHarvestingDeleteIndexL") );           
+    CleanupStack::PopAndDestroy();
+    delete plugin;
+    delete iPluginTester;
+    return error;
+    }
+
+TInt CHarvesterPluginTester::TestImageHarvestingAddIndexL( CStifItemParser& aItem )
+    {
+    TInt error = KErrNone;
+    TPtrC filepath;
+    TPtrC filename;
+    TPtrC newFile;
+    CImagePlugin* plugin = CImagePlugin::NewL();
+    CHarvesterObserver* iPluginTester = CHarvesterObserver::NewL( plugin );
+    plugin->StartPluginL();
+    RFs fSession;
+    fSession.Connect();
+    CleanupClosePushL( fSession );
+    if((aItem.GetNextString(filepath)==KErrNone) && (aItem.GetNextString(filename) == KErrNone))
+        {        
+        TBuf<KMaxFileName> desPath(_L("c:\\data\\Images\\"));
+        desPath.Append( filename );
+        //Delete the file if it already exists
+        fSession.Delete( desPath ); 
+        //To ensure video plugin is loaded, pause the harvester
+        RHarvesterClient harvester;
+        User::LeaveIfError(harvester.Connect());
+        harvester.Pause();
+        BaflUtils::EnsurePathExistsL( fSession, desPath );//Create folder
+        BaflUtils::CopyFile( fSession, filepath, desPath );
+        //Resume harvester for this harvesting
+        harvester.Resume();
+        harvester.Close();
+        //Now start video plugin harvesting
+        plugin->StartHarvestingL( _L(IMAGE_QBASEAPPCLASS) );
+        //wait for index to flush
+        iPluginTester->SetWaitTime( (TTimeIntervalMicroSeconds32)60000000 );
+        iPluginTester->iWaitForHarvester->Start();
+        TInt count = SearchForTextL( filename, _L(IMAGE_QBASEAPPCLASS), KNullDesC );
+        if(count <= 0)
+           {
+           error = KErrNotFound;
+           }
+        }
+        else
+           error = KErrNotFound;
+    doLog( iLog, error, _L("Error in TestImageHarvestingAddIndexL") );  
+    CleanupStack::PopAndDestroy();
+    delete plugin;
+    delete iPluginTester;
+    return error;
+    }
+
+TInt CHarvesterPluginTester::TestImageHarvestingUpdateIndexL( CStifItemParser& aItem )
+    {
+    TInt error = KErrNone;
+    TPtrC filepath;
+    TPtrC filename;
+    TPtrC newFile;
+    TBuf<KMaxFileName> srcPath(_L("c:\\data\\Images\\"));
+    TBuf<KMaxFileName> desPath;
+    desPath.Copy( srcPath );
+    CImagePlugin* plugin = CImagePlugin::NewL();
+    CHarvesterObserver* iPluginTester = CHarvesterObserver::NewL( plugin );
+    plugin->StartPluginL();
+    RFs fSession;
+    fSession.Connect();
+    CleanupClosePushL( fSession );
+    if((aItem.GetNextString(filepath)==KErrNone) && (aItem.GetNextString(filename) == KErrNone))
+        {
+        srcPath.Append( filename );
+        if( aItem.GetNextString(newFile) == KErrNone )
+            {
+            desPath.Append( newFile );
+            RHarvesterClient harvester;
+            User::LeaveIfError(harvester.Connect());
+            harvester.Pause();
+            TBool fileExist = BaflUtils::FileExists( fSession, srcPath );        
+            if(!fileExist)
+            {
+            BaflUtils::EnsurePathExistsL( fSession, srcPath );//Create folder
+            BaflUtils::CopyFile( fSession, filepath, srcPath );                    
+            }            
+            BaflUtils::RenameFile( fSession, srcPath, desPath );
+            harvester.Resume();
+            harvester.Close();
+            plugin->StartHarvestingL( _L(IMAGE_QBASEAPPCLASS) );
+            //wait for index to flush
+            iPluginTester->SetWaitTime( (TTimeIntervalMicroSeconds32)60000000 );            
+            iPluginTester->iWaitForHarvester->Start();
+            TInt count = SearchForTextL(_L("Portrait"), _L(IMAGE_QBASEAPPCLASS), KNullDesC );
+            if(count <= 0)
+               {
+               error = KErrNotFound;
+               }
+            doLog( iLog, error, _L("Error in TestImageHarvestingUpdateIndexL") );
+            }        
+        }
+    else
+        doLog( iLog, KErrNotFound, _L("Error in TestImageHarvestingUpdateIndexL") );           
+    CleanupStack::PopAndDestroy();
+    delete plugin;
+    delete iPluginTester;
+    return error;
+    }
+
+TInt CHarvesterPluginTester::TestImageHarvestingDeleteIndexL( CStifItemParser& aItem )
+    {
+    TInt error = KErrNone;
+    TPtrC filepath;
+    TPtrC filename;    
+    TBuf<KMaxFileName> srcPath(_L("c:\\data\\Images\\"));
+    CImagePlugin* plugin = CImagePlugin::NewL();
+    CHarvesterObserver* iPluginTester = CHarvesterObserver::NewL( plugin );
+    plugin->StartPluginL();
+    RFs fSession;
+    fSession.Connect();
+    CleanupClosePushL( fSession );
+    if((aItem.GetNextString(filepath)==KErrNone) && (aItem.GetNextString(filename) == KErrNone))
+        {
+        srcPath.Append( filename );        
+        RHarvesterClient harvester;
+        User::LeaveIfError(harvester.Connect());
+        harvester.Pause();
+        TBool fileExist = BaflUtils::FileExists( fSession, srcPath );        
+        if(!fileExist)
+        {
+        BaflUtils::EnsurePathExistsL( fSession, srcPath );//Create folder
+        BaflUtils::CopyFile( fSession, filepath, srcPath );                    
+        }            
+        BaflUtils::DeleteFile( fSession, srcPath );        
+        harvester.Resume();
+        harvester.Close();
+        plugin->StartHarvestingL( _L(IMAGE_QBASEAPPCLASS) );
+        //wait for index to flush
+        iPluginTester->SetWaitTime( (TTimeIntervalMicroSeconds32)60000000 );
+        //wait till image harvesting completes
+        iPluginTester->iWaitForHarvester->Start();
+        TInt count = SearchForTextL(_L("Square"), _L(IMAGE_QBASEAPPCLASS), KNullDesC );
+        if(count <= 0)
+           {
+           // If the search is not found,then testcase is success
+           doLog( iLog, error, _L("Error in TestImageHarvestingDeleteIndexL") );
+           }
+        }
+    else
+        doLog( iLog, KErrNotFound, _L("Error in TestImageHarvestingDeleteIndexL") );           
+    CleanupStack::PopAndDestroy();
+    delete plugin;
+    delete iPluginTester;
+    return error;
+    }
+
+TInt CHarvesterPluginTester::TestAudioMMCEventL( CStifItemParser& aItem )
+    {    
+    TInt error(KErrNone);
+    TInt drive;    
+    TInt mmcstatus;
+    aItem.GetNextInt ( drive );
+    aItem.GetNextInt ( mmcstatus );    
+    CAudioPlugin* plugin = CAudioPlugin::NewL();
+    CHarvesterObserver* iPluginTester = CHarvesterObserver::NewL( plugin );
+    plugin->StartPluginL(); //Initialize the Plugin
+    TRAPD( err , plugin->HandleMMCEventL( (TDriveNumber)drive , mmcstatus) );
+    //iPluginTester->iWaitForHarvester->Start(); //Start Wait AO and let it complete
+    doLog(iLog,error,_L("Error in TestAudioMMCEventL"));
+    delete plugin;
+    delete iPluginTester;    
+    //End search
+    return err;
+    }
+        
+TInt CHarvesterPluginTester::TestVideoMMCEventL( CStifItemParser& aItem )
+    {
+    TInt error(KErrNone);
+    TInt drive;    
+    TInt mmcstatus;
+    aItem.GetNextInt ( drive );
+    aItem.GetNextInt ( mmcstatus );    
+    CVideoPlugin* plugin = CVideoPlugin::NewL();
+    CHarvesterObserver* iPluginTester = CHarvesterObserver::NewL( plugin );
+    plugin->StartPluginL(); //Initialize the Plugin
+    TRAPD( err , plugin->HandleMMCEventL( (TDriveNumber)drive , mmcstatus) );
+    //iPluginTester->iWaitForHarvester->Start(); //Start Wait AO and let it complete
+    doLog(iLog,error,_L("Error in TestVideoMMCEventL"));
+    delete plugin;
+    delete iPluginTester;    
+    //End search
+    return err;
+    }
+        
+TInt CHarvesterPluginTester::TestImageMMCEventL( CStifItemParser& aItem )
+    {
+    TInt error(KErrNone);
+    TInt drive;    
+    TInt mmcstatus;
+    aItem.GetNextInt ( drive );
+    aItem.GetNextInt ( mmcstatus );    
+    CImagePlugin* plugin = CImagePlugin::NewL();
+    CHarvesterObserver* iPluginTester = CHarvesterObserver::NewL( plugin );
+    plugin->StartPluginL(); //Initialize the Plugin
+    TRAPD( err , plugin->HandleMMCEventL( (TDriveNumber)drive , mmcstatus) );
+    //iPluginTester->iWaitForHarvester->Start(); //Start Wait AO and let it complete
+    doLog(iLog,error,_L("Error in TestImageMMCEventL"));
+    delete plugin;
+    delete iPluginTester;    
+    //End search
+    return err;
+    }
+
+//  [End of File] - Do not remove
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/harvesterplugins/tsrc/performanceSummary.pl	Mon Apr 19 14:40:05 2010 +0300
@@ -0,0 +1,93 @@
+#
+# Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+# All rights reserved.
+# This component and the accompanying materials are made available
+# under the terms of "Eclipse Public License v1.0"
+# which accompanies this distribution, and is available
+# at the URL "http://www.eclipse.org/legal/epl-v10.html".
+#
+# Initial Contributors:
+# Nokia Corporation - initial contribution.
+#
+# Contributors:
+#
+# Description: 
+#
+
+#Change Log:
+#version 0.2: Analyzes multiple files in current directory.
+#version 0.1: Initial functionality.
+#
+#Provides summary of performance logs which are in the format:
+#add nnn - Time for add operation
+#del nnn - Time for delete operation
+#upd nnn - Time for update opearation
+#Ignores all other lines.
+#
+#Reads the current directory looking for file names 
+#with the pattern '*Perf.txt' (case sensitive).
+#
+#Prints the cumulative times for all ADD/DEL/UPD operations
+
+use warnings;
+use strict;
+
+#This prints the summary; called by analzyeFile
+sub printSummary($$$){ 
+	print "Total time for Add: ".(shift)."\n";
+	print "Total time for Delete: ".(shift)."\n";
+	print "Total time for Update: ".(shift)."\n";
+	print "-------------------------------------\n\n";
+}
+
+#This function analyzes the contents of the performance logs file
+sub analyzeFile($){
+	my $fh = shift;
+	my $add=0;
+	my $del=0; 
+	my $upd=0;
+	foreach my $line (<$fh>){
+		chomp($line);#remove the newline from $line.
+		#Documentation recommends not to use $' for
+		#performance reasons. In this case, its okay.
+		if ($line =~ m/^add */) {
+			$add += $';
+		}
+		if($line =~ m/^del */) {
+			$del += $';
+		}
+		if($line =~ m/^upd */) {
+			$upd += $';
+		}
+	}
+	#better if we can 'return; these values and have the 
+	#caller print the values returned.
+	#very tight function coupling otherwise.
+	printSummary($add, $del, $upd);
+}
+
+#Main entry point
+sub main(){
+	#We can change the function to be able to read
+	#cmd line args and analyze the necessary directory
+	#but thats for later. Not required for the moment.
+	my $directory = ".";
+	my $dirHandle;
+
+	opendir($dirHandle, "$directory") or die("Could not list directory $directory.");
+	my @thefiles = readdir($dirHandle);
+
+	foreach my $f (@thefiles){
+		if ($f =~ m/Perf\.txt$/) {#should end with "Perf.txt"
+			open my $inputFile, "<$f" or die("Could not open log file $f.");
+			print "File: ".$f."\n";
+			print "-----------------------\n";
+			analyzeFile($inputFile);
+			close($inputFile);
+		}
+	}
+	closedir($dirHandle);
+}
+
+#Call main() to do the work.
+main();
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/layers.sysdef.xml	Mon Apr 19 14:40:05 2010 +0300
@@ -0,0 +1,14 @@
+<?xml version="1.0"?>
+<!DOCTYPE SystemDefinition SYSTEM "sysdef_1_5_1.dtd" [
+  <!ENTITY layer_real_source_path "sf/app/search" >
+]>
+<SystemDefinition name="search" schema="1.5.1">
+  <systemModel>
+    <layer name="app_layer">
+    	<module name="search">
+				<unit unitID="orgdo.search.bldinf" mrp="" bldFile="&layer_real_source_path;/group" name="search_bldinf"/>
+				<unit unitID="orgdo.search.pro" mrp="" bldFile="&layer_real_source_path;/searchui" name="search_pro" proFile="searchui.pro"/>
+      </module>
+    </layer>
+  </systemModel>
+</SystemDefinition>
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/rom/cpix_app.iby	Mon Apr 19 14:40:05 2010 +0300
@@ -0,0 +1,59 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Includes additional application IBYs for PF52.50/ivalo
+*/
+
+#ifndef __CPIXHARVESTER_IBY__
+#define __CPIXHARVESTER_IBY__
+
+
+#ifdef FF_SEARCH_SW
+// Media Audio plugin
+ECOM_PLUGIN( cpixaudioplugin.dll, cpixaudioplugin.rsc)
+
+// Media Image plugin
+ECOM_PLUGIN( cpiximageplugin.dll, cpiximageplugin.rsc)
+
+// Media video plugin
+ECOM_PLUGIN( cpixvideoplugin.dll, cpixvideoplugin.rsc)
+
+//Message plugin
+ECOM_PLUGIN( cpixmessageplugin.dll, cpixmessageplugin.rsc)
+
+// Contact plugin
+ECOM_PLUGIN( cpixcontactsplugin.dll, cpixcontactsplugin.rsc)
+
+// File plugin
+ECOM_PLUGIN( cpixfileplugin.dll, cpixfileplugin.rsc)
+
+// Bookmark plugin
+ECOM_PLUGIN( cpixbookmarksplugin.dll, cpixbookmarksplugin.rsc)
+
+//Calender plugin
+ECOM_PLUGIN( cpixcalendarplugin.dll, cpixcalendarplugin.rsc)
+
+// cpixfileserverplugin.pxt, file server pxt plugin
+file=ABI_DIR\BUILD_DIR\cpixfileserverplugin.pxt	SHARED_LIB_DIR\cpixfileserverplugin.pxt
+
+//Application plugin
+ECOM_PLUGIN( cpixapplicationsplugin.dll, cpixapplicationsplugin.rsc)
+
+// Notes plugin
+ECOM_PLUGIN( cpixnotesplugin.dll, cpixnotesplugin.rsc)
+
+data=DATAZ_\private\10202be9\20029ac7.cre       private\10202be9\20029ac7.cre
+
+#endif //FF_SEARCH_SW
+
+#endif // __CPIXHARVESTER_IBY__
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/searchui/Searchapplication/Searchapplication.pri	Mon Apr 19 14:40:05 2010 +0300
@@ -0,0 +1,19 @@
+#
+# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+# All rights reserved.
+# This component and the accompanying materials are made available
+# under the terms of "Eclipse Public License v1.0"
+# which accompanies this distribution, and is available
+# at the URL "http://www.eclipse.org/legal/epl-v10.html".
+#
+# Initial Contributors:
+# Nokia Corporation - initial contribution.
+#
+# Contributors:
+#
+# Description:  Search application list of files
+#
+
+HEADERS += ./inc/*.h
+SOURCES += ./src/*.cpp
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/searchui/Searchapplication/Searchapplication.pro	Mon Apr 19 14:40:05 2010 +0300
@@ -0,0 +1,69 @@
+#
+# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+# All rights reserved.
+# This component and the accompanying materials are made available
+# under the terms of "Eclipse Public License v1.0"
+# which accompanies this distribution, and is available
+# at the URL "http://www.eclipse.org/legal/epl-v10.html".
+#
+# Initial Contributors:
+# Nokia Corporation - initial contribution.
+#
+# Contributors:
+#
+# Description:  `Search application project file
+#
+
+TEMPLATE = app
+
+TARGET = Searchapplication 
+
+win32 {
+    INCLUDEPATH += \
+                  $$PWD/../../homescreensrv/homescreensrv_plat/appruntimemodel_api
+    LIBS += -L$$PWD/../../bin/debug
+    
+    CONFIG(debug, debug|release) {
+      SUBDIRPART = debug
+    } else {
+      SUBDIRPART = release
+    }
+    DESTDIR = $$PWD/../../bin/$$SUBDIRPART
+}
+
+LIBS +=  -lappruntimemodel
+
+QT += xml 
+
+CONFIG += hb    
+CONFIG += console
+
+TRANSLATIONS += searchsw.ts 
+nft:DEFINES += NFT
+
+DEPENDPATH += . \
+              ./inc \
+              ./src
+
+INCLUDEPATH += . \
+               ./inc \
+               ../inc
+
+symbian {
+    TARGET.UID2 = 0x100039CE
+    TARGET.UID3 = 0x2002C377
+    TARGET.CAPABILITY = CAP_APPLICATION AllFiles TrustedUI
+    TARGET.EPOCSTACKSIZE = 0x14000 // 80kB
+    TARGET.EPOCHEAPSIZE = 0x20000 0x1000000 // 128kB - 16MB
+    rom:DEFINES += ROM
+    ICON = resources/search_app_icon.svg
+    icon.sources = resources/search_app_icon.svg
+    icon.path = /searchresources  
+    DEPLOYMENT += icon addFiles
+}
+
+win32 {
+include(Searchapplication_installs_win32.pri)
+}
+
+include(Searchapplication.pri)
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/searchui/Searchapplication/Searchapplication_installs_symbian.pri	Mon Apr 19 14:40:05 2010 +0300
@@ -0,0 +1,27 @@
+#
+# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+# All rights reserved.
+# This component and the accompanying materials are made available
+# under the terms of "Eclipse Public License v1.0"
+# which accompanies this distribution, and is available
+# at the URL "http://www.eclipse.org/legal/epl-v10.html".
+#
+# Initial Contributors:
+# Nokia Corporation - initial contribution.
+#
+# Contributors:
+#
+# Description: 
+#
+
+
+#deploy.path = z:
+
+#exports1.path = /private/20026F95
+
+#exports1.sources += resource/ftudb
+
+#for(export1, exports1.sources):BLD_INF_RULES.prj_exports += "./$$export1 $$deploy.path$$exports1.path/$$basename(export1)"
+
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/searchui/Searchapplication/Searchapplication_installs_unix.pri	Mon Apr 19 14:40:05 2010 +0300
@@ -0,0 +1,33 @@
+#
+# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+# All rights reserved.
+# This component and the accompanying materials are made available
+# under the terms of "Eclipse Public License v1.0"
+# which accompanies this distribution, and is available
+# at the URL "http://www.eclipse.org/legal/epl-v10.html".
+#
+# Initial Contributors:
+# Nokia Corporation - initial contribution.
+#
+# Contributors:
+#
+# Description: 
+#
+#
+
+# Release
+#
+
+r01.path = ../../bin/release/
+r01.files = ./release/Searchapplication
+
+INSTALLS += r01
+
+#
+# Debug
+#
+
+d01.path = ../../bin/debug/
+d01.files = ./debug/Searchapplication
+
+INSTALLS += d01
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/searchui/Searchapplication/Searchapplication_installs_win32.pri	Mon Apr 19 14:40:05 2010 +0300
@@ -0,0 +1,32 @@
+#
+# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+# All rights reserved.
+# This component and the accompanying materials are made available
+# under the terms of "Eclipse Public License v1.0"
+# which accompanies this distribution, and is available
+# at the URL "http://www.eclipse.org/legal/epl-v10.html".
+#
+# Initial Contributors:
+# Nokia Corporation - initial contribution.
+#
+# Contributors:
+#
+# Description: 
+#
+#
+# Release
+#
+
+r01.path = $$PWD/../../bin/release/
+r01.files = ./release/*.*
+
+INSTALLS += r01
+
+#
+# Debug
+#
+
+d01.path = $$PWD/../../bin/debug/
+d01.files = ./debug/*.*
+
+INSTALLS += d01
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/searchui/Searchapplication/inc/Search.h	Mon Apr 19 14:40:05 2010 +0300
@@ -0,0 +1,110 @@
+/*
+ * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+ * All rights reserved.
+ * This component and the accompanying materials are made available
+ * under the terms of "Eclipse Public License v1.0"
+ * which accompanies this distribution, and is available
+ * at the URL "http://www.eclipse.org/legal/epl-v10.html".
+ *
+ * Initial Contributors:
+ * Nokia Corporation - initial contribution.
+ *
+ * Contributors:
+ *
+ * Description:  search application main class.
+ *
+ */
+
+#ifndef SEARCHAPPLICATION_H
+#define SEARCHAPPLICATION_H
+
+#include "Search_global.h"
+
+#include <QObject>
+
+class HsRuntime;
+
+/**
+ * @ingroup group_searchsearchlication
+ * @brief Search application main class.
+ * 
+ * Loads a runtime from a runtime provider plugin. Manages 
+ * the runtime execution.
+ *
+ * @lib ?library
+ * @since S60 ?S60_version
+ */
+class Search : public QObject
+    {
+Q_OBJECT
+
+public:
+
+    /**
+     * Constructor.
+     * @since S60 ?S60_version.     
+     * @param aParent Parent object.
+     */
+    Search(QObject* aParent = 0);
+
+    /**
+     * Destructor.
+     * @since S60 ?S60_version.     
+     */
+    virtual ~Search();
+
+private:
+
+    Q_DISABLE_COPY(Search)
+
+signals:
+
+    /**
+     * Emitted when the search application needs to exit.
+     * @since S60 ?S60_version.     
+     */
+    void exit();
+
+public slots:
+
+    /**
+     * Starts the runtime.
+     * @since S60 ?S60_version. 
+     */
+    void start();
+
+    /**
+     * Stops the runtime.
+     * @since S60 ?S60_version.     
+     */
+    void stop();
+
+private slots:
+
+    /**
+     * Called after the runtime has started.
+     * @since S60 ?S60_version.     
+     */
+    void handleRuntimeStarted();
+
+    /**
+     * Called after the runtime has stopped.
+     * @since S60 ?S60_version.     
+     */
+    void handleRuntimeStopped();
+
+    /**
+     * Called after the runtime has faulted.
+     * @since S60 ?S60_version.     
+     */
+    void handleRuntimeFaulted();
+
+private:
+
+    /**
+     * Runtime.
+     */
+    HsRuntime* mRuntime;
+    };
+
+#endif//SEARCHAPPLICATION_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/searchui/Searchapplication/resources/search_app_icon.svg	Mon Apr 19 14:40:05 2010 +0300
@@ -0,0 +1,76 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 13.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 14948)  -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.0//EN" "http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd">
+<svg version="1.0" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+	 width="50px" height="50px" viewBox="0 0 50 50" enable-background="new 0 0 50 50" xml:space="preserve">
+<g>
+	<rect x="3.208" y="2.854" fill="none" width="44" height="44"/>
+	<path opacity="0.15" d="M32.209,44.854h-14c-2.205,0-4-1.795-4-4v-26c0-2.205,1.795-4,4-4h11.149l1.914-5.912
+		c0.132-0.406,0.504-0.685,0.931-0.693c0.007,0,0.013,0,0.019,0c0.42,0,0.795,0.26,0.94,0.654l2.57,6.975l6.971,0.013
+		c0.42,0,0.795,0.264,0.938,0.658c0.144,0.396,0.024,0.838-0.297,1.108l-5.543,4.658l1.86,6.666c0.113,0.402-0.037,0.83-0.373,1.076
+		c-0.176,0.129-0.383,0.193-0.59,0.193c-0.19,0-0.383-0.054-0.549-0.164l-1.941-1.275v16.042
+		C36.208,43.059,34.413,44.854,32.209,44.854L32.209,44.854z"/>
+	<path opacity="0.5" d="M36.663,17.962l6.036-5.071l-7.667-0.014L32.224,5.25l-2.138,6.604H18.208c-1.654,0-3,1.346-3,3v26
+		c0,1.654,1.346,3,3,3h14c1.654,0,3-1.346,3-3V22.956l3.489,2.294L36.663,17.962z"/>
+	
+		<linearGradient id="SVGID_1_" gradientUnits="userSpaceOnUse" x1="142.6875" y1="-59.4478" x2="142.6875" y2="-101.7325" gradientTransform="matrix(1 0 0 -1 -117.4805 -52.0195)">
+		<stop  offset="0" style="stop-color:#3687FF"/>
+		<stop  offset="1" style="stop-color:#051F7D"/>
+	</linearGradient>
+	<path fill="url(#SVGID_1_)" d="M32.208,10.854h-14c-1.654,0-3,1.346-3,3v26c0,1.654,1.346,3,3,3h14c1.654,0,3-1.346,3-3v-26
+		C35.208,12.2,33.862,10.854,32.208,10.854z"/>
+	
+		<linearGradient id="SVGID_2_" gradientUnits="userSpaceOnUse" x1="142.6875" y1="-59.8735" x2="142.6875" y2="-96.8744" gradientTransform="matrix(1 0 0 -1 -117.4805 -52.0195)">
+		<stop  offset="0" style="stop-color:#F2F2F2"/>
+		<stop  offset="0.1364" style="stop-color:#E4EDF0"/>
+		<stop  offset="0.3929" style="stop-color:#C0DFEB"/>
+		<stop  offset="0.7391" style="stop-color:#86C8E3"/>
+		<stop  offset="0.9945" style="stop-color:#57B6DD"/>
+		<stop  offset="1" style="stop-color:#57B6DD"/>
+	</linearGradient>
+	<rect x="18.208" y="14.854" fill="url(#SVGID_2_)" width="14" height="18"/>
+	<polygon fill="#FFFFFF" fill-opacity="0.4" points="18.208,27.889 32.208,20.889 32.208,14.854 18.208,14.854 	"/>
+	
+		<linearGradient id="SVGID_3_" gradientUnits="userSpaceOnUse" x1="142.6875" y1="-87.873" x2="142.6875" y2="-91.873" gradientTransform="matrix(1 0 0 -1 -117.4805 -52.0195)">
+		<stop  offset="0" style="stop-color:#FFFFFF"/>
+		<stop  offset="1" style="stop-color:#B2B2B2"/>
+	</linearGradient>
+	<rect x="23.208" y="35.854" fill="url(#SVGID_3_)" width="4" height="4"/>
+	<path fill="#FFFFFF" fill-opacity="0.25" d="M33.62,12.442l0.709-0.708c-0.544-0.544-1.294-0.88-2.121-0.88h-14
+		c-1.654,0-3,1.346-3,3v26c0,0.828,0.336,1.578,0.879,2.121l0.709-0.707c-0.363-0.363-0.588-0.863-0.588-1.414v-26c0-1.1,0.9-2,2-2
+		h14C32.758,11.854,33.258,12.079,33.62,12.442z"/>
+	<path fill-opacity="0.2" d="M34.317,11.724l-0.717,0.7c0.373,0.365,0.607,0.869,0.607,1.43v26c0,1.102-0.9,2-2,2h-14
+		c-0.55,0-1.051-0.225-1.412-0.586l-0.709,0.707c0.544,0.543,1.294,0.879,2.121,0.879h14c1.654,0,3-1.346,3-3v-26
+		C35.208,13.022,34.866,12.268,34.317,11.724z"/>
+	<polygon fill="#FFFFFF" fill-opacity="0.2" points="32.208,14.854 32.208,32.854 18.208,32.854 17.208,33.854 33.208,33.854 
+		33.208,13.854 	"/>
+	<polygon fill-opacity="0.25" points="18.208,32.854 18.208,14.854 32.208,14.854 33.208,13.854 17.208,13.854 17.208,33.854 	"/>
+	<path fill="#FFFFFF" fill-opacity="0.2" d="M27.862,35.098l-0.654,0.756v4h-4l-0.771,0.637c0.183,0.221,0.46,0.363,0.771,0.363h4
+		c0.553,0,1-0.449,1-1v-4C28.208,35.553,28.074,35.281,27.862,35.098z"/>
+	<path fill-opacity="0.25" d="M23.208,39.854v-4h4l0.654-0.756c-0.176-0.152-0.404-0.244-0.654-0.244h-4c-0.553,0-1,0.449-1,1v4
+		c0,0.242,0.086,0.463,0.229,0.637L23.208,39.854z"/>
+	<path opacity="0.3" d="M35.166,23.55v-9.701c0-1.654-1.346-3-3-3h-2.324l-0.492,1.522l-7.646,0.014
+		c-0.213,0-0.402,0.134-0.471,0.335c-0.071,0.201-0.006,0.425,0.16,0.557l6.107,4.855l-2.268,6.958
+		c-0.065,0.199,0.002,0.418,0.167,0.548c0.089,0.071,0.199,0.106,0.306,0.106c0.092,0,0.186-0.025,0.268-0.076l6.371-3.977
+		L35.166,23.55z"/>
+	<g>
+		
+			<linearGradient id="SVGID_4_" gradientUnits="userSpaceOnUse" x1="-126.7969" y1="301.3916" x2="-126.7969" y2="329.7876" gradientTransform="matrix(1 0 0 1 159.02 -299.4092)">
+			<stop  offset="0" style="stop-color:#FFE23D"/>
+			<stop  offset="1" style="stop-color:#E48717"/>
+		</linearGradient>
+		<polygon fill="url(#SVGID_4_)" points="32.224,4.25 35.032,11.877 42.699,11.891 36.663,16.962 38.697,24.25 32.394,20.105 
+			25.75,24.25 28.125,16.962 21.747,11.891 29.755,11.877 		"/>
+		<path fill-opacity="0.2" d="M29.291,16.611c0,0-2.8-2.227-4.686-3.727c0.001,0,0.002,0,0.004,0l-2.862-0.994l6.378,5.071
+			L29.291,16.611z"/>
+		<path fill-opacity="0.2" d="M42.699,11.891l-2.741,0.998c-1.786,1.5-4.432,3.723-4.432,3.723s0.889,3.184,1.49,5.338
+			c-1.863-1.225-4.609-3.03-4.609-3.03s-2.891,1.804-4.855,3.028c0.002-0.002,0.002-0.004,0.002-0.006L25.75,24.25l6.644-4.145
+			l6.304,4.145l-2.034-7.288L42.699,11.891z"/>
+		<path fill="#FFFFFF" fill-opacity="0.25" d="M42.699,11.891l-7.667-0.014L32.224,4.25l-2.469,7.627l-8.008,0.014l2.862,0.996
+			c2.365-0.005,5.875-0.011,5.875-0.011s1.072-3.317,1.801-5.565c0.83,2.252,2.051,5.565,2.051,5.565s3.361,0.006,5.625,0.011
+			c0,0-0.001,0-0.002,0.002L42.699,11.891z"/>
+		<path fill="#FFFFFF" fill-opacity="0.25" d="M25.75,24.25l1.804-2.309c0.701-2.15,1.737-5.33,1.737-5.33l-1.166,0.351L25.75,24.25
+			z"/>
+	</g>
+</g>
+</svg>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/searchui/Searchapplication/src/Search.cpp	Mon Apr 19 14:40:05 2010 +0300
@@ -0,0 +1,126 @@
+/*
+ * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+ * All rights reserved.
+ * This component and the accompanying materials are made available
+ * under the terms of "Eclipse Public License v1.0"
+ * which accompanies this distribution, and is available
+ * at the URL "http://www.eclipse.org/legal/epl-v10.html".
+ *
+ * Initial Contributors:
+ * Nokia Corporation - initial contribution.
+ *
+ * Contributors:
+ *
+ * Description:  Search application main class.
+ *
+ */
+
+#include "Search.h"
+#include "hsruntime.h"
+#include "hsruntimefactory.h"
+
+// ---------------------------------------------------------------------------
+// Search::Search
+// ---------------------------------------------------------------------------
+//
+Search::Search(QObject* aParent) :
+    QObject(aParent), mRuntime(NULL)
+    {
+    SEARCH_FUNC_ENTRY("SEARCH::Search::Search");
+
+    HsRuntimeFactory factory("searchresources/plugins/runtimeproviders",
+            "searchresources/plugins/runtimeproviders");
+
+    HsRuntimeToken token;
+    token.mLibrary = "searchruntimeprovider.dll";
+    token.mUri = "search.nokia.com/runtime/defaultruntime";
+
+    mRuntime = factory.createRuntime(token);
+    if (mRuntime)
+        {
+        mRuntime->setParent(this);
+        connect(mRuntime, SIGNAL(started()), SLOT(handleRuntimeStarted()));
+        connect(mRuntime, SIGNAL(stopped()), SLOT(handleRuntimeStopped()));
+        connect(mRuntime, SIGNAL(faulted()), SLOT(handleRuntimeFaulted()));
+        }
+
+    SEARCH_FUNC_EXIT("SEARCH::Search::Search");
+    }
+
+// ---------------------------------------------------------------------------
+// Search::~Search()
+// ---------------------------------------------------------------------------
+//
+Search::~Search()
+    {
+    if (mRuntime)
+        {
+        disconnect(mRuntime, SIGNAL(started()), this,
+                SLOT(handleRuntimeStarted()));
+        disconnect(mRuntime, SIGNAL(stopped()), this,
+                SLOT(handleRuntimeStopped()));
+        disconnect(mRuntime, SIGNAL(faulted()), this,
+                SLOT(handleRuntimeFaulted()));
+
+        delete mRuntime;
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// Search::start()
+// ---------------------------------------------------------------------------
+//
+void Search::start()
+    {
+    SEARCH_FUNC_ENTRY("SEARCH::Search::start");
+
+    if (mRuntime)
+        {
+        mRuntime->start();
+        }
+    else
+        {
+        emit exit();
+        }
+
+    SEARCH_FUNC_EXIT("SEARCH::Search::start");
+    }
+
+// ---------------------------------------------------------------------------
+// Search::stop()
+// ---------------------------------------------------------------------------
+//
+void Search::stop()
+    {
+    SEARCH_FUNC_ENTRY("SEARCH::Search::stop");
+
+    mRuntime->stop();
+
+    SEARCH_FUNC_EXIT("SEARCH::Search::stop");
+    }
+
+// ---------------------------------------------------------------------------
+// Search::handleRuntimeStarted()
+// ---------------------------------------------------------------------------
+//
+void Search::handleRuntimeStarted()
+    {
+    }
+
+// ---------------------------------------------------------------------------
+// Search::handleRuntimeStopped()
+// ---------------------------------------------------------------------------
+//
+void Search::handleRuntimeStopped()
+    {
+    emit exit();
+    }
+
+// ---------------------------------------------------------------------------
+// Search::handleRuntimeFaulted()
+// ---------------------------------------------------------------------------
+//
+void Search::handleRuntimeFaulted()
+    {
+    emit exit();
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/searchui/Searchapplication/src/main.cpp	Mon Apr 19 14:40:05 2010 +0300
@@ -0,0 +1,60 @@
+/*
+ * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+ * All rights reserved.
+ * This component and the accompanying materials are made available
+ * under the terms of "Eclipse Public License v1.0"
+ * which accompanies this distribution, and is available
+ * at the URL "http://www.eclipse.org/legal/epl-v10.html".
+ *
+ * Initial Contributors:
+ * Nokia Corporation - initial contribution.
+ *
+ * Contributors:
+ *
+ * Description:  Search application main implementation.
+ *
+ */
+
+#include "Search.h"
+#include "Search_global.h"
+
+#include <QtGui>
+#include <hbapplication.h>
+#include <qtranslator.h>
+#include <qlocale.h>
+
+// ---------------------------------------------------------------------------
+// main
+// ---------------------------------------------------------------------------
+//
+int main(int argc, char *argv[])
+    {
+    SEARCH_FUNC_ENTRY("SEARCH::Search::main");
+
+    HbApplication app(argc, argv);
+
+    QTranslator translator;
+    QString lang = QLocale::system().name();
+    QString path = "Z:/resource/qt/translations/";
+    translator.load("searchsw_" + lang, path);
+    app.installTranslator(&translator);
+
+    QTranslator commonTranslator;
+    commonTranslator.load("common_" + lang, path);
+    app.installTranslator(&commonTranslator);
+
+    Search search;
+#ifdef ROM
+    QDir::setCurrent("Z:/");
+#else
+    QDir::setCurrent("C:/");
+    SEARCHDEBUG("main() - SearchApplication's current dir set to C:/");
+#endif //ROM
+    QObject::connect(&app, SIGNAL(aboutToQuit()), &search, SLOT(stop()));
+    QObject::connect(&search, SIGNAL(exit()), &app, SLOT(quit()),
+            Qt::QueuedConnection);
+    search.start();
+    int ret = app.exec();
+    SEARCH_FUNC_EXIT("SEARCH::Search::main");
+    return ret;
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/searchui/bwins/searchindevicehandleru.def	Mon Apr 19 14:40:05 2010 +0300
@@ -0,0 +1,27 @@
+EXPORTS
+	??0InDeviceHandler@@QAE@XZ @ 1 NONAME ; InDeviceHandler::InDeviceHandler(void)
+	?setCategory@InDeviceHandler@@QAEXVQString@@@Z @ 2 NONAME ; void InDeviceHandler::setCategory(class QString)
+	?getDocumentAtIndex@InDeviceHandler@@QAEPAVQCPixDocument@@H@Z @ 3 NONAME ; class QCPixDocument * InDeviceHandler::getDocumentAtIndex(int)
+	?isPrepared@InDeviceHandler@@QAE_NXZ @ 4 NONAME ; bool InDeviceHandler::isPrepared(void)
+	?handleAsyncSearchResult@InDeviceHandler@@IAEXHH@Z @ 5 NONAME ; void InDeviceHandler::handleAsyncSearchResult(int, int)
+	?qt_metacast@InDeviceHandler@@UAEPAXPBD@Z @ 6 NONAME ; void * InDeviceHandler::qt_metacast(char const *)
+	?cancelLastSearch@InDeviceHandler@@QAEXXZ @ 7 NONAME ; void InDeviceHandler::cancelLastSearch(void)
+	?getDocumentAsyncAtIndex@InDeviceHandler@@QAEXH@Z @ 8 NONAME ; void InDeviceHandler::getDocumentAsyncAtIndex(int)
+	?metaObject@InDeviceHandler@@UBEPBUQMetaObject@@XZ @ 9 NONAME ; struct QMetaObject const * InDeviceHandler::metaObject(void) const
+	??_EInDeviceHandler@@UAE@I@Z @ 10 NONAME ; InDeviceHandler::~InDeviceHandler(unsigned int)
+	?qt_metacall@InDeviceHandler@@UAEHW4Call@QMetaObject@@HPAPAX@Z @ 11 NONAME ; int InDeviceHandler::qt_metacall(enum QMetaObject::Call, int, void * *)
+	?handleSearchResult@InDeviceHandler@@IAEXHH@Z @ 12 NONAME ; void InDeviceHandler::handleSearchResult(int, int)
+	?tr@InDeviceHandler@@SA?AVQString@@PBD0H@Z @ 13 NONAME ; class QString InDeviceHandler::tr(char const *, char const *, int)
+	??1InDeviceHandler@@UAE@XZ @ 14 NONAME ; InDeviceHandler::~InDeviceHandler(void)
+	?trUtf8@InDeviceHandler@@SA?AVQString@@PBD0@Z @ 15 NONAME ; class QString InDeviceHandler::trUtf8(char const *, char const *)
+	?getDocumentAsync@InDeviceHandler@@AAEXHPAVQCPixDocument@@@Z @ 16 NONAME ; void InDeviceHandler::getDocumentAsync(int, class QCPixDocument *)
+	?tr@InDeviceHandler@@SA?AVQString@@PBD0@Z @ 17 NONAME ; class QString InDeviceHandler::tr(char const *, char const *)
+	?search@InDeviceHandler@@QAEXVQString@@@Z @ 18 NONAME ; void InDeviceHandler::search(class QString)
+	?trUtf8@InDeviceHandler@@SA?AVQString@@PBD0H@Z @ 19 NONAME ; class QString InDeviceHandler::trUtf8(char const *, char const *, int)
+	?getStaticMetaObject@InDeviceHandler@@SAABUQMetaObject@@XZ @ 20 NONAME ; struct QMetaObject const & InDeviceHandler::getStaticMetaObject(void)
+	?getSearchResultCount@InDeviceHandler@@QAEHXZ @ 21 NONAME ; int InDeviceHandler::getSearchResultCount(void)
+	?searchAsync@InDeviceHandler@@QAEXVQString@@0@Z @ 22 NONAME ; void InDeviceHandler::searchAsync(class QString, class QString)
+	?staticMetaObject@InDeviceHandler@@2UQMetaObject@@B @ 23 NONAME ; struct QMetaObject const InDeviceHandler::staticMetaObject
+	?getSearchResult@InDeviceHandler@@AAEXHH@Z @ 24 NONAME ; void InDeviceHandler::getSearchResult(int, int)
+	?handleDocument@InDeviceHandler@@IAEXHPAVQCPixDocument@@@Z @ 25 NONAME ; void InDeviceHandler::handleDocument(int, class QCPixDocument *)
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/searchui/eabi/searchindevicehandleru.def	Mon Apr 19 14:40:05 2010 +0300
@@ -0,0 +1,27 @@
+EXPORTS
+	_ZN15InDeviceHandler10isPreparedEv @ 1 NONAME
+	_ZN15InDeviceHandler11qt_metacallEN11QMetaObject4CallEiPPv @ 2 NONAME
+	_ZN15InDeviceHandler11qt_metacastEPKc @ 3 NONAME
+	_ZN15InDeviceHandler11searchAsyncE7QStringS0_ @ 4 NONAME
+	_ZN15InDeviceHandler11setCategoryE7QString @ 5 NONAME
+	_ZN15InDeviceHandler14handleDocumentEiP13QCPixDocument @ 6 NONAME
+	_ZN15InDeviceHandler15getSearchResultEii @ 7 NONAME
+	_ZN15InDeviceHandler16cancelLastSearchEv @ 8 NONAME
+	_ZN15InDeviceHandler16getDocumentAsyncEiP13QCPixDocument @ 9 NONAME
+	_ZN15InDeviceHandler16staticMetaObjectE @ 10 NONAME DATA 16
+	_ZN15InDeviceHandler18getDocumentAtIndexEi @ 11 NONAME
+	_ZN15InDeviceHandler18handleSearchResultEii @ 12 NONAME
+	_ZN15InDeviceHandler19getStaticMetaObjectEv @ 13 NONAME
+	_ZN15InDeviceHandler20getSearchResultCountEv @ 14 NONAME
+	_ZN15InDeviceHandler23getDocumentAsyncAtIndexEi @ 15 NONAME
+	_ZN15InDeviceHandler23handleAsyncSearchResultEii @ 16 NONAME
+	_ZN15InDeviceHandler6searchE7QString @ 17 NONAME
+	_ZN15InDeviceHandlerC1Ev @ 18 NONAME
+	_ZN15InDeviceHandlerC2Ev @ 19 NONAME
+	_ZN15InDeviceHandlerD0Ev @ 20 NONAME
+	_ZN15InDeviceHandlerD1Ev @ 21 NONAME
+	_ZN15InDeviceHandlerD2Ev @ 22 NONAME
+	_ZNK15InDeviceHandler10metaObjectEv @ 23 NONAME
+	_ZTI15InDeviceHandler @ 24 NONAME
+	_ZTV15InDeviceHandler @ 25 NONAME
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/searchui/inc/Search_global.h	Mon Apr 19 14:40:05 2010 +0300
@@ -0,0 +1,76 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  The dll header file.
+*
+*/
+
+
+#ifndef SEARCH_GLOBAL_H
+#define SEARCH_GLOBAL_H
+
+#include <qdebug.h>
+
+#ifdef NFT
+#ifdef Q_OS_SYMBIAN
+#include <e32hal.h>
+#endif
+#endif
+
+#ifndef SEARCH_UNITTESTING
+    #define SEARCH_CLASS(aClassName)
+#else
+    #define SEARCH_CLASS(aClassName) class aClassName;
+#endif 
+
+#ifndef SEARCH_UNITTESTING
+    #define SEARCH_FRIEND_CLASS(aClassName)
+#else
+    #define SEARCH_FRIEND_CLASS(aClassName) friend class aClassName;
+#endif 
+
+#define SEARCHCATCHDEBUG qDebug("Catched in: %s on line: %d",__FILE__,__LINE__);
+#define SEARCHDEBUG(a) qDebug("%s in: %s on line: %d", (a),  __FILE__,__LINE__);
+
+#ifdef NFT
+    #define SEARCHTEST(aText)                  qDebug() << QString(aText)
+#ifdef Q_OS_SYMBIAN
+    inline void SEARCHFreeRam(const QString &aFunction)
+    {
+    TMemoryInfoV1Buf meminfo;
+    UserHal::MemoryInfo(meminfo);
+    int memSize = meminfo().iTotalRamInBytes >> 10;
+    int memFree = meminfo().iFreeRamInBytes >> 10;
+
+    RHeap& ownHeap = User::Heap();
+    TInt biggestBlock = 0;
+    int heapFree = ownHeap.Available(biggestBlock) >> 10;
+    int heapSize = ownHeap.Size() >> 10;
+    qDebug()<< aFunction << "memFree" << memFree << "kb memSize" << memSize << "kb heapFree" << heapFree << "kb heapSize" << heapSize;
+    }
+    
+    #define SEARCH_FUNC_ENTRY(aFunction)   SEARCHFreeRam(QString(aFunction)+" entry")
+    #define SEARCH_FUNC_EXIT(aFunction)    SEARCHFreeRam(QString(aFunction)+" exit")
+#else
+    #define SEARCH_FUNC_ENTRY(aFunction)   qDebug()<< aFunction << " entry";
+    #define SEARCH_FUNC_EXIT(aFunction)    qDebug()<< aFunction << " exit";
+#endif
+    
+#else
+    #define SEARCHTEST(aText)
+    #define SEARCH_FUNC_ENTRY(aFunction)
+    #define SEARCH_FUNC_EXIT(aFunction)
+#endif
+
+#endif // SEARCH_GLOBAL_H
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/searchui/indevicehandler/inc/indevicehandler.h	Mon Apr 19 14:40:05 2010 +0300
@@ -0,0 +1,174 @@
+/*
+ * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+ * All rights reserved.
+ * This component and the accompanying materials are made available
+ * under the terms of "Eclipse Public License v1.0"
+ * which accompanies this distribution, and is available
+ * at the URL "http://www.eclipse.org/legal/epl-v10.html".
+ *
+ * Initial Contributors:
+ * Nokia Corporation - initial contribution.
+ *
+ * Contributors:
+ *
+ * Description:  Declaration of the inDeviceHandler.
+ *
+ */
+#ifndef INDEVICEHANDLER_H
+#define INDEVICEHANDLER_H
+
+#include <QtCore>
+#include <qcoreapplication.h>
+#include <qdebug.h>
+#include "Search_global.h"
+
+#ifdef BUILD_INDEVICEHANDLER
+#define SEARCH_INDEVICEHANDLER Q_DECL_EXPORT
+#else
+#define SEARCH_INDEVICEHANDLER Q_DECL_IMPORT
+#endif
+
+#ifndef DEFAULT_SEARCH_FIELD
+#define DEFAULT_SEARCH_FIELD "_aggregate"
+#endif
+
+class QCPixSearcher;
+class QCPixDocument;
+
+SEARCH_CLASS(SearchInDeviceHandlerTest)
+
+/**
+ * InDeviceHandler is an interface class for UI and
+ * CPix engine.
+ */
+class SEARCH_INDEVICEHANDLER InDeviceHandler : public QObject
+    {
+Q_OBJECT
+public:
+
+    /**
+     * Constructor.
+     * @since S60 ?S60_version.
+     */
+    InDeviceHandler();
+
+    /**
+     * Destructor.
+     * @since S60 ?S60_version.
+     */
+    ~InDeviceHandler();
+
+signals:
+
+    /**
+     * Signalled when search completes synchronusly 
+     * error and number of results will be returned    
+     */
+    void handleSearchResult(int, int);
+
+    /**
+     * Signalled when search completes unsynchronusly
+     * error and number of results will be returned     
+     */
+    void handleAsyncSearchResult(int, int);
+
+    /**
+     * Signalled when user requests for the result item
+     * error and result item will be returned
+     */
+    void handleDocument(int aError, QCPixDocument* aDoc);
+
+private slots:
+
+    /**
+     * slot connects to QCPixSearcher to get the status of search results 
+     * @since S60 ?S60_version.
+     * @param aError error code.
+     * @param aEstimatedResultCount number of results
+     */
+
+    void getSearchResult(int aError, int aEstimatedResultCount);
+
+    /**
+     * slot connects to QCPixSearcher to get the result item 
+     * @since S60 ?S60_version.
+     * @param aError error code.
+     * @param aDocument result item
+     */
+    void getDocumentAsync(int aError, QCPixDocument* aDocument);
+
+public:
+
+    /**
+     * returns the result item synchronously.
+     * @since S60 ?S60_version.
+     * @param aIndex index 
+     */
+    QCPixDocument* getDocumentAtIndex(int aIndex);
+
+    /**
+     * returns the result item asynchronously.
+     * @since S60 ?S60_version.
+     * @param aIndex index 
+     */
+    void getDocumentAsyncAtIndex(int aIndex);
+
+    /**
+     * initate the search synchronously.
+     * @since S60 ?S60_version.
+     * @param aSearchString search keyword 
+     */
+    void search(QString aSearchString);
+
+    /**
+     * initate the search asynchronously.
+     * @since S60 ?S60_version.
+     * @param aSearchAsyncString search keyword
+     * @param aDefaultSearchField search criteria
+     */
+    void searchAsync(QString aSearchAsyncString, QString aDefaultSearchField =
+            NULL);
+
+    /**
+     * cancels the outstanding search
+     * @since S60 ?S60_version.
+     */
+    void cancelLastSearch();
+
+    /**
+     * returns the number of results on current search
+     * @since S60 ?S60_version.
+     */
+    int getSearchResultCount();
+
+    /**
+     * prepare the search on specified category
+     * @since S60 ?S60_version.
+     * @param aCategory database name
+     */
+    void setCategory(QString aCategory);
+
+    /**
+     * return the status whether the specified category is set 
+     * and ready for search
+     * @since S60 ?S60_version.
+     */
+    bool isPrepared();
+
+private:
+
+    /**
+     * interface for CPix.
+     * Own.
+     */
+    QCPixSearcher *mSearchInterface;
+
+    /**
+     * number of results on current search.        
+     */
+    int mSearchResultCount;
+
+SEARCH_FRIEND_CLASS    (SearchInDeviceHandlerTest)
+    };
+
+#endif //INDEVICEHANDLER_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/searchui/indevicehandler/indevicehandler.pri	Mon Apr 19 14:40:05 2010 +0300
@@ -0,0 +1,20 @@
+#
+# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+# All rights reserved.
+# This component and the accompanying materials are made available
+# under the terms of "Eclipse Public License v1.0"
+# which accompanies this distribution, and is available
+# at the URL "http://www.eclipse.org/legal/epl-v10.html".
+#
+# Initial Contributors:
+# Nokia Corporation - initial contribution.
+#
+# Contributors:
+#
+# Description:  FTU state provider list of files
+#
+
+HEADERS += ./inc/*.h
+SOURCES += ./src/*.cpp
+
+RESOURCES += 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/searchui/indevicehandler/indevicehandler.pro	Mon Apr 19 14:40:05 2010 +0300
@@ -0,0 +1,47 @@
+#
+# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+# All rights reserved.
+# This component and the accompanying materials are made available
+# under the terms of "Eclipse Public License v1.0"
+# which accompanies this distribution, and is available
+# at the URL "http://www.eclipse.org/legal/epl-v10.html".
+#
+# Initial Contributors:
+# Nokia Corporation - initial contribution.
+#
+# Contributors:
+#
+# Description:  SEARCH state provider project file
+#
+
+TEMPLATE = lib
+TARGET = searchindevicehandler
+
+   
+   LIBS += -lqcpixsearchclient
+   LIBS += -lhbcore
+   
+DEFINES += BUILD_INDEVICEHANDLER 
+
+DEPENDPATH += ./inc \
+              ./src
+
+INCLUDEPATH += ./inc \
+               ../inc 
+
+               
+#TRANSLATIONS=searchstateprovider.ts
+
+symbian {
+    TARGET.UID2 = 0x20004C45
+    TARGET.UID3 = 0x2002C37B
+    TARGET.EPOCALLOWDLLDATA=1
+    TARGET.CAPABILITY = ALL -TCB -DRM
+    INCLUDEPATH += $$MW_LAYER_SYSTEMINCLUDE
+    
+    
+}
+
+
+include(indevicehandler.pri)
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/searchui/indevicehandler/src/indevicehandler.cpp	Mon Apr 19 14:40:05 2010 +0300
@@ -0,0 +1,243 @@
+/*
+ * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+ * All rights reserved.
+ * This component and the accompanying materials are made available
+ * under the terms of "Eclipse Public License v1.0"
+ * which accompanies this distribution, and is available
+ * at the URL "http://www.eclipse.org/legal/epl-v10.html".
+ *
+ * Initial Contributors:
+ * Nokia Corporation - initial contribution.
+ *
+ * Contributors:
+ *
+ * Description:  Implementation indevice handler
+ *
+ */
+#include "indevicehandler.h"
+#include <qcpixsearcher.h>
+#include <qcpixdocument.h>
+
+// ---------------------------------------------------------------------------
+// InDeviceHandler::InDeviceHandler()
+// ---------------------------------------------------------------------------
+//
+InDeviceHandler::InDeviceHandler() :
+    mSearchInterface(0), mSearchResultCount(0)
+    {
+    }
+// ---------------------------------------------------------------------------
+// InDeviceHandler::getSearchResult(int aError, int estimatedResultCount)
+// aError: error code
+// estimatedResultCount: number of hits
+// ---------------------------------------------------------------------------
+//
+void InDeviceHandler::getSearchResult(int aError, int estimatedResultCount)
+    {
+    qDebug() << aError << estimatedResultCount;
+    mSearchResultCount = estimatedResultCount;
+    emit handleAsyncSearchResult(aError, estimatedResultCount);
+    }
+// ---------------------------------------------------------------------------
+// InDeviceHandler::getDocumentAsync(int aError, QCPixDocument* aDocument)
+// aError: error code
+// aDocument: holding the result item
+// ---------------------------------------------------------------------------
+//
+void InDeviceHandler::getDocumentAsync(int aError, QCPixDocument* aDocument)
+    {
+    emit handleDocument(aError, aDocument);
+    }
+// ---------------------------------------------------------------------------
+// InDeviceHandler::getDocumentAtIndex(int aIndex)
+// aIndex: item index to be found
+// ---------------------------------------------------------------------------
+//
+QCPixDocument* InDeviceHandler::getDocumentAtIndex(int aIndex)
+    {
+    QCPixDocument* doc = NULL;
+    if (mSearchInterface)
+        {
+        try
+            {
+            doc = mSearchInterface->getDocument(aIndex);
+
+            }
+        catch (...)
+            {
+            delete doc;
+            return NULL;
+            }
+        }
+    return doc;
+    }
+// ---------------------------------------------------------------------------
+// InDeviceHandler:: search(QString aSearchString)
+// aSearchString: string to be searched sync
+// ---------------------------------------------------------------------------
+//
+void InDeviceHandler::search(QString aSearchString)
+    {
+    qDebug() << "InDeviceHandler::search Enter";
+    if (aSearchString.length())
+        {
+        int error = 0;
+        mSearchResultCount = 0;
+        if (mSearchInterface)
+            {
+            try
+                {
+                mSearchResultCount = mSearchInterface->search(aSearchString);
+                }
+            catch (...)
+                {
+                error = -1;
+                }
+            }
+        emit handleSearchResult(error, mSearchResultCount);
+        }
+    qDebug() << "InDeviceHandler::search Exit";
+    }
+// ---------------------------------------------------------------------------
+// InDeviceHandler::~InDeviceHandler()
+// ---------------------------------------------------------------------------
+//
+InDeviceHandler::~InDeviceHandler()
+    {
+    if (mSearchInterface)
+        {
+        delete mSearchInterface;
+
+        }
+    }
+// ---------------------------------------------------------------------------
+// InDeviceHandler::getSearchResultCount()
+// gets the number of hits
+// ---------------------------------------------------------------------------
+//
+int InDeviceHandler::getSearchResultCount()
+    {
+    return mSearchResultCount;
+    }
+// ---------------------------------------------------------------------------
+// InDeviceHandler::getDocumentAsyncAtIndex(int aIndex)
+// aIndex :  index of item to be found async
+// ---------------------------------------------------------------------------
+//
+void InDeviceHandler::getDocumentAsyncAtIndex(int aIndex)
+    {
+    if (mSearchInterface)
+        {
+        try
+            {
+            mSearchInterface->getDocumentAsync(aIndex);
+            }
+        catch (...)
+            {
+            // handle the exception
+            return;
+            }
+        }
+
+    }
+// ---------------------------------------------------------------------------
+// InDeviceHandler::searchAsync(QString aSearchAsyncString, QString/* aDefaultSearchField*/)
+// aSearchAsyncString: string to be searched
+// async
+// ---------------------------------------------------------------------------
+//
+void InDeviceHandler::searchAsync(QString aSearchAsyncString, QString/* aDefaultSearchField*/)
+    {
+    if (aSearchAsyncString.length())
+        {
+        mSearchResultCount = 0;
+        if (mSearchInterface)
+            {
+            try
+                {
+                mSearchInterface->searchAsync(aSearchAsyncString);
+                }
+            catch (...)
+                {
+                // handle the exception
+                return;
+                }
+            }
+        }
+    }
+// ---------------------------------------------------------------------------
+// InDeviceHandler::cancelLastSearch()
+// ---------------------------------------------------------------------------
+//
+void InDeviceHandler::cancelLastSearch()
+    {
+    if (mSearchInterface)
+
+        {
+        try
+            {
+            mSearchInterface->cancelSearch();
+            }
+        catch (...)
+            {
+            // handle the exception
+            return;
+            }
+        }
+    }
+// ---------------------------------------------------------------------------
+// InDeviceHandler::setCategory(QString astring)
+// astring: setting categories to be searched
+// ---------------------------------------------------------------------------
+//
+void InDeviceHandler::setCategory(QString astring)
+    {
+    if (mSearchInterface)
+        {
+        delete mSearchInterface;
+        mSearchInterface = NULL;
+        }
+    if (astring.length())
+        {
+        QString database("root ");
+        database.append(astring);
+        mSearchInterface = QCPixSearcher::newInstance(database,
+                DEFAULT_SEARCH_FIELD);
+        try
+            {
+            mSearchInterface->connect(mSearchInterface,
+                    SIGNAL(handleSearchResults(int,int)), this,
+                    SLOT(getSearchResult(int,int)));
+            }
+        catch (...)
+            {
+            // handle the exception
+            }
+
+        try
+            {
+            mSearchInterface->connect(mSearchInterface,
+                    SIGNAL(handleDocument(int,QCPixDocument*)), this,
+                    SLOT(getDocumentAsync(int,QCPixDocument*)));
+            }
+        catch (...)
+            {
+            // handle the exception
+            }
+        }
+    }
+// ---------------------------------------------------------------------------
+// InDeviceHandler::isPrepared()
+// verify the mSearchInterface is prepared or not
+// ---------------------------------------------------------------------------
+//
+bool InDeviceHandler::isPrepared()
+    {
+    if (mSearchInterface)
+        {
+        return true;
+        }
+
+    return false;
+
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/searchui/indevicehandler/tsrc/t_indevicehandler/inc/t_indevicehandler.h	Mon Apr 19 14:40:05 2010 +0300
@@ -0,0 +1,51 @@
+/*
+ * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+ * All rights reserved.
+ * This component and the accompanying materials are made available
+ * under the terms of "Eclipse Public License v1.0"
+ * which accompanies this distribution, and is available
+ * at the URL "http://www.eclipse.org/legal/epl-v10.html".
+ *
+ * Initial Contributors:
+ * Nokia Corporation - initial contribution.
+ *
+ * Contributors:
+ *
+ * Description:  Tests for SearchStateProvider class.
+ *
+ */
+
+#include <QtTest/QtTest>
+#include "indevicehandler.h"
+
+/**
+ * @test Test class for stateproviders modules.
+ */
+class SearchInDeviceHandlerTest : public QObject
+    {
+Q_OBJECT
+
+public:
+    SearchInDeviceHandlerTest();
+    ~SearchInDeviceHandlerTest();
+
+private slots:
+    void init();
+    void initTestCase();
+    void cleanupTestCase();
+    void testCreateAndDestructIndeviceHandler();
+    void testhandleSearchResult();
+    void testhandleAsyncSearchResult();
+    void testhandleDocument();
+    void testgetSearchResult();
+    void testgetDocumentAsync();
+    void testgetDocumentAtIndex();
+    void testgetDocumentAsyncAtIndex();
+    void testsearch();
+    void testsearchAsync();
+    void testcancelLastSearch();
+    void testgetSearchResultCount();
+    void testsetCategory();
+    void testisPrepared();
+    };
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/searchui/indevicehandler/tsrc/t_indevicehandler/src/t_indevicehandler.cpp	Mon Apr 19 14:40:05 2010 +0300
@@ -0,0 +1,188 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: 
+*
+*/
+#include "t_indevicehandler.h"
+#include "indevicehandler.h"
+#include <qsignalspy.h>
+#include <qcpixdocument.h>
+SearchInDeviceHandlerTest::SearchInDeviceHandlerTest()
+    {
+    }
+SearchInDeviceHandlerTest::~SearchInDeviceHandlerTest()
+    {
+    }
+void SearchInDeviceHandlerTest::init()
+    {
+    }
+void SearchInDeviceHandlerTest::initTestCase()
+    {
+    }
+void SearchInDeviceHandlerTest::cleanupTestCase()
+    {
+    }
+
+void SearchInDeviceHandlerTest::testCreateAndDestructIndeviceHandler()
+    {
+    InDeviceHandler* indevicehandler = new InDeviceHandler();
+
+    QVERIFY(indevicehandler != NULL);
+
+    delete indevicehandler;
+    }
+void SearchInDeviceHandlerTest::testhandleSearchResult()
+    {
+    InDeviceHandler* indevicehandler = new InDeviceHandler();
+    indevicehandler->setCategory("file");
+    QSignalSpy spy(indevicehandler, SIGNAL(handleSearchResult(int, int)));
+    indevicehandler->search("txt");
+    QCOMPARE(spy.count(), 1);
+    delete indevicehandler;
+
+    //wait for signal to be emitted.
+    //QTest::qWait(200);
+
+    }
+void SearchInDeviceHandlerTest::testhandleAsyncSearchResult()
+    {
+    InDeviceHandler* indevicehandler = new InDeviceHandler();
+    indevicehandler->setCategory("file");
+    QSignalSpy
+            spy(indevicehandler, SIGNAL(handleAsyncSearchResult(int, int)));
+    indevicehandler->searchAsync("txt");
+    QTest::qWait(200);
+    QCOMPARE(spy.count(), 1);
+    delete indevicehandler;
+
+    }
+void SearchInDeviceHandlerTest::testhandleDocument()
+    {
+    InDeviceHandler* indevicehandler = new InDeviceHandler();
+    indevicehandler->setCategory("file");
+
+    indevicehandler->searchAsync("txt");
+    QTest::qWait(200);
+
+    QSignalSpy spy(indevicehandler,
+            SIGNAL(handleDocument(int, QCPixDocument*)));
+    indevicehandler->getDocumentAsyncAtIndex(0);
+    QTest::qWait(200);
+    QCOMPARE(spy.count(), 1);
+    delete indevicehandler;
+
+    }
+void SearchInDeviceHandlerTest::testgetSearchResult()
+    {
+    testhandleAsyncSearchResult();
+    }
+void SearchInDeviceHandlerTest::testgetDocumentAsync()
+    {
+    testhandleDocument();
+    }
+void SearchInDeviceHandlerTest::testgetDocumentAtIndex()
+    {
+    InDeviceHandler* indevicehandler = new InDeviceHandler();
+    indevicehandler->setCategory("file");
+    indevicehandler->search("txt");
+    QCPixDocument* iDoc = NULL;
+    iDoc = indevicehandler->getDocumentAtIndex(0);
+    QVERIFY(iDoc);
+    delete iDoc;
+    delete indevicehandler;
+    }
+void SearchInDeviceHandlerTest::testgetDocumentAsyncAtIndex()
+    {
+    InDeviceHandler* indevicehandler = new InDeviceHandler();
+    indevicehandler->setCategory("file");
+
+    indevicehandler->search("txt");
+    QSignalSpy spy(indevicehandler,
+            SIGNAL(handleDocument(int, QCPixDocument*)));
+    indevicehandler->getDocumentAsyncAtIndex(0);
+    QTest::qWait(200);
+    QCOMPARE(spy.count(), 1);
+    delete indevicehandler;
+    }
+void SearchInDeviceHandlerTest::testsearch()
+    {
+    InDeviceHandler* indevicehandler = new InDeviceHandler();
+    indevicehandler->setCategory("file");
+    QSignalSpy spy(indevicehandler, SIGNAL(handleSearchResult(int,int)));
+    indevicehandler->search(NULL);
+    QCOMPARE(spy.count(), 0);
+    indevicehandler->search("txt");
+    QCOMPARE(spy.count(), 1);
+    delete indevicehandler;
+    }
+void SearchInDeviceHandlerTest::testsearchAsync()
+    {
+    InDeviceHandler* indevicehandler = new InDeviceHandler();
+    indevicehandler->setCategory("file");
+    QSignalSpy spy(indevicehandler, SIGNAL(handleAsyncSearchResult(int,int)));
+    indevicehandler->searchAsync(NULL);
+    QTest::qWait(200);
+    QCOMPARE(spy.count(), 0);
+    indevicehandler->searchAsync("txt");
+    QTest::qWait(200);
+    QCOMPARE(spy.count(), 1);
+    delete indevicehandler;
+    }
+void SearchInDeviceHandlerTest::testcancelLastSearch()
+    {
+    InDeviceHandler* indevicehandler = new InDeviceHandler();
+    indevicehandler->setCategory("file");
+    indevicehandler->search("txt");
+    indevicehandler->cancelLastSearch();
+    delete indevicehandler;
+    }
+void SearchInDeviceHandlerTest::testgetSearchResultCount()
+    {
+    InDeviceHandler* indevicehandler = new InDeviceHandler();
+    QCOMPARE(indevicehandler->getSearchResultCount(),0);
+    indevicehandler->setCategory("file");
+    indevicehandler->search("txt");
+    QVERIFY(indevicehandler->getSearchResultCount());
+    delete indevicehandler;
+
+    }
+void SearchInDeviceHandlerTest::testsetCategory()
+    {
+    InDeviceHandler* indevicehandler = new InDeviceHandler();
+    indevicehandler->setCategory("file");
+    QVERIFY(indevicehandler->mSearchInterface);
+    indevicehandler->setCategory(NULL);
+    QVERIFY(indevicehandler->mSearchInterface == NULL);
+    delete indevicehandler;
+    }
+void SearchInDeviceHandlerTest::testisPrepared()
+    {
+    InDeviceHandler* indevicehandler = new InDeviceHandler();
+    indevicehandler->setCategory("file");
+    QVERIFY(indevicehandler->isPrepared());
+    indevicehandler->setCategory(NULL);
+    QVERIFY(indevicehandler->isPrepared() == false);
+    delete indevicehandler;
+
+    }
+int main(int argc, char *argv[])
+    {
+    QApplication app(argc, argv);
+    int error;
+    TRAPD(err,
+            QTEST_DISABLE_KEYPAD_NAVIGATION
+            SearchInDeviceHandlerTest tc;
+            error = QTest::qExec(&tc, argc, argv););
+    return error;
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/searchui/indevicehandler/tsrc/t_indevicehandler/t_indevicehandler.pri	Mon Apr 19 14:40:05 2010 +0300
@@ -0,0 +1,20 @@
+#
+# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+# All rights reserved.
+# This component and the accompanying materials are made available
+# under the terms of "Eclipse Public License v1.0"
+# which accompanies this distribution, and is available
+# at the URL "http://www.eclipse.org/legal/epl-v10.html".
+#
+# Initial Contributors:
+# Nokia Corporation - initial contribution.
+#
+# Contributors:
+#
+# Description: 
+#
+#Header files
+HEADERS += ./inc/*.h 
+
+#Source files
+SOURCES += ./src/*.cpp 
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/searchui/indevicehandler/tsrc/t_indevicehandler/t_indevicehandler.pro	Mon Apr 19 14:40:05 2010 +0300
@@ -0,0 +1,45 @@
+#
+# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+# All rights reserved.
+# This component and the accompanying materials are made available
+# under the terms of "Eclipse Public License v1.0"
+# which accompanies this distribution, and is available
+# at the URL "http://www.eclipse.org/legal/epl-v10.html".
+#
+# Initial Contributors:
+# Nokia Corporation - initial contribution.
+#
+# Contributors:
+#
+# Description:  Search stateprovider unit test project file
+#
+
+TEMPLATE = app
+
+
+LIBS += -lsearchindevicehandler
+    
+INCLUDEPATH += . 
+INCLUDEPATH += ../../inc\
+              ../../../inc
+
+
+CONFIG += qtestlib 
+CONFIG += hb
+
+QT += xml \
+      sql
+DEFINES += SEARCH_UNITTESTING
+
+symbian { 
+CONFIG += symbian_test     
+TARGET.UID2 = 0x100039CE
+TARGET.UID3 = 0x20026F8A
+TARGET.CAPABILITY = ALL -TCB -DRM
+TARGET.EPOCSTACKSIZE = 0x14000 // 80kB
+TARGET.EPOCHEAPSIZE = 0x20000 0x1000000 // 128kB - 16MB
+INCLUDEPATH += $$MW_LAYER_SYSTEMINCLUDE
+}
+
+include(t_indevicehandler.pri)
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/searchui/indevicehandler/tsrc/t_src.pro	Mon Apr 19 14:40:05 2010 +0300
@@ -0,0 +1,21 @@
+#
+# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+# All rights reserved.
+# This component and the accompanying materials are made available
+# under the terms of "Eclipse Public License v1.0"
+# which accompanies this distribution, and is available
+# at the URL "http://www.eclipse.org/legal/epl-v10.html".
+#
+# Initial Contributors:
+# Nokia Corporation - initial contribution.
+#
+# Contributors:
+#
+# Description:
+#
+
+TEMPLATE = subdirs
+
+SUBDIRS  = t_indevicehandler
+           
+CONFIG  += ordered
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/searchui/rom/search.iby	Mon Apr 19 14:40:05 2010 +0300
@@ -0,0 +1,54 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  search IBY file
+*/
+
+#ifndef __SEARCH_IBY__
+#define __SEARCH_IBY
+
+
+#ifdef FF_SEARCH_SW
+#include <bldvariant.hrh>
+#include <data_caging_paths_for_iby.hrh>
+S60_APP_EXE( Searchapplication)
+
+
+// Application registration file.
+data=DATAZ_/private/10003a3f/import/apps/Searchapplication_reg.rsc	/private/10003a3f/import/apps/Searchapplication_reg.rsc
+
+data=DATAZ_/resource/apps/Searchapplication.mif    /resource/apps/Searchapplication.mif
+
+//SearchIndevice handler
+file=/epoc32/release/armv5/urel/searchindevicehandler.dll SHARED_LIB_DIR/searchindevicehandler.dll
+
+
+
+//runtime provider dll
+data=/epoc32/data/z/searchresources/plugins/runtimeproviders/searchruntimeprovider.manifest  searchresources/plugins/runtimeproviders/searchruntimeprovider.manifest
+data=/epoc32/data/z/searchresources/plugins/runtimeproviders/searchruntimeprovider.qtplugin  searchresources/plugins/runtimeproviders/searchruntimeprovider.qtplugin
+file=/epoc32/release/armv5/urel/searchruntimeprovider.dll SHARED_LIB_DIR/searchruntimeprovider.dll
+
+
+
+
+//state provider dll
+
+data=/epoc32/data/z/searchresources/plugins/stateproviders/searchstateprovider.manifest  searchresources/plugins/stateproviders/searchstateprovider.manifest
+data=/epoc32/data/z/searchresources/plugins/stateproviders/searchstateprovider.qtplugin  searchresources/plugins/stateproviders/searchstateprovider.qtplugin
+file=/epoc32/release/armv5/urel/searchstateprovider.dll SHARED_LIB_DIR/searchstateprovider.dll
+
+#endif //FF_SEARCH_SW
+
+#endif // __SEARCH_IBY__
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/searchui/rom/searchresources.iby	Mon Apr 19 14:40:05 2010 +0300
@@ -0,0 +1,33 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  search IBY file
+*/
+
+#ifndef __SEARCHRESOURCES_IBY__
+#define __SEARCHRESOURCES_IBY__
+
+
+#ifdef FF_SEARCH_SW
+
+#include <data_caging_paths_for_iby.hrh>
+
+//Language resource files
+data=DATAZ_\QT_TRANSLATIONS_DIR\searchsw.qm QT_TRANSLATIONS_DIR\searchsw.qm
+
+// Application resource file.
+data=DATAZ_/resource/apps/Searchapplication.RSC     /resource/apps/Searchapplication.RSC
+
+#endif //FF_SEARCH_SW
+
+#endif //__SEARCHRESOURCES_IBY__
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/searchui/runtimeproviders/runtimeproviders.pro	Mon Apr 19 14:40:05 2010 +0300
@@ -0,0 +1,18 @@
+#
+# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+# All rights reserved.
+# This component and the accompanying materials are made available
+# under the terms of "Eclipse Public License v1.0"
+# which accompanies this distribution, and is available
+# at the URL "http://www.eclipse.org/legal/epl-v10.html".
+#
+# Initial Contributors:
+# Nokia Corporation - initial contribution.
+#
+# Contributors:
+#
+# Description:  SEARCH runtime providers project file
+#
+
+TEMPLATE = subdirs
+SUBDIRS  = searchruntimeprovider
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/searchui/runtimeproviders/searchruntimeprovider/inc/searchruntime.h	Mon Apr 19 14:40:05 2010 +0300
@@ -0,0 +1,138 @@
+/*
+ * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+ * All rights reserved.
+ * This component and the accompanying materials are made available
+ * under the terms of "Eclipse Public License v1.0"
+ * which accompanies this distribution, and is available
+ * at the URL "http://www.eclipse.org/legal/epl-v10.html".
+ *
+ * Initial Contributors:
+ * Nokia Corporation - initial contribution.
+ *
+ * Contributors:
+ *
+ * Description:  Declaration of the SEARCH default runtime.
+ *
+ */
+
+#ifndef SEARCH_RUNTIMES_DEFAULTRUNTIME_H
+#define SEARCH_RUNTIMES_DEFAULTRUNTIME_H
+
+#include "Search_global.h"
+#include "hsruntime.h"
+#include <qhash.h>
+
+SEARCH_CLASS(SearchRuntimeProviderTest)
+
+// Forward declarations
+class QStateMachine;
+class HbMainWindow;
+
+/**  @ingroup group_Searchruntimeprovider
+ * @brief Default implementation of the search runtime.
+ *
+ * Creates an execution context (EC) and populates it with
+ * runtime services. States are loaded from state provider
+ * plugins. Each state is given an access to the EC. States
+ * are added to a state machine. Finally, the state machine
+ * is started.
+ *
+ * @lib ?library
+ * @since S60 ?S60_version
+ */
+class SearchRuntime : public HsRuntime
+    {
+Q_OBJECT
+
+public:
+
+    /**
+     * Constructor.
+     * @since S60 ?S60_version.
+     * @param parent - address of parent QObject instance, by default none
+     */
+    SearchRuntime(QObject* = 0);
+
+    /**
+     * Destructor.
+     * @since S60 ?S60_version.
+     */
+    ~SearchRuntime();
+
+private:
+    /**
+     * Copy constructor
+     */
+    Q_DISABLE_COPY(SearchRuntime)
+
+public slots:
+
+    /**
+     * @copydoc HsRuntime::start()
+     */
+    void start();
+
+    /**
+     * @copydoc HsRuntime::stop()
+     */
+    void stop();
+
+private slots:
+
+    /**
+     * Called after the state machine has started.
+     * @since S60 ?S60_version.
+     */
+    void handleStateMachineStarted();
+
+    /**
+     * Called after the state machine has stopped.
+     * @since S60 ?S60_version.
+     */
+    void handleStateMachineStopped();
+
+signals:
+
+    /**
+     * Emission of this signal initiates a transition to the final state.     
+     */
+    void stopStateMachine();
+
+private:
+
+    /**
+     * Creates gui service parts
+     * @since S60 ?S60_version.
+     */
+    void createGuiServiceParts();
+
+    /**
+     * Creates states
+     * @since S60 ?S60_version.
+     */
+    void createStates();
+
+private:
+
+    /**
+     * Address of state machine instance.
+     * Ownership tranfered to application. Don't remove it.
+     */
+    QStateMachine *mStateMachine;
+
+    /**
+     * Window to visualize scene
+     */
+    HbMainWindow *mWindow;
+
+    /**
+     * Contains address of runtime service.
+     * Ownership transfered to application. Don't remove it.
+     */
+    QHash<QString, QObject*> mServices;
+
+SEARCH_FRIEND_CLASS    (SearchRuntimeProviderTest)
+
+    };
+
+#endif // SEARCH_RUNTIMES_DEFAULTRUNTIME_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/searchui/runtimeproviders/searchruntimeprovider/inc/searchruntimeprovider.h	Mon Apr 19 14:40:05 2010 +0300
@@ -0,0 +1,75 @@
+/*
+ * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+ * All rights reserved.
+ * This component and the accompanying materials are made available
+ * under the terms of "Eclipse Public License v1.0"
+ * which accompanies this distribution, and is available
+ * at the URL "http://www.eclipse.org/legal/epl-v10.html".
+ *
+ * Initial Contributors:
+ * Nokia Corporation - initial contribution.
+ *
+ * Contributors:
+ *
+ * Description:  Declaration of the search default runtime provider.
+ *
+ */
+
+#ifndef SEARCH_RUNTIMEPROVIDERS_DEFAULTRUNTIMEPROVIDER_H
+#define SEARCH_RUNTIMEPROVIDERS_DEFAULTRUNTIMEPROVIDER_H
+
+#include "hsiruntimeprovider.h"
+#include "hsistateprovider.h"
+
+/**
+ * @ingroup group_Searchruntimeprovider
+ * @brief Provides a default implementation of the SEARCH runtime.
+ *
+ * This provider includes a default implementation of the SEARCH runtime.
+ * The runtime is described in the Searchruntimeprovider.manifest file.
+ *
+ * @since S60 ?S60_version.
+ */
+class SearchRuntimeProvider : public QObject, public IHsRuntimeProvider
+    {
+Q_OBJECT
+
+Q_INTERFACES(IHsRuntimeProvider)
+
+public:
+
+    /**
+     * Default constructor.
+     *
+     * @since S60 ?S60_version.
+     */
+    SearchRuntimeProvider();
+
+public:
+
+    /**
+     * Returns contained runtimes as a list of tokens.
+     *
+     * @return Contained runtimes as a list of tokens.
+     * @since S60 ?S60_version.
+     */
+    QList<HsRuntimeToken> runtimes();
+
+    /**
+     * Creates a runtime based on the given token.
+     *
+     * @param aToken Identifies the runtime to be created.
+     * @since S60 ?S60_version.
+     */
+    HsRuntime* createRuntime(const HsRuntimeToken& aToken);
+
+private:
+
+    /**
+     * Token that describes the default runtime.
+     */
+    HsRuntimeToken mRuntimeToken;
+
+    };
+
+#endif //SEARCH_RUNTIMEPROVIDERS_DEFAULTRUNTIMEPROVIDER_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/searchui/runtimeproviders/searchruntimeprovider/resource/searchruntimeprovider.manifest	Mon Apr 19 14:40:05 2010 +0300
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="utf-8"?>
+<runtimeprovider>
+    <runtime library="searchruntimeproviders.dll"
+             uri="search.nokia.com/runtime/defaultruntime"/>
+</runtimeprovider>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/searchui/runtimeproviders/searchruntimeprovider/searchruntimeprovider.pri	Mon Apr 19 14:40:05 2010 +0300
@@ -0,0 +1,18 @@
+#
+# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+# All rights reserved.
+# This component and the accompanying materials are made available
+# under the terms of "Eclipse Public License v1.0"
+# which accompanies this distribution, and is available
+# at the URL "http://www.eclipse.org/legal/epl-v10.html".
+#
+# Initial Contributors:
+# Nokia Corporation - initial contribution.
+#
+# Contributors:
+#
+# Description:  SEARCH default runtime provider list of files
+#
+
+HEADERS += ./inc/*.h
+SOURCES += ./src/*.cpp
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/searchui/runtimeproviders/searchruntimeprovider/searchruntimeprovider.pro	Mon Apr 19 14:40:05 2010 +0300
@@ -0,0 +1,77 @@
+#
+# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+# All rights reserved.
+# This component and the accompanying materials are made available
+# under the terms of "Eclipse Public License v1.0"
+# which accompanies this distribution, and is available
+# at the URL "http://www.eclipse.org/legal/epl-v10.html".
+#
+# Initial Contributors:
+# Nokia Corporation - initial contribution.
+#
+# Contributors:
+#
+# Description:  SEARCH default runtime provider project file
+#
+
+TEMPLATE = lib
+
+
+symbian {
+    CONFIG(debug, debug|release) {
+        DESTDIR = debug
+    } else {  
+        DESTDIR = release
+    }
+}
+
+win32 {
+    CONFIG(debug, debug|release) {
+      SUBDIRPART = debug
+    } else {
+      SUBDIRPART = release
+    }
+    DESTDIR = $$PWD/../../../bin/$$SUBDIRPART/searchresources/plugins/runtimeproviders
+    INCLUDEPATH += \
+              $$PWD/../../../homescreensrv/homescreensrv_plat/appruntimemodel_api \
+              $$PWD/../../../homescreensrv/homescreensrv_plat/statemodel_api
+    LIBS += -L$$PWD/../../../bin/debug
+}
+
+LIBS +=  -lappruntimemodel
+LIBS +=  -lstatemodel
+
+    
+CONFIG += plugin debug_and_release
+
+CONFIG += hb
+
+QT += xml sql
+
+DEFINES += SEARCHRUNTIMEPROVIDER_LIB
+
+coverage:DEFINES += COVERAGE_MEASUREMENT
+
+DEPENDPATH +=   ./inc \
+                ./src
+
+INCLUDEPATH += ./inc \
+               ../../inc \
+
+symbian {
+    TARGET.UID3 = 0x2002C37D
+    TARGET.EPOCALLOWDLLDATA=1
+    TARGET.CAPABILITY = ALL -TCB
+    appkey:DEFINES += S60APP_KEY
+    INCLUDEPATH += $$MW_LAYER_SYSTEMINCLUDE
+
+    include(searchruntimeprovider_installs_symbian.pri)
+}
+
+win32 {
+include(searchruntimeprovider_installs_win32.pri)
+}
+
+symbian:unix:include(searchruntimeprovider_installs_unix.pri)
+
+include(searchruntimeprovider.pri)
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/searchui/runtimeproviders/searchruntimeprovider/searchruntimeprovider_installs_symbian.pri	Mon Apr 19 14:40:05 2010 +0300
@@ -0,0 +1,24 @@
+#
+# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+# All rights reserved.
+# This component and the accompanying materials are made available
+# under the terms of "Eclipse Public License v1.0"
+# which accompanies this distribution, and is available
+# at the URL "http://www.eclipse.org/legal/epl-v10.html".
+#
+# Initial Contributors:
+# Nokia Corporation - initial contribution.
+#
+# Contributors:
+#
+# Description: 
+#
+
+export.sources = resource/*.manifest
+export.path = /searchresources/plugins/runtimeproviders
+
+pluginstub.sources = searchruntimeprovider.dll
+pluginstub.path = /searchresources/plugins/runtimeproviders
+
+DEPLOYMENT += export pluginstub
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/searchui/runtimeproviders/searchruntimeprovider/searchruntimeprovider_installs_unix.pri	Mon Apr 19 14:40:05 2010 +0300
@@ -0,0 +1,34 @@
+#
+# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+# All rights reserved.
+# This component and the accompanying materials are made available
+# under the terms of "Eclipse Public License v1.0"
+# which accompanies this distribution, and is available
+# at the URL "http://www.eclipse.org/legal/epl-v10.html".
+#
+# Initial Contributors:
+# Nokia Corporation - initial contribution.
+#
+# Contributors:
+#
+# Description: 
+#
+#
+# Release
+#
+
+r01.path = ../../../bin/release/searchresources/plugins/runtimeproviders
+r01.files = ./release/*.so* \
+            ./resource/*.manifest
+
+INSTALLS += r01
+
+#
+# Debug
+#
+
+d01.path = ../../../bin/debug/searchresources/plugins/runtimeproviders
+d01.files = ./debug/*.so* \
+            ./resource/*.manifest
+
+INSTALLS += d01
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/searchui/runtimeproviders/searchruntimeprovider/searchruntimeprovider_installs_win32.pri	Mon Apr 19 14:40:05 2010 +0300
@@ -0,0 +1,34 @@
+#
+# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+# All rights reserved.
+# This component and the accompanying materials are made available
+# under the terms of "Eclipse Public License v1.0"
+# which accompanies this distribution, and is available
+# at the URL "http://www.eclipse.org/legal/epl-v10.html".
+#
+# Initial Contributors:
+# Nokia Corporation - initial contribution.
+#
+# Contributors:
+#
+# Description: 
+#
+#
+# Release
+#
+
+r01.path = $$PWD/../../../bin/release/searchresources/plugins/runtimeproviders
+r01.files = ./release/*.* \
+            ./resource/*.manifest
+
+INSTALLS += r01
+
+#
+# Debug
+#
+
+d01.path = $$PWD/../../../bin/debug/searchresources/plugins/runtimeproviders
+d01.files = ./debug/*.* \
+            ./resource/*.manifest
+
+INSTALLS += d01
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/searchui/runtimeproviders/searchruntimeprovider/src/searchruntime.cpp	Mon Apr 19 14:40:05 2010 +0300
@@ -0,0 +1,171 @@
+/*
+ * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+ * All rights reserved.
+ * This component and the accompanying materials are made available
+ * under the terms of "Eclipse Public License v1.0"
+ * which accompanies this distribution, and is available
+ * at the URL "http://www.eclipse.org/legal/epl-v10.html".
+ *
+ * Initial Contributors:
+ * Nokia Corporation - initial contribution.
+ *
+ * Contributors:
+ *
+ * Description:  Implementation of the SEARCH default runtime.
+ *
+ */
+
+#include "searchruntime.h"
+#include "Search_global.h"
+#include "hsstatefactory.h"
+
+#include <qstatemachine.h>
+#include <qstate.h>
+#include <qfinalstate.h>
+#include <qdebug.h>
+
+#include <hbmainwindow.h>
+
+// plugin factory const
+const char factoryManifestDir[] = "searchresources/plugins/stateproviders";
+const char factoryPluginDir[] = "searchresources/plugins/stateproviders";
+const char stateLibrary[] = "searchstateprovider.dll";
+
+// states
+const char wizardProgressiveStateUri[] =
+        "search.nokia.com/state/wizardprogressivestate";
+const char wizardSettingStateUri[] =
+        "search.nokia.com/state/wizardsettingstate";
+
+// ---------------------------------------------------------------------------
+// searchRuntime::SearchRuntime
+// ---------------------------------------------------------------------------
+//
+SearchRuntime::SearchRuntime(QObject* aParent) :
+    HsRuntime(aParent), mStateMachine(0), mWindow(0)
+    {
+    mStateMachine = new QStateMachine(this);
+    createGuiServiceParts();
+    createStates();
+    }
+
+// ---------------------------------------------------------------------------
+// SearchRuntime::~SearchRuntime()
+// ---------------------------------------------------------------------------
+//
+SearchRuntime::~SearchRuntime()
+    {
+    delete mWindow;
+    delete mStateMachine;
+    }
+
+// ---------------------------------------------------------------------------
+// SearchRuntime::start()
+// ---------------------------------------------------------------------------
+//
+void SearchRuntime::start()
+    {
+    mStateMachine->start();
+    }
+
+// ---------------------------------------------------------------------------
+// SearchRuntime::stop()
+// ---------------------------------------------------------------------------
+//
+void SearchRuntime::stop()
+    {
+    mStateMachine->stop();
+    }
+
+// ---------------------------------------------------------------------------
+// SearchRuntime::handleStateMachineStarted()
+// ---------------------------------------------------------------------------
+//
+void SearchRuntime::handleStateMachineStarted()
+    {
+    emit started();
+    }
+
+// ---------------------------------------------------------------------------
+// SearchRuntime::handleStateMachineStopped()
+// ---------------------------------------------------------------------------
+//
+void SearchRuntime::handleStateMachineStopped()
+    {
+    emit stopped();
+    }
+
+// ---------------------------------------------------------------------------
+// SearchRuntime::createGuiServiceParts()
+// ---------------------------------------------------------------------------
+//
+void SearchRuntime::createGuiServiceParts()
+    {
+    mWindow = new HbMainWindow();
+    mWindow->show();
+    }
+
+// ---------------------------------------------------------------------------
+// SearchRuntime::createStates()
+// ---------------------------------------------------------------------------
+//
+void SearchRuntime::createStates()
+    {
+    HsStateFactory factory(factoryManifestDir, factoryPluginDir);
+    HsStateToken token;
+
+    QFinalState* finalState = new QFinalState();
+    mStateMachine->addState(finalState);
+
+    // parallel state activates all children states
+    QState* parallel = new QState(QState::ParallelStates);
+    mStateMachine->addState(parallel);
+    parallel->addTransition(this, SIGNAL(stopStateMachine()), finalState);
+
+    // root GUI state
+    QState* guiRootState = new QState(parallel);
+
+    QState* searchRootState = new QState(guiRootState);
+
+    // create state based on token
+    token.mLibrary = stateLibrary;
+    token.mUri = wizardProgressiveStateUri;
+    QState* wizardProgressiveState = factory.createState(token);
+    // set state specific data
+    wizardProgressiveState->setParent(searchRootState);
+    wizardProgressiveState->setObjectName(token.mUri);
+    token.mUri = wizardSettingStateUri;
+
+    QState* wizardSettingState = factory.createState(token);
+    wizardSettingState->setParent(searchRootState);
+    wizardSettingState->setObjectName(token.mUri);
+
+    wizardProgressiveState->addTransition(wizardProgressiveState,
+            SIGNAL(settingsState()), wizardSettingState);
+
+    // From activated back to menu
+    wizardSettingState->addTransition(wizardSettingState,
+            SIGNAL(backEventTriggered()), wizardProgressiveState);
+    
+    connect(wizardSettingState, SIGNAL(clickstatus(bool)),
+                wizardProgressiveState, SLOT(settingsaction(bool)));
+
+    connect(wizardSettingState, SIGNAL(publishSelectedCategory(int,bool)),
+            wizardProgressiveState, SLOT(getSettingCategory(int,bool)));
+
+    connect(wizardSettingState, SIGNAL(customizeGoButton(bool)),
+            wizardProgressiveState, SLOT(_customizeGoButton(bool)));
+
+    // set initial state for statemachine
+    searchRootState->setInitialState(wizardProgressiveState);
+    guiRootState->setInitialState(searchRootState);
+    mStateMachine->setInitialState(parallel);
+
+    connect(mStateMachine, SIGNAL(started()),
+            SLOT(handleStateMachineStarted()));
+    connect(mStateMachine, SIGNAL(stopped()),
+            SLOT(handleStateMachineStopped()));
+    connect(mStateMachine, SIGNAL(finished()),
+            SLOT(handleStateMachineStopped()));
+
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/searchui/runtimeproviders/searchruntimeprovider/src/searchruntimeprovider.cpp	Mon Apr 19 14:40:05 2010 +0300
@@ -0,0 +1,55 @@
+/*
+ * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+ * All rights reserved.
+ * This component and the accompanying materials are made available
+ * under the terms of "Eclipse Public License v1.0"
+ * which accompanies this distribution, and is available
+ * at the URL "http://www.eclipse.org/legal/epl-v10.html".
+ *
+ * Initial Contributors:
+ * Nokia Corporation - initial contribution.
+ *
+ * Contributors:
+ *
+ * Description:  Implementation of the SEARCH default runtime provider.
+ *
+ */
+
+#include "searchruntimeprovider.h"
+#include "searchruntime.h"
+
+// constants
+const char providerFileName[] = "searchruntimeprovider.dll";
+const char providerFileUri[] = "search.nokia.com/runtime/defaultruntime";
+
+// ---------------------------------------------------------------------------
+// SearchRuntimeProvider::SearchRuntimeProvider()
+// ---------------------------------------------------------------------------
+//
+SearchRuntimeProvider::SearchRuntimeProvider()
+    {
+    mRuntimeToken.mLibrary = providerFileName;
+    mRuntimeToken.mUri = providerFileUri;
+    }
+
+// ---------------------------------------------------------------------------
+// SearchRuntimeProvider::runtimes()
+// ---------------------------------------------------------------------------
+//
+QList<HsRuntimeToken> SearchRuntimeProvider::runtimes()
+    {
+    return QList<HsRuntimeToken> () << mRuntimeToken;
+    }
+
+// ---------------------------------------------------------------------------
+// SearchRuntimeProvider::createRuntime()
+// ---------------------------------------------------------------------------
+//
+HsRuntime* SearchRuntimeProvider::createRuntime(const HsRuntimeToken& aToken)
+    {
+    return (aToken.mUri == providerFileUri ? new SearchRuntime() : 0);
+    }
+
+#ifndef COVERAGE_MEASUREMENT
+Q_EXPORT_PLUGIN2(Searchruntimeprovider, SearchRuntimeProvider)
+#endif //COVERAGE_MEASUREMENT
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/searchui/search_exports_to_rom.pri	Mon Apr 19 14:40:05 2010 +0300
@@ -0,0 +1,20 @@
+#
+# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+# All rights reserved.
+# This component and the accompanying materials are made available
+# under the terms of "Eclipse Public License v1.0"
+# which accompanies this distribution, and is available
+# at the URL "http://www.eclipse.org/legal/epl-v10.html".
+#
+# Initial Contributors:
+# Nokia Corporation - initial contribution.
+#
+# Contributors:
+#
+# Description:  Search list of exported files to ROM
+#
+
+BLD_INF_RULES.prj_exports += \
+    "$${LITERAL_HASH}include <platform_paths.hrh>"\
+    "./rom/search.iby                CORE_APP_LAYER_IBY_EXPORT_PATH(search.iby)"\
+    "./rom/searchresources.iby                LANGUAGE_APP_LAYER_IBY_EXPORT_PATH(searchresources.iby)"
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/searchui/searchui.pro	Mon Apr 19 14:40:05 2010 +0300
@@ -0,0 +1,25 @@
+#
+# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+# All rights reserved.
+# This component and the accompanying materials are made available
+# under the terms of "Eclipse Public License v1.0"
+# which accompanies this distribution, and is available
+# at the URL "http://www.eclipse.org/legal/epl-v10.html".
+#
+# Initial Contributors:
+# Nokia Corporation - initial contribution.
+#
+# Contributors:
+#
+# Description:  SEARCH project file
+#
+TEMPLATE = subdirs
+
+SUBDIRS  += indevicehandler \        
+	   Searchapplication \ 			          
+           runtimeproviders \                              
+           stateproviders
+
+CONFIG += ordered
+
+symbian:include(search_exports_to_rom.pri)
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/searchui/stateproviders/searchstateprovider/inc/searchinitstate.h	Mon Apr 19 14:40:05 2010 +0300
@@ -0,0 +1,69 @@
+/*
+ * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+ * All rights reserved.
+ * This component and the accompanying materials are made available
+ * under the terms of "Eclipse Public License v1.0"
+ * which accompanies this distribution, and is available
+ * at the URL "http://www.eclipse.org/legal/epl-v10.html".
+ *
+ * Initial Contributors:
+ * Nokia Corporation - initial contribution.
+ *
+ * Contributors:
+ *
+ * Description:  Declaration of the SEARCH init state.
+ *
+ */
+
+#ifndef SEARCH_STATES_INITSTATE_H
+#define SEARCH_STATES_INITSTATE_H
+
+#include <qstate.h>
+#include "Search_global.h"
+
+SEARCH_CLASS( SearchStateProviderTest)
+class SearchInitState : public QState
+    {
+Q_OBJECT
+
+public:
+
+    /**
+     * Constructor.
+     * @since S60 ?S60_version.     
+     * @param aParent Owner.
+     */
+    SearchInitState(QState *aParent = 0);
+
+    /**
+     * Destructor.
+     * @since S60 ?S60_version.
+     */
+    virtual ~SearchInitState();
+
+private:
+
+    /**
+     * Constructs this state.
+     * @since S60 ?S60_version.
+     */
+    void construct();
+
+protected:
+
+    /**
+     * @copydoc QState::onEntry()
+     */
+    void onEntry(QEvent *event);
+
+    /**
+     * @copydoc QState::onExit()
+     */
+    void onExit(QEvent *event);
+
+private:
+SEARCH_FRIEND_CLASS    ( SearchStateProviderTest)
+
+    };
+
+#endif //SEARCH_STATES_INITSTATE_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/searchui/stateproviders/searchstateprovider/inc/searchprogressivestate.h	Mon Apr 19 14:40:05 2010 +0300
@@ -0,0 +1,334 @@
+/*
+ * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+ * All rights reserved.
+ * This component and the accompanying materials are made available
+ * under the terms of "Eclipse Public License v1.0"
+ * which accompanies this distribution, and is available
+ * at the URL "http://www.eclipse.org/legal/epl-v10.html".
+ *
+ * Initial Contributors:
+ * Nokia Corporation - initial contribution.
+ *
+ * Contributors:
+ *
+ * Description:  Declaration of the progressive search state.
+ *
+ */
+
+#ifndef PROGRESSIVE_SEARCH_STATE_H
+#define PROGRESSIVE_SEARCH_STATE_H
+
+#include <qabstractitemmodel.h>
+#include <qstate.h>
+#include <qstringlist.h>
+#include <qdatetime.h>
+#include <qpixmap.h>
+#include <hbicon.h>
+#include <displaymode.h>
+#include "Search_global.h"
+
+class HbMainWindow;
+class HbView;
+class HbListView;
+class HbDocumentLoader;
+class QStandardItemModel;
+class HbSearchPanel;
+class QSortFilterProxyModel;
+
+class CFbsBitmap;
+
+class InDeviceHandler;
+class QCPixDocument;
+
+SEARCH_CLASS( SearchStateProviderTest)
+/** @ingroup group_searchstateprovider
+ * @brief The state where progressive search state is shown
+ *
+ * @see StateMachine
+ *
+ * @lib ?library
+ * @since S60 ?S60_version
+ */
+class SearchProgressiveState : public QState
+    {
+Q_OBJECT
+
+public:
+
+    /**
+     * Constructor.
+     * @since S60 ?S60_version.     
+     * @param aParent Owner.
+     */
+    SearchProgressiveState(QState *aParent = 0);
+
+    /**
+     * Destructor.
+     * @since S60 ?S60_version.
+     */
+    virtual ~SearchProgressiveState();
+
+protected:
+
+    /**
+     * @copydoc QState::onEntry()
+     */
+    void onEntry(QEvent *event);
+
+    /**
+     * @copydoc QState::onExit()
+     */
+    void onExit(QEvent *event);
+
+private:
+    /**
+     * deactivates the signals .
+     * @since S60 ?S60_version.
+     */
+    void deActivateSignals();
+
+    /**
+     * activates the signals .
+     * @since S60 ?S60_version.
+     */
+    void activateSignals();
+
+    /**
+     * get the application icon  .
+     * @since S60 ?S60_version.
+     */
+    HbIcon getAppIconFromAppId(TUid auid);
+
+    /**
+     * resizing the symbain icon  .
+     * @since S60 ?S60_version.
+     */
+    CFbsBitmap *copyBitmapLC(CFbsBitmap *input);
+public slots:
+
+    /**
+     * slot connects to CSearchHandler to get the status of search result synchronously 
+     * @since S60 ?S60_version.
+     * @param aError error code.
+     * @param aResultCount number of results
+     */
+    void onSearchComplete(int aError, int aResultCount);
+
+    /**
+     * slot connects to CSearchHandler to get the status of search result asynchronously 
+     * @since S60 ?S60_version.
+     * @param aError error code.
+     * @param aResultCount number of results
+     */
+    void onAsyncSearchComplete(int aError, int aResultCount);
+
+    /**
+     * slot connects to CSearchHandler to get the result item asynchronously 
+     * @since S60 ?S60_version.
+     * @param aError error code.
+     * @param aDoc result item
+     */
+    void onGetDocumentComplete(int aError, QCPixDocument* aDoc);
+
+    /**
+     * slot connects to list view to launch the respective application
+     * @since S60 ?S60_version.
+     * @param aIndex index of the activated item.
+     */
+    void openResultitem(QModelIndex aIndex);
+
+    /**
+     * slot connects to settings state to get the selected category information
+     * @since S60 ?S60_version.
+     * @param aCategory category(database) name.
+     * @param aStatus whether the category selected or not
+     */
+    void getSettingCategory(int, bool);
+
+    /**
+     * slot connects to action to change the current state to settings state
+     * @since S60 ?S60_version. 
+     */
+    void setSettings();
+
+    /**
+     * slot connects to search panel to initiate the fresh search
+     * @since S60 ?S60_version.
+     * @param aKeyword search keyword.
+     */
+    void startNewSearch(const QString &aKeyword);
+
+    /**
+     * slot connects to search state  for internet search
+     * @since S60 ?S60_version.
+     */
+    void _customizeGoButton(bool avalue);
+
+    /**
+     * slot connects to search state  for internet search
+     * @since S60 ?S60_version.
+     */
+    void settingsaction(bool avalue);
+
+    /**
+     * slot connects to search state  for internet search
+     * @since S60 ?S60_version.
+     */
+    void cancelSearch();
+
+private:
+
+    /**
+     * initiate the fresh search for selected category separately 
+     * 
+     * @param aKeyword search keyword.
+     */
+    void searchOnCategory(const QString aKeyword);
+
+    /**
+     * clears the model  
+     *              
+     */
+    void clear();
+
+    /**
+     * prepares the item on result list view for no result case 
+     * 
+     * @param aKeyword search keyword.
+     */
+    void noResultsFound(QString aKeyword);
+
+    /**
+     * prepares the suggestion link item on result list view to provide suggestion links     
+     * 
+     * @param aKeyword search keyword.
+     */
+    void createSuggestionLink(bool aFlag);
+
+    /**
+     * Function to include corrrect Qimage format to be taken from bitmap
+     *  @param mode Bitmap display mode.
+     */
+    QImage::Format TDisplayMode2Format(TDisplayMode mode);
+
+    /**
+     * Function to convert the s60 based CFbsBitmap into Qt specific QPixmap
+     *  @param aBitmap Bitmap to be converted.
+     */
+    QPixmap fromSymbianCFbsBitmap(CFbsBitmap *aBitmap);
+
+signals:
+
+    /**
+     * Signalled when user selects an to switch the settings state
+     * setting state will be  activated.
+     */
+    void settingsState();
+
+private:
+
+    HbMainWindow* mMainWindow;
+
+    /**
+     * main view.
+     * Own.
+     */
+    HbView* mView;
+
+    /**
+     * The List View widget.
+     * Own.
+     */
+    HbListView* mListView;
+
+    /**
+     * Document handler to load .docml.
+     * Own.
+     */
+    HbDocumentLoader* mDocumentLoader;
+
+    /**
+     * The searchpanel widget.
+     * Own.
+     */
+    HbSearchPanel* mSearchPanel;
+    /**
+     * proxymodel for list view
+     * Own.
+     */
+    QSortFilterProxyModel *proxyModel;
+
+    /**
+     * model for list view
+     * Own.
+     */
+    QStandardItemModel* mModel;
+
+    /**
+     * qt interface for CPix engine
+     * Own.
+     */
+    InDeviceHandler* mSearchHandler;
+
+    /**
+     * Search Keyword                        
+     */
+
+    QString mSearchString;
+
+    /**
+     * Search Keyword                        
+     */
+
+    QString mOriginalString;
+
+    /**
+     * selected categories on a map                        
+     */
+    QMap<int, bool> mSelectedCategory;
+
+    /**
+     * save the previous selected categories,decision to search again                        
+     */
+    QMap<int, bool> mTempSelectedCategory;
+
+    /**
+     * temporary list of selected categories
+     */
+    QStringList mTemplist;
+
+    /**
+     * number of categories selected
+     * 
+     */
+    int mDatabasecount;
+
+    /**
+     * index of link item
+     */
+    int mLinkindex;
+
+    /**
+     * number of hits
+     */
+    int mResultcount;
+
+    /**
+     * result parser 
+     * 
+     */
+    int mResultparser;
+
+    /**
+     * setting loaded or not variable
+     * 
+     */
+    bool loadSettings;
+    QList<HbIcon> mIconArray;
+    HbIcon mIcon;
+
+SEARCH_FRIEND_CLASS    (SearchStateProviderTest)
+
+    };
+
+#endif //PROGRESSIVE_SEARCH_STATE_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/searchui/stateproviders/searchstateprovider/inc/searchsettingsstate.h	Mon Apr 19 14:40:05 2010 +0300
@@ -0,0 +1,168 @@
+/*
+ * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+ * All rights reserved.
+ * This component and the accompanying materials are made available
+ * under the terms of "Eclipse Public License v1.0"
+ * which accompanies this distribution, and is available
+ * at the URL "http://www.eclipse.org/legal/epl-v10.html".
+ *
+ * Initial Contributors:
+ * Nokia Corporation - initial contribution.
+ *
+ * Contributors:
+ *
+ * Description:  
+ *
+ */
+
+#ifndef SEARCH_STATES_SETTINGS_H
+#define SEARCH_STATES_SETTINGS_H
+
+#include <qstate.h>
+#include <qabstractitemmodel.h>
+#include "Search_global.h"
+
+SEARCH_CLASS( SearchStateProviderTest)
+
+class QGraphicsWidget;
+class HbMainWindow;
+class HbLabel;
+class HbStackedWidget;
+class HbView;
+class HbDocumentLoader;
+class HbAction;
+class HbGridView;
+class QGraphicsLinearLayout;
+class SettingsWidget;
+
+/** @ingroup group_searchstateprovider
+ * @brief The state handles wizard activation and interaction.
+ *
+ * @see StateMachine
+ *
+ * @lib ?library
+ * @since S60 ?S60_version
+ */
+class SearchSettingsState : public QState
+    {
+Q_OBJECT
+public:
+    /*
+     * The plugin's display mode enumeration.
+     * FullScreen means menustrip is not shown.
+     * PartialScreen means menustrip is shown.
+     */
+    enum PluginDisplayMode
+        {
+        FullScreen, PartialScreen
+        };
+
+public:
+
+    /**
+     * Constructor.
+     * @since S60 ?S60_version.     
+     * @param aParent Owner.
+     */
+    SearchSettingsState(QState *aParent = 0);
+
+    /**
+     * Destructor.
+     * @since S60 ?S60_version.
+     */
+    virtual ~SearchSettingsState();
+
+protected:
+
+    /**
+     * @copydoc QState::onEntry()
+     */
+    void onEntry(QEvent *event);
+
+    /**
+     * @copydoc QState::onExit()
+     */
+    void onExit(QEvent *event);
+
+private:
+
+    /**
+     * Returns the main window handle.
+     * @since S60 ?S60_version.
+     * @return The pointer to the main window.
+     */
+    //  HbMainWindow* mainWindow();
+
+    /**
+     * Connects signals and slots for active wizard.
+     * @since S60 ?S60_version.
+     */
+
+    void isInternetOn();
+public slots:
+
+    void getItemCategory(int, bool);
+
+    /**
+     * Signalled when back action is triggerd from toolbaar.
+     * @since S60 ?S60_version.
+     */
+    void handleBackEvent(bool);
+
+    /**
+     * Function to customize the progressive state.
+     * @since S60 ?S60_version.
+     */
+    //  void customizeGoButton();
+signals:
+
+    /**
+     * Emitted when the menu state is to be activated.
+     * @since S60 ?S60_version.
+     */
+    void backEventTriggered();
+    
+    /**
+     * Emitted when ok/cancel clicked on settings page
+     * @since S60 ?S60_version.
+     */
+    void clickstatus(bool);
+
+    /**
+     * Emitted when categories selected for searching
+     * @since S60 ?S60_version.
+     */
+    void publishSelectedCategory(int, bool);
+
+    /**
+     * Emitted when internet search is selectead 
+     * @since S60 ?S60_version.
+     */
+    void customizeGoButton(bool);
+
+private:
+
+    /**
+     * HbMainWindow instance.
+     */
+    HbMainWindow* mMainWindow;
+
+    /**
+     * HbDocumentLoader instance.
+     */
+    HbDocumentLoader* mDocumentLoader;
+
+    /**
+     * settings widget
+     * 
+     */
+    SettingsWidget* mWidget;
+
+    bool minitialCount;
+    /**
+     * friend class for unit testing
+     */
+SEARCH_FRIEND_CLASS    (SearchStateProviderTest)
+    };
+
+#endif //SEARCH_STATES_SETTINGS_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/searchui/stateproviders/searchstateprovider/inc/searchstateprovider.h	Mon Apr 19 14:40:05 2010 +0300
@@ -0,0 +1,93 @@
+/*
+ * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+ * All rights reserved.
+ * This component and the accompanying materials are made available
+ * under the terms of "Eclipse Public License v1.0"
+ * which accompanies this distribution, and is available
+ * at the URL "http://www.eclipse.org/legal/epl-v10.html".
+ *
+ * Initial Contributors:
+ * Nokia Corporation - initial contribution.
+ *
+ * Contributors:
+ *
+ * Description:  Declaration of the Search state provider
+ *
+ */
+
+#ifndef SEARCH_STATEPROVIDERS_STATEPROVIDER_H
+#define SEARCH_STATEPROVIDERS_STATEPROVIDER_H
+
+#include "Search_global.h"
+
+#include "hsistateprovider.h"
+
+class SearchStateProviderTest;
+
+class QState;
+
+/**
+ * @ingroup group_Searchstateprovider
+ * @brief Provides a default implementation for each Search state.
+ *
+ * This provider includes a default implementation for each Search state
+ * States are described in the Searchstateprovider.manifest file.
+ *
+ * @lib Searchstateprovider
+ * @since S60 ?S60_version.
+ */
+class SearchStateProvider : public QObject, public IHsStateProvider
+    {
+
+Q_OBJECT
+Q_INTERFACES(IHsStateProvider)
+
+public:
+
+    /**
+     * Default constructor.
+     *
+     * @since S60 ?S60_version.
+     */
+    SearchStateProvider();
+
+    /**
+     * Destructor.
+     *
+     * @since S60 ?S60_version.
+     */
+    virtual ~SearchStateProvider();
+
+public:
+
+    /**
+     * Returns contained states as a list of tokens.
+     *
+     * @return Contained states as a list of tokens.
+     * @since S60 ?S60_version.
+     */
+    QList<HsStateToken> states();
+
+    /**
+     * Creates a state based on the given token.
+     *
+     * @param aToken Identifies the state to be created.
+     * @since S60 ?S60_version.
+     */
+    QState* createState(const HsStateToken& aToken);
+
+private:
+
+    /**
+     * Token that describes the wizard menu state.
+     */
+    HsStateToken mInitStateToken;
+
+    HsStateToken mWizardMenuStateToken;
+
+    HsStateToken mWizardActivatedStateToken;
+
+    friend class SearchStateProviderTest;
+    };
+
+#endif //SEARCH_STATEPROVIDERS_STATEPROVIDER_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/searchui/stateproviders/searchstateprovider/inc/settingswidget.h	Mon Apr 19 14:40:05 2010 +0300
@@ -0,0 +1,152 @@
+/*
+ * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+ * All rights reserved.
+ * This component and the accompanying materials are made available
+ * under the terms of "Eclipse Public License v1.0"
+ * which accompanies this distribution, and is available
+ * at the URL "http://www.eclipse.org/legal/epl-v10.html".
+ *
+ * Initial Contributors:
+ * Nokia Corporation - initial contribution.
+ *
+ * Contributors:
+ *
+ * Description:  Declaration of the settings widget
+ *
+ */
+#ifndef SETTINGSWIDGET_H_
+#define SETTINGSWIDGET_H_
+
+#include <hbwidget.h>
+#include <qlist.h>
+#include <hbgridview.h>
+#include <Search_global.h>
+class HbCheckBox;
+class HbDialog;
+class QSignalMapper;
+
+SEARCH_CLASS(SearchStateProviderTest)
+
+class SettingsWidget : public HbWidget
+    {
+Q_OBJECT
+public:
+    /**
+     * Construction
+     */
+    SettingsWidget();
+    /**
+     * destructor
+     */
+    ~SettingsWidget();
+public:
+    /**
+     * Launching the settings widget
+     */
+    void launchSettingWidget();
+    /**
+     * Verifies internet selection
+     * 
+     */
+    bool isInternetSearchOptionSelected();
+    /**
+     * unchecking subcategories under the main category once main category unchecked
+     */
+    void unCheckSubCategories(int aUnCheckSubCategory);
+    /**
+     * checking subcategories under the main category once main category checked
+     */
+    void checkSubCategories(int acheckSubCategory);
+    /**
+     * storing settings to application ini file
+     * 
+     */
+    void storeSettingsToiniFile();
+    /**
+     * Load setting from application ini file
+     * 
+     */
+    void loadSettingsFrominiFile();
+    /**
+     * make "OK" button visible 
+     * 
+     */
+    void setActionVisibility();
+    /**
+     * enable default settings in the application ini file
+     * 
+     */
+    void enableDefaultSettings();
+public slots:
+    /**
+     * will be called when settings OK is clicked
+     */
+    void checkBoxOkEvent();
+    /**
+     * will be called when setting cancel is called
+     */
+    void checkBoxCancelEvent();
+    /**
+     * will be called whenn any check box is checked
+     */
+    void itemChecked(int);
+    /**
+     * will be called when change oin internet or device selectin
+     * 
+     */
+    void changeDeviceInternetCheck();
+signals:
+    /**
+     * Emitted when setting closed
+     * 
+     */
+    void settingsEvent(bool);
+    /**
+     * Emitted if settings changed for "go" button
+     * 
+     */
+    void settingsChanged();
+    /**
+     * Emitted when categories selected or deselected
+     * 
+     */
+    void selectedItemCategory(int, bool);
+
+private:
+    /**
+     * for Device category list
+     */
+    QList<HbCheckBox*> mDeviceCheckBoxList;
+    /**
+     * for Internet category list
+     */
+    QList<HbCheckBox*> mInternetCheckBoxList;
+    /**
+     * mapper to map checkboxes
+     * 
+     */
+    QSignalMapper* signalMapper;
+    /**
+     * settings widget popup
+     */
+    HbDialog *popup;
+    /**
+     * to indicate internet is selected or not
+     */
+    bool isInternetSelected;
+
+    /**
+     * list of hardcoded device categories
+     */
+    QStringList deviceCategoryList;
+
+    /**
+     * list of hardcoded service providers
+     */
+    QStringList internetCategoryList;
+    /**
+     * for unit testing
+     */
+SEARCH_FRIEND_CLASS    (SearchStateProviderTest)
+    };
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/searchui/stateproviders/searchstateprovider/resource/searchstateprovider.manifest	Mon Apr 19 14:40:05 2010 +0300
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="utf-8"?>
+<stateprovider>
+    <state library="searchstateprovider.dll"
+           uri="search.nokia.com/state/initstate"/>
+    <state library="searchstateprovider.dll"
+           uri="search.nokia.com/state/wizardprogressivestate"/>
+    <state library="searchstateprovider.dll"
+           uri="search.nokia.com/state/wizardsettingstate "/>
+</stateprovider>
Binary file searchui/stateproviders/searchstateprovider/resources/calender.png has changed
Binary file searchui/stateproviders/searchstateprovider/resources/camera.png has changed
Binary file searchui/stateproviders/searchstateprovider/resources/email.png has changed
Binary file searchui/stateproviders/searchstateprovider/resources/message.png has changed
Binary file searchui/stateproviders/searchstateprovider/resources/phonebook.png has changed
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/searchui/stateproviders/searchstateprovider/resources/resources.qrc	Mon Apr 19 14:40:05 2010 +0300
@@ -0,0 +1,14 @@
+<RCC>
+    <qresource prefix="/xml">
+        <file alias="searchstateprovider.docml">searchstateprovider.docml</file>
+    </qresource>
+    <qresource prefix="/decorators">
+        <file alias="video.png">video.png</file>
+        <file alias="calender.png">calender.png</file>
+        <file alias="camera.png">camera.png</file>
+        <file alias="email.png">email.png</file>
+        <file alias="message.png">message.png</file>
+        <file alias="phonebook.png">phonebook.png</file>
+        <file alias="sound.png">sound.png</file>
+    </qresource>
+</RCC>
Binary file searchui/stateproviders/searchstateprovider/resources/sound.png has changed
Binary file searchui/stateproviders/searchstateprovider/resources/video.png has changed
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/searchui/stateproviders/searchstateprovider/searchstateprovider.pri	Mon Apr 19 14:40:05 2010 +0300
@@ -0,0 +1,20 @@
+#
+# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+# All rights reserved.
+# This component and the accompanying materials are made available
+# under the terms of "Eclipse Public License v1.0"
+# which accompanies this distribution, and is available
+# at the URL "http://www.eclipse.org/legal/epl-v10.html".
+#
+# Initial Contributors:
+# Nokia Corporation - initial contribution.
+#
+# Contributors:
+#
+# Description:  SEARCH state provider list of files
+#
+
+HEADERS += ./inc/*.h
+SOURCES += ./src/*.cpp
+
+RESOURCES += resources/resources.qrc
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/searchui/stateproviders/searchstateprovider/searchstateprovider.pro	Mon Apr 19 14:40:05 2010 +0300
@@ -0,0 +1,84 @@
+#
+# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+# All rights reserved.
+# This component and the accompanying materials are made available
+# under the terms of "Eclipse Public License v1.0"
+# which accompanies this distribution, and is available
+# at the URL "http://www.eclipse.org/legal/epl-v10.html".
+#
+# Initial Contributors:
+# Nokia Corporation - initial contribution.
+#
+# Contributors:
+#
+# Description:  SEARCH state provider project file
+#
+
+TEMPLATE = lib
+
+
+symbian {
+    CONFIG(debug, debug|release) {
+      DESTDIR = debug      
+    } else {
+      DESTDIR = release
+    }
+}
+
+win32 {
+    CONFIG(debug, debug|release) {
+      SUBDIRPART = debug
+    } else {
+      SUBDIRPART = release
+    }
+    DESTDIR = $$PWD/../../../bin/$$SUBDIRPART/searchresources/plugins/stateproviders
+    INCLUDEPATH += \              
+              $$PWD/../../../homescreensrv/homescreensrv_plat/ftuwizardmodel_api/inc \
+              $$PWD/../../../homescreensrv/homescreensrv_plat/statemodel_api
+    LIBS += -L$$PWD/../../../bin/debug
+}
+
+
+LIBS += -lstatemodel
+LIBS += -lsearchindevicehandler
+LIBS += -lxqservice 
+LIBS += -lqcpixsearchclient
+LIBS += -laknskins 
+LIBS += -lfbscli
+LIBS += -laknicon
+LIBS += -lapgrfx
+LIBS += -lbitgdi
+
+
+CONFIG += plugin debug_and_release
+
+coverage:DEFINES += COVERAGE_MEASUREMENT
+
+CONFIG += hb
+
+QT += xml
+
+nft:DEFINES += NFT
+
+DEPENDPATH += ./inc \
+              ./src
+
+INCLUDEPATH += ./inc \
+               ../../inc \
+               ../../indevicehandler/inc
+               
+
+
+symbian {
+    TARGET.UID2 = 0x20004C45
+    TARGET.UID3 = 0x2002C37A
+    TARGET.EPOCALLOWDLLDATA=1
+    TARGET.CAPABILITY = ALL -TCB -DRM
+    INCLUDEPATH += $$MW_LAYER_SYSTEMINCLUDE 
+    include(searchstateprovider_installs_symbian.pri)
+
+}
+
+symbian:unix:include(searchstateprovider_installs_unix.pri)
+include(searchstateprovider.pri)
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/searchui/stateproviders/searchstateprovider/searchstateprovider_installs_symbian.pri	Mon Apr 19 14:40:05 2010 +0300
@@ -0,0 +1,31 @@
+#
+# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+# All rights reserved.
+# This component and the accompanying materials are made available
+# under the terms of "Eclipse Public License v1.0"
+# which accompanies this distribution, and is available
+# at the URL "http://www.eclipse.org/legal/epl-v10.html".
+#
+# Initial Contributors:
+# Nokia Corporation - initial contribution.
+#
+# Contributors:
+#
+# Description: 
+#
+
+export.sources = resource/*.manifest
+export.path = /searchresources/plugins/stateproviders
+
+pluginstub.sources = searchstateprovider.dll 
+pluginstub.path = /searchresources/plugins/stateproviders
+
+DEPLOYMENT += export pluginstub
+
+#deploy.path = z:
+#qtplugins.path = /searchresources/plugins/stateproviders
+#qtplugins.sources += qmakepluginstubs/searchstateprovider.qtplugin
+#qtplugins.sources += resource/searchstateprovider.manifest
+
+#for(qtplugin, qtplugins.sources):BLD_INF_RULES.prj_exports += "./$$qtplugin $$deploy.path$$qtplugins.path/$$basename(qtplugin)"  
+  
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/searchui/stateproviders/searchstateprovider/searchstateprovider_installs_unix.pri	Mon Apr 19 14:40:05 2010 +0300
@@ -0,0 +1,34 @@
+#
+# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+# All rights reserved.
+# This component and the accompanying materials are made available
+# under the terms of "Eclipse Public License v1.0"
+# which accompanies this distribution, and is available
+# at the URL "http://www.eclipse.org/legal/epl-v10.html".
+#
+# Initial Contributors:
+# Nokia Corporation - initial contribution.
+#
+# Contributors:
+#
+# Description: 
+#
+#
+# Release
+#
+
+r01.path = ../../../bin/release/searchresources/plugins/stateproviders
+r01.files = ./release/*.so* \
+            ./resource/*.manifest
+
+INSTALLS += r01
+
+#
+# Debug
+#
+
+d01.path = ../../../bin/debug/searchresources/plugins/stateproviders
+d01.files = ./debug/*.so* \
+            ./resource/*.manifest
+
+INSTALLS += d01
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/searchui/stateproviders/searchstateprovider/searchstateprovider_installs_win32.pri	Mon Apr 19 14:40:05 2010 +0300
@@ -0,0 +1,34 @@
+#
+# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+# All rights reserved.
+# This component and the accompanying materials are made available
+# under the terms of "Eclipse Public License v1.0"
+# which accompanies this distribution, and is available
+# at the URL "http://www.eclipse.org/legal/epl-v10.html".
+#
+# Initial Contributors:
+# Nokia Corporation - initial contribution.
+#
+# Contributors:
+#
+# Description: 
+#
+#
+# Release
+#
+
+r01.path = $$PWD/../../../bin/release/searchresources/plugins/stateproviders
+r01.files = $$PWD/../../../bin/release/searchstateprovider.* \
+            ./resource/*.manifest
+
+INSTALLS += r01
+
+#
+# Debug
+#
+
+d01.path = $$PWD/../../../bin/debug/searchresources/plugins/stateproviders
+d01.files = $$PWD/../../../bin/debug/searchstateprovider.* \
+            ./resource/*.manifest
+
+INSTALLS += d01
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/searchui/stateproviders/searchstateprovider/src/searchinitstate.cpp	Mon Apr 19 14:40:05 2010 +0300
@@ -0,0 +1,74 @@
+/*
+ * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+ * All rights reserved.
+ * This component and the accompanying materials are made available
+ * under the terms of "Eclipse Public License v1.0"
+ * which accompanies this distribution, and is available
+ * at the URL "http://www.eclipse.org/legal/epl-v10.html".
+ *
+ * Initial Contributors:
+ * Nokia Corporation - initial contribution.
+ *
+ * Contributors:
+ *
+ * Description:  Implementation of the SEARCH init state.
+ *
+ */
+
+#include "searchinitstate.h"
+
+// Remove when functionality and tests implemented
+#ifdef COVERAGE_MEASUREMENT
+#pragma CTC SKIP
+#endif //COVERAGE_MEASUREMENT
+
+// ---------------------------------------------------------------------------
+// SearchInitState::SearchInitState
+// ---------------------------------------------------------------------------
+//
+SearchInitState::SearchInitState(QState *parent) :
+    QState(parent)
+    {
+    construct();
+    }
+
+// ---------------------------------------------------------------------------
+// SearchInitState::~SearchInitState
+// ---------------------------------------------------------------------------
+//
+SearchInitState::~SearchInitState()
+    {
+    }
+
+// ---------------------------------------------------------------------------
+// SearchInitState::~construct()
+// ---------------------------------------------------------------------------
+//
+void SearchInitState::construct()
+    {
+    // Read configuration parameters?
+    // lazyInit()?
+    }
+
+// ---------------------------------------------------------------------------
+// SearchInitState::onEntry
+// ---------------------------------------------------------------------------
+//
+void SearchInitState::onEntry(QEvent *event)
+    {
+    QState::onEntry(event);
+    }
+
+// ---------------------------------------------------------------------------
+// SearchInitState::onExit
+// ---------------------------------------------------------------------------
+//
+void SearchInitState::onExit(QEvent *event)
+    {
+    QState::onExit(event);
+    }
+
+// Remove when functionality and tests implemented
+#ifdef COVERAGE_MEASUREMENT
+#pragma CTC ENDSKIP
+#endif //COVERAGE_MEASUREMENT
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/searchui/stateproviders/searchstateprovider/src/searchprogressivestate.cpp	Mon Apr 19 14:40:05 2010 +0300
@@ -0,0 +1,942 @@
+/*
+ * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+ * All rights reserved.
+ * This component and the accompanying materials are made available
+ * under the terms of "Eclipse Public License v1.0"
+ * which accompanies this distribution, and is available
+ * at the URL "http://www.eclipse.org/legal/epl-v10.html".
+ *
+ * Initial Contributors:
+ * Nokia Corporation - initial contribution.
+ *
+ * Contributors:
+ *
+ * Description:  Implementation of the progressive search state.
+ *
+ */
+
+#include "searchprogressivestate.h"
+#include "indevicehandler.h"
+#include "qcpixdocument.h"
+#include "qcpixdocumentfield.h"
+#include <hbmainwindow.h>
+#include <hbview.h>
+#include <hblabel.h>
+#include <hbicon.h>
+#include <hbmenu.h>
+#include <hbinstance.h>
+#include <hblistview.h>
+#include <hbdocumentloader.h>
+#include <hbsearchpanel.h>
+#include <hbaction.h>
+#include <qstandarditemmodel.h>
+#include <xqservicerequest.h>
+#include <hbframebackground.h>
+#include <hbabstractviewitem.h>
+#include <hbframebackground.h>
+#include <hblistviewitem.h>
+#include <hbapplication.h>
+#include <qsortfilterproxymodel.h>
+#include <AknsUtils.h>
+#include <bitdev.h> 
+#include <bitstd.h>
+#include <qbitmap.h>
+#include <fbs.h>
+#include <AknInternalIconUtils.h>
+#include <AknIconUtils.h> 
+#include <apgcli.h>
+
+const char *SEARCHSTATEPROVIDER_DOCML = ":/xml/searchstateprovider.docml";
+const char *TOC_VIEW = "tocView";
+const char *TUT_SEARCHPANEL_WIDGET = "searchPanel";
+const char *TUT_LIST_VIEW = "listView";
+const QSize defaultIconSize(30, 30);
+
+// ---------------------------------------------------------------------------
+// SearchProgressiveState::SearchProgressiveState
+// ---------------------------------------------------------------------------
+//
+SearchProgressiveState::SearchProgressiveState(QState *parent) :
+    QState(parent), mMainWindow(NULL), mView(NULL), mListView(NULL),
+            mDocumentLoader(NULL), mModel(NULL), mSearchHandler(NULL)
+    {
+
+    mMainWindow = hbInstance->allMainWindows().at(0);
+    mModel = new QStandardItemModel(this);
+
+    proxyModel = new QSortFilterProxyModel(this);
+    proxyModel->setSourceModel(mModel);
+
+    mDocumentLoader = new HbDocumentLoader();
+    bool ok = false;
+    mDocumentLoader->load(SEARCHSTATEPROVIDER_DOCML, &ok);
+
+    QGraphicsWidget *widget = mDocumentLoader->findWidget(TOC_VIEW);
+    Q_ASSERT_X(ok && (widget != 0), "TOC_VIEW", "invalid view");
+
+    mView = qobject_cast<HbView*> (widget);
+    if (mView)
+        {
+        mView->setTitle(hbTrId("txt_search_title_search"));
+        }
+
+    mListView = qobject_cast<HbListView *> (mDocumentLoader->findWidget(
+            TUT_LIST_VIEW));
+    Q_ASSERT_X(ok && (mListView != 0), "TUT_LIST_VIEW", "invalid viewocML file");
+
+    if (mListView)
+        {
+        HbAbstractViewItem *prototype = mListView->itemPrototypes().first();
+        HbFrameBackground frame;
+        frame.setFrameGraphicsName("qtg_fr_list_normal");
+        frame.setFrameType(HbFrameDrawer::NinePieces);
+        prototype->setDefaultFrame(frame);
+
+        HbListViewItem *prototypeListView = qobject_cast<HbListViewItem *> (
+                prototype);
+        if (prototypeListView)
+            {
+            prototypeListView->setTextFormat(Qt::RichText);
+
+            }
+        mListView->setModel(mModel, prototype);
+        }
+    //bool bl = mListView->itemRecycling();
+    // mListView->setItemRecycling(false);
+    //mListView->setModel(proxyModel);
+
+    mSearchPanel = qobject_cast<HbSearchPanel *> (
+            mDocumentLoader->findWidget(TUT_SEARCHPANEL_WIDGET));
+    if (mSearchPanel)
+        {
+        mSearchPanel->setSearchOptionsEnabled(true);
+        }
+
+    mSearchHandler = new InDeviceHandler();
+    if (mView)
+        {
+        mMainWindow->addView(mView);
+        mMainWindow->setCurrentView(mView);
+        }
+    mDatabasecount = 0;
+    mLinkindex = 0;
+    mResultcount = 0;
+    mResultparser = 0;
+    loadSettings = true;
+
+    //Icon creation in array
+    RArray<TUid> appUid;
+    appUid.Append(TUid::Uid(0x20022EF9));//contact
+    appUid.Append(TUid::Uid(0x10207C62));//media(audio)
+    appUid.Append(TUid::Uid(0x200211FE));//video not assigned 
+    appUid.Append(TUid::Uid(0x20000A14));//image 
+    appUid.Append(TUid::Uid(0x2001FE79));//msg
+    appUid.Append(TUid::Uid(0x20022F35));//email not assigned 
+    appUid.Append(TUid::Uid(0x10005901));//calender
+    appUid.Append(TUid::Uid(0x20029F80));//notes
+    //appUid.Append(TUid::Uid(0x20022F35));//application
+    appUid.Append(TUid::Uid(0x20022F35));//bookmark not assigned
+    appUid.Append(TUid::Uid(0x2002BCC0));//files
+
+    for (int i = 0; i < appUid.Count(); i++)
+        {
+        mIconArray.append(getAppIconFromAppId(appUid[i]));
+        }
+
+    }
+// ---------------------------------------------------------------------------
+// SearchProgressiveState::~SearchProgressiveState
+// ---------------------------------------------------------------------------
+//
+SearchProgressiveState::~SearchProgressiveState()
+    {
+    if (proxyModel)
+        {
+        delete proxyModel;
+        }
+
+    if (mModel)
+        {
+        delete mModel;
+        }
+    if (mDocumentLoader)
+        {
+        delete mDocumentLoader;
+        }
+    if (mSearchHandler)
+        {
+        delete mSearchHandler;
+        }
+
+    }
+
+// ---------------------------------------------------------------------------
+// SearchProgressiveState::onEntry
+// ---------------------------------------------------------------------------
+//
+void SearchProgressiveState::onEntry(QEvent *event)
+    {
+    //  WMS_LOG << "::onEntry";
+    QState::onEntry(event);
+
+    activateSignals();
+
+    // If this is not the current view, we're getting back from plugin view  
+
+    if (mMainWindow->currentView() != mView)
+        {
+        mMainWindow->setCurrentView(mView, true);
+        }
+    mMainWindow->show();
+
+    if (loadSettings)
+        {
+        emit settingsState();
+        loadSettings = false;
+        }
+
+    }
+// ---------------------------------------------------------------------------
+// SearchProgressiveState::onExit
+// ---------------------------------------------------------------------------
+//
+void SearchProgressiveState::onExit(QEvent *event)
+    {
+    QState::onExit(event);
+    deActivateSignals();
+    }
+
+// ---------------------------------------------------------------------------
+// SearchProgressiveState::activateSignals
+// ---------------------------------------------------------------------------
+//
+void SearchProgressiveState::activateSignals()
+    {
+    if (mSearchHandler)
+        {
+        connect(mSearchHandler, SIGNAL(handleSearchResult(int,int)), this,
+                SLOT(onSearchComplete(int,int)));
+        connect(mSearchHandler, SIGNAL(handleAsyncSearchResult(int,int)),
+                this, SLOT(onAsyncSearchComplete(int,int)));
+        connect(mSearchHandler, SIGNAL(handleDocument(int,QCPixDocument*)),
+                this, SLOT(onGetDocumentComplete(int,QCPixDocument*)));
+        }
+    if (mListView)
+        {
+        connect(mListView, SIGNAL(activated(const QModelIndex)), this,
+                SLOT(openResultitem(const QModelIndex)));
+        }
+    if (mSearchPanel)
+        {
+        connect(mSearchPanel, SIGNAL(criteriaChanged(QString)), this,
+                SLOT(startNewSearch(QString)));
+
+        connect(mSearchPanel, SIGNAL(searchOptionsClicked()), this,
+                SLOT(setSettings()));
+        
+        connect(mSearchPanel, SIGNAL(exitClicked()), this,
+                        SLOT(cancelSearch()));
+        }
+    }
+// ---------------------------------------------------------------------------
+// SearchProgressiveState::deActivateSignals
+// ---------------------------------------------------------------------------
+//
+void SearchProgressiveState::deActivateSignals()
+    {
+    if (mSearchHandler)
+        {
+        disconnect(mSearchHandler, SIGNAL(handleSearchResult(int,int)), this,
+                SLOT(onSearchComplete(int,int)));
+        disconnect(mSearchHandler, SIGNAL(handleAsyncSearchResult(int,int)),
+                this, SLOT(onAsyncSearchComplete(int,int)));
+        disconnect(mSearchHandler,
+                SIGNAL(handleDocument(int,QCPixDocument*)), this,
+                SLOT(onGetDocumentComplete(int,QCPixDocument*)));
+        }
+    if (mListView)
+        {
+        disconnect(mListView, SIGNAL(activated(const QModelIndex)), this,
+                SLOT(openResultitem(const QModelIndex)));
+        }
+    if (mSearchPanel)
+        {
+        disconnect(mSearchPanel, SIGNAL(criteriaChanged(QString)), this,
+                SLOT(startNewSearch(QString)));
+
+        disconnect(mSearchPanel, SIGNAL(searchOptionsClicked()), this,
+                SLOT(setSettings()));
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// SearchProgressiveState::onSearchComplete
+// ---------------------------------------------------------------------------
+//
+void SearchProgressiveState::onSearchComplete(int aError, int aResultCount)
+    {
+    if (aError != 0)
+        {
+        //Error found
+        return;
+        }
+    if (aResultCount > 0)
+        {
+        mResultcount = aResultCount;
+        mResultparser = 0;
+        mSearchHandler->getDocumentAsyncAtIndex(mResultparser);
+        }
+    }
+// ---------------------------------------------------------------------------
+// SearchProgressiveState::onAsyncSearchComplete
+// ---------------------------------------------------------------------------
+//
+void SearchProgressiveState::onAsyncSearchComplete(int aError,
+        int aResultCount)
+    {
+
+    if (aError != 0)
+        {
+        //some error print logs
+        searchOnCategory(mSearchString);
+        return;
+        }
+    if (aResultCount == 0)
+        {
+        searchOnCategory(mSearchString);
+        }
+    else if (aResultCount > 0)
+        {
+        mResultcount = aResultCount;
+        mResultparser = 0;
+
+        mSearchHandler->getDocumentAsyncAtIndex(mResultparser);
+        }
+    }
+// ---------------------------------------------------------------------------
+// SearchProgressiveState::onGetDocumentComplete
+// ---------------------------------------------------------------------------
+//
+void SearchProgressiveState::onGetDocumentComplete(int aError,
+        QCPixDocument* aDoc)
+    {
+    if (aDoc == NULL || aError != 0)
+        return;
+    QStringList liststr;
+    QString secondrow = aDoc->excerpt();
+    QString baseclass = aDoc->baseAppClass();
+    QString Uid = aDoc->docId();
+    QString firstrow;
+
+    //-------------- html tag creation-------------------
+    QString htmlTagPre = QString("<u>");
+    QString htmlTagPost = QString("</u>");
+    int insertpt = secondrow.indexOf(mOriginalString, 0, Qt::CaseInsensitive);
+    if (insertpt >= 0)
+        {
+        int preTagLen = htmlTagPre.length();
+
+        secondrow.insert(insertpt, htmlTagPre);
+
+        secondrow.insert(insertpt + mOriginalString.length() + preTagLen,
+                htmlTagPost);
+        //--------------------Html Tag Creation completed------------
+        }
+
+    QStandardItem* listitem = new QStandardItem();
+
+    if (aDoc->baseAppClass().contains("contact"))
+        {
+        int index = aDoc->fieldCount();
+        for (int i = 0; i < index; i++)
+            {
+            if (aDoc->field(i).name().contains("GivenName"))
+                {
+                firstrow = aDoc->field(i).value();
+                break;
+                }
+            }
+        if (firstrow.length() == 0)
+            firstrow = baseclass;
+        liststr << firstrow << secondrow;
+        listitem->setData(mIconArray.at(0), Qt::DecorationRole);
+
+        }
+    else if (aDoc->baseAppClass().contains("audio"))
+        {
+        int index = aDoc->fieldCount();
+        for (int i = 0; i < index; i++)
+            {
+            if (aDoc->field(i).name().contains("Name"))
+                {
+                firstrow = aDoc->field(i).value();
+                break;
+                }
+            }
+        if (firstrow.length() == 0)
+            firstrow = baseclass;
+        liststr << firstrow << secondrow;
+        listitem->setData(mIconArray.at(1), Qt::DecorationRole);
+        }
+    else if (aDoc->baseAppClass().contains("video"))
+        {
+        int index = aDoc->fieldCount();
+        for (int i = 0; i < index; i++)
+            {
+            if (aDoc->field(i).name().contains("Name"))
+                {
+                firstrow = aDoc->field(i).value();
+                break;
+                }
+            }
+        if (firstrow.length() == 0)
+            firstrow = baseclass;
+        liststr << firstrow << secondrow;
+        listitem->setData(mIconArray.at(2), Qt::DecorationRole);
+
+        }
+    else if (aDoc->baseAppClass().contains("image"))
+        {
+        int index = aDoc->fieldCount();
+        for (int i = 0; i < index; i++)
+            {
+            if (aDoc->field(i).name().contains("Name"))
+                {
+                firstrow = aDoc->field(i).value();
+                break;
+                }
+            }
+        if (firstrow.length() == 0)
+            firstrow = baseclass;
+        liststr << firstrow << secondrow;
+        listitem->setData(mIconArray.at(3), Qt::DecorationRole);
+        }
+    else if (aDoc->baseAppClass().contains("msg"))
+        {
+        int index = aDoc->fieldCount();
+        for (int i = 0; i < index; i++)
+            {
+            if (aDoc->field(i).name().contains("Subject"))
+                {
+                firstrow = aDoc->field(i).value();
+                break;
+                }
+            }
+        if (firstrow.length() == 0)
+            firstrow = baseclass;
+        liststr << firstrow << secondrow;
+        listitem->setData(mIconArray.at(4), Qt::DecorationRole);
+
+        }
+    else if (aDoc->baseAppClass().contains("email"))
+        {
+        int index = aDoc->fieldCount();
+        for (int i = 0; i < index; i++)
+            {
+            if (aDoc->field(i).name().contains("GivenName"))
+                {
+                firstrow = aDoc->field(i).value();
+                break;
+                }
+            }
+        if (firstrow.length() == 0)
+            firstrow = baseclass;
+        liststr << firstrow << secondrow;
+        }
+    else if (aDoc->baseAppClass().contains("calendar"))
+        {
+        int index = aDoc->fieldCount();
+        for (int i = 0; i < index; i++)
+            {
+            if (aDoc->field(i).name().contains("Description"))
+                {
+                firstrow = aDoc->field(i).value();
+                break;
+                }
+            }
+        if (firstrow.length() == 0)
+            firstrow = baseclass;
+        liststr << firstrow << secondrow;
+        listitem->setData(mIconArray.at(6), Qt::DecorationRole);
+        }
+    else if (aDoc->baseAppClass().contains("notes"))
+        {
+        int index = aDoc->fieldCount();
+        for (int i = 0; i < index; i++)
+            {
+            if (aDoc->field(i).name().contains("Memo"))
+                {
+                firstrow = aDoc->field(i).value();
+                break;
+                }
+            }
+        if (firstrow.length() == 0)
+            firstrow = baseclass;
+        liststr << firstrow << secondrow;
+        }
+    else if (aDoc->baseAppClass().contains("applications"))
+        {
+
+        liststr << secondrow;
+        bool ok;
+        listitem->setData(getAppIconFromAppId(TUid::Uid(aDoc->docId().toInt(
+                &ok, 16))), Qt::DecorationRole);
+        }
+    else if (aDoc->baseAppClass().contains("bookmark"))
+        {
+        int index = aDoc->fieldCount();
+        for (int i = 0; i < index; i++)
+            {
+            if (aDoc->field(i).name().contains("Name"))
+                {
+                firstrow = aDoc->field(i).value();
+                break;
+                }
+            }
+        if (firstrow.length() == 0)
+            firstrow = baseclass;
+        liststr << firstrow << secondrow;
+        }
+    else if (aDoc->baseAppClass().contains("file"))
+        {
+        int index = aDoc->fieldCount();
+        for (int i = 0; i < index; i++)
+            {
+            if (aDoc->field(i).name().contains("FullName"))
+                {
+                firstrow = aDoc->field(i).value();
+                break;
+                }
+            }
+        if (firstrow.length() == 0)
+            firstrow = baseclass;
+        liststr << firstrow << secondrow;
+        listitem->setData(mIconArray.at(9), Qt::DecorationRole);
+        }
+
+    listitem->setData(liststr, Qt::DisplayRole);
+    listitem->setData(aDoc->docId(), Qt::UserRole);
+    listitem->setData(aDoc->baseAppClass(), Qt::UserRole + 1);
+
+    mModel->appendRow(listitem);
+    mResultparser++;
+    if (mResultparser < mResultcount)
+        {
+
+        mSearchHandler->getDocumentAsyncAtIndex(mResultparser);
+        }
+    else
+        {
+
+        searchOnCategory(mSearchString);
+        }
+    }
+// ---------------------------------------------------------------------------
+// SearchProgressiveState::_selectedcategory
+// ---------------------------------------------------------------------------
+//
+void SearchProgressiveState::getSettingCategory(int item, bool avalue)
+    {
+
+    mSelectedCategory.insert(item, avalue);
+
+    }
+// ---------------------------------------------------------------------------
+// SearchProgressiveState::openResultitem
+// ---------------------------------------------------------------------------
+//
+void SearchProgressiveState::openResultitem(QModelIndex index)
+    {
+    QStandardItem* item = mModel->itemFromIndex(index);
+    QString baseclass = item->data(Qt::UserRole + 1).toString();
+    bool t;
+    int uid = (item->data(Qt::UserRole)).toInt(&t);
+
+    if (index.row() == mLinkindex)
+        {
+        // emit linkItemClicked();
+        }
+    else
+        {
+        XQServiceRequest *mSndEdit;
+        QVariant retValue;
+
+        if (baseclass.contains("contact"))
+            {
+            mSndEdit = new XQServiceRequest(
+                    "com.nokia.services.phonebookservices.Fetch",
+                    "open(int)", false);
+            *mSndEdit << uid;
+            retValue = mSndEdit->send();
+            }
+        else if (baseclass.contains("msg"))
+            {
+            mSndEdit = new XQServiceRequest(
+                    "com.nokia.services.hbserviceprovider.conversationview",
+                    "openConversationView(qint64,int)", false);
+            *mSndEdit << uid << 0;
+            retValue = mSndEdit->send();
+            }
+        }
+    }
+// ---------------------------------------------------------------------------
+// SearchProgressiveState::createSuggestionLink
+// ---------------------------------------------------------------------------
+//
+void SearchProgressiveState::createSuggestionLink(bool aFlag)
+    {
+    QStandardItem* listitem = new QStandardItem();
+    /*   QString displaystr;
+     QString searchStr(mSearchString);*/
+    QString htmlKeyword = QString("<u>%1</u>").arg(mOriginalString);
+    /*  QString htmlServiceProvider = QString("in Google");*/
+
+    if (!aFlag)
+        {
+        QString linkString = QString(hbTrId(
+                "txt_search_list_search_for_1_on_2").arg(htmlKeyword));
+        mLinkindex = mModel->rowCount();
+        listitem->setData(linkString, Qt::DisplayRole);
+        /*   HbFrameBackground* background = new HbFrameBackground(
+         "qtg_fr_button_function_latched", HbFrameDrawer::NinePieces);
+         listitem->setData(*background, Qt::BackgroundRole);
+         */
+        mModel->appendRow(listitem);
+        }
+
+    }
+// ---------------------------------------------------------------------------
+// SearchProgressiveState::noResultsFound
+// ---------------------------------------------------------------------------
+//
+void SearchProgressiveState::noResultsFound(QString aKeyword)
+    {
+    if (aKeyword.length())
+        {
+        QStandardItem* listitem = new QStandardItem();
+        QString noResultMsg = QString("<align=\"center\">" + hbTrId(
+                "txt_search_results_no_match_found"));
+        listitem->setData(noResultMsg, Qt::DisplayRole);
+        mModel->appendRow(listitem);
+        }
+
+    }
+// ---------------------------------------------------------------------------
+// SearchProgressiveState::noResultsFound
+// ---------------------------------------------------------------------------
+//
+void SearchProgressiveState::clear()
+    {
+    if (mModel)
+        {
+        mModel->clear();
+        }
+    }
+// ---------------------------------------------------------------------------
+// SearchProgressiveState::noResultsFound
+// ---------------------------------------------------------------------------
+//
+void SearchProgressiveState::searchOnCategory(const QString aKeyword)
+    {
+    mResultparser = 0;
+    mResultcount = 0;
+    if (mDatabasecount < mTemplist.count())
+        {
+        QString str = mTemplist.at(mDatabasecount);
+        mSearchHandler->setCategory(mTemplist.at(mDatabasecount));
+        mDatabasecount++;
+        if (mSearchHandler->isPrepared())
+            {
+
+            mSearchHandler->searchAsync(aKeyword, "_aggregate");
+            }
+        }
+    else if (mDatabasecount >= mTemplist.count())
+        {
+        if (mListView->indexCount() == 0 && aKeyword.length() != 0)
+            {
+            noResultsFound(mOriginalString);
+            createSuggestionLink(0);
+            }
+        return;
+        }
+
+    }
+// ---------------------------------------------------------------------------
+// SearchProgressiveState::startNewSearch
+// ---------------------------------------------------------------------------
+//
+void SearchProgressiveState::startNewSearch(const QString &aKeyword)
+    {
+
+    if (mSearchHandler)
+        {
+        mSearchHandler->cancelLastSearch();
+        clear();
+        }    
+    mOriginalString = aKeyword.trimmed();
+    if (mOriginalString.length())
+        {
+        mDatabasecount = 0;
+        mTemplist.clear();
+        mSearchString = mOriginalString;
+        mSearchString.append('*');
+        QMapIterator<int, bool> i(mSelectedCategory);
+        while (i.hasNext())
+            {
+            i.next();
+            if (i.value())
+                {
+                switch (i.key())
+                    {
+                    case 0:
+                        {
+                        break;
+                        }
+                    case 1: //Contacts
+                        {
+                        mTemplist.append("contact");
+                        break;
+                        }
+                    case 2://Media
+                        {
+                        mTemplist.append("media");
+                        break;
+                        }
+                    case 3://Messages& emails
+                        {
+                        mTemplist.append("msg");
+                        //mTemplist.append("email");
+                        break;
+                        }
+                    case 4://Calender& notes
+                        {
+                        mTemplist.append("calendar");
+                        //mTemplist.append("notes");
+                        break;
+                        }
+                    case 5://Applications
+                        {
+                        mTemplist.append("applications");
+                        break;
+                        }
+                    case 6://All other files
+                        {
+                        mTemplist.append("file");
+                        mTemplist.append("bookmark");
+                        break;
+                        }
+                    }
+                }
+            }
+        searchOnCategory(mSearchString);
+        }
+    }
+// ---------------------------------------------------------------------------
+// SearchProgressiveState::setSettings
+// ---------------------------------------------------------------------------
+//
+void SearchProgressiveState::setSettings()
+    {
+    mTempSelectedCategory = mSelectedCategory;
+    emit settingsState();
+    }
+// ---------------------------------------------------------------------------
+// SearchProgressiveState::_customizeGoButton
+// ---------------------------------------------------------------------------
+//
+void SearchProgressiveState::_customizeGoButton(bool avalue)
+    {
+    if (mSearchPanel)
+        {
+        if (avalue)
+            {
+            mSearchPanel->setProgressive(false);
+            }
+        else
+            {
+            mSearchPanel->setProgressive(true);
+            }
+        }
+    }
+// ---------------------------------------------------------------------------
+// SearchProgressiveState::settingsaction
+// ---------------------------------------------------------------------------
+//
+void SearchProgressiveState::settingsaction(bool avalue)
+    {
+    if (avalue)
+        {
+        QMapIterator<int, bool> i(mTempSelectedCategory);
+        QMapIterator<int, bool> j(mSelectedCategory);
+        while (i.hasNext())
+            {
+            i.next();
+            j.next();
+            if (i.value() == j.value())
+                {
+
+                }
+            else
+                {
+                startNewSearch(mOriginalString);
+                break;
+                }
+            }
+        }
+    }
+// ---------------------------------------------------------------------------
+// SearchProgressiveState::cancelSearch
+// ---------------------------------------------------------------------------
+//
+void SearchProgressiveState::cancelSearch()
+    {
+    if(mSearchHandler)
+        {
+        mSearchHandler->cancelLastSearch();
+        }
+    }
+// ---------------------------------------------------------------------------
+// SearchProgressiveState::getAppIconFromAppId
+// ---------------------------------------------------------------------------
+//
+HbIcon SearchProgressiveState::getAppIconFromAppId(TUid auid)
+    {
+    HbIcon icon;
+    CAknIcon* aknIcon = NULL;
+    CFbsBitmap* bitmap = NULL;
+    CFbsBitmap* mask = NULL;
+    QPixmap pixmap;
+
+    MAknsSkinInstance* skin = AknsUtils::SkinInstance();
+    if (skin)
+        {
+        TRAPD( err,
+                    {
+                    AknsUtils::CreateAppIconLC( skin, auid,
+                            EAknsAppIconTypeList, bitmap, mask );
+                    CleanupStack::Pop(2); //for trap
+                    }
+        );
+        if (err == KErrNone)
+            {
+            aknIcon = CAknIcon::NewL();
+            aknIcon->SetBitmap(bitmap);
+            aknIcon->SetMask(mask);
+            }
+        }
+    if (aknIcon)
+        {
+        CleanupStack::PushL(aknIcon);
+
+        //need to disable compression to properly convert the bitmap
+        AknIconUtils::DisableCompression(aknIcon->Bitmap());
+
+        AknIconUtils::SetSize(aknIcon->Bitmap(), TSize(
+                defaultIconSize.width(), defaultIconSize.height()),
+                EAspectRatioPreservedAndUnusedSpaceRemoved);
+        if (aknIcon->Bitmap()->Header().iCompression == ENoBitmapCompression)
+            {
+            pixmap = fromSymbianCFbsBitmap(aknIcon->Bitmap());
+            QPixmap mask = fromSymbianCFbsBitmap(aknIcon->Mask());
+            pixmap.setAlphaChannel(mask);
+            }
+        else
+            {
+            CFbsBitmap *temp(NULL);
+            temp = copyBitmapLC(aknIcon->Bitmap());
+            pixmap = fromSymbianCFbsBitmap(temp);
+            CleanupStack::PopAndDestroy();
+
+            temp = copyBitmapLC(aknIcon->Mask());
+            QPixmap mask = fromSymbianCFbsBitmap(temp);
+            CleanupStack::PopAndDestroy();
+
+            pixmap.setAlphaChannel(mask);
+            }
+
+        pixmap = pixmap.scaled(defaultIconSize,
+                Qt::KeepAspectRatioByExpanding);
+        CleanupStack::PopAndDestroy(aknIcon);
+        icon = HbIcon(QIcon(pixmap));
+        }
+    return icon;
+    }
+// ---------------------------------------------------------------------------
+// SearchProgressiveState::TDisplayMode2Format
+// ---------------------------------------------------------------------------
+//
+QImage::Format SearchProgressiveState::TDisplayMode2Format(TDisplayMode mode)
+    {
+    QImage::Format format;
+    switch (mode)
+        {
+        case EGray2:
+            format = QImage::Format_MonoLSB;
+            break;
+        case EColor256:
+        case EGray256:
+            format = QImage::Format_Indexed8;
+            break;
+        case EColor4K:
+            format = QImage::Format_RGB444;
+            break;
+        case EColor64K:
+            format = QImage::Format_RGB16;
+            break;
+        case EColor16M:
+            format = QImage::Format_RGB888;
+            break;
+        case EColor16MU:
+            format = QImage::Format_RGB32;
+            break;
+        case EColor16MA:
+            format = QImage::Format_ARGB32;
+            break;
+        case EColor16MAP:
+            format = QImage::Format_ARGB32_Premultiplied;
+            break;
+        default:
+            format = QImage::Format_Invalid;
+            break;
+        }
+    return format;
+    }
+// ---------------------------------------------------------------------------
+// SearchProgressiveState::fromSymbianCFbsBitmap
+// ---------------------------------------------------------------------------
+//
+QPixmap SearchProgressiveState::fromSymbianCFbsBitmap(CFbsBitmap *aBitmap)
+    {
+    aBitmap->BeginDataAccess();
+    uchar *data = (uchar *) aBitmap->DataAddress();
+    TSize size = aBitmap->SizeInPixels();
+    TDisplayMode displayMode = aBitmap->DisplayMode();
+
+    // QImage format must match to bitmap format
+    QImage image(data, size.iWidth, size.iHeight, TDisplayMode2Format(
+            displayMode));
+    aBitmap->EndDataAccess();
+
+    // No data copying happens because image format matches native OpenVG format.
+    // So QPixmap actually points to CFbsBitmap data.
+    return QPixmap::fromImage(image);
+    }
+// ---------------------------------------------------------------------------
+// SearchProgressiveState::copyBitmapLC
+// ---------------------------------------------------------------------------
+//
+CFbsBitmap *SearchProgressiveState::copyBitmapLC(CFbsBitmap *input)
+    {
+    CFbsBitmap *bmp = new (ELeave) CFbsBitmap();
+    CleanupStack::PushL(bmp);
+    bmp->Create(input->SizeInPixels(), input->DisplayMode());
+    CFbsBitmapDevice *bitmapDevice = CFbsBitmapDevice::NewL(bmp);
+    CleanupStack::PushL(bitmapDevice);
+    CFbsBitGc *bmpGc;
+    bitmapDevice->CreateContext(bmpGc);
+    bmpGc->BitBlt(TPoint(0, 0), input);
+    delete bmpGc;
+    CleanupStack::PopAndDestroy(bitmapDevice);
+    return bmp;
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/searchui/stateproviders/searchstateprovider/src/searchsettingsstate.cpp	Mon Apr 19 14:40:05 2010 +0300
@@ -0,0 +1,128 @@
+/*
+ * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+ * All rights reserved.
+ * This component and the accompanying materials are made available
+ * under the terms of "Eclipse Public License v1.0"
+ * which accompanies this distribution, and is available
+ * at the URL "http://www.eclipse.org/legal/epl-v10.html".
+ *
+ * Initial Contributors:
+ * Nokia Corporation - initial contribution.
+ *
+ * Contributors:
+ *
+ * Description:  Implements the wizard activation and interactions.
+ *
+ */
+
+#include "searchsettingsstate.h"
+
+#include <hbdocumentloader.h>
+#include <hbview.h>
+#include <hblabel.h>
+#include <hbstackedwidget.h>
+#include <hbicon.h>
+#include <hbinstance.h>
+#include <hbaction.h>
+#include <hbgridview.h>
+#include <qstandarditemmodel.h>
+#include <qdebug.h>
+#include <qgraphicswidget.h>
+#include <qdir.h>
+#include"settingswidget.h"
+
+const char *WIZARD_VIEW = "tocView";
+
+// ---------------------------------------------------------------------------
+// SearchSettingsState::SearchSettingsState
+// ---------------------------------------------------------------------------
+//
+SearchSettingsState::SearchSettingsState(QState *parent) :
+    QState(parent), mDocumentLoader(NULL)
+    {
+    minitialCount = true;
+    mWidget = new SettingsWidget();
+
+    connect(mWidget, SIGNAL(settingsEvent(bool)), this, SLOT(handleBackEvent(bool)));
+
+    connect(mWidget, SIGNAL(selectedItemCategory(int, bool)), this,
+            SLOT(getItemCategory(int, bool)));
+
+    }
+// ---------------------------------------------------------------------------
+// SearchSettingsState::_selectedcategory
+// ---------------------------------------------------------------------------
+//
+void SearchSettingsState::getItemCategory(int str, bool avalue)
+    {
+    emit publishSelectedCategory(str, avalue);
+    }
+
+// ---------------------------------------------------------------------------
+// SearchSettingsState::~SearchSettingsState
+// ---------------------------------------------------------------------------
+//
+SearchSettingsState::~SearchSettingsState()
+    {
+    delete mDocumentLoader;
+    //  delete mWidget;
+
+    }
+
+// ---------------------------------------------------------------------------
+// SearchSettingsState::onEntry
+// ---------------------------------------------------------------------------
+//
+void SearchSettingsState::onEntry(QEvent *event)
+    {
+    qDebug() << "search:SearchSettingsState::onEntry";
+    QState::onEntry(event);
+    if (minitialCount)
+        {
+        mWidget->loadSettingsFrominiFile();
+        isInternetOn();
+        minitialCount = false;
+        emit backEventTriggered();
+        }
+    else
+        {
+
+        mWidget->launchSettingWidget();
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// SearchSettingsState::onExit
+// ---------------------------------------------------------------------------
+//
+void SearchSettingsState::onExit(QEvent *event)
+    {
+    QState::onExit(event);
+
+    }
+
+void SearchSettingsState::handleBackEvent(bool aStatus)
+    {
+    emit backEventTriggered();
+    if (mWidget)
+        {
+        isInternetOn();
+       emit clickstatus(aStatus);
+        }   
+    }
+// ---------------------------------------------------------------------------
+// SearchSettingsState::isInternetOn
+// ---------------------------------------------------------------------------
+//
+void SearchSettingsState::isInternetOn()
+    {
+    if (mWidget->isInternetSearchOptionSelected())
+        {
+        emit customizeGoButton(true);
+        }
+    else
+        {
+        emit customizeGoButton(false);
+        }
+    }
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/searchui/stateproviders/searchstateprovider/src/searchstateprovider.cpp	Mon Apr 19 14:40:05 2010 +0300
@@ -0,0 +1,102 @@
+/*
+ * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+ * All rights reserved.
+ * This component and the accompanying materials are made available
+ * under the terms of "Eclipse Public License v1.0"
+ * which accompanies this distribution, and is available
+ * at the URL "http://www.eclipse.org/legal/epl-v10.html".
+ *
+ * Initial Contributors:
+ * Nokia Corporation - initial contribution.
+ *
+ * Contributors:
+ *
+ * Description:  Implementation of the SEARCH state provider
+ *
+ */
+
+#include "searchstateprovider.h"
+#include "searchprogressivestate.h"
+
+#include "searchinitstate.h"
+#include "searchsettingsstate.h"
+
+#include <qstate.h>
+#include <qdebug.h>
+
+// constants
+const char providerFileName[] = "searchstateprovider.dll";
+const char initStateFileUri[] = "search.nokia.com/state/initstate";
+// states
+const char wizardProgressiveStateUri[] =
+        "search.nokia.com/state/wizardprogressivestate";
+const char wizardSettingStateUri[] =
+        "search.nokia.com/state/wizardsettingstate";
+
+// ---------------------------------------------------------------------------
+// searchStateProvider::searchStateProvider()
+// ---------------------------------------------------------------------------
+//
+SearchStateProvider::SearchStateProvider()
+    {
+    mInitStateToken.mLibrary = providerFileName;
+    mInitStateToken.mUri = initStateFileUri;
+
+    mWizardMenuStateToken.mLibrary = providerFileName;
+    mWizardMenuStateToken.mUri = wizardProgressiveStateUri;
+
+    mWizardActivatedStateToken.mLibrary = providerFileName;
+    mWizardActivatedStateToken.mUri = wizardSettingStateUri;
+    }
+
+// ---------------------------------------------------------------------------
+// SearchStateProvider::~SearchStateProvider()
+// ---------------------------------------------------------------------------
+//
+SearchStateProvider::~SearchStateProvider()
+    {
+    }
+
+// ---------------------------------------------------------------------------
+// SearchStateProvider::states()
+// ---------------------------------------------------------------------------
+//
+QList<HsStateToken> SearchStateProvider::states()
+    {
+    return QList<HsStateToken> () << mInitStateToken << mWizardMenuStateToken
+            << mWizardActivatedStateToken;
+    }
+
+// ---------------------------------------------------------------------------
+// SearchStateProvider::createState(const StateToken& aToken)
+// ---------------------------------------------------------------------------
+//
+QState* SearchStateProvider::createState(const HsStateToken& aToken)
+    {
+
+    if (aToken.mUri == mWizardMenuStateToken.mUri)
+        {
+        return new SearchProgressiveState();
+        }
+    else if (aToken.mUri == mWizardActivatedStateToken.mUri)
+        {
+        return new SearchSettingsState();
+        }
+    else if (aToken.mUri == mInitStateToken.mUri)
+        {
+        return new SearchInitState();
+        }
+
+    qDebug() << "SEARCH: No state found for mUri: " << aToken.mUri;
+    return NULL;
+
+    }
+
+#ifdef COVERAGE_MEASUREMENT
+#pragma CTC SKIP
+#endif //COVERAGE_MEASUREMENT
+Q_EXPORT_PLUGIN2(SearchStateProvider, SearchStateProvider)
+#ifdef COVERAGE_MEASUREMENT
+#pragma CTC ENDSKIP
+#endif //COVERAGE_MEASUREMENT
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/searchui/stateproviders/searchstateprovider/src/settingswidget.cpp	Mon Apr 19 14:40:05 2010 +0300
@@ -0,0 +1,451 @@
+/*
+ * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+ * All rights reserved.
+ * This component and the accompanying materials are made available
+ * under the terms of "Eclipse Public License v1.0"
+ * which accompanies this distribution, and is available
+ * at the URL "http://www.eclipse.org/legal/epl-v10.html".
+ *
+ * Initial Contributors:
+ * Nokia Corporation - initial contribution.
+ *
+ * Contributors:
+ *
+ * Description:  Implementation of the settings widget
+ *
+ */
+#include "settingswidget.h"
+#include <hbdialog.h>
+#include <hbcheckbox.h>
+#include <qgraphicslinearlayout.h>
+#include <hbaction.h>
+#include <hblabel.h>
+#include <qsignalmapper.h>
+#include <hbtooltip.h>
+#include <qsettings.h>
+#include <hbinputdialog.h>
+#include<hbscrollarea.h>
+#include <qgraphicswidget.h>
+#include <hbglobal.h>
+
+//----------------------------------------------------------------------------------------------------------------------------
+//SettingsWidget::SettingsWidget()
+//
+//----------------------------------------------------------------------------------------------------------------------------
+SettingsWidget::SettingsWidget() :
+    HbWidget()
+    {
+    deviceCategoryList = (QStringList() << hbTrId("txt_search_list_device")
+            << hbTrId("txt_search_list_contatcs") << hbTrId(
+            "txt_search_list_media") << hbTrId("txt_search_list_messagemail")
+            << hbTrId("txt_search_list_calendarnotes") << hbTrId(
+            "txt_search_list_applications") << hbTrId(
+            "txt_search_list_all_other_files"));
+    internetCategoryList = (QStringList() << hbTrId(
+            "txt_search_list_internet") << "Google" << "Bing");
+
+    QGraphicsLinearLayout *linearLayout = new QGraphicsLinearLayout(
+            Qt::Vertical);
+
+    setLayout(linearLayout);
+
+    popup = new HbDialog();
+    popup->setDismissPolicy(HbDialog::NoDismiss);
+
+    popup->setTimeout(HbDialog::NoTimeout);
+
+    HbAction * action = new HbAction(hbTrId("txt_common_button_ok"), popup);
+    connect(action, SIGNAL(triggered()), this, SLOT(checkBoxOkEvent()));
+    popup->setPrimaryAction(action);
+
+    action = new HbAction(hbTrId("txt_common_button_cancel"), popup);
+    connect(action, SIGNAL(triggered()), this, SLOT(checkBoxCancelEvent()));
+    popup->setSecondaryAction(action);
+
+    //device category creation
+
+    HbCheckBox *checkboxitem = NULL;
+
+    signalMapper = new QSignalMapper(this);
+
+    for (int i = 0; i < deviceCategoryList.count(); i++)
+        {
+        checkboxitem = new HbCheckBox(deviceCategoryList.at(i));
+
+        mDeviceCheckBoxList.append(checkboxitem);
+
+        signalMapper->setMapping(mDeviceCheckBoxList.at(i), i);
+
+        connect(mDeviceCheckBoxList.at(i), SIGNAL(stateChanged(int)),
+                signalMapper, SLOT(map()));
+
+        if (i == 0)
+            {
+            //arrange device search &internet search
+            linearLayout->addItem(mDeviceCheckBoxList.at(i));
+            }
+        else
+            {
+            //arrange other subcategoriess
+            mDeviceCheckBoxList.at(i)->setContentsMargins(20, 0, 0, 0);
+            linearLayout->addItem(mDeviceCheckBoxList.at(i));
+            }
+        }
+    int j = 0;
+    for (int i = deviceCategoryList.count(); i < internetCategoryList.count()
+            + deviceCategoryList.count(); i++)
+        {
+
+        checkboxitem = new HbCheckBox(internetCategoryList.at(j));
+
+        mInternetCheckBoxList.append(checkboxitem);
+
+        signalMapper->setMapping(mInternetCheckBoxList.at(j), i);
+
+        connect(mInternetCheckBoxList.at(j), SIGNAL(stateChanged(int)),
+                signalMapper, SLOT(map()));
+
+        if (i == deviceCategoryList.count())
+            {
+            //arrange device search &internet search
+            linearLayout->addItem(mInternetCheckBoxList.at(j));
+            }
+        else
+            {
+            //arrange other subcategoriess
+            mInternetCheckBoxList.at(j)->setContentsMargins(20, 0, 0, 0);
+            linearLayout->addItem(mInternetCheckBoxList.at(j));
+
+            }
+        j++;
+        }
+
+    connect(signalMapper, SIGNAL(mapped(int)), this, SLOT(itemChecked(int)));
+
+    //Heading label
+
+    HbLabel *label = new HbLabel(hbTrId(
+            "txt_search_qtl_dialog_pri_heading_delimiter"));
+    popup->setHeadingWidget(label);
+
+    HbScrollArea* scrollArea = new HbScrollArea(popup);
+    scrollArea->setScrollDirections(Qt::Vertical);
+    scrollArea->setFlag(QGraphicsItem::ItemClipsChildrenToShape, true);
+    scrollArea->setContentWidget(this);
+    popup->setContentWidget(scrollArea);
+
+    // loadSettingsFrominiFile();
+    }
+//----------------------------------------------------------------------------------------------------------------------------
+//SettingsWidget::~SettingsWidget()
+//
+//----------------------------------------------------------------------------------------------------------------------------
+SettingsWidget::~SettingsWidget()
+    {
+    delete signalMapper;
+    //delete popup;
+    }
+//----------------------------------------------------------------------------------------------------------------------------
+//SettingsWidget::launchSettingWidget()
+//
+//----------------------------------------------------------------------------------------------------------------------------
+void SettingsWidget::launchSettingWidget()
+    {
+    loadSettingsFrominiFile();
+    setActionVisibility();
+    popup->show();
+    }
+//----------------------------------------------------------------------------------------------------------------------------
+//SettingsWidget::setActionVisibility()
+//
+//----------------------------------------------------------------------------------------------------------------------------
+void SettingsWidget::setActionVisibility()
+    {
+    bool noItemSelected = true;
+    for (int i = 0; i < mDeviceCheckBoxList.count(); i++)
+        {
+        if (mDeviceCheckBoxList.at(i)->checkState() == Qt::Checked)
+            {
+            noItemSelected = false;
+            }
+        }
+    for (int i = 0; i < mInternetCheckBoxList.count(); i++)
+        {
+        if (mInternetCheckBoxList.at(i)->checkState() == Qt::Checked)
+            {
+            noItemSelected = false;
+            }
+        }
+    if (!noItemSelected)
+        {
+        popup->primaryAction()->setVisible(true);
+        }
+    else
+        {
+        popup->primaryAction()->setVisible(false);
+        }
+    }
+//----------------------------------------------------------------------------------------------------------------------------
+//SettingsWidget::itemChecked( int selectedIndex)
+//
+//----------------------------------------------------------------------------------------------------------------------------
+void SettingsWidget::itemChecked(int selectedIndex)
+    {
+    int totalcount = deviceCategoryList.count()
+            + internetCategoryList.count();
+
+    if (selectedIndex == 0) // validating the parent category "devices"
+        {
+        if ((mDeviceCheckBoxList.at(selectedIndex)->checkState()
+                == Qt::Checked))
+            {
+            isInternetSelected = false;
+            checkSubCategories(0);
+            unCheckSubCategories(0);
+            }
+        else
+            {
+            unCheckSubCategories(1);
+            }
+        setActionVisibility();
+        return;
+        }
+    else if (selectedIndex == deviceCategoryList.count())// validating the parent category "internet"
+        {
+        if (mInternetCheckBoxList.at(selectedIndex
+                - deviceCategoryList.count())->checkState() == Qt::Checked)
+            {
+            isInternetSelected = true;
+            checkSubCategories(1);
+            unCheckSubCategories(1);
+            }
+        else
+            {
+            unCheckSubCategories(0);
+            }
+        setActionVisibility();
+        return;
+        }
+    if (selectedIndex < deviceCategoryList.count())// validating the sub categories under  "devices"
+        {
+        if (mDeviceCheckBoxList.at(selectedIndex)->checkState()
+                == Qt::Checked)
+            {
+            isInternetSelected = false;
+            unCheckSubCategories(0);
+
+            }
+        }
+    else // validating the sub categories under  "internet"
+        {
+        int curentindex = (selectedIndex + internetCategoryList.count())
+                - (deviceCategoryList.count() + internetCategoryList.count());
+
+        if (mInternetCheckBoxList.at(curentindex)->checkState()
+                == Qt::Checked)
+            {
+            isInternetSelected = true;
+            unCheckSubCategories(1);
+            //return;
+            }
+        }
+    setActionVisibility();
+    }
+//----------------------------------------------------------------------------------------------------------------------------
+//SettingsWidget::check(int checkSubCategory)
+//
+//----------------------------------------------------------------------------------------------------------------------------
+void SettingsWidget::checkSubCategories(int checkSubCategory)
+    {
+    if (checkSubCategory == 0)
+        {
+        for (int i = 0; i < mDeviceCheckBoxList.count(); i++)
+            {
+            mDeviceCheckBoxList.at(i)->setCheckState(Qt::Checked);
+            }
+        }
+    else
+        {
+        for (int i = 0; i < mInternetCheckBoxList.count(); i++)
+            {
+            mInternetCheckBoxList.at(i)->setCheckState(Qt::Checked);
+            }
+        }
+    }
+//----------------------------------------------------------------------------------------------------------------------------
+//SettingsWidget::unCheckSubCategories(int unCheckSubCategory)
+//
+//----------------------------------------------------------------------------------------------------------------------------
+void SettingsWidget::unCheckSubCategories(int unCheckSubCategory)
+    {
+    if (unCheckSubCategory == 0)
+        {
+        for (int i = 0; i < mInternetCheckBoxList.count(); i++)
+            {
+            mInternetCheckBoxList.at(i)->setCheckState(Qt::Unchecked);
+            }
+        }
+    else
+        {
+        for (int i = 0; i < mDeviceCheckBoxList.count(); i++)
+            {
+            mDeviceCheckBoxList.at(i)->setCheckState(Qt::Unchecked);
+            }
+        }
+    }
+//----------------------------------------------------------------------------------------------------------------------------
+//SettingsWidget::checkBoxCancelEvent()
+//
+//----------------------------------------------------------------------------------------------------------------------------
+void SettingsWidget::checkBoxCancelEvent()
+    {
+    loadSettingsFrominiFile();//bug fix for cancel event selection should not reflect "go" button
+    emit settingsEvent(false);
+    }
+//----------------------------------------------------------------------------------------------------------------------------
+//void SettingsWidget::checkBoxOkEvent()
+//
+//----------------------------------------------------------------------------------------------------------------------------
+
+void SettingsWidget::checkBoxOkEvent()
+    {
+    storeSettingsToiniFile();
+    emit settingsEvent(true);
+    }
+//----------------------------------------------------------------------------------------------------------------------------
+//void SettingsWidget::storeSettingsToiniFile()
+//
+//----------------------------------------------------------------------------------------------------------------------------
+
+void SettingsWidget::storeSettingsToiniFile()
+    {
+    QSettings appSettings("Search.ini", QSettings::IniFormat);
+
+    appSettings.setValue("DeviceCount", mDeviceCheckBoxList.count());
+    for (int i = 0; i < mDeviceCheckBoxList.count(); i++)
+        {
+        if (mDeviceCheckBoxList.at(i)->checkState() == Qt::Checked)
+            {
+            appSettings.setValue(mDeviceCheckBoxList.at(i)->text(), 1);
+            emit selectedItemCategory(i, true);
+            }
+        else
+            {
+            appSettings.setValue(mDeviceCheckBoxList.at(i)->text(), 0);
+            emit selectedItemCategory(i, false);
+            }
+        }
+    // int totalcount = i;
+    appSettings.setValue("InternetCount", mInternetCheckBoxList.count());
+    for (int i = 0; i < mInternetCheckBoxList.count(); i++)
+        {
+        if (mInternetCheckBoxList.at(i)->checkState() == Qt::Checked)
+            {
+            appSettings.setValue(mInternetCheckBoxList.at(i)->text(), 1);
+            //  emit selectedcategory(totalcount,true);
+            }
+        else
+            {
+            appSettings.setValue(mInternetCheckBoxList.at(i)->text(), 0);
+            //emit selectedcategory(totalcount,false);
+            }
+        //    totalcount++;
+        }
+    }
+
+//----------------------------------------------------------------------------------------------------------------------------
+//void SettingsWidget::loadSettingsFrominiFile()
+//
+//----------------------------------------------------------------------------------------------------------------------------
+
+void SettingsWidget::loadSettingsFrominiFile()
+    {
+    enableDefaultSettings();
+    isInternetSelected = false;
+    QSettings appSettings("Search.ini", QSettings::IniFormat);
+    int ret = 0;
+    for (int i = 0; i < mDeviceCheckBoxList.count(); i++)
+        {
+        ret = appSettings.value(mDeviceCheckBoxList.at(i)->text()).toInt();
+        if (ret)
+            {
+            mDeviceCheckBoxList.at(i)->setCheckState(Qt::Checked);
+            emit selectedItemCategory(i, true);
+            }
+        else
+            {
+            mDeviceCheckBoxList.at(i)->setCheckState(Qt::Unchecked);
+            emit selectedItemCategory(i, false);
+            }
+        }
+    for (int i = 0; i < mInternetCheckBoxList.count(); i++)
+        {
+
+        ret = appSettings.value(mInternetCheckBoxList.at(i)->text()).toInt();
+        if (ret)
+            {
+            isInternetSelected = true;
+            mInternetCheckBoxList.at(i)->setCheckState(Qt::Checked);
+            // emit selectedcategory(mInternetCheckBoxList.at(i)->text(),true);
+            }
+        else
+            {
+            mInternetCheckBoxList.at(i)->setCheckState(Qt::Unchecked);
+            // emit selectedcategory(mInternetCheckBoxList.at(i)->text(),false);
+            }
+        }
+
+    }
+//----------------------------------------------------------------------------------------------------------------------------
+//SettingsWidget::isInternetSearchOptionSelected()
+//
+//----------------------------------------------------------------------------------------------------------------------------
+bool SettingsWidget::isInternetSearchOptionSelected()
+    {
+    return isInternetSelected;
+    }
+//----------------------------------------------------------------------------------------------------------------------------
+//void SettingsWidget::changeDeviceInternetCheck()
+//
+//----------------------------------------------------------------------------------------------------------------------------
+void SettingsWidget::changeDeviceInternetCheck()
+    {
+    if (isInternetSearchOptionSelected() == true)
+        {
+        mDeviceCheckBoxList.at(0)->setCheckState(Qt::Checked);
+
+        }
+    else
+
+        {
+
+        mInternetCheckBoxList.at(0)->setCheckState(Qt::Checked);
+
+        }
+
+    emit settingsChanged();
+    }
+//----------------------------------------------------------------------------------------------------------------------------
+//void SettingsWidget::enableDefaultSettings()
+//
+//----------------------------------------------------------------------------------------------------------------------------
+void SettingsWidget::enableDefaultSettings()
+    {
+    QSettings appSettings("Search.ini", QSettings::IniFormat);
+    if (!appSettings.contains("DeviceCount")) // change the settings for the first time only
+        {
+        appSettings.setValue("DeviceCount", mDeviceCheckBoxList.count());
+        for (int i = 0; i < mDeviceCheckBoxList.count(); i++)
+            {
+            //   mDeviceCheckBoxList.at(i)->setCheckState(Qt::Checked);
+            appSettings.setValue(mDeviceCheckBoxList.at(i)->text(), 1);
+            }
+        for (int i = 0; i < mInternetCheckBoxList.count(); i++)
+            {
+            //mInternetCheckBoxList.at(i)->setCheckState(Qt::Unchecked);
+            appSettings.setValue(mInternetCheckBoxList.at(i)->text(), 0);
+            }
+        //  storeSettingsToiniFile();
+        }
+
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/searchui/stateproviders/searchstateprovider/tsrc/t_searchstateprovider/inc/t_searchstateprovider.h	Mon Apr 19 14:40:05 2010 +0300
@@ -0,0 +1,144 @@
+/*
+ * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+ * All rights reserved.
+ * This component and the accompanying materials are made available
+ * under the terms of "Eclipse Public License v1.0"
+ * which accompanies this distribution, and is available
+ * at the URL "http://www.eclipse.org/legal/epl-v10.html".
+ *
+ * Initial Contributors:
+ * Nokia Corporation - initial contribution.
+ *
+ * Contributors:
+ *
+ * Description:  Tests for SearchStateProvider class.
+ *
+ */
+
+#include <QtTest/QtTest>
+#include "searchstateprovider.h"
+#include "hsistateprovider.h"
+
+class HbMainWindow;
+class HbAbstractViewItem;
+
+/**
+ * @test Test class for stateproviders modules.
+ */
+class SearchStateProviderTest : public QObject
+    {
+Q_OBJECT
+
+public:
+    SearchStateProviderTest();
+    ~SearchStateProviderTest();
+
+private slots:
+    void init();
+    void initTestCase();
+    void cleanupTestCase();
+    /**
+     * t_searchstateprovider.cpp
+     */
+    void testCreateAndDestructSearchStateProvider();
+    void testStates();
+    void testCreateProgressiveState();
+    void testCreateSettingsState();
+    void testCreateinitState();
+    void testCreateInvalidState();
+
+    /**
+     * t_searchprogressivestate.cpp
+     */
+
+    void testProgressiveStateConstruction();
+    void testProgressiveStateOnEntryAndExitSignalled();
+    void testonSearchComplete();
+    void testonAsyncSearchComplete();
+    void testonGetDocumentComplete();
+    void testgetSettingCategory();
+    void testopenResultitem();
+    void testcreateSuggestionLink();
+    void testnoResultsFound();
+    void testclear();
+    void testsearchOnCategory();
+    void teststartNewSearch();
+    void testsetHistory();
+    void testsetSettings();
+    void testaboutToCloseView();
+    void test_CustomizeGoButton();
+
+    /**
+     * t_searchsettingsstate.cpp
+     */
+    void testsettingsStateConstruction();
+    void testsettingsStateOnEntryAndExitSignalled();
+    void testhandleBackEvent();
+    void testgetItemCategory();
+    void testisInternetOn();
+    /**
+     * t_searchinitstate.cpp
+     */
+    void testinitStateConstruction();
+    void testinitStateOnEntryAndExitSignalled();
+
+    /**
+     * t_settingswidget.cpp
+     */
+
+    void testsettingswizardConstruction();
+    void testenableDefaultSettings();
+    void teststoreSettingsToiniFile();
+    void testloadSettingsFrominiFile();
+
+    void testlaunchSettingWidget();
+    void testisInternetSearchOptionSelected();
+    void testunCheckSubCategories();
+    void testcheckSubCategories();
+    void testsetActionVisibility();
+
+    void testcheckBoxOkEvent();
+    void testcheckBoxCancelEvent();
+    void testitemChecked();
+    void testchangeDeviceInternetCheck();
+
+    /* void testOnWizardAddedSignalledNoWizardInCS();
+     void testProgressUpdated();
+     void testWizardSelected();    
+     */
+private:
+
+    /**
+     * Helper method testing construction of state
+     *
+     * @param library Name of the library/plugin that contains the state.
+     * @param uri Unique state identificator.
+     *
+     * @return True if state was created successfully, false otherwise.
+     * @since S60 ?S60_version.
+     */
+    bool verifyStateCreation(const QString& library, const QString& uri);
+
+    /**
+     * Helper method testing existence of state
+     *
+     * @param states List of states.
+     * @param library Name of the library/plugin that contains the state.
+     * @param uri Unique state identificator.
+     *
+     * @return True if state was found, false otherwise.
+     * @since S60 ?S60_version.
+     */
+    bool findStateInStateList(const QList<HsStateToken>& states,
+            const QString& library, const QString& uri);
+
+    //void setContentServiceProperty(QState* state);
+
+    HbMainWindow* mainWindow();
+
+private:
+    //    FtuContentService* mFtuContentService;
+    HbMainWindow *mMainWindow;
+
+    };
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/searchui/stateproviders/searchstateprovider/tsrc/t_searchstateprovider/src/t_searchinitstate.cpp	Mon Apr 19 14:40:05 2010 +0300
@@ -0,0 +1,46 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: 
+*
+*/
+#include "t_searchstateprovider.h"
+#include "searchinitstate.h"
+// ---------------------------------------------------------------------------
+// ---------------------------------------------------------------------------
+//
+void SearchStateProviderTest::testinitStateConstruction()
+    {
+    // HbMainWindow* wind = mainWindow();
+    SearchInitState* initState = new SearchInitState();
+
+    QVERIFY(initState != NULL);
+
+    delete initState;
+    }
+// ---------------------------------------------------------------------------
+// ---------------------------------------------------------------------------
+//
+void SearchStateProviderTest::testinitStateOnEntryAndExitSignalled()
+    {
+    // HbMainWindow* wind = mainWindow();
+
+    SearchInitState* initState = new SearchInitState();
+
+    QEvent *event = new QEvent(QEvent::None);
+    initState->onEntry(event);
+
+    initState->onExit(event);
+
+    delete initState;
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/searchui/stateproviders/searchstateprovider/tsrc/t_searchstateprovider/src/t_searchprogressivestate.cpp	Mon Apr 19 14:40:05 2010 +0300
@@ -0,0 +1,294 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: 
+*
+*/
+#include "t_searchstateprovider.h"
+#include "searchprogressivestate.h"
+#include <qsignalspy.h>
+#include "indevicehandler.h"
+#include <qstandarditemmodel.h>
+// ---------------------------------------------------------------------------
+// ---------------------------------------------------------------------------
+//
+
+void SearchStateProviderTest::testProgressiveStateConstruction()
+    {
+  // HbMainWindow* wind = mainWindow();
+
+    SearchProgressiveState* progressiveState = new SearchProgressiveState();
+
+    QVERIFY(progressiveState != NULL);
+    QVERIFY(progressiveState->mView);
+    QVERIFY(progressiveState->mListView);
+    QVERIFY(progressiveState->mDocumentLoader);
+    QVERIFY(progressiveState->mSearchPanel);
+    QVERIFY(progressiveState->mModel);
+    QVERIFY(progressiveState->mSearchHandler);
+
+    delete progressiveState;
+
+    
+  //  delete wind;
+    }
+// ---------------------------------------------------------------------------
+// ---------------------------------------------------------------------------
+//
+
+void SearchStateProviderTest::testProgressiveStateOnEntryAndExitSignalled()
+    {
+//    HbMainWindow* wind = mainWindow();
+
+    SearchProgressiveState* progressiveState = new SearchProgressiveState();
+
+    QEvent *event = new QEvent(QEvent::None);
+    progressiveState->onEntry(event);
+
+    progressiveState->onExit(event);
+
+    delete progressiveState;
+    
+  //  delete wind;
+    }
+// ---------------------------------------------------------------------------
+// ---------------------------------------------------------------------------
+//
+
+void SearchStateProviderTest::testonSearchComplete()
+    {
+//    HbMainWindow* wind = mainWindow();
+    SearchProgressiveState* progressiveState = new SearchProgressiveState();
+    QEvent *event = new QEvent(QEvent::None);
+    progressiveState->onEntry(event);
+    progressiveState->onSearchComplete(-1, 0);
+    QCOMPARE(progressiveState->mResultcount,0);
+    progressiveState->onSearchComplete(0, -1);
+    QCOMPARE(progressiveState->mResultcount,0);
+    progressiveState->onSearchComplete(0, 10);
+    QCOMPARE(progressiveState->mResultcount,10);
+    delete progressiveState;
+  //  delete wind;
+    }
+// ---------------------------------------------------------------------------
+// ---------------------------------------------------------------------------
+//
+
+void SearchStateProviderTest::testonAsyncSearchComplete()
+    {
+  //  HbMainWindow* wind = mainWindow();
+    SearchProgressiveState* progressiveState = new SearchProgressiveState();
+    QEvent *event = new QEvent(QEvent::None);
+    progressiveState->onEntry(event);
+
+    progressiveState->onAsyncSearchComplete(-1, 10);
+    QCOMPARE(progressiveState->mResultcount,0);
+
+    progressiveState->onAsyncSearchComplete(0, -1);
+    QCOMPARE(progressiveState->mResultcount,0);
+
+    progressiveState->onAsyncSearchComplete(0, 10);
+    QCOMPARE(progressiveState->mResultcount,10);
+
+    delete progressiveState;
+  //  delete wind;
+    }
+// ---------------------------------------------------------------------------
+// ---------------------------------------------------------------------------
+//
+void SearchStateProviderTest::testonGetDocumentComplete()
+    {
+//    HbMainWindow* wind = mainWindow();
+    SearchProgressiveState* progressiveState = new SearchProgressiveState();
+    QEvent *event = new QEvent(QEvent::None);
+    progressiveState->onEntry(event);
+
+    progressiveState->onGetDocumentComplete(0, NULL);
+    QCOMPARE(progressiveState->mModel->rowCount(),0);
+
+    progressiveState->onGetDocumentComplete(-1, NULL);
+    QCOMPARE(progressiveState->mModel->rowCount(),0);
+
+    delete progressiveState;
+  //  delete wind;
+    }
+// ---------------------------------------------------------------------------
+// ---------------------------------------------------------------------------
+//
+void SearchStateProviderTest::testgetSettingCategory()
+    {
+//    HbMainWindow* wind = mainWindow();
+    SearchProgressiveState* progressiveState = new SearchProgressiveState();
+    QEvent *event = new QEvent(QEvent::None);
+    progressiveState->onEntry(event);
+    progressiveState->getSettingCategory(3, true);
+    QCOMPARE(progressiveState->mSelectedCategory.count(),1);
+    delete progressiveState;
+ //   delete wind;
+    }
+// ---------------------------------------------------------------------------
+// ---------------------------------------------------------------------------
+//
+void SearchStateProviderTest::testopenResultitem()
+    {
+//    HbMainWindow* wind = mainWindow();
+     SearchProgressiveState* progressiveState = new SearchProgressiveState();
+    QEvent *event = new QEvent(QEvent::None);
+    progressiveState->onEntry(event);
+    progressiveState->mSelectedCategory.insert(1, true);
+    progressiveState->startNewSearch("a");
+    QTest::qWait(200);
+    //code for getting the model index from model
+    QModelIndex index = progressiveState->mModel->index(1, 0, QModelIndex());
+    progressiveState->openResultitem(index);
+    delete progressiveState;
+ /*//   delete wind;
+
+       {
+        SearchProgressiveState* progressiveState =
+                new SearchProgressiveState();
+        QEvent *event = new QEvent(QEvent::None);
+        progressiveState->onEntry(event);
+        progressiveState->mSelectedCategory.insert(3, true);
+        progressiveState->startNewSearch("a");
+        QTest::qWait(200);
+        //code for getting the model index from model
+        QModelIndex index = progressiveState->mModel->index(1, 0,
+                QModelIndex());
+        progressiveState->openResultitem(index);
+
+        //to do
+        delete progressiveState;
+        }
+*/    }
+// ---------------------------------------------------------------------------
+// ---------------------------------------------------------------------------
+//
+void SearchStateProviderTest::testcreateSuggestionLink()
+    {
+    SearchProgressiveState* progressiveState = new SearchProgressiveState();
+    QEvent *event = new QEvent(QEvent::None);
+    progressiveState->onEntry(event);
+
+    progressiveState->createSuggestionLink(true);
+    //    QModelIndex index = progressiveState->mModel->index(0, 0, QModelIndex());
+    //  progressiveState->openResultitem(index);
+
+    //progressiveState->createSuggestionLink(false);
+    //QCOMPARE(progressiveState->mModel->rowCount(),0);
+
+    delete progressiveState;
+    }
+// ---------------------------------------------------------------------------
+// ---------------------------------------------------------------------------
+//
+void SearchStateProviderTest::testnoResultsFound()
+    {
+    SearchProgressiveState* progressiveState = new SearchProgressiveState();
+    QEvent *event = new QEvent(QEvent::None);
+    progressiveState->onEntry(event);
+
+    progressiveState->noResultsFound(NULL);
+    QCOMPARE(progressiveState->mModel->rowCount(),0);
+
+    progressiveState->noResultsFound("aaa");
+    QCOMPARE(progressiveState->mModel->rowCount(),1);
+
+    delete progressiveState;
+    }
+// ---------------------------------------------------------------------------
+// ---------------------------------------------------------------------------
+//
+void SearchStateProviderTest::testclear()
+    {
+    SearchProgressiveState* progressiveState = new SearchProgressiveState();
+    QEvent *event = new QEvent(QEvent::None);
+    progressiveState->onEntry(event);
+
+    progressiveState->noResultsFound("aaa");
+    QCOMPARE(progressiveState->mModel->rowCount(),1);
+    progressiveState->clear();
+    QCOMPARE(progressiveState->mModel->rowCount(),0);
+
+    delete progressiveState;
+    }
+// ---------------------------------------------------------------------------
+// ---------------------------------------------------------------------------
+//
+void SearchStateProviderTest::testsearchOnCategory()
+    {
+
+    }
+// ---------------------------------------------------------------------------
+// ---------------------------------------------------------------------------
+//
+void SearchStateProviderTest::teststartNewSearch()
+    {
+    SearchProgressiveState* progressiveState = new SearchProgressiveState();
+    QEvent *event = new QEvent(QEvent::None);
+    progressiveState->onEntry(event);
+    progressiveState->mSelectedCategory.insert(6, true);
+    progressiveState->startNewSearch("sample");
+    delete progressiveState;
+    }
+// ---------------------------------------------------------------------------
+// ---------------------------------------------------------------------------
+//
+void SearchStateProviderTest::testsetHistory()
+    {
+    SearchProgressiveState* progressiveState = new SearchProgressiveState();
+    QEvent *event = new QEvent(QEvent::None);
+    progressiveState->onEntry(event);
+    QSignalSpy spy(progressiveState, SIGNAL(historyState()));
+  //  progressiveState->setHistory();
+    QCOMPARE(spy.count(), 1);
+    delete progressiveState;
+    }
+// ---------------------------------------------------------------------------
+// ---------------------------------------------------------------------------
+//
+void SearchStateProviderTest::testsetSettings()
+    {
+    SearchProgressiveState* progressiveState = new SearchProgressiveState();
+    QEvent *event = new QEvent(QEvent::None);
+    progressiveState->onEntry(event);
+    QSignalSpy spy(progressiveState, SIGNAL(settingsState()));
+    progressiveState->setSettings();
+    QCOMPARE(spy.count(), 1);
+    delete progressiveState;
+    }
+// ---------------------------------------------------------------------------
+// ---------------------------------------------------------------------------
+//
+void SearchStateProviderTest::testaboutToCloseView()
+    {
+    SearchProgressiveState* progressiveState = new SearchProgressiveState();
+    QEvent *event = new QEvent(QEvent::None);
+    progressiveState->onEntry(event);
+    //progressiveState->aboutToCloseView();
+    delete progressiveState;
+    }
+
+void SearchStateProviderTest::test_CustomizeGoButton()
+    {
+
+    SearchProgressiveState* progressiveState = new SearchProgressiveState();
+    progressiveState->_customizeGoButton(true);
+    progressiveState->_customizeGoButton(false);
+    //QEvent *event = new QEvent(QEvent::None);
+    // progressiveState->onEntry(event);
+    // progressiveState->aboutToCloseView();
+    delete progressiveState;
+
+    }
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/searchui/stateproviders/searchstateprovider/tsrc/t_searchstateprovider/src/t_searchsettingsstate.cpp	Mon Apr 19 14:40:05 2010 +0300
@@ -0,0 +1,99 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: 
+*
+*/
+#include "t_searchstateprovider.h"
+#include "searchsettingsstate.h"
+
+// ---------------------------------------------------------------------------
+//SearchStateProviderTest::testsettingsStateConstruction()
+// ---------------------------------------------------------------------------
+//
+void SearchStateProviderTest::testsettingsStateConstruction()
+    {
+    // HbMainWindow* wind = mainWindow();
+    SearchSettingsState* settingsState = new SearchSettingsState();
+
+    QVERIFY(settingsState != NULL);
+    QVERIFY(settingsState->mWidget);
+
+    delete settingsState;
+
+    }
+// ---------------------------------------------------------------------------
+//SearchStateProviderTest::testsettingsStateOnEntryAndExitSignalled()
+// ---------------------------------------------------------------------------
+//
+void SearchStateProviderTest::testsettingsStateOnEntryAndExitSignalled()
+    {
+    // HbMainWindow* wind = mainWindow();
+
+    SearchSettingsState* settingsState = new SearchSettingsState();
+
+    QEvent *event = new QEvent(QEvent::None);
+    settingsState->onEntry(event);
+
+    settingsState->onExit(event);
+
+    delete settingsState;
+    }
+
+// ---------------------------------------------------------------------------
+//SearchStateProviderTest::testhandleBackEvent()
+// ---------------------------------------------------------------------------
+//
+void SearchStateProviderTest::testhandleBackEvent()
+    {
+    SearchSettingsState* settingsState = new SearchSettingsState();
+
+    QSignalSpy spy(settingsState, SIGNAL(backEventTriggered()));
+    settingsState->handleBackEvent(true);
+    QCOMPARE(spy.count(), 1);
+
+    delete settingsState;
+    }
+// ---------------------------------------------------------------------------
+//SearchStateProviderTest::test_selectedcategory()
+// ---------------------------------------------------------------------------
+//
+void SearchStateProviderTest::testgetItemCategory()
+    {
+    SearchSettingsState* settingsState = new SearchSettingsState();
+
+    QSignalSpy spy(settingsState,
+            SIGNAL(publishSelectedCategory(int, bool)));
+    settingsState->getItemCategory(1, true);
+    settingsState->getItemCategory(1, false);
+    settingsState->getItemCategory(6, true);
+    settingsState->getItemCategory(6, true);
+    QCOMPARE(spy.count(), 4);
+    delete settingsState;
+    }
+
+// ---------------------------------------------------------------------------
+//SearchStateProviderTest::testisInternetOn()
+// ---------------------------------------------------------------------------
+//
+void SearchStateProviderTest::testisInternetOn()
+    {
+    SearchSettingsState* settingsState = new SearchSettingsState();
+    QSignalSpy spy(settingsState,
+                SIGNAL(customizeGoButton(bool)));
+    
+    settingsState->isInternetOn();    
+    
+    QCOMPARE(spy.count(), 1);
+    delete settingsState;
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/searchui/stateproviders/searchstateprovider/tsrc/t_searchstateprovider/src/t_searchstateprovider.cpp	Mon Apr 19 14:40:05 2010 +0300
@@ -0,0 +1,209 @@
+/*
+ * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+ * All rights reserved.
+ * This component and the accompanying materials are made available
+ * under the terms of "Eclipse Public License v1.0"
+ * which accompanies this distribution, and is available
+ * at the URL "http://www.eclipse.org/legal/epl-v10.html".
+ *
+ * Initial Contributors:
+ * Nokia Corporation - initial contribution.
+ *
+ * Contributors:
+ *
+ * Description:  Main test class for searchstateprovider library.
+ *
+ */
+
+#include "t_searchstateprovider.h"
+#include "searchruntimeprovider.h"
+#include "searchstateprovider.h"
+
+#include <hsstatefactory.h>
+
+#include <qmetatype.h>
+#include <qstate.h>
+
+#include <hbinstance.h>
+#include <hbmainwindow.h>
+#include <hbview.h>
+#include <hbgraphicsscene.h>
+
+// ---------------------------------------------------------------------------
+// ---------------------------------------------------------------------------
+//
+
+SearchStateProviderTest::SearchStateProviderTest()
+    {
+
+    }
+
+// ---------------------------------------------------------------------------
+// ---------------------------------------------------------------------------
+//
+SearchStateProviderTest::~SearchStateProviderTest()
+    {
+    
+    }
+
+// ---------------------------------------------------------------------------
+// ---------------------------------------------------------------------------
+//
+void SearchStateProviderTest::init()
+    {
+    
+   // delete mMainWindow;
+    }
+
+// ---------------------------------------------------------------------------
+// ---------------------------------------------------------------------------
+//
+void SearchStateProviderTest::initTestCase()
+    {
+    mMainWindow = mainWindow();
+    }
+
+// ---------------------------------------------------------------------------
+// ---------------------------------------------------------------------------
+//
+void SearchStateProviderTest::cleanupTestCase()
+    {
+    
+    }
+
+// ---------------------------------------------------------------------------
+// ---------------------------------------------------------------------------
+//
+void SearchStateProviderTest::testCreateAndDestructSearchStateProvider()
+    {
+    SearchStateProvider provider;
+
+    QVERIFY(provider.mWizardMenuStateToken.mLibrary == "searchstateprovider.dll");
+    QVERIFY(provider.mWizardMenuStateToken.mUri == "search.nokia.com/state/wizardprogressivestate");
+
+    QVERIFY(provider.mWizardActivatedStateToken.mLibrary == "searchstateprovider.dll");
+    QVERIFY(provider.mWizardActivatedStateToken.mUri == "search.nokia.com/state/wizardsettingstate");
+
+    QVERIFY(provider.mInitStateToken.mLibrary == "searchstateprovider.dll");
+    QVERIFY(provider.mInitStateToken.mUri == "search.nokia.com/state/initstate");
+    }
+
+// ---------------------------------------------------------------------------
+// ---------------------------------------------------------------------------
+//
+void SearchStateProviderTest::testStates()
+    {
+    SearchStateProvider provider;
+    QList<HsStateToken> states = provider.states();
+
+    QCOMPARE(states.count(), 3);
+
+    QVERIFY(findStateInStateList(states, "searchstateprovider.dll","search.nokia.com/state/wizardprogressivestate"));
+    QVERIFY(findStateInStateList(states, "searchstateprovider.dll","search.nokia.com/state/wizardsettingstate"));
+    QVERIFY(findStateInStateList(states, "searchstateprovider.dll","search.nokia.com/state/initstate"));
+    }
+
+// ---------------------------------------------------------------------------
+// ---------------------------------------------------------------------------
+//
+void SearchStateProviderTest::testCreateProgressiveState()
+    {
+    
+    QVERIFY(verifyStateCreation("searchstateprovider.dll", "search.nokia.com/state/wizardprogressivestate"));
+   // delete wind;
+    }
+// ---------------------------------------------------------------------------
+// ---------------------------------------------------------------------------
+//
+void SearchStateProviderTest::testCreateSettingsState()
+    {
+    //HbMainWindow* wind = mainWindow();   
+    QVERIFY(verifyStateCreation("searchstateprovider.dll", "search.nokia.com/state/wizardsettingstate"));
+   // delete wind;
+    }
+// ---------------------------------------------------------------------------
+// ---------------------------------------------------------------------------
+//
+void SearchStateProviderTest::testCreateinitState()
+    {
+    //HbMainWindow* wind = mainWindow();   
+    QVERIFY(verifyStateCreation("searchstateprovider.dll", "search.nokia.com/state/initstate"));
+  //  delete wind;
+    }
+
+// ---------------------------------------------------------------------------
+// ---------------------------------------------------------------------------
+//
+void SearchStateProviderTest::testCreateInvalidState()
+    {
+    QVERIFY(!verifyStateCreation("searchstateprovider.dll", "invalid uri"));
+    }
+
+// ---------------------------------------------------------------------------
+// ---------------------------------------------------------------------------
+//
+bool SearchStateProviderTest::verifyStateCreation(const QString& library,
+        const QString& uri)
+    {
+
+    SearchStateProvider provider;
+    HsStateToken token;
+    token.mLibrary = library;
+    token.mUri = uri;
+    QState* state = provider.createState(token);
+    bool result = (state != NULL);
+    if (state)
+        {
+        delete state;
+        }
+    return result;
+    }
+
+// ---------------------------------------------------------------------------
+// ---------------------------------------------------------------------------
+//
+bool SearchStateProviderTest::findStateInStateList(
+        const QList<HsStateToken>& states, const QString& library,
+        const QString& uri)
+    {
+    foreach(HsStateToken token, states)
+            {
+            if (token.mLibrary == library && token.mUri == uri)
+                {
+                return true;
+                }
+            }
+    return false;
+    }
+
+// ---------------------------------------------------------------------------
+// ---------------------------------------------------------------------------
+//
+HbMainWindow* SearchStateProviderTest::mainWindow()
+    {
+    int count = HbInstance::instance()->allMainWindows().count();
+
+    for (int i = count - 1; i > -1; i--)
+        {
+        delete HbInstance::instance()->allMainWindows().at(i);
+        }
+    return new HbMainWindow;
+    }
+
+#ifdef Q_OS_SYMBIAN
+
+//QTEST_MAIN corrected since crashes if TRAP not in correct place.
+//Will be corrected in later (estimate 4.6.0) Qt release for Symbian.
+int main(int argc, char *argv[])
+    {
+    QApplication app(argc, argv);
+    int error;
+    TRAPD(err,
+            QTEST_DISABLE_KEYPAD_NAVIGATION
+            SearchStateProviderTest tc;
+            error = QTest::qExec(&tc, argc, argv););
+    return error;
+    }
+#else //Q_OS_SYMBIAN
+//QTEST_MAIN(SearchStateProviderTest)
+#endif //Q_OS_SYMBIAN
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/searchui/stateproviders/searchstateprovider/tsrc/t_searchstateprovider/src/t_settingswidget.cpp	Mon Apr 19 14:40:05 2010 +0300
@@ -0,0 +1,185 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: 
+*
+*/
+#include "t_searchstateprovider.h"
+#include "settingswidget.h"
+#include <qlist.h>
+#include <hbcheckbox.h>
+#include <hbdialog.h>
+#include <qnamespace.h>
+#include <qglobal.h>
+#include <QtGui>
+#include <hbaction.h>
+#include <qdir.h>
+
+// ---------------------------------------------------------------------------
+// ---------------------------------------------------------------------------
+//
+void SearchStateProviderTest::testsettingswizardConstruction()
+    {
+    // HbMainWindow* wind = mainWindow();
+    SettingsWidget* settingswizard = new SettingsWidget();
+
+    QVERIFY(settingswizard != NULL);
+
+    delete settingswizard;
+    }
+
+// ---------------------------------------------------------------------------
+// ---------------------------------------------------------------------------
+//
+void SearchStateProviderTest::teststoreSettingsToiniFile()
+    {
+    SettingsWidget* settingswizard = new SettingsWidget();
+
+    for (int i = 0; i < settingswizard->mDeviceCheckBoxList.count(); i++)
+        (settingswizard->mDeviceCheckBoxList.at(i))->setCheckState(
+                Qt::Unchecked);
+
+    settingswizard->storeSettingsToiniFile();
+
+    settingswizard->loadSettingsFrominiFile();
+    for (int i = 0; i < settingswizard->mDeviceCheckBoxList.count(); i++)
+        QCOMPARE(settingswizard->mDeviceCheckBoxList.at(i)->checkState(),Qt::Unchecked);
+
+    delete settingswizard;
+    }
+// ---------------------------------------------------------------------------
+// ---------------------------------------------------------------------------
+//
+void SearchStateProviderTest::testloadSettingsFrominiFile()
+    {
+    SettingsWidget* settingswizard = new SettingsWidget();
+
+    for (int i = 0; i < settingswizard->mDeviceCheckBoxList.count(); i++)
+        (settingswizard->mDeviceCheckBoxList.at(i))->setCheckState(
+                Qt::Checked);
+    settingswizard->storeSettingsToiniFile();
+
+    settingswizard->loadSettingsFrominiFile();
+    for (int i = 0; i < settingswizard->mDeviceCheckBoxList.count(); i++)
+        QCOMPARE(settingswizard->mDeviceCheckBoxList.at(i)->checkState(),Qt::Checked);
+
+    delete settingswizard;
+    }
+// ---------------------------------------------------------------------------
+// ---------------------------------------------------------------------------
+//
+void SearchStateProviderTest::testlaunchSettingWidget()
+    {
+    SettingsWidget* settingswizard = new SettingsWidget();
+    settingswizard->launchSettingWidget();
+    //  QVERIFY(settingswizard->popup->isActive());
+
+    delete settingswizard;
+
+    }
+void SearchStateProviderTest::testisInternetSearchOptionSelected()
+    {
+    SettingsWidget* settingswizard = new SettingsWidget();
+    settingswizard->isInternetSelected = false;
+    QCOMPARE(settingswizard->isInternetSearchOptionSelected(),false);
+
+    delete settingswizard;
+
+    }
+void SearchStateProviderTest::testunCheckSubCategories()
+    {
+    SettingsWidget* settingswizard = new SettingsWidget();
+    settingswizard->checkSubCategories(0);
+    settingswizard->unCheckSubCategories(0);
+    for (int i = 0; i < settingswizard->mDeviceCheckBoxList.count(); i++)
+        QCOMPARE(settingswizard->mDeviceCheckBoxList.at(i)->checkState(),Qt::Checked);
+
+    delete settingswizard;
+
+    }
+void SearchStateProviderTest::testcheckSubCategories()
+    {
+    SettingsWidget* settingswizard = new SettingsWidget();
+
+    settingswizard->unCheckSubCategories(0);
+    settingswizard->checkSubCategories(0);
+    for (int i = 0; i < settingswizard->mDeviceCheckBoxList.count(); i++)
+        QCOMPARE(settingswizard->mDeviceCheckBoxList.at(i)->checkState(),Qt::Checked);
+
+    delete settingswizard;
+
+    }
+void SearchStateProviderTest::testsetActionVisibility()
+    {
+    SettingsWidget* settingswizard = new SettingsWidget();
+    settingswizard->mDeviceCheckBoxList.at(2)->setChecked(true);
+    settingswizard->setActionVisibility();
+    QVERIFY(settingswizard->popup->primaryAction()->isVisible());
+    delete settingswizard;
+    }
+
+void SearchStateProviderTest::testenableDefaultSettings()
+    {
+    QDir dir;
+    bool ret = dir.remove("Search.ini");
+    SettingsWidget* settingswizard = new SettingsWidget();
+    settingswizard->enableDefaultSettings();
+    settingswizard->loadSettingsFrominiFile();
+    for (int i = 0; i < settingswizard->mDeviceCheckBoxList.count(); i++)
+        QCOMPARE(settingswizard->mDeviceCheckBoxList.at(i)->checkState(),Qt::Checked);
+    delete settingswizard;
+    }
+void SearchStateProviderTest::testcheckBoxOkEvent()
+    {
+    SettingsWidget* settingswizard = new SettingsWidget();
+    QSignalSpy spy(settingswizard, SIGNAL(settingsEvent()));
+    settingswizard->checkBoxOkEvent();
+    QCOMPARE(spy.count(), 1);
+    delete settingswizard;
+
+    }
+void SearchStateProviderTest::testcheckBoxCancelEvent()
+    {
+    SettingsWidget* settingswizard = new SettingsWidget();
+    QSignalSpy spy(settingswizard, SIGNAL(settingsEvent()));
+    settingswizard->checkBoxCancelEvent();
+    QCOMPARE(spy.count(), 1);
+    delete settingswizard;
+
+    }
+void SearchStateProviderTest::testitemChecked()
+    {
+    SettingsWidget* settingswizard = new SettingsWidget();
+    settingswizard->mDeviceCheckBoxList.at(0)->setChecked(2);
+    settingswizard->itemChecked(0);
+    for (int i = 0; i < settingswizard->mDeviceCheckBoxList.count(); i++)
+        QCOMPARE(settingswizard->mDeviceCheckBoxList.at(i)->checkState(),Qt::Checked);
+
+    delete settingswizard;
+
+    }
+void SearchStateProviderTest::testchangeDeviceInternetCheck()
+    {
+    delete mMainWindow;
+    SettingsWidget* settingswizard = new SettingsWidget();
+    settingswizard->isInternetSelected = false;
+
+    QSignalSpy spy(settingswizard, SIGNAL(settingsChanged()));
+    settingswizard->changeDeviceInternetCheck();
+    QCOMPARE(settingswizard->mInternetCheckBoxList.at(0)->checkState(), Qt::Checked);
+
+    QCOMPARE(spy.count(),1);
+    delete settingswizard;
+
+    }
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/searchui/stateproviders/searchstateprovider/tsrc/t_searchstateprovider/t_searchstateprovider.pri	Mon Apr 19 14:40:05 2010 +0300
@@ -0,0 +1,25 @@
+#
+# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+# All rights reserved.
+# This component and the accompanying materials are made available
+# under the terms of "Eclipse Public License v1.0"
+# which accompanies this distribution, and is available
+# at the URL "http://www.eclipse.org/legal/epl-v10.html".
+#
+# Initial Contributors:
+# Nokia Corporation - initial contribution.
+#
+# Contributors:
+#
+# Description: 
+#
+#Header files
+HEADERS += ./inc/*.h \
+           ../../inc/*.h \
+
+#Source files
+SOURCES += ./src/*.cpp \
+           ../../src/*.cpp \
+
+RESOURCES += ../resources/resources.qrc
+#RESOURCES += ../../../../translations/translations.qrc
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/searchui/stateproviders/searchstateprovider/tsrc/t_searchstateprovider/t_searchstateprovider.pro	Mon Apr 19 14:40:05 2010 +0300
@@ -0,0 +1,62 @@
+#
+# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+# All rights reserved.
+# This component and the accompanying materials are made available
+# under the terms of "Eclipse Public License v1.0"
+# which accompanies this distribution, and is available
+# at the URL "http://www.eclipse.org/legal/epl-v10.html".
+#
+# Initial Contributors:
+# Nokia Corporation - initial contribution.
+#
+# Contributors:
+#
+# Description:  Search stateprovider unit test project file
+#
+
+TEMPLATE = app
+
+
+LIBS += -lstatemodel
+#LIBS += -searchstateprovider.dll
+#LIBS += -searchruntimeprovider.dll
+LIBS += -lsearchindevicehandler
+LIBS += -lxqservice 
+LIBS += -lqcpixsearchclient
+LIBS += -laknskins 
+LIBS += -lfbscli
+LIBS += -laknicon
+LIBS += -lapgrfx
+LIBS += -lbitgdi
+    
+CONFIG += qtestlib 
+CONFIG += hb
+
+QT += xml \
+      sql
+DEFINES += SEARCH_UNITTESTING
+
+DEPENDPATH += .\
+              ./src \
+              ./inc \
+              ../../src \
+              ../../inc
+
+INCLUDEPATH += .\
+               ./inc \
+               ../../inc \
+               ../../../../inc \
+               ../../../../indevicehandler/inc \
+	       ../../../../runtimeproviders/searchruntimeprovider/inc
+symbian {         
+CONFIG += symbian_test               
+TARGET.UID2 = 0x100039CE
+TARGET.UID3 = 0x20026F9A
+TARGET.CAPABILITY = CAP_APPLICATION AllFiles
+TARGET.EPOCSTACKSIZE = 0x14000 // 80kB
+TARGET.EPOCHEAPSIZE = 0x20000 0x1000000 // 128kB - 16MB
+INCLUDEPATH += $$MW_LAYER_SYSTEMINCLUDE 
+}
+
+include(t_searchstateprovider.pri)
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/searchui/stateproviders/searchstateprovider/tsrc/tsrc.pro	Mon Apr 19 14:40:05 2010 +0300
@@ -0,0 +1,21 @@
+#
+# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+# All rights reserved.
+# This component and the accompanying materials are made available
+# under the terms of "Eclipse Public License v1.0"
+# which accompanies this distribution, and is available
+# at the URL "http://www.eclipse.org/legal/epl-v10.html".
+#
+# Initial Contributors:
+# Nokia Corporation - initial contribution.
+#
+# Contributors:
+#
+# Description:
+#
+
+TEMPLATE = subdirs
+
+SUBDIRS  = t_searchstateprovider
+           
+CONFIG  += ordered
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/searchui/stateproviders/stateproviders.pro	Mon Apr 19 14:40:05 2010 +0300
@@ -0,0 +1,19 @@
+#
+# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+# All rights reserved.
+# This component and the accompanying materials are made available
+# under the terms of "Eclipse Public License v1.0"
+# which accompanies this distribution, and is available
+# at the URL "http://www.eclipse.org/legal/epl-v10.html".
+#
+# Initial Contributors:
+# Nokia Corporation - initial contribution.
+#
+# Contributors:
+#
+# Description:  search state providers project file
+#
+
+TEMPLATE = subdirs
+SUBDIRS  += searchstateprovider 
+CONFIG  += ordered
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/sysdef_1_5_1.dtd	Mon Apr 19 14:40:05 2010 +0300
@@ -0,0 +1,88 @@
+ <!ELEMENT SystemDefinition (systemModel?, build?)>
+ <!ATTLIST SystemDefinition
+  name CDATA #REQUIRED
+  schema CDATA #REQUIRED>
+ <!ELEMENT systemModel (layer+)>
+ <!ELEMENT layer (logicalset* | module*)*>
+ <!ATTLIST layer
+  name CDATA #REQUIRED
+  levels CDATA #IMPLIED
+  span CDATA #IMPLIED>
+ <!ELEMENT logicalset (logicalsubset* | module* | unit* | package* | prebuilt*)*>
+ <!ATTLIST logicalset name CDATA #REQUIRED>
+ <!ELEMENT logicalsubset (module* | unit* | package* | prebuilt*)*>
+ <!ATTLIST logicalsubset name CDATA #REQUIRED>
+ <!ELEMENT module (component* | unit* | package* | prebuilt*)*>
+ <!ATTLIST module
+  name CDATA #REQUIRED
+  level CDATA #IMPLIED>
+ <!ELEMENT component (unit* | package* | prebuilt*)*>
+ <!ATTLIST component name CDATA #REQUIRED>
+ <!ELEMENT unit EMPTY>
+ <!ATTLIST unit
+  unitID ID #REQUIRED
+  name CDATA #REQUIRED
+  mrp CDATA #REQUIRED
+  filter CDATA #IMPLIED
+  bldFile CDATA #REQUIRED
+  priority CDATA #IMPLIED
+  contract CDATA #IMPLIED
+  proFile CDATA #IMPLIED
+  qmakeArgs CDATA #IMPLIED>
+ <!ELEMENT package EMPTY>
+ <!ATTLIST package
+  name CDATA #REQUIRED
+  mrp CDATA #REQUIRED
+  filter CDATA #IMPLIED
+  contract CDATA #IMPLIED>
+ <!ELEMENT prebuilt EMPTY>
+ <!ATTLIST prebuilt
+  name CDATA #REQUIRED
+  version CDATA #REQUIRED
+  late (Y|N) #IMPLIED
+  filter CDATA #IMPLIED
+  contract CDATA #IMPLIED>
+ <!ELEMENT build (option* | target+ | targetList+ | unitList+ | configuration+)*>
+ <!ELEMENT unitList (unitRef+)>
+ <!ATTLIST unitList
+  name ID #REQUIRED
+  description CDATA #REQUIRED>
+ <!ELEMENT unitRef EMPTY>
+ <!ATTLIST unitRef unit IDREF #REQUIRED>
+ <!ELEMENT targetList EMPTY>
+ <!ATTLIST targetList
+  name ID #REQUIRED
+  description CDATA #REQUIRED
+  target IDREFS #REQUIRED>
+ <!ELEMENT target EMPTY>
+ <!ATTLIST target
+  name ID #REQUIRED
+  abldTarget CDATA #REQUIRED
+  description CDATA #REQUIRED>
+ <!ELEMENT option EMPTY>
+ <!ATTLIST option
+  name ID #REQUIRED
+  abldOption CDATA #REQUIRED
+  description CDATA #REQUIRED
+  enable (Y | N | y | n) #REQUIRED>
+ <!ELEMENT configuration (unitListRef+ | layerRef+ | task+)*>
+ <!ATTLIST configuration
+  name ID #REQUIRED
+  description CDATA #REQUIRED
+  filter CDATA #REQUIRED>
+ <!ELEMENT task ( unitListRef* , (buildLayer | specialInstructions))>
+ <!ELEMENT unitListRef EMPTY>
+ <!ATTLIST unitListRef unitList IDREF #REQUIRED>
+ <!ELEMENT layerRef EMPTY>
+ <!ATTLIST layerRef layerName CDATA #REQUIRED>
+ <!ELEMENT buildLayer EMPTY>
+ <!ATTLIST buildLayer
+  command CDATA #REQUIRED
+  targetList IDREFS #IMPLIED
+  unitParallel (Y | N | y | n) #REQUIRED
+  targetParallel (Y | N | y | n) #IMPLIED>
+ <!ELEMENT specialInstructions EMPTY>
+ <!ATTLIST specialInstructions
+  name CDATA #REQUIRED
+  cwd CDATA #REQUIRED
+  command CDATA #REQUIRED>