omadrm/drmhelper/inc/DRMHelperGlobalNoteWrapper.h
changeset 0 95b198f216e5
child 12 8a03a285ab14
equal deleted inserted replaced
-1:000000000000 0:95b198f216e5
       
     1 /*
       
     2 * Copyright (c) 2004 - 2007 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:  Synchronous wrapper for showing global notes
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 #ifndef __DRMHELPERGLOBALNOTEWRAPPER_H__
       
    21 #define __DRMHELPERGLOBALNOTEWRAPPER_H__
       
    22 
       
    23 //  INCLUDES
       
    24 #include <e32base.h>
       
    25 #include <StringResourceReader.h>
       
    26 
       
    27 // CONSTANTS
       
    28 const TInt KDRMNoteBufferMaxSize ( 256 );
       
    29 
       
    30 // MACROS
       
    31 
       
    32 // DATA TYPES
       
    33 
       
    34 // FUNCTION PROTOTYPES
       
    35 
       
    36 // FORWARD DECLARATIONS
       
    37 
       
    38 // CLASS DECLARATION
       
    39 
       
    40 /**
       
    41 *  Wrapper class for displaying global notes.
       
    42 *
       
    43 *  @lib drmhelper.lib
       
    44 *  @since Series 60 2.6
       
    45 */
       
    46 class CDRMHelperGlobalNoteWrapper : public CActive
       
    47     {
       
    48 public:  // Constructors and destructor
       
    49 
       
    50     /**
       
    51     * Two-phased constructor.
       
    52     */
       
    53     static CDRMHelperGlobalNoteWrapper* NewL(
       
    54         CStringResourceReader* aResourceReader );
       
    55 
       
    56     static CDRMHelperGlobalNoteWrapper* NewLC(
       
    57         CStringResourceReader* aResourceReader );
       
    58 
       
    59     /**
       
    60     * Destructor.
       
    61     */
       
    62     virtual ~CDRMHelperGlobalNoteWrapper();
       
    63 
       
    64 public: // New functions
       
    65 
       
    66     /**
       
    67     * Synchronous wrapper for showing global note.
       
    68     * @param aTextResourceId resource id of string to be displayed
       
    69     * @param aButtonsId resource id of buttons of note
       
    70     * @return mapped button code
       
    71     * @see MappedButtonId
       
    72     */
       
    73     TInt ShowNoteWithButtonsL( TInt aResourceId, TInt aButtonsId );
       
    74 
       
    75     /**
       
    76     * Synchronous wrapper for showing global note.
       
    77     * @param aTextResourceId resource id of string to be displayed
       
    78     * @param aButtonsId resource id of buttons of note
       
    79     * @param aString string which replaces %U in resource string
       
    80     * @return mapped button code
       
    81     * @see MappedButtonId
       
    82     */
       
    83     TInt ShowNoteWithButtonsL( TInt aResourceId, TInt aButtonsId,
       
    84         const TDesC& aString );
       
    85 
       
    86     /**
       
    87     * Synchronous wrapper for showing global note.
       
    88     * @param aTextResourceId resource id of string to be displayed
       
    89     * @param aValue integer that replaces %N in resource string
       
    90     * @return mapped button code
       
    91     * @see MappedButtonId
       
    92     */
       
    93     TInt ShowNoteL( TInt aResourceId, TInt aValue );
       
    94 
       
    95     /**
       
    96     * Synchronous wrapper for showing global note.
       
    97     * @param aTextResourceId resource id of string to be displayed
       
    98     * @param aString string that replaces %U in resource string
       
    99     * @return mapped button code
       
   100     * @see MappedButtonId
       
   101     */
       
   102     TInt ShowNoteL( TInt aResourceId, const TDesC& aString );
       
   103 
       
   104     /**
       
   105     * Synchronous wrapper for showing global note.
       
   106     * @param aTextResourceId resource id of string to be displayed
       
   107     * @param aString string that replaces %U in resource string
       
   108     * @param aValue integer that replaces %N in resource string
       
   109     * @return mapped button code
       
   110     * @see MappedButtonId
       
   111     */
       
   112     TInt ShowNoteL(
       
   113         TInt aResourceId,
       
   114         const TDesC& aString,
       
   115         TInt aValue,
       
   116         TInt aStringPos = -1,
       
   117         TInt aValuePos = -1 );
       
   118 
       
   119 private: // From CActive
       
   120 
       
   121     void DoCancel();
       
   122     void RunL();
       
   123 
       
   124 private:
       
   125 
       
   126     /**
       
   127     * C++ default constructor.
       
   128     */
       
   129     CDRMHelperGlobalNoteWrapper();
       
   130 
       
   131     /**
       
   132     * By default Symbian 2nd phase constructor is private.
       
   133     */
       
   134     void ConstructL( CStringResourceReader* aResourceReader );
       
   135 
       
   136     /**
       
   137     * Do actual displaying of note
       
   138     */
       
   139     TInt DoShowNoteL(TInt aResourceId, const TDesC& aString = KNullDesC,
       
   140         TInt aValue = -1 );
       
   141     /**
       
   142     * @name MappedButtonId
       
   143     * @param aButtonId, raw button id
       
   144     *
       
   145     * @return aButtonId for positive answers ( like EAknSoftkeyOk )
       
   146     *     0 for negative answers ( like EAknSoftkeyCancel, EAknSoftkeyNo )
       
   147     *
       
   148     * @note borrowed from CEikDialog::MappedCommandId
       
   149     *
       
   150     * @see CEikDialog::MappedCommandId
       
   151     */
       
   152     TInt MappedButtonId( TInt aButtonId ) const;
       
   153 
       
   154 private:    // Data
       
   155 
       
   156     // Used to make asynchronous call synchronous
       
   157     CActiveSchedulerWait    iWait;
       
   158 
       
   159     // Text buffer used with global notes. Can contain max
       
   160     // KTextBufferMaxSize long string + filename.
       
   161     TBuf<KDRMNoteBufferMaxSize + KMaxFileName> iTextBuffer;
       
   162 
       
   163     // used to read resources
       
   164     CStringResourceReader* iResourceReader;
       
   165 
       
   166     // Resource id of buttons in confirmation query
       
   167     TInt iButtonsId;
       
   168     };
       
   169 
       
   170 
       
   171 #endif      // __DRMHelperGlobalNoteWrapper_H__
       
   172 
       
   173 // End of File
       
   174