Revision: 201017
authorDremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
Fri, 14 May 2010 15:53:17 +0300
changeset 3 6832643895f7
parent 2 208a4ba3894c
child 4 6396153a6cef
child 5 3bc31ad99ee7
Revision: 201017 Kit: 201019
group/bld.inf
harvesterplugins/applications/src/applicationsplugin.cpp
harvesterplugins/calendar/src/ccalendarplugin.cpp
harvesterplugins/file/inc/cfileplugin.h
harvesterplugins/file/src/cfileplugin.cpp
harvesterplugins/file/src/cmmcmonitor.cpp
harvesterplugins/media/mediautils/src/cpixmdedbmanager.cpp
harvesterplugins/messaging/email/group/emailplugin.mmp
harvesterplugins/messaging/email/inc/cemailplugin.h
harvesterplugins/messaging/email/inc/memailitemobserver.h
harvesterplugins/messaging/email/qtemailfetcher/bwins/qtemailfetcheru.def
harvesterplugins/messaging/email/qtemailfetcher/eabi/qtemailfetcheru.def
harvesterplugins/messaging/email/qtemailfetcher/qtemailfetcher.cpp
harvesterplugins/messaging/email/qtemailfetcher/qtemailfetcher.h
harvesterplugins/messaging/email/qtemailfetcher/qtemailfetcher.pro
harvesterplugins/messaging/email/src/cemailplugin.cpp
harvesterplugins/notes/src/notesplugin.cpp
rom/cpix_app.iby
searchui/indevicehandler/tsrc/t_indevicehandler/src/t_indevicehandler.cpp
searchui/rom/search.iby
searchui/search_exports_to_rom.pri
searchui/searchapplication/searchapplication.pkg
searchui/stateproviders/searchstateprovider/inc/searchprogressivestate.h
searchui/stateproviders/searchstateprovider/inc/settingswidget.h
searchui/stateproviders/searchstateprovider/resources/delimeterscreen.docml
searchui/stateproviders/searchstateprovider/resources/searchstateprovider.docml
searchui/stateproviders/searchstateprovider/searchstateprovider.pro
searchui/stateproviders/searchstateprovider/src/searchprogressivestate.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_searchprogressivestate.cpp
searchui/stateproviders/searchstateprovider/tsrc/t_searchstateprovider/src/t_searchstateprovider.cpp
searchui/stateproviders/searchstateprovider/tsrc/t_searchstateprovider/t_searchstateprovider.pro
searchui/stubsis/searchui_stub.pkg
searchui/stubsis/searchui_stub.sis
sis/cpixsearchapp_stub.pkg
sis/cpixsearchapp_stub.sis
sis/makestubsis.bat
--- a/group/bld.inf	Mon May 03 12:32:15 2010 +0300
+++ b/group/bld.inf	Fri May 14 15:53:17 2010 +0300
@@ -29,6 +29,7 @@
  
 ../cenrep/20029ac7.cre                         /epoc32/winscw/c/private/10202be9/20029ac7.cre
 ../cenrep/20029ac7.cre                         /epoc32/data/z/private/10202be9/20029ac7.cre
+../sis/cpixsearchapp_stub.sis                  /epoc32/data/z/system/install/cpixsearchapp_stub.sis
 
 PRJ_TESTMMPFILES
 
--- a/harvesterplugins/applications/src/applicationsplugin.cpp	Mon May 03 12:32:15 2010 +0300
+++ b/harvesterplugins/applications/src/applicationsplugin.cpp	Fri May 14 15:53:17 2010 +0300
@@ -209,8 +209,13 @@
     docidString = docidString.Mid( KUidStartIndex, KUidEndIndex  );
     
     CSearchDocument* document = CSearchDocument::NewLC( docidString, _L(APPLICATIONS_APPCLASS) );
+    //The UID field should not be aggregated for now as we dont want it to be searchable by default.
+    //By default, all tokenized fields are aggregated and therefore searchable.
+    //If we dont tokenize, then the field will not be searchable at all.
+    //As a middle path, we tokenize this field, but explicitly chose NOT to aggregate it.
+    //That way, if a client is interested in the UID field, he can choose to query it explicitly.
     document->AddFieldL(KMimeTypeField, KMimeTypeApplication, CDocumentField::EStoreYes | CDocumentField::EIndexUnTokenized );
-    document->AddFieldL(KApplicationFieldUid, docidString, CDocumentField::EStoreYes | CDocumentField::EIndexTokenized );
+    document->AddFieldL(KApplicationFieldUid, docidString, CDocumentField::EStoreYes | CDocumentField::EIndexTokenized | CDocumentField::EAggregateNo );
 
     if( iWidgetRegistry.IsWidget( aAppInfo.iUid  ) )
         AddWidgetInfoL( document, aAppInfo.iUid );
--- a/harvesterplugins/calendar/src/ccalendarplugin.cpp	Mon May 03 12:32:15 2010 +0300
+++ b/harvesterplugins/calendar/src/ccalendarplugin.cpp	Fri May 14 15:53:17 2010 +0300
@@ -367,6 +367,10 @@
 		// 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);
+		if ( entry == NULL ) {
+            CleanupStack::PopAndDestroy(index_item);
+            return;
+		}
 		// TODO leave if entry is NULL
 		CleanupStack::PushL(entry);
 		// TODO Uncomment below portion of code when the latest Organiser code in MCL
--- a/harvesterplugins/file/inc/cfileplugin.h	Mon May 03 12:32:15 2010 +0300
+++ b/harvesterplugins/file/inc/cfileplugin.h	Fri May 14 15:53:17 2010 +0300
@@ -115,7 +115,7 @@
 	 * @aUndefineAsWell if ETrue then undefine the volume as well
 	 * 
 	 */
-	void UnMount(TDriveNumber aMedia, TBool aUndefineAsWell);
+	void UnMount(TDriveNumber aMedia, TBool aUndefineAsWell,TBool aRemoveQueuePersist = EFalse);
 
 	/**
 	 * FormBaseAppClass - constructs a baseAppClass for the given drive.
--- a/harvesterplugins/file/src/cfileplugin.cpp	Mon May 03 12:32:15 2010 +0300
+++ b/harvesterplugins/file/src/cfileplugin.cpp	Fri May 14 15:53:17 2010 +0300
@@ -307,7 +307,7 @@
     OstTraceFunctionExit0( CFILEPLUGIN_MOUNTL_EXIT );
     }
 
-void CFilePlugin::UnMount(TDriveNumber aMedia, TBool aUndefineAsWell)
+void CFilePlugin::UnMount(TDriveNumber aMedia, TBool aUndefineAsWell,TBool aRemoveQueuePersist)
     {
     OstTraceFunctionEntry0( CFILEPLUGIN_UNMOUNT_ENTRY );
     CPIXLOGSTRING("ENTER CFilePlugin::UnMount ");
@@ -325,8 +325,8 @@
     TBuf<KFilePluginBaseAppClassMaxLen> baseContentAppClass;
     FormBaseAppClass(aMedia,KFileBaseAppClassContent, baseContentAppClass);
 
-    // Remove from harvesting queue
-    iObserver->RemoveHarvestingQueue(this, baseContentAppClass);
+    // Remove from harvesting queue aRemovePersist will remove from config file as well
+    iObserver->RemoveHarvestingQueue(this, baseContentAppClass,aRemoveQueuePersist);
     
     // Delete the index object
     if (iIndexer[aMedia])
--- a/harvesterplugins/file/src/cmmcmonitor.cpp	Mon May 03 12:32:15 2010 +0300
+++ b/harvesterplugins/file/src/cmmcmonitor.cpp	Fri May 14 15:53:17 2010 +0300
@@ -242,15 +242,15 @@
             OstTrace0( TRACE_NORMAL, DUP2_CMMCMONITOR_RUNL, "CMMCMonitor::RunL insert event" );
             CPIXLOGSTRING("CMMCMonitor::RunL insert event");
             // Mount MMC and force reharvest
-            iFilePlugin.MountL(drv, ETrue);
+            iFilePlugin.MountL(drv, EFalse); //dont force reharvest
             }
         else
             {
             OstTrace0( TRACE_NORMAL, DUP3_CMMCMONITOR_RUNL, "CMMCMonitor::RunL eject event" );
             CPIXLOGSTRING("CMMCMonitor::RunL eject event");
             // If the MMC has been ejected, then need to dismount 
-            // and undefine the volume
-            iFilePlugin.UnMount(drv, ETrue);
+            // and undefine the volume and also remove from queue forever
+            iFilePlugin.UnMount(drv, ETrue,ETrue);
             }
         }
     CPIXLOGSTRING("END CMMCMonitor::RunL");
--- a/harvesterplugins/media/mediautils/src/cpixmdedbmanager.cpp	Mon May 03 12:32:15 2010 +0300
+++ b/harvesterplugins/media/mediautils/src/cpixmdedbmanager.cpp	Fri May 14 15:53:17 2010 +0300
@@ -246,7 +246,7 @@
     sql.Format(KMdeCpixSyncDbSqlCheckExist,aObjId);
     User::LeaveIfError(dbView.Prepare(iDatabase, TDbQuery(sql)));
     User::LeaveIfError(dbView.EvaluateAll());
-    dbView.FirstL();
+    (void)dbView.FirstL();
     if(dbView.AtRow())
         {
         dbView.UpdateL();
--- a/harvesterplugins/messaging/email/group/emailplugin.mmp	Mon May 03 12:32:15 2010 +0300
+++ b/harvesterplugins/messaging/email/group/emailplugin.mmp	Fri May 14 15:53:17 2010 +0300
@@ -51,6 +51,7 @@
 LIBRARY       cpixsearchclient.lib
 LIBRARY       qtemailfetcher.lib
 LIBRARY       qtcore.lib
+LIBRARY       libstdcpp.lib //for std::exception from QT_TRYCATCH_LEAVING
 
 OPTION CW -wchar_t on
 MACRO _WCHAR_T_DECLARED
@@ -58,5 +59,7 @@
 // For logging
 LIBRARY 	  flogger.lib 
 
+EPOCALLOWDLLDATA
+
 EXPORTUNFROZEN
 
--- a/harvesterplugins/messaging/email/inc/cemailplugin.h	Mon May 03 12:32:15 2010 +0300
+++ b/harvesterplugins/messaging/email/inc/cemailplugin.h	Fri May 14 15:53:17 2010 +0300
@@ -45,7 +45,12 @@
 	 * From MEmailItemObserver
 	 */
 	 void HandleDocumentL(const CSearchDocument* aSearchDocument, TCPixActionType aActionType);
-	  
+	
+	 /**
+	  * From MEmailItemObserver
+	  */ 
+	 void HarvestingCompleted();
+	 
 	 /**
      * Gets the database observer class
      */
--- a/harvesterplugins/messaging/email/inc/memailitemobserver.h	Mon May 03 12:32:15 2010 +0300
+++ b/harvesterplugins/messaging/email/inc/memailitemobserver.h	Fri May 14 15:53:17 2010 +0300
@@ -48,6 +48,11 @@
    * @param aActionType action to be taken on document
 	 */
 	virtual void HandleDocumentL(const CSearchDocument* aSearchDocument, TCPixActionType aActionType) = 0;
+	
+	/**
+     * A pure virtual method which is called by the email fetcher when harvesting completed     
+     */
+    virtual void HarvestingCompleted() = 0;
 
 };
 
--- a/harvesterplugins/messaging/email/qtemailfetcher/bwins/qtemailfetcheru.def	Mon May 03 12:32:15 2010 +0300
+++ b/harvesterplugins/messaging/email/qtemailfetcher/bwins/qtemailfetcheru.def	Fri May 14 15:53:17 2010 +0300
@@ -1,22 +1,25 @@
 EXPORTS
