mmsengine/mmsmessage/inc/mmsownnumber.h
branchRCL_3
changeset 60 7fdbb852d323
parent 57 ebe688cedc25
equal deleted inserted replaced
57:ebe688cedc25 60:7fdbb852d323
     1 /*
     1 /*
     2 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
     2 * Copyright (c) 2005-2007 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".
     9 * Initial Contributors:
     9 * Initial Contributors:
    10 * Nokia Corporation - initial contribution.
    10 * Nokia Corporation - initial contribution.
    11 *
    11 *
    12 * Contributors:
    12 * Contributors:
    13 *
    13 *
    14 * Description:
    14 * Description:   checks if a given number is terminal's own number
    15 *
    15 *
    16 */
    16 */
    17 
    17 
       
    18 
       
    19 
       
    20 
       
    21 #ifndef MMSOWNNUMBER_H
       
    22 #define MMSOWNNUMBER_H
       
    23 
       
    24 //  INCLUDES
       
    25 #include <e32base.h>
       
    26 #include <badesca.h>
       
    27 
       
    28 #include <MVPbkContactFindObserver.h>
       
    29 #include <MVPbkContactStoreListObserver.h>
       
    30 #include <MVPbkSingleContactOperationObserver.h>
       
    31 
       
    32 // CONSTANTS
       
    33 
       
    34 // MACROS
       
    35 
       
    36 // DATA TYPES
       
    37 
       
    38 // FUNCTION PROTOTYPES
       
    39 
       
    40 // FORWARD DECLARATIONS
       
    41 class RFs;
       
    42 
       
    43 class CVPbkContactManager;
       
    44 class MVPbkContactStoreList;
       
    45 class MVPbkContactOperationBase;
       
    46 class MVPbkStoreContact;
       
    47 
       
    48 // CLASS DECLARATION
       
    49 
       
    50 /**
       
    51 *  Own numer matching
       
    52 *
       
    53 *  @lib mmsmessage.lib
       
    54 *  @since Series 60 3.1
       
    55 */
       
    56 
       
    57 NONSHARABLE_CLASS( CMmsOwnNumber ) : public CActive,
       
    58     public MVPbkContactFindObserver,
       
    59     public MVPbkContactStoreListObserver,
       
    60     public MVPbkSingleContactOperationObserver
       
    61     {
       
    62     public:  // Constructors and destructor
       
    63         
       
    64         /**
       
    65         * Two-phased constructor.
       
    66         */
       
    67         static CMmsOwnNumber* NewL( RFs* aFs );
       
    68         
       
    69         /**
       
    70         * Destructor.
       
    71         */
       
    72         virtual ~CMmsOwnNumber();
       
    73 
       
    74     public: // New functions
       
    75         
       
    76         /**
       
    77         * Starts searching for the number.
       
    78         * @since Series 60 3.1
       
    79         * @param aNumberList array of number from which to search own number
       
    80         * @param aFs file system pointer
       
    81         * @return the index of user's number in the array or error code
       
    82         */
       
    83         
       
    84         TInt StartL( const CDesCArray& aNumberList );
       
    85 
       
    86     public: // Functions from base classes
       
    87 
       
    88         /**
       
    89         * From MVPbkContactFindObserver
       
    90         * Called when find is complete. Callee takes ownership of the results.
       
    91         * In case of an error during find, the aResults may contain only 
       
    92         * partial results of the find.
       
    93         * @since Series 60 3.1
       
    94         *
       
    95         * @param aResults Array of contact links that matched the find.
       
    96         *                 Callee must take ownership of this object in
       
    97         *                 the end of the function, ie. in case the function
       
    98         *                 does not leave.
       
    99         */
       
   100         void FindCompleteL(MVPbkContactLinkArray* aResults);
       
   101         
       
   102         /**
       
   103         * From MVPbkContactFindObserver
       
   104         * Called in case the find fails for some reason.
       
   105         * @since Series 60 3.1
       
   106         * 
       
   107         * @param aError One of the system wide error codes.
       
   108         */
       
   109         void FindFailed(TInt aError);
       
   110         
       
   111         /**
       
   112         * From MVPbkContactStoreListObserver
       
   113         * Called when the opening process is complete, ie. all stores have been reported
       
   114         * either failed or successful open.
       
   115         */
       
   116         void OpenComplete();
       
   117         
       
   118         /**
       
   119         * From MVPbkContactStoreObserver
       
   120         * Called when a contact store is ready to use.
       
   121         */
       
   122         virtual void StoreReady(MVPbkContactStore& aContactStore);
       
   123 
       
   124         /**
       
   125         * From MVPbkContactStoreObserver
       
   126         * Called when a contact store becomes unavailable.
       
   127         * Client may inspect the reason of the unavailability and decide whether or not
       
   128         * it will keep the store opened (ie. listen to the store events).
       
   129         * @param aContactStore The store that became unavailable.
       
   130         * @param aReason The reason why the store is unavailable.
       
   131         *                This is one of the system wide error codes.
       
   132         */
       
   133         virtual void StoreUnavailable(MVPbkContactStore& aContactStore, TInt aReason);
       
   134 
       
   135         /**
       
   136         * From MVPbkContactStoreObserver
       
   137         * Called when changes occur in the contact store.
       
   138         * @see TVPbkContactStoreEvent
       
   139         *
       
   140         * @param aStoreEvent Event that has occured.
       
   141         */
       
   142         virtual void HandleStoreEventL(
       
   143                 MVPbkContactStore& aContactStore, 
       
   144                 TVPbkContactStoreEvent aStoreEvent);
       
   145                 
       
   146         /**
       
   147         * From MVPbkSingleContactOperationObserver
       
   148         * Called when operation is completed.
       
   149         *
       
   150         * @param aOperation    the completed operation.
       
   151         */
       
   152         virtual void VPbkSingleContactOperationComplete(
       
   153                 MVPbkContactOperationBase& aOperation,
       
   154                 MVPbkStoreContact* aContact);
       
   155 
       
   156         /**
       
   157         * From MVPbkSingleContactOperationObserver
       
   158         * Called if the operation fails.
       
   159         *
       
   160         * @param aOperation    the failed operation.
       
   161         * @param aError        error code of the failure.
       
   162         */
       
   163         virtual void VPbkSingleContactOperationFailed(
       
   164                 MVPbkContactOperationBase& aOperation, 
       
   165                 TInt aError);
       
   166 
       
   167         
       
   168     protected:  // New functions
       
   169         
       
   170     protected:  // Functions from base classes
       
   171         
       
   172     private:
       
   173 
       
   174         /**
       
   175         * C++ default constructor.
       
   176         */
       
   177         CMmsOwnNumber();
       
   178 
       
   179         /**
       
   180         * By default Symbian 2nd phase constructor is private.
       
   181         */
       
   182         void ConstructL( RFs* aFs );
       
   183         
       
   184         /**
       
   185         * From CActive: Cancel current operation.
       
   186         */
       
   187         void DoCancel();
       
   188         
       
   189         /**
       
   190         * From CActive: Active object completion
       
   191         */
       
   192         void RunL();
       
   193         
       
   194         /**
       
   195         * From CActive: Active object error
       
   196         */
       
   197         TInt RunError( TInt aError );
       
   198         
       
   199         /*
       
   200         * Search for contact
       
   201         */
       
   202         void SearchL();
       
   203         
       
   204         /*
       
   205         * if more than one contact found, check for duplicate entries
       
   206         */
       
   207         void CheckDuplicatesL();
       
   208         
       
   209 
       
   210     public:     // Data
       
   211     
       
   212     protected:  // Data
       
   213 
       
   214     private:    // Data
       
   215         
       
   216         enum TMmsOwnNumberStates
       
   217             {
       
   218             EMmsOwnNumberIdle,
       
   219             EMmsOwnNumberOpening,
       
   220             EMmsOwnNumberSearching,
       
   221             EMmsOwnNumberCheckingDuplicates,
       
   222             EMmsOwnNumberClosing,
       
   223             EMmsOwnNumberDone
       
   224             };
       
   225         
       
   226       	CActiveSchedulerWait iActiveSchedulerWait;
       
   227       	const CDesCArray* iNumberList; // caller's number list
       
   228       	TInt iIndex; // index of own number in array
       
   229       	CVPbkContactManager* iContactManager;
       
   230       	RFs* iFs; // file manager
       
   231       	TInt iNumberToMatch; // array index for the number to be matched
       
   232       	TInt iDigitsToMatch; // the number of digits to match in a phone number
       
   233       	TInt iContactToMatch; // array index of contact for exact matching
       
   234       	MVPbkContactStoreList* iContactList; // just a reference, not allocated memory
       
   235       	TBool iMatch; // tells if the contact was an exact match
       
   236       	TInt iNumberOfStores; // number of stores to search
       
   237       	TInt iNumberOfOpenStores; // number of stores we managed to open
       
   238       	TInt iState; // state machine state
       
   239       	MVPbkContactLinkArray* iResultArray;
       
   240       	MVPbkContactOperationBase* iOperation;
       
   241       	MVPbkStoreContact* iContact;
       
   242 
       
   243 
       
   244     };
       
   245     
       
   246 #endif      // MMSOWNNUMBER_H   
       
   247             
    18 // End of File
   248 // End of File