# HG changeset patch # User Dremov Kirill (Nokia-D-MSW/Tampere) # Date 1282115962 -10800 # Node ID cee7e9e0906c8f57ed0241d7da2183a9737b900a # Parent 1f002146abb468ad447a070914bf54ca96c0d840 Revision: 201031 Kit: 201033 diff -r 1f002146abb4 -r cee7e9e0906c cbs/CbsServer/Group/CbsServer.mmp --- a/cbs/CbsServer/Group/CbsServer.mmp Tue Jul 06 14:53:02 2010 +0300 +++ b/cbs/CbsServer/Group/CbsServer.mmp Wed Aug 18 10:19:22 2010 +0300 @@ -39,6 +39,7 @@ START RESOURCE ../Data/CbsServer.rss HEADER +TARGET CbsServer.rsg TARGETPATH RESOURCE_FILES_DIR LANGUAGE_IDS END diff -r 1f002146abb4 -r cee7e9e0906c cbs/CbsServer/ServerSrc/CCbsReceiverHelper.cpp --- a/cbs/CbsServer/ServerSrc/CCbsReceiverHelper.cpp Tue Jul 06 14:53:02 2010 +0300 +++ b/cbs/CbsServer/ServerSrc/CCbsReceiverHelper.cpp Wed Aug 18 10:19:22 2010 +0300 @@ -40,13 +40,15 @@ #include "CCbsDbImpTopicMessages.h" #include "CCbsDbImpTopicCollection.h" #include "CCbsRecMessage.h" -#ifndef SYMBIAN_ENABLE_SPLIT_HEADERS -#include // View server access -#else -#include -#endif -#include // ECellBroadcastNotification -#include // Soft Notification API +// <-- QT PHONE START --> +//#ifndef SYMBIAN_ENABLE_SPLIT_HEADERS +//#include // View server access +//#else +//#include +//#endif +//#include // ECellBroadcastNotification +//#include // Soft Notification API +// <-- QT PHONE END --> #include #include // <-- QT PHONE START --> @@ -62,12 +64,17 @@ // CONSTANTS +// <-- QT PHONE START --> // UID of CBS UI application -#define KUidCbsUiappDef 0x101F4CD3 -const TUid KUidCbsUiappApp = { KUidCbsUiappDef }; +//#define KUidCbsUiappDef 0x101F4CD3 +//const TUid KUidCbsUiappApp = { KUidCbsUiappDef }; +// <-- QT PHONE END --> -const TInt KCbsImmediateMessageIdInt = 313; -const TUid KCbsImmediateMessageId = { KCbsImmediateMessageIdInt }; +// <-- QT PHONE START --> +//const TInt KCbsImmediateMessageIdInt = 313; +//const TUid KCbsImmediateMessageId = { KCbsImmediateMessageIdInt }; +// <-- QT PHONE END --> + // <-- QT PHONE START --> //const TInt KCbsMessageTone = 2; // See SharedDataKeysVariant.h or NcnListInternalPSKeys.h // <-- QT PHONE END --> @@ -325,7 +332,11 @@ { CBSLOGSTRING("CBSSERVER: >>> CCbsReceiverHelper::ConstructL()"); + // <-- QT PHONE START --> + /* iVwsSession = CVwsSessionWrapper::NewL(); + */ + // <-- QT PHONE END--> // Array for SIM Topic numbers. This way we know which topics // to delete also from the SIM card (when deleting all topics). @@ -366,7 +377,11 @@ CBSLOGSTRING("CBSSERVER: >>> CCbsReceiverHelper::~CCbsReceiverHelper()"); delete iSimTopics; + // <-- QT PHONE START --> + /* delete iVwsSession; + */ + // <-- QT PHONE END--> CBSLOGSTRING("CBSSERVER: <<< CCbsReceiverHelper::~CCbsReceiverHelper()"); } @@ -835,8 +850,10 @@ // (other items were commented in a header). // ----------------------------------------------------------------------------- // -void CCbsReceiverHelper::LaunchMessageSoftNotificationL( const TBool aPlayTone ) +void CCbsReceiverHelper::LaunchMessageSoftNotificationL( const TBool /*aPlayTone*/ ) { + // <-- QT PHONE START --> + /* TInt numberOfHotMsgs( 0 ); numberOfHotMsgs = iDatabase.TopicListL().UnreadHotmarkedMessageCount(); @@ -851,6 +868,8 @@ notifier->SetNotificationCountL( ECellBroadcastNotification, numberOfHotMsgs ); CleanupStack::PopAndDestroy( notifier ); + */ + // <-- QT PHONE END--> } // ----------------------------------------------------------------------------- @@ -860,14 +879,18 @@ // ----------------------------------------------------------------------------- // void CCbsReceiverHelper::LaunchMessageImmediateDisplay( - const TCbsDbMessage& aMessage ) + const TCbsDbMessage& /*aMessage*/ ) { + // <-- QT PHONE START --> + /* TUid uiViewUid( TUid::Uid( ECbsUiMsgViewId ) ); TVwsViewId id( KUidCbsUiappApp, uiViewUid ); TPckgBuf pckg( aMessage.iHandle ); // Ignore result value. iVwsSession->CreateActivateViewEvent( id, KCbsImmediateMessageId, pckg ); + */ + // <-- QT PHONE END--> } // ----------------------------------------------------------------------------- diff -r 1f002146abb4 -r cee7e9e0906c cellular/psuinotes/tsrc/mocks/mock_hbglobal.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/cellular/psuinotes/tsrc/mocks/mock_hbglobal.cpp Wed Aug 18 10:19:22 2010 +0300 @@ -0,0 +1,26 @@ +/* +* Copyright (c) 2009 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" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ +#include +#include +#include "hbglobal.h" + +// ============================ MEMBER FUNCTIONS =============================== + +QString hbTrId(const char *id, int n) +{ + SMC_MOCK_METHOD2( QString, const char *, id, int, n ) +} \ No newline at end of file diff -r 1f002146abb4 -r cee7e9e0906c cellular/psuinotes/tsrc/mocks/mock_psetcalldivertingwrapper.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/cellular/psuinotes/tsrc/mocks/mock_psetcalldivertingwrapper.cpp Wed Aug 18 10:19:22 2010 +0300 @@ -0,0 +1,136 @@ +/* +* Copyright (c) 2009 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" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ +#include +#include +#include "psetcalldivertingwrapper.h" + +// ============================ MEMBER FUNCTIONS =============================== + +// ----------------------------------------------------------------------------- +// PSetCallDivertingWrapper::PSetCallDivertingWrapper +// ----------------------------------------------------------------------------- +// +PSetCallDivertingWrapper::PSetCallDivertingWrapper( + CPsetContainer & psetContainer, + QObject * parent ) + //: + //QObject( /*psetContainer, parent*/ ) + { + + } + + +// ----------------------------------------------------------------------------- +// PSetCallDivertingWrapper::~PSetCallDivertingWrapper +// ----------------------------------------------------------------------------- +// +PSetCallDivertingWrapper::~PSetCallDivertingWrapper( ) + { + + } + + +// ----------------------------------------------------------------------------- +// PSetCallDivertingWrapper::setCallDiverting +// ----------------------------------------------------------------------------- +// +int PSetCallDivertingWrapper::setCallDiverting( + PSCallDivertingCommand & aSetting, + int aBasicServiceGroup ) + { + SMC_MOCK_METHOD2( int, PSCallDivertingCommand &, aSetting, + int, aBasicServiceGroup ) + } + + +// ----------------------------------------------------------------------------- +// PSetCallDivertingWrapper::getCallDivertingStatus +// ----------------------------------------------------------------------------- +// +void PSetCallDivertingWrapper::getCallDivertingStatus( + const PsServiceGroup aServiceGroup, + const PsCallDivertingCondition aCondition, + int aBsc ) + { + int iDummy = aServiceGroup; + SMC_MOCK_METHOD3( void, int, iDummy, + const PsCallDivertingCondition, aCondition, + int, aBsc ) + } + + +// ----------------------------------------------------------------------------- +// PSetCallDivertingWrapper::cancelProcess +// ----------------------------------------------------------------------------- +// +void PSetCallDivertingWrapper::cancelProcess( ) + { + SMC_MOCK_METHOD0( void ) + } + + +// ----------------------------------------------------------------------------- +// PSetCallDivertingWrapper::getDefaultNumbers +// ----------------------------------------------------------------------------- +// +void PSetCallDivertingWrapper::getDefaultNumbers( + QStringList & aDefNumbers ) + { + QStringList list; + list << "0401234567" << "0501234567" << "0451234567"; + aDefNumbers = list; + + SMC_MOCK_METHOD1( void, QStringList &, aDefNumbers ) + } + + +// ----------------------------------------------------------------------------- +// PSetCallDivertingWrapper::setNewDefaultNumber +// ----------------------------------------------------------------------------- +// +void PSetCallDivertingWrapper::setNewDefaultNumber( + QString aNumber ) + { + SMC_MOCK_METHOD1( void, QString, aNumber ) + } + + +// ----------------------------------------------------------------------------- +// PSetCallDivertingWrapper::getVoiceMailBoxNumber +// ----------------------------------------------------------------------------- +// +int PSetCallDivertingWrapper::getVoiceMailBoxNumber( + QString & aNumber, + PsService aService ) + { + SMC_MOCK_METHOD2( int, QString &, aNumber, + PsService, aService ) + } + + +// ----------------------------------------------------------------------------- +// PSetCallDivertingWrapper::queryVoiceMailBoxNumber +// ----------------------------------------------------------------------------- +// +int PSetCallDivertingWrapper::queryVoiceMailBoxNumber( + QString & aNumber, + PsService aService ) + { + SMC_MOCK_METHOD2( int, QString &, aNumber, + PsService, aService ) + } + diff -r 1f002146abb4 -r cee7e9e0906c cellular/psuinotes/tsrc/mocks/mock_psetcallwaitingwrapper.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/cellular/psuinotes/tsrc/mocks/mock_psetcallwaitingwrapper.cpp Wed Aug 18 10:19:22 2010 +0300 @@ -0,0 +1,76 @@ +/* +* Copyright (c) 2009 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" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ +#include +#include +#include "psetcallwaitingwrapper.h" +#include "psetcallwaitingwrapper_p.h" + +// ============================ MEMBER FUNCTIONS =============================== + +// ----------------------------------------------------------------------------- +// PSetCallWaitingWrapper::PSetCallWaitingWrapper +// ----------------------------------------------------------------------------- +// +PSetCallWaitingWrapper::PSetCallWaitingWrapper( + CPsetContainer & psetContainer, + QObject * parent ) : QObject( parent ) + { + Q_UNUSED(psetContainer); + } + + +// ----------------------------------------------------------------------------- +// PSetCallWaitingWrapper::~PSetCallWaitingWrapper +// ----------------------------------------------------------------------------- +// +PSetCallWaitingWrapper::~PSetCallWaitingWrapper( ) + { + + } + + +// ----------------------------------------------------------------------------- +// PSetCallWaitingWrapper::setCallWaiting +// ----------------------------------------------------------------------------- +// +void PSetCallWaitingWrapper::setCallWaiting( + PsCallWaitingCommand aSetting, + int aBasicServiceGroup ) + { + SMC_MOCK_METHOD2( void, PsCallWaitingCommand, aSetting, + int, aBasicServiceGroup ) + } + + +// ----------------------------------------------------------------------------- +// PSetCallWaitingWrapper::getCallWaitingStatus +// ----------------------------------------------------------------------------- +// +void PSetCallWaitingWrapper::getCallWaitingStatus( ) + { + SMC_MOCK_METHOD0( void ) + } + + +// ----------------------------------------------------------------------------- +// PSetCallWaitingWrapper::cancelProcess +// ----------------------------------------------------------------------------- +// +void PSetCallWaitingWrapper::cancelProcess( ) + { + SMC_MOCK_METHOD0( void ) + } diff -r 1f002146abb4 -r cee7e9e0906c cellular/psuinotes/tsrc/mocks/mock_psetcallwaitingwrapper_p.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/cellular/psuinotes/tsrc/mocks/mock_psetcallwaitingwrapper_p.cpp Wed Aug 18 10:19:22 2010 +0300 @@ -0,0 +1,111 @@ +/* +* Copyright (c) 2009 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" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ +#include +#include +#include +#include +#include +#include "psetcallwaitingwrapper_p.h" + +// ============================ MEMBER FUNCTIONS =============================== + +// ----------------------------------------------------------------------------- +// PSetCallWaitingWrapperPrivate::PSetCallWaitingWrapperPrivate +// ----------------------------------------------------------------------------- +// +PSetCallWaitingWrapperPrivate::PSetCallWaitingWrapperPrivate( + PSetCallWaitingWrapper & owner ) + : m_Owner(owner) + { + + } + + +// ----------------------------------------------------------------------------- +// PSetCallWaitingWrapperPrivate::~PSetCallWaitingWrapperPrivate +// ----------------------------------------------------------------------------- +// +PSetCallWaitingWrapperPrivate::~PSetCallWaitingWrapperPrivate( ) + { + + } + + +// ----------------------------------------------------------------------------- +// PSetCallWaitingWrapperPrivate::HandleCallWaitingGetStatusL +// ----------------------------------------------------------------------------- +// +void PSetCallWaitingWrapperPrivate::HandleCallWaitingGetStatusL( + const MPsetCallWaiting::TGetCallWaitingStatus aStatus, + TUint8 aBsc[KPSetNumberOfBsc]) + { + Q_UNUSED(aStatus) + Q_UNUSED(aBsc) + // TODO: make compile + // SMC_MOCK_METHOD2( void, const MPsetCallWaiting::TGetCallWaitingStatus, aStatus, + // TUint8[KPSetNumberOfBsc], aBsc) + } + + +// ----------------------------------------------------------------------------- +// PSetCallWaitingWrapperPrivate::HandleCallWaitingChangedL +// ----------------------------------------------------------------------------- +// +void PSetCallWaitingWrapperPrivate::HandleCallWaitingChangedL( + const MPsetCallWaiting::TSetCallWaiting aSetting, + const TInt aResult ) + { + SMC_MOCK_METHOD2( void, const MPsetCallWaiting::TSetCallWaiting, aSetting, + const TInt, aResult ) + } + + +// ----------------------------------------------------------------------------- +// PSetCallWaitingWrapperPrivate::HandleCWRequestingL +// ----------------------------------------------------------------------------- +// +void PSetCallWaitingWrapperPrivate::HandleCWRequestingL( + TBool aOngoing, + TBool aInterrupted ) + { + SMC_MOCK_METHOD2( void, TBool, aOngoing, + TBool, aInterrupted ) + } + + +// ----------------------------------------------------------------------------- +// PSetCallWaitingWrapperPrivate::HandleCWErrorL +// ----------------------------------------------------------------------------- +// +void PSetCallWaitingWrapperPrivate::HandleCWErrorL( + TInt aReason ) + { + SMC_MOCK_METHOD1( void, TInt, aReason ) + } + + +// ----------------------------------------------------------------------------- +// PSetCallWaitingWrapperPrivate::SetEngineContact +// ----------------------------------------------------------------------------- +// +void PSetCallWaitingWrapperPrivate::SetEngineContact( + MPsetCallWaiting & aEngineContact ) + { + SMC_MOCK_METHOD1( void, MPsetCallWaiting &, aEngineContact ) + } + + diff -r 1f002146abb4 -r cee7e9e0906c cellular/psuinotes/tsrc/mocks/mock_psuinotes.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/cellular/psuinotes/tsrc/mocks/mock_psuinotes.cpp Wed Aug 18 10:19:22 2010 +0300 @@ -0,0 +1,205 @@ +/* +* Copyright (c) 2009 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" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ +#include +#include +#include +#include "psuinotes.h" + +// ============================ MEMBER FUNCTIONS =============================== + +// ----------------------------------------------------------------------------- +// PsUiNotes::PsUiNotes +// ----------------------------------------------------------------------------- +// +PsUiNotes::PsUiNotes( ) + //: + //QObject( /**/ ) + { + + } + +// ----------------------------------------------------------------------------- +// PsUiNotes::PsUiNotes +// ----------------------------------------------------------------------------- +// +PsUiNotes::~PsUiNotes( ) + { + + } + + +// ----------------------------------------------------------------------------- +// PsUiNotes::instance +// ----------------------------------------------------------------------------- +// +PsUiNotes * PsUiNotes::instance( ) + { + SMC_MOCK_METHOD0( PsUiNotes * ) + } + + +// ----------------------------------------------------------------------------- +// PsUiNotes::showGlobalProgressNote +// ----------------------------------------------------------------------------- +// +void PsUiNotes::showGlobalProgressNote( + int & noteId, + const QString & text ) + { + SMC_MOCK_METHOD2( void, int &, noteId, + const QString &, text ) + } + + +// ----------------------------------------------------------------------------- +// PsUiNotes::showGlobalNote +// ----------------------------------------------------------------------------- +// +void PsUiNotes::showGlobalNote( + int & noteId, + const QString & text, + HbMessageBox::MessageBoxType noteType ) + { + SMC_MOCK_METHOD3( void, int &, noteId, + const QString &, text, + HbMessageBox::MessageBoxType, noteType ) + } + + +// ----------------------------------------------------------------------------- +// PsUiNotes::showGlobalErrorNote +// ----------------------------------------------------------------------------- +// +void PsUiNotes::showGlobalErrorNote( + int & noteId, + int errorCode ) + { + SMC_MOCK_METHOD2( void, int &, noteId, + int, errorCode ) + } + + +// ----------------------------------------------------------------------------- +// PsUiNotes::showCallDivertDetails +// ----------------------------------------------------------------------------- +// +void PsUiNotes::showCallDivertDetails( + const QList & divertingStatusList ) + { + SMC_MOCK_METHOD1( void, const QList &, divertingStatusList ) + } + + +// ----------------------------------------------------------------------------- +// PsUiNotes::showPasswordQueryDialog +// ----------------------------------------------------------------------------- +// +void PsUiNotes::showPasswordQueryDialog( + const QString & title, + const QValidator & validator, + int maxPasswordLength ) + { + SMC_MOCK_METHOD3( void, const QString &, title, + const QValidator &, validator, + int, maxPasswordLength ) + } + + +// ----------------------------------------------------------------------------- +// PsUiNotes::cancelNote +// ----------------------------------------------------------------------------- +// +void PsUiNotes::cancelNote( + int noteId ) + { + SMC_MOCK_METHOD1( void, int, noteId ) + } + + +// ----------------------------------------------------------------------------- +// PsUiNotes::noteShowing +// ----------------------------------------------------------------------------- +// +bool PsUiNotes::noteShowing( ) + { + SMC_MOCK_METHOD0( bool ) + } + + +// ----------------------------------------------------------------------------- +// PsUiNotes::finishedPasswordQueryDialog +// ----------------------------------------------------------------------------- +// +void PsUiNotes::finishedPasswordQueryDialog( + HbAction * action2 ) + { + SMC_MOCK_METHOD1( void, HbAction *, action2 ) + } + + +// ----------------------------------------------------------------------------- +// PsUiNotes::showNotificationDialog +// ----------------------------------------------------------------------------- +// +void PsUiNotes::showNotificationDialog( + const QString & text ) + { + SMC_MOCK_METHOD1( void, const QString &, text ) + } + + +// ----------------------------------------------------------------------------- +// PsUiNotes::showGlobalNotificationDialog +// ----------------------------------------------------------------------------- +// +void PsUiNotes::showGlobalNotificationDialog( + const QString & text ) + { + SMC_MOCK_METHOD1( void, const QString &, text ) + } + + +// ----------------------------------------------------------------------------- +// CpPhoneNotes::activeNoteAboutToClose +// ----------------------------------------------------------------------------- +// +void PsUiNotes::activeNoteAboutToClose() +{ + SMC_MOCK_METHOD0( void ) +} + + +// ----------------------------------------------------------------------------- +// CpPhoneNotes::handleProgressNoteCanceled +// ----------------------------------------------------------------------------- +// +void PsUiNotes::handleProgressNoteCanceled() +{ + SMC_MOCK_METHOD0( void ) +} + + +// ----------------------------------------------------------------------------- +// CpPhoneNotes::passwordTextChanged +// ----------------------------------------------------------------------------- +// +void PsUiNotes::passwordTextChanged() +{ + SMC_MOCK_METHOD0( void ) +} + + diff -r 1f002146abb4 -r cee7e9e0906c cellular/psuinotes/tsrc/mocks/mock_qobject.cpp --- a/cellular/psuinotes/tsrc/mocks/mock_qobject.cpp Tue Jul 06 14:53:02 2010 +0300 +++ b/cellular/psuinotes/tsrc/mocks/mock_qobject.cpp Wed Aug 18 10:19:22 2010 +0300 @@ -330,13 +330,13 @@ const char * signal, const QObject * receiver, const char * member, - Qt:: ConnectionType ) + Qt::ConnectionType ConnectionType ) { -// SMC_MOCK_METHOD5( bool, const QObject *, sender, -// const char *, signal, -// const QObject *, receiver, -// const char *, member, -// Qt::, ConnectionType ) + SMC_MOCK_METHOD5( bool, const QObject *, sender, + const char *, signal, + const QObject *, receiver, + const char *, member, + Qt::ConnectionType, ConnectionType ) } diff -r 1f002146abb4 -r cee7e9e0906c cellular/psuinotes/tsrc/ut_psuidivertnotehandler/qtestmains60.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/cellular/psuinotes/tsrc/ut_psuidivertnotehandler/qtestmains60.h Wed Aug 18 10:19:22 2010 +0300 @@ -0,0 +1,40 @@ +/* +* Copyright (c) 2009 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" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +#ifndef QTESTMAINS60 +#define QTESTMAINS60 + +#define QTEST_MAIN_S60(TestObject) \ +int main(int argc, char *argv[]) \ +{ \ +char *new_argv[3]; \ +QCoreApplication app(argc, argv); \ +\ +QString str = "C:\\data\\" + QFileInfo(QCoreApplication::applicationFilePath()).baseName() + ".log"; \ +QByteArray bytes = str.toAscii(); \ +\ +char arg1[] = "-o"; \ +\ +new_argv[0] = argv[0]; \ +new_argv[1] = arg1; \ +new_argv[2] = bytes.data(); \ +\ +TestObject tc; \ +return QTest::qExec(&tc, 3, new_argv); \ +} + +#endif \ No newline at end of file diff -r 1f002146abb4 -r cee7e9e0906c cellular/psuinotes/tsrc/ut_psuidivertnotehandler/ut_psuidivertnotehandler.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/cellular/psuinotes/tsrc/ut_psuidivertnotehandler/ut_psuidivertnotehandler.cpp Wed Aug 18 10:19:22 2010 +0300 @@ -0,0 +1,195 @@ +/* +* Copyright (c) 2009 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" +/* +* Copyright (c) 2009 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" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +#include "ut_psuidivertnotehandler.h" +#include "psuidivertnotehandler.h" +#include "psetcalldivertingwrapper.h" +#include "qtestmains60.h" +#include + +class CPsetContainer +{ +public: + CPsetContainer(){}; + ~CPsetContainer(){}; +}; + +/*QString hbTrId(const char *id, int n) +{ + SMC_MOCK_METHOD2( QString, const char *, id, int, n ) +}*/ + + +/*! + UT_psuidivertnotehandler::UT_psuidivertnotehandler + */ +UT_psuidivertnotehandler::UT_psuidivertnotehandler() +{ + +} + +/*! + UT_psuidivertnotehandler::~UT_psuidivertnotehandler + */ +UT_psuidivertnotehandler::~UT_psuidivertnotehandler() +{ + +} + +/*! + UT_psuidivertnotehandler::init + */ +void UT_psuidivertnotehandler::init() +{ + initialize(); +} + +/*! + UT_psuidivertnotehandler::cleanup + */ +void UT_psuidivertnotehandler::cleanup() +{ + reset(); +} + +/*! + UT_psuidivertnotehandler::t_memleak + */ +void UT_psuidivertnotehandler::t_memleak() +{ + +} + +/*! + UT_psuidivertnotehandler::t_construction + */ +void UT_psuidivertnotehandler::t_construction() +{ + expect("QObject::connect").times(4); + CPsetContainer psetContainer; + PSetCallDivertingWrapper *mockDivertWrapper = new PSetCallDivertingWrapper(psetContainer,this); + PsUiDivertNoteHandler *divertHandler = new PsUiDivertNoteHandler(*mockDivertWrapper); + delete divertHandler; + delete mockDivertWrapper; + QVERIFY(verify()); +} + +void UT_psuidivertnotehandler::t_handleDivertingChanged() +{ + CPsetContainer psetContainer; + PSetCallDivertingWrapper *mockDivertWrapper = new PSetCallDivertingWrapper(psetContainer,this); + PsUiDivertNoteHandler *divertHandler = new PsUiDivertNoteHandler(*mockDivertWrapper); + + // Divert activated, plural false + PSCallDivertingCommand testCommand; + testCommand.iStatus = DivertingStatusActive; + expect("PsUiNotes::showGlobalNotificationDialog"); + divertHandler->handleDivertingChanged(testCommand, false); + QVERIFY(verify()); + + // Divert activated, plural true + testCommand.iStatus = DivertingStatusActive; + expect("PsUiNotes::showGlobalNotificationDialog"); + divertHandler->handleDivertingChanged(testCommand, true); + QVERIFY(verify()); + + // Divert deactivated, plural false + testCommand.iStatus = DivertingStatusInactive; + expect("PsUiNotes::showGlobalNotificationDialog"); + divertHandler->handleDivertingChanged(testCommand, false); + QVERIFY(verify()); + + // Divert deactivated, plural true + testCommand.iStatus = DivertingStatusInactive; + expect("PsUiNotes::showGlobalNotificationDialog"); + divertHandler->handleDivertingChanged(testCommand, true); + QVERIFY(verify()); + + // Divert status unknown + testCommand.iStatus = DivertingStatusUnknown; + expect("PsUiNotes::showGlobalNotificationDialog"); + divertHandler->handleDivertingChanged(testCommand, true); + QVERIFY(verify()); + + delete divertHandler; + delete mockDivertWrapper; +} + +void UT_psuidivertnotehandler::t_handleDivertingStatus() +{ + CPsetContainer psetContainer; + PSetCallDivertingWrapper *mockDivertWrapper = new PSetCallDivertingWrapper(psetContainer,this); + PsUiDivertNoteHandler *divertHandler = new PsUiDivertNoteHandler(*mockDivertWrapper); + QList divertList; + + expect("PsUiNotes::showCallDivertDetails").with(divertList); + divertHandler->handleDivertingStatus(divertList,false); + + QVERIFY(verify()); + delete divertHandler; + delete mockDivertWrapper; +} + +void UT_psuidivertnotehandler::t_handleDivertingError() +{ + CPsetContainer psetContainer; + PSetCallDivertingWrapper *mockDivertWrapper = new PSetCallDivertingWrapper(psetContainer,this); + PsUiDivertNoteHandler *divertHandler = new PsUiDivertNoteHandler(*mockDivertWrapper); + int errorCode = -1; + expect("PsUiNotes::cancelNote"); + expect("PsUiNotes::showGlobalErrorNote"); + divertHandler->handleDivertingError(errorCode); + + QVERIFY(verify()); + delete divertHandler; + delete mockDivertWrapper; +} + +void UT_psuidivertnotehandler::t_handleCFRequesting() +{ + CPsetContainer psetContainer; + PSetCallDivertingWrapper *mockDivertWrapper = new PSetCallDivertingWrapper(psetContainer,this); + PsUiDivertNoteHandler *divertHandler = new PsUiDivertNoteHandler(*mockDivertWrapper); + + bool ongoing = true; + bool interrupted = false; + expect("PsUiNotes::showGlobalProgressNote"); + divertHandler->handleCFRequesting(ongoing,interrupted); + QVERIFY(verify()); + + ongoing = false; + interrupted = true; + expect("PsUiNotes::cancelNote").times(2); + divertHandler->handleCFRequesting(ongoing,interrupted); + QVERIFY(verify()); + + ongoing = false; + interrupted = false; + expect("PsUiNotes::cancelNote"); + divertHandler->handleCFRequesting(ongoing,interrupted); + QVERIFY(verify()); + + delete divertHandler; + delete mockDivertWrapper; +} + +QTEST_MAIN_S60(UT_psuidivertnotehandler) diff -r 1f002146abb4 -r cee7e9e0906c cellular/psuinotes/tsrc/ut_psuidivertnotehandler/ut_psuidivertnotehandler.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/cellular/psuinotes/tsrc/ut_psuidivertnotehandler/ut_psuidivertnotehandler.h Wed Aug 18 10:19:22 2010 +0300 @@ -0,0 +1,48 @@ +/* +* Copyright (c) 2009 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" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +#ifndef UT_PSUIDIVERTNOTEHANDLER_H +#define UT_PSUIDIVERTNOTEHANDLER_H + +#include +#include + +class UT_psuidivertnotehandler : public QObject, MockService +{ + Q_OBJECT + +public: + UT_psuidivertnotehandler(); + ~UT_psuidivertnotehandler(); + +private slots: + void init(); + void cleanup(); + void t_memleak(); + + void t_construction(); + void t_handleDivertingChanged(); + void t_handleDivertingStatus(); + void t_handleDivertingError(); + void t_handleCFRequesting(); + + +private: + +}; + +#endif // UT_PSUIDIVERTNOTEHANDLER_H diff -r 1f002146abb4 -r cee7e9e0906c cellular/psuinotes/tsrc/ut_psuidivertnotehandler/ut_psuidivertnotehandler.pro --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/cellular/psuinotes/tsrc/ut_psuidivertnotehandler/ut_psuidivertnotehandler.pro Wed Aug 18 10:19:22 2010 +0300 @@ -0,0 +1,48 @@ +# +# Copyright (c) 2009 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" +# which accompanies this distribution, and is available +# at the URL "http://www.eclipse.org/legal/epl-v10.html". +# +# Initial Contributors: +# Nokia Corporation - initial contribution. +# +# Contributors: +# +# Description: +# + + +CONFIG += hb qtestlib +TEMPLATE = app +TARGET = +DEPENDPATH += . ../../src/ +INCLUDEPATH += . ../../inc/ +DEFINES += BUILD_PSUINOTES BUILD_PSETWRAPPER + +QT -= gui +QT += testlib + +symbian: { + INCLUDEPATH += $$MW_LAYER_SYSTEMINCLUDE + LIBS += -lmocklib -lsymbianmock +} + +# test code +HEADERS += ut_psuidivertnotehandler.h +SOURCES += ut_psuidivertnotehandler.cpp + +# code to be tested +HEADERS += ../../../../phonesrv_plat/phone_settings_ui_notes_api/inc/psuidivertnotehandler.h + +SOURCES += ../../src/psuidivertnotehandler.cpp + +# mocks needed for testing +HEADERS += ../../../../phonesrv_plat/phone_settings_ui_notes_api/inc/psuinotes.h \ + ../../../../phonesrv_plat/phone_settings_api/inc/psetcalldivertingwrapper.h + +SOURCES += ../mocks/mock_psuinotes.cpp \ + ../mocks/mock_psetcalldivertingwrapper.cpp \ + ../mocks/mock_qobject.cpp diff -r 1f002146abb4 -r cee7e9e0906c cellular/psuinotes/tsrc/ut_psuiwaitingnotehandler/qtestmains60.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/cellular/psuinotes/tsrc/ut_psuiwaitingnotehandler/qtestmains60.h Wed Aug 18 10:19:22 2010 +0300 @@ -0,0 +1,40 @@ +/* +* Copyright (c) 2009 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" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +#ifndef QTESTMAINS60 +#define QTESTMAINS60 + +#define QTEST_MAIN_S60(TestObject) \ +int main(int argc, char *argv[]) \ +{ \ +char *new_argv[3]; \ +QCoreApplication app(argc, argv); \ +\ +QString str = "C:\\data\\" + QFileInfo(QCoreApplication::applicationFilePath()).baseName() + ".log"; \ +QByteArray bytes = str.toAscii(); \ +\ +char arg1[] = "-o"; \ +\ +new_argv[0] = argv[0]; \ +new_argv[1] = arg1; \ +new_argv[2] = bytes.data(); \ +\ +TestObject tc; \ +return QTest::qExec(&tc, 3, new_argv); \ +} + +#endif \ No newline at end of file diff -r 1f002146abb4 -r cee7e9e0906c cellular/psuinotes/tsrc/ut_psuiwaitingnotehandler/ut_psuiwaitingnotehandler.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/cellular/psuinotes/tsrc/ut_psuiwaitingnotehandler/ut_psuiwaitingnotehandler.cpp Wed Aug 18 10:19:22 2010 +0300 @@ -0,0 +1,175 @@ +/* +* Copyright (c) 2009 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" +/* +* Copyright (c) 2009 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" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +#include "ut_psuiwaitingnotehandler.h" +#include "psuiwaitingnotehandler.h" +#include "psetcallwaitingwrapper.h" +#include "qtestmains60.h" +#include + +class CPsetContainer +{ +public: + CPsetContainer(){}; + ~CPsetContainer(){}; +}; + +/*! + UT_psuiwaitingnotehandler::UT_psuiwaitingnotehandler + */ +UT_psuiwaitingnotehandler::UT_psuiwaitingnotehandler() +{ + +} + +/*! + UT_psuiwaitingnotehandler::~UT_psuiwaitingnotehandler + */ +UT_psuiwaitingnotehandler::~UT_psuiwaitingnotehandler() +{ + +} + +/*! + UT_psuiwaitingnotehandler::init + */ +void UT_psuiwaitingnotehandler::init() +{ + initialize(); + m_psetContainer = new CPsetContainer(); + m_mockWaitingWrapper = new PSetCallWaitingWrapper(*m_psetContainer,this); + m_waitingHandler = new PsUiWaitingNoteHandler(*m_mockWaitingWrapper); +} + +/*! + UT_psuiwaitingnotehandler::cleanup + */ +void UT_psuiwaitingnotehandler::cleanup() +{ + delete m_waitingHandler; + delete m_mockWaitingWrapper; + delete m_psetContainer; + reset(); +} + +/*! + UT_psuiwaitingnotehandler::t_memleak + */ +void UT_psuiwaitingnotehandler::t_memleak() +{ + +} + +/*! + UT_psuiwaitingnotehandler::t_construction + */ +void UT_psuiwaitingnotehandler::t_construction() +{ + expect("QObject::connect").times(4); + CPsetContainer psetContainer; + PSetCallWaitingWrapper *mockWaitingWrapper = new PSetCallWaitingWrapper(psetContainer,this); + PsUiWaitingNoteHandler *waitingHandler = new PsUiWaitingNoteHandler(*mockWaitingWrapper); + delete waitingHandler; + delete mockWaitingWrapper; + QVERIFY(verify()); +} + +void UT_psuiwaitingnotehandler::t_handleCallWaitingGetStatus() +{ + + PSetCallWaitingWrapper::PsCallWaitingStatus status = + PSetCallWaitingWrapper::StatusNotProvisioned; + QList serviceGroups; + expect("PsUiNotes::cancelNote"); + expect("PsUiSettingsWrapper::isFeatureCallWaitingDistiquishNotProvisionedEnabled").returns(true); + expect("PsUiNotes::showGlobalNotificationDialog"); + m_waitingHandler->handleCallWaitingGetStatus(status,serviceGroups); + QVERIFY(verify()); + + status = PSetCallWaitingWrapper::StatusActive; + expect("PsUiNotes::showGlobalNotificationDialog"); + m_waitingHandler->handleCallWaitingGetStatus(status,serviceGroups); + QVERIFY(verify()); + + status = PSetCallWaitingWrapper::StatusDisabled; + expect("PsUiNotes::showGlobalNotificationDialog"); + m_waitingHandler->handleCallWaitingGetStatus(status,serviceGroups); + QVERIFY(verify()); +} + +void UT_psuiwaitingnotehandler::t_handleCallWaitingChanged() +{ + PSetCallWaitingWrapper::PsCallWaitingCommand setting; + int result; + + setting = PSetCallWaitingWrapper::ActivateCallWaiting; + result = true; + expect("PsUiNotes::showGlobalNote"); + m_waitingHandler->handleCallWaitingChanged(setting,result); + QVERIFY(verify()); + + setting = PSetCallWaitingWrapper::ActivateCallWaiting; + result = false; + expect("PsUiNotes::showGlobalNotificationDialog"); + m_waitingHandler->handleCallWaitingChanged(setting,result); + QVERIFY(verify()); + + setting = PSetCallWaitingWrapper::DeactivateCallWaiting; + result = false; + expect("PsUiNotes::showGlobalNotificationDialog"); + m_waitingHandler->handleCallWaitingChanged(setting,result); + QVERIFY(verify()); + + setting = PSetCallWaitingWrapper::CheckCallWaitingStatus; + result = false; + expect("PsUiNotes::showGlobalNotificationDialog"); + m_waitingHandler->handleCallWaitingChanged(setting,result); + QVERIFY(verify()); +} + +void UT_psuiwaitingnotehandler::t_handleCallWaitingRequesting() +{ + expect("PsUiNotes::showGlobalProgressNote"); + bool ongoing = true; + bool interrupted = false; + m_waitingHandler->handleCallWaitingRequesting(ongoing,interrupted); + QVERIFY(verify()); + + expect("PsUiNotes::cancelNote"); + ongoing = false; + interrupted = true; + m_waitingHandler->handleCallWaitingRequesting(ongoing,interrupted); + + QVERIFY(verify()); +} + +void UT_psuiwaitingnotehandler::t_handleCallWaitingError() +{ + expect("PsUiNotes::cancelNote"); + expect("PsUiNotes::showGlobalErrorNote"); + int error = -1; + m_waitingHandler->handleCallWaitingError(error); + + QVERIFY(verify()); +} + +QTEST_MAIN_S60(UT_psuiwaitingnotehandler) diff -r 1f002146abb4 -r cee7e9e0906c cellular/psuinotes/tsrc/ut_psuiwaitingnotehandler/ut_psuiwaitingnotehandler.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/cellular/psuinotes/tsrc/ut_psuiwaitingnotehandler/ut_psuiwaitingnotehandler.h Wed Aug 18 10:19:22 2010 +0300 @@ -0,0 +1,54 @@ +/* +* Copyright (c) 2009 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" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +#ifndef UT_PSUIWAITINGNOTEHANDLER_H +#define UT_PSUIWAITINGNOTEHANDLER_H + +#include +#include + +class CPsetContainer; +class PSetCallWaitingWrapper; +class PsUiWaitingNoteHandler; + +class UT_psuiwaitingnotehandler : public QObject, MockService +{ + Q_OBJECT + +public: + UT_psuiwaitingnotehandler(); + ~UT_psuiwaitingnotehandler(); + +private slots: + void init(); + void cleanup(); + void t_memleak(); + + void t_construction(); + void t_handleCallWaitingGetStatus(); + void t_handleCallWaitingChanged(); + void t_handleCallWaitingRequesting(); + void t_handleCallWaitingError(); + + +private: + CPsetContainer *m_psetContainer; + PSetCallWaitingWrapper *m_mockWaitingWrapper; + PsUiWaitingNoteHandler *m_waitingHandler; +}; + +#endif // UT_PSUIWAITINGNOTEHANDLER_H diff -r 1f002146abb4 -r cee7e9e0906c cellular/psuinotes/tsrc/ut_psuiwaitingnotehandler/ut_psuiwaitingnotehandler.pro --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/cellular/psuinotes/tsrc/ut_psuiwaitingnotehandler/ut_psuiwaitingnotehandler.pro Wed Aug 18 10:19:22 2010 +0300 @@ -0,0 +1,52 @@ +# +# Copyright (c) 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" +# which accompanies this distribution, and is available +# at the URL "http://www.eclipse.org/legal/epl-v10.html". +# +# Initial Contributors: +# Nokia Corporation - initial contribution. +# +# Contributors: +# +# Description: +# + + +CONFIG += hb qtestlib +TEMPLATE = app +TARGET = +DEPENDPATH += . ../../src/ +INCLUDEPATH += . ../../inc/ +DEFINES += BUILD_PSUINOTES BUILD_PSETWRAPPER + +QT -= gui +QT += testlib + +symbian: { + INCLUDEPATH += $$MW_LAYER_SYSTEMINCLUDE + LIBS += -lmocklib -lsymbianmock +} + +# test code +HEADERS += ut_psuiwaitingnotehandler.h +SOURCES += ut_psuiwaitingnotehandler.cpp + +# code to be tested +HEADERS += ../../../../phonesrv_plat/phone_settings_ui_notes_api/inc/psuiwaitingnotehandler.h +SOURCES += ../../src/psuiwaitingnotehandler.cpp + +# mocks needed for testing +HEADERS += ../../../../phonesrv_plat/phone_settings_ui_notes_api/inc/psuinotes.h \ + ../../../../phonesrv_plat/phone_settings_api/inc/psetcallwaitingwrapper.h \ + ../../../../phonesrv_plat/phone_settings_api/inc/psetcalldivertingwrapper.h \ + ../../../telephonysettings/xqbindings/psetwrapper/src/psetcallwaitingwrapper_p.h \ + ../../inc/psuiutils.h + +SOURCES += ../mocks/mock_psuinotes.cpp \ + ../mocks/mock_psetcallwaitingwrapper.cpp \ + ../mocks/mock_qobject.cpp \ + ../mocks/mock_psuiutils.cpp \ + ../mocks/mock_psetcallwaitingwrapper_p.cpp diff -r 1f002146abb4 -r cee7e9e0906c cellular/telephonysettings/xqbindings/psetwrapper/tsrc/run_auto_tests_qt.bat --- a/cellular/telephonysettings/xqbindings/psetwrapper/tsrc/run_auto_tests_qt.bat Tue Jul 06 14:53:02 2010 +0300 +++ b/cellular/telephonysettings/xqbindings/psetwrapper/tsrc/run_auto_tests_qt.bat Wed Aug 18 10:19:22 2010 +0300 @@ -32,7 +32,7 @@ :: starting with "ut_". :::::::::::::::::::::::::::::::::::::::::::::::::::::: :DEFAULT -set TESTED_SRC=..\..\src\* +set TESTED_SRC=..\..\src\*.cpp for /f %%a in ('dir /b ut_*') do call :build %%a if [%DOMODULESTESTS%] EQU [TRUE] ( @@ -169,7 +169,7 @@ :::::::::::::::::::::::::::::::::::::::::::::::::::::: :CALCULATECOVERAGE echo Calculating coverage -ctcpost %PATH_TO_COVERAGE_DATA%\*.sym | ctcmerge -i - -o profile.txt +ctcpost %PATH_TO_COVERAGE_DATA%\*.sym -p - | ctcmerge -i - -o profile.txt call ctc2html -t 70 -i profile.txt -o \coverage_result -nsb goto end diff -r 1f002146abb4 -r cee7e9e0906c phoneclientserver/phoneclient/Inc/UssdWrapper/CPhCltUssdNoteController.h --- a/phoneclientserver/phoneclient/Inc/UssdWrapper/CPhCltUssdNoteController.h Tue Jul 06 14:53:02 2010 +0300 +++ b/phoneclientserver/phoneclient/Inc/UssdWrapper/CPhCltUssdNoteController.h Wed Aug 18 10:19:22 2010 +0300 @@ -95,11 +95,6 @@ */ void ConstructL(); - /** - * LoadDefaultString. - */ - HBufC* LoadDefaultStringL( const TDesC& aText ); - private: // Data /** @@ -112,15 +107,6 @@ */ MPhCltUssdNoteControllerCallBack& iCallBack; - /** - * Check Load Success .ts file successfully or not - */ - TBool iIsResolverSuccess; - - /** - * Own, resouce of global note. - */ - HBufC* iGlobalResource; }; #endif // CPHCLTUSSDNOTECONTROLLER_H diff -r 1f002146abb4 -r cee7e9e0906c phoneclientserver/phoneclient/Src/UssdWrapper/CPhCltUssdNoteController.cpp --- a/phoneclientserver/phoneclient/Src/UssdWrapper/CPhCltUssdNoteController.cpp Tue Jul 06 14:53:02 2010 +0300 +++ b/phoneclientserver/phoneclient/Src/UssdWrapper/CPhCltUssdNoteController.cpp Wed Aug 18 10:19:22 2010 +0300 @@ -32,9 +32,9 @@ _LIT(KUssdDone, "txt_ussd_dpopinfo_done"); // Done _LIT(KUssdNotDone, "txt_ussd_dpopinfo_not_done"); // NotDone _LIT(KUssdNotAllowed, "txt_ussd_dpopinfo_not_allowed"); //NotAllowed -_LIT(KUssdUnconfirmed, "txt_ussd_dpopinfo_unconfirmed"); // Unconfirmed +_LIT(KUssdUnconfirmed, "txt_ussd_dpopinfo_request_not_confirmed"); // Unconfirmed _LIT(KUssdNoService, "txt_ussd_dpopinfo_no_service"); // NoService -_LIT(KUssdOffline, "txt_ussd_dpopinfo_offline_not_possible"); // Offline +_LIT(KUssdOffline, "txt_ussd_dpopinfo_unable_to_use_network_phone_is"); // Offline _LIT(KUssdHide, "txt_common_button_hide"); // Hide const int KPhCltUssdProgressBarMaxLength = 10; @@ -77,9 +77,7 @@ CPhCltUssdNoteController::CPhCltUssdNoteController( MPhCltUssdNoteControllerCallBack& aCallBack ) : iGlobalWaitNote( NULL ), - iCallBack( aCallBack ), - iIsResolverSuccess( EFalse ), - iGlobalResource( NULL ) + iCallBack( aCallBack ) { TFLOGSTRING("CPhCltUssdNoteController: CPhCltUssdNoteController call") TFLOGSTRING("CPhCltUssdNoteController: CPhCltUssdNoteController exit") @@ -106,58 +104,57 @@ { TFLOGSTRING2("CPhCltUssdNoteController: ShowGlobalInformationNoteL\ aInfoType = %d call", aInfoType) - iIsResolverSuccess = HbTextResolverSymbian::Init( KUssdLocFilename, KPath ); + const TBool textResolver = HbTextResolverSymbian::Init( + KUssdLocFilename, KPath ); TFLOGSTRING2("CPhCltUssdNoteController: ShowGlobalInformationNoteL\ - ussd iIsResolverSuccess = %d", iIsResolverSuccess ) + ussd textResolver = %d", textResolver ) HBufC* temp(NULL); switch ( aInfoType ) { case EPhCltUssdUnconfirme: { - temp = LoadDefaultStringL(KUssdUnconfirmed); + temp = HbTextResolverSymbian::LoadLC( KUssdUnconfirmed ); break; } case EPhCltUssdNotallowed: { - temp = LoadDefaultStringL(KUssdNotAllowed); + temp = HbTextResolverSymbian::LoadLC( KUssdNotAllowed ); break; } case EPhCltUssdNoservice: { - temp = LoadDefaultStringL(KUssdNoService); + temp = HbTextResolverSymbian::LoadLC( KUssdNoService ); break; } case EPhCltUssdOffline: { - temp = LoadDefaultStringL(KUssdOffline); + temp = HbTextResolverSymbian::LoadLC( KUssdOffline ); break; } case EPhCltUssdDone: { - temp = LoadDefaultStringL(KUssdDone); + temp = HbTextResolverSymbian::LoadLC( KUssdDone ); break; } case EPhCltUssdNotDone: { - temp = LoadDefaultStringL(KUssdNotDone); + temp = HbTextResolverSymbian::LoadLC( KUssdNotDone ); break; } default: { User::Leave( KErrArgument ); + break; } - break; } CHbDeviceMessageBoxSymbian* dlg = CHbDeviceMessageBoxSymbian::NewL( CHbDeviceMessageBoxSymbian::EInformation); CleanupStack::PushL( dlg ); dlg->SetTextL( temp->Des() ); - dlg->SetButton( CHbDeviceMessageBoxSymbian::EAcceptButton, - ETrue ); + dlg->SetButton( CHbDeviceMessageBoxSymbian::EAcceptButton, ETrue ); dlg->ExecL(); CleanupStack::PopAndDestroy( dlg ); - delete temp; - temp = NULL; + CleanupStack::PopAndDestroy( temp ); TFLOGSTRING("CPhCltUssdNoteController: ShowGlobalInformationNoteL exit") } @@ -168,22 +165,27 @@ { TFLOGSTRING("CPhCltUssdNoteController: ShowGlobalWaitNoteL call") DestroyGlobalWaitNote(); - iIsResolverSuccess = HbTextResolverSymbian::Init( KCommonLocFilename, KPath ); + TBool textResolver = HbTextResolverSymbian::Init( + KCommonLocFilename, KPath ); TFLOGSTRING2("CPhCltUssdNoteController: ConstructL\ - init common iIsResolverSuccess = %d", iIsResolverSuccess ) + init common textResolver = %d", textResolver ) //CHbDeviceProgressDialogSymbian iGlobalWaitNote = CHbDeviceProgressDialogSymbian::NewL( CHbDeviceProgressDialogSymbian::EProgressDialog ); CleanupStack::PushL( iGlobalWaitNote ); - iGlobalResource = LoadDefaultStringL( KUssdRequesting ); - iGlobalWaitNote->SetTextL( iGlobalResource->Des() ); + HBufC* context = HbTextResolverSymbian::LoadLC( KUssdRequesting ); + iGlobalWaitNote->SetTextL( context->Des() ); + HBufC* bottonText = HbTextResolverSymbian::LoadLC( KUssdHide ); + iGlobalWaitNote->SetButtonTextL( bottonText->Des() ); iGlobalWaitNote->SetObserver( this ); TFLOGSTRING("CPhCltUssdNoteController: ShowGlobalWaitNoteL before setactive") iGlobalWaitNote->SetRange(0,KPhCltUssdProgressBarMaxLength); iGlobalWaitNote->SetProgressValue( KPhCltUssdProgressBarMaxLength ); iGlobalWaitNote->SetAutoClose( EFalse ); - iGlobalWaitNote->SetButtonTextL( LoadDefaultStringL( KUssdHide )->Des() ); iGlobalWaitNote->ShowL(); + TFLOGSTRING("CPhCltUssdNoteController: ShowGlobalWaitNoteL after ShowL") + CleanupStack::PopAndDestroy( bottonText ); + CleanupStack::PopAndDestroy( context ); CleanupStack::Pop( iGlobalWaitNote ); TFLOGSTRING("CPhCltUssdNoteController: ShowGlobalWaitNoteL after setactive") TFLOGSTRING("CPhCltUssdNoteController: ShowGlobalWaitNoteL exit") @@ -200,8 +202,6 @@ iGlobalWaitNote->Close(); delete iGlobalWaitNote; iGlobalWaitNote = NULL; - delete iGlobalResource; - iGlobalResource = NULL; } TFLOGSTRING("CPhCltUssdNoteController: DestroyGlobalWaitNote exit") } @@ -217,8 +217,6 @@ { TFLOGSTRING("CPhCltUssdNoteController: ProgressDialogCancelled call") iCallBack.GlobalWaitNoteHidden(); - delete iGlobalResource; - iGlobalResource = NULL; TFLOGSTRING("CPhCltUssdNoteController: ProgressDialogCancelled exit") } @@ -235,28 +233,5 @@ TFLOGSTRING("CPhCltUssdNoteController: ProgressDialogClosed exit") } -// ----------------------------------------------------------------------------- -// CPhCltUssdNoteController::LoadDefaultString -// -// -// ----------------------------------------------------------------------------- -// -HBufC* CPhCltUssdNoteController::LoadDefaultStringL( const TDesC& aText ) - { - TFLOGSTRING("CPhCltUssdNoteController: LoadDefaultString call") - HBufC* newText = NULL; - if ( iIsResolverSuccess ) - { - newText = HbTextResolverSymbian::LoadL( aText ); - } - else - { - newText = aText.AllocL(); - TFLOGSTRING("CPhCltUssdNoteController: LoadDefaultString load failed."); - } - TFLOGSTRING("CPhCltUssdNoteController: LoadDefaultString exit") - return newText; - } - // End of file diff -r 1f002146abb4 -r cee7e9e0906c phoneclientserver/phoneclient/conf/ci_telephonyservices.confml Binary file phoneclientserver/phoneclient/conf/ci_telephonyservices.confml has changed diff -r 1f002146abb4 -r cee7e9e0906c phoneclientserver/phoneclient/tsrc/public/basic/ut_ussd/ut_testenv.cpp --- a/phoneclientserver/phoneclient/tsrc/public/basic/ut_ussd/ut_testenv.cpp Tue Jul 06 14:53:02 2010 +0300 +++ b/phoneclientserver/phoneclient/tsrc/public/basic/ut_ussd/ut_testenv.cpp Wed Aug 18 10:19:22 2010 +0300 @@ -20,34 +20,42 @@ // ==================================================================== EtelMsgLoop::EtelMsgLoop() { - mSendMessageReqStatus = 0; - - mReceiveMessageReqStatus = 0; - mReceiveMessageData = 0; - mReceiveMessageAttributes = 0; - - mNetworkReleaseReqStatus = 0; - mNetworkReleaseMessageData = 0; - mNetworkReleaseMessageAttributes = 0; + mSendMessageReqStatus = 0; + + mReceiveMessageReqStatus = 0; + mReceiveMessageData = 0; + mReceiveMessageAttributes = 0; + + mNetworkReleaseReqStatus = 0; + mNetworkReleaseMessageData = 0; + mNetworkReleaseMessageAttributes = 0; } void EtelMsgLoop::receive( const TDesC8& msg, const TDesC8& attr ) { - QVERIFY2(mReceiveMessageReqStatus, "EtelMsgLoop: unable to receive"); - mReceiveMessageData->Copy( msg ); - mReceiveMessageAttributes->Copy( attr ); + qDebug("EtelMsgLoop::receive mReceiveMessageReqStatus in =%d", + mReceiveMessageReqStatus); + mReceiveMessageData->Copy( msg ); + mReceiveMessageAttributes->Copy( attr ); const TestMode& mode = TestEnv::env().testMode(); - User::RequestComplete(mReceiveMessageReqStatus, mode.m_error); + User::RequestComplete(mReceiveMessageReqStatus, mode.m_error); + qDebug("EtelMsgLoop::receive mReceiveMessageReqStatus out =%d", + mReceiveMessageReqStatus); + QVERIFY(mReceiveMessageReqStatus == 0); } void EtelMsgLoop::networkRelease( const TDesC8& msg, const TDesC8& attr ) { - QVERIFY2(mNetworkReleaseReqStatus, "EtelMsgLoop: unable to networkRelease"); - mNetworkReleaseMessageData->Copy( msg ); - if ( mNetworkReleaseMessageAttributes ) - mNetworkReleaseMessageAttributes->Copy( attr ); - const TestMode& mode = TestEnv::env().testMode(); - User::RequestComplete(mNetworkReleaseReqStatus, mode.m_error); + qDebug("EtelMsgLoop::networkRelease mNetworkReleaseReqStatus in =%d", + mNetworkReleaseReqStatus); + mNetworkReleaseMessageData->Copy( msg ); + if ( mNetworkReleaseMessageAttributes ) + mNetworkReleaseMessageAttributes->Copy( attr ); + const TestMode& mode = TestEnv::env().testMode(); + User::RequestComplete(mNetworkReleaseReqStatus, mode.m_error); + qDebug("EtelMsgLoop::networkRelease mNetworkReleaseReqStatus out =%d", + mNetworkReleaseReqStatus); + QVERIFY(mNetworkReleaseReqStatus == 0); } // ==================================================================== @@ -83,10 +91,10 @@ // create the main USSD resource manager class m_resourceManager = new CPhSrvResourceManager(m_fs); TRAP(leave, m_resourceManager->ConstructL()); - QVERIFY(leave==0); + QVERIFY(leave == 0); m_ussdManager = new CPhSrvUssdManager(m_fs,*m_resourceManager); TRAP(leave,m_ussdManager->ConstructL(*this)); - QVERIFY(leave==0); + QVERIFY(leave == 0); m_fakeMessage = new RMessage2(); } diff -r 1f002146abb4 -r cee7e9e0906c phoneclientserver/phoneclient/tsrc/public/basic/ut_ussd/ut_ussd.cpp --- a/phoneclientserver/phoneclient/tsrc/public/basic/ut_ussd/ut_ussd.cpp Tue Jul 06 14:53:02 2010 +0300 +++ b/phoneclientserver/phoneclient/tsrc/public/basic/ut_ussd/ut_ussd.cpp Wed Aug 18 10:19:22 2010 +0300 @@ -339,9 +339,9 @@ receive(msg1,RMobileUssdMessaging::EUssdMTRequest); activeSleep(1000); receive(msg2,RMobileUssdMessaging::EUssdMTRequest); - //activeSleep(1000); + activeSleep(1000); receive(msg3,RMobileUssdMessaging::EUssdMTNotify); - //activeSleep(1000); + activeSleep(1000); TestEnv::destroy(); QTest::qSleep(200); diff -r 1f002146abb4 -r cee7e9e0906c phoneclientserver/phoneserver/Inc/Ussd/CPhSrvUssdManager.h --- a/phoneclientserver/phoneserver/Inc/Ussd/CPhSrvUssdManager.h Tue Jul 06 14:53:02 2010 +0300 +++ b/phoneclientserver/phoneserver/Inc/Ussd/CPhSrvUssdManager.h Wed Aug 18 10:19:22 2010 +0300 @@ -426,8 +426,6 @@ // An asynchronous callback for sending MO ACK messages CAsyncCallBack* iMoAckCallback; - TBool iTextResolver; - HBufC* iTextBuffer; }; diff -r 1f002146abb4 -r cee7e9e0906c phoneclientserver/phoneserver/Src/Ussd/CPhSrvUssdManager.cpp --- a/phoneclientserver/phoneserver/Src/Ussd/CPhSrvUssdManager.cpp Tue Jul 06 14:53:02 2010 +0300 +++ b/phoneclientserver/phoneserver/Src/Ussd/CPhSrvUssdManager.cpp Wed Aug 18 10:19:22 2010 +0300 @@ -390,7 +390,6 @@ iDeviceDialog( NULL ), iDCS ( KPhCltDcsUnknown ), iReturnResultPckg ( iReturnResult ), - iTextResolver ( EFalse ), iTextBuffer ( NULL ) { CActiveScheduler::Add( this ); @@ -460,9 +459,9 @@ void CPhSrvUssdManager::ConstructL( MPhSrvPhoneInterface& aPhoneInterface ) { _DPRINT( 4, "PhSrv.ConstructL.Start" ); - iTextResolver = HbTextResolverSymbian::Init( + const TBool textResolver = HbTextResolverSymbian::Init( KUssdLocFilename, KLocPath ); - _DDPRINT( 4, "PhSrv.ConstructL.ussd loc:", iTextResolver ); + _DDPRINT( 4, "PhSrv.ConstructL.ussd loc:", textResolver ); User::LeaveIfError( iTimer.CreateLocal() ); User::LeaveIfError( iMobileUssdMessaging.Open( aPhoneInterface.PhSrvMobilePhone() ) ); @@ -867,6 +866,7 @@ iDeviceDialog->SetObserver( this ); iDeviceDialog->SetTimeout( KPhSrvUssdTimeout ); iDeviceDialog->SetDismissPolicy ( KPhSrvUssdPopupDismissPolicy ); + iDeviceDialog->SetIconVisible(EFalse); // Show left key with empty string accoring to ui concept iDeviceDialog->SetButton( @@ -1425,8 +1425,7 @@ } if ( iClearArray ) { - iTextResolver = HbTextResolverSymbian::Init( - KCommonLocFilename, KLocPath ); + HbTextResolverSymbian::Init( KCommonLocFilename, KLocPath ); _DPRINT( 4, "PhSrv.LGMQ.use common loc file" ); // Yes, No iDeviceDialog->SetButton( @@ -1440,8 +1439,7 @@ CHbDeviceMessageBoxSymbian::ERejectButton, LoadDefaultString( KUssdNo ) ); _DPRINT( 4, "PhSrv.LGMQ.Yes&No" ); - iTextResolver = HbTextResolverSymbian::Init( - KUssdLocFilename, KLocPath ); + HbTextResolverSymbian::Init( KUssdLocFilename, KLocPath ); _DPRINT( 4, "PhSrv.LGMQ.back up to use ussd loc file" ); } iReceivedMessage.Zero(); @@ -2175,7 +2173,7 @@ } TInt err = KErrNone; TPtrC ptr( aText ); - if ( iTextResolver && ptr.Length() ) + if ( ptr.Length() ) { TRAP( err, iTextBuffer = HbTextResolverSymbian::LoadL( ptr ) ); _DDPRINT( 4, "PhSrv.LoadDefaultString.LoadL.%d", err ); diff -r 1f002146abb4 -r cee7e9e0906c phonesrv.pro --- a/phonesrv.pro Tue Jul 06 14:53:02 2010 +0300 +++ b/phonesrv.pro Wed Aug 18 10:19:22 2010 +0300 @@ -11,7 +11,7 @@ # # Contributors: # -# Description: Project file for building phonesrv components +# Description: Project file for building phonesrv components # # diff -r 1f002146abb4 -r cee7e9e0906c phonesrv_plat/dialpad_api/inc/dialpad.h --- a/phonesrv_plat/dialpad_api/inc/dialpad.h Tue Jul 06 14:53:02 2010 +0300 +++ b/phonesrv_plat/dialpad_api/inc/dialpad.h Wed Aug 18 10:19:22 2010 +0300 @@ -64,6 +64,8 @@ void paint(QPainter* painter, const QStyleOptionGraphicsItem* option, QWidget* widget); + + void changeEvent(QEvent *event); void showEvent(QShowEvent *event); diff -r 1f002146abb4 -r cee7e9e0906c satengine/SatServer/Commands/RefreshRequiredCmd/inc/CRefreshRequiredHandler.h --- a/satengine/SatServer/Commands/RefreshRequiredCmd/inc/CRefreshRequiredHandler.h Tue Jul 06 14:53:02 2010 +0300 +++ b/satengine/SatServer/Commands/RefreshRequiredCmd/inc/CRefreshRequiredHandler.h Wed Aug 18 10:19:22 2010 +0300 @@ -1,5 +1,5 @@ /* -* Copyright (c) 2002-2008 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" @@ -102,29 +102,6 @@ private: /** - * The indicated AID may be of four states. - * We treat it as the Active AID case if the indicated AID is NULL. - */ - enum TAidState - { - EAidInvalid, - EAidActive, - EAidNotActive, - EAidNull - }; - /** - * The header of AID from etelsat is A0 in hex equaled to 160 in decemal. - * The second, third and fourth byte of AID is 0. - */ - enum TAidBytes - { - EAid0, - EAidA0 = 160 - }; - - private: - - /** * C++ default constructor. */ CRefreshRequiredHandler(); @@ -178,19 +155,6 @@ */ void RefreshAllowed( const TDesC8& aRsp ); - /** - * Get the indicated AID state according to - * the current application's AID. - * @return TAidstate indicating the state of the indicated AID. - */ - TAidState AidState() const; - - /** - * Check whether the current application's AID is valid. - * @return TBool indicating whether the indicated AID is valid. - * @param aAid RefreshRequired AID data from etelsat. - */ - TBool IsValidAid( const RSat::TAid& aAid ) const; private: // Data // Refresh command data. @@ -222,7 +186,7 @@ // Response of refresh query. TBool iAllowRefresh; - + }; #endif // CREFRESHREQUIREDHANDLER_H diff -r 1f002146abb4 -r cee7e9e0906c satengine/SatServer/Commands/RefreshRequiredCmd/src/CRefreshRequiredHandler.cpp --- a/satengine/SatServer/Commands/RefreshRequiredCmd/src/CRefreshRequiredHandler.cpp Tue Jul 06 14:53:02 2010 +0300 +++ b/satengine/SatServer/Commands/RefreshRequiredCmd/src/CRefreshRequiredHandler.cpp Wed Aug 18 10:19:22 2010 +0300 @@ -1,5 +1,5 @@ /* -* Copyright (c) 2002-2008 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" @@ -30,12 +30,8 @@ #include "MSatUiSession.h" #include "SatSOpcodes.h" #include "MSatRefreshSubSession.h" -#include "msatmultimodeapi.h" #include "SatLog.h" -// CONSTANTS -const TInt KAidMinSize( 12 ); - // ============================ MEMBER FUNCTIONS =============================== @@ -367,38 +363,6 @@ iRefreshRequiredRsp.iAdditionalInfo[0] = RSat::KMeBusyOnCall; commandAllowed = EFalse; } - //Check the AidState. - else - { - const TAidState aidState = AidState(); - LOG2( NORMAL, "REFRESHREQ: AID state: %i", aidState ) - switch ( aidState ) - { - case EAidNotActive: - { - iRefreshRequiredRsp.iGeneralResult = - RSat::KRefreshUSIMNotActive; - iRefreshRequiredRsp.iInfoType = RSat::KNoAdditionalInfo; - commandAllowed = EFalse; - break; - } - - case EAidInvalid: - { - iRefreshRequiredRsp.iGeneralResult = - RSat::KCmdDataNotUnderstood; - iRefreshRequiredRsp.iInfoType = RSat::KNoAdditionalInfo; - commandAllowed = EFalse; - break; - } - - default: - { - LOG( NORMAL, "REFRESHREQ: Refresh allowed" ) - break; - } - } - } // When refresh is not allowed, send terminal response to sim. if ( !commandAllowed ) @@ -761,87 +725,5 @@ LOG( SIMPLE, "REFRESHREQ: CRefreshRequiredHandler::RefreshAllowed exiting" ) } - -// ----------------------------------------------------------------------------- -// CRefreshHandler::CheckIndicatedAid -// Check the state of the indicated Aid. -// ----------------------------------------------------------------------------- -// -CRefreshRequiredHandler::TAidState -CRefreshRequiredHandler::AidState() const - { - LOG( SIMPLE, "REFRESHREQ: CRefreshRequiredHandler::AidState calling" ) - - TAidState aidState( EAidNotActive ); - if ( !iRefreshRequiredData.iAid.Length() ) - { - aidState = EAidNull; - LOG( SIMPLE, "REFRESHREQ: Indicated AID Null" ) - } - else if ( !IsValidAid( iRefreshRequiredData.iAid ) ) - { - aidState = EAidInvalid; - LOG( SIMPLE, "REFRESHREQ: Indicated AID Invalid" ) - } - else - { - RSat::TAid aid; - MSatAsyncToSync* wrapper = iUtils->CreateAsyncToSyncHelper(); - if ( wrapper ) - { - iUtils->MultiModeApi().GetCurrentActiveUSimApplication( - wrapper->RequestStatus() , aid ); - // wait until GetCurrentActiveUSimApplication return aid - TInt err = wrapper->SetActiveAndWait(); - LOG2( NORMAL, "REFRESHREQ: CRefreshHandler::TAidState err %d",err ) - wrapper->Release(); - - if ( KErrNone == err ) - { - #ifdef ENABLE_SAT_LOGGING - for ( TInt i=0; i < aid.Length(); i++ ) - { - LOG2( DETAILED, "REFRESHREQ: AID from TSY: %x", aid[i] ) - } - #endif - if ( aid == iRefreshRequiredData.iAid ) - { - aidState = EAidActive; - } - } - else if ( KErrNotSupported == err ) - { - aidState = EAidActive; - } - } - LOG( SIMPLE, "REFRESHREQ: CRefreshRequiredHandler::AidState exit" ) - } - return aidState; - } - -// ----------------------------------------------------------------------------- -// Check whether the given AID is valid. -// According to TS 110 220 -// ----------------------------------------------------------------------------- -TBool CRefreshRequiredHandler::IsValidAid( const RSat::TAid& aAid ) const - { - LOG( SIMPLE, "REFRESHREQ: CRefreshRequiredHandler::\ - IsValidAid calling-exiting" ) - TInt result ( EFalse ); - // Check the length of AID, it should be between 12 to 16 bytes - // ETSI: A0,00,00,00,09; - // 3GPP: A0,00,00,00,87 - // the fifth byte is not sure in other situations. - //compare the first to fourth byte - if ( KAidMinSize <= aAid.Length() && RSat::KAidMaxSize >= aAid.Length() ) - { - if ( EAidA0 == aAid[0]&& EAid0 == aAid[1] && - EAid0 == aAid[2]&& EAid0 == aAid[3] ) - { - result = ETrue; - } - } - return result; - } // End of File diff -r 1f002146abb4 -r cee7e9e0906c satengine/SatServer/Engine/group/SatEngine.mmp --- a/satengine/SatServer/Engine/group/SatEngine.mmp Tue Jul 06 14:53:02 2010 +0300 +++ b/satengine/SatServer/Engine/group/SatEngine.mmp Wed Aug 18 10:19:22 2010 +0300 @@ -1,5 +1,5 @@ /* -* Copyright (c) 2002-2009 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" @@ -75,12 +75,8 @@ SYSTEMINCLUDE /epoc32/include/ecom SYSTEMINCLUDE ../../../../inc // Domain telephonyservices SYSTEMINCLUDE ../../../inc // Subsystem satengine +SYSTEMINCLUDE /epoc32/include/mw/hb/hbcore -START RESOURCE ../src/SatServer.rss -HEADER -TARGETPATH RESOURCE_FILES_DIR -LANGUAGE_IDS -END // RESOURCE USERINCLUDE ../inc USERINCLUDE ../../inc @@ -108,6 +104,7 @@ LIBRARY netmeta.lib LIBRARY cmmanager.lib LIBRARY extendedconnpref.lib +LIBRARY hbcore.lib #ifdef ENABLE_SAT_LOGGING LIBRARY flogger.lib diff -r 1f002146abb4 -r cee7e9e0906c satengine/SatServer/Engine/group/bld.inf --- a/satengine/SatServer/Engine/group/bld.inf Tue Jul 06 14:53:02 2010 +0300 +++ b/satengine/SatServer/Engine/group/bld.inf Wed Aug 18 10:19:22 2010 +0300 @@ -1,5 +1,5 @@ /* -* Copyright (c) 2003-2008 Nokia Corporation and/or its subsidiary(-ies). +* Copyright (c) 2003-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" @@ -24,7 +24,6 @@ PRJ_EXPORTS ../inc/MSatShellController.h |../../../../inc/MSatShellController.h ../../CenRep/SATInternalPSKeys.h |../../../../inc/SATInternalPSKeys.h -../../loc/SatServer.loc MW_LAYER_LOC_EXPORT_PATH( satserver.loc ) PRJ_MMPFILES SatEngine.mmp diff -r 1f002146abb4 -r cee7e9e0906c satengine/SatServer/Engine/inc/CSatCommandContainer.h --- a/satengine/SatServer/Engine/inc/CSatCommandContainer.h Tue Jul 06 14:53:02 2010 +0300 +++ b/satengine/SatServer/Engine/inc/CSatCommandContainer.h Wed Aug 18 10:19:22 2010 +0300 @@ -1,5 +1,5 @@ /* -* Copyright (c) 2005-2008 Nokia Corporation and/or its subsidiary(-ies). +* Copyright (c) 2005-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" @@ -372,7 +372,7 @@ * @since S60 v3.0 * @param aResourceId Selects name of the item to be read. */ - void CreateSatAppNameL( const TInt aResourceId ); + void CreateSatAppNameL( const TDesC& aResourceId ); /** * Gives pointer to BIP Utils class. diff -r 1f002146abb4 -r cee7e9e0906c satengine/SatServer/Engine/inc/csatmultimodeapi.h --- a/satengine/SatServer/Engine/inc/csatmultimodeapi.h Tue Jul 06 14:53:02 2010 +0300 +++ b/satengine/SatServer/Engine/inc/csatmultimodeapi.h Wed Aug 18 10:19:22 2010 +0300 @@ -149,12 +149,6 @@ void DialCancel(); /** - * Access RMobilePhone::GetCurrentActiveUSimApplication - */ - void GetCurrentActiveUSimApplication( TRequestStatus& aReqStatus, - RMobilePhone::TAID& aAID ); - - /** * Check if there is an incoming call * @return ETrue if there is an incoming call */ diff -r 1f002146abb4 -r cee7e9e0906c satengine/SatServer/Engine/src/CSatCommandContainer.cpp --- a/satengine/SatServer/Engine/src/CSatCommandContainer.cpp Tue Jul 06 14:53:02 2010 +0300 +++ b/satengine/SatServer/Engine/src/CSatCommandContainer.cpp Wed Aug 18 10:19:22 2010 +0300 @@ -20,12 +20,12 @@ #include #include #include -#include #include #include #include #include #include +#include #include "MSatSystemState.h" #include "TSatSystemStateFactory.h" @@ -52,16 +52,14 @@ #include "csatmultimodeapi.h" #include "csatsactivewrapper.h" -// Drive letter for resource file -_LIT( KResourceDrive, "Z:" ); -// SatServer's resource file -_LIT( KSatServerRsc, "SatServer.rsc" ); - +_LIT( KResourceDrive, "z:\\resource\\qt\\translations" ); +_LIT( KSatServerRsc, "satapp_"); +_LIT( KSatLogTitle, "txt_simatk_title_sim_services"); +_LIT( KSatCmccTitle, "txt_simatk_titlw_cmcc_sim_services"); const TUid KSatInterfaceDefinitionUid = { 0x1000f001 }; const TInt KSizeOfBuf = 50; -const TInt8 KCreateSatAppNamePop( 2 ); // Important plugins UIDs. These are started on startup // Implementation UID is from the .rss @@ -395,7 +393,7 @@ iIsCmccSim = ETrue; // Update default name read in ConstructL. - TRAPD( err, CreateSatAppNameL( R_QTN_SAT_CMCC_TITLE ) ); + TRAPD( err, CreateSatAppNameL( KSatCmccTitle ) ); LOG2( NORMAL, "SATENGINE: Error: %i", err ) if ( KErrNone == err ) { @@ -627,7 +625,7 @@ { LOG( NORMAL, "SATENGINE: CSatCommandContainer::RestoreSatAppNameL name reset" ) - CreateSatAppNameL( R_QTN_SAT_LOG_TITLE ); + CreateSatAppNameL( KSatLogTitle ); } LOG( NORMAL, "SATENGINE: CSatCommandContainer::RestoreSatAppNameL exiting" ) } @@ -902,7 +900,7 @@ LOG( NORMAL, "SATENGINE: CSatCommandContainer::ConstructL calling" ) iIsCmccSim = EFalse; - CreateSatAppNameL( R_QTN_SAT_LOG_TITLE ); + CreateSatAppNameL( KSatLogTitle ); // Register for ui events in order to keep track if user or command // has launched the ui. @@ -991,52 +989,22 @@ // (other items were commented in a header). // ----------------------------------------------------------------------------- // -void CSatCommandContainer::CreateSatAppNameL( const TInt aResourceId ) +void CSatCommandContainer::CreateSatAppNameL( const TDesC& aResourceId ) { LOG( NORMAL, "SATENGINE: CSatCommandContainer::CreateSatAppNameL calling" ) - - // Open the RFs session. - RFs fs; - - User::LeaveIfError( fs.Connect() ); - - // Push close operation in tbe cleanup stack - CleanupClosePushL( fs ); - - RResourceFile resFile; - // Backslashes are already defined in resource file, not needed here. - TBuf buf( KResourceDrive ); - buf.Append( KDC_RESOURCE_FILES_DIR ); - buf.Append( KSatServerRsc ); - - TFileName fileName( buf ); - - BaflUtils::NearestLanguageFile( fs, fileName ); - - // Open the resource file - resFile.OpenL( fs, fileName ); + delete iSatAppName; + iSatAppName = NULL; + const TBool textResolver = HbTextResolverSymbian::Init( + KSatServerRsc, KResourceDrive ); + LOG2(NORMAL,"SATENGINE: CSatCommandContainer::\ + CreateSatAppNameL textResolver = %d", textResolver ) + LOG2(NORMAL,"SATENGINE: CSatCommandContainer::\ + CreateSatAppNameL aResourceId = %S", &aResourceId ) - // Push close operation in the cleanup stack - CleanupClosePushL( resFile ); - - resFile.ConfirmSignatureL( ESatSResourceSignature ); - - // Reads a resource structure with memory allocation. - HBufC8* dataBuffer = resFile.AllocReadLC( aResourceId ); - - TResourceReader resReader; - resReader.SetBuffer( dataBuffer ); - - // Reads a string with memory allocation - iSatAppName = resReader.ReadHBufCL(); + iSatAppName = HbTextResolverSymbian::LoadL( aResourceId ); + LOG2(NORMAL,"SATENGINE: CSatCommandContainer::\ + CreateSatAppNameL iSatAppName = %S", iSatAppName ) iSatBipName.Copy( SatAppName() ); - - // dataBuffer - CleanupStack::PopAndDestroy( dataBuffer ); - // resFile, Calls resFile.Close() - // fs, Calls fs.Close - CleanupStack::PopAndDestroy( KCreateSatAppNamePop ); - LOG( NORMAL, "SATENGINE: CSatCommandContainer::CreateSatAppNameL exiting" ) } diff -r 1f002146abb4 -r cee7e9e0906c satengine/SatServer/Engine/src/SatServer.rss --- a/satengine/SatServer/Engine/src/SatServer.rss Tue Jul 06 14:53:02 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,43 +0,0 @@ -/* -* Copyright (c) 2003-2007 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" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: This file contains all the resources for the module. -* -*/ - - -NAME SATS - -#include - -#include "SatServer.hrh" -#include - -RESOURCE RSS_SIGNATURE { signature = ESatSResourceSignature; } - -/******************* Localized texts **********************/ - -// ----------------------------------------------------------------------------- -// r_sats_ti_log_title -// Defines localized text -// ----------------------------------------------------------------------------- -// -RESOURCE LBUF r_qtn_sat_log_title - { - txt = qtn_sat_log_title; - } - -RESOURCE LBUF r_qtn_sat_cmcc_title - { - txt = qtn_sat_cmcc_title; - } diff -r 1f002146abb4 -r cee7e9e0906c satengine/SatServer/Engine/src/csatmultimodeapi.cpp --- a/satengine/SatServer/Engine/src/csatmultimodeapi.cpp Tue Jul 06 14:53:02 2010 +0300 +++ b/satengine/SatServer/Engine/src/csatmultimodeapi.cpp Wed Aug 18 10:19:22 2010 +0300 @@ -304,21 +304,6 @@ } // ----------------------------------------------------------------------------- -// CSatMultiModeApi::GetCurrentActiveUSimApplication -// (other items were commented in a header). -// ----------------------------------------------------------------------------- -// -void CSatMultiModeApi::GetCurrentActiveUSimApplication( - TRequestStatus& aReqStatus, RMobilePhone::TAID& aAID ) - { - LOG( SIMPLE, "SATENGINE: CSatMultiModeApi::\ - GetCurrentActiveUSimApplication calling" ) - iPhone.GetCurrentActiveUSimApplication( aReqStatus,aAID ); - LOG( SIMPLE, "SATENGINE: CSatMultiModeApi::\ - GetCurrentActiveUSimApplication exiting" ) - } - -// ----------------------------------------------------------------------------- // CSatMultiModeApi::IsCallIncoming // (other items were commented in a header). // ----------------------------------------------------------------------------- diff -r 1f002146abb4 -r cee7e9e0906c satengine/SatServer/group/bld.inf --- a/satengine/SatServer/group/bld.inf Tue Jul 06 14:53:02 2010 +0300 +++ b/satengine/SatServer/group/bld.inf Wed Aug 18 10:19:22 2010 +0300 @@ -1,5 +1,5 @@ /* -* Copyright (c) 2003-2008 Nokia Corporation and/or its subsidiary(-ies). +* Copyright (c) 2003-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" @@ -24,7 +24,6 @@ PRJ_EXPORTS satserver_stub.sis /epoc32/data/z/system/install/SatServer_stub.sis ../rom/satserver.iby CORE_MW_LAYER_IBY_EXPORT_PATH( satserver.iby ) -../rom/SatServerResources.iby LANGUAGE_MW_LAYER_IBY_EXPORT_PATH( SatServerResources.iby ) // Generic configuration interface for component cenrep settings ../conf/sat.confml MW_LAYER_CONFML(sat.confml) diff -r 1f002146abb4 -r cee7e9e0906c satengine/SatServer/inc/msatmultimodeapi.h --- a/satengine/SatServer/inc/msatmultimodeapi.h Tue Jul 06 14:53:02 2010 +0300 +++ b/satengine/SatServer/inc/msatmultimodeapi.h Wed Aug 18 10:19:22 2010 +0300 @@ -132,12 +132,6 @@ * Access RMobileCall::DialCancel */ virtual void DialCancel() = 0; - /** - * Access RMobilePhone::GetCurrentActiveUSimApplication - * for the paramter information please see the etelmm.h - */ - virtual void GetCurrentActiveUSimApplication( TRequestStatus& aReqStatus, - RMobilePhone::TAID& aAID ) = 0; /** * Check if there is an incoming call diff -r 1f002146abb4 -r cee7e9e0906c satengine/SatServer/loc/SatServer.loc --- a/satengine/SatServer/loc/SatServer.loc Tue Jul 06 14:53:02 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,32 +0,0 @@ -/* -* Copyright (c) 2003-2007 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" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: SatServer localisation file -* -*/ - - -// LOCALISATION STRINGS: - -//d: Sat application name under the Sat icon in app shell. -//l: cell_app_pane_t1 -//w: S90DeskAppName -// -#define qtn_sat_log_title "SIM Services" - -//d: Application title and SAT application name when China -//d: Mobile SIM cards used -//l: cell_app_pane_t1 -#define qtn_sat_cmcc_title "SIM Card Application" - -// End of File diff -r 1f002146abb4 -r cee7e9e0906c satengine/SatServer/rom/SatServerResources.iby --- a/satengine/SatServer/rom/SatServerResources.iby Tue Jul 06 14:53:02 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,32 +0,0 @@ -/* -* Copyright (c) 2003-2006 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" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Sat Server Resources iby file, contains resource file -* iby- information -* -*/ - - -#ifndef SATSERVERRESOURCES_IBY -#define SATSERVERRESOURCES_IBY - -#ifdef __SIMCARD - -// Resource file(s) for SatServer -data = DATAZ_\RESOURCE_FILES_DIR\satserver.rsc RESOURCE_FILES_DIR\satserver.rsc - -#endif // __SIMCARD - -#endif // SATSERVERRESOURCES_IBY - -// End of File diff -r 1f002146abb4 -r cee7e9e0906c satui/satapp/inc/csatuiiconhandler.h --- a/satui/satapp/inc/csatuiiconhandler.h Tue Jul 06 14:53:02 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,112 +0,0 @@ -/* -* Copyright (c) 2006-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" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Introduces CSatUiIconHandler class, which handles -* icon fetching for SatUi. -* -*/ - - -#ifndef CSATUIICONHANDLER_H -#define CSATUIICONHANDLER_H - -#include -#include - -class CFbsBitmap; -class RSatSession; - -/** - * Handles asynchronous icon fetching for SatUi. - * - * Opens connection to SatClient by using received session attribute. - * Receives icon information and does the selection based on received icon id - * attribute. Asks the handle of the icon bitmap from the SatClient's - * RSatIcon class by giving the icon information and the package for handle, - * which is done asynchronously. For mean time, this class is waiting for - * completion of request by starting CActiveSchedulerWait, which is stopped - * when request is completed. After that the icon is duplicated via RSatIcon - * by giving the handle information. This is also an asynchronous call and - * CActiveSchedulerWait is started again. When completed the pointer to the - * bitmap is returned. - * - * @lib satui.exedll - * @since S60 v3.1 - */ -class CSatUiIconHandler : public CBase - { - -public: // Constructors and destructor - - /** - * Constructor. - */ - static CSatUiIconHandler* NewL(); - - /* - * Destructor. - */ - virtual ~CSatUiIconHandler(); - -public: // New functions - - /** - * The method, which fetches the icon. - * - * @since S60 v3.1 - * @param aSatSession Session information for SatClient interface. - * @param aIconId Id for icon to be fetched. - * @param aOptWidth Optimal width of the icon to be fetched. - * @param aOptHeight Optimal height of the icon to be fetched. - * @param aIconSupport Flag to signal if icons are not supported at all - * @return A pointer to the icon bitmap. - */ - CFbsBitmap* FetchIconL( const RSatSession& aSatSession, - const TUint8 aIconId, - const TInt aOptWidth, - const TInt aOptHeight, - TBool& aIconSupport ); - -private: - - /** - * C++ default constructor. - * - * @since S60 v3.1 - */ - CSatUiIconHandler(); - - /** - * Sorts the icons into order of superiority and saves the order into a list - * - * @since S60 v3.1 - * @param aIconEf List of icons - * @param aSelectedIcons List into which order is saved - * @param aOptWidth Optimal width of the icon to be fetched. - * @param aOptHeight Optimal height of the icon to be fetched. - */ - void SortIconsL( const RIconEf& aIconEf, - RArray& aSelectedIcons, - const TInt aOptWidth, - const TInt aOptHeight ) const; - -private: // data - - /** - * RSatService of the SatClient. - */ - RSatService iSatService; - - }; - -#endif // CSATUIICONHANDLER_H diff -r 1f002146abb4 -r cee7e9e0906c satui/satapp/inc/csatuiobserver.h --- a/satui/satapp/inc/csatuiobserver.h Tue Jul 06 14:53:02 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,396 +0,0 @@ -/* -* Copyright (c) 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" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: This class handles the communication between server and user -* interface -* -*/ - - -#ifndef CSATUIOBSERVER_H -#define CSATUIOBSERVER_H - -// INCLUDES -#include -#include -#include -#include -#include "satappcommonconstant.h" -// CONSTANTS -//256 max length-header information fields -const TInt KAdditionalInfoMaxSize = 244; -const TInt KMaxPlayToneLength = 50; - -enum TIconCommand - { - EIconSetUpMenuContext = 1, - EIconSetUpMenuItems, - EIconDisplayText, - EIconGetInput, - EIconGetInkey, - EIconGetYesNo, - EIconPlayTone, - EIconNotification, - EIconConfirmCommand - }; - -// FORWARD DECLARATIONS -class MSatUiAdapter; -class MSatUiActionImplementer; -class CSatUiIconHandler; -class CFbsBitmap; - -// CLASS DECLARATION - -/** -* This class implements the methods specified in the MSatUiObserver. -*/ - -class CSatUiObserver : public CBase, - public MSatUiObserver - { - public: // Constructors and destructor - - /** - * Two-phased constructor. - */ - static CSatUiObserver* NewL(); - - /** - * Destructor. - */ - virtual ~CSatUiObserver(); - - public: // New functions - - /** - * Sets the UI. - * @param aImplementer Pointer to be set. - */ - void SetImplementer( MSatUiActionImplementer* aImplementer ); - - /** - * Returns the adapter provided by SatCli. - */ - MSatUiAdapter* Adapter(); - - - /** - * Return current profile state. - * @return current profile state. - */ - TInt ProfileState(); - - /** - * ConnectRSatSession. - * - */ - void ConnectRSatSessionL(); - - /** - * DisconnectRSatSession - * - */ - void DisconnectRSatSession(); - - public: // Functions from base classes - - /** - * From MSatUiObserver Notification of the SAT Display Text command. - * @param aText The text string to be displayed. - * @param aSimApplicationName Sim Application name - * @param aIconId The id of icon. - * @param aRequestedIconDisplayed Informs if icon is not used. - * @param aSustainedText Indicates is this text sustained ie. no timers - * used if ETrue. - * @param aDuration Duration for showing the text - * @param aWaitUserToClear Indication if user is needed to clear - * message - * @return The response to this command. - */ - TSatUiResponse DisplayTextL( const TDesC& aText, - const TDesC& aSimApplicationName, - const TSatIconId& aIconId, - TBool& aRequestedIconDisplayed, - const TBool aSustainedText, - const TTimeIntervalSeconds aDuration, - const TBool aWaitUserToClear ); - - /** - * From MSatUiObserver Notification of the SAT Get Inkey command. - * @param aText The query text. - * @param aCharacterSet The character range allowed. - * @param aInput The input character. - * @param aHelpIsAvailable A flag indicating if SAT help is available - * @param aIconId The id of icon. - * @param aRequestedIconDisplayed Informs if icon is not used. - * @param aDuration Duration for showing the dialog. - * @param aImmediateDigitResponse Indication if Immediate digit response - * is needed. - * @return The response of to this command. - */ - TSatUiResponse GetInkeyL( const TDesC& aText, - const TSatCharacterSet aCharacterSet, TChar& aInput, - const TBool aHelpIsAvailable, - const TSatIconId& aIconId, - TBool& aRequestedIconDisplayed, - TUint& aDuration, - const TBool aImmediateDigitResponse ); - - /** - * From MSatUiObserver Notification of the SAT Get Input command. - * @param aText The query text. - * @param aCharacterSet The character range allowed. - * @param aInput The input string. - * @param aMinLength The minimum length of the input allowed. - * @param aMaxLength The maximum length of the input allowed. - * @param aHideInput A flag indicating if the input should be hidden. - * @param aHelpIsAvailable A flag indicating if SAT help is available. - * @param aIconId The id of icon. - * @param aRequestedIconDisplayed Informs if icon is not used. - * @return The response to this command. - */ - TSatUiResponse GetInputL( const TDesC& aText, - const TSatCharacterSet aCharacterSet, TDes& aInput, - const TInt aMinLength, const TInt aMaxLength, - const TBool aHideInput, - const TBool aHelpIsAvailable, - const TSatIconId& aIconId, - TBool& aRequestedIconDisplayed ); - - /** - * From MSatUiObserver Notification of the SAT Set Up Menu command. - * @param aText The title text. - * @param aMenuItems The array of menu item captions. - * @param aMenuItemNextActions The array of menu item next action - * indicator codes. - * @param aHelpIsAvailable A flag indicating if SAT help is available. - * @param aIconId The id of title icon. - * @param aMenuIcons List of icon identifiers for menu items. - * @param aIconListQualifier Indicates how to use icons in the icon list. - * @param aSelectionPreference Specifies is the soft keys preferred. - * @return The response to this command. - */ - TSatUiResponse SetUpMenuL( const TDesC& aText, - const MDesCArray& aMenuItems, - const CArrayFixFlat* aMenuItemNextActions, - const TBool aHelpIsAvailable, - const TSatIconId& aIconId, - const CArrayFixFlat* aMenuIcons, - const enum TSatIconQualifier aIconListQualifier, - const enum TSatSelectionPreference aSelectionPreference ); - - /** - * From MSatUiObserver Notification of the SAT Select Item command. - * @param aText The title text. - * @param aMenuItems The array of menu item captions. - * @param aMenuItemNextActions The array of menu item next action - * indicator codes. - * @param aDefaultItem The item selected by default. - * @param aSelection The item index selected by the user. - * @param aHelpIsAvailable A flag indicating if help is available. - * @param aIconId The id of title icon. - * @param aMenuIcons List of icon identifiers for menu items. - * @param aIconListQualifier Indicates how to use icons in the icon list. - * @param aRequestedIconDisplayed Informs if icon is not used. - * @param aSelectionPreference Specifies is the soft keys preferred. - * @return The response to this command. - */ - TSatUiResponse SelectItemL( const TDesC& aText, - const MDesCArray& aMenuItems, - const CArrayFixFlat* aMenuItemNextActions, - const TInt aDefaultItem, TUint8& aSelection, - const TBool aHelpIsAvailable, - const TSatIconId& aIconId, - const CArrayFixFlat* aMenuIcons, - const enum TSatIconQualifier aIconListQualifier, - TBool& aRequestedIconDisplayed, - const enum TSatSelectionPreference aSelectionPreference ); - - /** - * From MSatUiObserver Notification of the SAT Play Tone command. - * @param aText The text to be displayed. - * @param aTone The tone to be played. - * @param aDuration The duration of the tone to be played. - * @param aIconId The id of icon. - * @param aRequestedIconDisplayed Informs if icon is not used. - * @return The response to this command. - */ - TSatUiResponse PlayTone( const TDesC& aText, - const TSatTone aTone, - const TTimeIntervalMicroSeconds aDuration, - const TSatIconId& aIconId, - TBool& aRequestedIconDisplayed ); - - /** - * From MSatUiObserver General confirmation request - * @param aCommandId ID of the quering command - * @param aAlphaIdStatus Alpha Identifier status - * @param aText The text to be displayed. - * @param aAdditionalText Additional text to be used in queries. - * @param aActionAccepted Indicates whether the command was accepted. - * @param aIconId The id of icon. - * @param aRequestedIconDisplayed Informs if icon is not used. - * @param aTerminatedByUser Informs if end key is used. - */ - void ConfirmCommand( - const TSatSQueryCommand aCommandId, - const TSatAlphaIdStatus aAlphaIdStatus, - const TDesC& aText, - const TDesC& aAdditionalText, - TBool& aActionAccepted, - const TSatIconId& aIconId, - TBool& aRequestedIconDisplayed, - TBool& aTerminatedByUser ); - - /** - * From MSatUiObserver General notification - * @param aCommandId ID of the notifying command - * @param aAlphaIdStatus Alpha Identifier status - * @param aText Alpha Identifier - * @param aIconId The id of icon. - * @param aRequestedIconDisplayed Informs if icon is not used. - * @param aControlResult Control result of the MoSm and CallControl - * @return The response of the UI to this command. - */ - TSatUiResponse Notification( - const TSatSNotifyCommand aCommandId, - const TSatAlphaIdStatus aAlphaIdStatus, - const TDesC& aText, - const TSatIconId& aIconId, - TBool& aRequestedIconDisplayed, - const TSatControlResult aControlResult ); - - /** - * From MSatUiObserverGeneral event notification. Used for example to - * tell UI that command has completed its execution. - * @param aEventId, identifies the event - * @param aEventStatus, status of the event, used as additional info for - * the event - * @param aError, possible error code that may affect on event handling. - * This is also used as additional info - */ - void EventNotification( - const TSatSEvent aEventId, - const TSatSEventStatus aEventStatus, - const TInt aError ); - - private: - - /** - * C++ default constructor. - */ - CSatUiObserver(); - - /** - * Symbian OS constructor. - */ - void ConstructL(); - - /** - * Fetch icon information. - * @param aIconId Id for icons - * @param aIconCommand Command type for icon. - * @return Pointer to selected FbsBitmap icon - */ - CFbsBitmap* FetchIcon( const TUint8 aIconId, - const enum TIconCommand aIconCommand ); - - /** - * Gets default text's resource id - * @param aCommandId Identifies the command - * @param aControl Used only for MoSm and Call Control - * @return Resource id for the default text - */ - void DefaultAlphaId( - const TSatSNotifyCommand aCommandId, - const TSatControlResult aControlResult, - QString &resource) const; - - /** - * Get size for the icon in popup window. - * @param aSize Reference to the size of icon place. - * @param aIconCommand Dialog information - * @return TBool Returns EFalse if popup window is not supported - * in current layout. - */ - TBool GetPopUpWindowIconSize( TSize& aSize, - const TIconCommand aIconCommand ); - - /** - * Creates scalable bitmap. - * @param aBitMapToConvert Reference icon to be scaled. - * @param aIconCommand Dialog information - */ - void GetScalableBitmapL( CFbsBitmap*& aBitMapToConvert, - const TIconCommand aIconCommand ); - - /** - * Handles scalable bitmap. - * @param aBitMapToConvert Reference icon to be scaled. - * @param aIconCommand Dialog information - * @param aRequestedIconDisplayed Informs if icon is not shown. - */ - void GetScalableBitmap( - CFbsBitmap*& aBitMapToConvert, - const TIconCommand aIconCommand, - TBool& aRequestedIconDisplayed ); - - /** - * Handles scalable bitmap. - * @param aBitMapToConvert Reference icon to be scaled. - * @param aIconCommand Dialog information - */ - void GetScalableBitmap( - CFbsBitmap*& aBitMapToConvert, - const TIconCommand aIconCommand ); - - public: // Data - - //wait scheduler - CActiveSchedulerWait iWait; - - private: // Data - - // play tone sequence - TBuf8 iSequence; - - //Ref: Interface to the UI-part - MSatUiActionImplementer* iActionImplementer; - - // own: used with refresh started and finished - TBool iRefresh; - - // own: session to sat client - RSatUiSession iSat; - - //Ref: Adapter provided by SAT Client - MSatUiAdapter* iAdapter; - - //Own: Session - RSatSession iSatSession; - - //Own: Current Iconididentifier - TInt iIconIdIdentifier; - - // own: used to signal that icons are supported - TBool iIconSupport; - - //Own: used to indicate if ESatSClearScreenEvent occurs - TBool iClearScreenEvent; - - }; - -#endif // CSATUIOBSERVER_H - -// End of File diff -r 1f002146abb4 -r cee7e9e0906c satui/satapp/inc/dialogwaiter.h --- a/satui/satapp/inc/dialogwaiter.h Tue Jul 06 14:53:02 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,62 +0,0 @@ -/* -* Copyright (c) 2009-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" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: dialog waiter -* -* -*/ - -#ifndef DIALOGWAITER_H -#define DIALOGWAITER_H - -// INCLUDES -#include -#include - -// FORWARD DECLARATION -class HbAction; - -/** - * This utility synchronises access to dialogs, popups, menus and - * other ORBIT resources. How to use: - * - * HbDialog* dialog = new HbDialog(); - * DialogWaiter waiter(); - * dialog->open(&waiter, SLOT(done(HbAction*))); - * HbAction* result = waiter.wait(); - * delete dialog; - * if (result==...) ... - * - */ -class DialogWaiter : public QObject -{ - Q_OBJECT - - public: - - /** - * waits until dialog exits - * returns dialog exit action - */ - HbAction* wait(); - - private slots: - void done(HbAction* result); - - private: - QEventLoop mLoop; - HbAction* mResult; - -}; - -#endif // DIALOGWAITER_H diff -r 1f002146abb4 -r cee7e9e0906c satui/satapp/inc/msatuiactionimplementer.h --- a/satui/satapp/inc/msatuiactionimplementer.h Tue Jul 06 14:53:02 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,366 +0,0 @@ -/* -* 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" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -* -*/ - -#ifndef MSATUIACTIONIMPLEMENTER_H -#define MSATUIACTIONIMPLEMENTER_H - -// INCLUDES -#include - -// CLASS DECLARATION -class CCoeEnv; -class CFbsBitmap; - -/** -* This class defines the interface between engine and UI. -*/ -class MSatUiActionImplementer - { - public: - - /** - * Returns CoeEnv. - */ - virtual CCoeEnv* CoeEnv() = 0; - - /** - * Shows the wait note. - */ - virtual void ShowWaitNoteL() = 0; - - /** - * Shows the wait note without delay - */ - virtual void ShowWaitNoteWithoutDelayL() = 0; - - /** - * Removes the wait note from the screen. - */ - virtual void StopShowWaitNote() = 0; - - /** - * Handles the DisplayText operation. - * @param aText Text to be shown. - * @param aSimApplicationName Sim Application name - * @param aIconBitmapDisplayText Icon for dialog - * @param aSustainedText Indicates is this text sustained ie. no timers - * used if ETrue. - * @param aDuration Duration for showing the text - * @param aWaitUserToClear Indication if user is needed to clear - * message - * @return Information of the operation result. - */ - virtual TSatUiResponse DisplayTextL( const TDesC& aText, - const TDesC& aSimApplicationName, - CFbsBitmap* aIconBitmapDisplayText, - const TBool aSelfExplanatoryIcon, - const TBool aSustainedText, - const TTimeIntervalSeconds aDuration, - const TBool aWaitUserToClear ) = 0; - - /** - * Removes Display Text Dialog from the screen. - */ - virtual void ClearScreen() = 0; - - /** - * Asks a Yes/No answer from the user. - * @param aText A question to be shown. - * @param aCharacterSet The character range allowed. - * @param aInkey Character user feeds. - * @param aIconBitmap Icon for query dialog. - * @param aSelfExplanatory Flag indicating if icon is self-explanatory. - * @param aDuration Duration for showing the dialog. - * @param aImmediateDigitResponse Indication if Immediate digit response - * is needed. - * @return Information of the operation result. - */ - virtual TSatUiResponse GetYesNoL( const TDesC& aText, - const TSatCharacterSet aCharacterSet, - TChar& aInkey, - const CFbsBitmap* aIconBitmap, - const TBool aSelfExplanatory, - TUint& aDuration, - const TBool aImmediateDigitResponse ) = 0; - - /** - * Asks input from the user. - * @param aText A question to be shown. - * @param aCharacterSet The character range allowed. - * @param aInput The input string. - * @param aMinLength The minimum length of the input allowed. - * @param aMaxLength The maximum length of the input allowed. - * @param aHideInput A flag indicating if the input should be hidden. - * @param aGetInkey A flag indicating if GetInkey command is used. - * @param aIconBitmapGetInput Icon for query dialog. - * @param aSelfExplanatory A flag indicating if icon is self-explanatory. - * @param aDuration Duration for showing the dialog. - * @return Information of the operation result. - */ - virtual TSatUiResponse GetInputL( const TDesC& aText, - const TSatCharacterSet aCharacterSet, TDes& aInput, - const TInt aMinLength, const TInt aMaxLength, - const TBool aHideInput, const TBool aGetInkey, - const CFbsBitmap* aIconBitmapGetInput, - const TBool aSelfExplanatory, - TUint& aDuration ) = 0; - - /** - * Handles the SetUpMenu view. - * @param aText The title text. - * @param aMenuItems The array of menu item captions. - * @param aMenuItemNextActions The array of menu item next action - * indicator captions. - * @param aIconBitmap The Context pane icon. - * @param aItemsIconArray Array of item icons - * @param aSelfExplanatoryItems Flag indicating if only icons are shown. - * @param aHelpIsAvailable A flag indicating if SAT help is available. - * @return Information of the operation result. - */ - virtual TSatUiResponse SetUpMenuL( const TDesC& aText, - const MDesCArray& aMenuItems, - const CArrayFixFlat* aMenuItemNextActions, - const CFbsBitmap* aIconBitmap, - //const CAknIconArray* aItemIconsArray, - const TBool aSelfExplanatoryItems, - const TBool aHelpIsAvailable ) = 0; - - /** - * Handles the SelectItem view. - * @param aText The title text. - * @param aMenuItems The array of menu items. - * @param aMenuItemNextActions The array of next action indicators. - * @param aDefaultItem The item in focus. - * @param aSelection The item index selected by the user. - * @param aIconBitmap The Context Pane icon. - * @param aItemsIconArray Array of item icons - * @param aSelfExplanatoryItems Flag indicating if only icons are shown. - * @param aHelpIsAvailable A flag indicating if SAT help is available. - * @return Information of the operation result. - */ - virtual TSatUiResponse SelectItemL( const TDesC& aText, - const MDesCArray& aMenuItems, - const CArrayFixFlat* aMenuItemNextActions, - const TInt aDefaultItem, - TUint8& aSelection, - const CFbsBitmap* aIconBitmap, - //const CAknIconArray* aItemsIconArray, - const TBool aSelfExplanatoryItems, - const TBool aHelpIsAvailable ) = 0; - - /** - * Handles Standard Tone playing. - * @param aText The text to be displayed. - * @param aFileName The name of the file corresponding to the tone. - * @param aDuration The duration of the tone to be played. - * @param aIconBitmap The tone playing note icon - * @param aSelfExplanatory Flag indicating if icon is self-explanatory. - * @return Information of the operation result. - */ - virtual TSatUiResponse PlayStandardToneL( const TDesC& aText, - const TDesC8& aSequence, - TTimeIntervalMicroSeconds aDuration, - const CFbsBitmap* aIconBitmap, - const TBool aSelfExplanatory ) = 0; - - /** - * Shows the confirmation note about the SAT Send SMS, Send SS or - * Send USSD command. - * @param aText The text to be displayed. - * @param aActionAccepted Indicates whether the command was accepted. - * @param aType Type of the request (SMS, SS, USSD). - * @return Information of the operation result. - */ - virtual TSatUiResponse ConfirmSendL( const TDesC& aText, - TBool& aActionAccepted, TInt aType ) = 0; - - /** - * Shows the wait note about the Send SMS command. - * @param aText The text to be displayed. - * @param aIconBitmapSendSM Sending dialog icon. - * @param aSelfExplanatoryIcon A flag indicating if only icon is shown. - */ - virtual void ShowSmsWaitNoteL( const TDesC& aText, - const CFbsBitmap* aIconBitmapSendSM, - const TBool aSelfExplanatoryIcon ) = 0; - - /** - * Shows the wait note about the Send SS command. - * @param aText The text to be displayed. - * @param aIconBitmap Sending dialog icon. - * @param aSelfExplanatoryIcon A flag indicating if only icon is shown. - */ - virtual void ShowSsWaitNoteL( const TDesC& aText, - const CFbsBitmap* aIconBitmap, - const TBool aSelfExplanatoryIcon ) = 0; - - /** - * Shows the confirmation note about the SAT Refresh command. - * @param aActionAccepted Indicates whether the command was accepted. - * @return Information of the operation result. - */ - virtual TSatUiResponse ConfirmRefreshL( - TBool& aActionAccepted) = 0; - - /** - * Notification of the SAT Call Control command. - * @param aText The text string to be displayed. - * @param aAlphaIdStatus Alpha Identifier status - * @param aControlResult Call control general result - * @return The response from the UI - */ - virtual TSatUiResponse CallControlL( - const TDesC& aText, - const TSatAlphaIdStatus aAlphaIdStatus ) = 0; - - /** - * Notification of the SAT Launch browser confirmation request - * @param aText The text to be displayed. - * @param aActionAccepted Indicates whether the command was accepted. - * @param aIconBitmap The confirm note icon - * @param aSelfExplanatory Flag indicating if icon is self-explanatory. - */ - virtual void ConfirmLaunchBrowserL( - const TDesC& aText, - TBool& aActionAccepted, - const CFbsBitmap* aIconBitmap, - const TBool aSelfExplanatory ) = 0; - - /** - * Notification of the SAT Mo Sm Control command. - * @param aText The text string to be displayed. - * @param aAlphaIdStatus Alpha Identifier status - * @param aControlResult Mo Sm control general result - * @return The response from the UI - */ - virtual TSatUiResponse MoSmControlL( - const TDesC& aText, - const TSatAlphaIdStatus aAlphaIdStatus ) = 0; - - /** - * Shows the wait note while DTMF are being sent. - * @param aText The text to be displayed. - * @param aIconBitmap The confirm note icon - * @param aSelfExplanatory Flag indicating if icon is self-explanatory. - * @return Information on the operation result. - */ - virtual TSatUiResponse ShowDtmfWaitNoteL( const TDesC& aText, - const CFbsBitmap* aIconBitmap, - const TBool aSelfExplanatoryIcon ) = 0; - - /** Dispatch iWait to action implementer. - * @param aWait Timer. - */ - virtual void DispatchTimer( CActiveSchedulerWait& aWait ) = 0; - - /** - * Get flag which is indicating if end key is pressed. - * @return A Boolean flag which is indicating if end key is pressed. - */ - virtual TBool GetEndKey() = 0; - - /** - * Set a flag which is indicating if end key is pressed. - * @param aValue Status of end key - */ - virtual void SetEndKey( TBool aValue ) = 0; - - /** - * Set a flag which is indicating if proactive command is pending. - * @param aValue Status of proactive command - */ - virtual void SetCommandPending( TBool aValue ) = 0; - - /** - * Plays user selected tone. - * @param aText The text to be displayed. - * @param aDuration Play duration. - * @param aTone Tone to be played. - * @param aIconBitmap The tone playing note icon - * @param aSelfExplanatory Flag indicating if icon is self-explanatory. - * @return Information on the operation result. - */ - virtual TSatUiResponse PlayUserSelectedToneL( - const TDesC& aText, - TTimeIntervalMicroSeconds aDuration, - TSatTone aTone, - const CFbsBitmap* aIconBitmap, - const TBool aSelfExplanatory ) = 0; - - /** - * Confirm user permission for Open Channel. - * @param aText The text to be displayed. - * @param aActionAccepted Indicates whether the command was accepted. - * @param aIconBitmapOpenChannel Icon for query dialog - * @param aSelfExplanatory A flag indicating if icon is self-explanatory - * @return Operation result - */ - virtual TSatUiResponse ConfirmOpenChannelL( - const TDesC& aText, - TBool& aActionAccepted, - const CFbsBitmap* aIconBitmapOpenChannel, - const TBool aSelfExplanatory ) = 0; - - /** - * Shows the wait note while BIP packets are sent. - * @param aCommand Command type. - * @param aText The text to be displayed. - * @param aIconBitmap Icon for query dialog - * @param aSelfExplanatory A flag indicating if icon is self-explanatory - */ - virtual void ShowBIPNoteL( - TInt aCommand, - const TDesC& aText, - const CFbsBitmap* aIconBitmap, - const TBool aSelfExplanatory ) = 0; - - /** - * Confirm user permission for SetUpCall - * @param aText The text to be displayed. - * @param aSimAppName Header for th equery - * @param aActionAccepted Indicates whether the command was accepted. - * @param aIconBitmap Icon for query dialog - * @param aSelfExplanatory A flag indicating if icon is self-explanatory - */ - virtual void ConfirmSetUpCallL( - const TDesC& aText, - const TDesC& aSimAppName, - TBool& aActionAccepted, - const CFbsBitmap* aIconBitmap, - const TBool aSelfExplanatory ) = 0; - - /** - * Show note indicating SAT is not available. - */ - virtual void ShowNotAvailableNoteL() = 0; - - /** - * Show the Ss error note. - */ - virtual void ShowSsErrorNoteL() = 0; - - /** - * Start SatUi closing process. - */ - virtual void CloseSatUI() = 0; - - }; - -#endif // MSATUIACTIONIMPLEMENTER_H - -// End of File diff -r 1f002146abb4 -r cee7e9e0906c satui/satapp/inc/satappaction.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/satui/satapp/inc/satappaction.h Wed Aug 18 10:19:22 2010 +0300 @@ -0,0 +1,108 @@ +/* +* Copyright (c) 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" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +* +*/ + +#ifndef SATAPPACTION_H +#define SATAPPACTION_H + +#include +#include +#include +#include +#include // for symbian-to-qt conversions +#include "MSatUiObserver.h" // for the param type definitions +#include "satappconstant.h" + +// class declaration +class SatAppAction : public QObject +{ + Q_OBJECT + +public: + /** creates an action with given identity (TSatAction) */ + SatAppAction(int action, QObject *parent = 0); + ~SatAppAction(); + + /** synchronous wait until the action has been completed */ + void waitUntilCompleted(); + /** completes the action with guiven response */ + void complete(TSatUiResponse resp); + +public slots: + + /** completes the action */ + void complete() {complete(response());} + + // comfy methods for completing with certain response + void completeWithSuccess() {complete(ESatSuccess);} + void completeWithFailure() {complete(ESatFailure);} + void completeWithNoResponse() {complete(ESatNoResponseFromUser);} + void completeWithBackRequested() {complete(ESatBackwardModeRequestedByUser);} + void completeWithSessionTerminated() {complete(ESatSessionTerminatedByUser);} + +signals: + + /** signalled when the action has been completed */ + void actionCompleted(SatAppAction *action); + +public: // param access + + /** returns the identity of the action (TSatAction) */ + int action() {return mAction;} + + /** sets the action response */ + void setResponse(TSatUiResponse resp) {mResponse=resp;} + /** the action response (TSatUiResponse) */ + TSatUiResponse response() {return mResponse;} + + /** sets a value (arbitary type) */ + void set(const QString& key, QVariant value); + + /** sets QString value after doing symbian-to-qt conversion */ + void set(const QString& key, const TDesC& value); + /** sets QStringList value after doing symbian-to-qt conversion */ + void set(const QString& key, const MDesCArray& value); + /** sets QList value after doing symbian-to-qt conversion */ + void set(const QString& key, CArrayFixFlat& value); + /** sets int(millisec) value after doing symbian-to-qt conversion */ + void set(const QString& key, TTimeIntervalSeconds& value); + /** sets int(millisec) value after doing symbian-to-qt conversion */ + void set(const QString& key, TTimeIntervalMicroSeconds& value); + + /** returns a value (arbitary type) */ + QVariant value(const QString &key); + /** whether a value is present */ + bool hasValue(const QString &key); + +private: // data + + // identity of this action + int mAction; + + // response + TSatUiResponse mResponse; + + // parameter map + QMap mParams; + + // internal action state + enum State {Active,Waiting,Completed}; + State mState; +}; + +#endif // SATAPPACTION_H + diff -r 1f002146abb4 -r cee7e9e0906c satui/satapp/inc/satappcommandhandler.h --- a/satui/satapp/inc/satappcommandhandler.h Tue Jul 06 14:53:02 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,281 +0,0 @@ -/* -* Copyright (c) 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" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -#ifndef SATAPPCOMMANDHANDLER_H -#define SATAPPCOMMANDHANDLER_H - -#include -#include - -class SatAppUiProvider; - -class SatAppCommandHandler : public QObject - { - Q_OBJECT -public: - SatAppCommandHandler(SatAppUiProvider &ui, QObject *parent = 0); - virtual ~SatAppCommandHandler(); - -private slots: - - /** - * Handles the SetUpMenu command. - * @param aRes the out parameter. the result of the command. - * @param aText The title text. - * @param aMenuItems The array of menu item captions. - * @param aMenuItemNextActions The array of menu item next action - * indicator captions. - * @param aIconBitmap The Context pane icon. - * @param aItemsIconArray Array of item icons - * @param aSelfExplanatoryItems Flag indicating if only icons are shown. - * @param aHelpIsAvailable A flag indicating if SAT help is available. - */ - void setUpMenu( - TSatUiResponse &aRes, - const QString &aText, - const QStringList &aMenuItems, - //const CArrayFixFlat* aMenuItemNextActions, - //const HbIcon &aIcon, - //const CAknIconArray* aItemIconsArray, - const bool aSelfExplanatoryItems, - const bool aHelpIsAvailable); - - /** - * Handles the SelectItem view. - * @param aRes the out parameter. the result of the command. - * @param aText The title text. - * @param aMenuItems The array of menu items. - * @param aMenuItemNextActions The array of next action indicators. - * @param aDefaultItem The item in focus. - * @param aSelection The item index selected by the user. - * @param aIconBitmap The Context Pane icon. - * @param aItemsIconArray Array of item icons - * @param aSelfExplanatoryItems Flag indicating if only icons are shown. - * @param aHelpIsAvailable A flag indicating if SAT help is available. - * @return Information of the operation result. - */ - void selectItem( - TSatUiResponse &aRes, - const QString &aText, - const QStringList &aMenuItems, - //const CArrayFixFlat* aMenuItemNextActions, - const int aDefaultItem, - unsigned char &aSelection, - //const HbIcon &aIcon, - //const CAknIconArray* aItemsIconArray, - const bool aSelfExplanatoryItems, - const bool aHelpIsAvailable); - - /** - * Notification of the SAT Display Text command. - * @param aRes, the User's response. - * @param aText The text string to be displayed. - * @param aSimApplicationName Sim Application name - * @param aIcon the icon to show. - * @param aRequestedIconDisplayed Informs if icon is not used. - * @param aSustainedText Indicates is this text sustained ie. no timers - * used if ETrue. - * @param aDuration Duration for showing the text - * @param aWaitUserToClear Indication if user is needed to clear - * message - * @return The response of the UI to this command. - */ - void displayText( - TSatUiResponse &aRes, - const QString &aText, - const QString &aSimApplicationName, -// const HbIcon &aIcon, - bool &aRequestedIconDisplayed, - const bool aSustainedText, - const int aDuration, - const bool aWaitUserToClear); - - /** - * Notification of the SAT Get Input command. - * @param aRes, the User's response. - * @param aText The text string to be displayed. - * @param aSimApplicationName Sim Application name - * @param aIcon the icon to show. - * @param aRequestedIconDisplayed Informs if icon is not used. - * @param aSustainedText Indicates is this text sustained ie. no timers - * used if ETrue. - * @param aDuration Duration for showing the text - * @param aWaitUserToClear Indication if user is needed to clear - * message - * @return The response of the UI to this command. - */ - void getInkey( - TSatUiResponse &aRes, - const QString &aTitleText, - const TSatCharacterSet aCharacterSet, - QString &aInputText, - //const QPixmap* /*aIconBitmapGetInput*/, - const bool aSelfExplanatory, - unsigned int &aDuration); - - /** - * Notification of the SAT Get YesNo command. - * @param aText The query text. - * @param aCharacterSet The character range allowed. - * @param aInput The input character. - * @param aHelpIsAvailable indicates if help can be requested. - * @param aIconId The id of icon. - * @param aRequestedIconDisplayed Informs if icon is not used. - * @param aDuration Duration for showing the dialog. - * @param aImmediateDigitResponse Indication if Immediate digit response - * is needed. - * @return The response of the UI to this command. - */ - void getYesNo( - TSatUiResponse &aRes, - const QString &aText, - const TSatCharacterSet aCharacterSet, - unsigned int &aInkey, - //const TSatIconId &aIconId, - const bool &aSelfExplanatory, - unsigned int &aDuration, - const bool aImmediateDigitResponse); - - /** - * Notification of the SAT Get Input command. - * @param aRes, the User's response. - * @param aText The text string to be displayed. - * @param aSimApplicationName Sim Application name - * @param aIcon the icon to show. - * @param aRequestedIconDisplayed Informs if icon is not used. - * @param aSustainedText Indicates is this text sustained ie. no timers - * used if ETrue. - * @param aDuration Duration for showing the text - * @param aWaitUserToClear Indication if user is needed to clear - * message - * @return The response of the UI to this command. - */ - void getInput( - TSatUiResponse &aRes, - const QString &aTitleText, - const TSatCharacterSet aCharacterSet, - QString &aInputText, - const int aMinLength, - const int aMaxLength, - const bool aHideInput, - //const QPixmap* /*aIconBitmapGetInput*/, - const bool aSelfExplanatory, - unsigned int &aDuration); - - /** - * Notification of the SAT Call Control command. - * @param aText The text string to be displayed. - * @param aAlphaIdStatus alpha ID's status - */ - void callControl( - const QString &aText, - const TSatAlphaIdStatus aAlphaIdStatus); - - /** - * Notification of the SAT Mo Sms Control command. - * @param aText The text string to be displayed. - * @param aAlphaIdStatus alpha ID's status - */ - void moSmControl( - const QString &aText, - const TSatAlphaIdStatus aAlphaIdStatus); - - /** - * Shows the confirmation note about the SAT Send SMS, Send SS or - * Send USSD command. - * @param aText The text to be displayed. - * @param aActionAccepted Indicates whether the command was accepted. - * @param aType Type of the request (SMS, SS, USSD). - * @return Information of the operation result. - */ - void confirmSend( - TSatUiResponse &aRes, - const QString &aText, - bool &aActionAccepted, - int aType); - - /** - * Shows the wait note about the Send SMS command. - * @param aText The text to be displayed. - * @param aIconBitmapSendSM Sending dialog icon. - * @param aSelfExplanatoryIcon A flag indicating if only icon is shown. - */ - void showSmsWaitNote( - const QString &aText, - //const CFbsBitmap* aIconBitmapSendSM, - const bool aSelfExplanatoryIcon - ); - - /** - * Shows the wait note about the Send DTMF command. - * @param aText The text to be displayed. - * @param aIconBitmapSendDtmf Sending dialog icon. - * @param aSelfExplanatoryIcon A flag indicating if only icon is shown. - */ - void showDtmfWaitNote( - TSatUiResponse &aRes, - const QString &aText - ); - - /*! - Stop wait note - */ - void stopShowWaitNote(); - - /** - * Shows the confirmation not about SetUpCall. - * @param aText The text to be displayed. - * @param aSimAppName The header to be displayed. - * @param aActionAccepted Indicates whether the command was accepted. - */ - void confirmSetUpCall( - const QString &aText, - const QString &aSimAppName, - bool &aActionAccepted//, - //const CFbsBitmap* aIconBitmap, - //const TBool aSelfExplanatory - ); - - /** - * Shows the wait note about the Send Ss or Ussd command. - * @param aText The text to be displayed. - * @param aIconBitmapSendSM Sending dialog icon. - * @param aSelfExplanatoryIcon A flag indicating if only icon is shown. - */ - void showSsWaitNote( - const QString &aText, - //const CFbsBitmap* aIconBitmapSendSM, - const bool aSelfExplanatoryIcon - ); - - /** - * Shows the wait note about BIP - * @param aCommand command type. - * @param aText The text to be displayed. - */ - void showBIPWaitNote(int aCommand, const QString &aText); - - -private: - /** - * Not own. - */ - SatAppUiProvider &mUi; - -}; - -#endif /* SATAPPCOMMANDHANDLER_H */ diff -r 1f002146abb4 -r cee7e9e0906c satui/satapp/inc/satappcommonconstant.h --- a/satui/satapp/inc/satappcommonconstant.h Tue Jul 06 14:53:02 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,82 +0,0 @@ -/* -* Copyright (c) 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" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -#ifndef SATAPPCOMMONCONSTANT_H -#define SATAPPCOMMONCONSTANT_H - -// CONSTANTS - -const int KDisplayTxtUserClearTimeout( 60000 ); -// As the QT for S60 is slow, we use 6 sec, in symbian sat ui we use 3 sec. -// Rollback to 3s -const int KDisplayTxtDefaultduration( 3000 ); - -const unsigned int KGetInputStringMaxSize = 0xEF; - -const int KExtendTimeoutMseconds(3000); -// 1 minute -const int KDefaultSelectionTimeoutMseconds(60000); -const int KSymbianTimeConvertQtTime(100); -const int KMoSmControlTimeOut(3000); -const int KPlayToneSymbianConvertQtTime(1000); - -//enum for SendSms -/**Sat send sms user response*/ -enum TSatAppConfirmType - { - ESatUiConfirmSendSms = 1, - ESatUiConfirmSendSs, - ESatUiConfirmSendUssd - }; - -enum TSatAppUserResponse -{ - /** - * default, user no response - */ - EUserNoResponse = 0, - /** - * OK, user response - */ - EUserPrimaryResponse, - /** - * Back, user response - */ - EUserSecondaryResponse, - /** - * requested to clear by the server - */ - EUserClearResponse, - /** - * requested to close application by the server - */ - EUserCloseResponse -}; - -enum TSatAppDialogActionType - { - ESatDialogDisplayText = 0, // Ok Back - ESatDialogGetInput, // Cancel ->Ok Cancel - ESatDialogGetInkey, // Cancel ->Ok Cancel - ESatDialogGetYesNo, // Yes No - ESatDialogGetDigitalRsp, // Cancel - ESatDialogSetUpCall, // Call Cancel - ESatDialogConfirmSend, // Yes No - ESatDialogConfirmBip // Ok Cancel - }; - -#endif diff -r 1f002146abb4 -r cee7e9e0906c satui/satapp/inc/satappconfirmprovider.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/satui/satapp/inc/satappconfirmprovider.h Wed Aug 18 10:19:22 2010 +0300 @@ -0,0 +1,72 @@ +/* +* Copyright (c) 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" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Provides SAT user confim notes +* +*/ + +#ifndef SATAPPCONFIRMPROVIDER_H +#define SATAPPCONFIRMPROVIDER_H + +// includes +#include + +// forward declarations +class HbMessageBox; +class SatAppAction; + +class SatAppConfirmProvider : public QObject +{ + Q_OBJECT + +public: + /** Constructor */ + SatAppConfirmProvider(QObject *parent = 0); + + /** Destructor */ + virtual ~SatAppConfirmProvider(); + +public slots: + + /** + * General confirmation request + * @param userAccepted Indicates whether the command was accepted. + */ + void confirmCommand(SatAppAction &action); + + /** clear the current dialog in screen */ + void clearScreen(); + + /** reset some data members */ + void resetState(); + +private: + + /** Shows the confirm note about Open Channel */ + void showOpenChannelConfirm(SatAppAction &action); + + /** Shows the confirmation not about SetUpCall*/ + void showSetUpCallConfirm(SatAppAction &action); + +private: + + /** Own.*/ + HbMessageBox *mConfirmQuery; + + SatAppAction *mAction; + + /** For unit testing.*/ + friend class ConfirmProviderTest; +}; + +#endif /* SATAPPCONFIRMPROVIDER_H */ diff -r 1f002146abb4 -r cee7e9e0906c satui/satapp/inc/satappconstant.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/satui/satapp/inc/satappconstant.h Wed Aug 18 10:19:22 2010 +0300 @@ -0,0 +1,157 @@ +/* +* Copyright (c) 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" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +#ifndef SATAPPCONSTANT_H +#define SATAPPCONSTANT_H + +#ifdef _UDEB +#define SAT_ASSERT Q_ASSERT +#else +#define SAT_ASSERT(cond) cond +#endif + +// CONSTANTS + +const int KDisplayTxtUserClearTimeout( 60000 ); +// As the QT for S60 is slow, we use 6 sec, in symbian sat ui we use 3 sec. +// Rollback to 3s +const int KDisplayTxtDefaultduration( 3000 ); + +const unsigned int KGetInputStringMaxSize = 0xEF; + +const int KExtendTimeoutMseconds(3000); +// 1 minute +const int KDefaultSelectionTimeoutMseconds(60000); +const int KSymbianTimeConvertQtTime(100); +const int KMoSmControlTimeOut(3000); +const int KPlayToneSymbianConvertQtTime(1000); + +// extensions to ConfirmAction +const int ESatConfirmAction = 0x35; +// extensions to TSatAction +const int ESatNotifyAction = 0x1001; + +// SatAppAction +// parameter keys +const QString KeyText="text"; // QString +const QString KeyMenu="menu"; // QList +const QString KeyDefault="default"; // int - default selected item index +const QString KeySelection="selection"; // int - real selected index +const QString KeyCharacterSet="charset"; // int(TSatCharacterSet) +const QString KeyInKey="inkey"; // int(char pressed) +const QString KeyDuration="duration"; // int(milliseconds) +const QString KeyImmediate="immediate"; // bool - immediate response +const QString KeyInputString="input"; // QString - user input string +const QString KeyMinLength="min"; // int +const QString KeyMaxLength="max"; // int +const QString KeyHideInput="hide"; // bool - password mode +const QString KeyToneId="tone"; // int(TSatTone) +const QString KeySustainedText="sustained"; // bool - sustained text +const QString KeyWaitUserToClear="waitusertoclear"; // bool +const QString KeyHelpRequested="helprequested"; // bool +const QString KeyApplicationName="applicationname"; // QString - app.name +const QString KeyCommandId="commandid"; // int(TSatSNotifyCommand) +const QString KeyControlResult="controlresult"; // int(TSatControlResult) +const QString KeyAlphaIdStatus="alphaidstatus"; // int(TSatAlphaIdStatus) +const QString KeyAdditionalText="additionaltext"; //QString - aAdditionalText +const QString KeyQueryCommandId="querycommandid";//int(TSatSQueryCommand) +const QString KeyActionAccepted="actionaccepted";//bool + +const QString KeyselfExp="sekfexp";//bool + +// icon identifiers +const QString KeyIconId="iconid"; // int - icon id +const QString KeyIconIdArray="iconidarray"; // QList (icon id) +const QString KeyIconQualifier="iconqualifier"; // int (TSatIconQualifier) + +// icons +const QString KeyIcon="icon"; // HbIcon +const QString KeyIconArray="icons"; // QList + +const TInt KSatActiveProfileOffline = 5; // value from ProfileEngine + +/** + * Play Tone Constants + */ +// Tone Sequence +const char KNetToneSeqNetBusy[] = "\x00\x11\x05\x4E\x30\x40\x30\x07\x0B"; +const char KNetToneSeqNetCallWaiting[] = "\x00\x11\x05\x4E\x14\x40\x3C\x4E\x14" +"\x40\x64\x40\x64\x40\x64\x4E\x14\x40\x3C\x4E\x14\x40\x64\x40\x64\x40\x64" +"\x07\x0B"; +const char KNetToneSeqNetCongestion[] = "\x00\x11\x05\x4E\x14\x40\x14\x07\x0B"; +const char KNetToneSeqNetSpecialInformation[] = "\x00\x11\x05\x4F\x21\x50" +"\x21\x51\x21\x40\x64\x07\x0B"; +const char KNetToneSeqDial[] = "\x00\x11\x05\x4E\xFE\x4E\xFE\x4E\xFE\x4E\xFE\x4E\xFE" +"\x4E\xFE\x4E\xFE\x4E\xFE\x07\x0B"; +const char KNetToneSeqRingGoing[] = "\x00\x11\x05\x4E\x64\x05\x04\x40\x64\06\x07\x0B"; +const char KGeneralBeep[] = "\x00\x11\x0A\x76\x00\x0B"; +const char KErrorTone[] = "\x00\x11\x0A\x6C\x19\x0B"; +const char KRadioPathNotAvailable[] = "\x00\x11\x0A\x05\x03\x4E\x14\x40\x14\x06\x0B"; +const char KRadioPathAck[] = "\x00\x11\x0A\x02\xFC\x0A\x80\x4E\x14\x0A\x7f\x0B"; + +// PlayTone durations +const int KSatDur170ms = 170; // 170ms +const int KSatDur200ms = 200; // 200ms +const int KSatDur250ms = 250; // 250ms +const int KSatDur1200ms = 1200; // 1200ms + +//enum for SendSms +/**Sat send sms user response*/ +enum TSatAppConfirmType + { + ESatUiConfirmSendSms = 1, + ESatUiConfirmSendSs, + ESatUiConfirmSendUssd + }; + +enum TSatAppUserResponse +{ + /** + * default, user no response + */ + EUserNoResponse = 0, + /** + * OK, user response + */ + EUserPrimaryResponse, + /** + * Back, user response + */ + EUserSecondaryResponse, + /** + * requested to clear by the server + */ + EUserClearResponse, + /** + * requested to close application by the server + */ + EUserCloseResponse +}; + +enum TSatAppDialogActionType + { + ESatDialogDisplayText = 0, // Ok Back + ESatDialogGetInput, // Cancel ->Ok Cancel + ESatDialogGetInkey, // Cancel ->Ok Cancel + ESatDialogGetYesNo, // Yes No + ESatDialogGetDigitalRsp, // Cancel + ESatDialogSetUpCall, // Call Cancel + ESatDialogConfirmSend, // Yes No + ESatDialogConfirmBip // Ok Cancel + }; + +#endif diff -r 1f002146abb4 -r cee7e9e0906c satui/satapp/inc/satappeventprovider.h --- a/satui/satapp/inc/satappeventprovider.h Tue Jul 06 14:53:02 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,675 +0,0 @@ -/* -* Copyright (c) 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" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -#ifndef SATAPPEVENTPROVIDER_H -#define SATAPPEVENTPROVIDER_H - -#include -#include -#include "msatuiactionimplementer.h" - -class CSatUiObserver; -class SatAppPlayToneProvider; - - -class SatAppEventProvider: public QObject, - public MSatUiActionImplementer -{ - Q_OBJECT - -public: - - /** - * Constructor - */ - SatAppEventProvider(QObject *parent = 0); - - /** - * Distructor - */ - virtual ~SatAppEventProvider(); - -signals: - /** - * Notification of the SAT Display Text command. - * @param aRes, the User's response. - * @param aText The text string to be displayed. - * @param aSimApplicationName Sim Application name - * @param aIcon the icon to show. - * @param aRequestedIconDisplayed Informs if icon is not used. - * @param aSustainedText Indicates is this text sustained ie. no timers - * used if true. - * @param aDuration Duration for showing the text - * @param aWaitUserToClear Indication if user is needed to clear - * message - */ - void displayTextEvent( - TSatUiResponse &aRes, - const QString &aText, - const QString &aSimApplicationName, - bool &aRequestedIconDisplayed, - const bool aSustainedText, - const int aDuration, - const bool aWaitUserToClear); - - /** - * Notification of the SAT Get Input command. - * @param aText The query text. - * @param aCharacterSet The character range allowed. - * @param aInput The input string. - * @param aMaxLength The maximum length of the input allowed. - * @param aMinLength The minimum length of the input allowed. - * @param aHideInput A flag indicating if the input should be hidden. - * @param aHelpIsAvailable indicates if help can be requested. - * @param aIconId The id of icon. - * @param aRequestedIconDisplayed Informs if icon is not used. - * @return The response of the UI to this command. - */ - void getInputEvent( - TSatUiResponse &aRes, - const QString &aTitleText, - const TSatCharacterSet aCharacterSet, - QString &aInputText, - const int aMinLength, - const int aMaxLength, - const bool aHideInput, - const bool aSelfExplanatory, - unsigned int &aDuration); - - /** - * Notification of the SAT Get Inkey command. - * @param aText The query text. - * @param aCharacterSet The character range allowed. - * @param aInput The input string. - * @param aHideInput A flag indicating if the input should be hidden. - * @param aHelpIsAvailable indicates if help can be requested. - * @param aIconId The id of icon. - * @param aRequestedIconDisplayed Informs if icon is not used. - */ - void getInkeyEvent( - TSatUiResponse &aRes, - const QString &aTitleText, - const TSatCharacterSet aCharacterSet, - QString &aInputText, - const bool aSelfExplanatory, - unsigned int &aDuration); - - /** - * Notification of the SAT Get YesNo command. - * @param aText The query text. - * @param aCharacterSet The character range allowed. - * @param aInput The input character. - * @param aHelpIsAvailable indicates if help can be requested. - * @param aIconId The id of icon. - * @param aRequestedIconDisplayed Informs if icon is not used. - * @param aDuration Duration for showing the dialog. - * @param aImmediateDigitResponse Indication if Immediate digit response - * is needed. - * @return The response of the UI to this command. - */ - void getYesNoEvent( - TSatUiResponse &aRes, - const QString &aText, - const TSatCharacterSet aCharacterSet, - unsigned int &aInkey, - //const TSatIconId &aIconId, - const bool &aSelfExplanatory, - unsigned int &aDuration, - const bool aImmediateDigitResponse); - - /** - * Notification of the SAT Call Control command. - * @param aRes The response. - * @param aText The heading. - * @param aAlphaIdStatus The alpha ID status. - * - */ - void callControlEvent( - const QString &aText, - const TSatAlphaIdStatus aAlphaIdStatus); - - /** - * Notification of the SAT Call Control command. - * @param aRes The response. - * @param aText The heading. - * @param aAlphaIdStatus The alpha ID status. - * - */ - void moSmControlEvent( - const QString &aText, - const TSatAlphaIdStatus aAlphaIdStatus); - - /** - * Handles the SetUpMenu command. - * @param aRes the out parameter. the result of the command. - * @param aText The title text. - * @param aMenuItems The array of menu item captions. - * @param aMenuItemNextActions The array of menu item next action - * indicator captions. - * @param aIconBitmap The Context pane icon. - * @param aItemsIconArray Array of item icons - * @param aSelfExplanatoryItems A flag indicating if only icons are shown. - * @param aHelpIsAvailable A flag indicating if SAT help is available. - */ - void setUpMenuEvent( - TSatUiResponse &aRes, - const QString &aText, - const QStringList &aMenuItems, - const bool aSelfExplanatoryItems, - const bool aHelpIsAvailable); - - /** - * Handles the SelectItem view. - * @param aRes the out parameter. the result of the command. - * @param aText The title text. - * @param aMenuItems The array of menu items. - * @param aMenuItemNextActions The array of next action indicators. - * @param aDefaultItem The item in focus. - * @param aSelection The item index selected by the user. - * @param aIconBitmap The Context Pane icon. - * @param aItemsIconArray Array of item icons - * @param aSelfExplanatoryItems Flag indicating if only icons are shown. - * @param aHelpIsAvailable A flag indicating if SAT help is available. - * @return Information of the operation result. - */ - void selectItemEvent( - TSatUiResponse &aRes, - const QString &aText, - const QStringList &aMenuItems, - const int aDefaultItem, - unsigned char &aSelection, - const bool aSelfExplanatoryItems, - const bool aHelpIsAvailable); - - /** - * Shows the confirmation note about the SAT Send SMS, Send SS or - * Send USSD command. - * @param aText The text to be displayed. - * @param aActionAccepted Indicates whether the command was accepted. - * @param aType Type of the request (SMS, SS, USSD). - * @return Information of the operation result. - */ - void confirmSendEvent( - TSatUiResponse &aRes, - const QString &aText, - bool &aActionAccepted, - int aType); - - /** - * Shows the wait note about the Send SMS command. - * @param aText The text to be displayed. - * @param aIconBitmapSendSM Sending dialog icon. - * @param aSelfExplanatoryIcon A flag indicating if only icon is shown. - */ - void showSmsWaitNoteEvent( - const QString &aText, - const bool aSelfExplanatoryIcon); - - /** - * Shows the confirmation not about SetUpCall. - * @param aText The text to be displayed. - * @param aSimAppName The header to be displayed. - * @param aActionAccepted Indicates whether the command was accepted. - */ - void showSetUpCallConfirmEvent( - const QString &aText, - const QString &aSimAppName, - bool &aActionAccepted); - - /** - * Shows the wait note about the Send DTMF command. - * @param aText The text to be displayed. - * @param aIconBitmapSendSM Sending dialog icon. - */ - void showDtmfWaitNoteEvent( - TSatUiResponse &aRes, - const QString &aText); - - - /** - * Shows the wait note about the Send Ss or Ussd command. - * @param aText The text to be displayed. - * @param aIconBitmapSendSM Sending dialog icon. - * @param aSelfExplanatoryIcon A flag indicating if only icon is shown. - */ - void showSsWaitNoteEvent( - const QString &aText, - const bool aSelfExplanatoryIcon); - - /** - * Shows the wait note about Open Channel - * @param aText The text to be displayed. - * @param aActionAccepted Indicates whether the command was accepted. - */ - void showOpenChannelConfirmEvent( - const QString &aText, - bool &aActionAccepted); - - - /*! - Removes Display Text Dialog from the screen. - */ - void clearScreenEvent(); - - /*! - Close the sat ui - */ - void closeUiEvent(); - - /*! - *Close wait note - */ - void stopShowWaitNoteEvent(); - - /*! - *Show SsWaitNote without Delay - */ - void showWaitNoteWithoutDelayEvent(); - - /*! - *ShowSsErrorNoteEvent - */ - void showSsErrorNoteEvent(); - - /*! - * Show BIP related Note - */ - void showBIPNoteEvent(int aCommand, const QString &aText); - -public slots: - /*! - *User cancel response, Send DTMF, Send Data, Receive Data - */ - void userCancelResponse(); - -public: // from MSatUiActionImplementer and impletment by QT - - /** - * Shows the wait note. - */ - virtual void ShowWaitNoteL() {}; - - /** - * Shows the wait note without delay - */ - virtual void ShowWaitNoteWithoutDelayL(); - - /** - * Removes the wait note from the screen. - */ - void StopShowWaitNote(); - - /** - * Handles the SetUpMenu view. - * @param aText The title text. - * @param aMenuItems The array of menu item captions. - * @param aMenuItemNextActions The array of menu item next action - * indicator captions. - * @param aIconBitmap The Context pane icon. - * @param aItemsIconArray Array of item icons - * @param aSelfExplanatoryItems Flag indicating if only icons are shown. - * @param aHelpIsAvailable A flag indicating if SAT help is available. - * @return Information of the operation result. - */ - virtual TSatUiResponse SetUpMenuL( - const TDesC &aText, - const MDesCArray &aMenuItems, - const CArrayFixFlat* aMenuItemNextActions, - const CFbsBitmap *aIconBitmap, - const TBool aSelfExplanatoryItems, - const TBool aHelpIsAvailable); - - /** - * Handles the SelectItem view. - * @param aText The title text. - * @param aMenuItems The array of menu items. - * @param aMenuItemNextActions The array of next action indicators. - * @param aDefaultItem The item in focus. - * @param aSelection The item index selected by the user. - * @param aIconBitmap The Context Pane icon. - * @param aItemsIconArray Array of item icons - * @param aSelfExplanatoryItems Flag indicating if only icons are shown. - * @param aHelpIsAvailable A flag indicating if SAT help is available. - * @return Information of the operation result. - */ - virtual TSatUiResponse SelectItemL(const TDesC &aText, - const MDesCArray &aMenuItems, - const CArrayFixFlat* aMenuItemNextActions, - const TInt aDefaultItem, - TUint8 &aSelection, - const CFbsBitmap *aIconBitmap, - const TBool aSelfExplanatoryItems, - const TBool aHelpIsAvailable); - - /** - * Returns CoeEnv. - */ - virtual CCoeEnv* CoeEnv() { return 0; }; - - /** - * Handles the DisplayText operation. - * @param aText Text to be shown. - * @param aSimApplicationName Sim Application name - * @param aIconBitmapDisplayText Icon for dialog - * @param aSustainedText Indicates is this text sustained ie. no timers - * used if ETrue. - * @param aDuration Duration for showing the text - * @param aWaitUserToClear Indication if user is needed to clear - * message - * @return Information of the operation result. - */ - virtual TSatUiResponse DisplayTextL( - const TDesC &aText, - const TDesC &aSimApplicationName, - CFbsBitmap *aIconBitmapDisplayText, - const TBool aSelfExplanatoryIcon, - const TBool aSustainedText, - const TTimeIntervalSeconds aDuration, - const TBool aWaitUserToClear); - - /** - * Removes Display Text Dialog from the screen. - */ - virtual void ClearScreen(); - - /** - * Asks a Yes/No answer from the user. - * @param aText A question to be shown. - * @param aCharacterSet The character range allowed. - * @param aInkey Character user feeds. - * @param aIconBitmap Icon for query dialog. - * @param aSelfExplanatory Flag indicating if icon is self-explanatory. - * @param aDuration Duration for showing the dialog. - * @param aImmediateDigitResponse Indication if Immediate digit response - * is needed. - * @return Information of the operation result. - */ - virtual TSatUiResponse GetYesNoL( - const TDesC &aText, - const TSatCharacterSet aCharacterSet, - TChar &aInkey, - const CFbsBitmap */*aIconBitmap*/, - const TBool aSelfExplanatory, - TUint &aDuration, - const TBool aImmediateDigitResponse); - - /** - * Asks input from the user. - * @param aText A question to be shown. - * @param aCharacterSet The character range allowed. - * @param aInput The input string. - * @param aMinLength The minimum length of the input allowed. - * @param aMaxLength The maximum length of the input allowed. - * @param aHideInput A flag indicating if the input should be hidden. - * @param aGetInkey A flag indicating if GetInkey command is used. - * @param aIconBitmapGetInput Icon for query dialog. - * @param aSelfExplanatory A flag indicating if icon is self-explanatory. - * @param aDuration Duration for showing the dialog. - * @return Information of the operation result. - */ - virtual TSatUiResponse GetInputL( - const TDesC &aText, - const TSatCharacterSet aCharacterSet, - TDes &aInput, - const TInt aMinLength, - const TInt aMaxLength, - const TBool aHideInput, - const TBool aGetInkey, - const CFbsBitmap *aIconBitmapGetInput, - const TBool aSelfExplanatory, - TUint &aDuration); - - - /** - * Handles Standard Tone playing. - * @param aText The text to be displayed. - * @param aFileName The name of the file corresponding to the tone. - * @param aDuration The duration of the tone to be played. - * @param aIconBitmap The tone playing note icon - * @param aSelfExplanatory Flag indicating if icon is self-explanatory. - * @return Information of the operation result. - */ - virtual TSatUiResponse PlayStandardToneL( - const TDesC &aText, - const TDesC8 &aSequence, - TTimeIntervalMicroSeconds aDuration, - const CFbsBitmap *aIconBitmap, - const TBool aSelfExplanatory); - - /** - * Shows the confirmation note about the SAT Send SMS, Send SS or - * Send USSD command. - * @param aText The text to be displayed. - * @param aActionAccepted Indicates whether the command was accepted. - * @param aType Type of the request (SMS, SS, USSD). - * @return Information of the operation result. - */ - virtual TSatUiResponse ConfirmSendL( - const TDesC &aText, - TBool &aActionAccepted, - TInt aType); - - /** - * Shows the wait note about the Send SMS command. - * @param aText The text to be displayed. - * @param aIconBitmapSendSM Sending dialog icon. - * @param aSelfExplanatoryIcon A flag indicating if only icon is shown. - */ - virtual void ShowSmsWaitNoteL( - const TDesC &aText, - const CFbsBitmap *aIconBitmapSendSM, - const TBool aSelfExplanatoryIcon); - - /** - * Shows the wait note about the Send SS command. - * @param aText The text to be displayed. - * @param aIconBitmap Sending dialog icon. - * @param aSelfExplanatoryIcon A flag indicating if only icon is shown. - */ - virtual void ShowSsWaitNoteL( - const TDesC &aText, - const CFbsBitmap */*aIconBitmap*/, - const TBool aSelfExplanatoryIcon); - - /** - * Shows the confirmation note about the SAT Refresh command. - * @param aActionAccepted Indicates whether the command was accepted. - * @return Information of the operation result. - */ - virtual TSatUiResponse ConfirmRefreshL( - TBool &/*aActionAccepted*/) - { - return ESatSuccess; - }; - - /** - * Notification of the SAT Call Control command. - * @param aText The text string to be displayed. - * @param aAlphaIdStatus Alpha Identifier status - * @param aControlResult Call control general result - * @return The response from the UI - */ - virtual TSatUiResponse CallControlL( - const TDesC &aText, - const TSatAlphaIdStatus aAlphaIdStatus); - - /** - * Notification of the SAT Launch browser confirmation request - * @param aText The text to be displayed. - * @param aActionAccepted Indicates whether the command was accepted. - * @param aIconBitmap The confirm note icon - * @param aSelfExplanatory Flag indicating if icon is self-explanatory. - */ - virtual void ConfirmLaunchBrowserL( - const TDesC &/*aText*/, - TBool &/*aActionAccepted*/, - const CFbsBitmap */*aIconBitmap*/, - const TBool /*aSelfExplanatory*/) {}; - - /** - * Notification of the SAT Mo Sm Control command. - * @param aText The text string to be displayed. - * @param aAlphaIdStatus Alpha Identifier status - * @param aControlResult Mo Sm control general result - * @return The response from the UI - */ - virtual TSatUiResponse MoSmControlL( - const TDesC &aText, - const TSatAlphaIdStatus aAlphaIdStatus); - - /** - * Shows the wait note while DTMF are being sent. - * @param aText The text to be displayed. - * @param aIconBitmap The confirm note icon - * @param aSelfExplanatory Flag indicating if icon is self-explanatory. - * @return Information on the operation result. - */ - virtual TSatUiResponse ShowDtmfWaitNoteL( - const TDesC &aText, - const CFbsBitmap *aIconBitmap, - const TBool aSelfExplanatoryIcon); - - /** - * Dispatch iWait to action implementer. - * @param aWait Timer. - */ - virtual void DispatchTimer(CActiveSchedulerWait &/*aWait*/) {}; - - /** - * Get flag which is indicating if end key is pressed. - * @return A Boolean flag which is indicating if end key is pressed. - * EndKey not support, Open issue - */ - virtual TBool GetEndKey(){return EFalse;}; - - /** - * Set a flag which is indicating if end key is pressed. - * @param aValue Status of end key - */ - virtual void SetEndKey(TBool /*aValue*/) {}; - - /** - * Set a flag which is indicating if proactive command is pending. - * @param aValue Status of proactive command - */ - virtual void SetCommandPending(TBool /*aValue*/) {}; - - /** - * Plays user selected tone. - * @param aText The text to be displayed. - * @param aDuration Play duration. - * @param aTone Tone to be played. - * @param aIconBitmap The tone playing note icon - * @param aSelfExplanatory Flag indicating if icon is self-explanatory. - * @return Information on the operation result. - */ - virtual TSatUiResponse PlayUserSelectedToneL( - const TDesC &aText, - TTimeIntervalMicroSeconds aDuration, - TSatTone aTone, - const CFbsBitmap *aIconBitmap, - const TBool aSelfExplanatory); - - /** - * Confirm user permission for Open Channel. - * @param aText The text to be displayed. - * @param aActionAccepted Indicates whether the command was accepted. - * @param aIconBitmapOpenChannel Icon for query dialog - * @param aSelfExplanatory A flag indicating if icon is self-explanatory - * @return Operation result - */ - virtual TSatUiResponse ConfirmOpenChannelL( - const TDesC &aText, - TBool &aActionAccepted, - const CFbsBitmap */*aIconBitmapOpenChannel*/, - const TBool aSelfExplanatory); - - /** - * Shows the wait note while BIP packets are sent. - * @param aCommand Command type. - * @param aText The text to be displayed. - * @param aIconBitmap Icon for query dialog - * @param aSelfExplanatory A flag indicating if icon is self-explanatory - */ - virtual void ShowBIPNoteL( - TInt aCommand, - const TDesC &aText, - const CFbsBitmap */*aIconBitmap*/, - const TBool /*aSelfExplanatory*/); - - /** - * Confirm user permission for SetUpCall - * @param aText The text to be displayed. - * @param aSimAppName Header for th equery - * @param aActionAccepted Indicates whether the command was accepted. - * @param aIconBitmap Icon for query dialog - * @param aSelfExplanatory A flag indicating if icon is self-explanatory - */ - virtual void ConfirmSetUpCallL( - const TDesC &aText, - const TDesC &aSimAppName, - TBool &aActionAccepted, - const CFbsBitmap *aIconBitmap, - const TBool aSelfExplanatory); - - /** - * Show note indicating SAT is not available. - */ - virtual void ShowNotAvailableNoteL() {}; - - /** - * Show the Ss error note. - */ - virtual void ShowSsErrorNoteL(); - - /** - * Close SatUi process. - */ - virtual void CloseSatUI(); - -public: // new method - - /** - * Return current profile state. - * @return current profile state. - */ - int profileState(); - - /** - * Response to the Set Up Menu command. - * @param aMenuItem The selected menu item. - * @param aHelpRequested Indicates whether help was requested. - */ - void menuSelection(int aMenuItem, bool aHelpRequested); - -private: // Data - - /** - * The pointer to the sybmian class CSatUiObserver - * which will access Sat Client API - * own - */ - CSatUiObserver *mObs; - - /** - * Own, PlayTone - */ - SatAppPlayToneProvider *mPlayTone; - -}; - -#endif diff -r 1f002146abb4 -r cee7e9e0906c satui/satapp/inc/satappinputprovider.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/satui/satapp/inc/satappinputprovider.h Wed Aug 18 10:19:22 2010 +0300 @@ -0,0 +1,111 @@ +/* +* Copyright (c) 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" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Provides input methods like query dialogs +* +*/ + +#ifndef SATAPPINPUTPROVIDER_H +#define SATAPPINPUTPROVIDER_H + +// includes +#include +#include +#include + +// forward declarations +class HbDialog; +class SatAppAction; +class QTimer; + +class SatAppInputProvider : public QObject +{ + Q_OBJECT + +public: + SatAppInputProvider(QObject *parent = 0); + virtual ~SatAppInputProvider(); + +public slots: + + /** requests user to enter a SINGLE key, character or digit */ + void getInkey(SatAppAction& action); + + /** requests user to enter a STRING of free text, number or password etc. */ + void getInput(SatAppAction& action); + + /** Resets the UI state commits pending server requests if any */ + void resetState(); + +private slots: + + /** update the actions when content in getinput changed */ + void updateQueryAction(); + /** update the actions according the text */ + void updateQueryAction(QString text); + /** get the input key in get inkey */ + void transmitInkeyFromDialog(); + /** get the input key in get inkey immediate */ + void transmitInkeyImmediately(QString text); + /** get the input key in get inkey yesno query */ + void transmitInkeyTrue(); + /** get the input key in get inkey yesno query */ + void transmitInkeyFalse(); + /** get the get input string */ + void transmitStringFromDialog(); + /** clear the query timeout timer */ + void clearDurationTimer(); + +private: // private implementation + + /** show get inkey query */ + void showGetInkeyQuery(const QString &aHeading, + TSatCharacterSet aCharacterSet, int aDuration); + /** show get inkey immediate query */ + void showGetImmediateQuery(const QString &aHeading, int aDuration); + /** show get inkey yes no query */ + void showGetYesNoQuery(const QString &aText, int aDuration); + + /** show get input query */ + void showGetInputQuery(const QString &heading, const QString &content, + TSatCharacterSet characterSet, int minLength, int maxLength, + bool aHideInput); + /** dialog type */ + enum DialogMode { + GetInkey, + GetYesNo, + GetImmediate, + GetInput}; + + /** update dialog according type */ + void composeDialog(HbDialog *dlg, DialogMode mode); + /** set the get inkey result to action */ + void transmitInkey(int key); + /** start dialog timeout timer */ + void startDurationTimer(int duration); + +private: + /** not own */ + SatAppAction* mCurrentAction; + /** own */ + HbDialog* mCurrentDialog; + /** own */ + QTime mInputTimer; + /** own */ + QTimer* mDurationTimer; + + /**for unit testing */ + friend class InputProviderTest; +}; + +#endif /* SATAPPINPUTPROVIDER_H */ diff -r 1f002146abb4 -r cee7e9e0906c satui/satapp/inc/satappmainhandler.h --- a/satui/satapp/inc/satappmainhandler.h Tue Jul 06 14:53:02 2010 +0300 +++ b/satui/satapp/inc/satappmainhandler.h Wed Aug 18 10:19:22 2010 +0300 @@ -20,11 +20,16 @@ #define SATAPPMAINHANDLER_H #include +#include class HbMainWindow; -class SatAppUiProvider; -class SatAppEventProvider; -class SatAppCommandHandler; +class HbMessageBox; +class SatAppServerDispatcher; +class SatAppMenuProvider; +class SatAppInputProvider; +class SatAppToneProvider; +class SatAppPopupProvider; +class SatAppConfirmProvider; class SatAppMainHandler : public QObject { @@ -33,14 +38,29 @@ public: SatAppMainHandler(HbMainWindow &window, QObject *parent = 0); ~SatAppMainHandler(); + void showOfflineWarning(); private: void initConnections(); + +private slots: + void updateActivity(); + void saveActivity(); +private: + void removeActivity(); + bool isOffline(); private: // data - SatAppEventProvider *mEvent; - SatAppUiProvider *mUi; - SatAppCommandHandler *mCommand; + + SatAppServerDispatcher* mServer; + SatAppMenuProvider* mMenu; + SatAppInputProvider* mInput; + SatAppToneProvider* mTone; + SatAppPopupProvider* mPopup; + SatAppConfirmProvider *mConfirm; + QVariantHash mActivity; + + HbMessageBox *mOfflineWarningDlg; }; #endif // SATAPPMAINHANDLER_H diff -r 1f002146abb4 -r cee7e9e0906c satui/satapp/inc/satappmenuprovider.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/satui/satapp/inc/satappmenuprovider.h Wed Aug 18 10:19:22 2010 +0300 @@ -0,0 +1,86 @@ +/* +* Copyright (c) 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" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Provides and maintains SAT main view (selection list)s +* +*/ + +#ifndef SATAPPMENUPROVIDER_H +#define SATAPPMENUPROVIDER_H + +#include +#include //for TSatUiResponse + +class SatAppAction; +class HbMainWindow; +class HbListWidgetItem; +class HbView; +class QEventLoop; +class QTimer; +class HbMainWindow; +class HbAction; +class HbListWidget; +class HbLabel; +class QPixmap; + +class SatAppMenuProvider : public QObject +{ + Q_OBJECT + +public: + + SatAppMenuProvider(HbMainWindow *window, QObject *parent = 0); + + virtual ~SatAppMenuProvider(); + + /** takes a screen shot of the menu */ + QPixmap takeScreenShot(); + +public slots: + + /** signal request to display a menu */ + void setUpMenu(SatAppAction &action); + + /** requests a list selection menu to be displayed */ + void selectItem(SatAppAction &action); + + void resetState(); + +private slots: + void menuItemSelected(HbListWidgetItem *item); + +private: + + void loadMainView(); + void switchView(); + void connectItem(); + void disconnectItem(); + +private: + + QList mObjects; + HbMainWindow *mMainWindow; + HbView *mSetupMenuView; + HbView *mSelectItemView; + HbAction *mSoftKeyQuitAction; + HbAction *mSoftKeyBackAction; + HbListWidget *mListWidget; + HbListWidget *mSelectListWidget; + HbLabel *mSubTitle; + SatAppAction* mCurrentAction; // not own + + // for unit testing + friend class MenuProviderTest; +}; + +#endif /* SATAPPMENUPROVIDER_H */ diff -r 1f002146abb4 -r cee7e9e0906c satui/satapp/inc/satappplaytoneprovider.h --- a/satui/satapp/inc/satappplaytoneprovider.h Tue Jul 06 14:53:02 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,190 +0,0 @@ -/* -* Copyright (c) 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" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ -#ifndef SATAPPPLAYTONEPROVIDER_H -#define SATAPPPLAYTONEPROVIDER_H - -#include -#include //PlayStandardTone -#include //PlayUserSelectedTone -#include -#include - - -class CMdaAudioToneUtility; -class CMdaAudioPlayerUtility; -class QTimer; -class HbMessageBox; - -class SatAppPlayToneProvider: public QObject, - public MMdaAudioToneObserver,//PlayStandardTone - public MMdaAudioPlayerCallback//PlayUserSelectedTone -{ - Q_OBJECT - -public: - - /** - * Constructor - */ - SatAppPlayToneProvider(QObject *parent = 0); - - /** - * Distructor - */ - virtual ~SatAppPlayToneProvider(); - -public: // from MSatUiActionImplementer and impletment by Symbian - - /** - * Handles Standard Tone playing. - * @param aText The text to be displayed. - * @param aFileName The name of the file corresponding to the tone. - * @param aDuration The duration of the tone to be played. - * @param aIconBitmap The tone playing note icon - * @param aSelfExplanatory Flag indicating if icon is self-explanatory. - * @return Information of the operation result. - */ - virtual TSatUiResponse PlayStandardToneL( - const TDesC &aText, - const TDesC8 &aSequence, - TTimeIntervalMicroSeconds aDuration, - const CFbsBitmap *aIconBitmap, - const TBool aSelfExplanatory ); - - /** - * Plays user selected tone. - * @param aText The text to be displayed. - * @param aDuration Play duration. - * @param aTone Tone to be played. - * @param aIconBitmap The tone playing note icon - * @param aSelfExplanatory Flag indicating if icon is self-explanatory. - * @return Information on the operation result. - */ - virtual TSatUiResponse PlayUserSelectedToneL( - const TDesC &aText, - TTimeIntervalMicroSeconds aDuration, - TSatTone aTone, - const CFbsBitmap *aIconBitmap, - const TBool aSelfExplanatory ); - - /** - * ClearScreen - */ - void clearScreen(); - - /** - * CloseSatUI - */ - void closeSatUI(); - -public:// from MMdaAudioToneObserver - - /** - * From MMdaAudioToneObserver Called by the player object when - * it has been initialised. - * @param aError Error type. - */ - void MatoPrepareComplete( TInt aError ); - - /** - * From MMdaAudioToneObserver Called by the player object when - * the playback has been terminated. - * @param aError Error type. - */ - void MatoPlayComplete( TInt aError ); - -public://from MMdaAudioPlayerCallback - /** - * Initialisation of an audio sample has completed. - * @param aError The status of the audio sample after initialisation. - * @param aDuration The duration of the audio sample. - */ - void MapcInitComplete( - TInt aError, - const TTimeIntervalMicroSeconds& /*aDuration*/ ); - - /** - * Play of an audio sample has completed. - * @param aError The status of playback. - */ - void MapcPlayComplete( TInt aError ); - -private:// for playTone - - /** - * Get settings from current profile like volume, warning tones on/off etc. - * @param aTone, optional specifies the type of needed tone if necessary - * @param aToneName, optional buffer to get a soundfile name from - * the active profile if necessary - */ - void GetProfileParamsL( TSatTone aTone = ESatToneNotSet, - TDes *aToneName = NULL ); - - /** - * showWaitNote - */ - void showWaitNote(); - -private slots: - - void stopPlayTone(); - -private: // Data - - /** - * Warning And Play Tones - */ - bool mWarningAndPlayTones; - - /** - * Play tone volume - */ - int mVolume; - - /** - * Own, Media server interface to play rtf file - */ - CMdaAudioToneUtility *mPlayer; - - /** - * Response of Play tone - */ - TSatUiResponse mPlayToneError; - - /* - * Own. PlayTone - */ - QTimer *mTimer; - - /* - * Own. PlayTone - */ - QEventLoop *mLoop; - - /* - * Own. PlayTone note - */ - HbMessageBox *mPermanentNote; - - /* - * Own. Player for user selected tones. - */ - CMdaAudioPlayerUtility *mAudioPlayer; - -}; - -#endif //SATAPPPLAYTONEPROVIDER_H diff -r 1f002146abb4 -r cee7e9e0906c satui/satapp/inc/satapppopupprovider.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/satui/satapp/inc/satapppopupprovider.h Wed Aug 18 10:19:22 2010 +0300 @@ -0,0 +1,79 @@ +/* +* Copyright (c) 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" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Provides SAT popups info and progress notes +* +*/ + +#ifndef SATAPPPOPUPPROVIDER_H +#define SATAPPPOPUPPROVIDER_H + +// includes +#include + +// forward declarations +class HbMessageBox; +class HbDialog; +class HbDeviceMessageBox; +class SatAppAction; + +class SatAppPopupProvider : public QObject +{ + Q_OBJECT + +public: + SatAppPopupProvider(QObject *parent = 0); + virtual ~SatAppPopupProvider(); + +public slots: + + /** displays a text note on screen */ + void displayText(SatAppAction &action); + + /** shows a simple notification about an ongoing operation */ + void notification(SatAppAction &action); + + /** requests any ongoing wait note to be dismissed */ + void stopShowWaitNote(); + + /** show a error note for send ss command */ + void showSsErrorNote(); + + /** requests any ongoing wait note and display text to be dismissed */ + void clearScreen(); + + /** reset some data members */ + void resetState(); + +private: + QString alphaId(SatAppAction &action); + void showBIPWaitNote(SatAppAction &action); + void showCloseChannelWaitNote(SatAppAction &action); + void showMoSmControlNote(SatAppAction &action); + void showSatInfoNote(SatAppAction &action); + void showSmsWaitNote(SatAppAction &action); + void showCallControlNote(SatAppAction &action); + void showDtmfWaitNote(SatAppAction &action); + void showSsWaitNote(SatAppAction &action); + +private: + HbMessageBox *mDisplayText; + HbDialog *mWaitDialog; + HbDeviceMessageBox *mWaitDeviceDialog; + SatAppAction *mAction; + + // for unit testing + friend class PopupProviderTest; +}; + +#endif /* SATAPPPOPUPPROVIDER_H */ diff -r 1f002146abb4 -r cee7e9e0906c satui/satapp/inc/satappserverdispatcher.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/satui/satapp/inc/satappserverdispatcher.h Wed Aug 18 10:19:22 2010 +0300 @@ -0,0 +1,209 @@ +/* +* Copyright (c) 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" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Receives UI commands from SAT server and converts to QT +* +*/ + +#ifndef SATAPPSERVERDISPATCHER_H +#define SATAPPSERVERDISPATCHER_H + +#include +#include +#include +#include + +// forward declarations +class SatAppAction; + +class SatAppServerDispatcher: public QObject, public MSatUiObserver +{ + Q_OBJECT + +public: + + SatAppServerDispatcher(QObject *parent = 0); + + virtual ~SatAppServerDispatcher(); + +signals: + + /** signal request to display a menu */ + void setUpMenu(SatAppAction &action); + + /** requests a list selection menu to be displayed */ + void selectItem(SatAppAction &action); + + /** Requtes a text to be displayed to the user*/ + void displayText(SatAppAction &action); + + /** requests a key input to be displayed */ + void getInkey(SatAppAction &action); + + /** requests a string input to be displayed */ + void getInput(SatAppAction &action); + + /** Requests tone to be played */ + void playTone(SatAppAction &action); + + /** requests a confirm string to be displayed */ + void confirmCommand(SatAppAction &action); + + /** Requests an info notification or wait/status note */ + void notification(SatAppAction &action); + + /** requests any ongoing wait note to be dismissed */ + void stopShowWaitNote(); + + /** requests all ongoing activities to be cleared on SAT UI */ + void clearScreen(); + + /** requests to show ss error note*/ + void showSsErrorNote(); + +public slots: + + /** + * Response to the Set Up Menu command. + * @param aMenuItem The selected menu item. + * @param aHelpRequested Indicates whether help was requested. + */ + void menuSelection(SatAppAction* action); + + /** + * User cancel response, Send DTMF, Send Data, Receive Data + */ + void userCancelSession(SatAppAction* action); + + + // **************************************************************************** + // * ************************************************************************ * + // * * SYMBIAN PART * * + // * ************************************************************************ * + // **************************************************************************** + +private: + + void ConnectSatSessionL(); + void DisconnectSatSession(); + +public: // from MSatUiObserver + + /** + * see msatuiobserver.h + */ + TSatUiResponse DisplayTextL( const TDesC& aText, + const TDesC& aSimApplicationName, + const TSatIconId& aIconId, + TBool& aRequestedIconDisplayed, + const TBool aSustainedText, + const TTimeIntervalSeconds aDuration, + const TBool aWaitUserToClear ); + + /** + * see msatuiobserver.h + */ + TSatUiResponse GetInkeyL( const TDesC& aText, + const TSatCharacterSet aCharacterSet, TChar& aInput, + const TBool aHelpIsAvailable, + const TSatIconId& aIconId, + TBool& aRequestedIconDisplayed, + TUint& aDuration, + const TBool aImmediateDigitResponse ); + + /** + * see msatuiobserver.h + */ + TSatUiResponse GetInputL( const TDesC& aText, + const TSatCharacterSet aCharacterSet, TDes& aInput, + const TInt aMinLength, const TInt aMaxLength, + const TBool aHideInput, + const TBool aHelpIsAvailable, + const TSatIconId& aIconId, + TBool& aRequestedIconDisplayed ); + + /** + * see msatuiobserver.h + */ + TSatUiResponse SetUpMenuL( const TDesC& aText, + const MDesCArray& aMenuItems, + const CArrayFixFlat* aMenuItemNextActions, + const TBool aHelpIsAvailable, + const TSatIconId& aIconId, + const CArrayFixFlat* aMenuIcons, + const enum TSatIconQualifier aIconListQualifier, + const enum TSatSelectionPreference aSelectionPreference ); + + /** + * see msatuiobserver.h + */ + TSatUiResponse SelectItemL( const TDesC& aText, + const MDesCArray& aMenuItems, + const CArrayFixFlat* aMenuItemNextActions, + const TInt aDefaultItem, TUint8& aSelection, + const TBool aHelpIsAvailable, + const TSatIconId& aIconId, + const CArrayFixFlat* aMenuIcons, + const enum TSatIconQualifier aIconListQualifier, + TBool& aRequestedIconDisplayed, + const enum TSatSelectionPreference aSelectionPreference ); + + /** + * see msatuiobserver.h + */ + TSatUiResponse PlayTone( const TDesC& aText, + const TSatTone aTone, + const TTimeIntervalMicroSeconds aDuration, + const TSatIconId& aIconId, + TBool& aRequestedIconDisplayed ); + + /** + * see msatuiobserver.h + */ + void ConfirmCommand( + const TSatSQueryCommand aCommandId, + const TSatAlphaIdStatus aAlphaIdStatus, + const TDesC& aText, + const TDesC& aAdditionalText, + TBool& aActionAccepted, + const TSatIconId& aIconId, + TBool& aRequestedIconDisplayed, + TBool& aTerminatedByUser ); + + /** + * see msatuiobserver.h + */ + TSatUiResponse Notification( + const TSatSNotifyCommand aCommandId, + const TSatAlphaIdStatus aAlphaIdStatus, + const TDesC& aText, + const TSatIconId& aIconId, + TBool& aRequestedIconDisplayed, + const TSatControlResult aControlResult ); + + /** + * see msatuiobserver.h + */ + void EventNotification( + const TSatSEvent aEventId, + const TSatSEventStatus aEventStatus, + const TInt aError ); + +private: + + RSatUiSession iSat; + RSatSession iSatSession; + +}; + +#endif //SATAPPSERVERDISPATCHER_H diff -r 1f002146abb4 -r cee7e9e0906c satui/satapp/inc/satapptoneprovider.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/satui/satapp/inc/satapptoneprovider.h Wed Aug 18 10:19:22 2010 +0300 @@ -0,0 +1,129 @@ +/* +* Copyright (c) 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" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ +#ifndef SATAPPTONEPROVIDER_H +#define SATAPPTONEPROVIDER_H + +// includes +#include +#include +#include +#include //for TSatUiResponse +#include //MMdaAudioToneObserver +#include //MMdaAudioPlayerCallback + +// forward declarations +class QTimer; +class HbMessageBox; +class CMdaAudioToneUtility; +class CMdaAudioPlayerUtility; +class SatAppAction; + + +class SatAppToneProvider: + public QObject, + public MMdaAudioToneObserver, + public MMdaAudioPlayerCallback +{ + Q_OBJECT + +public: + + SatAppToneProvider(QObject *parent = 0); + virtual ~SatAppToneProvider(); + +public slots: + + void playTone(SatAppAction& action); + + void clearScreen(); + +private: + + enum State {Idle,PlayStandardTone,PlayUserSelectedTone}; + + State recognizeTone( + int tone, + QByteArray& sequence, + int& duration); + QByteArray charArrayToByteArray( + const char tone[], + int size); + void playStandardTone( + const QString& text, + const QByteArray& sequence, + int duration); + void playUserSelectedTone( + const QString& text, + int tone, + int duration); + +public slots: + /** + * Resets the UI state within the tone provider, + * commits pending server requests if any + */ + void resetState(); + +private slots: + + void stopPlayTone(); + +// **************************************************************************** +// * ************************************************************************ * +// * * SYMBIAN PART * * +// * ************************************************************************ * +// **************************************************************************** + +private: + + void SymbianPrepareAudioToneUtilityL(const TDesC8& sequence); + void SymbianStopAudioToneUtility(); + void SymbianPrepareAudioPlayerL(int tone, int duration); + void SymbianStopAudioPlayer(); + void GetProfileParamsL( + int tone=ESatToneNotSet, TDes* toneName=NULL ); + +public: // from MMdaAudioToneObserver + + void MatoPrepareComplete( TInt aError ); + void MatoPlayComplete( TInt aError ); + +public: //from MMdaAudioPlayerCallback + + void MapcInitComplete( TInt aError, + const TTimeIntervalMicroSeconds& aDuration ); + void MapcPlayComplete( TInt aError ); + + +private: // Data + + State mState; + SatAppAction* mCurrentAction; + + bool mWarningAndPlayTones; + int mVolume; + CMdaAudioToneUtility *mPlayer; + TSatUiResponse mPlayToneError; + QTimer *mTimer; + HbMessageBox *mPermanentNote; + CMdaAudioPlayerUtility *mAudioPlayer; + + // for unit testing + friend class ToneProviderTest; +}; + +#endif //SATAPPTONEPROVIDER_H diff -r 1f002146abb4 -r cee7e9e0906c satui/satapp/inc/satappuiprovider.h --- a/satui/satapp/inc/satappuiprovider.h Tue Jul 06 14:53:02 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,449 +0,0 @@ -/* -* Copyright (c) 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" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ -#ifndef SATAPPUIPROVIDER_H -#define SATAPPUIPROVIDER_H - -#include -#include -#include -#include -#include -#include "satappcommonconstant.h" - -class HbMainWindow; -class SatAppEventProvider; // Call back from SatServer -class SatAppView; // SetupMenu and SelectItem -class HbMessageBox; // DisplayText -class HbDeviceMessageBox; // CallControl -class HbInputDialog; // GetInKey -class QTimer; // For SMS/DTMF -class HbProgressDialog; - -// Here we create custom document loader to be able to use own classes in XML. -class SatAppDocumentLoader : public HbDocumentLoader -{ -public: - virtual QObject *createObject(const QString &type, const QString &name); -}; - -class SatAppUiProvider : public QObject -{ - Q_OBJECT - -public: - /* - * Constructor - * @param window reference of HbMainWindow - * @param event reference of SatAppEventProvider - * @param parent default value - */ - SatAppUiProvider(HbMainWindow &window, - SatAppEventProvider &event, - QObject *parent = 0); - - /* - * Destructor - */ - ~SatAppUiProvider(); - - /* - * return the document loader, not transfer the ownership. - */ - SatAppDocumentLoader* docmlLoader(); - - /* - * Set active view. - */ - void activeView(const QString &view); - - /* - * Show SetUpMenuView - * @param aRes TSatAppUserResponse the response - * @param aText The string need to be shown in heading widget - * @param aMenuItems The string need to be shown in list widget - * @param aSelfExplanatoryItems - * @param aHelpIsAvailable - */ - void showSetUpMenuView( - TSatUiResponse &aRes, - const QString &aText, - const QStringList &aMenuItems, - //const CArrayFixFlat* aMenuItemNextActions, - //const HbIcon &aIcon, - //const CAknIconArray* aItemIconsArray, - const bool aSelfExplanatoryItems, - const bool aHelpIsAvailable); - - /* - * Show SelectItemView - * @param aRes TSatAppUserResponse the response - * @param aText The string need to be shown in heading widget - * @param aMenuItems The string need to be shown in list widget - * @param aDefaultItem the default item - * param aSelection The string need to be shown in list widget - * @param aSelfExplanatoryItems - * @param aHelpIsAvailable - */ - void showSelectItemView( - TSatUiResponse &aRes, - const QString &aText, - const QStringList &aMenuItems, - //const CArrayFixFlat* aMenuItemNextActions, - const int aDefaultItem, - unsigned char&aSelection, - //const HbIcon &aIcon, - //const CAknIconArray* aItemsIconArray, - const bool aSelfExplanatoryItems, - const bool aHelpIsAvailable); - - /* - * Show the Display dialog - * @param aText The string need to be shown in content widget - * @param aHeader The string need to be shown in heading widget - * @param aDuration the duration of dialog shown if user do nothing - * @return TSatAppUserResponse the response - */ - TSatAppUserResponse showDisplayTextPopup( - const QString &aHeading, - const QString &aContent, - const int aDuration); - - /* - * Show GetInkeyQuer - * @param aHeader The string need to be shown in heading widget - * @param aContent The string need to be shown in content widget - * @param characterSet input mode is digtal or char - * @param aDuration the duration of dialog shown if user do nothing - * @return TSatAppUserResponse the response - */ - TSatAppUserResponse showGetInkeyQuery( - const QString &aHeading, - QString &aContent, - const TSatCharacterSet aCharacterSet, - unsigned int &aDuration); - - /* - * Show GetYesNoQuery - * @param aText The string shown in content - * @param characterSet input mode is digtal or char - * @param aDuration the duration of dialog shown if user do nothing - * @param aImmediateDigitResponse - * @return int the response - */ - int showGetYesNoQuery( - const QString &aText, - const TSatCharacterSet aCharacterSet, - unsigned int &aInkey, - unsigned int &aDuration, - const bool aImmediateDigitResponse); - - /* - * Show GetInput Query - * @param heading The string shown in heading widget - * @param content The string what user enters. May contain default text - * @param characterSet input mode is digtal or char - * @param minLength min lenght for user input - * @param maxLength max lenght for user input - * @param aHideInput user input should hide or not - */ - TSatAppUserResponse showGetInputQuery( - const QString &heading, - QString &content, - const TSatCharacterSet characterSet, - const int minLength, - const int maxLength, - const bool aHideInput); - - /* - * show confirm send query - * @param aText The string shown in heading widget - * @param aActionAccepted - */ - void showConfirmSendQuery( - const QString &aText, - bool &aActionAccepted); - - /* - * Show Sms wait note - * @param aText The string shown in heading widget - */ - void showSmsWaitNote(const QString &aText); - - /* - * Show Dtmf wait note - * @param aRes - * @param aText The string shown in heading widget - */ - void showDtmfWaitNote(TSatUiResponse &aRes, - const QString &aText); - - /* - * Stop show wait note - */ - void stopShowWaitNote(); - - /* - * Comfirm setupcall - * @param aText - * @param aSimAppName - * @param aActionAccepted - */ - void showConfirmSetUpCallQuery( - const QString &aText, - const QString &aSimAppName, - bool &aActionAccepted); - - /* - * Show Ss wait note - * @param aText The string shown in heading widget - */ - void showSsWaitNote(const QString &aText, const bool aSelfExplanatoryIcon); - - /* - * Show call control device info note, with cancel key - * @param aText The string shown in heading widget - */ - void showCallControlNote(const QString &aText); - - /* - * Show receive data and send data wait note, with cancel key - * @param aText The string shown in heading widget - */ - void showBIPWaitNote(const QString &aText); - - /* - * Show Mo sms info note, with cancel key - * @param aText The string shown in heading widget - */ - void showMoSmControlNote(const QString &aText); - /* - * Show Close Channel wait note without cancel key - * @param aText The string shown in heading widget - */ - void showCloseChannelWaitNote(const QString &aText); - - /* - * Show sat info note - * @param aText The string shown in heading widget - */ - void showSatInfoNote(const QString &aText); - -signals: - /* - * User cancel response, Send DTMF, Send Data, Receive Data - */ - void userCancelResponse(); - -public slots: - /* - * Clear Screen - */ - void clearScreen(); - - /* - * Close Ui - */ - void closeUi(); - - /* - * The response of user selected the Primary action - */ - void userPrimaryResponse(); - - /* - * The response of user selected the secondary action - */ - void userSecondaryResponse(); - - /* - * Update Query Action - * @param text - */ - void updateQueryAction(QString text); - - /* - * Handle HbLineEdit contentsChanged signal. - * when the input dialog in the password mode - * there is no textChanged signal, get this from - * HbAbstractEdit - */ - void contentChanged(); - - /* - * User cancel response, Send DTMF, Send Data, Receive Data - */ - void cancelResponse(); - - /* - * Show WaitNoteWithoutDelay - */ - void showWaitNoteWithoutDelay(); - - /* - * Show SsErrorNote - */ - void showSsErrorNote(); - - /* - * Comfirm OpenChannel - * @param aText - * @param aActionAccepted - */ - void showConfirmOpenChannelQuery( - const QString &aText, - bool &aActionAccepted); - - /* - * handleImmediateCancel - */ - void handleImmediateCancel(); - -private: - /* - * Reset the data member mUserRsp value - */ - void resetUserResponse(); - - /* - * Compose Dialog - * @param dlg - * @param dialog timeout - * @param dialog type: DisplayText, GetInput, and etc - * @param aModal - * @param aDismissPolicy - */ - void composeDialog(HbDialog *dlg, int aDuration, - TSatAppDialogActionType type, bool aModal = true, - HbDialog::DismissPolicy aDismissPolicy = HbDialog::NoDismiss); - - /* - * Extend the note shown time - */ - void extendNoteShowtime(); - - /* - * Digital immediately response - * @param text - */ - void immediateResponse(QString text); - -private: - /* - * Not own - */ - HbMainWindow &mMainWindow; - - /* - * Own,objects load from XML. Needs to be deleted once application exits - */ - QList mObjects; - - /* - * Own. For application xml - */ - SatAppDocumentLoader *mLoader; - - /* - * Own. from application xml - */ - SatAppView *mSetupMenuView; - - /* - * Own. from application xml - */ - SatAppView *mSelectItemView; - - /* - * Own. DisplayPopup - */ - HbMessageBox *mDisplayPopup; - - /* - * Own. GetInkeyQuery - */ - HbInputDialog *mGetInkeyQuery; - - /* - * Own. YesNoPopup - */ - HbMessageBox *mYesNoPopup; - - /* - * Own. Get inkey immediately response query dialog - */ - HbInputDialog *mImmediateQuery; - - /* - * Own. GetInputQuery - */ - HbInputDialog *mGetInputQuery; - - /* - * Own. Confirm SendQuery - */ - HbMessageBox *mConfirmSendQuery; - - /* - * Own. SetUpCall Query - */ - HbMessageBox *mSetUpCallQuery; - - /* - * Own. CallControl Query - */ - HbDeviceMessageBox *mCallControlMsg; - - /* - * Own. Confirm Bip Query - */ - HbMessageBox *mConfirmBipQuery; - - /* - * General user response - */ - TSatAppUserResponse mUserRsp; - - /* - * GetInkey immediate digital response - */ - unsigned int mDigitalRsp; - - /* - * GetInput min legnth, en/dis able ok buttion - */ - int mMinLength; - - /* - * Own. DTMF - */ - QTimer *mTimer; - - /* - * Own. - */ - QEventLoop *mLoop; - - /* - * Own. SsWaitNote - */ - HbProgressDialog *mWaitNote; - -}; - -#endif// SATAPPUIPROVIDER_H - -// End of file diff -r 1f002146abb4 -r cee7e9e0906c satui/satapp/inc/satappview.h --- a/satui/satapp/inc/satappview.h Tue Jul 06 14:53:02 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,224 +0,0 @@ -/* -* Copyright (c) 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" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -* -*/ - -#ifndef SATAPPVIEW_H -#define SATAPPVIEW_H - -#include -#include -#include - -class QTimer; -class HbMainWindow; -class HbAction; -class HbListWidget; -class HbListWidgetItem; -class HbLabel; -class SatAppEventProvider; -class SatAppUiProvider; - -class SatAppView : public HbView - { - Q_OBJECT - -public: - /** - * Constructor - */ - SatAppView(QGraphicsItem *parent = 0); - - /** - * Destructor - */ - ~SatAppView(); - - void setMainWindow(HbMainWindow &mainWindow); - - /** - * Initialize setup menu view - * Handles the SetUpMenu command. - * @param in eventProvider The reference of SatAppEventProvider. - * @param in uiProvider The eference of SatAppUiProvider. - */ - void initSetupMenu(SatAppEventProvider &eventProvider, - SatAppUiProvider &uiProvider); - - /** - * Initialize select item view - * Handles the SelectItem command. - * @param in utils The reference of SatAppEventProvider. - * @param in manager The reference of SatAppUiProvider. - */ - void initSelectItem(SatAppEventProvider &eventProvider, - SatAppUiProvider &uiProvider); - /** - * Handles the SetUpMenu command. - * @param aRes the out parameter. the result of the command. - * @param aText The title text. - * @param aMenuItems The array of menu item captions. - * @param aMenuItemNextActions The array of menu item next action - * indicator captions. - * @param aIconBitmap The Context pane icon. - * @param aItemsIconArray Array of item icons - * @param aSelfExplanatoryItems Flag indicating if only icons are shown. - * @param aHelpIsAvailable A flag indicating if SAT help is available. - */ - void showSetUpMenuContent( - TSatUiResponse &aRes, - const QString &aText, - const QStringList &aMenuItems, - //const CArrayFixFlat* aMenuItemNextActions, - //const HbIcon &aIcon, - //const CAknIconArray* aItemIconsArray, - const bool aSelfExplanatoryItems, - const bool aHelpIsAvailable); - - /** - * Handles the SelectItem view. - * @param aRes the out parameter. the result of the command. - * @param aText The title text. - * @param aMenuItems The array of menu items. - * @param aMenuItemNextActions The array of next action indicators. - * @param aDefaultItem The item in focus. - * @param aSelection The item index selected by the user. - * @param aIconBitmap The Context Pane icon. - * @param aItemsIconArray Array of item icons - * @param aSelfExplanatoryItems Flag indicating if only icons are shown. - * @param aHelpIsAvailable A flag indicating if SAT help is available. - * @return Information of the operation result. - */ - void showSelectItemContent( - TSatUiResponse &aRes, - const QString &aText, - const QStringList &aMenuItems, - //const CArrayFixFlat* aMenuItemNextActions, - const int aDefaultItem, - unsigned char &aSelection, - //const HbIcon &aIcon, - //const CAknIconArray* aItemsIconArray, - const bool aSelfExplanatoryItems, - const bool aHelpIsAvailable); - -public slots: - /** - * Private slot for select item event. - */ - void selectItemTimeOut(); - /** - * Private slot for active item. - */ - void menuItemSelected(HbListWidgetItem *item); - -private slots: - /** - * Private slot for receiving backSoftkey press event. - */ - void backButtonClicked(); - -private: // From HbView - /** - * handle key press event - */ - void keyPressEvent(QKeyEvent *event); - -private: // New method - - /** - * Connect item with menuItemSelected. - */ - void connectItem(); - - /** - * Disonnect item with menuItemSelected. - */ - void disconnectItem(); - -private: // data - /** - * Support select item time out. - */ - bool mTimeout; - - /** - * Indicatd Select item view and Setup Menu view. - */ - bool mSelectItem; - - /** - * Indicate use click back softkey. - */ - bool mClickBackSoftkey; - - /** - * The index of list widget. - */ - int mItemIndex; - - /** - * Own,an event loop for select item and menu selection - */ - QEventLoop* mLoop; - - /** - * Own,support selection item time out - */ - QTimer *mTimer; - - // quit for setup menu view - /** - * Not own. From main - */ - HbMainWindow *mWindow; - - /** - * Own. An Action to quit sat application - */ - HbAction *mSoftKeyQuitAction; - - /** - * Own. An action to back to setup menu view - */ - HbAction *mSoftKeyBackAction; - - /** - * Not own. - */ - SatAppEventProvider *mEvent; - - /** - * Not own. - */ - SatAppUiProvider *mUi; - - /** - * Own,from application xml,don't delete in distructor - */ - HbListWidget *mListWidget; - - /** - * Own,from application xml,don't delete in distructor - */ - HbListWidget *mSelectListWidget; - - /** - * Own,from application xml,don't delete in distructor - */ - HbLabel *mSubTitle; - }; - -#endif // SATAPPVIEW_H diff -r 1f002146abb4 -r cee7e9e0906c satui/satapp/inc/tflogger.h --- a/satui/satapp/inc/tflogger.h Tue Jul 06 14:53:02 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,106 +0,0 @@ -/* -* 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" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -* -*/ - -#ifndef __TFLOGGER_H__ -#define __TFLOGGER_H__ - -#include -#include - -_LIT(KTfLogFolder, "sat"); -_LIT(KTfLogFile, "satui.txt"); - -/** -* ------------------------------------------------------------------------------ -* -* Remove #define LOGGING_ENABLED from comments to enable logging -* -* ------------------------------------------------------------------------------ -*/ - -#ifdef _DEBUG -#define LOGGING_ENABLED -#endif - -/** -* ------------------------------------------------------------------------------ -* -* LOGGING MACROs -* -* USE THESE MACROS IN YOUR CODE -* -* Example: TFLOGTEXT(own_desc) -* Example: TFLOGSTRING("Test") -* Example: TFLOGSTRING("Test %i", aValue) -* Example: TFLOGSTRING("Test %i %i", aValue1, aValue2) -* -* ------------------------------------------------------------------------------ -*/ - -#ifdef LOGGING_ENABLED - - #define TFLOGTEXT(TEXT) \ - { \ - RFileLogger::Write(KTfLogFolder,KTfLogFile, \ - EFileLoggingModeAppend, TEXT); \ - RDebug::Print(TEXT); \ - } - - #define TFLOGSTRING(TEXT) \ - { \ - _LIT(tempLogDes, TEXT); \ - RFileLogger::Write(\ - KTfLogFolder, \ - KTfLogFile, \ - EFileLoggingModeAppend, \ - tempLogDes()); \ - RDebug::Print(_L(TEXT)); \ - } - - #define TFLOGSTRING2(TEXT, VAR1) \ - { \ - _LIT(tempLogDes, TEXT); \ - RFileLogger::WriteFormat(\ - KTfLogFolder, \ - KTfLogFile, \ - EFileLoggingModeAppend, \ - TRefByValue(tempLogDes()), VAR1); \ - RDebug::Print(_L(TEXT), VAR1); \ - } - - #define TFLOGSTRING3(TEXT, VAR1, VAR2) \ - { \ - _LIT(tempLogDes, TEXT); \ - RFileLogger::WriteFormat(\ - KTfLogFolder, \ - KTfLogFile, \ - EFileLoggingModeAppend, \ - TRefByValue(tempLogDes()), VAR1, VAR2); \ - RDebug::Print(_L(TEXT), VAR1, VAR2); \ - } - -#else - - #define TFLOGTEXT(TEXT) - #define TFLOGSTRING(TEXT) - #define TFLOGSTRING2(TEXT, VAR1) - #define TFLOGSTRING3(TEXT, VAR1, VAR2) - -#endif // LOGGING_ENABLED - -#endif // __TFLOGGER_H__ diff -r 1f002146abb4 -r cee7e9e0906c satui/satapp/resource/sat_text_map.xls Binary file satui/satapp/resource/sat_text_map.xls has changed diff -r 1f002146abb4 -r cee7e9e0906c satui/satapp/resource/satapp.docml --- a/satui/satapp/resource/satapp.docml Tue Jul 06 14:53:02 2010 +0300 +++ b/satui/satapp/resource/satapp.docml Wed Aug 18 10:19:22 2010 +0300 @@ -1,6 +1,6 @@ - + @@ -15,9 +15,9 @@ - + - + @@ -40,7 +40,7 @@ - + diff -r 1f002146abb4 -r cee7e9e0906c satui/satapp/resource/satapp.qm Binary file satui/satapp/resource/satapp.qm has changed diff -r 1f002146abb4 -r cee7e9e0906c satui/satapp/resource/satapp.qrc --- a/satui/satapp/resource/satapp.qrc Tue Jul 06 14:53:02 2010 +0300 +++ b/satui/satapp/resource/satapp.qrc Wed Aug 18 10:19:22 2010 +0300 @@ -4,7 +4,7 @@ satapp.docml - satapp_en.qm + satapp.qm qtg_large_sat.svg diff -r 1f002146abb4 -r cee7e9e0906c satui/satapp/resource/satapp.ts --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/satui/satapp/resource/satapp.ts Wed Aug 18 10:19:22 2010 +0300 @@ -0,0 +1,268 @@ + + + + + + Wait note text in message box. Displayed when something is being processed. + Processing + Processing + qtl_dialog_pri3_large_graphic + common + info + common + False + + + + Sending data + Sending data + qtl_dialog_pri3_large_graphic + simatk + dialog + simatk + False + + + notification dialog + Sending + Sending + qtl_dialog_pri3 + simatk + info + simatk + False + + + Default titlebar text + SIM Services + SIM Services + qtl_titlebar + simatk_02 + title + simatk + False + + + Button. Note! Use this text ID only if there are max. two buttons in the dialog. Allows the user to cancel the action or process. + Cancel + Cancel + qtl_dialog_softkey_2 + common + button + common + False + + + Default prompt text for input dialog + Enter:\n(number) + Enter:\n(number) + qtl_dialog_sec + simatk_06 + dialog + simatk + False + + + inputDialog label + Enter:\n(1 digit 0-9) + Enter:\n(1 digit 0-9) + qtl_dialog_sec + simatk_06 + dialog + simatk + False + + + title for CMCC + CMCC SIM Services + CMCC SIM Services + qtl_titlebar + simatk + title + simatk + False + + + Body text for note, shown when SAT App is opened but SAT is not supported (no SIM/offline/etc) + %1 about to call + %1 about to call + qtl_dialog_pri5_large_graphic + simatk_09 + info + simatk + False + + + list item in Application library - Short caption / grid view + SIM Services + SIM Services + qtl_grid_applications_sec + simatk_01 + grid + simatk + False + + + + Open browser? + + Open browser? + + qtl_dialog_pri5_large_graphic + simatk + dialog + simatk + False + + + + Receiving data + Receiving data + qtl_dialog_pri3_large_graphic + simatk + dialog + simatk + False + + + + Connection closed + Connection closed + qtl_dialog_pri3_large_graphic + simatk + dialog + simatk + False + + + Item in Task Switcher. + SIM Services + SIM Services + qtl_grid_taskswitcher_tiny + tsw_01 + caption + tsw + False + + + heading for dialog (input dialog, message box dialog) + SIM Services + SIM Services + qtl_dialog_pri_heading + simatk_03 + title + simatk + False + + + text for message box dialog + Open connection? + Open connection? + qtl_dialog_pri5_large_graphic + simatk + info + simatk + False + + + list item in Application library - Long caption / list view + SIM Services + SIM Services + qtl_list_pri_large_graphic + simatk_01 + dblist_1 + simatk + False + + + Default note body text if SIM doesn't provide one. Used when SIM does not allow a send SMS operation. Used also when SIM does not allow a Call/SendSS/SendUssd + Request not allowed + Request not allowed + qtl_notifdialog_pri2_medium_graphic + simatk + dpopinfo + simatk + False + + + inputDialog label + Enter: + Enter: + qtl_dialog_sec + simatk + dialog + simatk + False + + + notification dialog + Request modified + Request modified + qtl_notifdialog_pri2_medium_graphic + simatk + dpopinfo + simatk + False + + + inputDialog label + Enter:\n(1 character) + Enter:\n(1 character) + qtl_dialog_sec + simatk_05 + dialog + simatk + False + + + Default note body text if SIM doesn't provide one. Used when SIM modifies a send SMS operation (e.g. destination number) + SIM services not available + SIM services not available + qtl_notifdialog_pri2_medium_graphic + simatk + dpopinfo + simatk + False + + + Button. Note! Use this text ID only if there are max. two buttons in the dialog. Pressing this button confirms the selected operation. + Yes + Yes + qtl_dialog_softkey_2 + common + button + common + False + + + + Sending\n%U + Sending\n%U + qtl_dialog_pri5_large_graphic + simatk + dialog + simatk + False + + + Button. Note! Use this text ID only if there are max. two buttons in the dialog. Pressing this button rejects the selected operation. + No + No + qtl_dialog_softkey_2 + common + button + common + False + + + Button. Note! Use this text ID only if there are max. two buttons in the dialog. When this button is pressed, the focused item or operation will be selected or accepted. + OK + OK + qtl_dialog_softkey_2 + common + button + common + False + + + diff -r 1f002146abb4 -r cee7e9e0906c satui/satapp/resource/satapp_en.qm Binary file satui/satapp/resource/satapp_en.qm has changed diff -r 1f002146abb4 -r cee7e9e0906c satui/satapp/resource/satapp_en.ts --- a/satui/satapp/resource/satapp_en.ts Tue Jul 06 14:53:02 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,346 +0,0 @@ - - - - - - - about to call - about to call - - - - - False - - - - Enter character - Enter character - - - - - False - - - - Call - Call - - - - - False - - - - Connection closed - Connection closed - - - - - False - - - - Request modified - Request modified - - - - - False - - - - Sending… - Sending… - - - - - False - - - - Request not allowed - Request not allowed - - - - - False - - - - Cancel - Cancel - - - - - False - - - - Request modified - Request modified - - - - - False - - - - Sending Text message - Sending Text message - - - - - False - - - - SAT MESSAGE HEADER - SAT MESSAGE HEADER - - - - - False - - - - Back - Back - - - - - False - - - - No - No - - - - - False - - - - Sending… - Sending… - - - - - False - - - - Yes - Yes - - - - - False - - - - Make a choice... - Make a choice... - - - - - False - - - - Send - Send - - - - - False - - - - Not done - Not done - - - - - False - - - - SIM Services - SIM Services - - - - - False - - - - Enter:\n(1 digit 0-9) - Enter:\n(1 digit 0-9) - - - - - False - - - - Enternumber (1 digit 0-9) - Enternumber (1 digit 0-9) - - - - - False - - - - Requesting… - Requesting… - - - - - False - - - - Open connection? - Open connection? - - - - - False - - - - Sending data - Sending data - - - - - False - - - - Allow SIM card to send message? - Allow SIM card to send message? - - - - - False - - - - Connection closed - Connection closed - - - - - False - - - - OK - OK - - - - - False - - - - Allow SIM card to send a request to the network? - Allow SIM card to send a request to the network? - - - - - False - - - - Receiving data - Receiving data - - - - - False - - - - Enter: - Enter: - - - - - False - - - - Sending DTMF - Sending DTMF - - - - - False - - - - Sending\n%U - Sending\n%U - - - - - False - - - - Processing - Processing - - - - - False - - - - Request not allowed - Request not allowed - - - - - False - - - diff -r 1f002146abb4 -r cee7e9e0906c satui/satapp/satapp.pro --- a/satui/satapp/satapp.pro Tue Jul 06 14:53:02 2010 +0300 +++ b/satui/satapp/satapp.pro Wed Aug 18 10:19:22 2010 +0300 @@ -30,51 +30,49 @@ TARGET.UID3=0x101f4ce0 } +# enable this for tracing into a file (log/sat/satui.txt) +# DEFINES += SAT_DEBUG_TO_FILE +# LIBS += -lflogger - INCLUDEPATH += $$MW_LAYER_SYSTEMINCLUDE \ - .inc\ - MOC_DIR \ - ../../inc +INCLUDEPATH += $$MW_LAYER_SYSTEMINCLUDE \ + $$MOC_DIR \ + ../../inc - LIBS += -lSatClient \ - -lSatInternalClient \ - -legul \ - -lfbscli \ - -lcentralrepository \ - -lCenRepNotifHandler \ - -lCdlEngine \ - -lmediaclientaudio \ - -lFlogger \ - -lprofileeng +LIBS += -lSatClient \ + -lSatInternalClient \ + -legul \ + -lfbscli \ + -lcentralrepository \ + -lCenRepNotifHandler \ + -lCdlEngine \ + -lmediaclientaudio \ + -lprofileeng \ + -lbafl - HEADERS += inc/msatuiactionimplementer.h \ - inc/satappcommonconstant.h \ - inc/tflogger.h \ - inc/satappmainhandler.h \ - inc/satappcommandhandler.h \ - inc/satappeventprovider.h \ - inc/satappuiprovider.h \ - inc/satappview.h \ - inc/csatuiobserver.h \ - inc/csatuiiconhandler.h \ - inc/satappplaytoneprovider.h \ - inc/dialogwaiter.h +HEADERS += inc/satappmainhandler.h \ + inc/satappserverdispatcher.h \ + inc/satappmenuprovider.h \ + inc/satappinputprovider.h \ + inc/satapptoneprovider.h \ + inc/satapppopupprovider.h\ + inc/satappconfirmprovider.h \ + inc/satappaction.h \ + inc/satappconstant.h - SOURCES += src/main.cpp \ - src/satappmainhandler.cpp \ - src/satappcommandhandler.cpp \ - src/satappeventprovider.cpp \ - src/satappuiprovider.cpp \ - src/satappview.cpp \ - src/csatuiobserver.cpp \ - src/csatuiiconhandler.cpp \ - src/satappplaytoneprovider.cpp \ - src/dialogwaiter.cpp - - BLD_INF_RULES.prj_exports += "rom/satapp.iby CORE_MW_LAYER_IBY_EXPORT_PATH(satapp.iby)" \ - "rom/satapp_stub.sis /epoc32/data/z/system/install/satapp_stub.sis" \ - "resource/satapp_en.ts /epoc32/include/platform/qt/translations/satapp_en.ts" - +SOURCES += src/main.cpp \ + src/satappmainhandler.cpp \ + src/satappserverdispatcher.cpp \ + src/satappmenuprovider.cpp \ + src/satappinputprovider.cpp \ + src/satapptoneprovider.cpp \ + src/satapppopupprovider.cpp \ + src/satappconfirmprovider.cpp \ + src/satappaction.cpp + +BLD_INF_RULES.prj_exports += "rom/satapp.iby CORE_MW_LAYER_IBY_EXPORT_PATH(satapp.iby)" \ + "rom/satapp_stub.sis /epoc32/data/z/system/install/satapp_stub.sis" \ + "resource/satapp.ts /epoc32/include/platform/qt/translations/satapp.ts" + RESOURCES += resource/satapp.qrc diff -r 1f002146abb4 -r cee7e9e0906c satui/satapp/src/csatuiiconhandler.cpp --- a/satui/satapp/src/csatuiiconhandler.cpp Tue Jul 06 14:53:02 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,245 +0,0 @@ -/* -* Copyright (c) 2006-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" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Implementation of CSatUiIconHandler class. -* -*/ - -#include -#include -#include -#include - -#include "csatuiiconhandler.h" -#include "tflogger.h" - -// ============================ MEMBER FUNCTIONS ============================= - -// --------------------------------------------------------------------------- -// First part of Two-phased constructor. -// --------------------------------------------------------------------------- -// -CSatUiIconHandler* CSatUiIconHandler::NewL() - { - TFLOGSTRING( "CSatUiIconHandler::NewL enter" ) - CSatUiIconHandler* self = new ( ELeave ) CSatUiIconHandler; - TFLOGSTRING( "CSatUiIconHandler::NewL exit" ) - return self; - } - -// --------------------------------------------------------------------------- -// Destructor -// --------------------------------------------------------------------------- -// -CSatUiIconHandler::~CSatUiIconHandler() - { - TFLOGSTRING( "CSatUiIconHandler::~CSatUiIconHandler enter" ) - // Close RSatService interface - iSatService.Close(); - TFLOGSTRING( "CSatUiIconHandler::~CSatUiIconHandler exit" ) - } - -// --------------------------------------------------------------------------- -// Fetches first icon information, then the handle to the icon and at last -// does the duplication of the icon bitmap. Object is set to wait the -// completion of the request. -// --------------------------------------------------------------------------- -// -CFbsBitmap* CSatUiIconHandler::FetchIconL( const RSatSession& aSatSession, - const TUint8 aIconId, - const TInt aOptWidth, - const TInt aOptHeight, - TBool& aIconSupport ) - { - TFLOGSTRING( "CSatUiIconHandler::FetchIconL enter" ) - TFLOGSTRING3( "CSatUiIconHandler::FetchIconL aOptWidth=%d aOptHeight=%d", - aOptWidth, aOptHeight ) - - iSatService.OpenL( aSatSession ); - CleanupClosePushL( iSatService ); - - RIconEf iconEf; - CleanupClosePushL( iconEf ); - // Order of superiority list - RArray selectedIcons; - CleanupClosePushL( selectedIcons ); - CFbsBitmap* iconBitmap = NULL; - - // Getting the information of the icon - TRAPD( err, iSatService.GetIconInfoL( aIconId, iconEf ); ); - - if ( KErrNone == err ) - { - TFLOGSTRING( "CSatUiIconHandler::FetchIconL no error" ) - // Sorting into order of superiority - SortIconsL( iconEf, selectedIcons, aOptWidth, aOptHeight ); - - // Reset iconCount by approved icons - const TInt iconCount = selectedIcons.Count() <= iconEf.Count() ? - selectedIcons.Count() : - iconEf.Count(); - TBool fetchSuccess( EFalse ); - - TFLOGSTRING2( "CSatUiIconHandler::FetchIconL iconCount: %d", iconCount ) - // If there were icons to be fetched - if ( 0 < iconCount ) - { - // start going through approved icons list from the - // first and biggest icon - TInt counter( 0 ); - for ( counter = 0; ( counter < iconCount ) && !fetchSuccess; - counter++ ) - { - TInt selectedIconCounter = selectedIcons.operator[]( counter ); - TFLOGSTRING2( "CSatUiIconHandler::\ - FetchIconL selectedIconCounter: %d", selectedIconCounter ) - TRAPD( err, - iconBitmap = iSatService.GetIconL( iconEf.operator[]( - selectedIconCounter ) ) ); - if ( KErrNone == err ) - { - fetchSuccess = ETrue; - TFLOGSTRING( "CSatUiIconHandler::FetchIconL fetchSuccess!" ) - } - else - { - delete iconBitmap; - } - } - } - } - - TFLOGSTRING2( "CSatUiIconHandler::FetchIconL icon info error=%d", err ) - if ( KErrNotSupported == err ) - { - TFLOGSTRING( "CSatUiIconHandler::FetchIconL icons not supported" ) - aIconSupport = EFalse; - } - - // selectedIcons, iconEf and iSatService not deleted but closed - CleanupStack::PopAndDestroy( 3, &iSatService ); - - TFLOGSTRING( "CSatUiIconHandler::FetchIconL exit" ) - // Icon was not found, icons are not supported or an error was received. - return iconBitmap; - } - -// --------------------------------------------------------------------------- -// C++ default constructor cannot contain any code that might leave. -// --------------------------------------------------------------------------- -// -CSatUiIconHandler::CSatUiIconHandler() - { - TFLOGSTRING( "CSatUiIconHandler::CSatUiIconHandler enter - exit" ) - } - -// --------------------------------------------------------------------------- -// Sorts icons into order of superiority -// --------------------------------------------------------------------------- -// -void CSatUiIconHandler::SortIconsL( const RIconEf& aIconEf, - RArray& aSelectedIcons, const TInt aOptWidth, - const TInt aOptHeight ) const - { - TFLOGSTRING( "CSatUiIconHandler::SortIcons enter" ) - - const TInt iconCount = aIconEf.Count(); - TFLOGSTRING2( "CSatUiIconHandler::SortIcons iconCount=%d", iconCount ) - TInt counter( 0 ); - // Search icon from available iconarray - for ( counter = 0; counter < iconCount; counter++ ) - { - TFLOGSTRING3( "CSatUiIconHandler::SortIcons Icon Width=%d Height=%d", - aIconEf.operator[]( counter ).IconSize().iWidth, - aIconEf.operator[]( counter ).IconSize().iHeight ) - - const TInt selectedCount( aSelectedIcons.Count() ); - TBool replacement( EFalse ); - - // Count the difference of the icon versus layout - TInt newWidthDifference( - aOptWidth - aIconEf.operator[]( counter ).IconSize().iWidth ); - TInt newHeightDifference( - aOptHeight - aIconEf.operator[]( counter ).IconSize().iHeight ); - - // Make the difference absolute value - if ( newWidthDifference < 0 ) - { - newWidthDifference = -newWidthDifference; - } - - if ( newHeightDifference < 0 ) - { - newHeightDifference = -newHeightDifference; - } - TInt listCounter( 0 ); - // Going through the list of icons of suitable size - for ( listCounter = 0; ( listCounter < selectedCount ) && - !replacement; listCounter++ ) - { - - // Count the difference of the icon versus layout - TInt oldWidthDifference( aOptWidth - aIconEf.operator[]( - aSelectedIcons.operator[]( listCounter ) ).IconSize().iWidth ); - TInt oldHeightDifference( aOptHeight - aIconEf.operator[]( - aSelectedIcons.operator[]( listCounter ) ).IconSize().iHeight ); - - // Make the difference absolute value - if ( oldWidthDifference < 0 ) - { - oldWidthDifference = -oldWidthDifference; - } - - if ( oldHeightDifference < 0 ) - { - oldHeightDifference = -oldHeightDifference; - } - - // New icon is better either by being closer to the layout or by - // being same size and color instead of black and white - if ( ( ( newWidthDifference < oldWidthDifference ) && - ( newHeightDifference <= oldHeightDifference ) ) || - ( ( newWidthDifference <= oldWidthDifference ) && - ( newHeightDifference < oldHeightDifference ) ) || - ( ( newWidthDifference == oldWidthDifference ) && - ( newHeightDifference == oldHeightDifference ) && - ( TSatIconInfo::EBasic == aIconEf.operator[]( aSelectedIcons. - operator[]( listCounter ) ).CodingScheme() ) && - ( TSatIconInfo::EColor == aIconEf.operator[]( counter ). - CodingScheme() ) ) ) - { - TFLOGSTRING2( "CSatUiIconHandler::SortIcons \ - newWidthDifference: %d", newWidthDifference ) - TFLOGSTRING2( "CSatUiIconHandler::SortIcons \ - oldHeightDifference: %d", oldHeightDifference ) - // Insert new icon to correct place - aSelectedIcons.InsertL( counter, listCounter ); - replacement = ETrue; - } - } - - TFLOGSTRING2( "CSatUiIconHandler::SortIcons listCounter: %d", \ - listCounter ) - // Either first item or was not better than any in the list - // New icon is added to the end of the array - if ( !replacement ) - { - aSelectedIcons.AppendL( counter ); - } - } - - TFLOGSTRING2( "CSatUiIconHandler::SortIcons counter: %d", \ - counter ) - TFLOGSTRING( "CSatUiIconHandler::SortIcons exit" ) - } - diff -r 1f002146abb4 -r cee7e9e0906c satui/satapp/src/csatuiobserver.cpp --- a/satui/satapp/src/csatuiobserver.cpp Tue Jul 06 14:53:02 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1648 +0,0 @@ -/* -* 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" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: This class handles the communication between server and -* user interface -* -*/ - - -// INCLUDE FILES -#include -#include -#include -#include -#include -#include //for itemsicon -#include -#include - -#include "csatuiobserver.h" -#include "msatuiactionimplementer.h" -#include "csatuiiconhandler.h" -#include "tflogger.h" - -// CONSTANTS -const TInt KSatActiveProfileOffline = 5; // value from ProfileEngine - -// PlayTone durations -const TInt64 KSatDur170ms = 170000; // 170ms -const TInt64 KSatDur200ms = 200000; // 200ms -const TInt64 KSatDur250ms = 250000; // 250ms -const TInt64 KSatDur1200ms = 1200000; // 1200ms - -// play tone tones -_LIT8(KNetToneSeqNetBusy, "\x00\x11\x05\x4E\x30\x40\x30\x07\x0B"); - -_LIT8(KNetToneSeqNetCallWaiting, "\x00\x11\x05\x4E\x14\x40\x3C\x4E\x14\ -\x40\x64\x40\x64\x40\x64\x4E\x14\x40\x3C\x4E\x14\x40\x64\x40\x64\x40\x64\ -\x07\x0B"); - -_LIT8(KNetToneSeqNetCongestion, "\x00\x11\x05\x4E\x14\x40\x14\x07\x0B"); - -_LIT8(KNetToneSeqNetSpecialInformation, "\x00\x11\x05\x4F\x21\x50\ -\x21\x51\x21\x40\x64\x07\x0B"); - -_LIT8(KNetToneSeqDial,"\x00\x11\x05\x4E\xFE\x4E\xFE\x4E\xFE\x4E\xFE\x4E\xFE\ -\x4E\xFE\x4E\xFE\x4E\xFE\x07\x0B"); - -_LIT8(KNetToneSeqRingGoing, "\x00\x11\x05\x4E\x64\x05\x04\x40\x64\06\x07\x0B"); - -// General Beep is set for forever duration. Instead of AVKON definition 170ms. -_LIT8(KGeneralBeep, "\x00\x11\x0A\x76\x00\x0B"); -_LIT8(KErrorTone, "\x00\x11\x0A\x6C\x19\x0B"); -_LIT8(KRadioPathNotAvailable, "\x00\x11\x0A\x05\x03\x4E\x14\x40\x14\x06\x0B"); -_LIT8(KRadioPathAck, "\x00\x11\x0A\x02\xFC\x0A\x80\x4E\x14\x0A\x7f\x0B"); - -// ================= MEMBER FUNCTIONS ========================================= - -// ---------------------------------------------------------------------------- -// CSatUiObserver::CSatUiObserver -// (other items were commented in a header). -// ---------------------------------------------------------------------------- -// -CSatUiObserver::CSatUiObserver(): - iRefresh(EFalse), - iIconSupport(ETrue), - iClearScreenEvent(EFalse) - { - } - -// ---------------------------------------------------------------------------- -// CSatUiObserver::ConstructL -// (other items were commented in a header). -// ---------------------------------------------------------------------------- -// -void CSatUiObserver::ConstructL() - { - TFLOGSTRING("SATAPP: CSatUiObserver::ConstructL called") - TFLOGSTRING("SATAPP: CSatUiObserver::ConstructL exit") - } - -// ---------------------------------------------------------------------------- -// CSatUiObserver::NewL -// (other items were commented in a header). -// ---------------------------------------------------------------------------- -// -CSatUiObserver* CSatUiObserver::NewL() - { - TFLOGSTRING("SATAPP: CSatUiObserver::NewL() called") - CSatUiObserver* self = new (ELeave) CSatUiObserver; - - CleanupStack::PushL(self); - self->ConstructL(); - CleanupStack::Pop(self); - TFLOGSTRING("SATAPP: CSatUiObserver::NewL() exit") - return self; - } - -// ---------------------------------------------------------------------------- -// CSatUiObserver::~CSatUiObserver -// (other items were commented in a header). -// ---------------------------------------------------------------------------- -// -CSatUiObserver::~CSatUiObserver() - { - TFLOGSTRING("SATAPP: CSatUiObserver::~CSatUiObserver() called") - iActionImplementer = NULL; - iAdapter = NULL; - TFLOGSTRING("SATAPP: CSatUiObserver::~CSatUiObserver() exit") - } - -// ---------------------------------------------------------------------------- -// CSatUiObserver::SetImplementer -// Sets a pointer to CSatUiViewAppUi object. -// (other items were commented in a header). -// ---------------------------------------------------------------------------- -// -void CSatUiObserver::SetImplementer( - MSatUiActionImplementer* aImplementer) - { - TFLOGSTRING("SATAPP: CSatUiObserver::SetImplementer calling") - iActionImplementer = aImplementer; - TFLOGSTRING("SATAPP: CSatUiObserver::SetImplementer exiting") - } - -// ---------------------------------------------------------------------------- -// CSatUiObserver::Adapter -// Returns a pointer to MSatUiAdapter provided by SatCli. -// (other items were commented in a header). -// ---------------------------------------------------------------------------- -// -MSatUiAdapter* CSatUiObserver::Adapter() - { - TFLOGSTRING("SATAPP: CSatUiObserver::Adapter calling-exiting") - return iAdapter; - } - -// ---------------------------------------------------------------------------- -// CSatUiObserver::DisplayTextL -// Checks length of the text and calls method from -// the CSatUiViewAppUi class if the length is OK. -// (other items were commented in a header). -// ---------------------------------------------------------------------------- -// -TSatUiResponse CSatUiObserver::DisplayTextL( - const TDesC& aText, - const TDesC& aSimApplicationName, - const TSatIconId& aIconId, - TBool& aRequestedIconDisplayed, - const TBool aSustainedText, - const TTimeIntervalSeconds aDuration, - const TBool aWaitUserToClear) - { - TFLOGSTRING("SATAPP: CSatUiObserver::DisplayText called") - TSatUiResponse response(ESatFailure); - aRequestedIconDisplayed = ETrue; - TBool selfExplanatoryIcon(EFalse); - - TInt textLength(aText.Length()); - - if ((!textLength) || (textLength > RSat::KTextToDisplayMaxSize)) - { - TFLOGSTRING("SATAPP: CSatUiObserver::DisplayText no text") - aRequestedIconDisplayed = EFalse; - return response; - } - - CFbsBitmap* iconBitmapDisplayText = NULL; - iActionImplementer->SetCommandPending(ETrue); - - //if icon is available for command - if (((ESatSelfExplanatory == aIconId.iIconQualifier) || - (ESatNotSelfExplanatory == aIconId.iIconQualifier)) && - (iIconSupport)) - { - TFLOGSTRING("SATAPP: CSatUiObserver::DisplayText have icon") - iconBitmapDisplayText = FetchIcon(aIconId.iIdentifier, - EIconDisplayText); - - if (ESatSelfExplanatory == aIconId.iIconQualifier) - { - TFLOGSTRING("SATAPP: CSatUiObserver::DisplayText self \ - explanatory icon") - selfExplanatoryIcon = ETrue; - } - } - - //icon not found not shown - if (!iconBitmapDisplayText) - { - aRequestedIconDisplayed = EFalse; - } - - iActionImplementer->DispatchTimer(iWait); - - TFLOGSTRING2("CSatUiObserver::DisplayTextL aDuration: %d", aDuration.Int()) - TRAPD(err, - response = iActionImplementer->DisplayTextL(aText, aSimApplicationName, - iconBitmapDisplayText, selfExplanatoryIcon, - aSustainedText, aDuration, aWaitUserToClear); - ); - - if ( KErrNone != err ) - { - response = ESatFailure; - aRequestedIconDisplayed = EFalse; - } - - if ( iActionImplementer->GetEndKey() ) - { - response = ESatSessionTerminatedByUser; - iActionImplementer->SetEndKey( EFalse ); - } - - iActionImplementer->SetCommandPending( EFalse ); - - TFLOGSTRING2("SATAPP: CSatUiObserver::DisplayText exit, return: %d", \ - response) - return response; - } - -// ---------------------------------------------------------------------------- -// CSatUiObserver::GetInkeyL -// Checks type of the input wanted and calls right method -// from the CSatUiViewAppUi class. -// (other items were commented in a header). -// ---------------------------------------------------------------------------- -// -TSatUiResponse CSatUiObserver::GetInkeyL( - const TDesC& aText, - const TSatCharacterSet aCharacterSet, - TChar& aInput, - const TBool /*aHelpIsAvailable*/, - const TSatIconId& aIconId, - TBool& aRequestedIconDisplayed, - TUint& aDuration, - const TBool aImmediateDigitResponse) - { - TFLOGSTRING("SATAPP: CSatUiObserver::GetInkey called") - - TSatUiResponse response(ESatSuccess); - aRequestedIconDisplayed = EFalse; - TBuf<1> input; - - if (aInput.IsAssigned()) - { - input.Fill(aInput, 1); - } - - if ( ( ESatYesNo == aCharacterSet ) && (aText.Length() == 0) ) - { - TFLOGSTRING("SATAPP: CSatUiObserver::GetInkey return ESatFailure") - return ESatFailure; - } - - CFbsBitmap* iconBitmapGetInkey = NULL; - iActionImplementer->SetCommandPending(ETrue); - - // If icon is available for command - if (((ESatSelfExplanatory == aIconId.iIconQualifier) || - (ESatNotSelfExplanatory == aIconId.iIconQualifier)) && - (iIconSupport)) - { - TFLOGSTRING("SATAPP: CSatUiObserver::GetInkey have icon") - TIconCommand iconCommand (EIconGetInkey); - - if (ESatYesNo == aCharacterSet) - { - iconCommand = EIconGetYesNo; - } - - iconBitmapGetInkey = FetchIcon(aIconId.iIdentifier, - iconCommand); - GetScalableBitmap(iconBitmapGetInkey, iconCommand, - aRequestedIconDisplayed); - } - - TBool selfExplanatory(EFalse); - - // Icon is self-explanatory - if (ESatSelfExplanatory == aIconId.iIconQualifier) - { - selfExplanatory = ETrue; - } - - iActionImplementer->DispatchTimer(iWait); - - TRAPD(err, - - if (ESatYesNo == aCharacterSet || aImmediateDigitResponse) - { - TFLOGSTRING("SATAPP: CSatUiObserver::GetInkey digit response") - response = iActionImplementer->GetYesNoL(aText, aCharacterSet, - aInput, iconBitmapGetInkey, selfExplanatory, aDuration, - aImmediateDigitResponse); - } - else //ESatCharSmsDefaultAlphabet, ESatCharUcs2Alphabet, ESatDigitOnly - { - TFLOGSTRING("SATAPP: CSatUiObserver::GetInkey other conditions") - response = iActionImplementer->GetInputL( - aText, aCharacterSet, input, 1, 1, EFalse, ETrue, - iconBitmapGetInkey, selfExplanatory, aDuration); - - if ( ESatSuccess == response && input.Length() ) - { - aInput = input[0]; - } - } - ); - - if ( KErrNone != err ) - { - response = ESatFailure; - } - - if (iActionImplementer->GetEndKey()) - { - response = ESatSessionTerminatedByUser; - iActionImplementer->SetEndKey(EFalse); - } - iActionImplementer->SetCommandPending(EFalse); - - TFLOGSTRING2("SATAPP: CSatUiObserver::GetInkey exit, return: %d", \ - response) - return response; - } - -// -------------------------------------------------------- -// CSatUiObserver::GetInputL -// Checks type of the input wanted and whether it should be -// hidden and calls right method from the CSatUiViewAppUi class. -// (other items were commented in a header). -// ---------------------------------------------------------------------------- -// -TSatUiResponse CSatUiObserver::GetInputL( - const TDesC& aText, - const TSatCharacterSet aCharacterSet, - TDes& aInput, - const TInt aMinLength, - const TInt aMaxLength, - const TBool aHideInput, - const TBool /*aHelpIsAvailable*/, - const TSatIconId& aIconId, - TBool& aRequestedIconDisplayed) - { - TFLOGSTRING("SATAPP: CSatUiObserver::GetInput called") - TSatUiResponse response(ESatSuccess); - aRequestedIconDisplayed = EFalse; - - if (((aCharacterSet == ESatCharSmsDefaultAlphabet) || - (aCharacterSet == ESatCharUcs2Alphabet)) && - (aHideInput)) - { - TFLOGSTRING("SATAPP: CSatUiObserver::GetInput return ESatFailure") - return ESatFailure; - } - - CFbsBitmap* iconBitmapGetInput = NULL; - iActionImplementer->SetCommandPending(ETrue); - - // If icon is available for command - if (((ESatSelfExplanatory == aIconId.iIconQualifier) || - (ESatNotSelfExplanatory == aIconId.iIconQualifier)) && - (iIconSupport)) - { - iconBitmapGetInput = FetchIcon(aIconId.iIdentifier, EIconGetInput); - GetScalableBitmap(iconBitmapGetInput, EIconGetInput, - aRequestedIconDisplayed); - } - - TBool selfExplanatory(EFalse); - - // Icon is self-explanatory - if (ESatSelfExplanatory == aIconId.iIconQualifier) - { - selfExplanatory = ETrue; - } - - iActionImplementer->DispatchTimer(iWait); - - TUint duration (0); - TRAPD(err, - response = iActionImplementer->GetInputL( - aText, aCharacterSet, aInput, aMinLength, aMaxLength, - aHideInput, EFalse, iconBitmapGetInput, selfExplanatory, - duration); - ); - - if ( KErrNone != err ) - { - TFLOGSTRING2("SATAPP: CSatUiObserver::GetInput err:%d", err) - response = ESatFailure; - aRequestedIconDisplayed = EFalse; - } - - if (iActionImplementer->GetEndKey()) - { - response = ESatSessionTerminatedByUser; - iActionImplementer->SetEndKey(EFalse); - } - iActionImplementer->SetCommandPending(EFalse); - - TFLOGSTRING2("SATAPP: CSatUiObserver::GetInput response:%d", response) - TFLOGSTRING2("SATAPP: CSatUiObserver::GetInput aRequestedIconDisplayed:%d", - aRequestedIconDisplayed) - TFLOGSTRING("SATAPP: CSatUiObserver::GetInput exit") - return response; - } - -// ---------------------------------------------------------------------------- -// CSatUiObserver::SetUpMenuL -// Calls the method from the CSatUiViewAppUi class to show -// a SetUpMenu view. -// (other items were commented in a header). -// ---------------------------------------------------------------------------- -// -TSatUiResponse CSatUiObserver::SetUpMenuL( - const TDesC& aText, - const MDesCArray& aMenuItems, - const CArrayFixFlat* aMenuItemNextActions, - const TBool aHelpIsAvailable, - const TSatIconId& aIconId, - const CArrayFixFlat* aMenuIcons, - const enum TSatIconQualifier aIconListQualifier, - const enum TSatSelectionPreference /*aSelectionPreference*/) - { - TFLOGSTRING("SATAPP: CSatUiObserver::SetUpMenu called") - TSatUiResponse response(ESatSuccess); - TBool selfExplanatoryItems(EFalse); - CFbsBitmap* iconTitleBitmap = NULL; - iActionImplementer->SetCommandPending(ETrue); - - TFLOGSTRING2("SATAPP: CSatUiObserver::SetUpMenu item count: %d", - aMenuItems.MdcaCount()) - - if (!aMenuItems.MdcaCount() || - (KSatActiveProfileOffline == ProfileState())) - { - iActionImplementer->SetCommandPending(EFalse); - iActionImplementer->ShowNotAvailableNoteL(); - iActionImplementer->CloseSatUI(); - return response; - } - - //if contextpane icon available for command - TFLOGSTRING2("SATAPP: CSatUiObserver::SetUpMenu icon qua: %d", - aIconId.iIconQualifier) - if (((ESatSelfExplanatory == aIconId.iIconQualifier) || - (ESatNotSelfExplanatory == aIconId.iIconQualifier)) && - (iIconSupport)) - { - iconTitleBitmap = FetchIcon(aIconId.iIdentifier, - EIconSetUpMenuContext); - GetScalableBitmap(iconTitleBitmap, EIconSetUpMenuContext); - } - - TInt iconCount(0); - - if (aMenuIcons) - { - iconCount = aMenuIcons->Count(); - TFLOGSTRING2("SATAPP: CSatUiObserver::SetUpMenu icon count: %d", iconCount) - } - - - //if icons are available for item list - if ((aMenuItems.MdcaCount() == iconCount) && - ((aIconListQualifier == ESatSelfExplanatory) || - (aIconListQualifier == ESatNotSelfExplanatory)) && - (iIconSupport)) - { - TFLOGSTRING("SATAPP: CSatUiObserver::SetUpMenu have icon") - if (aIconListQualifier == ESatSelfExplanatory) - { - selfExplanatoryItems = ETrue; - } - - TBool continueLoop(ETrue); - TInt count(0); - for (count = 0; (count < iconCount) && continueLoop; count++) - { - CGulIcon* gulIcon = CGulIcon::NewLC(); - TUint8 itemIconId(STATIC_CAST(TUint8, - aMenuIcons->operator[](count))); - CFbsBitmap* iconItemBitmap = NULL; - iconItemBitmap = FetchIcon(itemIconId, EIconSetUpMenuItems); - - if (!iconItemBitmap && - (ESatSelfExplanatory == aIconListQualifier)) - { - TFLOGSTRING("SATAPP: CSatUiObserver::SetUpMenu \ - SelfExplanatory ") - CleanupStack::PopAndDestroy(gulIcon); // gulIcon - continueLoop = EFalse; - } - else - { - if (!iconItemBitmap && - (ESatNotSelfExplanatory == aIconListQualifier)) - { - TFLOGSTRING("SATAPP: CSatUiObserver::SetUpMenu \ - not SelfExplanatory ") - iconItemBitmap = new(ELeave)CFbsBitmap(); - } - else - { - TFLOGSTRING("SATAPP: CSatUiObserver::SetUpMenu \ - other conditions ") - GetScalableBitmap(iconItemBitmap, EIconSetUpMenuItems); - } - - gulIcon->SetBitmap(iconItemBitmap); - CleanupStack::Pop(gulIcon); - } - } - TFLOGSTRING2("SATAPP: CSatUiObserver::SetUpMenu count: %d", count) - } - - TRAPD(err, - response = iActionImplementer->SetUpMenuL( - aText, aMenuItems, aMenuItemNextActions, iconTitleBitmap, - /*iItemIcons,*/ selfExplanatoryItems, aHelpIsAvailable); - ); - - TFLOGSTRING2("SATAPP: CSatUiObserver::SetUpMenu err: %d", err) - - if (KErrNone != err) - { - response = ESatFailure; - } - - if (iActionImplementer->GetEndKey()) - { - response = ESatSessionTerminatedByUser; - iActionImplementer->SetEndKey(EFalse); - } - - iActionImplementer->SetCommandPending(EFalse); - TFLOGSTRING2("SATAPP: CSatUiObserver::SetUpMenu exit, \ - return:%i", response) - return response; - } - -// ---------------------------------------------------------------------------- -// CSatUiObserver::SelectItemL -// Calls the method from the CSatUiViewAppUi class to show -// a SelectItem view. -// (other items were commented in a header). -// ---------------------------------------------------------------------------- -// -TSatUiResponse CSatUiObserver::SelectItemL( - const TDesC& aText, - const MDesCArray& aMenuItems, - const CArrayFixFlat* aMenuItemNextActions, - const TInt aDefaultItem, - TUint8& aSelection, - const TBool aHelpIsAvailable, - const TSatIconId& aIconId, - const CArrayFixFlat* aMenuIcons, - const enum TSatIconQualifier aIconListQualifier, - TBool& aRequestedIconDisplayed, - const enum TSatSelectionPreference /*aSelectionPreference*/) - { - TFLOGSTRING("SATAPP: CSatUiObserver::SelectItem called") - TSatUiResponse response(ESatSuccess); - aRequestedIconDisplayed = ETrue; - TBool selfExplanatoryItems(EFalse); - - CFbsBitmap* iconTitleBitmap = NULL; - iActionImplementer->SetCommandPending(ETrue); - - //if contextpane icon available for command - if (((ESatSelfExplanatory == aIconId.iIconQualifier) || - (ESatNotSelfExplanatory == aIconId.iIconQualifier)) && - (iIconSupport)) - { - TFLOGSTRING("SATAPP: CSatUiObserver::SelectItem icon available") - iconTitleBitmap = FetchIcon(aIconId.iIdentifier, - EIconSetUpMenuContext); - GetScalableBitmap(iconTitleBitmap, EIconSetUpMenuContext, - aRequestedIconDisplayed); - } - - TInt iconCount(0); - - if (aMenuIcons) - { - iconCount = aMenuIcons->Count(); - } - - TFLOGSTRING2("SATAPP: CSatUiObserver::SelectItem iconCount:%d", iconCount) - - //if icons are available for item list - if ((aMenuItems.MdcaCount() == iconCount) && - ((ESatSelfExplanatory == aIconListQualifier) || - (ESatNotSelfExplanatory == aIconListQualifier)) && - (iIconSupport)) - { - TFLOGSTRING( - "SATAPP: CSatUiObserver::SelectItem icon available for item list") - - if (ESatSelfExplanatory == aIconListQualifier) - { - selfExplanatoryItems = ETrue; - } - - TBool continueLoop(ETrue); - TInt count(0); - for (count = 0; (count < iconCount) && continueLoop; count++) - { - CGulIcon* gulIcon = CGulIcon::NewLC(); - TUint8 itemIconId = STATIC_CAST(TUint8, - aMenuIcons->operator[](count)); - CFbsBitmap* iconItemBitmap = NULL; - iconItemBitmap = FetchIcon(itemIconId, EIconSetUpMenuItems); - - // when icon can't be received and is set to self explanatory, we - // iqnore all icons and show only text - if (!iconItemBitmap && - (aIconListQualifier == ESatSelfExplanatory)) - { - TFLOGSTRING("SATAPP: CSatUiObserver::SelectItem \ - SelfExplanatory ") - continueLoop = EFalse; - aRequestedIconDisplayed = EFalse; - } - else - { - // when icon can't be received and is set to not self - // explanatory, we replace it with empty icon - if (!iconItemBitmap && - (ESatNotSelfExplanatory == aIconListQualifier)) - { - TFLOGSTRING("SATAPP: CSatUiObserver::SelectItem \ - not SelfExplanatory ") - iconItemBitmap = new(ELeave)CFbsBitmap(); - aRequestedIconDisplayed = EFalse; - } - // when icon was able to receive, we scale it - // if every prior icon is correctly received - else if (aRequestedIconDisplayed) - { - TFLOGSTRING("SATAPP: CSatUiObserver::SelectItem \ - receive icon ") - GetScalableBitmap(iconItemBitmap, EIconSetUpMenuItems, - aRequestedIconDisplayed); - } - // if aRequestIconDisplayed is false, at least one prior icon - // fetch had problems and thus we must report that by not - // updating aRequestedIconDisplayed - else - { - TFLOGSTRING("SATAPP: CSatUiObserver::SelectItem \ - aRequestIconDisplayed false ") - GetScalableBitmap(iconItemBitmap, EIconSetUpMenuItems); - } - - gulIcon->SetBitmap(iconItemBitmap); - CleanupStack::Pop(gulIcon); - } - } - TFLOGSTRING2("SATAPP: CSatUiObserver::SelectItem count: %d", count) - } - - TRAPD(err, - response = iActionImplementer->SelectItemL(aText, aMenuItems, - aMenuItemNextActions, aDefaultItem, aSelection, iconTitleBitmap, - /*iItemIcons,*/ selfExplanatoryItems, aHelpIsAvailable); - ); - - if (KErrNone != err) - { - response = ESatFailure; - aRequestedIconDisplayed = EFalse; - } - - if (iActionImplementer->GetEndKey()) - { - response = ESatSessionTerminatedByUser; - iActionImplementer->SetEndKey(EFalse); - } - - iActionImplementer->SetCommandPending(EFalse); - - TFLOGSTRING2("SATAPP: CSatUiObserver::SelectItem aSelection:%d", aSelection) - TFLOGSTRING2("SATAPP: CSatUiObserver::SelectItem response:%d", response) - TFLOGSTRING("SATAPP: CSatUiObserver::SelectItem exit") - return response; - } - -// ---------------------------------------------------------------------------- -// CSatUiObserver::PlayTone -// Checks type of the tone wanted and calls right method -// from the CSatUiViewAppUi class. -// (other items were commented in a header). -// ---------------------------------------------------------------------------- -// -TSatUiResponse CSatUiObserver::PlayTone( - const TDesC& aText, - const TSatTone aTone, - const TTimeIntervalMicroSeconds aDuration, - const TSatIconId& aIconId, - TBool& aRequestedIconDisplayed) - { - TFLOGSTRING("SATAPP: CSatUiObserver::PlayTone called") - TFLOGSTRING2("SATAPP: CSatUiObserver::PlayTone tone is %i", aTone) - - aRequestedIconDisplayed = EFalse; - - iSequence.Zero(); - TTimeIntervalMicroSeconds duration(aDuration.Int64()); - iActionImplementer->SetCommandPending(ETrue); - // This is used to determine zero length duration. - const TTimeIntervalMicroSeconds zeroDuration(static_cast(0)); - - CFbsBitmap* iconBitmap = NULL; - // If icon is available for command - if (((ESatSelfExplanatory == aIconId.iIconQualifier) || - (ESatNotSelfExplanatory == aIconId.iIconQualifier)) && - (iIconSupport)) - { - iconBitmap = FetchIcon(aIconId.iIdentifier, EIconPlayTone); - GetScalableBitmap(iconBitmap, EIconPlayTone, - aRequestedIconDisplayed); - } - - TBool selfExplanatory(EFalse); - - // Icon is self-explanatory - if (ESatSelfExplanatory == aIconId.iIconQualifier) - { - selfExplanatory = ETrue; - } - - // Check if the current Profile is Meeting - TInt errCR(KErrNone); - TInt profileId(0); - - CRepository* repository = NULL; - TSatTone tone = aTone; - - // Which UID to monitor. - TRAP(errCR, repository = CRepository::NewL(KCRUidProfileEngine)); - - if (!errCR && repository) - { - errCR = repository->StartTransaction( - CRepository::EReadWriteTransaction); - errCR = repository->Get(KProEngActiveProfile, profileId); - } - - delete repository; - - TFLOGSTRING2("SATAPP: CSatUiObserver::PlayTone(): err = %d", errCR) - - TFLOGSTRING2("SCSatUiObserver::PlayTone() profileId: %d", - profileId) - - switch (tone) - { - case ESatGeneralBeep: - case ESatPositiveTone: - case ESatToneNotSet: - if (zeroDuration == duration) - { - duration = KSatDur170ms; // 170ms - } - iSequence.Copy(KGeneralBeep); - break; - case ESatNegativeTone: - if (zeroDuration == duration) - { - duration = KSatDur250ms; // 250ms - } - iSequence.Copy(KErrorTone); - break; - case ESatRadioPathNotAvailableCallDropped: - if (zeroDuration == duration) - { - duration = KSatDur1200ms; // 1200ms - } - iSequence.Copy(KRadioPathNotAvailable); - break; - case ESatRadioPathAcknowledge: - if (zeroDuration == duration) - { - duration = KSatDur200ms; // 200ms - } - iSequence.Copy(KRadioPathAck); - break; - case ESatDialTone: - { - if (zeroDuration == duration) - { - TFLOGSTRING("SATAPP: CSatUiObserver::PlayTone() ESatDialTone") - return ESatCmdDataNotUnderstood; - } - else - { - iSequence.Copy(KNetToneSeqDial); - } - } - break; - case ESatCalledSubscriberBusy: - { - if (zeroDuration == duration) - { - return ESatCmdDataNotUnderstood; - } - else - { - iSequence.Copy(KNetToneSeqNetBusy); - } - } - break; - case ESatCongestion: - { - if (zeroDuration == duration) - { - return ESatCmdDataNotUnderstood; - } - else - { - iSequence.Copy(KNetToneSeqNetCongestion); - } - } - break; - case ESatErrorSpecialInfo: - { - if (zeroDuration == duration) - { - return ESatCmdDataNotUnderstood; - } - else - { - iSequence.Copy(KNetToneSeqNetSpecialInformation); - } - } - break; - case ESatCallWaitingTone: - { - if (zeroDuration == duration) - { - return ESatCmdDataNotUnderstood; - } - else - { - iSequence.Copy(KNetToneSeqNetCallWaiting); - } - } - break; - case ESatRingingTone: - { - if (zeroDuration == duration) - { - return ESatCmdDataNotUnderstood; - } - else - { - iSequence.Copy(KNetToneSeqRingGoing); - } - } - break; - case ESatUserSelectedToneIncomingSpeech: - case ESatUserSelectedToneIncomingSms: - { - // These are handled later. - } - break; - default: - TFLOGSTRING("SATAPP: CSatUiObserver::PlayTone Default") - return ESatCmdDataNotUnderstood; - } - - TSatUiResponse response(ESatFailure); - - iActionImplementer->DispatchTimer(iWait); - - // ESatSClearScreenEvent doesn't occur,clear displaytext on screen. - if (EFalse == iClearScreenEvent) - { - // Clear displaytext on the screen. - TFLOGSTRING("SATAPP: CSatUiObserver::PlayTone clear screen") - iActionImplementer->ClearScreen(); - } - - if (0 != iSequence.Length()) - { - TFLOGSTRING2("SATAPP: CSatUiObserver::PlayTone duration microseconds %d", - aDuration.Int64()) - TRAPD(err, - response = iActionImplementer->PlayStandardToneL( - aText, - iSequence, - duration, - iconBitmap, - selfExplanatory); - ); - - if (KErrNone != err) - { - response = ESatFailure; - TFLOGSTRING2("SATAPP: CSatUiObserver::PlayTone error %i", err) - } - TFLOGSTRING("SATAPP: CSatUiObserver::PlayTone StandardTone exit") - } - else - { - TFLOGSTRING("SATAPP: CSatUiObserver::PlayTone length of sequence \ - is zero") - - TRAPD(err, - response = iActionImplementer->PlayUserSelectedToneL( - aText, - aDuration.Int64(), - tone, - iconBitmap, - selfExplanatory); - ); - - if (KErrNone != err) - { - response = ESatFailure; - TFLOGSTRING2("SATAPP: CSatUiObserver::PlayTone error %i", err) - } - - TFLOGSTRING("SATAPP: CSatUiObserver::PlayTone UserSelectedTone exit") - } - - if (iActionImplementer->GetEndKey()) - { - response = ESatSessionTerminatedByUser; - iActionImplementer->SetEndKey(EFalse); - } - - iActionImplementer->SetCommandPending(EFalse); - - TFLOGSTRING("SATAPP: CSatUiObserver::PlayTone iClearScreenEvent false") - iClearScreenEvent = EFalse; - - TFLOGSTRING2("SATAPP: CSatUiObserver::PlayTone response: %d", response) - TFLOGSTRING("SATAPP: CSatUiObserver::PlayTone exit") - return response; - } - -// ---------------------------------------------------------------------------- -// CSatUiObserver::ConfirmCommand -// (other items were commented in a header). -// ---------------------------------------------------------------------------- -// -void CSatUiObserver::ConfirmCommand( - const TSatSQueryCommand aCommandId, - const TSatAlphaIdStatus aAlphaIdStatus, - const TDesC& aText, - const TDesC& aAdditionalText, - TBool& aActionAccepted, - const TSatIconId& aIconId, - TBool& aRequestedIconDisplayed, - TBool& aTerminatedByUser) - { - TFLOGSTRING("SATAPP: CSatUiObserver::ConfirmCommand calling") - aRequestedIconDisplayed = EFalse; - TInt error(KErrNone); - TBool selfExplanatory(EFalse); - - // Icon is self-explanatory - if (ESatSelfExplanatory == aIconId.iIconQualifier) - { - selfExplanatory = ETrue; - } - - aActionAccepted = ETrue; - - iActionImplementer->SetCommandPending(ETrue); - - iActionImplementer->StopShowWaitNote(); - - CFbsBitmap* iconBitmap = NULL; - // If icon is available for command - if ((((ESatSelfExplanatory == aIconId.iIconQualifier) || - (ESatNotSelfExplanatory == aIconId.iIconQualifier)) && - ((ESatOpenChannelQuery == aCommandId) || - (ESatSLaunchBrowserQuery == aCommandId) || - (ESatSSetUpCallQuery == aCommandId))) && - (iIconSupport)) - { - iconBitmap = FetchIcon(aIconId.iIdentifier, - EIconConfirmCommand); - GetScalableBitmap(iconBitmap, EIconConfirmCommand, - aRequestedIconDisplayed); - } - TFLOGSTRING2("SATAPP: CSatUiObserver::ConfirmCommand aCommandId: %d", - aCommandId) - // Check quering command - switch (aCommandId) - { - case ESatOpenChannelQuery: - { - TFLOGSTRING("Quering OpenChannel") - TRAP(error, iActionImplementer->ConfirmOpenChannelL( - aText, aActionAccepted, iconBitmap, selfExplanatory)); - break; - } - - case ESatSRefreshQuery: - { - TFLOGSTRING("Quering Refresh") - //TRAP(error, iActionImplementer->ConfirmRefreshL(aActionAccepted)); - break; - } - - case ESatSLaunchBrowserQuery: - { - TFLOGSTRING("Quering LaunchBrowser") - //HBufC* textHolder = NULL; - - TRAP(error, - if (ESatAlphaIdNull != aAlphaIdStatus) - { - TFLOGSTRING("CSatUiObserver::ConfirmCommand AlphaId \ - isn't null") - if (ESatAlphaIdNotProvided == aAlphaIdStatus) - { - TFLOGSTRING("CSatUiObserver::ConfirmCommand \ - AlphaId not provided") - // ToDo: replace the resouce with qt. - //textHolder = StringLoader::LoadLC( - // R_QTN_SAT_CONF_LAUNCH_BROW, - // iActionImplementer->CoeEnv()); - } - else - { - TFLOGSTRING("CSatUiObserver::ConfirmCommand \ - AlphaId provided") - //textHolder = HBufC::NewLC(aText.Length()); - //TPtr ptr = textHolder->Des(); - //ptr.Append(aText); - } - - //TRAP(error, iActionImplementer->ConfirmLaunchBrowserL(*textHolder, - // aActionAccepted, iconBitmap, selfExplanatory)); - - // Clean textHolder - //CleanupStack::PopAndDestroy(textHolder); - } - - ); // TRAP - break; - } - - case ESatSSendSmQuery: - { - TFLOGSTRING( "Quering SendSm" ) - TRAP( error, iActionImplementer->ConfirmSendL( aText, - aActionAccepted, ESatUiConfirmSendSms ) ); - break; - } - - case ESatSSendSsQuery: - { - TFLOGSTRING(" Quering SendSs") - TRAP(error, iActionImplementer->ConfirmSendL(aText, - aActionAccepted, ESatUiConfirmSendSs)); - break; - } - - case ESatSSendUssdQuery: - { - TFLOGSTRING(" Quering SendUssd") - TRAP(error, iActionImplementer->ConfirmSendL(aText, - aActionAccepted, ESatUiConfirmSendUssd)); - break; - } - - case ESatSSetUpCallQuery: - { - TFLOGSTRING(" Quering SetUpCall") - TRAP(error, iActionImplementer->ConfirmSetUpCallL( - aText, aAdditionalText, aActionAccepted, iconBitmap, - selfExplanatory)); - break; - } - - default: - { - TFLOGSTRING(" Unknown quering command") - aActionAccepted = EFalse; - } - } - - if (KErrNone != error) - { - TFLOGSTRING2("SATAPP: CSatUiObserver::ConfirmCommand error:%d", error) - aActionAccepted = EFalse; - } - else if (iActionImplementer->GetEndKey()) - { - TFLOGSTRING("SATAPP: CSatUiObserver::ConfirmCommand press endkey") - aTerminatedByUser = ETrue; - aActionAccepted = EFalse; - iActionImplementer->SetEndKey(EFalse); - } - - iActionImplementer->SetCommandPending(EFalse); - TFLOGSTRING("SATAPP: CSatUiObserver::ConfirmCommand exiting") - } - -// ---------------------------------------------------------------------------- -// CSatUiObserver::Notification -// (other items were commented in a header). -// ---------------------------------------------------------------------------- -// -TSatUiResponse CSatUiObserver::Notification( - const TSatSNotifyCommand aCommandId, - const TSatAlphaIdStatus aAlphaIdStatus, - const TDesC& aText, - const TSatIconId& aIconId, - TBool& aRequestedIconDisplayed, - const TSatControlResult aControlResult) - { - TFLOGSTRING("SATAPP: CSatUiObserver::Notification calling") - TFLOGSTRING2("SATAPP: CSatUiObserver::Notification str=%S", &aText) - TSatUiResponse response = ESatSuccess; - TInt error(KErrNone); - aRequestedIconDisplayed = EFalse; - iActionImplementer->SetCommandPending(ETrue); - - HBufC* textHolder = NULL; - QString resource; - // In case where command id is SendDtmf and alphaID is not provided, - // DTMF string to be sent is shown in dialog along with default text. - if ((ESatSSendDtmfNotify == aCommandId) && - (ESatAlphaIdNotProvided == aAlphaIdStatus)) { - TFLOGSTRING("SATAPP: CSatUiObserver::Notification SendDtmf") - DefaultAlphaId(aCommandId, aControlResult,resource); - if ( resource.length()>0) - { - TFLOGSTRING("SATAPP: CSatUiObserver::Notification SendDtmf resource") - TRAP(error, textHolder = HBufC::NewL(resource.length())); - if (KErrNone == error) - { - textHolder->Des().Copy(reinterpret_cast - (resource.utf16())); - } - } - } - // Get default text, if alpha not provided or it is NULL - else if (aText.Length() == 0 && ESatAlphaIdNotNull != aAlphaIdStatus) - { - TFLOGSTRING("SATAPP: CSatUiObserver::Notification alpha is null") - DefaultAlphaId(aCommandId, aControlResult,resource); - if ( resource.length()>0) - { - TFLOGSTRING("SATAPP: CSatUiObserver::Notification alpha null resource") - TRAP( error, textHolder = HBufC::NewL(resource.length()) ); - if (KErrNone == error) - { - textHolder->Des().Copy(reinterpret_cast - (resource.utf16())); - } - } - TFLOGSTRING("SATAPP: CSatUiObserver::Notification alpha is null out") - } - // else use given text - else - { - TFLOGSTRING("SATAPP: CSatUiObserver::Notification alpha is provided") - TRAP(error, - textHolder = HBufC::NewL(aText.Length()); - TPtr ptr = textHolder->Des(); - ptr.Copy(aText); - ); - } - if (!textHolder) - { - TFLOGSTRING("SATAPP: CSatUiObserver::Notification textHolder 0") - TRAP(error, textHolder = HBufC::NewL(0)); - } - - // No need to add textHolder into CleanupStack, since this is - // not a leaving function - - if ((KErrNone == error) && textHolder) - { - TFLOGSTRING("SATAPP: CSatUiObserver::Notification none error ") - CFbsBitmap* iconBitmap = NULL; - TBool selfExplanatoryIcon(EFalse); - // Fetch icon - // Icons not supported for sending and receiving data - if ((((ESatSelfExplanatory == aIconId.iIconQualifier) || - (ESatNotSelfExplanatory == aIconId.iIconQualifier)) && - ((ESatSSendDataNotify != aCommandId) && - (ESatSReceiveDataNotify != aCommandId))) && - (iIconSupport)) - { - iconBitmap = FetchIcon(aIconId.iIdentifier, - EIconNotification); - } - - if (ESatSelfExplanatory == aIconId.iIconQualifier) - { - selfExplanatoryIcon = ETrue; - } - - // Check notifying command - switch (aCommandId) - { - case ESatSSendDataNotify: - { - TFLOGSTRING(" Notifying SendData") - TRAP(error, - iActionImplementer->ShowBIPNoteL( - ESendDataIdentier, *textHolder, iconBitmap, - selfExplanatoryIcon) - ); - break; - } - case ESatSReceiveDataNotify: - { - TFLOGSTRING(" Notifying ReceiveData") - TRAP(error, - iActionImplementer->ShowBIPNoteL( - EReceiveDataIdentifier, *textHolder, iconBitmap, - selfExplanatoryIcon) - ); - break; - } - case ESatSCloseChannelNotify: - { - TFLOGSTRING(" Notifying CloseChannel") - iActionImplementer->StopShowWaitNote(); - TRAP(error, - iActionImplementer->ShowBIPNoteL( - ECloseChannelIdentifier, *textHolder, iconBitmap, - selfExplanatoryIcon) - ); - break; - } - case ESatSMoSmControlNotify: - { - TFLOGSTRING(" Notifying MoSmControl") - TRAP(error, - iActionImplementer->MoSmControlL( - *textHolder, aAlphaIdStatus) - ); - iActionImplementer->SetCommandPending(EFalse); - break; - } - case ESatSCallControlNotify: - { - TFLOGSTRING(" Notifying CallControl") - iActionImplementer->DispatchTimer(iWait); - TRAP(error, - iActionImplementer->CallControlL( - *textHolder, aAlphaIdStatus) - ); - iActionImplementer->SetCommandPending(EFalse); - break; - } - case ESatSSendUssdNotify: // fall through - case ESatSSendSsNotify: - { - TFLOGSTRING(" Notifying SendSs / SendUssd") - iActionImplementer->StopShowWaitNote(); - TRAP(error, - if ((ESatAlphaIdNotNull == aAlphaIdStatus) || - (ESatAlphaIdNotProvided == aAlphaIdStatus)) - { - iActionImplementer->ShowSsWaitNoteL(*textHolder, - iconBitmap, selfExplanatoryIcon); - } - else - { - iActionImplementer->ShowWaitNoteWithoutDelayL(); - } - ); - break; - } - case ESatSSendDtmfNotify: - { - TFLOGSTRING(" Notifying SendDtmf") - iActionImplementer->StopShowWaitNote(); - TRAP(error, response = iActionImplementer->ShowDtmfWaitNoteL( - *textHolder, iconBitmap, selfExplanatoryIcon)); - break; - } - case ESatSSendSmsNotify: - { - TFLOGSTRING(" Notifying SendSms") - iActionImplementer->StopShowWaitNote(); - - if (KErrNone == error) - { - // Show Sms wait note - TRAP(error, - iActionImplementer->ShowSmsWaitNoteL(*textHolder, - iconBitmap, selfExplanatoryIcon)); - } - break; - } - default: - { - TFLOGSTRING(" Unkown notification") - response = ESatFailure; - break; - } - } - } - - delete textHolder; - textHolder = NULL; - - if (KErrNone != error) - { - TFLOGSTRING2("SATAPP: CSatUiObserver::Notification error:%d", error) - response = ESatFailure; - } - else if (iActionImplementer->GetEndKey()) - { - TFLOGSTRING("SATAPP: CSatUiObserver::Notification terminated by user") - response = ESatSessionTerminatedByUser; - iActionImplementer->SetEndKey(EFalse); - } - else - { - TFLOGSTRING("SATAPP: CSatUiObserver::Notification success") - response = ESatSuccess; - } - - TFLOGSTRING2("SATAPP: CSatUiObserver::Notification exiting, return: %d", \ - response) - return response; - } - -// ------------------------------------------------------------------------------------------------ -// CSatUiObserver::EventNotification -// (other items were commented in a header). -// ------------------------------------------------------------------------------------------------ -// -void CSatUiObserver::EventNotification( - const TSatSEvent aEventId, - const TSatSEventStatus /*aEventStatus*/, - const TInt /*aError*/) - { - TFLOGSTRING("SATAPP: CSatUiObserver::EventNotification calling") - - iActionImplementer->SetCommandPending(EFalse); - switch (aEventId) - { - case ESatSSmEndEvent: - { - TFLOGSTRING(" SmsEnd event") - iActionImplementer->StopShowWaitNote(); - break; - } - case ESatSClearScreenEvent: - { - TFLOGSTRING(" ClearScreen event") - iClearScreenEvent = ETrue; - iActionImplementer->ClearScreen(); - break; - } - case ESatSsEndEvent: - { - TFLOGSTRING(" Ss end event") - iActionImplementer->StopShowWaitNote(); - break; - } - case ESatSsErrorEvent: - { - TFLOGSTRING(" Notifying Ss error") - // If error occurred (and Alpha ID provided), notify user - TRAPD(err, iActionImplementer->ShowSsErrorNoteL()) - - if (err) - { - TFLOGSTRING(" Error Note could not be created!") - } - break; - } - case ESatSDtmfEndEvent: - { - TFLOGSTRING(" DTMF End event") - iActionImplementer->StopShowWaitNote(); - break; - } - case ESatSCloseSatUiAppEvent: - { - TFLOGSTRING(" Close UI event") - // Handle this similar way when End key is used - if (KSatActiveProfileOffline == ProfileState()) - { - iActionImplementer->SetEndKey(ETrue); - TRAP_IGNORE(iActionImplementer->ShowNotAvailableNoteL()) - } - iActionImplementer->CloseSatUI(); - break; - } - default: - { - TFLOGSTRING2(" Unknown event occured: %i", aEventId) - break; - } - } - - TFLOGSTRING("SATAPP: CSatUiObserver::EventNotification exiting") - } - -// ---------------------------------------------------------------------------- -// CSatUiObserver::DefaultAlphaId -// (other items were commented in a header). -// ---------------------------------------------------------------------------- -// -void CSatUiObserver::DefaultAlphaId( - const TSatSNotifyCommand aCommandId, - const TSatControlResult aControlResult, QString &resource) const - { - TFLOGSTRING("SATAPP: CSatUiObserver::DefaultAlphaId calling") - switch (aCommandId) - { - case ESatSSendDataNotify: // SendData - { - TFLOGSTRING("SendData default") - resource = hbTrId("txt_sat_conf_send_data_bip"); - break; - } - case ESatSReceiveDataNotify: // ReceiveData - { - TFLOGSTRING("ReceiveData default") - resource = hbTrId("txt_sat_conf_receive_data_bip"); - break; - } - case ESatSCloseChannelNotify: // CloseChannel - { - TFLOGSTRING("CloseChannel default") - resource = hbTrId("txt_sat_conf_close_channel_bip"); - break; - } - case ESatSMoSmControlNotify: // MoSmControl - { - if (ESatNotAllowed == aControlResult) - { - TFLOGSTRING(" MoSmcontrol Not allowed default") - resource = hbTrId("txt_sat_mosm_not_allowed"); - } - else if (ESatAllowedWithModifications == aControlResult) - { - TFLOGSTRING(" MoSmcontrol Modified default") - resource = hbTrId("txt_sat_request_modified"); - } - else - { - TFLOGSTRING(" MoSmcontrol No default") - resource = hbTrId(""); // Allowed, default alpha -> no info - } - break; - } - case ESatSCallControlNotify: // CallControl - { - if (ESatNotAllowed == aControlResult) - { - TFLOGSTRING("CallControl Not allowed default") - resource = hbTrId("txt_sat_cc_not_allowed"); - } - else if (ESatAllowedWithModifications == aControlResult) - { - TFLOGSTRING("CallControl Modified default") - resource = hbTrId("txt_sat_cc_modified"); - } - else - { - TFLOGSTRING("CallControl No default") - resource = hbTrId(""); // Allowed, default alpha -> no info - } - break; - } - case ESatSSendSmsNotify: // SendSm - { - TFLOGSTRING(" SendSms default") - resource = hbTrId("txt_sat_sending_sms"); - break; - } - - case ESatSSendDtmfNotify: // SendDtmf - { - TFLOGSTRING(" SendDTMF default") - resource = hbTrId("txt_sat_note_sending_dtmf_template"); - break; - } - default: - { - TFLOGSTRING2(" Unknown command id: %i", aCommandId) - break; - } - } - - TFLOGSTRING("SATAPP: CSatUiObserver::DefaultAlphaId exiting") - } - -// ---------------------------------------------------------------------------- -// CSatUiObserver::FetchIcon -// Fetch the icon information. -// (other items were commented in a header). -// ---------------------------------------------------------------------------- -// -CFbsBitmap* CSatUiObserver::FetchIcon(const TUint8 /*aIconId*/, - const enum TIconCommand /*aIconCommand*/) - { - TFLOGSTRING("SATAPP: CSatUiObserver::FetchIcon called") - - CFbsBitmap* iconBitmap = NULL; - TFLOGSTRING("SATAPP: CSatUiObserver::FetchIcon exit") - return iconBitmap; - } - -// ---------------------------------------------------------------------------- -// CSatUiObserver::GetPopUpWindowIconSize -// Get size for the icon in popup window. -// (other items were commented in a header). -// ---------------------------------------------------------------------------- -// -TBool CSatUiObserver::GetPopUpWindowIconSize(TSize& /*aSize*/, - const TIconCommand /*aIconCommand*/) - { - TFLOGSTRING("SATAPP: CSatUiObserver::GetPopUpWindowIconSize called") - return ETrue; - } - -// ---------------------------------------------------------------------------- -// CSatUiObserver::GetScalableBitmap -// Creates scalable bitmap -// (other items were commented in a header). -// ---------------------------------------------------------------------------- -// -void CSatUiObserver::GetScalableBitmapL( - CFbsBitmap*& /*aBitMapToConvert*/, - const TIconCommand /*aIconCommand*/) - { - TFLOGSTRING("SATAPP: CSatUiObserver::GetScalableBitmap called") - TFLOGSTRING("SATAPP: CSatUiObserver::GetScalableBitmap exit") - } - -// ---------------------------------------------------------------------------- -// CSatUiObserver::GetScalableBitmap -// Handles scalable bitmap -// (other items were commented in a header). -// ---------------------------------------------------------------------------- -// -void CSatUiObserver::GetScalableBitmap( - CFbsBitmap*& /*aBitMapToConvert*/, - const TIconCommand /*aIconCommand*/, - TBool& /*aRequestedIconDisplayed*/) - { - TFLOGSTRING("SATAPP: CSatUiObserver::GetScalableBitmap called") - TFLOGSTRING("SATAPP: CSatUiObserver::GetScalableBitmap exit") - } - -// ---------------------------------------------------------------------------- -// CSatUiObserver::GetScalableBitmap -// Handles scalable bitmap -// (other items were commented in a header). -// ---------------------------------------------------------------------------- -// -void CSatUiObserver::GetScalableBitmap( - CFbsBitmap*& /*aBitMapToConvert*/, - const TIconCommand /*aIconCommand*/) - { - TFLOGSTRING("SATAPP: CSatUiObserver::GetScalableBitmap called") - TFLOGSTRING("SATAPP: CSatUiObserver::GetScalableBitmap exit") - } - -// ---------------------------------------------------------------------------- -// CSatUiObserver::ProfileState -// Get the profile status -// (other items were commented in a header). -// ---------------------------------------------------------------------------- -// -TInt CSatUiObserver::ProfileState() - { - TFLOGSTRING("SATAPP: CSatUiObserver::ProfileState called") - TInt profileId(0); - CRepository* cr (NULL); - - TRAPD(err, cr = CRepository::NewL(KCRUidProfileEngine)); - if ((KErrNone == err) && cr) - { - TFLOGSTRING("SATAPP: CSatUiObserver::ProfileState no err") - // Get the ID of the currently active profile: - cr->Get(KProEngActiveProfile, profileId); - delete cr; - } - else - { - TFLOGSTRING2("SATAPP: CSatUiObserver::ProfileState CR failed: %i", err) - } - - TFLOGSTRING2("SATAPP: CSatUiObserver::ProfileState exit value: %d", - profileId) - - return profileId; - } - -// ---------------------------------------------------------------------------- -// CSatUiObserver::ConnectRSatSessionL -// -// (other items were commented in a header). -// ---------------------------------------------------------------------------- -// -void CSatUiObserver::ConnectRSatSessionL() - { - TFLOGSTRING("SATAPP: CSatUiObserver::ConnectRSatSessionL called") - //Register to Server as subsession - //If Server is not up, this function call may take time - iSatSession.ConnectL(); - iSat.RegisterL(iSatSession, this); - iAdapter = iSat.Adapter(); - if (!iAdapter) - { - User::Leave(KErrNotFound); - } - TFLOGSTRING("SATAPP: CSatUiObserver::ConnectRSatSessionL exit") - } - -// ---------------------------------------------------------------------------- -// CSatUiObserver::DisconnectRSatSession -// Get the profile status -// (other items were commented in a header). -// ---------------------------------------------------------------------------- -// -void CSatUiObserver::DisconnectRSatSession() - { - TFLOGSTRING("SATAPP: CSatUiObserver::DisconnectRSatSession called") - iSat.Close(); - iSatSession.Close(); - TFLOGSTRING("SATAPP: CSatUiObserver::DisconnectRSatSession exit") - } - -// End of File diff -r 1f002146abb4 -r cee7e9e0906c satui/satapp/src/dialogwaiter.cpp --- a/satui/satapp/src/dialogwaiter.cpp Tue Jul 06 14:53:02 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,34 +0,0 @@ -/* -* Copyright (c) 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" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: dialog waiter -* -* -*/ - -#include "dialogwaiter.h" - -HbAction* DialogWaiter::wait() -{ - mLoop.exec(); - HbAction* a=mResult; - mResult=0; - return a; -} - -void DialogWaiter::done(HbAction* result) -{ - mResult=result; - mLoop.quit(); -} - diff -r 1f002146abb4 -r cee7e9e0906c satui/satapp/src/main.cpp --- a/satui/satapp/src/main.cpp Tue Jul 06 14:53:02 2010 +0300 +++ b/satui/satapp/src/main.cpp Wed Aug 18 10:19:22 2010 +0300 @@ -11,41 +11,68 @@ * * Contributors: * -* Description: +* Description: satapp main * * */ +#include #include #include #include #include +#include "satappmainhandler.h" -#include "satappmainhandler.h" -#include "tflogger.h" +#ifdef SAT_DEBUG_TO_FILE + // ------------------------------------------------------------ + // this segment provides functionality that copies all QT debug + // output to RFileLogger, and also the standard QT debug stream + #include + #include + _LIT(KTfLogFolder, "sat"); + _LIT(KTfLogFile, "satui.txt"); + // original message handler + QtMsgHandler originalMsgHandler; + // debug redirection function + void qDebugToRFileLogger(QtMsgType type, const char *msg) + { + TPtrC8 symbian_msg((const TUint8*)msg); + RFileLogger::Write(KTfLogFolder,KTfLogFile, + EFileLoggingModeAppend,symbian_msg); + if (originalMsgHandler) originalMsgHandler(type,msg); + } + // ------------------------------------------------------------ +#endif + + + int main(int argc, char *argv[]) { - TFLOGSTRING("SATAPP: main") +#ifdef SAT_DEBUG_TO_FILE + originalMsgHandler = qInstallMsgHandler(qDebugToRFileLogger); +#endif + + qDebug("SATAPP: main"); HbApplication app(argc, argv); - TFLOGSTRING("SATAPP: main app created") + qDebug("SATAPP: main app created"); QTranslator translator; - bool ok = translator.load(":/translations/satapp_en"); - TFLOGSTRING2("SATUI: main, translation %d (1=OK, 0=fail)", ok ) + bool ok = translator.load(":/translations/satapp"); + qDebug("SATUI: main, translation %d (1=OK, 0=fail)", ok ); app.installTranslator(&translator); HbMainWindow window; - TFLOGSTRING("SATAPP: main window created") + qDebug("SATAPP: main window created"); SatAppMainHandler *mainHandler = new SatAppMainHandler(window); - + window.show(); - TFLOGSTRING("SATAPP: main view showed") + qDebug("SATAPP: main view showed"); int result = app.exec(); - TFLOGSTRING2("SATAPP: main exit %d", result) + qDebug("SATAPP: main exit %d", result); delete mainHandler; return result; diff -r 1f002146abb4 -r cee7e9e0906c satui/satapp/src/satappaction.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/satui/satapp/src/satappaction.cpp Wed Aug 18 10:19:22 2010 +0300 @@ -0,0 +1,206 @@ +/* +* Copyright (c) 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" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +* +*/ + +#include +#include +#include +#include +#include + +#include "satappaction.h" + +// ---------------------------------------------------------------------------- +// global des2str +// trasmit from symbian descripter to QString +// ---------------------------------------------------------------------------- +// +QString des2str(const TDesC& desc) +{ + return QString::fromUtf16(desc.Ptr(), desc.Length()); +} + +// ======== MEMBER FUNCTIONS ================================================== + +// ---------------------------------------------------------------------------- +// SatAppAction::SatAppAction +// ---------------------------------------------------------------------------- +// +SatAppAction::SatAppAction(int action, QObject *parent) +: QObject(parent) +{ + qDebug("SATAPP: SatAppAction::SatAppAction"); + mAction = action; + mResponse = ESatNoResponseFromUser; + mState = Active; + + //monitor application + SAT_ASSERT(connect( + qApp,SIGNAL(aboutToQuit()), + this,SLOT(completeWithSessionTerminated()))); +} + +// ---------------------------------------------------------------------------- +// SatAppAction::~SatAppAction +// ---------------------------------------------------------------------------- +// +SatAppAction::~SatAppAction() +{ + if (mState==Waiting) + complete(); // release waiting thread +} + +// ---------------------------------------------------------------------------- +// SatAppAction::waitUntilCompleted +// sync method that returns when this action is completed +// ---------------------------------------------------------------------------- +// +void SatAppAction::waitUntilCompleted() +{ + qDebug("SATAPP: SatAppAction::waitUntilCompleted"); + if (mState==Completed) return; // no need to wait! + QEventLoop loop; + SAT_ASSERT(connect( + this,SIGNAL(actionCompleted(SatAppAction*)), + &loop,SLOT(quit()))); + mState=Waiting; + qDebug("SATAPP: waitUntilCompleted: waiting..."); + loop.exec(); + // When use the FSW complete the satapp, the signal aboutToExit + // can not be recieved. temp solution + if(Waiting == mState){ + mState=Completed; + mResponse=ESatSessionTerminatedByUser; + } + qDebug("SATAPP: waitUntilCompleted: ...released"); +} + +// ---------------------------------------------------------------------------- +// SatAppAction::complete +// completes the action +// ---------------------------------------------------------------------------- +// +void SatAppAction::complete(TSatUiResponse resp) +{ + qDebug("SATAPP: SatAppAction::complete resp= %x in", resp); + if (mState!=Completed) { + qDebug("SATAPP: SatAppAction::completed"); + setResponse(resp); + mState = Completed; + emit actionCompleted(this); + } + qDebug("SATAPP: SatAppAction::complete resp= %x out", resp); +} + +// ---------------------------------------------------------------------------- +// SatAppAction::set +// setter for QVariant +// ---------------------------------------------------------------------------- +// +void SatAppAction::set(const QString& key, QVariant value) +{ + qDebug() << "SATAPP: SatAppAction::set(" << + key << "=" << value << ")"; + mParams[key] = value; +} + +// ---------------------------------------------------------------------------- +// SatAppAction::set +// setter for Symbian Descripter +// ---------------------------------------------------------------------------- +// +void SatAppAction::set(const QString& key, const TDesC& value) +{ + set(key,des2str(value)); +} + +// ---------------------------------------------------------------------------- +// SatAppAction::set +// setter for Symbian MDesCArray - Menu list +// ---------------------------------------------------------------------------- +// +void SatAppAction::set(const QString& key, const MDesCArray& value) +{ + QList list; + for(int i=0; i - mene icon +// ---------------------------------------------------------------------------- +// +void SatAppAction::set(const QString& key, CArrayFixFlat& value) +{ + QList list; + for(int i=0; imillisec + set(key,value_millisec); +} + +// ---------------------------------------------------------------------------- +// SatAppAction::set +// setter for TTimeIntervalMicroSeconds - duration +// ---------------------------------------------------------------------------- +// +void SatAppAction::set(const QString& key, TTimeIntervalMicroSeconds& value) +{ + int value_millisec = value.Int64() / 1000; // microsec->millisec + set(key,value_millisec); +} + +// ---------------------------------------------------------------------------- +// SatAppAction::value +// getter by key +// ---------------------------------------------------------------------------- +// +QVariant SatAppAction::value(const QString& key) +{ + if (!mParams.contains(key)) + { + // lazy-fetch params implementation goes here. + // for instance if Icon is requested, request for the icons here. + // however at this moment, all parameters should be present. + qFatal("SATAPP: SatAppAction::value - param missing: %s", + key.toLatin1().data()); + } + return mParams[key]; +} + +// ---------------------------------------------------------------------------- +// SatAppAction::hasValue +// ---------------------------------------------------------------------------- +// +bool SatAppAction::hasValue(const QString& key) +{ + return mParams.contains(key); +} + +//End of file diff -r 1f002146abb4 -r cee7e9e0906c satui/satapp/src/satappcommandhandler.cpp --- a/satui/satapp/src/satappcommandhandler.cpp Tue Jul 06 14:53:02 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,571 +0,0 @@ -/* -* Copyright (c) 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" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -#include -#include "satappcommandhandler.h" -#include "tflogger.h" -#include "satappcommonconstant.h" -#include "satappuiprovider.h" - -// ---------------------------------------------------------------------------- -// SatAppCommandHandler::DisplayText -// (other items were commented in a header). -// ---------------------------------------------------------------------------- -// -SatAppCommandHandler::SatAppCommandHandler(SatAppUiProvider &ui, - QObject *parent) : QObject(parent), mUi(ui) -{ - TFLOGSTRING("SATAPP: SatAppCommandHandler::SatAppCommandHandler call-exit") -} - -// ---------------------------------------------------------------------------- -// SatAppCommandHandler::~SatAppCommandHandler -// (other items were commented in a header). -// ---------------------------------------------------------------------------- -// -SatAppCommandHandler::~SatAppCommandHandler() -{ - -} - -// ---------------------------------------------------------------------------- -// SatAppCommandHandler::setUpMenu -// (other items were commented in a header). -// ---------------------------------------------------------------------------- -// -void SatAppCommandHandler::setUpMenu( - TSatUiResponse &aRes, - const QString &aText, - const QStringList &aMenuItems, - //const CArrayFixFlat* aMenuItemNextActions, - //const HbIcon &aIcon, - //const CAknIconArray* aItemIconsArray, - const bool aSelfExplanatoryItems, - const bool aHelpIsAvailable) -{ - TFLOGSTRING("SATAPP: SatAppCommandHandler::setUpMenu call") - mUi.showSetUpMenuView(aRes, aText, aMenuItems, - aSelfExplanatoryItems, aHelpIsAvailable); - TFLOGSTRING("SATAPP: SatAppCommandHandler::setUpMenu exit") -} - -// ---------------------------------------------------------------------------- -// SatAppCommandHandler::selectItem -// (other items were commented in a header). -// ---------------------------------------------------------------------------- -// -void SatAppCommandHandler::selectItem( - TSatUiResponse &aRes, - const QString &aText, - const QStringList &aMenuItems, - //const CArrayFixFlat* aMenuItemNextActions, - const int aDefaultItem, - unsigned char &aSelection, - //const HbIcon &aIcon, - //const CAknIconArray* aItemsIconArray, - const bool aSelfExplanatoryItems, - const bool aHelpIsAvailable) -{ - TFLOGSTRING("SATAPP: SatAppCommandHandler::selectItem call") - mUi.showSelectItemView(aRes, aText, aMenuItems, aDefaultItem, aSelection, - aSelfExplanatoryItems, aHelpIsAvailable); - TFLOGSTRING("SATAPP: SatAppCommandHandler::selectItem exit") -} - -// ---------------------------------------------------------------------------- -// SatAppCommandHandler::displayText -// (other items were commented in a header). -// ---------------------------------------------------------------------------- -// -void SatAppCommandHandler::displayText(TSatUiResponse &aRes, - const QString &aText, - const QString &aSimApplicationName, - // const HbIcon &aIcon, - bool &/*aRequestedIconDisplayed*/, - const bool aSustainedText, - const int aDuration, - const bool aWaitUserToClear) -{ - TFLOGSTRING("SATAPP: SatAppCommandHandler::displayText call") - - aRes = ESatSuccess; - QString heading; - if (!aSimApplicationName.isEmpty()) { - heading.append(aSimApplicationName); - } else { - heading.append(hbTrId("txt_sat_application_name")); - } - - // set time - int duration(0); - - if (!aDuration) { - TFLOGSTRING( - "SATAPP: SatAppCommandHandler::displayText duration not given") - duration = KDisplayTxtDefaultduration; - if (aWaitUserToClear) { - TFLOGSTRING( - "SATAPP: SatAppCommandHandler::displayText wait user to clear") - duration = KDisplayTxtUserClearTimeout; - } - } else { - TFLOGSTRING( - "SATAPP: SatAppCommandHandler::displayText duration given") - duration = aDuration * 1000; - } - - // If not sustained or Clear after delay requested start timer - if ( !(!aSustainedText || aDuration || !aWaitUserToClear) ){ - TFLOGSTRING( - "SATAPP: SatAppCommandHandler::displayText no duration") - duration = 0; - } - - TFLOGSTRING2( - "SATAPP: SatAppCommandHandler::displayText duration: %d", - duration) - TSatAppUserResponse rsp = EUserNoResponse; - rsp = mUi.showDisplayTextPopup(heading, aText, duration); - - // If user is not expected to clear message used response is success - if (aWaitUserToClear && !aSustainedText) { - // User press ok key - if (EUserPrimaryResponse == rsp || - EUserClearResponse == rsp){ - aRes = ESatSuccess; - TFLOGSTRING( - "SATAPP: SatAppCommandHandler::DisplayText successful response") - } else if (EUserSecondaryResponse == rsp) { - // User press back key - aRes = ESatBackwardModeRequestedByUser; - } else { - TFLOGSTRING( - "SATAPP: SatAppCommandHandler::DisplayText no user response") - // User did not close the text, closed by the timer or MT call - aRes = ESatNoResponseFromUser; - } - } - - // request to close by the server - if (EUserCloseResponse == rsp) { - aRes = ESatSessionTerminatedByUser; - } - - // to do - //End key by user ESatSessionTerminatedByUser - //rsp = EUserNoResponse; - TFLOGSTRING("SATAPP: SatAppCommandHandler::displayText exit") -} - -// ---------------------------------------------------------------------------- -// SatAppCommandHandler::getInkey -// (other items were commented in a header). -// ---------------------------------------------------------------------------- -// -void SatAppCommandHandler::getInkey(TSatUiResponse &aRes, - const QString &aTitleText, - const TSatCharacterSet aCharacterSet, - QString &aInputText, - //const QPixmap* /*aIconBitmapGetInput*/, - const bool /*aSelfExplanatory*/, - unsigned int &aDuration) -{ - TFLOGSTRING("SATAPP: SatAppCommandHandler::getInkey") - aRes = ESatSuccess; - // the timeout expires The timer starts when the text is - //displayed on the screen and stops when the TERMINALRESPONSE is sent. - QTime time; - unsigned int duration = KDefaultSelectionTimeoutMseconds; - if (aDuration) { - TFLOGSTRING2("SATAPP: SatAppCommandHandler::getInkey\ - in aDuration: %d", aDuration) - duration = aDuration * KSymbianTimeConvertQtTime; - time.start(); - } - - QString heading; - if (aTitleText.isEmpty()) { - if (ESatDigitOnly == aCharacterSet) { - TFLOGSTRING("SATAPP:SatAppCommandHandler::getInkey: ESatDigitOnly") - heading = hbTrId("txt_sat_getinkey_nbr"); - } else { - // ESatCharSmsDefaultAlphabet or ESatCharUcs2Alphabet - TFLOGSTRING("SatAppCommandHandler::getInkey others") - heading = hbTrId("txt_sat_getinkey_char"); - } - } else { - heading = aTitleText; - TFLOGSTRING("SatAppCommandHandler::getInkey: Using aTitleText") - } - //Duration will be implemented in GetInkey proactive command - TSatAppUserResponse rsp = EUserNoResponse; - rsp = mUi.showGetInkeyQuery(heading, aInputText, aCharacterSet, duration); - - if (aDuration) { - aDuration = time.elapsed() / KSymbianTimeConvertQtTime; - TFLOGSTRING2("SATAPP: SatAppCommandHandler::getInkey\ - return for server aDuration: %d", aDuration) - } - // User press OK key - if (EUserPrimaryResponse == rsp) { - aRes = ESatSuccess; - TFLOGSTRING("SATAPP: SatAppCommandHandler::getInkey successful response") - } else if (EUserSecondaryResponse == rsp) - { - // User press back key - aRes = ESatBackwardModeRequestedByUser; - } else { - TFLOGSTRING("SATAPP: SatAppCommandHandler::getInkey no user response") - // User did not close the text, closed by the timer or MT call - aRes = ESatNoResponseFromUser; - } - - TFLOGSTRING("SATAPP: SatAppCommandHandler::getInkey exit") -} - -// ---------------------------------------------------------------------------- -// SatAppCommandHandler::getYesNo -// (other items were commented in a header). -// ---------------------------------------------------------------------------- -// -void SatAppCommandHandler::getYesNo( - TSatUiResponse &aRes, - const QString &aText, - const TSatCharacterSet aCharacterSet, - unsigned int &aInkey, - //const TSatIconId &aIconId, - const bool &/*aSelfExplanatory*/, - unsigned int &aDuration, - const bool aImmediateDigitResponse) -{ - TFLOGSTRING("SATAPP: SatAppCommandHandler::getYesNo") - TFLOGSTRING2("SATAPP: SatAppCommandHandler::getYesNo: immediate %d", - aImmediateDigitResponse) - - // the timeout expires The timer starts when the text is - //displayed on the screen and stops when the TERMINALRESPONSE is sent. - QTime time; - unsigned int duration = KDefaultSelectionTimeoutMseconds; - if (aDuration) { - TFLOGSTRING2("SATAPP: SatAppUiProvider::getYesNo in aDuration: %d", - aDuration) - duration = aDuration * KSymbianTimeConvertQtTime; - time.start(); - } - TFLOGSTRING2("SATAPP: SatAppUiProvider::showGetYesNoQuery duration=%d", - duration) - - aRes = ESatSuccess; - int rsp = -1; - unsigned int inKey = aInkey; - rsp = mUi.showGetYesNoQuery(aText, aCharacterSet, inKey, - duration, aImmediateDigitResponse); - - if (aDuration) { - aDuration = time.elapsed() / KSymbianTimeConvertQtTime; - } - TFLOGSTRING2("SATAPP: SatAppUiProvider::showGetYesNoQuery duration out=%d", - aDuration) - if (EUserPrimaryResponse == rsp) { - aRes = ESatSuccess; - if ( Qt::Key_unknown == inKey ) { - // User press yes key - aInkey = 1; - } else { - // User press digital key - aInkey = inKey; - } - TFLOGSTRING("SATAPP: SatAppCommandHandler::getYesNo successful response") - } else if (EUserSecondaryResponse == rsp) - { - // User press cancel in immediate digital mode - if (ESatYesNo != aCharacterSet) { - aRes = ESatBackwardModeRequestedByUser; - TFLOGSTRING("SATAPP: SatAppCommandHandler::getYesNo Cancel") - } else { - // User press NO key - aRes = ESatSuccess; - aInkey = 0; - TFLOGSTRING("SATAPP: SatAppCommandHandler::getYesNo No") - } - } - // else if { - // // User press end/back key - // aRes = ESatBackwardModeRequestedByUser; - // aInkey = 1; - else { - TFLOGSTRING("SATAPP: SatAppCommandHandler::getYesNo no user response") - // User did not close the text, closed by the timer or MT call - aRes = ESatNoResponseFromUser; - aInkey = 0; - } - TFLOGSTRING("SATAPP: SatAppCommandHandler::getYesNo exit") -} - -// ---------------------------------------------------------------------------- -// SatAppCommandHandler::getInput -// (other items were commented in a header). -// ---------------------------------------------------------------------------- -// -void SatAppCommandHandler::getInput(TSatUiResponse &aRes, - const QString &aTitleText, - const TSatCharacterSet aCharacterSet, - QString &aInputText, - const int aMinLength, - const int aMaxLength, - const bool aHideInput, - //const QPixmap* /*aIconBitmapGetInput*/, - const bool /*aSelfExplanatory*/, - unsigned int &/*aDuration*/) -{ - TFLOGSTRING("SATAPP: SatAppCommandHandler::getInput") - - aRes = ESatNoResponseFromUser; - QString heading; - - if (aTitleText.isEmpty()) { - if (ESatDigitOnly == aCharacterSet) { - TFLOGSTRING("SATAPP::getInput ESatDigitOnly") - heading = hbTrId("txt_sat_getinput_nbr"); - } else { - // ESatCharSmsDefaultAlphabet or ESatCharUcs2Alphabet - TFLOGSTRING("SatAppCommandHandler::getInput ESatCharSmsDefaultAlphabet \ - or ESatCharUcs2Alphabet") - heading = hbTrId("txt_sat_getinput_char"); - } - } else { - heading.append(aTitleText); - } - - int minLength = 0; - int maxLength = 1; - if (aMinLength <= KGetInputStringMaxSize && aMinLength > 0){ - minLength = aMinLength; - } else if (aMinLength > KGetInputStringMaxSize){ - minLength = KGetInputStringMaxSize; - } - //lint -e{961} else block not needed, maxLength initialized. - if (aMaxLength < minLength){ - maxLength = minLength; - } else if (aMaxLength <= KGetInputStringMaxSize && aMaxLength > 1){ - maxLength = aMaxLength; - } else if (aMaxLength > KGetInputStringMaxSize){ - maxLength = KGetInputStringMaxSize; - } - - QString inputText; - if ((aInputText.length() >= minLength)&& (aInputText.length() <= maxLength)){ - inputText = aInputText; - } - - //Duration will be implemented in GetInkey proactive command - TSatAppUserResponse rsp = EUserNoResponse; - rsp = mUi.showGetInputQuery( heading, inputText, - aCharacterSet, minLength, maxLength, aHideInput); - - if (EUserPrimaryResponse == rsp) { - // User press OK key - aRes = ESatSuccess; - aInputText = inputText; - TFLOGSTRING("SATAPP: SatAppCommandHandler::getInput successful response") - } else if (EUserSecondaryResponse == rsp) - { - // User press back key - aRes = ESatBackwardModeRequestedByUser; - TFLOGSTRING("SATAPP: SatAppCommandHandler::getInput press back softkey response") - } else { - // User did not close the getinput query, closed by the timer or MT call - aRes = ESatNoResponseFromUser; - TFLOGSTRING("SATAPP: GetInputL::getInput no user response") - } - TFLOGSTRING("SATAPP: SatAppCommandHandler::getInput exit") -} - -// ---------------------------------------------------------------------------- -// SatAppCommandHandler::callControl -// (other items were commented in a header). -// ---------------------------------------------------------------------------- -// -void SatAppCommandHandler::callControl( - const QString &aText, - const TSatAlphaIdStatus /*aAlphaIdStatus*/) -{ - TFLOGSTRING("SATAPP: SatAppCommandHandler::showCallControlNote call") - //if (ESatAlphaIdNotNull == aAlphaIdStatus) { - //TODO The note will be disabled by the phone UI when the call is - // in connecting status. But call control case is an exception, So we - // use RAknKeyLock to enable soft notifications. - mUi.showCallControlNote(aText); - TFLOGSTRING("SATAPP: SatAppCommandHandler::showCallControlNote exit") -} - -// ---------------------------------------------------------------------------- -// SatAppCommandHandler::moSmControl -// (other items were commented in a header). -// ---------------------------------------------------------------------------- -// -void SatAppCommandHandler::moSmControl( - const QString &aText, - const TSatAlphaIdStatus aAlphaIdStatus) -{ - TFLOGSTRING("SATAPP: SatAppCommandHandler::moSmControl call") - if (ESatAlphaIdNotNull == aAlphaIdStatus) { - mUi.showMoSmControlNote(aText); - } else { - mUi.showSatInfoNote(aText); - } - TFLOGSTRING("SATAPP: SatAppCommandHandler::moSmControl exit") -} - -// ---------------------------------------------------------------------------- -// SatAppCommandHandler::confirmSend -// (other items were commented in a header). -// ---------------------------------------------------------------------------- -// -void SatAppCommandHandler::confirmSend( - TSatUiResponse &aRes, - const QString &/*aText*/, - bool &aActionAccepted, - int aType) -{ - TFLOGSTRING2("SATAPP: SatAppCommandHandler::confirmSend call, type=%d", aType) - aRes = ESatNoResponseFromUser; - QString title; - switch (aType) { - case ESatUiConfirmSendSms: - { - title.append(hbTrId("txt_sat_sim_notification_sendsms")); - TFLOGSTRING( "SATAPP: SatAppCommandHandler::confirmSend sms" ) - } - break; - case ESatUiConfirmSendSs: - case ESatUiConfirmSendUssd: //the same string for SS and USSD - { - title.append(hbTrId("txt_sat_sim_notification_sendss_ussd")); - TFLOGSTRING( "SATAPP: SatAppCommandHandler::confirmSend ussd or ss" ) - } - break; - default: - aRes = ESatFailure; - TFLOGSTRING( "SATAPP: SatAppCommandHandler::confirmSend type unsupport" ) - break; - } - if(ESatFailure != aRes) { - mUi.showConfirmSendQuery(title, aActionAccepted); - aRes = ESatSuccess; - TFLOGSTRING2( "SATAPP: SatAppCommandHandler::confirmSend accept=%d", - aActionAccepted) - } - TFLOGSTRING2( "SATAPP: SatAppCommandHandler::confirmSend exit rsp=%d", aRes ) -} - -// ---------------------------------------------------------------------------- -// SatAppCommandHandler::showSmsWaitNote -// (other items were commented in a header). -// ---------------------------------------------------------------------------- -// -void SatAppCommandHandler::showSmsWaitNote(const QString &aText, - const bool /*aSelfExplanatoryIcon*/) -{ - TFLOGSTRING("SATAPP: SatAppCommandHandler::showSmsWaitNote call") - mUi.showSmsWaitNote(aText); - TFLOGSTRING("SATAPP: SatAppCommandHandler::showSmsWaitNote exit") - } - -// ---------------------------------------------------------------------------- -// SatAppCommandHandler::showDtmfWaitNote -// (other items were commented in a header). -// ---------------------------------------------------------------------------- -// -void SatAppCommandHandler::showDtmfWaitNote(TSatUiResponse &aRes, - const QString &aText/*, - const bool aSelfExplanatoryIcon*/) -{ - TFLOGSTRING("SATAPP: SatAppCommandHandler::showDtmfWaitNote call") - mUi.showDtmfWaitNote(aRes, aText); - TFLOGSTRING("SATAPP: SatAppCommandHandler::showDtmfWaitNote exit") - } - -// ---------------------------------------------------------------------------- -// SatAppCommandHandler::stopShowWaitNote -// (other items were commented in a header). -// ---------------------------------------------------------------------------- -// -void SatAppCommandHandler::stopShowWaitNote() -{ - TFLOGSTRING("SATAPP: SatAppCommandHandler::stopShowWaitNote call") - mUi.stopShowWaitNote(); - TFLOGSTRING("SATAPP: SatAppCommandHandler::stopShowWaitNote exit") -} - -// ---------------------------------------------------------------------------- -// SatAppCommandHandler::confirmSetUpCall -// (other items were commented in a header). -// ---------------------------------------------------------------------------- -// -void SatAppCommandHandler::confirmSetUpCall( - const QString &aText, - const QString &aSimAppName, - bool &aActionAccepted//, - //const CFbsBitmap* aIconBitmap, - //const TBool aSelfExplanatory - ) -{ - TFLOGSTRING("SATAPP: SatAppCommandHandler::showSetUpCallConfirm call") - mUi.showConfirmSetUpCallQuery(aText, aSimAppName, aActionAccepted); - TFLOGSTRING("SATAPP: SatAppCommandHandler::showSetUpCallConfirm exit") -} - -// ---------------------------------------------------------------------------- -// SatAppCommandHandler::showSsWaitNote -// (other items were commented in a header). -// Displays a wait note to indicate SS sending. -// ---------------------------------------------------------------------------- -// -void SatAppCommandHandler::showSsWaitNote( - const QString &aText, - //const CFbsBitmap* aIconBitmapSendSM, - const bool aSelfExplanatoryIcon) -{ - TFLOGSTRING("SATAPP: SatAppCommandHandler::showSsWaitNote call") - mUi.showSsWaitNote(aText, aSelfExplanatoryIcon); - TFLOGSTRING("SATAPP: SatAppCommandHandler::showSsWaitNote exit") -} - -// ---------------------------------------------------------------------------- -// SatAppCommandHandler::showBIPWaitNote -// (other items were commented in a header). -// ---------------------------------------------------------------------------- -// -void SatAppCommandHandler::showBIPWaitNote(int aCommand, const QString &aText) -{ - TFLOGSTRING("SATAPP: SatAppCommandHandler::showBIPWaitNote call") - QString title = aText; - if (ECloseChannelIdentifier == aCommand ){ - if (aText.isEmpty()){ - title= hbTrId("txt_sat_closechannel_wait_note"); - } - // No cancel key support, close channel - mUi.showCloseChannelWaitNote(title); - } else { - // Cancel key support, Send Data, Receive Data - mUi.showBIPWaitNote(title); - } - - TFLOGSTRING("SATAPP: SatAppCommandHandler::showBIPWaitNote exit") -} -//End of file diff -r 1f002146abb4 -r cee7e9e0906c satui/satapp/src/satappconfirmprovider.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/satui/satapp/src/satappconfirmprovider.cpp Wed Aug 18 10:19:22 2010 +0300 @@ -0,0 +1,195 @@ +/* +* Copyright (c) 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" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +// qt +#include +// hb +#include +#include +// satapp +#include "satappconfirmprovider.h" +#include "satappconstant.h" +#include "satappaction.h" + +// ---------------------------------------------------------------------------- +// SatAppConfirmProvider::SatAppConfirmProvider +// ---------------------------------------------------------------------------- +// +SatAppConfirmProvider::SatAppConfirmProvider(QObject *parent) + : QObject(parent), mConfirmQuery(0), mAction(0) +{ + qDebug("SATAPP: SatAppConfirmProvider::SatAppConfirmProvider"); +} + +// ---------------------------------------------------------------------------- +// SatAppConfirmProvider::~SatAppConfirmProvider +// ---------------------------------------------------------------------------- +// +SatAppConfirmProvider::~SatAppConfirmProvider() +{ + qDebug("SATAPP: SatAppConfirmProvider::~SatAppConfirmProvider >"); + delete mConfirmQuery; + mConfirmQuery = 0; + qDebug("SATAPP: SatAppConfirmProvider::~SatAppConfirmProvider <"); +} + +// ---------------------------------------------------------------------------- +// SatAppConfirmProvider::showOpenChannelConfirm +// ---------------------------------------------------------------------------- +// +void SatAppConfirmProvider::confirmCommand(SatAppAction &action) +{ + qDebug("SATAPP: SatAppConfirmProvider::confirmCommand >"); + mAction = &action; + delete mConfirmQuery; + mConfirmQuery = 0; + TSatSQueryCommand aCommandId = + static_cast(action.value(KeyQueryCommandId).toInt()); + + qDebug("SATAPP: SatAppConfirmProvider::ConfirmCommand aCommandId: %d", + aCommandId); + // Check quering command + switch (aCommandId) + { + case ESatOpenChannelQuery: + { + qDebug("SATAPP: SatAppConfirmProvider::ConfirmCommand:\ + Quering OpenChannel"); + showOpenChannelConfirm(action); + break; + } + case ESatSSetUpCallQuery: + { + qDebug("SATAPP: SatAppConfirmProvider::ConfirmCommand:\ + Quering SetUpCall"); + showSetUpCallConfirm(action); + break; + } + // TODO: implemente later + case ESatSRefreshQuery: + // TODO: implemente later + case ESatSLaunchBrowserQuery: + { + action.completeWithNoResponse(); + break; + } + default: + { + qDebug("SATAPP: SatAppConfirmProvider::ConfirmCommand:\ + Unknown quering command"); + action.completeWithNoResponse(); + } + break; + } + qDebug("SATAPP: SatAppConfirmProvider::ConfirmCommand <"); +} + +// ---------------------------------------------------------------------------- +// SatAppConfirmProvider::showOpenChannelConfirm +// ---------------------------------------------------------------------------- +// +void SatAppConfirmProvider::showOpenChannelConfirm(SatAppAction &action) +{ + qDebug("SATAPP: SatAppConfirmProvider::showOpenChannelConfirm >"); + QString content = action.value(KeyText).toString(); + if (!content.length()){ + content = hbTrId("txt_simatk_info_open_connection"); + } + mConfirmQuery = new HbMessageBox(HbMessageBox::MessageTypeQuestion); + // Sets the "Yes"-action/button + mConfirmQuery->setText(content); + mConfirmQuery->setStandardButtons(HbMessageBox::Ok | HbMessageBox::Cancel); + SAT_ASSERT(connect(mConfirmQuery->actions().at(0), SIGNAL(triggered()), + &action, SLOT(completeWithSuccess()))); + SAT_ASSERT(connect(mConfirmQuery->actions().at(1), SIGNAL(triggered()), + &action, SLOT(completeWithBackRequested()))); + SAT_ASSERT(connect(mAction, SIGNAL(actionCompleted(SatAppAction *)), + this, SLOT(resetState()))); + qDebug("SATAPP: SatAppUiProvider::showOpenChannelConfirm before open"); + mConfirmQuery->open(); + qDebug("SATAPP: SatAppConfirmProvider::showOpenChannelConfirm <"); +} + +// ---------------------------------------------------------------------------- +// SatAppConfirmProvider::showSetUpCallConfirm +// ---------------------------------------------------------------------------- +// +void SatAppConfirmProvider::showSetUpCallConfirm(SatAppAction &action) +{ + qDebug("SATAPP: SatAppConfirmProvider::showSetUpCallConfirm >"); + QString text = action.value(KeyText).toString(); + QString additionText = action.value(KeyAdditionalText).toString(); + QString alphaId; + if (text.length() == 0) { + qDebug("SATAPP: SatAppConfirmProvider::showSetUpCallConfirm length 0"); + alphaId = hbTrId("txt_simatk_info_1_about_to_call"); + if (additionText.length() > 0) { + alphaId = alphaId.arg(additionText); + } else { + alphaId = alphaId.arg(hbTrId("txt_simatk_title_sim_services")); + } + } else { + qDebug("SATAPP: SatAppConfirmProvider::showSetUpCallConfirm text"); + alphaId.append(text); + } + qDebug("SATAPP: SatAppConfirmProvider::showSetUpCallConfirm new"); + mConfirmQuery = new HbMessageBox(HbMessageBox::MessageTypeQuestion); + mConfirmQuery->setStandardButtons(HbMessageBox::Ok | HbMessageBox::Cancel); + mConfirmQuery->setText(alphaId); + SAT_ASSERT(connect(mConfirmQuery->actions().at(0), SIGNAL(triggered()), + &action, SLOT(completeWithSuccess()))); + SAT_ASSERT(connect(mConfirmQuery->actions().at(1), SIGNAL(triggered()), + &action, SLOT(completeWithBackRequested()))); + SAT_ASSERT(connect(mAction, SIGNAL(actionCompleted(SatAppAction *)), + this, SLOT(resetState()))); + qDebug("SATAPP: SatAppConfirmProvider::showSetUpCallConfirm before open"); + mConfirmQuery->open(); + qDebug("SATAPP: SatAppConfirmProvider::showSetUpCallConfirm <"); +} + +// ---------------------------------------------------------------------------- +// SatAppConfirmProvider::clearScreen +// ---------------------------------------------------------------------------- +// +void SatAppConfirmProvider::clearScreen() +{ + qDebug("SATAPP: SatAppConfirmProvider::clearScreen >"); + if (mAction) { + SAT_ASSERT(disconnect(mAction, SIGNAL(actionCompleted(SatAppAction *)), + this, SLOT(resetState()))); + qDebug("SATAPP: SatAppConfirmProvider::clearScreen quit event loop"); + mAction->completeWithNoResponse(); + mAction = 0; + } + delete mConfirmQuery; + mConfirmQuery = 0; + qDebug("SATAPP: SatAppConfirmProvider::clearScreen <"); +} + +// ---------------------------------------------------------------------------- +// SatAppConfirmProvider::resetState +// reset +// ---------------------------------------------------------------------------- +// +void SatAppConfirmProvider::resetState() +{ + qDebug( "SATAPP: SatAppConfirmProvider::resetState >" ); + mAction = 0; + qDebug( "SATAPP: SatAppConfirmProvider::resetState <" ); +} + +//End of file diff -r 1f002146abb4 -r cee7e9e0906c satui/satapp/src/satappeventprovider.cpp --- a/satui/satapp/src/satappeventprovider.cpp Tue Jul 06 14:53:02 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,733 +0,0 @@ -/* -* Copyright (c) 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" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -#include -#include - -#include "satappeventprovider.h" -#include "satappplaytoneprovider.h" -#include "csatuiobserver.h" -#include "tflogger.h" - -// ---------------------------------------------------------------------------- -// SatAppEventProvider::SatAppEventProvider -// (other items were commented in a header). -// ---------------------------------------------------------------------------- -// -SatAppEventProvider::SatAppEventProvider(QObject *parent) : - QObject(parent), mObs(NULL), mPlayTone(NULL) -{ - TFLOGSTRING("SATAPP: SatAppEventProvider::SatAppEventProvider call") - TRAPD(err, mObs = CSatUiObserver::NewL(); - mObs->ConnectRSatSessionL(); - ); - if ( KErrNone != err ) { - CloseSatUI(); - } else { - mObs->SetImplementer(this); - TFLOGSTRING("SATAPP: SatAppEventProvider::SatAppEventProvider \ - SetImplementer") - mPlayTone = new SatAppPlayToneProvider(this); - } - - TFLOGSTRING("SATAPP: SatAppEventProvider::SatAppEventProvider exit") -} - -// ---------------------------------------------------------------------------- -// SatAppEventProvider::~SatAppEventProvider -// Sets a pointer to SATAPP: SatAppEventProvider object. -// (other items were commented in a header). -// ---------------------------------------------------------------------------- -// -SatAppEventProvider::~SatAppEventProvider() -{ - TFLOGSTRING("SATAPP: SatAppEventProvider::~SatAppEventProvider call") - if (mObs){ - mObs->DisconnectRSatSession(); - delete mObs; - mObs = NULL; - } - if (mPlayTone) { - delete mPlayTone; - mPlayTone = NULL; - TFLOGSTRING("SATAPP: SatAppEventProvider::~SatAppEventProvider delete\ - mPlayTone") - } - TFLOGSTRING("SATAPP: SatAppEventProvider::~SatAppEventProvider exit") -} - -// ---------------------------------------------------------------------------- -// SatAppEventProvider::SetUpMenuL -// (other items were commented in a header). -// ---------------------------------------------------------------------------- -// -TSatUiResponse SatAppEventProvider::SetUpMenuL( - const TDesC &aText, - const MDesCArray &aMenuItems, - const CArrayFixFlat */*aMenuItemNextActions*/, - const CFbsBitmap */*aIconBitmap*/, - const TBool aSelfExplanatoryItems, - const TBool aHelpIsAvailable) -{ - TFLOGSTRING("SATAPP: SatAppEventProvider::SetUpMenuL call") - - TSatUiResponse response(ESatSuccess); - QString title; - if (aText.Length() > 0) { - title = QString::fromUtf16 (aText.Ptr(), aText.Length()); - TFLOGSTRING2("SATAPP: SatAppEventProvider::SetUpMenuL Title=%S", - &aText) - } - - QStringList *menuList = new QStringList(); - TFLOGSTRING("SATAPP: SatAppEventProvider::SetUpMenuL List") - - //Add Item - if(menuList) { - for (int i=0 ; iappend(item); - } - - TFLOGSTRING("SATAPP: SatAppEventProvider::SetUpMenuL add item") - - emit setUpMenuEvent( - response, - title, - *menuList, - aSelfExplanatoryItems, - aHelpIsAvailable); - - delete menuList; - } - TFLOGSTRING("SATAPP: SatAppEventProvider::SetUpMenuL exit") - - return response; -} - -// ---------------------------------------------------------------------------- -// SatAppEventProvider::SetUpMenuL -// (other items were commented in a header). -// ---------------------------------------------------------------------------- -// -TSatUiResponse SatAppEventProvider::SelectItemL( - const TDesC &aText, - const MDesCArray &aMenuItems, - const CArrayFixFlat */*aMenuItemNextActions*/, - const TInt aDefaultItem, - TUint8 &aSelection, - const CFbsBitmap */*aIconBitmap*/, - const TBool aSelfExplanatoryItems, - const TBool aHelpIsAvailable) -{ - TFLOGSTRING("SATAPP: SatAppEventProvider::SelectItemL call") - - TSatUiResponse response(ESatSuccess); - aSelection = 0; - QString title; - if (aText.Length() > 0) { - title=QString::fromUtf16(aText.Ptr(), aText.Length()); - TFLOGSTRING2("SATAPP: SatAppEventProvider::SelectItemL Title=%S", - &aText) - } - - QStringList *menuList = new QStringList(); - //Add Item - if(menuList) { - for (int i=0 ; iappend(item); - } - TFLOGSTRING("SATAPP: SatAppEventProvider::SelectItemL add item") - - emit selectItemEvent( - response, - title, - *menuList, - aDefaultItem, - aSelection, - aSelfExplanatoryItems, - aHelpIsAvailable); - - delete menuList; - } - TFLOGSTRING("SATAPP: SatAppEventProvider::SelectItemL exit") - - return response; -} - -// ---------------------------------------------------------------------------- -// SatAppEventProvider::ProfileState -// (other items were commented in a header). -// ---------------------------------------------------------------------------- -// -int SatAppEventProvider::profileState() -{ - TFLOGSTRING("SATAPP: SatAppEventProvider::ProfileState call") - int res (0); - if (mObs) { - res = mObs->ProfileState(); - } - TFLOGSTRING("SATAPP: SatAppEventProvider::ProfileState exit") - return res; -} - -// ---------------------------------------------------------------------------- -// SatAppEventProvider::MenuSelection -// (other items were commented in a header). -// ---------------------------------------------------------------------------- -// -void SatAppEventProvider::menuSelection(int aMenuItem, bool aHelpRequested) -{ - TFLOGSTRING2("SATAPP: SatAppEventProvider::MenuSelection call\ - aMenuItem=%d", aMenuItem) - if(mObs && mObs->Adapter()) { - mObs->Adapter()->MenuSelection(aMenuItem, aHelpRequested); - } - - TFLOGSTRING("SATAPP: SatAppEventProvider::MenuSelection exit") -} - -// ---------------------------------------------------------------------------- -// SatAppEventProvider::DisplayTextL -// (other items were commented in a header). -// ---------------------------------------------------------------------------- -// -TSatUiResponse SatAppEventProvider::DisplayTextL( - const TDesC &aText, - const TDesC &aSimApplicationName, - CFbsBitmap */*aIconBitmapDisplayText*/, - const TBool aSelfExplanatoryIcon, - const TBool aSustainedText, - const TTimeIntervalSeconds aDuration, - const TBool aWaitUserToClear) - { - TFLOGSTRING("SATAPP: SatAppEventProvider::DisplayTextL call") - - TSatUiResponse response(ESatSuccess); - QString title; - if (aText.Length() > 0) { - title=QString::fromUtf16(aText.Ptr(), aText.Length()); - TFLOGSTRING2("SATAPP: SatAppEventProvider::DisplayTextL \ - Title=%S", &aText) - } - - QString appName; - if (aSimApplicationName.Length() > 0) { - appName=QString::fromUtf16(aSimApplicationName.Ptr(), - aSimApplicationName.Length()); - TFLOGSTRING2("SATAPP: SatAppEventProvider::DisplayTextL \ - appName=%S", &aSimApplicationName) - } - - int timeInterval = aDuration.Int(); - TFLOGSTRING2("SATAPP: SatAppEventProvider::DisplayTextL: \ - timeInterval=%d", timeInterval) - - bool isSelfExplanatoryIcon = (aSelfExplanatoryIcon) ? true : false; - - emit displayTextEvent( - response, - title, - appName, - //const HbIcon &aIcon, - isSelfExplanatoryIcon, - aSustainedText, - timeInterval, - aWaitUserToClear); - - TFLOGSTRING("SATAPP: SatAppEventProvider::DisplayTextL exit") - return response; - } - -// ---------------------------------------------------------------------------- -// SatAppEventProvider::GetInputLL -// (other items were commented in a header). -// ---------------------------------------------------------------------------- -// -TSatUiResponse SatAppEventProvider::GetInputL( - const TDesC &aText, - const TSatCharacterSet aCharacterSet, - TDes &aInput, - const TInt aMinLength, - const TInt aMaxLength, - const TBool aHideInput, - const TBool aGetInkey, - const CFbsBitmap */*aIconBitmapGetInput*/, - const TBool aSelfExplanatory, - TUint &aDuration) -{ - TFLOGSTRING("SATAPP: SatAppEventProvider::GetInputL call") - - TSatUiResponse response(ESatSuccess); - - QString title; - if (aText.Length() > 0) { - title=QString::fromUtf16(aText.Ptr(), aText.Length()); - TFLOGSTRING2("SATAPP: SatAppEventProvider::GetInputL \ - Title=%S", &aText) - } - - QString inputText; - if (aInput.Length() > 0) { - inputText = QString::fromUtf16(aInput.Ptr(), aInput.Length()); - TFLOGSTRING2("SATAPP: SatAppEventProvider::GetInputL \ - inputText=%S", &aInput) - } - bool isSelfExplanatory = aSelfExplanatory; - unsigned int duration = aDuration; - - if (aGetInkey) { - //Get Inkey - emit getInkeyEvent( - response, - title, - aCharacterSet, - inputText, - isSelfExplanatory, - duration); - TFLOGSTRING("SATAPP: SatAppEventProvider::GetInputL: GetInkey") - aInput.Copy(reinterpret_cast(inputText.utf16()), inputText.length()); - } else { - // Get Input - bool hideInput = aHideInput; - int minLength = aMinLength; - int maxLength = aMaxLength; - emit getInputEvent( - response, - title, - aCharacterSet, - inputText, - minLength, - maxLength, - hideInput, - isSelfExplanatory, - duration); - int length = inputText.length(); - if (length > maxLength) { - length = maxLength; - } - aInput.Copy(reinterpret_cast(inputText.utf16()), length); - TFLOGSTRING2("SATAPP: SatAppEventProvider::GetInputL aInput=%S", &aInput) - } - TFLOGSTRING("SATAPP: SatAppEventProvider::GetInputL exit") - return response; -} - -// ---------------------------------------------------------------------------- -// SatAppEventProvider::CallControlL -// (other items were commented in a header). -// ---------------------------------------------------------------------------- -// -TSatUiResponse SatAppEventProvider::CallControlL( - const TDesC &aText, - const TSatAlphaIdStatus aAlphaIdStatus) -{ - TFLOGSTRING("SATAPP: SatAppEventProvider::CallControlL call") - QString text; - if (aText.Length() > 0) { - text=QString::fromUtf16(aText.Ptr(), aText.Length()); - TFLOGSTRING2("SATAPP: SatAppEventProvider::CallControlL \ - aText=%S", &aText) - } - emit callControlEvent(text, aAlphaIdStatus); - TFLOGSTRING("SATAPP: SatAppEventProvider::CallControlL exit") - return ESatSuccess; -} - -// ---------------------------------------------------------------------------- -// SatAppEventProvider::MoSmControlL -// (other items were commented in a header). -// ---------------------------------------------------------------------------- -// -TSatUiResponse SatAppEventProvider::MoSmControlL( - const TDesC &aText, - const TSatAlphaIdStatus aAlphaIdStatus) -{ - TFLOGSTRING("SATAPP: SatAppEventProvider::MoSmControlL call") - QString text; - if (aText.Length() > 0) { - text=QString::fromUtf16(aText.Ptr(), aText.Length()); - TFLOGSTRING2("SATAPP: SatAppEventProvider::MoSmControlL \ - aText=%S", &aText) - } - emit moSmControlEvent(text, aAlphaIdStatus); - TFLOGSTRING("SATAPP: SatAppEventProvider::MoSmControlL exit") - return ESatSuccess; -} - -// ---------------------------------------------------------------------------- -// SatAppEventProvider::GetYesNoL -// (other items were commented in a header). -// ---------------------------------------------------------------------------- -// -TSatUiResponse SatAppEventProvider::GetYesNoL( - const TDesC &aText, - const TSatCharacterSet aCharacterSet, - TChar &aInkey, - const CFbsBitmap */*aIconBitmap*/, - const TBool aSelfExplanatory, - TUint &aDuration, - const TBool aImmediateDigitResponse) -{ - TFLOGSTRING("SATAPP: SatAppEventProvider::GetYesNoL call") - TSatUiResponse response(ESatSuccess); - QString text; - if (aText.Length() > 0) { - text=QString::fromUtf16(aText.Ptr(), aText.Length()); - TFLOGSTRING2("SATAPP: SatAppEventProvider::GetYesNoL \ - aText=%S", &aText) - } - - unsigned int inKey = static_cast < TUint >(aInkey); - TFLOGSTRING2("SATAPP: SatAppEventProvider::GetYesNoL: inkey=%d", - inKey) - - bool selfExplanatory = aSelfExplanatory; - bool immediateDigitResponse = aImmediateDigitResponse; - unsigned int duration = aDuration; - - emit getYesNoEvent( - response, - text, - aCharacterSet, - inKey, - selfExplanatory, - duration, - immediateDigitResponse); - - aInkey = inKey; - TFLOGSTRING2("SATAPP: SatAppEventProvider::GetYesNoL key=%x", inKey) - TFLOGSTRING("SATAPP: SatAppEventProvider::GetYesNoL exit") - return response; -} - -// ---------------------------------------------------------------------------- -// SatAppEventProvider::ConfirmSendL -// (other items were commented in a header). -// ---------------------------------------------------------------------------- -// -TSatUiResponse SatAppEventProvider::ConfirmSendL( - const TDesC &aText, - TBool &aActionAccepted, - TInt aType) -{ - TFLOGSTRING("SATAPP: SatAppEventProvider::ConfirmSendL call") - TSatUiResponse response(ESatSuccess); - QString text; - if (aText.Length() > 0) { - text=QString::fromUtf16(aText.Ptr(), aText.Length()); - TFLOGSTRING2("SATAPP: SatAppEventProvider::GetYesNoL \ - aText=%S", &aText) - } - bool actionAccepted = aActionAccepted; - int type = aType; - emit confirmSendEvent( - response, - text, - actionAccepted, - type); - aActionAccepted = actionAccepted; - TFLOGSTRING("SATAPP: SatAppEventProvider::ConfirmSendL exit") - return response; -} - -// ---------------------------------------------------------------------------- -// SatAppEventProvider::ShowSmsWaitNoteL -// (other items were commented in a header). -// ---------------------------------------------------------------------------- -// -void SatAppEventProvider::ShowSmsWaitNoteL( - const TDesC &aText, - const CFbsBitmap */*aIconBitmapSendSM*/, - const TBool aSelfExplanatoryIcon) -{ - TFLOGSTRING("SATAPP: SatAppEventProvider::ShowSmsWaitNoteL call") - QString title; - if (aText.Length() > 0) { - title = QString::fromUtf16 (aText.Ptr(), aText.Length()); - TFLOGSTRING2("SATAPP: SatAppEventProvider::ShowSmsWaitNoteL \ - Title=%S", &aText) - } - bool selfExplanatoryIcon = aSelfExplanatoryIcon; - - emit showSmsWaitNoteEvent( - title, - selfExplanatoryIcon); - TFLOGSTRING("SATAPP: SatAppEventProvider::ShowSmsWaitNoteL exit") -} - -// ---------------------------------------------------------------------------- -// SatAppEventProvider::ConfirmSetUpCallL -// (other items were commented in a header). -// ---------------------------------------------------------------------------- -// -void SatAppEventProvider::ConfirmSetUpCallL( - const TDesC &aText, - const TDesC &aSimAppName, - TBool &aActionAccepted, - const CFbsBitmap */*aIconBitmap*/, - const TBool /*aSelfExplanatory*/) - { - TFLOGSTRING("SATAPP: SatAppEventProvider::ConfirmSetUpCallL call") - QString text; - if (aText.Length() > 0) { - text = QString::fromUtf16 (aText.Ptr(), aText.Length()); - TFLOGSTRING2("SATAPP: SatAppEventProvider::ConfirmSetUpCallL \ - text=%S", &aText) - } - - QString title; - if (aSimAppName.Length() > 0) { - title = QString::fromUtf16 (aSimAppName.Ptr(), aSimAppName.Length()); - TFLOGSTRING2("SATAPP: SatAppEventProvider::ConfirmSetUpCallL \ - Title=%S", &aSimAppName) - } - bool actionAccepted = aActionAccepted; - - emit showSetUpCallConfirmEvent( - text, - title, - actionAccepted); - aActionAccepted = actionAccepted; - TFLOGSTRING2("SATAPP: SatAppEventProvider::ConfirmSetUpCallL aActionAccepted %d \ - exit", aActionAccepted) - } - -// ---------------------------------------------------------------------------- -// SatAppEventProvider::ShowDtmfWaitNoteL -// (other items were commented in a header). -// ---------------------------------------------------------------------------- -// -TSatUiResponse SatAppEventProvider::ShowDtmfWaitNoteL( - const TDesC &aText, - const CFbsBitmap */*aIconBitmapSendSM*/, - const TBool /*aSelfExplanatoryIcon*/) -{ - TSatUiResponse response(ESatSuccess); - TFLOGSTRING("SATAPP: SatAppEventProvider::ShowDtmfWaitNoteL call") - QString title; - if (aText.Length() > 0) { - title = QString::fromUtf16 (aText.Ptr(), aText.Length()); - TFLOGSTRING2("SATAPP: SatAppEventProvider::ShowDtmfWaitNoteL \ - Title=%S", &aText) - } - emit showDtmfWaitNoteEvent( - response, - title); - TFLOGSTRING("SATAPP: SatAppEventProvider::ShowDtmfWaitNoteL exit") - return response; -} - -// ---------------------------------------------------------------------------- -// SatAppEventProvider::clearScreen -// (other items were commented in a header). -// ---------------------------------------------------------------------------- -// -void SatAppEventProvider::ClearScreen() -{ - TFLOGSTRING("SATAPP: SatAppEventProvider::ClearScreen call") - if (mPlayTone) { - mPlayTone->clearScreen(); - } - emit clearScreenEvent(); - TFLOGSTRING("SATAPP: SatAppEventProvider::ClearScreen exit") -} - -// ---------------------------------------------------------------------------- -// SatAppEventProvider::CloseSatUI -// (other items were commented in a header). -// ---------------------------------------------------------------------------- -// -void SatAppEventProvider::CloseSatUI() -{ - TFLOGSTRING("SATAPP: SatAppEventProvider::CloseSatUI call") - if (mPlayTone) { - mPlayTone->closeSatUI(); - } - - emit closeUiEvent(); - TFLOGSTRING("SATAPP: SatAppEventProvider::CloseSatUI exit") -} - -//----------------------------------------------------------------------------- -// SatAppEventProvider::StopShowWaitNote -// (other items were commented in a header). -// ---------------------------------------------------------------------------- -// -void SatAppEventProvider::StopShowWaitNote() -{ - TFLOGSTRING("SATAPP: SatAppEventProvider::StopShowWaitNote call") - emit stopShowWaitNoteEvent(); - TFLOGSTRING("SATAPP: SatAppEventProvider::StopShowWaitNote exit") -} - -//----------------------------------------------------------------------------- -// SatAppEventProvider::userCancelResponse -// (other items were commented in a header). -// ---------------------------------------------------------------------------- -// -void SatAppEventProvider::userCancelResponse() -{ - TFLOGSTRING("SATAPP: SatAppEventProvider::userCancelResponse call") - mObs->Adapter()->SessionTerminated( ESessionCancel ); - TFLOGSTRING("SATAPP: SatAppEventProvider::userCancelResponse exit") -} - -//----------------------------------------------------------------------------- -// SatAppEventProvider::ShowSsWaitNoteL -// (other items were commented in a header). -// ---------------------------------------------------------------------------- -// -void SatAppEventProvider::ShowSsWaitNoteL( - const TDesC &aText, - const CFbsBitmap* /*aIconBitmap*/, - const TBool aSelfExplanatoryIcon ) -{ - TFLOGSTRING("SATAPP: SatAppEventProvider::ShowSsWaitNoteL call") - QString title; - if (aText.Length() > 0) { - title = QString::fromUtf16 (aText.Ptr(), aText.Length()); - TFLOGSTRING2("SATAPP: SatAppEventProvider::ShowSsWaitNoteL \ - Title=%S", &aText) - } - bool selfExplanatoryIcon = aSelfExplanatoryIcon; - - emit showSsWaitNoteEvent( - title, - selfExplanatoryIcon); - TFLOGSTRING("SATAPP: SatAppEventProvider::ShowSsWaitNoteL exit") -} - -//----------------------------------------------------------------------------- -// SatAppEventProvider::ShowWaitNoteWithoutDelayL -// (other items were commented in a header). -// ---------------------------------------------------------------------------- -// -void SatAppEventProvider::ShowWaitNoteWithoutDelayL() -{ - TFLOGSTRING("SATAPP: SatAppEventProvider::ShowWaitNoteWithoutDelayL call") - emit showWaitNoteWithoutDelayEvent(); - TFLOGSTRING("SATAPP: SatAppEventProvider::ShowWaitNoteWithoutDelayL exit") -} - -//----------------------------------------------------------------------------- -// SatAppEventProvider::showSsErrorNoteEvent -// (other items were commented in a header). -// ---------------------------------------------------------------------------- -// -void SatAppEventProvider::ShowSsErrorNoteL() -{ - TFLOGSTRING("SATAPP: SatAppEventProvider::showSsErrorNoteEvent call") - emit showSsErrorNoteEvent(); - TFLOGSTRING("SATAPP: SatAppEventProvider::showSsErrorNoteEvent exit") -} - -//----------------------------------------------------------------------------- -// SatAppEventProvider::ShowBIPNoteL -// (other items were commented in a header). -// ---------------------------------------------------------------------------- -// -void SatAppEventProvider::ShowBIPNoteL( TInt aCommand, const TDesC &aText, - const CFbsBitmap* /*aIconBitmap*/, const TBool /*aSelfExplanatory*/) -{ - TFLOGSTRING("SATAPP: SatAppEventProvider::ShowBIPNoteL call") - int cmdType = aCommand; - QString title; - if (aText.Length() > 0) { - title=QString::fromUtf16(aText.Ptr(), aText.Length()); - TFLOGSTRING2("SATAPP: SatAppEventProvider::ShowBIPNoteL \ - Title=%S", &aText) - } - emit showBIPNoteEvent(cmdType, title); - TFLOGSTRING("SATAPP: SatAppEventProvider::ShowBIPNoteL exit") -} - -//----------------------------------------------------------------------------- -// SatAppEventProvider::ConfirmOpenChannelL -// (other items were commented in a header). -// ---------------------------------------------------------------------------- -// -TSatUiResponse SatAppEventProvider::ConfirmOpenChannelL( - const TDesC &aText, - TBool &aActionAccepted, - const CFbsBitmap* /*aIconBitmapOpenChannel*/, - const TBool /*aSelfExplanatory*/ ) -{ - TFLOGSTRING("SATAPP: SatAppEventProvider::ConfirmOpenChannelL call") - TSatUiResponse response( ESatSuccess ); - - QString title; - if (aText.Length() > 0) { - title=QString::fromUtf16(aText.Ptr(), aText.Length()); - TFLOGSTRING2("SATAPP: SatAppEventProvider::ConfirmOpenChannelL \ - Title=%S", &aText) - } - bool actionAccepted = aActionAccepted; - emit showOpenChannelConfirmEvent(title, actionAccepted); - // Show progress dialog when Openchannel confirmed - if( actionAccepted ) { - emit showWaitNoteWithoutDelayEvent(); - } - aActionAccepted = actionAccepted; - TFLOGSTRING2( "SATAPP: SatAppEventProvider::ConfirmOpenChannelL exit\ - response: %d", response) - return response; -} - -//----------------------------------------------------------------------------- -// SatAppEventProvider::PlayStandardToneL -// (other items were commented in a header). -// ---------------------------------------------------------------------------- -// -TSatUiResponse SatAppEventProvider::PlayStandardToneL( const TDesC& aText, - const TDesC8& aSequence, - TTimeIntervalMicroSeconds aDuration, - const CFbsBitmap* aIconBitmap, - const TBool aSelfExplanatory ) -{ - TFLOGSTRING("SATAPP: SatAppEventProvider::PlayStandardToneL call") - TSatUiResponse response = mPlayTone->PlayStandardToneL( - aText, aSequence, aDuration, aIconBitmap, aSelfExplanatory); - TFLOGSTRING2("SATAPP: SatAppEventProvider::PlayStandardToneL \ - response= %d exit", response) - return response; -} - -//----------------------------------------------------------------------------- -// SatAppEventProvider::PlayUserSelectedToneL -// (other items were commented in a header). -// ---------------------------------------------------------------------------- -// -TSatUiResponse SatAppEventProvider::PlayUserSelectedToneL( - const TDesC &aText, - TTimeIntervalMicroSeconds aDuration, - TSatTone aTone, - const CFbsBitmap* aIconBitmap, - const TBool aSelfExplanatory ) -{ - TFLOGSTRING("SatAppEventProvider::PlayUserSelectedToneL calling") - TSatUiResponse response = mPlayTone->PlayUserSelectedToneL( - aText, aDuration, aTone, aIconBitmap, aSelfExplanatory); - TFLOGSTRING2( "SatAppEventProvider::PlayUserSelectedToneL response= %d \ - exit", response) - return response; -} - -//End of file diff -r 1f002146abb4 -r cee7e9e0906c satui/satapp/src/satappinputprovider.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/satui/satapp/src/satappinputprovider.cpp Wed Aug 18 10:19:22 2010 +0300 @@ -0,0 +1,636 @@ +/* +* Copyright (c) 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" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Provides input methods like query dialogs +* +*/ + +// qt +#include +#include +// hb +#include +#include +#include +#include +#include +#include +#include +// satapp +#include "satappinputprovider.h" +#include "satappconstant.h" +#include "satappaction.h" + + +// ---------------------------------------------------------------------------- +// SatAppInputProvider::SatAppInputProvider +// ---------------------------------------------------------------------------- +// +SatAppInputProvider::SatAppInputProvider(QObject *parent) + : QObject(parent), mCurrentAction(0), mCurrentDialog(0) +{ + qDebug("SATAPP: SatAppInputProvider::SatAppInputProvider >"); + mDurationTimer = new QTimer(this); + qDebug("SATAPP: SatAppInputProvider::SatAppInputProvider <"); +} + +// ---------------------------------------------------------------------------- +// SatAppInputProvider::~SatAppInputProvider +// ---------------------------------------------------------------------------- +// +SatAppInputProvider::~SatAppInputProvider() +{ + qDebug("SATAPP: SatAppInputProvider::~SatAppInputProvider >"); + delete mCurrentDialog; + mCurrentDialog = 0; + qDebug("SATAPP: SatAppInputProvider::~SatAppInputProvider <"); +} + +// ---------------------------------------------------------------------------- +// SatAppInputProvider::getInkey +// requests user to enter a SINGLE key, character or digit +// ---------------------------------------------------------------------------- +// +void SatAppInputProvider::getInkey(SatAppAction& action) +{ + qDebug("SATAPP: SatAppInputProvider::getInkey >"); + + delete mCurrentDialog; + mCurrentDialog=0; + + QString heading = action.value(KeyText).toString(); + qDebug() << "SATAPP: getInkey: heading=" << heading; + + TSatCharacterSet characterSet = + static_cast(action.value(KeyCharacterSet).toInt()); + + qDebug("SATAPP: SatAppInputProvider::getInkey char set %d", characterSet); + + // yes no query must have text. + if ((0 == heading.length()) && (ESatYesNo == characterSet)) { + action.completeWithFailure(); + return; + } + + // duration + int duration = action.value(KeyDuration).toInt(); + if (duration == 0) { + duration = KDefaultSelectionTimeoutMseconds; + } + qDebug("SATAPP: getInkey: duration=%d", duration); + mInputTimer.start(); + + if (heading.isEmpty()) { + if (ESatDigitOnly == characterSet) { + heading = hbTrId("txt_simatk_dialog_entern1_digit_09"); + } else { + // ESatCharSmsDefaultAlphabet or ESatCharUcs2Alphabet + heading = hbTrId("txt_simatk_dialog_entern1_character"); + } + } + qDebug() << "SATAPP: getInkey: heading=" << heading; + + mCurrentAction = &action; + bool immediate = action.value(KeyImmediate).toBool(); + qDebug() << "SATAPP: getInkey: immediate=" << immediate; + + if (characterSet == ESatYesNo) { + //Yes no imediate will be combine with YES no. + showGetYesNoQuery(heading, duration); + } + else if (immediate) { + // we only have digit immediate + showGetImmediateQuery(heading, duration); + } + else { + // Reminder, there is no default inkey in get inkey + // proactive command. + showGetInkeyQuery(heading, characterSet, duration); + } + SAT_ASSERT(connect(mCurrentAction, SIGNAL(actionCompleted(SatAppAction*)), + this, SLOT(clearDurationTimer()))); + qDebug("SATAPP: SatAppInputProvider::getInkey <"); +} + +// ---------------------------------------------------------------------------- +// SatAppInputProvider::getInput +// requests user to enter a STRING of free text, number or password etc. +// ---------------------------------------------------------------------------- +// +void SatAppInputProvider::getInput(SatAppAction& action) +{ + qDebug("SATAPP: SatAppInputProvider::getInput >"); + + delete mCurrentDialog; + mCurrentDialog=0; + // character set + TSatCharacterSet characterSet = + static_cast(action.value(KeyCharacterSet).toInt()); + + qDebug("SATAPP: SatAppInputProvider::getInput char set %d", characterSet); + + // heading + QString heading = action.value(KeyText).toString(); + qDebug() << "SATAPP: getInput: heading=" << heading; + if (heading.isEmpty()) { + if (ESatDigitOnly == characterSet) { + heading = hbTrId("txt_simatk_dialog_entern1_digit_09"); + } else { + // ESatCharSmsDefaultAlphabet or ESatCharUcs2Alphabet + heading = hbTrId("txt_simatk_dialog_entern1_character"); + } + } + qDebug() << "SATAPP: getInput: heading=" << heading; + + // min length + int minLength = action.value(KeyMinLength).toInt(); + if (minLength<0) { + minLength=0; + } + if (minLength>KGetInputStringMaxSize){ + minLength=KGetInputStringMaxSize; + } + + // max length + int maxLength = action.value(KeyMaxLength).toInt(); + if (maxLengthKGetInputStringMaxSize) { + maxLength=KGetInputStringMaxSize; + } + qDebug("SATAPP: SatAppInputProvider::getInput min %d", minLength); + qDebug("SATAPP: SatAppInputProvider::getInput max %d", maxLength); + + // default input text + QString inputText = action.value(KeyInputString).toString(); + if (inputText.length() < minLength || inputText.length() > maxLength){ + inputText = ""; + } + qDebug() << "SATAPP: getInput: inputText=" << inputText; + + // hide input + bool hideInput = action.value(KeyHideInput).toBool(); + qDebug("SATAPP: SatAppInputProvider::getInput hide %d", hideInput); + + qDebug("SATAPP: getInput: min=%d,max=%d,hide=%d", + minLength, maxLength, hideInput); + + mCurrentAction = &action; + showGetInputQuery( heading, inputText, + characterSet, minLength, maxLength, hideInput); + + SAT_ASSERT(connect(mCurrentAction, SIGNAL(actionCompleted(SatAppAction*)), + this, SLOT(clearDurationTimer()))); + qDebug("SATAPP: SatAppInputProvider::getInput <"); +} + +// ---------------------------------------------------------------------------- +// SatAppInputProvider::showGetInkeyQuery +// ---------------------------------------------------------------------------- +// +void SatAppInputProvider::showGetInkeyQuery( + const QString &heading, + TSatCharacterSet characterSet, + int duration) +{ + qDebug("SATAPP: SatAppInputProvider::showGetInkeyQuery >"); + + HbInputDialog* inputDialog = new HbInputDialog(); + mCurrentDialog = inputDialog; + // Set PromptText + inputDialog->setPromptText(heading); + // Set ContentText + HbEditorInterface inputMode(inputDialog->lineEdit()); + inputDialog->lineEdit()->setFocus(); + if (ESatDigitOnly == characterSet) { + // digit mode, digits only (0 9, *, #, and +) + inputMode.setFilter(HbPhoneNumberFilter::instance()); + inputMode.setMode(HbInputModeNumeric); + inputMode.setInputConstraints(HbEditorConstraintFixedInputMode); + } else { + // char mode + inputMode.setUpAsLatinAlphabetOnlyEditor(); + } + composeDialog(inputDialog, GetInkey); + mCurrentAction->set(KeyMinLength, 1); + inputDialog->lineEdit()->setMaxLength(1); + + // when input changed, enable/disable OK button + SAT_ASSERT(connect(inputDialog->lineEdit(), SIGNAL(textChanged(QString)), + this, SLOT(updateQueryAction(QString)))); + // when OK pressed, fill in data to action and complete it + SAT_ASSERT(connect(inputDialog->actions().at(0), SIGNAL(triggered()), + this, SLOT(transmitInkeyFromDialog()))); + // when cancel pressed, complete action with ESatBackwardModeRequestedByUser + SAT_ASSERT(connect(inputDialog->actions().at(1), SIGNAL(triggered()), + mCurrentAction, SLOT(completeWithBackRequested()))); + // after timeout, reset the provider + startDurationTimer(duration); + // open the dialog. When the dialog closes, reset everything + inputDialog->open(); + + qDebug("SATAPP: SatAppInputProvider::showGetInkeyQuery <"); +} + +// ---------------------------------------------------------------------------- +// SatAppInputProvider::showGetImmediateQuery +// ---------------------------------------------------------------------------- +// +void SatAppInputProvider::showGetImmediateQuery( + const QString &heading, + int duration) +{ + qDebug("SATAPP: SatAppInputProvider::showGetImmediateQuery >"); + + HbInputDialog* inputDialog = new HbInputDialog(); + mCurrentDialog = inputDialog; + // Set PromptText + inputDialog->setPromptText(heading); + // Set ContentText + HbEditorInterface inputMode(inputDialog->lineEdit()); + inputDialog->lineEdit()->setFocus(); + + inputMode.setFilter(HbPhoneNumberFilter::instance()); + inputMode.setMode(HbInputModeNumeric); + inputMode.setInputConstraints(HbEditorConstraintFixedInputMode); + + composeDialog(inputDialog, GetImmediate); + + // when receiving first input character, send it immediately + SAT_ASSERT(connect(inputDialog->lineEdit(), SIGNAL(textChanged(QString)), + this, SLOT(transmitInkeyImmediately(QString)))); + // when cancel pressed, complete action with ESatBackwardModeRequestedByUser + SAT_ASSERT(connect(inputDialog->actions().at(0), SIGNAL(triggered()), + mCurrentAction, SLOT(completeWithBackRequested()))); + // after timeout, reset the provider + startDurationTimer(duration); + // open the dialog. When the dialog closes, reset everything + inputDialog->open(); + + qDebug("SATAPP: SatAppInputProvider::showGetImmediateQuery <"); +} + +// ---------------------------------------------------------------------------- +// SatAppInputProvider::showGetYesNoQuery +// ---------------------------------------------------------------------------- +// +void SatAppInputProvider::showGetYesNoQuery( + const QString &text, + int duration) +{ + qDebug("SATAPP: SatAppInputProvider::showGetYesNoQuery >"); + HbMessageBox* messageBox = new HbMessageBox(HbMessageBox::MessageTypeInformation); + mCurrentDialog = messageBox; + + // Set the label as heading widget + HbLabel *lHeading = new HbLabel(text, messageBox); + messageBox->setHeadingWidget(lHeading); + messageBox->setIconVisible(false); + + composeDialog(messageBox, GetYesNo); + + // when YES pressed, complete action with ESatSuccess, inkey set to 1 + SAT_ASSERT(connect(messageBox->actions().at(0), SIGNAL(triggered()), + this, SLOT(transmitInkeyTrue()))); + // when NO pressed, complete action with ESatSuccess, inkey set to 0 + SAT_ASSERT(connect(messageBox->actions().at(1), SIGNAL(triggered()), + this, SLOT(transmitInkeyFalse()))); + + startDurationTimer(duration); + // show dialog. + messageBox->open(); + + qDebug("SATAPP: SatAppInputProvider::showGetYesNoQuery <"); +} + +// ---------------------------------------------------------------------------- +// SatAppInputProvider::showGetInputQuery +// ---------------------------------------------------------------------------- +// +void SatAppInputProvider::showGetInputQuery( + const QString& heading, + const QString& content, + TSatCharacterSet characterSet, + int minLength, + int maxLength, + bool hideInput) +{ + Q_UNUSED(minLength); + qDebug("SATAPP: SatAppInputProvider::showGetInputQuery >"); + + HbInputDialog* inputQuery = new HbInputDialog(); + mCurrentDialog = inputQuery; + inputQuery->setPromptText(heading); + inputQuery->setValue(QVariant(content)); + HbEditorInterface inputMode(inputQuery->lineEdit()); + inputQuery->lineEdit()->setFocus(); + if (ESatDigitOnly == characterSet) { + // digit mode, digits only (0 9, *, #, and +) + inputMode.setFilter(HbPhoneNumberFilter::instance()); + inputMode.setMode(HbInputModeNumeric); + inputMode.setInputConstraints(HbEditorConstraintFixedInputMode); + } else { + // char mode + inputMode.setUpAsLatinAlphabetOnlyEditor(); + } + + inputQuery->lineEdit()->setMaxLength(maxLength); + + composeDialog(inputQuery, GetInput); + // initially set the button states + updateQueryAction(inputQuery->value().toString()); + + if (hideInput) { + inputQuery->lineEdit()->setEchoMode(HbLineEdit::Password); + qDebug("SATAPP: showGetInputQuery: hiding input"); + } + + // when dialog content changes, dim ok button accordingly, use + // use contentChanged signal from the base class of the editor + // to get the signal when in password mode + SAT_ASSERT(connect(inputQuery->lineEdit(), SIGNAL(contentsChanged()), + this, SLOT(updateQueryAction()))); + // transmit the text on OK press + SAT_ASSERT(connect(inputQuery->actions().at(0), SIGNAL(triggered()), + this, SLOT(transmitStringFromDialog()))); + // on Cancel key complete action with ESatBackwardModeRequestedByUser + SAT_ASSERT(connect(inputQuery->actions().at(1), SIGNAL(triggered()), + mCurrentAction, SLOT(completeWithBackRequested()))); + // after timeout, reset the provider + startDurationTimer(KDefaultSelectionTimeoutMseconds); + // open dialog. When it closes, reset everything + inputQuery->open(); + + qDebug("SATAPP: SatAppInputProvider::showGetInputQuery <"); +} + +// ---------------------------------------------------------------------------- +// SatAppInputProvider::resetState +// ---------------------------------------------------------------------------- +// +void SatAppInputProvider::resetState() +{ + qDebug("SATAPP: SatAppInputProvider::resetState >"); + if (mCurrentAction) { + qDebug("SATAPP: SatAppInputProvider::resetState action"); + mCurrentAction->completeWithNoResponse(); + mCurrentAction = 0; + } + + qDebug("SATAPP: SatAppInputProvider::resetState action done"); + + delete mCurrentDialog; + mCurrentDialog = 0; + qDebug("SATAPP: SatAppInputProvider::resetState <"); +} + +// ---------------------------------------------------------------------------- +// SatAppInputProvider::composeDialog +// make sure dlg has 2 buttons +// ---------------------------------------------------------------------------- +// +void SatAppInputProvider::composeDialog( + HbDialog *dlg, + DialogMode mode) +{ + qDebug("SATAPP: SatAppInputProvider::composeDialog >"); + Q_ASSERT(mCurrentAction); + + dlg->setModal(true); + dlg->setDismissPolicy(HbDialog::NoDismiss); + + dlg->clearActions(); + HbAction *primaryAction = new HbAction(dlg); + dlg->addAction(primaryAction); + + HbAction *secondaryAction = new HbAction(dlg); + dlg->addAction(secondaryAction); + + switch(mode){ + case GetYesNo: + { + primaryAction->setText(hbTrId("txt_common_button_yes")); + secondaryAction->setText(hbTrId("txt_common_button_no")); + break; + } + case GetImmediate: + { + dlg->removeAction(primaryAction); + secondaryAction->setText(hbTrId("txt_common_button_cancel")); + break; + } + default: + { + primaryAction->setText(hbTrId("txt_common_button_ok")); + primaryAction->setEnabled(false); + secondaryAction->setText(hbTrId("txt_common_button_cancel")); + break; + } + } + qDebug("SATAPP: SatAppInputProvider::composeDialog <"); +} + +// ---------------------------------------------------------------------------- +// SatAppInputProvider::updateQueryAction +// Updates dialog's OK button according to input text length limits +// ---------------------------------------------------------------------------- +// +void SatAppInputProvider::updateQueryAction() +{ + qDebug("SATAPP: SatAppInputProvider::updateQueryAction >"); + Q_ASSERT(mCurrentDialog); + QString content = + qobject_cast(mCurrentDialog)->value().toString(); + qDebug() << "SATAPP: updateQueryAction: content=" << content; + updateQueryAction(content); + qDebug("SATAPP: SatAppInputProvider::updateQueryAction >"); +} + +// ---------------------------------------------------------------------------- +// SatAppInputProvider::updateQueryAction +// Updates dialog's OK button according to input text length limits +// ---------------------------------------------------------------------------- +// +void SatAppInputProvider::updateQueryAction(QString text) +{ + qDebug("SATAPP: SatAppInputProvider::updateQueryAction 2>"); + Q_ASSERT(mCurrentDialog); + qDebug() << "SATAPP: updateQueryAction 2: text=" << text; + int min=0; + if (mCurrentAction->hasValue(KeyMinLength)) + min=mCurrentAction->value(KeyMinLength).toInt(); + int max=10; + if (mCurrentAction->hasValue(KeyMaxLength)) + max=mCurrentAction->value(KeyMaxLength).toInt(); + if (mCurrentDialog->actions().at(0)) { + if (text.length() >= min && text.length() <= max) { + mCurrentDialog->actions().at(0)->setEnabled(true); + } else { + mCurrentDialog->actions().at(0)->setEnabled(false); + } + } + qDebug("SATAPP: SatAppInputProvider::updateQueryAction 2<"); +} + +// ---------------------------------------------------------------------------- +// SatAppInputProvider::transmitInkeyFromDialog +// ---------------------------------------------------------------------------- +// +void SatAppInputProvider::transmitInkeyFromDialog() +{ + qDebug("SATAPP: SatAppInputProvider::transmitInkeyFromDialog >"); + Q_ASSERT(mCurrentDialog); + Q_ASSERT(mCurrentAction->action()==ESatGetInkeyAction); + // grab the input string + HbInputDialog* inkeyQuery = static_cast(mCurrentDialog); + QString inputString = inkeyQuery->value().toString(); + qDebug() << "SATAPP: transmitInkeyFromDialog: input=" << inputString; + transmitInkeyImmediately(inputString); + qDebug("SATAPP: SatAppInputProvider::transmitInkeyFromDialog <"); +} + +// ---------------------------------------------------------------------------- +// SatAppInputProvider::transmitInkeyImmediately +// ---------------------------------------------------------------------------- +// +void SatAppInputProvider::transmitInkeyImmediately(QString text) +{ + qDebug("SATAPP: SatAppInputProvider::transmitInkeyImmediately >"); + transmitInkey((int)text.utf16()[0]); + qDebug("SATAPP: SatAppInputProvider::transmitInkeyImmediately <"); +} + + +// ---------------------------------------------------------------------------- +// SatAppInputProvider::transmitInkeyTrue +// ---------------------------------------------------------------------------- +// +void SatAppInputProvider::transmitInkeyTrue() +{ + qDebug("SATAPP: SatAppInputProvider::transmitInkeyTrue >"); + Q_ASSERT(mCurrentAction); + Q_ASSERT(mCurrentAction->action()==ESatGetInkeyAction); + Q_ASSERT(mCurrentAction->value(KeyCharacterSet).toInt()==ESatYesNo); + transmitInkey(1); + qDebug("SATAPP: SatAppInputProvider::transmitInkeyTrue <"); +} + +// ---------------------------------------------------------------------------- +// SatAppInputProvider::transmitInkeyFalse +// ---------------------------------------------------------------------------- +// +void SatAppInputProvider::transmitInkeyFalse() +{ + qDebug("SATAPP: SatAppInputProvider::transmitInkeyFalse >"); + Q_ASSERT(mCurrentAction); + Q_ASSERT(mCurrentAction->action()==ESatGetInkeyAction); + Q_ASSERT(mCurrentAction->value(KeyCharacterSet).toInt()==ESatYesNo); + transmitInkey(0); + qDebug("SATAPP: SatAppInputProvider::transmitInkeyFalse >"); +} + +// ---------------------------------------------------------------------------- +// SatAppInputProvider::transmit +// ---------------------------------------------------------------------------- +// +void SatAppInputProvider::transmitInkey(int key) +{ + qDebug("SATAPP: SatAppInputProvider::transmitInkey >"); + qDebug("SATAPP: SatAppInputProvider::transmitInkey %d",key); + Q_ASSERT(mCurrentAction); + Q_ASSERT(mCurrentAction->action()==ESatGetInkeyAction); + // write inkey + mCurrentAction->set(KeyInKey,key); + // overwrite timer duration + if (mCurrentAction->hasValue(KeyDuration)) { + int newDuration = mInputTimer.elapsed(); + qDebug("SATAPP: SatAppInputProvider::transmitInkey dur ", newDuration); + mCurrentAction->set(KeyDuration, newDuration); + } + bool immediate = mCurrentAction->value(KeyImmediate).toBool(); + if(immediate) { + mCurrentDialog->close(); + } + mCurrentAction->completeWithSuccess(); + mCurrentAction = 0; + qDebug("SATAPP: SatAppInputProvider::transmitInkey >"); +} + +// ---------------------------------------------------------------------------- +// SatAppInputProvider::transmitStringFromDialog +// ---------------------------------------------------------------------------- +// +void SatAppInputProvider::transmitStringFromDialog() +{ + qDebug("SATAPP: SatAppInputProvider::transmitStringFromDialog >"); + Q_ASSERT(mCurrentDialog); + Q_ASSERT(mCurrentAction); + Q_ASSERT(mCurrentAction->action()==ESatGetInputAction); + // write input string + HbInputDialog* inputQuery = static_cast(mCurrentDialog); + QString inputString = inputQuery->value().toString(); + qDebug() << "SATAPP: transmitStringFromDialog: string=" << inputString; + + mCurrentAction->set(KeyInputString,inputString); + // overwrite timer duration + if (mCurrentAction->hasValue(KeyDuration)) { + int newDuration = mInputTimer.elapsed(); + qDebug("SATAPP: SatAppInputProvider::transmitStringFromDialog dur ", + newDuration); + mCurrentAction->set(KeyDuration, newDuration); + } + mCurrentAction->completeWithSuccess(); + mCurrentAction = 0; + qDebug("SATAPP: SatAppInputProvider::transmitStringFromDialog >"); +} + +// ---------------------------------------------------------------------------- +// SatAppInputProvider::startDurationTimer +// ---------------------------------------------------------------------------- +// +void SatAppInputProvider::startDurationTimer(int duration) +{ + qDebug("SATAPP: SatAppInputProvider::startDurationTimer %d>", duration); + Q_ASSERT(mDurationTimer); + if (duration) { + mDurationTimer->setSingleShot(true); + SAT_ASSERT(connect(mDurationTimer, SIGNAL(timeout()), + this, SLOT(resetState()))); + mDurationTimer->start(duration); + } + qDebug("SATAPP: SatAppInputProvider::startDurationTimer <"); +} + +// ---------------------------------------------------------------------------- +// SatAppInputProvider::clearDurationTimer +// ---------------------------------------------------------------------------- +// +void SatAppInputProvider::clearDurationTimer() +{ + qDebug("SATAPP: SatAppInputProvider::clearDurationTimer >"); + Q_ASSERT(mDurationTimer); + Q_ASSERT(mCurrentAction); + + bool res = disconnect(mCurrentAction, SIGNAL(actionCompleted(SatAppAction*)), + this, SLOT(clearDurationTimer())); + qDebug("SATAPP: SatAppInputProvider::clearDurationTimer act %d>", res); + res = disconnect(mDurationTimer, SIGNAL(timeout()), + this, SLOT(resetState())); + qDebug("SATAPP: SatAppInputProvider::clearDurationTimer dur %d>", res); + + mDurationTimer->stop(); + qDebug("SATAPP: SatAppInputProvider::clearDurationTimer <"); +} + +//End of file diff -r 1f002146abb4 -r cee7e9e0906c satui/satapp/src/satappmainhandler.cpp --- a/satui/satapp/src/satappmainhandler.cpp Tue Jul 06 14:53:02 2010 +0300 +++ b/satui/satapp/src/satappmainhandler.cpp Wed Aug 18 10:19:22 2010 +0300 @@ -15,13 +15,27 @@ * * */ +//Qt +#include +#include +#include +#include + +// symbian +#include +#include #include "satappmainhandler.h" -#include "satappuiprovider.h" -#include "satappeventprovider.h" -#include "satappcommandhandler.h" -#include "satappcommonconstant.h" -#include "tflogger.h" +#include "satappserverdispatcher.h" +#include "satappmenuprovider.h" +#include "satappinputprovider.h" +#include "satapptoneprovider.h" +#include "satapppopupprovider.h" +#include "satappconstant.h" +#include "satappconfirmprovider.h" + +// Activity ID for Sat Application +const char *SATAPP_ACTIVITY_ID = "SIMServicesList"; // ======== MEMBER FUNCTIONS ================================================== @@ -31,16 +45,26 @@ // ---------------------------------------------------------------------------- // SatAppMainHandler::SatAppMainHandler(HbMainWindow &window, - QObject */*parent*/):mEvent(NULL), mUi(NULL), mCommand(NULL) + QObject */*parent*/): +mOfflineWarningDlg(NULL) { - TFLOGSTRING("SATAPP: SatAppMainHandler::SatAppMainHandler call") + qDebug("SATAPP: SatAppMainHandler::SatAppMainHandler >"); - mEvent = new SatAppEventProvider(this); - mUi = new SatAppUiProvider(window, *mEvent, this); - mCommand = new SatAppCommandHandler(*mUi, this); - - initConnections(); - TFLOGSTRING("SATAPP: SatAppMainHandler::SatAppMainHandler exit") + if(!isOffline()){ + mServer = new SatAppServerDispatcher(this); + mMenu = new SatAppMenuProvider(&window, this); + mInput = new SatAppInputProvider(this); + mTone = new SatAppToneProvider(this); + mPopup = new SatAppPopupProvider(this); + mConfirm = new SatAppConfirmProvider(this); + initConnections(); + } + else{ + showOfflineWarning(); + } + removeActivity(); + + qDebug("SATAPP: SatAppMainHandler::SatAppMainHandler <"); } // ---------------------------------------------------------------------------- @@ -50,7 +74,25 @@ // SatAppMainHandler::~SatAppMainHandler() { - TFLOGSTRING("SATAPP: SatAppMainHandler::~SatAppMainHandler call-exit") + qDebug("SATAPP: SatAppMainHandler::~SatAppMainHandler >"); + delete mOfflineWarningDlg; + qDebug("SATAPP: SatAppMainHandler::~SatAppMainHandler <"); +} + +// ---------------------------------------------------------------------------- +// Local override for connect-function +// this method ENSURES that the connection is succesful. +// ---------------------------------------------------------------------------- +// +void doConnect( + const QObject *sender, + const char *signal, + const QObject *receiver, + const char *member) +{ + bool ret = QObject::connect(sender, signal, + receiver, member, Qt::DirectConnection); + Q_ASSERT_X(ret, "doConnect: connection failed for: ", signal); } // ---------------------------------------------------------------------------- @@ -60,181 +102,201 @@ // void SatAppMainHandler::initConnections() { - TFLOGSTRING("SATAPP: SatAppMainHandler::initConnections call") - // For SetUpMenu - bool ret = connect(mEvent, SIGNAL(setUpMenuEvent(TSatUiResponse &, - QString, QStringList, bool, bool)), - mCommand, SLOT(setUpMenu(TSatUiResponse &, - QString, QStringList, bool, bool)), - Qt::DirectConnection); - TFLOGSTRING2("SATAPP: SatAppMainHandler::initConnections: \ - SetUpMenu=%d", ret) - - // For SelectItem - ret = connect(mEvent, SIGNAL(selectItemEvent(TSatUiResponse&, - QString, QStringList, - int, unsigned char&, bool, bool)), - mCommand, SLOT(selectItem(TSatUiResponse&, - QString,QStringList, - int, unsigned char&, bool, bool)), - Qt::DirectConnection); - TFLOGSTRING2("SATAPP: SatAppMainHandler::initConnections: \ - SelectItem=%d", ret) - - // for display text - ret = connect(mEvent, SIGNAL(displayTextEvent(TSatUiResponse &, - QString, QString, bool &, bool, int, bool)), - mCommand, SLOT(displayText(TSatUiResponse&, - QString, QString, bool &, bool, int, bool)), - Qt::DirectConnection); - - TFLOGSTRING2("SATAPP: SatAppMainHandler::initConnections: \ - DisplayText=%d", ret) - - ret = connect(mEvent, SIGNAL(clearScreenEvent()), - mUi, SLOT(clearScreen()), - Qt::DirectConnection); - - TFLOGSTRING2("SATAPP: SatAppMainHandler::initConnections: \ - ClearScreen=%d", ret) + qDebug("SATAPP: SatAppMainHandler::initConnections >"); + + // -------------------------------------- + // MenuProvider + // -------------------------------------- + + // SetupMenu command from server + doConnect( + mServer, SIGNAL( setUpMenu( SatAppAction &) ), + mMenu, SLOT( setUpMenu( SatAppAction &) ) ); - ret = connect(mEvent, SIGNAL(closeUiEvent()), - mUi, SLOT(closeUi()), - Qt::DirectConnection); - - TFLOGSTRING2("SATAPP: SatAppMainHandler::initConnections: \ - CloseUi=%d", ret) + // SelectItem command from server + doConnect( + mServer, SIGNAL( selectItem( SatAppAction &) ), + mMenu, SLOT( selectItem( SatAppAction &) ) ); + + // -------------------------------------- + // InputProvider + // -------------------------------------- + + // GetInkey command + doConnect( + mServer, SIGNAL( getInkey( SatAppAction &) ), + mInput, SLOT( getInkey( SatAppAction &) ) ); + // GetInput command + doConnect( + mServer, SIGNAL( getInput( SatAppAction &) ), + mInput, SLOT( getInput( SatAppAction &) ) ); - // For GetInkey - ret = connect(mEvent, SIGNAL(getInkeyEvent(TSatUiResponse &, - QString, TSatCharacterSet, QString &, - bool,unsigned int &)), - mCommand, SLOT(getInkey(TSatUiResponse &, QString, - TSatCharacterSet, QString &, - bool, unsigned int &)), - Qt::DirectConnection); - TFLOGSTRING2("SATAPP: SatAppMainHandler::initConnections: \ - GetInkey=%d", ret) + // clearScreen in InputProvider + doConnect( + mServer, SIGNAL( clearScreen() ), + mInput, SLOT( resetState() )); + + // -------------------------------------- + // Play tone + // -------------------------------------- + // Play tone + doConnect( + mServer, SIGNAL( playTone( SatAppAction &) ), + mTone, SLOT( playTone( SatAppAction &) ) ); + + // clearScreen in tone provider + doConnect( + mServer, SIGNAL( clearScreen() ), + mTone, SLOT( clearScreen() ) ); + + // -------------------------------------- + // Show Popups + // -------------------------------------- - ret = connect(mEvent, SIGNAL(getYesNoEvent(TSatUiResponse &, - QString, TSatCharacterSet, unsigned int &, //TSatIconId, - bool, unsigned int &, bool)), - mCommand, SLOT(getYesNo(TSatUiResponse &, QString, - TSatCharacterSet, unsigned int &, //TSatIconId, - bool, unsigned int &, bool)), - Qt::DirectConnection); - TFLOGSTRING2("SATAPP: SatAppMainHandler::initConnections: \ - GetYesNo=%d", ret) + // display text + doConnect( + mServer, SIGNAL(displayText( SatAppAction & )), + mPopup, SLOT(displayText( SatAppAction & ))); + + // show notification + doConnect( + mServer, SIGNAL( notification( SatAppAction & ) ), + mPopup, SLOT( notification( SatAppAction & ) ) ); + + // hide wait note + doConnect( + mServer, SIGNAL( stopShowWaitNote() ), + mPopup, SLOT( stopShowWaitNote() ) ); + + // clearScreen in popup note provider + doConnect( + mServer, SIGNAL(clearScreen()), + mPopup, SLOT(clearScreen())); - // For GetInput - ret = connect(mEvent, SIGNAL(getInputEvent(TSatUiResponse &, QString, - TSatCharacterSet, QString &, int, int, bool, bool, unsigned int &)), - mCommand, SLOT(getInput(TSatUiResponse &, QString, TSatCharacterSet, - QString &, int, int, bool, bool, unsigned int &)), - Qt::DirectConnection); - TFLOGSTRING2("SATAPP: SatAppMainHandler::initConnections: \ - GetInput=%d", ret) - - // For CallControl - ret = connect(mEvent, SIGNAL(callControlEvent(QString, - TSatAlphaIdStatus)), - mCommand, SLOT(callControl(QString, TSatAlphaIdStatus)), - Qt::DirectConnection); - TFLOGSTRING2("SATAPP: SatAppMainHandler::initConnections: \ - CallControl=%d", ret) + // clearScreen in popup note provider + doConnect( + mServer, SIGNAL(showSsErrorNote()), + mPopup, SLOT(showSsErrorNote())); + + // -------------------------------------- + // Show Confirm + // -------------------------------------- + + // show confirmCommand + doConnect( + mServer, SIGNAL( confirmCommand( SatAppAction & ) ), + mConfirm, SLOT( confirmCommand( SatAppAction & ) ) ); + + // clearScreen + doConnect( + mServer, SIGNAL( clearScreen() ), + mConfirm, SLOT( clearScreen() ) ); + + // Task switcher + doConnect( + mServer, SIGNAL( setUpMenu( SatAppAction & ) ), + this, SLOT( updateActivity() ) ); - // For MoSmControl - ret = connect(mEvent, SIGNAL(moSmControlEvent(QString, - TSatAlphaIdStatus)), - mCommand, SLOT(moSmControl(QString, TSatAlphaIdStatus)), - Qt::DirectConnection); - TFLOGSTRING2("SATAPP: SatAppMainHandler::initConnections: \ - MoSmControl=%d", ret) + doConnect( + qApp, SIGNAL( aboutToQuit() ), + this, SLOT( saveActivity() ) ); + + qDebug("SATAPP: SatAppMainHandler::initConnections <"); +} - // For send confirm - ret = connect(mEvent, SIGNAL(showSmsWaitNoteEvent(QString, - bool)), - mCommand, SLOT(showSmsWaitNote(QString, - bool)), - Qt::DirectConnection); - TFLOGSTRING2("SATAPP: SatAppMainHandler::initConnections: \ - showSmsWaitNote=%d", ret) - - //For Send DTMF - ret = connect(mEvent, SIGNAL(showDtmfWaitNoteEvent( - TSatUiResponse &, QString)), - mCommand, SLOT(showDtmfWaitNote( - TSatUiResponse &, QString)), - Qt::DirectConnection); - TFLOGSTRING2("SATAPP: SatAppMainHandler::initConnections: \ - showDtmfsWaitNote=%d", ret) +// ---------------------------------------------------------------------------- +// SatAppMainHandler::updateActivity +// ---------------------------------------------------------------------------- +// +void SatAppMainHandler::updateActivity() +{ + qDebug("SATAPP: SatAppMainHandler::updateActivity >"); + mActivity.insert("screenshot", mMenu->takeScreenShot()); + qDebug("SATAPP: SatAppMainHandler::updateActivity <"); +} + +// ---------------------------------------------------------------------------- +// SatAppMainHandler::saveActivity +// ---------------------------------------------------------------------------- +// +void SatAppMainHandler::saveActivity() +{ + qDebug("SATAPP: SatAppMainHandler::saveActivity >"); + + // Add the activity to the activity manager + const bool ok = qobject_cast(qApp)->activityManager()-> + addActivity(SATAPP_ACTIVITY_ID, QVariant(), mActivity); - //For DTMF, BIP cancel - ret = connect(mUi, SIGNAL(userCancelResponse()), - mEvent, SLOT(userCancelResponse()), - Qt::DirectConnection); - TFLOGSTRING2("SATAPP: SatAppMainHandler::initConnections: \ - userCancelResponse=%d", ret) - - //Stop wait note - ret = connect(mEvent, SIGNAL(stopShowWaitNoteEvent()), - mCommand, SLOT(stopShowWaitNote()), - Qt::DirectConnection); - TFLOGSTRING2("SATAPP: SatAppMainHandler::initConnections: \ - stopShowWaitNote=%d", ret) + qDebug("SATAPP: SatAppMainHandler::saveActivity < %d", ok); +} - // For SetUpCall - ret = connect(mEvent, SIGNAL(showSetUpCallConfirmEvent( - QString, QString, bool &)), - mCommand, SLOT(confirmSetUpCall( - QString, QString, bool &)), - Qt::DirectConnection); - TFLOGSTRING2("SATAPP: SatAppMainHandler::initConnections: \ - showSetUpCallConfirm=%d", ret) +// ---------------------------------------------------------------------------- +// SatAppMainHandler::removeActivity +// ---------------------------------------------------------------------------- +// +void SatAppMainHandler::removeActivity() +{ + qDebug("SATAPP: SatAppMainHandler::removeActivity >"); - ret = connect(mEvent, SIGNAL(showSsWaitNoteEvent(QString, - bool)), - mCommand, SLOT(showSsWaitNote(QString, - bool)), - Qt::DirectConnection); + QList activityList = + qobject_cast(qApp)->activityManager()->activities(); + qDebug("SATAPP: SatAppMenuProvider::removeActivity count=%d", + activityList.count()); + foreach (QVariantHash activity, activityList){ + if (activity.keys().contains(SATAPP_ACTIVITY_ID)){ + mActivity = activity; + qDebug("SATAPP: SatAppMenuProvider::removeActivity store"); + break; + } + } + + const bool ok = qobject_cast(qApp)->activityManager()-> + removeActivity(SATAPP_ACTIVITY_ID); - // For Send SS or USSD - TFLOGSTRING2("SATAPP: SatAppMainHandler::initConnections: \ - showSsWaitNote=%d", ret) - - //For showWaitNoteWithoutDelay - ret = connect(mEvent, SIGNAL(showWaitNoteWithoutDelayEvent()), - mUi, SLOT(showWaitNoteWithoutDelay()), - Qt::DirectConnection); - TFLOGSTRING2("SATAPP: SatAppMainHandler::initConnections: \ - showWaitNoteWithoutDelayEvent=%d", ret) + qDebug("SATAPP: SatAppMainHandler::removeActivity < %d", ok); +} - //For showSsErrorNote - ret = connect(mEvent, SIGNAL(showSsErrorNoteEvent()), - mUi, SLOT(showSsErrorNote()), - Qt::DirectConnection); - TFLOGSTRING2("SATAPP: SatAppMainHandler::initConnections: \ - showSsErrorNoteEvent=%d", ret) +// ---------------------------------------------------------------------------- +// SatAppMainHandler::isOffline +// ---------------------------------------------------------------------------- +// +bool SatAppMainHandler::isOffline() +{ + //If current active profile is offline, show a warning and quit + qDebug("SATAPP: SatAppMainHandler::isOffline >"); + TInt profileId(0); + CRepository* cr (NULL); + TRAPD(err, cr = CRepository::NewL(KCRUidProfileEngine)); + if ( KErrNone == err ) + { + // Get the ID of the currently active profile: + const TInt error = cr->Get(KProEngActiveProfile, profileId); + qDebug("SATAPP: SatAppMainHandler::isOffline get active \ + profile error=%d",error); + delete cr; + } + qDebug("SATAPP: SatAppMainHandler::isOffline< profileId = %d",profileId); + return ( KSatActiveProfileOffline == profileId ); +} - // For Open Channel - ret = connect(mEvent, SIGNAL(showOpenChannelConfirmEvent( - QString, bool &)), - mUi, SLOT(showConfirmOpenChannelQuery( - QString, bool &)), - Qt::DirectConnection); - TFLOGSTRING2("SATAPP: SatAppMainHandler::initConnections: \ - showOpenChannelConfirm=%d", ret) - - // For BIP wait note - ret = connect(mEvent, SIGNAL(showBIPNoteEvent( - int, QString)), - mCommand, SLOT(showBIPWaitNote( - int, QString)), - Qt::DirectConnection); - TFLOGSTRING2("SATAPP: SatAppMainHandler::initConnections: \ - showBIPNote=%d", ret) - - TFLOGSTRING("SATAPP: SatAppMainHandler::initConnections exit") +// ---------------------------------------------------------------------------- +// SatAppMainHandler::showOfflineWarning +// ---------------------------------------------------------------------------- +// +void SatAppMainHandler::showOfflineWarning() +{ + qDebug("SATAPP: SatAppMainHandler::showOfflineWarning >"); + mOfflineWarningDlg = + new HbMessageBox(HbMessageBox::MessageTypeWarning); + mOfflineWarningDlg->setText( + hbTrId("txt_simatk_dpopinfo_sim_services_not_available")); + mOfflineWarningDlg->clearActions(); + mOfflineWarningDlg->setDismissPolicy(HbDialog::TapOutside); + mOfflineWarningDlg->setTimeout(KDisplayTxtUserClearTimeout); + SAT_ASSERT(connect(mOfflineWarningDlg, SIGNAL(aboutToClose()), + qApp, SLOT(quit()))); + mOfflineWarningDlg->open(); + qDebug("SATAPP: SatAppMainHandler::showOfflineWarning <"); } //End of file diff -r 1f002146abb4 -r cee7e9e0906c satui/satapp/src/satappmenuprovider.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/satui/satapp/src/satappmenuprovider.cpp Wed Aug 18 10:19:22 2010 +0300 @@ -0,0 +1,347 @@ +/* +* Copyright (c) 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" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Provides and maintains SAT main view (selection list) +* +*/ + +// qt +#include +#include +#include +#include +// hb +#include +#include +#include +#include +#include +#include +#include +// satapp +#include "satappmenuprovider.h" +#include "satappaction.h" +#include "satappconstant.h" + +// constants +const char *SATAPP_DOCML = ":/xml/satapp.docml"; +const char *SATAPP_SETUPMENU_VIEW = "setupmenu_view"; +const char *SATAPP_SELECTITEM_VIEW = "selectitem_view"; +const char *SATAPP_MENUITEM = "s:ListWidget"; +const char *SATAPP_SELECTITEM = "t:ListWidget"; +const char *SATAPP_SUBTITLE = "t:label"; + + +// ---------------------------------------------------------------------------- +// SatAppMenuProvider::SatAppMenuProvider +// ---------------------------------------------------------------------------- +// +SatAppMenuProvider::SatAppMenuProvider(HbMainWindow *window,QObject *parent) + : QObject(parent), mMainWindow(window),mSetupMenuView(0), + mSelectItemView(0),mSoftKeyQuitAction(0),mSoftKeyBackAction(0), + mListWidget(0),mSelectListWidget(0),mSubTitle(0),mCurrentAction(0) +{ + qDebug("SATAPP: SatAppMenuProvider::SatAppMenuProvider"); +} + +// ---------------------------------------------------------------------------- +// SatAppMenuProvider::~SatAppMenuProvider +// ---------------------------------------------------------------------------- +// +SatAppMenuProvider::~SatAppMenuProvider() +{ + qDebug("SATAPP: SatAppMenuProvider::~SatAppMenuProvider >"); + resetState(); + // delete all objects created from DOCML. + while (!mObjects.isEmpty()) { + delete mObjects.takeFirst(); + } + // delete actions + delete mSoftKeyQuitAction; + delete mSoftKeyBackAction; + qDebug("SATAPP: SatAppMenuProvider::~SatAppMenuProvider <"); +} + +// ---------------------------------------------------------------------------- +// SatAppMenuProvider::takeScreenShot +// ---------------------------------------------------------------------------- +// +QPixmap SatAppMenuProvider::takeScreenShot() +{ + qDebug("SATAPP: SatAppMenuProvider::takeScreenShot"); + return QPixmap::grabWidget(mMainWindow, mMainWindow->rect()); +} + +// ---------------------------------------------------------------------------- +// SatAppMenuProvider::loadMainView +// ---------------------------------------------------------------------------- +// +void SatAppMenuProvider::loadMainView() +{ + qDebug("SATAPP: SatAppMenuProvider::loadMainView >"); + + // create actions + mSoftKeyQuitAction = new HbAction(Hb::QuitNaviAction,this); + mSoftKeyBackAction = new HbAction(Hb::BackNaviAction,this); + + bool docmlLoad = false; + HbDocumentLoader loader; + // ownership of the objects are transferred to caller + mObjects = loader.load(SATAPP_DOCML,&docmlLoad); + Q_ASSERT(docmlLoad); + qDebug("SATAPP: SatAppMenuProvider main view found"); + // load setupmenu view + mSetupMenuView = qobject_cast(loader.findWidget + (SATAPP_SETUPMENU_VIEW)); + // find setupmenu view items + mListWidget = qobject_cast + ( loader.findWidget(SATAPP_MENUITEM )); + // connect setupmenu view menu + HbAction *menuAction = mSetupMenuView->menu()->addAction( + hbTrId("txt_common_menu_exit")); + SAT_ASSERT(connect(menuAction, SIGNAL(triggered()), + mMainWindow, SLOT(close()))); + SAT_ASSERT(connect(mSoftKeyQuitAction, SIGNAL(triggered()), + mMainWindow, SLOT(close()))); + // set this view as current view + mMainWindow->addView(mSetupMenuView); + mMainWindow->setCurrentView(mSetupMenuView); + + // load selectitem view + mSelectItemView = qobject_cast(loader.findWidget + (SATAPP_SELECTITEM_VIEW)); + // find selectitem view items + mSubTitle = qobject_cast + ( loader.findWidget(SATAPP_SUBTITLE) ); + mSelectListWidget = qobject_cast + ( loader.findWidget(SATAPP_SELECTITEM )); + // connect selectitem view menu + HbAction *menuBack = mSelectItemView->menu()->addAction( + hbTrId("txt_common_opt_back")); + SAT_ASSERT(connect(menuBack, SIGNAL(triggered()), + mSoftKeyBackAction, SIGNAL(triggered()))); + HbAction *menuQuit = mSelectItemView->menu()->addAction( + hbTrId("txt_common_menu_exit")); + + SAT_ASSERT(connect(menuQuit, SIGNAL(triggered()), + mMainWindow, SLOT(close()))); + qDebug("SATAPP: SatAppMenuProvider::loadMainView <"); + +} + +// ---------------------------------------------------------------------------- +// switchView +// ---------------------------------------------------------------------------- +// +void SatAppMenuProvider::switchView() +{ + qDebug("SATAPP: SatAppMenuProvider::switchView >"); + if (mCurrentAction && ESatSelectItemAction == mCurrentAction->action()) { + // switch to select item view + mMainWindow->removeView(mMainWindow->currentView()); + mMainWindow->addView(mSelectItemView); + mMainWindow->setCurrentView(mSelectItemView); + } else { + // switch to main menu view + mMainWindow->removeView(mMainWindow->currentView()); + mMainWindow->addView(mSetupMenuView); + mMainWindow->setCurrentView(mSetupMenuView); + } + qDebug("SATAPP: SatAppMenuProvider::switchView <"); +} + + +// ---------------------------------------------------------------------------- +// SatAppMenuProvider::setUpMenu +// constructs a menu in the main SAT application view +// ---------------------------------------------------------------------------- +// +void SatAppMenuProvider::setUpMenu(SatAppAction &action) +{ + qDebug("SATAPP: SatAppMenuProvider::setUpMenu >"); + if (!mSetupMenuView) { + loadMainView(); + } + resetState(); + mCurrentAction = &action; + switchView(); + action.setResponse(ESatSuccess); + + // The text is the application name + // should be shown on the menu area always + QString text = action.value(KeyText).toString(); + if (!text.isEmpty()) { + mSetupMenuView->setTitle(text); + mSelectItemView->setTitle(text); + } + qDebug() << "SATAPP: SetUpMenu title=" << text; + + // build the menu + QList menu = action.value(KeyMenu).toList(); + mListWidget->clear(); + for(int i = 0; i < menu.count(); i++ ) { + mListWidget->addItem(menu.at(i).toString()); + } + qDebug() << "SATAPP: SetUpMenu menu=" << menu; + + // back-key quits the application + mSetupMenuView->setNavigationAction(mSoftKeyQuitAction); + // completes action with ESatSuccess and selected item + connectItem(); + + qDebug("SATAPP: SatAppMenuProvider::setUpMenu <"); +} + + +// ---------------------------------------------------------------------------- +// SatAppMenuProvider::selectItem +// Constructs a SETECT ITEM view +// ---------------------------------------------------------------------------- +// +void SatAppMenuProvider::selectItem( SatAppAction &action) +{ + qDebug("SATAPP: SatAppMenuProvider::selectItem >"); + + if (!mSetupMenuView) { + loadMainView(); + } + + resetState(); + mCurrentAction = &action; + switchView(); + action.setResponse(ESatSuccess); + + // Set sub title + QString text = action.value(KeyText).toString(); + if (!text.isEmpty()) { + mSubTitle->setPlainText(text); + } else { + mSubTitle->setPlainText(hbTrId("txt_long_caption_sim_services")); + } + qDebug() << "SATAPP: selectItem text=" << text; + + // Set List widget + QList menu = action.value(KeyMenu).toList(); + mSelectListWidget->clear(); + for(int i = 0; i < menu.count(); i++ ) { + mSelectListWidget->addItem(menu.at( i ).toString()); + } + qDebug() << "SATAPP: selectItem menu=" << menu; + + // timeout completes action with ESatNoResponseFromUser + QTimer::singleShot(KDefaultSelectionTimeoutMseconds, + mCurrentAction,SLOT(completeWithNoResponse())); + // back-key completes action with ESatBackwardModeRequestedByUser + mSelectItemView->setNavigationAction(mSoftKeyBackAction); + SAT_ASSERT(connect(mSoftKeyBackAction, SIGNAL(triggered()), + mCurrentAction, SLOT(completeWithBackRequested()))); + SAT_ASSERT(connect(mSelectItemView->menu()->actions().at(1), + SIGNAL(triggered()), + mCurrentAction, SLOT(completeWithSessionTerminated()))); + + // completes action with ESatSuccess and selected item + connectItem(); + + qDebug("SATAPP: SatAppMenuProvider::selectItem <"); +} + +// ---------------------------------------------------------------------------- +// SatAppMenuProvider::resetState +// terminates ongoing events and clears the screen +// ---------------------------------------------------------------------------- +// +void SatAppMenuProvider::resetState() +{ + qDebug("SATAPP: SatAppMenuProvider::resetState >"); + mCurrentAction = 0; + disconnectItem(); + qDebug("SATAPP: SatAppMenuProvider::resetState <"); +} + +// ---------------------------------------------------------------------------- +// SatAppMenuProvider::menuItemSelected +// (Menu item selected). +// ---------------------------------------------------------------------------- +// +void SatAppMenuProvider::menuItemSelected(HbListWidgetItem *item) +{ + qDebug("SATAPP: SatAppMenuProvider::menuItemSelected >"); + Q_ASSERT(mCurrentAction); + if (ESatSetUpMenuAction == mCurrentAction->action()) { + int index = mListWidget->row(item); + mCurrentAction->set(KeySelection,index); + mCurrentAction->set(KeyHelpRequested,false); + mCurrentAction->completeWithSuccess(); + } else if(ESatSelectItemAction == mCurrentAction->action()) { + int index = mSelectListWidget->row(item); + mCurrentAction->set(KeySelection,index); + mCurrentAction->completeWithSuccess(); + } + qDebug("SATAPP: SatAppMenuProvider::menuItemSelected <"); +} + + +// ---------------------------------------------------------------------------- +// SatAppMenuProvider::connectItem +// (Connect listwidget item). +// ---------------------------------------------------------------------------- +// +void SatAppMenuProvider::connectItem() +{ + qDebug("SATAPP: SatAppMenuProvider::connectItem >"); + Q_ASSERT(mCurrentAction); + if (ESatSetUpMenuAction == mCurrentAction->action()) { + SAT_ASSERT(connect( + mListWidget, SIGNAL(activated(HbListWidgetItem *)), + this, SLOT(menuItemSelected(HbListWidgetItem *)))); + SAT_ASSERT(connect( + mListWidget, + SIGNAL(longPressed(HbListWidgetItem *, const QPointF &)), + this, SLOT(menuItemSelected(HbListWidgetItem *)))); + } else if(mCurrentAction->action()== ESatSelectItemAction) { + SAT_ASSERT(connect( + mSelectListWidget, SIGNAL(activated(HbListWidgetItem *)), + this, SLOT(menuItemSelected(HbListWidgetItem *)))); + SAT_ASSERT(connect( + mSelectListWidget, + SIGNAL(longPressed(HbListWidgetItem*, const QPointF &)), + this, SLOT(menuItemSelected(HbListWidgetItem *)))); + } + qDebug("SATAPP: SatAppMenuProvider::connectItem <"); +} + +// ---------------------------------------------------------------------------- +// SatAppMenuProvider::disconnectItem +// (Disconnect listwidget item). +// ---------------------------------------------------------------------------- +// +void SatAppMenuProvider::disconnectItem() +{ + qDebug("SATAPP: SatAppMenuProvider::disconnectItem >"); + // setup menu view + disconnect(mListWidget, SIGNAL( activated(HbListWidgetItem *)), + this, SLOT( menuItemSelected( HbListWidgetItem *))); + disconnect( + mListWidget, SIGNAL(longPressed(HbListWidgetItem*, const QPointF &)), + this, SLOT(menuItemSelected(HbListWidgetItem *))); + // select item view + disconnect(mSelectListWidget, SIGNAL( activated(HbListWidgetItem *)), + this, SLOT( menuItemSelected( HbListWidgetItem *))); + disconnect( + mSelectListWidget, + SIGNAL(longPressed(HbListWidgetItem*, const QPointF &)), + this, SLOT(menuItemSelected(HbListWidgetItem *))); + qDebug("SATAPP: SatAppMenuProvider::disconnectItem <"); +} + +//End of file diff -r 1f002146abb4 -r cee7e9e0906c satui/satapp/src/satappplaytoneprovider.cpp --- a/satui/satapp/src/satappplaytoneprovider.cpp Tue Jul 06 14:53:02 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,554 +0,0 @@ -/* -* Copyright (c) 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" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - - -// PlayStandardTone -#include -#include -#include -#include -#include //KAudioPriorityLowLevel -#include //KMdaRepeatForever -#include // timeout callback -#include //playtone note -#include // for CMdaAudioToneUtility&CMdaAudioPlayerUtility -#include //TTimeIntervalMicroSeconds - -#include "satappplaytoneprovider.h" -#include "satappcommonconstant.h" -#include "tflogger.h" - -//const -// Maximum length for sound file. -const TInt KMaxSoundFileLength = 256; -// Used when dividing some values. Used only for preventing the use of magic -// numbers -// Audio sample is repeated indefinitely. -const TInt KSoundPlayerRepeatForever = KMdaRepeatForever; - -// The max volume value from settings. -// From TProfileToneSettings.h -const TInt KMaxVolumeFromProfile( 10 ); - - -// ---------------------------------------------------------------------------- -// SatAppPlayToneProvider::SatAppPlayToneProvider -// (other items were commented in a header). -// ---------------------------------------------------------------------------- -// -SatAppPlayToneProvider::SatAppPlayToneProvider(QObject *parent) : - QObject(parent), mWarningAndPlayTones(false),mVolume(0), - mPlayer(0),mPlayToneError(ESatSuccess), mTimer(0),mLoop(0), - mPermanentNote(0), mAudioPlayer(0) -{ - TFLOGSTRING("SATAPP: SatAppPlayToneProvider::SatAppPlayToneProvider call") - TFLOGSTRING("SATAPP: SatAppPlayToneProvider::SatAppPlayToneProvider exit") -} - -// ---------------------------------------------------------------------------- -// SatAppPlayToneProvider::~SatAppPlayToneProvider -// Sets a pointer to CSatUiViewAppUi object. -// (other items were commented in a header). -// ---------------------------------------------------------------------------- -// -SatAppPlayToneProvider::~SatAppPlayToneProvider() -{ - TFLOGSTRING("SATAPP: SatAppPlayToneProvider::~SatAppPlayToneProvider call") - stopPlayTone(); - if (mPermanentNote) { - TFLOGSTRING("SATAPP: SatAppPlayToneProvider::~SatAppPlayToneProvider note 0") - delete mPermanentNote; - mPermanentNote = 0; - } - if (mTimer) { - TFLOGSTRING("SATAPP: SatAppPlayToneProvider::~SatAppPlayToneProvider timer 0") - delete mTimer; - mTimer = 0; - } - if (mLoop) { - TFLOGSTRING("SatAppPlayToneProvider::~SatAppPlayToneProvider loop 0") - delete mLoop; - mLoop = 0; - } - TFLOGSTRING("SATAPP: SatAppPlayToneProvider::~SatAppPlayToneProvider exit") -} - -//----------------------------------------------------------------------------- -// SatAppPlayToneProvider::PlayStandardToneL -// (other items were commented in a header). -// ---------------------------------------------------------------------------- -// -TSatUiResponse SatAppPlayToneProvider::PlayStandardToneL( const TDesC& aText, - const TDesC8& aSequence, - TTimeIntervalMicroSeconds aDuration, - const CFbsBitmap* /*aIconBitmap*/, - const TBool aSelfExplanatory ) -{ - TFLOGSTRING("SATAPP: SatAppPlayToneProvider::PlayStandardToneL call") - if (mTimer) { - if (mTimer->isActive()) { - mTimer->stop(); - } - delete mTimer; - mTimer = 0; - TFLOGSTRING("SatAppPlayToneProvider::PlayStandardToneL delete timer") - } - if (mLoop) { - TFLOGSTRING("SatAppPlayToneProvider::PlayStandardToneL delete loop") - if (mLoop->isRunning()) { - mLoop->exit(); - } - delete mLoop; - mLoop = 0; - } - - TSatUiResponse response(ESatSuccess); - unsigned int duration(0); - if (aDuration > 0) { - duration = aDuration.Int64() / 1000; - } - TFLOGSTRING2("SATAPP: SatAppPlayToneProvider::PlayStandardToneL \ - duration microseconds %d", duration) - QString text; - mLoop = new QEventLoop(this); - if (aText.Length() > 0) { - text = QString::fromUtf16(aText.Ptr(), aText.Length()); - TFLOGSTRING2("SATAPP: SatAppPlayToneProvider::PlayStandardToneL \ - text=%S", &aText) - mPermanentNote = new HbMessageBox(HbMessageBox::MessageTypeInformation); - bool ret = connect(mPermanentNote, SIGNAL(aboutToClose()), - this, SLOT(stopPlayTone())); - TFLOGSTRING2("SATAPP: SatAppPlayToneProvider::PlayStandardToneL connect \ - note close to timer stop: %d", ret) - - bool selfExplanatory = aSelfExplanatory; - if (!selfExplanatory) { - mPermanentNote->setText(text); - if (duration > 0 ) { - mPermanentNote->setTimeout(duration); - } - mPermanentNote->setDismissPolicy(HbPopup::TapAnywhere); - TFLOGSTRING("SatAppPlayToneProvider::PlayStandardToneL show before") - mPermanentNote->show(); - TFLOGSTRING("SatAppPlayToneProvider::PlayStandardToneL show after") - } - } - - if (mPlayer) { - delete mPlayer; - mPlayer = 0; - } - mPlayer = CMdaAudioToneUtility::NewL(*this); - TInt volume(mPlayer->MaxVolume()); - mPlayer->SetVolume(volume); - mPlayer->PrepareToPlayDesSequence(aSequence); - - if (duration > 0) { - mTimer = new QTimer(this); - bool ret = connect(mTimer, SIGNAL(timeout()), - this, SLOT(stopPlayTone())); - TFLOGSTRING2("SATAPP: SatAppPlayToneProvider::PlayStandardToneL \ - connect mTimer stop: %d", ret) - mTimer->start(duration); - } - - if (mLoop) { - TFLOGSTRING("SATAPP: SatAppPlayToneProvider::PlayStandardToneL loop") - mLoop->exec(QEventLoop::AllEvents); - TFLOGSTRING("SATAPP: SatAppPlayToneProvider::PlayStandardToneL quit loop") - delete mLoop; - mLoop = 0; - } - if (mPermanentNote) { - TFLOGSTRING("SATAPP: SatAppPlayToneProvider::PlayStandardToneL note 0") - delete mPermanentNote; - mPermanentNote = 0; - } - if (mTimer) { - TFLOGSTRING("SATAPP: SatAppPlayToneProvider::PlayStandardToneL timer 0") - delete mTimer; - mTimer = 0; - } - - - TFLOGSTRING("SATAPP: SatAppPlayToneProvider::PlayStandardToneL before play cancel") - mPlayer->CancelPlay(); - delete mPlayer; - mPlayer = NULL; - - //get warning and game tones setting from active profile - GetProfileParamsL(); - if((EFalse == mWarningAndPlayTones) && - (ESatSuccess == mPlayToneError)) { - mPlayToneError = ESatSuccessToneNotPlayed; - } - response = mPlayToneError; - TFLOGSTRING("SATAPP: SatAppPlayToneProvider::PlayStandardToneL exit") - return response; -} - - -// --------------------------------------------------------- -// SatAppCommandHandler::GetProfileParamsL -// Get and store settings from current profile -// (other items were commented in a header). -// --------------------------------------------------------- -// -void SatAppPlayToneProvider::GetProfileParamsL( TSatTone aTone /*= ESatToneNotSet*/, - TDes* aToneName /*= NULL*/ ) -{ - TFLOGSTRING( "SatAppCommandHandler::GetProfileParamsL calling" ) - MProfile* profile = NULL; - MProfileEngine* engine = NULL; - engine = CreateProfileEngineL(); - CleanupReleasePushL( *engine ); - - profile = engine->ActiveProfileLC(); - - const MProfileTones& tones = profile->ProfileTones(); - - // Takes a current warning and gametones setting. - const TProfileToneSettings& ts = tones.ToneSettings(); - mWarningAndPlayTones = ts.iWarningAndGameTones; - mVolume = ts.iRingingVolume; - - TFLOGSTRING2( "SatAppCommandHandler::GetProfileParamsL \ - mVolume before mapping %d", mVolume ) - - // Max volume from profile is KMaxVolumeFromProfile, Max volume from - // CMdaAudioToneUtility is different, maybe 10,000. So, - // rate = maxVolumeFromPlayer / KMaxVolumeFromProfile - // User may never hear the TONE, because volume is too small. - // iVolume times the rate make it can be heard. - - CMdaAudioToneUtility* toneUtl = CMdaAudioToneUtility::NewL( *this ); - TInt maxVolumeFromPlayer( toneUtl->MaxVolume() ); - mVolume *= maxVolumeFromPlayer / KMaxVolumeFromProfile; - delete toneUtl; - toneUtl = NULL; - TFLOGSTRING2( "CSatUiViewAppUi::GetProfileParamsL \ - mVolume after mapping %d", mVolume ) - - if ( ( ESatUserSelectedToneIncomingSms == aTone ) && ( aToneName ) ) - { - TFLOGSTRING("SatAppCommandHandler::GetProfileParamsL message tone") - aToneName->Copy( tones.MessageAlertTone() ); - } else if( aToneName ) { - TFLOGSTRING("SatAppCommandHandler::GetProfileParamsL ring tone") - aToneName->Copy( tones.RingingTone1() ); - } - - CleanupStack::PopAndDestroy(2); // engine, profile - TFLOGSTRING("SatAppCommandHandler::GetProfileParamsL exits") -} - -// --------------------------------------------------------- -// SatAppPlayToneProvider::MatoPrepareComplete -// Indicates success or failure. -// (other items were commented in a header). -// --------------------------------------------------------- -// -void SatAppPlayToneProvider::MatoPrepareComplete(TInt aError) -{ - TFLOGSTRING2("SatAppPlayToneProvider::MatoPrepareComplete called\ - aError = %d", aError) - if (KErrNone == aError && mPlayer) { - mPlayToneError = ESatSuccess; - TTimeIntervalMicroSeconds zero(static_cast( 0 )); - mPlayer->SetPriority(KAudioPriorityLowLevel, - STATIC_CAST(TMdaPriorityPreference, KAudioPrefConfirmation)); - mPlayer->SetRepeats( KMdaAudioToneRepeatForever, zero ); - mPlayer->Play(); - } else { - mPlayToneError = ESatFailure; - } - TFLOGSTRING( "SatAppPlayToneProvider::MatoPrepareComplete exit" ) -} - -//----------------------------------------------------------------------------- -// SatAppPlayToneProvider::MatoPlayComplete -// Indicates success or failure. -// (other items were commented in a header). -// ---------------------------------------------------------------------------- -// -void SatAppPlayToneProvider::MatoPlayComplete( TInt aError ) -{ - TFLOGSTRING("SatAppPlayToneProvider::MatoPlayComplete calling") - if (KErrNone == aError && mPlayer) { - TFLOGSTRING("SatAppPlayToneProvider::MatoPlayComplete play") - mPlayer->Play(); - } else { - TFLOGSTRING( "SatAppPlayToneProvider::MatoPlayComplete stop playing") - // Stops playing if error. - stopPlayTone(); - } - TFLOGSTRING2("SatAppPlayToneProvider::MatoPlayComplete exit error %d", aError) -} - -//----------------------------------------------------------------------------- -// SatAppPlayToneProvider::PlayUserSelectedToneL -// (other items were commented in a header). -// ---------------------------------------------------------------------------- -// -TSatUiResponse SatAppPlayToneProvider::PlayUserSelectedToneL( - const TDesC &aText, - TTimeIntervalMicroSeconds aDuration, - TSatTone aTone, - const CFbsBitmap* /*aIconBitmap*/, - const TBool aSelfExplanatory ) -{ - TFLOGSTRING("SatAppPlayToneProvider::PlayUserSelectedToneL calling") - if (mTimer) { - delete mTimer; - mTimer = 0; - TFLOGSTRING("SatAppPlayToneProvider::PlayUserSelectedToneL delete timer") - } - if (mLoop) { - delete mLoop; - mLoop = 0; - TFLOGSTRING("SatAppPlayToneProvider::PlayUserSelectedToneL delete loop") - } - unsigned int duration(0); - if (aDuration > 0) { - duration = aDuration.Int64() / KPlayToneSymbianConvertQtTime; - TFLOGSTRING2("SatAppPlayToneProvider::PlayUserSelectedToneL duration %d", - duration) - } - - QString text; - if (aText.Length() > 0) { - text = QString::fromUtf16(aText.Ptr(), aText.Length()); - TFLOGSTRING2("SATAPP: SatAppPlayToneProvider::PlayUserSelectedToneL \ - text=%S", &aText) - mPermanentNote = new HbMessageBox(HbMessageBox::MessageTypeInformation); - bool selfExplanatory = aSelfExplanatory; - if (!selfExplanatory) { - mPermanentNote->setText(text); - if (duration) { - mPermanentNote->setTimeout(duration); - } - mPermanentNote->setDismissPolicy(HbPopup::TapAnywhere); - TFLOGSTRING("SatAppPlayToneProvider::PlayUserSelectedToneL show before") - mPermanentNote->show(); - TFLOGSTRING("SatAppPlayToneProvider::PlayUserSelectedToneL show after") - } - } - - // If several messages/calls arrive during a small amount of time and if the - // message received or incoming call tone is already being played we do not - // restart it. - if (mAudioPlayer) { - TFLOGSTRING( "SatAppPlayToneProvider::\ - PlayUserSelectedToneL Error - already played" ) - return ESatFailure; - } - - TSatUiResponse response(ESatSuccess); - // This defines name for the current message alert or incoming call tone. - TBuf soundFileName; - GetProfileParamsL( aTone, &soundFileName ); - // This defines the behaviour to be adopted by an - // audio client if a higher priority client takes over the device. - TInt mdaPriority( KAudioPrefIncomingCall ); - // This is used to resolve conflicts when more than one client tries to - // access the same sound output device simultaneously. - TInt audioPriority( KAudioPriorityPhoneCall ); - - TFLOGSTRING2( "SATAPP: SatAppPlayToneProvider::PlayUserSelectedToneL\ - Volume is %d ", mVolume ) - - // Creates the audio player. - mAudioPlayer = CMdaAudioPlayerUtility::NewFilePlayerL( - soundFileName, - *this, - audioPriority, - ( TMdaPriorityPreference ) mdaPriority ); - - if (aDuration > 0) { - TFLOGSTRING( "SATAPP: SatAppPlayToneProvider::PlayUserSelectedToneL\ - duration not 0" ) - mAudioPlayer->SetRepeats( KSoundPlayerRepeatForever, - TTimeIntervalMicroSeconds( - static_cast( 0 ) ) ); - mTimer = new QTimer(this); - mTimer->start(duration); - mLoop = new QEventLoop(this); - bool ret = connect(mTimer, SIGNAL(timeout()), this, SLOT(stopPlayTone())); - TFLOGSTRING2("SATAPP: SatAppPlayToneProvider::PlayUserSelectedToneL\ - connect mTimer stop: %d", ret) - - if (mPermanentNote) { - ret = connect(mPermanentNote, SIGNAL(aboutToClose()), - this, SLOT(stopPlayTone())); - TFLOGSTRING2("SATAPP: SatAppPlayToneProvider::PlayUserSelectedToneL \ - connect note close to timer stop: %d", ret) - } - if (mLoop) { - mLoop->exec(QEventLoop::AllEvents); - TFLOGSTRING("SATAPP: SatAppPlayToneProvider::PlayUserSelectedToneL quit loop") - delete mLoop; - mLoop = 0; - } - if (mPermanentNote) { - TFLOGSTRING("SATAPP: SatAppPlayToneProvider::PlayUserSelectedToneL note 0") - delete mPermanentNote; - mPermanentNote = 0; - } - if (mTimer) { - TFLOGSTRING("SATAPP: SatAppPlayToneProvider::PlayUserSelectedToneL timer 0") - delete mTimer; - mTimer = 0; - } - // Sample is played in forever loop for the duration. - // After duration call back timers are destroyed - // If player exists, stop playing and delete player. MapcPlayComplete - // is not called because CallBackTimer stops the playing. - if (mAudioPlayer) { - mAudioPlayer->Stop(); - delete mAudioPlayer; - mAudioPlayer = 0; - TFLOGSTRING( "SatAppPlayToneProvider::PlayUserSelectedToneL\ - mAudioPlayer deleted" ) - } - } else { - // If duration is zero then tone is played only once. - // Playing duration is same as duration of the sample. - mAudioPlayer->SetRepeats( - 0, TTimeIntervalMicroSeconds( static_cast( 0 ) ) ); - TFLOGSTRING( "SatAppPlayToneProvider::PlayUserSelectedToneL SetRepeats 0" ) - } - - TFLOGSTRING( "SatAppPlayToneProvider::PlayUserSelectedToneL exit" ) - if( EFalse == mWarningAndPlayTones ) { - response = ESatSuccessToneNotPlayed; - } - - TFLOGSTRING( "SatAppPlayToneProvider::PlayUserSelectedToneL exit" ) - return response; -} - -//----------------------------------------------------------------------------- -// SatAppPlayToneProvider::MapcInitComplete -// Plays the tone. -// (other items were commented in a header). -// ---------------------------------------------------------------------------- -void SatAppPlayToneProvider::MapcInitComplete( TInt aError, - const TTimeIntervalMicroSeconds& /*aDuration*/ ) -{ - TFLOGSTRING( "SatAppPlayToneProvider::MapcInitComplete called" ) - // Audio player is initialised, so if there is no error, we can start - // playing the tone. - if (KErrNone == aError && mAudioPlayer) { - const TInt volume( Max(0, Min(mVolume, - mAudioPlayer->MaxVolume()))); - TFLOGSTRING2("CSatUiViewAppUi::\ - MapcInitComplete SetVolume %d", volume ) - // Set volume according Settings. - mAudioPlayer->SetVolume( volume ); - mAudioPlayer->Play(); - TFLOGSTRING( "SatAppPlayToneProvider::MapcInitComplete Play" ) - } else { - // Otherwise, we delete the initialised audio player. - if ( mAudioPlayer ) { - TFLOGSTRING( "SatAppPlayToneProvider::MapcInitComplete mAudioPlayer \ - true" ) - delete mAudioPlayer; - mAudioPlayer = 0; - } - - // Remove also the note for play tone - // If there was a duration for play tone, stop waiting - stopPlayTone(); - - TFLOGSTRING2( "SatAppPlayToneProvider::MapcInitComplete Error %d", aError ) - } - TFLOGSTRING( "SatAppPlayToneProvider::MapcInitComplete exit" ) -} - -//----------------------------------------------------------------------------- -// SatAppPlayToneProvider::MapcPlayComplete -// Deletes audio player after playing is completed. -// (other items were commented in a header). -// ---------------------------------------------------------------------------- -void SatAppPlayToneProvider::MapcPlayComplete( TInt /*aError*/ ) -{ - TFLOGSTRING( "SatAppPlayToneProvider::MapcPlayComplete called" ) - - // When playing is completed, deleting the audio player. - if ( mAudioPlayer ) { - TFLOGSTRING("SatAppPlayToneProvider::MapcPlayComplete delete mAudioPlayer") - delete mAudioPlayer; - mAudioPlayer = 0; - } - // Remove note after play has completed. - stopPlayTone(); - TFLOGSTRING("SatAppPlayToneProvider::MapcPlayComplete exit") -} - -// ---------------------------------------------------------------------------- -// SatAppPlayToneProvider::clearScreen -// (other items were commented in a header). -// ---------------------------------------------------------------------------- -// -void SatAppPlayToneProvider::clearScreen() -{ - TFLOGSTRING("SATAPP: SatAppEventProvider::ClearScreen call") - stopPlayTone(); - TFLOGSTRING("SATAPP: SatAppEventProvider::ClearScreen exit") -} - -// ---------------------------------------------------------------------------- -// SatAppPlayToneProvider::clearScreen -// (other items were commented in a header). -// ---------------------------------------------------------------------------- -// -void SatAppPlayToneProvider::closeSatUI() -{ - TFLOGSTRING("SATAPP: SatAppEventProvider::closeSatUI call") - clearScreen(); - TFLOGSTRING("SATAPP: SatAppEventProvider::closeSatUI exit") -} - -// ---------------------------------------------------------------------------- -// SatAppPlayToneProvider::stopPlayTone -// (other items were commented in a header). -// ---------------------------------------------------------------------------- -// -void SatAppPlayToneProvider::stopPlayTone() -{ - TFLOGSTRING("SATAPP: SatAppEventProvider::stopPlayTone call") - if (mPermanentNote) { - TFLOGSTRING("SatAppPlayToneProvider::stopPlayTone delete mPermanentNote") - disconnect(mPermanentNote,SIGNAL(aboutToClose()), - this, SLOT(stopPlayTone())); - mPermanentNote->close(); - } - if (mTimer) { - TFLOGSTRING("SatAppPlayToneProvider::stopPlayTone delete timer") - disconnect(mTimer,SIGNAL(timeout()), this, SLOT(stopPlayTone())); - if (mTimer->isActive()) { - mTimer->stop(); - } - } - if (mLoop && mLoop->isRunning()) { - TFLOGSTRING("SatAppPlayToneProvider::stopPlayTone exit loop") - mLoop->exit(); - } - TFLOGSTRING("SATAPP: SatAppEventProvider::stopPlayTone exit") -} - - //End of file diff -r 1f002146abb4 -r cee7e9e0906c satui/satapp/src/satapppopupprovider.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/satui/satapp/src/satapppopupprovider.cpp Wed Aug 18 10:19:22 2010 +0300 @@ -0,0 +1,520 @@ +/* +* Copyright (c) 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" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +// qt +#include +#include +#include +// hb +#include +#include +#include +#include +#include +// satapp +#include "satapppopupprovider.h" +#include "satappconstant.h" +#include "satappaction.h" + + +// ---------------------------------------------------------------------------- +// SatAppPopupProvider::SatAppPopupProvider +// ---------------------------------------------------------------------------- +// +SatAppPopupProvider::SatAppPopupProvider( QObject *parent) + : QObject(parent), mDisplayText(0), mWaitDialog(0), + mWaitDeviceDialog(0), mAction(0) +{ + qDebug("SATAPP: SatAppPopupProvider::SatAppPopupProvider"); +} + +// ---------------------------------------------------------------------------- +// SatAppPopupProvider::~SatAppPopupProvider +// ---------------------------------------------------------------------------- +// +SatAppPopupProvider::~SatAppPopupProvider() +{ + qDebug("SATAPP: SatAppPopupProvider::~SatAppPopupProvider >"); + + if (mWaitDialog) { + qDebug("SATAPP: SatAppPopupProvider::~SatAppPopupProvider wait note"); + mWaitDialog->close(); + delete mWaitDialog; + mWaitDialog = NULL; + } + + if (mWaitDeviceDialog) { + qDebug("SATAPP: SatAppPopupProvider::~SatAppPopupProvider device note"); + mWaitDeviceDialog->close(); + delete mWaitDeviceDialog; + mWaitDeviceDialog = NULL; + } + + if (mDisplayText){ + qDebug( "SatAppPopupProvider::~SatAppPopupProvider DisplayText" ); + delete mDisplayText; + mDisplayText = 0; + } + qDebug("SATAPP: SatAppPopupProvider::~SatAppPopupProvider <"); +} + +// ---------------------------------------------------------------------------- +// SatAppPopupProvider::displayText +// ---------------------------------------------------------------------------- +// +void SatAppPopupProvider::displayText(SatAppAction& action) +{ + qDebug("SATAPP: SatAppPopupProvider::displayText >"); + mAction = &action; + delete mDisplayText; + mDisplayText = 0; + QString heading = action.value(KeyApplicationName).toString(); + if (heading.isEmpty()) { + heading = hbTrId("txt_simatk_dialog_sim_services"); + } + qDebug() << "SATAPP: displayText: heading=" << heading; + + // text + QString text = action.value(KeyText).toString(); + + // some flags + bool sustainedText = action.value(KeySustainedText).toBool(); + bool waitUserToClear = action.value(KeyWaitUserToClear).toBool(); + + // duration + int duration = action.value(KeyDuration).toInt(); + if (duration==0) { + duration = KDisplayTxtDefaultduration; + if (waitUserToClear) { + duration = KDisplayTxtUserClearTimeout; + } + } + if ( !(!sustainedText || + action.value(KeyDuration).toInt() || + !waitUserToClear) ) { + duration = 0; + } + qDebug("SATAPP: displayText: duration=%d",duration); + + // Show DisplayText dialog + mDisplayText = new HbMessageBox(HbMessageBox::MessageTypeInformation); + + // Set the label as heading widget + HbLabel *label = new HbLabel(heading, mDisplayText); + mDisplayText->setHeadingWidget(label); + mDisplayText->setText(text); + mDisplayText->setIconVisible(false); + mDisplayText->setStandardButtons(HbMessageBox::Ok | HbMessageBox::Cancel); + // ok pressed -> complete action with KSatSuccess + SAT_ASSERT(connect(mDisplayText->actions().at(0), SIGNAL(triggered()), + &action, SLOT(completeWithSuccess()))); + // cancel pressed -> complete action with ESatBackwardModeRequestedByUser + SAT_ASSERT(connect(mDisplayText->actions().at(1), SIGNAL(triggered()), + &action, SLOT(completeWithBackRequested()))); + SAT_ASSERT(connect(mAction, SIGNAL(actionCompleted(SatAppAction *)), + this, SLOT(resetState()))); + if (duration) { + if (waitUserToClear && !sustainedText) { + // in timeout, complete action with ESatNoResponseFromUser + QTimer::singleShot(duration, + &action, SLOT(completeWithNoResponse())); + } else { + QTimer::singleShot(duration, + &action, SLOT(completeWithSuccess())); + } + mDisplayText->setTimeout(duration); + } + + // open the popup. + mDisplayText->open(); + + qDebug("SATAPP: SatAppPopupProvider::displayText <"); +} + +// ---------------------------------------------------------------------------- +// SatAppPopupProvider::notification +// ---------------------------------------------------------------------------- +// +void SatAppPopupProvider::notification(SatAppAction& action) +{ + qDebug("SATAPP: SatAppPopupProvider::notification >"); + // some flags + int commandId = action.value(KeyCommandId).toInt(); + int alphaIdStatus = action.value(KeyAlphaIdStatus).toInt(); + // reset mAction + mAction = 0; + qDebug("SATAPP: notification id=%d alphaSt=%d", + commandId, alphaIdStatus); + + switch (commandId) + { + case ESatSSendDataNotify: + case ESatSReceiveDataNotify: + { + qDebug("SATAPP: Notifying BIP Send/Receive"); + // need to complete action with success when use don't prees cancel + mAction = &action; + showBIPWaitNote(action); + break; + } + case ESatSCloseChannelNotify: + { + qDebug("SATAPP: Notifying BIP CloseChannel"); + showCloseChannelWaitNote(action); + break; + } + case ESatSMoSmControlNotify: + { + qDebug("SATAPP: Notifying MoSmControl"); + if (ESatAlphaIdNotNull == alphaIdStatus) { + showMoSmControlNote(action); + } else { + showSatInfoNote(action); + } + break; + } + case ESatSCallControlNotify: + { + qDebug("SATAPP: Notifying CallControl"); + showCallControlNote(action); + break; + } + case ESatSSendUssdNotify: // fall through + case ESatSSendSsNotify: + { + qDebug("SATAPP: Notifying SendSs / SendUssd"); + showSsWaitNote(action); + break; + } + case ESatSSendDtmfNotify: + { + qDebug("SATAPP: Notifying SendDtmf"); + // need to complete action with success when use don't prees cancel + mAction = &action; + showDtmfWaitNote(action); + break; + } + case ESatSSendSmsNotify: + { + qDebug("SATAPP: Notifying SendSms"); + showSmsWaitNote(action); + break; + } + default: + { + qDebug("SATAPP: Unkown notification"); + action.completeWithFailure(); + break; + } + } + qDebug("SATAPP: SatAppPopupProvider::notification <"); +} + +// ---------------------------------------------------------------------------- +// SatAppPopupProvider::stopShowWaitNote +// ---------------------------------------------------------------------------- +// +void SatAppPopupProvider::stopShowWaitNote() +{ + qDebug("SATAPP:SatAppPopupProvider::stopShowWaitNote: >mWaitDialog = %x", + mWaitDialog ); + if (mWaitDialog) { + mWaitDialog->close(); + delete mWaitDialog; + mWaitDialog = NULL; + if (mAction) { + qDebug("SATAPP: stopShowWaitNote: mAction"); + int commandId = mAction->value(KeyCommandId).toInt(); + if (ESatSSendDataNotify == commandId + || ESatSReceiveDataNotify == commandId + || ESatSSendDtmfNotify == commandId) { + mAction->completeWithSuccess(); + } + } + } + + qDebug("SATAPP: stopShowWaitNote: mWaitDeviceDialog=%x", + mWaitDeviceDialog); + if (mWaitDeviceDialog) { + mWaitDeviceDialog->close(); + delete mWaitDeviceDialog; + mWaitDeviceDialog = NULL; + } + + qDebug("SATAPP:SatAppPopupProvider::stopShowWaitNote: <" ); +} + +// ---------------------------------------------------------------------------- +// SatAppPopupProvider::defaultAlphaId +// provides a default text in case it is empty +// ---------------------------------------------------------------------------- +// +QString SatAppPopupProvider::alphaId(SatAppAction& action) +{ + QString alpha = action.value(KeyText).toString(); + qDebug() << "SATAPP: SatAppPopupProvider::alphaId" << alpha; + + int commandId = action.value(KeyCommandId).toInt(); + int controlResult = action.value(KeyControlResult).toInt(); + + if (!alpha.isEmpty()) { + qDebug("SATAPP:SatAppPopupProvider::alphaId not empty<"); + return alpha; + } + switch (commandId) + { + case ESatSSendDataNotify: // SendData + { + alpha = hbTrId("txt_simatk_dialog_sendingdata"); + break; + } + case ESatSReceiveDataNotify: // ReceiveData + { + alpha = hbTrId("txt_simatk_dialog_receivingdata"); + break; + } + case ESatSCloseChannelNotify: // CloseChannel + { + alpha = hbTrId("txt_simatk_dialog_connectionclosed"); + break; + } + case ESatSMoSmControlNotify: // MoSmControl + { + if (ESatNotAllowed == controlResult) { + alpha = hbTrId("txt_simatk_dpopinfo_request_not_allowed"); + } else if (ESatAllowedWithModifications == controlResult) { + alpha = hbTrId("txt_simatk_dpopinfo_request_modified"); + } else { + alpha = hbTrId(""); // Allowed, default alpha -> no info + } + break; + } + case ESatSCallControlNotify: // CallControl + { + if (ESatNotAllowed == controlResult) { + alpha= hbTrId("txt_simatk_dpopinfo_request_not_allowed"); + } else if (ESatAllowedWithModifications == controlResult) { + alpha = hbTrId("txt_simatk_dpopinfo_request_modified"); + } else { + alpha = hbTrId(""); // Allowed, default alpha -> no info + } + break; + } + case ESatSSendSmsNotify: // fall through + case ESatSSendDtmfNotify: // fall through + case ESatSSendUssdNotify: // fall through + case ESatSSendSsNotify: // fall through + { + // alpha id is empty, set a default string + alpha = hbTrId("txt_common_info_processing"); + break; + } + default: + break; + } + qDebug("SATAPP:SatAppPopupProvider::alphaId <"); + return alpha; +} + +// ---------------------------------------------------------------------------- +// SatAppPopupProvider::showBIPWaitNote +// ---------------------------------------------------------------------------- +// +void SatAppPopupProvider::showBIPWaitNote(SatAppAction& action) +{ + qDebug("SATAPP: SatAppPopupProvider::showBIPWaitNote >"); + + QString text = alphaId(action); + // this is a new SEND DATA action + delete mWaitDialog; + mWaitDialog = 0; + HbProgressDialog *pd = new HbProgressDialog(HbProgressDialog::WaitDialog); + pd->setText(text); + // cancel -> complete with ESatBackwardModeRequestedByUser + SAT_ASSERT(connect(pd->actions().at(0),SIGNAL(triggered()), + &action,SLOT(completeWithBackRequested()))); + + // open dialog + pd->open(); + mWaitDialog = pd; + + qDebug("SATAPP: SatAppPopupProvider::showBIPWaitNote <"); +} + +// ---------------------------------------------------------------------------- +// SatAppPopupProvider::showCloseChannelWaitNote +// ---------------------------------------------------------------------------- +// +void SatAppPopupProvider::showCloseChannelWaitNote(SatAppAction& action) +{ + qDebug("SATAPP: SatAppPopupProvider::showCloseChannelWaitNote >"); + HbProgressDialog *pd = new HbProgressDialog(HbProgressDialog::WaitDialog); + pd->clearActions(); + pd->setText(alphaId(action)); + pd->open(); + mWaitDialog = pd; + qDebug("SATAPP: SatAppPopupProvider::showCloseChannelWaitNote <"); +} + +// ---------------------------------------------------------------------------- +// SatAppPopupProvider::showMoSmControlNote +// ---------------------------------------------------------------------------- +// +void SatAppPopupProvider::showMoSmControlNote(SatAppAction& action) +{ + qDebug("SATAPP: SatAppPopupProvider::showMoSmControlNote >"); + HbMessageBox *mb = new HbMessageBox(HbMessageBox::MessageTypeInformation); + mb->clearActions(); + mb->setText(alphaId(action)); + mb->open(); + mWaitDialog = mb; + qDebug("SATAPP: SatAppPopupProvider::showMoSmControlNote <"); +} + +// ---------------------------------------------------------------------------- +// SatAppPopupProvider::showSatInfoNote +// +// ---------------------------------------------------------------------------- +// +void SatAppPopupProvider::showSatInfoNote(SatAppAction& action) +{ + qDebug("SATAPP: SatAppPopupProvider::showSatInfoNote >"); + HbMessageBox *mb = new HbMessageBox(HbMessageBox::MessageTypeInformation); + mb->setText(alphaId(action)); + mb->open(); + mWaitDialog = mb; + qDebug("SATAPP: SatAppPopupProvider::showSatInfoNote <"); +} + +// ---------------------------------------------------------------------------- +// SatAppPopupProvider::showCallControlNote +// ---------------------------------------------------------------------------- +// +void SatAppPopupProvider::showCallControlNote(SatAppAction& action) +{ + qDebug("SATAPP: SatAppPopupProvider::showCallControlNote >"); + HbDeviceMessageBox *dmb = new HbDeviceMessageBox(HbMessageBox::MessageTypeInformation); + // No cancel key + dmb->setText(alphaId(action)); + dmb->show(); + mWaitDeviceDialog = dmb; + + qDebug("SATAPP: SatAppPopupProvider::showCallControlNote <"); +} + +// ---------------------------------------------------------------------------- +// SatAppPopupProvider::showSsWaitNote +// Displays a wait note to indicate SS sending. +// ---------------------------------------------------------------------------- +// +void SatAppPopupProvider::showSsWaitNote(SatAppAction& action) +{ + qDebug("SATAPP: SatAppPopupProvider::showSsWaitNote >"); + HbProgressDialog *pd = new HbProgressDialog(HbProgressDialog::WaitDialog); + pd->clearActions(); + pd->setText(alphaId(action)); + pd->show(); + mWaitDialog = pd; + qDebug("SATAPP: SatAppPopupProvider::showSsWaitNote <"); +} + +// ---------------------------------------------------------------------------- +// SatAppPopupProvider::showDtmfWaitNote +// ---------------------------------------------------------------------------- +// +void SatAppPopupProvider::showDtmfWaitNote(SatAppAction& action) +{ + qDebug("SATAPP: SatAppPopupProvider::showDtmfWaitNote >"); + HbProgressDialog *pd = new HbProgressDialog(HbProgressDialog::WaitDialog); + // cancel -> complete action with ESatBackwardModeRequestedByUser + SAT_ASSERT(connect(pd->actions().at(0), SIGNAL(triggered()), + &action, SLOT(completeWithBackRequested()))); + pd->setText(alphaId(action)); + pd->open(); + mWaitDialog = pd; + qDebug("SATAPP: SatAppPopupProvider::showDtmfWaitNote <"); + } + + +// ---------------------------------------------------------------------------- +// SatAppPopupProvider::showDtmfWaitNote +// ---------------------------------------------------------------------------- +// +void SatAppPopupProvider::showSmsWaitNote(SatAppAction& action) +{ + qDebug("SATAPP: SatAppPopupProvider::showSmsWaitNote >"); + HbProgressDialog *pd = new HbProgressDialog(HbProgressDialog::WaitDialog); + //remove the default cancel softkey + pd->clearActions(); + pd->setText(alphaId(action)); + pd->open(); + mWaitDialog = pd; + qDebug("SATAPP: SatAppPopupProvider::showSmsWaitNote <"); + } + +// ---------------------------------------------------------------------------- +// SatAppPopupProvider::stopShowWaitNote +// ---------------------------------------------------------------------------- +// +void SatAppPopupProvider::showSsErrorNote() +{ + qDebug("SATAPP: SatAppPopupProvider::showSsErrorNote >"); + HbMessageBox *mb = new HbMessageBox(HbMessageBox::MessageTypeWarning); + mb->setText(hbTrId("txt_sat_sendss_error_note")); + mb->open(); + mWaitDialog = mb; + qDebug("SATAPP: SatAppPopupProvider::showSsErrorNote <"); +} + +// ---------------------------------------------------------------------------- +// SatAppPopupProvider::clearScreen +// terminates all ongoing UI actions +// ---------------------------------------------------------------------------- +// +void SatAppPopupProvider::clearScreen() +{ + qDebug( "SATAPP: SatAppPopupProvider::clearScreen >" ); + stopShowWaitNote(); + if (mDisplayText){ + qDebug( "SatAppPopupProvider::clearScreen DisplayText" ); + delete mDisplayText; + mDisplayText = 0; + if (mAction) { + qDebug( "SatAppPopupProvider::clearScreen mAction" ); + SAT_ASSERT(disconnect(mAction, SIGNAL(actionCompleted(SatAppAction *)), + this, SLOT(resetState()))); + mAction->completeWithNoResponse(); + mAction = 0; + } + qDebug( "SatAppPopupProvider::clearScreen DisplayText <" ); + } + qDebug( "SATAPP: SatAppToneProvider::clearScreen <" ); +} + +// ---------------------------------------------------------------------------- +// SatAppPopupProvider::resetState +// reset +// ---------------------------------------------------------------------------- +// +void SatAppPopupProvider::resetState() +{ + qDebug( "SATAPP: SatAppPopupProvider::resetState >" ); + mAction = 0; + qDebug( "SATAPP: SatAppPopupProvider::resetState <" ); +} + +//End of file diff -r 1f002146abb4 -r cee7e9e0906c satui/satapp/src/satappserverdispatcher.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/satui/satapp/src/satappserverdispatcher.cpp Wed Aug 18 10:19:22 2010 +0300 @@ -0,0 +1,586 @@ +/* +* Copyright (c) 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" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Receives UI commands from SAT server and converts to QT +* +*/ + +// qt +#include +#include +#include +// symbian +#include +#include + +// sat +#include +#include "satappserverdispatcher.h" +#include "satappaction.h" +#include "satappconstant.h" + + +// ---------------------------------------------------------------------------- +// SatAppServerDispatcher::SatAppServerDispatcher +// ---------------------------------------------------------------------------- +// +SatAppServerDispatcher::SatAppServerDispatcher(QObject *parent) : + QObject(parent) +{ + qDebug("SATAPP: SatAppServerDispatcher::SatAppServerDispatcher"); + QT_TRAP_THROWING(ConnectSatSessionL()); +} + +// ---------------------------------------------------------------------------- +// SatAppServerDispatcher::~SatAppServerDispatcher +// ---------------------------------------------------------------------------- +// +SatAppServerDispatcher::~SatAppServerDispatcher() +{ + qDebug("SATAPP: SatAppServerDispatcher::~SatAppServerDispatcher"); + DisconnectSatSession(); +} + +// ---------------------------------------------------------------------------- +// SatAppServerDispatcher::menuSelection +// ---------------------------------------------------------------------------- +// +void SatAppServerDispatcher::menuSelection(SatAppAction* action) +{ + qDebug("SATAPP: SatAppServerDispatcher::menuSelection >"); + if ( ESatSuccess == action->response() ) { + // user selected item from menu + int menuItem = action->value(KeySelection).toInt(); + int helpRequested = action->value(KeyHelpRequested).toBool(); + qDebug("SATAPP: SatAppServerDispatcher::MenuSelection item=%d", + menuItem); + iSat.Adapter()->MenuSelection(menuItem, helpRequested); + } else if (ESatSessionTerminatedByUser == action->response()) { + // session terminated while executing the menu action + qDebug("SATAPP: SatAppServerDispatcher::SessionTerminated"); + iSat.Adapter()->SessionTerminated(EEndKeyUsed); + } + delete action; + qDebug("SATAPP: SatAppServerDispatcher::menuSelection <"); +} + +// ---------------------------------------------------------------------------- +// SatAppServerDispatcher::userCancelResponse +// ---------------------------------------------------------------------------- +// +void SatAppServerDispatcher::userCancelSession(SatAppAction* action) +{ + qDebug("SATAPP: SatAppServerDispatcher::userCancelSession"); + if (action && ESatBackwardModeRequestedByUser == action->response()){ + iSat.Adapter()->SessionTerminated(ESessionCancel); + } + delete action; + action = 0; +} + + +// **************************************************************************** +// * ************************************************************************ * +// * * SYMBIAN PART * * +// * ************************************************************************ * +// **************************************************************************** + +// ---------------------------------------------------------------------------- +// SatAppServerDispatcher::ConnectSatSessionL +// ---------------------------------------------------------------------------- +// +void SatAppServerDispatcher::ConnectSatSessionL() +{ + qDebug("SATAPP: SatAppServerDispatcher::ConnectSatSessionL>"); + //Register to Server as subsession + //If Server is not up, this function call may take time + iSatSession.ConnectL(); + iSat.RegisterL(iSatSession, this); + if (!iSat.Adapter()) + User::Leave(KErrNotFound); + qDebug("SATAPP: SatAppServerDispatcher::ConnectSatSessionL<"); +} + +// ---------------------------------------------------------------------------- +// SatAppServerDispatcher::DisconnectSatSession +// ---------------------------------------------------------------------------- +// +void SatAppServerDispatcher::DisconnectSatSession() +{ + qDebug("SATAPP: SatAppServerDispatcher::DisconnectSatSession>"); + iSat.Close(); + iSatSession.Close(); + qDebug("SATAPP: SatAppServerDispatcher::DisconnectSatSession<"); +} + +// ---------------------------------------------------------------------------- +// My own quick string -> descriptor conversion function :-) +// ---------------------------------------------------------------------------- +// +void s2d(const QString str, TDes& desc) +{ + desc.Copy(reinterpret_cast(str.utf16()), str.length()); +} + +// ---------------------------------------------------------------------------- +// SatAppServerDispatcher::DisplayTextL +// ---------------------------------------------------------------------------- +// +TSatUiResponse SatAppServerDispatcher::DisplayTextL( const TDesC& aText, + const TDesC& aSimApplicationName, + const TSatIconId& aIconId, + TBool& aRequestedIconDisplayed, + const TBool aSustainedText, + const TTimeIntervalSeconds aDuration, + const TBool aWaitUserToClear ) +{ + qDebug("SATAPP: SatAppServerDispatcher::DisplayTextL >"); + Q_UNUSED(aIconId); + SatAppAction action(ESatDisplayTextAction); + // validate + if (aText.Length()== 0 || aText.Length()>RSat::KTextToDisplayMaxSize){ + qDebug("SATAPP: SatAppServerDispatcher::DisplayText no text"); + aRequestedIconDisplayed = EFalse; + return ESatFailure; + } + + QT_TRYCATCH_LEAVING( + // ensure state + emit stopShowWaitNote(); + + // call + action.set(KeyText,aText); + action.set(KeyApplicationName, aSimApplicationName); + action.set(KeySustainedText, aSustainedText); + action.set(KeyDuration, const_cast(aDuration)); + action.set(KeyWaitUserToClear, aWaitUserToClear); + + emit displayText(action); + action.waitUntilCompleted(); + ); + + // return + qDebug("SATAPP: SatAppServerDispatcher::DisplayTextL action.response() %x<", + action.response()); + return action.response(); +} + +// ---------------------------------------------------------------------------- +// SatAppServerDispatcher::GetInkeyL +// ---------------------------------------------------------------------------- +// +TSatUiResponse SatAppServerDispatcher::GetInkeyL( + const TDesC& aText, + const TSatCharacterSet aCharacterSet, + TChar& aInput, + const TBool aHelpIsAvailable, + const TSatIconId& aIconId, + TBool& aRequestedIconDisplayed, + TUint& aDuration, + const TBool aImmediateDigitResponse ) +{ + Q_UNUSED(aHelpIsAvailable); + Q_UNUSED(aIconId); + + qDebug("SATAPP: SatAppServerDispatcher::GetInkeyL >"); + + // validate + aRequestedIconDisplayed = EFalse; + if (ESatYesNo == aCharacterSet && aText.Length() == 0) { + qDebug("SATAPP: CSatUiObserver::GetInkey return ESatFailure"); + return ESatFailure; + } + + SatAppAction action(ESatGetInkeyAction); + QT_TRYCATCH_LEAVING( + // ensure state + emit stopShowWaitNote(); + + // call + action.set(KeyText,aText); + action.set(KeyCharacterSet,(int)aCharacterSet); + action.set(KeyInKey,(int)aInput); + // convert from SAT time units(?) to milliseconds + action.set(KeyDuration,(int)aDuration*KSymbianTimeConvertQtTime); + action.set(KeyImmediate,(bool)aImmediateDigitResponse); + emit getInkey(action); + action.waitUntilCompleted(); + // convert from milliseconds to SAT time units(?) + aDuration = + action.value(KeyDuration).toInt()/KSymbianTimeConvertQtTime; + aInput = action.value(KeyInKey).toInt(); + ); + + // return + qDebug("SATAPP: SatAppServerDispatcher::GetInkeyL <"); + return action.response(); +} + +// ---------------------------------------------------------------------------- +// SatAppServerDispatcher::GetInputL +// ---------------------------------------------------------------------------- +// +TSatUiResponse SatAppServerDispatcher::GetInputL( + const TDesC& aText, + const TSatCharacterSet aCharacterSet, + TDes& aInput, + const TInt aMinLength, + const TInt aMaxLength, + const TBool aHideInput, + const TBool aHelpIsAvailable, + const TSatIconId& aIconId, + TBool& aRequestedIconDisplayed ) +{ + Q_UNUSED(aHelpIsAvailable); + Q_UNUSED(aIconId); + qDebug("SATAPP: SatAppServerDispatcher::GetInputL >"); + + // validate + aRequestedIconDisplayed = EFalse; + if ((aCharacterSet == ESatCharSmsDefaultAlphabet || + aCharacterSet == ESatCharUcs2Alphabet) && + aHideInput) { + qDebug("SATAPP: SatAppServerDispatcher::GetInput return ESatFailure"); + return ESatFailure; + } + + SatAppAction action(ESatGetInputAction); + QT_TRYCATCH_LEAVING( + // ensure state + emit stopShowWaitNote(); + + // call + action.set(KeyText,aText); + action.set(KeyCharacterSet,(int)aCharacterSet); + action.set(KeyInputString,aInput); + action.set(KeyMinLength,aMinLength); + action.set(KeyMaxLength,aMaxLength); + action.set(KeyHideInput,(bool)aHideInput); + emit getInput(action); + action.waitUntilCompleted(); + s2d(action.value(KeyInputString).toString(), aInput); + ) + + // return + qDebug("SATAPP: SatAppServerDispatcher::GetInputL <"); + return action.response(); +} + +// ---------------------------------------------------------------------------- +// SatAppServerDispatcher::SetUpMenuL +// ---------------------------------------------------------------------------- +// +TSatUiResponse SatAppServerDispatcher::SetUpMenuL( + const TDesC& aText, + const MDesCArray& aMenuItems, + const CArrayFixFlat* aMenuItemNextActions, + const TBool aHelpIsAvailable, + const TSatIconId& aIconId, + const CArrayFixFlat* aMenuIcons, + const enum TSatIconQualifier aIconListQualifier, + const enum TSatSelectionPreference aSelectionPreference ) +{ + Q_UNUSED(aMenuItemNextActions); + Q_UNUSED(aHelpIsAvailable); + Q_UNUSED(aIconId); + Q_UNUSED(aMenuIcons); + Q_UNUSED(aIconListQualifier); + Q_UNUSED(aSelectionPreference); + qDebug("SATAPP: SatAppServerDispatcher::SetUpMenuL >"); + + QT_TRYCATCH_LEAVING( + + // validate + if (!aMenuItems.MdcaCount()) { + emit clearScreen(); + QCoreApplication::instance()->quit(); + return ESatSuccess; + } + + // ensure state + emit stopShowWaitNote(); + + // call + SatAppAction* action = new SatAppAction(ESatSetUpMenuAction, this); + action->set(KeyText,aText); + action->set(KeyMenu,aMenuItems); + // connect for asynchronous menu selection + connect( + action,SIGNAL(actionCompleted(SatAppAction*)), + this,SLOT(menuSelection(SatAppAction*))); + + emit setUpMenu(*action); + ) + + // return + qDebug("SATAPP: SatAppServerDispatcher::SetUpMenuL <"); + return ESatSuccess; +} + +// ---------------------------------------------------------------------------- +// SatAppServerDispatcher::SelectItemL +// ---------------------------------------------------------------------------- +// +TSatUiResponse SatAppServerDispatcher::SelectItemL( + const TDesC& aText, + const MDesCArray& aMenuItems, + const CArrayFixFlat* aMenuItemNextActions, + const TInt aDefaultItem, + TUint8& aSelection, + const TBool aHelpIsAvailable, + const TSatIconId& aIconId, + const CArrayFixFlat* aMenuIcons, + const enum TSatIconQualifier aIconListQualifier, + TBool& aRequestedIconDisplayed, + const enum TSatSelectionPreference aSelectionPreference ) +{ + Q_UNUSED(aMenuItemNextActions); + Q_UNUSED(aHelpIsAvailable); + Q_UNUSED(aIconId); + Q_UNUSED(aMenuIcons); + Q_UNUSED(aIconListQualifier); + Q_UNUSED(aRequestedIconDisplayed); + Q_UNUSED(aSelectionPreference); + TSatUiResponse resp(ESatFailure); + SatAppAction action(ESatSelectItemAction); + qDebug("SATAPP: SatAppServerDispatcher::SelectItemL >"); + + QT_TRYCATCH_LEAVING( + // ensure state + emit stopShowWaitNote(); + + // call + action.set(KeyText,aText); + action.set(KeyMenu,aMenuItems); + action.set(KeyDefault,aDefaultItem); + emit selectItem(action); + action.waitUntilCompleted(); + resp = action.response(); + if ( ESatSuccess == resp ) { + aSelection = static_cast( + action.value(KeySelection).toInt()); + } + ) + + // return + qDebug("SATAPP: SatAppServerDispatcher::SelectItemL <"); + return resp; +} + +// ---------------------------------------------------------------------------- +// SatAppServerDispatcher::PlayTone +// ---------------------------------------------------------------------------- +// +TSatUiResponse SatAppServerDispatcher::PlayTone( + const TDesC& aText, + const TSatTone aTone, + const TTimeIntervalMicroSeconds aDuration, + const TSatIconId& aIconId, + TBool& aRequestedIconDisplayed ) +{ + Q_UNUSED(aIconId); + aRequestedIconDisplayed = EFalse; + TSatUiResponse resp(ESatSuccess); + qDebug("SATAPP: SatAppServerDispatcher::PlayTone >"); + SatAppAction action(ESatPlayToneAction); + int err(KErrNone); + QT_TRYCATCH_ERROR( + err, + // ensure state + emit stopShowWaitNote(); + + // call + action.set(KeyText,aText); + action.set(KeyToneId,aTone); + action.set(KeyDuration, const_cast(aDuration)); + emit playTone(action); + action.waitUntilCompleted(); + resp = action.response(); + ) + + // return + qDebug("SATAPP: SatAppServerDispatcher::PlayTone err = %d<", err); + return resp; +} + + +// ---------------------------------------------------------------------------- +// SatAppServerDispatcher::ConfirmCommand +// ---------------------------------------------------------------------------- +// +void SatAppServerDispatcher::ConfirmCommand( + const TSatSQueryCommand aCommandId, + const TSatAlphaIdStatus aAlphaIdStatus, + const TDesC& aText, + const TDesC& aAdditionalText, + TBool& aActionAccepted, + const TSatIconId& aIconId, + TBool& aRequestedIconDisplayed, + TBool& aTerminatedByUser ) +{ + qDebug("SATAPP: SatAppServerDispatcher::ConfirmCommand >"); + Q_UNUSED(aIconId); + aRequestedIconDisplayed = EFalse; + aTerminatedByUser = EFalse; + //ConfirmAction + SatAppAction action(ESatConfirmAction); + qDebug("SATAPP: SatAppServerDispatcher::ConfirmCommand"); + int err(KErrNone); + QT_TRYCATCH_ERROR( + err, + emit stopShowWaitNote(); + + action.set(KeyQueryCommandId, aCommandId); + action.set(KeyAlphaIdStatus, aAlphaIdStatus); + action.set(KeyText, aText); + action.set(KeyAdditionalText, aAdditionalText); + action.set(KeyActionAccepted, aActionAccepted); + + emit confirmCommand(action); + action.waitUntilCompleted(); + if (ESatSuccess == action.response() ) { + aActionAccepted = ETrue; + } + ) + qDebug("SATAPP: SatAppServerDispatcher::ConfirmCommand err = %d <", err); +} + +// ---------------------------------------------------------------------------- +// SatAppServerDispatcher::Notification +// ---------------------------------------------------------------------------- +// +TSatUiResponse SatAppServerDispatcher::Notification( + const TSatSNotifyCommand aCommandId, + const TSatAlphaIdStatus aAlphaIdStatus, + const TDesC& aText, + const TSatIconId& aIconId, + TBool& aRequestedIconDisplayed, + const TSatControlResult aControlResult ) +{ + Q_UNUSED(aIconId); + Q_UNUSED(aRequestedIconDisplayed); + qDebug("SATAPP: SatAppServerDispatcher::Notification command id=%d", + aCommandId); + + TSatUiResponse res(ESatFailure); + int err(KErrNone); + switch (aCommandId) + { + // With cancel + case ESatSSendDataNotify: // fall through + case ESatSReceiveDataNotify: // fall through + case ESatSSendDtmfNotify: // fall through + { + QT_TRYCATCH_ERROR( + err, + emit stopShowWaitNote(); + SatAppAction *action = new SatAppAction(ESatNotifyAction, this); + action->set(KeyText, aText); + action->set(KeyCommandId, aCommandId); + action->set(KeyAlphaIdStatus, aAlphaIdStatus); + action->set(KeyControlResult, aControlResult); + // connect for asynchronous menu selection + connect( + action,SIGNAL(actionCompleted(SatAppAction*)), + this,SLOT(userCancelSession(SatAppAction*))); + emit notification(*action); + res = ESatSuccess; + ) + break; + } + // Without cancel + case ESatSMoSmControlNotify: // fall through + case ESatSCallControlNotify: // fall through + case ESatSSendUssdNotify: // fall through + case ESatSSendSsNotify: // fall through + case ESatSSendSmsNotify: // fall through + case ESatSCloseChannelNotify: // fall through + { + QT_TRYCATCH_ERROR( + err, + emit stopShowWaitNote(); + SatAppAction a(ESatNotifyAction); + a.set(KeyText, aText); + a.set(KeyCommandId, aCommandId); + a.set(KeyAlphaIdStatus, aAlphaIdStatus); + a.set(KeyControlResult, aControlResult); + emit notification(a); + res = ESatSuccess; + ) + break; + } + default: + { + break; + } + } + qDebug("SATAPP: SatAppServerDispatcher::Notification < ret=%d", err); + return res; +} + +// ---------------------------------------------------------------------------- +// SatAppServerDispatcher::EventNotification +// ---------------------------------------------------------------------------- +// +void SatAppServerDispatcher::EventNotification( + const TSatSEvent aEventId, + const TSatSEventStatus aEventStatus, + const TInt aError ) +{ + qDebug( "SATAPP: SatAppServerDispatcher::EventNotification aEventId %d", + aEventId ); + Q_UNUSED(aEventStatus); + Q_UNUSED(aError); + int err(KErrNone); + + QT_TRYCATCH_ERROR( err, + switch ( aEventId ) + { + case ESatSSmEndEvent: + case ESatSsEndEvent: + case ESatSDtmfEndEvent: + { + emit stopShowWaitNote(); + break; + } + case ESatSClearScreenEvent: + { + qDebug("SATAPP: ClearScreen event"); + emit clearScreen(); + break; + } + case ESatSsErrorEvent: + { + qDebug("SATAPP: Notifying Ss error" ); + // If error occurred (and Alpha ID provided), notify user + emit showSsErrorNote(); + break; + } + case ESatSCloseSatUiAppEvent: + { + qDebug(" Close UI event" ); + emit clearScreen(); + QCoreApplication::instance()->quit(); + break; + } + default: + { + qDebug("SATAPP: Unknown event occured: %i", aEventId); + break; + } + } + ) // end QT_TRYCATCH_ERROR + qDebug("SATAPP: SatAppServerDispatcher::EventNotification err = %d<", err); +} + +//End of file diff -r 1f002146abb4 -r cee7e9e0906c satui/satapp/src/satapptoneprovider.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/satui/satapp/src/satapptoneprovider.cpp Wed Aug 18 10:19:22 2010 +0300 @@ -0,0 +1,702 @@ +/* +* Copyright (c) 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" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +// includes +#include +#include +#include +#include //playtone note + +#include "SatAppToneProvider.h" +#include "satappconstant.h" +#include "satappaction.h" + +// ---------------------------------------------------------------------------- +// SatAppToneProvider::SatAppToneProvider +// ---------------------------------------------------------------------------- +// +SatAppToneProvider::SatAppToneProvider(QObject *parent) : + QObject(parent) +{ + qDebug("SATAPP: SatAppToneProvider::SatAppToneProvider <>"); + mState = Idle; + mWarningAndPlayTones = false; + mVolume = 0; + mPlayer = 0; + mPlayToneError = ESatSuccess; + mTimer = 0; + mPermanentNote = 0; + mAudioPlayer = 0; + mCurrentAction = 0; +} + +// ---------------------------------------------------------------------------- +// SatAppToneProvider::~SatAppToneProvider +// ---------------------------------------------------------------------------- +// +SatAppToneProvider::~SatAppToneProvider() +{ + qDebug("SATAPP: SatAppToneProvider::~SatAppToneProvider >"); + + if (mCurrentAction) { + stopPlayTone(); + } + + if (mPermanentNote) { + qDebug("SatAppToneProvider::resetState delete mPermanentNote"); + delete mPermanentNote; + mPermanentNote = 0; + } + + if (mTimer) { + qDebug("SatAppToneProvider::resetState delete timer"); + delete mTimer; + mTimer = 0; + } + + qDebug("SATAPP: SatAppToneProvider::~SatAppToneProvider <"); +} + +//----------------------------------------------------------------------------- +// SatAppToneProvider::playTone +//----------------------------------------------------------------------------- +void SatAppToneProvider::playTone(SatAppAction& action) +{ + qDebug("SATAPP: SatAppToneProvider::playTone >"); + resetState(); + + mCurrentAction = &action; + int tone = action.value(KeyToneId).toInt(); + int duration = action.value(KeyDuration).toInt(); + QString text = action.value(KeyText).toString(); + QByteArray sequence; + mState = recognizeTone(tone,sequence,duration); + if (mState == PlayStandardTone) + { + playStandardTone(text,sequence,duration); + } + else if (mState == PlayUserSelectedTone) + { + playUserSelectedTone(text,tone,duration); + } + else + { + mCurrentAction->complete(ESatCmdDataNotUnderstood); + mCurrentAction = 0; + } + qDebug("SATAPP: SatAppToneProvider::playTone <"); +} + +//----------------------------------------------------------------------------- +// SatAppToneProvider::recognizeTone +// @param tone the tone code from server (see TSatTone in MSatUiObserver) +// @param sequence (out) standard tone play sequence +// @param duration (out) stanrard tone play duration (manipulated in some cases) +// @return suggested state for the tone provider (or Idle if tone is not recognised) +//----------------------------------------------------------------------------- +SatAppToneProvider::State SatAppToneProvider::recognizeTone( + int tone, + QByteArray& sequence, + int& duration) +{ + qDebug("SATAPP: SatAppToneProvider::recognizeTone >"); + State ret = Idle; + qDebug("SATAPP: SatAppToneProvider::recognizeTone tone: %d", tone); + switch (tone) + { + case ESatGeneralBeep: + case ESatPositiveTone: + case ESatToneNotSet: + { + if (duration == 0) duration = KSatDur170ms; // 170ms + sequence = charArrayToByteArray(KGeneralBeep, + sizeof(KGeneralBeep)); + ret = PlayStandardTone; + break; + } + case ESatNegativeTone: + { + if (duration == 0) duration = KSatDur250ms; // 250ms + sequence = charArrayToByteArray(KErrorTone, + sizeof(KErrorTone)); + ret = PlayStandardTone; + break; + } + case ESatRadioPathNotAvailableCallDropped: + { + if (duration == 0) duration = KSatDur1200ms; // 1200ms + sequence = charArrayToByteArray(KRadioPathNotAvailable, + sizeof(KRadioPathNotAvailable)); + ret = PlayStandardTone; + break; + } + case ESatRadioPathAcknowledge: + { + if (duration == 0) duration = KSatDur200ms; // 200ms + sequence = charArrayToByteArray(KRadioPathAck, + sizeof(KRadioPathAck)); + ret = PlayStandardTone; + break; + } + case ESatDialTone: + { + if (duration == 0) break; + sequence = charArrayToByteArray(KNetToneSeqDial, + sizeof(KNetToneSeqDial)); + ret = PlayStandardTone; + break; + } + case ESatCalledSubscriberBusy: + { + if (duration == 0) break; + sequence = charArrayToByteArray(KNetToneSeqNetBusy, + sizeof(KNetToneSeqNetBusy)); + ret = PlayStandardTone; + break; + } + case ESatCongestion: + { + if (duration == 0) break; + sequence = charArrayToByteArray(KNetToneSeqNetCongestion, + sizeof(KNetToneSeqNetCongestion)); + ret = PlayStandardTone; + break; + } + case ESatErrorSpecialInfo: + { + if (duration == 0) break; + sequence = charArrayToByteArray(KNetToneSeqNetSpecialInformation, + sizeof(KNetToneSeqNetSpecialInformation)); + ret = PlayStandardTone; + break; + } + case ESatCallWaitingTone: + { + if (duration == 0) break; + sequence = charArrayToByteArray(KNetToneSeqNetCallWaiting, + sizeof(KNetToneSeqNetCallWaiting)); + ret = PlayStandardTone; + break; + } + case ESatRingingTone: + { + if (duration == 0) break; + sequence = charArrayToByteArray(KNetToneSeqRingGoing, + sizeof(KNetToneSeqRingGoing)); + ret = PlayStandardTone; + break; + } + case ESatUserSelectedToneIncomingSpeech: + case ESatUserSelectedToneIncomingSms: + { + ret = PlayUserSelectedTone; + break; + } + default: + break; + } + + qDebug("SATAPP: SatAppToneProvider::recognizeTone state=%d <", ret); + return ret; +} + +//----------------------------------------------------------------------------- +// SatAppToneProvider::charArrayToByteArray +//----------------------------------------------------------------------------- +QByteArray SatAppToneProvider::charArrayToByteArray( + const char tone[], + int size) +{ + qDebug("SATAPP: SatAppToneProvider::charArrayToByteArray >"); + QByteArray seq; + seq = QByteArray::fromRawData(tone, size); + qDebug("SATAPP: SatAppToneProvider::charArrayToByteArray <"); + return seq; +} + +//----------------------------------------------------------------------------- +// SatAppToneProvider::playStandardTone +//----------------------------------------------------------------------------- +void SatAppToneProvider::playStandardTone( + const QString& text, + const QByteArray& sequence, + int duration) +{ + qDebug("SATAPP: SatAppToneProvider::playStandardTone >"); + + if (text.length() > 0) { + mPermanentNote = new HbMessageBox(HbMessageBox::MessageTypeInformation); + SAT_ASSERT(connect(mPermanentNote, SIGNAL(aboutToClose()), + this, SLOT(stopPlayTone()))); + mPermanentNote->setText(text); + mPermanentNote->setStandardButtons(HbMessageBox::Cancel); + if (duration > 0 ) { + mPermanentNote->setTimeout(duration); + } + mPermanentNote->setDismissPolicy(HbPopup::TapAnywhere); + qDebug("SatAppToneProvider::playStandardTone show before"); + mPermanentNote->show(); + qDebug("SatAppToneProvider::playStandardTone show after"); + } + + TPtrC8 seq((unsigned char*)sequence.constData(), sequence.length()); + qDebug("SATAPP: SatAppToneProvider::playStandardTone TPtrC8 seq: %S", &seq); + QT_TRAP_THROWING(SymbianPrepareAudioToneUtilityL(seq)); + + if (duration > 0) { + mTimer = new QTimer(this); + SAT_ASSERT(connect(mTimer, SIGNAL(timeout()), + this, SLOT(stopPlayTone()))); + mTimer->start(duration); + } + + qDebug("SATAPP: SatAppToneProvider::playStandardTone <"); +} + +//----------------------------------------------------------------------------- +// SatAppToneProvider::playUserSelectedTone +//----------------------------------------------------------------------------- +void SatAppToneProvider::playUserSelectedTone( + const QString& text, + int tone, + int duration) +{ + qDebug("SatAppToneProvider::playUserSelectedTone >"); + + // If several messages/calls arrive during a small amount of time and if the + // message received or incoming call tone is already being played we do not + // restart it. + if (mAudioPlayer) { + qDebug( "SatAppToneProvider::\ + PlayUserSelectedToneL Error - already played" ); + mCurrentAction->complete(ESatFailure); + mCurrentAction = 0; + mState = Idle; + return; + } + + if (text.length() > 0) { + mPermanentNote = new HbMessageBox(HbMessageBox::MessageTypeInformation); + mPermanentNote->setText(text); + mPermanentNote->setStandardButtons(HbMessageBox::Cancel); + if (duration) { + mPermanentNote->setTimeout(duration); + } + mPermanentNote->setDismissPolicy(HbPopup::TapAnywhere); + qDebug("SatAppToneProvider::PlayUserSelectedToneL show before"); + mPermanentNote->show(); + qDebug("SatAppToneProvider::PlayUserSelectedToneL show after"); + } + + QT_TRAP_THROWING(SymbianPrepareAudioPlayerL(tone,duration)); + + if (duration > 0) { + qDebug( "SATAPP: SatAppToneProvider::PlayUserSelectedToneL\ + duration not 0" ); + mTimer = new QTimer(this); + mTimer->start(duration); + SAT_ASSERT(connect(mTimer, SIGNAL(timeout()), this, SLOT(stopPlayTone()))); + + if (mPermanentNote) { + SAT_ASSERT(connect(mPermanentNote, SIGNAL(aboutToClose()), + this, SLOT(stopPlayTone()))); + } + } + + qDebug( "SatAppToneProvider::PlayUserSelectedToneL <" ); +} + + +// ---------------------------------------------------------------------------- +// SatAppToneProvider::clearScreen +// terminates all ongoing UI actions +// ---------------------------------------------------------------------------- +// +void SatAppToneProvider::clearScreen() +{ + qDebug( "SatAppToneProvider::clearScreen >" ); + if (mCurrentAction) { + stopPlayTone(); + } + qDebug( "SatAppToneProvider::clearScreen <" ); +} + +// ---------------------------------------------------------------------------- +// SatAppToneProvider::stopPlayTone +// Stops the music, frees blocked functions +// ---------------------------------------------------------------------------- +// +void SatAppToneProvider::stopPlayTone() +{ + qDebug("SATAPP: SatAppToneProvider::stopPlayTone >"); + + if (mPermanentNote) { + qDebug("SatAppToneProvider::stopPlayTone close mPermanentNote"); + disconnect(mPermanentNote,SIGNAL(aboutToClose()), + this, SLOT(stopPlayTone())); + mPermanentNote->close(); + } + + if (mTimer) { + qDebug("SatAppToneProvider::stopPlayTone stop timer"); + disconnect(mTimer,SIGNAL(timeout()), this, SLOT(stopPlayTone())); + if (mTimer->isActive()) { + mTimer->stop(); + } + } + + switch(mState) { + case PlayStandardTone: { + qDebug("SATAPP: SatAppToneProvider::stopPlayTone before play cancel"); + SymbianStopAudioToneUtility(); + + //get warning and game tones setting from active profile + QT_TRAP_THROWING(GetProfileParamsL()); + if( EFalse == mWarningAndPlayTones + && ESatSuccess == mPlayToneError ) { + mPlayToneError = ESatSuccessToneNotPlayed; + } + break; + } + case PlayUserSelectedTone: { + // Sample is played in forever loop for the duration. + // After duration call back timers are destroyed + // If player exists, stop playing and delete player. MapcPlayComplete + // is not called because CallBackTimer stops the playing. + SymbianStopAudioPlayer(); + if( EFalse == mWarningAndPlayTones ) { + mPlayToneError = ESatSuccessToneNotPlayed; + } + break; + } + default: + break; + } + + mState = Idle; + if (mCurrentAction) { + mCurrentAction->complete(mPlayToneError); + mCurrentAction = 0; + } + + qDebug("SATAPP: SatAppToneProvider::stopPlayTone <"); +} + +void SatAppToneProvider::resetState() +{ + qDebug("SATAPP: SatAppToneProvider::resetState >"); + if (mCurrentAction) { + mCurrentAction->completeWithNoResponse(); + mCurrentAction = 0; + } + + if (mPermanentNote) { + qDebug("SatAppToneProvider::resetState delete mPermanentNote"); + delete mPermanentNote; + mPermanentNote = 0; + } + + if (mTimer) { + qDebug("SatAppToneProvider::resetState delete timer"); + delete mTimer; + mTimer = 0; + } + qDebug("SATAPP: SatAppToneProvider::resetState <"); +} + + + +// **************************************************************************** +// * ************************************************************************ * +// * * SYMBIAN PART * * +// * ************************************************************************ * +// **************************************************************************** + + +// includes +#include //TTimeIntervalMicroSeconds +#include +#include +#include +#include +#include //KAudioPriorityLowLevel +#include // for CMdaAudioToneUtility&CMdaAudioPlayerUtility +#include //KMdaRepeatForever + +//constants + +// Maximum length for sound file. +const TInt KMaxSoundFileLength = 256; +// Used when dividing some values. Used only for preventing the use of magic +// numbers +// Audio sample is repeated indefinitely. +const TInt KSoundPlayerRepeatForever = KMdaRepeatForever; + +// The max volume value from settings. +// From TProfileToneSettings.h +const TInt KMaxVolumeFromProfile( 10 ); + +// ---------------------------------------------------------------------------- +// SatAppToneProvider::SymbianPrepareAudioToneUtilityL +// creates and prepares CMdaAudioToneUtility +// ---------------------------------------------------------------------------- +// +void SatAppToneProvider::SymbianPrepareAudioToneUtilityL(const TDesC8& sequence) +{ + qDebug( "SatAppToneProvider::SymbianPrepareAudioToneUtilityL >" ); + if (mPlayer) { + delete mPlayer; + mPlayer = 0; + } + mPlayer = CMdaAudioToneUtility::NewL(*this); + TInt volume(mPlayer->MaxVolume()); + mPlayer->SetVolume(volume); + mPlayer->PrepareToPlayDesSequence(sequence); + qDebug( "SatAppToneProvider::SymbianPrepareAudioToneUtilityL <" ); +} + +// ---------------------------------------------------------------------------- +// SatAppToneProvider::SymbianStopAudioToneUtility +// cancels and deletes CMdaAudioToneUtility +// ---------------------------------------------------------------------------- +void SatAppToneProvider::SymbianStopAudioToneUtility() +{ + qDebug( "SatAppToneProvider::SymbianStopAudioToneUtility >" ); + if (mPlayer) { + mPlayer->CancelPlay(); + } + delete mPlayer; + mPlayer = NULL; + qDebug( "SatAppToneProvider::SymbianStopAudioToneUtility <" ); +} + +// ---------------------------------------------------------------------------- +// SatAppToneProvider::SymbianPrepareAudioPlayerL +// cancels and deletes CMdaAudioToneUtility +// ---------------------------------------------------------------------------- +void SatAppToneProvider::SymbianPrepareAudioPlayerL( + int tone, int duration) +{ + qDebug( "SatAppToneProvider::SymbianPrepareAudioPlayerL >" ); + // This defines name for the current message alert or incoming call tone. + TBuf soundFileName; + GetProfileParamsL(tone, &soundFileName); + + // This defines the behaviour to be adopted by an + // audio client if a higher priority client takes over the device. + TInt mdaPriority( KAudioPrefIncomingCall ); + // This is used to resolve conflicts when more than one client tries to + // access the same sound output device simultaneously. + TInt audioPriority( KAudioPriorityPhoneCall ); + + qDebug( "SATAPP: SatAppToneProvider::PlayUserSelectedToneL\ + Volume is %d ", mVolume ); + + // Creates the audio player. + mAudioPlayer = CMdaAudioPlayerUtility::NewFilePlayerL( + soundFileName, + *this, + audioPriority, + ( TMdaPriorityPreference ) mdaPriority ); + + TTimeIntervalMicroSeconds no_silence(0); + if (duration > 0) + { + // repeat forever in a loop + mAudioPlayer->SetRepeats(KSoundPlayerRepeatForever, no_silence); + } + else + { + // play only once + mAudioPlayer->SetRepeats(0, no_silence); + } + qDebug( "SatAppToneProvider::SymbianPrepareAudioPlayerL <" ); + +} + +// ---------------------------------------------------------------------------- +// SatAppToneProvider::SymbianStopAudioPlayer +// cancels and deletes CMdaAudioToneUtility +// ---------------------------------------------------------------------------- +void SatAppToneProvider::SymbianStopAudioPlayer() +{ + qDebug( "SatAppToneProvider::SymbianStopAudioPlayer >" ); + if (mAudioPlayer) { + qDebug( "SatAppToneProvider::SymbianStopAudioPlayer AudioPlayer stop" ); + mAudioPlayer->Stop(); + } + delete mAudioPlayer; + mAudioPlayer = 0; + qDebug( "SatAppToneProvider::SymbianStopAudioPlayer <" ); +} + +// --------------------------------------------------------- +// SatAppCommandHandler::GetProfileParamsL +// Get and store settings from current profile +// (other items were commented in a header). +// --------------------------------------------------------- +// +void SatAppToneProvider::GetProfileParamsL( + int aTone /*= ESatToneNotSet*/, + TDes* aToneName /*= NULL*/ ) +{ + qDebug( "SatAppCommandHandler::GetProfileParamsL >" ); + MProfile* profile = NULL; + MProfileEngine* engine = NULL; + engine = CreateProfileEngineL(); + CleanupReleasePushL( *engine ); + + profile = engine->ActiveProfileLC(); + + const MProfileTones& tones = profile->ProfileTones(); + + // Takes a current warning and gametones setting. + const TProfileToneSettings& ts = tones.ToneSettings(); + mWarningAndPlayTones = ts.iWarningAndGameTones; + mVolume = ts.iRingingVolume; + + qDebug( "SatAppCommandHandler::GetProfileParamsL \ + mVolume before mapping %d", mVolume ); + + // Max volume from profile is KMaxVolumeFromProfile, Max volume from + // CMdaAudioToneUtility is different, maybe 10,000. So, + // rate = maxVolumeFromPlayer / KMaxVolumeFromProfile + // User may never hear the TONE, because volume is too small. + // iVolume times the rate make it can be heard. + + CMdaAudioToneUtility* toneUtl = CMdaAudioToneUtility::NewL( *this ); + TInt maxVolumeFromPlayer( toneUtl->MaxVolume() ); + mVolume *= maxVolumeFromPlayer / KMaxVolumeFromProfile; + delete toneUtl; + toneUtl = NULL; + qDebug( "CSatUiViewAppUi::GetProfileParamsL \ + mVolume after mapping %d", mVolume ); + + if ( ( ESatUserSelectedToneIncomingSms == aTone ) && ( aToneName ) ) + { + qDebug("SatAppCommandHandler::GetProfileParamsL message tone"); + aToneName->Copy( tones.MessageAlertTone() ); + } else if( aToneName ) { + qDebug("SatAppCommandHandler::GetProfileParamsL ring tone"); + aToneName->Copy( tones.RingingTone1() ); + } + + CleanupStack::PopAndDestroy(2); // engine, profile + qDebug("SatAppCommandHandler::GetProfileParamsL <"); +} + +// --------------------------------------------------------- +// SatAppToneProvider::MatoPrepareComplete +// Preparation is complete -> Starts playing tone +// --------------------------------------------------------- +// +void SatAppToneProvider::MatoPrepareComplete(TInt aError) +{ + qDebug("SatAppToneProvider::MatoPrepareComplete \ + aError = %d >", aError); + if (KErrNone == aError && mPlayer) { + mPlayToneError = ESatSuccess; + TTimeIntervalMicroSeconds zero(static_cast( 0 )); + mPlayer->SetPriority(KAudioPriorityLowLevel, + STATIC_CAST(TMdaPriorityPreference, KAudioPrefConfirmation)); + mPlayer->SetRepeats( KMdaAudioToneRepeatForever, zero ); + mPlayer->Play(); + } else { + mPlayToneError = ESatFailure; + stopPlayTone(); + } + qDebug( "SatAppToneProvider::MatoPrepareComplete <" ); +} + +//----------------------------------------------------------------------------- +// SatAppToneProvider::MatoPlayComplete +// Play complete -> Frees blocking function +// (other items were commented in a header). +// ---------------------------------------------------------------------------- +// +void SatAppToneProvider::MatoPlayComplete( TInt aError ) +{ + qDebug("SatAppToneProvider::MatoPlayComplete >"); + if (KErrNone == aError && mPlayer) { + qDebug("SatAppToneProvider::MatoPlayComplete play"); + mPlayer->Play(); + } else { + qDebug( "SatAppToneProvider::MatoPlayComplete stop playing"); + // Stops playing if error. + stopPlayTone(); + } + qDebug("SatAppToneProvider::MatoPlayComplete error %d <", aError); +} + +//----------------------------------------------------------------------------- +// SatAppToneProvider::MapcInitComplete +// Initialisation complete -> starts playing the tone. +// ---------------------------------------------------------------------------- +void SatAppToneProvider::MapcInitComplete( TInt aError, + const TTimeIntervalMicroSeconds& /*aDuration*/ ) +{ + qDebug( "SatAppToneProvider::MapcInitComplete >" ); + // Audio player is initialised, so if there is no error, we can start + // playing the tone. + if (KErrNone == aError && mAudioPlayer) { + const TInt volume( Max(0, Min(mVolume, + mAudioPlayer->MaxVolume()))); + qDebug("CSatUiViewAppUi::\ + MapcInitComplete SetVolume %d", volume ); + // Set volume according Settings. + mAudioPlayer->SetVolume( volume ); + mAudioPlayer->Play(); + qDebug( "SatAppToneProvider::MapcInitComplete Play" ); + } else { + // Otherwise, we delete the initialised audio player. + if ( mAudioPlayer ) { + qDebug( "SatAppToneProvider::MapcInitComplete mAudioPlayer \ + true" ); + delete mAudioPlayer; + mAudioPlayer = 0; + } + + // Remove also the note for play tone + // If there was a duration for play tone, stop waiting + stopPlayTone(); + + qDebug( "SatAppToneProvider::MapcInitComplete Error %d", aError ); + } + qDebug( "SatAppToneProvider::MapcInitComplete <" ); +} + +//----------------------------------------------------------------------------- +// SatAppToneProvider::MapcPlayComplete +// Deletes audio player after playing is completed. +// ---------------------------------------------------------------------------- +void SatAppToneProvider::MapcPlayComplete( TInt /*aError*/ ) +{ + qDebug( "SatAppToneProvider::MapcPlayComplete >" ); + + // When playing is completed, deleting the audio player. + if ( mAudioPlayer ) { + qDebug("SatAppToneProvider::MapcPlayComplete delete mAudioPlayer"); + delete mAudioPlayer; + mAudioPlayer = 0; + } + // Remove note after play has completed. + stopPlayTone(); + qDebug( "SatAppToneProvider::MapcPlayComplete <" ); +} + + +//End of file diff -r 1f002146abb4 -r cee7e9e0906c satui/satapp/src/satappuiprovider.cpp --- a/satui/satapp/src/satappuiprovider.cpp Tue Jul 06 14:53:02 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1283 +0,0 @@ -/* -* Copyright (c) 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" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ -#include -#include // GetInkey duration return -#include // timeout callback -#include // softkey -#include // application xml -#include // action user response -#include // DisplayText, ConfirmSend, -#include // CallControl, SetUpCall -#include // DisplayText, GetInput, SetUpCall -#include // GetInkey -#include // SendSms wait note -#include // For GetInput -#include // GetInput -#include -#include -#include -#include -#include "satappview.h" // SetUpMenu, SelectItem -#include "satappuiprovider.h" -#include "tflogger.h" - -const char *SATAPP_DOCML = ":/xml/satapp.docml"; -const char *SATAPP_SETUPMENU_VIEW = "setupmenu_view"; -const char *SATAPP_SELECTITEM_VIEW = "selectitem_view"; - -// ======== MEMBER FUNCTIONS ================================================== -// TODO: #ifndef __WINS__ need to be remove when orbit works well. Now the macro -// is to avoid panic on emulator. Deleting pointer before create dialog is to -// avoid memory leak in emulator. - -// ---------------------------------------------------------------------------- -// SatAppUiProvider -// ---------------------------------------------------------------------------- -// -SatAppUiProvider::SatAppUiProvider( - HbMainWindow &window, - SatAppEventProvider &event, - QObject *parent) : - QObject(parent), mMainWindow(window), mLoader(0), - mSetupMenuView(0), mSelectItemView(0), mDisplayPopup(0), - mGetInkeyQuery(0),mYesNoPopup(0), mImmediateQuery(0), mGetInputQuery(0), - mConfirmSendQuery(0), mSetUpCallQuery(0), mCallControlMsg(0), - mConfirmBipQuery(0), mUserRsp(EUserNoResponse), mDigitalRsp(0), - mMinLength(0), mTimer(0), mLoop(0),mWaitNote(0) -{ - TFLOGSTRING("SATAPP: SatAppUiProvider::SatAppUiProvider call"); - - bool docmlLoad = false; - mLoader = new SatAppDocumentLoader(); - // ownership of the objects are transferred to caller - mObjects = mLoader->load(SATAPP_DOCML,&docmlLoad); - if (docmlLoad) { - TFLOGSTRING("SATAPP: SatAppUiProvider::SatAppUiProvider view found") - mSetupMenuView = qobject_cast(mLoader->findWidget - (SATAPP_SETUPMENU_VIEW)); - if (mSetupMenuView) { - mMainWindow.addView(mSetupMenuView); - mSetupMenuView->setMainWindow(mMainWindow); - mSetupMenuView->initSetupMenu(event, *this); - mMainWindow.setCurrentView(mSetupMenuView); - } - - mSelectItemView = qobject_cast(mLoader->findWidget - (SATAPP_SELECTITEM_VIEW)); - if (mSelectItemView) { - mSelectItemView->setMainWindow(mMainWindow); - mSelectItemView->initSelectItem(event, *this); - } - } else { - TFLOGSTRING( - "SATAPP: SatAppUiProvider::SatAppUiProvider DOCML failure!"); - } - TFLOGSTRING("SATAPP: SatAppUiProvider::SatAppUiProvider eixt"); -} - -// ---------------------------------------------------------------------------- -// activeView -// ---------------------------------------------------------------------------- -// -void SatAppUiProvider::activeView(const QString &view) -{ - TFLOGSTRING("SATAPP: SatAppUiProvider::activeView"); - if(view == "setupmenu_view") { - mMainWindow.removeView(mMainWindow.currentView()); - mMainWindow.addView(mSetupMenuView); - mMainWindow.setCurrentView(mSetupMenuView); - TFLOGSTRING("SATAPP: SatAppUiProvider::activeView setup menu"); - } else { - mMainWindow.removeView(mMainWindow.currentView()); - mMainWindow.addView(mSelectItemView); - mMainWindow.setCurrentView(mSelectItemView); - TFLOGSTRING("SATAPP: SatAppUiProvider::activeView select item"); - } - TFLOGSTRING("SATAPP: SatAppUiProvider::activeView eixt"); -} - -// ---------------------------------------------------------------------------- -// Destructor -// ---------------------------------------------------------------------------- -// -SatAppUiProvider::~SatAppUiProvider() -{ - TFLOGSTRING("SATAPP: SatAppUiProvider::~SatAppUiProvider call"); - stopShowWaitNote(); - delete mLoader; - // delete all objects created from DOCML. - while (!mObjects.isEmpty()) { - TFLOGSTRING( - "SATAPP: SatAppUiProvider::~SatAppUiProvider object tree"); - delete mObjects.takeFirst(); - } - - if (mDisplayPopup) { - delete mDisplayPopup; - mDisplayPopup = 0; - } - - if (mGetInkeyQuery) { - delete mGetInkeyQuery; - mGetInkeyQuery = 0; - } - - if (mYesNoPopup) { - delete mYesNoPopup; - mYesNoPopup = 0; - } - - if (mImmediateQuery) { - delete mImmediateQuery; - mImmediateQuery = 0; - } - if (mGetInputQuery) { - delete mGetInputQuery; - mGetInputQuery = 0; - } - if (mConfirmSendQuery) { - delete mConfirmSendQuery; - mConfirmSendQuery = 0; - } - - if (mSetUpCallQuery) { - delete mSetUpCallQuery; - mSetUpCallQuery = 0; - } - - if (mConfirmBipQuery ) { - delete mConfirmBipQuery ; - mConfirmBipQuery = 0; - } - - if (mWaitNote) { - delete mWaitNote; - mWaitNote = 0; - } - - if (mLoop && mLoop->isRunning()) { - mLoop->exit(); - delete mLoop; - mLoop = 0; - TFLOGSTRING("SatAppUiProvider::~SatAppUiProvider exit loop") - } - - if (mCallControlMsg) { - delete mCallControlMsg; - mCallControlMsg = 0; - } - TFLOGSTRING("SATAPP: SatAppUiProvider::~SatAppUiProvider exit"); -} - -// ---------------------------------------------------------------------------- -// userPrimaryResponse -// ---------------------------------------------------------------------------- -// -void SatAppUiProvider::userPrimaryResponse() -{ - mUserRsp = EUserPrimaryResponse; - TFLOGSTRING("SATAPP: SatAppUiProvider::userPrimaryResponse call-exit") -} - -// ---------------------------------------------------------------------------- -// userSecondaryResponse -// ---------------------------------------------------------------------------- -// -void SatAppUiProvider::userSecondaryResponse() -{ - mUserRsp = EUserSecondaryResponse; - TFLOGSTRING("SATAPP: SatAppUiProvider::userSecondaryResponse call-exit") -} - -// ---------------------------------------------------------------------------- -// showSetUpMenuView -// ---------------------------------------------------------------------------- -// -void SatAppUiProvider::showSetUpMenuView( - TSatUiResponse &aRes, - const QString &aText, - const QStringList &aMenuItems, - //const CArrayFixFlat *aMenuItemNextActions, - //const HbIcon &aIcon, - //const CAknIconArray *aItemIconsArray, - const bool aSelfExplanatoryItems, - const bool aHelpIsAvailable) -{ - TFLOGSTRING("SATAPP: SatAppUiProvider::showSetUpMenuView call") - stopShowWaitNote(); - activeView("setupmenu_view"); - - // The text is the application name - // should be shown on the menu area always - if (!aText.isEmpty()) { - TFLOGSTRING2("SATAPP: SatAppUiProvider::showSetUpMenuView: title1", - aText.utf16()) - mSetupMenuView->setTitle(aText); - TFLOGSTRING2("SATAPP: SatAppUiProvider::showSetUpMenuView: title2", - aText.utf16()) - mSelectItemView->setTitle(aText); - } - - mSetupMenuView->showSetUpMenuContent(aRes, aText, aMenuItems, - aSelfExplanatoryItems, aHelpIsAvailable); - TFLOGSTRING("SATAPP: SatAppUiProvider::showSetUpMenuView exit") -} - -// ---------------------------------------------------------------------------- -// showSelectItemView -// ---------------------------------------------------------------------------- -// -void SatAppUiProvider::showSelectItemView( - TSatUiResponse &aRes, - const QString &aText, - const QStringList &aMenuItems, - //const CArrayFixFlat *aMenuItemNextActions, - const int aDefaultItem, - unsigned char &aSelection, - //const HbIcon &aIcon, - //const CAknIconArray *aItemsIconArray, - const bool aSelfExplanatoryItems, - const bool aHelpIsAvailable) -{ - TFLOGSTRING("SATAPP: SatAppUiProvider::showSelectItemView call") - stopShowWaitNote(); - activeView("selectitem_view"); - mSelectItemView->showSelectItemContent(aRes, aText, - aMenuItems, aDefaultItem, aSelection, - aSelfExplanatoryItems, aHelpIsAvailable); - TFLOGSTRING("SATAPP: SatAppUiProvider::showSelectItemView call") -} - - -// ---------------------------------------------------------------------------- -// showDisplayTextPopup -// ---------------------------------------------------------------------------- -// -TSatAppUserResponse SatAppUiProvider::showDisplayTextPopup( - const QString &aHeading, - const QString &aContent, - const int aDuration) -{ - TFLOGSTRING("SATAPP: SatAppUiProvider::showDisplayTextPopup call") - resetUserResponse(); - stopShowWaitNote(); - - if (mDisplayPopup){ - delete mDisplayPopup; - mDisplayPopup = NULL; - } - mDisplayPopup = new HbMessageBox(HbMessageBox::MessageTypeInformation); - - if (mDisplayPopup) { - TFLOGSTRING( - "SATAPP: SatAppUiProvider::showDisplayTextPopup note created") - - // Set the label as heading widget - HbLabel *lHeading = new HbLabel(aHeading, mDisplayPopup); - mDisplayPopup->setHeadingWidget(lHeading); - mDisplayPopup->setText(aContent); - mDisplayPopup->setIconVisible(false); - composeDialog(mDisplayPopup, aDuration, ESatDialogDisplayText); - TFLOGSTRING( - "SATAPP: SatAppUiProvider::showDisplayTextPopup duration before open") - DialogWaiter waiter; - mDisplayPopup->open(&waiter, SLOT(done(HbAction *))); - waiter.wait(); - TFLOGSTRING( - "SATAPP: SatAppUiProvider::showDisplayTextPopup duration end open") -#ifndef __WINS__ - delete mDisplayPopup; - mDisplayPopup = 0; -#endif - } - TFLOGSTRING("SATAPP: SatAppUiProvider::showDisplayTextPopup exit") - return mUserRsp; -} - -// ---------------------------------------------------------------------------- -// showGetInkeyQuery -// ---------------------------------------------------------------------------- -// -TSatAppUserResponse SatAppUiProvider::showGetInkeyQuery( - const QString &aHeading, - QString &aContent, - const TSatCharacterSet aCharacterSet, - unsigned int &aDuration) -{ - TFLOGSTRING("SATAPP: SatAppUiProvider::showGetInkeyQuery call") - - resetUserResponse(); - stopShowWaitNote(); - - if (mGetInkeyQuery){ - delete mGetInkeyQuery; - mGetInkeyQuery = NULL; - } - mGetInkeyQuery = new HbInputDialog(); - if (mGetInkeyQuery) { - TFLOGSTRING("SATAPP: SatAppUiProvider::showGetInkeyQuery note created") - // Set PromptText - mGetInkeyQuery->setPromptText(aHeading); - // Set ContentText - QVariant vContent(aContent); - mGetInkeyQuery->setValue(vContent); - HbEditorInterface inputMode(mGetInkeyQuery->lineEdit()); - mGetInkeyQuery->lineEdit()->setFocus(); - if (ESatDigitOnly == aCharacterSet) { - // digit mode, digits only (0 9, *, #, and +) - inputMode.setFilter(HbPhoneNumberFilter::instance()); - } else { - // char mode - inputMode.setUpAsLatinAlphabetOnlyEditor(); - } - composeDialog(mGetInkeyQuery, aDuration, ESatDialogGetInkey); - mGetInkeyQuery->lineEdit()->setMaxLength(1); - connect(mGetInkeyQuery->lineEdit(), SIGNAL(textChanged(QString)), - this, SLOT(updateQueryAction(QString))); - TFLOGSTRING("SATAPP: SatAppUiProvider::showGetInkeyQuery before pop") - DialogWaiter waiter; - mGetInkeyQuery->open(&waiter, SLOT(done(HbAction *))); - waiter.wait(); - TFLOGSTRING("SATAPP: SatAppUiProvider::showGetInkeyQuery end pop") - - QString inputString = (mGetInkeyQuery->value()).toString(); - aContent = inputString; - -#ifndef __WINS__ - delete mGetInkeyQuery; - mGetInkeyQuery = 0; -#endif - } - TFLOGSTRING("SATAPP: SatAppUiProvider::showGetInkeyQuery exit") - return mUserRsp; -} - -// ---------------------------------------------------------------------------- -// showGetYesNoQuery -// ---------------------------------------------------------------------------- -// -int SatAppUiProvider::showGetYesNoQuery( - const QString &aText, - const TSatCharacterSet aCharacterSet, - unsigned int &aInkey, - unsigned int &aDuration, - const bool aImmediateDigitResponse) -{ - TFLOGSTRING("SATAPP: SatAppUiProvider::showGetYesNoQuery call") - resetUserResponse(); - stopShowWaitNote(); - TFLOGSTRING2("SATAPP: SatAppUiProvider::showGetYesNoQuery duration in=%d", - aDuration) - if (ESatYesNo == aCharacterSet) { - if (mYesNoPopup){ - delete mYesNoPopup; - mYesNoPopup = 0; - } - mYesNoPopup = new HbMessageBox(HbMessageBox::MessageTypeInformation); - - if (mYesNoPopup) { - TFLOGSTRING("SATAPP: SatAppUiProvider::showGetYesNoQuery normal") - // Set the label as heading widget - HbLabel *lHeading = new HbLabel(aText, mYesNoPopup); - mYesNoPopup->setHeadingWidget(lHeading); - mYesNoPopup->setIconVisible(false); - - composeDialog(mYesNoPopup, aDuration, ESatDialogGetYesNo); - - TFLOGSTRING("SATAPP: SatAppUiProvider::showGetYesNoQuery before open") - DialogWaiter waiter; - mYesNoPopup->open(&waiter, SLOT(done(HbAction *))); - waiter.wait(); - TFLOGSTRING( "SATAPP: SatAppUiProvider::showGetYesNoQuery after open") - mYesNoPopup->close(); - } - } else if (aImmediateDigitResponse) { - if (mImmediateQuery) { - delete mImmediateQuery; - mImmediateQuery = 0; - } - mImmediateQuery = new HbInputDialog(); - if (mImmediateQuery) { - mImmediateQuery->setPromptText(aText); - // user can choose the charactor or digital , and only cancel - // key press, then close current dialog - TFLOGSTRING("SATAPP: SatAppUiProvider::showGetYesNoQuery immediate") - composeDialog(mImmediateQuery, aDuration, ESatDialogGetDigitalRsp); - bool ret = connect(mImmediateQuery->lineEdit(), - SIGNAL(textChanged(QString)), - this, SLOT(updateQueryAction(QString))); - TFLOGSTRING2("SATAPP: SatAppUiProvider::showGetYesNoQuery:\ - connect updateQueryAction=%d", ret) - // digit mode, digits only (0 9, *, #, and +) - HbEditorInterface inputMode(mImmediateQuery->lineEdit()); - inputMode.setFilter(HbPhoneNumberFilter::instance()); - if (mLoop) { - TFLOGSTRING("SatAppUiProvider::showGetYesNoQuery delete loop") - delete mLoop; - mLoop = 0; - } - if (mTimer) { - delete mTimer; - mTimer = 0; - TFLOGSTRING("SatAppUiProvider::showGetYesNoQuery delete timer") - } - mTimer = new QTimer(this); - mTimer->start(aDuration); - ret = connect(mTimer, SIGNAL(timeout()), mTimer, SLOT(stop())); - TFLOGSTRING2("SATAPP: SatAppUiProvider::showGetYesNoQuery connect\ - mTimer stop: %d", ret) - mLoop = new QEventLoop(this); - ret = connect(mTimer, SIGNAL(timeout()), mLoop, SLOT(quit())); - TFLOGSTRING("SATAPP: SatAppUiProvider::showGetYesNoQuery befor pop") - mImmediateQuery->open(); - mLoop->exec(); - TFLOGSTRING("SATAPP: SatAppUiProvider::showGetYesNoQuery end pop") - if (mTimer->isActive()) { - TFLOGSTRING("SATAPP: SatAppUiProvider::showGetYesNoQuery stop time") - mTimer->stop(); - } - aInkey = mDigitalRsp; - mImmediateQuery->close(); - } - } - return mUserRsp; -} - -// ---------------------------------------------------------------------------- -// showGetInputQuery -// ---------------------------------------------------------------------------- -// -TSatAppUserResponse SatAppUiProvider::showGetInputQuery( - const QString &heading, - QString &content, - const TSatCharacterSet characterSet, - const int minLength, - const int maxLength, - const bool aHideInput) -{ - TFLOGSTRING("SATAPP: SatAppUiProvider::showGetInputQuery call") - TFLOGSTRING3("SATAPP: SatAppUiProvider::showGetInputQuery \ - min %d max %d length", minLength, maxLength) - resetUserResponse(); - stopShowWaitNote(); - mMinLength = minLength; - - if (mGetInputQuery){ - delete mGetInputQuery; - mGetInputQuery = NULL; - } - mGetInputQuery = new HbInputDialog(); - mGetInputQuery->setPromptText(heading); - QVariant vContent(content); - mGetInputQuery->setValue(vContent); - HbEditorInterface inputMode(mGetInputQuery->lineEdit()); - mGetInputQuery->lineEdit()->setFocus(); - if (ESatDigitOnly == characterSet) { - // digit mode, digits only (0 9, *, #, and +) - inputMode.setFilter(HbPhoneNumberFilter::instance()); - } else { - // char mode - inputMode.setUpAsLatinAlphabetOnlyEditor(); - } - - mGetInputQuery->lineEdit()->setMaxLength(maxLength); - - composeDialog(mGetInputQuery, KDefaultSelectionTimeoutMseconds, ESatDialogGetInput); - // Sets the "OK"-action/button - if ((0 == minLength || content.length() >= minLength) && - mGetInputQuery->actions().at(0)) { - mGetInputQuery->actions().at(0)->setEnabled(true); - } - - if (aHideInput) { - mGetInputQuery->lineEdit()->setEchoMode(HbLineEdit::Password); - - bool res = connect(mGetInputQuery->lineEdit(), - SIGNAL(contentsChanged()), this, SLOT(contentChanged())); - TFLOGSTRING2("SATAPP: SatAppUiProvider::showGetInputQuery \ - connect %d",res); - }else { - connect(mGetInputQuery->lineEdit(), SIGNAL(textChanged(QString)), - this, SLOT(updateQueryAction(QString))); - } - - TFLOGSTRING("SATAPP: SatAppUiProvider::showGetInputQuery before pop") - DialogWaiter waiter; - mGetInputQuery->open(&waiter, SLOT(done(HbAction *))); - waiter.wait(); - TFLOGSTRING("SATAPP: SatAppUiProvider::showGetInputQuery end pop") - - content = (mGetInputQuery->value()).toString(); - -#ifndef __WINS__ - delete mGetInputQuery; - mGetInputQuery = 0; -#endif - - TFLOGSTRING2("SATAPP: SatAppUiProvider::showGetInputQuery mUserRsp =%d exit", - mUserRsp) - return mUserRsp; -} - -// ---------------------------------------------------------------------------- -// SatAppInputProvider::contentChanged -// Called when editor field is modified -// ---------------------------------------------------------------------------- -// -void SatAppUiProvider::contentChanged() -{ - if (mGetInputQuery) { - QString content = (mGetInputQuery->value()).toString(); - updateQueryAction(content); - } -} - -// ---------------------------------------------------------------------------- -// Called when editor field is modified -// ---------------------------------------------------------------------------- -// -void SatAppUiProvider::updateQueryAction(QString text) -{ - TFLOGSTRING("SATAPP: SatAppUiProvider::updateQueryAction call") - // Get Input - if (mGetInputQuery && mGetInputQuery->actions().at(0)) { - if (text.length() >= mMinLength ) { - mGetInputQuery->actions().at(0)->setEnabled(true); - } else { - mGetInputQuery->actions().at(0)->setEnabled(false); - } - } - - // Get InKey - if (mGetInkeyQuery && mGetInkeyQuery->actions().at(0)) { - if (1 == text.length()) { - mGetInkeyQuery->actions().at(0)->setEnabled(true); - } else { - mGetInkeyQuery->actions().at(0)->setEnabled(false); - } - } - if (mImmediateQuery) { - TFLOGSTRING("SATAPP: SatAppUiProvider::updateQueryAction \ - digital immediate") - immediateResponse(text); - } - TFLOGSTRING("SATAPP: SatAppUiProvider::updateQueryAction exit") -} - -// ---------------------------------------------------------------------------- -// showConfirmSendQuery -// ---------------------------------------------------------------------------- -// -void SatAppUiProvider::showConfirmSendQuery( - const QString &aText, - bool &aActionAccepted) -{ - TFLOGSTRING("SATAPP: SatAppUiProvider::showConfirmSendQuery call") - resetUserResponse(); - - if (mConfirmSendQuery){ - delete mConfirmSendQuery; - mConfirmSendQuery = NULL; - } - mConfirmSendQuery = new HbMessageBox(HbMessageBox::MessageTypeQuestion); - if(mConfirmSendQuery) { - mConfirmSendQuery->setText(aText); - composeDialog(mConfirmSendQuery, 0, ESatDialogConfirmSend); - - TFLOGSTRING("SATAPP: SatAppUiProvider::confirmSend before open") - DialogWaiter waiter; - mConfirmSendQuery->open(&waiter, SLOT(done(HbAction *))); - waiter.wait(); - TFLOGSTRING("SATAPP: SatAppUiProvider::confirmSend after open") - -#ifndef __WINS__ - delete mConfirmSendQuery; - mConfirmSendQuery = 0; -#endif - } - aActionAccepted = (EUserPrimaryResponse == mUserRsp) ? true : false; - TFLOGSTRING("SATAPP: SatAppUiProvider::showConfirmSendQuery exit") -} - -// ---------------------------------------------------------------------------- -// showSmsWaitNote -// ---------------------------------------------------------------------------- -// -void SatAppUiProvider::showSmsWaitNote(const QString &aText) -{ - TFLOGSTRING("SATAPP: SatAppUiProvider::showSmsWaitNote") - if (mWaitNote) { - delete mWaitNote; - mWaitNote = 0; - } - mWaitNote = new HbProgressDialog(HbProgressDialog::WaitDialog); - //remove the default cancel softkey - if (mWaitNote){ - mWaitNote->clearActions(); - if(aText.isEmpty()) { - mWaitNote->setText(hbTrId("txt_sat_sendingtextmessage")); - } else { - mWaitNote->setText(aText); - } - mWaitNote->show(); - // Extend showing sms wait note timer for test - extendNoteShowtime(); - } - TFLOGSTRING("SATAPP: SatAppUiProvider::showSmsWaitNote exit") - } - -// ---------------------------------------------------------------------------- -// showDtmfWaitNote -// ---------------------------------------------------------------------------- -// -void SatAppUiProvider::showDtmfWaitNote( - TSatUiResponse &aRes, - const QString &aText) -{ - TFLOGSTRING("SATAPP: SatAppUiProvider::showDtmfWaitNote call") - aRes = ESatSuccess; - - if (mWaitNote) { - delete mWaitNote; - mWaitNote = 0; - } - - mWaitNote = new HbProgressDialog(HbProgressDialog::WaitDialog); - //remove the default cancel softkey - bool ret = connect(mWaitNote->actions().at(0), SIGNAL(triggered()), - this, SLOT(cancelResponse())); - TFLOGSTRING2("SATAPP: SatAppUiProvider::showDtmfWaitNote \ - primaryAction=%d", ret) - if(aText.isEmpty()) { - mWaitNote->setText(hbTrId("txt_sat_senddtmf_wait_note")); - } else { - mWaitNote->setText(aText); - } - mWaitNote->show(); - // Extend showing sms wait note timer for test - extendNoteShowtime(); - TFLOGSTRING("SATAPP: SatAppUiProvider::showDtmfWaitNote exit") - } - -// ---------------------------------------------------------------------------- -//stopShowWaitNote -// ---------------------------------------------------------------------------- -// -void SatAppUiProvider::stopShowWaitNote() -{ - TFLOGSTRING("SATAPP: SatAppUiProvider::stopShowWaitNote call") - - if (mWaitNote) { - TFLOGSTRING("SATAPP: SatAppUiProvider::mWaitNote close") - mWaitNote->close(); - delete mWaitNote; - mWaitNote = 0; - } - - if (mCallControlMsg) { - TFLOGSTRING("SATAPP: SatAppUiProvider::mCallControlMsg close") - mCallControlMsg->close(); - delete mCallControlMsg; - mCallControlMsg = 0; - } - TFLOGSTRING("SATAPP: SatAppUiProvider::stopShowWaitNote exit") -} - -// ---------------------------------------------------------------------------- -// showConfirmSetUpCallQUery -// ---------------------------------------------------------------------------- -// -void SatAppUiProvider::showConfirmSetUpCallQuery( - const QString &aText, - const QString &aSimAppName, - bool &aActionAccepted) -{ - TFLOGSTRING("SATAPP: SatAppUiProvider::showConfirmSetUpCallQUery call") - resetUserResponse(); - - QString alphaId; - if (aText.length() == 0){ - if (aSimAppName.length() > 0){ - alphaId.append(aSimAppName); - } else { - alphaId.append(hbTrId("txt_sat_title")); - } - alphaId.append(hbTrId("txt_sat_setupcall_confirm_note")); - TFLOGSTRING("SATAPP: SatAppUiProvider::showConfirmSetUpCallQUery length 0") - } else { - alphaId.append(aText); - TFLOGSTRING("SATAPP: SatAppUiProvider::showConfirmSetUpCallQUery exit") - } - if (mSetUpCallQuery){ - delete mSetUpCallQuery; - mSetUpCallQuery = NULL; - } - - mSetUpCallQuery = new HbMessageBox(HbMessageBox::MessageTypeQuestion); - if(mSetUpCallQuery) { - mSetUpCallQuery->setText(alphaId); - composeDialog(mSetUpCallQuery, 0, ESatDialogSetUpCall); - - TFLOGSTRING("SATAPP: SatAppSetUpCall::showSetUpCallConfirm before open") - DialogWaiter waiter; - mSetUpCallQuery->open(&waiter, SLOT(done(HbAction *))); - waiter.wait(); - TFLOGSTRING("SATAPP: SatAppSetUpCall::showSetUpCallConfirm after open") - -#ifndef __WINS__ - delete mSetUpCallQuery; - mSetUpCallQuery = 0; -#endif - } - aActionAccepted = (EUserPrimaryResponse == mUserRsp) ? true : false; - TFLOGSTRING("SATAPP: SatAppUiProvider::showConfirmSetUpCallQUery exit") -} - -// ---------------------------------------------------------------------------- -// clearScreen -// ---------------------------------------------------------------------------- -// -void SatAppUiProvider::clearScreen() -{ - TFLOGSTRING("SATAPP: SatAppUiProvider::clearScreen called") - if (mDisplayPopup) { - TFLOGSTRING("SATAPP: SatAppUiProvider::clearScreen DisplayText") - mDisplayPopup->close(); - mDisplayPopup = NULL; - } - if (mGetInkeyQuery) { - TFLOGSTRING("SATAPP: SatAppUiProvider::clearScreen GetInkey") - mGetInkeyQuery->close(); - mGetInkeyQuery = NULL; - } - - if (mYesNoPopup) { - TFLOGSTRING("SATAPP: SatAppUiProvider::clearScreen mYesNoPopup") - mYesNoPopup->close(); - delete mYesNoPopup; - mYesNoPopup = 0; - } - - if (mImmediateQuery) { - TFLOGSTRING("SATAPP: SatAppUiProvider::clearScreen mImmediateQuery") - mImmediateQuery->close(); - mImmediateQuery = NULL; - } - - if (mGetInputQuery) { - TFLOGSTRING("SATAPP: SatAppUiProvider::clearScreen GetInput") - mGetInputQuery->close(); - mGetInputQuery = NULL; - } - - if(mConfirmSendQuery) { - TFLOGSTRING("SATAPP: SatAppUiProvider::clearScreen ConfirmSend") - mConfirmSendQuery->close(); - mConfirmSendQuery = NULL; - } - - if (mSetUpCallQuery) { - TFLOGSTRING("SATAPP: SatAppUiProvider::clearScreen SetUpCall") - mSetUpCallQuery->close(); - mSetUpCallQuery = NULL; - } - - if (mCallControlMsg){ - TFLOGSTRING("SATAPP: SatAppUiProvider::clearScreen CallControlMsg") - mCallControlMsg->close(); - mCallControlMsg = NULL; - } - - if (mConfirmBipQuery){ - TFLOGSTRING("SATAPP: SatAppUiProvider::clearScreen ConfirmBip") - mConfirmBipQuery->close(); - mConfirmBipQuery = NULL; - } - - if (mWaitNote){ - TFLOGSTRING("SATAPP: SatAppUiProvider::clearScreen WaitNote") - mWaitNote->close(); - mWaitNote = NULL; - } - mUserRsp = EUserClearResponse; - TFLOGSTRING("SATAPP: SatAppUiProvider::clearScreen exit") -} - -// ---------------------------------------------------------------------------- -// closeUi -// ---------------------------------------------------------------------------- -// -void SatAppUiProvider::closeUi() - { - TFLOGSTRING("SATAPP: SatAppUiProvider::closeUi called") - clearScreen(); - mUserRsp = EUserCloseResponse; - QCoreApplication::instance()->quit(); - TFLOGSTRING("SATAPP: SatAppUiProvider::closeUi exit") -} - -// ---------------------------------------------------------------------------- -// resetUserResponse -// ---------------------------------------------------------------------------- -// -void SatAppUiProvider::resetUserResponse() -{ - TFLOGSTRING("SATAPP: SatAppUiProvider::resetUserResponse call") - mUserRsp = EUserNoResponse; - mDigitalRsp = Qt::Key_unknown; - mMinLength = 0; - TFLOGSTRING("SATAPP: SatAppUiProvider::resetUserResponse exit") -} - -// ---------------------------------------------------------------------------- -// composeDialog: make sure dlg has 2 buttons -// ---------------------------------------------------------------------------- -// -void SatAppUiProvider::composeDialog( - HbDialog *dlg, - int aDuration, - TSatAppDialogActionType type, - bool aModal/* = true*/, - HbDialog::DismissPolicy aDismissPolicy/* = HbDialog::NoDismiss*/) -{ - TFLOGSTRING("SATAPP: SatAppUiProvider::composeDialog call") - - dlg->setModal(aModal); - dlg->setDismissPolicy(aDismissPolicy); - if (aDuration){ - dlg->setTimeout(aDuration); - } else { - dlg->setTimeout(HbDialog::NoTimeout); - } - - dlg->clearActions(); - HbAction *primaryAction = new HbAction(dlg); - dlg->addAction(primaryAction); - bool ret = connect(primaryAction, SIGNAL(triggered()), - this, SLOT(userPrimaryResponse())); - TFLOGSTRING2("SATAPP: SatAppUiProvider::composeDialog \ - primaryAction=%d", ret) - - HbAction *secondaryAction = new HbAction(dlg); - dlg->addAction(secondaryAction); - ret = connect(secondaryAction, SIGNAL(triggered()), - this, SLOT(userSecondaryResponse())); - TFLOGSTRING2("SATAPP: SatAppUiProvider::composeDialog \ - secondaryAction=%d", ret) - - if (ESatDialogDisplayText == type){ - primaryAction->setText(hbTrId("txt_sat_general_ok")); - secondaryAction->setText(hbTrId("txt_sat_general_back")); - TFLOGSTRING("SATAPP: SatAppUiProvider::composeDialog \ - ESatDialogDisplayText") - } else if (ESatDialogGetInput == type){ - primaryAction->setText(hbTrId("txt_sat_general_ok")); - primaryAction->setEnabled(false); - secondaryAction->setText(hbTrId("txt_sat_general_cancel")); - TFLOGSTRING("SATAPP: SatAppUiProvider::composeDialog \ - ESatDialogGetInput") - } else if (ESatDialogGetInkey == type){ - primaryAction->setText(hbTrId("txt_sat_general_ok")); - primaryAction->setEnabled(false); - secondaryAction->setText(hbTrId("txt_sat_general_cancel")); - TFLOGSTRING("SATAPP: SatAppUiProvider::composeDialog \ - ESatDialogGetInkey") - } else if (ESatDialogGetYesNo == type){ - primaryAction->setText(hbTrId("txt_sat_general_yes")); - secondaryAction->setText(hbTrId("txt_sat_general_no")); - TFLOGSTRING("SATAPP: SatAppUiProvider::composeDialog \ - ESatDialogGetYesNo") - } else if (ESatDialogGetDigitalRsp == type){ - dlg->removeAction(primaryAction); - secondaryAction->setText(hbTrId("txt_sat_general_cancel")); - ret = connect(secondaryAction, SIGNAL(triggered()), - this, SLOT(handleImmediateCancel())); - TFLOGSTRING2("SATAPP: SatAppUiProvider::composeDialog \ - con secondaryAction=%d", ret) - TFLOGSTRING("SATAPP: SatAppUiProvider::composeDialog \ - ESatDialogGetDigitalRsp") - } else if (ESatDialogSetUpCall == type){ - primaryAction->setText(hbTrId("txt_sat_general_call")); - secondaryAction->setText(hbTrId("txt_sat_general_cancel")); - TFLOGSTRING("SATAPP: SatAppUiProvider::composeDialog \ - ESatDialogSetUpCall") - } else if (ESatDialogConfirmSend == type){ - primaryAction->setText(hbTrId("txt_sat_general_send")); - secondaryAction->setText(hbTrId("txt_sat_general_cancel")); - TFLOGSTRING("SATAPP: SatAppUiProvider::composeDialog \ - ESatDialogConfirmSend") - } else if (ESatDialogConfirmBip == type){ - primaryAction->setText(hbTrId("txt_sat_general_ok")); - secondaryAction->setText(hbTrId("txt_sat_general_cancel")); - TFLOGSTRING("SATAPP: SatAppUiProvider::composeDialog \ - ESatDialogConfirmBip") - } - - TFLOGSTRING("SATAPP: SatAppUiProvider::composeDialog exit") -} - -// ---------------------------------------------------------------------------- -// docmlLoader -// ---------------------------------------------------------------------------- -// -SatAppDocumentLoader *SatAppUiProvider::docmlLoader() -{ - TFLOGSTRING("SATAPP: SatAppUiProvider::docmlLoader call-exit"); - return mLoader; -} - -// ---------------------------------------------------------------------------- -// createObject -// ---------------------------------------------------------------------------- -// -QObject *SatAppDocumentLoader::createObject( - const QString &type, - const QString &name) -{ - TFLOGSTRING("SATAPP: SatAppDocumentLoader::createObject") - if (type == SatAppView::staticMetaObject.className()) { - QObject *object = new SatAppView(); - TFLOGSTRING2( - "SATAPP: SatAppDocumentLoader::createObject %S", name.utf16()) - object->setObjectName(name); - TFLOGSTRING("SATAPP: SatAppDocumentLoader::createObject sat view exit") - return object; - } - TFLOGSTRING("SATAPP: SatAppDocumentLoader::createObject other exit") - return HbDocumentLoader::createObject(type, name); -} - -// ---------------------------------------------------------------------------- -//extendNoteShowtime -// ---------------------------------------------------------------------------- -// -void SatAppUiProvider::extendNoteShowtime() -{ - TFLOGSTRING("SatAppUiProvider::extendNoteShowtime") - if (mTimer) { - delete mTimer; - mTimer = 0; - TFLOGSTRING("SatAppUiProvider::extendNoteShowtime delete timer") - } - if (mLoop) { - delete mLoop; - mLoop = 0; - TFLOGSTRING("SatAppUiProvider::extendNoteShowtime delete loop") - } - mTimer = new QTimer(this); - mTimer->start(KExtendTimeoutMseconds); - bool ret = connect(mTimer, SIGNAL(timeout()), mTimer, SLOT(stop())); - TFLOGSTRING2("SATAPP: SatAppUiProvider::extendNoteShowtime connect\ - mTimer stop: %d", ret) - - mLoop = new QEventLoop(this); - ret = connect(mTimer, SIGNAL(timeout()), mLoop, SLOT(quit())); - TFLOGSTRING2("SATAPP: SatAppUiProvider::extendNoteShowtime connect \ - syn: %d", ret) - mLoop->exec(QEventLoop::AllEvents); - TFLOGSTRING("SatAppUiProvider::extendNoteShowtime exit") -} - -// ---------------------------------------------------------------------------- -//cancelResponse -// ---------------------------------------------------------------------------- -// -void SatAppUiProvider::cancelResponse() -{ - TFLOGSTRING("SatAppUiProvider::cancelResponse") - if (mWaitNote) { - TFLOGSTRING("SatAppUiProvider::cancelResponse user cancel") - if (mTimer) { - mTimer->stop(); - TFLOGSTRING("SatAppUiProvider::cancelResponse time out") - } - if (mLoop && mLoop->isRunning()) { - mLoop->exit(); - TFLOGSTRING("SatAppUiProvider::cancelResponse exit loop") - } - mWaitNote->setEnabled(false); - mWaitNote->close(); - emit userCancelResponse(); - } - TFLOGSTRING("SatAppUiProvider::cancelResponse exit") -} - -// ---------------------------------------------------------------------------- -//showSsWaitNote -// Displays a wait note to indicate SS sending. -// ---------------------------------------------------------------------------- -// -void SatAppUiProvider::showSsWaitNote(const QString &aText, - const bool aSelfExplanatoryIcon) -{ - TFLOGSTRING("SATAPP: SatAppUiProvider::showSsWaitNote") - if (mWaitNote) { - delete mWaitNote; - mWaitNote = 0; - } - mWaitNote = new HbProgressDialog(HbProgressDialog::WaitDialog); - mWaitNote->clearActions(); - if (aText.length()) { - if (!aSelfExplanatoryIcon) { - TFLOGSTRING("SATAPP: SatAppUiProvider::showSsWaitNote !Icon") - mWaitNote->setText(aText); - } else { - TFLOGSTRING("SATAPP: SatAppUiProvider::showSsWaitNote send") - mWaitNote->setText(hbTrId("txt_sat_sendss_wait_note_send")); - } - } else { - mWaitNote->setText(hbTrId("txt_sat_sendss_wait_note_request")); - } - TFLOGSTRING("SATAPP: SatAppUiProvider::showSsWaitNote show before") - mWaitNote->show(); - TFLOGSTRING("SATAPP: SatAppUiProvider::showSsWaitNote exit") -} - -// ---------------------------------------------------------------------------- -//showWaitNoteWithoutDelay -// -// ---------------------------------------------------------------------------- -// -void SatAppUiProvider::showWaitNoteWithoutDelay() -{ - TFLOGSTRING("SATAPP: SatAppUiProvider::showWaitNoteWithoutDelay") - if (mWaitNote) { - delete mWaitNote; - mWaitNote = 0; - } - mWaitNote = new HbProgressDialog(HbProgressDialog::WaitDialog); - mWaitNote->clearActions(); - mWaitNote->setText(hbTrId("txt_sat_wait_note_without_delay")); - mWaitNote->show(); - TFLOGSTRING("SATAPP: SatAppUiProvider::showWaitNoteWithoutDelay exit") -} - -// ---------------------------------------------------------------------------- -//showSsErrorNote -// -// ---------------------------------------------------------------------------- -// -void SatAppUiProvider::showSsErrorNote() -{ - TFLOGSTRING("SATAPP: SatAppUiProvider::showSsErrorNote") - HbMessageBox::warning(hbTrId("txt_sat_sendss_error_note")); - TFLOGSTRING("SATAPP: SatAppUiProvider::showSsErrorNote exit") -} - -// ---------------------------------------------------------------------------- -// showConfirmOpenChannelQuery -// ---------------------------------------------------------------------------- -// -void SatAppUiProvider::showConfirmOpenChannelQuery( - const QString &aText, - bool &aActionAccepted) -{ - TFLOGSTRING("SATAPP: SatAppUiProvider::showConfirmOpenChannelQuery call") - stopShowWaitNote(); - if (mConfirmBipQuery){ - delete mConfirmBipQuery; - mConfirmBipQuery = NULL; - } - QString title = aText; - if (!aText.length()){ - title = hbTrId("txt_sat_openchannel_confirm_note"); - } - - mConfirmBipQuery = new HbMessageBox(HbMessageBox::MessageTypeQuestion); - if(mConfirmBipQuery) { - // Sets the "Yes"-action/button - mConfirmBipQuery->setText(title); - composeDialog(mConfirmBipQuery, 0, ESatDialogConfirmBip); - - TFLOGSTRING("SATAPP: SatAppUiProvider::showConfirmOpenChannelQuery before open") - DialogWaiter waiter; - mConfirmBipQuery->open(&waiter, SLOT(done(HbAction *))); - waiter.wait(); - TFLOGSTRING("SATAPP: SatAppUiProvider::showConfirmOpenChannelQuery after open") - - delete mConfirmBipQuery; - mConfirmBipQuery = 0; - } - - aActionAccepted = (EUserPrimaryResponse == mUserRsp) ? true : false; - - TFLOGSTRING("SATAPP: SatAppUiProvider::showConfirmOpenChannelQuery exit") -} - -// ---------------------------------------------------------------------------- -//showCallControlNote -// -// ---------------------------------------------------------------------------- -// -void SatAppUiProvider::showCallControlNote(const QString &aText) -{ - TFLOGSTRING("SATAPP: SatAppUiProvider::showCallControlNote") - if (mCallControlMsg) { - delete mCallControlMsg; - mCallControlMsg = 0; - } - mCallControlMsg = new HbDeviceMessageBox(HbMessageBox::MessageTypeInformation); - mCallControlMsg->setText(aText); - mCallControlMsg->show(); - // Extend showing sms wait note timer for test - extendNoteShowtime(); - TFLOGSTRING("SATAPP: SatAppUiProvider::showCallControlNote exit") - -} - -// ---------------------------------------------------------------------------- -// showBIPWaitNote -// ---------------------------------------------------------------------------- -// -void SatAppUiProvider::showBIPWaitNote(const QString &aText) -{ - TFLOGSTRING("SATAPP: SatAppUiProvider::showBIPWaitNote call") - if (!mWaitNote) { - mWaitNote = new HbProgressDialog(HbProgressDialog::WaitDialog); - mWaitNote->setText(aText); - - //remove the default cancel softkey - bool ret = connect(mWaitNote->actions().at(0), SIGNAL(triggered()), - this, SLOT(cancelResponse())); - TFLOGSTRING2("SATAPP: SatAppUiProvider::showDtmfWaitNote \ - primaryAction=%d", ret) - - mWaitNote->show(); - } else { - mWaitNote->setText(aText); - TFLOGSTRING("SATAPP: SatAppUiProvider::showBIPWaitNote Update Text") - } - TFLOGSTRING("SATAPP: SatAppUiProvider::showBIPWaitNote exit") -} - -// ---------------------------------------------------------------------------- -//showMoSmControlNote -// -// ---------------------------------------------------------------------------- -// -void SatAppUiProvider::showMoSmControlNote(const QString &aText) -{ - TFLOGSTRING("SATAPP: SatAppUiProvider::showMoSmControlNote") - HbMessageBox::information(aText); - TFLOGSTRING("SATAPP: SatAppUiProvider::showMoSmControlNote exit") - -} - -// ---------------------------------------------------------------------------- -// showCloseChannelWaitNote -// ---------------------------------------------------------------------------- -// -void SatAppUiProvider::showCloseChannelWaitNote(const QString &aText) -{ - TFLOGSTRING("SATAPP: SatAppUiProvider::showCloseChannelWaitNote call") - if (mWaitNote) { - delete mWaitNote; - mWaitNote = 0; - } - mWaitNote = new HbProgressDialog(HbProgressDialog::WaitDialog); - mWaitNote->clearActions(); - mWaitNote->setText(aText); - mWaitNote->show(); - TFLOGSTRING("SATAPP: SatAppUiProvider::showCloseChannelWaitNote exit") -} - -// ---------------------------------------------------------------------------- -//showSatInfoNote -// -// ---------------------------------------------------------------------------- -// -void SatAppUiProvider::showSatInfoNote(const QString &aText) -{ - TFLOGSTRING("SATAPP: SatAppUiProvider::showSatInfoNote") - HbMessageBox::information(aText); - TFLOGSTRING("SATAPP: SatAppUiProvider::showSatInfoNote exit") -} - - -// ---------------------------------------------------------------------------- -//handleImmediateCancel -// -// ---------------------------------------------------------------------------- -// -void SatAppUiProvider::handleImmediateCancel() -{ - TFLOGSTRING("SATAPP: SatAppUiProvider::handleImmediateCancel") - if (mLoop && mLoop->isRunning()) { - mLoop->quit(); - } - TFLOGSTRING("SATAPP: SatAppUiProvider::handleImmediateCancel exit") -} - -// ---------------------------------------------------------------------------- -//immediateResponse -// -// ---------------------------------------------------------------------------- -// -void SatAppUiProvider::immediateResponse(QString text) -{ - TFLOGSTRING("SATAPP: SatAppUiProvider::immediateResponse") - if (mLoop && mLoop->isRunning()) { - mLoop->quit(); - } - if ("0" == text) { - mDigitalRsp = Qt::Key_0; - TFLOGSTRING("SATAPP: SatAppUiProvider::immediateResponse 0") - } else if ("1" == text) { - mDigitalRsp = Qt::Key_1; - TFLOGSTRING("SATAPP: SatAppUiProvider::immediateResponse 1") - } else if ("2" == text) { - mDigitalRsp = Qt::Key_2; - TFLOGSTRING("SATAPP: SatAppUiProvider::immediateResponse 2") - } else if ("3" == text) { - mDigitalRsp = Qt::Key_3; - TFLOGSTRING("SATAPP: SatAppUiProvider::immediateResponse 3") - } else if ("4" == text) { - mDigitalRsp = Qt::Key_4; - TFLOGSTRING("SATAPP: SatAppUiProvider::immediateResponse 4") - }else if ("5" == text) { - mDigitalRsp = Qt::Key_5; - TFLOGSTRING("SATAPP: SatAppUiProvider::immediateResponse 5") - } else if ("6" == text) { - mDigitalRsp = Qt::Key_6; - TFLOGSTRING("SATAPP: SatAppUiProvider::immediateResponse 6") - } else if ("7" == text) { - mDigitalRsp = Qt::Key_7; - TFLOGSTRING("SATAPP: SatAppUiProvider::immediateResponse 7") - } else if ("8" == text) { - mDigitalRsp = Qt::Key_8; - TFLOGSTRING("SATAPP: SatAppUiProvider::immediateResponse 8") - } else if ("9" == text) { - mDigitalRsp = Qt::Key_9; - TFLOGSTRING("SATAPP: SatAppUiProvider::immediateResponse 9") - } else if ("+" == text) { - mDigitalRsp = Qt::Key_Plus; - TFLOGSTRING("SATAPP: SatAppUiProvider::immediateResponse +") - } else if ("*" == text) { - mDigitalRsp = Qt::Key_Asterisk; - TFLOGSTRING("SATAPP: SatAppUiProvider::immediateResponse *") - } else if ("#" == text) { - mDigitalRsp = Qt::Key_NumberSign; - TFLOGSTRING("SATAPP: SatAppUiProvider::immediateResponse #") - } - mUserRsp = EUserPrimaryResponse; - TFLOGSTRING2("SATAPP: SatAppUiProvider::immediateResponse key %x", - mDigitalRsp) - - TFLOGSTRING("SATAPP: SatAppUiProvider::immediateResponse exit") -} - -// End of file diff -r 1f002146abb4 -r cee7e9e0906c satui/satapp/src/satappview.cpp --- a/satui/satapp/src/satappview.cpp Tue Jul 06 14:53:02 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,463 +0,0 @@ -/* -* Copyright (c) 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" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -* -*/ -#include -#include -#include -#include -#include -#include -#include -#include - -#include "satappuiprovider.h" -#include "satappeventprovider.h" -#include "satappview.h" -#include "tflogger.h" -#include "satappcommonconstant.h" - -const char *SATAPP_MENUITEM = "s:ListWidget"; -const char *SATAPP_SUBTITLE = "t:label"; -const char *SATAPP_SELECTITEM = "t:ListWidget"; - - -// ======== MEMBER FUNCTIONS ================================================== - -// ---------------------------------------------------------------------------- -// SatAppView::SatAppView -// (Constructor). -// ---------------------------------------------------------------------------- -// -SatAppView::SatAppView(QGraphicsItem *parent) : - HbView(parent), - mTimeout(false), - mSelectItem(false), - mClickBackSoftkey(false), - mItemIndex(0), - mLoop(0), - mTimer(0), - mWindow(0), - mSoftKeyQuitAction(0), - mSoftKeyBackAction(0), - mEvent(0), - mUi(0), - mListWidget(0), - mSelectListWidget(0), - mSubTitle(0) -{ - TFLOGSTRING("SATAPP: SatAppView::SatAppView call-exit") -} - -// ---------------------------------------------------------------------------- -// SatAppView::~SatAppView -// (Disconstructor). -// ---------------------------------------------------------------------------- -// -SatAppView::~SatAppView() -{ - TFLOGSTRING("SATAPP: SatAppView::~SatAppView") - // The objects are outside the object tree, Delete them manually - if (mTimer) { - delete mTimer; - mTimer = 0; - TFLOGSTRING("SATAPP: SatAppView::~SatAppView delete subtitle") - } - - if (mLoop) { - if (mLoop->isRunning()) { - mLoop->quit(); - } - delete mLoop; - mLoop = 0; - TFLOGSTRING("SATAPP: SatAppView::~SatAppView delete subtitle") - } - TFLOGSTRING("SATAPP: SatAppView::~SatAppView Exit") -} - -// ---------------------------------------------------------------------------- -// SatAppView::initSetupMenu -// (Init the setup menu view). -// ---------------------------------------------------------------------------- -// -void SatAppView::initSetupMenu( - SatAppEventProvider &event, - SatAppUiProvider &ui) -{ - TFLOGSTRING( "SATAPP: SatAppView::initSetupMenu call" ) - mEvent = &event; - mUi = &ui; - - // Listwidget - mListWidget = qobject_cast - ( mUi->docmlLoader()->findWidget(SATAPP_MENUITEM )); - if (mListWidget && mWindow) { - mSoftKeyQuitAction = new HbAction(Hb::QuitNaviAction,this); - HbAction *menuAction = menu()->addAction("Exit"); - bool ret = connect(menuAction, SIGNAL(triggered()), - mSoftKeyQuitAction, SIGNAL(triggered())); - TFLOGSTRING2("SATAPP: SatAppView::initSetupMenu: \ - menu connected %d", ret) - ret = connect(mSoftKeyQuitAction, SIGNAL(triggered()), - mWindow, SLOT(close())); - TFLOGSTRING2("SATAPP: SatAppView::initSetupMenu: \ - quit connected %d", ret) - } - - TFLOGSTRING("SATAPP: SatAppView::initSetupMenu exit") -} - - -// ---------------------------------------------------------------------------- -// SatAppView::initSelectItem -// (Init the select item view). -// ---------------------------------------------------------------------------- -// -void SatAppView::initSelectItem( - SatAppEventProvider &event, - SatAppUiProvider &ui) -{ - TFLOGSTRING( "SATAPP: SatAppView::initSelectItem call") - mEvent = &event; - mUi = &ui; - // Subtitle - mSubTitle = qobject_cast - ( mUi->docmlLoader()->findWidget(SATAPP_SUBTITLE) ); - - mSelectListWidget = qobject_cast - ( mUi->docmlLoader()->findWidget(SATAPP_SELECTITEM )); - - if (mSelectListWidget && mWindow) { - mSoftKeyBackAction = new HbAction(Hb::BackNaviAction,this); - HbAction *menuBack = menu()->addAction("Back"); - bool ret = connect(menuBack, SIGNAL(triggered()), - mSoftKeyBackAction, SIGNAL(triggered())); - TFLOGSTRING2("SATAPP: SatAppView::initSelectItem: \ - menu connected %d", ret) - HbAction *menuQuit = menu()->addAction("Exit"); - ret = connect(menuQuit, SIGNAL(triggered()), - mWindow, SLOT(close())); - TFLOGSTRING2("SATAPP: SatAppView::initSelectItem: \ - close connected %d", ret) - ret = connect(mSoftKeyBackAction, SIGNAL(triggered()), - this, SLOT(backButtonClicked())); - TFLOGSTRING2("SATAPP: SatAppView::initSelectItem: \ - back connected %d", ret) - } - TFLOGSTRING("SATAPP: SatAppView::initSelectItem exit") -} - -// ---------------------------------------------------------------------------- -// SatAppView::SatAppView -// (Set up menu). -// ---------------------------------------------------------------------------- -// -void SatAppView::showSetUpMenuContent( - TSatUiResponse& aRes, - const QString& aText, - const QStringList& aMenuItems, - //const CArrayFixFlat* aMenuItemNextActions, - //const HbIcon& aIcon, - //const CAknIconArray* aItemIconsArray, - const bool /*aSelfExplanatoryItems*/, - const bool /*aHelpIsAvailable*/) -{ - TFLOGSTRING("SATAPP: SatAppView::SetUpMenu") - // Disconnect select item - disconnectItem(); - aRes = ESatSuccess; - mSelectItem = false; - - // The text is the application name - // should be shown on the menu area always - if (!aText.isEmpty()) { - TFLOGSTRING( "SATAPP: SatAppView::SetUpMenu: title" ) - setTitle(aText); - } - if (mListWidget) { - TFLOGSTRING("SATAPP: SatAppView::SetUpMenu mListWidget") - mListWidget->clear(); - for(int i = 0; i < aMenuItems.count(); i++ ) { - mListWidget->addItem(aMenuItems.at( i )); - } - // connect setup menu item - connectItem(); - setNavigationAction(mSoftKeyQuitAction); - } - TFLOGSTRING("SATAPP: SatAppView::SetUpMenu exit") -} - - -// ---------------------------------------------------------------------------- -// SatAppView::SelectItem -// (Selected item). -// ---------------------------------------------------------------------------- -// -void SatAppView::showSelectItemContent( - TSatUiResponse& aRes, - const QString& aText, - const QStringList& aMenuItems, - //const CArrayFixFlat* aMenuItemNextActions, - const int /*aDefaultItem*/, - unsigned char& aSelection, - //const HbIcon& aIcon, - //const CAknIconArray* aItemsIconArray, - const bool /*aSelfExplanatoryItems*/, - const bool /*aHelpIsAvailable*/) -{ - TFLOGSTRING("SATAPP: SatAppView::selectItem") - // Disconnect setup menu item - disconnectItem(); - aRes = ESatSuccess; - mSelectItem = true; - mClickBackSoftkey = false; - - // Set sub title - if (!aText.isEmpty()) { - mSubTitle->setPlainText(aText); - } else { - TFLOGSTRING("SATAPP: txt_sat_selectitem_title") - mSubTitle->setPlainText(hbTrId("txt_sat_selectitem_title")); - } - // Set List widget - if (mSelectListWidget) { - TFLOGSTRING("SATAPP: SatAppView::selectItem mSelectListWidget") - mSelectListWidget->clear(); - for(int i = 0; i < aMenuItems.count(); i++ ) { - mSelectListWidget->addItem(aMenuItems.at( i )); - } - } - // Set Back key - //setSoftkeyBack(); - if (mSoftKeyBackAction) { - setNavigationAction(mSoftKeyBackAction); - TFLOGSTRING("SATAPP: SatAppView::selectItem set softkey back") - } - // connect selectitem - connectItem(); - - mTimer = new QTimer(); - if (mTimer) { - bool ret = connect(mTimer, SIGNAL(timeout()), - this, SLOT(selectItemTimeOut())); - TFLOGSTRING2("SATAPP: SatAppView::selectItem timer %d", ret) - mTimer->start( KDefaultSelectionTimeoutMseconds ); - mLoop = new QEventLoop(); - TFLOGSTRING("SATAPP: SatAppView::selectItem loop exec before") - mLoop->exec(QEventLoop::AllEvents); - TFLOGSTRING("SATAPP: SatAppView::selectItem loop exec after") - delete mTimer; - mTimer = 0; - delete mLoop; - mLoop = 0; - } - - if (mTimeout) { - aRes = ESatNoResponseFromUser; - TFLOGSTRING("SATAPP: SatAppView::selectItem time out") - } else if (mClickBackSoftkey) { - TFLOGSTRING("SATAPP: SatAppView::selectItem, \ - user click the back softkey") - aRes = ESatBackwardModeRequestedByUser; - } else { - TFLOGSTRING2("SATAPP: SatAppView::selectItem selected %d", - mItemIndex) - //For Demo. We will not return user select item to SIM. - aSelection = mItemIndex; - } - // disconnet select item - disconnectItem(); - TFLOGSTRING2("SATAPP: SatAppView::selectItem aRes:%d", aRes) - mTimeout = false; - TFLOGSTRING("SATAPP: SatAppView::selectItem exit") -} - -// ---------------------------------------------------------------------------- -// SatAppView::selectItemTimeOut -// (Time Out of select item). -// ---------------------------------------------------------------------------- -// -void SatAppView::selectItemTimeOut() -{ - TFLOGSTRING("SATAPP: SatAppView::selectItemTimeOut") - if (mSelectItem && mLoop && mLoop->isRunning()) { - TFLOGSTRING("SATAPP: SatAppView::selectItemTimeOut time out") - mTimeout = true; - mLoop->exit(); - } - TFLOGSTRING("SATAPP: SatAppView::selectItemTimeOut exit") -} - -// ---------------------------------------------------------------------------- -// SatAppView::keyPressEvent -// (keyPressEvent). -// ---------------------------------------------------------------------------- -// -void SatAppView::keyPressEvent(QKeyEvent *event) -{ - TFLOGSTRING("SATAPP: SatAppView::keyPressEvent") - // Need updating, End key support is still missing - switch (event->key()) - { - case Qt::Key_Hangup: - { - TFLOGSTRING("SATAPP: SatAppView::keyPressEvent end key") - } - break; - default: - { - TFLOGSTRING2("SATAPP: SatAppView::keyPressEvent key %d", - event->key()) - HbView::keyPressEvent(event); - } - } - TFLOGSTRING("SATAPP: SatAppView::keyPressEvent exit") -} - -// ---------------------------------------------------------------------------- -// SatAppView::backButtonClicked -// (Back action). -// ---------------------------------------------------------------------------- -// -void SatAppView::backButtonClicked() -{ - TFLOGSTRING("SATAPP: SatAppView::backButtonClicked") - if (mSelectItem) { - mClickBackSoftkey = true; - TFLOGSTRING("SATAPP: SatAppView::backButtonClicked back selected") - if (mLoop) { - TFLOGSTRING("SATAPP: SatAppView::backButtonClicked quit loop") - if (mLoop->isRunning()) { - mLoop->exit(); - } - } - } - TFLOGSTRING("SATAPP: SatAppView::backButtonClicked exit") -} - -// ---------------------------------------------------------------------------- -// SatAppView::setMainWindow -// (Set window for view). -// ---------------------------------------------------------------------------- -// -void SatAppView::setMainWindow(HbMainWindow &mainWindow) -{ - TFLOGSTRING("SATAPP: SatAppView::setMainWindow") - TFLOGSTRING2("SATAPP: SatAppView::setMainWindow \ - &mainWindow=0x%x", &mainWindow) - mWindow = &mainWindow; - TFLOGSTRING("SATAPP: SatAppView::setMainWindow exit") -} - -// ---------------------------------------------------------------------------- -// SatAppView::menuItemSelected -// (Menu item selected). -// ---------------------------------------------------------------------------- -// -void SatAppView::menuItemSelected(HbListWidgetItem *item) -{ - TFLOGSTRING("SATAPP: SatAppView::menuItemSelected") - if(mSelectItem && mSelectListWidget) { - mItemIndex = mSelectListWidget->row(item); - if (mLoop && mLoop->isRunning()) { - TFLOGSTRING( "SATAPP: SatAppView::menuItemSelected sel item") - mLoop->quit(); - TFLOGSTRING( "SATAPP: SatAppView::menuItemSelected exit loop") - } - } - if (!mSelectItem && mListWidget) { - mItemIndex = mListWidget->row(item); - TFLOGSTRING( "SATAPP: SatAppView::menuItemSelected setup menu") - if (mEvent) { - mEvent->menuSelection( mItemIndex, false ); - TFLOGSTRING( "SATAPP: SatAppView::menuItemSelected setup menu") - } - // disconnet the list widget, when server returns response, - // the connect again - disconnectItem(); - } - TFLOGSTRING("SATAPP: SatAppView::menuItemSelected exit") -} - -// ---------------------------------------------------------------------------- -// SatAppView::connectItem -// (Connect listwidget item). -// ---------------------------------------------------------------------------- -// -void SatAppView::connectItem() -{ - TFLOGSTRING("SATAPP: SatAppView::connectItem") - bool ret = false; - if (!mSelectItem && mListWidget) { - ret = connect( - mListWidget, SIGNAL(activated(HbListWidgetItem *)), - this, SLOT(menuItemSelected(HbListWidgetItem *))); - TFLOGSTRING2( - "SATAPP: SatAppView::connectItem SetupMenu short connect=%d", ret) - ret = connect( - mListWidget, SIGNAL(longPressed(HbListWidgetItem*, const QPointF&)), - this, SLOT(menuItemSelected(HbListWidgetItem *))); - TFLOGSTRING2( - "SATAPP: SatAppView::connectItem SetupMenue long connect=%d", ret) - } - - if (mSelectItem && mSelectListWidget) { - ret = connect( - mSelectListWidget, SIGNAL(activated(HbListWidgetItem *)), - this, SLOT(menuItemSelected(HbListWidgetItem *))); - TFLOGSTRING2( - "SATAPP: SatAppView::connectItem SelectItem short connect=%d", ret) - ret = connect( - mSelectListWidget, - SIGNAL(longPressed(HbListWidgetItem*, const QPointF&)), - this, SLOT(menuItemSelected(HbListWidgetItem *))); - TFLOGSTRING2( - "SATAPP: SatAppView::connectItem SelectItem long connect=%d", ret) - } - TFLOGSTRING("SATAPP: SatAppView::connectItem exit") -} - -// ---------------------------------------------------------------------------- -// SatAppView::disconnectItem -// (Disconnect listwidget item). -// ---------------------------------------------------------------------------- -// -void SatAppView::disconnectItem() -{ - TFLOGSTRING("SATAPP: SatAppView::disconnectItem") - // setup menu view - if (!mSelectItem && mListWidget) { - disconnect(mListWidget, SIGNAL( activated(HbListWidgetItem *)), - this, SLOT( menuItemSelected( HbListWidgetItem *))); - disconnect( - mListWidget, SIGNAL(longPressed(HbListWidgetItem*, const QPointF&)), - this, SLOT(menuItemSelected(HbListWidgetItem *))); - TFLOGSTRING("SATAPP: SatAppView::disconnectItem: SetupMenu") - } - // select item view - if (mSelectItem && mSelectListWidget) { - disconnect(mSelectListWidget, SIGNAL( activated(HbListWidgetItem *)), - this, SLOT( menuItemSelected( HbListWidgetItem *))); - disconnect( - mSelectListWidget, - SIGNAL(longPressed(HbListWidgetItem*, const QPointF&)), - this, SLOT(menuItemSelected(HbListWidgetItem *))); - TFLOGSTRING("SATAPP: SatAppView::disconnectItem: SelectItem") - } - TFLOGSTRING("SATAPP: SatAppView::disconnectItem exit") -} - -// End of file diff -r 1f002146abb4 -r cee7e9e0906c satui/satapp/tsrc/ut_satapp/inc/dummyeventprovider.h --- a/satui/satapp/tsrc/ut_satapp/inc/dummyeventprovider.h Tue Jul 06 14:53:02 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,687 +0,0 @@ -/* -* Copyright (c) 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" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: dummyeventprovider.h -* -*/ - -#ifndef DUMMYEVENTPROVIDER_H -#define DUMMYEVENTPROVIDER_H - -#include -#include - - -#include "msatuiactionimplementer.h" - -class CSatUiObserver; -//class QPixmap; // For future icon support -class DummyPlayToneProvider; - -class DummyEventProvider: public QObject, - public MSatUiActionImplementer -{ - Q_OBJECT - -public: - - /** - * Constructor - */ - DummyEventProvider(QObject *parent = 0); - - /** - * Distructor - */ - virtual ~DummyEventProvider(); - -signals: - /** - * Notification of the SAT Display Text command. - * @param aRes, the User's response. - * @param aText The text string to be displayed. - * @param aSimApplicationName Sim Application name - * @param aIcon the icon to show. - * @param aRequestedIconDisplayed Informs if icon is not used. - * @param aSustainedText Indicates is this text sustained ie. no timers - * used if true. - * @param aDuration Duration for showing the text - * @param aWaitUserToClear Indication if user is needed to clear - * message - */ - void displayTextEvent( - TSatUiResponse &aRes, - const QString &aText, - const QString &aSimApplicationName, - //const HbIcon &aIcon, - bool &aRequestedIconDisplayed, - const bool aSustainedText, - const int aDuration, - const bool aWaitUserToClear); - - /** - * Notification of the SAT Get Input command. - * @param aText The query text. - * @param aCharacterSet The character range allowed. - * @param aInput The input string. - * @param aMaxLength The maximum length of the input allowed. - * @param aMinLength The minimum length of the input allowed. - * @param aHideInput A flag indicating if the input should be hidden. - * @param aHelpIsAvailable indicates if help can be requested. - * @param aIconId The id of icon. - * @param aRequestedIconDisplayed Informs if icon is not used. - * @return The response of the UI to this command. - */ - void getInputEvent( - TSatUiResponse &aRes, - const QString &aTitleText, - const TSatCharacterSet aCharacterSet, - QString &aInputText, - const int aMinLength, - const int aMaxLength, - const bool aHideInput, - //const QPixmap* /*aIconBitmapGetInput*/, - const bool aSelfExplanatory, - unsigned int &aDuration ); - - /** - * Notification of the SAT Get Inkey command. - * @param aText The query text. - * @param aCharacterSet The character range allowed. - * @param aInput The input string. - * @param aHideInput A flag indicating if the input should be hidden. - * @param aHelpIsAvailable indicates if help can be requested. - * @param aIconId The id of icon. - * @param aRequestedIconDisplayed Informs if icon is not used. - */ - void getInkeyEvent( - TSatUiResponse &aRes, - const QString &aTitleText, - const TSatCharacterSet aCharacterSet, - QString &aInputText, - //const QPixmap* /*aIconBitmapGetInput*/, - const bool aSelfExplanatory, - unsigned int &aDuration ); - - /** - * Notification of the SAT Get YesNo command. - * @param aText The query text. - * @param aCharacterSet The character range allowed. - * @param aInput The input character. - * @param aHelpIsAvailable indicates if help can be requested. - * @param aIconId The id of icon. - * @param aRequestedIconDisplayed Informs if icon is not used. - * @param aDuration Duration for showing the dialog. - * @param aImmediateDigitResponse Indication if Immediate digit response - * is needed. - * @return The response of the UI to this command. - */ - void getYesNoEvent( - TSatUiResponse &aRes, - const QString &aText, - const TSatCharacterSet aCharacterSet, - unsigned int &aInkey, - //const TSatIconId &aIconId, - const bool &aSelfExplanatory, - unsigned int &aDuration, - const bool aImmediateDigitResponse ); - - /** - * Handles the SetUpMenu command. - * @param aRes the out parameter. the result of the command. - * @param aText The title text. - * @param aMenuItems The array of menu item captions. - * @param aMenuItemNextActions The array of menu item next action - * indicator captions. - * @param aIconBitmap The Context pane icon. - * @param aItemsIconArray Array of item icons - * @param aSelfExplanatoryItems A flag indicating if only icons are shown. - * @param aHelpIsAvailable A flag indicating if SAT help is available. - */ - void setUpMenuEvent( - TSatUiResponse &aRes, - const QString &aText, - const QStringList &aMenuItems, - //const CArrayFixFlat* aMenuItemNextActions, - //const HbIcon &aIcon, - //const CAknIconArray* aItemIconsArray, - const bool aSelfExplanatoryItems, - const bool aHelpIsAvailable); - - /** - * Handles the SelectItem view. - * @param aRes the out parameter. the result of the command. - * @param aText The title text. - * @param aMenuItems The array of menu items. - * @param aMenuItemNextActions The array of next action indicators. - * @param aDefaultItem The item in focus. - * @param aSelection The item index selected by the user. - * @param aIconBitmap The Context Pane icon. - * @param aItemsIconArray Array of item icons - * @param aSelfExplanatoryItems Flag indicating if only icons are shown. - * @param aHelpIsAvailable A flag indicating if SAT help is available. - * @return Information of the operation result. - */ - void selectItemEvent( - TSatUiResponse &aRes, - const QString &aText, - const QStringList &aMenuItems, - //const CArrayFixFlat* aMenuItemNextActions, - const int aDefaultItem, - unsigned char &aSelection, - //const HbIcon &aIcon, - //const CAknIconArray* aItemsIconArray, - const bool aSelfExplanatoryItems, - const bool aHelpIsAvailable); - - /** - * Shows the confirmation note about the SAT Send SMS, Send SS or - * Send USSD command. - * @param aText The text to be displayed. - * @param aActionAccepted Indicates whether the command was accepted. - * @param aType Type of the request (SMS, SS, USSD). - * @return Information of the operation result. - */ - void confirmSendEvent( - TSatUiResponse &aRes, - const QString &aText, - bool &aActionAccepted, - int aType); - - /** - * Shows the wait note about the Send SMS command. - * @param aText The text to be displayed. - * @param aIconBitmapSendSM Sending dialog icon. - * @param aSelfExplanatoryIcon A flag indicating if only icon is shown. - */ - void showSmsWaitNoteEvent( - const QString &aText, - //const CFbsBitmap* aIconBitmapSendSM, - const bool aSelfExplanatoryIcon - ); - - /** - * Shows the confirmation not about SetUpCall. - * @param aText The text to be displayed. - * @param aSimAppName The header to be displayed. - * @param aActionAccepted Indicates whether the command was accepted. - */ - void showSetUpCallConfirmEvent( - const QString &aText, - const QString &aSimAppName, - bool &aActionAccepted//, - //const CFbsBitmap* aIconBitmap, - //const TBool aSelfExplanatory - ); - - /** - * Shows the wait note about the Send DTMF command. - * @param aText The text to be displayed. - * @param aIconBitmapSendSM Sending dialog icon. - */ - void showDtmfWaitNoteEvent( - TSatUiResponse &aRes, - const QString &aText); - - - /** - * Shows the wait note about the Send Ss or Ussd command. - * @param aText The text to be displayed. - * @param aIconBitmapSendSM Sending dialog icon. - * @param aSelfExplanatoryIcon A flag indicating if only icon is shown. - */ - void showSsWaitNoteEvent( - const QString &aText, - //const CFbsBitmap* aIconBitmapSendSM, - const bool aSelfExplanatoryIcon - ); - - /** - * Shows the wait note about Open Channel - * @param aText The text to be displayed. - * @param aActionAccepted Indicates whether the command was accepted. - */ - void showOpenChannelConfirmEvent( - const QString &aText, - bool &aActionAccepted); - - - /*! - Removes Display Text Dialog from the screen. - */ - void clearScreenEvent(); - - /*! - Close the sat ui - */ - void closeUiEvent(); - - /*! - *Close wait note - */ - void stopShowWaitNoteEvent(); - - /*! - *Show SsWaitNote without Delay - */ - void showWaitNoteWithoutDelayEvent(); - - /*! - *ShowSsErrorNoteEvent - */ - void showSsErrorNoteEvent(); - - /*! - * Show BIP related Note - */ - void showBIPNoteEvent(int aCommand, const QString &aText); - -public slots: - /*! - *User cancel response, Send DTMF, Send Data, Receive Data - */ - void userCancelResponse(); - -public: // from MSatUiActionImplementer and impletment by QT - - /** - * Shows the wait note. - */ - virtual void ShowWaitNoteL() {}; - - /** - * Shows the wait note without delay - */ - virtual void ShowWaitNoteWithoutDelayL(); - - /** - * Removes the wait note from the screen. - */ - void StopShowWaitNote(); - - /** - * Handles the SetUpMenu view. - * @param aText The title text. - * @param aMenuItems The array of menu item captions. - * @param aMenuItemNextActions The array of menu item next action - * indicator captions. - * @param aIconBitmap The Context pane icon. - * @param aItemsIconArray Array of item icons - * @param aSelfExplanatoryItems Flag indicating if only icons are shown. - * @param aHelpIsAvailable A flag indicating if SAT help is available. - * @return Information of the operation result. - */ - virtual TSatUiResponse SetUpMenuL( - const TDesC &aText, - const MDesCArray &aMenuItems, - const CArrayFixFlat* aMenuItemNextActions, - const CFbsBitmap* aIconBitmap, - //const CAknIconArray* aItemIconsArray, - const TBool aSelfExplanatoryItems, - const TBool aHelpIsAvailable); - - /** - * Handles the SelectItem view. - * @param aText The title text. - * @param aMenuItems The array of menu items. - * @param aMenuItemNextActions The array of next action indicators. - * @param aDefaultItem The item in focus. - * @param aSelection The item index selected by the user. - * @param aIconBitmap The Context Pane icon. - * @param aItemsIconArray Array of item icons - * @param aSelfExplanatoryItems Flag indicating if only icons are shown. - * @param aHelpIsAvailable A flag indicating if SAT help is available. - * @return Information of the operation result. - */ - virtual TSatUiResponse SelectItemL( const TDesC &aText, - const MDesCArray &aMenuItems, - const CArrayFixFlat* aMenuItemNextActions, - const TInt aDefaultItem, - TUint8 &aSelection, - const CFbsBitmap* aIconBitmap, - //const CAknIconArray* aItemsIconArray, - const TBool aSelfExplanatoryItems, - const TBool aHelpIsAvailable ); - -public: // from MSatUiActionImplementer and impletment by Symbian - - /** - * Returns CoeEnv. - */ - virtual CCoeEnv* CoeEnv() { return 0; }; - - /** - * Handles the DisplayText operation. - * @param aText Text to be shown. - * @param aSimApplicationName Sim Application name - * @param aIconBitmapDisplayText Icon for dialog - * @param aSustainedText Indicates is this text sustained ie. no timers - * used if ETrue. - * @param aDuration Duration for showing the text - * @param aWaitUserToClear Indication if user is needed to clear - * message - * @return Information of the operation result. - */ - virtual TSatUiResponse DisplayTextL( - const TDesC &aText, - const TDesC &aSimApplicationName, - CFbsBitmap* aIconBitmapDisplayText, - const TBool aSelfExplanatoryIcon, - const TBool aSustainedText, - const TTimeIntervalSeconds aDuration, - const TBool aWaitUserToClear); - - /** - * Removes Display Text Dialog from the screen. - */ - virtual void ClearScreen(); - - /** - * Asks a Yes/No answer from the user. - * @param aText A question to be shown. - * @param aCharacterSet The character range allowed. - * @param aInkey Character user feeds. - * @param aIconBitmap Icon for query dialog. - * @param aSelfExplanatory Flag indicating if icon is self-explanatory. - * @param aDuration Duration for showing the dialog. - * @param aImmediateDigitResponse Indication if Immediate digit response - * is needed. - * @return Information of the operation result. - */ - virtual TSatUiResponse GetYesNoL( - const TDesC &aText, - const TSatCharacterSet aCharacterSet, - TChar &aInkey, - const CFbsBitmap* /*aIconBitmap*/, - const TBool aSelfExplanatory, - TUint &aDuration, - const TBool aImmediateDigitResponse); - - /** - * Asks input from the user. - * @param aText A question to be shown. - * @param aCharacterSet The character range allowed. - * @param aInput The input string. - * @param aMinLength The minimum length of the input allowed. - * @param aMaxLength The maximum length of the input allowed. - * @param aHideInput A flag indicating if the input should be hidden. - * @param aGetInkey A flag indicating if GetInkey command is used. - * @param aIconBitmapGetInput Icon for query dialog. - * @param aSelfExplanatory A flag indicating if icon is self-explanatory. - * @param aDuration Duration for showing the dialog. - * @return Information of the operation result. - */ - virtual TSatUiResponse GetInputL( - const TDesC &aText, - const TSatCharacterSet aCharacterSet, - TDes &aInput, - const TInt aMinLength, - const TInt aMaxLength, - const TBool aHideInput, - const TBool aGetInkey, - const CFbsBitmap* aIconBitmapGetInput, - const TBool aSelfExplanatory, - TUint &aDuration ); - - - /** - * Handles Standard Tone playing. - * @param aText The text to be displayed. - * @param aFileName The name of the file corresponding to the tone. - * @param aDuration The duration of the tone to be played. - * @param aIconBitmap The tone playing note icon - * @param aSelfExplanatory Flag indicating if icon is self-explanatory. - * @return Information of the operation result. - */ - virtual TSatUiResponse PlayStandardToneL( - const TDesC &aText, - const TDesC8 &aSequence, - TTimeIntervalMicroSeconds aDuration, - const CFbsBitmap* aIconBitmap, - const TBool aSelfExplanatory ); - - /** - * Shows the confirmation note about the SAT Send SMS, Send SS or - * Send USSD command. - * @param aText The text to be displayed. - * @param aActionAccepted Indicates whether the command was accepted. - * @param aType Type of the request (SMS, SS, USSD). - * @return Information of the operation result. - */ - virtual TSatUiResponse ConfirmSendL( - const TDesC &aText, - TBool &aActionAccepted, - TInt aType); - - /** - * Shows the wait note about the Send SMS command. - * @param aText The text to be displayed. - * @param aIconBitmapSendSM Sending dialog icon. - * @param aSelfExplanatoryIcon A flag indicating if only icon is shown. - */ - virtual void ShowSmsWaitNoteL( - const TDesC &aText, - const CFbsBitmap* aIconBitmapSendSM, - const TBool aSelfExplanatoryIcon); - - /** - * Shows the wait note about the Send SS command. - * @param aText The text to be displayed. - * @param aIconBitmap Sending dialog icon. - * @param aSelfExplanatoryIcon A flag indicating if only icon is shown. - */ - virtual void ShowSsWaitNoteL( - const TDesC &aText, - const CFbsBitmap* /*aIconBitmap*/, - const TBool aSelfExplanatoryIcon ); - - /** - * Shows the confirmation note about the SAT Refresh command. - * @param aActionAccepted Indicates whether the command was accepted. - * @return Information of the operation result. - */ - virtual TSatUiResponse ConfirmRefreshL( - TBool &/*aActionAccepted*/) - { - return ESatSuccess; - }; - - /** - * Notification of the SAT Call Control command. - * @param aText The text string to be displayed. - * @param aAlphaIdStatus Alpha Identifier status - * @param aControlResult Call control general result - * @return The response from the UI - */ - virtual TSatUiResponse CallControlL( - const TDesC &/*aText*/, - const TSatAlphaIdStatus /*aAlphaIdStatus*/ ) - { - return ESatSuccess; - }; - - /** - * Notification of the SAT Launch browser confirmation request - * @param aText The text to be displayed. - * @param aActionAccepted Indicates whether the command was accepted. - * @param aIconBitmap The confirm note icon - * @param aSelfExplanatory Flag indicating if icon is self-explanatory. - */ - virtual void ConfirmLaunchBrowserL( - const TDesC &/*aText*/, - TBool &/*aActionAccepted*/, - const CFbsBitmap* /*aIconBitmap*/, - const TBool /*aSelfExplanatory*/) {}; - - /** - * Notification of the SAT Mo Sm Control command. - * @param aText The text string to be displayed. - * @param aAlphaIdStatus Alpha Identifier status - * @param aControlResult Mo Sm control general result - * @return The response from the UI - */ - virtual TSatUiResponse MoSmControlL( - const TDesC &/*aText*/, - const TSatAlphaIdStatus /*aAlphaIdStatus*/ ) - { - return ESatSuccess; - }; - - /** - * Shows the wait note while DTMF are being sent. - * @param aText The text to be displayed. - * @param aIconBitmap The confirm note icon - * @param aSelfExplanatory Flag indicating if icon is self-explanatory. - * @return Information on the operation result. - */ - virtual TSatUiResponse ShowDtmfWaitNoteL( - const TDesC &aText, - const CFbsBitmap* aIconBitmap, - const TBool aSelfExplanatoryIcon ); - - /** - * Dispatch iWait to action implementer. - * @param aWait Timer. - */ - virtual void DispatchTimer(CActiveSchedulerWait &/*aWait*/) {}; - - /** - * Get flag which is indicating if end key is pressed. - * @return A Boolean flag which is indicating if end key is pressed. - */ - virtual TBool GetEndKey() - { - return EFalse; - }; - - /** - * Set a flag which is indicating if end key is pressed. - * @param aValue Status of end key - */ - virtual void SetEndKey(TBool /*aValue*/) {}; - - /** - * Set a flag which is indicating if proactive command is pending. - * @param aValue Status of proactive command - */ - virtual void SetCommandPending(TBool /*aValue*/) {}; - - /** - * Plays user selected tone. - * @param aText The text to be displayed. - * @param aDuration Play duration. - * @param aTone Tone to be played. - * @param aIconBitmap The tone playing note icon - * @param aSelfExplanatory Flag indicating if icon is self-explanatory. - * @return Information on the operation result. - */ - virtual TSatUiResponse PlayUserSelectedToneL( - const TDesC &aText, - TTimeIntervalMicroSeconds aDuration, - TSatTone aTone, - const CFbsBitmap* aIconBitmap, - const TBool aSelfExplanatory ); - - /** - * Confirm user permission for Open Channel. - * @param aText The text to be displayed. - * @param aActionAccepted Indicates whether the command was accepted. - * @param aIconBitmapOpenChannel Icon for query dialog - * @param aSelfExplanatory A flag indicating if icon is self-explanatory - * @return Operation result - */ - virtual TSatUiResponse ConfirmOpenChannelL( - const TDesC &aText, - TBool &aActionAccepted, - const CFbsBitmap* /*aIconBitmapOpenChannel*/, - const TBool aSelfExplanatory ); - - /** - * Shows the wait note while BIP packets are sent. - * @param aCommand Command type. - * @param aText The text to be displayed. - * @param aIconBitmap Icon for query dialog - * @param aSelfExplanatory A flag indicating if icon is self-explanatory - */ - virtual void ShowBIPNoteL( - TInt aCommand, - const TDesC &aText, - const CFbsBitmap* /*aIconBitmap*/, - const TBool /*aSelfExplanatory*/); - - /** - * Confirm user permission for SetUpCall - * @param aText The text to be displayed. - * @param aSimAppName Header for th equery - * @param aActionAccepted Indicates whether the command was accepted. - * @param aIconBitmap Icon for query dialog - * @param aSelfExplanatory A flag indicating if icon is self-explanatory - */ - virtual void ConfirmSetUpCallL( - const TDesC &aText, - const TDesC &aSimAppName, - TBool &aActionAccepted, - const CFbsBitmap* aIconBitmap, - const TBool aSelfExplanatory); - - /** - * Show note indicating SAT is not available. - */ - virtual void ShowNotAvailableNoteL() {}; - - /** - * Show the Ss error note. - */ - virtual void ShowSsErrorNoteL(); - - /** - * Start SatUi closing process. - */ - virtual void CloseSatUI(); - - -public: // new method - - /** - * Return current profile state. - * @return current profile state. - */ - int profileState(); - - /** - * Response to the Set Up Menu command. - * @param aMenuItem The selected menu item. - * @param aHelpRequested Indicates whether help was requested. - */ - void menuSelection( int aMenuItem, bool aHelpRequested ); - -protected: - //Q_DISABLE_COPY( SatAppEventProvider ); - -private: // Data - - /** - * The pointer to the sybmian class CSatUiObserver - * which will access Sat Client API - * own - */ - CSatUiObserver *mObs; - - /** - * Own,PlayTone - */ - DummyPlayToneProvider *mPlayTone; - -}; - -#endif //DUMMYEVENTPROVIDER_H diff -r 1f002146abb4 -r cee7e9e0906c satui/satapp/tsrc/ut_satapp/inc/dummyplaytoneprovider.h --- a/satui/satapp/tsrc/ut_satapp/inc/dummyplaytoneprovider.h Tue Jul 06 14:53:02 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,144 +0,0 @@ -/* -* Copyright (c) 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" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ -#ifndef DUMMYPLAYTONEPROVIDER_H -#define DUMMYPLAYTONEPROVIDER_H - -#include -#include //PlayStandardTone -#include //PlayUserSelectedTone -#include -#include - - -class CMdaAudioToneUtility; -class CMdaAudioPlayerUtility; -class QTimer; -class HbMessageBox; - -class DummyPlayToneProvider: public QObject, - public MMdaAudioToneObserver,//PlayStandardTone - public MMdaAudioPlayerCallback//PlayUserSelectedTone -{ - Q_OBJECT - -public: - - /** - * Constructor - */ - DummyPlayToneProvider(QObject *parent = 0); - - /** - * Distructor - */ - virtual ~DummyPlayToneProvider(); - -public: // from MSatUiActionImplementer and impletment by Symbian - - /** - * Handles Standard Tone playing. - * @param aText The text to be displayed. - * @param aFileName The name of the file corresponding to the tone. - * @param aDuration The duration of the tone to be played. - * @param aIconBitmap The tone playing note icon - * @param aSelfExplanatory Flag indicating if icon is self-explanatory. - * @return Information of the operation result. - */ - virtual TSatUiResponse PlayStandardToneL( - const TDesC &aText, - const TDesC8 &aSequence, - TTimeIntervalMicroSeconds aDuration, - const CFbsBitmap* aIconBitmap, - const TBool aSelfExplanatory ); - - /** - * Plays user selected tone. - * @param aText The text to be displayed. - * @param aDuration Play duration. - * @param aTone Tone to be played. - * @param aIconBitmap The tone playing note icon - * @param aSelfExplanatory Flag indicating if icon is self-explanatory. - * @return Information on the operation result. - */ - virtual TSatUiResponse PlayUserSelectedToneL( - const TDesC &aText, - TTimeIntervalMicroSeconds aDuration, - TSatTone aTone, - const CFbsBitmap* aIconBitmap, - const TBool aSelfExplanatory ); - - /** - * ClearScreen - */ - void clearScreen(); - - /** - * CloseSatUI - */ - void closeSatUI(); - -public:// from MMdaAudioToneObserver - - /** - * From MMdaAudioToneObserver Called by the player object when - * it has been initialised. - * @param aError Error type. - */ - void MatoPrepareComplete( TInt aError ); - - /** - * From MMdaAudioToneObserver Called by the player object when - * the playback has been terminated. - * @param aError Error type. - */ - void MatoPlayComplete( TInt aError ); - -public://from MMdaAudioPlayerCallback - /** - * Initialisation of an audio sample has completed. - * @param aError The status of the audio sample after initialisation. - * @param aDuration The duration of the audio sample. - */ - void MapcInitComplete( - TInt aError, - const TTimeIntervalMicroSeconds& /*aDuration*/ ); - - /** - * Play of an audio sample has completed. - * @param aError The status of playback. - */ - void MapcPlayComplete( TInt aError ); - -private:// for playTone - - /** - * Get settings from current profile like volume, warning tones on/off etc. - * @param aTone, optional specifies the type of needed tone if necessary - * @param aToneName, optional buffer to get a soundfile name from - * the active profile if necessary - */ - void GetProfileParamsL( TSatTone aTone = ESatToneNotSet, - TDes* aToneName = NULL ); - - /** - * showWaitNote - */ - void showWaitNote(); - -}; - -#endif //DUMMYPLAYTONEPROVIDER_H diff -r 1f002146abb4 -r cee7e9e0906c satui/satapp/tsrc/ut_satapp/inc/ut_csatuiobserver.h --- a/satui/satapp/tsrc/ut_satapp/inc/ut_csatuiobserver.h Tue Jul 06 14:53:02 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,217 +0,0 @@ -/* -* Copyright (c) 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" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Unit test CSatUiObserver class -* -*/ - -#ifndef UT_CSATUIOBSERVER_H -#define UT_CSATUIOBSERVER_H - -#include -#include - -// Class forwards -class CSatUiObserver; -class DummyEventProvider; - -/** - * CSatUiObserver unit test class. - * - * @since S60 - */ -class Ut_CSatUiObserver : public QObject -{ - Q_OBJECT - -public: - /** - * Constructor. - */ - Ut_CSatUiObserver(QObject *parent = 0); - /** - * Destructor. - */ - virtual ~Ut_CSatUiObserver(); - -private slots: - - /** - * Called before the first testfunction is executed. - * Handles the SetUpMenu command. - */ - void initTestCase(); - - /** - * Called after the last testfunction has been executed. - * - */ - void cleanupTestCase(); - - /** - * Test CSatUiObserver's ConnectRSatSessionL. - * - */ - void testConnectRSatSession(); - - /** - * Test CSatUiObserver's Adapter. - * - */ - void testAdapter(); - - /** - * Test CSatUiObserver's DisconnectRSatSession. - * - */ - void testDisconnectRSatSession(); - - /** - * Test CSatUiObserver's ProfileState. - * - */ - void testProfileState(); - - /** - * Test CSatUiObserver's SetImplementer. - * - */ - void testSetImplementer(); - - /** - * Test CSatUiObserver's testDisplayText's input param list. - * - */ - void testDisplayText_data(); - - /** - * Test CSatUiObserver's DisplayTextL. - * - */ - void testDisplayText(); - - /** - * Test CSatUiObserver's testSetUpMenu's input param list. - * - */ - void testSetUpMenu_data(); - - /** - * Test CSatUiObserver's SetUpMenuL. - * - */ - void testSetUpMenu(); - - /** - * Test CSatUiObserver's testGetInkey's input param list. - * - */ - void testGetInkey_data(); - - /** - * Test CSatUiObserver's GetInkeyL. - * - */ - void testGetInkey(); - - /** - * Test CSatUiObserver's testGetInput's input param list. - * - */ - void testGetInput_data(); - - /** - * Test CSatUiObserver's GetInputL. - * - */ - void testGetInput(); - - /** - * Test CSatUiObserver's testConfirmCommand's input param list. - * - */ - void testConfirmCommand_data(); - - /** - * Test CSatUiObserver's ConfirmCommand. - * - */ - void testConfirmCommand(); - - - /** - * Test CSatUiObserver's Notification input param list. - * - */ - void testNotification_data(); - - /** - * Test CSatUiObserver's Notification. - * - */ - void testNotification(); - - - /** - * Test CSatUiObserver's EventNotification input param list. - * - */ - void testEventNotification_data(); - - /** - * Test CSatUiObserver's Notification. - * - */ - void testEventNotification(); - - /** - * Test CSatUiObserver's testSetUpMenu's input param list. - * - */ - void testSelectItem_data(); - - /** - * Test CSatUiObserver's SetUpMenuL. - * - */ - void testSelectItem(); - - /** - * Test CSatUiObserver's testPlayTone input param list. - * - */ - void testPlayTone_data(); - - /** - * Test CSatUiObserver's testPlayTone. - * - */ - void testPlayTone(); - -private: - - /** - * Own. - * - */ - CSatUiObserver *mSatObserver; - - /** - * Own. - * - */ - DummyEventProvider *mImplementer; - -}; - -#endif // UT_CSATUIOBSERVER_H diff -r 1f002146abb4 -r cee7e9e0906c satui/satapp/tsrc/ut_satapp/inc/ut_playtoneprovider.h --- a/satui/satapp/tsrc/ut_satapp/inc/ut_playtoneprovider.h Tue Jul 06 14:53:02 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,131 +0,0 @@ -/* -* Copyright (c) 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" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -#ifndef UT_SATAPPPLAYTONEPROVIDER_H -#define UT_SATAPPPLAYTONEPROVIDER_H - -#include -#include - - -// Class forwards -class SatAppPlayToneProvider; - -/** - * Satapp unit test class. - * - * @since S60 - */ -class Ut_SatAppPlayToneProvider : public QObject -{ - Q_OBJECT - -public: - - Ut_SatAppPlayToneProvider(QObject *parent = 0); - - virtual ~Ut_SatAppPlayToneProvider(); - -private slots: - /** - * Called before the first testfunction is executed. - * Handles the SetUpMenu command. - */ - void initTestCase(); - - /** - * Called after the last testfunction has been executed. - * - */ - void cleanupTestCase(); - - /** - * Test SatAppPlayToneProvider's constructor. - * - */ - void testCreatePlayTone(); - - /** - * Test SatAppPlayToneProvider's testPlayStandardTone input param list. - * - */ - void testPlayStandardTone_data(); - - /** - * Test SatAppPlayToneProvider's PlayStandardToneL. - * - */ - void testPlayStandardTone(); - - /** - * Test SatAppPlayToneProvider's testPlayUserSelectedTone input param list. - * - */ - void testPlayUserSelectedTone_data(); - - /** - * Test SatAppPlayToneProvider's PlayUserSelectedToneL. - * - */ - void testPlayUserSelectedTone(); - - /** - * Test SatAppPlayToneProvider's closeSatUI. - * - */ - void testCloseSatUI(); - - /** - * Test SatAppPlayToneProvider's clearScreen. - * - */ - void testClearScreen(); - - /** - * Test SatAppPlayToneProvider's testMapcPlayComplete input param list. - * - */ - void testMapcPlayComplete_data(); - - /** - * Test SatAppPlayToneProvider's MapcPlayComplete. - * - */ - void testMapcPlayComplete(); - - /** - * Test SatAppPlayToneProvider's testMapcInitComplete input param list. - * - */ - void testMapcInitComplete_data(); - - - /** - * Test SatAppPlayToneProvider's MapcInitComplete. - * - */ - void testMapcInitComplete(); - -private: - /** - * Own. - */ - SatAppPlayToneProvider *mPlayTone; - -}; - -#endif // UT_SATAPPPLAYTONEPROVIDER_H diff -r 1f002146abb4 -r cee7e9e0906c satui/satapp/tsrc/ut_satapp/inc/ut_satappaction.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/satui/satapp/tsrc/ut_satapp/inc/ut_satappaction.h Wed Aug 18 10:19:22 2010 +0300 @@ -0,0 +1,75 @@ +/* +* Copyright (c) 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" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +#ifndef UT_SATAPPACTION_H +#define UT_SATAPPACTION_H + +// includes +#include +#include + + +// forward declarations +class SatAppAction; + + + +// QTest class +class Ut_SatAppAction : public QObject +{ + Q_OBJECT + +public: + + Ut_SatAppAction(QObject *parent = 0); + +private slots: + + void testAction(); + void testParams(); + void testComplete(); + void testCompleteSignal(); + void testDoubleComplete(); + void testAsyncActionRobustness(); + void testWait(); + +private: + + +}; + + + +// Helper object +class ActionHelper : public QObject +{ + Q_OBJECT + +public: + ActionHelper() {mCounter=0;} + int& count() {return mCounter;} + +public slots: + void inc() {++mCounter;} + void del(SatAppAction*); + +private: + int mCounter; +}; + + +#endif // UT_SATAPPACTION_H diff -r 1f002146abb4 -r cee7e9e0906c satui/satapp/tsrc/ut_satapp/inc/ut_satappconfirmprovider.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/satui/satapp/tsrc/ut_satapp/inc/ut_satappconfirmprovider.h Wed Aug 18 10:19:22 2010 +0300 @@ -0,0 +1,77 @@ +/* +* Copyright (c) 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" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +#ifndef UT_SATAPPCONFIRMPROVIDER_H +#define UT_SATAPPCONFIRMPROVIDER_H + +// includes +#include +#include + + +// forward declarations +class SatAppConfirmProvider; + + + +// QTest class +class Ut_SatAppConfirmProvider : public QObject +{ + Q_OBJECT + +public: + + Ut_SatAppConfirmProvider( + QObject *parent = 0); + +private slots: + + void testConfirmCommand_data(); + void testConfirmCommand(); + void testConfirmFirstAction(); + void testConfirmSecondAction(); + void testConfirmAndClearScreen(); + +}; + + +// internal helper class +class ConfirmProviderTest: public QObject +{ + Q_OBJECT + +public: + + ConfirmProviderTest(); + ~ConfirmProviderTest(); + +public slots: + + void simulateFirstActionClicked(); + void simulateSecondActionClicked(); + void simulateClearScreen(); + void cleanup(); + +public: + + // test data + SatAppConfirmProvider *mConfirm; + +}; + + +#endif // UT_SATAPPCONFIRMPROVIDER_H diff -r 1f002146abb4 -r cee7e9e0906c satui/satapp/tsrc/ut_satapp/inc/ut_satappeventhandler.h --- a/satui/satapp/tsrc/ut_satapp/inc/ut_satappeventhandler.h Tue Jul 06 14:53:02 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,109 +0,0 @@ -/* -* Copyright (c) 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" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -#ifndef UT_SATAPPEVENTPROVIDER_H -#define UT_SATAPPEVENTPROVIDER_H - -#include -#include -#include - -// Class forwards -class HbMainWindow; -class HbView; -class SatAppEventProvider; - -/** - * Satapp unit test class. - * - * @since S60 - */ -class Ut_SatAppEventProvider : public QObject -{ - Q_OBJECT - -public: - - Ut_SatAppEventProvider(QObject *parent = 0); - - - virtual ~Ut_SatAppEventProvider(); - -private slots: - /** - * Called before the first testfunction is executed. - * Handles the SetUpMenu command. - */ - void initTestCase(); - - /** - * Called after the last testfunction has been executed. - * - */ - void cleanupTestCase(); - - /** - * Test SatAppEventProvider's constructor. - * - */ - void testCreateEventHandler(); - - /** - * Test SatAppEventProvider's testShowSsWaitNote param list. - * - */ - void testShowSsWaitNote_data(); - - /** - * Test SatAppEventProvider's showSsWaitNote. - * - */ - void testShowSsWaitNote(); - - /** - * Test SatAppEventProvider's StopShowWaitNote. - * - */ - void testStopShowWaitNote(); - - /** - * Test SatAppEventProvider's ShowWaitNoteWithoutDelayL. - * - */ - void testShowWaitNoteWithoutDelay(); - - /** - * Test SatAppEventProvider's ShowSsErrorNoteL. - * - */ - void testShowSsErrorNote(); - -private: - /** - * Own. - */ - SatAppEventProvider *mEventHandler; - - /** - * Own. - */ - HbMainWindow *mWindow; - - -}; - -#endif // UT_SATAPPEVENTPROVIDER_H diff -r 1f002146abb4 -r cee7e9e0906c satui/satapp/tsrc/ut_satapp/inc/ut_satappinputprovider.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/satui/satapp/tsrc/ut_satapp/inc/ut_satappinputprovider.h Wed Aug 18 10:19:22 2010 +0300 @@ -0,0 +1,96 @@ +/* +* Copyright (c) 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" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +#ifndef UT_SATAPPINPUTPROVIDER_H +#define UT_SATAPPINPUTPROVIDER_H + +// includes +#include +#include + + +// forward declarations +class SatAppInputProvider; + + + +// QTest class +class Ut_SatAppInputProvider : public QObject +{ + Q_OBJECT + +public: + + Ut_SatAppInputProvider( + QObject *parent = 0); + +private slots: + + void testResetState(); + + void testGetInkeyAndOk_data(); + void testGetInkeyAndOk(); + void testGetInkeyAndCancel_data(); + void testGetInkeyAndCancel(); + void testGetInkeyAndTimeout(); + void testGetInkeyAndReset(); + void testGetInkeyAndDelete(); + + void testGetInkeyImmediateAndOk(); + void testGetInkeyImmediateAndCancel(); + + void testGetInputAndOk_data(); + void testGetInputAndOk(); + void testGetInputAndCancel_data(); + void testGetInputAndCancel(); + void testGetInputAndTimeout(); + void testGetInputAndReset(); + void testGetInputAndDelete(); + +private: + + +}; + + +// internal helper class +class InputProviderTest: public QObject +{ + Q_OBJECT + +public: + + InputProviderTest(); + ~InputProviderTest(); + +public slots: + + void simulateFirstActionClicked(); + void simulateSecondActionClicked(); + void simulateImmediateKeypress(QString s); + void cleanup(); + +public: + + + // test data + SatAppInputProvider *mInput; + +}; + + +#endif // UT_SATAPPINPUTPROVIDER_H diff -r 1f002146abb4 -r cee7e9e0906c satui/satapp/tsrc/ut_satapp/inc/ut_satappmainhandler.h --- a/satui/satapp/tsrc/ut_satapp/inc/ut_satappmainhandler.h Tue Jul 06 14:53:02 2010 +0300 +++ b/satui/satapp/tsrc/ut_satapp/inc/ut_satappmainhandler.h Wed Aug 18 10:19:22 2010 +0300 @@ -23,6 +23,7 @@ // Class forwards +class HbMainWindow; class SatAppMainHandler; /** @@ -36,7 +37,8 @@ public: - Ut_SatAppMainHandler(QObject *parent = 0); + Ut_SatAppMainHandler( + HbMainWindow* mainWindow, QObject *parent = 0); virtual ~Ut_SatAppMainHandler(); @@ -58,11 +60,16 @@ * */ void testCreateMainHandler(); + + /** + * Test SatAppMainHandler's constructor in offline. + * + */ + void testCreateMainHandler_OfflineMode(); private: - /** - * Own. - */ + + HbMainWindow* mMainWindow; // not own SatAppMainHandler *mMainHandler; }; diff -r 1f002146abb4 -r cee7e9e0906c satui/satapp/tsrc/ut_satapp/inc/ut_satappmenuprovider.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/satui/satapp/tsrc/ut_satapp/inc/ut_satappmenuprovider.h Wed Aug 18 10:19:22 2010 +0300 @@ -0,0 +1,90 @@ +/* +* Copyright (c) 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" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +#ifndef UT_SATAPPMENUPROVIDER_H +#define UT_SATAPPMENUPROVIDER_H + +// includes +#include +#include + + +// forward declarations +class HbMainWindow; +class SatAppMenuProvider; + + + +// QTest class +class Ut_SatAppMenuProvider : public QObject +{ + Q_OBJECT + +public: + + Ut_SatAppMenuProvider( + HbMainWindow* mainWindow, QObject *parent = 0); + +private slots: + + void testResetState(); + + void testSetUpMenu_data(); + void testSetUpMenu(); + void testSetUpMenuAndReset(); + void testSetUpMenuAndDelete(); + + void testSelectItem_data(); + void testSelectItem(); + void testSelectItemAndBack(); + void testSelectItemAndTimeout(); + void testSelectItemAndReset(); + void testSelectItemAndDelete(); + +private: + + HbMainWindow* mMainWindow; // not own + +}; + + +// internal helper class +class MenuProviderTest: public QObject +{ + Q_OBJECT + +public: + + MenuProviderTest(HbMainWindow* mainWindow); + ~MenuProviderTest(); + +public slots: + void loadMainview(); + void simulateItemSelected(); + void simulateBackButtonClicked(); + void cleanup(); + +public: + + // test data + SatAppMenuProvider *mMenu; + int mItemIndexToBeSelected; + +}; + + +#endif // UT_SATAPPMENUPROVIDER_H diff -r 1f002146abb4 -r cee7e9e0906c satui/satapp/tsrc/ut_satapp/inc/ut_satapppopupprovider.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/satui/satapp/tsrc/ut_satapp/inc/ut_satapppopupprovider.h Wed Aug 18 10:19:22 2010 +0300 @@ -0,0 +1,85 @@ +/* +* Copyright (c) 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" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +#ifndef UT_SATAPPPOPUPPROVIDER_H +#define UT_SATAPPPOPUPPROVIDER_H + +// includes +#include +#include + + +// forward declarations +class SatAppPopupProvider; + + + +// QTest class +class Ut_SatAppPopupProvider : public QObject +{ + Q_OBJECT + +public: + + Ut_SatAppPopupProvider( + QObject *parent = 0); + +private slots: + + + void testDisplayTextAndOk_data(); + void testDisplayTextAndOk(); + + void testDisplayTextAndCancel_data(); + void testDisplayTextAndCancel(); + + void testDisplayTextAndTimeout(); + + void testNotificationWithCancel_data(); + void testNotificationWithCancel(); + + void testNotification_data(); + void testNotification(); + +}; + + +// internal helper class +class PopupProviderTest: public QObject +{ + Q_OBJECT + +public: + + PopupProviderTest(); + ~PopupProviderTest(); + +public slots: + + bool simulateOkClicked(); + bool simulateCancelClicked(); + void cleanup(); + +public: + + // test data + SatAppPopupProvider *mPopup; + +}; + + +#endif // UT_SATAPPPOPUPPROVIDER_H diff -r 1f002146abb4 -r cee7e9e0906c satui/satapp/tsrc/ut_satapp/inc/ut_satappserverdispatcher.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/satui/satapp/tsrc/ut_satapp/inc/ut_satappserverdispatcher.h Wed Aug 18 10:19:22 2010 +0300 @@ -0,0 +1,84 @@ +/* +* Copyright (c) 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" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Unit test CSatUiObserver class +* +*/ + +#ifndef UT_SATAPPSERVERDISPATCHER_H +#define UT_SATAPPSERVERDISPATCHER_H + +#include +#include + +// Class forwards +class SatAppServerDispatcher; +class SatAppAction; + +/** + * CSatUiObserver unit test class. + */ +class Ut_SatAppServerDispatcher : public QObject +{ + Q_OBJECT + +public: + Ut_SatAppServerDispatcher(QObject *parent = 0); + +private slots: + + void initTestCase(); + void cleanupTestCase(); + + //test MSatUiObserver api + void testDisplayText_data(); + void testDisplayText(); + void testGetInkey_data(); + void testGetInkey(); + void testGetInput_data(); + void testGetInput(); + void testSetUpMenu_data(); + void testSetUpMenu(); + void testSelectItem_data(); + void testSelectItem(); + void testPlayTone_data(); + void testPlayTone(); + void testConfirmCommand_data(); + void testConfirmCommand(); + void testNotification_data(); + void testNotification(); + void testEventNotification_data(); + void testEventNotification(); + + // test slots + void testMenuSelection(); + void testUserCancelSession(); + +private: + + SatAppServerDispatcher *mServer; + +}; + + +// internal helper class +class ServerDispatcherHelper: public QObject +{ + Q_OBJECT + +public slots: + void exec(SatAppAction& action); + void simulateItemSelected(SatAppAction& action); +}; + +#endif // UT_SATAPPSERVERDISPATCHER_H diff -r 1f002146abb4 -r cee7e9e0906c satui/satapp/tsrc/ut_satapp/inc/ut_satapptoneprovider.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/satui/satapp/tsrc/ut_satapp/inc/ut_satapptoneprovider.h Wed Aug 18 10:19:22 2010 +0300 @@ -0,0 +1,96 @@ +/* +* Copyright (c) 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" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +#ifndef UT_SATAPPTONEPROVIDER_H +#define UT_SATAPPTONEPROVIDER_H + +#include +#include +#include + + +// Class forwards +class SatAppToneProvider; + +// class declaration +class Ut_SatAppToneProvider : public QObject +{ + Q_OBJECT + +public: + + Ut_SatAppToneProvider(QObject *parent = 0); + +private slots: + + void testCreateProvider_data(); + void testCreateProvider(); + void testClearScreen(); + + void testPlayTone_data(); + void testPlayTone(); + void testplayDoubleTone_data(); + void testplayDoubleTone(); + void testPlayToneAndClearScreen(); + + void testMatoPrepareComplete_data(); + void testMatoPrepareComplete(); +// void testMatoPlayComplete_data(); +// void testMatoPlayComplete(); +// void testMapcPlayComplete_data(); +// void testMapcPlayComplete(); + void testMapcInitComplete_data(); + void testMapcInitComplete(); + void testRecognizeTone_data(); + void testRecognizeTone(); + void testPrepareAudioToneUtility(); + +}; + +// internal helper class +class ToneProviderTest: public QObject +{ + Q_OBJECT + +public: + + ToneProviderTest(); + ~ToneProviderTest(); + static SatAppToneProvider* getToneInstance(); + bool isMessageBoxShown(); + bool isTimerActive(); + void ConstructAudioTone(); + void DestroyAudioTone(); + void ConstructAudioPlayer(); + void DestroyAudioPlayer(); + void ConstructTimer(bool active); + void DestroyTimer(); + void SetPlayToneResult(TSatUiResponse error); + void TestRecognizeTone(int tone, int duration); + +public slots: + + void cleanup(); + +public: + + // test data + SatAppToneProvider *mTone; + +}; + +#endif // UT_SATAPPTONEPROVIDER_H diff -r 1f002146abb4 -r cee7e9e0906c satui/satapp/tsrc/ut_satapp/src/dummyeventprovider.cpp --- a/satui/satapp/tsrc/ut_satapp/src/dummyeventprovider.cpp Tue Jul 06 14:53:02 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,681 +0,0 @@ -/* -* Copyright (c) 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" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -#include -#include -#include "dummyeventprovider.h" -#include "tflogger.h" -#include "csatuiobserver.h" -#include "dummyplaytoneprovider.h" - -// ---------------------------------------------------------------------------- -// DummyEventProvider::DummyEventProvider -// (other items were commented in a header). -// ---------------------------------------------------------------------------- -// -DummyEventProvider::DummyEventProvider(QObject *parent) : - QObject(parent), mObs(NULL) -{ - qDebug("SATAPP: DummyEventProvider::DummyEventProvider call"); - TRAPD(err, mObs = CSatUiObserver::NewL()); - - if (KErrNone != err) { - CloseSatUI(); - } else { - mObs->SetImplementer(this); - TFLOGSTRING("SATAPP: DummyEventProvider::DummyEventProvider \ - SetImplementer") - mPlayTone = new DummyPlayToneProvider(this); - } - qDebug("SATAPP: DummyEventProvider::DummyEventProvider exit"); -} - -// ---------------------------------------------------------------------------- -// DummyEventProvider::~DummyEventProvider -// Sets a pointer to CSatUiViewAppUi object. -// (other items were commented in a header). -// ---------------------------------------------------------------------------- -// -DummyEventProvider::~DummyEventProvider() -{ - qDebug("SATAPP: DummyEventProvider::~DummyEventProvider call"); - delete mObs; - mObs = NULL; - if (mPlayTone) { - delete mPlayTone; - mPlayTone = 0; - TFLOGSTRING("SATAPP: DummyEventProvider::~DummyEventProvider delete\ - mPlayTone") - } - qDebug("SATAPP: DummyEventProvider::~DummyEventProvider exit"); -} - -// ---------------------------------------------------------------------------- -// DummyEventProvider::SetUpMenuL -// (other items were commented in a header). -// ---------------------------------------------------------------------------- -// -TSatUiResponse DummyEventProvider::SetUpMenuL( - const TDesC &aText, - const MDesCArray &aMenuItems, - const CArrayFixFlat */*aMenuItemNextActions*/, - const CFbsBitmap */*aIconBitmap*/, - //const CAknIconArray */*aItemIconsArray*/, - const TBool aSelfExplanatoryItems, - const TBool aHelpIsAvailable) - { - qDebug("SATAPP: DummyEventProvider::SetUpMenuL call"); - - TSatUiResponse response(ESatSuccess); - QString title; - if (aText.Length() > 0) { - title = QString::fromUtf16 (aText.Ptr(), aText.Length()); - } - - QStringList *menuList = new QStringList(); - qDebug("SATAPP: DummyEventProvider::SetUpMenuL List"); - - //Add Item - if(menuList) { - for (int i=0 ; iappend(item); - } - - qDebug("SATAPP: DummyEventProvider::SetUpMenuL add item"); - - emit setUpMenuEvent( - response, - title, - *menuList, - //const CArrayFixFlat *aMenuItemNextActions, - //const HbIcon &aIcon, - //const CArrayFixFlat *aMenuIcons, - aSelfExplanatoryItems, - aHelpIsAvailable); - - delete menuList; - } - qDebug("SATAPP: DummyEventProvider::SetUpMenuL exit"); - - return response; - } - -// ---------------------------------------------------------------------------- -// DummyEventProvider::SetUpMenuL -// (other items were commented in a header). -// ---------------------------------------------------------------------------- -// -TSatUiResponse DummyEventProvider::SelectItemL( - const TDesC &aText, - const MDesCArray &aMenuItems, - const CArrayFixFlat */*aMenuItemNextActions*/, - const TInt aDefaultItem, - TUint8 &aSelection, - const CFbsBitmap */*aIconBitmap*/, - //const CAknIconArray */*aItemsIconArray*/, - const TBool aSelfExplanatoryItems, - const TBool aHelpIsAvailable) -{ - qDebug("SATAPP: DummyEventProvider::SelectItemL call"); - - TSatUiResponse response(ESatSuccess); - aSelection = 0; - QString title; - if (aText.Length() > 0) { - title=QString::fromUtf16(aText.Ptr(), aText.Length()); - } - - QStringList *menuList = new QStringList(); - //Add Item - if(menuList) { - for (int i=0 ; iappend(item); - } - qDebug("SATAPP: DummyEventProvider::SelectItemL add item"); - - emit selectItemEvent( - response, - title, - *menuList, - aDefaultItem, - aSelection, - //const CArrayFixFlat *aMenuItemNextActions, - //const HbIcon &aIcon, - //const CArrayFixFlat *aMenuIcons, - aSelfExplanatoryItems, - aHelpIsAvailable); - - delete menuList; - } - qDebug("SATAPP: DummyEventProvider::SelectItemL exit"); - - return response; -} - -// ---------------------------------------------------------------------------- -// DummyEventProvider::ProfileState -// (other items were commented in a header). -// ---------------------------------------------------------------------------- -// -int DummyEventProvider::profileState() -{ - qDebug("SATAPP: DummyEventProvider::ProfileState call"); - int res (0); - if (mObs) { - res = mObs->ProfileState(); - } - qDebug("SATAPP: DummyEventProvider::ProfileState exit"); - return res; -} - -// ---------------------------------------------------------------------------- -// DummyEventProvider::MenuSelection -// (other items were commented in a header). -// ---------------------------------------------------------------------------- -// -void DummyEventProvider::menuSelection(int aMenuItem, bool aHelpRequested) - { - if(mObs && mObs->Adapter()) { - mObs->Adapter()->MenuSelection(aMenuItem, aHelpRequested); - } - - qDebug("SATAPP: DummyEventProvider::MenuSelection exit"); - } - -// ---------------------------------------------------------------------------- -// DummyEventProvider::DisplayTextL -// (other items were commented in a header). -// ---------------------------------------------------------------------------- -// -TSatUiResponse DummyEventProvider::DisplayTextL( - const TDesC &aText, - const TDesC &aSimApplicationName, - CFbsBitmap */*aIconBitmapDisplayText*/, - const TBool aSelfExplanatoryIcon, - const TBool aSustainedText, - const TTimeIntervalSeconds aDuration, - const TBool aWaitUserToClear) - { - qDebug("SATAPP: DummyEventProvider::DisplayTextL call"); - - TSatUiResponse response(ESatFailure); - QString title; - if (aText.Length() > 0) { - title=QString::fromUtf16(aText.Ptr(), aText.Length()); - } else { - qDebug("SATAPP: DummyEventProvider::DisplayTextL null text"); - response = ESatFailure; - } - - QString appName; - if (aSimApplicationName.Length() > 0) { - appName=QString::fromUtf16(aSimApplicationName.Ptr(), - aSimApplicationName.Length()); - } else { - // test leave - qDebug("SATAPP: DummyEventProvider::DisplayTextL leave exit"); - User::Leave(KErrNotFound); - } - - int timeInterval = aDuration.Int(); - - bool isSelfExplanatoryIcon = (aSelfExplanatoryIcon) ? true : false; - - emit displayTextEvent( - response, - title, - appName, - //const HbIcon &aIcon, - isSelfExplanatoryIcon, - aSustainedText, - timeInterval, - aWaitUserToClear); - - qDebug("SATAPP: DummyEventProvider::DisplayTextL exit"); - return response; - } - -// ---------------------------------------------------------------------------- -// DummyEventProvider::GetInputLL -// (other items were commented in a header). -// ---------------------------------------------------------------------------- -// -TSatUiResponse DummyEventProvider::GetInputL( - const TDesC &aText, - const TSatCharacterSet aCharacterSet, - TDes &aInput, - const TInt aMinLength, - const TInt aMaxLength, - const TBool aHideInput, - const TBool aGetInkey, - const CFbsBitmap */*aIconBitmapGetInput*/, - const TBool aSelfExplanatory, - TUint &aDuration) -{ - qDebug("SATAPP: DummyEventProvider::GetInputL call"); - - TSatUiResponse response(ESatSuccess); - - QString title; - if (aText.Length() > 0) { - title=QString::fromUtf16(aText.Ptr(), aText.Length()); - TFLOGSTRING2("SATAPP: DummyEventProvider::GetInputL \ - Title=%S", &aText) - } - - QString inputText; - if (aInput.Length() > 0) { - inputText = QString::fromUtf16(aInput.Ptr(), aInput.Length()); - } else { - // test leave - TFLOGSTRING("SATAPP: DummyEventProvider::GetInkey test leave") - User::Leave(KErrNotFound); - } - bool isSelfExplanatory = aSelfExplanatory; - unsigned int duration = aDuration; - if (aGetInkey) { - //Get Inkey - emit getInkeyEvent( - response, - title, - aCharacterSet, - inputText, - //iconBitmapGetInput, - isSelfExplanatory, - duration); - qDebug("SATAPP: DummyEventProvider::GetInputL: GetInkey"); - aInput.Copy(reinterpret_cast(inputText.utf16()), inputText.length()); - } else { - // Get Input - bool hideInput = aHideInput; - int minLength = aMinLength; - int maxLength = aMaxLength; - emit getInputEvent( - response, - title, - aCharacterSet, - inputText, - minLength, - maxLength, - hideInput, - //iconBitmapGetInput, - isSelfExplanatory, - duration); - int length = inputText.length(); - if (length > maxLength) { - length = maxLength; - } - qDebug("SATAPP: DummyEventProvider::GetInputL: GetInput"); - aInput.Copy(reinterpret_cast(inputText.utf16()), length); - } - qDebug("SATAPP: DummyEventProvider::GetInputL exit"); - return response; - } - - // ---------------------------------------------------------------------------- -// DummyEventProvider::GetYesNoL -// (other items were commented in a header). -// ---------------------------------------------------------------------------- -// -TSatUiResponse DummyEventProvider::GetYesNoL( - const TDesC &aText, - const TSatCharacterSet aCharacterSet, - TChar &aInkey, - const CFbsBitmap */*aIconBitmap*/, - const TBool aSelfExplanatory, - TUint &aDuration, - const TBool aImmediateDigitResponse) -{ - qDebug("SATAPP: DummyEventProvider::GetYesNoL call"); - TSatUiResponse response(ESatSuccess); - QString text; - if (aText.Length() > 0) { - text=QString::fromUtf16(aText.Ptr(), aText.Length()); - } - - unsigned int inKey = static_cast < TUint >(aInkey); - - bool selfExplanatory = aSelfExplanatory; - bool immediateDigitResponse = aImmediateDigitResponse; - unsigned int duration = aDuration; - - emit getYesNoEvent( - response, - text, - aCharacterSet, - inKey, - //const TSatIconId &aIconId, - selfExplanatory, - duration, - immediateDigitResponse); - - aInkey = inKey; - qDebug("SATAPP: DummyEventProvider::GetYesNoL exit"); - return response; -} - -// ---------------------------------------------------------------------------- -// DummyEventProvider::ConfirmSendL -// (other items were commented in a header). -// ---------------------------------------------------------------------------- -// -TSatUiResponse DummyEventProvider::ConfirmSendL( - const TDesC &aText, - TBool &aActionAccepted, - TInt aType) -{ - qDebug("SATAPP: DummyEventProvider::ConfirmSendL call"); - TSatUiResponse response(ESatSuccess); - QString text; - if (aText.Length() > 0) { - text=QString::fromUtf16(aText.Ptr(), aText.Length()); - } - bool actionAccepted = aActionAccepted; - int type = aType; - emit confirmSendEvent( - response, - text, - actionAccepted, - type); - qDebug("SATAPP: DummyEventProvider::ConfirmSendL exit"); - return response; -} - -// ---------------------------------------------------------------------------- -// DummyEventProvider::ShowSmsWaitNoteL -// (other items were commented in a header). -// ---------------------------------------------------------------------------- -// -void DummyEventProvider::ShowSmsWaitNoteL( - const TDesC &aText, - const CFbsBitmap */*aIconBitmapSendSM*/, - const TBool aSelfExplanatoryIcon) -{ - qDebug("SATAPP: DummyEventProvider::ShowSmsWaitNoteL call"); - QString title; - if (aText.Length() > 0) { - title = QString::fromUtf16 (aText.Ptr(), aText.Length()); - } - bool selfExplanatoryIcon = aSelfExplanatoryIcon; - - emit showSmsWaitNoteEvent( - title, - selfExplanatoryIcon); - qDebug("SATAPP: DummyEventProvider::ShowSmsWaitNoteL exit"); -} - -// ---------------------------------------------------------------------------- -// DummyEventProvider::ConfirmSetUpCallL -// (other items were commented in a header). -// ---------------------------------------------------------------------------- -// -void DummyEventProvider::ConfirmSetUpCallL( - const TDesC &aText, - const TDesC &aSimAppName, - TBool &aActionAccepted, - const CFbsBitmap */*aIconBitmap*/, - const TBool /*aSelfExplanatory*/) - { - qDebug("SATAPP: DummyEventProvider::ConfirmSetUpCallL call"); - QString text; - if (aText.Length() > 0) { - text = QString::fromUtf16 (aText.Ptr(), aText.Length()); - TFLOGSTRING2("SATAPP: DummyEventProvider::ConfirmSetUpCallL \ - text=%S", text.utf16()) - } - - QString title; - if (aText.Length() > 0) { - title = QString::fromUtf16 (aSimAppName.Ptr(), aSimAppName.Length()); - TFLOGSTRING2("SATAPP: DummyEventProvider::ConfirmSetUpCallL \ - Title=%S", title.utf16()) - } - bool actionAccepted = aActionAccepted; - - emit showSetUpCallConfirmEvent( - text, - title, - actionAccepted); - qDebug("SATAPP: DummyEventProvider::ConfirmSetUpCallL exit"); - } - -// ---------------------------------------------------------------------------- -// DummyEventProvider::ShowDtmfWaitNoteL -// (other items were commented in a header). -// ---------------------------------------------------------------------------- -// -TSatUiResponse DummyEventProvider::ShowDtmfWaitNoteL( - const TDesC &aText, - const CFbsBitmap */*aIconBitmapSendSM*/, - const TBool /*aSelfExplanatoryIcon*/) -{ - TSatUiResponse response(ESatSuccess); - qDebug("SATAPP: DummyEventProvider::ShowDtmfWaitNoteL call"); - QString title; - if (aText.Length() > 0) { - title = QString::fromUtf16 (aText.Ptr(), aText.Length()); - TFLOGSTRING2("SATAPP: DummyEventProvider::ShowDtmfWaitNoteL \ - Title=%S", title.utf16()) - } - emit showDtmfWaitNoteEvent( - response, - title); - qDebug("SATAPP: DummyEventProvider::ShowDtmfWaitNoteL exit"); - return response; -} - -// ---------------------------------------------------------------------------- -// DummyEventProvider::clearScreen -// (other items were commented in a header). -// ---------------------------------------------------------------------------- -// -void DummyEventProvider::ClearScreen() -{ - qDebug("SATAPP: DummyEventProvider::ClearScreen call"); - if (mPlayTone) { - mPlayTone->clearScreen(); - } - emit clearScreenEvent(); - qDebug("SATAPP: DummyEventProvider::ClearScreen exit"); -} - -// ---------------------------------------------------------------------------- -// DummyEventProvider::CloseSatUI -// (other items were commented in a header). -// ---------------------------------------------------------------------------- -// -void DummyEventProvider::CloseSatUI() -{ - qDebug("SATAPP: DummyEventProvider::CloseSatUI call"); - if (mPlayTone) { - mPlayTone->closeSatUI(); - } - emit closeUiEvent(); - qDebug("SATAPP: DummyEventProvider::CloseSatUI exit"); -} - -//----------------------------------------------------------------------------- -// DummyEventProvider::StopShowWaitNote -// (other items were commented in a header). -// ---------------------------------------------------------------------------- -// -void DummyEventProvider::StopShowWaitNote() -{ - qDebug("SATAPP: DummyEventProvider::StopShowWaitNote call"); - emit stopShowWaitNoteEvent(); - qDebug("SATAPP: DummyEventProvider::StopShowWaitNote exit"); -} - -//----------------------------------------------------------------------------- -// DummyEventProvider::userCancelDtmfResponse -// (other items were commented in a header). -// ---------------------------------------------------------------------------- -// -void DummyEventProvider::userCancelResponse() -{ - qDebug("SATAPP: DummyEventProvider::userCancelDtmfResponse call"); - mObs->Adapter()->SessionTerminated( ESessionCancel ); - qDebug("SATAPP: DummyEventProvider::userCancelDtmfResponse exit"); -} - -//----------------------------------------------------------------------------- -// DummyEventProvider::ShowSsWaitNoteL -// (other items were commented in a header). -// ---------------------------------------------------------------------------- -// -void DummyEventProvider::ShowSsWaitNoteL( - const TDesC &aText, - const CFbsBitmap* /*aIconBitmap*/, - const TBool aSelfExplanatoryIcon ) -{ - TFLOGSTRING("SATAPP: DummyEventProvider::ShowSsWaitNoteL call") - QString title; - if (aText.Length() > 0) { - title = QString::fromUtf16 (aText.Ptr(), aText.Length()); - TFLOGSTRING2("SATAPP: DummyEventProvider::ShowSsWaitNoteL \ - Title=%s", title.utf16()) - } - bool selfExplanatoryIcon = aSelfExplanatoryIcon; - - emit showSsWaitNoteEvent( - title, - selfExplanatoryIcon); - TFLOGSTRING("SATAPP: DummyEventProvider::ShowSsWaitNoteL exit") -} - -//----------------------------------------------------------------------------- -// DummyEventProvider::ShowWaitNoteWithoutDelayL -// (other items were commented in a header). -// ---------------------------------------------------------------------------- -// -void DummyEventProvider::ShowWaitNoteWithoutDelayL() -{ - TFLOGSTRING("SATAPP: DummyEventProvider::ShowWaitNoteWithoutDelayL call") - emit showWaitNoteWithoutDelayEvent(); - TFLOGSTRING("SATAPP: DummyEventProvider::ShowWaitNoteWithoutDelayL exit") -} - -//----------------------------------------------------------------------------- -// DummyEventProvider::showSsErrorNoteEvent -// (other items were commented in a header). -// ---------------------------------------------------------------------------- -// -void DummyEventProvider::ShowSsErrorNoteL() -{ - TFLOGSTRING("SATAPP: DummyEventProvider::showSsErrorNoteEvent call") - emit showSsErrorNoteEvent(); - TFLOGSTRING("SATAPP: DummyEventProvider::showSsErrorNoteEvent exit") -} - -//----------------------------------------------------------------------------- -// DummyEventProvider::ShowBIPNoteL -// (other items were commented in a header). -// ---------------------------------------------------------------------------- -// -void DummyEventProvider::ShowBIPNoteL( TInt aCommand, const TDesC &aText, - const CFbsBitmap* /*aIconBitmap*/, const TBool /*aSelfExplanatory*/) -{ - TFLOGSTRING("SATAPP: DummyEventProvider::ShowBIPNoteL call") - int cmdType = aCommand; - QString title; - if (aText.Length() > 0) { - title=QString::fromUtf16(aText.Ptr(), aText.Length()); - TFLOGSTRING2("SATAPP: DummyEventProvider::ShowBIPNoteL \ - Title=%S", title.utf16()) - } - emit showBIPNoteEvent(cmdType, title); - TFLOGSTRING("SATAPP: DummyEventProvider::ShowBIPNoteL exit") -} - -//----------------------------------------------------------------------------- -// DummyEventProvider::ConfirmOpenChannelL -// (other items were commented in a header). -// ---------------------------------------------------------------------------- -// -TSatUiResponse DummyEventProvider::ConfirmOpenChannelL( - const TDesC &aText, - TBool &aActionAccepted, - const CFbsBitmap* /*aIconBitmapOpenChannel*/, - const TBool /*aSelfExplanatory*/ ) -{ - TFLOGSTRING("SATAPP: DummyEventProvider::ConfirmOpenChannelL call") - - TSatUiResponse response( ESatSuccess ); - - QString title; - if (aText.Length() > 0) { - title=QString::fromUtf16(aText.Ptr(), aText.Length()); - TFLOGSTRING2("SATAPP: DummyEventProvider::ConfirmOpenChannelL \ - Title=%s", title.utf16()) - } - - bool actionAccepted = aActionAccepted; - - emit showOpenChannelConfirmEvent(title, actionAccepted); - - TFLOGSTRING2( "SATAPP: DummyEventProvider::ConfirmOpenChannelL exit\ - response: %d", response) - return response; -} - -//----------------------------------------------------------------------------- -// DummyEventProvider::PlayStandardToneL -// (other items were commented in a header). -// ---------------------------------------------------------------------------- -// -TSatUiResponse DummyEventProvider::PlayStandardToneL( const TDesC& aText, - const TDesC8& aSequence, - TTimeIntervalMicroSeconds aDuration, - const CFbsBitmap* aIconBitmap, - const TBool aSelfExplanatory ) -{ - TFLOGSTRING("SATAPP: DummyEventProvider::PlayStandardToneL call") - TSatUiResponse response = mPlayTone->PlayStandardToneL( - aText, aSequence, aDuration, aIconBitmap, aSelfExplanatory); - TFLOGSTRING2("SATAPP: DummyEventProvider::PlayStandardToneL \ - response= %d exit", response) - return response; -} - -//----------------------------------------------------------------------------- -// DummyEventProvider::PlayUserSelectedToneL -// (other items were commented in a header). -// ---------------------------------------------------------------------------- -// -TSatUiResponse DummyEventProvider::PlayUserSelectedToneL( - const TDesC &aText, - TTimeIntervalMicroSeconds aDuration, - TSatTone aTone, - const CFbsBitmap* aIconBitmap, - const TBool aSelfExplanatory ) -{ - TFLOGSTRING("DummyEventProvider::PlayUserSelectedToneL calling") - if (100 == aTone) { - TFLOGSTRING("DummyEventProvider::PlayUserSelectedToneL test failure") - return ESatFailure; - } - TSatUiResponse response = mPlayTone->PlayUserSelectedToneL( - aText, aDuration, aTone, aIconBitmap, aSelfExplanatory); - TFLOGSTRING2( "DummyEventProvider::PlayUserSelectedToneL response= %d \ - exit", response) - return response; -} - //End of file diff -r 1f002146abb4 -r cee7e9e0906c satui/satapp/tsrc/ut_satapp/src/dummyplaytoneprovider.cpp --- a/satui/satapp/tsrc/ut_satapp/src/dummyplaytoneprovider.cpp Tue Jul 06 14:53:02 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,178 +0,0 @@ -/* -* Copyright (c) 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" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - - -// PlayStandardTone -#include -#include -#include -#include -#include //KAudioPriorityLowLevel - -#include //KMdaRepeatForever -#include // timeout callback -#include //playtone note -#include // for CMdaAudioToneUtility&CMdaAudioPlayerUtility -#include //TTimeIntervalMicroSeconds - -#include "dummyplaytoneprovider.h" - -//#include "tflogger.h" - - -// ---------------------------------------------------------------------------- -// DummyPlayToneProvider::DummyPlayToneProvider -// (other items were commented in a header). -// ---------------------------------------------------------------------------- -// -DummyPlayToneProvider::DummyPlayToneProvider(QObject *parent) : - QObject(parent) -{ - qDebug("SATAPP: DummyPlayToneProvider::DummyPlayToneProvider >"); - qDebug("SATAPP: DummyPlayToneProvider::DummyPlayToneProvider <"); -} - -// ---------------------------------------------------------------------------- -// DummyPlayToneProvider::~DummyPlayToneProvider -// Sets a pointer to CSatUiViewAppUi object. -// (other items were commented in a header). -// ---------------------------------------------------------------------------- -// -DummyPlayToneProvider::~DummyPlayToneProvider() -{ - qDebug("SATAPP: DummyPlayToneProvider::~DummyPlayToneProvider >"); - qDebug("SATAPP: DummyPlayToneProvider::~DummyPlayToneProvider <"); -} - -//----------------------------------------------------------------------------- -// DummyPlayToneProvider::PlayStandardToneL -// (other items were commented in a header). -// ---------------------------------------------------------------------------- -// -TSatUiResponse DummyPlayToneProvider::PlayStandardToneL( const TDesC& /*aText*/, - const TDesC8& /*aSequence*/, - TTimeIntervalMicroSeconds /*aDuration*/, - const CFbsBitmap* /*aIconBitmap*/, - const TBool /*aSelfExplanatory*/ ) -{ - qDebug("SATAPP: DummyPlayToneProvider::PlayStandardToneL >"); - qDebug("SATAPP: DummyPlayToneProvider::PlayStandardToneL <"); - return ESatSuccess; -} - - -// --------------------------------------------------------- -// SatAppCommandHandler::GetProfileParamsL -// Get and store settings from current profile -// (other items were commented in a header). -// --------------------------------------------------------- -// -void DummyPlayToneProvider::GetProfileParamsL( TSatTone - /*aTone = ESatToneNotSet*/, TDes* /*aToneName = NULL*/ ) -{ - qDebug( "SatAppCommandHandler::GetProfileParamsL >"); - qDebug("SatAppCommandHandler::GetProfileParamsL <"); -} - -// --------------------------------------------------------- -// DummyPlayToneProvider::MatoPrepareComplete -// Indicates success or failure. -// (other items were commented in a header). -// --------------------------------------------------------- -// -void DummyPlayToneProvider::MatoPrepareComplete(TInt /*aError*/) -{ - qDebug("DummyPlayToneProvider::MatoPrepareComplete >"); - qDebug( "DummyPlayToneProvider::MatoPrepareComplete <"); -} - -//----------------------------------------------------------------------------- -// DummyPlayToneProvider::MatoPlayComplete -// Indicates success or failure. -// (other items were commented in a header). -// ---------------------------------------------------------------------------- -// -void DummyPlayToneProvider::MatoPlayComplete( TInt /*aError*/ ) -{ - qDebug("DummyPlayToneProvider::MatoPlayComplete >"); - qDebug("DummyPlayToneProvider::MatoPlayComplete <"); -} - -//----------------------------------------------------------------------------- -// DummyPlayToneProvider::PlayUserSelectedToneL -// (other items were commented in a header). -// ---------------------------------------------------------------------------- -// -TSatUiResponse DummyPlayToneProvider::PlayUserSelectedToneL( - const TDesC &/*aText*/, - TTimeIntervalMicroSeconds /*aDuration*/, - TSatTone /*aTone*/, - const CFbsBitmap* /*aIconBitmap*/, - const TBool /*aSelfExplanatory*/ ) -{ - qDebug("DummyPlayToneProvider::PlayUserSelectedToneL >"); - qDebug( "DummyPlayToneProvider::PlayUserSelectedToneL <"); - return ESatSuccess; -} - -//----------------------------------------------------------------------------- -// DummyPlayToneProvider::MapcInitComplete -// Plays the tone. -// (other items were commented in a header). -// ---------------------------------------------------------------------------- -void DummyPlayToneProvider::MapcInitComplete( TInt /*aError*/, - const TTimeIntervalMicroSeconds& /*aDuration*/ ) -{ - qDebug( "DummyPlayToneProvider::MapcInitComplete >" ); - qDebug( "DummyPlayToneProvider::MapcInitComplete <" ); -} - -//----------------------------------------------------------------------------- -// DummyPlayToneProvider::MapcPlayComplete -// Deletes audio player after playing is completed. -// (other items were commented in a header). -// ---------------------------------------------------------------------------- -void DummyPlayToneProvider::MapcPlayComplete( TInt /*aError*/ ) -{ - qDebug( "DummyPlayToneProvider::MapcPlayComplete >"); - qDebug("DummyPlayToneProvider::MapcPlayComplete <"); -} - -// ---------------------------------------------------------------------------- -// DummyPlayToneProvider::clearScreen -// (other items were commented in a header). -// ---------------------------------------------------------------------------- -// -void DummyPlayToneProvider::clearScreen() -{ - qDebug("SATAPP: SatAppEventProvider::clearScreen >"); - qDebug("SATAPP: DummyPlayToneProvider::clearScreen <"); -} - -// ---------------------------------------------------------------------------- -// DummyPlayToneProvider::clearScreen -// (other items were commented in a header). -// ---------------------------------------------------------------------------- -// -void DummyPlayToneProvider::closeSatUI() -{ - qDebug("SATAPP: DummyPlayToneProvider::closeSatUI >"); - clearScreen(); - qDebug("SATAPP: DummyPlayToneProvider::closeSatUI <"); -} - - //End of file diff -r 1f002146abb4 -r cee7e9e0906c satui/satapp/tsrc/ut_satapp/src/main.cpp --- a/satui/satapp/tsrc/ut_satapp/src/main.cpp Tue Jul 06 14:53:02 2010 +0300 +++ b/satui/satapp/tsrc/ut_satapp/src/main.cpp Wed Aug 18 10:19:22 2010 +0300 @@ -18,53 +18,67 @@ #include +#include "hbapplication.h" +#include "hbinstance.h" #include "ut_satappmainhandler.h" -#include "ut_csatuiobserver.h" -#include "ut_satappeventhandler.h" -#include "ut_playtoneprovider.h" +#include "ut_satappmenuprovider.h" +#include "ut_satappinputprovider.h" +#include "ut_satapptoneprovider.h" +#include "ut_satapppopupprovider.h" +#include "ut_satappserverdispatcher.h" +#include "ut_satappconfirmprovider.h" +#include "ut_satappaction.h" int main(int argc, char *argv[]) { qDebug("Ut_SatApp: main() >"); - QApplication app(argc, argv); + HbApplication app(argc,argv); + HbInstance::instance(); + HbMainWindow mainWindow; - int result(0); + // test cmdline parameters char *pass[3]; pass[0] = argv[0]; pass[1] = "-o"; - pass[2] = "c:\\logs\\sat\\ut_SatAppMainHandler.txt"; - - qDebug("Test SatAppMainHandler"); - Ut_SatAppMainHandler tc; - result = QTest::qExec(&tc, 3, pass); - qDebug("Ut_SatApp: main() test SatAppMainHandler, result=%d", result); + + int result(0); + + Ut_SatAppPopupProvider utPopupProvider; + pass[2] = "c:\\logs\\sat\\Ut_SatAppPopupProvider.txt"; + result += QTest::qExec(&utPopupProvider, /*3*/ 1, pass); - //qDebug("Test CSatUiObserve"); - Ut_CSatUiObserver utCSatUiObserver; - char *test[3]; - test[0] = argv[0]; - test[1] = "-o"; - test[2] = "c:\\logs\\sat\\ut_CSatUiObserver.txt"; - result = QTest::qExec(&utCSatUiObserver, 3, test); - qDebug("Ut_SatApp: main() test CSatUiObserver<, result=%d", result); + Ut_SatAppConfirmProvider utConfirmProvide; + pass[2] = "c:\\logs\\sat\\Ut_SatAppConfirmProvider.txt"; + result += QTest::qExec(&utConfirmProvide, /*3*/ 1, pass); + + Ut_SatAppAction utAction; + pass[2] = "c:\\logs\\sat\\Ut_SatAppAction.txt"; + result += QTest::qExec(&utAction, /*3*/ 1, pass); + + Ut_SatAppMenuProvider utMenuProvider(&mainWindow); + pass[2] = "c:\\logs\\sat\\Ut_SatAppMenuProvider.txt"; + result += QTest::qExec(&utMenuProvider, /*3*/ 1, pass); - /*Ut_SatAppEventProvider utSatAppEventProvider; - char *test_event[3]; - test_event[0] = argv[0]; - test_event[1] = "-o"; - test_event[2] = "c:\\logs\\sat\\ut_SatAppEventProvide.txt"; - result = QTest::qExec(&utSatAppEventProvider, 3, test_event); - qDebug("Ut_SatApp: main() test SatAppEventProvide<, result=%d", result);*/ + Ut_SatAppInputProvider utInputProvider; + pass[2] = "c:\\logs\\sat\\Ut_SatAppInputProvider.txt"; + result += QTest::qExec(&utInputProvider, /*3*/ 1, pass); + + Ut_SatAppToneProvider utToneProvider; + pass[2] = "c:\\logs\\sat\\Ut_SatAppToneProvider.txt"; + result += QTest::qExec(&utToneProvider, /*3*/ 1, pass); - Ut_SatAppPlayToneProvider utPlayTone; - char *test_playtone[3]; - test_playtone[0] = argv[0]; - test_playtone[1] = "-o"; - test_playtone[2] = "c:\\logs\\sat\\Ut_SatAppPlayToneProvider.txt"; - result = QTest::qExec(&utPlayTone, 3, test_playtone); - qDebug("Ut_SatApp: main() test SatAppPlayToneProvider<, result=%d", result); + Ut_SatAppServerDispatcher utServerDispatcher; + pass[2] = "c:\\logs\\sat\\Ut_SatAppServerDispatcher.txt"; + result += QTest::qExec(&utServerDispatcher, /*3*/ 1, pass); + Ut_SatAppMainHandler utMainHandler(&mainWindow); + pass[2] = "c:\\logs\\sat\\ut_SatAppMainHandler.txt"; + result = QTest::qExec(&utMainHandler, /*3*/ 1, pass); + + // cause a crash to free binary, so that we can recompile and run + // unit tests without restarting the emulator + //int crash = ((QString*)0)->length(); return result; } diff -r 1f002146abb4 -r cee7e9e0906c satui/satapp/tsrc/ut_satapp/src/rsat_stub.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/satui/satapp/tsrc/ut_satapp/src/rsat_stub.cpp Wed Aug 18 10:19:22 2010 +0300 @@ -0,0 +1,71 @@ +/* +* Copyright (c) 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" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Stub implementations for RSatSession and RSatUiSession +* (used in unit testing the SAT APP) +* +* +*/ + + +#include +#include +#include +#include + +// adapter +class CSatCCommandProcessor: public MSatUiAdapter { + void MenuSelection(TInt aMenuItem, TBool aHelpRequested) + { + } + + void SessionTerminated(TInt8 aType) + { + } +}; + + +// RSatSession + +RSatSession::RSatSession() +{ +} + +void RSatSession::ConnectL() +{ +} + +// RSatUiSession + +RSatUiSession::RSatUiSession() +{ +} + +void RSatUiSession::RegisterL(const RSatSession&,MSatUiObserver*) +{ + iCommandProcessor = new CSatCCommandProcessor(); +} + +void RSatUiSession::Close() +{ + delete iCommandProcessor; +} + +MSatUiAdapter* RSatUiSession::Adapter() const +{ + return iCommandProcessor; +} + + + +//End of file diff -r 1f002146abb4 -r cee7e9e0906c satui/satapp/tsrc/ut_satapp/src/ut_csatuiobserver.cpp --- a/satui/satapp/tsrc/ut_satapp/src/ut_csatuiobserver.cpp Tue Jul 06 14:53:02 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1079 +0,0 @@ -/* -* Copyright (c) 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" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Unit test for CSatUiObserver -* -*/ - -//symbian -#include -//#include -#include -#include -//qt -#include -//test class -#include "csatuiobserver.h" -#include "ut_csatuiobserver.h" -#include "dummyeventprovider.h" - - - -// ----------------------------------------------------------------------------- -// Ut_CSatUiObserver::Ut_CSatUiObserver -// ----------------------------------------------------------------------------- -// -Ut_CSatUiObserver::Ut_CSatUiObserver(QObject *parent):QObject(parent) -{ - qDebug("Ut_CSatUiObserver::Ut_CSatUiObserver >"); - TRAPD(err, mSatObserver = CSatUiObserver::NewL()); - qDebug("Ut_CSatUiObserver: Ut_CSatUiObserver, err=%d", err); - mImplementer = new DummyEventProvider(); - QVERIFY(mImplementer); - qDebug("Ut_CSatUiObserver::Ut_CSatUiObserver <"); -} - -// ----------------------------------------------------------------------------- -// Ut_CSatUiObserver::~Ut_CSatUiObserver -// ----------------------------------------------------------------------------- -// -Ut_CSatUiObserver::~Ut_CSatUiObserver() -{ - qDebug("Ut_CSatUiObserver::~Ut_CSatUiObserver >"); - if (mSatObserver) { - qDebug("Ut_CSatUiObserver::~Ut_CSatUiObserver delete mSatObserver..."); - delete mSatObserver; - mSatObserver = 0; - } - if (mImplementer) { - qDebug("Ut_CSatUiObserver::~Ut_CSatUiObserver delete mImplementer..."); - delete mImplementer; - mImplementer = 0; - } - qDebug("Ut_CSatUiObserver::~Ut_CSatUiObserver <"); -} - -// ----------------------------------------------------------------------------- -// Ut_CSatUiObserver::initTestCase -// QTestLib cleanup method, called after the last testfunction . -// ----------------------------------------------------------------------------- -void Ut_CSatUiObserver::initTestCase() -{ - qDebug("Ut_CSatUiObserver::initTestCase >"); - qDebug("Ut_CSatUiObserver::initTestCase <"); -} - - -// ----------------------------------------------------------------------------- -// Ut_CSatUiObserver::cleanupTestCase -// -// Connects to test object signal and verifies received data. -// ----------------------------------------------------------------------------- -void Ut_CSatUiObserver::cleanupTestCase() -{ - qDebug("Ut_CSatUiObserver::cleanupTestCase >"); - qDebug("Ut_CSatUiObserver::cleanupTestCase <"); -} - -// ----------------------------------------------------------------------------- -// Ut_CSatUiObserver::testConnectRSatSession -// -// Connects to test object signal and verifies received data. -// ----------------------------------------------------------------------------- -void Ut_CSatUiObserver::testConnectRSatSession() -{ - qDebug("Ut_CSatUiObserver::testConnectRSatSession >"); - QVERIFY(mSatObserver); - TRAP_IGNORE(mSatObserver->ConnectRSatSessionL()); - qDebug("Ut_CSatUiObserver::testConnectRSatSession <"); -} - -// ----------------------------------------------------------------------------- -// Ut_CSatUiObserver::testAdapter -// -// Connects to test object signal and verifies received data. -// ----------------------------------------------------------------------------- -void Ut_CSatUiObserver::testAdapter() -{ - qDebug("Ut_CSatUiObserver::testAdapter >"); - QVERIFY(mSatObserver); - mSatObserver->Adapter(); - qDebug("Ut_CSatUiObserver::testAdapter <"); -} - -// ----------------------------------------------------------------------------- -// Ut_CSatUiObserver::testDisconnectRSatSession -// -// Connects to test object signal and verifies received data. -// ----------------------------------------------------------------------------- -void Ut_CSatUiObserver::testDisconnectRSatSession() -{ - qDebug("Ut_CSatUiObserver::testDisconnectRSatSession >"); - QVERIFY(mSatObserver); - mSatObserver->DisconnectRSatSession(); - qDebug("Ut_CSatUiObserver::testDisconnectRSatSession <"); -} - -// ----------------------------------------------------------------------------- -// Ut_CSatUiObserver::testProfileState -// -// Connects to test object signal and verifies received data. -// ----------------------------------------------------------------------------- -void Ut_CSatUiObserver::testProfileState() -{ - qDebug("Ut_CSatUiObserver::testProfileState >"); - QVERIFY(mSatObserver); - mSatObserver->ProfileState(); - qDebug("Ut_CSatUiObserver::testProfileState <"); -} - -// ----------------------------------------------------------------------------- -// Ut_CSatUiObserver::testSetImplementer -// -// Connects to test object signal and verifies received data. -// ----------------------------------------------------------------------------- -void Ut_CSatUiObserver::testSetImplementer() -{ - qDebug("Ut_CSatUiObserver::testSetImplementer >"); - QVERIFY(mSatObserver); - QVERIFY(mImplementer); - mSatObserver->SetImplementer(mImplementer); - qDebug("Ut_CSatUiObserver::testSetImplementer <"); -} - -// ----------------------------------------------------------------------------- -// Ut_CSatUiObserver::testDisplayText_data -// -// Connects to test object signal and verifies received data. -// ----------------------------------------------------------------------------- -void Ut_CSatUiObserver::testDisplayText_data() -{ - qDebug("Ut_CSatUiObserver::testDisplayText_data >"); - QTest::addColumn("text"); - QTest::addColumn("appName"); - QTest::addColumn("iconIdIdentifier"); - QTest::addColumn("iconIdQualifier");//enum 0~3 - QTest::addColumn("isIconDisplayed"); - QTest::addColumn("sustainedText"); - QTest::addColumn("duration"); - QTest::addColumn("isWaitUsertoClear"); - QTest::addColumn("expectValue"); - - QTest::newRow("first") << "Show Display text!" << "Unit test SIM Service" << - 84 << 1 << false << false << 2500 << true << 0; - - QTest::newRow("second") << "Show Display text!" << "SIM Service" << - 84 << 1 << true << false << 2500 << false << 0; - // test null text - QTest::newRow("third") << "" << "SIM Service" << - 84 << 1 << true << false << 2500 << false << -1; - - // test icon is available for command - QTest::newRow("fouth") << "Show Display text!" << "SIM Service" << - 84 << 2 << true << false << 2500 << false << 0; - - // test leave occurs - //QTest::newRow("forth") << "Show Display text!" << "" << - // 84 << 2 << true << false << 2500 << false << 1; - - qDebug("Ut_CSatUiObserver::testDisplayText_data <"); -} - -// ----------------------------------------------------------------------------- -// Ut_SatApp::testDisplayText -// -// Connects to test object signal and verifies received data. -// ----------------------------------------------------------------------------- -void Ut_CSatUiObserver::testDisplayText() -{ - qDebug("Ut_CSatUiObserver::testDisplayText >"); - QVERIFY(mSatObserver); - QFETCH(QString, text); - QFETCH(QString, appName); - QFETCH(int, iconIdIdentifier); - QFETCH(int, iconIdQualifier); - QFETCH(bool, isIconDisplayed); - QFETCH(bool, sustainedText); - QFETCH(int, duration); - QFETCH(bool, isWaitUsertoClear); - QFETCH(int, expectValue); - - // text - HBufC* hText = HBufC::New(text.length()); - TPtr aText( hText->Des() ); - aText.Copy( text.utf16() ); - // sim name - HBufC* hSimAppName = HBufC::New(appName.length()); - TPtr aSimApplicationName( hSimAppName->Des() ); - aSimApplicationName.Copy( appName.utf16() ); - - TSatIconId aIconId; - aIconId.iIdentifier = iconIdIdentifier; - aIconId.iIconQualifier = static_cast(iconIdQualifier); - TBool aIsIconDisplayed(isIconDisplayed); - - TSatUiResponse result(ESatSuccess); - // It seems that TRAPD&QT_TRAP_THROWING does nothing if leave occurs, need - // to investigate. - QT_TRAP_THROWING( result = mSatObserver->DisplayTextL( - aText, - aSimApplicationName, - aIconId, - aIsIconDisplayed, - sustainedText, - duration, - isWaitUsertoClear - )); - delete hText; - hText = 0; - TSatUiResponse exValue = static_cast(expectValue); - QCOMPARE(exValue, result); - qDebug("Ut_CSatUiObserver::testDisplayText <"); -} - -// ----------------------------------------------------------------------------- -// Ut_CSatUiObserver::testSetUpMenu_data -// -// Connects to test object signal and verifies received data. -// ----------------------------------------------------------------------------- -void Ut_CSatUiObserver::testSetUpMenu_data() -{ - qDebug("Ut_CSatUiObserver::testSetUpMenu_data >"); - QTest::addColumn("text"); - QTest::addColumn("setupMenuItem"); - QTest::addColumn("isHelpIsAvailable"); - QTest::addColumn("iconIdIdentifier"); - QTest::addColumn("iconIdQualifier");//enum 0~3 - QTest::addColumn("iconListQualifier"); - QTest::addColumn("expectReturnValue"); - - QStringList testSetUpMenu_1_items; - testSetUpMenu_1_items - << "SendData" - << "ReceiveData" - << "CloseChannel" - << "OpenChannel" - << "GetChannelStatus" - << "DisplayText with different symbols and durations" - << "GetInkey" - << "GetInput" - << "SelectItem" - << "PlayTone" - << "RefreshRequired" - << "DoRefresh" - << "SendSm" - << "SendSs" - << "SendUssd" - << "SetUpCall" - << "SetUpIdleModeText" - << "CallControl" - << "MoSmControl" - << "LaunchBrowser" - << "SendDTMF" - << "SetUpEventList" - << "ProvideLocalInfo" - << "EventDownload for IdleScreen available event" - << "SetUpMenu"; - - QTest::newRow("first") << "SAT" << testSetUpMenu_1_items << - false << 80 << 1 << 2 << 0; - - qDebug("Ut_CSatUiObserver::testSetUpMenu_data <"); -} - -// ----------------------------------------------------------------------------- -// Ut_CSatUiObserver::testSetUpMenu -// -// Connects to test object signal and verifies received data. -// ----------------------------------------------------------------------------- -void Ut_CSatUiObserver::testSetUpMenu() -{ - qDebug("Ut_CSatUiObserver::testSetUpMenu >"); - QVERIFY(mSatObserver); - QFETCH(QString, text); - QFETCH(QStringList, setupMenuItem); - QFETCH(bool, isHelpIsAvailable); - QFETCH(int, iconIdIdentifier); - QFETCH(int, iconIdQualifier); - QFETCH(int, iconListQualifier); - QFETCH(int, expectReturnValue); - - // aText - HBufC* hText = HBufC::New(text.length()); - TPtr aText( hText->Des() ); - aText.Copy( text.utf16() ); - // aMenuItems - TBuf<128> menuItem; - CDesCArrayFlat* aMenuItems = new CDesCArrayFlat(4); - QVERIFY(aMenuItems); - for (int i = 0; i< setupMenuItem.count(); i++) { - menuItem = setupMenuItem.at(i).utf16(); - QT_TRAP_THROWING(aMenuItems->AppendL(menuItem)); - } - // aIconId - TSatIconId aIconId; - aIconId.iIdentifier = iconIdIdentifier; - aIconId.iIconQualifier = static_cast(iconIdQualifier); - // aMenuItemNextActions - CArrayFixFlat* aMenuItemNextActions = - new CArrayFixFlat (4); - QVERIFY(aMenuItemNextActions); - // Temp test - QT_TRAP_THROWING(aMenuItemNextActions->AppendL(ESatSetUpMenuAction)); - // aMenuIcons - CArrayFixFlat* aMenuIcons = new CArrayFixFlat(2); - QVERIFY(aMenuIcons); - // Temp test - QT_TRAP_THROWING(aMenuIcons->AppendL(1)); - // aIconListQualifier - TSatIconQualifier aIconListQualifier = - static_cast(iconListQualifier); - // TSatSelectionPreference, useless - TSatSelectionPreference aSelectionPreference(ESatNoSelectionPreference); - TSatUiResponse result(ESatSuccess); - QT_TRAP_THROWING(result = mSatObserver->SetUpMenuL( - aText, - *aMenuItems, - aMenuItemNextActions, - isHelpIsAvailable, - aIconId, - aMenuIcons, - aIconListQualifier, - aSelectionPreference - )); - TSatUiResponse exValue = static_cast(expectReturnValue); - QCOMPARE(exValue, result); - - delete hText; - hText = 0; - delete aMenuItems; - aMenuItems = 0; - delete aMenuItemNextActions; - aMenuItemNextActions = 0; - delete aMenuIcons; - aMenuIcons = 0; - qDebug("Ut_CSatUiObserver::testSetUpMenu <"); -} - -// ----------------------------------------------------------------------------- -// Ut_CSatUiObserver::testGetInkey_data -// -// Connects to test object signal and verifies received data. -// ----------------------------------------------------------------------------- -void Ut_CSatUiObserver::testGetInkey_data() -{ - qDebug("Ut_CSatUiObserver::testGetInkey_data >"); - QTest::addColumn("text"); - QTest::addColumn("characterSet");//enum 0~3 - QTest::addColumn("input"); - QTest::addColumn("isHelpIsAvailable"); - QTest::addColumn("iconIdIdentifier"); - QTest::addColumn("iconIdQualifier");//enum 0~3 - QTest::addColumn("isRequestedIconDisplayed"); - QTest::addColumn("duration"); - QTest::addColumn("isImmediateDigitResponse"); - QTest::addColumn("expectValue"); - //// test ESatDigitOnly - QTest::newRow("first") << "Test GetInKey" << 0 << - "8" << false << 60 << 1 << false << 2500 << true << 0; - // null text && EIconGetYesNo - QTest::newRow("second") << "" << 0 << - "s" << false<< 60 << 1 << false << 2500 << true << 0; - // test EIconGetYesNo - QTest::newRow("third") << "Test GetInKey" << 3 << - "s" << false << 60 << 1 << false << 2500 << true << 0; - // test ESatCharSmsDefaultAlphabet - QTest::newRow("fourth") << "Test GetInKey" << 3 << - "$" << false << 60 << 1 << false << 2500 << true << 0; - // ino immediateDigitResponse - QTest::newRow("fifth") << "Test GetInKey" << 1 << - "#" << false<< 60 << 1 << false << 2500 << false << 0; - // test leave - //QTest::newRow("sisth") << "Test GetInKey" << 1 << - // "" << false << 60 << 1 << false << 2500 << true << 0; - qDebug("Ut_CSatUiObserver::testGetInkey_data <"); -} - -// ----------------------------------------------------------------------------- -// Ut_CSatUiObserver::testGetInkey -// -// Connects to test object signal and verifies received data. -// ----------------------------------------------------------------------------- -void Ut_CSatUiObserver::testGetInkey() -{ - qDebug("Ut_CSatUiObserver::testGetInkey >"); - QVERIFY(mSatObserver); - QFETCH(QString, text); - QFETCH(int, characterSet); - QFETCH(QString, input); - QFETCH(bool, isHelpIsAvailable); - QFETCH(int, iconIdIdentifier); - QFETCH(int, iconIdQualifier); - QFETCH(bool, isRequestedIconDisplayed); - QFETCH(int, duration); - QFETCH(bool, isImmediateDigitResponse); - QFETCH(int, expectValue); - - // text - HBufC* hText = HBufC::New(text.length()); - TPtr aText( hText->Des() ); - aText.Copy( text.utf16() ); - // aCharacterSet - TSatCharacterSet aCharacterSet = static_cast(characterSet); - // aInput - TBuf<1> tInput = input.utf16(); - TChar aInput(tInput[0]); - // aHelpIsAvailable - TBool aHelpIsAvailable(isHelpIsAvailable); - // aIconId - TSatIconId aIconId; - aIconId.iIdentifier = iconIdIdentifier; - aIconId.iIconQualifier = static_cast(iconIdQualifier); - // aRequestedIconDisplayed - TBool aRequestedIconDisplayed(isRequestedIconDisplayed); - // aDuration - TUint aDuration= static_cast(duration); - // aRequestedIconDisplayed - //TBool aImmediateDigitResponse(isImmediateDigitResponse); - - TSatUiResponse result(ESatSuccess); - QT_TRAP_THROWING( result = mSatObserver->GetInkeyL( - aText, - aCharacterSet, - aInput, - aHelpIsAvailable, - aIconId, - aRequestedIconDisplayed, - aDuration, - isImmediateDigitResponse - )); - delete hText; - hText = 0; - TSatUiResponse exValue = static_cast(expectValue); - QCOMPARE(exValue, result); - - qDebug("Ut_CSatUiObserver::testGetInkey <"); -} - -// ----------------------------------------------------------------------------- -// Ut_CSatUiObserver::testGetInput_data -// -// Connects to test object signal and verifies received data. -// ----------------------------------------------------------------------------- -void Ut_CSatUiObserver::testGetInput_data() -{ - qDebug("Ut_CSatUiObserver::testGetInput_data >"); - QTest::addColumn("text"); - QTest::addColumn("characterSet");//enum 0~3 - QTest::addColumn("input"); - QTest::addColumn("minLength"); - QTest::addColumn("maxLength"); - QTest::addColumn("isHideInput"); - QTest::addColumn("isHelpIsAvailable"); - QTest::addColumn("iconIdIdentifier"); - QTest::addColumn("iconIdQualifier");//enum 0~3 - QTest::addColumn("isRequestedIconDisplayed"); - QTest::addColumn("expectValue"); - // test characterSet ESatCharSmsDefaultAlphabet - QTest::newRow("first") << "Test GetInput" << 1 << - "get input" << 1 << 5 << false << false <<60 << 1 << true << 0; - // test iconIdQualifier ESatSelfExplanatory - QTest::newRow("second") << "Test GetInput" << 0 << - "get input" << 1 << 5 << false << false <<60 << 2 << true << 0; - // test leave - //QTest::newRow("third") << "Test GetInput" << 0 << - // "" << 1 << 5 << false << false <<60 << 2 << true << 0; - qDebug("Ut_CSatUiObserver::testGetInput_data <"); -} - -// ----------------------------------------------------------------------------- -// Ut_CSatUiObserver::testGetInput -// -// Connects to test object signal and verifies received data. -// ----------------------------------------------------------------------------- -void Ut_CSatUiObserver::testGetInput() -{ - qDebug("Ut_CSatUiObserver::testGetInput >"); - QVERIFY(mSatObserver); - QFETCH(QString, text); - QFETCH(int, characterSet); - QFETCH(QString, input); - QFETCH(int, minLength); - QFETCH(int, maxLength); - QFETCH(bool, isHideInput); - QFETCH(bool, isHelpIsAvailable); - QFETCH(int, iconIdIdentifier); - QFETCH(int, iconIdQualifier); - QFETCH(bool, isRequestedIconDisplayed); - QFETCH(int, expectValue); - - // text - HBufC* hText = HBufC::New(text.length()); - TPtr aText( hText->Des() ); - aText.Copy( text.utf16() ); - // aCharacterSet - TSatCharacterSet aCharacterSet = static_cast(characterSet); - // aInput - HBufC* hInput = HBufC::New(input.length()); - TPtr aInput( hInput->Des() ); - aInput.Copy( input.utf16() ); - // aIconId - TSatIconId aIconId; - aIconId.iIdentifier = iconIdIdentifier; - aIconId.iIconQualifier = static_cast(iconIdQualifier); - // aRequestedIconDisplayed - TBool aRequestedIconDisplayed(isRequestedIconDisplayed); - - TSatUiResponse result(ESatSuccess); - QT_TRAP_THROWING( result = mSatObserver->GetInputL( - aText, - aCharacterSet, - aInput, - minLength, - maxLength, - isHideInput, - isHelpIsAvailable, - aIconId, - aRequestedIconDisplayed - )); - delete hText; - hText = 0; - delete hInput; - hInput = 0; - TSatUiResponse exValue = static_cast(expectValue); - QCOMPARE(exValue, result); - qDebug("Ut_CSatUiObserver::testGetInput <"); -} - -// ----------------------------------------------------------------------------- -// Ut_CSatUiObserver::testConfirmCommand_data -// -// Connects to test object signal and verifies received data. -// ----------------------------------------------------------------------------- -void Ut_CSatUiObserver::testConfirmCommand_data() -{ - qDebug("Ut_CSatUiObserver::testConfirmCommand_data >"); - QTest::addColumn("commandId");// enum 0~6 - QTest::addColumn("alphaIdStatus"); - QTest::addColumn("text"); - QTest::addColumn("additionalText"); - QTest::addColumn("isctionAccepted"); - QTest::addColumn("iconIdIdentifier"); - QTest::addColumn("iconIdQualifier");//enum 0~3 - QTest::addColumn("isRequestedIconDisplayed"); - QTest::addColumn("isterminatedByUser"); - // test commandId ESatSSendSmQuery - QTest::newRow("first") << 0 << 1 << "ConfirmCommand SendSm" - << "SendSm" <"); - QVERIFY(mSatObserver); - QFETCH(int, commandId); - QFETCH(int, alphaIdStatus); - QFETCH(QString, text); - QFETCH(QString, additionalText); - QFETCH(bool, isctionAccepted); - QFETCH(int, iconIdIdentifier); - QFETCH(int, iconIdQualifier); - QFETCH(bool, isRequestedIconDisplayed); - QFETCH(bool, isterminatedByUser); - - // aCharacterSet - TSatSQueryCommand aCommandId = static_cast(commandId); - // aAlphaIdStatus - TSatAlphaIdStatus aAlphaIdStatus = static_cast(alphaIdStatus); - // text - HBufC* hText = HBufC::New(text.length()); - TPtr aText( hText->Des() ); - aText.Copy( text.utf16() ); - // aAdditionalText - HBufC* hAdditionalText = HBufC::New(additionalText.length()); - TPtr aAdditionalText( hAdditionalText->Des() ); - aAdditionalText.Copy( additionalText.utf16() ); - // aActionAccepted - TBool aActionAccepted(isctionAccepted); - // aIconId - TSatIconId aIconId; - aIconId.iIdentifier = iconIdIdentifier; - aIconId.iIconQualifier = static_cast(iconIdQualifier); - // aRequestedIconDisplayed - TBool aRequestedIconDisplayed(isRequestedIconDisplayed); - // aRequestedIconDisplayed - TBool aTerminatedByUser(isterminatedByUser); - - mSatObserver->ConfirmCommand( - aCommandId, - aAlphaIdStatus, - aText, - aAdditionalText, - aActionAccepted, - aIconId, - aRequestedIconDisplayed, - aTerminatedByUser - ); - delete hText; - hText = 0; - delete hAdditionalText; - hAdditionalText = 0; - qDebug("Ut_CSatUiObserver::testConfirmCommand <"); -} - -// ----------------------------------------------------------------------------- -// Ut_CSatUiObserver::testNotification_data -// -// Connects to test object signal and verifies received data. -// ----------------------------------------------------------------------------- -void Ut_CSatUiObserver::testNotification_data() -{ - qDebug("Ut_CSatUiObserver::testNotification_data >"); - QTest::addColumn("commandId");// enum 0~6 - QTest::addColumn("alphaIdStatus"); - QTest::addColumn("text"); - QTest::addColumn("iconIdIdentifier"); - QTest::addColumn("iconIdQualifier");//enum 0~3 - QTest::addColumn("isRequestedIconDisplayed"); - QTest::addColumn("controlResult"); - - // test commandId ESatSSendDataNotify - QTest::newRow("Senddata_0id") << 0 << 0 << "Send data notify" - << 2 << 0 << false <<0; - // test commandId ESatSSendDataNotify alpha id not null but string length is zero - QTest::newRow("Senddata_1id") << 0 << 1 << "" - << 2 << 0 << false <<0; - QTest::newRow("Senddata_2id") << 0 << 2 << "Send data notify AlphaIdNotProvided" - << 2 << 0 << false <<0; - // test commandId ESatSReceiveDataNotify - QTest::newRow("Recievedata_0id") << 1 << 0 << "Recieve data notify" - << 2 << 3 << false <<0; - QTest::newRow("Recievedata_1id") << 1 << 1 << "Recieve data notify" - << 2 << 3 << false <<0; - QTest::newRow("Recievedata_2id") << 1 << 2 << "Recieve data notify AlphaIdNotProvided" - << 2 << 3 << false <<0; - // test commandId ESatSCloseChannelNotify - QTest::newRow("CloseChannel_0id") << 2 << 0 << "Close channel notify" - << 2 << 3 << false <<0; - QTest::newRow("CloseChannel_1id") << 2 << 1 << "" - << 2 << 3 << false <<0; - QTest::newRow("CloseChannel_2id") << 2 << 2 << "Close channel notify AlphaIdNotProvided" - << 2 << 3 << false <<0; - // test commandId ESatSMoSmControlNotify - QTest::newRow("MoSm_0id") << 3 << 0 << "SM control notify" - << 2 << 0 << false <<0; - QTest::newRow("MoSm_1id") << 3 << 1 << "0" - << 2 << 0 << false <<0; - QTest::newRow("MoSm_2id") << 3 << 2 << "SM control notify AlphaIdNotProvided" - << 2 << 0 << false <<0; - // test commandId ESatSCallControlNotify - QTest::newRow("CallControl_0id") << 4 << 0 << "Call control notify" - << 2 << 1 << false <<0; - QTest::newRow("CallControl_1id") << 4 << 1 << "" - << 2 << 1 << false <<0; - QTest::newRow("CallControl_2id") << 4 << 2 << "Call control notify AlphaIdNotProvided" - << 2 << 1 << false <<0; - // test commandId ESatSSendSsNotify - QTest::newRow("SendSs_0id") << 5 << 0 << "Send SS notify" - << 2 << 2 << false <<0; - QTest::newRow("SendSs_1id") << 5 << 1 << "" - << 2 << 2 << false <<0; - QTest::newRow("SendSs_2id") << 5 << 2 << "Send SS notify AlphaIdNotProvided" - << 2 << 2 << false <<0; - // test commandId ESatSSendUssdNotify - QTest::newRow("SendUssd_0id") << 6 << 0 << "Send Ussd notify" - << 2 << 3 << false <<0; - // test commandId ESatSSendUssdNotify - QTest::newRow("SendUssd_1id") << 6 << 1 << "" - << 2 << 3 << false <<0; - // test commandId ESatSSendUssdNotify - QTest::newRow("SendUssd_2id") << 6 << 2 << "Send Ussd notify AlphaIdNotProvided" - << 2 << 3 << false <<0; - // test commandId ESatSSendDtmfNotify - QTest::newRow("SendDtmf_0id") << 7 << 0 << "Send dtmf notify" - << 2 << 3 << false <<0; - QTest::newRow("SendDtmf_1id") << 7 << 1 << "Send dtmf notify" - << 2 << 3 << false <<0; - QTest::newRow("SendDtmf_2id") << 7 << 2 << "Send dtmf notify AlphaIdNotProvided" - << 2 << 3 << false <<0; - // test commandId ESatSSendSmsNotify - QTest::newRow("SendSm_0id") << 8 << 0 << "SendSm notify" - << 2 << 2 << false <<0; - QTest::newRow("SendSm_1id") << 8 << 1 << "SendSm notify" - << 2 << 2 << false <<0; - QTest::newRow("SendSm_2id") << 8 << 2 << "SendSm notify AlphaIdNotProvided" - << 2 << 2 << false <<0; - qDebug("Ut_CSatUiObserver::testNotification_data <"); -} - -// ----------------------------------------------------------------------------- -// Ut_CSatUiObserver::testNotification -// -// Connects to test object signal and verifies received data. -// ----------------------------------------------------------------------------- -void Ut_CSatUiObserver::testNotification() -{ - qDebug("Ut_CSatUiObserver::testNotification >"); - QVERIFY(mSatObserver); - QFETCH(int, commandId); - QFETCH(int, alphaIdStatus); - QFETCH(QString, text); - QFETCH(int, iconIdIdentifier); - QFETCH(int, iconIdQualifier); - QFETCH(bool, isRequestedIconDisplayed); - QFETCH(int, controlResult); - - // aCommandId - TSatSNotifyCommand aCommandId = static_cast(commandId); - // aAlphaIdStatus - TSatAlphaIdStatus aAlphaIdStatus = static_cast(alphaIdStatus); - // text - HBufC* hText = HBufC::New(text.length()); - TPtr aText( hText->Des() ); - aText.Copy( text.utf16() ); - - // aIconId - TSatIconId aIconId; - aIconId.iIdentifier = iconIdIdentifier; - aIconId.iIconQualifier = static_cast(iconIdQualifier); - // aRequestedIconDisplayed - TBool aRequestedIconDisplayed(isRequestedIconDisplayed); - // aRequestedIconDisplayed - TSatControlResult aControlResult = static_cast(controlResult); - - mSatObserver->Notification( - aCommandId, - aAlphaIdStatus, - aText, - aIconId, - aRequestedIconDisplayed, - aControlResult - ); - delete hText; - hText = 0; - qDebug("Ut_CSatUiObserver::testNotification <"); -} - -// ----------------------------------------------------------------------------- -// Ut_CSatUiObserver::testEventNotification_data -// -// Connects to test object signal and verifies received data. -// ----------------------------------------------------------------------------- -void Ut_CSatUiObserver::testEventNotification_data() -{ - qDebug("Ut_CSatUiObserver::testEventNotification_data >"); - QTest::addColumn("eventId");// enum 0~6 - - // test eventId ESatSRefreshStartEvent - QTest::newRow("RefreshStartEvent") << 0 ; - // test eventId ESatSRefreshEndEvent - QTest::newRow("RefreshEndEvent") << 1; - // test eventId ESatSSmEndEvent - QTest::newRow("SSmEndEvent") << 2; - // test eventId ESatSClearScreenEvent - QTest::newRow("ClearScreenEvent") << 3; - // test eventId ESatSCloseSatUiAppEvent - QTest::newRow("CloseSatUiAppEvent") << 4; - // test eventId ESatSsEndEvent - QTest::newRow("SsEndEvent") << 5; - // test eventId ESatSsErrorEvent - QTest::newRow("SsErrorEvent") << 6; - // test eventId ESatSDtmfEndEvent - QTest::newRow("DtmfEndEvent") << 7; - - qDebug("Ut_CSatUiObserver::testEventNotification_data <"); -} - -// ----------------------------------------------------------------------------- -// Ut_CSatUiObserver::testEventNotification -// -// Connects to test object signal and verifies received data. -// ----------------------------------------------------------------------------- -void Ut_CSatUiObserver::testEventNotification() -{ - qDebug("Ut_CSatUiObserver::testEventNotification >"); - QVERIFY(mSatObserver); - QFETCH(int, eventId); - - TSatSEvent aEventId = static_cast(eventId); - TSatSEventStatus aEventStatus = ESatEventCompleteOk; - mSatObserver->EventNotification(aEventId, aEventStatus, 0); - qDebug("Ut_CSatUiObserver::testEventNotification <"); -} - -// ----------------------------------------------------------------------------- -// Ut_CSatUiObserver::testSelectItem_data -// -// Connects to test object signal and verifies received data. -// ----------------------------------------------------------------------------- -void Ut_CSatUiObserver::testSelectItem_data() -{ - qDebug("Ut_CSatUiObserver::testSelectItem_data >"); - QTest::addColumn("text"); - QTest::addColumn("selectItemItem"); - QTest::addColumn("defaultItem"); - QTest::addColumn("isHelpIsAvailable"); - QTest::addColumn("iconIdIdentifier"); - QTest::addColumn("iconIdQualifier");//enum 0~3 - QTest::addColumn("iconListQualifier"); - QTest::addColumn("expectReturnValue"); - - QStringList testSelectItem_1_items; - testSelectItem_1_items - << "Select Item 1" - << "Select Item 2" - << "Select Item 3" - << "Select Item 4" - << "Select Item 5"; - - QTest::newRow("first") << "Make a Choice" << testSelectItem_1_items << - 0 << false << 80 << 1 << 2 << 0; - - qDebug("Ut_CSatUiObserver::testSelectItem_data <"); -} - -// ----------------------------------------------------------------------------- -// Ut_CSatUiObserver::testSetUpMenu -// -// Connects to test object signal and verifies received data. -// ----------------------------------------------------------------------------- -void Ut_CSatUiObserver::testSelectItem() -{ - qDebug("Ut_CSatUiObserver::testSelectItem >"); - QVERIFY(mSatObserver); - QFETCH(QString, text); - QFETCH(QStringList, selectItemItem); - QFETCH(int, defaultItem); - QFETCH(bool, isHelpIsAvailable); - QFETCH(int, iconIdIdentifier); - QFETCH(int, iconIdQualifier); - QFETCH(int, iconListQualifier); - QFETCH(int, expectReturnValue); - - // aText - HBufC* hText = HBufC::New(text.length()); - TPtr aText( hText->Des() ); - aText.Copy( text.utf16() ); - // aMenuItems - TBuf<128> menuItem; - CDesCArrayFlat* aMenuItems = new CDesCArrayFlat(4); - QVERIFY(aMenuItems); - for (int i = 0; i< selectItemItem.count(); i++) { - menuItem = selectItemItem.at(i).utf16(); - QT_TRAP_THROWING(aMenuItems->AppendL(menuItem)); - } - - TUint8 aSelectedItem( 1 ); - // aIconId - TSatIconId aIconId; - aIconId.iIdentifier = iconIdIdentifier; - aIconId.iIconQualifier = static_cast(iconIdQualifier); - // aMenuItemNextActions - CArrayFixFlat* aMenuItemNextActions = - new CArrayFixFlat (4); - QVERIFY(aMenuItemNextActions); - // Temp test - QT_TRAP_THROWING(aMenuItemNextActions->AppendL(ESatSelectItemAction)); - // aMenuIcons - CArrayFixFlat* aMenuIcons = new CArrayFixFlat(2); - QVERIFY(aMenuIcons); - // Temp test - QT_TRAP_THROWING(aMenuIcons->AppendL(1)); - // aIconListQualifier - TSatIconQualifier aIconListQualifier = - static_cast(iconListQualifier); - // TSatSelectionPreference, useless - TSatSelectionPreference aSelectionPreference(ESatNoSelectionPreference); - TBool aRequestIconDisplayed (EFalse); - - TSatUiResponse result(ESatSuccess); - QT_TRAP_THROWING(result = mSatObserver->SelectItemL( - aText, - *aMenuItems, - aMenuItemNextActions, - defaultItem, - aSelectedItem, - isHelpIsAvailable, - aIconId, - aMenuIcons, - aIconListQualifier, - aRequestIconDisplayed, - aSelectionPreference - )); - TSatUiResponse exValue = static_cast(expectReturnValue); - QCOMPARE(exValue, result); - - delete hText; - hText = 0; - delete aMenuItems; - aMenuItems = 0; - delete aMenuItemNextActions; - aMenuItemNextActions = 0; - delete aMenuIcons; - aMenuIcons = 0; - qDebug("Ut_CSatUiObserver::testSelectItem <"); -} - -// ----------------------------------------------------------------------------- -// Ut_CSatUiObserver::testSetUpMenu -// -// Connects to test object signal and verifies received data. -// ----------------------------------------------------------------------------- -void Ut_CSatUiObserver::testPlayTone_data() -{ - qDebug("Ut_CSatUiObserver::testPlayTone_data >"); - QTest::addColumn("text");//enum 0~3 - QTest::addColumn("satTone"); - QTest::addColumn("duration"); - QTest::addColumn("iconIdIdentifier"); - QTest::addColumn("iconIdQualifier");//enum 0~3 - QTest::addColumn("isRequestedIconDisplayed"); - QTest::addColumn("expectReturnValue"); - QTest::newRow("Response_Failure") << "PlayStandardTone" << 100 << - 0 << 80 << 1 << false << -1; - QTest::newRow("ToneNotSet") << "PlayStandardTone" << -1 << - 0 << 80<< 0 << false << 0; - QTest::newRow("DialTone_0") << "PlayStandardTone" << 1 << - 0 << 80<< 1 << false << 0; - QTest::newRow("DialTone_2000") << "PlayStandardTone" << 1 << - 2000 << 80 << 2 << false << 0; - QTest::newRow("DialTone_true") << "PlayStandardTone" << 1 << - 2000 << 80 << 3 << true << 0; - QTest::newRow("Busy") << "PlayStandardTone" << 2 << - 2000 << 80 << 3 << false << 0; - QTest::newRow("Congestion") << "PlayStandardTone" << 3 << - 25000 << 80 << 3 << false << 0; - QTest::newRow("Congestion_0") << "PlayStandardTone" << 3 << - 0 << 80 << 3 << false << 0; - QTest::newRow("Acknowledge ") << "PlayStandardTone" << 4 << - 25000 << 80 << 3 << false << 0; - QTest::newRow("Acknowledge_0") << "PlayStandardTone" << 4 << - 0 << 80 << 3 << false << 0; - QTest::newRow("CallDropped") << "PlayStandardTone" << 5 << - 25000 << 80 << 1 << false << 0; - QTest::newRow("CallDropped_0") << "PlayStandardTone" << 5 << - 0 << 80 << 1 << false << 0; - QTest::newRow("SpecialInfo") << "PlayStandardTone" << 6 << - 25000 << 80 << 1 << false << 0; - QTest::newRow("SpecialInfo_0") << "PlayStandardTone" << 6 << - 0 << 80 << 1 << false << 0; - QTest::newRow("WaitingTone") << "PlayStandardTone" << 7 << - 25000 << 80 << 1 << false << 0; - QTest::newRow("WaitingTone_0") << "PlayStandardTone" << 7 << - 0 << 80 << 1 << false << 0; - QTest::newRow("RingingTone") << "PlayStandardTone" << 8 << - 25000 << 80 << 1 << false << 0; - QTest::newRow("RingingTone_0") << "PlayStandardTone" << 8 << - 0 << 80 << 1 << false << 0; - QTest::newRow("GeneralBeep") << "PlayStandardTone" << 16 << - 25000 << 80 << 1 << false << 0; - QTest::newRow("GeneralBeep_0") << "PlayStandardTone" << 16 << - 0 << 80 << 1 << false << 0; - QTest::newRow("PositiveTone") << "PlayStandardTone" << 17 << - 25000 << 80 << 1 << false << 0; - QTest::newRow("PositiveTone_0") << "PlayStandardTone" << 17 << - 0 << 80 << 1 << false << 0; - QTest::newRow("NegativeTone") << "PlayStandardTone" << 18 << - 25000 << 80 << 1 << false << 0; - QTest::newRow("NegativeTone_0") << "PlayStandardTone" << 18 << - 0 << 80 << 1 << false << 0; - QTest::newRow("Speech") << "PlayStandardTone" << 19 << - 25000 << 80 << 1 << false << 0; - QTest::newRow("Speech_0") << "PlayStandardTone" << 19 << - 25000 << 80 << 1 << false << 0; - QTest::newRow("Sms") << "PlayStandardTone" << 20 << - 25000 << 80 << 1 << false << 0; - QTest::newRow("Sms_0") << "PlayStandardTone" << 20 << - 0 << 80 << 1 << false << 0; - QTest::newRow("Busy_0") << "PlayStandardTone" << 2 << - 0 << 80 << 3 << false << 0; - qDebug("Ut_CSatUiObserver::testPlayTone_data <"); -} - - -// ----------------------------------------------------------------------------- -// Ut_CSatUiObserver::testSetUpMenu -// -// Connects to test object signal and verifies received data. -// ----------------------------------------------------------------------------- -void Ut_CSatUiObserver::testPlayTone() -{ - qDebug("Ut_CSatUiObserver::testPlayTone >"); - QVERIFY(mSatObserver); - QFETCH(QString, text); - QFETCH(int, duration); - QFETCH(int, satTone); - QFETCH(int, iconIdIdentifier); - QFETCH(int, iconIdQualifier); - QFETCH(bool, isRequestedIconDisplayed); - QFETCH(int, expectReturnValue); - qDebug("Ut_CSatUiObserver::testPlayTone after fetch"); - // text - HBufC* hText = HBufC::New(text.length()); - TPtr aText( hText->Des() ); - aText.Copy( text.utf16() ); - // aTone - TSatTone aTone = static_cast(satTone); - // aDuration - TUint aDuration= static_cast(duration); - // aIconId - TSatIconId aIconId; - aIconId.iIdentifier = iconIdIdentifier; - aIconId.iIconQualifier = static_cast(iconIdQualifier); - // aRequestedIconDisplayed - TBool aRequestedIconDisplayed(isRequestedIconDisplayed); - qDebug("Ut_CSatUiObserver::testPlayTone call observer"); - TSatUiResponse result(ESatSuccess); - result = mSatObserver->PlayTone( - aText, - aTone, - aDuration, - aIconId, - aRequestedIconDisplayed - ); - TSatUiResponse exValue = static_cast(expectReturnValue); - QCOMPARE(exValue, result); - delete hText; - hText = 0; - qDebug("Ut_CSatUiObserver::testPlayTone <"); -} - -// End of file diff -r 1f002146abb4 -r cee7e9e0906c satui/satapp/tsrc/ut_satapp/src/ut_playtoneprovider.cpp --- a/satui/satapp/tsrc/ut_satapp/src/ut_playtoneprovider.cpp Tue Jul 06 14:53:02 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,287 +0,0 @@ -/* -* Copyright (c) 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" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Unit test for satappmainhandler -* -*/ - - -#include -#include "ut_playtoneprovider.h" -//test class -#include "satappplaytoneprovider.h" - -// ----------------------------------------------------------------------------- -// Ut_SatAppPlayToneProvider::Ut_SatAppPlayToneProvider -// ----------------------------------------------------------------------------- -// -Ut_SatAppPlayToneProvider::Ut_SatAppPlayToneProvider(QObject *parent):QObject(parent) -{ - qDebug("Ut_SatAppPlayToneProvider::Ut_SatAppPlayToneProvider >"); - qDebug("Ut_SatAppPlayToneProvider::Ut_SatAppPlayToneProvider <"); -} - -// ----------------------------------------------------------------------------- -// Ut_SatAppPlayToneProvider::~Ut_SatAppPlayToneProvider -// ----------------------------------------------------------------------------- -// -Ut_SatAppPlayToneProvider::~Ut_SatAppPlayToneProvider() -{ - qDebug("Ut_SatAppPlayToneProvider::~Ut_SatAppPlayToneProvider >"); - qDebug("Ut_SatAppPlayToneProvider::~Ut_SatAppPlayToneProvider <"); -} - -// ----------------------------------------------------------------------------- -// Ut_SatAppPlayToneProvider::initTestCase -// QTestLib cleanup method, called after the last testfunction . -// ----------------------------------------------------------------------------- -void Ut_SatAppPlayToneProvider::initTestCase() -{ - qDebug("Ut_SatAppPlayToneProvider::initTestCase >"); - qDebug("Ut_SatAppPlayToneProvider::initTestCase <"); -} - - -// ----------------------------------------------------------------------------- -// Ut_SatAppPlayToneProvider::cleanupTestCase -// -// Connects to test object signal and verifies received data. -// ----------------------------------------------------------------------------- -void Ut_SatAppPlayToneProvider::cleanupTestCase() -{ - qDebug("Ut_SatAppPlayToneProvider::cleanupTestCase >"); - if (mPlayTone) { - qDebug("Ut_SatAppPlayToneProvider::cleanupTestCase delete mPlayTone..."); - delete mPlayTone; - mPlayTone = 0; - } - qDebug("Ut_SatAppPlayToneProvider::cleanupTestCase <"); -} - -// ----------------------------------------------------------------------------- -// Ut_SatAppPlayToneProvider::testCreatePlayTone -// -// Connects to test object signal and verifies received data. -// ----------------------------------------------------------------------------- -void Ut_SatAppPlayToneProvider::testCreatePlayTone() -{ - qDebug("Ut_SatAppPlayToneProvider::testCreatePlayTone >"); - mPlayTone = new SatAppPlayToneProvider(); - QVERIFY(mPlayTone); - qDebug("Ut_SatAppPlayToneProvider::testCreatePlayTone <"); -} - -// ----------------------------------------------------------------------------- -// Ut_SatAppPlayToneProvider::testPlayStandardTone_data -// -// Connects to test object signal and verifies received data. -// ----------------------------------------------------------------------------- -void Ut_SatAppPlayToneProvider::testPlayStandardTone_data() -{ - qDebug("Ut_SatAppPlayToneProvider::testPlayStandardTone_data >"); - QTest::addColumn("text");//enum 0~3 - QTest::addColumn("duration"); - QTest::addColumn("isRequestedIconDisplayed"); - QTest::addColumn("expectReturnValue"); - // test duration 0 - QTest::newRow("duration_0") << "Play Standard tone" << 0 << false << 0; - QTest::newRow("duration") << "Play Standard tone" << 1000000 << false << 0; - QTest::newRow("textnull") << "" << 10000000 << false << 0; - qDebug("Ut_SatAppPlayToneProvider::testPlayStandardTone_data <"); -} - -// ----------------------------------------------------------------------------- -// Ut_SatAppPlayToneProvider::testPlayStandardTone -// -// Connects to test object signal and verifies received data. -// ----------------------------------------------------------------------------- -void Ut_SatAppPlayToneProvider::testPlayStandardTone() -{ - qDebug("Ut_SatAppPlayToneProvider::testPlayStandardTone >"); - QVERIFY(mPlayTone); - QFETCH(QString, text); - QFETCH(int, duration); - QFETCH(bool, isRequestedIconDisplayed); - QFETCH(int, expectReturnValue); - qDebug("Ut_SatAppPlayToneProvider::testPlayTone after fetch"); - // text - HBufC* hText = HBufC::New(text.length()); - TPtr aText( hText->Des() ); - aText.Copy( text.utf16() ); - // text - _LIT( KPlayToneSequence, "Play tone sequence"); - TBuf8<32> aSequence; - aSequence.Copy(KPlayToneSequence); - - // aDuration - TUint aDuration= static_cast(duration); - CFbsBitmap* bitmap(NULL); - qDebug("Ut_SatAppPlayToneProvider::testPlayStandardTone call"); - TSatUiResponse result(ESatSuccess); - TRAPD(err, result = mPlayTone->PlayStandardToneL( - aText, - aSequence, - aDuration, - bitmap, - isRequestedIconDisplayed)); - QCOMPARE(KErrNone, err); - TSatUiResponse exValue = static_cast(expectReturnValue); - QCOMPARE(exValue, result); - delete hText; - qDebug("Ut_SatAppPlayToneProvider::testPlayStandardTone <"); -} - -// ----------------------------------------------------------------------------- -// Ut_SatAppPlayToneProvider::testPlayUserSelectedTone_data -// -// Connects to test object signal and verifies received data. -// ----------------------------------------------------------------------------- -void Ut_SatAppPlayToneProvider::testPlayUserSelectedTone_data() -{ - qDebug("Ut_SatAppPlayToneProvider::testPlayUserSelectedTone_data >"); - QTest::addColumn("text");//enum 0~3 - QTest::addColumn("duration"); - QTest::addColumn("satTone"); - QTest::addColumn("isaSelfExplanatory"); - QTest::addColumn("expectReturnValue"); - //QTest::newRow("duration_0") << "Play UserSelectedTone" << 0 << 1 <"); - QVERIFY(mPlayTone); - QFETCH(QString, text); - QFETCH(int, duration); - QFETCH(int, satTone); - QFETCH(bool, isaSelfExplanatory); - QFETCH(int, expectReturnValue); - qDebug("Ut_SatAppPlayToneProvider::testPlayTone after fetch"); - // text - HBufC* hText = HBufC::New(text.length()); - TPtr aText( hText->Des() ); - aText.Copy( text.utf16() ); - // aTone - TSatTone aTone = static_cast(satTone); - // aDuration - TUint aDuration= static_cast(duration); - CFbsBitmap* bitmap(NULL); - TBool aSelfExplanatory(isaSelfExplanatory); - TSatUiResponse result(ESatSuccess); - TRAPD(err, result = mPlayTone->PlayUserSelectedToneL( - aText, - aDuration, - aTone, - bitmap, - aSelfExplanatory )); - QCOMPARE(KErrNone, err); - delete hText; - hText = 0; - TSatUiResponse exValue = static_cast(expectReturnValue); - QCOMPARE(exValue, result); - qDebug("Ut_SatAppPlayToneProvider::testPlayUserSelectedTone <"); -} - -// ----------------------------------------------------------------------------- -// Ut_SatAppPlayToneProvider::testPlayUserSelectedTone -// -// Connects to test object signal and verifies received data. -// ----------------------------------------------------------------------------- -void Ut_SatAppPlayToneProvider::testCloseSatUI() -{ - qDebug("Ut_SatAppPlayToneProvider::closeSatUI >"); - QVERIFY(mPlayTone); - mPlayTone->closeSatUI(); - qDebug("Ut_SatAppPlayToneProvider::closeSatUI <"); -} - -// ----------------------------------------------------------------------------- -// Ut_SatAppPlayToneProvider::testPlayUserSelectedTone -// -// Connects to test object signal and verifies received data. -// ----------------------------------------------------------------------------- -void Ut_SatAppPlayToneProvider::testClearScreen() -{ - qDebug("Ut_SatAppPlayToneProvider::clearScreen >"); - QVERIFY(mPlayTone); - mPlayTone->clearScreen(); - qDebug("Ut_SatAppPlayToneProvider::clearScreen <"); -} - -// ----------------------------------------------------------------------------- -// Ut_SatAppPlayToneProvider::testMapcPlayComplete_data -// -// Connects to test object signal and verifies received data. -// ----------------------------------------------------------------------------- -void Ut_SatAppPlayToneProvider::testMapcPlayComplete_data() -{ - qDebug("Ut_SatAppPlayToneProvider::testMapcPlayComplete_data >"); - QTest::addColumn("error"); - QTest::newRow("error_0") << 0; - QTest::newRow("error_-6") << -6; - qDebug("Ut_SatAppPlayToneProvider::testMapcPlayComplete_data <"); -} - -// ----------------------------------------------------------------------------- -// Ut_SatAppPlayToneProvider::testMapcPlayComplete -// -// Connects to test object signal and verifies received data. -// ----------------------------------------------------------------------------- -void Ut_SatAppPlayToneProvider::testMapcPlayComplete() -{ - qDebug("Ut_SatAppPlayToneProvider::testMapcPlayComplete >"); - QVERIFY(mPlayTone); - QFETCH(int, error); - mPlayTone->MapcPlayComplete(error); - qDebug("Ut_SatAppPlayToneProvider::testMapcPlayComplete <"); -} - -// ----------------------------------------------------------------------------- -// Ut_SatAppPlayToneProvider::testMapcInitComplete_data -// -// Connects to test object signal and verifies received data. -// ----------------------------------------------------------------------------- -void Ut_SatAppPlayToneProvider::testMapcInitComplete_data() -{ - qDebug("Ut_SatAppPlayToneProvider::testMapcInitComplete_data >"); - QTest::addColumn("error"); - QTest::newRow("error_0") << 0; - QTest::newRow("error_-6") << -6; - qDebug("Ut_SatAppPlayToneProvider::testMapcInitComplete_data <"); -} - -// ----------------------------------------------------------------------------- -// Ut_SatAppPlayToneProvider::testMapcInitComplete -// -// Connects to test object signal and verifies received data. -// ----------------------------------------------------------------------------- -void Ut_SatAppPlayToneProvider::testMapcInitComplete() -{ - qDebug("Ut_SatAppPlayToneProvider::testMapcInitComplete >"); - QVERIFY(mPlayTone); - QFETCH(int, error); - mPlayTone->MapcInitComplete(error, 0); - qDebug("Ut_SatAppPlayToneProvider::testMapcInitComplete <"); -} - -// End of file - diff -r 1f002146abb4 -r cee7e9e0906c satui/satapp/tsrc/ut_satapp/src/ut_satappaction.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/satui/satapp/tsrc/ut_satapp/src/ut_satappaction.cpp Wed Aug 18 10:19:22 2010 +0300 @@ -0,0 +1,201 @@ +/* +* Copyright (c) 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" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Unit test for satappmainhandler +* +*/ + +#include +#include +#include + +#include +#include + +#include "ut_satappaction.h" +#include "satappaction.h" + + + +// -------------------------------------------------------- +// The unit tests begin here +// -------------------------------------------------------- + +Ut_SatAppAction::Ut_SatAppAction(QObject *parent) + :QObject(parent) +{ +} + + +void Ut_SatAppAction::testAction() +{ + SatAppAction a(ESatDisplayTextAction); + SatAppAction b(ESatGetInputAction); + SatAppAction c(ESatPlayToneAction); + + QCOMPARE(a.action(),(int)ESatDisplayTextAction); + QCOMPARE(b.action(),(int)ESatGetInputAction); + QCOMPARE(c.action(),(int)ESatPlayToneAction); + +} + +void Ut_SatAppAction::testParams() +{ + SatAppAction a(ESatDisplayTextAction); + // qvariant + a.set(KeyText, QVariant("hello")); + QCOMPARE(a.value(KeyText).toString(),QString("hello")); + + // int + a.set(KeyMinLength, 25); + QCOMPARE(a.value(KeyMinLength).toInt(),25); + + // string + a.set(KeyInputString,_L("kiss")); + QCOMPARE(a.value(KeyInputString).toString(),QString("kiss")); + + // descriptor array + CDesCArrayFlat* array1 = new CDesCArrayFlat(8); + array1->AppendL(_L("item_0")); + array1->AppendL(_L("item_1")); + array1->AppendL(_L("item_2")); + a.set(KeyMenu,*array1); + QList list1 = a.value(KeyMenu).toList(); + QCOMPARE(list1.size(), 3); + QCOMPARE(list1[0].toString(), QString("item_0")); + QCOMPARE(list1[1].toString(), QString("item_1")); + QCOMPARE(list1[2].toString(), QString("item_2")); + + // int array + CArrayFixFlat* array2 = new CArrayFixFlat(8); + array2->AppendL(1); + array2->AppendL(2); + array2->AppendL(3); + a.set(KeyIconIdArray,*array2); + QList list2 = a.value(KeyIconIdArray).toList(); + QCOMPARE(list2.size(), 3); + QCOMPARE(list2[0].toInt(), 1); + QCOMPARE(list2[1].toInt(), 2); + QCOMPARE(list2[2].toInt(), 3); + + // TTimeIntervalSeconds + TTimeIntervalSeconds seconds(3); + a.set(KeyDuration,seconds); + QCOMPARE(a.value(KeyDuration).toInt(),3000); + + // TTimeIntervalMicroSeconds + TTimeIntervalMicroSeconds ysec(TInt64(500000)); + a.set(KeyDuration,ysec); + QCOMPARE(a.value(KeyDuration).toInt(),500); + + // test hasValue + QVERIFY(a.hasValue(KeyText)); + QVERIFY(a.hasValue(KeyMinLength)); + QVERIFY(a.hasValue(KeyInputString)); + QVERIFY(a.hasValue(KeyMenu)); + QVERIFY(a.hasValue(KeyIconIdArray)); + QVERIFY(a.hasValue(KeyDuration)); + QVERIFY(!a.hasValue(KeyHelpRequested)); // <-- not set + QVERIFY(!a.hasValue(KeyHelpRequested)); // <-- not set + QVERIFY(!a.hasValue(KeyCharacterSet)); // <-- not set + QVERIFY(!a.hasValue(QString("billy the kid"))); // <-- definitely not set +} + +void Ut_SatAppAction::testComplete() +{ + SatAppAction a(ESatDisplayTextAction); + SatAppAction b(ESatGetInputAction); + SatAppAction c(ESatPlayToneAction); + SatAppAction d(ESatPlayToneAction); + SatAppAction e(ESatPlayToneAction); + a.complete(); + b.completeWithSuccess(); + c.completeWithFailure(); + d.completeWithBackRequested(); + e.completeWithSessionTerminated(); + QCOMPARE(a.response(),ESatNoResponseFromUser); + QCOMPARE(b.response(),ESatSuccess); + QCOMPARE(c.response(),ESatFailure); + QCOMPARE(d.response(),ESatBackwardModeRequestedByUser); + QCOMPARE(e.response(),ESatSessionTerminatedByUser); +} + +void Ut_SatAppAction::testCompleteSignal() +{ + SatAppAction a(ESatDisplayTextAction); + SatAppAction b(ESatGetInputAction); + SatAppAction c(ESatPlayToneAction); + SatAppAction d(ESatPlayToneAction); + SatAppAction e(ESatPlayToneAction); + ActionHelper x; + connect(&a, SIGNAL(actionCompleted(SatAppAction*)), &x, SLOT(inc())); + connect(&b, SIGNAL(actionCompleted(SatAppAction*)), &x, SLOT(inc())); + connect(&c, SIGNAL(actionCompleted(SatAppAction*)), &x, SLOT(inc())); + connect(&d, SIGNAL(actionCompleted(SatAppAction*)), &x, SLOT(inc())); + connect(&e, SIGNAL(actionCompleted(SatAppAction*)), &x, SLOT(inc())); + a.complete(); + b.completeWithSuccess(); + c.completeWithFailure(); + d.completeWithBackRequested(); + e.completeWithSessionTerminated(); + QCOMPARE(x.count(),5); +} + +void Ut_SatAppAction::testDoubleComplete() +{ + SatAppAction a(ESatDisplayTextAction); + a.completeWithSuccess(); + QCOMPARE(a.response(),ESatSuccess); + a.completeWithFailure(); // <-- no effect because already completed + QCOMPARE(a.response(),ESatSuccess); // <-- still in same state! +} + +void Ut_SatAppAction::testAsyncActionRobustness() +{ + // this function tests if an action can be safely deleted in the "completed" + // slot, at the same time testing robustness and memory leaks by repeating + // the sequence multiple times + ActionHelper x; + for(int i=0; i<10000; ++i) + { + SatAppAction* a = new SatAppAction(ESatDisplayTextAction, this); + connect(a,SIGNAL(actionCompleted(SatAppAction*)),&x,SLOT(del(SatAppAction*))); + a->complete(); + } +} + + +void Ut_SatAppAction::testWait() +{ + SatAppAction a(ESatDisplayTextAction); + QTimer::singleShot(1000, &a, SLOT(completeWithSuccess())); + // this should last 1 second + a.waitUntilCompleted(); + QCOMPARE(a.response(),ESatSuccess); + + // this should flow through directly, because already completed + a.waitUntilCompleted(); + QCOMPARE(a.response(),ESatSuccess); // <-- response remains unchanged + +} + + + +// helper +void ActionHelper::del(SatAppAction* action) +{ + delete action; +} + + +// End of file diff -r 1f002146abb4 -r cee7e9e0906c satui/satapp/tsrc/ut_satapp/src/ut_satappconfirmprovider.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/satui/satapp/tsrc/ut_satapp/src/ut_satappconfirmprovider.cpp Wed Aug 18 10:19:22 2010 +0300 @@ -0,0 +1,193 @@ +/* +* Copyright (c) 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" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Unit test for satappmainhandler +* +*/ + +#include +#include + +#include + +#include "ut_satappconfirmprovider.h" +#include "satappconfirmprovider.h" +#include "satappaction.h" + +// -------------------------------------------------------- +// The unit tests begin here +// -------------------------------------------------------- + +Ut_SatAppConfirmProvider::Ut_SatAppConfirmProvider( + QObject *parent) + :QObject(parent) +{ +} + +void Ut_SatAppConfirmProvider::testConfirmCommand_data() +{ + QTest::addColumn("commandId"); + QTest::addColumn("alphaIdStatus"); + QTest::addColumn("text"); + QTest::addColumn("additionText"); + QTest::addColumn("userAccepted"); + QTest::addColumn("expectRes"); + + + QTest::newRow("t01") << (int)ESatOpenChannelQuery << (int)ESatAlphaIdNull + << "comfrm" << "addition"<< false << false; + QTest::newRow("t02") << (int)ESatOpenChannelQuery << (int)ESatAlphaIdNotProvided + << "comfrm" << "addition"<< true << true; + QTest::newRow("t03") << (int)ESatOpenChannelQuery << (int)ESatAlphaIdNotProvided + << "" << "addition"<< true << true; + QTest::newRow("t04") << (int)ESatOpenChannelQuery << (int)ESatAlphaIdNotProvided + << "comfrm" << ""<< true << true; + QTest::newRow("t05") << (int)ESatSSendSmQuery << (int)ESatAlphaIdNull + << "comfrm" << "addition"<< true << true; + QTest::newRow("t06") << (int)ESatSSetUpCallQuery << (int)ESatAlphaIdNull + << "comfrm" << "addition"<< true << true; + QTest::newRow("t07") << (int)ESatSSetUpCallQuery << (int)ESatAlphaIdNull + << "" << "addition"<< true << true; + QTest::newRow("t08") << (int)ESatSSetUpCallQuery << (int)ESatAlphaIdNull + << "" << ""<< true << true; + QTest::newRow("t09") << (int)ESatSLaunchBrowserQuery << (int)ESatAlphaIdNull + << "" << ""<< true << true; + QTest::newRow("t10") << (int)ESatSLaunchBrowserQuery << (int)ESatAlphaIdNotProvided + << "" << ""<< true << true; + QTest::newRow("t11") << (int)ESatSLaunchBrowserQuery << (int)ESatAlphaIdNull + << "" << ""<< true << true; + QTest::newRow("t12") << 10 << (int)ESatAlphaIdNull + << "" << ""<< true << true; + QTest::newRow("t05") << (int)ESatSSendUssdQuery << (int)ESatAlphaIdNull + << "comfrm" << "addition"<< true << true; + QTest::newRow("t05") << (int)ESatSSendSsQuery << (int)ESatAlphaIdNull + << "comfrm" << "addition"<< true << true; + QTest::newRow("t05") << (int)ESatSRefreshQuery << (int)ESatAlphaIdNull + << "comfrm" << "addition"<< true << true; +} + + +void Ut_SatAppConfirmProvider::testConfirmCommand() +{ + QFETCH(int, commandId); + QFETCH(int, alphaIdStatus); + QFETCH(QString, text); + QFETCH(QString, additionText); + QFETCH(bool, userAccepted); + QFETCH(bool, expectRes); + + SatAppAction action(ESatConfirmAction); + action.set(KeyQueryCommandId, commandId); + action.set(KeyAlphaIdStatus, alphaIdStatus); + action.set(KeyText, text); + action.set(KeyAdditionalText, additionText); + action.set(KeyActionAccepted, userAccepted); + + ConfirmProviderTest test; + QTimer::singleShot(1000, &test, SLOT(simulateFirstActionClicked())); + test.mConfirm->confirmCommand(action); + QCOMPARE(userAccepted,expectRes); +} + +void Ut_SatAppConfirmProvider::testConfirmFirstAction() +{ + ConfirmProviderTest test; + + SatAppAction action(ESatConfirmAction); + action.set(KeyQueryCommandId, ESatOpenChannelQuery); + action.set(KeyAlphaIdStatus, ESatAlphaIdNull); + action.set(KeyText, "OpenChannel"); + action.set(KeyAdditionalText, "yes"); + test.mConfirm->confirmCommand(action); + QTimer::singleShot(1000, &test, SLOT(simulateFirstActionClicked())); + action.waitUntilCompleted(); + QCOMPARE(action.response(), ESatSuccess); +} + +void Ut_SatAppConfirmProvider::testConfirmSecondAction() +{ + ConfirmProviderTest test; + + SatAppAction action(ESatConfirmAction); + action.set(KeyQueryCommandId, ESatOpenChannelQuery); + action.set(KeyAlphaIdStatus, ESatAlphaIdNull); + action.set(KeyText, "OpenChannel"); + action.set(KeyAdditionalText, "No"); + test.mConfirm->confirmCommand(action); + QTimer::singleShot(1000, &test, SLOT(simulateSecondActionClicked())); + action.waitUntilCompleted(); + QCOMPARE(action.response(), ESatBackwardModeRequestedByUser); +} + + +void Ut_SatAppConfirmProvider::testConfirmAndClearScreen() +{ + ConfirmProviderTest test; + + SatAppAction action(ESatConfirmAction); + action.set(KeyQueryCommandId, ESatOpenChannelQuery); + action.set(KeyAlphaIdStatus, ESatAlphaIdNull); + action.set(KeyText, "OpenChannel"); + action.set(KeyAdditionalText, "ClearScreen"); + test.mConfirm->confirmCommand(action); + QTimer::singleShot(1000, &test, SLOT(simulateClearScreen())); + action.waitUntilCompleted(); + QCOMPARE(action.response(), ESatNoResponseFromUser); + + action.set(KeyQueryCommandId, ESatSSetUpCallQuery); + action.set(KeyText, "SetUpCall"); + test.mConfirm->confirmCommand(action); + QTimer::singleShot(1000, &test, SLOT(simulateClearScreen())); + action.waitUntilCompleted(); + QCOMPARE(action.response(), ESatNoResponseFromUser); +} + +// --------------------------------------------------------------- +// internal helper class +// --------------------------------------------------------------- + +ConfirmProviderTest::ConfirmProviderTest() +{ + mConfirm = new SatAppConfirmProvider(this); +} + +ConfirmProviderTest::~ConfirmProviderTest() +{ + cleanup(); +} + +void ConfirmProviderTest::simulateFirstActionClicked() +{ + if (mConfirm->mConfirmQuery) + mConfirm->mConfirmQuery->actions().at(0)->trigger(); +} + +void ConfirmProviderTest::simulateSecondActionClicked() +{ + if (mConfirm->mConfirmQuery) + mConfirm->mConfirmQuery->actions().at(1)->trigger(); + +} + +void ConfirmProviderTest::simulateClearScreen() +{ + if (mConfirm->mConfirmQuery) mConfirm->clearScreen(); +} + +void ConfirmProviderTest::cleanup() +{ + delete mConfirm; + mConfirm = 0; +} + +// End of file diff -r 1f002146abb4 -r cee7e9e0906c satui/satapp/tsrc/ut_satapp/src/ut_satappeventhandler.cpp --- a/satui/satapp/tsrc/ut_satapp/src/ut_satappeventhandler.cpp Tue Jul 06 14:53:02 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,160 +0,0 @@ -/* -* Copyright (c) 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" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Unit test for satappeventprovider -* -*/ - -#include "ut_satappeventhandler.h" -//test class -#include "satappeventprovider.h" - -// ----------------------------------------------------------------------------- -// Ut_SatAppEventProvider::Ut_SatAppEventProvider -// ----------------------------------------------------------------------------- -// -Ut_SatAppEventProvider::Ut_SatAppEventProvider(QObject *parent): - QObject(parent), mEventHandler(0) -{ - qDebug("Ut_SatAppEventProvider::Ut_SatAppEventProvider >"); - qDebug("Ut_SatAppEventProvider::Ut_SatAppEventProvider <"); -} - -// ----------------------------------------------------------------------------- -// Ut_SatAppEventProvider::~Ut_SatAppEventProvider -// ----------------------------------------------------------------------------- -// -Ut_SatAppEventProvider::~Ut_SatAppEventProvider() -{ - qDebug("Ut_SatAppEventProvider::~Ut_SatAppEventProvider >"); - qDebug("Ut_SatAppEventProvider::~Ut_SatAppEventProvider <"); -} - -// ----------------------------------------------------------------------------- -// Ut_SatAppEventProvider::initTestCase -// QTestLib cleanup method, called after the last testfunction . -// ----------------------------------------------------------------------------- -void Ut_SatAppEventProvider::initTestCase() -{ - qDebug("Ut_SatAppEventProvider::initTestCase >"); - qDebug("Ut_SatAppEventProvider::initTestCase <"); -} - -// ----------------------------------------------------------------------------- -// Ut_SatAppEventProvider::cleanupTestCase -// -// Connects to test object signal and verifies received data. -// ----------------------------------------------------------------------------- -void Ut_SatAppEventProvider::cleanupTestCase() -{ - qDebug("Ut_SatAppEventProvider::cleanupTestCase >"); - delete mEventHandler; - mEventHandler = 0; - qDebug("Ut_SatAppEventProvider::cleanupTestCase <"); -} - -// ----------------------------------------------------------------------------- -// Ut_SatAppEventProvider::testProfileState -// -// Connects to test object signal and verifies received data. -// ----------------------------------------------------------------------------- -void Ut_SatAppEventProvider::testCreateEventHandler() -{ - qDebug("Ut_SatAppEventProvider::testCreateEventHandler >"); - mEventHandler = new SatAppEventProvider; - QVERIFY(mEventHandler); - qDebug("Ut_SatAppEventProvider::testCreateEventHandler <"); -} - -// ----------------------------------------------------------------------------- -// Ut_SatAppEventProvider::testShowSsWaitNote_data -// -// Connects to test object signal and verifies received data. -// ----------------------------------------------------------------------------- -void Ut_SatAppEventProvider::testShowSsWaitNote_data() -{ - qDebug("Ut_SatAppEventProvider::testShowSsWaitNote_data >"); - QTest::addColumn("text"); - QTest::addColumn("isSelfExplanatoryIcon"); - QTest::newRow("first") << "Show Ss Wait note First!" << false; - QTest::newRow("second") << "Show Ss Wait note seconde!" << true; - QTest::newRow("third") << "" << false; - qDebug("Ut_SatAppEventProvider::testShowSsWaitNote_data <"); -} - -// ----------------------------------------------------------------------------- -// Ut_SatAppEventProvider::testProfileState -// -// Connects to test object signal and verifies received data. -// ----------------------------------------------------------------------------- -void Ut_SatAppEventProvider::testShowSsWaitNote() -{ - qDebug("Ut_SatAppEventProvider::testShowSsWaitNote >"); - QVERIFY(mEventHandler); - QFETCH(QString, text); - QFETCH(bool, isSelfExplanatoryIcon); - // text - HBufC* hText = HBufC::New(text.length()); - TPtr aText( hText->Des() ); - aText.Copy( text.utf16() ); - CFbsBitmap* bitmap(NULL); - TRAPD(err, mEventHandler->ShowSsWaitNoteL(aText,bitmap, - isSelfExplanatoryIcon)); - delete hText; - hText = 0; - QCOMPARE(err, KErrNone); - qDebug("Ut_SatAppEventProvider::testShowSsWaitNote <"); -} - -// ----------------------------------------------------------------------------- -// Ut_SatAppEventProvider::testProfileState -// -// Connects to test object signal and verifies received data. -// ----------------------------------------------------------------------------- -void Ut_SatAppEventProvider:: testStopShowWaitNote() -{ - qDebug("Ut_SatAppEventProvider::testStopShowWaitNote >"); - QVERIFY(mEventHandler); - mEventHandler->StopShowWaitNote(); - qDebug("Ut_SatAppEventProvider::testStopShowWaitNote <"); -} - -// ----------------------------------------------------------------------------- -// Ut_SatAppEventProvider::ShowWaitNoteWithoutDelayL -// -// Connects to test object signal and verifies received data. -// ----------------------------------------------------------------------------- -void Ut_SatAppEventProvider::testShowWaitNoteWithoutDelay() -{ - qDebug("Ut_SatAppEventProvider::testShowWaitNoteWithoutDelay >"); - QVERIFY(mEventHandler); - TRAPD(err,mEventHandler->ShowWaitNoteWithoutDelayL()); - QCOMPARE(err, KErrNone); - qDebug("Ut_SatAppEventProvider::testShowWaitNoteWithoutDelay <"); -} - -// ----------------------------------------------------------------------------- -// Ut_SatAppEventProvider::testShowSsErrorNote -// -// Connects to test object signal and verifies received data. -// ----------------------------------------------------------------------------- -void Ut_SatAppEventProvider::testShowSsErrorNote() -{ - qDebug("Ut_SatAppEventProvider::testShowSsErrorNote >"); - QVERIFY(mEventHandler); - TRAPD(err, mEventHandler->ShowSsErrorNoteL()); - QCOMPARE(err, KErrNone); - qDebug("Ut_SatAppEventProvider::testShowSsErrorNote <"); -} - -// End of file diff -r 1f002146abb4 -r cee7e9e0906c satui/satapp/tsrc/ut_satapp/src/ut_satappinputprovider.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/satui/satapp/tsrc/ut_satapp/src/ut_satappinputprovider.cpp Wed Aug 18 10:19:22 2010 +0300 @@ -0,0 +1,411 @@ +/* +* Copyright (c) 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" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Unit test for satappmainhandler +* +*/ + +#include +#include + +#include +#include + +#include "ut_satappinputprovider.h" +#include "satappinputprovider.h" +#include "satappaction.h" + + +// -------------------------------------------------------- +// The unit tests begin here +// -------------------------------------------------------- + +Ut_SatAppInputProvider::Ut_SatAppInputProvider( + QObject *parent) + :QObject(parent) +{ +} + +void Ut_SatAppInputProvider::testResetState() +{ + InputProviderTest test; + test.mInput->resetState(); +} + +void Ut_SatAppInputProvider::testGetInkeyAndOk_data() +{ + QTest::addColumn("text"); + QTest::addColumn("charset"); + QTest::addColumn("inkey"); + + QTest::newRow("t01") << "title" << (int)ESatDigitOnly << 0; + QTest::newRow("t02") << "title" << (int)ESatCharSmsDefaultAlphabet << 0; + QTest::newRow("t03") << "title" << (int)ESatCharUcs2Alphabet << 0; + QTest::newRow("t04") << "title" << (int)ESatYesNo << 0; + QTest::newRow("t05") << "long title that does not fix to screen" << (int)ESatDigitOnly << 0; + QTest::newRow("t06") << "long title that does not fix to screen" << (int)ESatCharSmsDefaultAlphabet << 0; + QTest::newRow("t07") << "long title that does not fix to screen" << (int)ESatCharUcs2Alphabet << 0; + QTest::newRow("t08") << "long title that does not fix to screen" << (int)ESatYesNo << 0; + QTest::newRow("t09") << "" << (int)ESatDigitOnly << 1; + QTest::newRow("t10") << "" << (int)ESatCharSmsDefaultAlphabet << 47; + QTest::newRow("t11") << "" << (int)ESatCharUcs2Alphabet << 58; + QTest::newRow("t12") << "" << (int)ESatYesNo << 0; +} + +void Ut_SatAppInputProvider::testGetInkeyAndOk() +{ + QFETCH(QString, text); + QFETCH(int, charset); + QFETCH(int, inkey); + bool selfExp = false; + + SatAppAction a(ESatGetInkeyAction); + a.set(KeyText,text); + a.set(KeyCharacterSet,charset); + a.set(KeyInKey,inkey); + a.set(KeyImmediate,false); + a.set(KeyDuration,10000); + + InputProviderTest test; + test.mInput->getInkey(a); + // simulate press OK + if( (charset!=ESatYesNo) || (text.length()>0)){ + test.simulateFirstActionClicked(); + } + + if (charset==ESatYesNo) { + if( text.length()>0 ){ + QCOMPARE(a.response(),ESatSuccess); + QCOMPARE(a.value(KeyInKey).toInt(),1); + } + else { + QCOMPARE(a.response(),ESatFailure); + } + + } + else { + QCOMPARE(a.response(),ESatSuccess); + } + +} + +void Ut_SatAppInputProvider::testGetInkeyAndCancel_data() +{ + // uses same test materil as testGetInkeyAndOk() + testGetInkeyAndOk_data(); +} + +void Ut_SatAppInputProvider::testGetInkeyAndCancel() +{ + QFETCH(QString, text); + QFETCH(int, charset); + QFETCH(int, inkey); + bool selfExp = false; + + SatAppAction a(ESatGetInkeyAction); + a.set(KeyText,text); + a.set(KeyCharacterSet,charset); + a.set(KeyInKey,inkey); + a.set(KeyImmediate,false); + a.set(KeyDuration,10000); + + InputProviderTest test; + test.mInput->getInkey(a); + // simulate press CANCEL + if((charset!=ESatYesNo) || (text.length()>0)) { + test.simulateSecondActionClicked(); + } + + if (charset==ESatYesNo) { + if( text.length()>0 ){ + QCOMPARE(a.response(),ESatSuccess); + QCOMPARE(a.value(KeyInKey).toInt(),0); + } + else { + QCOMPARE(a.response(),ESatFailure); + } } + else { + QCOMPARE(a.response(),ESatBackwardModeRequestedByUser); + } +} + +void Ut_SatAppInputProvider::testGetInkeyAndTimeout() +{ + SatAppAction a(ESatGetInkeyAction); + a.set(KeyText,"hello"); + a.set(KeyCharacterSet,ESatCharSmsDefaultAlphabet); + a.set(KeyInKey,64); + a.set(KeyImmediate,false); + a.set(KeyDuration,1000); + + InputProviderTest test; + test.mInput->getInkey(a); + a.waitUntilCompleted(); + + QCOMPARE(a.response(),ESatNoResponseFromUser); +} + +void Ut_SatAppInputProvider::testGetInkeyAndReset() +{ + SatAppAction a(ESatGetInkeyAction); + a.set(KeyText,"hello"); + a.set(KeyCharacterSet,ESatCharSmsDefaultAlphabet); + a.set(KeyInKey,64); + a.set(KeyImmediate,false); + a.set(KeyDuration,10000); + a.setResponse(ESatFailure); + + InputProviderTest test; + test.mInput->getInkey(a); + test.mInput->resetState(); + + QCOMPARE(a.response(),ESatNoResponseFromUser); +} + +void Ut_SatAppInputProvider::testGetInkeyAndDelete() +{ + SatAppAction a(ESatGetInkeyAction); + a.set(KeyText,"hello"); + a.set(KeyCharacterSet,ESatCharSmsDefaultAlphabet); + a.set(KeyInKey,64); + a.set(KeyImmediate,false); + a.set(KeyDuration,10000); + a.setResponse(ESatFailure); + + { + InputProviderTest test; + test.mInput->getInkey(a); + } + // at this point everything should be cleaned up safely, and action + // should be completed later when application exit or timeout + + QCOMPARE(a.response(),ESatFailure); +} + +void Ut_SatAppInputProvider::testGetInkeyImmediateAndOk() +{ + SatAppAction a(ESatGetInkeyAction); + a.set(KeyText,"hello"); + a.set(KeyCharacterSet,ESatDigitOnly); + a.set(KeyInKey,64); + a.set(KeyImmediate,true); + a.set(KeyDuration,10000); + a.setResponse(ESatFailure); + + InputProviderTest test; + test.mInput->getInkey(a); + test.simulateImmediateKeypress("0"); + + QCOMPARE(a.response(),ESatSuccess); + QCOMPARE(a.value(KeyInKey).toInt(),0x30); +} + +void Ut_SatAppInputProvider::testGetInkeyImmediateAndCancel() +{ + SatAppAction a(ESatGetInkeyAction); + a.set(KeyText,"hello"); + a.set(KeyCharacterSet,ESatDigitOnly); + a.set(KeyInKey,64); + a.set(KeyImmediate,true); + a.set(KeyDuration,10000); + a.setResponse(ESatFailure); + + InputProviderTest test; + test.mInput->getInkey(a); + test.simulateFirstActionClicked(); // cancel + + QCOMPARE(a.response(),ESatBackwardModeRequestedByUser); +} + +void Ut_SatAppInputProvider::testGetInputAndOk_data() +{ + QTest::addColumn("text"); + QTest::addColumn("charset"); + QTest::addColumn("input"); + QTest::addColumn("min"); + QTest::addColumn("max"); + QTest::addColumn("hide"); + + QTest::newRow("t01") << "title" << (int)ESatDigitOnly << "" << 1 << 5 << false; + QTest::newRow("t02") << "title" << (int)ESatCharSmsDefaultAlphabet << "" << 1 << 5 << false; + QTest::newRow("t03") << "title" << (int)ESatCharUcs2Alphabet << "" << 1 << 5 << false; + QTest::newRow("t04") << "very long title that does not fit into screen" << (int)ESatDigitOnly << "" << 1 << 5 << false; + QTest::newRow("t05") << "very long title that does not fit into screen" << (int)ESatCharSmsDefaultAlphabet << "" << 2 << 8 << false; + QTest::newRow("t06") << "very long title that does not fit into screen" << (int)ESatCharUcs2Alphabet << "" << 2 << 8 << false; + QTest::newRow("t07") << "title" << (int)ESatDigitOnly << "12345" << 1 << 5 << false; + QTest::newRow("t08") << "title" << (int)ESatCharSmsDefaultAlphabet << "12345" << 1 << 5 << false; + QTest::newRow("t09") << "title" << (int)ESatCharUcs2Alphabet << "12345" << 1 << 5 << false; + QTest::newRow("t10") << "title" << (int)ESatDigitOnly << "12345" << 1 << 5 << true; + QTest::newRow("t11") << "title" << (int)ESatCharSmsDefaultAlphabet << "12345" << 1 << 5 << true; + QTest::newRow("t12") << "title" << (int)ESatCharUcs2Alphabet << "12345" << 1 << 5 << true; + QTest::newRow("t13") << "" << (int)ESatDigitOnly << "" << 1 << 5 << false; + QTest::newRow("t14") << "" << (int)ESatCharSmsDefaultAlphabet << "" << 1 << 5 << false; + QTest::newRow("t15") << "" << (int)ESatCharUcs2Alphabet << "" << 1 << 5 << false; + QTest::newRow("t16") << "" << (int)ESatDigitOnly << "123456789123456789" << 1 << 5 << false; + QTest::newRow("t17") << "" << (int)ESatCharSmsDefaultAlphabet << "123456789123456789" << 1 << 5 << false; + QTest::newRow("t18") << "" << (int)ESatCharUcs2Alphabet << "123456789123456789" << 1 << 5 << false; + +} + +void Ut_SatAppInputProvider::testGetInputAndOk() +{ + QFETCH(QString, text); + QFETCH(int, charset); + QFETCH(QString, input); + QFETCH(int, min); + QFETCH(int, max); + QFETCH(bool, hide); + + SatAppAction a(ESatGetInputAction); + a.set(KeyText,text); + a.set(KeyCharacterSet,charset); + a.set(KeyInputString,input); + a.set(KeyMinLength,min); + a.set(KeyMaxLength,max); + a.set(KeyHideInput,hide); + a.set(KeyDuration,10000); + + InputProviderTest test; + test.mInput->getInput(a); + test.simulateFirstActionClicked(); + + QCOMPARE(a.response(),ESatSuccess); +} + +void Ut_SatAppInputProvider::testGetInputAndCancel_data() +{ + // uses same test data as testGetInputAndOk + testGetInputAndOk_data(); +} + +void Ut_SatAppInputProvider::testGetInputAndCancel() +{ + QFETCH(QString, text); + QFETCH(int, charset); + QFETCH(QString, input); + QFETCH(int, min); + QFETCH(int, max); + QFETCH(bool, hide); + + SatAppAction a(ESatGetInputAction); + a.set(KeyText,text); + a.set(KeyCharacterSet,charset); + a.set(KeyInputString,input); + a.set(KeyMinLength,min); + a.set(KeyMaxLength,max); + a.set(KeyHideInput,hide); + a.set(KeyDuration,10000); + + InputProviderTest test; + test.mInput->getInput(a); + test.simulateSecondActionClicked(); + + QCOMPARE(a.response(),ESatBackwardModeRequestedByUser); +} + +void Ut_SatAppInputProvider::testGetInputAndTimeout() +{ + SatAppAction a(ESatGetInputAction); + a.set(KeyText,"hello"); + a.set(KeyCharacterSet,ESatCharSmsDefaultAlphabet); + a.set(KeyInputString,"12345"); + a.set(KeyMinLength,1); + a.set(KeyMaxLength,10); + a.set(KeyHideInput,false); + a.set(KeyDuration,1000); + + InputProviderTest test; + test.mInput->getInput(a); + a.waitUntilCompleted(); + + QCOMPARE(a.response(),ESatNoResponseFromUser); +} + +void Ut_SatAppInputProvider::testGetInputAndReset() +{ + SatAppAction a(ESatGetInputAction); + a.set(KeyText,"hello"); + a.set(KeyCharacterSet,ESatCharSmsDefaultAlphabet); + a.set(KeyInputString,"12345"); + a.set(KeyMinLength,1); + a.set(KeyMaxLength,10); + a.set(KeyHideInput,false); + a.set(KeyDuration,10000); + + InputProviderTest test; + test.mInput->getInput(a); + test.mInput->resetState(); + + QCOMPARE(a.response(),ESatNoResponseFromUser); +} + +void Ut_SatAppInputProvider::testGetInputAndDelete() +{ + SatAppAction a(ESatGetInputAction); + a.set(KeyText,"hello"); + a.set(KeyCharacterSet,ESatCharSmsDefaultAlphabet); + a.set(KeyInputString,"12345"); + a.set(KeyMinLength,1); + a.set(KeyMaxLength,10); + a.set(KeyHideInput,false); + a.set(KeyDuration,10000); + a.setResponse(ESatFailure); + + { + InputProviderTest test; + test.mInput->getInput(a); + } + // at this point input dialog out of scope and destroyed. + // pending action should have been completed later when application exit or timeout + + QCOMPARE(a.response(),ESatFailure); +} + + +// --------------------------------------------------------------- +// internal helper class +// --------------------------------------------------------------- + +InputProviderTest::InputProviderTest() +{ + mInput = new SatAppInputProvider(this); +} + +InputProviderTest::~InputProviderTest() +{ + cleanup(); +} + +void InputProviderTest::simulateFirstActionClicked() +{ + mInput->mCurrentDialog->actions().at(0)->trigger(); +} + +void InputProviderTest::simulateSecondActionClicked() +{ + mInput->mCurrentDialog->actions().at(1)->trigger(); +} + +void InputProviderTest::simulateImmediateKeypress(QString s) +{ + mInput->transmitInkeyImmediately(s); +} + +void InputProviderTest::cleanup() +{ + delete mInput; + mInput = 0; +} + + +// End of file diff -r 1f002146abb4 -r cee7e9e0906c satui/satapp/tsrc/ut_satapp/src/ut_satappmainhandler.cpp --- a/satui/satapp/tsrc/ut_satapp/src/ut_satappmainhandler.cpp Tue Jul 06 14:53:02 2010 +0300 +++ b/satui/satapp/tsrc/ut_satapp/src/ut_satappmainhandler.cpp Wed Aug 18 10:19:22 2010 +0300 @@ -17,15 +17,20 @@ #include +#include +#include #include "ut_satappmainhandler.h" //test class #include "satappmainhandler.h" +#include "satappconstant.h" // ----------------------------------------------------------------------------- // Ut_SatAppMainHandler::Ut_SatAppMainHandler // ----------------------------------------------------------------------------- // -Ut_SatAppMainHandler::Ut_SatAppMainHandler(QObject *parent):QObject(parent) +Ut_SatAppMainHandler::Ut_SatAppMainHandler( + HbMainWindow* mainWindow, QObject *parent) + :QObject(parent), mMainWindow(mainWindow) { qDebug("Ut_SatAppMainHandler::Ut_SatAppMainHandler >"); qDebug("Ut_SatAppMainHandler::Ut_SatAppMainHandler <"); @@ -69,18 +74,52 @@ } // ----------------------------------------------------------------------------- -// Ut_SatAppMainHandler::testProfileState +// Ut_SatAppMainHandler::testCreateMainHandler // // Connects to test object signal and verifies received data. // ----------------------------------------------------------------------------- void Ut_SatAppMainHandler::testCreateMainHandler() { - qDebug("Ut_SatAppMainHandler::testProfileState >"); - HbMainWindow* window = new HbMainWindow(); - QVERIFY(window); - mMainHandler = new SatAppMainHandler(*window); + qDebug("Ut_SatAppMainHandler::testCreateMainHandler >"); + mMainHandler = new SatAppMainHandler(*mMainWindow); QVERIFY(mMainHandler); - qDebug("Ut_SatAppMainHandler::testProfileState <"); + qDebug("Ut_SatAppMainHandler::testCreateMainHandler <"); } +// ----------------------------------------------------------------------------- +// Ut_SatAppMainHandler::testCreateMainHandler_OfflineMode +// +// Connects to test object signal and verifies received data. +// ----------------------------------------------------------------------------- +void Ut_SatAppMainHandler::testCreateMainHandler_OfflineMode() +{ + qDebug("Ut_SatAppMainHandler::testCreateMainHandler_OfflineMode >"); + cleanupTestCase(); + TInt profileId(0); + CRepository* cr (NULL); + TRAPD(err, cr = CRepository::NewL(KCRUidProfileEngine)); + if ( KErrNone == err ) + { + // Get the ID of the currently active profile: + TInt error = cr->Get(KProEngActiveProfile, profileId); + qDebug("Ut_SatAppMainHandler::SatAppMainHandler get active \ + profile error=%d, profileId=%d", error, profileId); + if( KErrNone != error){ + delete cr; + return; + } + error = cr->Set(KProEngActiveProfile, + KSatActiveProfileOffline); + qDebug("Ut_SatAppMainHandler::SatAppMainHandler set active \ + profile error=%d",error); + mMainHandler = new SatAppMainHandler(*mMainWindow); + QVERIFY(mMainHandler); + error = cr->Set(KProEngActiveProfile, profileId); + qDebug("Ut_SatAppMainHandler::SatAppMainHandler set active \ + profile error=%d",error); + delete cr; + } + + qDebug("Ut_SatAppMainHandler::testCreateMainHandler_OfflineMode <"); +} // End of file diff -r 1f002146abb4 -r cee7e9e0906c satui/satapp/tsrc/ut_satapp/src/ut_satappmenuprovider.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/satui/satapp/tsrc/ut_satapp/src/ut_satappmenuprovider.cpp Wed Aug 18 10:19:22 2010 +0300 @@ -0,0 +1,268 @@ +/* +* Copyright (c) 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" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Unit test for satappmainhandler +* +*/ + +#include +#include +#include + +#include "ut_satappmenuprovider.h" +#include "satappmenuprovider.h" +#include "satappaction.h" + + + +// -------------------------------------------------------- +// The unit tests begin here +// -------------------------------------------------------- + +Ut_SatAppMenuProvider::Ut_SatAppMenuProvider( + HbMainWindow* mainWindow, QObject *parent) + :QObject(parent) +{ + mMainWindow = mainWindow; +} + +void Ut_SatAppMenuProvider::testResetState() +{ + MenuProviderTest test(mMainWindow); + test.mMenu->resetState(); +} + +void Ut_SatAppMenuProvider::testSetUpMenu_data() +{ + QTest::addColumn("text"); + QTest::addColumn("menuitems"); + QTest::addColumn("selection"); + + QTest::newRow("t1") << "title" << 1 << 0; + QTest::newRow("t2") << "a very long title that does not fit to screen" << 2 << 1; + QTest::newRow("t3") << "manyrows" << 999 << 444; + QTest::newRow("t4") << "" << 1 << 0; + QTest::newRow("t5") << "" << 10 << 1; + QTest::newRow("t6") << "a" << 10 << 9; +} + +void Ut_SatAppMenuProvider::testSetUpMenu() +{ + QFETCH(QString, text); + QFETCH(int, menuitems); + QFETCH(int, selection); + + SatAppAction a(ESatSetUpMenuAction); + a.set(KeyText,text); + QStringList list; + for(int i=0; isetUpMenu(a); + + test.mItemIndexToBeSelected = selection; + test.simulateItemSelected(); + + QCOMPARE(a.response(), ESatSuccess); + QVERIFY(a.hasValue(KeySelection)); + +} + +void Ut_SatAppMenuProvider::testSetUpMenuAndReset() +{ + SatAppAction a(ESatSetUpMenuAction); + a.set(KeyText,"hello"); + QStringList list; + for(int i=0; i<10; ++i) {list<setUpMenu(a); + + test.mMenu->resetState(); + + QCOMPARE(a.response(), ESatSuccess); + +} + +void Ut_SatAppMenuProvider::testSetUpMenuAndDelete() +{ + SatAppAction a(ESatSetUpMenuAction); + a.set(KeyText,"hello"); + QStringList list; + for(int i=0; i<10; ++i) {list<setUpMenu(a); + } + // now SatAppMenuProvider is out of scope and deleted. + QCOMPARE(a.response(), ESatSuccess); +} + +void Ut_SatAppMenuProvider::testSelectItem_data() +{ + QTest::addColumn("text"); + QTest::addColumn("menuitems"); + QTest::addColumn("defaultitem"); + QTest::addColumn("selection"); + + QTest::newRow("t1") << "title" << 1 << 0 << 0; + QTest::newRow("t2") << "a very long title that does not fit to screen" << 2 << 0 << 1; + QTest::newRow("t3") << "manyrows" << 999 << 333 << 444 ; + QTest::newRow("t4") << "" << 3 << 2 << 1 ; + QTest::newRow("t5") << "" << 4 << 3 << 0 ; + QTest::newRow("t6") << "default out of range" << 5 << 7 << 1 ; +} + +void Ut_SatAppMenuProvider::testSelectItem() +{ + QFETCH(QString, text); + QFETCH(int, menuitems); + QFETCH(int, defaultitem); + QFETCH(int, selection); + + SatAppAction a(ESatSelectItemAction); + a.set(KeyText,text); + QStringList list; + for(int i=0; iselectItem(a); + + test.mItemIndexToBeSelected = selection; + test.simulateItemSelected(); + + QCOMPARE(a.response(), ESatSuccess); + QVERIFY(a.hasValue(KeySelection)); + +} + +void Ut_SatAppMenuProvider::testSelectItemAndBack() +{ + SatAppAction a(ESatSelectItemAction); + a.set(KeyText,"hello"); + QStringList list; + for(int i=0; i<10; ++i) {list<selectItem(a); + test.simulateBackButtonClicked(); + + QCOMPARE(a.response(), ESatBackwardModeRequestedByUser); + +} + + +void Ut_SatAppMenuProvider::testSelectItemAndTimeout() +{ + SatAppAction a(ESatSelectItemAction); + a.set(KeyText,"hello"); + QStringList list; + for(int i=0; i<10; ++i) {list<selectItem(a); + a.waitUntilCompleted(); // wait selectItem timeout + + QCOMPARE(a.response(), ESatNoResponseFromUser); + +} + +void Ut_SatAppMenuProvider::testSelectItemAndReset() +{ + SatAppAction a(ESatSelectItemAction); + a.set(KeyText,"hello"); + QStringList list; + for(int i=0; i<10; ++i) {list<selectItem(a); + test.mMenu->resetState(); + + QCOMPARE(a.response(), ESatSuccess); + +} + +void Ut_SatAppMenuProvider::testSelectItemAndDelete() +{ + SatAppAction a(ESatSelectItemAction); + a.set(KeyText,"hello"); + QStringList list; + for(int i=0; i<10; ++i) {list<selectItem(a); + } + + // object deleted, blocking function should return safely + QCOMPARE(a.response(), ESatSuccess); +} + +// --------------------------------------------------------------- +// internal helper class +// --------------------------------------------------------------- + +MenuProviderTest::MenuProviderTest(HbMainWindow* mainWindow) +{ + mMenu = new SatAppMenuProvider(mainWindow,this); +} + +MenuProviderTest::~MenuProviderTest() +{ + cleanup(); +} + +void MenuProviderTest::loadMainview() +{ + mMenu->loadMainView(); +} + +void MenuProviderTest::simulateItemSelected() +{ + mMenu->menuItemSelected(mMenu->mSelectListWidget->item( + mItemIndexToBeSelected)); +} + +void MenuProviderTest::simulateBackButtonClicked() +{ + mMenu->mSoftKeyBackAction->trigger(); +} + + +void MenuProviderTest::cleanup() +{ + delete mMenu; + mMenu = 0; +} + +// End of file diff -r 1f002146abb4 -r cee7e9e0906c satui/satapp/tsrc/ut_satapp/src/ut_satapppopupprovider.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/satui/satapp/tsrc/ut_satapp/src/ut_satapppopupprovider.cpp Wed Aug 18 10:19:22 2010 +0300 @@ -0,0 +1,284 @@ +/* +* Copyright (c) 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" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Unit test for satappmainhandler +* +*/ + +#include +#include + +#include +#include +#include + +#include "ut_satapppopupprovider.h" +#include "satapppopupprovider.h" +#include "satappaction.h" + + + +// -------------------------------------------------------- +// The unit tests begin here +// -------------------------------------------------------- + +Ut_SatAppPopupProvider::Ut_SatAppPopupProvider( + QObject *parent) + :QObject(parent) +{ +} + + +void Ut_SatAppPopupProvider::testDisplayTextAndOk_data() +{ + QTest::addColumn("text"); + QTest::addColumn("appName"); + QTest::addColumn("sustainedText"); + QTest::addColumn("duration"); + + QTest::newRow("t01") << "title" << "sat" << true << 1000; + QTest::newRow("t02") << "" << "sat" << false << 100; + QTest::newRow("t03") << "" << "sat" << true << 500; + QTest::newRow("t04") << "title" << "sat" << true << 0; + QTest::newRow("t05") << "a bit longer title that does not fit" << "" << false << 900; + QTest::newRow("t06") << "title" << "" << false << 400; + QTest::newRow("t07") << "" << "" << true << 150; + QTest::newRow("t08") << "a bit longer title that does not fit" << "sat" << true << 2000; + QTest::newRow("t09") << "title" << "sat" << false << 600; + QTest::newRow("t10") << "" << "somewhat longer application name" << false << 200; + QTest::newRow("t11") << "" << "" << false << 0; + QTest::newRow("t12") << "title" << "" << true << 500; + QTest::newRow("t13") << "title" << "somewhat longer application name" << false << 0; + QTest::newRow("t14") << "" << "sat" << true << 700; + QTest::newRow("t15") << "title" << "sat" << false << 3000; + +} + +void Ut_SatAppPopupProvider::testDisplayTextAndOk() +{ + QFETCH(QString, text); + QFETCH(QString, appName); + QFETCH(bool, sustainedText); + QFETCH(int, duration); + + SatAppAction a(ESatDisplayTextAction); + a.set(KeyText,text); + a.set(KeyApplicationName,appName); + a.set(KeySustainedText,sustainedText); + a.set(KeyDuration,duration); + a.set(KeyWaitUserToClear,false); + a.setResponse(ESatFailure); + + PopupProviderTest test; + test.mPopup->displayText(a); + test.simulateOkClicked(); + + QCOMPARE(a.response(),ESatSuccess); +} + + +void Ut_SatAppPopupProvider::testDisplayTextAndCancel_data() +{ + testDisplayTextAndOk_data(); // same test material +} + +void Ut_SatAppPopupProvider::testDisplayTextAndCancel() +{ + QFETCH(QString, text); + QFETCH(QString, appName); + QFETCH(bool, sustainedText); + QFETCH(int, duration); + + SatAppAction a(ESatDisplayTextAction); + a.set(KeyText,text); + a.set(KeyApplicationName,appName); + a.set(KeySustainedText,sustainedText); + a.set(KeyDuration,duration); + a.set(KeyWaitUserToClear,false); + a.setResponse(ESatFailure); + + PopupProviderTest test; + test.mPopup->displayText(a); + test.simulateCancelClicked(); + + QCOMPARE(a.response(),ESatBackwardModeRequestedByUser); +} + + +void Ut_SatAppPopupProvider::testDisplayTextAndTimeout() +{ + SatAppAction a(ESatDisplayTextAction); + a.set(KeyText,"hello world"); + a.set(KeyApplicationName,"sat"); + a.set(KeySustainedText,false); + a.set(KeyDuration,1000); + a.set(KeyWaitUserToClear,true); + a.setResponse(ESatFailure); + + PopupProviderTest test; + test.mPopup->displayText(a); + a.waitUntilCompleted(); + QCOMPARE(a.response(),ESatNoResponseFromUser); +} + +void Ut_SatAppPopupProvider::testNotificationWithCancel_data() +{ + QTest::addColumn("commandId"); + QTest::addColumn("alphaIdStatus"); + QTest::addColumn("text"); + QTest::addColumn("controlResult"); + QTest::addColumn("clickState"); // clikcked->state + + QTest::newRow("t01") << (int)ESatSSendDataNotify << (int)ESatAlphaIdNotNull << "notify" + << (int)ESatAllowedNoModification << (int)ESatSuccess; + QTest::newRow("t02") << (int)ESatSSendDataNotify << (int)ESatAlphaIdNull << "" + << (int)ESatNotAllowed << (int)ESatSuccess; + + QTest::newRow("t03") << (int)ESatSReceiveDataNotify << (int)ESatAlphaIdNotNull + << "notify" << (int)ESatAllowedNoModification << (int)ESatSuccess; + QTest::newRow("t04") << (int)ESatSReceiveDataNotify << (int)ESatAlphaIdNull + << "" << (int)ESatNotAllowed << (int)ESatSuccess; + + QTest::newRow("t05") << (int)ESatSSendDtmfNotify << (int)ESatAlphaIdNotNull + << "notify" << (int)ESatAllowedNoModification << (int)ESatSuccess; + QTest::newRow("t06") << (int)ESatSSendDtmfNotify << (int)ESatAlphaIdNull + << "" << (int)ESatNotAllowed << (int)ESatSuccess; +} + +void Ut_SatAppPopupProvider::testNotificationWithCancel() +{ + QFETCH(int, commandId); + QFETCH(int, alphaIdStatus); + QFETCH(QString, text); + QFETCH(int, controlResult); + QFETCH(int, clickState); + + SatAppAction *a = new SatAppAction(ESatNotifyAction); + a->set(KeyCommandId,commandId); + a->set(KeyAlphaIdStatus,alphaIdStatus); + a->set(KeyText,text); + a->set(KeyControlResult,controlResult); + a->setResponse(ESatSuccess); + + PopupProviderTest test; + test.mPopup->notification(*a); + qDebug() << "action response" << a->response() << "/" << clickState; + QVERIFY(a->response()==(TSatUiResponse)clickState); +} + +void Ut_SatAppPopupProvider::testNotification_data() +{ + QTest::addColumn("commandId"); + QTest::addColumn("alphaIdStatus"); + QTest::addColumn("text"); + QTest::addColumn("controlResult"); + QTest::addColumn("clickState"); // clikcked->state + + QTest::newRow("t01") << (int)ESatSCloseChannelNotify << (int)ESatAlphaIdNotNull + << "notify" << (int)ESatNotAllowed << (int)ESatSuccess; + QTest::newRow("t02") << (int)ESatSCloseChannelNotify << (int)ESatAlphaIdNull + << "" << (int)ESatAllowedNoModification << (int)ESatSuccess; + + QTest::newRow("t03") << (int)ESatSMoSmControlNotify << (int)ESatAlphaIdNotNull + << "notify" << (int)ESatAllowedNoModification << (int)ESatSuccess; + QTest::newRow("t04") << (int)ESatSMoSmControlNotify << (int)ESatAlphaIdNull + << "" << (int)ESatNotAllowed << (int)ESatSuccess; + QTest::newRow("t05") << (int)ESatSMoSmControlNotify << (int)ESatAlphaIdNotProvided + << "" << (int)ESatAllowedWithModifications << (int)ESatSuccess; + + QTest::newRow("t06") << (int)ESatSCallControlNotify << (int)ESatAlphaIdNotNull + << "notify" << (int)ESatAllowedNoModification << (int)ESatSuccess; + QTest::newRow("t07") << (int)ESatSCallControlNotify << (int)ESatAlphaIdNull + << "" << (int)ESatNotAllowed << (int)ESatSuccess; + QTest::newRow("t08") << (int)ESatSCallControlNotify << (int)ESatAlphaIdNotProvided + << "" << (int)ESatAllowedWithModifications << (int)ESatSuccess; + + QTest::newRow("t09") << (int)ESatSSendUssdNotify << (int)ESatAlphaIdNotNull + << "notify" << (int)ESatAllowedNoModification << (int)ESatSuccess; + QTest::newRow("t10") << (int)ESatSSendUssdNotify << (int)ESatAlphaIdNull + << "" << (int)ESatNotAllowed << (int)ESatSuccess; + + QTest::newRow("t11") << (int)ESatSSendUssdNotify << (int)ESatAlphaIdNotNull + << "notify" << (int)ESatAllowedNoModification << (int)ESatSuccess; + QTest::newRow("t12") << (int)ESatSSendUssdNotify << (int)ESatAlphaIdNull + << "" << (int)ESatNotAllowed << (int)ESatSuccess; + + QTest::newRow("t13") << (int)ESatSSendSsNotify << (int)ESatAlphaIdNotNull + << "notify" << (int)ESatAllowedNoModification << (int)ESatSuccess; + QTest::newRow("t14") << (int)ESatSSendSsNotify << (int)ESatAlphaIdNull + << "" << (int)ESatNotAllowed << (int)ESatSuccess; + + QTest::newRow("t15") << (int)ESatSSendSmsNotify << (int)ESatAlphaIdNotNull + << "notify" << (int)ESatAllowedNoModification << (int)ESatSuccess; + QTest::newRow("t16") << (int)ESatSSendSmsNotify << (int)ESatAlphaIdNull + << "" << (int)ESatNotAllowed << (int)ESatSuccess; +} + +void Ut_SatAppPopupProvider::testNotification() +{ + QFETCH(int, commandId); + QFETCH(int, alphaIdStatus); + QFETCH(QString, text); + QFETCH(int, controlResult); + QFETCH(int, clickState); + + SatAppAction a(ESatNotifyAction); + a.set(KeyCommandId,commandId); + a.set(KeyAlphaIdStatus,alphaIdStatus); + a.set(KeyText,text); + a.set(KeyControlResult,controlResult); + a.setResponse(ESatSuccess); + + PopupProviderTest test; + test.mPopup->notification(a); + + qDebug() << "action response:" << a.response() << "/" << clickState; + QCOMPARE(a.response(),(TSatUiResponse)clickState); +} + +// --------------------------------------------------------------- +// internal helper class +// --------------------------------------------------------------- + +PopupProviderTest::PopupProviderTest() +{ + mPopup = new SatAppPopupProvider(this); +} + +PopupProviderTest::~PopupProviderTest() +{ + cleanup(); +} + +bool PopupProviderTest::simulateOkClicked() +{ + if (mPopup->mDisplayText->actions().size()<=0) return false; + mPopup->mDisplayText->actions().at(0)->trigger(); + return true; +} + +bool PopupProviderTest::simulateCancelClicked() +{ + if (mPopup->mDisplayText->actions().size()<=1) return false; + mPopup->mDisplayText->actions().at(1)->trigger(); + return true; +} + +void PopupProviderTest::cleanup() +{ + delete mPopup; + mPopup = 0; +} + + +// End of file diff -r 1f002146abb4 -r cee7e9e0906c satui/satapp/tsrc/ut_satapp/src/ut_satappserverdispatcher.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/satui/satapp/tsrc/ut_satapp/src/ut_satappserverdispatcher.cpp Wed Aug 18 10:19:22 2010 +0300 @@ -0,0 +1,1043 @@ +/* +* Copyright (c) 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" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Unit test for CSatUiObserver +* +*/ + +#include "ut_satappserverdispatcher.h" +#include "satappserverdispatcher.h" +#include "satappaction.h" + +Ut_SatAppServerDispatcher::Ut_SatAppServerDispatcher(QObject *parent):QObject(parent) +{ +} + +// ----------------------------------------------------------------------------- +// Ut_SatAppServerDispatcher::initTestCase +// QTestLib cleanup method, called after the last testfunction . +// ----------------------------------------------------------------------------- +void Ut_SatAppServerDispatcher::initTestCase() +{ + mServer = new SatAppServerDispatcher(this); +} + + +// ----------------------------------------------------------------------------- +// Ut_SatAppServerDispatcher::cleanupTestCase +// +// Connects to test object signal and verifies received data. +// ----------------------------------------------------------------------------- +void Ut_SatAppServerDispatcher::cleanupTestCase() +{ + delete mServer; + mServer = 0; +} + + + + +// ----------------------------------------------------------------------------- +// Ut_SatAppServerDispatcher::testDisplayText_data +// +// Connects to test object signal and verifies received data. +// ----------------------------------------------------------------------------- +void Ut_SatAppServerDispatcher::testDisplayText_data() +{ + qDebug("Ut_SatAppServerDispatcher::testDisplayText_data >"); + QTest::addColumn("text"); + QTest::addColumn("appName"); + QTest::addColumn("iconIdIdentifier"); + QTest::addColumn("iconIdQualifier");//enum 0~3 + QTest::addColumn("isIconDisplayed"); + QTest::addColumn("sustainedText"); + QTest::addColumn("duration"); + QTest::addColumn("isWaitUsertoClear"); + QTest::addColumn("expectValue"); + + QTest::newRow("first") << "Show Display text!" << "Unit test SIM Service" << + 84 << 1 << false << false << 2500 << true << 0; + + QTest::newRow("second") << "Show Display text!" << "SIM Service" << + 84 << 1 << true << false << 2500 << false << 0; + // test null text + QTest::newRow("third") << "" << "SIM Service" << + 84 << 1 << true << false << 2500 << false << -1; + + // test icon is available for command + QTest::newRow("fouth") << "Show Display text!" << "SIM Service" << + 84 << 2 << true << false << 2500 << false << 0; + + // test show a log text over the limitation + QTest::newRow("five") << "Show a very very long text. Show a very very long text. Show a very very long text. Show a very very long text. Show a very very long text. Show a very very long text. Show a very very long text. Show a very very long text. Show a very very long text. Show a very very long text. Show a very very long text. Show a very very long text. Show a very very long text. Show a very very long text. Show a very very long text. Show a very very long text. Show a very very long text. Show a very very long text. Show a very very long text. Show a very very long text. " + << "SIM Service" << 84 << 2 << true << false << 2500 << false << -1; + + // test leave occurs + //QTest::newRow("forth") << "Show Display text!" << "" << + // 84 << 2 << true << false << 2500 << false << 1; + + qDebug("Ut_SatAppServerDispatcher::testDisplayText_data <"); +} + +// ----------------------------------------------------------------------------- +// Ut_SatAppServerDispatcher::testDisplayText +// +// Connects to test object signal and verifies received data. +// ----------------------------------------------------------------------------- +void Ut_SatAppServerDispatcher::testDisplayText() +{ + qDebug("Ut_SatAppServerDispatcher::testDisplayText >"); + QVERIFY(mServer); + QFETCH(QString, text); + QFETCH(QString, appName); + QFETCH(int, iconIdIdentifier); + QFETCH(int, iconIdQualifier); + QFETCH(bool, isIconDisplayed); + QFETCH(bool, sustainedText); + QFETCH(int, duration); + QFETCH(bool, isWaitUsertoClear); + QFETCH(int, expectValue); + + // text + HBufC* hText = HBufC::New(text.length()); + TPtr aText( hText->Des() ); + aText.Copy( text.utf16() ); + // sim name + HBufC* hSimAppName = HBufC::New(appName.length()); + TPtr aSimApplicationName( hSimAppName->Des() ); + aSimApplicationName.Copy( appName.utf16() ); + + TSatIconId aIconId; + aIconId.iIdentifier = iconIdIdentifier; + aIconId.iIconQualifier = static_cast(iconIdQualifier); + TBool aIsIconDisplayed(isIconDisplayed); + + TSatUiResponse result(ESatSuccess); + ServerDispatcherHelper helper; + connect(mServer,SIGNAL(displayText(SatAppAction&)),&helper,SLOT(exec(SatAppAction&))); + // It seems that TRAPD&QT_TRAP_THROWING does nothing if leave occurs, need + // to investigate. + QT_TRAP_THROWING( result = mServer->DisplayTextL( + aText, + aSimApplicationName, + aIconId, + aIsIconDisplayed, + sustainedText, + duration, + isWaitUsertoClear + )); + delete hText; + hText = 0; + TSatUiResponse exValue = static_cast(expectValue); + QCOMPARE(exValue, result); + qDebug("Ut_SatAppServerDispatcher::testDisplayText <"); +} + +// ----------------------------------------------------------------------------- +// Ut_SatAppServerDispatcher::testGetInkey_data +// +// Connects to test object signal and verifies received data. +// ----------------------------------------------------------------------------- +void Ut_SatAppServerDispatcher::testGetInkey_data() +{ + qDebug("Ut_SatAppServerDispatcher::testGetInkey_data >"); + QTest::addColumn("text"); + QTest::addColumn("characterSet");//enum 0~3 + QTest::addColumn("input"); + QTest::addColumn("isHelpIsAvailable"); + QTest::addColumn("iconIdIdentifier"); + QTest::addColumn("iconIdQualifier");//enum 0~3 + QTest::addColumn("isRequestedIconDisplayed"); + QTest::addColumn("duration"); + QTest::addColumn("isImmediateDigitResponse"); + QTest::addColumn("expectValue"); + //// test ESatDigitOnly + QTest::newRow("first") << "Test GetInKey" << 0 << + "8" << false << 60 << 1 << false << 2500 << true << 0; + // null text + QTest::newRow("second") << "" << 0 << + "s" << false<< 60 << 1 << false << 2500 << true << 0; + // test EIconGetYesNo + QTest::newRow("third") << "Test GetInKey" << 3 << + "s" << false << 60 << 1 << false << 2500 << true << 0; + // test ESatCharSmsDefaultAlphabet + QTest::newRow("fourth") << "Test GetInKey" << 3 << + "$" << false << 60 << 1 << false << 2500 << true << 0; + // ino immediateDigitResponse + QTest::newRow("fifth") << "Test GetInKey" << 1 << + "#" << false<< 60 << 1 << false << 2500 << false << 0; + // test zero lenght and yes no + QTest::newRow("sisth") << "" << 3 << + "S" << false << 60 << 1 << false << 2500 << true << -1; + qDebug("Ut_SatAppServerDispatcher::testGetInkey_data <"); +} + +// ----------------------------------------------------------------------------- +// Ut_SatAppServerDispatcher::testGetInkey +// +// Connects to test object signal and verifies received data. +// ----------------------------------------------------------------------------- +void Ut_SatAppServerDispatcher::testGetInkey() +{ + qDebug("Ut_SatAppServerDispatcher::testGetInkey >"); + QVERIFY(mServer); + QFETCH(QString, text); + QFETCH(int, characterSet); + QFETCH(QString, input); + QFETCH(bool, isHelpIsAvailable); + QFETCH(int, iconIdIdentifier); + QFETCH(int, iconIdQualifier); + QFETCH(bool, isRequestedIconDisplayed); + QFETCH(int, duration); + QFETCH(bool, isImmediateDigitResponse); + QFETCH(int, expectValue); + + // text + HBufC* hText = HBufC::New(text.length()); + TPtr aText( hText->Des() ); + aText.Copy( text.utf16() ); + // aCharacterSet + TSatCharacterSet aCharacterSet = static_cast(characterSet); + // aInput + TBuf<1> tInput = input.utf16(); + TChar aInput(tInput[0]); + // aHelpIsAvailable + TBool aHelpIsAvailable(isHelpIsAvailable); + // aIconId + TSatIconId aIconId; + aIconId.iIdentifier = iconIdIdentifier; + aIconId.iIconQualifier = static_cast(iconIdQualifier); + // aRequestedIconDisplayed + TBool aRequestedIconDisplayed(isRequestedIconDisplayed); + // aDuration + TUint aDuration= static_cast(duration); + // aRequestedIconDisplayed + //TBool aImmediateDigitResponse(isImmediateDigitResponse); + ServerDispatcherHelper helper; + connect(mServer,SIGNAL(getInkey(SatAppAction&)),&helper,SLOT(exec(SatAppAction&))); + TSatUiResponse result(ESatSuccess); + QT_TRAP_THROWING( result = mServer->GetInkeyL( + aText, + aCharacterSet, + aInput, + aHelpIsAvailable, + aIconId, + aRequestedIconDisplayed, + aDuration, + isImmediateDigitResponse + )); + delete hText; + hText = 0; + TSatUiResponse exValue = static_cast(expectValue); + QCOMPARE(exValue, result); + + qDebug("Ut_SatAppServerDispatcher::testGetInkey <"); +} + +// ----------------------------------------------------------------------------- +// Ut_SatAppServerDispatcher::testGetInput_data +// +// Connects to test object signal and verifies received data. +// ----------------------------------------------------------------------------- +void Ut_SatAppServerDispatcher::testGetInput_data() +{ + qDebug("Ut_SatAppServerDispatcher::testGetInput_data >"); + QTest::addColumn("text"); + QTest::addColumn("characterSet");//enum 0~3 + QTest::addColumn("input"); + QTest::addColumn("minLength"); + QTest::addColumn("maxLength"); + QTest::addColumn("isHideInput"); + QTest::addColumn("isHelpIsAvailable"); + QTest::addColumn("iconIdIdentifier"); + QTest::addColumn("iconIdQualifier");//enum 0~3 + QTest::addColumn("isRequestedIconDisplayed"); + QTest::addColumn("expectValue"); + // test characterSet ESatCharSmsDefaultAlphabet + QTest::newRow("first") << "Test GetInput" << 1 << + "get input" << 1 << 5 << false << false <<60 << 1 << true << 0; + // test iconIdQualifier ESatSelfExplanatory + QTest::newRow("second") << "Test GetInput" << 0 << + "get input" << 1 << 5 << false << false <<60 << 2 << true << 0; + // test hide + QTest::newRow("third") << "Test GetInput" << 1 << + "" << 1 << 5 << true << false <<60 << 2 << true << -1; + qDebug("Ut_SatAppServerDispatcher::testGetInput_data <"); +} + +// ----------------------------------------------------------------------------- +// Ut_SatAppServerDispatcher::testGetInput +// +// Connects to test object signal and verifies received data. +// ----------------------------------------------------------------------------- +void Ut_SatAppServerDispatcher::testGetInput() +{ + qDebug("Ut_SatAppServerDispatcher::testGetInput >"); + QVERIFY(mServer); + QFETCH(QString, text); + QFETCH(int, characterSet); + QFETCH(QString, input); + QFETCH(int, minLength); + QFETCH(int, maxLength); + QFETCH(bool, isHideInput); + QFETCH(bool, isHelpIsAvailable); + QFETCH(int, iconIdIdentifier); + QFETCH(int, iconIdQualifier); + QFETCH(bool, isRequestedIconDisplayed); + QFETCH(int, expectValue); + + // text + HBufC* hText = HBufC::New(text.length()); + TPtr aText( hText->Des() ); + aText.Copy( text.utf16() ); + // aCharacterSet + TSatCharacterSet aCharacterSet = static_cast(characterSet); + // aInput + HBufC* hInput = HBufC::New(input.length()); + TPtr aInput( hInput->Des() ); + aInput.Copy( input.utf16() ); + // aIconId + TSatIconId aIconId; + aIconId.iIdentifier = iconIdIdentifier; + aIconId.iIconQualifier = static_cast(iconIdQualifier); + // aRequestedIconDisplayed + TBool aRequestedIconDisplayed(isRequestedIconDisplayed); + ServerDispatcherHelper helper; + connect(mServer,SIGNAL(getInput(SatAppAction&)),&helper,SLOT(exec(SatAppAction&))); + TSatUiResponse result(ESatSuccess); + QT_TRAP_THROWING( result = mServer->GetInputL( + aText, + aCharacterSet, + aInput, + minLength, + maxLength, + isHideInput, + isHelpIsAvailable, + aIconId, + aRequestedIconDisplayed + )); + delete hText; + hText = 0; + delete hInput; + hInput = 0; + TSatUiResponse exValue = static_cast(expectValue); + QCOMPARE(exValue, result); + qDebug("Ut_SatAppServerDispatcher::testGetInput <"); +} + +// ----------------------------------------------------------------------------- +// Ut_SatAppServerDispatcher::testSetUpMenu_data +// +// Connects to test object signal and verifies received data. +// ----------------------------------------------------------------------------- +void Ut_SatAppServerDispatcher::testSetUpMenu_data() +{ + qDebug("Ut_SatAppServerDispatcher::testSetUpMenu_data >"); + QTest::addColumn("text"); + QTest::addColumn("setupMenuItem"); + QTest::addColumn("isHelpIsAvailable"); + QTest::addColumn("iconIdIdentifier"); + QTest::addColumn("iconIdQualifier");//enum 0~3 + QTest::addColumn("iconListQualifier"); + QTest::addColumn("expectReturnValue"); + + QStringList testSetUpMenu_1_items; + testSetUpMenu_1_items + << "SendData" + << "ReceiveData" + << "CloseChannel" + << "OpenChannel" + << "GetChannelStatus" + << "DisplayText with different symbols and durations" + << "GetInkey" + << "GetInput" + << "SelectItem" + << "PlayTone" + << "RefreshRequired" + << "DoRefresh" + << "SendSm" + << "SendSs" + << "SendUssd" + << "SetUpCall" + << "SetUpIdleModeText" + << "CallControl" + << "MoSmControl" + << "LaunchBrowser" + << "SendDTMF" + << "SetUpEventList" + << "ProvideLocalInfo" + << "EventDownload for IdleScreen available event" + << "SetUpMenu"; + + QTest::newRow("first") << "SAT" << testSetUpMenu_1_items << + false << 80 << 1 << 2 << 0; + + qDebug("Ut_SatAppServerDispatcher::testSetUpMenu_data <"); +} + +// ----------------------------------------------------------------------------- +// Ut_SatAppServerDispatcher::testSetUpMenu +// +// Connects to test object signal and verifies received data. +// ----------------------------------------------------------------------------- +void Ut_SatAppServerDispatcher::testSetUpMenu() +{ + qDebug("Ut_SatAppServerDispatcher::testSetUpMenu >"); + QVERIFY(mServer); + QFETCH(QString, text); + QFETCH(QStringList, setupMenuItem); + QFETCH(bool, isHelpIsAvailable); + QFETCH(int, iconIdIdentifier); + QFETCH(int, iconIdQualifier); + QFETCH(int, iconListQualifier); + QFETCH(int, expectReturnValue); + + // aText + HBufC* hText = HBufC::New(text.length()); + TPtr aText( hText->Des() ); + aText.Copy( text.utf16() ); + // aMenuItems + TBuf<128> menuItem; + CDesCArrayFlat* aMenuItems = new CDesCArrayFlat(4); + QVERIFY(aMenuItems); + for (int i = 0; i< setupMenuItem.count(); i++) { + menuItem = setupMenuItem.at(i).utf16(); + QT_TRAP_THROWING(aMenuItems->AppendL(menuItem)); + } + // aIconId + TSatIconId aIconId; + aIconId.iIdentifier = iconIdIdentifier; + aIconId.iIconQualifier = static_cast(iconIdQualifier); + // aMenuItemNextActions + CArrayFixFlat* aMenuItemNextActions = + new CArrayFixFlat (4); + QVERIFY(aMenuItemNextActions); + // Temp test + QT_TRAP_THROWING(aMenuItemNextActions->AppendL(ESatSetUpMenuAction)); + // aMenuIcons + CArrayFixFlat* aMenuIcons = new CArrayFixFlat(2); + QVERIFY(aMenuIcons); + // Temp test + QT_TRAP_THROWING(aMenuIcons->AppendL(1)); + // aIconListQualifier + TSatIconQualifier aIconListQualifier = + static_cast(iconListQualifier); + // TSatSelectionPreference, useless + TSatSelectionPreference aSelectionPreference(ESatNoSelectionPreference); + TSatUiResponse result(ESatSuccess); + QT_TRAP_THROWING(result = mServer->SetUpMenuL( + aText, + *aMenuItems, + aMenuItemNextActions, + isHelpIsAvailable, + aIconId, + aMenuIcons, + aIconListQualifier, + aSelectionPreference + )); + TSatUiResponse exValue = static_cast(expectReturnValue); + QCOMPARE(exValue, result); + + delete hText; + hText = 0; + delete aMenuItems; + aMenuItems = 0; + delete aMenuItemNextActions; + aMenuItemNextActions = 0; + delete aMenuIcons; + aMenuIcons = 0; + qDebug("Ut_SatAppServerDispatcher::testSetUpMenu <"); +} + +// ----------------------------------------------------------------------------- +// Ut_SatAppServerDispatcher::testSelectItem_data +// +// Connects to test object signal and verifies received data. +// ----------------------------------------------------------------------------- +void Ut_SatAppServerDispatcher::testSelectItem_data() +{ + qDebug("Ut_SatAppServerDispatcher::testSelectItem_data >"); + QTest::addColumn("text"); + QTest::addColumn("selectItemItem"); + QTest::addColumn("defaultItem"); + QTest::addColumn("isHelpIsAvailable"); + QTest::addColumn("iconIdIdentifier"); + QTest::addColumn("iconIdQualifier");//enum 0~3 + QTest::addColumn("iconListQualifier"); + QTest::addColumn("expectReturnValue"); + + QStringList testSelectItem_1_items; + testSelectItem_1_items + << "Select Item 1" + << "Select Item 2" + << "Select Item 3" + << "Select Item 4" + << "Select Item 5"; + + QTest::newRow("first") << "Make a Choice" << testSelectItem_1_items << + 0 << false << 80 << 1 << 2 << 0; + + qDebug("Ut_SatAppServerDispatcher::testSelectItem_data <"); +} + +// ----------------------------------------------------------------------------- +// Ut_SatAppServerDispatcher::testSetUpMenu +// +// Connects to test object signal and verifies received data. +// ----------------------------------------------------------------------------- +void Ut_SatAppServerDispatcher::testSelectItem() +{ + qDebug("Ut_SatAppServerDispatcher::testSelectItem >"); + QVERIFY(mServer); + QFETCH(QString, text); + QFETCH(QStringList, selectItemItem); + QFETCH(int, defaultItem); + QFETCH(bool, isHelpIsAvailable); + QFETCH(int, iconIdIdentifier); + QFETCH(int, iconIdQualifier); + QFETCH(int, iconListQualifier); + QFETCH(int, expectReturnValue); + + // aText + HBufC* hText = HBufC::New(text.length()); + TPtr aText( hText->Des() ); + aText.Copy( text.utf16() ); + // aMenuItems + TBuf<128> menuItem; + CDesCArrayFlat* aMenuItems = new CDesCArrayFlat(4); + QVERIFY(aMenuItems); + for (int i = 0; i< selectItemItem.count(); i++) { + menuItem = selectItemItem.at(i).utf16(); + QT_TRAP_THROWING(aMenuItems->AppendL(menuItem)); + } + + TUint8 aSelectedItem( 1 ); + // aIconId + TSatIconId aIconId; + aIconId.iIdentifier = iconIdIdentifier; + aIconId.iIconQualifier = static_cast(iconIdQualifier); + // aMenuItemNextActions + CArrayFixFlat* aMenuItemNextActions = + new CArrayFixFlat (4); + QVERIFY(aMenuItemNextActions); + // Temp test + QT_TRAP_THROWING(aMenuItemNextActions->AppendL(ESatSelectItemAction)); + // aMenuIcons + CArrayFixFlat* aMenuIcons = new CArrayFixFlat(2); + QVERIFY(aMenuIcons); + // Temp test + QT_TRAP_THROWING(aMenuIcons->AppendL(1)); + // aIconListQualifier + TSatIconQualifier aIconListQualifier = + static_cast(iconListQualifier); + // TSatSelectionPreference, useless + TSatSelectionPreference aSelectionPreference(ESatNoSelectionPreference); + TBool aRequestIconDisplayed (EFalse); + + TSatUiResponse result(ESatSuccess); + ServerDispatcherHelper helper; + connect(mServer,SIGNAL(selectItem(SatAppAction&)),&helper,SLOT(exec(SatAppAction&))); + connect(mServer,SIGNAL(selectItem(SatAppAction&)), + &helper,SLOT(simulateItemSelected(SatAppAction&))); + QT_TRAP_THROWING(result = mServer->SelectItemL( + aText, + *aMenuItems, + aMenuItemNextActions, + defaultItem, + aSelectedItem, + isHelpIsAvailable, + aIconId, + aMenuIcons, + aIconListQualifier, + aRequestIconDisplayed, + aSelectionPreference + )); + TSatUiResponse exValue = static_cast(expectReturnValue); + QCOMPARE(exValue, result); + + delete hText; + hText = 0; + delete aMenuItems; + aMenuItems = 0; + delete aMenuItemNextActions; + aMenuItemNextActions = 0; + delete aMenuIcons; + aMenuIcons = 0; + qDebug("Ut_SatAppServerDispatcher::testSelectItem <"); +} + +// ----------------------------------------------------------------------------- +// Ut_SatAppServerDispatcher::testSetUpMenu +// +// Connects to test object signal and verifies received data. +// ----------------------------------------------------------------------------- +void Ut_SatAppServerDispatcher::testPlayTone_data() +{ + qDebug("Ut_SatAppServerDispatcher::testPlayTone_data >"); + QTest::addColumn("text");//enum 0~3 + QTest::addColumn("satTone"); + QTest::addColumn("duration"); + QTest::addColumn("iconIdIdentifier"); + QTest::addColumn("iconIdQualifier");//enum 0~3 + QTest::addColumn("isRequestedIconDisplayed"); + QTest::addColumn("expectReturnValue"); + QTest::newRow("Response_Failure") << "PlayStandardTone" << 100 << + 0 << 80 << 1 << false << 0; + QTest::newRow("ToneNotSet") << "PlayStandardTone" << -1 << + 0 << 80<< 0 << false << 0; + QTest::newRow("DialTone_0") << "PlayStandardTone" << 1 << + 0 << 80<< 1 << false << 0; + QTest::newRow("DialTone_2000") << "PlayStandardTone" << 1 << + 2000 << 80 << 2 << false << 0; + QTest::newRow("DialTone_true") << "PlayStandardTone" << 1 << + 2000 << 80 << 3 << true << 0; + QTest::newRow("Busy") << "PlayStandardTone" << 2 << + 2000 << 80 << 3 << false << 0; + QTest::newRow("Congestion") << "PlayStandardTone" << 3 << + 25000 << 80 << 3 << false << 0; + QTest::newRow("Congestion_0") << "PlayStandardTone" << 3 << + 0 << 80 << 3 << false << 0; + QTest::newRow("Acknowledge ") << "PlayStandardTone" << 4 << + 25000 << 80 << 3 << false << 0; + QTest::newRow("Acknowledge_0") << "PlayStandardTone" << 4 << + 0 << 80 << 3 << false << 0; + QTest::newRow("CallDropped") << "PlayStandardTone" << 5 << + 25000 << 80 << 1 << false << 0; + QTest::newRow("CallDropped_0") << "PlayStandardTone" << 5 << + 0 << 80 << 1 << false << 0; + QTest::newRow("SpecialInfo") << "PlayStandardTone" << 6 << + 25000 << 80 << 1 << false << 0; + QTest::newRow("SpecialInfo_0") << "PlayStandardTone" << 6 << + 0 << 80 << 1 << false << 0; + QTest::newRow("WaitingTone") << "PlayStandardTone" << 7 << + 25000 << 80 << 1 << false << 0; + QTest::newRow("WaitingTone_0") << "PlayStandardTone" << 7 << + 0 << 80 << 1 << false << 0; + QTest::newRow("RingingTone") << "PlayStandardTone" << 8 << + 25000 << 80 << 1 << false << 0; + QTest::newRow("RingingTone_0") << "PlayStandardTone" << 8 << + 0 << 80 << 1 << false << 0; + QTest::newRow("GeneralBeep") << "PlayStandardTone" << 16 << + 25000 << 80 << 1 << false << 0; + QTest::newRow("GeneralBeep_0") << "PlayStandardTone" << 16 << + 0 << 80 << 1 << false << 0; + QTest::newRow("PositiveTone") << "PlayStandardTone" << 17 << + 25000 << 80 << 1 << false << 0; + QTest::newRow("PositiveTone_0") << "PlayStandardTone" << 17 << + 0 << 80 << 1 << false << 0; + QTest::newRow("NegativeTone") << "PlayStandardTone" << 18 << + 25000 << 80 << 1 << false << 0; + QTest::newRow("NegativeTone_0") << "PlayStandardTone" << 18 << + 0 << 80 << 1 << false << 0; + QTest::newRow("Speech") << "PlayStandardTone" << 19 << + 25000 << 80 << 1 << false << 0; + QTest::newRow("Speech_0") << "PlayStandardTone" << 19 << + 25000 << 80 << 1 << false << 0; + QTest::newRow("Sms") << "PlayStandardTone" << 20 << + 25000 << 80 << 1 << false << 0; + QTest::newRow("Sms_0") << "PlayStandardTone" << 20 << + 0 << 80 << 1 << false << 0; + QTest::newRow("Busy_0") << "PlayStandardTone" << 2 << + 0 << 80 << 3 << false << 0; + qDebug("Ut_SatAppServerDispatcher::testPlayTone_data <"); +} + + +// ----------------------------------------------------------------------------- +// Ut_SatAppServerDispatcher::testSetUpMenu +// +// Connects to test object signal and verifies received data. +// ----------------------------------------------------------------------------- +void Ut_SatAppServerDispatcher::testPlayTone() +{ + qDebug("Ut_SatAppServerDispatcher::testPlayTone >"); + QVERIFY(mServer); + QFETCH(QString, text); + QFETCH(int, duration); + QFETCH(int, satTone); + QFETCH(int, iconIdIdentifier); + QFETCH(int, iconIdQualifier); + QFETCH(bool, isRequestedIconDisplayed); + QFETCH(int, expectReturnValue); + qDebug("Ut_SatAppServerDispatcher::testPlayTone after fetch"); + // text + HBufC* hText = HBufC::New(text.length()); + TPtr aText( hText->Des() ); + aText.Copy( text.utf16() ); + // aTone + TSatTone aTone = static_cast(satTone); + // aDuration + TUint aDuration= static_cast(duration); + // aIconId + TSatIconId aIconId; + aIconId.iIdentifier = iconIdIdentifier; + aIconId.iIconQualifier = static_cast(iconIdQualifier); + // aRequestedIconDisplayed + TBool aRequestedIconDisplayed(isRequestedIconDisplayed); + qDebug("Ut_SatAppServerDispatcher::testPlayTone call observer"); + ServerDispatcherHelper helper; + connect(mServer,SIGNAL(playTone(SatAppAction&)),&helper,SLOT(exec(SatAppAction&))); + TSatUiResponse result(ESatSuccess); + result = mServer->PlayTone( + aText, + aTone, + aDuration, + aIconId, + aRequestedIconDisplayed + ); + TSatUiResponse exValue = static_cast(expectReturnValue); + QCOMPARE(exValue, result); + delete hText; + hText = 0; + qDebug("Ut_SatAppServerDispatcher::testPlayTone <"); +} + + +// ----------------------------------------------------------------------------- +// Ut_SatAppServerDispatcher::testConfirmCommand_data +// +// Connects to test object signal and verifies received data. +// ----------------------------------------------------------------------------- +void Ut_SatAppServerDispatcher::testConfirmCommand_data() +{ + qDebug("Ut_SatAppServerDispatcher::testConfirmCommand_data >"); + QTest::addColumn("commandId");// enum 0~6 + QTest::addColumn("alphaIdStatus"); + QTest::addColumn("text"); + QTest::addColumn("additionalText"); + QTest::addColumn("isctionAccepted"); + QTest::addColumn("iconIdIdentifier"); + QTest::addColumn("iconIdQualifier");//enum 0~3 + QTest::addColumn("isRequestedIconDisplayed"); + QTest::addColumn("isterminatedByUser"); + // test commandId ESatSSendSmQuery + QTest::newRow("first") << 0 << 1 << "ConfirmCommand SendSm" + << "SendSm" <"); + QVERIFY(mServer); + QFETCH(int, commandId); + QFETCH(int, alphaIdStatus); + QFETCH(QString, text); + QFETCH(QString, additionalText); + QFETCH(bool, isctionAccepted); + QFETCH(int, iconIdIdentifier); + QFETCH(int, iconIdQualifier); + QFETCH(bool, isRequestedIconDisplayed); + QFETCH(bool, isterminatedByUser); + + // aCharacterSet + TSatSQueryCommand aCommandId = static_cast(commandId); + // aAlphaIdStatus + TSatAlphaIdStatus aAlphaIdStatus = static_cast(alphaIdStatus); + // text + HBufC* hText = HBufC::New(text.length()); + TPtr aText( hText->Des() ); + aText.Copy( text.utf16() ); + // aAdditionalText + HBufC* hAdditionalText = HBufC::New(additionalText.length()); + TPtr aAdditionalText( hAdditionalText->Des() ); + aAdditionalText.Copy( additionalText.utf16() ); + // aActionAccepted + TBool aActionAccepted(isctionAccepted); + // aIconId + TSatIconId aIconId; + aIconId.iIdentifier = iconIdIdentifier; + aIconId.iIconQualifier = static_cast(iconIdQualifier); + // aRequestedIconDisplayed + TBool aRequestedIconDisplayed(isRequestedIconDisplayed); + // aRequestedIconDisplayed + TBool aTerminatedByUser(isterminatedByUser); + ServerDispatcherHelper helper; + connect(mServer,SIGNAL(confirmCommand(SatAppAction&)),&helper,SLOT(exec(SatAppAction&))); + mServer->ConfirmCommand( + aCommandId, + aAlphaIdStatus, + aText, + aAdditionalText, + aActionAccepted, + aIconId, + aRequestedIconDisplayed, + aTerminatedByUser + ); + delete hText; + hText = 0; + delete hAdditionalText; + hAdditionalText = 0; + qDebug("Ut_SatAppServerDispatcher::testConfirmCommand <"); +} + +// ----------------------------------------------------------------------------- +// Ut_SatAppServerDispatcher::testNotification_data +// +// Connects to test object signal and verifies received data. +// ----------------------------------------------------------------------------- +void Ut_SatAppServerDispatcher::testNotification_data() +{ + qDebug("Ut_SatAppServerDispatcher::testNotification_data >"); + QTest::addColumn("commandId");// enum 0~6 + QTest::addColumn("alphaIdStatus"); + QTest::addColumn("text"); + QTest::addColumn("iconIdIdentifier"); + QTest::addColumn("iconIdQualifier");//enum 0~3 + QTest::addColumn("isRequestedIconDisplayed"); + QTest::addColumn("controlResult"); + + // test commandId ESatSSendDataNotify + QTest::newRow("Senddata_0id") << 0 << 0 << "Send data notify" + << 2 << 0 << false <<0; + // test commandId ESatSSendDataNotify alpha id not null but string length is zero + QTest::newRow("Senddata_1id") << 0 << 1 << "" + << 2 << 0 << false <<0; + QTest::newRow("Senddata_2id") << 0 << 2 << "Send data notify AlphaIdNotProvided" + << 2 << 0 << false <<0; + // test commandId ESatSReceiveDataNotify + QTest::newRow("Recievedata_0id") << 1 << 0 << "Recieve data notify" + << 2 << 3 << false <<0; + QTest::newRow("Recievedata_1id") << 1 << 1 << "Recieve data notify" + << 2 << 3 << false <<0; + QTest::newRow("Recievedata_2id") << 1 << 2 << "Recieve data notify AlphaIdNotProvided" + << 2 << 3 << false <<0; + // test commandId ESatSCloseChannelNotify + QTest::newRow("CloseChannel_0id") << 2 << 0 << "Close channel notify" + << 2 << 3 << false <<0; + QTest::newRow("CloseChannel_1id") << 2 << 1 << "" + << 2 << 3 << false <<0; + QTest::newRow("CloseChannel_2id") << 2 << 2 << "Close channel notify AlphaIdNotProvided" + << 2 << 3 << false <<0; + // test commandId ESatSMoSmControlNotify + QTest::newRow("MoSm_0id") << 3 << 0 << "SM control notify" + << 2 << 0 << false <<0; + QTest::newRow("MoSm_1id") << 3 << 1 << "0" + << 2 << 0 << false <<0; + QTest::newRow("MoSm_2id") << 3 << 2 << "SM control notify AlphaIdNotProvided" + << 2 << 0 << false <<0; + // test commandId ESatSCallControlNotify + QTest::newRow("CallControl_0id") << 4 << 0 << "Call control notify" + << 2 << 1 << false <<0; + QTest::newRow("CallControl_1id") << 4 << 1 << "" + << 2 << 1 << false <<0; + QTest::newRow("CallControl_2id") << 4 << 2 << "Call control notify AlphaIdNotProvided" + << 2 << 1 << false <<0; + // test commandId ESatSSendSsNotify + QTest::newRow("SendSs_0id") << 5 << 0 << "Send SS notify" + << 2 << 2 << false <<0; + QTest::newRow("SendSs_1id") << 5 << 1 << "" + << 2 << 2 << false <<0; + QTest::newRow("SendSs_2id") << 5 << 2 << "Send SS notify AlphaIdNotProvided" + << 2 << 2 << false <<0; + // test commandId ESatSSendUssdNotify + QTest::newRow("SendUssd_0id") << 6 << 0 << "Send Ussd notify" + << 2 << 3 << false <<0; + // test commandId ESatSSendUssdNotify + QTest::newRow("SendUssd_1id") << 6 << 1 << "" + << 2 << 3 << false <<0; + // test commandId ESatSSendUssdNotify + QTest::newRow("SendUssd_2id") << 6 << 2 << "Send Ussd notify AlphaIdNotProvided" + << 2 << 3 << false <<0; + // test commandId ESatSSendDtmfNotify + QTest::newRow("SendDtmf_0id") << 7 << 0 << "Send dtmf notify" + << 2 << 3 << false <<0; + QTest::newRow("SendDtmf_1id") << 7 << 1 << "Send dtmf notify" + << 2 << 3 << false <<0; + QTest::newRow("SendDtmf_2id") << 7 << 2 << "Send dtmf notify AlphaIdNotProvided" + << 2 << 3 << false <<0; + // test commandId ESatSSendSmsNotify + QTest::newRow("SendSm_0id") << 8 << 0 << "SendSm notify" + << 2 << 2 << false <<0; + QTest::newRow("SendSm_1id") << 8 << 1 << "SendSm notify" + << 2 << 2 << false <<0; + QTest::newRow("SendSm_2id") << 8 << 2 << "SendSm notify AlphaIdNotProvided" + << 2 << 2 << false <<0; + qDebug("Ut_SatAppServerDispatcher::testNotification_data <"); +} + +// ----------------------------------------------------------------------------- +// Ut_SatAppServerDispatcher::testNotification +// +// Connects to test object signal and verifies received data. +// ----------------------------------------------------------------------------- +void Ut_SatAppServerDispatcher::testNotification() +{ + qDebug("Ut_SatAppServerDispatcher::testNotification >"); + QVERIFY(mServer); + QFETCH(int, commandId); + QFETCH(int, alphaIdStatus); + QFETCH(QString, text); + QFETCH(int, iconIdIdentifier); + QFETCH(int, iconIdQualifier); + QFETCH(bool, isRequestedIconDisplayed); + QFETCH(int, controlResult); + + // aCommandId + TSatSNotifyCommand aCommandId = static_cast(commandId); + // aAlphaIdStatus + TSatAlphaIdStatus aAlphaIdStatus = static_cast(alphaIdStatus); + // text + HBufC* hText = HBufC::New(text.length()); + TPtr aText( hText->Des() ); + aText.Copy( text.utf16() ); + + // aIconId + TSatIconId aIconId; + aIconId.iIdentifier = iconIdIdentifier; + aIconId.iIconQualifier = static_cast(iconIdQualifier); + // aRequestedIconDisplayed + TBool aRequestedIconDisplayed(isRequestedIconDisplayed); + // aRequestedIconDisplayed + TSatControlResult aControlResult = static_cast(controlResult); + ServerDispatcherHelper helper; + connect(mServer,SIGNAL(notification(SatAppAction&)),&helper,SLOT(exec(SatAppAction&))); + mServer->Notification( + aCommandId, + aAlphaIdStatus, + aText, + aIconId, + aRequestedIconDisplayed, + aControlResult + ); + delete hText; + hText = 0; + qDebug("Ut_SatAppServerDispatcher::testNotification <"); +} + +// ----------------------------------------------------------------------------- +// Ut_SatAppServerDispatcher::testEventNotification_data +// +// Connects to test object signal and verifies received data. +// ----------------------------------------------------------------------------- +void Ut_SatAppServerDispatcher::testEventNotification_data() +{ + qDebug("Ut_SatAppServerDispatcher::testEventNotification_data >"); + QTest::addColumn("eventId");// enum 0~6 + + // test eventId ESatSRefreshStartEvent + QTest::newRow("RefreshStartEvent") << 0 ; + // test eventId ESatSRefreshEndEvent + QTest::newRow("RefreshEndEvent") << 1; + // test eventId ESatSSmEndEvent + QTest::newRow("SSmEndEvent") << 2; + // test eventId ESatSClearScreenEvent + QTest::newRow("ClearScreenEvent") << 3; + // test eventId ESatSCloseSatUiAppEvent + QTest::newRow("CloseSatUiAppEvent") << 4; + // test eventId ESatSsEndEvent + QTest::newRow("SsEndEvent") << 5; + // test eventId ESatSsErrorEvent + QTest::newRow("SsErrorEvent") << 6; + // test eventId ESatSDtmfEndEvent + QTest::newRow("DtmfEndEvent") << 7; + + qDebug("Ut_SatAppServerDispatcher::testEventNotification_data <"); +} + +// ----------------------------------------------------------------------------- +// Ut_SatAppServerDispatcher::testEventNotification +// +// Connects to test object signal and verifies received data. +// ----------------------------------------------------------------------------- +void Ut_SatAppServerDispatcher::testEventNotification() +{ + qDebug("Ut_SatAppServerDispatcher::testEventNotification >"); + QVERIFY(mServer); + QFETCH(int, eventId); + + TSatSEvent aEventId = static_cast(eventId); + TSatSEventStatus aEventStatus = ESatEventCompleteOk; + mServer->EventNotification(aEventId, aEventStatus, 0); + qDebug("Ut_SatAppServerDispatcher::testEventNotification <"); +} + + +void Ut_SatAppServerDispatcher::testMenuSelection() +{ + // menu selection 1 + SatAppAction* a = new SatAppAction(ESatSetUpMenuAction,mServer); + a->set(KeySelection,4); + a->set(KeyHelpRequested,false); + connect(a,SIGNAL(actionCompleted(SatAppAction*)),mServer,SLOT(menuSelection(SatAppAction*))); + a->completeWithSuccess(); + + // menu selection 2 - with different params + SatAppAction* b = new SatAppAction(ESatSetUpMenuAction,mServer); + b->set(KeySelection,4); + b->set(KeyHelpRequested,false); + connect(b,SIGNAL(actionCompleted(SatAppAction*)),mServer,SLOT(menuSelection(SatAppAction*))); + b->completeWithSuccess(); + + // menu selection 3 - no user resp + SatAppAction* c = new SatAppAction(ESatSetUpMenuAction,mServer); + connect(c,SIGNAL(actionCompleted(SatAppAction*)),mServer,SLOT(menuSelection(SatAppAction*))); + c->completeWithNoResponse(); + + // menu selection 4 - session terminated + SatAppAction* d = new SatAppAction(ESatSetUpMenuAction,mServer); + connect(d,SIGNAL(actionCompleted(SatAppAction*)),mServer,SLOT(menuSelection(SatAppAction*))); + d->completeWithSessionTerminated(); + +} + +void Ut_SatAppServerDispatcher::testUserCancelSession() +{ + SatAppAction* a = new SatAppAction(ESatSetUpMenuAction); + mServer->userCancelSession(a); +} + + +/*! +*User cancel response, Send DTMF, Send Data, Receive Data +*/ + +// helper class +void ServerDispatcherHelper::exec(SatAppAction& action) +{ + action.completeWithSuccess(); +} + +void ServerDispatcherHelper::simulateItemSelected(SatAppAction& action) +{ + action.set(KeySelection, 0); +} + +// End of file diff -r 1f002146abb4 -r cee7e9e0906c satui/satapp/tsrc/ut_satapp/src/ut_satapptoneprovider.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/satui/satapp/tsrc/ut_satapp/src/ut_satapptoneprovider.cpp Wed Aug 18 10:19:22 2010 +0300 @@ -0,0 +1,625 @@ +/* +* Copyright (c) 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" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Unit test for satappmainhandler +* +*/ + +#include +#include "ut_satapptoneprovider.h" +#include "satapptoneprovider.h" +#include "satappaction.h" + +// ----------------------------------------------------------------------------- +// Ut_SatAppToneProvider::Ut_SatAppToneProvider +// ----------------------------------------------------------------------------- +// +Ut_SatAppToneProvider::Ut_SatAppToneProvider(QObject *parent):QObject(parent) +{ +} + +// ----------------------------------------------------------------------------- +// Ut_SatAppToneProvider::testCreateProvider +// +// Connects to test object signal and verifies received data. +// ----------------------------------------------------------------------------- +void Ut_SatAppToneProvider::testCreateProvider_data() +{ + QTest::addColumn("timer"); + QTest::newRow("t01") << false; + QTest::newRow("t01") << true; +} + +// ----------------------------------------------------------------------------- +// Ut_SatAppToneProvider::testCreateProvider +// +// Connects to test object signal and verifies received data. +// ----------------------------------------------------------------------------- +void Ut_SatAppToneProvider::testCreateProvider() +{ + QFETCH(bool, timer); + ToneProviderTest test; + if(timer){ + test.ConstructTimer(false); + } + QVERIFY(test.mTone); +} + +// ----------------------------------------------------------------------------- +// Ut_SatAppToneProvider::testClearScreen +// +// Connects to test object signal and verifies received data. +// ----------------------------------------------------------------------------- +void Ut_SatAppToneProvider::testClearScreen() +{ + ToneProviderTest test; + test.mTone->clearScreen(); + QVERIFY(!test.isMessageBoxShown()); + QVERIFY(!test.isTimerActive()); +} + + +// ----------------------------------------------------------------------------- +// Ut_SatAppToneProvider::testPlayTone_data +// +// Connects to test object signal and verifies received data. +// ----------------------------------------------------------------------------- +void Ut_SatAppToneProvider::testPlayTone_data() +{ + QTest::addColumn("text"); + QTest::addColumn("tone"); + QTest::addColumn("duration"); + QTest::addColumn("exp_result"); + + QTest::newRow("t01") << "Standard" << 0x01 << 0 << 0x32; // exp result changed + QTest::newRow("t02") << "Standard" << 0x02 << 100 << 0; + QTest::newRow("t03") << "Standard" << 0x03 << 1000 << 0; + QTest::newRow("t04") << "Standard" << 0x04 << 0 << 0; + QTest::newRow("t05") << "Standard" << 0x05 << 100 << 0; + QTest::newRow("t06") << "Standard" << 0x07 << 1000 << 0; + QTest::newRow("t07") << "" << 0x07 << 100 << 0; + QTest::newRow("t08") << "" << 0x08 << 500 << 0; + QTest::newRow("t09") << "" << 0x09 << 1000 << 0x32; // exp result changed + QTest::newRow("t10") << "User" << 0x13 << 1000 << 0; + QTest::newRow("t11") << "User" << 0x14 << 500 << 0; + QTest::newRow("t12") << "Illegal" << 0x99 << 100 << 0x32; +} + +// ----------------------------------------------------------------------------- +// Ut_SatAppToneProvider::testPlayTone +// ----------------------------------------------------------------------------- +void Ut_SatAppToneProvider::testPlayTone() +{ + QFETCH(QString, text); + QFETCH(int, tone); + QFETCH(int, duration); + QFETCH(int, exp_result); + + ToneProviderTest test; + TSatUiResponse resp(ESatSuccess); + + SatAppAction action(ESatPlayToneAction); + action.set(KeyToneId,tone); + action.set(KeyDuration,duration); + action.set(KeyText,text); + test.mTone->playTone(action); + action.waitUntilCompleted(); + resp = action.response(); + + QCOMPARE((int)resp, exp_result); +} + +// ----------------------------------------------------------------------------- +// Ut_SatAppToneProvider::testplayStandardTone_data +// +// Connects to test object signal and verifies received data. +// ----------------------------------------------------------------------------- +void Ut_SatAppToneProvider::testplayDoubleTone_data() +{ + QTest::addColumn("text"); + QTest::addColumn("tone"); + QTest::addColumn("duration"); + QTest::addColumn("timer"); + QTest::addColumn("active"); + + QTest::newRow("t01") << "Standard" << 0x10 << 0 << false << false; + QTest::newRow("t02") << "Standard" << 0x10 << 0 << true << true; + QTest::newRow("t03") << "Standard" << 0x10 << 0 << true << false; + QTest::newRow("t04") << "Standard" << 0x13 << 0 << false << false; + QTest::newRow("t04") << "Standard" << 0x14 << 0 << true << true; + QTest::newRow("t04") << "" << 0x13 << 0 << true << false; + +} + +// ----------------------------------------------------------------------------- +// Ut_SatAppToneProvider::testplayStandardTone +// ----------------------------------------------------------------------------- +void Ut_SatAppToneProvider::testplayDoubleTone() +{ + QFETCH(QString, text); + QFETCH(int, tone); + QFETCH(int, duration); + QFETCH(bool, timer); + QFETCH(bool, active); + + ToneProviderTest test; + TSatUiResponse resp(ESatSuccess); + if(timer){ + test.ConstructTimer(active); + } + + SatAppAction action(ESatPlayToneAction); + action.set(KeyToneId,tone); + action.set(KeyDuration,duration); + action.set(KeyText,text); + test.mTone->playTone(action); + action.waitUntilCompleted(); + resp = action.response(); +} + +// ----------------------------------------------------------------------------- +// Ut_SatAppToneProvider::testPlayToneAndClearScreen +// ----------------------------------------------------------------------------- +void Ut_SatAppToneProvider::testPlayToneAndClearScreen() +{ + ToneProviderTest test; + + // timer for clearing screen after 1 sec. + QTimer::singleShot(1000, test.mTone, SLOT(clearScreen())); + + // start playing + TSatUiResponse result(ESatFailure); + SatAppAction action(ESatPlayToneAction); + action.set(KeyToneId,0x01); + action.set(KeyDuration,3000); + action.set(KeyText,QString("play")); + test.mTone->playTone(action); + action.waitUntilCompleted(); + result = action.response(); + +// QCOMPARE(result, ESatSuccessToneNotPlayed); TODO:which? + QCOMPARE(result, ESatSuccess); +} + +// ----------------------------------------------------------------------------- +// Ut_SatAppToneProvider::testMatoPlayComplete_data +// +// Connects to test object signal and verifies received data. +// ----------------------------------------------------------------------------- +void Ut_SatAppToneProvider::testMatoPrepareComplete_data() +{ + QTest::addColumn("error"); + QTest::addColumn("tone"); + QTest::newRow("error_0") << 0 << true; + QTest::newRow("error_-1") << -1 << false; + QTest::newRow("error_-2") << 0 << false; +} + +// ----------------------------------------------------------------------------- +// Ut_SatAppToneProvider::testMatoPlayComplete +// +// Connects to test object signal and verifies received data. +// ----------------------------------------------------------------------------- +void Ut_SatAppToneProvider::testMatoPrepareComplete() +{ + QFETCH(int, error); + QFETCH(bool, tone); + ToneProviderTest test; + + if(tone) + test.ConstructAudioTone(); + + test.mTone->MatoPrepareComplete(error); + + test.DestroyAudioTone(); +} + +//// ----------------------------------------------------------------------------- +//// Ut_SatAppToneProvider::testMatoPlayComplete_data +//// +//// Connects to test object signal and verifies received data. +//// ----------------------------------------------------------------------------- +//void Ut_SatAppToneProvider::testMatoPlayComplete_data() +//{ +// QTest::addColumn("error"); +// QTest::addColumn("tone"); +// QTest::newRow("error_0") << 0 << true; +// QTest::newRow("error_-1") << -1 << false; +// QTest::newRow("error_-2") << 0 << false; +//} +// +//// ----------------------------------------------------------------------------- +//// Ut_SatAppToneProvider::testMatoPlayComplete +//// +//// Connects to test object signal and verifies received data. +//// ----------------------------------------------------------------------------- +//void Ut_SatAppToneProvider::testMatoPlayComplete() +//{ +// QFETCH(int, error); +// QFETCH(bool, tone); +// ToneProviderTest test; +// +// if(tone) +// test.ConstructAudioTone(); +// +// test.mTone->MatoPrepareComplete(error); +// test.mTone->MatoPlayComplete(error); +// +// test.DestroyAudioTone(); +//} +// +//// ----------------------------------------------------------------------------- +//// Ut_SatAppToneProvider::testMapcPlayComplete_data +//// +//// Connects to test object signal and verifies received data. +//// ----------------------------------------------------------------------------- +//void Ut_SatAppToneProvider::testMapcPlayComplete_data() +//{ +// QTest::addColumn("player"); +// QTest::newRow("t_true") << true; +// QTest::newRow("t_false") << false; +//} +// +//// ----------------------------------------------------------------------------- +//// Ut_SatAppToneProvider::testMapcPlayComplete +//// +//// Connects to test object signal and verifies received data. +//// ----------------------------------------------------------------------------- +//void Ut_SatAppToneProvider::testMapcPlayComplete() +//{ +// QFETCH(bool, player); +// TInt error = 0; +// ToneProviderTest test; +// +// if(player) +// test.ConstructAudioPlayer(); +// +// test.mTone->MapcPlayComplete(error); +// +// test.DestroyAudioPlayer(); +//} + +// ----------------------------------------------------------------------------- +// Ut_SatAppToneProvider::testMapcInitComplete_data +// +// Connects to test object signal and verifies received data. +// ----------------------------------------------------------------------------- +void Ut_SatAppToneProvider::testMapcInitComplete_data() +{ + QTest::addColumn("error"); + QTest::addColumn("player"); + QTest::newRow("error_0") << 0 << false; + QTest::newRow("error_-6") << -6 << true; + QTest::newRow("error_-6") << -6 << false; +} + +// ----------------------------------------------------------------------------- +// Ut_SatAppToneProvider::testMapcInitComplete +// +// Connects to test object signal and verifies received data. +// ----------------------------------------------------------------------------- +void Ut_SatAppToneProvider::testMapcInitComplete() +{ + QFETCH(int, error); + QFETCH(bool, player); + ToneProviderTest test; + + if(player) + test.ConstructAudioPlayer(); + + test.mTone->MapcInitComplete(error, 0); + + test.DestroyAudioPlayer(); +} + +// ----------------------------------------------------------------------------- +// Ut_SatAppToneProvider::testRecognizeTone_data +// +// Connects to test object signal and verifies received data. +// ----------------------------------------------------------------------------- +void Ut_SatAppToneProvider::testRecognizeTone_data() +{ + QTest::addColumn("tone"); + QTest::addColumn("duration"); + + QTest::newRow("t01") << -1 << 0; + QTest::newRow("t01") << -1 << 1; + QTest::newRow("t01") << 0x01 << 0; + QTest::newRow("t01") << 0x01 << 1; + QTest::newRow("t01") << 0x02 << 0; + QTest::newRow("t01") << 0x02 << 1; + QTest::newRow("t01") << 0x03 << 0; + QTest::newRow("t01") << 0x03 << 1; + QTest::newRow("t01") << 0x04 << 0; + QTest::newRow("t01") << 0x04 << 1; + QTest::newRow("t01") << 0x05 << 0; + QTest::newRow("t01") << 0x05 << 1; + QTest::newRow("t01") << 0x06 << 0; + QTest::newRow("t01") << 0x06 << 1; + QTest::newRow("t01") << 0x07 << 0; + QTest::newRow("t01") << 0x07 << 1; + QTest::newRow("t01") << 0x08 << 0; + QTest::newRow("t01") << 0x08 << 1; + QTest::newRow("t01") << 0x09 << 0; + + QTest::newRow("t01") << 0x10 << 0; + QTest::newRow("t01") << 0x10 << 1; + QTest::newRow("t01") << 0x11 << 0; + QTest::newRow("t01") << 0x11 << 1; + QTest::newRow("t01") << 0x12 << 0; + QTest::newRow("t01") << 0x12 << 1; + QTest::newRow("t02") << 0x13 << 0; + + QTest::newRow("t02") << 0x14 << 0; + + +} + +// ----------------------------------------------------------------------------- +// Ut_SatAppToneProvider::testRecognizeTone +// +// Connects to test object signal and verifies received data. +// ----------------------------------------------------------------------------- +void Ut_SatAppToneProvider::testRecognizeTone() +{ + QFETCH(int, tone); + QFETCH(int, duration); + + ToneProviderTest test; + test.TestRecognizeTone(tone, duration); +} + +// ----------------------------------------------------------------------------- +// Ut_SatAppToneProvider::testPrepareAudioToneUtility +// +// Connects to test object signal and verifies received data. +// ----------------------------------------------------------------------------- +void Ut_SatAppToneProvider::testPrepareAudioToneUtility() +{ + ToneProviderTest test; + test.ConstructAudioTone(); + test.ConstructAudioTone(); +} + +// --------------------------------------------------------------- +// internal helper class +// --------------------------------------------------------------- + +ToneProviderTest::ToneProviderTest() +{ + mTone = new SatAppToneProvider(this); +} + +ToneProviderTest::~ToneProviderTest() +{ + cleanup(); +} + +/** + * Singleton Pattern - not used + */ +SatAppToneProvider* ToneProviderTest::getToneInstance() +{ + +} + +bool ToneProviderTest::isMessageBoxShown() +{ + if (mTone->mPermanentNote) { + return true; + } + return false; +} + +bool ToneProviderTest::isTimerActive() +{ + if (mTone->mTimer && mTone->mTimer->isActive()) { + return true; + } + return false; +} + +void ToneProviderTest::ConstructAudioTone() +{ + QByteArray sequence; + sequence = KNetToneSeqDial; + TPtrC8 seq((unsigned char*)sequence.constData(),sequence.length()); + if(mTone) + QT_TRAP_THROWING(mTone->SymbianPrepareAudioToneUtilityL(seq)); +} + +void ToneProviderTest::DestroyAudioTone() +{ + if(mTone) + mTone->SymbianStopAudioToneUtility(); +} + +void ToneProviderTest::ConstructAudioPlayer() +{ + int tone = ESatToneNotSet; + int duration = 0; + if(mTone) + QT_TRAP_THROWING(mTone->SymbianPrepareAudioPlayerL(tone,duration)); +} + +void ToneProviderTest::DestroyAudioPlayer() +{ + if(mTone) + mTone->SymbianStopAudioPlayer(); +} + +void ToneProviderTest::ConstructTimer(bool active) +{ + mTone->mTimer = new QTimer(mTone); + connect(mTone->mTimer, SIGNAL(timeout()), + mTone, SLOT(stopPlayTone())); + if(active) + mTone->mTimer->start(3000); +} + +void ToneProviderTest::DestroyTimer() +{ + +} + +void ToneProviderTest::SetPlayToneResult(TSatUiResponse error) +{ + mTone->mPlayToneError = error; +} + +void ToneProviderTest::TestRecognizeTone(int tone, int duration) +{ + QByteArray sequence; + mTone->recognizeTone(tone, sequence, duration); +} + +void ToneProviderTest::cleanup() +{ + delete mTone; + mTone = 0; +} + +// **************************************************************************** +// * ************************************************************************ * +// * * SYMBIAN MOC PART * * +// * ************************************************************************ * +// **************************************************************************** + + +// includes +#include +#include +#include +#include +#include +#include //MMdaAudioToneObserver + +class CMocProfileTones : public MProfileTones + { + public: + CMocProfileTones() + { + // Set TProfileToneSettings with specified value + iToneSettings.iWarningAndGameTones = EFalse; + TBuf<256> ringTone(_L("Z:\\Data\\Sounds\\Digital\\Nokia tune.aac")); + TBuf<256> alertTone(_L("Z:\\Data\\Sounds\\Digital\\Message 1.aac")); + iTone = ringTone; + } + virtual ~CMocProfileTones() {} + + public: + virtual const TDesC& RingingTone1() const + { + //DONE + return iTone; + } + virtual const TDesC& RingingTone2() const + { + //DONE + return iTone; + } + virtual const TDesC& MessageAlertTone() const + { + //DONE + return iTone; + } + virtual const TProfileToneSettings& ToneSettings() const + { + //DONE: Return TProfileToneSettings + return iToneSettings; + } + private: + TProfileToneSettings iToneSettings; + TBuf<256> iTone; + }; + +class CMocProFile : public MProfile + { + public: + static CMocProFile* NewLC() + { + CMocProFile* self = new( ELeave ) CMocProFile; + CleanupStack::PushL( self ); + self->ConstructL(); + return self; + } + virtual ~CMocProFile() {} + protected: + CMocProFile() {} + void ConstructL() + { + iTones = new(ELeave) CMocProfileTones; + } + + public: // New functions + virtual void Release() {} + virtual const TArray AlertForL() {} + virtual TBool IsSilent() const { return EFalse; } + virtual const MProfileName& ProfileName() const {} + virtual const MProfileTones& ProfileTones() const + { + //DONE: return an MProfileTones object + return *iTones; + } + virtual const MProfileExtraTones& ProfileExtraTones() const {} + virtual const MProfileExtraSettings& ProfileExtraSettings() const {} + + private: + MProfileTones* iTones; + }; + +class CMocProfileEngine : public MProfileEngine + { + public: + CMocProfileEngine() {}; + virtual ~CMocProfileEngine() {}; + public: + virtual void Release() {}; + virtual MProfile* ActiveProfileLC() + { + //DONE: Create an MProfile object + MProfile* pf = CMocProFile::NewLC(); + return pf; + } + virtual MProfile* ActiveProfileL() { return NULL; }; + virtual TInt ActiveProfileId() { return 0; }; + virtual MProfilesNamesArray* ProfilesNamesArrayLC() { return NULL; }; + virtual void SetActiveProfileL( TInt /*aId*/ ) {}; + virtual void SetTempRingingVolumeL( TProfileRingingVolume /*aVolume*/ ) {}; + virtual TProfileRingingVolume TempRingingVolumeL() const { + return EProfileRingingVolumeLevel1; + } + virtual void SetTempMediaVolumeL( TProfileRingingVolume /*aVolume*/ ) {}; + virtual TProfileRingingVolume TempMediaVolumeL() const { + return EProfileRingingVolumeLevel1; + } + virtual TBool IsFeatureSupported( + TProfileFeatureId /*aFeatureId*/ ) const { return EFalse; }; + virtual TBool IsActiveProfileTimedL() { return EFalse; }; + + }; + +// ---------------------------------------------------------------------------- +// CreateProfileEngineL moc +// create profile engine +// ---------------------------------------------------------------------------- +// +//MProfileEngine* CreateProfileEngineL() +// { +// +// MProfileEngine* pe = new( ELeave ) CMocProfileEngine; +// return pe; +// } + +// End of file + diff -r 1f002146abb4 -r cee7e9e0906c satui/satapp/tsrc/ut_satapp/ut_satapp.pro --- a/satui/satapp/tsrc/ut_satapp/ut_satapp.pro Tue Jul 06 14:53:02 2010 +0300 +++ b/satui/satapp/tsrc/ut_satapp/ut_satapp.pro Wed Aug 18 10:19:22 2010 +0300 @@ -15,69 +15,71 @@ # TEMPLATE = app -TARGET = utsatapp +TARGET = ut_satapp DEPENDPATH += . INCLUDEPATH += . CONFIG += hb CONFIG += qtestlib HEADERS += $$PUBLIC_HEADERS -MOC_DIR = moc_utsatapp +MOC_DIR = moc symbian { - TARGET.CAPABILITY = CAP_GENERAL_DLL - INCLUDEPATH += $$MW_LAYER_SYSTEMINCLUDE \ - .inc \ - ../../../../inc \ - .MOC_DIR + TARGET.CAPABILITY = CAP_APPLICATION +} + +INCLUDEPATH += $$MW_LAYER_SYSTEMINCLUDE \ + $$MOC_DIR \ + ../../../../inc \ + ../../inc - LIBS += -lSatClient.dll \ - -lSatInternalClient.dll \ - -legul.dll \ - -lfbscli.dll \ - -lcentralrepository.dll \ - -lCenRepNotifHandler.dll \ - -lCdlEngine.dll \ - -lFlogger.dll \ - -lbafl.dll \ - -lprofileeng.dll +LIBS += -legul \ + -lfbscli \ + -lcentralrepository \ + -lCenRepNotifHandler \ + -lCdlEngine \ + -lbafl \ + -lmediaclientaudio \ + -lprofileeng \ + -lFlogger - HEADERS += ../../inc \ - ../../inc/msatuiactionimplementer.h \ - ../../inc/satappcommonconstant.h \ - ../../inc/tflogger.h \ - ../../inc/satappmainhandler.h \ - ../../inc/csatuiobserver.h\ - ../../inc/satappcommandhandler.h \ - ../../inc/satappeventprovider.h \ - ../../inc/satappuiprovider.h \ - ../../inc/satappview.h \ - ../../inc/satappgetinkeynote.h \ - ../../inc/csatuiobserver.h \ - ../../inc/csatuiiconhandler.h \ - ../../inc/satappplaytoneprovider.h \ - inc/dummyeventprovider.h \ - inc/dummyplaytoneprovider.h \ - inc/ut_satappmainhandler.h \ - inc/ut_csatuiobserver.h \ - inc/ut_satappeventhandler.h \ - inc/ut_playtoneprovider.h +HEADERS += ../../inc \ + ../../inc/satappmainhandler.h \ + ../../inc/satappserverdispatcher.h \ + ../../inc/satappmenuprovider.h \ + ../../inc/satappinputprovider.h \ + ../../inc/satapptoneprovider.h \ + ../../inc/satapppopupprovider.h \ + ../../inc/satappconfirmprovider.h \ + ../../inc/satappaction.h \ + ../../inc/satappconstant.h \ + inc/ut_satappmainhandler.h \ + inc/ut_satappserverdispatcher.h \ + inc/ut_satappmenuprovider.h \ + inc/ut_satappinputprovider.h \ + inc/ut_satapptoneprovider.h \ + inc/ut_satapppopupprovider.h \ + inc/ut_satappconfirmprovider.h \ + inc/ut_satappaction.h - SOURCES += ../../src/csatuiobserver.cpp \ - ../../src/satappmainhandler.cpp \ - ../../src/satappcommandhandler.cpp \ - ../../src/satappuiprovider.cpp \ - ../../src/satappeventprovider.cpp \ - ../../src/satappview.cpp \ - ../../src/satappgetinkeynote.cpp \ - ../../src/csatuiiconhandler.cpp\ - ../../src/satappplaytoneprovider.cpp\ - src/main.cpp \ - src/dummyeventprovider.cpp \ - src/dummyplaytoneprovider.cpp \ - src/ut_satappmainhandler.cpp \ - src/ut_csatuiobserver.cpp \ - src/ut_satappeventhandler.cpp \ - src/ut_playtoneprovider.cpp +SOURCES += ../../src/satappmainhandler.cpp \ + ../../src/satappserverdispatcher.cpp \ + ../../src/satappmenuprovider.cpp \ + ../../src/satappinputprovider.cpp \ + ../../src/satapptoneprovider.cpp \ + ../../src/satapppopupprovider.cpp \ + ../../src/satappconfirmprovider.cpp \ + ../../src/satappaction.cpp \ + src/main.cpp \ + src/ut_satappmainhandler.cpp \ + src/ut_satappserverdispatcher.cpp \ + src/ut_satappmenuprovider.cpp \ + src/ut_satappinputprovider.cpp \ + src/ut_satapptoneprovider.cpp \ + src/ut_satapppopupprovider.cpp \ + src/ut_satappconfirmprovider.cpp \ + src/ut_satappaction.cpp \ + src/rsat_stub.cpp -} +RESOURCES += ../../resource/satapp.qrc + diff -r 1f002146abb4 -r cee7e9e0906c telutils/dialpad/bwins/dialpadu.def --- a/telutils/dialpad/bwins/dialpadu.def Tue Jul 06 14:53:02 2010 +0300 +++ b/telutils/dialpad/bwins/dialpadu.def Wed Aug 18 10:19:22 2010 +0300 @@ -61,4 +61,5 @@ ?metaObject@DialpadKeyHandler@@UBEPBUQMetaObject@@XZ @ 60 NONAME ; struct QMetaObject const * DialpadKeyHandler::metaObject(void) const ??0DialpadKeyHandler@@QAE@PAVDialpad@@AAVHbMainWindow@@PAVQObject@@@Z @ 61 NONAME ; DialpadKeyHandler::DialpadKeyHandler(class Dialpad *, class HbMainWindow &, class QObject *) ?isCallButtonEnabled@Dialpad@@QBE_NXZ @ 62 NONAME ; bool Dialpad::isCallButtonEnabled(void) const + ?changeEvent@Dialpad@@MAEXPAVQEvent@@@Z @ 63 NONAME ; void Dialpad::changeEvent(class QEvent *) diff -r 1f002146abb4 -r cee7e9e0906c telutils/dialpad/dialpad.pro --- a/telutils/dialpad/dialpad.pro Tue Jul 06 14:53:02 2010 +0300 +++ b/telutils/dialpad/dialpad.pro Wed Aug 18 10:19:22 2010 +0300 @@ -37,7 +37,8 @@ inc/dialpadvideomailboxeventfilter.h \ inc/dialpadmailboxeventfilterbase.h \ inc/dialpademergencycalleventfilter.h \ - inc/dialpadhasheventfilter.h + inc/dialpadhasheventfilter.h \ + inc/dialpadnumericbutton.h SOURCES += src/dialpad.cpp \ src/dialpadbutton.cpp \ @@ -54,7 +55,8 @@ src/dialpadmailboxeventfilterbase.cpp \ src/dialpademergencycalleventfilter.cpp \ src/dialpadvtkeyhandler.cpp \ - src/dialpadhasheventfilter.cpp + src/dialpadhasheventfilter.cpp \ + src/dialpadnumericbutton.cpp RESOURCES += dialpad.qrc diff -r 1f002146abb4 -r cee7e9e0906c telutils/dialpad/eabi/dialpadu.def --- a/telutils/dialpad/eabi/dialpadu.def Tue Jul 06 14:53:02 2010 +0300 +++ b/telutils/dialpad/eabi/dialpadu.def Wed Aug 18 10:19:22 2010 +0300 @@ -68,4 +68,5 @@ _ZThn8_N7DialpadD0Ev @ 67 NONAME _ZThn8_N7DialpadD1Ev @ 68 NONAME _ZNK7Dialpad19isCallButtonEnabledEv @ 69 NONAME + _ZN7Dialpad11changeEventEP6QEvent @ 70 NONAME diff -r 1f002146abb4 -r cee7e9e0906c telutils/dialpad/inc/dialpadkeypad.h --- a/telutils/dialpad/inc/dialpadkeypad.h Tue Jul 06 14:53:02 2010 +0300 +++ b/telutils/dialpad/inc/dialpadkeypad.h Wed Aug 18 10:19:22 2010 +0300 @@ -18,10 +18,13 @@ #ifndef DIALPADKEYPAD_H #define DIALPADKEYPAD_H +#include +#include #include class DialpadInputField; class DialpadButton; +class DialpadNumericButton; class QSignalMapper; class QGraphicsGridLayout; @@ -53,10 +56,44 @@ void sendLongPressEvent(const QKeyEvent& event); void handleKeyChangeEvent(const QKeyEvent& releaseEvent, const QKeyEvent& pressEvent); + void cancelButtonPress(); + +protected: + void postKeyEvent(QEvent::Type type, int key); + void sendKeyEventToEditor(QEvent::Type type, int key); + + inline DialpadNumericButton* button(int i) const; + void updateButtonLabels(); + void updateColorArray(); + void updateIconColor(); + void updateTextLayouts(const QSizeF &size); + void resolveTextContent(QList &content); + void createTextLayouts(const QSizeF &size, + const QList &content); + void layoutTextLines(const QSizeF &size, + QTextLayout &textLayout, + int state, + int type); + +protected: + void paint(QPainter* painter, + const QStyleOptionGraphicsItem* option, + QWidget* widget); + void setGeometry(const QRectF &rect); + void changeEvent(QEvent *event); private: - void postKeyEvent(QEvent::Type type, int key); - void sendKeyEventToEditor(QEvent::Type type, int key); + enum ButtonState { + Normal = 0, + Pressed, + StateCount + }; + + enum TextType { + PrimaryText = 0, + SecondaryText, + TextTypeCount + }; private: const HbMainWindow& mMainWindow; @@ -65,6 +102,10 @@ QMap mGeneratedChar; int mPressedNumericKey; DialpadButton* mCallButton; + QList mColors; + QList mTextLayouts; + qreal mUnit; + qreal mMaxPrimaryLineWidth; }; #endif // DIALPADKEYPAD_H diff -r 1f002146abb4 -r cee7e9e0906c telutils/dialpad/inc/dialpadnumericbutton.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/telutils/dialpad/inc/dialpadnumericbutton.h Wed Aug 18 10:19:22 2010 +0300 @@ -0,0 +1,47 @@ +/*! +* Copyright (c) 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" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Extends HbInputButton +* +*/ + +#ifndef DIALPADNUMERICBUTTON_H +#define DIALPADNUMERICBUTTON_H + +#include +#include + +class DialpadNumericButton : public HbInputButton +{ + Q_OBJECT + +public: + explicit DialpadNumericButton(int keyCode, const QPoint &position, const QSize &size = QSize(1, 1)); + virtual ~DialpadNumericButton(); + + void setIcon(const HbIcon& icon); + HbIcon& icon(); + + void setText(const QString& text); + QString text() const; + + void setSecondaryText(const QString& text); + QString secondaryText() const; + +private: + HbIcon mIcon; + QString mText; + QString mSecondaryText; +}; + +#endif // DIALPADNUMERICBUTTON_H diff -r 1f002146abb4 -r cee7e9e0906c telutils/dialpad/resources/dialpad.css --- a/telutils/dialpad/resources/dialpad.css Tue Jul 06 14:53:02 2010 +0300 +++ b/telutils/dialpad/resources/dialpad.css Wed Aug 18 10:19:22 2010 +0300 @@ -15,6 +15,6 @@ left: -var(hb-param-margin-gene-middle-horizontal); right: var(hb-param-margin-gene-middle-horizontal); top: -var(hb-param-margin-gene-middle-vertical); - bottom: var(hb-param-margin-gene-middle-vertical);; + bottom: var(hb-param-margin-gene-middle-vertical); } diff -r 1f002146abb4 -r cee7e9e0906c telutils/dialpad/src/dialpad.cpp --- a/telutils/dialpad/src/dialpad.cpp Tue Jul 06 14:53:02 2010 +0300 +++ b/telutils/dialpad/src/dialpad.cpp Wed Aug 18 10:19:22 2010 +0300 @@ -27,6 +27,7 @@ #include #include #include +#include #include "dialpad.h" #include "dialpadinputfield.h" @@ -45,8 +46,8 @@ static const qreal DialpadComponentMargin = 0.75; // units static const qreal DialpadCloseHandleHeight = 2.23; // units static const qreal DialpadCloseHandleWidth = 18.8; // units -static const qreal DialpadCallButtonHeight = 8.0; // units -static const qreal DialpadCallButtonHeightH = 6.0; // units +static const qreal DialpadCallButtonHeight = 8.75; // units, same as numeric buttons +static const qreal DialpadCallButtonHeightH = 7.25; // units static const QLatin1String handsetIcon("qtg_mono_call"); static const QLatin1String vmbxIcon("qtg_mono_voice_mailbox"); @@ -113,7 +114,8 @@ popupLayout->addItem(mKeypad); popupLayout->addItem(&mKeypad->callButton()); popupLayout->setContentsMargins(margin, mCloseHandleHeight, margin, margin); - popupLayout->setSpacing(margin); + popupLayout->setSpacing(0); + popupLayout->setItemSpacing(0,margin); setLayout(popupLayout); // asterisk multitap handler @@ -214,6 +216,16 @@ mIconDrawer->paint(painter, rect); } +void Dialpad::changeEvent(QEvent *event) +{ + if (event->type() == QEvent::LayoutDirectionChange) { + mBackgroundDrawer->setLayoutDirection(layoutDirection()); + } else if (event->type() == HbEvent::ThemeChanged) { + mBackgroundDrawer->themeChanged(); + mIconDrawer->themeChanged(); + } +} + bool Dialpad::isOpen() const { return mIsOpen; diff -r 1f002146abb4 -r cee7e9e0906c telutils/dialpad/src/dialpadbluetootheventfilter.cpp --- a/telutils/dialpad/src/dialpadbluetootheventfilter.cpp Tue Jul 06 14:53:02 2010 +0300 +++ b/telutils/dialpad/src/dialpadbluetootheventfilter.cpp Wed Aug 18 10:19:22 2010 +0300 @@ -44,18 +44,17 @@ bool DialpadBluetoothEventFilter::eventFilter(QObject *watched, QEvent *event) { Q_UNUSED(watched) - QKeyEvent *keyEvent = static_cast(event); - const int keyCode = keyEvent->key(); - const int eventType = event->type(); - - if (eventType == QEvent::KeyPress && keyCode == Qt::Key_Asterisk) { - if (!(mDialpad->editor().text().length() >= 1)) { + + if (event->type() == QEvent::KeyPress) { + QKeyEvent *keyEvent = static_cast(event); + if (keyEvent->key() == Qt::Key_Asterisk && + !(mDialpad->editor().text().length() >= 1)) { //Check that there is only one item in dialpad, if there is more than one //do not handle long key press. mLongPressTimer->stop(); mLongPressTimer->start(DialpadLongKeyPressTimeOut); } - } else if (eventType == QEvent::KeyRelease) { + } else if (event->type() == QEvent::KeyRelease) { mLongPressTimer->stop(); } diff -r 1f002146abb4 -r cee7e9e0906c telutils/dialpad/src/dialpademergencycalleventfilter.cpp --- a/telutils/dialpad/src/dialpademergencycalleventfilter.cpp Tue Jul 06 14:53:02 2010 +0300 +++ b/telutils/dialpad/src/dialpademergencycalleventfilter.cpp Wed Aug 18 10:19:22 2010 +0300 @@ -23,8 +23,6 @@ #ifdef Q_OS_SYMBIAN #include -#include -#include #include #endif //Q_OS_SYMBIAN diff -r 1f002146abb4 -r cee7e9e0906c telutils/dialpad/src/dialpadhasheventfilter.cpp --- a/telutils/dialpad/src/dialpadhasheventfilter.cpp Tue Jul 06 14:53:02 2010 +0300 +++ b/telutils/dialpad/src/dialpadhasheventfilter.cpp Wed Aug 18 10:19:22 2010 +0300 @@ -38,20 +38,18 @@ Q_UNUSED(watched) bool keyEventEaten(false); - QKeyEvent *keyEvent = static_cast(event); - const int keyCode = keyEvent->key(); - const int eventType = event->type(); - - if (eventType == QEvent::KeyPress) { - if ((isLongKeyPressSupported(keyCode)) && - !(mDialpad->editor().text().length() >= 1)) { + if (event->type() == QEvent::KeyPress) { + QKeyEvent *keyEvent = static_cast(event); + if ((isLongKeyPressSupported(keyEvent->key())) && + !(mDialpad->editor().text().length() >= 1)) { //Check that there is only one item in dialpad, if there is more than one //do not handle long key press. mLongPressTimer->stop(); mLongPressTimer->start(DialpadLongKeyPressTimeOut); } - } else if (eventType == QEvent::KeyRelease) { - if (isLongKeyPressSupported(keyCode)){ + } else if (event->type() == QEvent::KeyRelease) { + QKeyEvent *keyEvent = static_cast(event); + if (isLongKeyPressSupported(keyEvent->key())){ mLongPressTimer->stop(); } } diff -r 1f002146abb4 -r cee7e9e0906c telutils/dialpad/src/dialpadkeypad.cpp --- a/telutils/dialpad/src/dialpadkeypad.cpp Tue Jul 06 14:53:02 2010 +0300 +++ b/telutils/dialpad/src/dialpadkeypad.cpp Wed Aug 18 10:19:22 2010 +0300 @@ -25,9 +25,12 @@ #include #include #include +#include #include -#include +#include +#include +#include "dialpadnumericbutton.h" #include "dialpadkeypad.h" #include "dialpadbutton.h" #include "dialpadinputfield.h" @@ -36,7 +39,12 @@ static const int DialpadColumnCount = 3; static const QLatin1String handsetIcon("qtg_mono_call"); static const QLatin1String vmbxIcon("qtg_mono_voice_mailbox"); -static const qreal DialpadKeypadBorderWidth = 0.25; +// layout values in units +static const qreal DialpadPrimaryTextSize = 5.5; +static const qreal DialpadSecondaryTextSize = 4.0; +static const qreal DialpadIconSize = 4.0; +static const qreal DialpadPrimaryTextLeftMargin = 1.5; +static const qreal DialpadPrimarySecondaryMargin = 0.75; static const int DialpadKeyCodeTable[DialpadRowCount*DialpadColumnCount] = { @@ -53,7 +61,8 @@ QGraphicsItem* parent) : HbInputButtonGroup(parent), mMainWindow(mainWindow), - mInputField(inputField) + mInputField(inputField), + mMaxPrimaryLineWidth(0) { setObjectName("keypad"); @@ -70,12 +79,12 @@ // create keypad setGridSize(QSize(DialpadColumnCount, DialpadRowCount)); - setButtonBorderSize(DialpadKeypadBorderWidth); + setButtonBorderSize(0); QList buttons; for (int i = 0; i < DialpadRowCount * DialpadColumnCount; ++i) { - HbInputButton *item = new HbInputButton( + DialpadNumericButton *item = new DialpadNumericButton( DialpadKeyCodeTable[i], QPoint(i % DialpadColumnCount, i / DialpadColumnCount)); buttons.append(item); @@ -114,13 +123,16 @@ // set button texts setButtonTexts(); // set button icons - button(0)->setIcon(HbIcon(vmbxIcon), - HbInputButton::ButtonIconIndexSecondaryFirstRow); + button(0)->setIcon(HbIcon(vmbxIcon)); // update button texts when input language is changed connect(HbInputSettingProxy::instance(), SIGNAL(globalInputLanguageChanged(HbInputLanguage)), this,SLOT(setButtonTexts())); + + updateColorArray(); + + mUnit = HbDeviceProfile::profile(this).unitValue(); } DialpadKeypad::~DialpadKeypad() @@ -144,10 +156,8 @@ if (keyCode == Qt::Key_Asterisk) { // asterisk is not localized QChar asterisk('*'); - button(i)->setText(asterisk, - HbInputButton::ButtonTextIndexPrimary); - button(i)->setText("+", - HbInputButton::ButtonTextIndexSecondaryFirstRow); + button(i)->setText(asterisk); + button(i)->setSecondaryText(QLatin1String("+")); mGeneratedChar.insert(Qt::Key_Asterisk, asterisk); continue; } @@ -155,10 +165,7 @@ if (keyCode == Qt::Key_NumberSign) { // number sign is not localized QChar numberSign('#'); - button(i)->setText(numberSign, - HbInputButton::ButtonTextIndexPrimary); - button(i)->setText(" ", - HbInputButton::ButtonTextIndexSecondaryFirstRow); + button(i)->setText(numberSign); mGeneratedChar.insert(Qt::Key_NumberSign, numberSign); continue; } @@ -175,11 +182,11 @@ QChar numberChar = HbInputUtils::findFirstNumberCharacterBoundToKey( key, - inputLanguage.language()); + inputLanguage.language(), + HbInputUtils::inputDigitType(inputLanguage.language())); // button text - button(i)->setText(numberChar, - HbInputButton::ButtonTextIndexPrimary); + button(i)->setText(numberChar); mGeneratedChar.insert(keyCode,numberChar); // additional text (letters) @@ -194,12 +201,8 @@ QString characters = key->characters(HbModifierNone); - if (numberOfCharacters==0 && keyCode!=Qt::Key_1) { - button(i)->setText(" ", - HbInputButton::ButtonTextIndexSecondaryFirstRow); - } else { - button(i)->setText(characters.left(numberOfCharacters), - HbInputButton::ButtonTextIndexSecondaryFirstRow); + if (numberOfCharacters!=0 && keyCode!=Qt::Key_1) { + button(i)->setSecondaryText(characters.left(numberOfCharacters)); } } } @@ -229,12 +232,15 @@ void DialpadKeypad::sendKeyPressEvent(const QKeyEvent& event) { + updateButtonLabels(); mPressedNumericKey = event.key(); postKeyEvent(QEvent::KeyPress, event.key()); } void DialpadKeypad::sendKeyReleaseEvent(const QKeyEvent& event) { + updateButtonLabels(); + if (mPressedNumericKey) { // short press, update editor here sendKeyEventToEditor(QEvent::KeyPress, event.key()); @@ -246,7 +252,6 @@ void DialpadKeypad::sendLongPressEvent(const QKeyEvent& event) { sendKeyEventToEditor(QEvent::KeyPress, event.key()); - resetButtons(); mPressedNumericKey = 0; } @@ -275,3 +280,298 @@ { return *mCallButton; } + +DialpadNumericButton* DialpadKeypad::button(int i) const +{ + return static_cast(HbInputButtonGroup::button(i)); +} + +void DialpadKeypad::updateButtonLabels() +{ + // update numeric buttons according to button state (pressed/released) + updateIconColor(); + updateTextLayouts(rect().size()); +} + +void DialpadKeypad::paint( + QPainter* painter, + const QStyleOptionGraphicsItem* option, + QWidget* widget) +{ + Q_UNUSED(option); + Q_UNUSED(widget); + + // Paints empty buttons + HbInputButtonGroup::paint(painter,option,widget); + + qreal cellWidth = boundingRect().width() / gridSize().width(); + qreal cellHeight = boundingRect().height() / gridSize().height(); + + // Draw icons + for (int i = 0; i < DialpadRowCount * DialpadColumnCount; i++) { + DialpadNumericButton *item = button(i); + + if (!item->icon().isNull()) { + // icon is centered to button + qreal x = (item->position().x() * cellWidth) + (cellWidth / 2) - + ((DialpadIconSize * mUnit) / 2); + qreal y = (item->position().y() * cellHeight) + (cellHeight / 2) - + ((DialpadIconSize * mUnit) / 2); + + qreal width = DialpadIconSize * mUnit; + qreal height = DialpadIconSize * mUnit; + + Qt::Alignment alignment = + static_cast(Qt::AlignVCenter | Qt::AlignHCenter); + item->icon().paint(painter, + QRectF(x,y,width,height), + Qt::KeepAspectRatio, + alignment); + } + } + + // Draw texts + QPen origPen = painter->pen(); + for (int i = 0; i < mTextLayouts.count(); ++i) { + if (i==SecondaryText) { + // dimmed in normal state + painter->setPen(mColors.at(Pressed+1)); + } else { + // otherwise normal or pressed color + painter->setPen(mColors.at(i/TextTypeCount)); + } + mTextLayouts.at(i)->draw(painter, QPointF(0, 0)); + } + painter->setPen(origPen); +} + +void DialpadKeypad::updateColorArray() +{ + mColors.clear(); + + QColor normalColor = HbColorScheme::color("qtc_input_button_normal"); + mColors.insert(Normal, normalColor); + + QColor pressedColor = HbColorScheme::color("qtc_input_button_pressed"); + mColors.insert(Pressed, pressedColor); + + // this is used for alphabets shown dimmed, use alpha until exact color + // is specified + QColor disabledColor = HbColorScheme::color("qtc_input_button_normal"); + disabledColor.setAlpha(128); + mColors.insert(Pressed+1, disabledColor); +} + +void DialpadKeypad::updateIconColor() +{ + for (int i = 0; i < (DialpadRowCount * DialpadColumnCount); i++) { + DialpadNumericButton *item = button(i); + + if (item->state()==HbInputButton::ButtonStatePressed) { + item->icon().setColor(mColors.at(Pressed)); + } else { + item->icon().setColor(mColors.at(Normal)); + } + } +} + +void DialpadKeypad::cancelButtonPress() +{ + HbInputButtonGroup::cancelButtonPress(); + updateButtonLabels(); +} + +void DialpadKeypad::setGeometry(const QRectF &rect) +{ + HbInputButtonGroup::setGeometry(rect); + updateTextLayouts(rect.size()); +} + +void DialpadKeypad::changeEvent(QEvent *event) +{ + HbInputButtonGroup::changeEvent(event); + + if (event->type() == HbEvent::ThemeChanged) { + updateColorArray(); + updateIconColor(); + } +} + +void DialpadKeypad::updateTextLayouts(const QSizeF &size) +{ + if (!size.width() && !size.height()) { + return; + } + + // get normal and pressed state texts + QList textContent; + resolveTextContent(textContent); + + // layout the texts + createTextLayouts(size, textContent); +} + +void DialpadKeypad::resolveTextContent(QList &content) +{ + QString normalState; + QString normalStateSecondary; + QString pressedState; + QString pressedStateSecondary; + + for (int i = 0; i < (DialpadRowCount*DialpadColumnCount); i++) { + DialpadNumericButton *item = button(i); + if (item->state()==HbInputButton::ButtonStatePressed) { + if (item->text().length()) { + pressedState.append(item->text()); + pressedState.append(QChar(QChar::LineSeparator)); + } + + if (item->secondaryText().length()) { + pressedStateSecondary.append(item->secondaryText()); + pressedStateSecondary.append(QChar(QChar::LineSeparator)); + } + } else { // ButtonStateNormal + if (item->text().length()) { + normalState.append(item->text()); + normalState.append(QChar(QChar::LineSeparator)); + } + + if (item->secondaryText().length()) { + normalStateSecondary.append(item->secondaryText()); + normalStateSecondary.append(QChar(QChar::LineSeparator)); + } + } + } + + content.insert(PrimaryText, normalState); + content.insert(SecondaryText, normalStateSecondary); + content.insert(TextTypeCount + Pressed, pressedState); + content.insert(StateCount + SecondaryText, pressedStateSecondary); +} + +void DialpadKeypad::createTextLayouts( + const QSizeF &size, const QList &content) +{ + // clear old layouts + qDeleteAll(mTextLayouts); + mTextLayouts.clear(); + + if (content.count()==2) { + // line width is measured only when all buttons are in normal state + mMaxPrimaryLineWidth = 0; + } + + QFont primaryfFont = HbFontSpec(HbFontSpec::Primary).font(); + primaryfFont.setPixelSize(DialpadPrimaryTextSize * mUnit); + + QFont secondaryFont = HbFontSpec(HbFontSpec::Secondary).font(); + secondaryFont.setPixelSize(DialpadSecondaryTextSize * mUnit); + + for (int i=0; i < (StateCount*TextTypeCount); i++ ) { + QString text = content.at(i); + + if (!text.isNull()) { + QTextLayout* textLayout; + int type; + + if (i%TextTypeCount) { + textLayout = new QTextLayout(text,secondaryFont); + type = SecondaryText; + } else { + textLayout = new QTextLayout(text,primaryfFont); + type = PrimaryText; + } + + mTextLayouts.append(textLayout); + + textLayout->beginLayout(); + + int state = (i>=TextTypeCount) ? Pressed : Normal; + + layoutTextLines(size,*textLayout,state,type); + + textLayout->endLayout(); + + textLayout->setCacheEnabled(true); + } + } +} + +void DialpadKeypad::layoutTextLines( + const QSizeF &size, + QTextLayout &textLayout, + int state, + int type) +{ + QFontMetricsF fontMetrics(textLayout.font()); + qreal textHeight = fontMetrics.height(); + + qreal cellWidth = size.width() / gridSize().width(); + qreal cellHeight = size.height() / gridSize().height(); + qreal maxLineWidth = 0; + + for (int j = 0; j < (DialpadRowCount*DialpadColumnCount); j++) { + DialpadNumericButton *item = button(j); + + if ((type==PrimaryText && item->text().isNull()) || + (type==SecondaryText && item->secondaryText().isNull())) { + continue; // no text for this button -> next button + } + + if ( ( state==Normal && + item->state()==HbInputButton::ButtonStateReleased ) || + ( state==Pressed && + item->state()==HbInputButton::ButtonStatePressed ) ) { + + QTextLine line = textLayout.createLine(); + + qreal textPositionX = 0; + qreal textPositionY = 0; + + if (line.isValid()) { + line.setNumColumns(item->text().length()); + // layout text line + if (type==SecondaryText) { + if (j==9) { + // + is centered to button + qreal lineWidth = fontMetrics.width(item->text()); + textPositionX = (item->position().x() * cellWidth) + + (cellWidth / 2) - + (lineWidth / 2); + textPositionY = (item->position().y() + + (0.5 * item->size().height())) * + cellHeight - (0.5 * textHeight); + + } else { + textPositionX = (item->position().x() * cellWidth) + + (DialpadPrimaryTextLeftMargin * mUnit) + + mMaxPrimaryLineWidth + + (DialpadPrimarySecondaryMargin * mUnit) + + buttonBorderSize(); + textPositionY = (item->position().y() + + (0.5 * item->size().height())) * + cellHeight - (0.5 * textHeight); + } + } else { + textPositionX = (item->position().x() * cellWidth) + + (DialpadPrimaryTextLeftMargin * mUnit) + + buttonBorderSize(); + textPositionY = (item->position().y() + + (0.5 * item->size().height())) * + cellHeight - (0.5 * textHeight); + + // store line width, for drawing secondary text + qreal lineWidth = fontMetrics.width(item->text()); + if (mMaxPrimaryLineWidth == 0 && (j>0 && j<10) && + lineWidth > maxLineWidth) { + maxLineWidth = lineWidth; + } + } + } + + line.setPosition(QPointF(textPositionX, textPositionY)); + } + } + + mMaxPrimaryLineWidth = maxLineWidth; +} diff -r 1f002146abb4 -r cee7e9e0906c telutils/dialpad/src/dialpadkeysequenceeventfilter.cpp --- a/telutils/dialpad/src/dialpadkeysequenceeventfilter.cpp Tue Jul 06 14:53:02 2010 +0300 +++ b/telutils/dialpad/src/dialpadkeysequenceeventfilter.cpp Wed Aug 18 10:19:22 2010 +0300 @@ -57,33 +57,32 @@ Q_UNUSED(watched) const bool eventFiltered = false; -#ifdef Q_OS_SYMBIAN - QKeyEvent *keyEvent = static_cast(event); - const int keyCode = keyEvent->key(); - const int eventType = event->type(); - +#ifdef Q_OS_SYMBIAN // Code is executed after '#' is pressed as specified in Dialer UI // specification. - QString keySequenceCandidate = HbStringUtil::convertDigitsTo( - mDialpad->editor().text(), WesternDigit); - if (QEvent::KeyRelease == eventType && Qt::Key_NumberSign == keyCode) { - XQAiwInterfaceDescriptor keySequenceHandler = - findKeySequenceHandler(keySequenceCandidate); - if (keySequenceHandler.isValid()) { - QScopedPointer request(mAiwMgr.create( - keySequenceHandler, - "executeKeySequence(QString)", - false)); - request->setSynchronous(true); - request->setBackground(true); - QList arguments; - arguments << keySequenceCandidate; - request->setArguments(arguments); - - QVariant keySequenceProcessed; - bool requestOk = request->send(keySequenceProcessed); - if (requestOk && keySequenceProcessed.toBool()) { - mDialpad->editor().setText(QString("")); + if (QEvent::KeyRelease == event->type()){ + QKeyEvent *keyEvent = static_cast(event); + if (Qt::Key_NumberSign == keyEvent->key()) { + QString keySequenceCandidate = HbStringUtil::convertDigitsTo( + mDialpad->editor().text(), WesternDigit); + XQAiwInterfaceDescriptor keySequenceHandler = + findKeySequenceHandler(keySequenceCandidate); + if (keySequenceHandler.isValid()) { + QScopedPointer request(mAiwMgr.create( + keySequenceHandler, + "executeKeySequence(QString)", + false)); + request->setSynchronous(true); + request->setBackground(true); + QList arguments; + arguments << keySequenceCandidate; + request->setArguments(arguments); + + QVariant keySequenceProcessed; + bool requestOk = request->send(keySequenceProcessed); + if (requestOk && keySequenceProcessed.toBool()) { + mDialpad->editor().setText(QString("")); + } } } } diff -r 1f002146abb4 -r cee7e9e0906c telutils/dialpad/src/dialpadnumericbutton.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/telutils/dialpad/src/dialpadnumericbutton.cpp Wed Aug 18 10:19:22 2010 +0300 @@ -0,0 +1,59 @@ +/*! +* Copyright (c) 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" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Extends HbInputButton +* +*/ + + +#include "dialpadnumericbutton.h" + +DialpadNumericButton::DialpadNumericButton( + int keyCode, const QPoint &position, const QSize &size) + : HbInputButton(keyCode, position, size) +{ +} + +DialpadNumericButton::~DialpadNumericButton() +{ +} + +void DialpadNumericButton::setIcon(const HbIcon& icon) +{ + mIcon = icon; +} + +HbIcon& DialpadNumericButton::icon() +{ + return mIcon; +} + +void DialpadNumericButton::setText(const QString& text) +{ + mText = text; +} + +QString DialpadNumericButton::text() const +{ + return mText; +} + +void DialpadNumericButton::setSecondaryText(const QString& text) +{ + mSecondaryText = text; +} + +QString DialpadNumericButton::secondaryText() const +{ + return mSecondaryText; +} diff -r 1f002146abb4 -r cee7e9e0906c telutils/dialpad/src/dialpadvideomailboxeventfilter.cpp --- a/telutils/dialpad/src/dialpadvideomailboxeventfilter.cpp Tue Jul 06 14:53:02 2010 +0300 +++ b/telutils/dialpad/src/dialpadvideomailboxeventfilter.cpp Wed Aug 18 10:19:22 2010 +0300 @@ -43,25 +43,23 @@ { Q_UNUSED(watched) bool keyEventEaten(false); - - QKeyEvent *keyEvent = static_cast(event); - const int keyCode = keyEvent->key(); - const int eventType = event->type(); - - if (eventType == QEvent::KeyPress) { - if (checkIfSendEventAndConsumeEvent(keyCode, eventType)) { + + if (event->type() == QEvent::KeyPress) { + QKeyEvent *keyEvent = static_cast(event); + if (checkIfSendEventAndConsumeEvent(keyEvent->key(), event->type())) { keyEventEaten = true; - } else if ((isLongKeyPressSupported(keyCode)) && + } else if ((isLongKeyPressSupported(keyEvent->key())) && !(mDialpad->editor().text().length() >= 1)) { //Check that there is only one item in dialpad, if there is more than one //do not handle long key press. mLongPressTimer->stop(); mLongPressTimer->start(DialpadLongKeyPressTimeOut); } - } else if (eventType == QEvent::KeyRelease) { - if (checkIfSendEventAndConsumeEvent(keyCode, eventType)) { + } else if (event->type() == QEvent::KeyRelease) { + QKeyEvent *keyEvent = static_cast(event); + if (checkIfSendEventAndConsumeEvent(keyEvent->key(), event->type())) { keyEventEaten = true; - } else if (isLongKeyPressSupported(keyCode)){ + } else if (isLongKeyPressSupported(keyEvent->key())){ mLongPressTimer->stop(); } } diff -r 1f002146abb4 -r cee7e9e0906c telutils/dialpad/src/dialpadvoicemailboxeventfilter.cpp --- a/telutils/dialpad/src/dialpadvoicemailboxeventfilter.cpp Tue Jul 06 14:53:02 2010 +0300 +++ b/telutils/dialpad/src/dialpadvoicemailboxeventfilter.cpp Wed Aug 18 10:19:22 2010 +0300 @@ -43,25 +43,23 @@ { Q_UNUSED(watched) bool keyEventEaten(false); - - QKeyEvent *keyEvent = static_cast(event); - const int keyCode = keyEvent->key(); - const int eventType = event->type(); - - if (eventType == QEvent::KeyPress) { - if (checkIfSendEventAndConsumeEvent(keyCode, eventType)) { + + if (event->type() == QEvent::KeyPress) { + QKeyEvent *keyEvent = static_cast(event); + if (checkIfSendEventAndConsumeEvent(keyEvent->key(), event->type())) { keyEventEaten = true; - } else if ((isLongKeyPressSupported(keyCode)) && + } else if ((isLongKeyPressSupported(keyEvent->key())) && !(mDialpad->editor().text().length() >= 1)) { //Check that there is only one item in dialpad, if there is more than one //do not handle long key press. mLongPressTimer->stop(); mLongPressTimer->start(DialpadLongKeyPressTimeOut); } - } else if (eventType == QEvent::KeyRelease) { - if (checkIfSendEventAndConsumeEvent(keyCode, eventType)) { + } else if (event->type() == QEvent::KeyRelease) { + QKeyEvent *keyEvent = static_cast(event); + if (checkIfSendEventAndConsumeEvent(keyEvent->key(), event->type())) { keyEventEaten = true; - } else if (isLongKeyPressSupported(keyCode)){ + } else if (isLongKeyPressSupported(keyEvent->key())){ mLongPressTimer->stop(); } } diff -r 1f002146abb4 -r cee7e9e0906c telutils/dialpad/tsrc/unit/shared/mock_cphcltemergencycall.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/telutils/dialpad/tsrc/unit/shared/mock_cphcltemergencycall.cpp Wed Aug 18 10:19:22 2010 +0300 @@ -0,0 +1,149 @@ +/* +* Copyright (c) 2009 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" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +#include +#include +#include "mock_cphcltemergencycall.h" + +// ============================ MEMBER FUNCTIONS =============================== + +// ----------------------------------------------------------------------------- +// CPhCltEmergencyCall::CPhCltEmergencyCall +// C++ constructor. +// ----------------------------------------------------------------------------- +// +CPhCltEmergencyCall::CPhCltEmergencyCall( + MPhCltEmergencyCallObserver* aObserver ) + : CActive( EPriorityStandard ), iObserver( aObserver ) + { + + } + + +// ----------------------------------------------------------------------------- +// CPhCltEmergencyCall::CPhCltEmergencyCall +// ----------------------------------------------------------------------------- +// +CPhCltEmergencyCall* CPhCltEmergencyCall::NewL( + MPhCltEmergencyCallObserver* aObserver ) + { + return CPhCltEmergencyCallMock::NewL( aObserver ); + } + + +// ----------------------------------------------------------------------------- +// CPhCltEmergencyCallMock::CPhCltEmergencyCallMock +// C++ constructor. +// ----------------------------------------------------------------------------- +// +CPhCltEmergencyCallMock::CPhCltEmergencyCallMock( + MPhCltEmergencyCallObserver * aObserver ) + : CPhCltEmergencyCall( aObserver ) + { + + } + + +// ----------------------------------------------------------------------------- +// CPhCltEmergencyCallMock::NewL +// ----------------------------------------------------------------------------- +// +CPhCltEmergencyCallMock * CPhCltEmergencyCallMock::NewL( + MPhCltEmergencyCallObserver * aObserver ) + { + SMC_MOCK_NEWL1( CPhCltEmergencyCallMock *, MPhCltEmergencyCallObserver *, aObserver ) + + CPhCltEmergencyCallMock* self = new( ELeave ) CPhCltEmergencyCallMock( aObserver ); + CleanupStack::PushL( self ); + //self->ConstructL() + CleanupStack::Pop( self ); + return self; + } + + +// ----------------------------------------------------------------------------- +// CPhCltEmergencyCallMock::IsEmergencyPhoneNumber +// ----------------------------------------------------------------------------- +// +TInt CPhCltEmergencyCallMock::IsEmergencyPhoneNumber( + const TDesC & aNumber, + TBool & aIsEmergencyNumber ) + { + SMC_MOCK_METHOD2( TInt, const TDesC &, aNumber, + TBool &, aIsEmergencyNumber ) + } + + +// ----------------------------------------------------------------------------- +// CPhCltEmergencyCallMock::FindEmergencyPhoneNumber +// ----------------------------------------------------------------------------- +// +TInt CPhCltEmergencyCallMock::FindEmergencyPhoneNumber( + TDes & aNumber, + TBool & aIsEmergencyNumber ) + { + SMC_MOCK_METHOD2( TInt, TDes &, aNumber, + TBool &, aIsEmergencyNumber ) + } + + +// ----------------------------------------------------------------------------- +// CPhCltEmergencyCallMock::DialEmergencyCallL +// ----------------------------------------------------------------------------- +// +void CPhCltEmergencyCallMock::DialEmergencyCallL( + const TDesC & aNumber ) + { + SMC_MOCK_METHOD1( void, const TDesC &, aNumber ) + } + + +// ----------------------------------------------------------------------------- +// CPhCltEmergencyCallMock::IsEmergencyPhoneNumber +// ----------------------------------------------------------------------------- +// +TInt CPhCltEmergencyCallMock::IsEmergencyPhoneNumber( + const TDesC & aNumber, + TDes & aMatchedEmergencyNumber, + TBool & aIsEmergencyNumber ) + { + SMC_MOCK_METHOD3( TInt, const TDesC &, aNumber, + TDes &, aMatchedEmergencyNumber, + TBool &, aIsEmergencyNumber ) + } + + +// ----------------------------------------------------------------------------- +// CPhCltEmergencyCallMock::RunL +// Declaration needed due to vftable references. +// ----------------------------------------------------------------------------- +// +void CPhCltEmergencyCallMock::RunL() + { + + } + + +// ----------------------------------------------------------------------------- +// CPhCltEmergencyCallMock::DoCancel +// Declaration needed due to vftable references. +// ----------------------------------------------------------------------------- +// +void CPhCltEmergencyCallMock::DoCancel() + { + + } diff -r 1f002146abb4 -r cee7e9e0906c telutils/dialpad/tsrc/unit/shared/mock_cphcltemergencycall.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/telutils/dialpad/tsrc/unit/shared/mock_cphcltemergencycall.h Wed Aug 18 10:19:22 2010 +0300 @@ -0,0 +1,144 @@ +/* +* Copyright (c) 2009 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" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +#ifndef CPHCLTEMERGENCYCALLMOCK_H +#define CPHCLTEMERGENCYCALLMOCK_H + +#include +#include + +// FORWARD DECLARATIONS +class MPhCltEmergencyCallObserver; + +// CLASS DECLARATION +/** +* Phone Client Emergency Call Api for emergency number query +* and emergency dialing. +* +* @lib phoneclient.lib +* @since SeriesS60_3.2 +*/ +class CPhCltEmergencyCallMock : public CPhCltEmergencyCall + { + public: + static TBool iSimulateEmergencyNumberMatch; + + public: // Constructors and destructor + + /** + * Create an instance that implements the interface. + * + * @param aObserver It is the observer for the instance. + * @return Returns the created instance. + */ + static CPhCltEmergencyCallMock* NewL( + MPhCltEmergencyCallObserver* aObserver ); + + public: // New functions + + /** + * Returns information whether the number specified was an emergency number. + * + * @param aNumber Number to be queried. aNumber might contain prefix (SS code) + * and/or postfix (DTMF part). + * The aNumber parameter should be a buffer and the + * clients are provided with a typedef called + * TPhCltEmergencyNumber. + * + * @param aIsEmergencyNumber If ETrue, then the aNumber + * parameter included emergency number. + * @return Returns error code of the success of the operation. + */ + TInt IsEmergencyPhoneNumber( const TDesC& aNumber, + TBool& aIsEmergencyNumber ); + + /** + * Method can be used to check if the number specified contains + * a valid emergency number in the end of the number. + * + * @param aNumber Number to be queried, matched emergency number + * is returned in this parameter. + * The aNumber parameter should be a buffer and the + * clients are provided with a typedef called + * TPhCltTelephoneNumber. + * + * @param aIsEmergencyNumber If ETrue, then the aNumber parameter + * was emergency number. + * @return Returns error code of the success of the operation. + */ + TInt FindEmergencyPhoneNumber( TDes& aNumber, + TBool& aIsEmergencyNumber ); + + /** + * Initiates an emergency call. + * + * @param aNumber Emergency number to be dialed. + * The aNumber parameter should be a buffer and the + * clients are provided with a typedef called + * TPhCltEmergencyNumber. + * + * If the aNumber parameter supplies an "empty" buffer + * the call is created either dialing the default emergency + * phone number or use the SET UP EMERGENCY request + * that does not contain a dialling number. + * + * Leaves with KErrArgument, if parameter aNumber was + * not an emergency number. + * + * @pre IsActive() returns EFalse, otherwise leaves with KErrInUse. + */ + void DialEmergencyCallL( const TDesC& aNumber ); + + /** + * Returns information whether the number specified was an emergency + * number and also returns the plain emergency number. + * + * @param aNumber Number to be queried.aNumber might contain prefix (SS code) + * and/or postfix (DTMF part). + * The aNumber parameter should be a buffer and the + * clients are provided with a typedef called + * TPhCltEmergencyNumber. + * + * @param aMatchedEmergencyNumber Matched emergencynumber without prefix or + * postfix is returned in this parameter. The aMatchedEmergencyNumber + * parameter should be a buffer and the clients are + * provided with atypedef called TPhCltEmergencyNumber. + * + * @param aIsEmergencyNumber If ETrue, then the aNumber + * parameter included emergency number. + * + * @return Returns error code of the success of the operation. + */ + TInt IsEmergencyPhoneNumber( const TDesC& aNumber, + TDes& aMatchedEmergencyNumber, TBool& aIsEmergencyNumber ); + + protected: + + /** + * C++ constructor. + */ + CPhCltEmergencyCallMock( MPhCltEmergencyCallObserver* aObserver ); + + void RunL(); + + void DoCancel(); + + }; + +#endif // CPHCLTEMERGENCYCALLMOCK_H + +// End of File diff -r 1f002146abb4 -r cee7e9e0906c telutils/dialpad/tsrc/unit/shared/mock_dialpadhasheventfilter.cpp --- a/telutils/dialpad/tsrc/unit/shared/mock_dialpadhasheventfilter.cpp Tue Jul 06 14:53:02 2010 +0300 +++ b/telutils/dialpad/tsrc/unit/shared/mock_dialpadhasheventfilter.cpp Wed Aug 18 10:19:22 2010 +0300 @@ -29,9 +29,9 @@ Dialpad * dialpad, QObject * parent ) : - QObject( parent ) + DialpadMailboxEventFilterBase(dialpad, parent) { - Q_UNUSED(dialpad) + } @@ -57,4 +57,29 @@ QEvent *, event ) } +// ----------------------------------------------------------------------------- +// DialpadHashEventFilter::handleCallButtonPress +// ----------------------------------------------------------------------------- +// +bool DialpadHashEventFilter::handleCallButtonPress() +{ + return false; +} +// ----------------------------------------------------------------------------- +// DialpadHashEventFilter::handleMailboxOperation +// ----------------------------------------------------------------------------- +// +void DialpadHashEventFilter::handleMailboxOperation() +{ + +} + +// ----------------------------------------------------------------------------- +// DialpadHashEventFilter::handleLongKeyPress +// ----------------------------------------------------------------------------- +// +void DialpadHashEventFilter::handleLongKeyPress() +{ + +} diff -r 1f002146abb4 -r cee7e9e0906c telutils/dialpad/tsrc/unit/shared/mock_hbnotificationdialog.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/telutils/dialpad/tsrc/unit/shared/mock_hbnotificationdialog.cpp Wed Aug 18 10:19:22 2010 +0300 @@ -0,0 +1,288 @@ +/* +* Copyright (c) 2009 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" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ +#include +#include "hbnotificationdialog.h" +#include + +// ============================ MEMBER FUNCTIONS =============================== + +// ----------------------------------------------------------------------------- +// HbNotificationDialog::Q_PROPERTY +// ----------------------------------------------------------------------------- +// +/*Q_OBJECT HbNotificationDialog::Q_PROPERTY( + QString text READ text WRITE setText ) Q_PROPERTY ( QString title READ title WRITE setTitle ) Q_PROPERTY ( HbIcon icon READ icon WRITE setIcon ) Q_PROPERTY ( Hb::TextWrapping titleTextWrapping READ titleTextWrapping WRITE setTitleTextWrapping ) Q_PROPERTY ( bool sequentialShow READ isSequentialShow WRITE setSequentialShow ):HbNotificationDialog ( ) + { + SMC_MOCK_METHOD1( Q_OBJECT, QString text READ text WRITE setText ) Q_PROPERTY ( QString title READ title WRITE setTitle ) Q_PROPERTY ( HbIcon icon READ icon WRITE setIcon ) Q_PROPERTY ( Hb::TextWrapping titleTextWrapping READ titleTextWrapping WRITE setTitleTextWrapping ) Q_PROPERTY ( bool sequentialShow READ isSequentialShow WRITE setSequentialShow ):HbNotificationDialog, ( ) + }*/ + +HbNotificationDialog::HbNotificationDialog() //: HbDialog(*new HbNotificationDialogPrivate, 0) +{ +} + + +// ----------------------------------------------------------------------------- +// HbNotificationDialog::~HbNotificationDialog +// ----------------------------------------------------------------------------- +// +HbNotificationDialog::~HbNotificationDialog( ) + { + //SMC_MOCK_METHOD0( void ) + } + + +// ----------------------------------------------------------------------------- +// HbNotificationDialog::launchDialog +// ----------------------------------------------------------------------------- +// +void HbNotificationDialog::launchDialog( + const QString & title, + QGraphicsScene * scene ) + { + SMC_MOCK_METHOD2( void, const QString &, title, + QGraphicsScene *, scene ) + } + + +// ----------------------------------------------------------------------------- +// HbNotificationDialog::launchDialog +// ----------------------------------------------------------------------------- +// +void HbNotificationDialog::launchDialog( + const QString & title, + const QString & text, + QGraphicsScene * scene ) + { + SMC_MOCK_METHOD3( void, const QString &, title, + const QString &, text, + QGraphicsScene *, scene ) + } + + +// ----------------------------------------------------------------------------- +// HbNotificationDialog::launchDialog +// ----------------------------------------------------------------------------- +// +void HbNotificationDialog::launchDialog( + const HbIcon & icon, + const QString & title, + const QString & text, + QGraphicsScene * scene ) + { + SMC_MOCK_METHOD4( void, const HbIcon &, icon, + const QString &, title, + const QString &, text, + QGraphicsScene *, scene ) + } + + +// ----------------------------------------------------------------------------- +// HbNotificationDialog::enableTouchActivation +// ----------------------------------------------------------------------------- +// +void HbNotificationDialog::enableTouchActivation( + bool enabled ) + { + SMC_MOCK_METHOD1( void, bool, enabled ) + } + + +// ----------------------------------------------------------------------------- +// HbNotificationDialog::isTouchActivating +// ----------------------------------------------------------------------------- +// +bool HbNotificationDialog::isTouchActivating( ) const + { + SMC_MOCK_METHOD0( bool ) + } + + +// ----------------------------------------------------------------------------- +// HbNotificationDialog::setTitle +// ----------------------------------------------------------------------------- +// +void HbNotificationDialog::setTitle( + const QString & text ) + { + SMC_MOCK_METHOD1( void, const QString &, text ) + } + + +// ----------------------------------------------------------------------------- +// HbNotificationDialog::setText +// ----------------------------------------------------------------------------- +// +void HbNotificationDialog::setText( + const QString & text ) + { + SMC_MOCK_METHOD1( void, const QString &, text ) + } + + +// ----------------------------------------------------------------------------- +// HbNotificationDialog::setIcon +// ----------------------------------------------------------------------------- +// +void HbNotificationDialog::setIcon( + const HbIcon & icon ) + { + SMC_MOCK_METHOD1( void, const HbIcon &, icon ) + } + + +// ----------------------------------------------------------------------------- +// HbNotificationDialog::title +// ----------------------------------------------------------------------------- +// +QString HbNotificationDialog::title( ) const + { + SMC_MOCK_METHOD0( QString ) + } + + +// ----------------------------------------------------------------------------- +// HbNotificationDialog::text +// ----------------------------------------------------------------------------- +// +QString HbNotificationDialog::text( ) const + { + SMC_MOCK_METHOD0( QString ) + } + + +// ----------------------------------------------------------------------------- +// HbNotificationDialog::icon +// ----------------------------------------------------------------------------- +// +HbIcon HbNotificationDialog::icon( ) const + { + SMC_MOCK_METHOD0( HbIcon ) + } + + +// ----------------------------------------------------------------------------- +// HbNotificationDialog::setTitleTextWrapping +// ----------------------------------------------------------------------------- +// +void HbNotificationDialog::setTitleTextWrapping( + Hb::TextWrapping wrapping ) + { + SMC_MOCK_METHOD1( void, Hb::TextWrapping, wrapping ) + } + + +// ----------------------------------------------------------------------------- +// HbNotificationDialog::titleTextWrapping +// ----------------------------------------------------------------------------- +// +Hb::TextWrapping HbNotificationDialog::titleTextWrapping( ) const + { + SMC_MOCK_METHOD0( Hb::TextWrapping ) + } + + +// ----------------------------------------------------------------------------- +// HbNotificationDialog::setSequentialShow +// ----------------------------------------------------------------------------- +// +void HbNotificationDialog::setSequentialShow( + bool sequential ) + { + SMC_MOCK_METHOD1( void, bool, sequential ) + } + + +// ----------------------------------------------------------------------------- +// HbNotificationDialog::isSequentialShow +// ----------------------------------------------------------------------------- +// +bool HbNotificationDialog::isSequentialShow( ) const + { + SMC_MOCK_METHOD0( bool ) + } + +// ----------------------------------------------------------------------------- +// HbNotificationDialog::primitive +// ----------------------------------------------------------------------------- +// +QGraphicsItem * HbNotificationDialog::primitive( + const QString & itemName ) const + { + SMC_MOCK_METHOD1( QGraphicsItem *, const QString &, itemName ) + } + +// ----------------------------------------------------------------------------- +// HbNotificationDialog::HbNotificationDialog +// ----------------------------------------------------------------------------- +// +/*void*/ HbNotificationDialog::HbNotificationDialog( + HbNotificationDialogPrivate & dd, + QGraphicsItem * parent ) + { + Q_UNUSED(dd) + Q_UNUSED(parent) + //SMC_MOCK_METHOD2( void, HbNotificationDialogPrivate &, dd, + // QGraphicsItem *, parent ) + } + + +// ----------------------------------------------------------------------------- +// HbNotificationDialog::gestureEvent +// ----------------------------------------------------------------------------- +// +void HbNotificationDialog::gestureEvent( + QGestureEvent * event ) + { + SMC_MOCK_METHOD1( void, QGestureEvent *, event ) + } + + +// ----------------------------------------------------------------------------- +// HbNotificationDialog::hideEvent +// ----------------------------------------------------------------------------- +// +void HbNotificationDialog::hideEvent( + QHideEvent * event ) + { + SMC_MOCK_METHOD1( void, QHideEvent *, event ) + } + + +// ----------------------------------------------------------------------------- +// HbNotificationDialog::showEvent +// ----------------------------------------------------------------------------- +// +void HbNotificationDialog::showEvent( + QShowEvent * event ) + { + SMC_MOCK_METHOD1( void, QShowEvent *, event ) + } + + +// ----------------------------------------------------------------------------- +// HbNotificationDialog::itemChange +// ----------------------------------------------------------------------------- +// +QVariant HbNotificationDialog::itemChange( + GraphicsItemChange change, + const QVariant & value ) + { + SMC_MOCK_METHOD2( QVariant, GraphicsItemChange, change, + const QVariant &, value ) + } + + diff -r 1f002146abb4 -r cee7e9e0906c telutils/dialpad/tsrc/unit/unit.pro --- a/telutils/dialpad/tsrc/unit/unit.pro Tue Jul 06 14:53:02 2010 +0300 +++ b/telutils/dialpad/tsrc/unit/unit.pro Wed Aug 18 10:19:22 2010 +0300 @@ -27,3 +27,4 @@ SUBDIRS += mt_dialpad SUBDIRS += mt_keyhandler SUBDIRS += ut_dialpadhasheventfilter +SUBDIRS += ut_dialpadnumericbutton diff -r 1f002146abb4 -r cee7e9e0906c telutils/dialpad/tsrc/unit/ut_dialpademergencycalleventfilter/ut_dialpademergencycalleventfilter.cpp --- a/telutils/dialpad/tsrc/unit/ut_dialpademergencycalleventfilter/ut_dialpademergencycalleventfilter.cpp Tue Jul 06 14:53:02 2010 +0300 +++ b/telutils/dialpad/tsrc/unit/ut_dialpademergencycalleventfilter/ut_dialpademergencycalleventfilter.cpp Wed Aug 18 10:19:22 2010 +0300 @@ -25,31 +25,18 @@ #include #include #include +#include -#ifdef Q_OS_SYMBIAN -#include "xqservicerequest.h" -#endif - +#include "mock_cphcltemergencycall.h" #include "dialpadtest.h" #include "dialpadtestutil.h" #include "dialpademergencycalleventfilter.h" #include "dialpad.h" const int WAIT_TIME = 300; -QString mService; -QString mMessage; -bool mXQServiceConstructed; -bool mSendCalled; - -#ifdef Q_OS_SYMBIAN -XQServiceRequest::XQServiceRequest(const QString& service, const QString& message, const bool& synchronous) { mService=service; mMessage=message; mXQServiceConstructed=true; } -XQServiceRequest::~XQServiceRequest() {} -bool XQServiceRequest::send(QVariant& retValue) { mSendCalled=true; return true; } -void XQServiceRequest::addArg(const QVariant& v) {} -#endif // test cases -class ut_DialpadEmergencyCallEventFilter : public QObject +class ut_DialpadEmergencyCallEventFilter : public QObject, public MockService { Q_OBJECT @@ -95,10 +82,7 @@ void ut_DialpadEmergencyCallEventFilter::init() { - mService = QString(""); - mMessage = QString(""); - mXQServiceConstructed = false; - mSendCalled = false; + initialize(); } void ut_DialpadEmergencyCallEventFilter::cleanupTestCase() @@ -110,13 +94,24 @@ void ut_DialpadEmergencyCallEventFilter::cleanup() { + reset(); mDialpad->editor().setText(QString()); QTest::qWait( WAIT_TIME ); // delay between tests } +void checkNumber(const TDesC& aNumber, TBool& aIsEmergencyNumber) +{ + if (aNumber == _L("112")) { + aIsEmergencyNumber = true; + } +} void ut_DialpadEmergencyCallEventFilter::testEmergencyCallEventFilter() { + EXPECT(CPhCltEmergencyCallMock::IsEmergencyPhoneNumber).willOnce( + invoke(checkNumber)); + EXPECT(CPhCltEmergencyCallMock::DialEmergencyCallL); + mDialpad->openDialpad(); QTest::qWait(WAIT_TIME); mUtil->mouseClickDialpad(Qt::Key_1); @@ -130,12 +125,7 @@ mDialpad->closeDialpad(); -#ifdef Q_OS_SYMBIAN - QVERIFY(mXQServiceConstructed == true); - QVERIFY(mSendCalled == true); - QCOMPARE(mService, QString("com.nokia.symbian.ICallDial")); - QCOMPARE(mMessage, QString("dial(QString)")); -#endif + QVERIFY(verify()); } DIALPAD_TEST_MAIN(ut_DialpadEmergencyCallEventFilter) diff -r 1f002146abb4 -r cee7e9e0906c telutils/dialpad/tsrc/unit/ut_dialpademergencycalleventfilter/ut_dialpademergencycalleventfilter.pro --- a/telutils/dialpad/tsrc/unit/ut_dialpademergencycalleventfilter/ut_dialpademergencycalleventfilter.pro Tue Jul 06 14:53:02 2010 +0300 +++ b/telutils/dialpad/tsrc/unit/ut_dialpademergencycalleventfilter/ut_dialpademergencycalleventfilter.pro Wed Aug 18 10:19:22 2010 +0300 @@ -32,11 +32,11 @@ #ß HEADERS += ../../../inc/dialpademergencycalleventfilter.h \ - xqservicerequest.h \ ../shared/dialpadtestutil.h SOURCES += ut_dialpademergencycalleventfilter.cpp \ ../../../src/dialpademergencycalleventfilter.cpp \ - ../shared/dialpadtestutil.cpp + ../shared/dialpadtestutil.cpp \ + ../shared/mock_cphcltemergencycall.cpp # -LIBS += -ldialpad +LIBS += -ldialpad -lmocklib -lsymbianmock diff -r 1f002146abb4 -r cee7e9e0906c telutils/dialpad/tsrc/unit/ut_dialpademergencycalleventfilter/xqservicerequest.h --- a/telutils/dialpad/tsrc/unit/ut_dialpademergencycalleventfilter/xqservicerequest.h Tue Jul 06 14:53:02 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,32 +0,0 @@ -/* -* Copyright (c) 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" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -class XQServiceRequest : public QObject -{ -public: - XQServiceRequest(const QString& service, const QString& message, const bool& synchronous); - ~XQServiceRequest(); - bool send(QVariant& retValue); - void addArg(const QVariant& v); - template - inline XQServiceRequest &operator<< (const T &var) - { - QVariant v = qVariantFromValue(var); - addArg(v); - return *this; - } -}; diff -r 1f002146abb4 -r cee7e9e0906c telutils/dialpad/tsrc/unit/ut_dialpadkeyhandler/ut_dialpadkeyhandler.cpp --- a/telutils/dialpad/tsrc/unit/ut_dialpadkeyhandler/ut_dialpadkeyhandler.cpp Tue Jul 06 14:53:02 2010 +0300 +++ b/telutils/dialpad/tsrc/unit/ut_dialpadkeyhandler/ut_dialpadkeyhandler.cpp Wed Aug 18 10:19:22 2010 +0300 @@ -39,6 +39,10 @@ SMC_MOCK_METHOD1( void, QObject *, obj ) } +void QObject::removeEventFilter(QObject *obj) +{ + SMC_MOCK_METHOD1( void, QObject *, obj ) +} UT_DialpadKeyHandler::UT_DialpadKeyHandler() : @@ -79,6 +83,7 @@ void UT_DialpadKeyHandler::t_constructionWithAllFilters() { EXPECT(QObject::installEventFilter).times(5); + EXPECT(QObject::removeEventFilter).times(5); DialpadKeyHandler::DialpadKeyEventFilters filters( DialpadKeyHandler::VoiceMailbox | @@ -89,6 +94,8 @@ DialpadKeyHandler::Hash ); m_keyHandler = new DialpadKeyHandler(m_dialPad, filters, this); + delete m_keyHandler; + m_keyHandler = 0; QVERIFY(verify()); } diff -r 1f002146abb4 -r cee7e9e0906c telutils/dialpad/tsrc/unit/ut_dialpadnumericbutton/ut_dialpadnumericbutton.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/telutils/dialpad/tsrc/unit/ut_dialpadnumericbutton/ut_dialpadnumericbutton.cpp Wed Aug 18 10:19:22 2010 +0300 @@ -0,0 +1,78 @@ +/*! +* Copyright (c) 2009 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" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +#include +#include + +#include + +#include "dialpadtest.h" +#include "dialpadnumericbutton.h" + +class ut_DialpadNumericButton : public QObject +{ + Q_OBJECT + +private slots: + void initTestCase(); + void cleanupTestCase(); + + void testSetText(); + void testSetSecondaryText(); + void testSetIcon(); + +private: + DialpadNumericButton *mButton; +}; + +void ut_DialpadNumericButton::initTestCase() +{ + mButton = new DialpadNumericButton(0,QPoint(1,1),QSize(1,1)); +} + +void ut_DialpadNumericButton::cleanupTestCase() +{ + delete mButton; +} + +void ut_DialpadNumericButton::testSetText() +{ + QVERIFY(mButton->text().isNull()); + mButton->setText(QLatin1String("Primary text")); + QVERIFY(mButton->text() == QLatin1String("Primary text")); +} + +void ut_DialpadNumericButton::testSetSecondaryText() +{ + QVERIFY(mButton->secondaryText().isNull()); + mButton->setSecondaryText(QLatin1String("Secondary text")); + QVERIFY(mButton->secondaryText() == QLatin1String("Secondary text")); +} + +void ut_DialpadNumericButton::testSetIcon() +{ + HbIcon icon(QLatin1String("dummy.svg")); + + QVERIFY(mButton->icon().isNull()); + mButton->setIcon(icon); + mButton->icon().setColor(Qt::white); + QVERIFY(mButton->icon().iconName() == QLatin1String("dummy.svg")); + QVERIFY(mButton->icon().color() == Qt::white); +} + +DIALPAD_TEST_MAIN(ut_DialpadNumericButton) +#include "ut_dialpadnumericbutton.moc" diff -r 1f002146abb4 -r cee7e9e0906c telutils/dialpad/tsrc/unit/ut_dialpadnumericbutton/ut_dialpadnumericbutton.pro --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/telutils/dialpad/tsrc/unit/ut_dialpadnumericbutton/ut_dialpadnumericbutton.pro Wed Aug 18 10:19:22 2010 +0300 @@ -0,0 +1,35 @@ +# +# Copyright (c) 2009 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" +# which accompanies this distribution, and is available +# at the URL "http://www.eclipse.org/legal/epl-v10.html". +# +# Initial Contributors: +# Nokia Corporation - initial contribution. +# +# Contributors: +# +# Description: +# +# + +TEMPLATE = app +TARGET = +DEPENDPATH += . ../../../src +INCLUDEPATH += . ../../../inc ../shared +CONFIG += hb qtestlib +HB += hbinput + +symbian { + INCLUDEPATH += $$APP_LAYER_SYSTEMINCLUDE +} else:win32 { + DESTDIR = ./ +} + +HEADERS += ../../../inc/dialpadnumericbutton.h + +SOURCES += ut_dialpadnumericbutton.cpp \ + ../../../src/dialpadnumericbutton.cpp + diff -r 1f002146abb4 -r cee7e9e0906c vmbx/vmbxcpplugin/inc/customedit.h --- a/vmbx/vmbxcpplugin/inc/customedit.h Tue Jul 06 14:53:02 2010 +0300 +++ b/vmbx/vmbxcpplugin/inc/customedit.h Wed Aug 18 10:19:22 2010 +0300 @@ -19,6 +19,8 @@ #define CUSTOMEDIT_H #include +#include + class CustomEdit : public HbLineEdit { @@ -46,7 +48,17 @@ Click line edit */ void editItemClicked(); + +private slots: + + // emits the editItemClicked signal + void emitEditItemClicked(); + +private: + + // timer for item clicked emission + QTimer mItemClickedTimer; + }; #endif //CUSTOMEDIT_H - diff -r 1f002146abb4 -r cee7e9e0906c vmbx/vmbxcpplugin/src/customedit.cpp --- a/vmbx/vmbxcpplugin/src/customedit.cpp Tue Jul 06 14:53:02 2010 +0300 +++ b/vmbx/vmbxcpplugin/src/customedit.cpp Wed Aug 18 10:19:22 2010 +0300 @@ -1,4 +1,4 @@ - /* +/* * Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). * All rights reserved. * This component and the accompanying materials are made available @@ -15,8 +15,6 @@ * */ -#include - #include "customedit.h" #include "loggerutil.h" @@ -26,7 +24,10 @@ CustomEdit::CustomEdit(QGraphicsItem *parent) : HbLineEdit(parent) { - _DBGLOG("CustomEdit::CustomEdit()") + _DBGLOG("CustomEdit::CustomEdit() >") + const bool ret = connect(&mItemClickedTimer, SIGNAL(timeout()), + this, SLOT(emitEditItemClicked())); + _DBGLOG2("CustomEdit::CustomEdit() <", ret) } /*! @@ -35,25 +36,39 @@ CustomEdit::~CustomEdit() { _DBGLOG("CustomEdit::CustomEdit()") + disconnect(&mItemClickedTimer, SIGNAL(timeout()), + this, SLOT(emitEditItemClicked())); } /*! - mousePressEvent + focusInEvent */ void CustomEdit::focusInEvent(QFocusEvent *event) { _DBGLOG("CustomEdit::focusInEvent() >") if (!event->gotFocus()) { + _DBGLOG("CustomEdit::focusInEvent() ignore") event->ignore(); - _DBGLOG("CustomEdit::focusInEvent() ignore") - return; } else { - emit editItemClicked(); + _DBGLOG("CustomEdit::focusInEvent() emit clicked") + // When focus comes to the controller, a 100 ms timer is started. + // a signal is emitted after this 100 ms, and focus transfer to other controller, + // after the other controller finished,to avoid focus gained again. + mItemClickedTimer.start(100); event->accept(); - _DBGLOG("CustomEdit::focusInEvent() emit clicked") } _DBGLOG("CustomEdit::focusInEvent() <") } - + +/*! + emitEditItemClicked +*/ +void CustomEdit::emitEditItemClicked() +{ + _DBGLOG("CustomEdit::emitEditItemClicked() >") + emit editItemClicked(); + mItemClickedTimer.stop(); + _DBGLOG("CustomEdit::emitEditItemClicked() <") +} // End of file diff -r 1f002146abb4 -r cee7e9e0906c vmbx/vmbxcpplugin/tsrc/src/ut_customedit.cpp --- a/vmbx/vmbxcpplugin/tsrc/src/ut_customedit.cpp Tue Jul 06 14:53:02 2010 +0300 +++ b/vmbx/vmbxcpplugin/tsrc/src/ut_customedit.cpp Wed Aug 18 10:19:22 2010 +0300 @@ -18,6 +18,7 @@ #include #include #include +#include #include "ut_customedit.h" #include "customedit.h" @@ -44,9 +45,15 @@ Qt::MouseFocusReason); QVERIFY(event); edit->focusInEvent(event); + // test for emitEditItemClicked + QEventLoop loop; + QTimer timer; + timer.start(150); + connect( &timer,SIGNAL(timeout()), + &loop,SLOT(quit())); + loop.exec(); delete event; event = NULL; - delete edit; edit = NULL; QVERIFY(!edit); diff -r 1f002146abb4 -r cee7e9e0906c vmbx/vmbxengine/conf/CI_voicemailbox.confml Binary file vmbx/vmbxengine/conf/CI_voicemailbox.confml has changed diff -r 1f002146abb4 -r cee7e9e0906c vmbx/vmbxengine/conf/voicemailbox.confml Binary file vmbx/vmbxengine/conf/voicemailbox.confml has changed diff -r 1f002146abb4 -r cee7e9e0906c vmbx/vmbxengine/tsrc/ut_vmbxengine/ut_vmbxengine.pro --- a/vmbx/vmbxengine/tsrc/ut_vmbxengine/ut_vmbxengine.pro Tue Jul 06 14:53:02 2010 +0300 +++ b/vmbx/vmbxengine/tsrc/ut_vmbxengine/ut_vmbxengine.pro Wed Aug 18 10:19:22 2010 +0300 @@ -112,12 +112,13 @@ SOURCES += src\qtuihandler_mock.cpp SOURCES += src\cenrep_mock.cpp -LIBS += -lflogger.dll -LIBS += -lfeatmgr.dll -LIBS += -lcenrepnotifhandler.dll -LIBS += -lphoneclient.dll -LIBS += -lsssettings.dll -LIBS += -lsatclient.dll -LIBS += -lserviceprovidersettings.dll +LIBS += -lflogger +LIBS += -lfeatmgr +LIBS += -lcenrepnotifhandler +LIBS += -lphoneclient +LIBS += -lsssettings +LIBS += -lsatclient +LIBS += -lserviceprovidersettings +LIBS += -lefsrv -#End of files \ No newline at end of file +#End of file diff -r 1f002146abb4 -r cee7e9e0906c vmbx/vmbxengine/vmbxengine.pro --- a/vmbx/vmbxengine/vmbxengine.pro Tue Jul 06 14:53:02 2010 +0300 +++ b/vmbx/vmbxengine/vmbxengine.pro Wed Aug 18 10:19:22 2010 +0300 @@ -116,14 +116,16 @@ MMP_RULES += defFiles - BLD_INF_RULES.prj_exports += "rom/backup_registration.xml /epoc32/data/z/private/100058F5/backup_registration.xml" \ - "conf/CI_voicemailbox.confml MW_LAYER_CONFML(CI_voicemailbox.confml)" \ - "conf/voicemailbox_101F874F.crml MW_LAYER_CRML(voicemailbox_101F874F.crml)" \ - "rom/backup_registration.xml /epoc32/release/winscw/udeb/z/private/100058F5/backup_registration.xml" \ - "rom/backup_registration.xml /epoc32/release/winscw/urel/z/private/100058F5/backup_registration.xml" \ - "rom/vmbxengine_stub.sis /epoc32/data/z/system/install/vmbxengine_stub.sis" \ - "rom/vmbxengine.iby CORE_MW_LAYER_IBY_EXPORT_PATH(vmbxengine.iby)" \ - "rom/vmbxresources.iby LANGUAGE_MW_LAYER_IBY_EXPORT_PATH(vmbxresources.iby)" -TRANSLATIONS = vmbx.ts + BLD_INF_RULES.prj_exports += \ + "rom/backup_registration.xml /epoc32/data/z/private/100058F5/backup_registration.xml" \ + "conf/voicemailbox.confml MW_LAYER_CONFML(voicemailbox.confml)" \ + "conf/voicemailbox_101F874F.crml MW_LAYER_CRML(voicemailbox_101F874F.crml)" \ + "rom/backup_registration.xml /epoc32/release/winscw/udeb/z/private/100058F5/backup_registration.xml" \ + "rom/backup_registration.xml /epoc32/release/winscw/urel/z/private/100058F5/backup_registration.xml" \ + "rom/vmbxengine_stub.sis /epoc32/data/z/system/install/vmbxengine_stub.sis" \ + "rom/vmbxengine.iby CORE_MW_LAYER_IBY_EXPORT_PATH(vmbxengine.iby)" \ + "rom/vmbxresources.iby LANGUAGE_MW_LAYER_IBY_EXPORT_PATH(vmbxresources.iby)" + + TRANSLATIONS = vmbx.ts }