-	?initialize@QEmailFetcher@@CAXPAV1@@Z @ 1 NONAME ; void QEmailFetcher::initialize(class QEmailFetcher *)
-	?processMessages@QEmailFetcher@@QAEXH@Z @ 2 NONAME ; void QEmailFetcher::processMessages(int)
-	?trUtf8@QEmailFetcher@@SA?AVQString@@PBD0@Z @ 3 NONAME ; class QString QEmailFetcher::trUtf8(char const *, char const *)
-	?qt_metacall@QEmailFetcher@@UAEHW4Call@QMetaObject@@HPAPAX@Z @ 4 NONAME ; int QEmailFetcher::qt_metacall(enum QMetaObject::Call, int, void * *)
-	?tr@QEmailFetcher@@SA?AVQString@@PBD0@Z @ 5 NONAME ; class QString QEmailFetcher::tr(char const *, char const *)
-	?StartHarvesting@QEmailFetcher@@QAEXXZ @ 6 NONAME ; void QEmailFetcher::StartHarvesting(void)
-	?tr@QEmailFetcher@@SA?AVQString@@PBD0H@Z @ 7 NONAME ; class QString QEmailFetcher::tr(char const *, char const *, int)
-	?getStaticMetaObject@QEmailFetcher@@SAABUQMetaObject@@XZ @ 8 NONAME ; struct QMetaObject const & QEmailFetcher::getStaticMetaObject(void)
-	?staticMetaObject@QEmailFetcher@@2UQMetaObject@@B @ 9 NONAME ; struct QMetaObject const QEmailFetcher::staticMetaObject
-	?handleMailboxesListed@QEmailFetcher@@QAEXH@Z @ 10 NONAME ; void QEmailFetcher::handleMailboxesListed(int)
-	??1QEmailFetcher@@UAE@XZ @ 11 NONAME ; QEmailFetcher::~QEmailFetcher(void)
-	?mailFoldersListed@QEmailFetcher@@QAEXH@Z @ 12 NONAME ; void QEmailFetcher::mailFoldersListed(int)
-	?emailServiceIntialized@QEmailFetcher@@QAEX_N@Z @ 13 NONAME ; void QEmailFetcher::emailServiceIntialized(bool)
-	?qt_metacast@QEmailFetcher@@UAEPAXPBD@Z @ 14 NONAME ; void * QEmailFetcher::qt_metacast(char const *)
-	?newInstance@QEmailFetcher@@SAPAV1@AAVMEmailItemObserver@@@Z @ 15 NONAME ; class QEmailFetcher * QEmailFetcher::newInstance(class MEmailItemObserver &)
-	?trUtf8@QEmailFetcher@@SA?AVQString@@PBD0H@Z @ 16 NONAME ; class QString QEmailFetcher::trUtf8(char const *, char const *, int)
-	?metaObject@QEmailFetcher@@UBEPBUQMetaObject@@XZ @ 17 NONAME ; struct QMetaObject const * QEmailFetcher::metaObject(void) const
-	??0QEmailFetcher@@AAE@AAVMEmailItemObserver@@@Z @ 18 NONAME ; QEmailFetcher::QEmailFetcher(class MEmailItemObserver &)
-	??_EQEmailFetcher@@UAE@I@Z @ 19 NONAME ; QEmailFetcher::~QEmailFetcher(unsigned int)
-	?handleMessageEvent@QEmailFetcher@@QAEXW4MessageEvent@@_K1V?$QList@_K@@@Z @ 20 NONAME ; void QEmailFetcher::handleMessageEvent(enum MessageEvent, unsigned long long, unsigned long long, class QList<unsigned long long>)
+	?processMessages@QEmailFetcher@@QAEXH@Z @ 1 NONAME ; void QEmailFetcher::processMessages(int)
+	?tr@QEmailFetcher@@SA?AVQString@@PBD0@Z @ 2 NONAME ; class QString QEmailFetcher::tr(char const *, char const *)
+	?StartHarvesting@QEmailFetcher@@QAEXXZ @ 3 NONAME ; void QEmailFetcher::StartHarvesting(void)
+	?getStaticMetaObject@QEmailFetcher@@SAABUQMetaObject@@XZ @ 4 NONAME ; struct QMetaObject const & QEmailFetcher::getStaticMetaObject(void)
+	??1QEmailFetcher@@UAE@XZ @ 5 NONAME ; QEmailFetcher::~QEmailFetcher(void)
+	?processNextMailbox@QEmailFetcher@@AAEXXZ @ 6 NONAME ; void QEmailFetcher::processNextMailbox(void)
+	?trUtf8@QEmailFetcher@@SA?AVQString@@PBD0H@Z @ 7 NONAME ; class QString QEmailFetcher::trUtf8(char const *, char const *, int)
+	??_EQEmailFetcher@@UAE@I@Z @ 8 NONAME ; QEmailFetcher::~QEmailFetcher(unsigned int)
+	?NotifyHarvestingComplete@QEmailFetcher@@AAEXXZ @ 9 NONAME ; void QEmailFetcher::NotifyHarvestingComplete(void)
+	?handleMessageEvent@QEmailFetcher@@QAEXW4MessageEvent@@_K1V?$QList@_K@@@Z @ 10 NONAME ; void QEmailFetcher::handleMessageEvent(enum MessageEvent, unsigned long long, unsigned long long, class QList<unsigned long long>)
+	?initialize@QEmailFetcher@@CAXPAV1@@Z @ 11 NONAME ; void QEmailFetcher::initialize(class QEmailFetcher *)
+	?trUtf8@QEmailFetcher@@SA?AVQString@@PBD0@Z @ 12 NONAME ; class QString QEmailFetcher::trUtf8(char const *, char const *)
+	?qt_metacall@QEmailFetcher@@UAEHW4Call@QMetaObject@@HPAPAX@Z @ 13 NONAME ; int QEmailFetcher::qt_metacall(enum QMetaObject::Call, int, void * *)
+	?tr@QEmailFetcher@@SA?AVQString@@PBD0H@Z @ 14 NONAME ; class QString QEmailFetcher::tr(char const *, char const *, int)
+	?staticMetaObject@QEmailFetcher@@2UQMetaObject@@B @ 15 NONAME ; struct QMetaObject const QEmailFetcher::staticMetaObject
+	?handleMailboxesListed@QEmailFetcher@@QAEXH@Z @ 16 NONAME ; void QEmailFetcher::handleMailboxesListed(int)
+	?emailServiceIntialized@QEmailFetcher@@QAEX_N@Z @ 17 NONAME ; void QEmailFetcher::emailServiceIntialized(bool)
+	?processNextFolder@QEmailFetcher@@AAEXXZ @ 18 NONAME ; void QEmailFetcher::processNextFolder(void)
+	?qt_metacast@QEmailFetcher@@UAEPAXPBD@Z @ 19 NONAME ; void * QEmailFetcher::qt_metacast(char const *)
+	?newInstance@QEmailFetcher@@SAPAV1@AAVMEmailItemObserver@@@Z @ 20 NONAME ; class QEmailFetcher * QEmailFetcher::newInstance(class MEmailItemObserver &)
+	?handleMailFoldersListed@QEmailFetcher@@QAEXH@Z @ 21 NONAME ; void QEmailFetcher::handleMailFoldersListed(int)
+	??0QEmailFetcher@@AAE@AAVMEmailItemObserver@@@Z @ 22 NONAME ; QEmailFetcher::QEmailFetcher(class MEmailItemObserver &)
+	?metaObject@QEmailFetcher@@UBEPBUQMetaObject@@XZ @ 23 NONAME ; struct QMetaObject const * QEmailFetcher::metaObject(void) const
 
--- a/harvesterplugins/messaging/email/qtemailfetcher/eabi/qtemailfetcheru.def	Mon May 03 12:32:15 2010 +0300
+++ b/harvesterplugins/messaging/email/qtemailfetcher/eabi/qtemailfetcheru.def	Fri May 14 15:53:17 2010 +0300
@@ -6,17 +6,20 @@
 	_ZN13QEmailFetcher15StartHarvestingEv @ 5 NONAME
 	_ZN13QEmailFetcher15processMessagesEi @ 6 NONAME
 	_ZN13QEmailFetcher16staticMetaObjectE @ 7 NONAME DATA 16
-	_ZN13QEmailFetcher17mailFoldersListedEi @ 8 NONAME
+	_ZN13QEmailFetcher17processNextFolderEv @ 8 NONAME
 	_ZN13QEmailFetcher18handleMessageEventE12MessageEventyy5QListIyE @ 9 NONAME
-	_ZN13QEmailFetcher19getStaticMetaObjectEv @ 10 NONAME
-	_ZN13QEmailFetcher21handleMailboxesListedEi @ 11 NONAME
-	_ZN13QEmailFetcher22emailServiceIntializedEb @ 12 NONAME
-	_ZN13QEmailFetcherC1ER18MEmailItemObserver @ 13 NONAME
-	_ZN13QEmailFetcherC2ER18MEmailItemObserver @ 14 NONAME
-	_ZN13QEmailFetcherD0Ev @ 15 NONAME
-	_ZN13QEmailFetcherD1Ev @ 16 NONAME
-	_ZN13QEmailFetcherD2Ev @ 17 NONAME
-	_ZNK13QEmailFetcher10metaObjectEv @ 18 NONAME
-	_ZTI13QEmailFetcher @ 19 NONAME
-	_ZTV13QEmailFetcher @ 20 NONAME
+	_ZN13QEmailFetcher18processNextMailboxEv @ 10 NONAME
+	_ZN13QEmailFetcher19getStaticMetaObjectEv @ 11 NONAME
+	_ZN13QEmailFetcher21handleMailboxesListedEi @ 12 NONAME
+	_ZN13QEmailFetcher22emailServiceIntializedEb @ 13 NONAME
+	_ZN13QEmailFetcher23handleMailFoldersListedEi @ 14 NONAME
+	_ZN13QEmailFetcher24NotifyHarvestingCompleteEv @ 15 NONAME
+	_ZN13QEmailFetcherC1ER18MEmailItemObserver @ 16 NONAME
+	_ZN13QEmailFetcherC2ER18MEmailItemObserver @ 17 NONAME
+	_ZN13QEmailFetcherD0Ev @ 18 NONAME
+	_ZN13QEmailFetcherD1Ev @ 19 NONAME
+	_ZN13QEmailFetcherD2Ev @ 20 NONAME
+	_ZNK13QEmailFetcher10metaObjectEv @ 21 NONAME
+	_ZTI13QEmailFetcher @ 22 NONAME
+	_ZTV13QEmailFetcher @ 23 NONAME
 
--- a/harvesterplugins/messaging/email/qtemailfetcher/qtemailfetcher.cpp	Mon May 03 12:32:15 2010 +0300
+++ b/harvesterplugins/messaging/email/qtemailfetcher/qtemailfetcher.cpp	Fri May 14 15:53:17 2010 +0300
@@ -37,7 +37,9 @@
      iEmailService( NULL ),
      iMailBoxListings( NULL ), 
      iMailFolderList( NULL ),
-     iEnvelopeListing( NULL )
+     iEnvelopeListing( NULL ),
+     iCurrentMailboxIndex( 0 ), 
+     iCurrentFolderIndex( 0 )
     {
     }
 
@@ -57,7 +59,6 @@
     //Leak free init.
     try{
         QEmailFetcher* emailFetcher = new QEmailFetcher( aObserver );
-        //Uncomment 'this' once the actual APIs are ready.
         emailFetcher->iEmailService = new NmEmailService( emailFetcher );
         emailFetcher->iEmailEventNotifier =  new NmEventNotifier( emailFetcher );
         emailFetcher->iMailBoxListings = new NmMailboxListing( emailFetcher );
@@ -164,6 +165,30 @@
 } //anonymous namespace
 
 //------------------------------------------------------------------------------
+//Just to avoid duplication of the following two lines.
+void QEmailFetcher::NotifyHarvestingComplete(){
+    iCurrentMailboxIndex = iCurrentFolderIndex = 0;
+    QT_TRAP_THROWING( iEmailObserver.HarvestingCompleted() );
+    return;
+}
+
+//------------------------------------------------------------------------------
+void QEmailFetcher::handleMailboxesListed(int aCount){
+    iCurrentMailboxIndex = 0;
+    if( aCount == NmMailboxListing::MailboxListingFailed ) {
+        NotifyHarvestingComplete();
+        return;
+    }
+    if( aCount>0 && iMailBoxListings->getMailboxes( iMailBoxes ) ){
+        //Already set to NULL in constructor, so safe to call delete first time.
+        processNextMailbox();
+    }else{
+        NotifyHarvestingComplete();
+        return;
+    }
+}
+
+//------------------------------------------------------------------------------
 //Options to make async (like other plugins' Asynchronizer):
 //1. Use http://doc.trolltech.com/4.6/qtimer.html and connect timeout() signal to something?
 //Downside: 
@@ -178,44 +203,68 @@
 //
 //Recommendation: Use option 4.
 
