stif/StifTFwIf/src/UIStorePopup.cpp
branchRCL_3
changeset 59 8ad140f3dd41
equal deleted inserted replaced
49:7fdc9a71d314 59:8ad140f3dd41
       
     1 /*
       
     2 * Copyright (c) 2009 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: CUIStorePopup: This object executes test cases 
       
    15 * from STIF Test Framework.
       
    16 *
       
    17 */
       
    18 
       
    19 // INCLUDE FILES
       
    20 #include <e32base.h>
       
    21 #include <e32svr.h>
       
    22 #include <stifinternal/UIStore.h>
       
    23 #include "UIStorePopup.h"
       
    24 #include "Logging.h"
       
    25 
       
    26 
       
    27 // EXTERNAL DATA STRUCTURES
       
    28 // None
       
    29 
       
    30 // EXTERNAL FUNCTION PROTOTYPES  
       
    31 // None
       
    32 
       
    33 // CONSTANTS
       
    34 
       
    35 // MACROS
       
    36 #ifdef LOGGER
       
    37 #undef LOGGER
       
    38 #endif
       
    39 #define LOGGER iUIStore->iLogger
       
    40 
       
    41 
       
    42 // LOCAL CONSTANTS AND MACROS
       
    43 // None
       
    44 
       
    45 // MODULE DATA STRUCTURES
       
    46 // None
       
    47 
       
    48 // LOCAL FUNCTION PROTOTYPES
       
    49 // None
       
    50 
       
    51 // FORWARD DECLARATIONS
       
    52 // None
       
    53 
       
    54 
       
    55 // ==================== LOCAL FUNCTIONS ======================================= 
       
    56 // None
       
    57 
       
    58 // ================= MEMBER FUNCTIONS =========================================
       
    59 
       
    60 /*
       
    61 -------------------------------------------------------------------------------
       
    62 
       
    63     Class: CUIStorePopup
       
    64 
       
    65     Method: CUIStorePopup
       
    66 
       
    67     Description: Default constructor
       
    68 
       
    69     C++ default constructor can NOT contain any code, that
       
    70     might leave.
       
    71 
       
    72     Parameters: None
       
    73     
       
    74     Return Values: None
       
    75 
       
    76     Errors/Exceptions: None
       
    77 
       
    78     Status: Draft
       
    79 
       
    80 -------------------------------------------------------------------------------
       
    81 */
       
    82 CUIStorePopup::CUIStorePopup( CUIStore* aUIStore,
       
    83                               CUIEngineContainer* aContainer,
       
    84                               CStifTFwIfProt* aRemoteMsg,                             
       
    85                               CUIStore::TPopupPriority aPopupPriority) :
       
    86     CActive( CActive::EPriorityStandard ),
       
    87     iUIStore( aUIStore ),
       
    88     iRemoteMsg( aRemoteMsg ),
       
    89     iContainer( aContainer ),
       
    90     iPopupPriority( aPopupPriority )
       
    91     {
       
    92     __TRACE( KPrint, ( _L( "CUIStorePopup::CUIStorePopup") ) );
       
    93     __ASSERT_ALWAYS( aUIStore, User::Panic( _L("Null pointer"), KErrGeneral ) );
       
    94 
       
    95     CActiveScheduler::Add( this );
       
    96     }
       
    97 
       
    98 
       
    99 /*
       
   100 -------------------------------------------------------------------------------
       
   101 
       
   102     Class: CUIStorePopup
       
   103 
       
   104     Method: ConstructL
       
   105 
       
   106     Description: Symbian OS second phase constructor
       
   107 
       
   108     Symbian OS default constructor can leave.
       
   109 
       
   110     Parameters: None
       
   111 
       
   112     Return Values: None
       
   113 
       
   114     Errors/Exceptions: Leaves if called Open method returns error
       
   115 
       
   116     Status: Approved
       
   117 
       
   118 -------------------------------------------------------------------------------
       
   119 */
       
   120 void CUIStorePopup::ConstructL( const TDesC& aMsg )
       
   121     {    
       
   122     iMsg = aMsg.AllocL();
       
   123     }
       
   124 
       
   125 
       
   126 /*
       
   127 -------------------------------------------------------------------------------
       
   128 
       
   129     Class: CUIStorePopup
       
   130 
       
   131     Method: NewL
       
   132 
       
   133     Description: Two-phased constructor.
       
   134     
       
   135     Parameters: CUIStore* CUIStore: in: Pointer to CUIStore Interface
       
   136                 TTestInfo& aTestInfo: in: Test info
       
   137 
       
   138     Return Values: CUIStorePopup* : Pointer to created runner object
       
   139 
       
   140     Errors/Exceptions: Leaves if memory allocation for CUIStorePopup fails
       
   141                        Leaves if ConstructL leaves
       
   142 
       
   143     Status: Draft
       
   144 
       
   145 -------------------------------------------------------------------------------
       
   146 */
       
   147 CUIStorePopup* CUIStorePopup::NewL( CUIStore* aUIStore,
       
   148                                     CUIEngineContainer* aContainer,
       
   149                                     CStifTFwIfProt* aRemoteMsg,
       
   150                                     CUIStore::TPopupPriority aPopupPriority,
       
   151                                     const TDesC& aMsg )
       
   152     {
       
   153     
       
   154     CUIStorePopup* self =  
       
   155         new ( ELeave ) CUIStorePopup( aUIStore, aContainer, aRemoteMsg, aPopupPriority );
       
   156     CleanupStack::PushL( self );
       
   157     self->ConstructL( aMsg );
       
   158     CleanupStack::Pop();
       
   159     return self;
       
   160     
       
   161     }
       
   162 
       
   163 
       
   164 /*
       
   165 -------------------------------------------------------------------------------
       
   166 
       
   167     Class: CUIStorePopup
       
   168 
       
   169     Method: ~CUIStorePopup
       
   170 
       
   171     Description: Destructor
       
   172     
       
   173     Parameters: None
       
   174 
       
   175     Return Values: None
       
   176 
       
   177     Errors/Exceptions: None
       
   178 
       
   179     Status: Draft
       
   180 
       
   181 -------------------------------------------------------------------------------
       
   182 */
       
   183 CUIStorePopup::~CUIStorePopup()
       
   184     {
       
   185     __TRACE( KPrint, ( _L( "CUIStorePopup::~CUIStorePopup()") ) );
       
   186     Cancel();
       
   187     
       
   188     delete iMsg;
       
   189     delete iRemoteMsg;
       
   190     
       
   191     }
       
   192 
       
   193 /*
       
   194 -------------------------------------------------------------------------------
       
   195 
       
   196     Class: CUIStorePopup
       
   197 
       
   198     Method: Start
       
   199 
       
   200     Description: Call SETActive and return TRequestStatus member.
       
   201 
       
   202     Parameters: None
       
   203 
       
   204     Return Values: Symbian OS error code
       
   205     
       
   206     Errors/Exceptions: None
       
   207     
       
   208     Status: Draft
       
   209 
       
   210 -------------------------------------------------------------------------------
       
   211 */
       
   212 TInt CUIStorePopup::Start( const TDesC& aLine1, 
       
   213                            const TDesC& aLine2 )
       
   214     {
       
   215     __TRACE( KPrint, ( _L( "CUIStorePopup::Start") ) );
       
   216     
       
   217     if(IsActive())
       
   218     { 
       
   219         __TRACE( KPrint, ( _L( "CUIStorePopup already started") ) );
       
   220        return KErrNone;  
       
   221     }
       
   222           
       
   223     iPopupWindow = iUIStore->iUIStoreIf->PopupMsg( 
       
   224         aLine1, aLine2, KDefaultPopupTimeout, iKey, iStatus );
       
   225     
       
   226     if( iPopupWindow < 0 )
       
   227         {
       
   228         return iPopupWindow;
       
   229         }
       
   230 
       
   231     SetActive();
       
   232     return KErrNone;
       
   233     
       
   234     }
       
   235 /*
       
   236 -------------------------------------------------------------------------------
       
   237 
       
   238     Class: CUIStorePopup
       
   239 
       
   240     Method: RunL
       
   241 
       
   242     Description: RunL handles completed requests.
       
   243 
       
   244     Parameters: None
       
   245 
       
   246     Return Values: None
       
   247 
       
   248     Errors/Exceptions: Leaves if iStatus is not KErrNone, error is handled in
       
   249                        RunError called by CActiveObject
       
   250 
       
   251     Status: Draft
       
   252 
       
   253 -------------------------------------------------------------------------------
       
   254 */
       
   255 void CUIStorePopup::RunL()
       
   256     {
       
   257    
       
   258     __TRACE( KPrint, ( _L( "CUIStorePopup::RunL") ) );
       
   259     
       
   260     iUIStore->RemotePopupComplete( this, iStatus.Int(), 
       
   261                                    iContainer, iRemoteMsg, iKey );
       
   262         
       
   263     }
       
   264 
       
   265 /*
       
   266 -------------------------------------------------------------------------------
       
   267 
       
   268     Class: CUIStorePopup
       
   269 
       
   270     Method: DoCancel
       
   271 
       
   272     Description: Cancel active request.
       
   273 
       
   274     Parameters: None
       
   275 
       
   276     Return Values: None
       
   277 
       
   278     Errors/Exceptions: None
       
   279 
       
   280     Status: Draft
       
   281 
       
   282 -------------------------------------------------------------------------------
       
   283 */
       
   284 void CUIStorePopup::DoCancel()
       
   285     {
       
   286     __TRACE( KPrint, ( _L( "CUIStorePopup::DoCancel") ) );
       
   287     
       
   288     iUIStore->iUIStoreIf->Close( iPopupWindow );
       
   289         
       
   290     }
       
   291 
       
   292 /*
       
   293 -------------------------------------------------------------------------------
       
   294 
       
   295     DESCRIPTION
       
   296 
       
   297     CActiveTimer: This object prints running seconds to console screen.
       
   298 
       
   299 -------------------------------------------------------------------------------
       
   300 */
       
   301 
       
   302 // ================= MEMBER FUNCTIONS =========================================
       
   303 
       
   304 
       
   305 
       
   306 
       
   307 // ================= OTHER EXPORTED FUNCTIONS ================================= 
       
   308 // None
       
   309 
       
   310 // End of File