cellular/servicerequest/inc/cservicerequest.h
author hgs
Wed, 21 Jul 2010 18:26:52 +0300
changeset 33 8d5d7fcf9b59
permissions -rw-r--r--
201027
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
33
hgs
parents:
diff changeset
     1
/*
hgs
parents:
diff changeset
     2
* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). 
hgs
parents:
diff changeset
     3
* All rights reserved.
hgs
parents:
diff changeset
     4
* This component and the accompanying materials are made available
hgs
parents:
diff changeset
     5
* under the terms of "Eclipse Public License v1.0"
hgs
parents:
diff changeset
     6
* which accompanies this distribution, and is available
hgs
parents:
diff changeset
     7
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
hgs
parents:
diff changeset
     8
*
hgs
parents:
diff changeset
     9
* Initial Contributors:
hgs
parents:
diff changeset
    10
* Nokia Corporation - initial contribution.
hgs
parents:
diff changeset
    11
*
hgs
parents:
diff changeset
    12
* Contributors:
hgs
parents:
diff changeset
    13
*
hgs
parents:
diff changeset
    14
* Description:  Interface for service request
hgs
parents:
diff changeset
    15
*
hgs
parents:
diff changeset
    16
*/
hgs
parents:
diff changeset
    17
hgs
parents:
diff changeset
    18
hgs
parents:
diff changeset
    19
hgs
parents:
diff changeset
    20
#ifndef CSERVICEREQUEST_H
hgs
parents:
diff changeset
    21
#define CSERVICEREQUEST_H
hgs
parents:
diff changeset
    22
hgs
parents:
diff changeset
    23
//  INCLUDES
hgs
parents:
diff changeset
    24
#include <e32std.h>
hgs
parents:
diff changeset
    25
#include <e32base.h>
hgs
parents:
diff changeset
    26
#include <AknProgressDialog.h> 
hgs
parents:
diff changeset
    27
hgs
parents:
diff changeset
    28
// FORWARD DECLARATIONS
hgs
parents:
diff changeset
    29
class MServiceRequestObserver;
hgs
parents:
diff changeset
    30
class CAknWaitDialog;
hgs
parents:
diff changeset
    31
class RConeResourceLoader;
hgs
parents:
diff changeset
    32
hgs
parents:
diff changeset
    33
// CLASS DECLARATION
hgs
parents:
diff changeset
    34
hgs
parents:
diff changeset
    35
/**
hgs
parents:
diff changeset
    36
*  Interface for service request
hgs
parents:
diff changeset
    37
*
hgs
parents:
diff changeset
    38
* -Create instance by calling the static NewL method. User must implement the
hgs
parents:
diff changeset
    39
*  observer interface MServiceRequestObserver. Cancelling the wait note is 
hgs
parents:
diff changeset
    40
*  informed through this API.
hgs
parents:
diff changeset
    41
*
hgs
parents:
diff changeset
    42
*  iServiceRequest = CServiceRequest::NewL( *this );
hgs
parents:
diff changeset
    43
*
hgs
parents:
diff changeset
    44
*
hgs
parents:
diff changeset
    45
* -The instance can be deleted at any time and all notes are dismissed.
hgs
parents:
diff changeset
    46
*
hgs
parents:
diff changeset
    47
*  delete iServiceRequest;
hgs
parents:
diff changeset
    48
*
hgs
parents:
diff changeset
    49
*
hgs
parents:
diff changeset
    50
* -The wait note can be launched by calling StartL function:
hgs
parents:
diff changeset
    51
*
hgs
parents:
diff changeset
    52
*  iServiceRequest->StartL();
hgs
parents:
diff changeset
    53
*
hgs
parents:
diff changeset
    54
*  By default the text "Requesting" is used, but the user may give the text
hgs
parents:
diff changeset
    55
*  as a parameter:
hgs
parents:
diff changeset
    56
*
hgs
parents:
diff changeset
    57
*  iServiceRequest->StartL( _L("Please wait...") );
hgs
parents:
diff changeset
    58
*
hgs
parents:
diff changeset
    59
*  Call to the StartL function will delete own notes visible at the call time.
hgs
parents:
diff changeset
    60
*
hgs
parents:
diff changeset
    61
*
hgs
parents:
diff changeset
    62
* -Wait note can deleteted by calling the ShowCompletionNoteL function. This removes
hgs
parents:
diff changeset
    63
*  all own notes. If the user wants to show a completion note for the request,
hgs
parents:
diff changeset
    64
*  the parameter aShowNote must be set to ETrue. Creation of a new note may leave.
hgs
parents:
diff changeset
    65
*  By deafult the Supplementary Service UI specification texts and note types are
hgs
parents:
diff changeset
    66
*  used. The user may override some parameters, like note type and text. By default,
hgs
parents:
diff changeset
    67
*  the error code is converted into note, e.g.:
hgs
parents:
diff changeset
    68
*      KErrNone, Global confirmation note "Done"
hgs
parents:
diff changeset
    69
*      KErrCancel, Local information note "Request not confirmed"
hgs
parents:
diff changeset
    70
*      KErrAccessDenied, Global information note "Not allowed"
hgs
parents:
diff changeset
    71
*  and so on.
hgs
parents:
diff changeset
    72
*
hgs
parents:
diff changeset
    73
*
hgs
parents:
diff changeset
    74
*
hgs
parents:
diff changeset
    75
*  @lib ServiceRequest.lib
hgs
parents:
diff changeset
    76
*  @since 1.2
hgs
parents:
diff changeset
    77
*/
hgs
parents:
diff changeset
    78
