commondrm/drmui/drmuidialogs/inc/drmuidialogs.h
branchRCL_3
changeset 27 1481bf457703
parent 26 1221b68b8a5f
child 28 00671737faf2
equal deleted inserted replaced
26:1221b68b8a5f 27:1481bf457703
     1 /*
       
     2 * Copyright (c) 2010 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:  CDrmUIDialogs API can be used to show UI dialogs via 
       
    15 * notification dialog plugin.
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef C_DRMUIDIALOGS_H
       
    20 #define C_DRMUIDIALOGS_H
       
    21 
       
    22 #include <e32base.h>                            // CActive
       
    23 #include <hb/hbcore/hbdevicedialogsymbian.h>    // MHbDeviceDialogObserver
       
    24 
       
    25 class CHbSymbianVariantMap;
       
    26 class CActiveSchedulerWait;
       
    27 
       
    28 /**
       
    29  * CDrmUIDialogs manages and controls DRM UI notes and queries. 
       
    30  * An Orbit device dialog plugin implements the UI dialogs.
       
    31  *
       
    32  * @dll drmuidialogs.dll
       
    33  * @since 10.1
       
    34  */
       
    35 NONSHARABLE_CLASS( CDrmUIDialogs ) : public CActive,
       
    36                                      public MHbDeviceDialogObserver
       
    37     {
       
    38     public:  // constructor and destructor
       
    39         /**
       
    40          * Creates new CDrmUIDialogs object and pushes it into cleanup stack.
       
    41          * @returns CDrmUIDialogs* -- new CDrmUIDialogs object
       
    42          */
       
    43         IMPORT_C static CDrmUIDialogs* NewLC();
       
    44 
       
    45         /**
       
    46          * Creates new CDrmUIDialogs object.
       
    47          * @returns CDrmUIDialogs* -- new CDrmUIDialogs object
       
    48          */
       
    49         IMPORT_C static CDrmUIDialogs* NewL();
       
    50 
       
    51         /**
       
    52          * Destructor.
       
    53          */
       
    54         CDrmUIDialogs::~CDrmUIDialogs();
       
    55 
       
    56     public:
       
    57         /**
       
    58         * Displays a note or query dialog synchronously. Synchronous function.
       
    59         * Returns after the user has accepted or cancelled the query.
       
    60         * @param aDialogId  dialog id of dialog to be displayed
       
    61         * @param aString    string that replaces %U in resource string
       
    62         * @param aValue     integer that replaces %N in resource string
       
    63         * @return EOk if user accepted the query, ECancelled otherwise
       
    64         */
       
    65         IMPORT_C TInt ShowNoteL( TInt aDialogId, 
       
    66                                  const TDesC& aString = KNullDesC, 
       
    67                                  TInt aValue = -1 );
       
    68 
       
    69     protected:  // from CActive
       
    70         void DoCancel();
       
    71         void RunL();
       
    72 
       
    73     private:    // from MHbDeviceDialogObserver
       
    74         void DataReceived( CHbSymbianVariantMap& aData );
       
    75         void DeviceDialogClosed( TInt aCompletionCode );
       
    76 
       
    77     private:
       
    78         CDrmUIDialogs();
       
    79         void ConstructL();
       
    80         void ClearParamsL();
       
    81         void ClearParamsAndSetDialogIdL( TInt aDialogId );
       
    82         void AddParamL( const TDesC& aKey, TInt aValue );
       
    83         void AddParamL( const TDesC& aKey, const TDesC& aValue );
       
    84         void DisplayDeviceDialogL();
       
    85         TInt WaitUntilDeviceDialogClosed();
       
    86 
       
    87     private:    // data
       
    88         CHbDeviceDialogSymbian* iDeviceDialog; // own
       
    89         CHbSymbianVariantMap* iVariantMap; // own
       
    90         CActiveSchedulerWait* iWait; // own
       
    91         TBool iIsDisplayingDialog;
       
    92         TInt iCompletionCode;
       
    93         TInt iReturnValue;
       
    94     };
       
    95 
       
    96 #endif  // C_DRMUIDIALOGS_H