messagingappbase/ncnlist/inc/NcnOutboxSendOperation.h
changeset 0 72b543305e3a
equal deleted inserted replaced
-1:000000000000 0:72b543305e3a
       
     1 /*
       
     2 * Copyright (c) 2004 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:  
       
    15 *       When the phone mode is changed from offline to online mode, this class
       
    16 *       sends the messages in outbox, that are in suspended or failed state
       
    17 *       because of the offline mode. When phone is changed from online to
       
    18 *       offline mode, the currently running sending operation will be
       
    19 *       cancelled.
       
    20 *
       
    21 */
       
    22 
       
    23 
       
    24 
       
    25 #ifndef __NCNOUTBOXSENDOPERATION_H__
       
    26 #define __NCNOUTBOXSENDOPERATION_H__
       
    27 
       
    28 //  INCLUDES
       
    29 #include <msvapi.h>
       
    30 #include <MuiuMsvSingleOpWatcher.h>
       
    31 
       
    32 // CONSTANTS
       
    33 _LIT8( KNcnBlankBuffer, "" );
       
    34 
       
    35 // FORWARD DECLARATIONS
       
    36 class CMsvEntrySelection;
       
    37 
       
    38 // CLASS DECLARATION
       
    39 
       
    40 /**
       
    41 *  Sends messages from Outbox when user selects "Start" in Outbox.
       
    42 */
       
    43 class CNcnOutboxSendOperation : public CMsvOperation
       
    44     {
       
    45     public: // Constructors and destructor
       
    46 
       
    47         /**
       
    48         *   A two-phased constructor.
       
    49         */
       
    50         static CNcnOutboxSendOperation* NewL(
       
    51             CMsvSession& aMsvSession, TRequestStatus& aObserverRequestStatus);
       
    52 
       
    53         /**
       
    54         *   A destructor.
       
    55         */
       
    56         virtual ~CNcnOutboxSendOperation();
       
    57 
       
    58         /**
       
    59         *   Returns the current operation.
       
    60         */
       
    61         virtual const TDesC8& ProgressL();
       
    62 
       
    63     private:
       
    64 
       
    65         /**
       
    66         *   A C++ constructor
       
    67         */
       
    68         CNcnOutboxSendOperation(
       
    69             CMsvSession& aMsvSession, TRequestStatus& aObserverRequestStatus);
       
    70 
       
    71         /**
       
    72         *   Creates the sending operation session.
       
    73         */
       
    74         void ConstructL();
       
    75 
       
    76     private:    // Functions from base classes
       
    77 
       
    78         /**
       
    79         *   Cancels sending operation.
       
    80         */
       
    81         void DoCancel();
       
    82 
       
    83         /**
       
    84         *   Keeps the message sending operaion active until all
       
    85         *   messages are sent.
       
    86         */
       
    87         void RunL();
       
    88 
       
    89         /**
       
    90         *  Handles the runtime error events
       
    91         */
       
    92         TInt RunError( TInt aError );
       
    93 
       
    94     private:    // New functions
       
    95 
       
    96         /**
       
    97         *   Starts sending operation for  next selection.
       
    98         */
       
    99         void StartSendingL();
       
   100 
       
   101         /**
       
   102         *   Sets the selected messages to sending state.
       
   103         */
       
   104         void SendWaitingSMSMessages();
       
   105 
       
   106         /**
       
   107         *   Sets the selected messages to sending state.
       
   108         */
       
   109         void SendWaitingSMSMessagesL();
       
   110 
       
   111         /**
       
   112         *   Creates selection of spesified type of messages in outbox
       
   113         */
       
   114         void CreateSelectionL(
       
   115             const TUid& aUidForSel,
       
   116             const TMsvId& aServiceId,
       
   117             CMsvEntrySelection*& aSelection );
       
   118 
       
   119         /**
       
   120         *   Checks if MTM is available and creates selection
       
   121         */
       
   122         TBool CheckAndCreateSelectionL();
       
   123 
       
   124         /**
       
   125         * Completes operation and cancels notify
       
   126         */
       
   127         void CompleteObserver( TInt aStatus );
       
   128 
       
   129         /**
       
   130         * Deletes the selection
       
   131         */
       
   132         void RemoveSelection();
       
   133 
       
   134         /**
       
   135         * Checks if there is need to continue sending operation
       
   136         */
       
   137         TBool IsSendingNeeded( TUid& aMtm ) const;
       
   138 
       
   139         /**
       
   140         * Removes the sending flag
       
   141         */
       
   142         void RemoveSendingFlag( const TUid& aMtm );
       
   143         
       
   144         /**
       
   145         * Complete own request
       
   146         */
       
   147         void CompleteSelf( TInt aValue );
       
   148 
       
   149 
       
   150     private:    // Data
       
   151         enum
       
   152         {
       
   153             ENcnSupportsSmsSending      = 0x01,
       
   154             ENcnSendSms                 = 0x10,
       
   155         };
       
   156 
       
   157         // Selection queue
       
   158         CArrayPtrFlat<CMsvEntrySelection> iSelections;
       
   159         // Services selection
       
   160         CMsvEntrySelection      iServices;
       
   161         // Pointer to Msv Operation
       
   162         CMsvOperation*          iOperation;
       
   163         // Entry pointer
       
   164         CMsvEntry*              iEntry;
       
   165         // Supported message types
       
   166         TUint                   iSupportedMsgs;
       
   167     };
       
   168 
       
   169 
       
   170 #endif // __NCNOUTBOXSENDOPERATION_H__
       
   171 
       
   172 // End of file