ipsservices/ipssosplugin/inc/ipsplgsearchop.h
changeset 0 8466d47a6819
child 2 5253a20d2a1e
equal deleted inserted replaced
-1:000000000000 0:8466d47a6819
       
     1 /*
       
     2 * Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). 
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description: This file defines class CIpsPlgSearchOp.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef IPSPLGSEARCHOP_H
       
    20 #define IPSPLGSEARCHOP_H
       
    21 
       
    22 
       
    23 #include "ipsplgtextsearcher.h"
       
    24 
       
    25 class CFSMailMessage;
       
    26 class CImEmailMessage;
       
    27 class CIpsPlgTextSearcher;
       
    28 
       
    29 /**
       
    30  * Class to handle searching from emails.
       
    31  *
       
    32  * @since FS v1.0
       
    33  * @lib IpsSosSettings.lib
       
    34  */
       
    35 NONSHARABLE_CLASS( CIpsPlgSearchOp ) : 
       
    36     public CActive, 
       
    37     public MIpsPlgTextSearcherObserver
       
    38     {
       
    39 
       
    40 public:
       
    41 
       
    42     /**
       
    43      * Symbian 2nd phase construcror
       
    44      *
       
    45      * @return None
       
    46      */
       
    47     static CIpsPlgSearchOp* NewL( CIpsPlgSearch& aObserver );
       
    48 
       
    49     /**
       
    50      * Symbian 2nd phase construcror
       
    51      *
       
    52      * @return None
       
    53      */
       
    54     static CIpsPlgSearchOp* NewLC( CIpsPlgSearch& aObserver );
       
    55 
       
    56     /**
       
    57      * Class destructor
       
    58      *
       
    59      * @return
       
    60      */
       
    61     virtual ~CIpsPlgSearchOp();
       
    62 
       
    63     /**
       
    64      *
       
    65      *
       
    66      * @return
       
    67      */
       
    68     void DoCancel();
       
    69     
       
    70 protected:
       
    71 
       
    72     /**
       
    73      * Class constructor
       
    74      *
       
    75      * @param
       
    76      * @param
       
    77      */
       
    78     CIpsPlgSearchOp( CIpsPlgSearch& aObserver );
       
    79 
       
    80 private:
       
    81 
       
    82 // Data   
       
    83 
       
    84     /**
       
    85      * Symbian 2nd phase construct
       
    86      *
       
    87      */
       
    88     void ConstructL();
       
    89 
       
    90 // From base class CActive
       
    91 
       
    92     /**
       
    93      *
       
    94      *
       
    95      * @return
       
    96      */
       
    97     void RunL();
       
    98 
       
    99     /**
       
   100      * Handles any leaves that happened during the operation.
       
   101      *
       
   102      * @return KErrNone, when problems are solved.
       
   103      */
       
   104     TInt RunError( TInt aError );
       
   105 
       
   106 // From base class MIpsPlgTextSearcherObserver
       
   107 
       
   108 	/**
       
   109 	* Called from the text searcher when all search criteria are met.
       
   110 	*
       
   111 	* @param	aSnippet			The snippet
       
   112 	* @param	aSnippetCharPos		The character position of the keyword match within
       
   113 	*								 the snippet
       
   114 	* @param	aStartIncomplete	Indicates that the snippet start is incomplete
       
   115 	* @param	aEndIncomplete		Indicates that the snippet end is incomplete
       
   116 	*/
       
   117 	void HitL( 
       
   118 	    const TDesC& aSnippet, 
       
   119 	    TInt aSnippetCharPos, 
       
   120 	    TBool aStartIncomplete, 
       
   121 	    TBool aEndIncomplete );
       
   122 
       
   123 // New functions
       
   124 
       
   125     /**
       
   126      * Get next available mail or finish the search. Changes state on demand.
       
   127      *
       
   128      * @return ETrue, when search can be continued
       
   129      * @return EFalse, when search is finished.
       
   130      */
       
   131     TBool NextMailL();
       
   132 
       
   133     /**
       
   134      * Looks for strings from the body.
       
   135      *
       
   136      * @param aSearchString Strings to be searched.
       
   137      * @return ETrue, when strings are found.
       
   138      */
       
   139     void SearchBodyL();
       
   140     
       
   141     /**
       
   142      * Search for the string from the email.
       
   143      */
       
   144     void SearchL();
       
   145 
       
   146     /**
       
   147      * Filter out javascript and html tags.
       
   148      */
       
   149     void HandleHtmlL();
       
   150 
       
   151     /**
       
   152      * Send finish command to observer.
       
   153      */
       
   154     void FinalizeL();
       
   155 
       
   156     /**
       
   157      * @param aArray Array to be searched for.
       
   158      * @return ETrue if found, EFalse otherwise
       
   159      */
       
   160     TBool SearchFromArrayL( const CDesCArray& aArray );
       
   161 
       
   162     /**
       
   163      * @param aString String to be searched for.
       
   164      * @return ETrue if found, EFalse otherwise
       
   165      */
       
   166     TBool SearchFromStringL( const TDesC& aString );
       
   167     
       
   168     /**
       
   169     * Activate and complete
       
   170      */
       
   171     void ActivateAndComplete( );
       
   172     
       
   173     /**
       
   174     * Search for the string from the email.
       
   175     */
       
   176     void SearchFromEntireMailL();
       
   177     
       
   178     /**
       
   179     * Search for the string from subject only.
       
   180     */
       
   181     void SearchFromSubjectL();
       
   182 
       
   183 // Data
       
   184 
       
   185     enum TState
       
   186         {
       
   187         EStopped = 0,
       
   188         EStarted,
       
   189         ERunning,
       
   190         EFinished,
       
   191         EHit,
       
   192         ECanceled
       
   193         };
       
   194 
       
   195     /**
       
   196      * Current search state.
       
   197      */
       
   198     TState iState;
       
   199     
       
   200     /**
       
   201      * Client, which started the operation.
       
   202      */
       
   203     CIpsPlgSearch& iObserver;
       
   204     
       
   205     /**
       
   206      * Currently accessed message.
       
   207      * Owned.
       
   208      */
       
   209     CImEmailMessage* iMessage;
       
   210     
       
   211     /**
       
   212      * Header of currently accessed message.
       
   213      * Owned.
       
   214      */
       
   215     CImHeader* iHeader;
       
   216     
       
   217     /**
       
   218      * Temporary storage for search strings.
       
   219      * Owned.
       
   220      */
       
   221     
       
   222     /**
       
   223      * Object to handle the actual searching.
       
   224      * Owned.
       
   225      */
       
   226     CIpsPlgTextSearcher* iSearcher;  
       
   227     
       
   228     };
       
   229 
       
   230 #endif /* IPSPLGSEARCHOP_H */
       
   231 
       
   232 // End of File