phoneclientserver/phoneserver/src/ussd/cphsrvussdmanager.cpp
changeset 48 78df25012fda
parent 36 7c428525956b
child 51 12bc758d6a02
equal deleted inserted replaced
46:2fa1fa551b0b 48:78df25012fda
    85 // Refers to HbPopup::NoDismiss = 0
    85 // Refers to HbPopup::NoDismiss = 0
    86 const TInt KPhSrvUssdPopupDismissPolicy = 0; 
    86 const TInt KPhSrvUssdPopupDismissPolicy = 0; 
    87 // The time out only for testing, from CPhSrvUssdReplyTimer.cpp
    87 // The time out only for testing, from CPhSrvUssdReplyTimer.cpp
    88 const TUint KPhSrvUssdTimeout = 300000000;
    88 const TUint KPhSrvUssdTimeout = 300000000;
    89 
    89 
       
    90 //Refers to HbMessageBox::Yes
       
    91 const TUint KHbMsgBoxBtnYes = 0x00002000;
       
    92 //Refers to HbMessageBox::No
       
    93 const TUint KHbMsgBoxBtnNo = 0x00010000;
       
    94 
    90 // Use QT style localization
    95 // Use QT style localization
    91 _LIT(KUssdLocFilename, "ussd_");
    96 _LIT(KUssdLocFilename, "ussd_");
    92 _LIT(KCommonLocFilename, "common_");
    97 _LIT(KCommonLocFilename, "common_");
    93 _LIT(KLocPath, "z:\\resource\\qt\\translations");
    98 _LIT(KLocPath, "z:\\resource\\qt\\translations");
    94 _LIT(KUssdReply, "txt_ussd_button_reply"); // Reply
    99 _LIT(KUssdReply, "txt_ussd_button_reply"); // Reply
   388      iFsSession( aFsSession ),
   393      iFsSession( aFsSession ),
   389      iResourceManager( aResourceManager ),
   394      iResourceManager( aResourceManager ),
   390      iDeviceDialog( NULL ),
   395      iDeviceDialog( NULL ),
   391      iDCS ( KPhCltDcsUnknown ),
   396      iDCS ( KPhCltDcsUnknown ),
   392      iReturnResultPckg ( iReturnResult ),
   397      iReturnResultPckg ( iReturnResult ),
   393      iTextBuffer ( NULL )
   398      iTextBuffer ( NULL ),
       
   399      iDialogType ( EInvalidType )
   394     {
   400     {
   395     CActiveScheduler::Add( this );
   401     CActiveScheduler::Add( this );
   396     }
   402     }
   397 
   403 
   398 
   404 
   876                 CHbDeviceMessageBoxSymbian::ERejectButton, ETrue );
   882                 CHbDeviceMessageBoxSymbian::ERejectButton, ETrue );
   877             iDeviceDialog->SetButtonTextL(
   883             iDeviceDialog->SetButtonTextL(
   878                 CHbDeviceMessageBoxSymbian::ERejectButton, 
   884                 CHbDeviceMessageBoxSymbian::ERejectButton, 
   879                 LoadDefaultString( KUssdExit ) );
   885                 LoadDefaultString( KUssdExit ) );
   880             _DPRINT( 4, "PhSrv.UssdHandleReceivedEventL.Exit" );             
   886             _DPRINT( 4, "PhSrv.UssdHandleReceivedEventL.Exit" );             
       
   887             iDialogType = EOnlyExit;
   881         }
   888         }
   882       
   889       
   883         if ( iNotifyMessage || iMsgTypeReply )
   890         if ( iNotifyMessage || iMsgTypeReply )
   884             {
   891             {
   885             //This is for reply message in notifyarray
   892             //This is for reply message in notifyarray
   911             {
   918             {
   912             // Remove Answer key
   919             // Remove Answer key
   913             iDeviceDialog->SetButton( 
   920             iDeviceDialog->SetButton( 
   914                 CHbDeviceMessageBoxSymbian::EAcceptButton, EFalse );
   921                 CHbDeviceMessageBoxSymbian::EAcceptButton, EFalse );
   915             _DPRINT( 4, "PhSrv.UssdHandleReceivedEventL.NoAnswer" ); 
   922             _DPRINT( 4, "PhSrv.UssdHandleReceivedEventL.NoAnswer" ); 
       
   923             iDialogType = EOnlyExit;
   916             }
   924             }
   917         // Show Reply key
   925         // Show Reply key
   918         else
   926         else
   919             {
   927             {
   920             iDeviceDialog->SetButton( 
   928             iDeviceDialog->SetButton( 
   921                 CHbDeviceMessageBoxSymbian::EAcceptButton, ETrue );              
   929                 CHbDeviceMessageBoxSymbian::EAcceptButton, ETrue );              
   922             iDeviceDialog->SetButtonTextL(
   930             iDeviceDialog->SetButtonTextL(
   923                 CHbDeviceMessageBoxSymbian::EAcceptButton, 
   931                 CHbDeviceMessageBoxSymbian::EAcceptButton, 
   924                 LoadDefaultString( KUssdReply ) ); 
   932                 LoadDefaultString( KUssdReply ) ); 
       
   933             iDeviceDialog->SetButton( 
       
   934                 CHbDeviceMessageBoxSymbian::ERejectButton, ETrue );              
       
   935             iDeviceDialog->SetButtonTextL(
       
   936                 CHbDeviceMessageBoxSymbian::ERejectButton, 
       
   937                 LoadDefaultString( KUssdExit ) );
   925             _DPRINT( 4, "PhSrv.UssdHandleReceivedEventL.WithAnswer" ); 
   938             _DPRINT( 4, "PhSrv.UssdHandleReceivedEventL.WithAnswer" ); 
       
   939             iDialogType = EReplyExit;
   926             }
   940             }
   927 
   941 
   928  
   942  
   929         _DPRINT( 4,
   943         _DPRINT( 4,
   930             "PhSrv.UssdHandleReceivedEventL.String.Middle" );
   944             "PhSrv.UssdHandleReceivedEventL.String.Middle" );
  1288     const CHbDeviceMessageBoxSymbian* aMessageBox,
  1302     const CHbDeviceMessageBoxSymbian* aMessageBox,
  1289     CHbDeviceMessageBoxSymbian::TButtonId aButton)
  1303     CHbDeviceMessageBoxSymbian::TButtonId aButton)
  1290     {
  1304     {
  1291     _DPRINT( 4, "PhSrv.MsgClose.Start" );
  1305     _DPRINT( 4, "PhSrv.MsgClose.Start" );
  1292     // ussd device dialog observer callback function
  1306     // ussd device dialog observer callback function
  1293     TPtrC leftBtn = aMessageBox->ButtonText( 
  1307 
  1294         CHbDeviceMessageBoxSymbian::EAcceptButton );
  1308     _DDPRINT( 4, "PhSrv.MsgClose.iDialogType=", iDialogType );
  1295     TPtrC rightBtn = aMessageBox->ButtonText( 
  1309     _DDPRINT( 4, "PhSrv.MsgClose.aBtn=", aButton );
  1296         CHbDeviceMessageBoxSymbian::ERejectButton );    
  1310     
  1297 
       
  1298     TInt err = KErrNone;
  1311     TInt err = KErrNone;
  1299     // Click Yes on Confirmation note (Yes, No) 
  1312     // Click Yes on Confirmation note (Yes, No) 
  1300     if ( !leftBtn.Compare( 
  1313     if ( EYesNo == iDialogType && 
  1301           LoadDefaultString( KUssdYes ) ) && 
       
  1302           ( CHbDeviceMessageBoxSymbian::EAcceptButton == aButton ) )
  1314           ( CHbDeviceMessageBoxSymbian::EAcceptButton == aButton ) )
  1303         {
  1315         {
  1304         _DPRINT( 4, "PhSrv.MsgClose.SK.Yes" );
  1316         _DPRINT( 4, "PhSrv.MsgClose.SK.Yes" );
  1305         iClearArray = EFalse;
  1317         iClearArray = EFalse;
  1306         iNotifyArray->Reset();
  1318         iNotifyArray->Reset();
  1307         TryCloseSession();
  1319         TryCloseSession();
  1308         }
  1320         }
  1309     // Click "No" on Confirmation note (Yes, No) 
  1321     // Click "No" on Confirmation note (Yes, No) 
  1310     else if ( !rightBtn.Compare( 
  1322     else if ( EYesNo == iDialogType && 
  1311                LoadDefaultString( KUssdNo ) ) && 
       
  1312               ( CHbDeviceMessageBoxSymbian::ERejectButton == aButton ) )
  1323               ( CHbDeviceMessageBoxSymbian::ERejectButton == aButton ) )
  1313         {
  1324         {
  1314         _DPRINT( 4, "PhSrv.MsgClose.SK.No" );
  1325         _DPRINT( 4, "PhSrv.MsgClose.SK.No" );
  1315         iClearArray = EFalse;
  1326         iClearArray = EFalse;
  1316         iNotifyMessage = ETrue; // for removing the yes/no query
  1327         iNotifyMessage = ETrue; // for removing the yes/no query
  1317         CheckArray();
  1328         CheckArray();
  1318         TryCloseSession();
  1329         TryCloseSession();
  1319         }
  1330         }
  1320     // Click "Next" on Notification note (Next, Exit) 
  1331     // Click "Next" on Notification note (Next, Exit) 
  1321     else if ( !leftBtn.Compare( 
  1332     else if ( ENextExit == iDialogType && 
  1322                LoadDefaultString( KUssdNext ) ) && 
       
  1323                ( CHbDeviceMessageBoxSymbian::EAcceptButton == aButton ) )
  1333                ( CHbDeviceMessageBoxSymbian::EAcceptButton == aButton ) )
  1324         {
  1334         {
  1325         _DPRINT( 4, "PhSrv.MsgClose.SK.Next" ); 
  1335         _DPRINT( 4, "PhSrv.MsgClose.SK.Next" ); 
  1326         CheckArray();
  1336         CheckArray();
  1327         TryCloseSession();
  1337         TryCloseSession();
  1328         }
  1338         }
  1329     // Click "Exit" on Notification note (Next, Exit or only Exit) 
  1339     // Click "Exit" on Notification note (Next, Exit or only Exit) 
  1330     else if ( !rightBtn.Compare( 
  1340     else if ( (EOnlyExit == iDialogType 
  1331                LoadDefaultString( KUssdExit ) ) && 
  1341             || ENextExit == iDialogType 
       
  1342             || EReplyExit == iDialogType ) && 
  1332                ( CHbDeviceMessageBoxSymbian::ERejectButton == aButton ) )
  1343                ( CHbDeviceMessageBoxSymbian::ERejectButton == aButton ) )
  1333         {
  1344         {
  1334         TRAP( err, ClearArrayL() );
  1345         TRAP( err, ClearArrayL() );
  1335         _DDPRINT( 4, "PhSrv.MsgClose.SK.Clear.%d", err );
  1346         _DDPRINT( 4, "PhSrv.MsgClose.SK.Clear.%d", err );
  1336         TryCloseSession();
  1347         TryCloseSession();
  1337         _DPRINT( 4, "PhSrv.MsgClose.SK.Exit" ); 
  1348         _DPRINT( 4, "PhSrv.MsgClose.SK.Exit" ); 
  1338         }
  1349         }
  1339     // Click "Reply" on Message note (Reply, Exit) 
  1350     // Click "Reply" on Message note (Reply, Exit) 
  1340     else if ( !leftBtn.Compare( 
  1351     else if ( EReplyExit == iDialogType && 
  1341                LoadDefaultString( KUssdReply ) ) && 
       
  1342                ( CHbDeviceMessageBoxSymbian::EAcceptButton == aButton ) )
  1352                ( CHbDeviceMessageBoxSymbian::EAcceptButton == aButton ) )
  1343         {
  1353         {
  1344         // Answer
  1354         // Answer
  1345         iStartEditor = ETrue;
  1355         iStartEditor = ETrue;
  1346         iShowDone = EFalse;
  1356         iShowDone = EFalse;
  1408                 CHbDeviceMessageBoxSymbian::ERejectButton, ETrue );    
  1418                 CHbDeviceMessageBoxSymbian::ERejectButton, ETrue );    
  1409             iDeviceDialog->SetButtonTextL(
  1419             iDeviceDialog->SetButtonTextL(
  1410                 CHbDeviceMessageBoxSymbian::ERejectButton, 
  1420                 CHbDeviceMessageBoxSymbian::ERejectButton, 
  1411                 LoadDefaultString( KUssdExit ) );  
  1421                 LoadDefaultString( KUssdExit ) );  
  1412             _DPRINT( 4, "PhSrv.LGMQ.Next&Exit" );
  1422             _DPRINT( 4, "PhSrv.LGMQ.Next&Exit" );
       
  1423             iDialogType = ENextExit;
  1413             }
  1424             }
  1414         else
  1425         else
  1415             {
  1426             {
  1416             // Only Exit
  1427             // Only Exit
  1417             iDeviceDialog->SetButton(
  1428             iDeviceDialog->SetButton(
  1420                 CHbDeviceMessageBoxSymbian::ERejectButton, ETrue );               
  1431                 CHbDeviceMessageBoxSymbian::ERejectButton, ETrue );               
  1421             iDeviceDialog->SetButtonTextL(
  1432             iDeviceDialog->SetButtonTextL(
  1422                 CHbDeviceMessageBoxSymbian::ERejectButton, 
  1433                 CHbDeviceMessageBoxSymbian::ERejectButton, 
  1423                 LoadDefaultString( KUssdExit ) );   
  1434                 LoadDefaultString( KUssdExit ) );   
  1424             _DPRINT( 4, "PhSrv.LGMQ.onlyExit" );
  1435             _DPRINT( 4, "PhSrv.LGMQ.onlyExit" );
       
  1436             iDialogType = EOnlyExit;
  1425             }
  1437             }
  1426         if ( iClearArray )
  1438         if ( iClearArray )
  1427             {
  1439             {
  1428             HbTextResolverSymbian::Init( KCommonLocFilename, KLocPath );
  1440             HbTextResolverSymbian::Init( KCommonLocFilename, KLocPath );
  1429             _DPRINT( 4, "PhSrv.LGMQ.use common loc file" );
  1441             _DPRINT( 4, "PhSrv.LGMQ.use common loc file" );
  1430             // Yes, No
  1442             // Yes, No
  1431             iDeviceDialog->SetButton(
  1443             iDeviceDialog->SetStandardButtons(KHbMsgBoxBtnYes
  1432                 CHbDeviceMessageBoxSymbian::EAcceptButton, ETrue );               
  1444                 |KHbMsgBoxBtnNo);
  1433             iDeviceDialog->SetButtonTextL(
  1445             iDeviceDialog->SetButtonTextL(
  1434                 CHbDeviceMessageBoxSymbian::EAcceptButton, 
  1446                 CHbDeviceMessageBoxSymbian::EAcceptButton, 
  1435                 LoadDefaultString( KUssdYes ) );
  1447                 LoadDefaultString( KUssdYes ) );
  1436             iDeviceDialog->SetButton(
       
  1437                 CHbDeviceMessageBoxSymbian::ERejectButton, ETrue );              
       
  1438             iDeviceDialog->SetButtonTextL(
  1448             iDeviceDialog->SetButtonTextL(
  1439                 CHbDeviceMessageBoxSymbian::ERejectButton, 
  1449                 CHbDeviceMessageBoxSymbian::ERejectButton, 
  1440                 LoadDefaultString( KUssdNo ) );  
  1450                 LoadDefaultString( KUssdNo ) );  
  1441             _DPRINT( 4, "PhSrv.LGMQ.Yes&No" );
  1451             _DPRINT( 4, "PhSrv.LGMQ.Yes&No" );
  1442             HbTextResolverSymbian::Init( KUssdLocFilename, KLocPath );
  1452             HbTextResolverSymbian::Init( KUssdLocFilename, KLocPath );
  1443             _DPRINT( 4, "PhSrv.LGMQ.back up to use ussd loc file" );
  1453             _DPRINT( 4, "PhSrv.LGMQ.back up to use ussd loc file" );
       
  1454             iDialogType = EYesNo;
  1444             }
  1455             }
  1445         iReceivedMessage.Zero();
  1456         iReceivedMessage.Zero();
  1446         iReceivedMessage = (*iNotifyArray)[0];
  1457         iReceivedMessage = (*iNotifyArray)[0];
  1447         }
  1458         }
  1448     TurnLightsOn(); //Ensure lights on
  1459     TurnLightsOn(); //Ensure lights on
  1666         iDeviceDialog->SetButton( 
  1677         iDeviceDialog->SetButton( 
  1667             CHbDeviceMessageBoxSymbian::EAcceptButton, ETrue ); 
  1678             CHbDeviceMessageBoxSymbian::EAcceptButton, ETrue ); 
  1668         iDeviceDialog->SetButtonTextL(
  1679         iDeviceDialog->SetButtonTextL(
  1669             CHbDeviceMessageBoxSymbian::EAcceptButton, 
  1680             CHbDeviceMessageBoxSymbian::EAcceptButton, 
  1670             LoadDefaultString( KUssdNext ) );
  1681             LoadDefaultString( KUssdNext ) );
       
  1682         iDialogType = ENextExit;
  1671         }
  1683         }
  1672     // Remove left softkey
  1684     // Remove left softkey
  1673     else
  1685     else
  1674         {
  1686         {
  1675         iDeviceDialog->SetButton( 
  1687         iDeviceDialog->SetButton(