apengine/apsettingshandlerui/inc/Apsettingsdeleteoperation.h
changeset 70 ac5daea24fb0
parent 0 5a93021fdf25
equal deleted inserted replaced
61:8b0c979bbe8c 70:ac5daea24fb0
       
     1 /*
       
     2 * Copyright (c) 2002 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:  Declaration of class CApSettingsDeleteOperation.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef APSETTINGS_DELETE_OPERATION_H
       
    20 #define APSETTINGS_DELETE_OPERATION_H
       
    21 
       
    22 // INCLUDE FILES
       
    23 #include <ApDataHandler.h>
       
    24 #include <AknProgressDialog.h>
       
    25 // CONSTANTS
       
    26 
       
    27 // DATA TYPES
       
    28 
       
    29 // FORWARD DECLARATION
       
    30 class CActiveApDb;
       
    31 class CApSettingsModel;
       
    32 class CAknWaitDialog;
       
    33 class CErrorUI;
       
    34 
       
    35 // CLASS DECLARATION
       
    36 
       
    37 /**
       
    38 * Model for the access point settings ui.
       
    39 */
       
    40 NONSHARABLE_CLASS( CApSettingsDeleteOperation ) : 
       
    41                     public CActive, public MProgressDialogCallback
       
    42     {
       
    43     public:
       
    44         enum TState             /// State of the finite state machine.
       
    45             {
       
    46             EProcOnDialogOn,
       
    47             EProcOffDialogOn,
       
    48             EProcOnDialogOff,
       
    49             EProcOffDialogOff
       
    50             };
       
    51 
       
    52     public:     // Construct / destruct
       
    53         /**
       
    54         * Two-phased constructor. Leaves on failure.
       
    55         * @param aNoteControlId The ID of the note control.
       
    56         * @param aResourceID The resource ID of the wait note dialog.
       
    57         * @param aUid The UID of the access point to delete.
       
    58         * @param aNoteText The label for the note text.
       
    59         * @return The constructed CApSettingsDeleteOperation object.
       
    60         */
       
    61         static CApSettingsDeleteOperation* NewL(
       
    62                                 TInt aNoteControlId,
       
    63                                 TInt aResourceID,
       
    64                                 TUint32 aUid,
       
    65                                 const TDesC& aNoteText
       
    66                                 );
       
    67 
       
    68 
       
    69         /**
       
    70         * Destructor.
       
    71         */
       
    72         virtual ~CApSettingsDeleteOperation();
       
    73 
       
    74 
       
    75     protected:  // new functions
       
    76         /**
       
    77         * Constructor.
       
    78         * @param aNoteControlId The ID of the note control.
       
    79         * @param aResourceID The resource ID of the wait note dialog.
       
    80         * @param aUid The UID of the access point to delete.
       
    81         */
       
    82         CApSettingsDeleteOperation(
       
    83                                 TInt aNoteControlId,
       
    84                                 TInt aResourceID,
       
    85                                 TUint32 aUid
       
    86                                 );
       
    87 
       
    88         /**
       
    89         * Second phase constructor. Leaves on failure.
       
    90         * @param aNoteText The desired text of the note.
       
    91         * events.
       
    92         */
       
    93         void ConstructL( const TDesC& aNoteText );
       
    94 
       
    95     protected:  // from CActive
       
    96         /**
       
    97         * Run a step of the observer test.
       
    98         */
       
    99         void RunL();
       
   100 
       
   101         /**
       
   102         * Cancel protocol implementation.
       
   103         * must be present although does nothing
       
   104         * as it is pure virtual in base...
       
   105         */
       
   106         void DoCancel();
       
   107 
       
   108         /**
       
   109         * Callback for notification of the dismissal of the wait note dialog.
       
   110         * From MProgressDialogCallback.
       
   111         * The passed aButtonId is ignored.
       
   112         */
       
   113         virtual void DialogDismissedL( TInt aButtonId );
       
   114 
       
   115     public:     // new methods
       
   116 
       
   117         /**
       
   118         * Start the operation.
       
   119         */
       
   120         void StartL();
       
   121 
       
   122 
       
   123         /**
       
   124         * Moves into next wait round and forces RunL to execute.
       
   125         */
       
   126         void Next();
       
   127 
       
   128 
       
   129         /**
       
   130         * Starts the wait note with the current params.
       
   131         */
       
   132         void StartWaitNoteL();
       
   133 
       
   134 
       
   135         /**
       
   136         * Starts the separate delete operation thread with the current params.
       
   137         */
       
   138         void StartDeleteOperationThreadL();
       
   139 
       
   140 
       
   141         /**
       
   142         * Separate thread for the delete operation.
       
   143         * @param aPtr   A pointer to the operation to be started in the thread
       
   144         * @return The return code of the delete operation
       
   145         */
       
   146         static TInt RunDeleteThread( TAny* aPtr );
       
   147 
       
   148 
       
   149         /**
       
   150         * Separate thread for the delete operation.
       
   151         * @param aop   A pointer to the operation to be started in the thread
       
   152         * @return The return code of the delete operation
       
   153         */
       
   154         static TInt DoRunDeleteThreadL( CApSettingsDeleteOperation* aop );
       
   155 
       
   156 
       
   157         /**
       
   158         * Starts a transaction on the given database
       
   159         * @param aDb Pointer to the database object
       
   160         * @param aWrite boolean indicating whether write or read lock is needed
       
   161         * @param aRetry boolean indicating whether retry is needed
       
   162         * @return Whether the transaction is our own or not
       
   163         */
       
   164         static TBool StartTransactionLC
       
   165                             (
       
   166                             CCommsDatabase* aDb,
       
   167                             TBool aWrite,
       
   168                             TBool aRetry /* ETrue */
       
   169                             );
       
   170 
       
   171 
       
   172         /**
       
   173         * Gets write lock for the given database
       
   174         * @param aDb Pointer to the database object
       
   175         */
       
   176         static void GetWriteLockL( CCommsDatabase* aDb );
       
   177 
       
   178 
       
   179         /**
       
   180         * Cleanup function for the transaction.
       
   181         * In case of leave, it will be called and
       
   182         * transaction will be rolled back
       
   183         */
       
   184         static void RollbackTransactionOnLeave( TAny* aDb );
       
   185 
       
   186 
       
   187         /**
       
   188         * Get the list of VPN WAP Access point UID's which are linked to a 
       
   189         * specific normal internet access point WAP ID.
       
   190         * @param aDb a reference of a CCommsDatabase database object 
       
   191         * to operate on
       
   192         * @param aUid a TUint32 containing the WAP UID of the normal 
       
   193         * internet access point
       
   194         * @param aVpnList a TUint32 dynamic array passed by reference to 
       
   195         * hold the WAP UID's of the linked VPN access points.
       
   196         */
       
   197 /*
       
   198         static void GetLinkedVpnAccessPointsL( CCommsDatabase& aDb,
       
   199                                         TUint32 aUid, 
       
   200                                         CArrayFixFlat<TUint32> &aVpnList );
       
   201 */
       
   202 
       
   203         /**
       
   204         * Reads up an integer from the given table
       
   205         * @param atable The CCommsDbTableView* table to perform the operation
       
   206         * @param aColumn The column to read
       
   207         * @param aValue A TUint32 passed by reference to hold the readed value.
       
   208         * @return TInt Error code. Returns either 0 or KErrnotFound. 
       
   209         * Leaves on any other error
       
   210         */
       
   211         static TInt ReadUintL( CCommsDbTableView* atable,
       
   212                                const TDesC& aColumn,
       
   213                                TUint32& aValue );
       
   214 
       
   215         /**
       
   216         * Returns the current state.
       
   217         */
       
   218         TState State(){ return iState;};
       
   219         
       
   220         /**
       
   221         * Set a new UID
       
   222         */
       
   223         void SetUid( TUint32 aUid ) { iUid = aUid;};
       
   224         
       
   225         
       
   226         /**
       
   227         * Set a new note-text
       
   228         */
       
   229         void SetNoteTextL( const TDesC& aNoteText );
       
   230 
       
   231     private:    // data
       
   232         TInt                iNoteControlId;
       
   233         TInt                iResourceID;
       
   234         TUint32             iUid;
       
   235         RThread             iDeleteOperation;
       
   236         HBufC*              iNoteText;
       
   237         CAknWaitDialog*     iWaitDialog;
       
   238         TState              iState;
       
   239         CErrorUI*           iErrorUi;
       
   240         TInt                iErr;
       
   241     };
       
   242 
       
   243 
       
   244 #endif
       
   245 
       
   246 // End of file