commondrm/drmutility/inc/DrmUtilityGlobalNoteWrapper.h
changeset 0 95b198f216e5
child 32 457cd4423b8c
equal deleted inserted replaced
-1:000000000000 0:95b198f216e5
       
     1 /*
       
     2 * Copyright (c) 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 __DRMUTILITYGLOBALNOTEWRAPPER_H__
       
    21 #define __DRMUTILITYGLOBALNOTEWRAPPER_H__
       
    22 
       
    23 //  INCLUDES
       
    24 #include <e32base.h>
       
    25 #include <stringresourcereader.h>
       
    26 
       
    27 namespace DRM 
       
    28 {
       
    29 
       
    30 // CONSTANTS
       
    31 const TInt KDRMNoteBufferMaxSize ( 256 );
       
    32 
       
    33 /**
       
    34 *  Wrapper class for displaying global notes.
       
    35 */
       
    36 NONSHARABLE_CLASS ( CDrmUtilityGlobalNoteWrapper ) : public CActive
       
    37     {
       
    38     public:  // Constructors and destructor
       
    39         
       
    40         /**
       
    41         * Two-phased constructor.
       
    42         */
       
    43         static CDrmUtilityGlobalNoteWrapper* NewL( 
       
    44                                     CStringResourceReader* aResourceReader );
       
    45         
       
    46         static CDrmUtilityGlobalNoteWrapper* NewLC( 
       
    47                                     CStringResourceReader* aResourceReader );
       
    48         
       
    49         /**
       
    50         * Destructor.
       
    51         */
       
    52         virtual ~CDrmUtilityGlobalNoteWrapper();
       
    53 
       
    54     public: // New functions
       
    55 
       
    56         /**
       
    57         * Synchronous wrapper for showing global note.
       
    58         * @param aTextResourceId resource id of string to be displayed
       
    59         * @param aButtonsId resource id of buttons of note
       
    60         * @return button code
       
    61         */
       
    62         TInt ShowNoteWithButtonsL( TInt aResourceId, TInt aButtonsId );
       
    63         
       
    64         /**
       
    65         * Synchronous wrapper for showing global note.
       
    66         * @param aTextResourceId resource id of string to be displayed
       
    67         * @param aButtonsId resource id of buttons of note
       
    68         * @param aString string which replaces %U in resource string
       
    69         * @return button code
       
    70         */
       
    71         TInt ShowNoteWithButtonsL( TInt aResourceId, 
       
    72                                    TInt aButtonsId, 
       
    73                                    const TDesC& aString );
       
    74         
       
    75         /**
       
    76         * Synchronous wrapper for showing global note.
       
    77         * @param aTextResourceId resource id of string to be displayed
       
    78         * @param aValue integer that replaces %N in resource string        
       
    79         * @return button code
       
    80         */
       
    81         TInt ShowNoteL( TInt aResourceId, TInt aValue );
       
    82 
       
    83         /**
       
    84         * Synchronous wrapper for showing global note.
       
    85         * @param aTextResourceId resource id of string to be displayed
       
    86         * @param aString string that replaces %U in resource string        
       
    87         * @return button code
       
    88         */
       
    89         TInt ShowNoteL( TInt aResourceId, const TDesC& aString );
       
    90 
       
    91         /**
       
    92         * Synchronous wrapper for showing global note.
       
    93         * @param aTextResourceId resource id of string to be displayed
       
    94         * @param aString string that replaces %U in resource string        
       
    95         * @param aValue integer that replaces %N in resource string        
       
    96         * @return button code
       
    97         */
       
    98         TInt ShowNoteL( TInt aResourceId, 
       
    99         	            const TDesC& aString, 
       
   100         	            TInt aValue,
       
   101         	            TInt aStringPos = -1,
       
   102         	            TInt aValuePos = -1 );
       
   103         	            
       
   104         /**
       
   105         * Synchronous wrapper for showing global  preview list query.
       
   106         * @param aTextResourceId resource id of preview structure to be
       
   107         *        displayed
       
   108         * @return button code
       
   109         */
       
   110         TInt ShowPreviewListQueryL( TInt aResourceId ); 
       
   111 
       
   112     private: // From CActive
       
   113     
       
   114     	void DoCancel();
       
   115     	void RunL();
       
   116         
       
   117     private:
       
   118 
       
   119         /**
       
   120         * C++ default constructor.
       
   121         */
       
   122         CDrmUtilityGlobalNoteWrapper();
       
   123 
       
   124         /**
       
   125         * By default Symbian 2nd phase constructor is private.
       
   126         */
       
   127         void ConstructL( CStringResourceReader* aResourceReader );
       
   128 
       
   129         /**
       
   130         * Do actual displaying of note
       
   131         */
       
   132         TInt DoShowNoteL(TInt aResourceId, 
       
   133                          const TDesC& aString = KNullDesC, 
       
   134                          TInt aValue = -1 );
       
   135         
       
   136     private:    // Data
       
   137 
       
   138         // Used to make asynchronous call synchronous
       
   139         CActiveSchedulerWait iWait;
       
   140 
       
   141         // Text buffer used with global notes. Can contain max 
       
   142         // KTextBufferMaxSize long string + filename.
       
   143         TBuf<KDRMNoteBufferMaxSize + KMaxFileName> iTextBuffer;
       
   144         
       
   145         // used to read resources
       
   146         CStringResourceReader* iResourceReader;
       
   147         
       
   148         // Resource id of buttons in confirmation query
       
   149         TInt iButtonsId;
       
   150     };
       
   151 
       
   152 }
       
   153 
       
   154 #endif      // __DRMUTILITYGLOBALNOTEWRAPPER_H__   
       
   155             
       
   156 // End of File
       
   157