-void QEmailFetcher::handleMailboxesListed(int aCount){
-    QList<NmMailbox> mailBoxes;
-    if( aCount>0 && iMailBoxListings->getMailboxes( mailBoxes ) ){
-        for( int i=0; i<aCount; i++ ){
-            //Already set to NULL in constructor, so safe to call delete first time.
-            delete iMailFolderList; iMailFolderList = NULL;
-            iMailFolderList = new NmFolderListing( this, mailBoxes.at( i ).id() );
-            connect( iMailFolderList, SIGNAL(foldersListed()), this, SLOT(mailFoldersListed()) );
-            const int waitForSeconds = 30; //TODO Move this constant out of here if needed elsewhere
-            QTimer::singleShot( waitForSeconds, iMailFolderList, SLOT( start()) );
-        }
+void QEmailFetcher::processNextMailbox(){
+    //No more mailboxes, notify completion.
+    if( iCurrentMailboxIndex >= iMailBoxes.count() ) {
+        NotifyHarvestingComplete();
+        return;
+    }
+    
+    //More mailboxes available.
+    delete iMailFolderList; iMailFolderList = NULL;
+    iMailFolderList = new NmFolderListing( this, iMailBoxes.at( iCurrentMailboxIndex++ ).id() );
+    connect( iMailFolderList, SIGNAL(foldersListed()), this, SLOT(handleMailFoldersListed()) );
+    const int waitForSeconds = 30; //TODO Move this constant out of here if needed elsewhere
+    QTimer::singleShot( waitForSeconds, iMailFolderList, SLOT( start()) );
+}
+
+//------------------------------------------------------------------------------
+void QEmailFetcher::handleMailFoldersListed(int aCount){
+    iCurrentFolderIndex = 0;
+    if( aCount == NmFolderListing::FolderListingFailed ){
+        processNextMailbox();
+        return;//Don't proceed futher.
+    }
+    if( aCount && iMailFolderList->getFolders( iFolders ) ){ 
+        processNextFolder();
+    }else{
+        processNextMailbox();
+        return;
     }
 }
 
 //------------------------------------------------------------------------------
-void QEmailFetcher::mailFoldersListed(int aCount){
-    if( aCount == NmFolderListing::FolderListingFailed ) return; //silently.
-    QList<NmFolder> folders;
-    if ( aCount && iMailFolderList->getFolders( folders ) ) {
-        for( int i=0; i<aCount; i++ ){
-            //Already set to NULL in constructor, so safe to call delete first time.
-            delete iEnvelopeListing; iEnvelopeListing = NULL; 
-            iEnvelopeListing = new NmEnvelopeListing( this, folders.at( i ).id(), 0 );
-            connect(iEnvelopeListing, SIGNAL(envelopesListed(int)),this,SLOT(processMessages(int)));
-            iEnvelopeListing->start();
-        }
+void QEmailFetcher::processNextFolder(){
+    //No more folders in current mailbox.
+    if( iCurrentFolderIndex >= iFolders.count() ) {
+        processNextMailbox();
+        return;//Don't proceed futher.
     }
+    
+    //More folders to process.
+    //Already set to NULL in constructor, so safe to call delete first time.
+    delete iEnvelopeListing; iEnvelopeListing = NULL; 
+    iEnvelopeListing= new NmEnvelopeListing( 
+            this, 
+            iFolders.at( iCurrentFolderIndex++ ).id(),
+            iMailBoxes.at( iCurrentMailboxIndex-1 ).id() ); //we have already incremented iMailboxIndex.
+
+    connect(iEnvelopeListing, SIGNAL(envelopesListed(int)),this,SLOT(processMessages(int)));
+    iEnvelopeListing->start();
 }
 
 //------------------------------------------------------------------------------
 void QEmailFetcher::processMessages(int aCount){
-    if( aCount == NmMailboxListing::MailboxListingFailed ) return; //silently.
+    if( aCount == NmEnvelopeListing::EnvelopeListingFailed ) {
+        processNextFolder();
+        return;//Don't proceed futher.
+    }
     QList<NmMessageEnvelope> envelopes;
     if ( aCount > 0 && iEnvelopeListing->getEnvelopes(envelopes) ) {
         for( int i=0; i<envelopes.count(); i++ ) {
-        const NmMessageEnvelope &envelope = envelopes.at( i );
-        //Create document and call back observer.
-        QT_TRAP_THROWING( iEmailObserver.HandleDocumentL( getSearchDocument( envelope ), ECPixAddAction ) );
+            const NmMessageEnvelope &envelope = envelopes.at( i );
+            //Create document and call back observer.
+            QT_TRAP_THROWING( iEmailObserver.HandleDocumentL( getSearchDocument( envelope ), ECPixAddAction ) );
         }
     }
 }
--- a/harvesterplugins/messaging/email/qtemailfetcher/qtemailfetcher.h	Mon May 03 12:32:15 2010 +0300
+++ b/harvesterplugins/messaging/email/qtemailfetcher/qtemailfetcher.h	Fri May 14 15:53:17 2010 +0300
@@ -53,16 +53,19 @@
     static QEmailFetcher* newInstance(MEmailItemObserver& aObserver);
     ~QEmailFetcher();
     void StartHarvesting();
-
+    
 private:
     QEmailFetcher(MEmailItemObserver& aObserver );
     static void initialize(QEmailFetcher* aThis); //helper (2nd phase constructor).
-
-    //Private?
-public slots:
+    void processNextMailbox();
+    void processNextFolder();
+    void processNextEnvelope();
+    void NotifyHarvestingComplete();
+    
+public slots: //public since they need to be called by *other* objects.
     void emailServiceIntialized( bool );
     void handleMailboxesListed( int );
-    void mailFoldersListed( int );
+    void handleMailFoldersListed( int );
     void processMessages( int );
     //Connect to messageEvent signal
     void handleMessageEvent( MessageEvent aEvent, quint64 mailboxId, quint64 folderId, QList<quint64> messageList );
@@ -75,6 +78,12 @@
     NmFolderListing* iMailFolderList;       //owned.
     NmEnvelopeListing* iEnvelopeListing;    //owned.
     NmMessageEnvelope* iMessageListing;     //owned.
+    
+    //These are needed to asynchronously process *all* mailboxes/folders.
+    int iCurrentMailboxIndex;
+    int iCurrentFolderIndex;
+    QList<NmMailbox> iMailBoxes;
+    QList<NmFolder> iFolders;
     };
 
 #endif //_QEMAILFETCHER_H
--- a/harvesterplugins/messaging/email/qtemailfetcher/qtemailfetcher.pro	Mon May 03 12:32:15 2010 +0300
+++ b/harvesterplugins/messaging/email/qtemailfetcher/qtemailfetcher.pro	Fri May 14 15:53:17 2010 +0300
@@ -34,7 +34,7 @@
     
     INCLUDEPATH += ../inc
     
-    HEADERS += memailitemobserver.h
+    HEADERS += ../inc/memailitemobserver.h
     LIBS += -lcpixsearchclient
     LIBS += -lnmailclientapi
         
--- a/harvesterplugins/messaging/email/src/cemailplugin.cpp	Mon May 03 12:32:15 2010 +0300
+++ b/harvesterplugins/messaging/email/src/cemailplugin.cpp	Fri May 14 15:53:17 2010 +0300
@@ -158,10 +158,10 @@
 	if (!iIndexer[drive])
 	   User::Leave(KErrGeneral);
 	
-	//Complete harvesting here only for time being
-	//HarvestingCompleted(KErrNone);
-    // Reset the database
+	// Reset the database
 	iIndexer[drive]->ResetL();
+	iQEmailFetcher->StartHarvesting();
+	
 #ifdef __PERFORMANCE_DATA
     iStartTime.UniversalTime();
 #endif
@@ -353,6 +353,15 @@
     }
 
 // ---------------------------------------------------------------------------
+// CEmailPlugin::HarvestingCompleted callback from email fetcher
+// ---------------------------------------------------------------------------
+//
+void CEmailPlugin::HarvestingCompleted()
+    {
+    HarvestingCompleted(KErrNone);
+    }
+
+// ---------------------------------------------------------------------------
 // CEmailPlugin::HarvestingCompleted
 // ---------------------------------------------------------------------------
 //  
--- a/harvesterplugins/notes/src/notesplugin.cpp	Mon May 03 12:32:15 2010 +0300
+++ b/harvesterplugins/notes/src/notesplugin.cpp	Fri May 14 15:53:17 2010 +0300
@@ -328,7 +328,8 @@
 		{
         // 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);    
+	    CCalEntry* entry = iEntryView->FetchL(aLocalUid);
+	    if ( entry == NULL)  return;
 	    CleanupStack::PushL(entry);
 	    
 	    if( CCalEntry::ENote != entry->EntryTypeL() )
--- a/rom/cpix_app.iby	Mon May 03 12:32:15 2010 +0300
+++ b/rom/cpix_app.iby	Fri May 14 15:53:17 2010 +0300
@@ -54,6 +54,8 @@
 
 data=DATAZ_\private\10202be9\20029ac7.cre       private\10202be9\20029ac7.cre
 
+data=ZSYSTEM\install\cpixsearchapp_stub.sis    System\Install\cpixsearchapp_stub.sis
+
 #endif //FF_SEARCH_SW
 
 #endif // __CPIXHARVESTER_IBY__
--- a/searchui/indevicehandler/tsrc/t_indevicehandler/src/t_indevicehandler.cpp	Mon May 03 12:32:15 2010 +0300
+++ b/searchui/indevicehandler/tsrc/t_indevicehandler/src/t_indevicehandler.cpp	Fri May 14 15:53:17 2010 +0300
@@ -60,7 +60,7 @@
     InDeviceHandler* indevicehandler = new InDeviceHandler();
     indevicehandler->setCategory("file");
 
-    indevicehandler->searchAsync("a");
+    indevicehandler->searchAsync("txt");
     QTest::qWait(200);
 
     QSignalSpy spy(indevicehandler,
@@ -153,11 +153,12 @@
 int main(int argc, char *argv[])
     {
     QApplication app(argc, argv);
-    int error;
+    int error = 0;
     TRAPD(err,
             QTEST_DISABLE_KEYPAD_NAVIGATION
             SearchInDeviceHandlerTest tc;
             error = QTest::qExec(&tc, argc, argv););
+    Q_UNUSED(err);
     return error;
     }
 #else //Q_OS_SYMBIAN
--- a/searchui/rom/search.iby	Mon May 03 12:32:15 2010 +0300
+++ b/searchui/rom/search.iby	Fri May 14 15:53:17 2010 +0300
@@ -43,6 +43,10 @@
 //state provider dll
 file=/epoc32/release/armv5/urel/searchstateprovider.dll SHARED_LIB_DIR/searchstateprovider.dll
 
+
+// Stub sis
+data=DATAZ_\system\install\searchui_stub.sis             \System\Install\searchui_stub.sis
+
 #endif //FF_SEARCH_SW
 
 #endif // __SEARCH_IBY__
--- a/searchui/search_exports_to_rom.pri	Mon May 03 12:32:15 2010 +0300
+++ b/searchui/search_exports_to_rom.pri	Fri May 14 15:53:17 2010 +0300
@@ -17,4 +17,5 @@
 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
+    "./rom/searchresources.iby                LANGUAGE_APP_LAYER_IBY_EXPORT_PATH(searchresources.iby)"\
+    "./stubsis/searchui_stub.sis	/epoc32/data/z/system/install/searchui_stub.sis"
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/searchui/searchapplication/searchapplication.pkg	Fri May 14 15:53:17 2010 +0300
@@ -0,0 +1,68 @@
+
+; 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:  searchapplication package file
+
+; Language
+&EN
+
+; SIS header: name, uid, version
+#{"Searchapplication"},(0x2002C377),1,1,0, TYPE=SA, RU
+
+; Localised Vendor name
+%{"Vendor"}
+
+; Unique Vendor name
+:"Vendor"
+
+; Manual PKG pre-rules from PRO files
+; Default HW/platform dependencies
+[0x101F7961],0,0,0,{"S60ProductID"}
+[0x102032BE],0,0,0,{"S60ProductID"}
+[0x102752AE],0,0,0,{"S60ProductID"}
+[0x1028315F],0,0,0,{"S60ProductID"}
+ 
+; Default dependency to Qt libraries
+(0x2001E61C), 4, 5, 0, {"Qt"}
+
+; Executable and default resource files
+"/epoc32/release/armv5/urel/Searchapplication.exe"    - "!:\sys\bin\Searchapplication.exe"
+"/epoc32/data/z/private/10003a3f/import/apps/Searchapplication_reg.rsc"    - "!:\private\10003a3f\import\apps\Searchapplication_reg.rsc"
+
+
+; Indevice Habdler DLL DEPLOYMENT
+"/epoc32/release/armv5/urel/searchindevicehandler.dll"  - "!:\sys\bin\searchindevicehandler.dll"
+
+; RuntimeProvider DLL DEPLOYMENT
+"/epoc32/release/armv5/urel/searchruntimeprovider.dll"    - "!:\sys\bin\searchruntimeprovider.dll"
+
+
+; Stateprovider DLL DEPLOYMENT
+"/epoc32/release/armv5/urel/searchstateprovider.dll"    - "!:\sys\bin\searchstateprovider.dll"
+
+
+
+;Resource&Language file DEPLOYMENT
+
+"\epoc32\data\z\resource\apps\searchapplication.rsc"                 -  "!:\resource\apps\searchapplication.rsc"
+"\epoc32\data\z\resource\apps\searchapplication.r01"                 - "!:\resource\apps\searchapplication.r01"
+"\epoc32\data\z\resource\apps\searchapplication.r02"                 - "!:\resource\apps\searchapplication.r02"
+"\epoc32\data\z\resource\apps\searchapplication.r03"                 - "!:\resource\apps\searchapplication.r03"
+"\epoc32\data\z\resource\apps\searchapplication.r04"                 - "!:\resource\apps\searchapplication.r04"
+"\epoc32\data\z\resource\apps\searchapplication.r05"                 - "!:\resource\apps\searchapplication.r05"
+"\epoc32\data\z\resource\apps\searchapplication.r13"                 - "!:\resource\apps\searchapplication.r13"
+
+
+
+
+; Manual PKG post-rules from PRO files
--- a/searchui/stateproviders/searchstateprovider/inc/searchprogressivestate.h	Mon May 03 12:32:15 2010 +0300
+++ b/searchui/stateproviders/searchstateprovider/inc/searchprogressivestate.h	Fri May 14 15:53:17 2010 +0300
@@ -28,6 +28,7 @@
 #include <xqappmgr.h>
 #include <xqaiwrequest.h>
 #include "search_global.h"
+#include <f32file.h>
 
 //Uncomment to enable performance measurements.
 //#define OST_TRACE_COMPILER_IN_USE
@@ -61,7 +62,6 @@
 #define PERF_CAT_GETDOC_ACCUMULATOR_ENDLOG
 
 #endif //OST_TRACE_COMPILER_IN_USE
-
 class HbMainWindow;
 class HbView;
 class HbListView;
@@ -71,7 +71,8 @@
 class CFbsBitmap;
 class InDeviceHandler;
 class QCPixDocument;
-
+class NotesEditor;
+class EventViewerPluginInterface;
 SEARCH_CLASS( SearchStateProviderTest)
 /** @ingroup group_searchstateprovider
  * @brief The state where progressive search state is shown
@@ -150,8 +151,6 @@
     void setSelectedCategories();
 public slots:
 
-   
-
     /**
      * slot connects to CSearchHandler to get the status of search result asynchronously 
      * @since S60 ?S60_version.
@@ -226,26 +225,25 @@
      */
     void getrowsRemoved();
     /**
-        * slot added for Application manager
-        * @since S60 ?S60_version.
-        */
+     * slot added for Application manager
+     * @since S60 ?S60_version.
+     */
 
     void handleOk(const QVariant& var);
-    
+
     /**
-      * slot added for Application manager
-      * @since S60 ?S60_version.
-      */
+     * slot added for Application manager
+     * @since S60 ?S60_version.
+     */
 
     void handleError(int ret, const QString& var);
-    
+
     /**
-      * Slot implemented for particular category search 
-      * @since S60 ?S60_version.
-      */
+     * Slot implemented to delete the calenderviewer plugin  
+     * @since S60 ?S60_version.
+     */
 
-    
-    QString filterDoc(const QCPixDocument* aDoc,const QString& filter);
+    void _viewingCompleted();
 private:
 
     /**
@@ -287,6 +285,29 @@
      */
     QPixmap fromSymbianCFbsBitmap(CFbsBitmap *aBitmap);
 
+    /**
+     * Function to retrive drive number from the provided mediaId
+     *  @param aMediaId Unique media Id.
+     */
+    QString getDrivefromMediaId(QString aMediaId);
+
+    /**
+     * Function to launch the result item for application category 
+     *  @param aUid Unique app Id.
+     */
+    void LaunchApplicationL(const TUid aUid);
+
+    /**
+     * Function to parse the  QCPixDocument with the given filter       
+     */
+    QString filterDoc(const QCPixDocument* aDoc, const QString& filter);
+
+    /**
+     * Function to parse the  QCPixDocument with the given filters       
+     */
+    QStringList filterDoc(const QCPixDocument* aDoc, const QString& filter1,
+            const QString& filter2, const QString& filter3 = QString());
+
 signals:
 
     /**
@@ -322,7 +343,7 @@
      * Own.
      */
     HbSearchPanel* mSearchPanel;
-  
+
     /**
      * model for list view
      * Own.
@@ -393,11 +414,14 @@
     bool loadSettings;
     QList<HbIcon> mIconArray;
     HbIcon mIcon;
-	
+    RFs iFs;
+
+    EventViewerPluginInterface *calAgandaViewerPluginInstance;
+    NotesEditor *notesEditor;
 private:
     XQApplicationManager* mAiwMgr;
     XQAiwRequest* mRequest;
-	
+    QSize mListViewIconSize;
 #ifdef OST_TRACE_COMPILER_IN_USE
     QTime m_totalSearchUiTime;
     QTime m_categorySearchUiTime;
--- a/searchui/stateproviders/searchstateprovider/inc/settingswidget.h	Mon May 03 12:32:15 2010 +0300
+++ b/searchui/stateproviders/searchstateprovider/inc/settingswidget.h	Fri May 14 15:53:17 2010 +0300
@@ -29,6 +29,7 @@
 class HbDataForm;
 class HbRadioButtonList;
 class HbDataFormModelItem;
+class HbComboBox;
 
 SEARCH_CLASS(SearchStateProviderTest)
 
@@ -226,6 +227,11 @@
       */
 
     HbRadioButtonList* mradiolist;
+	
+    /** 
+     * combobox items
+     */    
+    HbComboBox *comboBox ;
 
     bool mInstialize;
     bool mchangestate;
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/searchui/stateproviders/searchstateprovider/resources/delimeterscreen.docml	Fri May 14 15:53:17 2010 +0300
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<hbdocument version="1.0">
+    <widget name="dialog" type="HbDialog">
+        <widget name="container" role="HbDialog:contentWidget" type="HbWidget">
+            <widget name="dataForm" type="HbDataForm">
+                <widget name="dataformviewItemPrototype" role="HbAbstractView:prototype" type="HbDataFormViewItem"/>
+                <enums name="verticalScrollBarPolicy" value="ScrollBarAutoHide"/>
+                <string name="description" value=""/>
+                <string name="heading" value=""/>
+            </widget>
+            <layout type="grid">
+                <griditem column="0" itemname="dataForm" row="0"/>
+            </layout>
+        </widget>
+        <size height="expr(var(hb-param-screen-height)-(var(hb-param-margin-gene-screen)*2  )  )" name="size" width="expr(var(hb-param-screen-width)-(var(hb-param-margin-gene-screen)*2   ) )"/>
+        <sizehint height="expr(var(hb-param-screen-height) -2*var(hb-param-margin-gene-screen) )" type="PREFERRED" width="expr(var(hb-param-screen-width) - 2*var(hb-param-margin-gene-screen) )"/>
+        <sizehint height="expr(var(hb-param-screen-height) - 2*var(hb-param-margin-gene-screen))" type="MINIMUM" width="expr(var(hb-param-screen-width) -2*var(hb-param-margin-gene-screen) )"/>
+        <sizehint height="expr(var(hb-param-screen-height) - 2*var(hb-param-margin-gene-screen) )" type="MAXIMUM" width="expr(var(hb-param-screen-width) - 2*var(hb-param-margin-gene-screen) )"/>
+        <enums name="dismissPolicy" value="NoDismiss"/>
+        <rect height="var(hb-param-screen-height)" name="geometry" width="var(hb-param-screen-width)" x="2un" y="2un"/>
+    </widget>
+    <metadata activeUIState="Common ui state" display="NHD landscape" unit="un">
+        <uistate name="Common ui state" sections="#common"/>
+    </metadata>
+</hbdocument>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/searchui/stateproviders/searchstateprovider/resources/searchstateprovider.docml	Fri May 14 15:53:17 2010 +0300
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<hbdocument version="1.0">
+    <widget name="tocView" type="HbView">
+        <widget name="content" role="HbView:widget" type="HbWidget">
+            <widget name="listView" type="HbListView">
+                <widget name="prototype" role="HbAbstractView:prototype" type="HbListViewItem">
+                    <enums name="graphicsSize" value="LargeIcon"/>
+                </widget>
+                <string name="layoutName" value="default"/>
+                <sizehint height="47.7612un" type="PREFERRED" width="35.8209un"/>
+            </widget>
+            <widget name="searchPanel" type="HbSearchPanel">
+                <sizepolicy horizontalPolicy="MinimumExpanding" horizontalStretch="0" verticalPolicy="Preferred" verticalStretch="0"/>
+            </widget>
+            <layout orientation="Vertical" type="linear">
+                <linearitem itemname="listView"/>
+                <linearitem itemname="searchPanel"/>
+            </layout>
+        </widget>
+        <string name="title" value="Search"/>
+    </widget>
+    <metadata activeUIState="Common ui state" display="NHD portrait" unit="un">
+        <uistate name="Common ui state" sections="#common"/>
+        <dummydata objectName="listView" section="#common" value="0"/>
+    </metadata>
+</hbdocument>
--- a/searchui/stateproviders/searchstateprovider/searchstateprovider.pro	Mon May 03 12:32:15 2010 +0300
+++ b/searchui/stateproviders/searchstateprovider/searchstateprovider.pro	Fri May 14 15:53:17 2010 +0300
@@ -46,6 +46,7 @@
 LIBS += -laknicon
 LIBS += -lapgrfx
 LIBS += -lbitgdi
+LIBS += -lnoteseditor
 
 
 coverage:DEFINES += COVERAGE_MEASUREMENT
--- a/searchui/stateproviders/searchstateprovider/src/searchprogressivestate.cpp	Mon May 03 12:32:15 2010 +0300
+++ b/searchui/stateproviders/searchstateprovider/src/searchprogressivestate.cpp	Fri May 14 15:53:17 2010 +0300
@@ -14,7 +14,6 @@
  * Description:  Implementation of the progressive search state.
  *
  */
-
 #include "searchprogressivestate.h"
 #include "indevicehandler.h"
 #include <qcpixdocument.h>
@@ -44,27 +43,31 @@
 #include <AknInternalIconUtils.h>
 #include <AknIconUtils.h> 
 #include <apgcli.h>
-
+#include <qpluginloader.h>
+#include <eventviewerplugininterface.h>
+#include <noteseditor.h>
+#include <w32std.h>
+#include <apgtask.h>
+#include <apgcli.h>
+#include <AknTaskList.h>
+#include <apacmdln.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);
 const int totalcategories = 10;
 // ---------------------------------------------------------------------------
 // SearchProgressiveState::SearchProgressiveState
 // ---------------------------------------------------------------------------
-//
 SearchProgressiveState::SearchProgressiveState(QState *parent) :
     QState(parent), mMainWindow(NULL), mView(NULL), mListView(NULL),
             mDocumentLoader(NULL), mModel(NULL), mSearchHandler(NULL),
-            mAiwMgr(0), mRequest(0)
+            notesEditor(0), mAiwMgr(0), mRequest(0)
     {
 
     mMainWindow = hbInstance->allMainWindows().at(0);
     mModel = new QStandardItemModel(this);
 
-   
     mAiwMgr = new XQApplicationManager;
 
     mDocumentLoader = new HbDocumentLoader();
@@ -96,8 +99,12 @@
                 prototype);
         if (prototypeListView)
             {
+            HbStyle style;
+            qreal x;
+            style.parameter("hb-param-graphic-size-primary-large", x);
+            QSizeF size(x, x);
+            mListViewIconSize = size.toSize();
             prototypeListView->setTextFormat(Qt::RichText);
-
             }
         mListView->setModel(mModel, prototype);
 
@@ -105,10 +112,8 @@
                 HbAbstractItemView::All;
         noCreationAndRemovalAnimations ^= HbAbstractItemView::Appear;
         noCreationAndRemovalAnimations ^= HbAbstractItemView::Disappear;
-
         mListView->setEnabledAnimations(noCreationAndRemovalAnimations);
         }
-    
 
     mSearchPanel = qobject_cast<HbSearchPanel *> (
             mDocumentLoader->findWidget(TUT_SEARCHPANEL_WIDGET));
@@ -148,7 +153,6 @@
         {
         mIconArray.append(getAppIconFromAppId(appUid[i]));
         }
-
 #ifdef OST_TRACE_COMPILER_IN_USE 
     //start() the timers to avoid worrying abt having to start()/restart() later
     m_categorySearchApiTime.start();
@@ -161,14 +165,12 @@
 // ---------------------------------------------------------------------------
 // SearchProgressiveState::~SearchProgressiveState
 // ---------------------------------------------------------------------------
-//
 SearchProgressiveState::~SearchProgressiveState()
     {
     if (mAiwMgr)
         {
         delete mAiwMgr;
         }
-   
     if (mModel)
         {
         delete mModel;
@@ -177,18 +179,18 @@
         {
         delete mDocumentLoader;
         }
-
     for (int i = 0; i < mSearchHandlerList.count(); i++)
         {
         delete mSearchHandlerList.at(i);
         }
-
+    if(notesEditor)
+        {
+        delete notesEditor;
+        }
     }
-
 // ---------------------------------------------------------------------------
 // SearchProgressiveState::constructHandlers
 // ---------------------------------------------------------------------------
-//
 void SearchProgressiveState::constructHandlers()
     {
     InDeviceHandler* handler = NULL;
@@ -251,16 +253,13 @@
         mSearchHandlerList.append(handler);
         }
     }
-
 // ---------------------------------------------------------------------------
 // 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  
@@ -282,17 +281,14 @@
 // ---------------------------------------------------------------------------
 // SearchProgressiveState::onExit
 // ---------------------------------------------------------------------------
-//
 void SearchProgressiveState::onExit(QEvent *event)
     {
     QState::onExit(event);
     deActivateSignals();
     }
-
 // ---------------------------------------------------------------------------
 // SearchProgressiveState::activateSignals
 // ---------------------------------------------------------------------------
-//
 void SearchProgressiveState::activateSignals()
     {
     for (int i = 0; i < mSearchHandlerList.count(); i++)
@@ -313,10 +309,8 @@
         {
         connect(mSearchPanel, SIGNAL(criteriaChanged(QString)), this,
                 SLOT(startNewSearch(QString)));
-
         connect(mSearchPanel, SIGNAL(searchOptionsClicked()), this,
                 SLOT(setSettings()));
-
         connect(mSearchPanel, SIGNAL(exitClicked()), this,
                 SLOT(cancelSearch()));
         }
@@ -324,7 +318,6 @@
         {
         connect(mModel, SIGNAL(rowsInserted(QModelIndex,int,int)), this,
                 SLOT(getrowsInserted()));
-
         connect(mModel, SIGNAL(rowsRemoved(QModelIndex,int,int)), this,
                 SLOT(getrowsRemoved()));
         }
@@ -332,7 +325,6 @@
 // ---------------------------------------------------------------------------
 // SearchProgressiveState::deActivateSignals
 // ---------------------------------------------------------------------------
-//
 void SearchProgressiveState::deActivateSignals()
     {
     for (int i = 0; i < mSearchHandlerList.count(); i++)
@@ -353,10 +345,8 @@
         {
         disconnect(mSearchPanel, SIGNAL(criteriaChanged(QString)), this,
                 SLOT(startNewSearch(QString)));
-
         disconnect(mSearchPanel, SIGNAL(searchOptionsClicked()), this,
                 SLOT(setSettings()));
-
         disconnect(mSearchPanel, SIGNAL(exitClicked()), this,
                 SLOT(cancelSearch()));
         }
@@ -364,7 +354,6 @@
         {
         disconnect(mModel, SIGNAL(rowsInserted(QModelIndex,int,int)), this,
                 SLOT(getrowsInserted()));
-
         disconnect(mModel, SIGNAL(rowsRemoved(QModelIndex,int,int)), this,
                 SLOT(getrowsRemoved()));
         }
@@ -372,13 +361,11 @@
 // ---------------------------------------------------------------------------
 // SearchProgressiveState::onAsyncSearchComplete
 // ---------------------------------------------------------------------------
-//
 void SearchProgressiveState::onAsyncSearchComplete(int aError,
         int aResultCount)
     {
     PERF_CAT_API_ENDLOG
     PERF_CAT_HITS_ENDLOG
-
     if (aError != 0)
         {
         //some error print logs
@@ -401,7 +388,6 @@
 // ---------------------------------------------------------------------------
 // SearchProgressiveState::onGetDocumentComplete
 // ---------------------------------------------------------------------------
-//
 void SearchProgressiveState::onGetDocumentComplete(int aError,
         QCPixDocument* aDoc)
     {
@@ -411,9 +397,8 @@
     QStringList liststr;
     QString secondrow = aDoc->excerpt();
     QString firstrow;
-
     //-------------- html tag creation-------------------
-    QString htmlTagPre = QString("<u>");
+   /* QString htmlTagPre = QString("<u>");
     QString htmlTagPost = QString("</u>");
     int insertpt = secondrow.indexOf(mOriginalString, 0, Qt::CaseInsensitive);
     if (insertpt >= 0)
@@ -423,101 +408,90 @@
         secondrow.insert(insertpt + mOriginalString.length()
                 + htmlTagPre.length(), htmlTagPost);
         }
-    //--------------------Html Tag Creation completed------------
+*/    //--------------------Html Tag Creation completed------------
     QStandardItem* listitem = new QStandardItem();
 
     if (aDoc->baseAppClass().contains("contact"))
         {
-        QString givename;
-        QString familyname;
-        bool bgivenname = false;
-        bool bfamilyname = false;
-        for (int i = 0; i < aDoc->fieldCount(); i++)
+        QStringList docsList = filterDoc(aDoc, "GivenName", "FamilyName");
+        if (docsList.value(0, "").length())
             {
-            if (!bgivenname && aDoc->field(i).name().contains("GivenName"))
-                {
-                givename.append(aDoc->field(i).value());
-                bgivenname = true;
-                }
-            if (!bfamilyname && aDoc->field(i).name().contains("FamilyName"))
-                {
-                familyname.append(aDoc->field(i).value());
-                bfamilyname = true;
-                }
-            if (bgivenname && bfamilyname)
-                break;
+            firstrow.append(docsList.at(0));
             }
-        if (givename.length())
-            {
-            firstrow.append(givename);
-            }
-        if (familyname.length())
+        if (docsList.value(1, "").length())
             {
             if (firstrow.length())
                 firstrow.append(" ");
-            firstrow.append(familyname);
+            firstrow.append(docsList.at(1));
             }
         if (firstrow.length() == 0)
             {
-            firstrow = hbTrId("txt_phob_list_unknown");
+            firstrow = hbTrId("txt_phob_dblist_unnamed");
             }
         liststr << firstrow << secondrow;
         listitem->setData(mIconArray.at(0), Qt::DecorationRole);
         }
     else if (aDoc->baseAppClass().contains("audio"))
         {
-        firstrow.append(filterDoc(aDoc, "Title"));
+        QStringList audioList = filterDoc(aDoc, "Title", "MediaId");
+        if (audioList.value(0, "").length())
+            {
+            firstrow.append(audioList.at(0));
+            }
         if (firstrow.length() == 0)
             {
             firstrow = hbTrId("txt_mus_dblist_val_unknown4");
             }
         liststr << firstrow << secondrow;
         listitem->setData(mIconArray.at(1), Qt::DecorationRole);
+        if (audioList.value(1, "").length())
+            {
+            listitem->setData(audioList.at(1), Qt::UserRole + 2);
+            }
         }
     else if (aDoc->baseAppClass().contains("video"))
         {
-        firstrow.append(filterDoc(aDoc, "Title"));
-        if (firstrow.length() == 0)
+        QStringList videoList = filterDoc(aDoc, "Title", "MediaId","Name");
+        if (videoList.value(0, "").length())
             {
-            firstrow.append(filterDoc(aDoc, "Name"));
+            firstrow.append(videoList.at(0));
+            }
+        if (firstrow.length() == 0 && videoList.value(2, "").length())
+            {
+            firstrow.append(videoList.at(2));
             }
         liststr << firstrow << secondrow;
         listitem->setData(mIconArray.at(2), Qt::DecorationRole);
+        if (videoList.value(1, "").length())
+            {
+            listitem->setData(videoList.at(1), Qt::UserRole + 2);
+            }
         }
     else if (aDoc->baseAppClass().contains("image"))
         {
-        firstrow.append(filterDoc(aDoc, "Name"));
+        QStringList imageList = filterDoc(aDoc, "Name", "MediaId");
+        if (imageList.value(0, "").length())
+            {
+            firstrow.append(imageList.at(0));
+            }
         liststr << firstrow << secondrow;
         listitem->setData(mIconArray.at(3), Qt::DecorationRole);
+        if (imageList.value(1, "").length())
+            {
+            listitem->setData(imageList.at(1), Qt::UserRole + 2);
+            }
         }
     else if (aDoc->baseAppClass().contains("msg"))
         {
-        QString subject;
-        QString body;
-        bool bsubject = false;
-        bool bbody = false;
-        for (int i = 0; i < aDoc->fieldCount(); i++)
+        QStringList msgList = filterDoc(aDoc, "Subject", "Body");
+        if (msgList.value(0, "").length())
             {
-            if (!bsubject && aDoc->field(i).name().contains("Subject"))
-                {
-                subject.append(aDoc->field(i).value());
-                bsubject = true;
-                }
-            if (!bbody && aDoc->field(i).name().contains("Body"))
-                {
-                body.append(aDoc->field(i).value());
-                bbody = true;
-                }
-            if (bsubject && bbody)
-                break;
-            }
-        if (subject.length())
-            {
-            firstrow.append(subject);
+            firstrow.append(msgList.at(0));
             }
         else
             {
-            firstrow.append(body);
+            if (msgList.value(1, "").length())
+                firstrow.append(msgList.at(1));
             }
         if (firstrow.length() == 0)
             {
@@ -533,7 +507,7 @@
         }
     else if (aDoc->baseAppClass().contains("calendar"))
         {
-        firstrow.append(filterDoc(aDoc, "Description"));
+        firstrow.append(filterDoc(aDoc, "Summary"));
         if (firstrow.length() == 0)
             {
             firstrow = hbTrId("txt_calendar_preview_unnamed");
@@ -550,10 +524,12 @@
             firstrow = hbTrId("txt_notes_dblist_unnamed");
             }
         liststr << firstrow << secondrow;
+        listitem->setData(mIconArray.at(7), Qt::DecorationRole);
         }
     else if (aDoc->baseAppClass().contains("applications"))
         {
-        liststr << secondrow;
+        firstrow.append(filterDoc(aDoc, "Name"));
+        liststr << firstrow;
         bool ok;
         listitem->setData(getAppIconFromAppId(TUid::Uid(aDoc->docId().toInt(
                 &ok, 16))), Qt::DecorationRole);
@@ -569,25 +545,21 @@
         }
     else if (aDoc->baseAppClass().contains("file"))
         {
-        firstrow.append(filterDoc(aDoc, "BaseName"));
+        firstrow.append(filterDoc(aDoc, "Name"));
         if (firstrow.length() == 0)
             firstrow = aDoc->baseAppClass();
         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);
-
     delete aDoc;
     }
 // ---------------------------------------------------------------------------
 // SearchProgressiveState::getSettingCategory
 // ---------------------------------------------------------------------------
-//
 void SearchProgressiveState::getSettingCategory(int item, bool avalue)
     {
     mSelectedCategory.insert(item, avalue);
@@ -595,7 +567,6 @@
 // ---------------------------------------------------------------------------
 // SearchProgressiveState::getrowsInserted
 // ---------------------------------------------------------------------------
-//
 void SearchProgressiveState::getrowsInserted()
     {
     mResultparser++;
@@ -613,7 +584,6 @@
 // ---------------------------------------------------------------------------
 // SearchProgressiveState::getrowsRemoved
 // ---------------------------------------------------------------------------
-//
 void SearchProgressiveState::getrowsRemoved()
     {
     if (mModel->rowCount() != 0)
@@ -626,6 +596,9 @@
         if (mOriginalString.length())
             {
             mDatabasecount = 0;
+            /*mSearchString = "$prefix(\"";
+            mSearchString += mOriginalString;
+            mSearchString += "\")";*/
             mSearchString = mOriginalString;
             mSearchString.append('*');
             searchOnCategory(mSearchString);
@@ -635,200 +608,229 @@
 // ---------------------------------------------------------------------------
 // SearchProgressiveState::openResultitem
 // ---------------------------------------------------------------------------
-//
 void SearchProgressiveState::openResultitem(QModelIndex index)
     {
     QStandardItem* item = mModel->itemFromIndex(index);
-    QString baseclass = item->data(Qt::UserRole + 1).toString();
+    QList<QVariant> args;
+    bool t;
+    mRequest = NULL;
+    if (item->data(Qt::UserRole + 1).toString().contains("contact"))
+        {
+        mRequest = mAiwMgr->create("com.nokia.services.phonebookservices",
+                "Fetch", "open(int)", false);
 
-    QVariant retValue;
-    bool t;
-    if (baseclass.contains("contact"))
+        int uid = (item->data(Qt::UserRole)).toInt(&t);
+        args << uid;
+        }
+    else if (item->data(Qt::UserRole + 1).toString().contains("bookmark"))
         {
 
-        mRequest = mAiwMgr->create("com.nokia.services.phonebookservices",
-                "Fetch", "open(int)", false);
+        }
+    else if (item->data(Qt::UserRole + 1).toString().contains("calendar"))
+        {
+        QDir pluginDir = QDir(QString("z:/resource/qt/plugins/calendar"));
+        QPluginLoader *calAgandaViewerPluginLoader = new QPluginLoader(
+                pluginDir.absoluteFilePath(QString(
+                        "agendaeventviewerplugin.qtplugin")));
+
+        calAgandaViewerPluginInstance = qobject_cast<
+                EventViewerPluginInterface *> (
+                calAgandaViewerPluginLoader->instance());
+
+        connect(calAgandaViewerPluginInstance, SIGNAL(viewingCompleted()),
+                this, SLOT(_viewingCompleted()));
+
+        calAgandaViewerPluginInstance->viewEvent(
+                item->data(Qt::UserRole).toInt(),
+                EventViewerPluginInterface::ActionEditDelete, NULL);
+        }
+    else if (item->data(Qt::UserRole + 1).toString().contains("applications"))
+        {
+        TRAPD(err,
+                    {LaunchApplicationL(TUid::Uid((item->data(Qt::UserRole)).toString().toInt(&t, 16)));})
+        if (err == KErrNone)
+            {
+            }
+        }
+    else if (item->data(Qt::UserRole + 1).toString().contains("file"))
+        {
+        }
+    else if (item->data(Qt::UserRole + 1).toString().contains("video"))
+        {
+        mRequest = mAiwMgr->create("com.nokia.videos", "IVideoView",
+                "playMedia(QString)", false);
+
+        QString uid = getDrivefromMediaId(
+                item->data(Qt::UserRole + 2).toString());
+        uid.append(':');
+        uid.append(item->data(Qt::UserRole).toString());
+        args << uid;
+        }
+    else if (item->data(Qt::UserRole + 1).toString().contains("audio"))
+        {
+        QString uid = getDrivefromMediaId(
+                item->data(Qt::UserRole + 2).toString());
+        uid.append(':');
+        uid.append(item->data(Qt::UserRole).toString());
+        mRequest = mAiwMgr->create("musicplayer",
+                "com.nokia.symbian.IFileView", "view(QString)", false);
+        args << uid;
+        }
+    else if (item->data(Qt::UserRole + 1).toString().contains("image"))
+        {
+        QString uid = getDrivefromMediaId(
+                item->data(Qt::UserRole + 2).toString());
+        uid.append(':');
+        uid.append(item->data(Qt::UserRole).toString());
+        mRequest = mAiwMgr->create("com.nokia.services.media",
+                "com.nokia.symbian.IFileView", "view(QString)", false);
+        args << uid;
+        }
+    else if (item->data(Qt::UserRole + 1).toString().contains("notes"))
+        {
+        if (!notesEditor)
+            {
+            notesEditor = new NotesEditor(this);
+            }
+        notesEditor->edit(item->data(Qt::UserRole).toInt());
+        }
+    else if (item->data(Qt::UserRole + 1).toString().contains("msg"))
+        {
+        mRequest = mAiwMgr->create("com.nokia.services.hbserviceprovider",
+                "conversationview", "view(int)", false);
+
+        int uid = (item->data(Qt::UserRole)).toInt(&t);
+        args << uid;
+        }
+    if (mRequest)
+        {
         connect(mRequest, SIGNAL(requestOk(const QVariant&)), this,
                 SLOT(handleOk(const QVariant&)));
-        // Connect error handling signal or apply lastError function instead.
         connect(mRequest, SIGNAL(requestError(int,const QString&)), this,
-                SLOT(handleError(int,const QString&)));
-
-        if (!mRequest)
-            {
-            qDebug() << "AIW-ERROR: NULL request";
-            return;
-            }
-
-        int uid = (item->data(Qt::UserRole)).toInt(&t);
-        QList<QVariant> args;
-        args << uid;
+                SLOT(handleError(int,const QString&)));// Connect error handling signal or apply lastError function instead.
         mRequest->setArguments(args);
-        // Make the request
-        if (!mRequest->send())
+        if (!mRequest->send())// Make the request
             {
             qDebug() << "AIW-ERROR: Send failed" << mRequest->lastError();
             }
-        delete mRequest;
-
-        }
-    else if (baseclass.contains("msg"))
-        {
-        int uid = (item->data(Qt::UserRole)).toInt(&t);
-
-        mRequest = mAiwMgr->create("com.nokia.services.hbserviceprovider",
-                "conversationview", "view(qint64)", false);
-        connect(mRequest, SIGNAL(requestOk(const QVariant&)), this,
+        disconnect(mRequest, SIGNAL(requestOk(const QVariant&)), this,
                 SLOT(handleOk(const QVariant&)));
-        // Connect error handling signal or apply lastError function instead.
-        connect(mRequest, SIGNAL(requestError(int,const QString&)), this,
-                SLOT(handleError(int,const QString&)));
-
-        if (!mRequest)
-            {
-            qDebug() << "AIW-ERROR: NULL request";
-            return;
-            }
-
-        QList<QVariant> args;
-        args << uid;
-        retValue = mRequest->send();
-        delete mRequest;
+        disconnect(mRequest, SIGNAL(requestError(int,const QString&)), this,
+                SLOT(handleError(int,const QString&)));// Connect error handling signal or apply lastError function instead.
+        mRequest->deleteLater();
         }
-    else if (baseclass.contains("video"))
+    else
         {
-        QString uid = item->data(Qt::UserRole).toString();
-        mRequest = mAiwMgr->create("com.nokia.videos", "IVideoView",
-                "playMedia(QString)", false);
-        connect(mRequest, SIGNAL(requestOk(const QVariant&)), this,
-                SLOT(handleOk(const QVariant&)));
-        // Connect error handling signal or apply lastError function instead.
-        connect(mRequest, SIGNAL(requestError(int,const QString&)), this,
-                SLOT(handleError(int,const QString&)));
-
-        QList<QVariant> args;
-        args << uid;
-        retValue = mRequest->send();
-        delete mRequest;
+        qDebug() << "AIW-ERROR: NULL request";
+        return;
         }
-
     }
 // ---------------------------------------------------------------------------
 // SearchProgressiveState::handleOk
 // ---------------------------------------------------------------------------
-//
-void SearchProgressiveState::handleOk(const QVariant& /*var*/)
+void SearchProgressiveState::handleOk(const QVariant& var)
     {
-
+    Q_UNUSED(var);
     }
 // ---------------------------------------------------------------------------
 // SearchProgressiveState::handleError
 // ---------------------------------------------------------------------------
-//
-void SearchProgressiveState::handleError(int /*ret*/, const QString& /*var*/)
+void SearchProgressiveState::handleError(int ret, const QString& var)
     {
-
+    Q_UNUSED(ret);
+    Q_UNUSED(var);
     }
 // ---------------------------------------------------------------------------
 // SearchProgressiveState::createSuggestionLink
 // ---------------------------------------------------------------------------
-//
 void SearchProgressiveState::createSuggestionLink(bool aFlag)
     {
-    QStandardItem* listitem = new QStandardItem();    
-    QString htmlKeyword = QString("<u>%1</u>").arg(mOriginalString);
+    QStandardItem* listitem = new QStandardItem();   
     if (!aFlag)
         {
-        QString linkString = QString(hbTrId(
-                "txt_search_list_search_for_1_on_2").arg(htmlKeyword));
+        QString linkString = QString(hbTrId("txt_search_list_search_for_1").arg(mOriginalString));
         mLinkindex = mModel->rowCount();
         listitem->setData(linkString, Qt::DisplayRole);
- 
         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"));
+                "txt_search_list_no_match_found"));
         listitem->setData(noResultMsg, Qt::DisplayRole);
         mModel->appendRow(listitem);
         }
-
     }
 // ---------------------------------------------------------------------------
 // SearchProgressiveState::clear
 // ---------------------------------------------------------------------------
-//
 void SearchProgressiveState::clear()
     {
     if (mModel)
         {
-        mModel->removeRows(0, mModel->rowCount());      
+        mModel->removeRows(0, mModel->rowCount());
         }
     }
 // ---------------------------------------------------------------------------
 // SearchProgressiveState::searchOnCategory
 // ---------------------------------------------------------------------------
-//
 void SearchProgressiveState::searchOnCategory(const QString aKeyword)
     {
 #ifdef OST_TRACE_COMPILER_IN_USE
-    if( mDatabasecount != 0 ){//Search just started.
+    if( mDatabasecount != 0 )
+        {//Search just started.
         PERF_CAT_UI_ENDLOG
-    }
+        }
     PERF_CAT_UI_TIME_RESTART
 #endif
     mResultparser = 0;
     mResultcount = 0;
     if (mDatabasecount < mTemplist.count())
         {
-        QString str = mTemplist.at(mDatabasecount);
-        if (str.contains("selectall"))
+        if (mTemplist.at(mDatabasecount).contains("selectall"))
             {
-            // mSearchHandler = mSearchHandlerList.at(0);
+            mSearchHandler = mSearchHandlerList.at(0);
             }
-        else if (str.contains("contact"))
+        else if (mTemplist.at(mDatabasecount).contains("contact"))
             {
             mSearchHandler = mSearchHandlerList.at(1);
             }
-        else if (str.contains("media"))
+        else if (mTemplist.at(mDatabasecount).contains("media"))
             {
             mSearchHandler = mSearchHandlerList.at(2);
             }
-        else if (str.contains("msg"))
+        else if (mTemplist.at(mDatabasecount).contains("msg"))
             {
             mSearchHandler = mSearchHandlerList.at(3);
             }
-        else if (str.contains("email"))
+        else if (mTemplist.at(mDatabasecount).contains("email"))
             {
             mSearchHandler = mSearchHandlerList.at(4);
             }
-        else if (str.contains("calendar"))
+        else if (mTemplist.at(mDatabasecount).contains("calendar"))
             {
             mSearchHandler = mSearchHandlerList.at(5);
             }
-        else if (str.contains("notes"))
+        else if (mTemplist.at(mDatabasecount).contains("notes"))
             {
             mSearchHandler = mSearchHandlerList.at(6);
             }
-        else if (str.contains("applications"))
+        else if (mTemplist.at(mDatabasecount).contains("applications"))
             {
             mSearchHandler = mSearchHandlerList.at(7);
             }
-        else if (str.contains("file"))
+        else if (mTemplist.at(mDatabasecount).contains("file"))
             {
             mSearchHandler = mSearchHandlerList.at(8);
             }
-        else if (str.contains("bookmark"))
+        else if (mTemplist.at(mDatabasecount).contains("bookmark"))
             {
             mSearchHandler = mSearchHandlerList.at(9);
             }
@@ -843,23 +845,20 @@
     else if (mDatabasecount >= mTemplist.count())
         {
         PERF_TOTAL_UI_ENDLOG
-        if (mListView->indexCount() == 0 && aKeyword.length() != 0)
+        if (mModel->rowCount() == 0 && aKeyword.length() != 0)
             {
             noResultsFound(mOriginalString);
             createSuggestionLink(0);
             }
         return;
         }
-
     }
 // ---------------------------------------------------------------------------
 // SearchProgressiveState::startNewSearch
 // ---------------------------------------------------------------------------
-//
 void SearchProgressiveState::startNewSearch(const QString &aKeyword)
     {
     PERF_CAT_TOTAL_TIME_RESTART
-
     mOriginalString = aKeyword.trimmed();
     for (int i = 0; i < mSearchHandlerList.count(); i++)
         {
@@ -873,6 +872,10 @@
         {
         mDatabasecount = 0;
         mLinkindex = 0;
+        //Prefix query
+        /*mSearchString = "$prefix(\"";
+        mSearchString += mOriginalString;
+        mSearchString += "\")";*/
         mSearchString = mOriginalString;
         mSearchString.append('*');
         searchOnCategory(mSearchString);
@@ -881,7 +884,6 @@
 // ---------------------------------------------------------------------------
 // SearchProgressiveState::setSettings
 // ---------------------------------------------------------------------------
-//
 void SearchProgressiveState::setSettings()
     {
     mTempSelectedCategory = mSelectedCategory;
@@ -890,7 +892,6 @@
 // ---------------------------------------------------------------------------
 // SearchProgressiveState::_customizeGoButton
 // ---------------------------------------------------------------------------
-//
 void SearchProgressiveState::_customizeGoButton(bool avalue)
     {
     if (mSearchPanel)
@@ -908,7 +909,6 @@
 // ---------------------------------------------------------------------------
 // SearchProgressiveState::settingsaction
 // ---------------------------------------------------------------------------
-//
 void SearchProgressiveState::settingsaction(bool avalue)
     {
     if (avalue)
@@ -919,11 +919,7 @@
             {
             i.next();
             j.next();
-            if (i.value() == j.value())
-                {
-
-                }
-            else
+            if (i.value() != j.value())
                 {
                 startNewSearch(mOriginalString);
                 break;
@@ -934,11 +930,11 @@
 // ---------------------------------------------------------------------------
 // SearchProgressiveState::setSelectedCategories
 // ---------------------------------------------------------------------------
-//
 void SearchProgressiveState::setSelectedCategories()
     {
     mTemplist.clear();
     QMapIterator<int, bool> i(mSelectedCategory);
+    bool isrootsearch = false;
     while (i.hasNext())
         {
         i.next();
@@ -948,7 +944,8 @@
                 {
                 case 0:
                     {
-                    //mTemplist.append("selectall");
+                    isrootsearch = true;
+                    // mTemplist.append("selectall");
                     break;
                     }
                 case 1: //Contacts
@@ -991,11 +988,17 @@
                 }
             }
         }
+    if (mTemplist.count() == 8)
+        isrootsearch = true;
+    if (isrootsearch)
+        {
+        mTemplist.clear();
+        mTemplist.append("selectall");
+        }
     }
 // ---------------------------------------------------------------------------
 // SearchProgressiveState::cancelSearch
 // ---------------------------------------------------------------------------
-//
 void SearchProgressiveState::cancelSearch()
     {
     for (int i = 0; i < mSearchHandlerList.count(); i++)
@@ -1006,7 +1009,6 @@
 // ---------------------------------------------------------------------------
 // SearchProgressiveState::getAppIconFromAppId
 // ---------------------------------------------------------------------------
-//
 HbIcon SearchProgressiveState::getAppIconFromAppId(TUid auid)
     {
     HbIcon icon;
@@ -1014,7 +1016,6 @@
     CFbsBitmap* bitmap = NULL;
     CFbsBitmap* mask = NULL;
     QPixmap pixmap;
-
     MAknsSkinInstance* skin = AknsUtils::SkinInstance();
     if (skin)
         {
@@ -1033,17 +1034,15 @@
                         aknIcon->SetMask(mask);});
             if (err1 == KErrNone)
                 {
-
                 }
             }
         }
     if (aknIcon)
-        {       
+        {
         //need to disable compression to properly convert the bitmap
         AknIconUtils::DisableCompression(aknIcon->Bitmap());
-
-        AknIconUtils::SetSize(aknIcon->Bitmap(), TSize(
-                defaultIconSize.width(), defaultIconSize.height()),
+        AknIconUtils::SetSize(aknIcon->Bitmap(), TSize(mListViewIconSize.width(),
+                mListViewIconSize.height()),
                 EAspectRatioPreservedAndUnusedSpaceRemoved);
         if (aknIcon->Bitmap()->Header().iCompression == ENoBitmapCompression)
             {
@@ -1067,14 +1066,10 @@
                             pixmap.setAlphaChannel(mask);});
                 if (err1 == KErrNone)
                     {
-
                     }
                 }
-
             }
-
-        pixmap = pixmap.scaled(defaultIconSize,
-                Qt::KeepAspectRatioByExpanding);
+        pixmap = pixmap.scaled(mListViewIconSize, Qt::KeepAspectRatioByExpanding);
         icon = HbIcon(QIcon(pixmap));
         }
     return icon;
@@ -1082,7 +1077,6 @@
 // ---------------------------------------------------------------------------
 // SearchProgressiveState::TDisplayMode2Format
 // ---------------------------------------------------------------------------
-//
 QImage::Format SearchProgressiveState::TDisplayMode2Format(TDisplayMode mode)
     {
     QImage::Format format;
@@ -1122,19 +1116,15 @@
 // ---------------------------------------------------------------------------
 // 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));
+            displayMode));// QImage format must match to bitmap format
     aBitmap->EndDataAccess();
-
     // No data copying happens because image format matches native OpenVG format.
     // So QPixmap actually points to CFbsBitmap data.
     return QPixmap::fromImage(image);
@@ -1142,7 +1132,6 @@
 // ---------------------------------------------------------------------------
 // SearchProgressiveState::copyBitmapLC
 // ---------------------------------------------------------------------------
-//
 CFbsBitmap *SearchProgressiveState::copyBitmapLC(CFbsBitmap *input)
     {
     CFbsBitmap *bmp = new (ELeave) CFbsBitmap();
@@ -1160,7 +1149,6 @@
 // ---------------------------------------------------------------------------
 // SearchProgressiveState::filterDoc
 // ---------------------------------------------------------------------------
-//
 QString SearchProgressiveState::filterDoc(const QCPixDocument* aDoc,
         const QString& filter)
     {
@@ -1173,3 +1161,132 @@
         }
     return NULL;
     }
+// ---------------------------------------------------------------------------
+// SearchProgressiveState::filterDoc
+// ---------------------------------------------------------------------------
+QStringList SearchProgressiveState::filterDoc(const QCPixDocument* aDoc,
+        const QString& filter1, const QString& filter2,
+        const QString& filter3)
+    {
+    QStringList docList;
+    docList.append(QString());
+    docList.append(QString());
+    docList.append(QString());
+    bool bfilter1 = false;
+    bool bfilter2 = false;
+    bool bfilter3 = false;
+    if (!filter3.length())
+        {
+        bfilter3 = true;
+        }
+    for (int i = 0; i < aDoc->fieldCount(); i++)
+        {
+        if (!bfilter1 && aDoc->field(i).name().contains(filter1))
+            {
+            docList.replace(0, aDoc->field(i).value());
+            bfilter1 = true;
+            }
+        if (!bfilter2 && aDoc->field(i).name().contains(filter2))
+            {
+            docList.replace(1, aDoc->field(i).value());
+            bfilter2 = true;
+            }
+        if (!bfilter3 && aDoc->field(i).name().contains(filter3))
+            {
+            docList.replace(2, aDoc->field(i).value());
+            bfilter3 = true;
+            }
+        if (bfilter1 && bfilter2 && bfilter3)
+            break;
+        }
+    return docList;
+    }
+// ---------------------------------------------------------------------------
+// SearchProgressiveState::getDrivefromMediaId
+// ---------------------------------------------------------------------------
+QString SearchProgressiveState::getDrivefromMediaId(QString aMediaId)
+    {
+    TBuf<15> mediaIdBuf(aMediaId.utf16());
+    if (KErrNone == iFs.Connect())
+        {
+        TUint mediaNum;
+        TVolumeInfo vmInfo;
+        TChar driveLetter;
+        TLex lex(mediaIdBuf);
+        lex.Val(mediaNum);
+        TDriveNumber drive = TDriveNumber(KErrNotSupported);
+
+        for (TInt i = 0; i <= EDriveZ; i++)
+            {
+            TInt err = iFs.Volume(vmInfo, i);// Volume() returns KErrNotReady if no volume present.       
+            if (err != KErrNotReady)// In this case, check next drive number
+                {
+                if (vmInfo.iUniqueID == mediaNum)
+                    {
+                    drive = TDriveNumber(i);//Is the drive
+                    if (KErrNone == iFs.DriveToChar(drive, driveLetter))
+                        {
+                        mediaIdBuf.Zero();
+                        mediaIdBuf.Append(driveLetter);
+                        mediaIdBuf.LowerCase();
+                        }
+                    break;
+                    }
+                }
+            }
+        iFs.Close();
+        }
+    return QString::fromUtf16(mediaIdBuf.Ptr(), mediaIdBuf.Length());
+    }
+// ---------------------------------------------------------------------------
+// SearchProgressiveState::LaunchApplicationL
+// ---------------------------------------------------------------------------
+void SearchProgressiveState::LaunchApplicationL(const TUid aUid)
+    {
+    RWsSession wsSession;
+    User::LeaveIfError(wsSession.Connect());
+    CleanupClosePushL<RWsSession> (wsSession);
+    CAknTaskList *taskList = CAknTaskList::NewL(wsSession);
+    TApaTask task = taskList->FindRootApp(aUid);
+    delete taskList;
+    if (task.Exists())
+        {
+        task.BringToForeground();
+        }
+    else
+        {
+        TApaAppInfo appInfo;
+        TApaAppCapabilityBuf capabilityBuf;
+        RApaLsSession appArcSession;
+        User::LeaveIfError(appArcSession.Connect());
+        CleanupClosePushL<RApaLsSession> (appArcSession);
+        User::LeaveIfError(appArcSession.GetAppInfo(appInfo, aUid));
+        User::LeaveIfError(
+                appArcSession.GetAppCapability(capabilityBuf, aUid));
+        TApaAppCapability &caps = capabilityBuf();
+        TFileName appName = appInfo.iFullName;
+        CApaCommandLine *cmdLine = CApaCommandLine::NewLC();
+        cmdLine->SetExecutableNameL(appName);
+        if (caps.iLaunchInBackground)
+            {
+            cmdLine->SetCommandL(EApaCommandBackground);
+            }
+        else
+            {
+            cmdLine->SetCommandL(EApaCommandRun);
+            }
+        //cmdLine->SetTailEndL(aParam);
+        User::LeaveIfError(appArcSession.StartApp(*cmdLine));
+        CleanupStack::PopAndDestroy(cmdLine);
+        CleanupStack::PopAndDestroy(&appArcSession);
+        }
+    CleanupStack::PopAndDestroy(&wsSession);
+    }
+// ---------------------------------------------------------------------------
+// SearchProgressiveState::_viewingCompleted
+// ---------------------------------------------------------------------------
+void SearchProgressiveState::_viewingCompleted()
+    {
+    if (calAgandaViewerPluginInstance)
+        calAgandaViewerPluginInstance->deleteLater();
+    }
--- a/searchui/stateproviders/searchstateprovider/src/settingswidget.cpp	Mon May 03 12:32:15 2010 +0300
+++ b/searchui/stateproviders/searchstateprovider/src/settingswidget.cpp	Fri May 14 15:53:17 2010 +0300
@@ -48,7 +48,7 @@
 //----------------------------------------------------------------------------------------------------------------------------
 SettingsWidget::SettingsWidget() :
     signalMapper(NULL), popup(NULL), mDocumentLoader(NULL), dataform(NULL),
-            mModel(NULL),mSelectedScope(0),mSelectedProvider(0)
+            mModel(NULL),mSelectedScope(0),mSelectedProvider(0),comboBox(NULL)
     {
     for (int i = 0; i < 8; i++)
         {
@@ -130,7 +130,7 @@
 
     HbDataFormModelItem* themeComboGeneral = mModel->appendDataFormItem(
             HbDataFormModelItem::ComboBoxItem, hbTrId(
-                    "txt_search_qtl_dialog_pri_heading_delimiter"));
+                    "txt_search_info_select_search_scope"));
 
     themeComboGeneral->setContentWidgetData(QString("items"), mCategoryList);
 
@@ -139,9 +139,9 @@
 
     QModelIndex index = mModel->indexFromItem(themeComboGeneral);
 
-    HbDataFormViewItem *formItem = dataform->dataFormViewItem(index);
+    HbDataFormViewItem *formItem = static_cast<HbDataFormViewItem *> (dataform->itemByIndex(index));
 
-    HbComboBox *comboBox =
+      comboBox =
             static_cast<HbComboBox*> (formItem->dataItemContentWidget());
 
     q_currentIndexChanged(mSelectedScope);
@@ -175,7 +175,7 @@
             mModelItemList.append(mModelItem);
             QModelIndex index = mModel->indexFromItem(mModelItem);
 
-            HbDataFormViewItem *formItem = dataform->dataFormViewItem(index);
+            HbDataFormViewItem *formItem = static_cast<HbDataFormViewItem *> (dataform->itemByIndex(index));
 
             checkboxitem
                     = static_cast<HbCheckBox*> (formItem->dataItemContentWidget());
@@ -205,7 +205,7 @@
 
         QModelIndex index = mModel->indexFromItem(mModelItem);
 
-        HbDataFormViewItem *formItem = dataform->dataFormViewItem(index);
+        HbDataFormViewItem *formItem = static_cast<HbDataFormViewItem *> (dataform->itemByIndex(index));
 
         mradiolist
                 = static_cast<HbRadioButtonList*> (formItem->dataItemContentWidget());
@@ -272,7 +272,7 @@
     
    // mCategoryDbMapping.insert("email", true); // to remove once email starts working
     
-    mDeviceListDisplay.append("Select all");
+    mDeviceListDisplay.append(hbTrId("txt_search_list_select_all"));
     mDeviceMapping.insert(0, true);
 
     if (mCategoryDbMapping.value("Contacts"))
@@ -320,7 +320,7 @@
         mDeviceListDisplay.append(hbTrId("txt_search_list_all_other_files"));
         mDeviceMapping.insert(7, true);
         }
-    internetCategoryList = (QStringList() << "Google" << "Bing");
+    internetCategoryList = (QStringList());
 
     mCategoryList = (QStringList() << hbTrId("txt_search_list_device")
             << hbTrId("txt_search_list_internet"));
@@ -355,7 +355,8 @@
         initialize();
         mInstialize = false;
         }
-    q_currentIndexChanged(mSelectedScope);
+    comboBox->setCurrentIndex(mSelectedScope);
+    loadDeviceSettings();
     setActionVisibility();
     popup->show();
     }
--- a/searchui/stateproviders/searchstateprovider/tsrc/t_searchstateprovider/inc/t_searchstateprovider.h	Mon May 03 12:32:15 2010 +0300
+++ b/searchui/stateproviders/searchstateprovider/tsrc/t_searchstateprovider/inc/t_searchstateprovider.h	Fri May 14 15:53:17 2010 +0300
@@ -45,30 +45,36 @@
     void testCreateProgressiveState();
     void testCreateSettingsState();
     void testCreateinitState();
-     /**
+    /**
      * t_searchprogressivestate.cpp
      */
 
     void testProgressiveStateConstruction();
     void testProgressiveStateOnEntryAndExitSignalled();
+    void testgetAppIconFromAppId();
+    void testsetSelectedCategories();
     void testonAsyncSearchComplete();
     void testonGetDocumentComplete();
+    void testopenResultitem();
     void testgetSettingCategory();
-    void testopenResultitem();
-    void testcreateSuggestionLink();
-    void testnoResultsFound();
-    void testclear();
-    void testsearchOnCategory();
-    void teststartNewSearch();
     void testsetSettings();
-    void test_CustomizeGoButton();
-    void testgetAppIconFromAppId();
+    void teststartNewSearch();
+    void test_customizeGoButton();
     void testsettingsaction();
-    void testcancelsearch();
-    void testhandleokanderror();
+    void testcancelSearch();
+    void testgetrowsInserted();
+    void testgetrowsRemoved();
+    void testhandleOkError();
+    void test_viewingCompleted();
+    void testsearchOnCategory();
+    void testclear();
+    void testnoResultsFound();
+    void testcreateSuggestionLink();
     void testTDisplayMode2Format();
-    void testsetSelectedCategories();
-    void testfilterdoc();
+    void testfromSymbianCFbsBitmap();
+    void testgetDrivefromMediaId();
+    void testLaunchApplicationL();
+    void testfilterDoc();
 
     /**
      * t_searchsettingsstate.cpp
@@ -97,17 +103,15 @@
     void testisInternetSearchOptionSelected();
     void testunCheckSubCategories();
     void testcheckSubCategories();
-  
+
     void testcheckBoxOkEvent();
     void testcheckBoxCancelEvent();
     void testitemChecked();
     void testcreateGui();
     void testpreparecategories();
     void testq_currentIndexChanged();
-  
+
     void selectedItemCategory();
-    
-    
 
     /* void testOnWizardAddedSignalledNoWizardInCS();
      void testProgressUpdated();
--- a/searchui/stateproviders/searchstateprovider/tsrc/t_searchstateprovider/src/t_searchprogressivestate.cpp	Mon May 03 12:32:15 2010 +0300
+++ b/searchui/stateproviders/searchstateprovider/tsrc/t_searchstateprovider/src/t_searchprogressivestate.cpp	Fri May 14 15:53:17 2010 +0300
@@ -71,6 +71,36 @@
 
     //  delete wind;
     }
+void SearchStateProviderTest::testsetSelectedCategories()
+    {
+    SearchProgressiveState* progressiveState = new SearchProgressiveState();
+    QEvent *event = new QEvent(QEvent::None);
+    progressiveState->onEntry(event);
+    progressiveState->getSettingCategory(0, true);
+    progressiveState->getSettingCategory(1, true);
+    progressiveState->getSettingCategory(2, true);
+    progressiveState->getSettingCategory(3, true);
+    progressiveState->getSettingCategory(4, true);
+    progressiveState->getSettingCategory(5, true);
+    progressiveState->getSettingCategory(6, true);
+    progressiveState->getSettingCategory(7, true);
+    progressiveState->setSelectedCategories();
+    delete progressiveState;
+    }
+void SearchStateProviderTest::testgetAppIconFromAppId()
+    {
+
+    SearchProgressiveState* progressiveState = new SearchProgressiveState();
+    QEvent *event = new QEvent(QEvent::None);
+    progressiveState->onEntry(event);
+    for (int i = 0; i < progressiveState->mIconArray.count(); i++)
+        {
+        QVERIFY(!(progressiveState->mIconArray.at(i).isNull()));
+        }
+    progressiveState->mIconArray.clear();
+    delete progressiveState;
+    }
+
 // ---------------------------------------------------------------------------
 // ---------------------------------------------------------------------------
 //
@@ -89,7 +119,7 @@
 
     progressiveState->onAsyncSearchComplete(0, -1);
     QCOMPARE(progressiveState->mResultcount,0);
-    progressiveState->mSearchHandler->searchAsync("a", "_aggregate");
+    progressiveState->mSearchHandler->searchAsync("txt", "_aggregate");
     QTest::qWait(100);
     //QCOMPARE(progressiveState->mResultcount,10);
 
@@ -105,7 +135,7 @@
     SearchProgressiveState* progressiveState = new SearchProgressiveState();
     QEvent *event = new QEvent(QEvent::None);
 
-    progressiveState->mSelectedCategory.insert(1, true);
+    progressiveState->mSelectedCategory.insert(5, true);
     progressiveState->onEntry(event);
     // progressiveState->mSearchHandler = progressiveState->mSearchHandlerList.at(1);
     progressiveState->onGetDocumentComplete(0, NULL);
@@ -113,9 +143,9 @@
 
     progressiveState->onGetDocumentComplete(-1, NULL);
     QCOMPARE(progressiveState->mModel->rowCount(),0);
-    progressiveState->startNewSearch("a");
+    progressiveState->startNewSearch("d");
     QTest::qWait(2000);
-    int i =progressiveState->mModel->rowCount();
+    int i = progressiveState->mModel->rowCount();
     QVERIFY(progressiveState->mModel->rowCount());
     delete progressiveState;
     //  delete wind;
@@ -123,21 +153,6 @@
 // ---------------------------------------------------------------------------
 // ---------------------------------------------------------------------------
 //
-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();
@@ -155,72 +170,21 @@
     delete progressiveState;
     //   delete wind;    
     }
+
 // ---------------------------------------------------------------------------
 // ---------------------------------------------------------------------------
 //
-void SearchStateProviderTest::testcreateSuggestionLink()
+void SearchStateProviderTest::testgetSettingCategory()
     {
-    SearchProgressiveState* progressiveState = new SearchProgressiveState();
-    QEvent *event = new QEvent(QEvent::None);
-    progressiveState->onEntry(event);
-
-    progressiveState->createSuggestionLink(true);
-    QCOMPARE(progressiveState->mModel->rowCount(), 0);
-    progressiveState->createSuggestionLink(false);
-    QCOMPARE(progressiveState->mModel->rowCount(), 1);
-    delete progressiveState;
-    }
-// ---------------------------------------------------------------------------
-// ---------------------------------------------------------------------------
-//
-void SearchStateProviderTest::testnoResultsFound()
-    {
+    //    HbMainWindow* wind = mainWindow();
     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);
-
+    progressiveState->getSettingCategory(3, true);
+    QCOMPARE(progressiveState->mSelectedCategory.count(),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->mSelectedCategory.insert(1, true);
-    progressiveState->onEntry(event);
-    progressiveState->startNewSearch("a");
-    delete progressiveState;
+    //   delete wind;
     }
 
 // ---------------------------------------------------------------------------
@@ -236,8 +200,16 @@
     QCOMPARE(spy.count(), 1);
     delete progressiveState;
     }
-
-void SearchStateProviderTest::test_CustomizeGoButton()
+void SearchStateProviderTest::teststartNewSearch()
+    {
+    SearchProgressiveState* progressiveState = new SearchProgressiveState();
+    QEvent *event = new QEvent(QEvent::None);
+    progressiveState->mSelectedCategory.insert(5, true);
+    progressiveState->onEntry(event);
+    progressiveState->startNewSearch("d");
+    delete progressiveState;
+    }
+void SearchStateProviderTest::test_customizeGoButton()
     {
     SearchProgressiveState* progressiveState = new SearchProgressiveState();
     QEvent *event = new QEvent(QEvent::None);
@@ -248,21 +220,6 @@
     QVERIFY(progressiveState->mSearchPanel->isProgressive());
     delete progressiveState;
     }
-
-void SearchStateProviderTest::testgetAppIconFromAppId()
-    {
-
-    SearchProgressiveState* progressiveState = new SearchProgressiveState();
-    QEvent *event = new QEvent(QEvent::None);
-    progressiveState->onEntry(event);
-    for (int i = 0; i < progressiveState->mIconArray.count(); i++)
-        {
-        QVERIFY(!(progressiveState->mIconArray.at(i).isNull()));
-        }
-    progressiveState->mIconArray.clear();
-    delete progressiveState;
-    }
-
 // ---------------------------------------------------------------------------
 // ---------------------------------------------------------------------------
 //
@@ -285,18 +242,26 @@
 //SearchStateProviderTest::testcancelsearch()
 // ---------------------------------------------------------------------------
 //
-void SearchStateProviderTest::testcancelsearch()
+void SearchStateProviderTest::testcancelSearch()
     {
     SearchProgressiveState* progressiveState = new SearchProgressiveState();
     QEvent *event = new QEvent(QEvent::None);
     progressiveState->onEntry(event);
     progressiveState->getSettingCategory(5, true);
-    progressiveState->startNewSearch("a");
+    progressiveState->startNewSearch("d");
     progressiveState->cancelSearch();
     delete progressiveState;
 
     }
-void SearchStateProviderTest::testhandleokanderror()
+void SearchStateProviderTest::testgetrowsInserted()
+    {
+
+    }
+void SearchStateProviderTest::testgetrowsRemoved()
+    {
+
+    }
+void SearchStateProviderTest::testhandleOkError()
     {
     SearchProgressiveState* progressiveState = new SearchProgressiveState();
     QEvent *event = new QEvent(QEvent::None);
@@ -307,6 +272,67 @@
     progressiveState->handleError(ret, QString());
     delete progressiveState;
     }
+void SearchStateProviderTest::test_viewingCompleted()
+    {
+
+    }
+// ---------------------------------------------------------------------------
+// ---------------------------------------------------------------------------
+//
+void SearchStateProviderTest::testsearchOnCategory()
+    {
+
+    }
+// ---------------------------------------------------------------------------
+// ---------------------------------------------------------------------------
+//
+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::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::testcreateSuggestionLink()
+    {
+    SearchProgressiveState* progressiveState = new SearchProgressiveState();
+    QEvent *event = new QEvent(QEvent::None);
+    progressiveState->onEntry(event);
+
+    progressiveState->createSuggestionLink(true);
+    QCOMPARE(progressiveState->mModel->rowCount(), 0);
+    progressiveState->createSuggestionLink(false);
+    QCOMPARE(progressiveState->mModel->rowCount(), 1);
+    delete progressiveState;
+    }
 void SearchStateProviderTest::testTDisplayMode2Format()
     {
     SearchProgressiveState* progressiveState = new SearchProgressiveState();
@@ -335,30 +361,50 @@
 
     delete progressiveState;
     }
-void SearchStateProviderTest::testsetSelectedCategories()
+void SearchStateProviderTest::testfromSymbianCFbsBitmap()
+    {
+
+    }
+void SearchStateProviderTest::testgetDrivefromMediaId()
+    {
+    SearchProgressiveState* progressiveState = new SearchProgressiveState();
+    QEvent *event = new QEvent(QEvent::None);
+    progressiveState->mSelectedCategory.insert(1, false);
+    progressiveState->mSelectedCategory.insert(3, false);
+    progressiveState->mSelectedCategory.insert(4, false);
+    progressiveState->mSelectedCategory.insert(5, false);
+    progressiveState->mSelectedCategory.insert(6, false);
+    progressiveState->mSelectedCategory.insert(7, false);
+    
+    progressiveState->mSelectedCategory.insert(2, true);
+    progressiveState->onEntry(event);
+    progressiveState->startNewSearch("3gpp");
+    QTest::qWait(200);
+    QModelIndex index = progressiveState->mModel->index(1, 0);
+    QStandardItem* item = progressiveState->mModel->itemFromIndex(index);
+    QString uid = progressiveState->getDrivefromMediaId(item->data(
+            Qt::UserRole + 2).toString());
+    //QVERIFY(uid.length());
+    delete progressiveState;
+    }
+void SearchStateProviderTest::testLaunchApplicationL()
     {
     SearchProgressiveState* progressiveState = new SearchProgressiveState();
     QEvent *event = new QEvent(QEvent::None);
     progressiveState->onEntry(event);
-    progressiveState->getSettingCategory(0, true);
-    progressiveState->getSettingCategory(1, true);
-    progressiveState->getSettingCategory(2, true);
-    progressiveState->getSettingCategory(3, true);
-    progressiveState->getSettingCategory(4, true);
-    progressiveState->getSettingCategory(5, true);
-    progressiveState->getSettingCategory(6, true);
-    progressiveState->getSettingCategory(7, true);
-    progressiveState->setSelectedCategories();
+    progressiveState->LaunchApplicationL(TUid::Uid(0x20011383));
     delete progressiveState;
     }
-
-void SearchStateProviderTest::testfilterdoc()
+// ---------------------------------------------------------------------------
+// ---------------------------------------------------------------------------
+//
+void SearchStateProviderTest::testfilterDoc()
     {
-    
-        SearchProgressiveState* progressiveState = new SearchProgressiveState();
-        QEvent *event = new QEvent(QEvent::None);
-        progressiveState->onEntry(event);
-        progressiveState->filterDoc(NULL,"Name");
-        delete progressiveState;  
-    
+    SearchProgressiveState* progressiveState = new SearchProgressiveState();
+    QEvent *event = new QEvent(QEvent::None);
+    progressiveState->mSelectedCategory.insert(5, true);
+    progressiveState->onEntry(event);
+    progressiveState->startNewSearch("d");
+    QTest::qWait(200);
+    delete progressiveState;
     }
--- a/searchui/stateproviders/searchstateprovider/tsrc/t_searchstateprovider/src/t_searchstateprovider.cpp	Mon May 03 12:32:15 2010 +0300
+++ b/searchui/stateproviders/searchstateprovider/tsrc/t_searchstateprovider/src/t_searchstateprovider.cpp	Fri May 14 15:53:17 2010 +0300
@@ -185,11 +185,12 @@
 int main(int argc, char *argv[])
     {
     QApplication app(argc, argv);
-    int error;
+    int error =0;
     TRAPD(err,
             QTEST_DISABLE_KEYPAD_NAVIGATION
             SearchStateProviderTest tc;
             error = QTest::qExec(&tc, argc, argv););
+    Q_UNUSED(err);
     return error;
     }
 #else //Q_OS_SYMBIAN
--- a/searchui/stateproviders/searchstateprovider/tsrc/t_searchstateprovider/t_searchstateprovider.pro	Mon May 03 12:32:15 2010 +0300
+++ b/searchui/stateproviders/searchstateprovider/tsrc/t_searchstateprovider/t_searchstateprovider.pro	Fri May 14 15:53:17 2010 +0300
@@ -45,6 +45,7 @@
 LIBS += -laknicon
 LIBS += -lapgrfx
 LIBS += -lbitgdi
+LIBS += -lnoteseditor
     
 CONFIG += qtestlib \
           symbian_test \
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/searchui/stubsis/searchui_stub.pkg	Fri May 14 15:53:17 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:  searchui application stubsis package file
+
+
+; Language
+&EN
+
+; Header
+#{"Searchapplication"}, (0x2002C377), 1, 0, 0, TYPE=SA
+
+
+
+; Localised Vendor name
+%{"Nokia"}
+
+; Unique Vendor name
+:"Nokia"
+
+
+
Binary file searchui/stubsis/searchui_stub.sis has changed
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/sis/cpixsearchapp_stub.pkg	Fri May 14 15:53:17 2010 +0300
@@ -0,0 +1,29 @@
+;
+; 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: 
+;
+
+
+
+;Languages
+&EN
+
+#{"CPix SearchApp"},(0x2001F703),1,0,0, TYPE=SA
+
+; Supports Series 60 v 3.0
+[0x101F7961], 0, 0, 0, {"S60ProductID"}
+
+; Vendor names
+%{"Nokia"}
+:"Nokia"
Binary file sis/cpixsearchapp_stub.sis has changed
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/sis/makestubsis.bat	Fri May 14 15:53:17 2010 +0300
@@ -0,0 +1,16 @@
+@rem
+@rem Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+@rem All rights reserved.
+@rem This component and the accompanying materials are made available
+@rem under the terms of "Eclipse Public License v1.0"
+@rem which accompanies this distribution, and is available
+@rem at the URL "http://www.eclipse.org/legal/epl-v10.html".
+@rem
+@rem Initial Contributors:
+@rem Nokia Corporation - initial contribution.
+@rem
+@rem Contributors:
+@rem
+@rem Description: 
+@rem
+makesis -s cpixsearchapp_stub.pkg cpixsearchapp_stub.sis
\ No newline at end of file