--- a/phoneclientserver/phoneserver/Src/Ussd/CPhSrvUssdManager.cpp Fri Apr 16 15:31:58 2010 +0300
+++ b/phoneclientserver/phoneserver/Src/Ussd/CPhSrvUssdManager.cpp Mon May 03 13:01:45 2010 +0300
@@ -1,5 +1,5 @@
/*
-* Copyright (c) 2002-2005 Nokia Corporation and/or its subsidiary(-ies).
+* Copyright (c) 2002-2010 Nokia Corporation and/or its subsidiary(-ies).
* All rights reserved.
* This component and the accompanying materials are made available
* under the terms of "Eclipse Public License v1.0"
@@ -27,15 +27,9 @@
#include "mphsrvphoneinterface.h"
#include "cphsrvussdsessioncancelwaiter.h"
-#include <AknGlobalNote.h>
-#include <aknnotedialog.h>
-#include <aknstaticnotedialog.h>
-#include <AknProgressDialog.h>
#include <apacmdln.h>
#include <apgtask.h>
#include <bautils.h>
-#include <StringLoader.h>
-#include <AknGlobalMsgQuery.h>
#include <textresolver.h>
#include <charconv.h>
#include <gsmuelem.h>
@@ -45,7 +39,7 @@
#include <w32std.h>
#include <apgcli.h>
#include <cphcltussd.h>
-#include <avkon.rsg>
+#include <hbtextresolversymbian.h>
#include <phoneserver.rsg>
#include "phsrvdebuginfo.h"
#include <e32property.h>
@@ -61,7 +55,7 @@
const TInt KPhSrvUssdAppUID = 0x10005955;
const TInt KPhSrvUssdMessageQueryInterval = 500000; // 0.5 sec
-const TInt KPhSrvUssdNoteExitPeriod = 500000; // 0.5 sec
+//const TInt KPhSrvUssdNoteExitPeriod = 500000; // 0.5 sec
//
const TUint KPhSrvUssdDefaultDCS = 0x0f; // 00001111
@@ -86,6 +80,23 @@
const TUint KPhSrvUssdDcsMessageHandlingAlphabet8Bit = 0xf4; // 1111x1xx
const TInt KPhrUssdNotifyArraySize = 1;
+// Refers to HbPopup::NoDismiss = 0
+const TInt KPhSrvUssdPopupDismissPolicy = 0;
+// The time out only for testing, from CPhSrvUssdReplyTimer.cpp
+const TUint KPhSrvUssdTimeout = 300000000;
+
+// Use QT style localization
+_LIT(KUssdLocFilename, "phcltsrvussd.ts");
+_LIT(KUssdLocPath, "z://data");
+_LIT(KUssdReply, "txt_ussd_button_reply"); // Reply
+_LIT(KUssdExit, "txt_ussd_button_exit"); // Exit
+_LIT(KUssdNext, "txt_ussd_button_next"); //Next
+_LIT(KUssdYes, "txt_common_button_yes"); // Yes
+_LIT(KUssdNo, "txt_common_button_no"); // No
+_LIT(KUssdTitle, "txt_ussd_title_message"); // Message
+_LIT(KUssdDone, "txt_ussd_dpopinfo_done"); // Done
+_LIT(KUssdConfirm, "txt_ussd_info_there_are_still_unread_notifications");
+
// MACROS
#define _DPRINT_FLAGS() \
@@ -373,9 +384,11 @@
:CActive( EPriorityLow ),
iFsSession( aFsSession ),
iResourceManager( aResourceManager ),
+ iDeviceDialog( NULL ),
iDCS ( KPhCltDcsUnknown ),
- iReturnResultPckg ( iReturnResult )
-
+ iReturnResultPckg ( iReturnResult ),
+ iTextResolver ( EFalse ),
+ iTextBuffer ( NULL )
{
CActiveScheduler::Add( this );
}
@@ -390,7 +403,7 @@
//
CPhSrvUssdManager::~CPhSrvUssdManager()
{
- _DPRINT( 4, "PhSrv.~CPhSrvUssdManager.start" ); // debug print
+ _DPRINT( 4, "PhSrv.~CPhSrvUssdManager.start" );
delete iUssdSendHandler;
@@ -405,9 +418,12 @@
Cancel();
iTimer.Close();
-
- delete iGlobalMsgQuery;
- iGlobalMsgQuery = NULL;
+
+ delete iTextBuffer;
+ iTextBuffer = NULL;
+
+ delete iDeviceDialog;
+ iDeviceDialog = NULL;
if ( iNotifyArray )
{
@@ -424,13 +440,10 @@
iFsSession.Close();
iMobileUssdMessaging.Close();
-
- delete iMeQuHeaderText;
- iMeQuHeaderText = NULL;
delete iMoAckCallback;
- _DPRINT( 4, "PhSrv.~CPhSrvUssdManager.end" ); // debug print
+ _DPRINT( 4, "PhSrv.~CPhSrvUssdManager.end" );
}
@@ -443,7 +456,10 @@
//
void CPhSrvUssdManager::ConstructL( MPhSrvPhoneInterface& aPhoneInterface )
{
- _DPRINT( 4, "PhSrv.ConstructL.Start" ); // debug print
+ _DPRINT( 4, "PhSrv.ConstructL.Start" );
+ iTextResolver = HbTextResolverSymbian::Init(
+ KUssdLocFilename, KUssdLocPath );
+ _DDPRINT( 4, "PhSrv.ConstructL.loc:", iTextResolver );
User::LeaveIfError( iTimer.CreateLocal() );
User::LeaveIfError( iMobileUssdMessaging.Open( aPhoneInterface.PhSrvMobilePhone() ) );
@@ -479,14 +495,10 @@
User::LeaveIfError( GetTelephonyVariantData() );
- iMeQuHeaderText = iResourceManager.ReadResourceLC(
- R_PHSRV_USSD_MESQUERY_MESSAGE);
- CleanupStack::Pop( iMeQuHeaderText );
-
_DDPRINT( 4, "PhSrv.ConstructL.iSatCanceled ", iSatCanceled );
_DDPRINT( 4, "PhSrv.ConstructL.iShowDone ", iShowDone );
iNotifyArray = new( ELeave ) CDesCArrayFlat( KPhrUssdNotifyArraySize );
- _DPRINT( 4, "PhSrv.ConstructL.End" ); // debug print
+ _DPRINT( 4, "PhSrv.ConstructL.End" );
}
@@ -501,20 +513,20 @@
{
// If SendHandler is not created, first check that MO Ussd
// is supported by the TSY.
- _DPRINT( 4, "PhSrv.SendHandlerL.Start" ); // debug print
+ _DPRINT( 4, "PhSrv.SendHandlerL.Start" );
if ( iUssdSendHandler == NULL )
{
- _DPRINT( 4, "PhSrv.SendHandlerL.iUssdSendHandler.NULL" ); // debug print
+ _DPRINT( 4, "PhSrv.SendHandlerL.iUssdSendHandler.NULL" );
RMobileUssdMessaging::TMobileUssdCapsV1 caps;
RMobileUssdMessaging::TMobileUssdCapsV1Pckg pckgCaps( caps );
User::LeaveIfError( iMobileUssdMessaging.GetCaps( pckgCaps ) );
- _DPRINT( 4, "PhSrv.SendHandlerL.iMobileUssdMessaging.GetCaps" ); // debug print
+ _DPRINT( 4, "PhSrv.SendHandlerL.iMobileUssdMessaging.GetCaps" );
if ( ( caps.iUssdTypes & RMobileUssdMessaging::KCapsMOUssd ) == 0 ||
( caps.iUssdFormat & RMobileUssdMessaging::KCapsPackedString )
== 0 )
{
- _DPRINT( 4, "PhSrv.SendHandlerL.KErrNotSupported" ); // debug print
+ _DPRINT( 4, "PhSrv.SendHandlerL.KErrNotSupported" );
User::Leave( KErrNotSupported );
}
@@ -524,7 +536,7 @@
iMobileUssdMessaging,
*iPhoneInterface );
}
- _DPRINT( 4, "PhSrv.SendHandlerL.End" ); // debug print
+ _DPRINT( 4, "PhSrv.SendHandlerL.End" );
return *iUssdSendHandler;
}
@@ -541,7 +553,7 @@
RMobileUssdMessaging::TMobileUssdAttributesV1& aMsgAttribute,
MPhSrvUssdMessageSentObserver& aObserver )
{
- _DPRINT( 4, "PhSrv.SendUssdL.Start ######" ); // debug print
+ _DPRINT( 4, "PhSrv.SendUssdL.Start ######" );
_DPRINT_FLAGS();
if ( iObserver && iNetworkReleased )
@@ -549,7 +561,7 @@
// Network has been released but the previous send request is still alive.
// Cancel the pervious send operation, complete the old request with error
// and clean up the pointer.
- _DPRINT( 4, "PhSrv.SendUssdL.Error.Complete.Existing" ); // debug print
+ _DPRINT( 4, "PhSrv.SendUssdL.Error.Complete.Existing" );
if ( iUssdSendHandler )
{
iUssdSendHandler->Cancel();
@@ -560,7 +572,7 @@
if ( iObserver || iSendingAck )
{
- _DPRINT( 4, "PhSrv.SendUssdL.KErrInUse" ); // debug print
+ _DPRINT( 4, "PhSrv.SendUssdL.KErrInUse" );
// Other client is using the service.
User::Leave( KErrInUse );
}
@@ -568,7 +580,7 @@
// Check that message type is set
if( ( aMsgAttribute.iFlags & RMobileUssdMessaging::KUssdMessageType )
== 0 )
- _DPRINT( 4, "PhSrv.SendUssdL.KUssdMessageType.0" ); // debug print
+ _DPRINT( 4, "PhSrv.SendUssdL.KUssdMessageType.0" );
{
// Mesasge type not set -> Set it.
aMsgAttribute.iFlags |= RMobileUssdMessaging::KUssdMessageType;
@@ -588,7 +600,7 @@
RMobileUssdMessaging::TMobileUssdAttributesV1Pckg attribs( aMsgAttribute );
iShowDone = ETrue;
_DPRINT( 4, "PhSrv.SendUssdL.iShowDone.ETrue" );
- _DPRINT( 4, "PhSrv.SendUssdL.Send" ); // debug print
+ _DPRINT( 4, "PhSrv.SendUssdL.Send" );
SendHandlerL().SendUssdL( aMsgData , attribs );
iObserver = &aObserver;
// Not closing nor closed anymore
@@ -603,7 +615,7 @@
_DPRINT( 4, "PhSrv.SendUssdCancel.TimerStop" ); // debug print
iUssdReplyTimer->Stop();
}
- _DPRINT( 4, "PhSrv.SendUssdL.End" ); // debug print
+ _DPRINT( 4, "PhSrv.SendUssdL.End" );
}
// -----------------------------------------------------------------------------
@@ -623,7 +635,7 @@
//
void CPhSrvUssdManager::SendUssdCancel()
{
- _DPRINT( 4, "PhSrv.SendUssdCancel.Start #######" ); // debug print
+ _DPRINT( 4, "PhSrv.SendUssdCancel.Start #######" );
// Ack sending should not be canceled unless it's about terminating
// the whole session
@@ -642,7 +654,7 @@
iObserver = NULL;
SetActiveIfPendingNotificationsExist();
- _DPRINT( 4, "PhSrv.SendUssdCancel.End" ); // debug print
+ _DPRINT( 4, "PhSrv.SendUssdCancel.End" );
}
// -----------------------------------------------------------------------------
@@ -681,14 +693,14 @@
// complete SAT if needed
if ( aError < KErrNone )
{
- // debug print
+
_DPRINT( 4, "PhSrv.UssdNetworkObserverHandleSendEventL.CompleteSat" );
CompleteSatL( NULL, aError );
}
if ( iObserver )
{
- // debug print
+
_DPRINT( 4, "PhSrv.UssdNetworkObserverHandleSendEventL.Observer" );
iObserver->UssdMessageSentObserverHandleResult( aError );
@@ -746,7 +758,7 @@
if ( aError != KErrNone )
{
TurnLightsOn(); //Ensure lights on
- // debug print
+
_DPRINT( 4, "PhSrv.UssdNetworkObserverHandleReceivedEventL.ShErNote" );
ShowErrorNoteL( aError );
}
@@ -763,9 +775,6 @@
// -----------------------------------------------------------------------------
// CPhSrvUssdManager::UssdHandleReceivedEventL
-//
-//
-//
// -----------------------------------------------------------------------------
//
void CPhSrvUssdManager::UssdHandleReceivedEventL(
@@ -779,7 +788,7 @@
// 2. Complete Send with some positive value.
if ( iObserver )
{
- // debug print
+
_DPRINT( 4, "PhSrv.UssdHandleReceivedEventL.Observer" );
UssdNetworkObserverHandleSendEventL( 1 ); // some positive value
}
@@ -813,7 +822,7 @@
{
if ( !ShowNotesL() )
{
- // debug print
+
_DPRINT( 4,
"PhSrv.UssdHandleReceivedEventL.SAtReturn" );
return;
@@ -824,13 +833,13 @@
if ( !iDecodedMessage.Length() )
{
TurnLightsOn(); //Ensure lights on
- // debug print
+
_DPRINT( 4,
"PhSrv.UssdHandleReceivedEventL.EmptyString" );
ShowDoneNoteL();
- // debug print
+
_DPRINT( 4,
"PhSrv.UssdHandleReceivedEventL.EmptyString.OK" );
}
@@ -849,6 +858,25 @@
iAcksToBeSent ++;
}
+ if ( !iDeviceDialog ){
+ iDeviceDialog = CHbDeviceMessageBoxSymbian::NewL(
+ CHbDeviceMessageBoxSymbian::EInformation );
+ iDeviceDialog->SetObserver( this );
+ iDeviceDialog->SetTimeout( KPhSrvUssdTimeout );
+ iDeviceDialog->SetDismissPolicy ( KPhSrvUssdPopupDismissPolicy );
+
+ // Show left key with empty string accoring to ui concept
+ iDeviceDialog->SetButton(
+ CHbDeviceMessageBoxSymbian::EAcceptButton, EFalse );
+ // Show Exit Key always
+ iDeviceDialog->SetButton(
+ CHbDeviceMessageBoxSymbian::ERejectButton, ETrue );
+ iDeviceDialog->SetButtonTextL(
+ CHbDeviceMessageBoxSymbian::ERejectButton,
+ LoadDefaultString( KUssdExit ) );
+ _DPRINT( 4, "PhSrv.UssdHandleReceivedEventL.Exit" );
+ }
+
if ( iNotifyMessage || iMsgTypeReply )
{
//This is for reply message in notifyarray
@@ -858,12 +886,12 @@
//Notify added to array
iNotifyArray->AppendL( iReceivedMessage );
- _DPRINT( 4, "PhSrv.UssdHandleReceivedEventL.AppendL" ); // debug print
- UpdateNotifyMessage();
+ _DPRINT( 4, "PhSrv.UssdHandleReceivedEventL.AppendL" );
+ UpdateNotifyMessageL();
if ( !iSendRelease && NotifyCount() <= 1 )
{
- _DPRINT( 4, "PhSrv.UssdHandleReceivedEventL.!SendRelease.Cancel" ); // debug print
+ _DPRINT( 4, "PhSrv.UssdHandleReceivedEventL.!SendRelease.Cancel" );
Cancel();
}
}
@@ -871,35 +899,44 @@
{
// New message deletes old message, i.e. Cancel existing query.
Cancel();
- _DPRINT( 4, "PhSrv.UssdHandleReceivedEventL.NewAnswerable" ); // debug print
+ _DPRINT( 4, "PhSrv.UssdHandleReceivedEventL.NewAnswerable" );
}
- if ( !iGlobalMsgQuery )
- {
- iGlobalMsgQuery = CAknGlobalMsgQuery::NewL();
- }
-
- // Delay after message query so that application execution order will
- // be correct.
- iGlobalMsgQuery->SetExitDelay( KPhSrvUssdNoteExitPeriod );
-
- TInt softkeys = R_AVKON_SOFTKEYS_USSD_ANSWER_EXIT__ANSWER;
+ // Remove Reply key
if( !( aMsgAttributes.iFlags & RMobileUssdMessaging::KUssdMessageType )
|| aMsgAttributes.iType != RMobileUssdMessaging::EUssdMTRequest )
{
- softkeys = R_AVKON_SOFTKEYS_EXIT;
+ // Remove Answer key
+ iDeviceDialog->SetButton(
+ CHbDeviceMessageBoxSymbian::EAcceptButton, EFalse );
+ _DPRINT( 4, "PhSrv.UssdHandleReceivedEventL.NoAnswer" );
+ }
+ // Show Reply key
+ else
+ {
+ iDeviceDialog->SetButton(
+ CHbDeviceMessageBoxSymbian::EAcceptButton, ETrue );
+ iDeviceDialog->SetButtonTextL(
+ CHbDeviceMessageBoxSymbian::EAcceptButton,
+ LoadDefaultString( KUssdReply ) );
+ _DPRINT( 4, "PhSrv.UssdHandleReceivedEventL.WithAnswer" );
}
- // Set timer that lauches Global MessageQuery after time interval.
- iSoftkeys = softkeys;
-
- // debug print
+
_DPRINT( 4,
"PhSrv.UssdHandleReceivedEventL.String.Middle" );
// Play the USSD tone if needed. Logically should be in RunL, but here
// to give better balancing with voice and visible message.
-
+ // <-- QT PHONE START-->
+ /*
+ if ( IsTelephonyFeatureSupported( KTelephonyLVFlagUssdTone ) )
+ {
+ _DPRINT( 4, "PhSrv.UssdHandleReceivedEventL.PlayTone" );
+ PlayUssdTone();
+ }
+ */
+ // <-- QT PHONE END-->
// Launch the new message query
if ( !IsActive() )
{
@@ -967,7 +1004,7 @@
if ( !iSatCanceled )
{
CompleteSatL(&iReceivedMessage, aError );
- _DPRINT( 4, "PhSrv.UssdNetworkObserverHandleNotifyNWReleaseL.CompleteSat" ); // debug print
+ _DPRINT( 4, "PhSrv.UssdNetworkObserverHandleNotifyNWReleaseL.CompleteSat" );
}
}
if ( iUssdReplyTimer && iUssdReplyTimer->IsTimerActive() )
@@ -1004,11 +1041,8 @@
{
_DDPRINT( 4, "PhSrv.ShowDoneNoteL.iShowDone", iShowDone );
// Show global confirmation note "Done"
- HBufC* noteText = iResourceManager.ReadResourceLC( R_PHSRV_TEXT_DONE );
- CAknGlobalNote* note = CAknGlobalNote::NewLC();
- note->ShowNoteL( EAknGlobalConfirmationNote, *noteText );
- CleanupStack::PopAndDestroy( note );
- CleanupStack::PopAndDestroy( noteText );
+ CHbDeviceMessageBoxSymbian::InformationL(
+ LoadDefaultString( KUssdDone ) );
iShowDone = EFalse;
}
@@ -1026,14 +1060,16 @@
return;
}
+ // Show specific error message
CTextResolver* textResolver = CTextResolver::NewLC();
-
HBufC* buffer = textResolver->ResolveErrorString( aError ).AllocLC();
- CAknGlobalNote* note = CAknGlobalNote::NewLC();
- note->ShowNoteL( EAknGlobalErrorNote, *buffer );
+ CHbDeviceMessageBoxSymbian::InformationL( buffer ->Des() );
- CleanupStack::PopAndDestroy( 3 ); // note, buffer, textResolver
+ CleanupStack::PopAndDestroy( buffer );
+ CleanupStack::PopAndDestroy( textResolver );
+
+
_DPRINT( 4, "PhSrv.ShowErrorNoteL.End" );
return;
}
@@ -1226,7 +1262,7 @@
if ( aError == KErrNone &&
IsActive() &&
- iGlobalMsgQuery )
+ iDeviceDialog )
{
Cancel();
// Terminates USSD session.
@@ -1242,12 +1278,88 @@
// -----------------------------------------------------------------------------
+// CPhSrvUssdManager::MessageBoxClosed
+// -----------------------------------------------------------------------------
+//
+void CPhSrvUssdManager::MessageBoxClosed(
+ const CHbDeviceMessageBoxSymbian* aMessageBox,
+ CHbDeviceMessageBoxSymbian::TButtonId aButton)
+ {
+ _DPRINT( 4, "PhSrv.MsgClose.Start" );
+ // ussd device dialog observer callback function
+ TPtrC leftBtn = aMessageBox->ButtonText(
+ CHbDeviceMessageBoxSymbian::EAcceptButton );
+ TPtrC rightBtn = aMessageBox->ButtonText(
+ CHbDeviceMessageBoxSymbian::ERejectButton );
+
+ TInt err = KErrNone;
+ // Click Yes on Confirmation note (Yes, No)
+ if ( !leftBtn.Compare(
+ LoadDefaultString( KUssdYes ) ) &&
+ ( CHbDeviceMessageBoxSymbian::EAcceptButton == aButton ) )
+ {
+ _DPRINT( 4, "PhSrv.MsgClose.SK.Yes" );
+ iClearArray = EFalse;
+ iNotifyArray->Reset();
+ TryCloseSession();
+ }
+ // Click "No" on Confirmation note (Yes, No)
+ else if ( !rightBtn.Compare(
+ LoadDefaultString( KUssdNo ) ) &&
+ ( CHbDeviceMessageBoxSymbian::ERejectButton == aButton ) )
+ {
+ _DPRINT( 4, "PhSrv.MsgClose.SK.No" );
+ iClearArray = EFalse;
+ iNotifyMessage = ETrue; // for removing the yes/no query
+ CheckArray();
+ TryCloseSession();
+ }
+ // Click "Next" on Notification note (Next, Exit)
+ else if ( !leftBtn.Compare(
+ LoadDefaultString( KUssdNext ) ) &&
+ ( CHbDeviceMessageBoxSymbian::EAcceptButton == aButton ) )
+ {
+ _DPRINT( 4, "PhSrv.MsgClose.SK.Next" );
+ CheckArray();
+ TryCloseSession();
+ }
+ // Click "Exit" on Notification note (Next, Exit or only Exit)
+ else if ( !rightBtn.Compare(
+ LoadDefaultString( KUssdExit ) ) &&
+ ( CHbDeviceMessageBoxSymbian::ERejectButton == aButton ) )
+ {
+ TRAP( err, ClearArrayL() );
+ _DDPRINT( 4, "PhSrv.MsgClose.SK.Clear.%d", err );
+ TryCloseSession();
+ _DPRINT( 4, "PhSrv.MsgClose.SK.Exit" );
+ }
+ // Click "Reply" on Message note (Reply, Exit)
+ else if ( !leftBtn.Compare(
+ LoadDefaultString( KUssdReply ) ) &&
+ ( CHbDeviceMessageBoxSymbian::EAcceptButton == aButton ) )
+ {
+ // Answer
+ iStartEditor = ETrue;
+ iShowDone = EFalse;
+ // Start the USSD editor now.
+ TRAP( err, RequestStartEditingL() );
+ _DDPRINT( 4, "PhSrv.MsgClose.RequestStartEditingL.%d", err );
+ }
+ else
+ {
+ _DPRINT( 4, "PhSrv.MsgClose.SK.Default" );
+ }
+
+ _DPRINT( 4, "PhSrv.MsgClose.End" );
+ }
+
+// -----------------------------------------------------------------------------
// CPhSrvUssdManager::RunL
// -----------------------------------------------------------------------------
//
void CPhSrvUssdManager::RunL()
{
- _DPRINT( 4, "PhSrv.RunL.Start" ); // debug print
+ _DPRINT( 4, "PhSrv.RunL.Start" );
ProcessMoAcksL();
@@ -1261,73 +1373,7 @@
else
{
iStartEditor = EFalse;
-
- TInt key = iStatus.Int();
- if ( key == EEikBidOk ) // OK key
- {
- if ( NetworkWaitingForAnAnswer() )
- {
- key = EAknSoftkeyShow;
- }
- else
- {
- key = EAknSoftkeyExit;
- }
- }
-
- switch( key )
- {
- case EAknSoftkeyShow:
- {
- // Answer
- iStartEditor = ETrue;
- iShowDone = EFalse;
- // Start the USSD editor now.
- _DPRINT( 4, "PhSrv.RunL.RequestStartEditingL" ); // debug print
- RequestStartEditingL();
- break;
- }
- case EAknSoftkeyYes:
- {
- _DPRINT( 4, "PhSrv.RunL.SK.Yes" );
- iClearArray = EFalse;
- iNotifyArray->Reset();
- TryCloseSession();
- break;
- }
- case EAknSoftkeyCancel:
- _DPRINT( 4, "PhSrv.RunL.SK.Cancel" );
- if ( iHavePendingSatMessagePointer )
- {
- iSatCanceled = ETrue;
- CompleteSatL( &iReceivedMessage, KErrCancel );
- _DPRINT( 4, "PhSrv.RunL.CompleteSatL" );
- }
- // fall through.
- case EAknSoftkeyExit:
- _DPRINT( 4, "PhSrv.RunL.SK.Exit" );
- ClearArrayL();
- TryCloseSession();
- break;
- case EAknSoftkeyBack:
- _DPRINT( 4, "PhSrv.RunL.SK.Back" );
- ClearArrayL();
- TryCloseSession();
- break;
- case EAknSoftkeyNo:
- _DPRINT( 4, "PhSrv.RunL.SK.No" );
- iClearArray = EFalse;
- iNotifyMessage = ETrue; // for removing the yes/no query
- // fall through.
- case EAknSoftkeyNext:
- _DPRINT( 4, "PhSrv.RunL.SK.Next" );
- CheckArray();
- TryCloseSession();
- break;
- default:
- _DPRINT( 4, "PhSrv.RunL.SK.Default" );
- break;
- }
+ // update device dialog
_DPRINT( 4, "PhSrv.RunL.End" ); // debug print
}
}
@@ -1340,22 +1386,54 @@
{
_DPRINT( 4, "PhSrv.LGMQ.start" );
_DPRINT_FLAGS();
+
if ( iNotifyMessage )
{
_DDPRINT( 4, "PhSrv.LGMQ.NotifyMessage", iNotifyMessage );
iNotifyMessage = ETrue;
TInt count = NotifyCount();
+ //check softkey in avkon.rss
if ( count > 1 )
{
- iSoftkeys = R_AVKON_SOFTKEYS_NEXT_EXIT__NEXT;
+ // Next, Exit
+ iDeviceDialog->SetButton(
+ CHbDeviceMessageBoxSymbian::EAcceptButton, ETrue );
+ iDeviceDialog->SetButtonTextL(
+ CHbDeviceMessageBoxSymbian::EAcceptButton,
+ LoadDefaultString( KUssdNext ) );
+ iDeviceDialog->SetButton(
+ CHbDeviceMessageBoxSymbian::ERejectButton, ETrue );
+ iDeviceDialog->SetButtonTextL(
+ CHbDeviceMessageBoxSymbian::ERejectButton,
+ LoadDefaultString( KUssdExit ) );
+ _DPRINT( 4, "PhSrv.LGMQ.Next&Exit" );
}
else
{
- iSoftkeys = R_AVKON_SOFTKEYS_EXIT;
+ // Only Exit
+ iDeviceDialog->SetButton(
+ CHbDeviceMessageBoxSymbian::EAcceptButton, EFalse );
+ iDeviceDialog->SetButton(
+ CHbDeviceMessageBoxSymbian::ERejectButton, ETrue );
+ iDeviceDialog->SetButtonTextL(
+ CHbDeviceMessageBoxSymbian::ERejectButton,
+ LoadDefaultString( KUssdExit ) );
+ _DPRINT( 4, "PhSrv.LGMQ.onlyExit" );
}
if ( iClearArray )
{
- iSoftkeys = R_AVKON_SOFTKEYS_YES_NO;
+ // Yes, No
+ iDeviceDialog->SetButton(
+ CHbDeviceMessageBoxSymbian::EAcceptButton, ETrue );
+ iDeviceDialog->SetButtonTextL(
+ CHbDeviceMessageBoxSymbian::EAcceptButton,
+ LoadDefaultString( KUssdYes ) );
+ iDeviceDialog->SetButton(
+ CHbDeviceMessageBoxSymbian::ERejectButton, ETrue );
+ iDeviceDialog->SetButtonTextL(
+ CHbDeviceMessageBoxSymbian::ERejectButton,
+ LoadDefaultString( KUssdNo ) );
+ _DPRINT( 4, "PhSrv.LGMQ.Yes&No" );
}
iReceivedMessage.Zero();
iReceivedMessage = (*iNotifyArray)[0];
@@ -1364,11 +1442,27 @@
_DPRINT( 4, "PhSrv.LGMQ.ShMsgQuery" ); // debug print
// Launch Global MessageQuery as requested.
- iGlobalMsgQuery->ShowMsgQueryL(iStatus, iReceivedMessage, iSoftkeys,
- *iMeQuHeaderText, KNullDesC);
- _DPRINT( 4, "PhSrv.LGMQ.SetActive" );
- SetActive();
+ // Dialog not support header text, this code is only
+ // for testing, not final solution.
+ TInt receiveLength = iReceivedMessage.Length();
+ _DDPRINT( 4, "PhSrv.LGMQ.ShMsgQuery.MsgLength", receiveLength );
+
+ TInt titleLength = LoadDefaultString( KUssdTitle ).Length();
+ _DDPRINT( 4, "PhSrv.LGMQ.ShMsgQuery.TilteLength", titleLength );
+
+ TInt length = receiveLength + titleLength;
+ _DDPRINT( 4, "PhSrv.LGMQ.ShMsgQuery.TotalLength", length );
+
+ HBufC* titleAndText = HBufC::NewLC( length );
+ titleAndText->Des().Append( LoadDefaultString( KUssdTitle ) );
+ titleAndText->Des().Append( iReceivedMessage );
+ iDeviceDialog->SetTextL( titleAndText->Des() );
+ CleanupStack::Pop( titleAndText );
+
+ iDeviceDialog->Close();
+ iDeviceDialog->ShowL();
iShowDone = EFalse;
+
// Do nothing else in RunL this time.
_DPRINT( 4, "PhSrv.LGMQ.ShMsgQuery.ret" ); // debug print
}
@@ -1523,11 +1617,9 @@
else
{
iReceivedMessage.Zero();
- HBufC* unreadText = iResourceManager.ReadResourceLC( R_PHSRV_TEXT_UNREAD );
- TPtr pMessage( unreadText->Des() );
- iReceivedMessage.Append( pMessage );
+ iReceivedMessage.Append(
+ LoadDefaultString( KUssdConfirm ) );
iNotifyArray->InsertL( 0, iReceivedMessage );
- CleanupStack::PopAndDestroy( unreadText );
iLaunchGMQ = ETrue;
iNotifyMessage = ETrue;
_DPRINT( 4, "PhSrv.ClearArrayL.iNotifyMessage.ETrue" );
@@ -1545,24 +1637,40 @@
// CPhSrvUssdManager::NotifyCount()
// -----------------------------------------------------------------------------
//
- TInt CPhSrvUssdManager:: NotifyCount()
- {
- return iNotifyArray->Count();
- }
+TInt CPhSrvUssdManager:: NotifyCount()
+{
+ TInt count = iNotifyArray->Count();
+ _DDPRINT( 4, "PhSrv.NotifyCount:", count ); // debug print
+ return count;
+}
- // -----------------------------------------------------------------------------
-// CPhSrvUssdManager::UpdateNotifyMessage()
+// -----------------------------------------------------------------------------
+// CPhSrvUssdManager::UpdateNotifyMessageL()
// -----------------------------------------------------------------------------
//
- void CPhSrvUssdManager:: UpdateNotifyMessage()
+ void CPhSrvUssdManager:: UpdateNotifyMessageL()
{
- _DDPRINT( 4, "PhSrv.UpdateNotifyMessage.Start, clear: ", iClearArray ); // debug print
+ _DDPRINT( 4, "PhSrv.UpdateNotifyMessageL.Start, clear: ", iClearArray ); // debug print
+
+ // Show left softkey - "Next"
if (NotifyCount() > 1 && !iClearArray )
{
- _DPRINT( 4, "PhSrv.UpdateNotifyMessage" ); // debug print
- iGlobalMsgQuery->UpdateMsgQuery( R_AVKON_SOFTKEYS_NEXT_EXIT__NEXT );
+ _DPRINT( 4, "PhSrv.UpdateNotifyMessageL" ); // debug print
+ iDeviceDialog->SetButton(
+ CHbDeviceMessageBoxSymbian::EAcceptButton, ETrue );
+ iDeviceDialog->SetButtonTextL(
+ CHbDeviceMessageBoxSymbian::EAcceptButton,
+ LoadDefaultString( KUssdNext ) );
}
- _DPRINT( 4, "PhSrv.UpdateNotifyMessage.End" ); // debug print
+ // Remove left softkey
+ else
+ {
+ iDeviceDialog->SetButton(
+ CHbDeviceMessageBoxSymbian::EAcceptButton, EFalse );
+ }
+ iDeviceDialog->UpdateL();
+
+ _DPRINT( 4, "PhSrv.UpdateNotifyMessageL.End" ); // debug print
}
// -----------------------------------------------------------------------------
@@ -1574,11 +1682,12 @@
_DPRINT( 4, "PhSrv.DoCancel.Start" ); // debug print
iTimer.Cancel();
iLaunchGMQ = EFalse;
-
- if ( iGlobalMsgQuery )
+ if ( iDeviceDialog )
{
_DPRINT( 4, "PhSrv.DoCancel" ); // debug print
- iGlobalMsgQuery->CancelMsgQuery();
+ iDeviceDialog->Close();
+ delete iDeviceDialog;
+ iDeviceDialog = NULL;
}
_DPRINT( 4, "PhSrv.DoCancel.End" ); // debug print
}
@@ -1647,6 +1756,16 @@
CleanupStack::PopAndDestroy( apaCommandLine );
}
CleanupStack::PopAndDestroy(); // apaLsSession
+
+ // bring the ussd editor to foreground, only for testing
+ TApaTaskList tasklist( wsSession );
+ TApaTask task = tasklist.FindApp( TUid::Uid( KPhSrvUssdAppUID ) );
+ if ( task.Exists() )
+ {
+ _DPRINT( 4, "PhSrv.UssdM.RequestStartEditingL.task.BringToForeground" );
+ task.BringToForeground();
+ }
+ // bring the ussd editor to foreground, only for testing
}
CleanupStack::PopAndDestroy(); // wsSession
@@ -1685,7 +1804,7 @@
{
if ( iUssdReplyTimer->IsTimerActive() )
{
- // debug print
+
_DPRINT( 4, "PhSrv.UssdM.InfUssdAppTerminatingL.timer" );
// Read the information what is the reason
@@ -1696,14 +1815,14 @@
0,
exitReasonPckg );
- // debug print
+
_DPRINT( 4, "PhSrv.UssdM.InfUssdAppTerminatingL.timer2" );
// If reason was the completion of send operation, the USSD
// session is not canceled, otherwise it is canceled.
if ( exitReason != EPhCltSendCompleted )
{
- // debug print
+
_DPRINT( 4, "PhSrv.UssdM.InfUssdAppTerminatingL.SendRelease" );
CloseSession();
}
@@ -1771,7 +1890,7 @@
}
else
{
- _DPRINT( 4, "PhSrv.InformStartSAT.Set" ); // debug print
+ _DPRINT( 4, "PhSrv.InformStartSAT.Set" );
// There was not pending SAT message
iHavePendingSatMessagePointer = ETrue;
@@ -1789,7 +1908,7 @@
//
void CPhSrvUssdManager::InformStopSAT()
{
- _DPRINT( 4, "PhSrv.InformStopSAT.Start" ); // debug print
+ _DPRINT( 4, "PhSrv.InformStopSAT.Start" );
// Do the actions only if there is pending SAT message.
if ( iHavePendingSatMessagePointer )
@@ -1802,7 +1921,7 @@
}
iHavePendingSatMessagePointer = EFalse;
}
- _DPRINT( 4, "PhSrv.InformStopSAT.End" ); // debug print
+ _DPRINT( 4, "PhSrv.InformStopSAT.End" );
}
// -----------------------------------------------------------------------------
@@ -1854,7 +1973,7 @@
TDesC* aReceiveString,
TInt aError )
{
- _DPRINT( 4, "PhSrv.CompleteSatL.Start" ); // debug print
+ _DPRINT( 4, "PhSrv.CompleteSatL.Start" );
if ( aReceiveString )
{
if ( aReceiveString->Length() )
@@ -1863,7 +1982,7 @@
// copy the received string to client side.
if ( iPendingSatMessagePointer.Int1() < aReceiveString->Length() )
{
- // debug print
+
_DPRINT( 4, "PhSrv.CompleteSatL.recString.LengthError" );
if ( !iPendingSatMessagePointer.IsNull() )
{
@@ -1887,7 +2006,7 @@
}
}
}
- _DPRINT( 4, "PhSrv.CompleteSatL.Middle" ); // debug print
+ _DPRINT( 4, "PhSrv.CompleteSatL.Middle" );
if ( !iPendingSatMessagePointer.IsNull() )
{
if ( aReceiveString && !iSatCanceled )
@@ -1904,7 +2023,7 @@
iHavePendingSatMessagePointer = EFalse;
- _DPRINT( 4, "PhSrv.CompleteSatL.End" ); // debug print
+ _DPRINT( 4, "PhSrv.CompleteSatL.End" );
}
@@ -1927,7 +2046,7 @@
//
TInt CPhSrvUssdManager::PlayUssdTone()
{
- _DPRINT( 4, "PhSrv.UssdM.PlayTone.start" ); // debug print
+ _DPRINT( 4, "PhSrv.UssdM.PlayTone.start" );
TInt err = KErrNone;
// <-- QT PHONE START-->
@@ -1952,6 +2071,28 @@
{
_DPRINT( 4, "PhSrv.UssdM.GetTelephonyVariantData.Start" );
TInt err = KErrNone;
+// <-- QT PHONE START-->
+/*
+ // Variation data should be unchangable during run-time,
+ // therefore, if once succesfully read, later reads are
+ // not allowed.
+ if ( iVariantReadOnlyValues == KPhSrvDefaultValue )
+ {
+ CRepository* cenRepSession = NULL;
+ TRAP ( err ,
+ cenRepSession = CRepository::NewL( KCRUidTelVariation ) );
+ if ( err == KErrNone )
+ {
+ err = cenRepSession->Get( KTelVariationFlags,
+ iVariantReadOnlyValues );
+ }
+ delete cenRepSession;
+ }
+
+ _DDPRINT( 4, "PhSrv.UssdM.variant", iVariantReadOnlyValues ); // debug print
+ _DPRINT( 4, "PhSrv.UssdM.GetTelephonyVariantData.End" );
+ */
+// <-- QT PHONE END-->
return err;
}
@@ -1963,7 +2104,7 @@
//
void CPhSrvUssdManager::SendMoAcknowledgementL()
{
- _DPRINT( 4, "PhSrv.SendMoAckL.Start" ); // debug print
+ _DPRINT( 4, "PhSrv.SendMoAckL.Start" );
// Acknowledge MT USSD message.
RMobileUssdMessaging::TMobileUssdAttributesV1 msgAttribs;
@@ -1981,7 +2122,7 @@
RMobileUssdMessaging::TMobileUssdAttributesV1Pckg attribs = msgAttribs;
SendHandlerL().SendUssdL( KNullDesC8() , attribs );
- _DPRINT( 4, "PhSrv.SendMoAckL.End" ); // debug print
+ _DPRINT( 4, "PhSrv.SendMoAckL.End" );
}
// -----------------------------------------------------------------------------
@@ -1991,20 +2132,51 @@
//
void CPhSrvUssdManager::TurnLightsOn()
{
- _DPRINT( 4, "PhSrv.TurnLightsOn Start" ); // debug print
+ _DPRINT( 4, "PhSrv.TurnLightsOn.Start" );
- // Change the bit on and off. SysAp will detect that
+ // Change the bit on and off. SysAp will detect that
// the lights should be switched on for the specified time.
//
- RProperty::Set(KPSUidCoreApplicationUIs, KLightsControl, ELightsOn);
- TInt err = RProperty::Set(KPSUidCoreApplicationUIs, KLightsControl, ELightsOff);
+ RProperty::Set(KPSUidCoreApplicationUIs, KLightsControl, ELightsOn);
+ TInt err = RProperty::Set(KPSUidCoreApplicationUIs, KLightsControl, ELightsOff);
+
+ if ( err != KErrNone )
+ {
+ _DDPRINT( 4,"PhSrv.TurnLightsOn.Error: ",err );// debug print
+ }
+
+ _DPRINT( 4, "PhSrv.TurnLightsOn.End" );
+ }
- if ( err != KErrNone )
- {
- _DDPRINT( 4,"PhSrv.TurnLightsOn.Error: ",err );// debug print
- }
+// -----------------------------------------------------------------------------
+// CPhSrvUssdManager::LoadDefaultString
+// -----------------------------------------------------------------------------
+//
+const TPtrC CPhSrvUssdManager::LoadDefaultString( const TDesC& aText )
+ {
+ _DPRINT( 4, "PhSrv.LoadDefaultString.Start" );
+
+ if ( iTextBuffer )
+ {
+ delete iTextBuffer;
+ iTextBuffer = NULL;
+ _DPRINT( 4, "PhSrv.LoadDefaultString.Clear" );
+ }
+ TInt err = KErrNone;
+ TPtrC ptr( aText );
+ if ( iTextResolver && ptr.Length() )
+ {
+ TRAP( err, iTextBuffer = HbTextResolverSymbian::LoadL( ptr ) );
+ _DDPRINT( 4, "PhSrv.LoadDefaultString.LoadL.%d", err );
+ if ( iTextBuffer )
+ {
+ ptr.Set( iTextBuffer->Des() );
+ _DPRINT( 4, "PhSrv.LoadDefaultString.Set" );
+ }
+ }
+ _DPRINT( 4, "PhSrv.LoadDefaultString.End" );
+ return ptr;
+ }
- _DPRINT( 4, "PhSrv.TurnLightsOn.End" ); // debug print
- }
// End of File