class CServiceRequest : public CActive, public MProgressDialogCallback
hgs
parents:
diff changeset
    79
    {
hgs
parents:
diff changeset
    80
    public:  // Constructors and destructor
hgs
parents:
diff changeset
    81
hgs
parents:
diff changeset
    82
        // Used note types
hgs
parents:
diff changeset
    83
        enum TSerqNoteType
hgs
parents:
diff changeset
    84
            {
hgs
parents:
diff changeset
    85
            ESerqDefault,
hgs
parents:
diff changeset
    86
            ESerqLocalInformationNote,
hgs
parents:
diff changeset
    87
            ESerqLocalConfirmationNote,
hgs
parents:
diff changeset
    88
            ESerqGlobalInformationNote,
hgs
parents:
diff changeset
    89
            ESerqGlobalErrorNote,
hgs
parents:
diff changeset
    90
            ESerqGlobalConfirmationNote
hgs
parents:
diff changeset
    91
            };
hgs
parents:
diff changeset
    92
hgs
parents:
diff changeset
    93
        
hgs
parents:
diff changeset
    94
        /**
hgs
parents:
diff changeset
    95
        * Two-phased constructor.
hgs
parents:
diff changeset
    96
        * @param aObserver Oberver to inform cancelling.
hgs
parents:
diff changeset
    97
        * @return New CServiceRequest object.
hgs
parents:
diff changeset
    98
        */
hgs
parents:
diff changeset
    99
        IMPORT_C static CServiceRequest* NewL( MServiceRequestObserver& aObserver );
hgs
parents:
diff changeset
   100
        
hgs
parents:
diff changeset
   101
        /**
hgs
parents:
diff changeset
   102
        * Destructor.
hgs
parents:
diff changeset
   103
        */
hgs
parents:
diff changeset
   104
        IMPORT_C virtual ~CServiceRequest();
hgs
parents:
diff changeset
   105
hgs
parents:
diff changeset
   106
    public: // New functions
hgs
parents:
diff changeset
   107
        
hgs
parents:
diff changeset
   108
        /**
hgs
parents:
diff changeset
   109
        * Starts a wait note.
hgs
parents:
diff changeset
   110
        * @since 1.2
hgs
parents:
diff changeset
   111
        * @param aText "Requesting" text is used, if this descriptor's
hgs
parents:
diff changeset
   112
        *              lenght is zero.
hgs
parents:
diff changeset
   113
        */
hgs
parents:
diff changeset
   114
        IMPORT_C void StartL( const TDesC& aText = KNullDesC() );
hgs
parents:
diff changeset
   115
hgs
parents:
diff changeset
   116
        /**
hgs
parents:
diff changeset
   117
        * Removes wait note and shows new note if wanted.
hgs
parents:
diff changeset
   118
        * If aShowNote = EFalse, this function won't leave!
hgs
parents:
diff changeset
   119
        * Removal of the wait note is guaranteed in leave cases also.
hgs
parents:
diff changeset
   120
        * @since 1.2
hgs
parents:
diff changeset
   121
        * @param aShowNote ETrue: a note is shown 
hgs
parents:
diff changeset
   122
        *                  EFalse: no additional note is shown
hgs
parents:
diff changeset
   123
        * @param aError Used in default notes. The default note type and used
hgs
parents:
diff changeset
   124
        *               text is decided based on this value. These vales are
hgs
parents:
diff changeset
   125
        *               overridden if note type or used text is geven as a
hgs
parents:
diff changeset
   126
        *               parameter.
hgs
parents:
diff changeset
   127
        * @param aNoteType Type of the note. If EDefault is used, then the
hgs
parents:
diff changeset
   128
        *                  aError parameter is checked.
hgs
parents:
diff changeset
   129
        * @param aText Given text. If lenght is zero, aError parameter is checked.
hgs
parents:
diff changeset
   130
        */
hgs
parents:
diff changeset
   131
        IMPORT_C void ShowCompletionNoteL( 
hgs
parents:
diff changeset
   132
            TBool aShowNote = ETrue,
hgs
parents:
diff changeset
   133
            TInt aError = KErrNone,
hgs
parents:
diff changeset
   134
            TSerqNoteType aNoteType = ESerqDefault,
hgs
parents:
diff changeset
   135
            const TDesC& aText = KNullDesC() );
hgs
parents:
diff changeset
   136
hgs
parents:
diff changeset
   137
    protected: // From baseclasses
hgs
parents:
diff changeset
   138
hgs
parents:
diff changeset
   139
        // From MProgressDialogCallback
hgs
parents:
diff changeset
   140
        void DialogDismissedL( TInt aButtonId );
hgs
parents:
diff changeset
   141
hgs
parents:
diff changeset
   142
        // From CActive
hgs
parents:
diff changeset
   143
        void RunL();
hgs
parents:
diff changeset
   144
hgs
parents:
diff changeset
   145
        // From CActive
hgs
parents:
diff changeset
   146
        void DoCancel();
hgs
parents:
diff changeset
   147
        
hgs
parents:
diff changeset
   148
        /**
hgs
parents:
diff changeset
   149
        * From CActive
hgs
parents:
diff changeset
   150
        * @param aError
hgs
parents:
diff changeset
   151
        * @return TInt
hgs
parents:
diff changeset
   152
        */
hgs
parents:
diff changeset
   153
        TInt RunError(TInt aError);
hgs
parents:
diff changeset
   154
hgs
parents:
diff changeset
   155
    private:
hgs
parents:
diff changeset
   156
hgs
parents:
diff changeset
   157
        /**
hgs
parents:
diff changeset
   158
        * C++ default constructor.
hgs
parents:
diff changeset
   159
        */
hgs
parents:
diff changeset
   160
        CServiceRequest( MServiceRequestObserver& aObserver );
hgs
parents:
diff changeset
   161
hgs
parents:
diff changeset
   162
        /**
hgs
parents:
diff changeset
   163
        * By default Symbian 2nd phase constructor is private.
hgs
parents:
diff changeset
   164
        */
hgs
parents:
diff changeset
   165
        void ConstructL();
hgs
parents:
diff changeset
   166
hgs
parents:
diff changeset
   167
        /**
hgs
parents:
diff changeset
   168
        * Zeroes data members
hgs
parents:
diff changeset
   169
        */
hgs
parents:
diff changeset
   170
        void Reset();
hgs
parents:
diff changeset
   171
hgs
parents:
diff changeset
   172
        /**
hgs
parents:
diff changeset
   173
        * Gets default note implementation for give error value.
hgs
parents:
diff changeset
   174
        */
hgs
parents:
diff changeset
   175
        static void GetDefaultNote( 
hgs
parents:
diff changeset
   176
            const TInt aError , 
hgs
parents:
diff changeset
   177
            TSerqNoteType& aNoteType , 
hgs
parents:
diff changeset
   178
            TInt& aResourceId );
hgs
parents:
diff changeset
   179
hgs
parents:
diff changeset
   180
        /**
hgs
parents:
diff changeset
   181
        * Launches given note. Text is fetched from iNoteText.
hgs
parents:
diff changeset
   182
        */
hgs
parents:
diff changeset
   183
        void LaunchNoteL( const TSerqNoteType aNoteType);
hgs
parents:
diff changeset
   184
hgs
parents:
diff changeset
   185
    private:    // Data
hgs
parents:
diff changeset
   186
        // Service request observer
hgs
parents:
diff changeset
   187
        MServiceRequestObserver& iObserver;
hgs
parents:
diff changeset
   188
hgs
parents:
diff changeset
   189
        // Requesting wait note:
hgs
parents:
diff changeset
   190
        CAknWaitDialog* iRequestingNote;
hgs
parents:
diff changeset
   191
hgs
parents:
diff changeset
   192
        // Resource loader
hgs
parents:
diff changeset
   193
        RConeResourceLoader* iResourceLoader;
hgs
parents:
diff changeset
   194
hgs
parents:
diff changeset
   195
        // Text for note
hgs
parents:
diff changeset
   196
        HBufC* iNoteText;
hgs
parents:
diff changeset
   197
hgs
parents:
diff changeset
   198
        // Enables instance deletion in call back.
hgs
parents:
diff changeset
   199
        TBool* iDestroyed;
hgs
parents:
diff changeset
   200
         
hgs
parents:
diff changeset
   201
        // Reserved pointer for future extension
hgs
parents:
diff changeset
   202
        TAny* iReserved;
hgs
parents:
diff changeset
   203
    };
hgs
parents:
diff changeset
   204
hgs
parents:
diff changeset
   205
#endif      // CSERVICEREQUEST_H   
hgs
parents:
diff changeset
   206
            
hgs
parents:
diff changeset
   207
// End of File