emailservices/emailclientapi/inc/emailmessagesearch.h
branchRCL_3
changeset 64 3533d4323edc
parent 63 d189ee25cf9d
equal deleted inserted replaced
63:d189ee25cf9d 64:3533d4323edc
     1 /*
     1 /*
     2 * Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). 
     2 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). 
     3 * All rights reserved.
     3 * All rights reserved.
     4 * This component and the accompanying materials are made available
     4 * This component and the accompanying materials are made available
     5 * under the terms of "Eclipse Public License v1.0"
     5 * under the terms of "Eclipse Public License v1.0"
     6 * which accompanies this distribution, and is available
     6 * which accompanies this distribution, and is available
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
    20 
    20 
    21 #include <memailmessage.h>
    21 #include <memailmessage.h>
    22 #include <memailmessagesearch.h>
    22 #include <memailmessagesearch.h>
    23 #include <emailsorting.h>
    23 #include <emailsorting.h>
    24 
    24 
    25 #include "CFSMailClient.h"
    25 #include "cfsmailclient.h"
    26 #include "MFSMailBoxSearchObserver.h"
    26 #include "mfsmailboxsearchobserver.h"
    27 #include "emailapiutils.h"
    27 #include "emailapiutils.h"
    28 
    28 
    29 using namespace EmailInterface;
    29 using namespace EmailInterface;
    30 
    30 
    31 
    31 
    48      * Destructor
    48      * Destructor
    49      */
    49      */
    50     ~CEmailMessageSearchAsync();
    50     ~CEmailMessageSearchAsync();
    51     
    51     
    52 public: // from MEmailInterface
    52 public: // from MEmailInterface
    53     TEmailTypeId InterfaceId() const;
    53     virtual TEmailTypeId InterfaceId() const;
    54     
    54     
    55     void Release();
    55     virtual void Release();
    56     
    56     
    57 
    57 
    58 public: // from MEmailMessageSearchAsync
    58 public: // from MEmailMessageSearchAsync
    59     /**
    59     /**
    60     * Sets sort order for search results.
    60     * Sets sort order for search results.
    61     * Leaves KErrNotReady if search is ongoing.
    61     * Leaves KErrNotReady if search is ongoing.
    62     */
    62     */
    63     void SetSortCriteriaL( const TEmailSortCriteria& aCriteria );
    63     virtual void SetSortCriteriaL( const TEmailSortCriteria& aCriteria );
    64     
    64     
    65     /**
    65     /**
    66     * Adds a search key. Leaves KErrNotReady if search is ongoing.
    66     * Adds a search key. Leaves KErrNotReady if search is ongoing.
    67     */
    67     */
    68     void AddSearchKeyL( const TDesC& aSearchKey );
    68     virtual void AddSearchKeyL( const TDesC& aSearchKey );
    69                                                                   
    69                                                                   
    70     /**
    70     /**
    71     * Enables/disables search from remote email server.
    71     * Enables/disables search from remote email server.
    72     * Leaves KErrNotReady if search is ongoing.
    72     * Leaves KErrNotReady if search is ongoing.
    73     */
    73     */
    74     void SetRemoteSearchL( TBool aRemote );                                                               
    74     virtual void SetRemoteSearchL( TBool aRemote );                                                               
    75     
    75     
    76     /**
    76     /**
    77     * Indicates whether remote search is enabled.
    77     * Indicates whether remote search is enabled.
    78     */
    78     */
    79     TBool IsRemoteSearch() const;
    79     virtual TBool IsRemoteSearch() const;
    80     
    80     
    81     /**
    81     /**
    82      * Starts search, all methods affecting search attribures leave
    82      * Starts search, all methods affecting search attribures leave
    83      * KErrNotReady while search is ongoing.
    83      * KErrNotReady while search is ongoing.
    84      * @param aObserver called when results are available.
    84      * @param aObserver called when results are available.
    85      */     
    85      */     
    86     void StartSearchL( MEmailSearchObserver& aObserver );
    86     virtual void StartSearchL( MEmailSearchObserver& aObserver );
    87 
    87 
    88     /**
    88     /**
    89      * Cancels search.
    89      * Cancels search.
    90      */
    90      */
    91     void Cancel();
    91     virtual void Cancel();
    92                                              
    92                                              
    93     /** returns search status 
    93     /** returns search status 
    94       * @return search status:
    94       * @return search status:
    95       *     < 0 : Search has failed
    95       *     < 0 : Search has failed
    96       *     KRequestPending : search is ongoing. note that status may be
    96       *     KRequestPending : search is ongoing. note that status may be
    97       *         KRequestPending after HandleResultL callback because results 
    97       *         KRequestPending after HandleResultL callback because results 
    98       *         may be given in chunks of results. Size of chunk depends on
    98       *         may be given in chunks of results. Size of chunk depends on
    99       *         implementation and may vary.
    99       *         implementation and may vary.
   100       *     KErrNone : initial state, or search has finished
   100       *     KErrNone : initial state, or search has finished
   101       */
   101       */
   102     TInt Status() const;
   102     virtual TInt Status() const;
   103     
   103     
   104     /**
   104     /**
   105      * Resets all search attribures. Cancels search if ongoing. 
   105      * Resets all search attribures. Cancels search if ongoing. 
   106      */
   106      */
   107     void Reset();
   107     virtual void Reset();
   108     
   108     
   109 public:  // From MFSMailBoxSearchObserver
   109 public:  // From MFSMailBoxSearchObserver
   110     /** 
   110     /** 
   111      * Notifies the email search API client that a match has been found
   111      * Notifies the email search API client that a match has been found
   112      * 
   112      * 
   113      * @param aMatchMessage contains a pointer to the matched message.
   113      * @param aMatchMessage contains a pointer to the matched message.
   114      *         Ownership is transfered to the observer.
   114      *         Ownership is transfered to the observer.
   115      *
   115      *
   116      */
   116      */
   117      void MatchFoundL( CFSMailMessage* aMatchMessage );
   117      virtual void MatchFoundL( CFSMailMessage* aMatchMessage );
   118 
   118 
   119     /**
   119     /**
   120      * Notifies the email search API client that the search has completed
   120      * Notifies the email search API client that the search has completed
   121      *
   121      *
   122      */
   122      */
   123      void SearchCompletedL();
   123      virtual void SearchCompletedL();
   124 
   124 
   125 //
   125 //
   126     /**
   126     /**
   127     * Asks client if search engine should change search priority 
   127     * Asks client if search engine should change search priority 
   128   	*/
   128   	*/
   129     void ClientRequiredSearchPriority(TInt *apRequiredSearchPriority); 
   129     virtual void ClientRequiredSearchPriority(TInt *apRequiredSearchPriority); 
   130 //
   130 //
   131 
   131 
   132     
   132     
   133 private:
   133 private:
   134     /**
   134     /**
   138         CPluginData& aPluginData,
   138         CPluginData& aPluginData,
   139         const TMailboxId& aMailboxId );
   139         const TMailboxId& aMailboxId );
   140 
   140 
   141     void ConstructL();
   141     void ConstructL();
   142     
   142     
   143     /**
       
   144      * Function leaves if search is going on. Otherwise it doesn't do anything.
       
   145      */
       
   146     inline void IsSearchGoingOnL() const; 
       
   147 
       
   148 private:
   143 private:
   149     
   144     
   150     CPluginData&    iPluginData;
   145     CPluginData&    iPluginData;
   151     
   146     
   152     CFSMailPlugin*  iPlugin;
   147     CFSMailPlugin*  iPlugin;
   158     RPointerArray<TDesC> iSearchStrings;    
   153     RPointerArray<TDesC> iSearchStrings;    
   159 
   154 
   160     MEmailSearchObserver* iObserver;
   155     MEmailSearchObserver* iObserver;
   161     
   156     
   162     mutable RSemaphore iGate;
   157     mutable RSemaphore iGate;
   163 
       
   164     TBool iRemote;
   158     TBool iRemote;
   165 };
   159 };
   166 
   160 
   167 #endif // EMAILMESSAGESEARCHASYNCIMPL_H_
   161 #endif /* EMAILMESSAGESEARCHASYNCIMPL_H_ */
   168 
       
   169 // End of file
       
   170