# HG changeset patch # User Dremov Kirill (Nokia-D-MSW/Tampere) # Date 1277306632 -10800 # Node ID 997690c3397a97fc26ac7e2f82100e1358cc48cc # Parent 91746b151f978285c57619732d1d8a5a4a42a762 Revision: 201023 Kit: 2010125 diff -r 91746b151f97 -r 997690c3397a bluetoothappprofiles/avrcp/mediabrowseapi/group/bld.inf --- a/bluetoothappprofiles/avrcp/mediabrowseapi/group/bld.inf Fri Jun 11 13:48:51 2010 +0300 +++ b/bluetoothappprofiles/avrcp/mediabrowseapi/group/bld.inf Wed Jun 23 18:23:52 2010 +0300 @@ -40,5 +40,5 @@ ../public/remconmediabrowsetypes.h SYMBIAN_MW_LAYER_PUBLIC_EXPORT_PATH(remconmediabrowsetypes.h) ../public/remconmediabrowsepanic.h SYMBIAN_MW_LAYER_PUBLIC_EXPORT_PATH(remconmediabrowsepanic.h) -../public/remconmediabrowsetargetbase.h SYMBIAN_MW_LAYER_PLATFORM_EXPORT_PATH(remcon/remconmediabrowsetargetbase.h) +../public/remconmediabrowsetargetbase.h SYMBIAN_MW_LAYER_PUBLIC_EXPORT_PATH(remcon/remconmediabrowsetargetbase.h) diff -r 91746b151f97 -r 997690c3397a bluetoothappprofiles/avrcp/nowplayingapi/group/bld.inf --- a/bluetoothappprofiles/avrcp/nowplayingapi/group/bld.inf Fri Jun 11 13:48:51 2010 +0300 +++ b/bluetoothappprofiles/avrcp/nowplayingapi/group/bld.inf Wed Jun 23 18:23:52 2010 +0300 @@ -30,4 +30,4 @@ ../public/remcondatabaseunawarenowplayingtarget.h SYMBIAN_MW_LAYER_PUBLIC_EXPORT_PATH(remcondatabaseunawarenowplayingtarget.h) ../public/remcondatabaseunawarenowplayingtargetobserver.h SYMBIAN_MW_LAYER_PUBLIC_EXPORT_PATH(remcondatabaseunawarenowplayingtargetobserver.h) -../public/remconnowplayingtargetbase.h SYMBIAN_MW_LAYER_PLATFORM_EXPORT_PATH(remcon/remconnowplayingtargetbase.h) +../public/remconnowplayingtargetbase.h SYMBIAN_MW_LAYER_PUBLIC_EXPORT_PATH(remcon/remconnowplayingtargetbase.h) diff -r 91746b151f97 -r 997690c3397a bluetoothappprofiles/avrcp/remconbeareravrcp/inc/avrcpincomingcommandhandler.h --- a/bluetoothappprofiles/avrcp/remconbeareravrcp/inc/avrcpincomingcommandhandler.h Fri Jun 11 13:48:51 2010 +0300 +++ b/bluetoothappprofiles/avrcp/remconbeareravrcp/inc/avrcpincomingcommandhandler.h Wed Jun 23 18:23:52 2010 +0300 @@ -32,13 +32,13 @@ class CPassthroughHelper; class CRcpRouter; -class CRemConBearerAvrcp; +class MRemConControlCommandInterface; class CAVCFrame; class TBTDevAddr; NONSHARABLE_CLASS(CRcpIncomingCommandHandler) : public CBase, public MPlayerChangeObserver, public MIncomingCommandHandler { public: - static CRcpIncomingCommandHandler* NewL(CRemConBearerAvrcp& aBearer, + static CRcpIncomingCommandHandler* NewL(MRemConControlCommandInterface& aCommandInterface, MRemConBearerObserver& aObserver, CRcpRouter& aRouter, CDeltaTimer& aTimer, @@ -59,7 +59,7 @@ void SendReject(TUid aInterfaceUid, TUint aId); private: - CRcpIncomingCommandHandler(CRemConBearerAvrcp& aBearer, + CRcpIncomingCommandHandler(MRemConControlCommandInterface& aCommandInterface, MRemConBearerObserver& aObserver, CRcpRouter& aRouter, CDeltaTimer& aTimer, @@ -92,6 +92,8 @@ void SendInternalResponse(TUint aId, RBuf8& aData); void SendResponse(TDblQue& aCommandQueue, TUint aId, RBuf8& aData); + + void EnterAddressedMode(); // Timer functions TBool DuplicateNotify(TDblQue& aCommandQueue, const CControlCommand& aCommand) const; @@ -100,15 +102,15 @@ TDblQue iCommandQueue; TDblQue iInternalCommandQueue; - CAVRCPFragmenter* iFragmenter; - CRemConBearerAvrcp& iBearer; - MRemConBearerObserver& iObserver; - CRcpRouter& iRouter; - CDeltaTimer& iTimer; - TRemConClientId iClientId; // We store the client id even if we aren't - // in addressed mode as we may switch into - // it and need to know the current local - // addressed player + CAVRCPFragmenter* iFragmenter; + MRemConControlCommandInterface& iCommandInterface; + MRemConBearerObserver& iObserver; + CRcpRouter& iRouter; + CDeltaTimer& iTimer; + TRemConClientId iClientId; // We store the client id even if we aren't + // in addressed mode as we may switch into + // it and need to know the current local + // addressed player TBool iAddressedMode; CAvrcpPlayerInfoManager& iPlayerInfoManager; diff -r 91746b151f97 -r 997690c3397a bluetoothappprofiles/avrcp/remconbeareravrcp/inc/avrcpoutgoingcommandhandler.h --- a/bluetoothappprofiles/avrcp/remconbeareravrcp/inc/avrcpoutgoingcommandhandler.h Fri Jun 11 13:48:51 2010 +0300 +++ b/bluetoothappprofiles/avrcp/remconbeareravrcp/inc/avrcpoutgoingcommandhandler.h Wed Jun 23 18:23:52 2010 +0300 @@ -30,13 +30,13 @@ class CControlCommand; class CRcpRouter; -class CRemConBearerAvrcp; +class MRemConControlCommandInterface; class MRemConBearerObserver; NONSHARABLE_CLASS(CRcpOutgoingCommandHandler) : public CBase, public MOutgoingCommandHandler { public: // Construction/Destruction - static CRcpOutgoingCommandHandler* NewL(CRemConBearerAvrcp& aBearer, + static CRcpOutgoingCommandHandler* NewL(MRemConControlCommandInterface& aCommandInterface, MRemConBearerObserver& aObserver, CRcpRouter& aRouter, CDeltaTimer& aTimer); @@ -68,7 +68,7 @@ const TBTDevAddr& aAddr); private: - CRcpOutgoingCommandHandler(CRemConBearerAvrcp& aBearer, + CRcpOutgoingCommandHandler(MRemConControlCommandInterface& aCommandInterface, MRemConBearerObserver& aObserver, CRcpRouter& aRouter, CDeltaTimer& aTimer); @@ -105,14 +105,14 @@ CControlCommand* aCommand, TBool aNotify); private: - TTransactionLabel iCurrentTrans; + TTransactionLabel iCurrentTrans; TDblQue iCommandQueue; TDblQue iNotifyCommandQueue; - CRemConBearerAvrcp& iBearer; - MRemConBearerObserver& iObserver; - CRcpRouter& iRouter; - CDeltaTimer& iTimer; + MRemConControlCommandInterface& iCommandInterface; + MRemConBearerObserver& iObserver; + CRcpRouter& iRouter; + CDeltaTimer& iTimer; CControlCommand* iUnreleasedCommand; TBool iUnreleasedHasResponse; diff -r 91746b151f97 -r 997690c3397a bluetoothappprofiles/avrcp/remconbeareravrcp/inc/avrcpremotedevice.h --- a/bluetoothappprofiles/avrcp/remconbeareravrcp/inc/avrcpremotedevice.h Fri Jun 11 13:48:51 2010 +0300 +++ b/bluetoothappprofiles/avrcp/remconbeareravrcp/inc/avrcpremotedevice.h Wed Jun 23 18:23:52 2010 +0300 @@ -24,7 +24,7 @@ #include -class CRemConBearerAvrcp; +class MRemConControlCommandInterface; class MIncomingCommandHandler; class MOutgoingCommandHandler; class CRcpIncomingCommandHandler; @@ -41,7 +41,7 @@ public: static CRcpRemoteDevice* NewL(const TBTDevAddr& aAddr, CRcpRouter& aRouter, - CRemConBearerAvrcp& aBearer, + MRemConControlCommandInterface& aCommandInterface, MRemConBearerObserver& aObserver, CDeltaTimer& aTimer, CAvrcpPlayerInfoManager& aPlayerInfoManager); @@ -58,7 +58,7 @@ private: CRcpRemoteDevice(const TBTDevAddr& aAddr, CRcpRouter& aRouter, - CRemConBearerAvrcp& aBearer, + MRemConControlCommandInterface& aCommandInterface, CDeltaTimer& aTimer); void ConstructL(MRemConBearerObserver& aObserver, @@ -73,7 +73,7 @@ CRcpOutgoingCommandHandler* iOutgoing; CRcpRouter& iRouter; - CRemConBearerAvrcp& iBearer; + MRemConControlCommandInterface& iCommandInterface; CDeltaTimer& iTimer; }; diff -r 91746b151f97 -r 997690c3397a bluetoothappprofiles/avrcp/remconbeareravrcp/inc/avrcputils.h --- a/bluetoothappprofiles/avrcp/remconbeareravrcp/inc/avrcputils.h Fri Jun 11 13:48:51 2010 +0300 +++ b/bluetoothappprofiles/avrcp/remconbeareravrcp/inc/avrcputils.h Wed Jun 23 18:23:52 2010 +0300 @@ -80,6 +80,8 @@ ECommandAlreadyQueuedForSending = 52, EPassthroughQueueNotEmptyAfterDisconnect = 53, EPreviousPassthroughNonNullReplacing = 54, + ETooManyRemotesRegisterForLocalAddressedPlayerUpdates = 55, + ETooFewRemotesRegisterForLocalAddressedPlayerUpdates = 56, }; template diff -r 91746b151f97 -r 997690c3397a bluetoothappprofiles/avrcp/remconbeareravrcp/inc/controlbearer.h --- a/bluetoothappprofiles/avrcp/remconbeareravrcp/inc/controlbearer.h Fri Jun 11 13:48:51 2010 +0300 +++ b/bluetoothappprofiles/avrcp/remconbeareravrcp/inc/controlbearer.h Wed Jun 23 18:23:52 2010 +0300 @@ -62,6 +62,8 @@ void MrcciCommandExpired(TUint aTransactionId); void MrccciSetAddressedClient(const TRemConClientId& aClient); + void MrccciRegisterForLocalAddressedClientUpdates(); + void MrccciUnregisterForLocalAddressedClientUpdates(); private: // MRemConBearerInterfaceV3 functions called from RemCon virtual TInt GetResponse(TUid& aInterfaceUid, @@ -184,6 +186,8 @@ CAvrcpBulkBearer* iBulkBearer; RAvctp iAvctp; + + TInt iRemotesInterestedInLocalAddressedClient; }; #endif //CONTROLBEARER_H diff -r 91746b151f97 -r 997690c3397a bluetoothappprofiles/avrcp/remconbeareravrcp/inc/passthroughhelper.h --- a/bluetoothappprofiles/avrcp/remconbeareravrcp/inc/passthroughhelper.h Fri Jun 11 13:48:51 2010 +0300 +++ b/bluetoothappprofiles/avrcp/remconbeareravrcp/inc/passthroughhelper.h Wed Jun 23 18:23:52 2010 +0300 @@ -19,19 +19,19 @@ #include class CRcpRouter; -class CRemConBearerAvrcp; +class MRemConControlCommandInterface; class CControlCommand; NONSHARABLE_CLASS(CPassthroughHelper) : public CBase { public: - static CPassthroughHelper* NewL(CRcpRouter& aRouter, CRemConBearerAvrcp& aBearer, CDeltaTimer& aTimer); + static CPassthroughHelper* NewL(CRcpRouter& aRouter, MRemConControlCommandInterface& aCommandInterface, CDeltaTimer& aTimer); ~CPassthroughHelper(); void Disconnect(); void HandlePassthrough(CControlCommand& aCommand); // FIXME for now private: - CPassthroughHelper(CRcpRouter& aRouter, CRemConBearerAvrcp& aAvrcp, CDeltaTimer& aTimer); + CPassthroughHelper(CRcpRouter& aRouter, MRemConControlCommandInterface& aCommandInterface, CDeltaTimer& aTimer); void ConstructL(); void Respond(CControlCommand& aCommand, TInt aErr); @@ -52,7 +52,7 @@ private: CRcpRouter& iRouter; - CRemConBearerAvrcp& iBearer; + MRemConControlCommandInterface& iCommandInterface; CDeltaTimer& iTimer; CControlCommand* iPreviousPassthrough; }; diff -r 91746b151f97 -r 997690c3397a bluetoothappprofiles/avrcp/remconbeareravrcp/inc/remconcommandinterface.h --- a/bluetoothappprofiles/avrcp/remconbeareravrcp/inc/remconcommandinterface.h Fri Jun 11 13:48:51 2010 +0300 +++ b/bluetoothappprofiles/avrcp/remconbeareravrcp/inc/remconcommandinterface.h Wed Jun 23 18:23:52 2010 +0300 @@ -51,7 +51,8 @@ virtual void MrccciNewNotifyResponse(CControlCommand& aCommand) = 0; virtual void MrccciSetAddressedClient(const TRemConClientId& aClient) = 0; - + virtual void MrccciRegisterForLocalAddressedClientUpdates() = 0; + virtual void MrccciUnregisterForLocalAddressedClientUpdates() = 0; }; #endif //REMCONCOMMANDINTERFACE_H diff -r 91746b151f97 -r 997690c3397a bluetoothappprofiles/avrcp/remconbeareravrcp/src/avrcpMetadataTransfer.cpp --- a/bluetoothappprofiles/avrcp/remconbeareravrcp/src/avrcpMetadataTransfer.cpp Fri Jun 11 13:48:51 2010 +0300 +++ b/bluetoothappprofiles/avrcp/remconbeareravrcp/src/avrcpMetadataTransfer.cpp Wed Jun 23 18:23:52 2010 +0300 @@ -901,11 +901,16 @@ eventsBuf.Append(ERegisterNotificationUidsChanged ); } - // Always mark support for stuff that's handled internally rather than - // by the player - count+= 2; - eventsBuf.Append(ERegisterNotificationAvailablePlayersChanged ); - eventsBuf.Append(ERegisterNotificationAddressedPlayerChanged ); + // If there are any browsing clients then mark support for the player addressing + // events. Without browsing support the remote will not be able to see the + // information about the players so it is better not to let them see events + // relating to the them + if(iPlayerInfoManager->BrowsingSupportedL(KNullClientId)) + { + count+= 2; + eventsBuf.Append(ERegisterNotificationAvailablePlayersChanged ); + eventsBuf.Append(ERegisterNotificationAddressedPlayerChanged ); + } responseData[1] += count; diff -r 91746b151f97 -r 997690c3397a bluetoothappprofiles/avrcp/remconbeareravrcp/src/avrcpincomingcommandhandler.cpp --- a/bluetoothappprofiles/avrcp/remconbeareravrcp/src/avrcpincomingcommandhandler.cpp Fri Jun 11 13:48:51 2010 +0300 +++ b/bluetoothappprofiles/avrcp/remconbeareravrcp/src/avrcpincomingcommandhandler.cpp Wed Jun 23 18:23:52 2010 +0300 @@ -54,7 +54,7 @@ @return A fully constructed CRcpIncomingCommandHandler. @leave System wide error codes. */ -CRcpIncomingCommandHandler* CRcpIncomingCommandHandler::NewL(CRemConBearerAvrcp& aBearer, +CRcpIncomingCommandHandler* CRcpIncomingCommandHandler::NewL(MRemConControlCommandInterface& aCommandInterface, MRemConBearerObserver& aObserver, CRcpRouter& aRouter, CDeltaTimer& aTimer, @@ -62,7 +62,7 @@ TBTDevAddr& aDevice) { LOG_STATIC_FUNC - CRcpIncomingCommandHandler* handler = new(ELeave)CRcpIncomingCommandHandler(aBearer, aObserver, aRouter, aTimer, aPlayerInfoManager, aDevice); + CRcpIncomingCommandHandler* handler = new(ELeave)CRcpIncomingCommandHandler(aCommandInterface, aObserver, aRouter, aTimer, aPlayerInfoManager, aDevice); CleanupStack::PushL(handler); handler->ConstructL(); CleanupStack::Pop(handler); @@ -78,7 +78,7 @@ @return A partially constructed CRcpIncomingCommandHandler. @leave System wide error codes. */ -CRcpIncomingCommandHandler::CRcpIncomingCommandHandler(CRemConBearerAvrcp& aBearer, +CRcpIncomingCommandHandler::CRcpIncomingCommandHandler(MRemConControlCommandInterface& aCommandInterface, MRemConBearerObserver& aObserver, CRcpRouter& aRouter, CDeltaTimer& aTimer, @@ -87,7 +87,7 @@ : iCommandQueue(_FOFF(CControlCommand, iHandlingLink)) , iInternalCommandQueue(_FOFF(CControlCommand, iHandlingLink)) , iFragmenter(NULL) - , iBearer(aBearer) + , iCommandInterface(aCommandInterface) , iObserver(aObserver) , iRouter(aRouter) , iTimer(aTimer) @@ -121,7 +121,7 @@ CleanupStack::PopAndDestroy(&players); - iPassthroughHelper = CPassthroughHelper::NewL(iRouter, iBearer, iTimer); + iPassthroughHelper = CPassthroughHelper::NewL(iRouter, iCommandInterface, iTimer); } /** Destructor. @@ -130,6 +130,7 @@ { LOG_FUNC + iCommandInterface.MrccciUnregisterForLocalAddressedClientUpdates(); iPlayerInfoManager.RemoveObserver( *this ); delete iFragmenter; delete iPassthroughHelper; @@ -207,7 +208,7 @@ { LOG_FUNC - TUint id = iBearer.MrcciNewTransactionId(); + TUint id = iCommandInterface.MrcciNewTransactionId(); // If there's nothing beyond a header this is bobs. Dump it now. if(aMessageInformation.Length() <= KAVCFrameHeaderLength) @@ -508,11 +509,11 @@ // can go directly to client (unlike passthrough which may need to map 2 commands to 1 click if (aCommand.Frame().Type() == AVC::ENotify) { - iBearer.MrccciNewNotifyCommand(aCommand, aCommand.ClientId()); + iCommandInterface.MrccciNewNotifyCommand(aCommand, aCommand.ClientId()); } else { - iBearer.MrcciNewCommand(aCommand, aCommand.ClientId()); + iCommandInterface.MrcciNewCommand(aCommand, aCommand.ClientId()); } } } @@ -522,7 +523,7 @@ LOG_FUNC // Once we respond to this we've told the remote that we're using a particular player - iAddressedMode = ETrue; + EnterAddressedMode(); // SetAddressedPlayer involves not just responding to this command but // also rejecting a bunch of notifies and completing the addressed player @@ -568,7 +569,7 @@ }; SendInternalResponse(aId, responseBuf); - iBearer.MrccciSetAddressedClient(iClientId); + iCommandInterface.MrccciSetAddressedClient(iClientId); responseBuf.Close(); } @@ -662,7 +663,7 @@ LOG_FUNC // Once we respond to this we've told the remote that we're using a particular player - iAddressedMode = ETrue; + EnterAddressedMode(); RBuf8 responseBuf; TRAPD(err, DoHandleRegisterAddressedPlayerNotificationL(responseBuf, aCommand)); @@ -720,7 +721,7 @@ // Although we haven't strictly told the remote which player we're using this is // a 1.4 command, and implies use of a specific player so switch into addressed mode - iAddressedMode = ETrue; + EnterAddressedMode(); RBuf8 responseBuf; TUint16 uidCounter = 0; @@ -823,6 +824,12 @@ aData.Close(); } +void CRcpIncomingCommandHandler::EnterAddressedMode() + { + iAddressedMode = ETrue; + iCommandInterface.MrccciRegisterForLocalAddressedClientUpdates(); + } + TBool CRcpIncomingCommandHandler::DuplicateNotify(TDblQue& aCommandQueue, const CControlCommand& aCommand) const { TUid interfaceUid = aCommand.RemConInterfaceUid(); diff -r 91746b151f97 -r 997690c3397a bluetoothappprofiles/avrcp/remconbeareravrcp/src/avrcpoutgoingcommandhandler.cpp --- a/bluetoothappprofiles/avrcp/remconbeareravrcp/src/avrcpoutgoingcommandhandler.cpp Fri Jun 11 13:48:51 2010 +0300 +++ b/bluetoothappprofiles/avrcp/remconbeareravrcp/src/avrcpoutgoingcommandhandler.cpp Wed Jun 23 18:23:52 2010 +0300 @@ -45,13 +45,13 @@ @return A fully constructed CRcpOutgoingCommandHandler. @leave System wide error codes. */ -CRcpOutgoingCommandHandler* CRcpOutgoingCommandHandler::NewL(CRemConBearerAvrcp& aBearer, +CRcpOutgoingCommandHandler* CRcpOutgoingCommandHandler::NewL(MRemConControlCommandInterface& aCommandInterface, MRemConBearerObserver& aObserver, CRcpRouter& aRouter, CDeltaTimer& aTimer) { LOG_STATIC_FUNC - CRcpOutgoingCommandHandler* handler = new(ELeave)CRcpOutgoingCommandHandler(aBearer, aObserver, aRouter, aTimer); + CRcpOutgoingCommandHandler* handler = new(ELeave)CRcpOutgoingCommandHandler(aCommandInterface, aObserver, aRouter, aTimer); return handler; } @@ -64,12 +64,12 @@ @return A partially constructed CRcpIncomingCommandHandler. @leave System wide error codes. */ -CRcpOutgoingCommandHandler::CRcpOutgoingCommandHandler(CRemConBearerAvrcp& aBearer, +CRcpOutgoingCommandHandler::CRcpOutgoingCommandHandler(MRemConControlCommandInterface& aCommandInterface, MRemConBearerObserver& aObserver, CRcpRouter& aRouter, CDeltaTimer& aTimer) : iCommandQueue(_FOFF(CControlCommand, iHandlingLink)), iNotifyCommandQueue(_FOFF(CControlCommand, iHandlingLink)), - iBearer(aBearer), iObserver(aObserver), iRouter(aRouter), iTimer(aTimer) + iCommandInterface(aCommandInterface), iObserver(aObserver), iRouter(aRouter), iTimer(aTimer) { LOG_FUNC } @@ -281,11 +281,11 @@ if ( aNotify ) {//This is a notify command - iBearer.MrccciNewNotifyResponse(*aCommand); + iCommandInterface.MrccciNewNotifyResponse(*aCommand); } else { - iBearer.MrccciNewResponse(*aCommand); + iCommandInterface.MrccciNewResponse(*aCommand); } } @@ -331,7 +331,7 @@ if(command) { command->SetNotifyVolumeChangeResult(command->Frame()); - iBearer.MrccciNewNotifyResponse(*command); + iCommandInterface.MrccciNewNotifyResponse(*command); } else { @@ -353,7 +353,7 @@ } } - iBearer.MrccciNewResponse(*command); + iCommandInterface.MrccciNewResponse(*command); } command->iHandlingLink.Deque(); @@ -578,7 +578,7 @@ aCommand.SetCoreButtonAction(ERemConCoreApiButtonRelease, ETrue); } - iBearer.MrccciNewResponse(aCommand); + iCommandInterface.MrccciNewResponse(aCommand); } } } diff -r 91746b151f97 -r 997690c3397a bluetoothappprofiles/avrcp/remconbeareravrcp/src/avrcpremotedevice.cpp --- a/bluetoothappprofiles/avrcp/remconbeareravrcp/src/avrcpremotedevice.cpp Fri Jun 11 13:48:51 2010 +0300 +++ b/bluetoothappprofiles/avrcp/remconbeareravrcp/src/avrcpremotedevice.cpp Wed Jun 23 18:23:52 2010 +0300 @@ -31,13 +31,13 @@ */ CRcpRemoteDevice* CRcpRemoteDevice::NewL(const TBTDevAddr& aAddr, CRcpRouter& aRouter, - CRemConBearerAvrcp& aBearer, + MRemConControlCommandInterface& aCommandInterface, MRemConBearerObserver& aObserver, CDeltaTimer& aTimer, CAvrcpPlayerInfoManager& aPlayerInfoManager) { LOG_STATIC_FUNC - CRcpRemoteDevice* engine = new(ELeave) CRcpRemoteDevice(aAddr, aRouter, aBearer, aTimer); + CRcpRemoteDevice* engine = new(ELeave) CRcpRemoteDevice(aAddr, aRouter, aCommandInterface, aTimer); CleanupStack::PushL(engine); engine->ConstructL(aObserver, aPlayerInfoManager); CleanupStack::Pop(engine); @@ -56,9 +56,9 @@ */ CRcpRemoteDevice::CRcpRemoteDevice(const TBTDevAddr& aAddr, CRcpRouter& aRouter, - CRemConBearerAvrcp& aBearer, + MRemConControlCommandInterface& aCommandInterface, CDeltaTimer& aTimer) : - iDevice(aAddr), iRouter(aRouter), iBearer(aBearer), iTimer(aTimer) + iDevice(aAddr), iRouter(aRouter), iCommandInterface(aCommandInterface), iTimer(aTimer) { LOG_FUNC } @@ -72,8 +72,8 @@ CAvrcpPlayerInfoManager& aPlayerInfoManager) { LOG_FUNC - iIncoming = CRcpIncomingCommandHandler::NewL(iBearer, aObserver, iRouter, iTimer, aPlayerInfoManager, iDevice); - iOutgoing = CRcpOutgoingCommandHandler::NewL(iBearer, aObserver, iRouter, iTimer); + iIncoming = CRcpIncomingCommandHandler::NewL(iCommandInterface, aObserver, iRouter, iTimer, aPlayerInfoManager, iDevice); + iOutgoing = CRcpOutgoingCommandHandler::NewL(iCommandInterface, aObserver, iRouter, iTimer); } /** Destructor. diff -r 91746b151f97 -r 997690c3397a bluetoothappprofiles/avrcp/remconbeareravrcp/src/avrcpsdputils.cpp --- a/bluetoothappprofiles/avrcp/remconbeareravrcp/src/avrcpsdputils.cpp Fri Jun 11 13:48:51 2010 +0300 +++ b/bluetoothappprofiles/avrcp/remconbeareravrcp/src/avrcpsdputils.cpp Wed Jun 23 18:23:52 2010 +0300 @@ -1,4 +1,4 @@ -// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). +// Copyright (c) 2008-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" @@ -29,18 +29,14 @@ if(aProfileVersion == AvrcpSdp::KAvrcpProfileVersion13) { serviceClassUuids->StartListL() - ->BuildDESL()->StartListL() ->BuildUUIDL(TUUID(TUint16(KAVRemoteControlUUID))) - ->EndListL() ->EndListL(); } else { serviceClassUuids->StartListL() - ->BuildDESL()->StartListL() ->BuildUUIDL(TUUID(TUint16(KAVRemoteControlUUID))) ->BuildUUIDL(TUUID(TUint16(KAVRemoteControlControllerUUID))) - ->EndListL() ->EndListL(); } diff -r 91746b151f97 -r 997690c3397a bluetoothappprofiles/avrcp/remconbeareravrcp/src/passthroughhelper.cpp --- a/bluetoothappprofiles/avrcp/remconbeareravrcp/src/passthroughhelper.cpp Fri Jun 11 13:48:51 2010 +0300 +++ b/bluetoothappprofiles/avrcp/remconbeareravrcp/src/passthroughhelper.cpp Wed Jun 23 18:23:52 2010 +0300 @@ -21,9 +21,9 @@ #include "controlbearer.h" -CPassthroughHelper* CPassthroughHelper::NewL(CRcpRouter& aRouter, CRemConBearerAvrcp& aBearer, CDeltaTimer& aTimer) +CPassthroughHelper* CPassthroughHelper::NewL(CRcpRouter& aRouter, MRemConControlCommandInterface& aCommandInterface, CDeltaTimer& aTimer) { - CPassthroughHelper* helper = new(ELeave)CPassthroughHelper(aRouter, aBearer, aTimer); + CPassthroughHelper* helper = new(ELeave)CPassthroughHelper(aRouter, aCommandInterface, aTimer); CleanupStack::PushL(helper); helper->ConstructL(); CleanupStack::Pop(helper); @@ -34,9 +34,9 @@ { } -CPassthroughHelper::CPassthroughHelper(CRcpRouter& aRouter, CRemConBearerAvrcp& aBearer, CDeltaTimer& aTimer) +CPassthroughHelper::CPassthroughHelper(CRcpRouter& aRouter, MRemConControlCommandInterface& aCommandInterface, CDeltaTimer& aTimer) : iRouter(aRouter) - , iBearer(aBearer) + , iCommandInterface(aCommandInterface) , iTimer(aTimer) { } @@ -164,7 +164,7 @@ { iPreviousPassthrough->SetClick(EFalse); iPreviousPassthrough->SetCoreButtonAction(ERemConCoreApiButtonPress, ETrue); - iBearer.MrcciNewCommand(*iPreviousPassthrough, iPreviousPassthrough->ClientId()); + iCommandInterface.MrcciNewCommand(*iPreviousPassthrough, iPreviousPassthrough->ClientId()); } StartReleaseTimer(*iPreviousPassthrough); } @@ -174,7 +174,7 @@ // to RemCon then start waiting for click. iPreviousPassthrough->CancelTimer(iTimer); iPreviousPassthrough->SetCoreButtonAction(ERemConCoreApiButtonClick, ETrue); - iBearer.MrcciNewCommand(*iPreviousPassthrough, iPreviousPassthrough->ClientId()); + iCommandInterface.MrcciNewCommand(*iPreviousPassthrough, iPreviousPassthrough->ClientId()); HandledCommand(*iPreviousPassthrough); @@ -214,7 +214,7 @@ // Cancel hold timer and send the previous command as a click. iPreviousPassthrough->CancelTimer(iTimer); iPreviousPassthrough->SetCoreButtonAction(ERemConCoreApiButtonClick, ETrue); - iBearer.MrcciNewCommand(*iPreviousPassthrough, iPreviousPassthrough->ClientId()); + iCommandInterface.MrcciNewCommand(*iPreviousPassthrough, iPreviousPassthrough->ClientId()); HandledCommand(*iPreviousPassthrough); } @@ -228,7 +228,7 @@ { aCommand.SetCoreButtonAction(ERemConCoreApiButtonRelease, ETrue); } - iBearer.MrcciNewCommand(aCommand, aCommand.ClientId()); + iCommandInterface.MrcciNewCommand(aCommand, aCommand.ClientId()); aCommand.DecrementUsers(); } } @@ -267,7 +267,7 @@ } else { - iBearer.MrcciNewCommand(aCommand, aCommand.ClientId()); + iCommandInterface.MrcciNewCommand(aCommand, aCommand.ClientId()); StartReleaseTimer(aCommand); } } @@ -303,7 +303,7 @@ TRAPD(err, aCommand.ReSetCoreButtonActionL(ERemConCoreApiButtonRelease, ETrue)); if (err == KErrNone) { - iBearer.MrcciNewCommand(aCommand, aCommand.ClientId()); + iCommandInterface.MrcciNewCommand(aCommand, aCommand.ClientId()); } else { @@ -386,7 +386,7 @@ aCommand.CancelTimer(iTimer); aCommand.SetClick(EFalse); aCommand.SetCoreButtonAction(ERemConCoreApiButtonPress, ETrue); - iBearer.MrcciNewCommand(aCommand, aCommand.ClientId()); + iCommandInterface.MrcciNewCommand(aCommand, aCommand.ClientId()); StartReleaseTimer(aCommand); } diff -r 91746b151f97 -r 997690c3397a bluetoothappprofiles/avrcp/remconbeareravrcp/src/remconbeareravrcp.cpp --- a/bluetoothappprofiles/avrcp/remconbeareravrcp/src/remconbeareravrcp.cpp Fri Jun 11 13:48:51 2010 +0300 +++ b/bluetoothappprofiles/avrcp/remconbeareravrcp/src/remconbeareravrcp.cpp Wed Jun 23 18:23:52 2010 +0300 @@ -870,6 +870,54 @@ Observer().SetRemoteAddressedClient(TUid::Uid(KRemConBearerAvrcpImplementationUid), aClientId); } +void CRemConBearerAvrcp::MrccciRegisterForLocalAddressedClientUpdates() + { + // Addressed player observers are registered with RemCon on a per-bearer basis + // so we aggregate interest from remote here + iRemotesInterestedInLocalAddressedClient++; + if(iRemotesInterestedInLocalAddressedClient == 1) + { + // Weren't any registered before, tell RemCon we care + Observer().RegisterLocalAddressedClientObserver(TUid::Uid(KRemConBearerAvrcpImplementationUid)); + } + +#ifdef __DEBUG + TInt numRemotes = 0; + CRcpRemoteDevice* remote = NULL; + + TDblQueIter iter(iRemotes); + while (iter++) + { + numRemotes++; + } + __ASSERT_DEBUG(iRemotesInterestedInLocalAddressedClient <= numRemotes, AVRCP_PANIC(ETooManyRemotesRegisterForLocalAddressedPlayerUpdates)); +#endif + } + +void CRemConBearerAvrcp::MrccciUnregisterForLocalAddressedClientUpdates() + { +#ifdef __DEBUG + TInt numRemotes = 0; + CRcpRemoteDevice* remote = NULL; + + TDblQueIter iter(iRemotes); + while (iter++) + { + numRemotes++; + } + __ASSERT_DEBUG(iRemotesInterestedInLocalAddressedClient <= numRemotes, AVRCP_PANIC(ETooManyRemotesRegisterForLocalAddressedPlayerUpdates)); + __ASSERT_DEBUG(iRemotesInterestedInLocalAddressedClient > 0, AVRCP_PANIC(ETooFewRemotesRegisterForLocalAddressedPlayerUpdates)); +#endif + + iRemotesInterestedInLocalAddressedClient--; + if(iRemotesInterestedInLocalAddressedClient == 0) + { + // No-one left who cares. Tell RemCon not to bother updating + // us anymore. + Observer().UnregisterLocalAddressedClientObserver(TUid::Uid(KRemConBearerAvrcpImplementationUid)); + } + } + /** Called from outgoing handlers to notify that a response for a notify command is ready for RemCon. diff -r 91746b151f97 -r 997690c3397a bluetoothengine/bteng/conf/CI_bteng.confml Binary file bluetoothengine/bteng/conf/CI_bteng.confml has changed diff -r 91746b151f97 -r 997690c3397a bluetoothengine/bteng/conf/bteng.confml Binary file bluetoothengine/bteng/conf/bteng.confml has changed diff -r 91746b151f97 -r 997690c3397a bluetoothengine/bteng/group/bld.inf --- a/bluetoothengine/bteng/group/bld.inf Fri Jun 11 13:48:51 2010 +0300 +++ b/bluetoothengine/bteng/group/bld.inf Wed Jun 23 18:23:52 2010 +0300 @@ -37,6 +37,10 @@ ../conf/bteng_10204DAB.crml MW_LAYER_CRML(bteng_10204DAB.crml) ../conf/bteng_10204DAC.crml MW_LAYER_CRML(bteng_10204DAC.crml) +/*remove the following exportation, when SCB CR is approved*/ +../conf/CI_bteng.confml MW_LAYER_CONFML(CI_bteng.confml) + + ../data/btrfs.txt z:/resource/btrfs.txt diff -r 91746b151f97 -r 997690c3397a bluetoothengine/bthid/bthidserver/src/bthidserver.cpp --- a/bluetoothengine/bthid/bthidserver/src/bthidserver.cpp Fri Jun 11 13:48:51 2010 +0300 +++ b/bluetoothengine/bthid/bthidserver/src/bthidserver.cpp Wed Jun 23 18:23:52 2010 +0300 @@ -101,7 +101,7 @@ delete iHidSdpClient; - RProperty::Delete( KPSUidBthidSrv, KBTMouseCursorState ); + } CBTHidServer* CBTHidServer::NewL() @@ -210,13 +210,8 @@ } TRACE_INFO(_L("[BTHID]\tCBTHidServer::ConstructL(): Starting the server")); - - User::LeaveIfError( RProperty::Define( KPSUidBthidSrv, - KBTMouseCursorState, - RProperty::EInt, - KBTHIDPSKeyReadPolicy, - KBTHIDPSKeyWritePolicy) ); - + + StartL(KBTHidSrvName); iActiveState = EFalse; diff -r 91746b151f97 -r 997690c3397a bluetoothengine/bthid/common/inc/bthidPsKey.h --- a/bluetoothengine/bthid/common/inc/bthidPsKey.h Fri Jun 11 13:48:51 2010 +0300 +++ b/bluetoothengine/bthid/common/inc/bthidPsKey.h Wed Jun 23 18:23:52 2010 +0300 @@ -20,7 +20,9 @@ #ifndef BTHIDPSKEY_H_ #define BTHIDPSKEY_H_ -const TUid KPSUidBthidSrv = {0x2001E301}; + + +const TUid KPSUidBthidSrv = { 0x2001FE5C }; const TUint KBTMouseCursorState = 0x00000001; diff -r 91746b151f97 -r 997690c3397a bluetoothengine/bthid/keyboard/group/keyboard.mmp --- a/bluetoothengine/bthid/keyboard/group/keyboard.mmp Fri Jun 11 13:48:51 2010 +0300 +++ b/bluetoothengine/bthid/keyboard/group/keyboard.mmp Wed Jun 23 18:23:52 2010 +0300 @@ -22,7 +22,7 @@ TARGETTYPE PLUGIN UID ECOM_UID KEYBOARD_UID -CAPABILITY CAP_APPLICATION +CAPABILITY CAP_APPLICATION CommDD ProtServ VENDORID VID_DEFAULT USERINCLUDE ../inc diff -r 91746b151f97 -r 997690c3397a bluetoothengine/bthid/keyboard/inc/keyboard.h --- a/bluetoothengine/bthid/keyboard/inc/keyboard.h Fri Jun 11 13:48:51 2010 +0300 +++ b/bluetoothengine/bthid/keyboard/inc/keyboard.h Wed Jun 23 18:23:52 2010 +0300 @@ -27,9 +27,6 @@ #include "hidkeys.h" #include "layoutmgr.h" #include "timeoutnotifier.h" -#include -#include -#include "pointmsgqueue.h" #include "bthidsettings.h" class CField; @@ -67,16 +64,6 @@ KNumInputFieldTypes }; - // The types of keyboard input report fields that we handle: - enum TMouseFieldType - { - EMouseButtons = 0, - EMouseXY = 1, - EMouseWheel = 2, - EMouseMediaKeys = 3, - EMousePowerKeys = 4, - KMouseInputFieldTypes - }; public: // Constructors and destructor /*! @@ -210,14 +197,6 @@ // Handles the states of the modifier keys void UpdateModifiers(TInt aFieldIndex, const TDesC8& aReport); - // Handles the states of the XY (mouse up, down, left, right) - void UpdateXY(TInt aFieldIndex, const TDesC8& aReport); - - // Handles the states of the Buttons (left & right button) - void UpdateButtons(TInt aFieldIndex, const TDesC8& aReport); - - // Handles the states of the wheel - void UpdateWheel(TInt aFieldIndex, const TDesC8& aReport); // Handle key presses void ProcessKeys(TInt aFieldIndex, const TDesC8& aReport); @@ -302,17 +281,10 @@ // ---------------------------------------- static TInt ResetArrayToSize(RArray& aArray, TInt aSize); - void MoveCursor(const TPoint& aPoint); - TInt PostPointer(const TPoint& aPoint); - TInt SendButtonEvent(TBool aButtonDown); TBool IsDigitKey(TInt aScanCode); TBool IsSpecialHandleKey(TInt aUniCode); - void LaunchApplicationL(const TDesC& aName); - - //Redraw cursor - void CursorRedraw(); private: TKeyboardDriverState iDriverState; @@ -333,9 +305,6 @@ // various types of key: const CField* iField[KNumInputFieldTypes]; - // Pointers to the fields in the report descriptor containing the - // various types of key: - const CField* iMouseField[KMouseInputFieldTypes]; // Pointer to the field in the report descriptor containing the LEDs: const CField* iLedField; @@ -371,13 +340,6 @@ // This timer stops key repeating after defined time to prevent endless key repeats in error cases. Fix for EMKD-7FBB9H CTimeOutTimer* iRepeatEndTimer; - - TBool iComboDevice; - - RMsgQueue iPointBufQueue; - TPointBuffer iPointerBuffer; - TBool iButtonDown; - TBool iButton2Down; }; // ---------------------------------------------------------------------- diff -r 91746b151f97 -r 997690c3397a bluetoothengine/bthid/keyboard/src/keyboard.cpp --- a/bluetoothengine/bthid/keyboard/src/keyboard.cpp Fri Jun 11 13:48:51 2010 +0300 +++ b/bluetoothengine/bthid/keyboard/src/keyboard.cpp Wed Jun 23 18:23:52 2010 +0300 @@ -23,8 +23,6 @@ #include #include #include -#include -#include #include "hidtranslate.h" #include "finder.h" @@ -52,7 +50,6 @@ const TInt KKeyRepeatDelay = 500000; const TInt KKeyRepeatInterval = 75000; -_LIT(KAppName, "PaintCursor.exe"); //---------------------------------------------------------------------------- // CHidKeyboardDriver::CHidKeyboardDriver //---------------------------------------------------------------------------- @@ -112,8 +109,6 @@ iPhoneAppId = PhoneAppId(); iIdleAppId = IdleAppId(); - iComboDevice = EFalse; - iSettings = CBtHidSettings::NewL(); } @@ -136,58 +131,10 @@ iKeys[i].Reset(); } - iPointBufQueue.Close(); - - if (iComboDevice) - { - RProperty::Set( KPSUidBthidSrv, KBTMouseCursorState, ECursorNotInitialized ); - } - if (iSettings) delete iSettings; } -void CHidKeyboardDriver::MoveCursor(const TPoint& aPoint) - { - DBG(RDebug::Print( - _L("CHidKeyboard::MoveCursor"))); - - PostPointer(aPoint); - } -// --------------------------------------------------------------------------- -// CHidMouseDriver::PostPointer -// Save the event to the buffer -// --------------------------------------------------------------------------- -// -TInt CHidKeyboardDriver::PostPointer(const TPoint& aPoint) - { - DBG(RDebug::Print(_L("CHidKeyboard::PostPointer"))); - iPointerBuffer.iPoint[iPointerBuffer.iNum] = aPoint; - iPointerBuffer.iType[iPointerBuffer.iNum] = KBufferPlainPointer; - iPointerBuffer.iNum++; - TInt ret = KErrNone; - - if (iPointerBuffer.iNum > KPMaxEvent) - { - ret = iPointBufQueue.Send(iPointerBuffer); - iPointerBuffer.iNum = 0; - } - return ret; - } - -TInt CHidKeyboardDriver::SendButtonEvent(TBool aButtonDown) - { - DBG(RDebug::Print( - _L("CHidKeyboard::SendButtonEvent"))); - iPointerBuffer.iPoint[iPointerBuffer.iNum] = TPoint(0, 0); - iPointerBuffer.iType[iPointerBuffer.iNum] = aButtonDown - ? KBufferPenDown - : KBufferPenUp; - iPointerBuffer.iNum++; - TInt ret = iPointBufQueue.Send(iPointerBuffer); - iPointerBuffer.iNum = 0; - return ret; - } //---------------------------------------------------------------------------- // CHidKeyboardDriver:::StartL //---------------------------------------------------------------------------- @@ -233,25 +180,10 @@ //Used the layoutID from CenRep iLayoutMgr.SetLayout(iLastSelectedLayout); } - TInt err = iPointBufQueue.OpenGlobal(KMsgBTMouseBufferQueue); - if (err == KErrNotFound) - { - User::LeaveIfError(iPointBufQueue.CreateGlobal(KMsgBTMouseBufferQueue, KPointQueueLen)); - } - else - { - User::LeaveIfError( err ); - } // Ready to process keyboard events: iDriverState = EInitialised; - if (iComboDevice) - { - LaunchApplicationL(KAppName); - RProperty::Set( KPSUidBthidSrv, KBTMouseCursorState, ECursorShow ); - } - } //---------------------------------------------------------------------------- @@ -286,41 +218,6 @@ { iDriverState = EDisabled; CancelAllKeys(); - if (iComboDevice) - { - RProperty::Set( KPSUidBthidSrv, KBTMouseCursorState, ECursorNotInitialized ); - } - } - -//---------------------------------------------------------------------------- -// CHidMouseDriver::LaunchApplicationL -//---------------------------------------------------------------------------- -// -void CHidKeyboardDriver::LaunchApplicationL(const TDesC& aName) - { - //Check if application is already running in the background - TApaTaskList tasks(iWsSession); - TApaTask task = tasks.FindApp(aName); - if (task.Exists()) - { - // Application is active, so just bring to foreground - } - else - { - // If application is not running, then create a new one - CApaCommandLine* cmd = CApaCommandLine::NewLC(); - cmd->SetExecutableNameL(aName); - cmd->SetCommandL(EApaCommandBackground); // EApaCommandRun - - RApaLsSession arcSession; - //connect to AppArc server - User::LeaveIfError(arcSession.Connect()); - CleanupClosePushL(arcSession); - User::LeaveIfError(arcSession.StartApp(*cmd)); - arcSession.Close(); - CleanupStack::PopAndDestroy(2); - } - } // ---------------------------------------------------------------------- @@ -339,21 +236,6 @@ case CHidTransport::EHidChannelInt: if (EInitialised == iDriverState) { - if (iComboDevice) - { - TInt mouseStatus; - TInt err = RProperty::Get( KPSUidBthidSrv, KBTMouseCursorState, mouseStatus ); - if ( !err && - ((static_cast(mouseStatus) == ECursorRedraw)|| - (static_cast(mouseStatus) == ECursorReset)) ) - { - err = RProperty::Set( KPSUidBthidSrv, KBTMouseCursorState, ECursorShow ); - DBG(RDebug::Print( - _L("[BTHID]\tCHidKeyboardDriver::DataIn() ECursorRedraw ||ECursorReset ")) ); - } - - CursorRedraw(); - } InterruptData(aPayload); } break; @@ -386,127 +268,6 @@ Stop(); } -void CHidKeyboardDriver::UpdateXY(TInt aFieldIndex, const TDesC8& aReport) - { - // DBG(RDebug::Print(_L("[HID]\tCHidMouseDriver::UpdateModifiers()"))); - - // Translate the HID usage values into a boot protocol style - // modifier bitmask: - // - TReportTranslator report(aReport, iMouseField[aFieldIndex]); - - TInt Xvalue = 0; - TInt Yvalue = 0; - - TInt errX = report.GetValue(Xvalue, EGenericDesktopUsageX); - TInt errY = report.GetValue(Yvalue, EGenericDesktopUsageY); - - DBG(RDebug::Print(_L("[HID]\tCHidMouseDriver::UpdateXY (%d,%d)"), Xvalue, Yvalue)); - if ((Xvalue != 0) || (Yvalue != 0)) - { - MoveCursor(TPoint(Xvalue, Yvalue)); - } - } - -void CHidKeyboardDriver::UpdateWheel(TInt aFieldIndex, const TDesC8& aReport) - { - TReportTranslator report(aReport, iMouseField[aFieldIndex]); - - TInt Yvalue = 0; - - TInt errY = report.GetValue(Yvalue, EGenericDesktopUsageWheel); - DBG(RDebug::Print(_L("[HID]\tCHidMouseDriver::UpdateWheel (%d)"), Yvalue)); - TInt absValue(Abs(Yvalue)); - if ((errY == KErrNone) && (absValue >= 1)) - { - TRawEvent rawEvent; - for (TInt ii = 0; ii < absValue; ii++) - { - rawEvent.Set(TRawEvent::EKeyDown, - (Yvalue > 0) ? EStdKeyUpArrow : EStdKeyDownArrow); - UserSvr::AddEvent(rawEvent); - rawEvent.Set(TRawEvent::EKeyUp, - (Yvalue > 0) ? EStdKeyUpArrow : EStdKeyDownArrow); - UserSvr::AddEvent(rawEvent); - } - } - DBG(RDebug::Print(_L("[HID]\t new iModifiers = %02x"), iModifiers)); - } - -void CHidKeyboardDriver::UpdateButtons(TInt aFieldIndex, - const TDesC8& aReport) - { - DBG(RDebug::Print(_L("[HID]\tCHidMouseDriver::UpdateButtons()"))); - // Translate the HID usage values into a boot protocol style - // modifier bitmask: - // - const TInt KButton1 = 1; - const TInt KButton2 = 2; - const TInt KButton3 = 3; - - TBool buttonPressed(EFalse); - - DBG(RDebug::Print(_L("[HID]\tCHidMouseDriver::UpdateButtons() %d, %d, %d"), - iMouseField[aFieldIndex]->UsagePage(), - iMouseField[aFieldIndex]->UsageMin(), - iMouseField[aFieldIndex]->UsageMax())); - (void) aFieldIndex; - // Hack but works - // We dont come here if the report is wrong? - TInt buttonByte = aReport[1]; - if (KButton1 == buttonByte) - { - DBG(RDebug::Print(_L("[HID]\tCHidMouseDriver::UpdateButtons() Button1"))); - buttonPressed = ETrue; - } - - if (KButton2 == buttonByte) - { - DBG(RDebug::Print(_L("[HID]\tCHidMouseDriver::UpdateButtons() Button2"))); - if (!iButton2Down) - { - iButton2Down = ETrue; - TRawEvent rawEvent; - rawEvent.Set(TRawEvent::EKeyDown, EStdKeyApplication0); - CursorRedraw(); - UserSvr::AddEvent(rawEvent); - } - } - else - { - if (iButton2Down) - { - iButton2Down = EFalse; - TRawEvent rawEvent; - rawEvent.Set(TRawEvent::EKeyUp, EStdKeyApplication0); - CursorRedraw(); - UserSvr::AddEvent(rawEvent); - } - } - - if (KButton3 == buttonByte) - { - DBG(RDebug::Print(_L("[HID]\tCHidMouseDriver::UpdateButtons() Button3"))); - buttonPressed = ETrue; - } - - if (buttonPressed) - { - if (!iButtonDown) - { - iButtonDown = ETrue; - SendButtonEvent(ETrue);//Send Mouse Button Down - } - } - else - { - if (iButtonDown) - { - iButtonDown = EFalse; - SendButtonEvent(EFalse); //Send Mouse Button Up - } - } - } //---------------------------------------------------------------------------- // CHidKeyboardDriver::InterruptData //---------------------------------------------------------------------------- @@ -531,30 +292,6 @@ ii, nextByte)); } #endif - TBool mouseEvent(EFalse); - if (iMouseField[EMouseXY] && iMouseField[EMouseXY]->IsInReport(firstByte)) - { - UpdateXY(EMouseXY, aPayload); - mouseEvent = ETrue; - } - - if (iMouseField[EMouseButtons] && iMouseField[EMouseButtons]->IsInReport( - firstByte)) - { - UpdateButtons(EMouseButtons, aPayload); - mouseEvent = ETrue; - } - if (iMouseField[EMouseXY] && iMouseField[EMouseXY]->IsInReport(firstByte)) - { - UpdateWheel(EMouseWheel, aPayload); - mouseEvent = ETrue; - } - DBG(RDebug::Print(_L("[HID]\tCHidKeyboardDriver::InterruptData() mouseevent %d"), - mouseEvent)); - if (mouseEvent) - { - return; - } // First check for any rollover errors: // TInt i; @@ -1523,18 +1260,6 @@ { valid = KErrNone; } - - TMouseFinder mousefinder; - search.SearchL(aReportRoot, &mousefinder); - iMouseField[EMouseButtons] = mousefinder.ButtonsField(); - iMouseField[EMouseXY] = mousefinder.XYField(); - iMouseField[EMouseWheel] = mousefinder.WheelField(); - - if ((iMouseField[EMouseButtons] != 0) && (iMouseField[EMouseXY] != 0)) - { - iComboDevice = ETrue; - } - TRACE_INFO( ( _L("CHidKeyboard::CanHandleReport() returning %d"), valid)); @@ -1937,18 +1662,5 @@ CancelAllKeys(); } -void CHidKeyboardDriver::CursorRedraw() - { - TInt mouseStatus; - - TInt err = RProperty::Get( KPSUidBthidSrv, KBTMouseCursorState, mouseStatus ); - if ( !err ) - { - err = RProperty::Set( KPSUidBthidSrv, KBTMouseCursorState, ECursorRedraw ); - DBG(RDebug::Print( - _L("[BTHID]\tCHidKeyboardDriver::CursorRedraw() X->ECursorRedraw") ) ); - } - } - // ---------------------------------------------------------------------- // End of file diff -r 91746b151f97 -r 997690c3397a bluetoothengine/bthid/mouse/PaintCursor/src/paintcursorappview.cpp --- a/bluetoothengine/bthid/mouse/PaintCursor/src/paintcursorappview.cpp Fri Jun 11 13:48:51 2010 +0300 +++ b/bluetoothengine/bthid/mouse/PaintCursor/src/paintcursorappview.cpp Wed Jun 23 18:23:52 2010 +0300 @@ -16,11 +16,20 @@ */ #include +#include +#include #include "paintcursorappview.h" #include "pointmsgqueue.h" #include "debug.h" +/** PubSub key read and write policies */ +_LIT_SECURITY_POLICY_C2( KBTHIDPSKeyReadPolicy, + ECapabilityLocalServices, ECapabilityReadDeviceData ); +_LIT_SECURITY_POLICY_C2( KBTHIDPSKeyWritePolicy, + ECapabilityLocalServices, ECapabilityWriteDeviceData ); + + CPaintCursorAppView* CPaintCursorAppView::NewL(const TRect& aRect) { CPaintCursorAppView* self = CPaintCursorAppView::NewLC(aRect); @@ -38,6 +47,13 @@ void CPaintCursorAppView::ConstructL(const TRect& aRect) { + + User::LeaveIfError( RProperty::Define( KPSUidBthidSrv, + KBTMouseCursorState, + RProperty::EInt, + KBTHIDPSKeyReadPolicy, + KBTHIDPSKeyWritePolicy) ); + // Create a window for this application view CreateWindowL(); @@ -110,6 +126,8 @@ // Close the animation server iMouseCursorDll.Close(); + + RProperty::Delete( KPSUidBthidSrv, KBTMouseCursorState ); } void CPaintCursorAppView::SizeChanged() diff -r 91746b151f97 -r 997690c3397a bluetoothengine/bthid/mouse/Sesame_client/src/clientimagecommander.cpp --- a/bluetoothengine/bthid/mouse/Sesame_client/src/clientimagecommander.cpp Fri Jun 11 13:48:51 2010 +0300 +++ b/bluetoothengine/bthid/mouse/Sesame_client/src/clientimagecommander.cpp Wed Jun 23 18:23:52 2010 +0300 @@ -27,6 +27,7 @@ #include #include #include +#include #include "clientimagecommander.h" #ifndef DBG diff -r 91746b151f97 -r 997690c3397a bluetoothengine/bthid/mouse/hidmousedriver/group/mouse.mmp --- a/bluetoothengine/bthid/mouse/hidmousedriver/group/mouse.mmp Fri Jun 11 13:48:51 2010 +0300 +++ b/bluetoothengine/bthid/mouse/hidmousedriver/group/mouse.mmp Wed Jun 23 18:23:52 2010 +0300 @@ -23,7 +23,7 @@ TARGETTYPE PLUGIN UID ECOM_UID MOUSE_UID -CAPABILITY CAP_APPLICATION +CAPABILITY CAP_APPLICATION CommDD ProtServ VENDORID VID_DEFAULT diff -r 91746b151f97 -r 997690c3397a bluetoothengine/bthid/mouse/hidmousedriver/inc/mouse.h --- a/bluetoothengine/bthid/mouse/hidmousedriver/inc/mouse.h Fri Jun 11 13:48:51 2010 +0300 +++ b/bluetoothengine/bthid/mouse/hidmousedriver/inc/mouse.h Wed Jun 23 18:23:52 2010 +0300 @@ -176,7 +176,8 @@ TInt SendButtonEvent(TBool aButtonDown); void LaunchApplicationL(const TDesC& aName); - //void LaunchApplicationL(TInt aAppUid); + + TBool IsAlreadyRunning(); private: // The Generic HID layer diff -r 91746b151f97 -r 997690c3397a bluetoothengine/bthid/mouse/hidmousedriver/src/mouse.cpp --- a/bluetoothengine/bthid/mouse/hidmousedriver/src/mouse.cpp Fri Jun 11 13:48:51 2010 +0300 +++ b/bluetoothengine/bthid/mouse/hidmousedriver/src/mouse.cpp Wed Jun 23 18:23:52 2010 +0300 @@ -183,10 +183,7 @@ void CHidMouseDriver::LaunchApplicationL(const TDesC& aName) { //Check if application is already running in the background - TApaTaskList tasks( iWsSession ); - TApaTask task = tasks.FindApp( aName ); - - if ( task.Exists() ) + if (IsAlreadyRunning()) { // Application is active, so just bring to foreground } @@ -208,6 +205,32 @@ CleanupStack::PopAndDestroy(2); } } + +TBool CHidMouseDriver::IsAlreadyRunning() + { + TFindProcess processFinder(_L("*[2001fe5c]*")); //search by paintcursor.exe UID3 + + TBool found = EFalse; + TFullName result; + if (processFinder.Next(result) == KErrNone) + { + DBG(RDebug::Print(_L("[BTHID] CHidMouseDriver::IsAlreadyRunning - process found Inside while")) ); + found = ETrue; + } + + if (found) + { + DBG(RDebug::Print(_L("[BTHID] CHidMouseDriver::IsAlreadyRunning - Process found ")) ); + } + else + { + DBG(RDebug::Print(_L("[BTHID] CHidMouseDriver::IsAlreadyRunning - Process was never found")) ); + } + + return found; +} + + // ---------------------------------------------------------------------- // CHidDriver mandatory functions: @@ -231,6 +254,7 @@ _L("[BTHID]\tCHidMouseDriver::DataIn() ECursorRedraw ||ECursorReset ")) ); } + LaunchApplicationL(KAppName); CursorRedraw(); diff -r 91746b151f97 -r 997690c3397a bluetoothengine/btnotif/btdevicedialogplugin/btdevicedialogplugin.pro --- a/bluetoothengine/btnotif/btdevicedialogplugin/btdevicedialogplugin.pro Fri Jun 11 13:48:51 2010 +0300 +++ b/bluetoothengine/btnotif/btdevicedialogplugin/btdevicedialogplugin.pro Wed Jun 23 18:23:52 2010 +0300 @@ -17,7 +17,7 @@ TEMPLATE = lib TARGET = btdevicedialogplugin CONFIG += hb plugin -INCLUDEPATH += . ../inc +INCLUDEPATH += . ../inc ../../btui/inc DEPENDPATH += . DESTDIR = $${HB_BUILD_DIR}/plugins/devicedialogs @@ -33,7 +33,9 @@ inc/btdevicesearchdialogwidget.h \ inc/btmoredevicesdialogwidget.h \ inc/btsenddialogwidget.h \ - inc/btdevicedialogplugintrace.h + inc/btdevicedialogplugintrace.h \ + inc/btdevicedialogrecvquerywidget.h \ + inc/btrecvprgrsdialogwidget.h SOURCES += src/btdevicedialogplugin.cpp \ @@ -42,7 +44,9 @@ src/btdevicedialognotifwidget.cpp \ src/btdevicesearchdialogwidget.cpp \ src/btmoredevicesdialogwidget.cpp \ - src/btsenddialogwidget.cpp + src/btsenddialogwidget.cpp \ + src/btdevicedialogrecvquerywidget.cpp \ + src/btrecvprgrsdialogwidget.cpp RESOURCES += btdevicedialogplugin.qrc @@ -51,6 +55,9 @@ TARGET.EPOCALLOWDLLDATA = 1 TARGET.CAPABILITY = CAP_GENERAL_DLL TARGET.UID3 = 0x2002E6DF + + LIBS += -lbtdevice + hblib.sources = Hb.dll hblib.path = \sys\bin hblib.depends = "(0xEEF9EA38), 1, 0, 0, {\"Hb\"}" diff -r 91746b151f97 -r 997690c3397a bluetoothengine/btnotif/btdevicedialogplugin/btdevicedialogplugin.qrc --- a/bluetoothengine/btnotif/btdevicedialogplugin/btdevicedialogplugin.qrc Fri Jun 11 13:48:51 2010 +0300 +++ b/bluetoothengine/btnotif/btdevicedialogplugin/btdevicedialogplugin.qrc Wed Jun 23 18:23:52 2010 +0300 @@ -4,6 +4,10 @@ docml/bt-more-devices-dialog.docml docml/bt-send-dialog.docml icons/qgn_prop_sml_bt.svg - icons/qtg_large_bluetooth.svg + icons/qtg_large_bluetooth.svg + docml/bt-receive-auth-dialog.docml + docml/bt-recv-progress-dialog.docml + btdialogs_en_GB.qm + btviews_en_GB.qm diff -r 91746b151f97 -r 997690c3397a bluetoothengine/btnotif/btdevicedialogplugin/btdialogs_en_GB.qm Binary file bluetoothengine/btnotif/btdevicedialogplugin/btdialogs_en_GB.qm has changed diff -r 91746b151f97 -r 997690c3397a bluetoothengine/btnotif/btdevicedialogplugin/btviews_en_GB.qm Binary file bluetoothengine/btnotif/btdevicedialogplugin/btviews_en_GB.qm has changed diff -r 91746b151f97 -r 997690c3397a bluetoothengine/btnotif/btdevicedialogplugin/docml/bt-device-search-dialog.docml --- a/bluetoothengine/btnotif/btdevicedialogplugin/docml/bt-device-search-dialog.docml Fri Jun 11 13:48:51 2010 +0300 +++ b/bluetoothengine/btnotif/btdevicedialogplugin/docml/bt-device-search-dialog.docml Wed Jun 23 18:23:52 2010 +0300 @@ -1,19 +1,27 @@ - - + + + + + + + + + + - + - + @@ -31,32 +39,18 @@ + - - - - - - - - - - - - - - - - + - - + + - + diff -r 91746b151f97 -r 997690c3397a bluetoothengine/btnotif/btdevicedialogplugin/docml/bt-more-devices-dialog.docml --- a/bluetoothengine/btnotif/btdevicedialogplugin/docml/bt-more-devices-dialog.docml Fri Jun 11 13:48:51 2010 +0300 +++ b/bluetoothengine/btnotif/btdevicedialogplugin/docml/bt-more-devices-dialog.docml Wed Jun 23 18:23:52 2010 +0300 @@ -1,45 +1,35 @@ - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - + + + - + + - + - + diff -r 91746b151f97 -r 997690c3397a bluetoothengine/btnotif/btdevicedialogplugin/docml/bt-receive-auth-dialog.docml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/bluetoothengine/btnotif/btdevicedialogplugin/docml/bt-receive-auth-dialog.docml Wed Jun 23 18:23:52 2010 +0300 @@ -0,0 +1,61 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -r 91746b151f97 -r 997690c3397a bluetoothengine/btnotif/btdevicedialogplugin/docml/bt-recv-progress-dialog.docml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/bluetoothengine/btnotif/btdevicedialogplugin/docml/bt-recv-progress-dialog.docml Wed Jun 23 18:23:52 2010 +0300 @@ -0,0 +1,80 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -r 91746b151f97 -r 997690c3397a bluetoothengine/btnotif/btdevicedialogplugin/docml/bt-send-dialog.docml --- a/bluetoothengine/btnotif/btdevicedialogplugin/docml/bt-send-dialog.docml Fri Jun 11 13:48:51 2010 +0300 +++ b/bluetoothengine/btnotif/btdevicedialogplugin/docml/bt-send-dialog.docml Wed Jun 23 18:23:52 2010 +0300 @@ -1,37 +1,71 @@ - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - + + + + + + + + - - - - - + + + + + + + + + + + + + + + - + - - - + + - - + - diff -r 91746b151f97 -r 997690c3397a bluetoothengine/btnotif/btdevicedialogplugin/inc/btdevicedialognotifwidget.h --- a/bluetoothengine/btnotif/btdevicedialogplugin/inc/btdevicedialognotifwidget.h Fri Jun 11 13:48:51 2010 +0300 +++ b/bluetoothengine/btnotif/btdevicedialogplugin/inc/btdevicedialognotifwidget.h Wed Jun 23 18:23:52 2010 +0300 @@ -21,12 +21,13 @@ #include +#include #include #include #include /*! - \class BtDeviceDialogQueryWidget + \class BtDeviceDialogNotifWidget \brief Widget class with properties setting. BtDeviceDialogQueryWidget, inherited from HbNotificationDialog, @@ -36,38 +37,42 @@ */ class BtDeviceDialogNotifWidget : - public HbNotificationDialog, public HbDeviceDialogInterface + public QObject, public HbDeviceDialogInterface { Q_OBJECT public: BtDeviceDialogNotifWidget(const QVariantMap ¶meters); + ~BtDeviceDialogNotifWidget(); // From base class HbDeviceDialogInterface virtual bool setDeviceDialogParameters(const QVariantMap ¶meters); virtual int deviceDialogError() const; virtual void closeDeviceDialog(bool byClient); - virtual HbDialog *deviceDialogWidget() const; + HbPopup *deviceDialogWidget() const; + virtual QObject *signalSender() const; signals: // Required by the framework void deviceDialogClosed(); + void deviceDialogData(QVariantMap data); private: + void processParam(const QVariantMap ¶meters); - bool constructQueryDialog(const QVariantMap ¶meters); + bool constructNotifDialog(const QVariantMap ¶meters); void resetProperties(); - // From base HbInputDialog, reimplement and emit signals. - void hideEvent(QHideEvent *event); - void showEvent(QShowEvent *event); - +public slots: + void NotifClosed(HbAction *action); + private: Q_DISABLE_COPY(BtDeviceDialogNotifWidget) int mLastError; int mSendAction; bool mShowEventReceived; + HbNotificationDialog* mNotificationDialog; }; #endif // BTDEVICEDIALOGNOTIFWIDGET_H diff -r 91746b151f97 -r 997690c3397a bluetoothengine/btnotif/btdevicedialogplugin/inc/btdevicedialogplugin.h --- a/bluetoothengine/btnotif/btdevicedialogplugin/inc/btdevicedialogplugin.h Fri Jun 11 13:48:51 2010 +0300 +++ b/bluetoothengine/btnotif/btdevicedialogplugin/inc/btdevicedialogplugin.h Wed Jun 23 18:23:52 2010 +0300 @@ -26,6 +26,7 @@ // Forward declarations class BtDeviceDialogPluginPrivate; +class QTranslator; /*! \class BtDeviceDialogPlugin @@ -67,6 +68,8 @@ private: Q_DISABLE_COPY(BtDeviceDialogPlugin) BtDeviceDialogPluginPrivate *d; + QTranslator* mDialogTranslator; + QTranslator* mViewTranslator; }; #endif // BTDEVICEDIALOGPLUGIN_P_H diff -r 91746b151f97 -r 997690c3397a bluetoothengine/btnotif/btdevicedialogplugin/inc/btdevicedialogrecvquerywidget.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/bluetoothengine/btnotif/btdevicedialogplugin/inc/btdevicedialogrecvquerywidget.h Wed Jun 23 18:23:52 2010 +0300 @@ -0,0 +1,77 @@ +/* +* 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: BtDeviceDialogWidget class declaration. +* +*/ + + +#ifndef BTDEVICEDIALOGRECVQUERYWIDGET_H_ +#define BTDEVICEDIALOGRECVQUERYWIDGET_H_ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + + +class BTRecvQueryDialogWidget : public QObject, + public HbDeviceDialogInterface + { + Q_OBJECT + +public: + BTRecvQueryDialogWidget(const QVariantMap ¶meters); + ~BTRecvQueryDialogWidget(); + +public: // from HbDeviceDialogInterface + bool setDeviceDialogParameters(const QVariantMap ¶meters); + int deviceDialogError() const; + void closeDeviceDialog(bool byClient); + HbPopup *deviceDialogWidget() const; + virtual QObject *signalSender() const; + +public slots: + void yesClicked(); + void noClicked(); + void checkBoxStateChanged(bool checked); + +private: + bool constructDialog(const QVariantMap ¶meters); + +signals: + void deviceDialogClosed(); + void deviceDialogData(QVariantMap data); + +private: + HbDocumentLoader *mLoader; + QStandardItemModel *mContentItemModel; + HbLabel *mHeading; + HbLabel *mDeviceName; + HbLabel *mDeviceType; + HbLabel *mDeviceIcon; + HbAction *mYes; + HbAction *mNo; + HbCheckBox *mCheckBox; + HbDialog *mDialog; + + Q_DISABLE_COPY(BTRecvQueryDialogWidget) + }; + +#endif /* BTDEVICEDIALOGRECVQUERYWIDGET_H_ */ diff -r 91746b151f97 -r 997690c3397a bluetoothengine/btnotif/btdevicedialogplugin/inc/btdevicesearchdialogwidget.h --- a/bluetoothengine/btnotif/btdevicedialogplugin/inc/btdevicesearchdialogwidget.h Fri Jun 11 13:48:51 2010 +0300 +++ b/bluetoothengine/btnotif/btdevicedialogplugin/inc/btdevicesearchdialogwidget.h Wed Jun 23 18:23:52 2010 +0300 @@ -28,8 +28,9 @@ #include #include #include -#include #include +#include + struct device { @@ -38,7 +39,8 @@ int mDeviceIdx; }; -class BTDeviceSearchDialogWidget : public HbDialog, + +class BTDeviceSearchDialogWidget : public QObject, public HbDeviceDialogInterface { Q_OBJECT @@ -52,6 +54,7 @@ int deviceDialogError() const; void closeDeviceDialog(bool byClient); HbPopup *deviceDialogWidget() const; + virtual QObject *signalSender() const; public slots: void stopRetryClicked(); @@ -60,6 +63,7 @@ void deviceSelected(const QModelIndex& modelIndex); // void viewByItemSelected(int index); void selectionDialogClosed(HbAction*); + void searchDialogClosed(HbAction* action); private: bool constructDialog(const QVariantMap ¶meters); @@ -87,8 +91,6 @@ QList mDeviceTypeList; QList mDeviceList; HbListView* mListView; - HbPushButton* mStopRetryBtn; - HbPushButton* mViewByBtn; HbLabel* mSearchLabel; HbLabel* mSearchIconLabel; HbLabel* mSearchDoneLabel; @@ -97,6 +99,11 @@ int mDeviceLstIdx; int mSelectedType; int mDeviceDialogData; + HbDialog *mSearchDevicesDialog; + HbAction *mStopRetryAction; + HbAction *mViewByAction; + + int mStopRetryFlag; Q_DISABLE_COPY(BTDeviceSearchDialogWidget) }; diff -r 91746b151f97 -r 997690c3397a bluetoothengine/btnotif/btdevicedialogplugin/inc/btmoredevicesdialogwidget.h --- a/bluetoothengine/btnotif/btdevicedialogplugin/inc/btmoredevicesdialogwidget.h Fri Jun 11 13:48:51 2010 +0300 +++ b/bluetoothengine/btnotif/btdevicedialogplugin/inc/btmoredevicesdialogwidget.h Wed Jun 23 18:23:52 2010 +0300 @@ -26,10 +26,9 @@ #include #include #include - +#include -class BTMoreDevicesDialogWidget : public HbDialog, - public HbDeviceDialogInterface +class BTMoreDevicesDialogWidget : public QObject, public HbDeviceDialogInterface { Q_OBJECT @@ -37,12 +36,12 @@ BTMoreDevicesDialogWidget(const QVariantMap ¶meters); ~BTMoreDevicesDialogWidget(); -public: // from HbDeviceDialogInterface +public: // from HbDeviceDialogInterface` bool setDeviceDialogParameters(const QVariantMap ¶meters); int deviceDialogError() const; void closeDeviceDialog(bool byClient); HbPopup *deviceDialogWidget() const; - // virtual QObject *signalSender() const; + virtual QObject *signalSender() const; public slots: void moreDevicesClicked(); @@ -52,8 +51,8 @@ private: bool constructDialog(const QVariantMap ¶meters); - void hideEvent(QHideEvent *event); - void showEvent(QShowEvent *event); + // void hideEvent(QHideEvent *event); + // void showEvent(QShowEvent *event); QIcon icon(/*QString deviceType*/); signals: @@ -63,8 +62,9 @@ private: HbDocumentLoader *mLoader; int mDeviceDialogData; -// HbAction *mMoreAction; -// HbAction *mCancelAction; + HbDialog *mMoreDeviceDialog; + HbAction *mMoreAction; + HbAction *mCancelAction; /** * diff -r 91746b151f97 -r 997690c3397a bluetoothengine/btnotif/btdevicedialogplugin/inc/btrecvprgrsdialogwidget.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/bluetoothengine/btnotif/btdevicedialogplugin/inc/btrecvprgrsdialogwidget.h Wed Jun 23 18:23:52 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: BtDeviceDialogWidget class declaration. +* +*/ + +#ifndef BTRECVPRGRSDIALOGWIDGET_H_ +#define BTRECVPRGRSDIALOGWIDGET_H_ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + + +class BTRecvPrgrsDialogWidget : public QObject, + public HbDeviceDialogInterface + { + Q_OBJECT + +public: + BTRecvPrgrsDialogWidget(const QVariantMap ¶meters); + ~BTRecvPrgrsDialogWidget(); + +public: // from HbDeviceDialogInterface + bool setDeviceDialogParameters(const QVariantMap ¶meters); + int deviceDialogError() const; + void closeDeviceDialog(bool byClient); + HbPopup *deviceDialogWidget() const; + virtual QObject *signalSender() const; + +public slots: + void hideClicked(); + void cancelClicked(); + +private: + bool constructDialog(const QVariantMap ¶meters); + +signals: + void deviceDialogClosed(); + void deviceDialogData(QVariantMap data); + +private: + HbDocumentLoader *mLoader; + QStandardItemModel *mContentItemModel; + HbLabel *mHeading; + HbLabel *mFileName; + HbLabel *mFileSize; + HbLabel *mFileCount; + HbAction *mHide; + HbAction *mCancel; + HbDialog *mDialog; + HbProgressBar *mProgressBar; + int mFileSz; + + Q_DISABLE_COPY(BTRecvPrgrsDialogWidget) + }; + +#endif /* BTRECVPRGRSDIALOGWIDGET_H_ */ diff -r 91746b151f97 -r 997690c3397a bluetoothengine/btnotif/btdevicedialogplugin/inc/btsenddialogwidget.h --- a/bluetoothengine/btnotif/btdevicedialogplugin/inc/btsenddialogwidget.h Fri Jun 11 13:48:51 2010 +0300 +++ b/bluetoothengine/btnotif/btdevicedialogplugin/inc/btsenddialogwidget.h Wed Jun 23 18:23:52 2010 +0300 @@ -29,9 +29,10 @@ #include #include #include +#include -class BTSendDialogWidget : public HbDialog, +class BTSendDialogWidget : public QObject, public HbDeviceDialogInterface { Q_OBJECT @@ -49,8 +50,8 @@ public slots: // void hideClicked(); -// void cancelClicked(); - void inputClosed(HbAction* action); + void cancelClicked(); +// void inputClosed(HbAction* action); private: bool constructDialog(const QVariantMap ¶meters); void hideEvent(QHideEvent *event); @@ -61,11 +62,19 @@ private: HbDocumentLoader *mLoader; - QStandardItemModel* mContentItemModel; + // QStandardItemModel* mContentItemModel; HbProgressBar* mProgressBar; - HbLabel* mLabel; - HbListView* mListView; - int mFileIndex; + HbLabel* mDialogHeading; + HbLabel* mFileIconLabel; + HbLabel* mFileNameLabel; + HbLabel* mFileSizeLabel; + +// HbListView* mListView; + HbDialog *mSendDialog; + HbAction *mHideAction; + HbAction *mCancelAction; + int mFileIndex; + Q_DISABLE_COPY(BTSendDialogWidget) }; diff -r 91746b151f97 -r 997690c3397a bluetoothengine/btnotif/btdevicedialogplugin/src/btdevicedialoginputwidget.cpp --- a/bluetoothengine/btnotif/btdevicedialogplugin/src/btdevicedialoginputwidget.cpp Fri Jun 11 13:48:51 2010 +0300 +++ b/bluetoothengine/btnotif/btdevicedialogplugin/src/btdevicedialoginputwidget.cpp Wed Jun 23 18:23:52 2010 +0300 @@ -21,8 +21,12 @@ #include #include #include +#include +#include #include "btdevicedialogpluginerrors.h" +const int PASSCODE_MAX_LEN = 16; // from BT specs + /*! class Constructor */ @@ -118,7 +122,8 @@ { TRACE_ENTRY - QString keyStr, prompt; + QString keyStr, prompt,title,regExp; + QVariant name; keyStr.setNum( TBluetoothDialogParams::EResource ); // Validate if the resource item exists. QVariantMap::const_iterator i = parameters.constFind( keyStr ); @@ -130,7 +135,11 @@ QVariant param = parameters.value( keyStr ); if ( param.toInt() == EPinInput ) { - prompt = QString( tr( "Passcode for device %1:" ) ); + // Numeric value only + mInputDialog->setInputMode(HbInputDialog::RealInput); + title = QString(hbTrId("txt_bt_title_pairing_with_1")); + // todo: Fixe the multiline problem + prompt = QString( hbTrId( "txt_bt_dialog_please_enter_the_passcode_for_1" ) ); } else { mLastError = ParameterError; @@ -141,23 +150,46 @@ keyStr.setNum( TBluetoothDeviceDialog::EAdditionalDesc ); i = parameters.constFind( keyStr ); // Mini Length required, update prompt - // ToDo: use Validator to check input length. + // ToDo: The validator doesn't seem to work properly if ( i != parameters.constEnd() ) { - prompt = QString( tr( "Enter %1 digit passcode for device %2:" ) ); + // Todo : The string ID for the localization is not available yet + // for string : "Enter %1 digit passcode for device %2:" + // I'm using the "Enter the passcode for device %1" instead + prompt = QString( hbTrId( "txt_bt_dialog_please_enter_the_passcode_for_1" ) ); param = parameters.value( keyStr ); + regExp = tr("^\\d{%1,}$"); + regExp.arg(param.toString()); + HbValidator* validator = new HbValidator(mInputDialog->lineEdit()); + validator->addField( + new QRegExpValidator( + QRegExp(regExp, Qt::CaseInsensitive), validator ),""); + mInputDialog->setValidator(validator); + }else{ + // Minimum requirement is to have at least 1 digit + regExp = tr("^\\d{1,}$"); + HbValidator* validator = new HbValidator(mInputDialog->lineEdit()); + validator->addField( + new QRegExpValidator( + QRegExp(regExp, Qt::CaseInsensitive), validator ),""); + mInputDialog->setValidator(validator); } - // replace % with the miniLength and device name int repls = prompt.count( QString( "%" ) ); if ( repls > 1 ) { prompt = prompt.arg( param.toString() ); } if ( repls > 0 ) { - QVariant name = parameters.value( QString::number( TBluetoothDeviceDialog::EDeviceName ) ); + name = parameters.value( QString::number( TBluetoothDeviceDialog::EDeviceName ) ); prompt = prompt.arg( name.toString() ); } - // set property value to this dialog widget - mInputDialog->setPromptText( prompt ); + repls = title.count(QString("%")); + if(repls > 0){ + title = title.arg( name.toString() ); + } + mInputDialog->setHeadingWidget(new HbLabel(title)); + mInputDialog->lineEdit(0)->setMaxLength(PASSCODE_MAX_LEN); + mInputDialog->lineEdit(0)->setText(tr("")); // clear the input field + mInputDialog->setPromptText(prompt); TRACE_EXIT } diff -r 91746b151f97 -r 997690c3397a bluetoothengine/btnotif/btdevicedialogplugin/src/btdevicedialognotifwidget.cpp --- a/bluetoothengine/btnotif/btdevicedialogplugin/src/btdevicedialognotifwidget.cpp Fri Jun 11 13:48:51 2010 +0300 +++ b/bluetoothengine/btnotif/btdevicedialogplugin/src/btdevicedialognotifwidget.cpp Wed Jun 23 18:23:52 2010 +0300 @@ -22,7 +22,7 @@ #include #include #include "btdevicedialogpluginerrors.h" - +#include /*! class Constructor */ @@ -32,12 +32,23 @@ // set properties mLastError = NoError; mShowEventReceived = false; + mNotificationDialog = new HbNotificationDialog(); resetProperties(); - constructQueryDialog(parameters); + constructNotifDialog(parameters); TRACE_EXIT } /*! + class Constructor + */ +BtDeviceDialogNotifWidget::~BtDeviceDialogNotifWidget() +{ + TRACE_ENTRY + delete mNotificationDialog; + return; +} + +/*! Set parameters, implementation of interface Invoked when HbDeviceDialog::update calls. */ @@ -70,8 +81,8 @@ Q_UNUSED(byClient); // Closed by client or internally by server -> no action to be transmitted. mSendAction = false; - close(); - // If show event has been received, close is signalled from hide event. If not, + mNotificationDialog->close(); + // If show event has been received, close is signalled from hide event. If not, // hide event does not come and close is signalled from here. if (!mShowEventReceived) { emit deviceDialogClosed(); @@ -82,22 +93,27 @@ /*! Return display widget, implementation of interface */ -HbDialog *BtDeviceDialogNotifWidget::deviceDialogWidget() const +HbPopup *BtDeviceDialogNotifWidget::deviceDialogWidget() const { TRACE_ENTRY TRACE_EXIT + return mNotificationDialog; +} + +QObject* BtDeviceDialogNotifWidget::signalSender() const + { return const_cast(this); -} + } /*! Construct display widget */ -bool BtDeviceDialogNotifWidget::constructQueryDialog(const QVariantMap ¶meters) +bool BtDeviceDialogNotifWidget::constructNotifDialog(const QVariantMap ¶meters) { TRACE_ENTRY // analyze the parameters to compose the properties of the message box widget processParam(parameters); - + connect(mNotificationDialog, SIGNAL(finished(HbAction*)), this, SLOT(NotifClosed(HbAction*))); TRACE_EXIT return true; } @@ -108,7 +124,8 @@ void BtDeviceDialogNotifWidget::processParam(const QVariantMap ¶meters) { TRACE_ENTRY - QString keyStr, prompt; + QString keyStr, prompt,title; + QVariant classOfDevice; keyStr.setNum( TBluetoothDialogParams::EResource ); // Validate if the resource item exists. QVariantMap::const_iterator i = parameters.constFind( keyStr ); @@ -117,32 +134,41 @@ mLastError = UnknownDeviceDialogError; return; } - + HbIcon icon; QVariant param = parameters.value( keyStr ); int key = param.toInt(); switch ( key ) { - // Note dialogs case EPairingSuccess: - prompt = QString( tr( "Pairing with %1 complete" ) ); + title = QString(hbTrId( "txt_bt_dpophead_paired" )); + prompt = QString( hbTrId( "txt_bt_dpopinfo_paired_to_1" ) ); + classOfDevice = parameters.value(QString::number( TBluetoothDeviceDialog::EDeviceClass )); + icon = getBadgedDeviceTypeIcon(classOfDevice.toInt()); + mNotificationDialog->setIcon(icon); break; - case EPairingFailure: - prompt = QString( tr( "Unable to pair with %1" ) ); - break; + // todo: remove this Unpaired notification if not used + case EUnpairedDevice: + title = QString(hbTrId( "txt_bt_dpophead_unpaired" )); + prompt = QString( hbTrId( "txt_bt_dpopinfo_with_1" ) ); + classOfDevice = parameters.value(QString::number( TBluetoothDeviceDialog::EDeviceClass )); + icon = getBadgedDeviceTypeIcon(classOfDevice.toInt()); + mNotificationDialog->setIcon(icon); + break; case EVisibilityTimeout: - prompt = QString( tr( "Phone is not detectable in searches made by other devices" ) ); + title = QString(hbTrId( "txt_bt_dpophead_bluetooth" )); + prompt = QString( hbTrId( "txt_bt_dpopinfo_is_now_hidden" ) ); + mNotificationDialog->setIcon(HbIcon("qtg_large_bluetooth")); break; default: mLastError = ParameterError; break; } - // Could use QChar with ReplacementCharacter? int repls = prompt.count( QString( "%" ) ); if ( repls > 0 ) { QVariant name = parameters.value( QString::number( TBluetoothDeviceDialog::EDeviceName ) ); prompt = prompt.arg( name.toString() ); } - // set property value to this dialog widget - HbNotificationDialog::setTitle( prompt ); + mNotificationDialog->setTitle( title ); + mNotificationDialog->setText( prompt ); TRACE_EXIT } @@ -157,20 +183,10 @@ return; } -/*! - Widget is about to hide. Closing effect has ended. - */ -void BtDeviceDialogNotifWidget::hideEvent(QHideEvent *event) +void BtDeviceDialogNotifWidget::NotifClosed(HbAction *action) { - HbNotificationDialog::hideEvent(event); + Q_UNUSED(action); emit deviceDialogClosed(); + mSendAction = false; } -/*! - Widget is about to show - */ -void BtDeviceDialogNotifWidget::showEvent(QShowEvent *event) -{ - HbNotificationDialog::showEvent(event); - mShowEventReceived = true; -} diff -r 91746b151f97 -r 997690c3397a bluetoothengine/btnotif/btdevicedialogplugin/src/btdevicedialogplugin.cpp --- a/bluetoothengine/btnotif/btdevicedialogplugin/src/btdevicedialogplugin.cpp Fri Jun 11 13:48:51 2010 +0300 +++ b/bluetoothengine/btnotif/btdevicedialogplugin/src/btdevicedialogplugin.cpp Wed Jun 23 18:23:52 2010 +0300 @@ -24,14 +24,21 @@ #include "btdevicedialoginputwidget.h" #include "btdevicedialogquerywidget.h" #include "btdevicedialognotifwidget.h" +#include "btrecvprgrsdialogwidget.h" #include "btdevicedialogpluginerrors.h" #include "btdevicesearchdialogwidget.h" #include "btmoredevicesdialogwidget.h" #include "btsenddialogwidget.h" +#include "btdevicedialogrecvquerywidget.h" +#include +#include Q_EXPORT_PLUGIN2(btdevicedialogplugin, BtDeviceDialogPlugin) +const char* BTDIALOG_TRANSLATION = "btdialogs_en_GB"; +const char* BTVIEW_TRANSLATION = "btviews_en_GB"; + // This plugin implements one device dialog type static const struct { const char *mTypeString; @@ -57,7 +64,8 @@ /*! BtDeviceDialogPlugin Constructor */ -BtDeviceDialogPlugin::BtDeviceDialogPlugin() +BtDeviceDialogPlugin::BtDeviceDialogPlugin(): + mDialogTranslator(0),mViewTranslator(0) { d = new BtDeviceDialogPluginPrivate; } @@ -68,6 +76,8 @@ BtDeviceDialogPlugin::~BtDeviceDialogPlugin() { delete d; + delete mDialogTranslator; + delete mViewTranslator; } /*! @@ -95,6 +105,34 @@ d->mError = NoError; int i; + + //TODO: Uncomment the lines when actual translation files are available in sdk and remove loading locally. + // QString locale = QLocale::system().name(); + // QString path = "z:/resource/qt/translations/"; + // QTranslator translator; + //QTranslator translator_comm; + //translator.load(path + QString("btdialogs_") + locale); + //translator_comm.load(path + QString("common_") + locale); + + QString path = ":/"; + if(!mDialogTranslator) + { + mDialogTranslator = new QTranslator(); +// QString lang = QLocale::system().name(); +// QString appName = "btdialogs_"; + //todo need to handle failed case of transaltor loading + bool ok = mDialogTranslator->load(BTDIALOG_TRANSLATION, path); + QCoreApplication::installTranslator(mDialogTranslator); + } + if(!mViewTranslator) + { + mViewTranslator = new QTranslator(); +// QString lang = QLocale::system().name(); +// QString appName = "btviews_"; + //todo need to handle failed case of transaltor loading + bool ok = mViewTranslator->load(BTVIEW_TRANSLATION, path); + QCoreApplication::installTranslator(mViewTranslator); + } // verify that requested dialog type is supported const int numTypes = sizeof(noteInfos) / sizeof(noteInfos[0]); for(i = 0; i < numTypes; i++) { @@ -184,7 +222,7 @@ switch ( i.value().toInt() ) { case TBluetoothDialogParams::ENote: deviceDialog = - new BtDeviceDialogQueryWidget(HbMessageBox::MessageTypeInformation, parameters); + new BtDeviceDialogNotifWidget(parameters); break; case TBluetoothDialogParams::EQuery: deviceDialog = @@ -205,6 +243,12 @@ case TBluetoothDialogParams::EGlobalNotif: deviceDialog = new BtDeviceDialogNotifWidget(parameters); break; + case TBluetoothDialogParams::EUserAuthorization: + deviceDialog = new BTRecvQueryDialogWidget(parameters); + break; + case TBluetoothDialogParams::EReceiveProgress: + deviceDialog = new BTRecvPrgrsDialogWidget(parameters); + break; default: d->mError = UnknownDeviceDialogError; break; diff -r 91746b151f97 -r 997690c3397a bluetoothengine/btnotif/btdevicedialogplugin/src/btdevicedialogquerywidget.cpp --- a/bluetoothengine/btnotif/btdevicedialogplugin/src/btdevicedialogquerywidget.cpp Fri Jun 11 13:48:51 2010 +0300 +++ b/bluetoothengine/btnotif/btdevicedialogplugin/src/btdevicedialogquerywidget.cpp Wed Jun 23 18:23:52 2010 +0300 @@ -21,6 +21,7 @@ #include #include #include +#include #include "btdevicedialogpluginerrors.h" /*! @@ -118,7 +119,8 @@ void BtDeviceDialogQueryWidget::processParam(const QVariantMap ¶meters) { TRACE_ENTRY - QString keyStr, prompt; + QString keyStr, prompt,title; + QVariant name,param,addval; keyStr.setNum( TBluetoothDialogParams::EResource ); // Validate if the resource item exists. QVariantMap::const_iterator i = parameters.constFind( keyStr ); @@ -127,31 +129,15 @@ mLastError = UnknownDeviceDialogError; return; } - - QVariant param = parameters.value( keyStr ); + title = QString(hbTrId("txt_bt_title_pairing_with_1")); + param = parameters.value( keyStr ); int key = param.toInt(); switch ( key ) { - // Query dialogs: - case EAuthorization: - prompt = QString( tr( "Accept connection request from:\n%1" ) ); - break; - case EIncomingPairing: - prompt = QString( tr( "Device '%1' is trying to pair with you. Allow pairing?" ) ); - break; case ENumericComparison: - prompt = QString( tr( "Does this code match the one on %1?\n\n%2" ) ); + prompt = QString( hbTrId( "txt_bt_info_does_this_code_match_the_code_on_1" ) ); break; case EPasskeyDisplay: - prompt = QString( tr( "Enter on %1:\n\n%2" ) ); - break; - case ESetTrusted: - prompt = QString( tr( "Authorise this device to make connections automatically?" ) ); - break; - case EBlockUnpairedDevice: - prompt = QString( tr( "Do you want to block all future connection attempts from device %1?" ) ); - break; - case EBlockPairedDevice: - prompt = QString( tr( "Do you want to block all future connection attempts from paired device %1? \nThis will delete your pairing with the device." ) ); + prompt = QString( hbTrId( "txt_bt_info_enter_the_following_code_to_the_1" ) ); break; // Note dialogs, but not Notification dialogs // Input dialogs @@ -164,18 +150,22 @@ mLastError = ParameterError; break; } - // Could use QChar with ReplacementCharacter? int repls = prompt.count( QString( "%" ) ); if ( repls > 0 ) { - QVariant name = parameters.value( QString::number( TBluetoothDeviceDialog::EDeviceName ) ); + name = parameters.value( QString::number( TBluetoothDeviceDialog::EDeviceName ) ); prompt = prompt.arg( name.toString() ); - if ( repls > 1 ) { - QVariant addval = parameters.value( QString::number( TBluetoothDeviceDialog::EAdditionalDesc ) ); - prompt = prompt.arg( addval.toString() ); - } + addval = parameters.value( QString::number( TBluetoothDeviceDialog::EAdditionalDesc ) ); + // todo: Formating the prompt need to be discussed with UI designer + // The passcode could be displayed on a separate row if it the label did support + // the use of newline escape character. + prompt.append(tr(" ")); + prompt.append(addval.toString()); } + title = title.arg(name.toString()); // set property value to this dialog widget + mMessageBox->setHeadingWidget(new HbLabel(title)); mMessageBox->setText( prompt ); + mMessageBox->setIconVisible(false); TRACE_EXIT } diff -r 91746b151f97 -r 997690c3397a bluetoothengine/btnotif/btdevicedialogplugin/src/btdevicedialogrecvquerywidget.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/bluetoothengine/btnotif/btdevicedialogplugin/src/btdevicedialogrecvquerywidget.cpp Wed Jun 23 18:23:52 2010 +0300 @@ -0,0 +1,160 @@ +/* +* 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: BtDeviceDialogWidget class declaration. +* +*/ + + +#include "btdevicedialogrecvquerywidget.h" +#include "bluetoothdevicedialogs.h" +#include + +const char* DOCML_BT_RECV_QUERY_DIALOG = ":/docml/bt-receive-auth-dialog.docml"; + + +BTRecvQueryDialogWidget::BTRecvQueryDialogWidget(const QVariantMap ¶meters) +{ + mLoader = 0; + constructDialog(parameters); +} + +BTRecvQueryDialogWidget::~BTRecvQueryDialogWidget() +{ + if(mLoader) + { + delete mLoader; + mLoader = NULL; + } +} + +bool BTRecvQueryDialogWidget::setDeviceDialogParameters(const QVariantMap ¶meters) +{ + Q_UNUSED(parameters); + return true; +} + +int BTRecvQueryDialogWidget::deviceDialogError() const +{ + return 0; +} + +void BTRecvQueryDialogWidget::closeDeviceDialog(bool byClient) +{ + Q_UNUSED(byClient); + mDialog->close(); +} + +HbPopup* BTRecvQueryDialogWidget::deviceDialogWidget() const +{ + return mDialog; +} + +QObject* BTRecvQueryDialogWidget::signalSender() const +{ + return const_cast(this); +} + +bool BTRecvQueryDialogWidget::constructDialog(const QVariantMap ¶meters) +{ + mLoader = new HbDocumentLoader(); + bool ok = false; + + mLoader->load(DOCML_BT_RECV_QUERY_DIALOG, &ok); + if(ok) + { + mDialog = qobject_cast(mLoader->findWidget("senddialog")); + mHeading = qobject_cast(mLoader->findWidget("heading")); + + mDeviceName = qobject_cast(mLoader->findWidget("deviceName")); + mDeviceType = qobject_cast(mLoader->findWidget("deviceType")); + mDeviceIcon = qobject_cast(mLoader->findWidget("deviceIcon")); + + int classOfDevice = parameters.value(QString::number(TBluetoothDeviceDialog::EDeviceClass)).toDouble(); + HbIcon icon = getBadgedDeviceTypeIcon(classOfDevice); + mDeviceIcon->setIcon(icon); + + mDeviceName->setPlainText(parameters.value(QString::number(TBluetoothDeviceDialog::EDeviceName)).toString()); + mDeviceType->setPlainText(getDeviceTypeString(classOfDevice)); + + mYes = qobject_cast(mLoader->findObject("yesaction")); + mNo = qobject_cast(mLoader->findObject("noaction")); + + mCheckBox = qobject_cast(mLoader->findWidget("checkbox")); + + int dialogType = parameters.value(QString::number(TBluetoothDialogParams::EDialogTitle)).toInt(); + switch(dialogType) + { + case TBluetoothDialogParams::EReceive: + { + mHeading->setPlainText(hbTrId("txt_bt_title_receive_messages_from")); + }break; + + case TBluetoothDialogParams::EReceiveFromPairedDevice: + { + mHeading->setPlainText(hbTrId("txt_bt_title_receive_messages_from_paired_device")); + mCheckBox->setCheckState(Qt::Checked); + }break; + + case TBluetoothDialogParams::EConnect: + { + mHeading->setPlainText(hbTrId("txt_bt_title_connect_to")); + mCheckBox->setCheckState(Qt::Checked); + }break; + case TBluetoothDialogParams::EPairingRequest: + mHeading->setPlainText(hbTrId("txt_bt_title_pair_with")); + mCheckBox->setCheckState(Qt::Checked); + break; + default: + break; + + } + mDialog->setHeadingWidget(mHeading); + } + + mDialog->setBackgroundFaded(false); + mDialog->setDismissPolicy(HbPopup::NoDismiss); + mDialog->setTimeout(HbPopup::NoTimeout); + + connect(mYes, SIGNAL(triggered()), this, SLOT(yesClicked())); + connect(mNo, SIGNAL(triggered()), this, SLOT(noClicked())); + connect(mCheckBox, SIGNAL(clicked(bool)), this, SLOT(checkBoxStateChanged(bool))); + + return true; +} + +void BTRecvQueryDialogWidget::yesClicked() +{ + QVariantMap data; + data.insert(QString("actionResult"), QVariant(true)); + emit deviceDialogData(data); + emit deviceDialogClosed(); +} + +void BTRecvQueryDialogWidget::noClicked() +{ + QVariantMap data; + data.insert(QString("actionResult"), QVariant(false)); + emit deviceDialogData(data); + emit deviceDialogClosed(); +} + +void BTRecvQueryDialogWidget::checkBoxStateChanged(bool checked) +{ + QVariantMap data; + data.insert(QString("checkBoxState"), QVariant(checked)); + emit deviceDialogData(data); +} + + + diff -r 91746b151f97 -r 997690c3397a bluetoothengine/btnotif/btdevicedialogplugin/src/btdevicesearchdialogwidget.cpp --- a/bluetoothengine/btnotif/btdevicedialogplugin/src/btdevicesearchdialogwidget.cpp Fri Jun 11 13:48:51 2010 +0300 +++ b/bluetoothengine/btnotif/btdevicedialogplugin/src/btdevicesearchdialogwidget.cpp Wed Jun 23 18:23:52 2010 +0300 @@ -24,32 +24,36 @@ #include #include +#include +#include +#include const char* DOCML_BTDEV_SEARCH_DIALOG = ":/docml/bt-device-search-dialog.docml"; +#define LOC_SEARCHING_DEVICE hbTrId("txt_bt_subhead_searching") +#define LOC_SEARCH_DONE hbTrId("txt_bt_subhead_search_done") +#define LOC_SEARCH_STOP hbTrId("txt_common_button_stop") +#define LOC_SEARCH_RETRY hbTrId("txt_common_button_retry") + + BTDeviceSearchDialogWidget::BTDeviceSearchDialogWidget(const QVariantMap ¶meters) -:HbDialog() { mDeviceLstIdx = 0; mViewByChosen = false; mSelectedType = 0; mDeviceDialogData = 0; + mLoader = 0; + mContentItemModel = 0; + mStopRetryFlag = 0; // Stop constructDialog(parameters); } BTDeviceSearchDialogWidget::~BTDeviceSearchDialogWidget() { - if(mLoader) - { - delete mLoader; - mLoader = NULL; - } - if(mContentItemModel) - { - delete mContentItemModel; - mContentItemModel = NULL; - } + delete mLoader; + delete mContentItemModel; + // delete mRbl; // delete mViewByDialog; } @@ -65,9 +69,9 @@ mSearchDoneLabel->show(); mSearchDoneLabel->setTextWrapping(Hb::TextWordWrap); mSearchDoneLabel->setAlignment(Qt::AlignLeft); - mSearchDoneLabel->setPlainText("Search Done"); + mSearchDoneLabel->setPlainText(LOC_SEARCH_DONE); - mStopRetryBtn->setText("Retry"); + mStopRetryAction->setText(LOC_SEARCH_RETRY); } else { @@ -121,33 +125,47 @@ void BTDeviceSearchDialogWidget::closeDeviceDialog(bool byClient) { Q_UNUSED(byClient); - this->close(); + mSearchDevicesDialog->close(); + //@ TODO to check below code is required which is written based on the documentation of closeDeviceDialog API + + /* QVariantMap val; + QVariant index(-1); + val.insert("selectedindex",index); + emit deviceDialogData(val); + emit deviceDialogClosed();*/ } HbPopup* BTDeviceSearchDialogWidget::deviceDialogWidget() const { + return mSearchDevicesDialog; + } + +QObject* BTDeviceSearchDialogWidget::signalSender() const + { return const_cast(this); } bool BTDeviceSearchDialogWidget::constructDialog(const QVariantMap ¶meters) { (void) parameters; - mLoader = new HbDocumentLoader(); bool ok = false; + mLoader = new HbDocumentLoader(); mLoader->load(DOCML_BTDEV_SEARCH_DIALOG, &ok); if(ok) { - HbLabel* heading = qobject_cast(mLoader->findWidget("heading")); + mSearchDevicesDialog = qobject_cast(mLoader->findWidget("searchdialog")); + + /* HbLabel* heading = qobject_cast(mLoader->findWidget("heading")); heading->setTextWrapping(Hb::TextWordWrap); heading->setAlignment(Qt::AlignHCenter); heading->setPlainText("Bluetooth - Found devices"); - setHeadingWidget(heading); + setHeadingWidget(heading);*/ mSearchLabel = qobject_cast(mLoader->findWidget("searchLabel")); mSearchLabel->setTextWrapping(Hb::TextWordWrap); mSearchLabel->setAlignment(Qt::AlignHCenter); - mSearchLabel->setPlainText("Searching..."); + mSearchLabel->setPlainText(LOC_SEARCHING_DEVICE); mSearchIconLabel = qobject_cast(mLoader->findWidget("iconLabel")); mSearchIconLabel->setIcon(icon()); @@ -155,11 +173,12 @@ mSearchDoneLabel = qobject_cast(mLoader->findWidget("searchDoneLabel")); mSearchDoneLabel->hide(); - setFrameType(HbDialog::Strong); - setBackgroundFaded(false); + + mSearchDevicesDialog->setFrameType(HbDialog::Strong); + mSearchDevicesDialog->setBackgroundFaded(false); - mViewByBtn = qobject_cast(mLoader->findWidget("viewby")); - mStopRetryBtn = qobject_cast(mLoader->findWidget("stop")); + // mViewByBtn = qobject_cast(mLoader->findWidget("viewby")); + // mStopRetryBtn = qobject_cast(mLoader->findWidget("stop")); mListView = qobject_cast(mLoader->findWidget("listView")); mListView->setSelectionMode(HbAbstractItemView::SingleSelection); @@ -168,15 +187,26 @@ mListView->setModel(mContentItemModel);//, prototype); connect(mListView, SIGNAL(activated(QModelIndex)), this, SLOT(deviceSelected(QModelIndex))); - connect(mStopRetryBtn, SIGNAL(clicked()), this, SLOT(stopRetryClicked())); - connect(mViewByBtn, SIGNAL(clicked()), this, SLOT(viewByClicked())); + // connect(mStopRetryBtn, SIGNAL(clicked()), this, SLOT(stopRetryClicked())); + // connect(mViewByBtn, SIGNAL(clicked()), this, SLOT(viewByClicked())); + + mViewByAction = static_cast( mLoader->findObject( "viewaction" ) ); + mViewByAction->disconnect(mSearchDevicesDialog); + + mStopRetryAction = static_cast( mLoader->findObject( "stopretryaction" ) ); + mStopRetryAction->disconnect(mSearchDevicesDialog); - QGraphicsWidget *widget = mLoader->findWidget(QString("container")); - setContentWidget(widget); + connect(mViewByAction, SIGNAL(triggered()), this, SLOT(viewByClicked())); + connect(mStopRetryAction, SIGNAL(triggered()), this, SLOT(stopRetryClicked())); + + connect(mSearchDevicesDialog, SIGNAL(finished(HbAction*)), this, SLOT(searchDialogClosed(HbAction*))); + +// QGraphicsWidget *widget = mLoader->findWidget(QString("container")); + //setContentWidget(widget); } - setBackgroundFaded(false); - setDismissPolicy(HbPopup::TapOutside); - setTimeout(HbPopup::NoTimeout); + mSearchDevicesDialog->setBackgroundFaded(false); + mSearchDevicesDialog->setDismissPolicy(HbPopup::TapOutside); + mSearchDevicesDialog->setTimeout(HbPopup::NoTimeout); /* mViewByDialog = new HbDialog(); mRbl = new HbRadioButtonList(mViewByDialog); @@ -185,9 +215,9 @@ return true; } -void BTDeviceSearchDialogWidget::hideEvent(QHideEvent *event) +/*void BTDeviceSearchDialogWidget::hideEvent(QHideEvent *event) { - HbDialog::hideEvent(event); + // HbDialog::hideEvent(event); QVariantMap val; QVariant index(-1); val.insert("selectedindex",index); @@ -197,25 +227,26 @@ void BTDeviceSearchDialogWidget::showEvent(QShowEvent *event) { - HbDialog::showEvent(event); - } + // HbDialog::showEvent(event); + }*/ void BTDeviceSearchDialogWidget::stopRetryClicked() { QVariantMap val; - if(mStopRetryBtn->text().compare("Retry")==0) + if(mStopRetryFlag == 1)//mStopRetryAction->text().compare(LOC_SEARCH_RETRY)==0 { + mStopRetryFlag = 0; // Stop QVariant index("Retry"); val.insert("Retry",index); emit deviceDialogData(val); delete mContentItemModel; mContentItemModel = new QStandardItemModel(this); mListView->setModel(mContentItemModel); - mStopRetryBtn->setText("Stop"); + mStopRetryAction->setText(LOC_SEARCH_STOP); mSearchLabel->setTextWrapping(Hb::TextWordWrap); mSearchLabel->setAlignment(Qt::AlignHCenter); - mSearchLabel->setPlainText("Searching..."); + mSearchLabel->setPlainText(LOC_SEARCHING_DEVICE); mSearchIconLabel->setIcon(icon()); mSearchLabel->show(); @@ -226,7 +257,8 @@ } else { - mStopRetryBtn->setText("Retry"); + mStopRetryFlag = 1; //Retry + mStopRetryAction->setText(LOC_SEARCH_RETRY); mSearchLabel->hide(); @@ -235,7 +267,7 @@ mSearchDoneLabel->show(); mSearchDoneLabel->setTextWrapping(Hb::TextWordWrap); mSearchDoneLabel->setAlignment(Qt::AlignLeft); - mSearchDoneLabel->setPlainText("Search Done"); + mSearchDoneLabel->setPlainText(LOC_SEARCH_DONE); QVariantMap val; QVariant index("Stop"); @@ -313,6 +345,23 @@ mViewByDialog->show();*/ } +void BTDeviceSearchDialogWidget::searchDialogClosed(HbAction* action) + { + HbDialog *dlg=static_cast(sender()); + if(dlg->actions().first() == action) { + } + else if(dlg->actions().at(1) == action) { + } + else + { + QVariantMap val; + QVariant index(-1); + val.insert("selectedindex",index); + emit deviceDialogData(val); + emit deviceDialogClosed(); + } + } + void BTDeviceSearchDialogWidget::selectionDialogClosed(HbAction* action) { Q_UNUSED(action); diff -r 91746b151f97 -r 997690c3397a bluetoothengine/btnotif/btdevicedialogplugin/src/btmoredevicesdialogwidget.cpp --- a/bluetoothengine/btnotif/btdevicedialogplugin/src/btmoredevicesdialogwidget.cpp Fri Jun 11 13:48:51 2010 +0300 +++ b/bluetoothengine/btnotif/btdevicedialogplugin/src/btmoredevicesdialogwidget.cpp Wed Jun 23 18:23:52 2010 +0300 @@ -29,24 +29,28 @@ BTMoreDevicesDialogWidget::BTMoreDevicesDialogWidget(const QVariantMap ¶meters) -:HbDialog() { mDeviceDialogData = 0; + mLoader = 0; + mContentItemModel = 0; constructDialog(parameters); +/* try + { + //May throws badAlloc on exception + constructDialog(parameters); + } + catch(std::bad_alloc &badAlloc) + { + //Failure to allocate memory + Q_UNUSED(badAlloc); + // = UnknownDeviceDialogError; + }*/ } BTMoreDevicesDialogWidget::~BTMoreDevicesDialogWidget() { - if(mLoader) - { - delete mLoader; - mLoader = NULL; - } - if(mContentItemModel) - { - delete mContentItemModel; - mContentItemModel =NULL; - } + delete mLoader; + delete mContentItemModel; } bool BTMoreDevicesDialogWidget::setDeviceDialogParameters(const QVariantMap ¶meters) @@ -75,11 +79,23 @@ void BTMoreDevicesDialogWidget::closeDeviceDialog(bool byClient) { Q_UNUSED(byClient); - this->close(); + // below code is required and written based on the documentation of closeDeviceDialog API + mMoreDeviceDialog->close(); + QVariantMap val; + QVariant index(-1); + val.insert("selectedindex",index); + emit deviceDialogData(val); + //below signal is emitted to make dialog server aware that our dialog is closed + emit deviceDialogClosed(); } HbPopup* BTMoreDevicesDialogWidget::deviceDialogWidget() const { + return mMoreDeviceDialog; + } + +QObject* BTMoreDevicesDialogWidget::signalSender() const + { return const_cast(this); } @@ -91,15 +107,18 @@ mLoader->load(DOCML_BT_MORE_DEV_DIALOG, &ok); if(ok) { - HbLabel* label = qobject_cast(mLoader->findWidget("label")); + mMoreDeviceDialog = qobject_cast(mLoader->findWidget("lastuseddialog")); + mMoreDeviceDialog->setFrameType(HbDialog::Strong); + mMoreDeviceDialog->setBackgroundFaded(false); +/* HbLabel* label = qobject_cast(mLoader->findWidget("label")); if(label) { label->setTextWrapping(Hb::TextWordWrap); label->setPlainText("Send to:"); } - this->setHeadingWidget(label); - HbPushButton* moreDevices = qobject_cast(mLoader->findWidget("moreDevices")); - HbPushButton* cancel = qobject_cast(mLoader->findWidget("cancel")); + this->setHeadingWidget(label);*/ + // HbPushButton* moreDevices = qobject_cast(mLoader->findWidget("moreDevices")); + // HbPushButton* cancel = qobject_cast(mLoader->findWidget("cancel")); HbListView* listView = qobject_cast(mLoader->findWidget("listView")); listView->setSelectionMode(HbAbstractItemView::SingleSelection); @@ -125,23 +144,32 @@ }*/ connect(listView, SIGNAL(activated(QModelIndex)), this, SLOT(deviceSelected(QModelIndex))); - connect(moreDevices, SIGNAL(clicked()), this, SLOT(moreDevicesClicked())); - connect(cancel, SIGNAL(clicked()), this, SLOT(cancelClicked())); + // connect(moreDevices, SIGNAL(clicked()), this, SLOT(moreDevicesClicked())); + // connect(cancel, SIGNAL(clicked()), this, SLOT(cancelClicked())); + mMoreAction = static_cast( mLoader->findObject( "moreaction" ) ); + mMoreAction->disconnect(mMoreDeviceDialog); - QGraphicsWidget *widget = mLoader->findWidget(QString("container")); - this->setContentWidget(widget); + mCancelAction = static_cast( mLoader->findObject( "cancelaction" ) ); + mCancelAction->disconnect(mMoreDeviceDialog); +// QGraphicsWidget *widget = mLoader->findWidget(QString("container")); + // mMoreDeviceDialog->setContentWidget(widget); + + connect(mMoreAction, SIGNAL(triggered()), this, SLOT(moreDevicesClicked())); + connect(mCancelAction, SIGNAL(triggered()), this, SLOT(cancelClicked())); + } - this->setBackgroundFaded(false); - setDismissPolicy(HbPopup::NoDismiss); - setTimeout(HbPopup::NoTimeout); + mMoreDeviceDialog->setBackgroundFaded(false); + mMoreDeviceDialog->setDismissPolicy(HbPopup::NoDismiss); + mMoreDeviceDialog->setTimeout(HbPopup::NoTimeout); return true; } -void BTMoreDevicesDialogWidget::hideEvent(QHideEvent *event) +/*void BTMoreDevicesDialogWidget::hideEvent(QHideEvent *event) { - HbDialog::hideEvent(event); + //HbDialog::hideEvent(event); + mMoreDeviceDialog->hideEvent(event); // if(mDeviceDialogData == 0) { QVariantMap val; @@ -149,14 +177,14 @@ val.insert("selectedindex",index); emit deviceDialogData(val); emit deviceDialogClosed(); - } + }*/ // - } + // } -void BTMoreDevicesDialogWidget::showEvent(QShowEvent *event) +/*void BTMoreDevicesDialogWidget::showEvent(QShowEvent *event) { - HbDialog::showEvent(event); - } + //HbDialog::showEvent(event); + }*/ void BTMoreDevicesDialogWidget::moreDevicesClicked() { @@ -172,7 +200,12 @@ void BTMoreDevicesDialogWidget::cancelClicked() { // TODO - this->close(); + mMoreDeviceDialog->close(); + QVariantMap val; + QVariant index(-1); + val.insert("selectedindex",index); + emit deviceDialogData(val); + emit deviceDialogClosed(); } void BTMoreDevicesDialogWidget::deviceSelected(const QModelIndex& modelIndex) @@ -181,10 +214,6 @@ QVariantMap val; QVariant index(row); val.insert("selectedindex",index); - - - - emit deviceDialogData(val); // mDeviceDialogData = 1;//flag is to say that device dialog data is emitted required when we cancel the dialog // this->close(); diff -r 91746b151f97 -r 997690c3397a bluetoothengine/btnotif/btdevicedialogplugin/src/btrecvprgrsdialogwidget.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/bluetoothengine/btnotif/btdevicedialogplugin/src/btrecvprgrsdialogwidget.cpp Wed Jun 23 18:23:52 2010 +0300 @@ -0,0 +1,177 @@ +/* +* 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: BtDeviceDialogWidget class declaration. +* +*/ + + +#include "btrecvprgrsdialogwidget.h" +#include "bluetoothdevicedialogs.h" + +const char* DOCML_BT_RECV_PRGRS_DIALOG = ":/docml/bt-recv-progress-dialog.docml"; + + +BTRecvPrgrsDialogWidget::BTRecvPrgrsDialogWidget(const QVariantMap ¶meters) +{ + mLoader = 0; + constructDialog(parameters); +} + +BTRecvPrgrsDialogWidget::~BTRecvPrgrsDialogWidget() +{ + if(mLoader) + { + delete mLoader; + mLoader = NULL; + } +} + +bool BTRecvPrgrsDialogWidget::setDeviceDialogParameters(const QVariantMap ¶meters) +{ + mProgressBar->setMinimum(0); + mProgressBar->setMaximum(mFileSz); + mProgressBar->setProgressValue(parameters.value("progress").toInt()); + return true; +} + +int BTRecvPrgrsDialogWidget::deviceDialogError() const +{ + return 0; +} + +void BTRecvPrgrsDialogWidget::closeDeviceDialog(bool byClient) +{ + Q_UNUSED(byClient); + mDialog->close(); +} + +HbPopup* BTRecvPrgrsDialogWidget::deviceDialogWidget() const +{ + return mDialog; +} + +QObject* BTRecvPrgrsDialogWidget::signalSender() const +{ + return const_cast(this); +} + +bool BTRecvPrgrsDialogWidget::constructDialog(const QVariantMap ¶meters) +{ + mLoader = new HbDocumentLoader(); + bool ok = false; + + mLoader->load(DOCML_BT_RECV_PRGRS_DIALOG, &ok); + if(ok) + { + mDialog = qobject_cast(mLoader->findWidget("senddialog")); + mHeading = qobject_cast(mLoader->findWidget("heading")); + + mFileName = qobject_cast(mLoader->findWidget("fileName")); + mFileSize = qobject_cast(mLoader->findWidget("fileSize")); + mFileCount = qobject_cast(mLoader->findWidget("fileCount")); + + //TODO - set icon based on the file icon. + + mHide = qobject_cast(mLoader->findObject("hideaction")); + mCancel = qobject_cast(mLoader->findObject("cancelaction")); + + mProgressBar = qobject_cast(mLoader->findWidget("horizontalProgressBar")); + + int dialogType = parameters.value(QString::number(TBluetoothDialogParams::EDialogTitle)).toInt(); + switch(dialogType) + { + case TBluetoothDialogParams::EReceive: + { + //TODO - Localization + QString headingStr(hbTrId("txt_bt_title_receiving_files_from_1")); + QString senderName(parameters.value(QString::number(TBluetoothDeviceDialog::EDeviceName)).toString()); + mHeading->setPlainText(headingStr.arg(senderName)); + }break; + + default: + break; + } + mDialog->setHeadingWidget(mHeading); + + mFileName->setPlainText(parameters.value(QString::number(TBluetoothDeviceDialog::EReceivingFileName)).toString()); + + mFileSz = parameters.value(QString::number(TBluetoothDeviceDialog::EReceivingFileSize)).toInt(); + mProgressBar->setMinimum(0); + mProgressBar->setMaximum(mFileSz); + mProgressBar->setProgressValue(0); + + //Format the file size into a more readable format + if ( mFileSz >> 20 ) // size in MB + { + float sizeInMB = 0; + sizeInMB = ((float)mFileSz ) / (1024*1024); + QString fileSzMb; + fileSzMb.setNum(sizeInMB); + fileSzMb.append(QString(" Mb")); + mFileSize->setPlainText(fileSzMb); + } + + else if( mFileSz >> 10 ) // size in KB + { + TInt64 sizeInKB = 0; + sizeInKB = mFileSz >> 10; + QString fileSzKb; + fileSzKb.setNum(sizeInKB); + fileSzKb.append(QString(" Kb")); + mFileSize->setPlainText(fileSzKb); + } + + else // size is unknown or less than 1K + { + QString fileSzB; + fileSzB.setNum(mFileSz); + fileSzB.append(QString(" Bytes")); + mFileSize->setPlainText(fileSzB); + } + + //TODO - Set the received file count +/* + int count = parameters.value(QString::number(TBluetoothDeviceDialog::EReceivedFileCount)).toInt(); + QString fileCntStr; + fileCntStr.setNum(count); + mFileCount->setPlainText(fileCntStr); +*/ + } + + mDialog->setBackgroundFaded(false); + mDialog->setDismissPolicy(HbPopup::NoDismiss); + mDialog->setTimeout(HbPopup::NoTimeout); + + connect(mHide, SIGNAL(triggered()), this, SLOT(hideClicked())); + connect(mCancel, SIGNAL(triggered()), this, SLOT(cancelClicked())); + + return true; +} + +void BTRecvPrgrsDialogWidget::hideClicked() +{ + QVariantMap data; + data.insert(QString("actionResult"), QVariant(true)); + emit deviceDialogData(data); + emit deviceDialogClosed(); +} + +void BTRecvPrgrsDialogWidget::cancelClicked() +{ + QVariantMap data; + data.insert(QString("actionResult"), QVariant(false)); + emit deviceDialogData(data); + emit deviceDialogClosed(); +} + diff -r 91746b151f97 -r 997690c3397a bluetoothengine/btnotif/btdevicedialogplugin/src/btsenddialogwidget.cpp --- a/bluetoothengine/btnotif/btdevicedialogplugin/src/btsenddialogwidget.cpp Fri Jun 11 13:48:51 2010 +0300 +++ b/bluetoothengine/btnotif/btdevicedialogplugin/src/btsenddialogwidget.cpp Wed Jun 23 18:23:52 2010 +0300 @@ -25,51 +25,46 @@ #include "btsenddialogwidget.h" +#define LOC_SENDING_FILES_TO_DEVICE hbTrId("txt_bt_title_sending_file_l1l2_to_3") const char* DOCML_BT_SEND_DIALOG = ":/docml/bt-send-dialog.docml"; BTSendDialogWidget::BTSendDialogWidget(const QVariantMap ¶meters) -:HbDialog() { - // LOG(ELevel1,_L("BTSendDialogWidget::BTSendDialogWidget")); + mLoader = 0; constructDialog(parameters); - } BTSendDialogWidget::~BTSendDialogWidget() { - if(mLoader) - { - delete mLoader; - mLoader = NULL; - } - if(mContentItemModel) + delete mLoader; + /* if(mContentItemModel) { delete mContentItemModel; mContentItemModel = NULL; - } + }*/ } bool BTSendDialogWidget::setDeviceDialogParameters(const QVariantMap ¶meters) { - // LOG(ELevel1,_L("BTSendDialogWidget::setDeviceDialogParameters ")); - if(mFileIndex != parameters.value("currentFileIdx").toString().toInt() ) { - mLabel->setTextWrapping(Hb::TextWordWrap); - mLabel->setAlignment(Qt::AlignHCenter); + mDialogHeading->setTextWrapping(Hb::TextWordWrap); + mDialogHeading->setAlignment(Qt::AlignHCenter); //Todo - replace this with the actual text from parameters - QString headLabel; - headLabel.append(QString("Sending file ")); + QString headLabel = QString(LOC_SENDING_FILES_TO_DEVICE).arg(parameters.value("currentFileIdx").toInt()) + .arg(parameters.value("totalFilesCnt").toInt()) + .arg(parameters.value("destinationName").toString()); + /* headLabel.append(QString("Sending file ")); headLabel.append(parameters.value("currentFileIdx").toString()); headLabel.append('/'); headLabel.append(parameters.value("totalFilesCnt").toString()); headLabel.append(QString(" to ")); - headLabel.append(parameters.value("destinationName").toString()); - mLabel->setPlainText(headLabel); + headLabel.append(parameters.value("destinationName").toString());*/ + mDialogHeading->setPlainText(headLabel); - QStringList info; + /* QStringList info; info.append(parameters.value("fileName").toString()); info.append(parameters.value("fileSzTxt").toString()); @@ -77,7 +72,7 @@ // parameters. listitem->setData(info, Qt::DisplayRole); - //Todo - Insert icons based on the device class + //Todo - Insert file icons here thumbnail icon QIcon icon(QString(":/icons/qtg_large_bluetooth.svg")); listitem->setIcon(icon); @@ -85,8 +80,12 @@ mContentItemModel = new QStandardItemModel(this); mListView->setModel(mContentItemModel);//, prototype); - mContentItemModel->appendRow(listitem); - + mContentItemModel->appendRow(listitem);*/ + //Todo - Insert file icons here thumbnail icon + QIcon icon(QString(":/icons/qtg_large_bluetooth.svg")); + mFileIconLabel->setIcon(icon); + mFileNameLabel->setPlainText(parameters.value("fileName").toString()); + mFileSizeLabel->setPlainText(parameters.value("fileSzTxt").toString()); mProgressBar->setMinimum(0); mProgressBar->setProgressValue(0); mProgressBar->setMaximum(parameters.value("fileSz").toInt()); @@ -96,7 +95,6 @@ { mProgressBar->setProgressValue(parameters.value("progressValue").toInt()); } - // LOG(ELevel1,_L("BTSendDialogWidget::setDeviceDialogParameters Completed")); return true; } @@ -108,12 +106,14 @@ void BTSendDialogWidget::closeDeviceDialog(bool byClient) { Q_UNUSED(byClient); - this->close(); + mSendDialog->close(); +// below redundant call is required because of the api documentation. + emit deviceDialogClosed(); } HbPopup* BTSendDialogWidget::deviceDialogWidget() const { - return const_cast(this); + return mSendDialog; } QObject *BTSendDialogWidget::signalSender() const @@ -123,46 +123,53 @@ bool BTSendDialogWidget::constructDialog(const QVariantMap&/*parameters*/) { - // LOG(ELevel1,_L("BTSendDialogWidget::constructDialog ")); mLoader = new HbDocumentLoader(); bool ok = false; mLoader->load(DOCML_BT_SEND_DIALOG, &ok); if(ok) { - mLabel = qobject_cast(mLoader->findWidget("heading")); - this->setHeadingWidget(mLabel); - mListView = qobject_cast(mLoader->findWidget("listView")); + mSendDialog = qobject_cast(mLoader->findWidget("senddialog")); + mDialogHeading = qobject_cast(mLoader->findWidget("heading")); + mFileIconLabel = qobject_cast(mLoader->findWidget("fileiconlabel")); + mFileNameLabel = qobject_cast(mLoader->findWidget("filenamelabel")); + mFileSizeLabel = qobject_cast(mLoader->findWidget("filesizelabel")); + // mSendDialog->setHeadingWidget(mLabel); + /* mListView = qobject_cast(mLoader->findWidget("listView")); if(mListView) { - //Todo - replace this with the actual text from parameters mContentItemModel = new QStandardItemModel(this); mListView->setModel(mContentItemModel);//, prototype); - } + }*/ mProgressBar = qobject_cast(mLoader->findWidget("horizontalProgressBar")); - HbAction* hide = new HbAction("Hide"); - HbAction* cancel = new HbAction("Cancel"); + // HbAction* hide = new HbAction("Hide"); + // HbAction* cancel = new HbAction("Cancel"); - this->addAction(hide); - this->addAction(cancel); + // this->addAction(hide); + // this->addAction(cancel); - QGraphicsWidget *widget = mLoader->findWidget(QString("container")); - this->setContentWidget(widget); + // QGraphicsWidget *widget = mLoader->findWidget(QString("container")); + // this->setContentWidget(widget); } - this->setBackgroundFaded(false); - setDismissPolicy(HbPopup::NoDismiss); - setTimeout(HbPopup::NoTimeout); - - this->actions().first()->disconnect(this); - connect(this, SIGNAL(finished(HbAction*)), this, SLOT(inputClosed(HbAction*))); + mSendDialog->setBackgroundFaded(false); + mSendDialog->setDismissPolicy(HbPopup::NoDismiss); + mSendDialog->setTimeout(HbPopup::NoTimeout); + mHideAction = static_cast( mLoader->findObject( "hideaction" ) ); + mHideAction->disconnect(mSendDialog); + + mCancelAction = static_cast( mLoader->findObject( "cancelaction" ) ); + mCancelAction->disconnect(mSendDialog); + + connect(mCancelAction, SIGNAL(triggered()), this, SLOT(cancelClicked())); + return true; } -void BTSendDialogWidget::hideEvent(QHideEvent *event) +/*void BTSendDialogWidget::hideEvent(QHideEvent *event) { HbDialog::hideEvent(event); emit deviceDialogClosed(); @@ -171,23 +178,22 @@ void BTSendDialogWidget::showEvent(QShowEvent *event) { HbDialog::showEvent(event); - } + }*/ /*void BTSendDialogWidget::hideClicked() { // TODO this->close(); emit deviceDialogClosed(); - } + }*/ void BTSendDialogWidget::cancelClicked() { - // TODO - this->close(); + mSendDialog->close(); emit deviceDialogClosed(); - }*/ + } -void BTSendDialogWidget::inputClosed(HbAction* action) +/*void BTSendDialogWidget::inputClosed(HbAction* action) { QVariantMap data; @@ -196,5 +202,5 @@ } else if(dlg->actions().at(1) == action) { } - } + }*/ diff -r 91746b151f97 -r 997690c3397a bluetoothengine/btnotif/btnotifsrv/inc/btnotifbasepairinghandler.h --- a/bluetoothengine/btnotif/btnotifsrv/inc/btnotifbasepairinghandler.h Fri Jun 11 13:48:51 2010 +0300 +++ b/bluetoothengine/btnotif/btnotifsrv/inc/btnotifbasepairinghandler.h Wed Jun 23 18:23:52 2010 +0300 @@ -24,7 +24,7 @@ #include #include -class CBTNotifPairingManager; +class CBTNotifSecurityManager; /** * Class CBTNotifBasePairingHandler @@ -94,6 +94,12 @@ * @param the required minimum length of a pin code. */ virtual void GetPinCode( TBTPinCode& aPin, const TBTDevAddr& aAddr, TInt aMinPinLength ); + + /** + * Show a dialog for pairing success or failure + * @param aResult The result of the pairing + */ + void ShowPairingResultNoteL(TInt aResult); protected: @@ -118,7 +124,7 @@ /** * C++ default constructor */ - CBTNotifBasePairingHandler(CBTNotifPairingManager& aParent, const TBTDevAddr& aAddr); + CBTNotifBasePairingHandler(CBTNotifSecurityManager& aParent, const TBTDevAddr& aAddr); /** * Symbian 2nd-phase constructor @@ -161,7 +167,7 @@ /** * Reference to the owner of this object. */ - CBTNotifPairingManager& iParent; + CBTNotifSecurityManager& iParent; /** * Active object helper for asynchronous operations. diff -r 91746b151f97 -r 997690c3397a bluetoothengine/btnotif/btnotifsrv/inc/btnotifconnectiontracker.h --- a/bluetoothengine/btnotif/btnotifsrv/inc/btnotifconnectiontracker.h Fri Jun 11 13:48:51 2010 +0300 +++ b/bluetoothengine/btnotif/btnotifsrv/inc/btnotifconnectiontracker.h Wed Jun 23 18:23:52 2010 +0300 @@ -26,7 +26,7 @@ class CBTNotificationManager; class CbtnotifConnectionTrackerTest; -class CBTNotifPairingManager; +class CBTNotifSecurityManager; @@ -91,14 +91,14 @@ { return iSockServ; } /** - * Processes a message for notifiers related to pairings. + * Processes a message for notifiers related to remote devices. * ( These are usually issued by BT stack. However, any application * is not restricted to do so (e.g., for testing purpose). * * @since Symbian^4 * @param aMessage The message containing the details of the client request. */ - void HandlePairingNotifierRequestL( const RMessage2& aMessage ); + void HandleNotifierRequestL( const RMessage2& aMessage ); /** * Handle a request related to pairing. @@ -167,7 +167,7 @@ * Object for managing the application pairing. * Own. */ - CBTNotifPairingManager* iPairingManager; + CBTNotifSecurityManager* iPairingManager; BTUNITTESTHOOK diff -r 91746b151f97 -r 997690c3397a bluetoothengine/btnotif/btnotifsrv/inc/btnotifincomingpairinghandler.h --- a/bluetoothengine/btnotif/btnotifsrv/inc/btnotifincomingpairinghandler.h Fri Jun 11 13:48:51 2010 +0300 +++ b/bluetoothengine/btnotif/btnotifsrv/inc/btnotifincomingpairinghandler.h Wed Jun 23 18:23:52 2010 +0300 @@ -38,7 +38,7 @@ * @param aParent the owner of this observer * @param aAddr the remote device this observer is targeted to */ - static CBTNotifBasePairingHandler* NewL( CBTNotifPairingManager& aParent, + static CBTNotifBasePairingHandler* NewL( CBTNotifSecurityManager& aParent, const TBTDevAddr& aAddr); /** @@ -120,7 +120,7 @@ /** * C++ default constructor */ - CBTNotifIncomingPairingHandler(CBTNotifPairingManager& aParent, const TBTDevAddr& aAddr); + CBTNotifIncomingPairingHandler(CBTNotifSecurityManager& aParent, const TBTDevAddr& aAddr); /** * 2nd phase constructor. diff -r 91746b151f97 -r 997690c3397a bluetoothengine/btnotif/btnotifsrv/inc/btnotifoutgoingpairinghandler.h --- a/bluetoothengine/btnotif/btnotifsrv/inc/btnotifoutgoingpairinghandler.h Fri Jun 11 13:48:51 2010 +0300 +++ b/bluetoothengine/btnotif/btnotifsrv/inc/btnotifoutgoingpairinghandler.h Wed Jun 23 18:23:52 2010 +0300 @@ -63,7 +63,7 @@ * @param aParent the owner of this object * @param aAddr the remote device this observer is targeted to */ - static CBTNotifBasePairingHandler* NewL( CBTNotifPairingManager& aParent, + static CBTNotifBasePairingHandler* NewL( CBTNotifSecurityManager& aParent, const TBTDevAddr& aAddr ); /** @@ -157,7 +157,7 @@ /** * C++ default constructor */ - CBTNotifOutgoingPairingHandler( CBTNotifPairingManager& aParent, const TBTDevAddr& aAddr ); + CBTNotifOutgoingPairingHandler( CBTNotifSecurityManager& aParent, const TBTDevAddr& aAddr ); /** * Symbian 2nd-phase constructor diff -r 91746b151f97 -r 997690c3397a bluetoothengine/btnotif/btnotifsrv/inc/btnotifpairingmanager.h --- a/bluetoothengine/btnotif/btnotifsrv/inc/btnotifpairingmanager.h Fri Jun 11 13:48:51 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,400 +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 BTNOTIFPAIRINGMANAGER_H -#define BTNOTIFPAIRINGMANAGER_H - -#include -#include -#include -#include -#include -#include - -class CBTNotifBasePairingHandler; -class CBTNotifPairNotifier; -class CBTNotifConnectionTracker; -class CBtDevRepository; - -/** - * Class CBTNotifPairingManager - * - * This class manages pairing with BT devices. - * The responsibility of handling incoming and outgoing pairings is - * delegated to CBTNotifIncomingPairingHandler and CBTNotifOutgoingPairingHandler - * respectively. - * - * @since Symbian^4 - */ -NONSHARABLE_CLASS( CBTNotifPairingManager ) : - public CBase, - public MBtSimpleActiveObserver, - public MBtDevRepositoryObserver - { -public: - - /** - * Two-phase constructor - */ - static CBTNotifPairingManager* NewL( - CBTNotifConnectionTracker& aParent, - CBtDevRepository& aDevRepository ); - - /** - * Destructor - */ - ~CBTNotifPairingManager(); - - /** - * Cancels an outstanding pairing request. - */ - void CancelOutgoingPair(); - - /** - * Process commands relevant to pairing - */ - void HandleBondingRequestL( const RMessage2& aMessage ); - - void HandlePairingNotifierRequestL( const RMessage2& aMessage ); - - /** - * Gets the instance of pairing server. - * @return the server instance. NULL if dedicated bonding is unavailable. - */ - RBluetoothPairingServer* PairingServer(); - - /** - * gets the reference of socket server session - */ - RSocketServ& SocketServ(); - - /** - * gets the reference of devrepository. - */ - CBtDevRepository& BTDevRepository(); - - /** - * gets the reference of connection tracker. - */ - CBTNotifConnectionTracker& ConnectionTracker(); - - /** - * Transfer responsiblity to the specified object. - * @param aPairer the object whose the responsibility is transfered. - */ - void RenewPairingHandler( CBTNotifBasePairingHandler* aPairingHandler ); - - /** - * Be notified when handling of an outgoing pair has been completed. - * @param aErr the result of pairing - * - */ - void OutgoingPairCompleted( TInt aErr ); - - /** - * Be informed that a session will be closed. - * - * @since Symbian^4 - * @param aSession the session to be cloased. - */ - void SessionClosed(CSession2* aSession ); - - /** - * Unpair a device via registry - */ - void UnpairDevice( const TBTDevAddr& aAddr ); - - /** - * Add the bit indicating the device is user-aware Just worked paired to - * UI cookie. - */ - TInt AddUiCookieJustWorksPaired( const TBTNamelessDevice& aDev ); - - /** - * Update a nameless device in registry - */ - TInt UpdateRegDevice( const TBTNamelessDevice& aDev ); - - /** - * Gets the pin code to be used for pairing a device. - * @param aPin contains the pin code if it is not empty - * @param aAddr the device to which pairing is performed. - * @param the required minimum length of a pin code. - */ - void GetPinCode( TBTPinCode& aPin, const TBTDevAddr& aAddr, TInt aMinPinLength ); - - /** - * Returns the service (limited to services managed in bteng scope) - * level connection status of the specified device. - * - * @param aAddr the address of the device - * @return one of TBTEngConnectionStatus enums - */ - TBTEngConnectionStatus ConnectStatus( const TBTDevAddr& aAddr ); - -private: - - // from base class MBtSimpleActiveObserver - - /** - * - * Callback to notify that an outstanding request has completed. - * - * @since Symbian^4 - * @param aActive Pointer to the active object that completed. - * @param aId The ID that identifies the outstanding request. - * @param aStatus The status of the completed request. - */ - virtual void RequestCompletedL( CBtSimpleActive* aActive, TInt aStatus ); - - /** - * Callback from Docancel() for handling cancelation of an outstanding request. - * - * @since Symbian^4 - * @param aId The ID that identifies the outstanding request. - */ - virtual void CancelRequest( TInt aRequestId ); - - /** - * Callback to notify that an error has occurred in RunL. - * - * @since Symbian^4 - * @param aActive Pointer to the active object that completed. - * @param aId The ID that identifies the outstanding request. - * @param aStatus The status of the completed request. - */ - virtual void HandleError( CBtSimpleActive* aActive, TInt aError ); - - // From base class MBtDevRepositoryObserver - - /** - * Callback to notify that the repository has finished initialization. - * Initialization completion means the repository has retieved all - * Bluetooth devices from BT registry, and it is subscribing to - * registry update events. - */ - virtual void RepositoryInitialized(); - - /** - * Callback to notify that a device has been deleted from BT registry. - * - * - * @param aAddr the bd_addr of the deleted device - */ - virtual void DeletedFromRegistry( const TBTDevAddr& aAddr ); - - /** - * Callback to notify that the device has been added to BT registry. - * - * @param aDevice the device that has been added to registry - */ - virtual void AddedToRegistry( const CBtDevExtension& aDevice ); - - /** - * Callback to notify that the property of a device in BT registry has been - * changed. - * - * @param aDevice the device that possesses the latest properties. - * @param aSimilarity the similarity of the properties comparing to the ones - * prior to this change. - * Refer CBTDevice::TBTDeviceNameSelector and - * TBTNamelessDevice::TBTDeviceSet for the meanings of the bits - * in this parameter. - */ - virtual void ChangedInRegistry( - const CBtDevExtension& aDevice, TUint aSimilarity ); - - /** - * Callback to notify that the status of service (limited to - * services maintained in btengsrv scope) connections with - * a device has changed. - * - * @param aDevice the device to which the status change refers - * @param aConnected ETrue if at least one service is currently connected. - * EFalse if no service is currently connected. - */ - virtual void ServiceConnectionChanged( - const CBtDevExtension& aDevice, TBool aConnected ); - - -private: - - /** - * C++ default constructor - */ - CBTNotifPairingManager( - CBTNotifConnectionTracker& aParent, - CBtDevRepository& aDevRepository ); - - /** - * Symbian 2nd-phase constructor - */ - void ConstructL(); - - /** - * Subscribe local device address for determining - * Bluetooth HW power status - */ - void SubscribeLocalAddress(); - - TBool IsLocalAddressAvailable(); - - /** - * Activate / deactivate a pair observer - */ - TInt SetPairObserver(const TBTDevAddr& aAddr, TBool aActivate); - - /** - * Pair a BT device. - */ - void PairDeviceL( const TBTDevAddr& aAddr, TUint32 aCod ); - - /** - * Cancel all subscribes to pairng server - */ - void CancelSubscribePairingAuthenticate(); - - /** - * subscribe to receive SSP pairing result from pairing server - */ - void SubscribeSspPairingResult(); - - /** - * Subscribe to receive authentication result from pairing server - */ - void SubscribeAuthenticateResult(); - - /** - * Handle a pairing result from the pairing server. - * - * @since Symbian^4 - * @param aResult The status code of the authentication result. - */ - void HandlePairingResultL( const TBTDevAddr& aAddr, TInt aResult ); - - /** - * Copy the paired devices to internal array storage. - */ - void UpdatePairedDeviceListL(); - - /** - * Handles a new bonding event from Registry. - */ - void HandleRegistryBondingL( const TBTNamelessDevice& aNameless ); - - -private: - - /** - * Owner of this class. - * Not owned. - */ - CBTNotifConnectionTracker& iParent; - - /** - * Reference to repository. - * Not owned. - */ - CBtDevRepository& iDevRepository; - - /** - * The session with BT registry. - * own. - */ - RBTRegistry iRegistry; - - /** - * contains the list of all paired devices. - */ - RArray iPairedDevices; - - /** - * Session with the pairing server. - * Allocate it in heap to ease the handling for - * situation of unavailable dedicated pairing service. - * - * own. - */ - RBluetoothPairingServer* iPairingServ; - - /** - * Subsession with the pairing server for - * getting the simple pairing result. - * own - */ - RBluetoothPairingResult iPairingResult; - - /** - * Subsession with the pairing server for - * getting the authentication result. - * own - */ - RBluetoothAuthenticationResult iAuthenResult; - - /** - * the address with which a simple pairing has been performed - */ - TBTDevAddr iSimplePairingRemote; - - /** - * the address with which an authentication has been performed - */ - TBTDevAddr iAuthenticateRemote; - - /** - * Active object helper for receiving simple pairing results. - * Own. - */ - CBtSimpleActive* iSSPResultActive; - - /** - * Active object helper for receiving authentication results. - * Own. - */ - CBtSimpleActive* iAuthenResultActive; - - /** - * pairing hanlder at the time. - * Own. - */ - CBTNotifBasePairingHandler* iPairingHandler; - - /** - * The handler for pairing notifiers - */ - CBTNotifPairNotifier* iPairNotifier; - - /** - * Client-server message for power change requests. - */ - RMessage2 iMessage; - - /** - * AO for local address updates. - */ - CBtSimpleActive* iLocalAddrActive; - - /** - * Provides access to the BT local device address. - */ - RProperty iPropertyLocalAddr; - }; - -#endif /*BTNOTIFPAIRINGMANAGER_H*/ - - - diff -r 91746b151f97 -r 997690c3397a bluetoothengine/btnotif/btnotifsrv/inc/btnotifpairnotifier.h --- a/bluetoothengine/btnotif/btnotifsrv/inc/btnotifpairnotifier.h Fri Jun 11 13:48:51 2010 +0300 +++ b/bluetoothengine/btnotif/btnotifsrv/inc/btnotifpairnotifier.h Wed Jun 23 18:23:52 2010 +0300 @@ -20,16 +20,17 @@ #include #include +#include #include "bluetoothdevicedialogs.h" #include "btnotificationresult.h" #include "bluetoothtrace.h" -class CBTNotifPairingManager; +class CBTNotifSecurityManager; class CBTNotifConnectionTracker; class CBluetoothNotification; /** - * Helper class for performing user prompt for pairing and authorization. + * Helper class for performing user prompt for pairing. * * The design of this class is focussed on structure and maintainability first. * Duplicate (state) information is kept to a minimum. And memory usage comes @@ -37,8 +38,6 @@ * only instantiated when there is pairing-related processing, so extreme * focus on memory or processing efficiency would have relatively little effect. * - * Auth represents Authenticate and Authorize - * * @since Symbian^4 */ NONSHARABLE_CLASS( CBTNotifPairNotifier ) : public CBase, @@ -53,7 +52,7 @@ * @param aDevice Pointer to information of the remote device. * aParam The owner of this object */ - static CBTNotifPairNotifier* NewL( CBTNotifPairingManager& aParent ); + static CBTNotifPairNotifier* NewL( CBTNotifSecurityManager& aParent ); /** * Destructor. @@ -118,7 +117,7 @@ /** * C++ default constructor. */ - CBTNotifPairNotifier( CBTNotifPairingManager& aParent ); + CBTNotifPairNotifier( CBTNotifSecurityManager& aParent ); /** * Symbian 2nd-phase constructor. @@ -154,7 +153,7 @@ * @param aResult The user response; ETrue if the user accepted the query, * otherwise EFalse. */ - void CompleteAcceptPairingQueryL( TInt aError, TBool aResult ); + void CompleteAcceptPairingQueryL( TInt aError); /** * Parse the parameters of a request for pairing. @@ -231,13 +230,6 @@ */ void NotificationClosedL( TInt aError, const TDesC8& aData ); - /** - * Ask the user if he/she wants to block future connection requests. - * - * @since Symbian^4 - */ - void LaunchBlockingQueryL(); - private: // data enum TNotifierState @@ -246,7 +238,7 @@ EPairingInputConfirm, }; - CBTNotifPairingManager& iParent; + CBTNotifSecurityManager& iParent; /** * The client request. @@ -290,6 +282,11 @@ TNotifierState iState; + // Defines if the check box in the dialog is checked or not. + TBool iCheckBoxState; + + TBool iAcceptPairingResult; + BTUNITTESTHOOK }; diff -r 91746b151f97 -r 997690c3397a bluetoothengine/btnotif/btnotifsrv/inc/btnotifsecuritymanager.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/bluetoothengine/btnotif/btnotifsrv/inc/btnotifsecuritymanager.h Wed Jun 23 18:23:52 2010 +0300 @@ -0,0 +1,413 @@ +/* +* 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 BTNOTIFSECURITYMANAGER_H +#define BTNOTIFSECURITYMANAGER_H + +#include +#include +#include +#include +#include +#include + +class CBTNotifBasePairingHandler; +class CBTNotifPairNotifier; +class CBTNotifConnectionTracker; +class CBtDevRepository; +class CBTNotifServiceAuthorizer; + +/** + * Class CBTNotifSecurityManager + * + * This class manages pairing with BT devices. + * The responsibility of handling incoming and outgoing pairings is + * delegated to CBTNotifIncomingPairingHandler and CBTNotifOutgoingPairingHandler + * respectively. + * + * @since Symbian^4 + */ +NONSHARABLE_CLASS( CBTNotifSecurityManager ) : + public CBase, + public MBtSimpleActiveObserver, + public MBtDevRepositoryObserver + { +public: + + /** + * Two-phase constructor + */ + static CBTNotifSecurityManager* NewL( + CBTNotifConnectionTracker& aParent, + CBtDevRepository& aDevRepository ); + + /** + * Destructor + */ + ~CBTNotifSecurityManager(); + + /** + * Cancels an outstanding pairing request. + */ + void CancelOutgoingPair(); + + /** + * Process commands relevant to pairing + */ + void HandleBondingRequestL( const RMessage2& aMessage ); + + void HandleNotifierRequestL( const RMessage2& aMessage ); + + /** + * Gets the instance of pairing server. + * @return the server instance. NULL if dedicated bonding is unavailable. + */ + RBluetoothPairingServer* PairingServer(); + + /** + * gets the reference of socket server session + */ + RSocketServ& SocketServ(); + + /** + * gets the reference of devrepository. + */ + CBtDevRepository& BTDevRepository(); + + /** + * gets the reference of connection tracker. + */ + CBTNotifConnectionTracker& ConnectionTracker(); + + /** + * Transfer responsiblity to the specified object. + * @param aPairer the object whose the responsibility is transfered. + */ + void RenewPairingHandler( CBTNotifBasePairingHandler* aPairingHandler ); + + /** + * Be notified when handling of an outgoing pair has been completed. + * @param aErr the result of pairing + * + */ + void OutgoingPairCompleted( TInt aErr ); + + /** + * Be informed that a session will be closed. + * + * @since Symbian^4 + * @param aSession the session to be cloased. + */ + void SessionClosed(CSession2* aSession ); + + /** + * Unpair a device via registry + */ + void UnpairDevice( const TBTDevAddr& aAddr ); + + /** + * Block a device via registry + */ + void BlockDevice( const TBTDevAddr& aAddr , TBool aBanned); + + /** + * Add the bit indicating the device is user-aware Just worked paired to + * UI cookie. + */ + TInt AddUiCookieJustWorksPaired( const TBTNamelessDevice& aDev ); + + /** + * Update a nameless device in registry + */ + TInt UpdateRegDevice( const TBTNamelessDevice& aDev ); + + /** + * Gets the pin code to be used for pairing a device. + * @param aPin contains the pin code if it is not empty + * @param aAddr the device to which pairing is performed. + * @param the required minimum length of a pin code. + */ + void GetPinCode( TBTPinCode& aPin, const TBTDevAddr& aAddr, TInt aMinPinLength ); + + /** + * Returns the service (limited to services managed in bteng scope) + * level connection status of the specified device. + * + * @param aAddr the address of the device + * @return one of TBTEngConnectionStatus enums + */ + TBTEngConnectionStatus ConnectStatus( const TBTDevAddr& aAddr ); + + /** + * Activate / deactivate a pair observer + */ + TInt SetPairObserver(const TBTDevAddr& aAddr, TBool aActivate); + + /** + * Trust a device via the registry + */ + void TrustDevice( const TBTDevAddr& aAddr ); + +private: + + // from base class MBtSimpleActiveObserver + + /** + * + * Callback to notify that an outstanding request has completed. + * + * @since Symbian^4 + * @param aActive Pointer to the active object that completed. + * @param aId The ID that identifies the outstanding request. + * @param aStatus The status of the completed request. + */ + virtual void RequestCompletedL( CBtSimpleActive* aActive, TInt aStatus ); + + /** + * Callback from Docancel() for handling cancelation of an outstanding request. + * + * @since Symbian^4 + * @param aId The ID that identifies the outstanding request. + */ + virtual void CancelRequest( TInt aRequestId ); + + /** + * Callback to notify that an error has occurred in RunL. + * + * @since Symbian^4 + * @param aActive Pointer to the active object that completed. + * @param aId The ID that identifies the outstanding request. + * @param aStatus The status of the completed request. + */ + virtual void HandleError( CBtSimpleActive* aActive, TInt aError ); + + // From base class MBtDevRepositoryObserver + + /** + * Callback to notify that the repository has finished initialization. + * Initialization completion means the repository has retieved all + * Bluetooth devices from BT registry, and it is subscribing to + * registry update events. + */ + virtual void RepositoryInitialized(); + + /** + * Callback to notify that a device has been deleted from BT registry. + * + * + * @param aAddr the bd_addr of the deleted device + */ + virtual void DeletedFromRegistry( const TBTDevAddr& aAddr ); + + /** + * Callback to notify that the device has been added to BT registry. + * + * @param aDevice the device that has been added to registry + */ + virtual void AddedToRegistry( const CBtDevExtension& aDevice ); + + /** + * Callback to notify that the property of a device in BT registry has been + * changed. + * + * @param aDevice the device that possesses the latest properties. + * @param aSimilarity the similarity of the properties comparing to the ones + * prior to this change. + * Refer CBTDevice::TBTDeviceNameSelector and + * TBTNamelessDevice::TBTDeviceSet for the meanings of the bits + * in this parameter. + */ + virtual void ChangedInRegistry( + const CBtDevExtension& aDevice, TUint aSimilarity ); + + /** + * Callback to notify that the status of service (limited to + * services maintained in btengsrv scope) connections with + * a device has changed. + * + * @param aDevice the device to which the status change refers + * @param aConnected ETrue if at least one service is currently connected. + * EFalse if no service is currently connected. + */ + virtual void ServiceConnectionChanged( + const CBtDevExtension& aDevice, TBool aConnected ); + + +private: + + /** + * C++ default constructor + */ + CBTNotifSecurityManager( + CBTNotifConnectionTracker& aParent, + CBtDevRepository& aDevRepository ); + + /** + * Symbian 2nd-phase constructor + */ + void ConstructL(); + + /** + * Subscribe local device address for determining + * Bluetooth HW power status + */ + void SubscribeLocalAddress(); + + TBool IsLocalAddressAvailable(); + + /** + * Pair a BT device. + */ + void PairDeviceL( const TBTDevAddr& aAddr, TUint32 aCod ); + + /** + * Cancel all subscribes to pairng server + */ + void CancelSubscribePairingAuthenticate(); + + /** + * subscribe to receive SSP pairing result from pairing server + */ + void SubscribeSspPairingResult(); + + /** + * Subscribe to receive authentication result from pairing server + */ + void SubscribeAuthenticateResult(); + + /** + * Handle a pairing result from the pairing server. + * + * @since Symbian^4 + * @param aResult The status code of the authentication result. + */ + void HandlePairingResultL( const TBTDevAddr& aAddr, TInt aResult ); + + /** + * Copy the paired devices to internal array storage. + */ + void UpdatePairedDeviceListL(); + + /** + * Handles a new bonding event from Registry. + */ + void HandleRegistryBondingL( const TBTNamelessDevice& aNameless ); + + +private: + + /** + * Owner of this class. + * Not owned. + */ + CBTNotifConnectionTracker& iParent; + + /** + * Reference to repository. + * Not owned. + */ + CBtDevRepository& iDevRepository; + + /** + * The session with BT registry. + * own. + */ + RBTRegistry iRegistry; + + /** + * contains the list of all paired devices. + */ + RArray iPairedDevices; + + /** + * Session with the pairing server. + * Allocate it in heap to ease the handling for + * situation of unavailable dedicated pairing service. + * + * own. + */ + RBluetoothPairingServer* iPairingServ; + + /** + * Subsession with the pairing server for + * getting the simple pairing result. + * own + */ + RBluetoothPairingResult iPairingResult; + + /** + * Subsession with the pairing server for + * getting the authentication result. + * own + */ + RBluetoothAuthenticationResult iAuthenResult; + + /** + * the address with which a simple pairing has been performed + */ + TBTDevAddr iSimplePairingRemote; + + /** + * the address with which an authentication has been performed + */ + TBTDevAddr iAuthenticateRemote; + + /** + * Active object helper for receiving simple pairing results. + * Own. + */ + CBtSimpleActive* iSSPResultActive; + + /** + * Active object helper for receiving authentication results. + * Own. + */ + CBtSimpleActive* iAuthenResultActive; + + /** + * pairing hanlder at the time. + * Own. + */ + CBTNotifBasePairingHandler* iPairingHandler; + + /** + * The handler for pairing notifiers + */ + CBTNotifPairNotifier* iPairNotifier; + + /** + * Client-server message for power change requests. + */ + RMessage2 iMessage; + + /** + * AO for local address updates. + */ + CBtSimpleActive* iLocalAddrActive; + + /** + * Provides access to the BT local device address. + */ + RProperty iPropertyLocalAddr; + + CBTNotifServiceAuthorizer* iServiceAuthorizer; + }; + +#endif /*BTNOTIFSECURITYMANAGER_H*/ + + + diff -r 91746b151f97 -r 997690c3397a bluetoothengine/btnotif/btnotifsrv/inc/btnotifserviceauthorizer.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/bluetoothengine/btnotif/btnotifsrv/inc/btnotifserviceauthorizer.h Wed Jun 23 18:23:52 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: class for prompting user to authorize a service +* connection request. +* +*/ + +#ifndef BTNOTIFSERVICEAUTHORIZER_H +#define BTNOTIFSERVICEAUTHORIZER_H + +#include +#include "btnotificationresult.h" +#include "bluetoothdevicedialogs.h" + +class CBTNotifSecurityManager; +class CBluetoothNotification; + + +NONSHARABLE_CLASS(CBTNotifServiceAuthorizer) + : public CBase, public MBTNotificationResult + { +public: + static CBTNotifServiceAuthorizer* NewL(CBTNotifSecurityManager& aParent); + ~CBTNotifServiceAuthorizer(); + +private: + CBTNotifServiceAuthorizer(CBTNotifSecurityManager& aParent); + void ConstructL(); + +public: + void StartNotifierL(const RMessage2& aMessage); + +private: // From MBTNotificationResult + void MBRDataReceived(CHbSymbianVariantMap& aData); + void MBRNotificationClosed(TInt aError, const TDesC8& aData); + +private: + void PrepareNotificationL(TBluetoothDialogParams::TBTDialogType aType, + TBTDialogResourceId aResourceId, TBool aPaired); + TBool IsExistingConnectionToAudioL(const TBTDevAddr& aDevAddr); + +private: + CBTNotifSecurityManager& iParent; + + /** + * Buffer containing the parameters of the client message. + * Own. + */ + RBuf8 iParams; + + /** + * Pointer to an outstanding user interaction. + * Not owned. + */ + CBluetoothNotification* iNotification; + + // Contains the device name provided in params + TBTDeviceName iCurrentDeviceName; + + // The client request. + RMessage2 iNotifierMessage; + + // The bluetooth SDP Id of the connecting device. + TUint iServiceId; + + // Variable that defines if the connecting device is to be trusted or not. + TBool iSetTrusted; + + // Defines if the check box in the dialog is checked or not. + TBool iCheckBoxState; + + // Defines if the connecting device is paired or not. + TBool iPairedDevice; + + // Defines the class of the connecting device. + TInt iDeviceClass; + }; + +#endif /* BTNOTIFSERVICEAUTHORIZER_H_ */ diff -r 91746b151f97 -r 997690c3397a bluetoothengine/btnotif/btnotifsrv/inc/btnotifutil.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/bluetoothengine/btnotif/btnotifsrv/inc/btnotifutil.h Wed Jun 23 18:23:52 2010 +0300 @@ -0,0 +1,49 @@ +/* +* 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 BTNOTIFUTIL_H +#define BTNOTIFUTIL_H + +#include +#include + +class CBtDevExtension; + +/** + * Utility class providing common functions required by various classes within + * btnotifsrv. + * + * @since Symbian^4 + */ +NONSHARABLE_CLASS( TBTNotifUtil ) + { +public: + + /** + * Gets the name of a device for displaying in UI. + * + * @param aNameBuf The buffer that will contain the name at return. + * @param aDevExt the DevExt instance representing the remote device. + * @param aNameInParam the given name from the parameter of a notifier request. + * @param aAddr the address of the device. Used only when aDevExt is null. + */ + static void GetDeviceUiNameL( TDes& aNameBuf, + const CBtDevExtension* aDevExt, + const TDesC& aNameInParam, const TBTDevAddr& aAddr ); + }; + +#endif // BTNOTIFUTIL_H diff -r 91746b151f97 -r 997690c3397a bluetoothengine/btnotif/btnotifsrv/src/bluetoothnotification.cpp --- a/bluetoothengine/btnotif/btnotifsrv/src/bluetoothnotification.cpp Fri Jun 11 13:48:51 2010 +0300 +++ b/bluetoothengine/btnotif/btnotifsrv/src/bluetoothnotification.cpp Wed Jun 23 18:23:52 2010 +0300 @@ -161,7 +161,6 @@ { BOstraceFunctionEntryExt( DUMMY_DEVLIST, this, aType ); TBuf16<6> key; - TInt err = 0; CHbSymbianVariant* value = NULL; switch( aType ) { @@ -191,12 +190,7 @@ TPtrC16 *ptr = (TPtrC16 *)value->Data(); BOstraceExt2( TRACE_DEBUG, DUMMY_DEVLIST, "SetData [%S] = [%S]", &p, ptr); ); - err = iNotificationData->Add( key, value ); // Takes ownership of value - if ( err ) - { - // Note: need a proper exception handling. - // NOTIF_NOTHANDLED( err ) - } + User::LeaveIfError(iNotificationData->Add( key, value )); // Takes ownership of value break; case TBluetoothDialogParams::EResource: case TBluetoothDeviceDialog::EDeviceClass: @@ -220,7 +214,6 @@ { BOstraceFunctionEntryExt( DUMMY_DEVLIST, this, aType ); TBuf<6> key; - TInt err = 0; CHbSymbianVariant* value = NULL; switch( aType ) { @@ -251,13 +244,7 @@ TInt *intPtr = (TInt *)value->Data(); BOstraceExt2( TRACE_DEBUG, DUMMY_DEVLIST, "SetData [%S] = [%d]", &p, *intPtr); ); - err = iNotificationData->Add( key, value ); // Takes ownership of value - if ( err ) - { - // need a proper exception handling. - //NOTIF_NOTHANDLED( !err ) - } - + User::LeaveIfError(iNotificationData->Add( key, value )); // Takes ownership of value break; case TBluetoothDialogParams::EAddress: case TBluetoothDeviceDialog::EDeviceName: @@ -297,7 +284,10 @@ } } } - iObserver->MBRDataReceived( aData ); + if( iObserver ) + { + iObserver->MBRDataReceived( aData ); + } BOstraceFunctionExit1( DUMMY_DEVLIST, this ); } diff -r 91746b151f97 -r 997690c3397a bluetoothengine/btnotif/btnotifsrv/src/btnotifbasepairinghandler.cpp --- a/bluetoothengine/btnotif/btnotifsrv/src/btnotifbasepairinghandler.cpp Fri Jun 11 13:48:51 2010 +0300 +++ b/bluetoothengine/btnotif/btnotifsrv/src/btnotifbasepairinghandler.cpp Wed Jun 23 18:23:52 2010 +0300 @@ -15,8 +15,12 @@ * */ -#include "btnotifpairingmanager.h" +#include "btnotifsecuritymanager.h" #include "btnotifbasepairinghandler.h" +#include "btnotificationmanager.h" +#include "bluetoothnotification.h" +#include "btnotifconnectiontracker.h" +#include "bluetoothtrace.h" // ======== MEMBER FUNCTIONS ======== @@ -24,7 +28,7 @@ // C++ default constructor // --------------------------------------------------------------------------- // -CBTNotifBasePairingHandler::CBTNotifBasePairingHandler( CBTNotifPairingManager& aParent, const TBTDevAddr& aAddr) +CBTNotifBasePairingHandler::CBTNotifBasePairingHandler( CBTNotifSecurityManager& aParent, const TBTDevAddr& aAddr) : iAddr( aAddr ), iParent( aParent ) { } @@ -121,6 +125,38 @@ return iPairResultSet; } +// --------------------------------------------------------------------------- +// Invalidate iPairResultSet +// --------------------------------------------------------------------------- +// +void CBTNotifBasePairingHandler::ShowPairingResultNoteL(TInt aResult) + { + BOstraceFunctionEntry0( DUMMY_DEVLIST ); + CBluetoothNotification* notification = + iParent.ConnectionTracker().NotificationManager()->GetNotification(); + User::LeaveIfNull( notification ); // For OOM exception, leaves with KErrNoMemory + TBTDialogResourceId resourceId = EPairingSuccess; + if(KErrNone != aResult) + { + resourceId = EPairingFailure; + } + notification->SetNotificationType( TBluetoothDialogParams::ENote, resourceId ); + const CBtDevExtension* dev = iParent.BTDevRepository().Device(iAddr); + if(dev) + { + User::LeaveIfError(notification->SetData( TBluetoothDeviceDialog::EDeviceName, dev->Alias())); + User::LeaveIfError(notification->SetData( TBluetoothDeviceDialog::EDeviceClass, dev->Device().DeviceClass().DeviceClass())); + } + else + { + TBTDeviceName name; + iAddr.GetReadable(name); + User::LeaveIfError(notification->SetData( TBluetoothDialogParams::EAddress, name )); + User::LeaveIfError(notification->SetData( TBluetoothDeviceDialog::EDeviceClass, 0)); // No device class + } + iParent.ConnectionTracker().NotificationManager()->QueueNotificationL( notification); + BOstraceFunctionExit0( DUMMY_DEVLIST ); + } diff -r 91746b151f97 -r 997690c3397a bluetoothengine/btnotif/btnotifsrv/src/btnotifconnectiontracker.cpp --- a/bluetoothengine/btnotif/btnotifsrv/src/btnotifconnectiontracker.cpp Fri Jun 11 13:48:51 2010 +0300 +++ b/bluetoothengine/btnotif/btnotifsrv/src/btnotifconnectiontracker.cpp Wed Jun 23 18:23:52 2010 +0300 @@ -27,7 +27,7 @@ #include "btnotifsession.h" #include "btnotifclientserver.h" #include "bluetoothtrace.h" -#include "btnotifpairingmanager.h" +#include "btnotifsecuritymanager.h" /** Time window for determining if there are too many requests. */ #ifndef __WINS__ @@ -62,7 +62,7 @@ User::LeaveIfError( iBTRegistrySession.Connect() ); // Open a handle to the socket server User::LeaveIfError( iSockServ.Connect() ); - iPairingManager = CBTNotifPairingManager::NewL(*this, iServer->DevRepository() ); + iPairingManager = CBTNotifSecurityManager::NewL(*this, iServer->DevRepository() ); BOstraceFunctionExit0( DUMMY_DEVLIST ); } @@ -99,10 +99,10 @@ // Process notifier message related to pairing notifiers. // --------------------------------------------------------------------------- // -void CBTNotifConnectionTracker::HandlePairingNotifierRequestL( const RMessage2& aMessage ) +void CBTNotifConnectionTracker::HandleNotifierRequestL( const RMessage2& aMessage ) { BOstraceFunctionEntryExt ( DUMMY_LIST, this, aMessage.Function() ); - iPairingManager->HandlePairingNotifierRequestL(aMessage); + iPairingManager->HandleNotifierRequestL(aMessage); BOstraceFunctionExit1( DUMMY_DEVLIST, this ); } diff -r 91746b151f97 -r 997690c3397a bluetoothengine/btnotif/btnotifsrv/src/btnotifdeviceselector.cpp --- a/bluetoothengine/btnotif/btnotifsrv/src/btnotifdeviceselector.cpp Fri Jun 11 13:48:51 2010 +0300 +++ b/bluetoothengine/btnotif/btnotifsrv/src/btnotifdeviceselector.cpp Wed Jun 23 18:23:52 2010 +0300 @@ -26,6 +26,8 @@ #include "btnotifserver.h" #include "btnotificationmanager.h" #include "btnotifclientserver.h" +// Key description length +const TInt KMaxKeyDesCLength = 20; // ======== MEMBER FUNCTIONS ======== @@ -187,8 +189,8 @@ devParams().SetDeviceClass(iDevices[val]->Device().DeviceClass()); devParams().SetDeviceName(iDevices[val]->Alias()); err = iMessage.Write( EBTNotifSrvReplySlot, devParams ); + iNotification->RemoveObserver(); iNotification->Close(); // Also dequeues the notification from the queue. - iNotification->RemoveObserver(); iNotification = NULL; } iMessage.Complete( err ); @@ -208,8 +210,8 @@ } else if(aData.Keys().MdcaPoint(0).Compare(_L("MoreDevices"))==KErrNone) { + iNotification->RemoveObserver(); iNotification->Close(); // Also dequeues the notification from the queue. - iNotification->RemoveObserver(); iNotification = NULL; iDevices.ResetAndDestroy(); TRAP_IGNORE( { @@ -243,8 +245,13 @@ CBtDevExtension* devext = CBtDevExtension::NewLC( aAddr, aName ); iDevices.AppendL( devext ); CleanupStack::Pop( devext ); + + if(iNotification) + {// conditional check required as CAdvanceDevDiscoverer sends discovered devices at times + // even after canceldiscovery is issued and notification is set to NULL + // this causes EExcDataAbort CHbSymbianVariantMap* map = iNotification->Data(); - TBuf<8> keyStr; + TBuf keyStr; CHbSymbianVariant* devEntry; keyStr.Num( TBluetoothDialogParams::EDialogExt + iDevices.Count() - 1 ); @@ -252,6 +259,7 @@ CHbSymbianVariant::EDes ); map->Add( keyStr, devEntry ); iNotification->Update(); + } } // --------------------------------------------------------------------------- @@ -262,7 +270,7 @@ { (void) aErr; CHbSymbianVariantMap* map = iNotification->Data(); - TBuf<25> keyStr; + TBuf keyStr; //TODO compile fail here we need to send the discovery completed text to the dialog @@ -345,6 +353,11 @@ TBTDialogResourceId aResourceId ) { BOstraceFunctionEntry0( DUMMY_DEVLIST ); + if(iNotification) + { + iNotification->RemoveObserver(); + iNotification = NULL; + } iNotification = iServer.NotificationManager()->GetNotification(); User::LeaveIfNull( iNotification ); // For OOM exception, leaves with KErrNoMemory iNotification->SetObserver( this ); @@ -367,7 +380,7 @@ { iDevices.AppendL( devArray[i]->CopyL() ); CHbSymbianVariantMap* map = iNotification->Data(); - TBuf<8> keyStr; + TBuf keyStr; CHbSymbianVariant* devEntry; keyStr.Num( TBluetoothDialogParams::EDialogExt + iDevices.Count() - 1 ); diff -r 91746b151f97 -r 997690c3397a bluetoothengine/btnotif/btnotifsrv/src/btnotificationmanager.cpp --- a/bluetoothengine/btnotif/btnotifsrv/src/btnotificationmanager.cpp Fri Jun 11 13:48:51 2010 +0300 +++ b/bluetoothengine/btnotif/btnotifsrv/src/btnotificationmanager.cpp Wed Jun 23 18:23:52 2010 +0300 @@ -63,8 +63,10 @@ // CBTNotificationManager::~CBTNotificationManager() { + BOstraceFunctionEntry0( DUMMY_DEVLIST ); iNotificationQ.ResetAndDestroy(); iNotificationQ.Close(); + BOstraceFunctionExit0( DUMMY_DEVLIST ); } @@ -74,6 +76,7 @@ // CBluetoothNotification* CBTNotificationManager::GetNotification() { + BOstraceFunctionEntry0( DUMMY_DEVLIST ); CBluetoothNotification* notification = NULL; TRAP_IGNORE( notification = CBluetoothNotification::NewL( this ) ); if( notification ) @@ -86,6 +89,7 @@ notification = NULL; } } + BOstraceFunctionExit0( DUMMY_DEVLIST ); return notification; } @@ -96,17 +100,14 @@ // void CBTNotificationManager::ReleaseNotification( CBluetoothNotification* aNotification ) { + BOstraceFunctionEntry0( DUMMY_DEVLIST ); __ASSERT_ALWAYS( aNotification, PanicServer( EBTNotifPanicBadArgument ) ); TInt pos = iNotificationQ.Find( aNotification ); __ASSERT_ALWAYS( pos > KErrNotFound, PanicServer( EBTNotifPanicMissing ) ); + delete iNotificationQ[pos]; iNotificationQ.Remove( pos ); - // Just delete the notification. - delete aNotification; - if(!iNotificationQ.Count() ) - { - // the queue is empty, reset it. - iNotificationQ.Compress(); - } + iNotificationQ.Compress(); + BOstraceFunctionExit0( DUMMY_DEVLIST ); } @@ -118,10 +119,12 @@ CBluetoothNotification* aNotification, TNotificationPriority aPriority ) { + BOstraceFunctionEntry0( DUMMY_DEVLIST ); (void) aPriority; TInt pos = iNotificationQ.Find( aNotification ); __ASSERT_ALWAYS( pos > KErrNotFound, PanicServer( EBTNotifPanicMissing ) ); - if( /*aPriority == EPriorityHigh &&*/ pos != 0 ) + // Always move the newly added notification on top + if(pos != 0 ) { CBluetoothNotification* notification = NULL; notification = iNotificationQ[pos]; @@ -129,6 +132,7 @@ iNotificationQ.InsertL(notification,0); } ProcessNotificationQueueL(); + BOstraceFunctionExit0( DUMMY_DEVLIST ); } // --------------------------------------------------------------------------- @@ -137,6 +141,7 @@ // void CBTNotificationManager::ProcessNotificationQueueL() { + BOstraceFunctionEntry0( DUMMY_DEVLIST ); if( iNotificationQ.Count() ) { iNotificationQ[0]->ShowL(); @@ -146,5 +151,6 @@ // No outstanding notifications iNotificationQ.Compress(); // the queue is empty, reset it. } + BOstraceFunctionExit0( DUMMY_DEVLIST ); } diff -r 91746b151f97 -r 997690c3397a bluetoothengine/btnotif/btnotifsrv/src/btnotifincomingpairinghandler.cpp --- a/bluetoothengine/btnotif/btnotifsrv/src/btnotifincomingpairinghandler.cpp Fri Jun 11 13:48:51 2010 +0300 +++ b/bluetoothengine/btnotif/btnotifsrv/src/btnotifincomingpairinghandler.cpp Wed Jun 23 18:23:52 2010 +0300 @@ -16,9 +16,10 @@ */ #include "btnotifincomingpairinghandler.h" -#include "btnotifpairingmanager.h" +#include "btnotifsecuritymanager.h" #include "btnotifoutgoingpairinghandler.h" #include +#include "bluetoothtrace.h" const TInt KBTNotifWaitingForPairingOkDelay = 500000; // 0.5s @@ -37,7 +38,7 @@ // C++ default constructor // --------------------------------------------------------------------------- // -CBTNotifIncomingPairingHandler::CBTNotifIncomingPairingHandler( CBTNotifPairingManager& aParent, +CBTNotifIncomingPairingHandler::CBTNotifIncomingPairingHandler( CBTNotifSecurityManager& aParent, const TBTDevAddr& aAddr) : CBTNotifBasePairingHandler( aParent, aAddr ) { } @@ -48,22 +49,26 @@ // void CBTNotifIncomingPairingHandler::ConstructL() { + BOstraceFunctionEntry0( DUMMY_DEVLIST ); BaseConstructL(); iActivePairingOk = CBtSimpleActive::NewL(*this, EWaitingForPairingOk ); User::LeaveIfError( iPairingOkTimer.CreateLocal() ); + BOstraceFunctionExit0( DUMMY_DEVLIST ); } // --------------------------------------------------------------------------- // NewL // --------------------------------------------------------------------------- // -CBTNotifBasePairingHandler* CBTNotifIncomingPairingHandler::NewL( CBTNotifPairingManager& aParent, +CBTNotifBasePairingHandler* CBTNotifIncomingPairingHandler::NewL( CBTNotifSecurityManager& aParent, const TBTDevAddr& aAddr) { + BOstraceFunctionEntry0( DUMMY_DEVLIST ); CBTNotifIncomingPairingHandler* self = new (ELeave) CBTNotifIncomingPairingHandler(aParent, aAddr); CleanupStack::PushL( self ); self->ConstructL(); CleanupStack::Pop( self ); + BOstraceFunctionExit0( DUMMY_DEVLIST ); return self; } @@ -73,13 +78,13 @@ // CBTNotifIncomingPairingHandler::~CBTNotifIncomingPairingHandler() { - // TRACE_FUNC_ENTRY + BOstraceFunctionEntry0( DUMMY_DEVLIST ); // Cancel all outstanding requests CancelPlaNotification(); iPla.Close(); delete iActivePairingOk; iPairingOkTimer.Close(); - // TRACE_FUNC_EXIT + BOstraceFunctionExit0( DUMMY_DEVLIST ); } // --------------------------------------------------------------------------- @@ -89,13 +94,15 @@ // TInt CBTNotifIncomingPairingHandler::ObserveIncomingPair( const TBTDevAddr& aAddr ) { + BOstraceFunctionEntry0( DUMMY_DEVLIST ); TInt err( KErrServerBusy ); if ( iAddr == aAddr ) { err = KErrNone; - iUserAwarePairing = ETrue; // This function is called by a notifier, which means the UI has been involved + // This function is called by a notifier, which means the UI has been involved // Therefore we can display it in the paired devices list - if ( !iActive->IsActive() && !OpenPhysicalLinkAdaptor() ) + iUserAwarePairing = ETrue; + if ( !iActive->IsActive() && !OpenPhysicalLinkAdaptor() ) { // If we are observing physical link, or showing user a note, // we won't interrupt it. @@ -103,6 +110,7 @@ MonitorPhysicalLink(); } } + BOstraceFunctionExit0( DUMMY_DEVLIST ); return err; } @@ -112,12 +120,12 @@ // void CBTNotifIncomingPairingHandler::HandleOutgoingPairL( const TBTDevAddr& aAddr, TUint aCod ) { - // TRACE_FUNC_ENTRY + BOstraceFunctionEntry0( DUMMY_DEVLIST ); // Outgoing pairing always takes highest priority: CBTNotifBasePairingHandler* pairinghandler = CBTNotifOutgoingPairingHandler::NewL( iParent, aAddr ); pairinghandler->HandleOutgoingPairL( aAddr, aCod ); iParent.RenewPairingHandler( pairinghandler ); - // TRACE_FUNC_EXIT + BOstraceFunctionExit0( DUMMY_DEVLIST ); } // --------------------------------------------------------------------------- @@ -127,12 +135,12 @@ // void CBTNotifIncomingPairingHandler::StopPairHandling( const TBTDevAddr& aAddr ) { + BOstraceFunctionEntry0( DUMMY_DEVLIST ); if ( aAddr == iAddr ) { - // TRACE_FUNC_ENTRY iParent.RenewPairingHandler( NULL ); - // TRACE_FUNC_EXIT } + BOstraceFunctionExit0( DUMMY_DEVLIST ); } // --------------------------------------------------------------------------- @@ -141,14 +149,15 @@ // void CBTNotifIncomingPairingHandler::DoHandlePairServerResult( TInt aResult ) { + BOstraceFunctionEntry0( DUMMY_DEVLIST ); CancelPlaNotification(); // For a successful pairing, we need wait for registry table change. if( aResult != KErrNone && aResult != KHCIErrorBase ) { // Pair failure situation. SetPairResult( aResult ); - // todo: show pairing failure note. } + BOstraceFunctionExit0( DUMMY_DEVLIST ); } // --------------------------------------------------------------------------- @@ -158,7 +167,7 @@ // void CBTNotifIncomingPairingHandler::DoHandleRegistryNewPairedEvent( const TBTNamelessDevice& aDev ) { - // TRACE_FUNC_ENTRY + BOstraceFunctionEntry0( DUMMY_DEVLIST ); // First of all cancel the iPairingOkTimer timer, if active if (iActivePairingOk->IsActive()) @@ -176,7 +185,7 @@ // a service connection with phone. We won't take any action (e.g. remove // link key) in this case. As the result, this device can't be seen in our UI, // however other applications are still freely to use its services. - // TRACE_INFO(_L("[BTEng]: CBTEngIncPair: JW pairing with no IO device" ) ) + BOstrace0(TRACE_DEBUG,DUMMY_DEVLIST,"[BTNotif]: JW pairing with no IO device"); TBTEngConnectionStatus status = iParent.ConnectStatus( aDev.Address() ); if ( status == EBTEngConnecting || status == EBTEngConnected ) { @@ -184,14 +193,15 @@ // exception handling option: (void) iParent.AddUiCookieJustWorksPaired( aDev ); } + TRAP_IGNORE(ShowPairingResultNoteL(KErrNone)); iParent.RenewPairingHandler( NULL ); } else if (aDev.LinkKeyType() == ELinkKeyUnauthenticatedUpgradable && !iUserAwarePairing) { // The linkkey has been created by an incoming OBEX service request // which resulted a pairing event received from pair server. - // TRACE_INFO(_L("[BTEng]: CBTEngIncPair: JW pairing with IO device" ) ) - iParent.RenewPairingHandler( NULL ); + BOstrace0(TRACE_DEBUG,DUMMY_DEVLIST,"[BTNotif]: JW pairing with IO device"); + iParent.RenewPairingHandler( NULL ); } else { @@ -200,13 +210,14 @@ // The user was involved in the pairing, so display in the paired devices list (void) iParent.AddUiCookieJustWorksPaired(aDev); } - // TRACE_INFO(_L("[BTEng]: CBTEngIncPair: Non-JW pairing")) + BOstrace0(TRACE_DEBUG,DUMMY_DEVLIST,"[BTNotif]: Non-JW pairing"); // Other pairing model than Just Works: CancelPlaNotification(); SetPairResult( KErrNone ); + TRAP_IGNORE(ShowPairingResultNoteL(KErrNone)); iParent.RenewPairingHandler( NULL ); } - // TRACE_FUNC_EXIT + BOstraceFunctionExit0( DUMMY_DEVLIST ); } // --------------------------------------------------------------------------- @@ -215,13 +226,13 @@ // void CBTNotifIncomingPairingHandler::RequestCompletedL( CBtSimpleActive* aActive, TInt aStatus ) { - // TRACE_FUNC_ARG( ( _L( "aId: %d, aStatus: %d"), aId, aStatus ) ) - // Check which request completed. + BOstraceFunctionEntry0( DUMMY_DEVLIST ); + // Check which request completed. switch( aActive->RequestId() ) { case EPhysicalLinkNotify: { - // Check if the link has disconnected. + // Check if the link has disconnected. HandlePhysicalLinkResultL( aStatus ); break; } @@ -239,20 +250,21 @@ break; } default: - // Should not be possible, but no need for handling. + // Should not be possible, but no need for handling. break; } - // TRACE_FUNC_EXIT + BOstraceFunctionExit0( DUMMY_DEVLIST ); } // --------------------------------------------------------------------------- -// From class MBTEngActiveObserver. +// From class MBTNotifPairingAOObserver. // cancels an outstanding request according to the given id. // --------------------------------------------------------------------------- // void CBTNotifIncomingPairingHandler::CancelRequest( TInt aRequestId ) { + BOstraceFunctionEntry0( DUMMY_DEVLIST ); switch ( aRequestId ) { case EPhysicalLinkNotify: @@ -264,6 +276,7 @@ iPairingOkTimer.Cancel(); } } + BOstraceFunctionExit0( DUMMY_DEVLIST ); } // --------------------------------------------------------------------------- @@ -273,13 +286,14 @@ // void CBTNotifIncomingPairingHandler::HandleError( CBtSimpleActive* aActive, TInt aError ) { - // TRACE_FUNC_ARG( ( _L( "request id: %d, error: %d" ), aId, aError ) ) + BOstraceFunctionEntry0( DUMMY_DEVLIST ); (void) aActive; (void) aError; - // Our error handling is to just stop observing. - // Nothing critical to be preserved here, the user - // just won't get any notification of pairing result. + // Our error handling is to just stop observing. + // Nothing critical to be preserved here, the user + // just won't get any notification of pairing result. iParent.RenewPairingHandler( NULL ); + BOstraceFunctionExit0( DUMMY_DEVLIST ); } // --------------------------------------------------------------------------- @@ -289,14 +303,14 @@ // void CBTNotifIncomingPairingHandler::MonitorPhysicalLink() { - // TRACE_FUNC_ENTRY + BOstraceFunctionEntry0( DUMMY_DEVLIST ); iActive->SetRequestId( EPhysicalLinkNotify ); - // Subscribe to disconnect and error events. + // Subscribe to disconnect and error events. iPla.NotifyNextBasebandChangeEvent( iBbEvent, iActive->RequestStatus(), ENotifyPhysicalLinkDown | ENotifyPhysicalLinkError ); iActive->GoActive(); - // TRACE_FUNC_EXIT + BOstraceFunctionExit0( DUMMY_DEVLIST ); } // --------------------------------------------------------------------------- @@ -305,17 +319,18 @@ // TInt CBTNotifIncomingPairingHandler::OpenPhysicalLinkAdaptor() { - // TRACE_FUNC_ENTRY + BOstraceFunctionEntry0( DUMMY_DEVLIST ); TInt err ( KErrNone ); if( !iPla.IsOpen() ) { - // Try to open the adapter in case it failed earlier. - // This can happen for outgoing dedicated bonding with - // non-SSP device, as the PIN dialog can be kept open even - // though the link has dropped because of a time-out. + // Try to open the adapter in case it failed earlier. + // This can happen for outgoing dedicated bonding with + // non-SSP device, as the PIN dialog can be kept open even + // though the link has dropped because of a time-out. err = iPla.Open( iParent.SocketServ(), iAddr ); } - // TRACE_INFO( (_L("[BTEng]: CBTEngIncPair::HasPhysicalLink ? %d"), iPla.IsOpen() ) ) + BOstrace1(TRACE_DEBUG,DUMMY_DEVLIST,"[BTNotif]:HasPhysicalLink ? %d", iPla.IsOpen() ); + BOstraceFunctionExit0( DUMMY_DEVLIST ); return err; } @@ -325,13 +340,13 @@ // void CBTNotifIncomingPairingHandler::CancelPlaNotification() { - // TRACE_FUNC_ENTRY + BOstraceFunctionEntry0( DUMMY_DEVLIST ); if( iActive && iActive->RequestId() == EPhysicalLinkNotify ) { // cancel Baseband monitor iActive->Cancel(); } - // TRACE_FUNC_EXIT + BOstraceFunctionExit0( DUMMY_DEVLIST ); } // --------------------------------------------------------------------------- @@ -340,9 +355,8 @@ // void CBTNotifIncomingPairingHandler::HandlePhysicalLinkResultL( TInt aResult ) { - // TRACE_FUNC_ARG( ( _L( " BBEvent 0x%08X, code %d"), - // iBbEvent().EventType(), iBbEvent().SymbianErrorCode() ) ) - // Check if the connection is still alive. + BOstraceFunctionEntry0( DUMMY_DEVLIST ); + // Check if the connection is still alive. TBool physicalLinkDown = ( iBbEvent().EventType() == ENotifyPhysicalLinkDown | ENotifyPhysicalLinkError ); @@ -361,7 +375,7 @@ // Uninteresting event, re-subscribe. MonitorPhysicalLink(); } - // TRACE_FUNC_EXIT + BOstraceFunctionExit0( DUMMY_DEVLIST ); } diff -r 91746b151f97 -r 997690c3397a bluetoothengine/btnotif/btnotifsrv/src/btnotifoutgoingpairinghandler.cpp --- a/bluetoothengine/btnotif/btnotifsrv/src/btnotifoutgoingpairinghandler.cpp Fri Jun 11 13:48:51 2010 +0300 +++ b/bluetoothengine/btnotif/btnotifsrv/src/btnotifoutgoingpairinghandler.cpp Wed Jun 23 18:23:52 2010 +0300 @@ -18,7 +18,8 @@ #include "btnotifoutgoingpairinghandler.h" #include #include -#include "btnotifpairingmanager.h" +#include "btnotifsecuritymanager.h" +#include "bluetoothtrace.h" /** Length of the default PIN. */ const TInt KDefaultHeadsetPinLength = 4; @@ -70,7 +71,7 @@ // C++ default constructor // --------------------------------------------------------------------------- // -CBTNotifOutgoingPairingHandler::CBTNotifOutgoingPairingHandler( CBTNotifPairingManager& aParent, const TBTDevAddr& aAddr) +CBTNotifOutgoingPairingHandler::CBTNotifOutgoingPairingHandler( CBTNotifSecurityManager& aParent, const TBTDevAddr& aAddr) : CBTNotifBasePairingHandler( aParent, aAddr ) { } @@ -89,7 +90,7 @@ // NewL // --------------------------------------------------------------------------- // -CBTNotifBasePairingHandler* CBTNotifOutgoingPairingHandler::NewL( CBTNotifPairingManager& aParent, +CBTNotifBasePairingHandler* CBTNotifOutgoingPairingHandler::NewL( CBTNotifSecurityManager& aParent, const TBTDevAddr& aAddr ) { CBTNotifOutgoingPairingHandler* self = new( ELeave ) CBTNotifOutgoingPairingHandler( aParent, aAddr ); @@ -129,7 +130,7 @@ // void CBTNotifOutgoingPairingHandler::HandleOutgoingPairL( const TBTDevAddr& aAddr, TUint aCod ) { - // TRACE_FUNC_ARG( ( _L(" cod 0x%08x"), aCod ) ) + BOstrace1(TRACE_DEBUG,DUMMY_DEVLIST," cod 0x%08x", aCod ); if ( iActive->IsActive() || aAddr != iAddr ) { // we don't allow another pairing request. @@ -149,7 +150,6 @@ { iPairMode = EBTOutgoingNoneHeadsetPairing; } - // SetOutgoPairProperty( iOutgoProperty, iAddr, iPairMode ); DoPairingL(); } @@ -159,6 +159,7 @@ // void CBTNotifOutgoingPairingHandler::CancelOutgoingPair() { + BOstraceFunctionEntry0( DUMMY_DEVLIST ); iParent.RenewPairingHandler( NULL ); } @@ -171,6 +172,7 @@ void CBTNotifOutgoingPairingHandler::GetPinCode( TBTPinCode& aPin, const TBTDevAddr& aAddr, TInt aMinPinLength ) { + BOstraceFunctionEntry0( DUMMY_DEVLIST ); aPin().iLength = 0; if ( aMinPinLength <= KDefaultHeadsetPinLength && aAddr == iAddr @@ -195,6 +197,7 @@ // void CBTNotifOutgoingPairingHandler::StopPairHandling( const TBTDevAddr& aAddr ) { + BOstraceFunctionEntry0( DUMMY_DEVLIST ); if ( aAddr == iAddr ) { iParent.OutgoingPairCompleted( KErrCancel ); @@ -208,6 +211,7 @@ // void CBTNotifOutgoingPairingHandler::DoHandlePairServerResult( TInt aResult ) { + BOstraceFunctionEntry0( DUMMY_DEVLIST ); if (aResult == (KHCIErrorBase-EPairingNotAllowed)) { // if EPairingNotAllowed is recieved then any further pairing attempts will fail @@ -223,6 +227,7 @@ void CBTNotifOutgoingPairingHandler::DoHandleRegistryNewPairedEvent( const TBTNamelessDevice& aDev ) { + BOstraceFunctionEntry0( DUMMY_DEVLIST ); TInt err( KErrNone ); // If pairing was performed using Just Works mode, we set a // UICookie to indicate that the device is successfully @@ -230,11 +235,14 @@ // bluetooth application: if ( aDev.LinkKeyType() == ELinkKeyUnauthenticatedNonUpgradable ) { - // TRACE_INFO( ( _L( "[BTENG] CBTEngOtgPair, Just Works pairing" ) ) ); + BOstrace0(TRACE_DEBUG,DUMMY_DEVLIST,"[BTNOTIF] Outgoing Pairing, Just Works pairing"); err = iParent.AddUiCookieJustWorksPaired( aDev ); } iActive->Cancel(); SetPairResult( err ? err : KErrNone ); + if(err == KErrNone){ + TRAP_IGNORE(ShowPairingResultNoteL(err)); + } iParent.OutgoingPairCompleted( err ); iParent.RenewPairingHandler( NULL ); } @@ -248,7 +256,8 @@ void CBTNotifOutgoingPairingHandler::RequestCompletedL( CBtSimpleActive* aActive, TInt aStatus ) { - // TRACE_FUNC_ARG( ( _L( "reqid %d, status: %d, pair mode %d " ), aId, aStatus, iPairMode ) ) + BOstraceFunctionEntry0( DUMMY_DEVLIST ); + BOstraceExt3(TRACE_DEBUG,DUMMY_DEVLIST,"reqid %d, status: %d, pair mode %d ", aActive->RequestId(), aStatus, iPairMode); if( aActive->RequestId() == EDedicatedBonding && ( aStatus == KErrRemoteDeviceIndicatedNoBonding || ( aStatus && iPairMode != EBTOutgoingNoneHeadsetPairing && iPairMode != EBTOutgoingPairNone ) ) ) @@ -261,8 +270,7 @@ { iPairMode = EBTOutgoingHeadsetManualPairing; // auto pairing with headset failed, try to pair again with manual pin: - // ( void ) SetOutgoPairProperty( iOutgoProperty, iAddr, iPairMode ); - // TRACE_INFO( _L( " auto pairing failed, switch to manual pairing") ); + BOstrace0(TRACE_DEBUG,DUMMY_DEVLIST," auto pairing failed, switch to manual pairing"); DoPairingL(); } else if ( aStatus && aActive->RequestId() == EGeneralBonding && @@ -288,7 +296,6 @@ } if ( aStatus ) { - // todo: show error note? iParent.OutgoingPairCompleted( aStatus ); } } @@ -301,6 +308,7 @@ // void CBTNotifOutgoingPairingHandler::CancelRequest( TInt aRequestId ) { + BOstraceFunctionEntry0( DUMMY_DEVLIST ); switch ( aRequestId ) { case EDedicatedBonding: @@ -328,7 +336,7 @@ void CBTNotifOutgoingPairingHandler::HandleError( CBtSimpleActive* aActive, TInt aError ) { - // TRACE_FUNC_ARG( ( _L( "error: %d" ), aError ) ) + BOstrace1(TRACE_DEBUG,DUMMY_DEVLIST,"error: %d", aError ); // Our RunL can actually not leave, so we should never reach here. (void) aActive; iParent.OutgoingPairCompleted( aError ); @@ -341,7 +349,7 @@ // void CBTNotifOutgoingPairingHandler::DoPairingL() { - // TRACE_FUNC_ENTRY + BOstraceFunctionEntry0( DUMMY_DEVLIST ); TPairingStageId currentMode = ( TPairingStageId ) iActive->RequestId(); ASSERT( !iActive->IsActive() ); TPairingStageId nextMode( EGeneralBonding ); @@ -357,7 +365,7 @@ nextMode = EGeneralBondingRetry; } - // TRACE_INFO( ( _L( "[BTENG] CBTEngOtgPair::DoPairingL: bonding mode: pre %d, next %d"), currentMode, nextMode ) ); + BOstraceExt2(TRACE_DEBUG,DUMMY_DEVLIST,"[BTENG] CBTEngOtgPair::DoPairingL: bonding mode: pre %d, next %d", currentMode, nextMode); iActive->SetRequestId( nextMode ); if ( nextMode == EDedicatedBonding ) @@ -376,6 +384,6 @@ iSocket.Connect( iSockAddr, iActive->RequestStatus() ); } iActive->GoActive(); - // TRACE_FUNC_EXIT + BOstraceFunctionExit0( DUMMY_DEVLIST ); } diff -r 91746b151f97 -r 997690c3397a bluetoothengine/btnotif/btnotifsrv/src/btnotifpairingmanager.cpp --- a/bluetoothengine/btnotif/btnotifsrv/src/btnotifpairingmanager.cpp Fri Jun 11 13:48:51 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,809 +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 "btnotifpairingmanager.h" -#include "btnotifoutgoingpairinghandler.h" -#include "btnotifincomingpairinghandler.h" -#include "btnotifpairnotifier.h" -#include "btnotifclientserver.h" -#include -#include "btnotifconnectiontracker.h" - -/** Identification for active object */ -enum TPairManActiveRequestId - { - ESimplePairingResult, - EAuthenticationResult, - ERegistryGetLocalAddress, - }; - -// --------------------------------------------------------------------------- -// Tells if two TBTNamelessDevice instances are for the same remote device -// --------------------------------------------------------------------------- -// -TBool CompareDeviceByAddress( const TBTNamelessDevice& aDevA, const TBTNamelessDevice& aDevB ) - { - return aDevA.Address() == aDevB.Address(); - } - -// --------------------------------------------------------------------------- -// Tells if these two instances are for the same remote device -// --------------------------------------------------------------------------- -// -TBool MatchDeviceAddress(const TBTDevAddr* aAddr, const TBTNamelessDevice& aDev) - { - return *aAddr == aDev.Address(); - } - -// ======== MEMBER FUNCTIONS ======== - -// --------------------------------------------------------------------------- -// C++ default constructor -// --------------------------------------------------------------------------- -// -CBTNotifPairingManager::CBTNotifPairingManager( - CBTNotifConnectionTracker& aParent, - CBtDevRepository& aDevRepository) - : iParent( aParent ), iDevRepository( aDevRepository ) - { - } - -// --------------------------------------------------------------------------- -// Symbian 2nd-phase constructor -// --------------------------------------------------------------------------- -// -void CBTNotifPairingManager::ConstructL() - { - // Connect to pairing server for authentication & simple pairing - // results directly from the BT stack. - // Pairing server doesn't exist if we run BT 2.0 stack: - iPairingServ = new (ELeave) RBluetoothPairingServer; - TInt err = iPairingServ->Connect(); - if ( err) - { - delete iPairingServ; - iPairingServ = NULL; - } - else - { - User::LeaveIfError( iPairingResult.Open( *iPairingServ ) ); - User::LeaveIfError( iAuthenResult.Open( *iPairingServ ) ); - iSSPResultActive = CBtSimpleActive::NewL( *this, ESimplePairingResult ); - iAuthenResultActive = CBtSimpleActive::NewL( *this, EAuthenticationResult ); - SubscribeSspPairingResult(); - SubscribeAuthenticateResult(); - } - User::LeaveIfError( iRegistry.Open( iParent.RegistryServerSession() ) ); - // RProperty for accessing the local device address - User::LeaveIfError( iPropertyLocalAddr.Attach( - KPropertyUidBluetoothCategory, KPropertyKeyBluetoothGetLocalDeviceAddress) ); - // Initialise paired devices list - iLocalAddrActive = CBtSimpleActive::NewL( *this, ERegistryGetLocalAddress ); - SubscribeLocalAddress(); - iPairNotifier = CBTNotifPairNotifier::NewL( *this ); - iDevRepository.AddObserverL( this ); - } - -// --------------------------------------------------------------------------- -// NewL -// --------------------------------------------------------------------------- -// -CBTNotifPairingManager* CBTNotifPairingManager::NewL( - CBTNotifConnectionTracker& aParent, - CBtDevRepository& aDevRepository ) - { - CBTNotifPairingManager* self = NULL; - self = new CBTNotifPairingManager( aParent, aDevRepository ); - CleanupStack::PushL( self ); - self->ConstructL(); - CleanupStack::Pop( self ); - return self; - } - -// --------------------------------------------------------------------------- -// Destructor -// --------------------------------------------------------------------------- -// -CBTNotifPairingManager::~CBTNotifPairingManager() - { - delete iSSPResultActive; - delete iAuthenResultActive; - delete iPairNotifier; - delete iPairingHandler; - iPairedDevices.Close(); - iPairingResult.Close(); - iAuthenResult.Close(); - if ( iPairingServ ) - { - iPairingServ->Close(); - delete iPairingServ; - } - iRegistry.Close(); - delete iLocalAddrActive; - iPropertyLocalAddr.Close(); - if ( !iMessage.IsNull() ) - { - iMessage.Complete( KErrCancel ); - } - } - -// --------------------------------------------------------------------------- -// Initialises the paired devices list. -// If the local address is not available from the P&S key -// KPropertyKeyBluetoothGetLocalDeviceAddress, then the list may need to be -// updated once the H/W is switched on. This is so that any registry update -// from a restore operation can be included in the list, without mistaking the -// new devices for new pairings. -// --------------------------------------------------------------------------- -// -void CBTNotifPairingManager::SubscribeLocalAddress() - { - // Check that we have the Bluetooth local address. If we don't then initialise anyway, but subscribe for an update. - // This allows us to refresh our paired devices list to include updates made to the remote devices table of the - // Bluetooth registry from a restore operation. We need to include these devices without mistaking them for new - // pairings. We look solely at the P&S key for the address to avoid the condition whereby the address has been - // entered into the reigstry but the Bluetooth Manager server has not begun the restore process yet. The signalling - // of the P&S key will cause Bluetooth Manager to update the registry with any restored devices before fulfilling - // any further requests. - - // Subscribe to local address property in case we need an update. - iPropertyLocalAddr.Subscribe( iLocalAddrActive->iStatus ); - iLocalAddrActive->SetRequestId( ERegistryGetLocalAddress ); - iLocalAddrActive->GoActive(); - } - -// --------------------------------------------------------------------------- -// Tells whether the local address is available from the P&S key -// KPropertyKeyBluetoothGetLocalDeviceAddress. -// --------------------------------------------------------------------------- -// -TBool CBTNotifPairingManager::IsLocalAddressAvailable() - { - // Attempt to read address from P&S key. - TBuf8 btAddrDes; - TInt err = iPropertyLocalAddr.Get( btAddrDes ); - - // Is the P&S key defined yet? (if not, stack not up yet) - if ( err == KErrNone ) - { - // P&S key defined, is local address set? (if not, H/W not initialised yet) - if ( btAddrDes.Length() == KBTDevAddrSize ) - { - TBTDevAddr btAddr = btAddrDes; - if ( btAddr != TBTDevAddr() ) - { - return ETrue; - } - } - } - return EFalse; - } - -// --------------------------------------------------------------------------- -// Handles pairing related requests from BTNotif clients. -// --------------------------------------------------------------------------- -// -void CBTNotifPairingManager::HandleBondingRequestL( const RMessage2& aMessage ) - { - TInt opcode = aMessage.Function(); - TBTDevAddrPckgBuf addrPkg; - switch( opcode ) - { - case EBTNotifPairDevice: - { - if ( !iMessage.IsNull() ) - { - User::Leave( KErrServerBusy ); - } - TBTDevAddrPckgBuf addrPkg; - aMessage.ReadL( EBTNotifSrvParamSlot, addrPkg ); - UnpairDevice( addrPkg() ); - PairDeviceL( addrPkg(), aMessage.Int2() ); - iMessage = RMessage2( aMessage ); - break; - } - case EBTNotifCancelPairDevice: - { - // Only the client who requested pairing can cancel it: - if ( !iMessage.IsNull() && aMessage.Session() == iMessage.Session() ) - { - iPairingHandler->CancelOutgoingPair(); - iMessage.Complete( KErrCancel ); - } - aMessage.Complete( KErrNone ); - break; - } - default: - { - User::Leave( KErrArgument ); - } - } - } - -// --------------------------------------------------------------------------- -// Process a client message related to notifiers. -// --------------------------------------------------------------------------- -// -void CBTNotifPairingManager::HandlePairingNotifierRequestL( const RMessage2& aMessage ) - { - iPairNotifier->StartPairingNotifierL( aMessage ); - BOstraceFunctionExit1( DUMMY_DEVLIST, this ); - } - -// --------------------------------------------------------------------------- -// Returns the RBluetoothPairingServer instance. -// --------------------------------------------------------------------------- -// -RBluetoothPairingServer* CBTNotifPairingManager::PairingServer() - { - return iPairingServ; - } - -// --------------------------------------------------------------------------- -// Access the reference of RSockServ -// --------------------------------------------------------------------------- -// -RSocketServ& CBTNotifPairingManager::SocketServ() - { - return iParent.SocketServerSession(); - } - -// --------------------------------------------------------------------------- -// Access the reference of RBTRegSrv -// --------------------------------------------------------------------------- -// -CBtDevRepository& CBTNotifPairingManager::BTDevRepository() - { - return iDevRepository; - } - -// --------------------------------------------------------------------------- -// Access the reference of CBTNotifConnectionTracker -// --------------------------------------------------------------------------- -// -CBTNotifConnectionTracker& CBTNotifPairingManager::ConnectionTracker() - { - return iParent; - } - -// --------------------------------------------------------------------------- -// Deletes the current pairing handler and transfer the responsibility -// to the specified. -// --------------------------------------------------------------------------- -// -void CBTNotifPairingManager::RenewPairingHandler( - CBTNotifBasePairingHandler* aPairingHandler ) - { - delete iPairingHandler; - iPairingHandler = aPairingHandler; - } - -// --------------------------------------------------------------------------- -// Find the session who requested this and completes its request. -// --------------------------------------------------------------------------- -// -void CBTNotifPairingManager::OutgoingPairCompleted( TInt aErr ) - { - // the meaning of KHCIErrorBase equals KErrNone. Hide this specific BT stack - // detail from clients: - if ( !iMessage.IsNull() ) - { - iMessage.Complete( (aErr == KHCIErrorBase) ? KErrNone : aErr ); - } - } - -// --------------------------------------------------------------------------- -// A session will be ended, completes the pending request for this session. -// --------------------------------------------------------------------------- -// -void CBTNotifPairingManager::SessionClosed( CSession2* aSession ) - { - // TRACE_FUNC_ARG( ( _L( " session %x"), aSession ) ) - if ( !iMessage.IsNull() && iMessage.Session() == aSession ) - { - iMessage.Complete( KErrCancel ); - } - } - -// --------------------------------------------------------------------------- -// Unpair the device from registry -// --------------------------------------------------------------------------- -// -void CBTNotifPairingManager::UnpairDevice( const TBTDevAddr& aAddr ) - { - TIdentityRelation addrComp( CompareDeviceByAddress ); - TBTNamelessDevice dev; - dev.SetAddress( aAddr ); - // only do unpairing if the we have a link key with it. - TInt index = iPairedDevices.Find( dev, addrComp ); - if ( index > KErrNotFound ) - { - dev = iPairedDevices[index]; - TRequestStatus status( KRequestPending ); - // Unpair the device in registry (synchronously) - iRegistry.UnpairDevice( dev.Address(), status ); - User::WaitForRequest( status ); - // TRACE_INFO( ( _L( "Delete link key, res %d"), status.Int() ) ) - if ( status == KErrNone ) - { - TBTDeviceSecurity security = dev.GlobalSecurity(); - // Clear trust setting so that correct icon will be shown in ui applications. - security.SetNoAuthenticate(EFalse ); - security.SetNoAuthorise(EFalse ); - dev.SetGlobalSecurity(security); - dev.DeleteLinkKey(); - if ( dev.IsValidUiCookie() && - ( dev.UiCookie() & EBTUiCookieJustWorksPaired ) ) - { - // Remove the UI cookie bit for Just Works pairing. - TInt32 cookie = dev.UiCookie() & ~EBTUiCookieJustWorksPaired; - dev.SetUiCookie( cookie ); - // TRACE_INFO( ( _L( "UI cookie %x cleared"), EBTUiCookieJustWorksPaired ) ); - } - // modify the device in registry synchronously - // status.Int() could be -1 if the device is not in registry - // which is totally fine for us. - (void) UpdateRegDevice( dev ); - } - } - } - -TInt CBTNotifPairingManager::AddUiCookieJustWorksPaired( const TBTNamelessDevice& aDev ) - { - TInt err( KErrNone ); - // There might be UI cookies used by other applications, - // we should not overwrite them. - TInt32 cookie = aDev.IsValidUiCookie() ? aDev.UiCookie() : EBTUiCookieUndefined; - if ( !( cookie & EBTUiCookieJustWorksPaired ) ) - { - // Only update the cookie if the wanted one is not in registry yet - // to keep minimal operations with registry. - TBTNamelessDevice dev = aDev; - cookie |= EBTUiCookieJustWorksPaired; - dev.SetUiCookie( cookie ); - err = UpdateRegDevice( dev ); - // TRACE_INFO( ( _L( "[BTENG] CBTEngOtgPair write Ui cookie ret %d"), err ) ); - } - return err; - } - -// --------------------------------------------------------------------------- -// update a nameless device in registry -// --------------------------------------------------------------------------- -// -TInt CBTNotifPairingManager::UpdateRegDevice( const TBTNamelessDevice& aDev ) - { - TRequestStatus status( KRequestPending ); - // update the device in registry synchronously - iRegistry.ModifyDevice( aDev, status ); - User::WaitForRequest( status ); - // TRACE_INFO( ( _L( "UpdateRegDevice, ret %d"), status.Int() ) ) - return status.Int(); - } - -// --------------------------------------------------------------------------- -// 0000 for outgoing pairing with a headset. -// The placeholder for future extension (pin code passed in for pairing) -// --------------------------------------------------------------------------- -// -void CBTNotifPairingManager::GetPinCode( - TBTPinCode& aPin, const TBTDevAddr& aAddr, TInt aMinPinLength ) - { - if ( iPairingHandler ) - { - iPairingHandler->GetPinCode( aPin, aAddr, aMinPinLength ); - } - else - { - // make sure not to leave any text as PIN. - aPin.Zero(); - } - } - -// --------------------------------------------------------------------------- -// Ask server class the connection status of the specified device -// --------------------------------------------------------------------------- -// -TBTEngConnectionStatus CBTNotifPairingManager::ConnectStatus( const TBTDevAddr& aAddr ) - { - const CBtDevExtension* devExt = iDevRepository.Device(aAddr); - TBTEngConnectionStatus status = EBTEngNotConnected; - if ( devExt ) - { - status = devExt->ServiceConnectionStatus(); - } - return status; - } - -// --------------------------------------------------------------------------- -// From class MBTNotifPairingAOObserver. -// Checks if there is an authentication result. -// --------------------------------------------------------------------------- -// -void CBTNotifPairingManager::RequestCompletedL( CBtSimpleActive* aActive, TInt aStatus ) - { - // TRACE_FUNC_ARG( ( _L( "aId: %d, aStatus: %d"), aId, aStatus ) ) - // Check which request is completed. - switch( aActive->RequestId() ) - { - case ESimplePairingResult: - { - TBTDevAddr tmpAddr = iSimplePairingRemote; - if (aStatus != KErrServerTerminated) - { - SubscribeSspPairingResult(); - } - HandlePairingResultL( tmpAddr, aStatus ); - break; - } - case EAuthenticationResult: - { - TBTDevAddr tmpAddr = iAuthenticateRemote; - if (aStatus != KErrServerTerminated) - { - SubscribeAuthenticateResult(); - } - HandlePairingResultL( tmpAddr, aStatus ); - break; - } - case ERegistryGetLocalAddress: - { - TBool value = IsLocalAddressAvailable(); - SubscribeLocalAddress(); - if ( value ) - { - // Refresh paired devices list to include any restored devices. - iDevRepository.ReInitialize(); - } - break; - } - default: - // Should not be possible, but no need for handling. - break; - } - } - -// --------------------------------------------------------------------------- -// From class MBTEngActiveObserver. -// cancels an outstanding request according to the given id. -// --------------------------------------------------------------------------- -// -void CBTNotifPairingManager::CancelRequest( TInt aRequestId ) - { - switch ( aRequestId ) - { - case ESimplePairingResult: - { - // Cancel listening Simple pairing result - iPairingResult.CancelSimplePairingResult(); - break; - } - case EAuthenticationResult: - { - // Cancel listening authentication result - iAuthenResult.CancelAuthenticationResult(); - break; - } - case ERegistryGetLocalAddress: - { - // cancel listening local address status change - iPropertyLocalAddr.Cancel(); - break; - } - } - } - -// --------------------------------------------------------------------------- -// From class MBtSimpleActiveObserver. -// --------------------------------------------------------------------------- -// -void CBTNotifPairingManager::HandleError( CBtSimpleActive* aActive, TInt aError ) - { - // TRACE_FUNC_ARG( ( _L( "request id: %d, error: %d" ), aId, aError ) ) - (void) aActive; - (void) aError; - } - -// --------------------------------------------------------------------------- -// From class MBtDevRepositoryObserver. -// --------------------------------------------------------------------------- -// -void CBTNotifPairingManager::RepositoryInitialized() - { - TRAPD(err, UpdatePairedDeviceListL() ); - if ( !err && iPairingHandler ) - { - // non-null pairing handler means we are involved in a - // pairing operation already. - // todo: is some handling for above case needed? - } - } - -// --------------------------------------------------------------------------- -// From class MBtDevRepositoryObserver. -// --------------------------------------------------------------------------- -// -void CBTNotifPairingManager::DeletedFromRegistry( const TBTDevAddr& aAddr ) - { - // We are only interested in the removal of a paired device. - // thus check whether it is in our local paired list: - TInt i = iPairedDevices.Find( aAddr, MatchDeviceAddress); - if ( i > KErrNotFound ) - { - iPairedDevices.Remove( i ); - } - } - -// --------------------------------------------------------------------------- -// From class MBtDevRepositoryObserver. -// --------------------------------------------------------------------------- -// -void CBTNotifPairingManager::AddedToRegistry( const CBtDevExtension& aDevice ) - { - // We are only interested in paired device. - if ( CBtDevExtension::IsBonded( aDevice.Device().AsNamelessDevice() ) ) - { - TRAP_IGNORE( - HandleRegistryBondingL( aDevice.Device().AsNamelessDevice() ) ); - } - } - - -// --------------------------------------------------------------------------- -// From class MBtDevRepositoryObserver. -// --------------------------------------------------------------------------- -// -void CBTNotifPairingManager::ChangedInRegistry( - const CBtDevExtension& aDevice, TUint aSimilarity ) - { - // We are only interested in paired device. - // thus check whether it is in our local paired list: - TInt i = iPairedDevices.Find( aDevice.Addr(), MatchDeviceAddress); - TBool bonded = CBtDevExtension::IsBonded( aDevice.Device().AsNamelessDevice() ); - if ( i == KErrNotFound ) - { - if ( bonded ) - { - TRAP_IGNORE( - HandleRegistryBondingL( - aDevice.Device().AsNamelessDevice() ) ); - } - return; - } - // Device was inregistry before, but we need to evaluate its bonding - // status. - // The given similarity will tell if the linkkey and paired is changed - // or not. - TInt pairingProperty = TBTNamelessDevice::EIsPaired - | TBTNamelessDevice::ELinkKey; - if ( ( pairingProperty & aSimilarity) == pairingProperty ) - { - // no pairing or linkkey change. Nothing to do for pairing handling. - // but we'd better update local copy just in case other data - // of this device is needed by someone: - iPairedDevices[i] = aDevice.Device().AsNamelessDevice(); - return; - } - if ( !CBtDevExtension::IsBonded( aDevice.Device().AsNamelessDevice() ) ) - { - // device is not user-bonded. - iPairedDevices.Remove( i ); - return; - } - // it is a new paired device if its link-key has been upgraded - if ( aDevice.Device().LinkKeyType() != ELinkKeyUnauthenticatedUpgradable ) - { - iPairedDevices.Remove( i ); - TRAP_IGNORE( - HandleRegistryBondingL( - aDevice.Device().AsNamelessDevice() ) ); - } - } - -// --------------------------------------------------------------------------- -// From class MBtDevRepositoryObserver. -// This class is not interested in such events. -// --------------------------------------------------------------------------- -// -void CBTNotifPairingManager::ServiceConnectionChanged( - const CBtDevExtension& aDevice, TBool aConnected ) - { - (void) aDevice; - (void) aConnected; - } - -// --------------------------------------------------------------------------- -// Activate or deactivate a pairing handler -// --------------------------------------------------------------------------- -// -TInt CBTNotifPairingManager::SetPairObserver(const TBTDevAddr& aAddr, TBool aActivate) - { - // TRACE_FUNC_ARG( ( _L( "%d" ), aActivate ) ) - // TRACE_BDADDR( aAddr ) - TInt err( KErrNone ); - if ( !aActivate ) - { - if ( iPairingHandler ) - { - iPairingHandler->StopPairHandling( aAddr ); - } - return err; - } - - if ( !iPairingHandler) - { - // This is an incoming pair, unpair it from registry and - // create the handler: - UnpairDevice( aAddr ); - TRAP( err, iPairingHandler = CBTNotifIncomingPairingHandler::NewL( *this, aAddr )); - } - if ( iPairingHandler) - { - // let the handler decide what to do: - err = iPairingHandler->ObserveIncomingPair( aAddr ); - } - return err; - } - -// --------------------------------------------------------------------------- -// Delegates the request to current pair handler -// --------------------------------------------------------------------------- -// -void CBTNotifPairingManager::PairDeviceL( const TBTDevAddr& aAddr, TUint32 aCod ) - { - if ( !iPairingHandler) - { - // no existing pair handling, create one: - iPairingHandler = CBTNotifOutgoingPairingHandler::NewL( *this, aAddr ); - } - // let pair handler decide what to do: - iPairingHandler->HandleOutgoingPairL( aAddr, aCod ); - } - -// --------------------------------------------------------------------------- -// cancel Subscribings to simple pairing result and authentication result from -// Pairing Server -// --------------------------------------------------------------------------- -// -void CBTNotifPairingManager::CancelSubscribePairingAuthenticate() - { - if( iSSPResultActive ) - { - // Cancel listening Simple pairing result - iSSPResultActive->Cancel(); - } - if( iAuthenResultActive ) - { - iAuthenResultActive->Cancel(); - } - } - -// --------------------------------------------------------------------------- -// Subscribes to simple pairing result from Pairing Server (if not already -// subscribed). -// --------------------------------------------------------------------------- -// -void CBTNotifPairingManager::SubscribeSspPairingResult() - { - if ( !iSSPResultActive->IsActive() ) - { - iPairingResult.SimplePairingResult( iSimplePairingRemote, iSSPResultActive->RequestStatus() ); - iSSPResultActive->GoActive(); - } - } - -// --------------------------------------------------------------------------- -// Subscribes to authentication result from Pairing Server (if not already -// subscribed). -// --------------------------------------------------------------------------- -// -void CBTNotifPairingManager::SubscribeAuthenticateResult() - { - if ( !iAuthenResultActive->IsActive() ) - { - // Subscribe authentication result (which requires pairing for unpaired devices) - iAuthenResult.AuthenticationResult( iAuthenticateRemote, iAuthenResultActive->RequestStatus() ); - iAuthenResultActive->GoActive(); - } - } - -// --------------------------------------------------------------------------- -// Handle a pairing result from the pairing server. -// --------------------------------------------------------------------------- -// -void CBTNotifPairingManager::HandlePairingResultL( const TBTDevAddr& aAddr, TInt aResult ) - { - // TRACE_FUNC_ARG( (_L("result %d"), aResult ) ) - // TRACE_BDADDR( aAddr ); - if ( !iPairingHandler && ( aResult == KErrNone || aResult == KHCIErrorBase ) ) - { - // we only create new handler if incoming pairing succeeds. - // Pairing failure could be caused by user local cancellation, as the - // result, the handler was destroyed by notifier. We shall not - // instantiate the handler again. - // If a pairing failed due to other reasons than user local cancelling, - // it will be catched by the already started handler - // (except Just Works pairing - no handler for it at all until we receive - // registry change event. Thus if incoming JWs pairing failed, no user - // notification will be shown.) - iPairedDevices.Find( aAddr, MatchDeviceAddress); - TInt index = iPairedDevices.Find( aAddr, MatchDeviceAddress); - // If the device is not found in the old paired device list, it is a new - // paired device: - if ( index == KErrNotFound) - { - // No handler yet, create incoming pairing handler: - iPairingHandler = CBTNotifIncomingPairingHandler::NewL( *this, aAddr ); - } - } - if ( iPairingHandler ) - { - iPairingHandler->HandlePairServerResult( aAddr, aResult ); - } - } - -// --------------------------------------------------------------------------- -// copy the nameless devices to local array -// --------------------------------------------------------------------------- -// -void CBTNotifPairingManager::UpdatePairedDeviceListL() - { - iPairedDevices.Reset(); - const RDevExtensionArray& alldevs = iDevRepository.AllDevices(); - for ( TInt i = 0; i < alldevs.Count(); i++ ) - { - // TRACE_BDADDR( iPairedDevicesResp->Results()[i]->BDAddr() ); - // TRACE_INFO((_L("[BTENG]\t linkkeytype %d"), - // iPairedDevicesResp->Results()[i]->LinkKeyType())) - if ( CBtDevExtension::IsBonded( alldevs[i]->Device().AsNamelessDevice() ) ) - { - iPairedDevices.AppendL( alldevs[i]->Device().AsNamelessDevice() ); - } - } - } - -// --------------------------------------------------------------------------- -// Create incoming pairing handler if no one exists yet. -// --------------------------------------------------------------------------- -// -void CBTNotifPairingManager::HandleRegistryBondingL( - const TBTNamelessDevice& aNameless) - { - TInt err = iPairedDevices.Append( aNameless ); - if ( !err && !iPairingHandler) - { - // New paired device, but no pairing handler yet. - // this means an incoming pairing has occured: - TRAP( err, iPairingHandler = - CBTNotifIncomingPairingHandler::NewL( *this, aNameless.Address() ) ); - } - if ( !err ) - { - // We have a pairing handler now. - // Ask pair handler to decide what to do: - iPairingHandler->HandleRegistryNewPairedEvent( - aNameless ); - } - else if ( iPairingHandler ) - { - // error could occur due to no memory, - // let us try aborting pairing handling - iPairingHandler->StopPairHandling( aNameless.Address() ); - } - } - - diff -r 91746b151f97 -r 997690c3397a bluetoothengine/btnotif/btnotifsrv/src/btnotifpairnotifier.cpp --- a/bluetoothengine/btnotif/btnotifsrv/src/btnotifpairnotifier.cpp Fri Jun 11 13:48:51 2010 +0300 +++ b/bluetoothengine/btnotif/btnotifsrv/src/btnotifpairnotifier.cpp Wed Jun 23 18:23:52 2010 +0300 @@ -22,7 +22,7 @@ #include #endif #include "btnotifconnectiontracker.h" -#include "btnotifpairingmanager.h" +#include "btnotifsecuritymanager.h" #include "btnotificationmanager.h" #include "bluetoothnotification.h" #include "btnotifserver.h" @@ -42,7 +42,7 @@ // --------------------------------------------------------------------------- // CBTNotifPairNotifier::CBTNotifPairNotifier( - CBTNotifPairingManager& aParent ) + CBTNotifSecurityManager& aParent ) : iParent( aParent ) { } @@ -60,7 +60,7 @@ // --------------------------------------------------------------------------- // CBTNotifPairNotifier* CBTNotifPairNotifier::NewL( - CBTNotifPairingManager& aParent ) + CBTNotifSecurityManager& aParent ) { BOstraceFunctionEntry0( DUMMY_DEVLIST ); CBTNotifPairNotifier* self = new( ELeave ) CBTNotifPairNotifier( aParent ); @@ -102,23 +102,23 @@ { BOstraceFunctionEntry0( DUMMY_DEVLIST ); - // todo: move Authorize notifier to a separate class TInt uid = aMessage.Int0(); - if ( KBTManAuthNotifierUid.iUid == uid ) + TInt opCode = aMessage.Function(); + BOstrace1(TRACE_DEBUG,DUMMY_DEVLIST,"[BTNotif]:Opcode: %d",opCode); + + if ( (!iNotifierMessage.IsNull()) && + (opCode != EBTNotifCancelNotifier )&&(opCode != EBTNotifUpdateNotifier)) { - TPckgBuf answer; - answer() = ETrue; - TInt err = aMessage.Write( EBTNotifSrvReplySlot, answer); - aMessage.Complete( KErrNone ); - return; + // todo: do we allow concurrent pairing? + BOstrace0(TRACE_DEBUG,DUMMY_DEVLIST,"[BTNotif]:We are busy"); + User::Leave(KErrServerBusy ); } - //BOstraceFunctionEntryExt( DUMMY_DEVLIST, this, aUid ); - if ( !iNotifierMessage.IsNull() ) - { - // todo: do we allow concurrent pairing? - User::Leave(KErrServerBusy ); - } + if(opCode == EBTNotifCancelNotifier){ + CancelPairingNotifierL(uid); + aMessage.Complete(KErrNone); + return; + } // Store the parameters locally, we need them later again. iParams.CreateL( aMessage.GetDesLengthL( EBTNotifSrvParamSlot ) ); @@ -127,6 +127,12 @@ // Read the notifier parameters ParseNotifierReqParamsL(); + + if(opCode ==EBTNotifUpdateNotifier ){ + UpdatePairingNotifierL(uid,iParams); + aMessage.Complete(KErrNone); + return; + } const CBtDevExtension* dev = iParent.BTDevRepository().Device(iRemote); if(dev) @@ -134,13 +140,16 @@ if (!iLocallyInitiated && dev->Device().GlobalSecurity().Banned() ) { // If the device is banned and pairing is not locally initiated - // then we ignore. - aMessage.Complete( KErrNone ); + // then we reject. + BOstrace0(TRACE_DEBUG,DUMMY_DEVLIST,"[BTNotif]:Device is banned"); + iNotifierMessage.Complete( KErrCancel ); + return; } if (iLocallyInitiated && dev->Device().GlobalSecurity().Banned()) { // Remove the banned device from the blocking history iParent.ConnectionTracker().UpdateBlockingHistoryL(&dev->Device(),ETrue); + iParent.BlockDevice(dev->Addr(),EFalse); } if(0 != dev->Device().FriendlyName().Length()&& dev->Device().IsValidFriendlyName()) { @@ -168,6 +177,7 @@ // If this is an incoming pairing, we first ask the user to accept it. if( !iLocallyInitiated ) { + User::LeaveIfError(iParent.SetPairObserver(iRemote,ETrue)); StartAcceptPairingQueryL(); } else @@ -304,8 +314,22 @@ void CBTNotifPairNotifier::MBRDataReceived( CHbSymbianVariantMap& aData ) { BOstraceFunctionEntry0( DUMMY_DEVLIST ); - (void) aData; - NOTIF_NOTIMPL + if(aData.Keys().MdcaPoint(0).Compare(_L("actionResult")) == 0) + { + TInt val = *(static_cast(aData.Get(_L("actionResult"))->Data())); + if(val) + { + iAcceptPairingResult = ETrue; + } + else + { + iAcceptPairingResult = EFalse; + } + } + else if(aData.Keys().MdcaPoint(0).Compare(_L("checkBoxState")) == 0) + { + iCheckBoxState = *(static_cast(aData.Get(_L("checkBoxState"))->Data())); + } BOstraceFunctionExit0( DUMMY_DEVLIST ); } @@ -318,10 +342,9 @@ { BOstraceFunctionEntryExt( DUMMY_DEVLIST, this, aError ); // First unregister from the notification, so we can already get the next one. - //iNotification->RemoveObserver(); - //iNotification = NULL; + iNotification->RemoveObserver(); + iNotification = NULL; TRAP_IGNORE( NotificationClosedL( aError, aData ) ); - iNotification = NULL; BOstraceFunctionExit1( DUMMY_DEVLIST, this ); } @@ -354,13 +377,17 @@ TPtrC8 resultData(KNullDesC8); TBTPinCode pinCode; TPckgBuf userAcceptance; + TInt uid = iNotifierMessage.Int0(); + if( !err ) { - TInt uid = iNotifierMessage.Int0(); // The returned data is the entered passkey. - // const CBtDevExtension* dev = iParent.BTDevRepository().Device(iRemote); - // TBool proceed = iParent.ConnectionTracker().UpdateBlockingHistoryL(&dev->Device(),aResult); - if( uid == KBTNumericComparisonNotifierUid.iUid ) + const CBtDevExtension* dev = iParent.BTDevRepository().Device(iRemote); + if(dev) + { + iParent.ConnectionTracker().UpdateBlockingHistoryL(&dev->Device(),aResult); + } + if( uid == KBTNumericComparisonNotifierUid.iUid ) { // Numeric comparison needs the boolean result passed back. userAcceptance() = aResult; @@ -374,12 +401,18 @@ // Check the passkey entered by the user. // The length of the returned data equals the number of characters // entered by the user. - pinCode().iLength = aData.Length(); + // Check that the passkey length do not exceed the maximum allowed size + TInt pinCodeLength = aData.Length(); + if(pinCodeLength > KHCIPINCodeSize) + { + pinCodeLength = KHCIPINCodeSize; + } + pinCode().iLength = pinCodeLength; // Check that the length of the passkey meets the minimum // required pin code length - if( aData.Length() >= iMinPinLength ) + if( pinCodeLength >= iMinPinLength ) { - for( TInt i = 0; i < aData.Length(); i++ ) + for( TInt i = 0; i < pinCodeLength; i++ ) { pinCode().iPIN[i] = aData[i]; } @@ -387,7 +420,7 @@ } else { - // todo: PIN wasn't long enough. This should be handled by the dialog though. + // shouldn't happen since the length is checked in the dialog err = KErrCompletion; } } @@ -395,21 +428,6 @@ else { err = KErrCancel; - if( iLocallyInitiated ) - { - // The user denied the connection, ask to block the device. - // This is only for pairing (and not bonding) initiated by us, - // as the user already gets the opportunity to block when - // rejecting an incoming pairing request. - // This case may be for someone requesting to access a service - // which requires authentication by us, but not by the remote device. - // if(proceed) - // { - // LaunchBlockingQueryL(); - // } - // For incoming pairing, blocking is asked after rejecting the - // pairing request. This is done in CompleteAcceptPairingQueryL - } } } // Complete the message with the result, and result data if any. @@ -417,6 +435,14 @@ { err = iNotifierMessage.Write( EBTNotifSrvReplySlot, resultData ); } + if(err && (uid == KBTNumericComparisonNotifierUid.iUid)) + { + // We need to reject the numeric comparaison otherwise + // the link will remain active + userAcceptance() = aResult; + resultData.Set( userAcceptance ); + err = iNotifierMessage.Write( EBTNotifSrvReplySlot, resultData ); + } iNotifierMessage.Complete( err ); BOstraceFunctionExit1( DUMMY_DEVLIST, this ); } @@ -428,7 +454,7 @@ void CBTNotifPairNotifier::StartAcceptPairingQueryL() { BOstraceFunctionEntry0( DUMMY_DEVLIST ); - PrepareNotificationL( TBluetoothDialogParams::EQuery, EIncomingPairing ); + PrepareNotificationL( TBluetoothDialogParams::EUserAuthorization, EAuthorization ); iState = EIncomingPairingAcceptconfirm; // if rejected, the client message is completed in CompleteAcceptPairingQueryL BOstraceFunctionExit0( DUMMY_DEVLIST ); @@ -438,32 +464,37 @@ // The user was asked to accept an incoming pairing. Process and proceed. // --------------------------------------------------------------------------- // -void CBTNotifPairNotifier::CompleteAcceptPairingQueryL( TInt aError, TBool aResult ) +void CBTNotifPairNotifier::CompleteAcceptPairingQueryL( TInt aError) { BOstraceFunctionEntry0( DUMMY_DEVLIST ); TInt err = aError; + TBool proceed = EFalse; + if( !err ) { - // const CBtDevExtension* dev = iParent.BTDevRepository().Device(iRemote); - // TBool proceed = iParent.ConnectionTracker().UpdateBlockingHistoryL(&dev->Device(),aResult); - if( aResult ) + const CBtDevExtension* dev = iParent.BTDevRepository().Device(iRemote); + if(dev) + { + proceed = iParent.ConnectionTracker().UpdateBlockingHistoryL(&dev->Device(),iAcceptPairingResult); + } + if( iAcceptPairingResult ) { // User accepted, continue to show pairing query. + // Trust the device + if(iCheckBoxState){ + iParent.TrustDevice(iRemote); + } StartPairingUserInputL(); - if( iDialogNumeric.Length() ) - { - err = iNotification->SetData( - TBluetoothDeviceDialog::EAdditionalDesc, iDialogNumeric ); - } - } + } else { - err = KErrCancel; - // if( proceed ) - // { - // //ask to block the device. - // LaunchBlockingQueryL(); - // } + if( proceed && iCheckBoxState ) + { + //ask to block the device. + iParent.BlockDevice(iRemote,proceed); + } + err = iParent.SetPairObserver(iRemote,EFalse); + err = KErrCancel; // We need to complete the pairing request here } } if( err ) @@ -571,6 +602,7 @@ TBTNumericComparisonParams::TComparisonScenario scenario = paramsPckg().ComparisonScenario(); aNumVal.Format( KNumCompFormat, paramsPckg().NumericalValue() ); + aNumVal.Insert(3,_L(" ")); aAddr = paramsPckg().DeviceAddress(); iCurrentDeviceName = paramsPckg().DeviceName(); BOstraceFunctionExit0( DUMMY_DEVLIST ); @@ -624,6 +656,14 @@ } err = iNotification->SetData( (TInt) TBluetoothDeviceDialog::EDeviceClass, classofdevice ); + if( iDialogNumeric.Length() ) + { + err = iNotification->SetData( + TBluetoothDeviceDialog::EAdditionalDesc, iDialogNumeric ); + } + err = iNotification->SetData( TBluetoothDialogParams::EDialogTitle, TBluetoothDialogParams::EPairingRequest); + iCheckBoxState = ETrue; + iAcceptPairingResult = EFalse; iParent.ConnectionTracker().NotificationManager()->QueueNotificationL( iNotification); NOTIF_NOTHANDLED( !err ) BOstraceFunctionExit0( DUMMY_DEVLIST ); @@ -641,9 +681,10 @@ result.Set( aData.Ptr(), result.Length() ); // Read the part containing the result // Set a pointer descriptor to capture the remaining data, if any. TPtrC8 dataPtr( aData.Mid( result.Length() ) ); + if ( iState == EIncomingPairingAcceptconfirm ) { - CompleteAcceptPairingQueryL(aError, result()); + CompleteAcceptPairingQueryL(aError); } else { @@ -652,25 +693,6 @@ BOstraceFunctionExit1( DUMMY_DEVLIST, this ); } -// --------------------------------------------------------------------------- -// Ask the user if he/she wants to block future connection requests. -// --------------------------------------------------------------------------- -// -void CBTNotifPairNotifier::LaunchBlockingQueryL() - { - BOstraceFunctionEntry0( DUMMY_DEVLIST ); - TBTDialogResourceId resourceId = EBlockUnpairedDevice; - const CBtDevExtension* dev = iParent.BTDevRepository().Device(iRemote); - if(dev->Device().IsValidPaired() && dev->Device().IsPaired() && - dev->Device().LinkKeyType() != ELinkKeyUnauthenticatedUpgradable ) - { - resourceId = EBlockPairedDevice; - } - PrepareNotificationL( TBluetoothDialogParams::EQuery, resourceId ); - BOstraceFunctionExit0( DUMMY_DEVLIST ); - } - - diff -r 91746b151f97 -r 997690c3397a bluetoothengine/btnotif/btnotifsrv/src/btnotifsecuritymanager.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/bluetoothengine/btnotif/btnotifsrv/src/btnotifsecuritymanager.cpp Wed Jun 23 18:23:52 2010 +0300 @@ -0,0 +1,859 @@ +/* +* 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 "btnotifsecuritymanager.h" +#include "btnotifoutgoingpairinghandler.h" +#include "btnotifincomingpairinghandler.h" +#include "btnotifpairnotifier.h" +#include "btnotifclientserver.h" +#include +#include "btnotifconnectiontracker.h" +#include "btnotifserviceauthorizer.h" + +/** Identification for active object */ +enum TPairManActiveRequestId + { + ESimplePairingResult, + EAuthenticationResult, + ERegistryGetLocalAddress, + }; + +// --------------------------------------------------------------------------- +// Tells if two TBTNamelessDevice instances are for the same remote device +// --------------------------------------------------------------------------- +// +TBool CompareDeviceByAddress( const TBTNamelessDevice& aDevA, const TBTNamelessDevice& aDevB ) + { + return aDevA.Address() == aDevB.Address(); + } + +// --------------------------------------------------------------------------- +// Tells if these two instances are for the same remote device +// --------------------------------------------------------------------------- +// +TBool MatchDeviceAddress(const TBTDevAddr* aAddr, const TBTNamelessDevice& aDev) + { + return *aAddr == aDev.Address(); + } + +// ======== MEMBER FUNCTIONS ======== + +// --------------------------------------------------------------------------- +// C++ default constructor +// --------------------------------------------------------------------------- +// +CBTNotifSecurityManager::CBTNotifSecurityManager( + CBTNotifConnectionTracker& aParent, + CBtDevRepository& aDevRepository) + : iParent( aParent ), iDevRepository( aDevRepository ) + { + } + +// --------------------------------------------------------------------------- +// Symbian 2nd-phase constructor +// --------------------------------------------------------------------------- +// +void CBTNotifSecurityManager::ConstructL() + { + // Connect to pairing server for authentication & simple pairing + // results directly from the BT stack. + // Pairing server doesn't exist if we run BT 2.0 stack: + iPairingServ = new (ELeave) RBluetoothPairingServer; + TInt err = iPairingServ->Connect(); + if ( err) + { + delete iPairingServ; + iPairingServ = NULL; + } + else + { + User::LeaveIfError( iPairingResult.Open( *iPairingServ ) ); + User::LeaveIfError( iAuthenResult.Open( *iPairingServ ) ); + iSSPResultActive = CBtSimpleActive::NewL( *this, ESimplePairingResult ); + iAuthenResultActive = CBtSimpleActive::NewL( *this, EAuthenticationResult ); + SubscribeSspPairingResult(); + SubscribeAuthenticateResult(); + } + User::LeaveIfError( iRegistry.Open( iParent.RegistryServerSession() ) ); + // RProperty for accessing the local device address + User::LeaveIfError( iPropertyLocalAddr.Attach( + KPropertyUidBluetoothCategory, KPropertyKeyBluetoothGetLocalDeviceAddress) ); + // Initialise paired devices list + iLocalAddrActive = CBtSimpleActive::NewL( *this, ERegistryGetLocalAddress ); + SubscribeLocalAddress(); + iPairNotifier = CBTNotifPairNotifier::NewL( *this ); + iDevRepository.AddObserverL( this ); + iServiceAuthorizer = CBTNotifServiceAuthorizer::NewL(*this); + } + +// --------------------------------------------------------------------------- +// NewL +// --------------------------------------------------------------------------- +// +CBTNotifSecurityManager* CBTNotifSecurityManager::NewL( + CBTNotifConnectionTracker& aParent, + CBtDevRepository& aDevRepository ) + { + CBTNotifSecurityManager* self = NULL; + self = new CBTNotifSecurityManager( aParent, aDevRepository ); + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop( self ); + return self; + } + +// --------------------------------------------------------------------------- +// Destructor +// --------------------------------------------------------------------------- +// +CBTNotifSecurityManager::~CBTNotifSecurityManager() + { + delete iSSPResultActive; + delete iAuthenResultActive; + delete iPairNotifier; + delete iPairingHandler; + iPairedDevices.Close(); + iPairingResult.Close(); + iAuthenResult.Close(); + if ( iPairingServ ) + { + iPairingServ->Close(); + delete iPairingServ; + } + iRegistry.Close(); + delete iLocalAddrActive; + iPropertyLocalAddr.Close(); + if ( !iMessage.IsNull() ) + { + iMessage.Complete( KErrCancel ); + } + delete iServiceAuthorizer; + } + +// --------------------------------------------------------------------------- +// Initialises the paired devices list. +// If the local address is not available from the P&S key +// KPropertyKeyBluetoothGetLocalDeviceAddress, then the list may need to be +// updated once the H/W is switched on. This is so that any registry update +// from a restore operation can be included in the list, without mistaking the +// new devices for new pairings. +// --------------------------------------------------------------------------- +// +void CBTNotifSecurityManager::SubscribeLocalAddress() + { + // Check that we have the Bluetooth local address. If we don't then initialise anyway, but subscribe for an update. + // This allows us to refresh our paired devices list to include updates made to the remote devices table of the + // Bluetooth registry from a restore operation. We need to include these devices without mistaking them for new + // pairings. We look solely at the P&S key for the address to avoid the condition whereby the address has been + // entered into the reigstry but the Bluetooth Manager server has not begun the restore process yet. The signalling + // of the P&S key will cause Bluetooth Manager to update the registry with any restored devices before fulfilling + // any further requests. + + // Subscribe to local address property in case we need an update. + iPropertyLocalAddr.Subscribe( iLocalAddrActive->iStatus ); + iLocalAddrActive->SetRequestId( ERegistryGetLocalAddress ); + iLocalAddrActive->GoActive(); + } + +// --------------------------------------------------------------------------- +// Tells whether the local address is available from the P&S key +// KPropertyKeyBluetoothGetLocalDeviceAddress. +// --------------------------------------------------------------------------- +// +TBool CBTNotifSecurityManager::IsLocalAddressAvailable() + { + // Attempt to read address from P&S key. + TBuf8 btAddrDes; + TInt err = iPropertyLocalAddr.Get( btAddrDes ); + + // Is the P&S key defined yet? (if not, stack not up yet) + if ( err == KErrNone ) + { + // P&S key defined, is local address set? (if not, H/W not initialised yet) + if ( btAddrDes.Length() == KBTDevAddrSize ) + { + TBTDevAddr btAddr = btAddrDes; + if ( btAddr != TBTDevAddr() ) + { + return ETrue; + } + } + } + return EFalse; + } + +// --------------------------------------------------------------------------- +// Handles pairing related requests from BTNotif clients. +// --------------------------------------------------------------------------- +// +void CBTNotifSecurityManager::HandleBondingRequestL( const RMessage2& aMessage ) + { + TInt opcode = aMessage.Function(); + TBTDevAddrPckgBuf addrPkg; + switch( opcode ) + { + case EBTNotifPairDevice: + { + if ( !iMessage.IsNull() ) + { + User::Leave( KErrServerBusy ); + } + TBTDevAddrPckgBuf addrPkg; + aMessage.ReadL( EBTNotifSrvParamSlot, addrPkg ); + BlockDevice(addrPkg(),EFalse); + UnpairDevice( addrPkg() ); + PairDeviceL( addrPkg(), aMessage.Int2() ); + iMessage = RMessage2( aMessage ); + break; + } + case EBTNotifCancelPairDevice: + { + // Only the client who requested pairing can cancel it: + if ( !iMessage.IsNull() && aMessage.Session() == iMessage.Session() ) + { + iPairingHandler->CancelOutgoingPair(); + iMessage.Complete( KErrCancel ); + } + aMessage.Complete( KErrNone ); + break; + } + default: + { + User::Leave( KErrArgument ); + } + } + } + +// --------------------------------------------------------------------------- +// Process a client message related to notifiers. +// --------------------------------------------------------------------------- +// +void CBTNotifSecurityManager::HandleNotifierRequestL( const RMessage2& aMessage ) + { + if(aMessage.Int0() == KBTManAuthNotifierUid.iUid) + { + iServiceAuthorizer->StartNotifierL( aMessage ); + } + else + { + iPairNotifier->StartPairingNotifierL( aMessage ); + } + + BOstraceFunctionExit0( DUMMY_DEVLIST); + } + +// --------------------------------------------------------------------------- +// Returns the RBluetoothPairingServer instance. +// --------------------------------------------------------------------------- +// +RBluetoothPairingServer* CBTNotifSecurityManager::PairingServer() + { + return iPairingServ; + } + +// --------------------------------------------------------------------------- +// Access the reference of RSockServ +// --------------------------------------------------------------------------- +// +RSocketServ& CBTNotifSecurityManager::SocketServ() + { + return iParent.SocketServerSession(); + } + +// --------------------------------------------------------------------------- +// Access the reference of RBTRegSrv +// --------------------------------------------------------------------------- +// +CBtDevRepository& CBTNotifSecurityManager::BTDevRepository() + { + return iDevRepository; + } + +// --------------------------------------------------------------------------- +// Access the reference of CBTNotifConnectionTracker +// --------------------------------------------------------------------------- +// +CBTNotifConnectionTracker& CBTNotifSecurityManager::ConnectionTracker() + { + return iParent; + } + +// --------------------------------------------------------------------------- +// Deletes the current pairing handler and transfer the responsibility +// to the specified. +// --------------------------------------------------------------------------- +// +void CBTNotifSecurityManager::RenewPairingHandler( + CBTNotifBasePairingHandler* aPairingHandler ) + { + delete iPairingHandler; + iPairingHandler = aPairingHandler; + } + +// --------------------------------------------------------------------------- +// Find the session who requested this and completes its request. +// --------------------------------------------------------------------------- +// +void CBTNotifSecurityManager::OutgoingPairCompleted( TInt aErr ) + { + // the meaning of KHCIErrorBase equals KErrNone. Hide this specific BT stack + // detail from clients: + if ( !iMessage.IsNull() ) + { + iMessage.Complete( (aErr == KHCIErrorBase) ? KErrNone : aErr ); + } + } + +// --------------------------------------------------------------------------- +// A session will be ended, completes the pending request for this session. +// --------------------------------------------------------------------------- +// +void CBTNotifSecurityManager::SessionClosed( CSession2* aSession ) + { + BOstrace1(TRACE_DEBUG,DUMMY_DEVLIST," session %x", aSession); + if ( !iMessage.IsNull() && iMessage.Session() == aSession ) + { + iMessage.Complete( KErrCancel ); + } + } + +// --------------------------------------------------------------------------- +// Unpair the device from registry +// --------------------------------------------------------------------------- +// +void CBTNotifSecurityManager::UnpairDevice( const TBTDevAddr& aAddr ) + { + TIdentityRelation addrComp( CompareDeviceByAddress ); + TBTNamelessDevice dev; + dev.SetAddress( aAddr ); + // only do unpairing if the we have a link key with it. + TInt index = iPairedDevices.Find( dev, addrComp ); + if ( index > KErrNotFound ) + { + dev = iPairedDevices[index]; + TRequestStatus status( KRequestPending ); + // Unpair the device in registry (synchronously) + iRegistry.UnpairDevice( dev.Address(), status ); + User::WaitForRequest( status ); + BOstrace1(TRACE_DEBUG,DUMMY_DEVLIST,"Delete link key, res %d", status.Int()); + if ( status == KErrNone ) + { + TBTDeviceSecurity security = dev.GlobalSecurity(); + // Clear trust setting so that correct icon will be shown in ui applications. + security.SetNoAuthenticate(EFalse ); + security.SetNoAuthorise(EFalse ); + dev.SetGlobalSecurity(security); + dev.DeleteLinkKey(); + if ( dev.IsValidUiCookie() && + ( dev.UiCookie() & EBTUiCookieJustWorksPaired ) ) + { + // Remove the UI cookie bit for Just Works pairing. + TInt32 cookie = dev.UiCookie() & ~EBTUiCookieJustWorksPaired; + dev.SetUiCookie( cookie ); + BOstrace1(TRACE_DEBUG,DUMMY_DEVLIST,"UI cookie %x cleared", EBTUiCookieJustWorksPaired ); + } + // modify the device in registry synchronously + // status.Int() could be -1 if the device is not in registry + // which is totally fine for us. + (void) UpdateRegDevice( dev ); + } + } + } + +void CBTNotifSecurityManager::BlockDevice( const TBTDevAddr& aAddr , TBool aBanned) + { + TIdentityRelation addrComp( CompareDeviceByAddress ); + TBTNamelessDevice dev; + dev.SetAddress( aAddr ); + TRequestStatus status( KRequestPending ); + // Unpair the device in registry (synchronously) + iRegistry.GetDevice(dev,status); + User::WaitForRequest( status ); + if(status == KErrNone) + { + TBTDeviceSecurity security = dev.GlobalSecurity(); + security.SetBanned(aBanned); + if ( aBanned ) + { + security.SetNoAuthorise(EFalse); + } + dev.SetGlobalSecurity(security); + (void)UpdateRegDevice(dev); + } + } + +TInt CBTNotifSecurityManager::AddUiCookieJustWorksPaired( const TBTNamelessDevice& aDev ) + { + TInt err( KErrNone ); + // There might be UI cookies used by other applications, + // we should not overwrite them. + TInt32 cookie = aDev.IsValidUiCookie() ? aDev.UiCookie() : EBTUiCookieUndefined; + if ( !( cookie & EBTUiCookieJustWorksPaired ) ) + { + // Only update the cookie if the wanted one is not in registry yet + // to keep minimal operations with registry. + TBTNamelessDevice dev = aDev; + cookie |= EBTUiCookieJustWorksPaired; + dev.SetUiCookie( cookie ); + err = UpdateRegDevice( dev ); + BOstrace1(TRACE_DEBUG,DUMMY_DEVLIST,"Outgoing Pairing write Ui cookie ret %d", err ); + } + return err; + } + +// --------------------------------------------------------------------------- +// update a nameless device in registry +// --------------------------------------------------------------------------- +// +TInt CBTNotifSecurityManager::UpdateRegDevice( const TBTNamelessDevice& aDev ) + { + TRequestStatus status( KRequestPending ); + // update the device in registry synchronously + iRegistry.ModifyDevice( aDev, status ); + User::WaitForRequest( status ); + BOstrace1(TRACE_DEBUG,DUMMY_DEVLIST,"UpdateRegDevice, ret %d", status.Int()); + return status.Int(); + } + +// --------------------------------------------------------------------------- +// 0000 for outgoing pairing with a headset. +// The placeholder for future extension (pin code passed in for pairing) +// --------------------------------------------------------------------------- +// +void CBTNotifSecurityManager::GetPinCode( + TBTPinCode& aPin, const TBTDevAddr& aAddr, TInt aMinPinLength ) + { + if ( iPairingHandler ) + { + iPairingHandler->GetPinCode( aPin, aAddr, aMinPinLength ); + } + else + { + // make sure not to leave any text as PIN. + aPin.Zero(); + } + } + +// --------------------------------------------------------------------------- +// Ask server class the connection status of the specified device +// --------------------------------------------------------------------------- +// +TBTEngConnectionStatus CBTNotifSecurityManager::ConnectStatus( const TBTDevAddr& aAddr ) + { + const CBtDevExtension* devExt = iDevRepository.Device(aAddr); + TBTEngConnectionStatus status = EBTEngNotConnected; + if ( devExt ) + { + status = devExt->ServiceConnectionStatus(); + } + return status; + } + +// --------------------------------------------------------------------------- +// From class MBTNotifPairingAOObserver. +// Checks if there is an authentication result. +// --------------------------------------------------------------------------- +// +void CBTNotifSecurityManager::RequestCompletedL( CBtSimpleActive* aActive, TInt aStatus ) + { + BOstraceExt2(TRACE_DEBUG,DUMMY_DEVLIST,"aId: %d, aStatus: %d", aActive->RequestId(), aStatus); + // Check which request is completed. + switch( aActive->RequestId() ) + { + case ESimplePairingResult: + { + TBTDevAddr tmpAddr = iSimplePairingRemote; + if (aStatus != KErrServerTerminated) + { + SubscribeSspPairingResult(); + } + HandlePairingResultL( tmpAddr, aStatus ); + break; + } + case EAuthenticationResult: + { + TBTDevAddr tmpAddr = iAuthenticateRemote; + if (aStatus != KErrServerTerminated) + { + SubscribeAuthenticateResult(); + } + HandlePairingResultL( tmpAddr, aStatus ); + break; + } + case ERegistryGetLocalAddress: + { + TBool value = IsLocalAddressAvailable(); + SubscribeLocalAddress(); + if ( value ) + { + // Refresh paired devices list to include any restored devices. + iDevRepository.ReInitialize(); + } + break; + } + default: + // Should not be possible, but no need for handling. + break; + } + } + +// --------------------------------------------------------------------------- +// From class MBTEngActiveObserver. +// cancels an outstanding request according to the given id. +// --------------------------------------------------------------------------- +// +void CBTNotifSecurityManager::CancelRequest( TInt aRequestId ) + { + switch ( aRequestId ) + { + case ESimplePairingResult: + { + // Cancel listening Simple pairing result + iPairingResult.CancelSimplePairingResult(); + break; + } + case EAuthenticationResult: + { + // Cancel listening authentication result + iAuthenResult.CancelAuthenticationResult(); + break; + } + case ERegistryGetLocalAddress: + { + // cancel listening local address status change + iPropertyLocalAddr.Cancel(); + break; + } + } + } + +// --------------------------------------------------------------------------- +// From class MBtSimpleActiveObserver. +// --------------------------------------------------------------------------- +// +void CBTNotifSecurityManager::HandleError( CBtSimpleActive* aActive, TInt aError ) + { + BOstraceExt2(TRACE_DEBUG,DUMMY_DEVLIST,"request id: %d, error: %d", aActive->RequestId(), aError); + (void) aActive; + (void) aError; + } + +// --------------------------------------------------------------------------- +// From class MBtDevRepositoryObserver. +// --------------------------------------------------------------------------- +// +void CBTNotifSecurityManager::RepositoryInitialized() + { + TRAPD(err, UpdatePairedDeviceListL() ); + if ( !err && iPairingHandler ) + { + // non-null pairing handler means we are involved in a + // pairing operation already. + // todo: is some handling for above case needed? + } + } + +// --------------------------------------------------------------------------- +// From class MBtDevRepositoryObserver. +// --------------------------------------------------------------------------- +// +void CBTNotifSecurityManager::DeletedFromRegistry( const TBTDevAddr& aAddr ) + { + // We are only interested in the removal of a paired device. + // thus check whether it is in our local paired list: + TInt i = iPairedDevices.Find( aAddr, MatchDeviceAddress); + if ( i > KErrNotFound ) + { + iPairedDevices.Remove( i ); + } + } + +// --------------------------------------------------------------------------- +// From class MBtDevRepositoryObserver. +// --------------------------------------------------------------------------- +// +void CBTNotifSecurityManager::AddedToRegistry( const CBtDevExtension& aDevice ) + { + // We are only interested in paired device. + if ( CBtDevExtension::IsBonded( aDevice.Device().AsNamelessDevice() ) ) + { + TRAP_IGNORE( + HandleRegistryBondingL( aDevice.Device().AsNamelessDevice() ) ); + } + } + + +// --------------------------------------------------------------------------- +// From class MBtDevRepositoryObserver. +// --------------------------------------------------------------------------- +// +void CBTNotifSecurityManager::ChangedInRegistry( + const CBtDevExtension& aDevice, TUint aSimilarity ) + { + // We are only interested in paired device. + // thus check whether it is in our local paired list: + TInt i = iPairedDevices.Find( aDevice.Addr(), MatchDeviceAddress); + TBool bonded = CBtDevExtension::IsBonded( aDevice.Device().AsNamelessDevice() ); + if ( i == KErrNotFound ) + { + if ( bonded ) + { + TRAP_IGNORE( + HandleRegistryBondingL( + aDevice.Device().AsNamelessDevice() ) ); + } + return; + } + // Device was inregistry before, but we need to evaluate its bonding + // status. + // The given similarity will tell if the linkkey and paired is changed + // or not. + TInt pairingProperty = TBTNamelessDevice::EIsPaired + | TBTNamelessDevice::ELinkKey; + if ( ( pairingProperty & aSimilarity) == pairingProperty ) + { + // no pairing or linkkey change. Nothing to do for pairing handling. + // but we'd better update local copy just in case other data + // of this device is needed by someone: + iPairedDevices[i] = aDevice.Device().AsNamelessDevice(); + return; + } + if ( !CBtDevExtension::IsBonded( aDevice.Device().AsNamelessDevice() ) ) + { + // device is not user-bonded. + iPairedDevices.Remove( i ); + return; + } + // it is a new paired device if its link-key has been upgraded + if ( aDevice.Device().LinkKeyType() != ELinkKeyUnauthenticatedUpgradable ) + { + iPairedDevices.Remove( i ); + TRAP_IGNORE( + HandleRegistryBondingL( + aDevice.Device().AsNamelessDevice() ) ); + } + } + +// --------------------------------------------------------------------------- +// From class MBtDevRepositoryObserver. +// This class is not interested in such events. +// --------------------------------------------------------------------------- +// +void CBTNotifSecurityManager::ServiceConnectionChanged( + const CBtDevExtension& aDevice, TBool aConnected ) + { + (void) aDevice; + (void) aConnected; + } + +// --------------------------------------------------------------------------- +// Activate or deactivate a pairing handler +// --------------------------------------------------------------------------- +// +TInt CBTNotifSecurityManager::SetPairObserver(const TBTDevAddr& aAddr, TBool aActivate) + { + BOstrace1(TRACE_DEBUG,DUMMY_DEVLIST,"%d", aActivate); + BtTraceBtAddr0(TRACE_DEBUG,DUMMY_DEVLIST, aAddr ); + TInt err( KErrNone ); + if ( !aActivate ) + { + if ( iPairingHandler ) + { + iPairingHandler->StopPairHandling( aAddr ); + } + return err; + } + + if ( !iPairingHandler) + { + // This is an incoming pair, unpair it from registry and + // create the handler: + UnpairDevice( aAddr ); + TRAP( err, iPairingHandler = CBTNotifIncomingPairingHandler::NewL( *this, aAddr )); + } + if ( iPairingHandler) + { + // let the handler decide what to do: + err = iPairingHandler->ObserveIncomingPair( aAddr ); + } + return err; + } + +// --------------------------------------------------------------------------- +// Delegates the request to current pair handler +// --------------------------------------------------------------------------- +// +void CBTNotifSecurityManager::PairDeviceL( const TBTDevAddr& aAddr, TUint32 aCod ) + { + if ( !iPairingHandler) + { + // no existing pair handling, create one: + iPairingHandler = CBTNotifOutgoingPairingHandler::NewL( *this, aAddr ); + } + // let pair handler decide what to do: + iPairingHandler->HandleOutgoingPairL( aAddr, aCod ); + } + +// --------------------------------------------------------------------------- +// cancel Subscribings to simple pairing result and authentication result from +// Pairing Server +// --------------------------------------------------------------------------- +// +void CBTNotifSecurityManager::CancelSubscribePairingAuthenticate() + { + if( iSSPResultActive ) + { + // Cancel listening Simple pairing result + iSSPResultActive->Cancel(); + } + if( iAuthenResultActive ) + { + iAuthenResultActive->Cancel(); + } + } + +// --------------------------------------------------------------------------- +// Subscribes to simple pairing result from Pairing Server (if not already +// subscribed). +// --------------------------------------------------------------------------- +// +void CBTNotifSecurityManager::SubscribeSspPairingResult() + { + if ( !iSSPResultActive->IsActive() ) + { + iPairingResult.SimplePairingResult( iSimplePairingRemote, iSSPResultActive->RequestStatus() ); + iSSPResultActive->GoActive(); + } + } + +// --------------------------------------------------------------------------- +// Subscribes to authentication result from Pairing Server (if not already +// subscribed). +// --------------------------------------------------------------------------- +// +void CBTNotifSecurityManager::SubscribeAuthenticateResult() + { + if ( !iAuthenResultActive->IsActive() ) + { + // Subscribe authentication result (which requires pairing for unpaired devices) + iAuthenResult.AuthenticationResult( iAuthenticateRemote, iAuthenResultActive->RequestStatus() ); + iAuthenResultActive->GoActive(); + } + } + +// --------------------------------------------------------------------------- +// Handle a pairing result from the pairing server. +// --------------------------------------------------------------------------- +// +void CBTNotifSecurityManager::HandlePairingResultL( const TBTDevAddr& aAddr, TInt aResult ) + { + BOstrace1(TRACE_DEBUG,DUMMY_DEVLIST,"result %d", aResult); + BtTraceBtAddr0(TRACE_DEBUG,DUMMY_DEVLIST, aAddr ); + + if ( !iPairingHandler && ( aResult == KErrNone || aResult == KHCIErrorBase ) ) + { + // we only create new handler if incoming pairing succeeds. + // Pairing failure could be caused by user local cancellation, as the + // result, the handler was destroyed by notifier. We shall not + // instantiate the handler again. + // If a pairing failed due to other reasons than user local cancelling, + // it will be catched by the already started handler + // (except Just Works pairing - no handler for it at all until we receive + // registry change event. Thus if incoming JWs pairing failed, no user + // notification will be shown.) + iPairedDevices.Find( aAddr, MatchDeviceAddress); + TInt index = iPairedDevices.Find( aAddr, MatchDeviceAddress); + // If the device is not found in the old paired device list, it is a new + // paired device: + if ( index == KErrNotFound) + { + // No handler yet, create incoming pairing handler: + iPairingHandler = CBTNotifIncomingPairingHandler::NewL( *this, aAddr ); + } + } + if ( iPairingHandler ) + { + iPairingHandler->HandlePairServerResult( aAddr, aResult ); + } + } + +// --------------------------------------------------------------------------- +// copy the nameless devices to local array +// --------------------------------------------------------------------------- +// +void CBTNotifSecurityManager::UpdatePairedDeviceListL() + { + iPairedDevices.Reset(); + const RDevExtensionArray& alldevs = iDevRepository.AllDevices(); + for ( TInt i = 0; i < alldevs.Count(); i++ ) + { + if ( CBtDevExtension::IsBonded( alldevs[i]->Device().AsNamelessDevice() ) ) + { + iPairedDevices.AppendL( alldevs[i]->Device().AsNamelessDevice() ); + } + } + } + +// --------------------------------------------------------------------------- +// Create incoming pairing handler if no one exists yet. +// --------------------------------------------------------------------------- +// +void CBTNotifSecurityManager::HandleRegistryBondingL( + const TBTNamelessDevice& aNameless) + { + TInt err = iPairedDevices.Append( aNameless ); + if ( !err && !iPairingHandler) + { + // New paired device, but no pairing handler yet. + // this means an incoming pairing has occured: + TRAP( err, iPairingHandler = + CBTNotifIncomingPairingHandler::NewL( *this, aNameless.Address() ) ); + } + if ( !err ) + { + // We have a pairing handler now. + // Ask pair handler to decide what to do: + iPairingHandler->HandleRegistryNewPairedEvent( + aNameless ); + } + else if ( iPairingHandler ) + { + // error could occur due to no memory, + // let us try aborting pairing handling + iPairingHandler->StopPairHandling( aNameless.Address() ); + } + } + +void CBTNotifSecurityManager::TrustDevice( const TBTDevAddr& aAddr ) + { + TIdentityRelation addrComp( CompareDeviceByAddress ); + TBTNamelessDevice dev; + dev.SetAddress( aAddr ); + TRequestStatus status( KRequestPending ); + + iRegistry.GetDevice(dev,status); + User::WaitForRequest( status ); + if(status == KErrNone) + { + TBTDeviceSecurity security = dev.GlobalSecurity(); + security.SetNoAuthorise(ETrue); + security.SetBanned(EFalse); + dev.SetGlobalSecurity(security); + (void)UpdateRegDevice(dev); + } + } + diff -r 91746b151f97 -r 997690c3397a bluetoothengine/btnotif/btnotifsrv/src/btnotifserver.cpp --- a/bluetoothengine/btnotif/btnotifsrv/src/btnotifserver.cpp Fri Jun 11 13:48:51 2010 +0300 +++ b/bluetoothengine/btnotif/btnotifsrv/src/btnotifserver.cpp Wed Jun 23 18:23:52 2010 +0300 @@ -272,7 +272,8 @@ // GLDEF_C TInt E32Main() { - __UHEAP_MARK; + // Disabled until memory leak in QT/Open C are fixed + // __UHEAP_MARK; CTrapCleanup* cleanup = CTrapCleanup::New(); TInt err = KErrNoMemory; if ( cleanup ) @@ -280,7 +281,8 @@ TRAP( err, RunServerL() ); delete cleanup; } - __UHEAP_MARKEND; + // Disabled until memory leak in QT/Open C are fixed + // __UHEAP_MARKEND; return err; } diff -r 91746b151f97 -r 997690c3397a bluetoothengine/btnotif/btnotifsrv/src/btnotifserviceauthorizer.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/bluetoothengine/btnotif/btnotifsrv/src/btnotifserviceauthorizer.cpp Wed Jun 23 18:23:52 2010 +0300 @@ -0,0 +1,275 @@ +/* +* 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 for prompting user to authorize a service +* connection request. +* +*/ + +#include +#include +#include "btnotifserviceauthorizer.h" +#include "btnotifsecuritymanager.h" +#include "bluetoothtrace.h" +#include "btnotifclientserver.h" +#include "bluetoothnotification.h" +#include "btnotifconnectiontracker.h" +#include "btnotificationmanager.h" +#include "bluetoothnotification.h" +#include "btnotifserver.h" +#include "btnotifutil.h" + +// +// SDP UUID Constants - Short form +// Taken from Bluetooth Profile specification v1.1 +// These are used when registering the service to +// local SDP database and when searching the service +// information from remote device. +const TUint KBTSdpDun = 0x1103; +const TUint KBTSdpGenericTelephony = 0x1204; +const TUint KBTSdpFax = 0x1111; +const TUint KBTSdpObjectPush = 0x1105; +const TUint KBTSdpFileTransfer = 0x1106; +const TUint KBTSdpHeadSet = 0x1108; +const TUint KBTSdpGenericNetworking = 0x1201; +const TUint KBTSdpBasicImaging = 0x111b; + + +CBTNotifServiceAuthorizer* CBTNotifServiceAuthorizer::NewL( + CBTNotifSecurityManager& aParent) + { + CBTNotifServiceAuthorizer* me = new (ELeave) CBTNotifServiceAuthorizer(aParent); + CleanupStack::PushL(me); + me->ConstructL(); + CleanupStack::Pop(me); + return me; + } + +CBTNotifServiceAuthorizer::~CBTNotifServiceAuthorizer() + { + iParams.Close(); + if( iNotification ) + { + // Clear the notification callback, we cannot receive them anymore. + iNotification->RemoveObserver(); + iNotification->Close(); // Also dequeues the notification from the queue. + iNotification = NULL; + } + } + +CBTNotifServiceAuthorizer::CBTNotifServiceAuthorizer( + CBTNotifSecurityManager& aParent) +:iParent(aParent) + { + } + +void CBTNotifServiceAuthorizer::ConstructL() + { + } + +void CBTNotifServiceAuthorizer::StartNotifierL(const RMessage2& aMessage) + { + if (!iNotifierMessage.IsNull()) + { + if(aMessage.Function() == EBTNotifCancelNotifier) + { + TInt err = iNotification->Close(); + iNotifierMessage.Complete(KErrCancel); + aMessage.Complete(err); + return; + } + BOstrace0(TRACE_DEBUG,DUMMY_DEVLIST,"[BTNotif]:We are busy"); + User::Leave(KErrServerBusy ); + } + + iParams.CreateL( aMessage.GetDesLengthL( EBTNotifSrvParamSlot ) ); + aMessage.ReadL( EBTNotifSrvParamSlot, iParams ); + + TBTAuthorisationParams params; + TPckgC paramsPckg( params ); + paramsPckg.Set( iParams ); + + iServiceId = paramsPckg().iUid.iUid; + + const CBtDevExtension* dev = NULL; + dev = iParent.BTDevRepository().Device(paramsPckg().iBDAddr); + + if(dev && dev->Device().GlobalSecurity().Banned() ) + { + // If the device is banned, service connection from + // this device is not allowed: + BOstrace0(TRACE_DEBUG,DUMMY_DEVLIST,"[BTNotif]:Device is banned"); + aMessage.Complete( KErrCancel); + return; + } + + if(dev && dev->Device().GlobalSecurity().NoAuthorise()) + { + // If the device is a trusted one, no need to pop up query messages. + TPckgBuf answer; + answer() = ETrue; + aMessage.Write(EBTNotifSrvReplySlot, answer); + aMessage.Complete(KErrNone); + return; + } + + // User must namually authorize this request. + // Get needed info for the dialog: + iPairedDevice = (dev == NULL ) ? EFalse : dev->IsUserAwareBonded(); + iDeviceClass = (dev == NULL ) ? 0 : dev->Device().DeviceClass().DeviceClass(); + TBTNotifUtil::GetDeviceUiNameL(iCurrentDeviceName, + dev, paramsPckg().iName, paramsPckg().iBDAddr ); + + PrepareNotificationL(TBluetoothDialogParams::EUserAuthorization, EAuthorization, iPairedDevice); + iNotification->ShowL(); + // we do not save the message until all leavable functions have executed successfully. + // This makes sure the iNotifierMessage has a valid handle. + iNotifierMessage = aMessage; + } + +void CBTNotifServiceAuthorizer::MBRDataReceived( CHbSymbianVariantMap& aData ) + { + // "actionResult" will be true if the user clicks 'Yes' on the dialog and false, if he/she clicks 'No' + // "iCheckBoxState" will be set to true of the checkbox is checked, else false. + if(aData.Keys().MdcaPoint(0).Compare(_L("actionResult")) == 0) + { + TBTAuthorisationParams params; + TPckgC paramsPckg(params); + paramsPckg.Set(iParams); + + TPckgBuf answer; + TInt val = *(static_cast(aData.Get(_L("actionResult"))->Data())); + if(val) + { + answer() = ETrue; + if(iCheckBoxState) + { + // Set the device "Trusted" property + iParent.TrustDevice(paramsPckg().iBDAddr); + } + } + else + { + answer() = EFalse; + if(iCheckBoxState) + { + // If the device is paried, unpair it as well. + if(iPairedDevice) + { + iParent.UnpairDevice(paramsPckg().iBDAddr); + } + + //Set the device "Blocked" property + iParent.BlockDevice(paramsPckg().iBDAddr,ETrue); + } + } + iNotifierMessage.Write(EBTNotifSrvReplySlot, answer); + iNotifierMessage.Complete(KErrNone); + } + else if(aData.Keys().MdcaPoint(0).Compare(_L("checkBoxState")) == 0) + { + iCheckBoxState = *(static_cast(aData.Get(_L("checkBoxState"))->Data())); + } + } + +void CBTNotifServiceAuthorizer::MBRNotificationClosed( TInt /*aError*/, const TDesC8& /*aData*/ ) + { + } + +void CBTNotifServiceAuthorizer::PrepareNotificationL(TBluetoothDialogParams::TBTDialogType aType, + TBTDialogResourceId aResourceId, TBool aPaired) + { + iNotification = iParent.ConnectionTracker().NotificationManager()->GetNotification(); + User::LeaveIfNull( iNotification ); // For OOM exception, leaves with KErrNoMemory + iNotification->SetObserver( this ); + iNotification->SetNotificationType( aType, aResourceId ); + TInt err = KErrNone; + + //Set the dialog title based on the service IDs + switch(iServiceId) + { + case KBTSdpObjectPush: + case KBTSdpBasicImaging: + { + if(aPaired) + { + err = iNotification->SetData( TBluetoothDialogParams::EDialogTitle, TBluetoothDialogParams::EReceiveFromPairedDevice); + // In case of receiving a msg from a paired deivce, the checkbox is checked by default. + iCheckBoxState = ETrue; + User::LeaveIfError(err); + } + else + { + err = iNotification->SetData( TBluetoothDialogParams::EDialogTitle, TBluetoothDialogParams::EReceive); + iCheckBoxState = EFalse; + User::LeaveIfError(err); + } + }break; + + case KBTSdpFax: + case KBTSdpDun: + case KBTSdpFileTransfer: + case KBTSdpHeadSet: + case KBTSdpGenericTelephony: + case KBTSdpGenericNetworking: + { + err = iNotification->SetData( TBluetoothDialogParams::EDialogTitle, TBluetoothDialogParams::EConnect); + // In case of an incoming connection, the checkbox is checked by default. + iCheckBoxState = ETrue; + User::LeaveIfError(err); + }break; + + default: + { + TBTAuthorisationParams params; + TPckgC paramsPckg(params); + paramsPckg.Set(iParams); + + // In this case, if there already exists a connection to an audio device, then we simply accept + // the incoming connection without querying the user. + // If there is no existing connection, then we pop up a query message. + if(IsExistingConnectionToAudioL(paramsPckg().iBDAddr)) + { + TPckgBuf answer; + answer() = ETrue; + iNotifierMessage.Write(EBTNotifSrvReplySlot, answer); + iNotifierMessage.Complete(KErrNone); + return; + } + else + { + err = iNotification->SetData( TBluetoothDialogParams::EDialogTitle, TBluetoothDialogParams::EConnect); + // In case of an incoming connection, the checkbox is checked by default. + iCheckBoxState = ETrue; + User::LeaveIfError(err); + } + }break; + } + + //Add the device name + err = iNotification->SetData( TBluetoothDeviceDialog::EDeviceName, iCurrentDeviceName ); + User::LeaveIfError(err); + //Add the device class + err = iNotification->SetData( TBluetoothDeviceDialog::EDeviceClass, iDeviceClass ); + User::LeaveIfError(err); + } + +TBool CBTNotifServiceAuthorizer::IsExistingConnectionToAudioL(const TBTDevAddr& aDevAddr) + { + CBTEngConnMan* connMan = CBTEngConnMan::NewL(); + TBTEngConnectionStatus conntatus(EBTEngNotConnected); + (void) connMan->IsConnected(aDevAddr,conntatus); + delete connMan; + return (conntatus==EBTEngConnected || conntatus==EBTEngConnecting); + } + diff -r 91746b151f97 -r 997690c3397a bluetoothengine/btnotif/btnotifsrv/src/btnotifsession.cpp --- a/bluetoothengine/btnotif/btnotifsrv/src/btnotifsession.cpp Fri Jun 11 13:48:51 2010 +0300 +++ b/bluetoothengine/btnotif/btnotifsrv/src/btnotifsession.cpp Wed Jun 23 18:23:52 2010 +0300 @@ -128,7 +128,7 @@ { // Pass it to the connection tracker. TRAP( err, - connTracker->HandlePairingNotifierRequestL( aMessage ) ); + connTracker->HandleNotifierRequestL( aMessage ) ); } if ( err ) { diff -r 91746b151f97 -r 997690c3397a bluetoothengine/btnotif/btnotifsrv/src/btnotifutil.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/bluetoothengine/btnotif/btnotifsrv/src/btnotifutil.cpp Wed Jun 23 18:23:52 2010 +0300 @@ -0,0 +1,68 @@ +/* +* 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 "btnotifutil.h" +#include +#include +#include "bluetoothtrace.h" + +// --------------------------------------------------------------------------- +// If aDevExt contains a valid friendly name, the friendly name will be displayed; +// Otherwise, if the given name from the parameter of a notifier request is valid, +// the given name will be displayed; +// Otherwise, If aDevExt contains a valid device name, the name will be displayed; +// Otherwise, the a name will be created by this function. +// --------------------------------------------------------------------------- +// +void TBTNotifUtil::GetDeviceUiNameL( TDes& aNameBuf, + const CBtDevExtension* aDevExt, + const TDesC& aNameInParam, + const TBTDevAddr& aAddr) + { + CBtDevExtension* tempDev( NULL ); + TPtrC namePtr; + if ( aDevExt && + aDevExt->Device().IsValidFriendlyName() && + aDevExt->Device().FriendlyName().Length() != 0 ) + { + // We always use the friendly name regardless of + // the device-name of the device is available or not. + namePtr.Set( aDevExt->Device().FriendlyName() ); + } + else + { + // this will take care of name formating. Either the + // name from iNameInParam or the address will be + // the alias: + tempDev = CBtDevExtension::NewLC( aAddr, aNameInParam ); + namePtr.Set( tempDev->Alias() ); + } + // Make sure no overflow: + if ( aNameBuf.MaxLength() < namePtr.Length() ) + { + aNameBuf.Copy( namePtr.Left( aNameBuf.MaxLength() ) ); + } + else + { + aNameBuf.Copy( namePtr ); + } + if ( tempDev ) + { + CleanupStack::PopAndDestroy( tempDev ); + } + } + + diff -r 91746b151f97 -r 997690c3397a bluetoothengine/btnotif/group/btnotifsrv.mmp --- a/bluetoothengine/btnotif/group/btnotifsrv.mmp Fri Jun 11 13:48:51 2010 +0300 +++ b/bluetoothengine/btnotif/group/btnotifsrv.mmp Wed Jun 23 18:23:52 2010 +0300 @@ -42,7 +42,9 @@ SOURCE btnotifbasepairinghandler.cpp SOURCE btnotifincomingpairinghandler.cpp SOURCE btnotifoutgoingpairinghandler.cpp -SOURCE btnotifpairingmanager.cpp +SOURCE btnotifsecuritymanager.cpp +SOURCE btnotifserviceauthorizer.cpp +SOURCE btnotifutil.cpp USERINCLUDE ../btnotifsrv/inc ../inc @@ -65,3 +67,4 @@ LIBRARY commonengine.lib LIBRARY flogger.lib LIBRARY charconv.lib + diff -r 91746b151f97 -r 997690c3397a bluetoothengine/btnotif/inc/bluetoothdevicedialogs.h --- a/bluetoothengine/btnotif/inc/bluetoothdevicedialogs.h Fri Jun 11 13:48:51 2010 +0300 +++ b/bluetoothengine/btnotif/inc/bluetoothdevicedialogs.h Wed Jun 23 18:23:52 2010 +0300 @@ -41,6 +41,7 @@ EPairingSuccess, EPairingFailure, EVisibilityTimeout, + EUnpairedDevice, EUnusedResource // The last ID }; @@ -65,7 +66,9 @@ EMoreDevice, EDeviceSearch, ESend, - EGlobalNotif + EGlobalNotif, + EUserAuthorization, + EReceiveProgress }; /** Enumeration for the notification parameters data type to be configured. */ @@ -78,6 +81,15 @@ EDialogTitle, EDialogExt // Id for first data type of derived class. }; + + /** Enumeration for the notification dialog heading type. */ + enum TDialogTitleDataType + { + EReceive, + EReceiveFromPairedDevice, + EConnect, + EPairingRequest + }; inline TBluetoothDialogParams(); @@ -123,7 +135,10 @@ EDeviceName, EDeviceClass, EAdditionalInt, - EAdditionalDesc + EAdditionalDesc, + EReceivingFileName, + EReceivingFileSize, + EReceivedFileCount }; inline TBluetoothDeviceDialog(); diff -r 91746b151f97 -r 997690c3397a bluetoothengine/btserviceutil/bwins/btserviceutilu.def --- a/bluetoothengine/btserviceutil/bwins/btserviceutilu.def Fri Jun 11 13:48:51 2010 +0300 +++ b/bluetoothengine/btserviceutil/bwins/btserviceutilu.def Wed Jun 23 18:23:52 2010 +0300 @@ -32,4 +32,5 @@ ?Device@CBtDevRepository@@QBEPBVCBtDevExtension@@ABVTBTDevAddr@@@Z @ 31 NONAME ; class CBtDevExtension const * CBtDevRepository::Device(class TBTDevAddr const &) const ?ReInitialize@CBtDevRepository@@QAEXXZ @ 32 NONAME ; void CBtDevRepository::ReInitialize(void) ?IsHeadset@CBtDevExtension@@SAHABVTBTDeviceClass@@@Z @ 33 NONAME ; int CBtDevExtension::IsHeadset(class TBTDeviceClass const &) + ?NewLC@CBtDevExtension@@SAPAV1@ABVTBTDevAddr@@ABVTDesC16@@W4TDefaultDevNameOption@@@Z @ 34 NONAME ; class CBtDevExtension * CBtDevExtension::NewLC(class TBTDevAddr const &, class TDesC16 const &, enum TDefaultDevNameOption) diff -r 91746b151f97 -r 997690c3397a bluetoothengine/btserviceutil/eabi/btserviceutilu.def --- a/bluetoothengine/btserviceutil/eabi/btserviceutilu.def Fri Jun 11 13:48:51 2010 +0300 +++ b/bluetoothengine/btserviceutil/eabi/btserviceutilu.def Wed Jun 23 18:23:52 2010 +0300 @@ -40,4 +40,5 @@ _ZN15CBtDevExtension17IsUserAwareBondedERK17TBTNamelessDevice @ 39 NONAME _ZN15CBtDevExtension8IsBondedERK17TBTNamelessDevice @ 40 NONAME _ZN15CBtDevExtension9IsHeadsetERK14TBTDeviceClass @ 41 NONAME + _ZN15CBtDevExtension5NewLCERK10TBTDevAddrRK7TDesC1621TDefaultDevNameOption @ 42 NONAME diff -r 91746b151f97 -r 997690c3397a bluetoothengine/btserviceutil/export/btdevextension.h --- a/bluetoothengine/btserviceutil/export/btdevextension.h Fri Jun 11 13:48:51 2010 +0300 +++ b/bluetoothengine/btserviceutil/export/btdevextension.h Wed Jun 23 18:23:52 2010 +0300 @@ -77,14 +77,27 @@ /** * Two-phase constructor - * @param aDev a CBTDevice instance. The ownership is transferred. + * @param aAddr the inquiry socket address of the device. + * @param aName the device-name of the device. * @param aNameOption the option for formating the default device - * name when the given aDev instance has no valid name. + * name when the given name is empty. */ IMPORT_C static CBtDevExtension* NewLC( const TInquirySockAddr& aAddr, const TDesC& aName = KNullDesC, TDefaultDevNameOption aNameOption = EColonSeperatedBDAddr ); + + /** + * Two-phase constructor + * @param aAddr the bd_addr of the device. + * @param aName the device-name of the device. + * @param aNameOption the option for formating the default device + * name when the given name is empty. + */ + IMPORT_C static CBtDevExtension* NewLC( + const TBTDevAddr& aAddr, + const TDesC& aName = KNullDesC, + TDefaultDevNameOption aNameOption = EColonSeperatedBDAddr ); /** * Destructor diff -r 91746b151f97 -r 997690c3397a bluetoothengine/btserviceutil/src/btdevextension.cpp --- a/bluetoothengine/btserviceutil/src/btdevextension.cpp Fri Jun 11 13:48:51 2010 +0300 +++ b/bluetoothengine/btserviceutil/src/btdevextension.cpp Wed Jun 23 18:23:52 2010 +0300 @@ -77,6 +77,27 @@ } // --------------------------------------------------------------------------- +// NewLC +// --------------------------------------------------------------------------- +// +EXPORT_C CBtDevExtension* CBtDevExtension::NewLC( + const TBTDevAddr& aAddr, + const TDesC& aName, + TDefaultDevNameOption aNameOption ) + { + CBtDevExtension* self = new (ELeave) CBtDevExtension( aNameOption ); + CleanupStack::PushL( self ); + CBTDevice* dev = CBTDevice::NewLC( aAddr ); + if ( aName.Length() ) + { + dev->SetDeviceNameL( BTDeviceNameConverter::ToUTF8L( aName ) ); + } + self->ConstructL( dev ); + CleanupStack::Pop( dev ); + return self; + } + +// --------------------------------------------------------------------------- // Destructor // --------------------------------------------------------------------------- // @@ -248,12 +269,15 @@ iAlias.Zero(); if ( iDev->IsValidFriendlyName() && iDev->FriendlyName().Length() != 0 ) { - iAlias.CreateL( iDev->FriendlyName() ); + iAlias.ReAllocL(iDev->FriendlyName().Length()); + iAlias.Append(iDev->FriendlyName()); } // otherwise, device name, if it is available, will be displayed else if ( iDev->IsValidDeviceName() && iDev->DeviceName().Length() != 0 ) { - iAlias.CreateL( BTDeviceNameConverter::ToUnicodeL(iDev->DeviceName() ) ); + TBTDeviceName name = BTDeviceNameConverter::ToUnicodeL(iDev->DeviceName()); + iAlias.ReAllocL(name.Length()); + iAlias.Append(name); } if ( iAlias.Length() == 0 && ( iNameOption == EColonSeperatedBDAddr || iNameOption == EPlainBDAddr ) ) diff -r 91746b151f97 -r 997690c3397a bluetoothengine/btui/btcpplugin/btcpplugin.cpp --- a/bluetoothengine/btui/btcpplugin/btcpplugin.cpp Fri Jun 11 13:48:51 2010 +0300 +++ b/bluetoothengine/btui/btcpplugin/btcpplugin.cpp Wed Jun 23 18:23:52 2010 +0300 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * 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" @@ -18,7 +18,6 @@ #include #include "btcpplugin.h" -#include "btcpuimainview.h" #include "btcpuisettingitem.h" /*! @@ -42,7 +41,7 @@ { return QList () << new BtCpUiSettingItem( - itemDataHelper, tr("Bluetooth")); + itemDataHelper); } diff -r 91746b151f97 -r 997690c3397a bluetoothengine/btui/btcpplugin/btcpplugin.h --- a/bluetoothengine/btui/btcpplugin/btcpplugin.h Fri Jun 11 13:48:51 2010 +0300 +++ b/bluetoothengine/btui/btcpplugin/btcpplugin.h Wed Jun 23 18:23:52 2010 +0300 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * 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" diff -r 91746b151f97 -r 997690c3397a bluetoothengine/btui/btcpplugin/btcpplugin.pro --- a/bluetoothengine/btui/btcpplugin/btcpplugin.pro Fri Jun 11 13:48:51 2010 +0300 +++ b/bluetoothengine/btui/btcpplugin/btcpplugin.pro Wed Jun 23 18:23:52 2010 +0300 @@ -19,39 +19,43 @@ DEPENDPATH += . INCLUDEPATH += . ../inc/ - CONFIG += qt hb plugin LIBS += -lcpframework -lbtuimodel -lbtuidelegate MOC_DIR = moc OBJECTS_DIR = obj -#TRANSLATIONS = telephone_cp.ts +TRANSLATIONS += btviews.ts \ + btdialogs.ts RESOURCES += btcpplugin.qrc # Input -HEADERS += btcpplugin.h \ - btcpuibaseview.h \ - btcpuimainview.h \ - btcpuisearchview.h \ - btcpuideviceview.h \ - btcpuisettingitem.h \ - btuiviewutil.h - -SOURCES += btcpplugin.cpp \ - btcpuibaseview.cpp \ - btcpuimainview.cpp \ - btcpuisearchview.cpp \ - btcpuideviceview.cpp \ - btcpuisettingitem.cpp - -symbian: { +HEADERS += btcpuimainlistviewitem.h \ + btcpuisearchlistviewitem.h \ + btcpplugin.h \ + btcpuibaseview.h \ + btcpuimainview.h \ + btcpuisearchview.h \ + btcpuideviceview.h \ + btcpuisettingitem.h \ + btuiviewutil.h +SOURCES += btcpuimainlistviewitem.cpp \ + btcpuisearchlistviewitem.cpp \ + btcpplugin.cpp \ + btcpuibaseview.cpp \ + btcpuimainview.cpp \ + btcpuisearchview.cpp \ + btcpuideviceview.cpp \ + btcpuisettingitem.cpp +symbian: { DEFINES += PLUGINUID3=0x2002434E TARGET.UID3 = 0x2002434E TARGET.CAPABILITY = ALL -TCB TARGET.EPOCALLOWDLLDATA = 1 INCLUDEPATH += $$MW_LAYER_SYSTEMINCLUDE + + LIBS += -lbtdevice PLUGIN_STUB_PATH = /resource/qt/plugins/controlpanel diff -r 91746b151f97 -r 997690c3397a bluetoothengine/btui/btcpplugin/btcpplugin.qrc --- a/bluetoothengine/btui/btcpplugin/btcpplugin.qrc Fri Jun 11 13:48:51 2010 +0300 +++ b/bluetoothengine/btui/btcpplugin/btcpplugin.qrc Wed Jun 23 18:23:52 2010 +0300 @@ -18,8 +18,6 @@ icons/qgn_prop_bt_printer.svg icons/qgn_prop_bt_unknown.svg icons/qgn_frwidget_add_friend_photo.svg - - docml/bt-main-view.docml docml/bt-search-view.docml docml/bt-device-view.docml diff -r 91746b151f97 -r 997690c3397a bluetoothengine/btui/btcpplugin/btcpuibaseview.cpp --- a/bluetoothengine/btui/btcpplugin/btcpuibaseview.cpp Fri Jun 11 13:48:51 2010 +0300 +++ b/bluetoothengine/btui/btcpplugin/btcpuibaseview.cpp Wed Jun 23 18:23:52 2010 +0300 @@ -1,24 +1,19 @@ /* -* ============================================================================ -* Name : btcpuibaseclass.cpp -* Part of : BluetoothUI / btapplication *** Info from the SWAD -* Description : Implements the baseclass for all views in btapplication. -* -* Copyright © 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: -* Nokia Corporation -* ============================================================================ -* Template version: 4.1 -*/ + * 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 "btcpuibaseview.h" #include diff -r 91746b151f97 -r 997690c3397a bluetoothengine/btui/btcpplugin/btcpuibaseview.h --- a/bluetoothengine/btui/btcpplugin/btcpuibaseview.h Fri Jun 11 13:48:51 2010 +0300 +++ b/bluetoothengine/btui/btcpplugin/btcpuibaseview.h Wed Jun 23 18:23:52 2010 +0300 @@ -1,24 +1,19 @@ /* -* ============================================================================ -* Name : btcpuibaseview.h -* Part of : BluetoothUI / btapplication *** Info from the SWAD -* Description : Declaration of the baseclass for all views in btapplication. -* -* Copyright © 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: -* Nokia Corporation -* ============================================================================ -* Template version: 4.2 -*/ + * 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 BTCPUIBASEVIEW_H #define BTCPUIBASEVIEW_H @@ -60,10 +55,10 @@ protected: - // do not owned + // not owned BtSettingModel *mSettingModel; - //do not owned + // not owned BtDeviceModel *mDeviceModel; QGraphicsItem *mParent; diff -r 91746b151f97 -r 997690c3397a bluetoothengine/btui/btcpplugin/btcpuideviceview.cpp --- a/bluetoothengine/btui/btcpplugin/btcpuideviceview.cpp Fri Jun 11 13:48:51 2010 +0300 +++ b/bluetoothengine/btui/btcpplugin/btcpuideviceview.cpp Wed Jun 23 18:23:52 2010 +0300 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * 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"" @@ -21,10 +21,13 @@ #include #include #include +#include +#include #include #include #include -#include +#include +#include #include #include #include @@ -35,6 +38,8 @@ #include #include #include +#include "btuiiconutil.h" +#include "btuidevtypemap.h" // docml to load const char* BTUI_DEVICEVIEW_DOCML = ":/docml/bt-device-view.docml"; @@ -45,7 +50,8 @@ BtDeviceModel &deviceModel, QGraphicsItem *parent) : BtCpUiBaseView(settingModel,deviceModel,parent), - mPairStatus(false), mConnectStatus(false), mConnectable(false), mAbstractDelegate(0) + mPairedStatus(false), mConnectedStatus(false), mTrustedStatus(false), mBlockedStatus(false), + mConnectable(false), mAbstractDelegate(0) { mDeviceIndex = QModelIndex();//is it needed to initialize mIndex??? @@ -63,11 +69,11 @@ // name in docml. setObjectName("bt_device_view"); + mLoader = new HbDocumentLoader(); + // Pass the view to documentloader. Document loader uses this view + // when docml is parsed, instead of creating new view. QObjectList objectList; objectList.append(this); - // Pass the view to documentloader. Document loader uses this view - // when docml is parsed, instead of creating new view. - mLoader = new HbDocumentLoader(); mLoader->setObjectTree(objectList); bool ret = false; @@ -77,23 +83,36 @@ // Exit if the file format is invalid BTUI_ASSERT_X( ok, "bt-device-view", "Invalid docml file" ); - // Set title for the control panel - // ToDo: check if deprecated API - setTitle("Control Panel"); + mOrientation = mMainWindow->orientation(); + + if (mOrientation == Qt::Horizontal) { + mLoader->load(BTUI_DEVICEVIEW_DOCML, "landscape", &ok); + BTUI_ASSERT_X( ok, "bt-device-view", "Invalid docml file: landscape section problem" ); + } + else { + mLoader->load(BTUI_DEVICEVIEW_DOCML, "portrait", &ok); + BTUI_ASSERT_X( ok, "bt-device-view", "Invalid docml file: landscape section problem" ); + } + + // listen for orientation changes + ret = connect(mMainWindow, SIGNAL(orientationChanged(Qt::Orientation)), + this, SLOT(changeOrientation(Qt::Orientation))); + BTUI_ASSERT_X( ret, "BtCpUiDeviceView::BtCpUiDeviceView()", "connect orientationChanged() failed"); + // assign automatically created widgets to local variables - + /* mGroupBox = 0; mGroupBox = qobject_cast( mLoader->findWidget( "groupBox_deviceView" ) ); BTUI_ASSERT_X( mGroupBox != 0, "bt-device-view", "Device groupbox not found" ); - + */ mDeviceIcon=0; //can't use qobject_cast since HbIcon is not derived from QObject! mDeviceIcon = qobject_cast( mLoader->findWidget( "deviceIcon" ) ); BTUI_ASSERT_X( mDeviceIcon != 0, "bt-device-view", "Device Icon not found" ); mDeviceName=0; - mDeviceName = qobject_cast( mLoader->findWidget( "deviceName" ) ); + mDeviceName = qobject_cast( mLoader->findWidget( "deviceName" ) ); BTUI_ASSERT_X( mDeviceName != 0, "bt-device-view", "Device Name not found" ); ret = connect(mDeviceName, SIGNAL(editingFinished ()), this, SLOT(changeBtDeviceName())); @@ -105,6 +124,13 @@ mDeviceStatus = qobject_cast( mLoader->findWidget( "deviceStatus" ) ); BTUI_ASSERT_X( mDeviceStatus != 0, "bt-device-view", "Device status not found" ); + + mConnectionCombobox = 0; + mConnectionCombobox = qobject_cast( mLoader->findWidget( "connectionCombobox" ) ); + BTUI_ASSERT_X( mConnectionCombobox != 0, "bt-device-view", "connection combobox not found" ); + + mConnectionComboboxModel = new HbDataFormModel(); + mPair_Unpair=0; mPair_Unpair = qobject_cast( mLoader->findWidget( "pushButton_0" ) ); BTUI_ASSERT_X( mPair_Unpair != 0, "bt-device-view", "pair/unpair button not found" ); @@ -121,18 +147,17 @@ mDeviceSetting = qobject_cast( mLoader->findWidget( "pushButton_2" ) ); BTUI_ASSERT_X( mDeviceSetting != 0, "bt-device-view", "settings button not found" ); - // read landscape orientation section from docml file if needed - // mOrientation = ((BTUIViewManager*)parent)->orientation(); - mOrientation = Qt::Vertical; - if (mOrientation == Qt::Horizontal) { - mLoader->load(BTUI_DEVICEVIEW_DOCML, "landscape", &ok); - BTUI_ASSERT_X( ok, "bt-device-view", "Invalid docml file: landscape section problem" ); - } + setConnectionCombobox(); + } BtCpUiDeviceView::~BtCpUiDeviceView() { + delete mLoader; // Also deletes all widgets that it constructed. + + delete mConnectionComboboxModel; + setNavigationAction(0); delete mSoftKeyBackAction; if(mAbstractDelegate) @@ -167,7 +192,7 @@ mDeviceBdAddr = (mDeviceModel->data(index, BtDeviceModel::ReadableBdaddrRole)); //activate view is called when device is selected - clearViewData(); + //clearViewData(); updateDeviceData(); bool ret(false); @@ -180,23 +205,46 @@ { } +// called due to real orientation change event coming from main window +void BtCpUiDeviceView::changeOrientation( Qt::Orientation orientation ) +{ + bool ok = false; + mOrientation = orientation; + if( orientation == Qt::Vertical ) { + // load "portrait" section + mLoader->load( BTUI_DEVICEVIEW_DOCML, "portrait", &ok ); + BTUI_ASSERT_X( ok, "bt-device-view", "Invalid docml file: portrait section problem" ); + } else { + // load "landscape" section + mLoader->load( BTUI_DEVICEVIEW_DOCML, "landscape", &ok ); + BTUI_ASSERT_X( ok, "bt-device-view", "Invalid docml file: landscape section problem" ); + } +} + void BtCpUiDeviceView::clearViewData() { mDeviceIcon->clear(); mDeviceCategory->clear(); mDeviceStatus->clear(); - mPairStatus = false; - mConnectStatus = false; + mPairedStatus = false; + mConnectedStatus = false; + mTrustedStatus = false; + mBlockedStatus = false; + mConnectable = false; } void BtCpUiDeviceView::updateDeviceData() { - QModelIndex localIndex = mSettingModel->index( BtSettingModel::LocalBtNameRow, 0); + clearViewData(); + // ToDo: the groupbox header should only say "Bluetooth", ie. without device name; + // check new TextMap file for the right TextId + /*QModelIndex localIndex = mSettingModel->index( BtSettingModel::LocalBtNameRow, 0); QString localName = (mSettingModel->data(localIndex,BtSettingModel::settingDisplayRole)).toString(); - QString groupBoxTitle (tr("Bluetooth-")); - mGroupBox->setHeading(groupBoxTitle.append(localName)); + QString groupBoxTitle (hbTrId("txt_bt_subhead_bluetooth_1").arg(localName)); + mGroupBox->setHeading(groupBoxTitle); + */ //Get the QModelIndex of the device using the device BDAddres QModelIndex start = mDeviceModel->index(0,0); QModelIndexList indexList = mDeviceModel->match(start,BtDeviceModel::ReadableBdaddrRole, mDeviceBdAddr); @@ -205,7 +253,7 @@ //populate device view with device data fetched from UiModel QString deviceName = (mDeviceModel->data(mDeviceIndex, BtDeviceModel::NameAliasRole)).toString(); - mDeviceName->setPlainText(deviceName); + mDeviceName->setText(deviceName); int cod = (mDeviceModel->data(mDeviceIndex,BtDeviceModel::CoDRole)).toInt(); @@ -219,90 +267,135 @@ void BtCpUiDeviceView::setDeviceCategory(int cod,int majorRole, int minorRole) { - //TODO: change the hardcoded numeric value to enumerations - if (cod) - { - if (majorRole & 0x00020000) - { - //this is a phone - mDeviceCategory->setPlainText(tr("Phone")); - } - else if (majorRole & 0x00010000) - { - //this is a computer - mDeviceCategory->setPlainText(tr("Computer")); - + mDeviceCategory->setPlainText( getDeviceTypeString( cod )); + HbIcon icon = + getBadgedDeviceTypeIcon(cod, majorRole, + BtuiBottomLeft | BtuiBottomRight | BtuiTopLeft | BtuiTopRight ); + mDeviceIcon->setIcon(icon); + + if (majorRole & BtuiDevProperty::AVDev) { + if ( minorRole & BtuiDevProperty::Headset){ + // this is a Headset, it is possible to connect + mConnectable = true; } - else if (majorRole & 0x00080000) - { - //this is a A/V device - //int minorRole = (mDeviceModel->data(mIndex,BtDeviceModel::MinorPropertyRole)).toInt(); - if ( minorRole & 0x00000002) - { - //this is a Headset, it is possible to connect - mConnectable = true; - mDeviceCategory->setPlainText(tr("Headset")); - } - } - else - { - mDeviceCategory->setPlainText(tr("Uncategorized Dev")); - } - } - - } + void BtCpUiDeviceView::setDeviceStatus(int majorRole) { - //TODO: change the hardcoded numeric value to enumerations QString deviceStatus; - if (majorRole & 0x00000001) - { - deviceStatus = deviceStatus.append(tr("Paired")); - mPairStatus = true; + + updateStatusVariables(majorRole); // should we use bitmap instead?? + + if (majorRole & BtuiDevProperty::Bonded && + majorRole & BtuiDevProperty::Trusted && + majorRole & BtuiDevProperty::Connected ) { + mDeviceStatus->setPlainText(hbTrId("txt_bt_info_paired_trused_connected")); + } + else if (majorRole & BtuiDevProperty::Bonded && + majorRole & BtuiDevProperty::Connected ) { + mDeviceStatus->setPlainText(hbTrId("txt_bt_info_paired_connected")); } - else - { - mPairStatus = false; + else if (majorRole & BtuiDevProperty::Bonded && + majorRole & BtuiDevProperty::Trusted ) { + mDeviceStatus->setPlainText(hbTrId("txt_bt_info_paired_trusted")); + } + else if (majorRole & BtuiDevProperty::Bonded) { + mDeviceStatus->setPlainText(hbTrId("txt_bt_info_paired")); + } + else if (majorRole & BtuiDevProperty::Connected) { + mDeviceStatus->setPlainText(hbTrId("txt_bt_info_connected")); } + else if (majorRole & BtuiDevProperty::Blocked) { + mDeviceStatus->setPlainText(hbTrId("txt_bt_info_blocked")); + } + else { + // device not paired, connected, trusted or blocked. is this ok? + } + +} + +void BtCpUiDeviceView::setConnectionCombobox(){ + + //create a model class - if ((majorRole & 0x00000020)&& (mConnectable)) - { - //if the device is connected and it is a headset NOTE! two phone can be paired but not be connected - deviceStatus = deviceStatus.append(tr(", connected")); - mConnectStatus = true; + mConnectionComboboxModel->appendDataFormItem( + HbDataFormModelItem::ComboBoxItem, QString("Connection"), mConnectionComboboxModel->invisibleRootItem()); + + //set the model to the view, once model and data class are created + mConnectionCombobox->setModel(mConnectionComboboxModel); + + + +} + + +/*! + * instead of using separate boolean variables we could use bitmap in single variable + */ +void BtCpUiDeviceView::updateStatusVariables(int majorRole) +{ + if (majorRole & BtuiDevProperty::Trusted ) { + mTrustedStatus = true; + } + else { + mTrustedStatus = false; } - else - { - mConnectStatus = false; + if (majorRole & BtuiDevProperty::Bonded) { + mPairedStatus = true; + } + else { + mPairedStatus = false; + } + if (majorRole & BtuiDevProperty::Connected) { + mConnectedStatus = true; } - mDeviceStatus->setPlainText(deviceStatus); - - - + else { + mConnectedStatus = false; + } + if (majorRole & BtuiDevProperty::Blocked) { + mBlockedStatus = true; + } + else { + mBlockedStatus = false; + } } void BtCpUiDeviceView::setTextAndVisibilityOfButtons() { - if (mPairStatus) + mPair_Unpair->setStretched(true); + if (mPairedStatus) { - mPair_Unpair->setText(tr("Unpair")); + HbIcon icon("qtg_mono_bt_unpair"); + icon.setIconName("qtg_mono_bt_unpair"); + mPair_Unpair->setIcon(icon); + mPair_Unpair->setText(hbTrId("txt_bt_button_unpair")); + } else { - mPair_Unpair->setText(tr("Pair")); + HbIcon icon("qtg_mono_bt_pair"); + icon.setIconName("qtg_mono_bt_pair"); + mPair_Unpair->setIcon(icon); + mPair_Unpair->setText(hbTrId("txt_bt_button_pair")); } if (mConnectable) { - if (mConnectStatus) + mConnect_Disconnect->setStretched(true); + if (mConnectedStatus) { - mConnect_Disconnect->setText(tr("Disconnect")); + HbIcon icon("qtg_mono_speaker_off"); + icon.setIconName("qtg_mono_speaker_off"); + mConnect_Disconnect->setIcon(icon); + mConnect_Disconnect->setText(hbTrId("txt_bt_button_disconnect")); } else { - mConnect_Disconnect->setText(tr("Connect")); + HbIcon icon("qtg_mono_speaker"); + icon.setIconName("qtg_mono_speaker"); + mConnect_Disconnect->setIcon(icon); + mConnect_Disconnect->setText(hbTrId("txt_bt_button_connect")); } } @@ -316,22 +409,10 @@ } -void BtCpUiDeviceView::changeBtDeviceName() -{ - /* - if (!mAbstractDelegate) - { - mAbstractDelegate = BtDelegateFactory::newDelegate(BtDelegate::DeviceName, mModel); - connect( mAbstractDelegate, SIGNAL(commandCompleted(int,QVariant)), this, SLOT(btNameDelegateCompleted(int,QVariant)) ); - mAbstractDelegate->exec(mDeviceNameEdit->text ()); - } - */ - -} void BtCpUiDeviceView::pairUnpair() { - if (mPairStatus) + if (mPairedStatus) { //if the device is paired, call unpairDevice() when the button is tabbed unpairDevice(); @@ -348,7 +429,7 @@ void BtCpUiDeviceView::connectDisconnect() { - if (mConnectStatus) + if (mConnectedStatus) { //if the device is connected, call disconnectDevice() when the button is tabbed disconnectDevice(); @@ -448,8 +529,25 @@ { if (!mAbstractDelegate)//if there is no other delegate running { + + + DisconnectOption discoOpt = ServiceLevel; + + QListlist; + QVariant paramFirst; + paramFirst.setValue(mDeviceIndex); + + QVariant paramSecond; + paramSecond.setValue((int)discoOpt); + + list.append(paramFirst); + list.append(paramSecond); + QVariant params; - params.setValue(mDeviceIndex); + params.setValue(list); + + + //params.setValue(mDeviceIndex); mAbstractDelegate = BtDelegateFactory::newDelegate( BtDelegate::Disconnect, mSettingModel, mDeviceModel); connect( mAbstractDelegate, SIGNAL(commandCompleted(int)), this, SLOT(disconnectDelegateCompleted(int)) ); @@ -471,3 +569,48 @@ } +void BtCpUiDeviceView::changeBtDeviceName(){ + if (!mAbstractDelegate)//if there is no other delegate running + { + QListlist; + + QVariant index; + index.setValue(mDeviceIndex); + + QVariant name; + name.setValue(mDeviceName->text()); + + list.append(index); + list.append(name); + + QVariant params; + params.setValue(list); + + mAbstractDelegate = BtDelegateFactory::newDelegate( + BtDelegate::RemoteDevName, mSettingModel, mDeviceModel); + connect( mAbstractDelegate, SIGNAL(commandCompleted(int, QVariant)), this, SLOT(changeDevNameDelegateCompleted(int, QVariant)) ); + mAbstractDelegate->exec(params); + } + +} + +void BtCpUiDeviceView::changeDevNameDelegateCompleted(int status, QVariant param) +{ + + + if(KErrNone == status) { + mDeviceName->setText(param.toString()); + } + else { + //setPrevBtLocalName(); + } + //TODO:Error handling has to be done. + if (mAbstractDelegate) + { + disconnect(mAbstractDelegate); + delete mAbstractDelegate; + mAbstractDelegate = 0; + } + + +} diff -r 91746b151f97 -r 997690c3397a bluetoothengine/btui/btcpplugin/btcpuideviceview.h --- a/bluetoothengine/btui/btcpplugin/btcpuideviceview.h Fri Jun 11 13:48:51 2010 +0300 +++ b/bluetoothengine/btui/btcpplugin/btcpuideviceview.h Wed Jun 23 18:23:52 2010 +0300 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * 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"" @@ -25,13 +25,14 @@ class HbGroupBox; class HbLabel; -class HbTextEdit; +class HbLineEdit; class HbPushButton; class HbIcon; class HbDocumentLoader; -class HbListView; +class HbDataForm; + class HbDataFormModel; -class HbDataFormModelItem; +//class HbDataFormModelItem; class CpSettingFormItemData; class BtAbstractDelegate; @@ -53,6 +54,7 @@ public slots: virtual void switchToPreviousView(); + void changeOrientation( Qt::Orientation orientation ); void updateDeviceData(); void changeBtDeviceName(); void pairUnpair(); @@ -61,6 +63,7 @@ void unpairDelegateCompleted(int status); void connectDelegateCompleted(int status); void disconnectDelegateCompleted(int status); + void changeDevNameDelegateCompleted(int status, QVariant param); private: void clearViewData(); @@ -70,16 +73,21 @@ void disconnectDevice(); void setDeviceCategory(int cod, int majorRole, int minorRole);//cod:class of device void setDeviceStatus(int majorRole); + void setConnectionCombobox(); void setTextAndVisibilityOfButtons(); + void updateStatusVariables(int majorRole); private: HbDocumentLoader *mLoader; - HbGroupBox *mGroupBox; + //HbGroupBox *mGroupBox; HbLabel *mDeviceIcon; - HbTextEdit *mDeviceName; + HbLineEdit *mDeviceName; HbLabel *mDeviceCategory; HbLabel *mDeviceStatus; + HbDataForm *mConnectionCombobox; + HbDataFormModel *mConnectionComboboxModel; + HbPushButton *mPair_Unpair; HbPushButton *mConnect_Disconnect; HbPushButton *mDeviceSetting; @@ -99,12 +107,14 @@ QVariant mDeviceBdAddr; //true -> device is paired; false -> device is unpaired - bool mPairStatus; + bool mPairedStatus; //true-> device is connected; false -> device is disconnected - bool mConnectStatus; - - //true -> device is connectable + bool mConnectedStatus; + bool mTrustedStatus; + bool mBlockedStatus; + + //true -> device is connectable //e.g. not possible to connect to a phone, but possible to connect to a headset bool mConnectable; diff -r 91746b151f97 -r 997690c3397a bluetoothengine/btui/btcpplugin/btcpuimainlistviewitem.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/bluetoothengine/btui/btcpplugin/btcpuimainlistviewitem.cpp Wed Jun 23 18:23:52 2010 +0300 @@ -0,0 +1,114 @@ +/* +* Copyright (c) 2008-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: BTUISearchListViewItem implementation +* +*/ + + +#include "btcpuimainlistviewitem.h" +#include "btdevicemodel.h" +#include "btuiiconutil.h" +#include + +BtCpUiMainListViewItem::BtCpUiMainListViewItem(QGraphicsItem * parent) : + HbListViewItem(parent), mParent(parent) +{ + mDeviceNameLabel = 0; + mDevTypeIconLabel = 0; + mDevTypeTextLabel = 0; + mBtuiModelSortFilter = ((BtCpUiMainListViewItem *)parent)->mBtuiModelSortFilter; + + mRow = 0; +} + +BtCpUiMainListViewItem::~BtCpUiMainListViewItem() +{ + delete mDeviceNameLabel; + delete mDevTypeIconLabel; + delete mDevTypeTextLabel; +} + +/* + * This method is called by the HbListView when it needs a new + * view item element. + * + */ +HbAbstractViewItem * BtCpUiMainListViewItem::createItem() +{ + return new BtCpUiMainListViewItem(*this); +} + +/*! + UpdateChildItem updates the item graphics. + Screen elements are created once if not already done. This may increase the overall memory + consumption of the application, however, this is deemed inconsequential. There might be a small + performance improvement with current style. + */ +void BtCpUiMainListViewItem::updateChildItems() +{ + QModelIndex index; + + // Get device name from model + if (mBtuiModelSortFilter) + index = mBtuiModelSortFilter->mapToSource(modelIndex()); + else + index = modelIndex(); + + // create new icon label if needed + if (!mDevTypeIconLabel) { + mDevTypeIconLabel = new HbLabel(); + mDevTypeIconLabel->setPreferredSize(53.5260, 53.5260); //8un x 8un + mDevTypeIconLabel->setMinimumWidth(53.5260); + } + // create new label if needed + if (!mDeviceNameLabel) { + mDeviceNameLabel = new HbLabel(); + mDeviceNameLabel->setPreferredSize(250, 26.763); + } + // create new label if needed + if (!mDevTypeTextLabel) { + mDevTypeTextLabel = new HbLabel(); + mDevTypeTextLabel->setPreferredSize(250, 26.763); + } + // create layout if needed + if ( !mRow ) { + // Still need to create the actual layout + mRow = new QGraphicsGridLayout(); + mRow->addItem(mDevTypeIconLabel,0,0,2,1); + mRow->addItem(mDeviceNameLabel,0,1,1,1); + mRow->addItem(mDevTypeTextLabel,1,1,1,1); + setLayout(mRow); + } + + QString data = index.data(Qt::DisplayRole).toString(); + int cod = (index.data(BtDeviceModel::CoDRole)).toInt(); + int majorProperty = (index.data(BtDeviceModel::MajorPropertyRole)).toInt(); + + // ToDo: remove clear() once Orbit bug is fixed + mDeviceNameLabel->clear(); + mDeviceNameLabel->setPlainText(data); + mDevTypeIconLabel->clear(); + mDevTypeTextLabel->clear(); + mDevTypeTextLabel->setPlainText( getDeviceTypeString( cod )); + HbIcon icon = + getBadgedDeviceTypeIcon( cod, majorProperty, + BtuiBottomLeft | BtuiBottomRight | BtuiTopLeft | BtuiTopRight ); + mDevTypeIconLabel->setIcon(icon); +} + + +void BtCpUiMainListViewItem::setModelSortFilter(BtuiModelSortFilter *filter) +{ + mBtuiModelSortFilter = filter; +} diff -r 91746b151f97 -r 997690c3397a bluetoothengine/btui/btcpplugin/btcpuimainlistviewitem.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/bluetoothengine/btui/btcpplugin/btcpuimainlistviewitem.h Wed Jun 23 18:23:52 2010 +0300 @@ -0,0 +1,51 @@ +/* +* Copyright (c) 2008-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: device view item +* +*/ + + +#ifndef BTCPUIMAINLISTVIEWITEM_H +#define BTCPUIMAINLISTVIEWITEM_H + +#include +#include +#include +#include +#include "btuimodelsortfilter.h" + +class BtCpUiMainListViewItem : public HbListViewItem +{ + Q_OBJECT + +public: + BtCpUiMainListViewItem(QGraphicsItem * parent = 0); + ~BtCpUiMainListViewItem(); + + HbAbstractViewItem * createItem(); + void updateChildItems(); + + void setModelSortFilter(BtuiModelSortFilter *filter); + +private: + QGraphicsItem *mParent; + HbLabel *mDevTypeIconLabel; + HbLabel *mDeviceNameLabel; + HbLabel *mDevTypeTextLabel; + BtuiModelSortFilter* mBtuiModelSortFilter; + + QGraphicsGridLayout *mRow; +}; + +#endif /* BTCPUIMAINLISTVIEWITEM_H */ diff -r 91746b151f97 -r 997690c3397a bluetoothengine/btui/btcpplugin/btcpuimainview.cpp --- a/bluetoothengine/btui/btcpplugin/btcpuimainview.cpp Fri Jun 11 13:48:51 2010 +0300 +++ b/bluetoothengine/btui/btcpplugin/btcpuimainview.cpp Wed Jun 23 18:23:52 2010 +0300 @@ -1,5 +1,5 @@ /* -* Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies). +* 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" @@ -33,13 +33,15 @@ #include #include #include +#include #include "btcpuisearchview.h" #include "btcpuideviceview.h" #include #include #include #include "btqtconstants.h" - +#include "btcpuimainlistviewitem.h" +#include "btuidevtypemap.h" // docml to load const char* BTUI_MAINVIEW_DOCML = ":/docml/bt-main-view.docml"; @@ -57,7 +59,7 @@ mAbstractDelegate(0), mMainFilterModel(0) { bool ret(false); - + mMainWindow = hbInstance->allMainWindows().first(); mMainView = this; @@ -66,11 +68,11 @@ // name in docml. setObjectName("view"); + mLoader = new HbDocumentLoader(); + // Pass the view to documentloader. Document loader uses this view + // when docml is parsed, instead of creating new view. QObjectList objectList; objectList.append(this); - // Pass the view to documentloader. Document loader uses this view - // when docml is parsed, instead of creating new view. - mLoader = new HbDocumentLoader(); mLoader->setObjectTree(objectList); bool ok = false; @@ -103,6 +105,14 @@ mVisibilityMode=0; mVisibilityMode = qobject_cast( mLoader->findWidget( "combobox" ) ); BTUI_ASSERT_X( mVisibilityMode != 0, "bt-main-view", "visibility combobox not found" ); + // add new item for temporary visibility + // NOTE: translation (at least default english) gives string "(p)Visible for 5 min", + // if setting 1 min --> "(s)Visible for 1 min", ie p=plural, s=singular, but these should + // not be shown to the user! + // ToDo: change this to use translation once it starts working +// QString tempVis(hbTrId("txt_bt_setlabel_visibility_val_visible_for_l1_min", TEMP_VISIBILITY_DEFAULT)); + QString tempVis(hbTrId("Visible for 5 min")); + mVisibilityMode->addItem(tempVis, Qt::DisplayRole); mDeviceList=0; mDeviceList = qobject_cast( mLoader->findWidget( "listView" ) ); @@ -120,7 +130,22 @@ HbAction *discoverAction = static_cast( mLoader->findObject( "discoverAction" ) ); BTUI_ASSERT_X( discoverAction, "bt-main-view", "discover action missing" ); ret = connect(discoverAction, SIGNAL(triggered()), this, SLOT(goToDiscoveryView())); - BTUI_ASSERT_X( ret, "bt-main-view", "orientation toggle can't connect" ); + BTUI_ASSERT_X( ret, "bt-main-view", "discover action can't connect" ); + + // load tool bar actions + mAllAction = static_cast( mLoader->findObject( "allAction" ) ); + BTUI_ASSERT_X( mAllAction, "bt-main-view", "All action missing" ); + ret = connect(mAllAction, SIGNAL(triggered()), this, SLOT(allActionTriggered())); + BTUI_ASSERT_X( ret, "bt-main-view", "all action can't connect" ); + + // load tool bar actions + mPairAction = static_cast( mLoader->findObject( "pairedAction" ) ); + BTUI_ASSERT_X( mPairAction, "bt-main-view", "Pair action missing" ); + ret = connect(mPairAction, SIGNAL(triggered()), this, SLOT(pairActiontriggered())); + BTUI_ASSERT_X( ret, "bt-main-view", "pair action can't connect" ); + + mGroupBox = qobject_cast( mLoader->findWidget( "groupBox" ) ); + BTUI_ASSERT_X( mGroupBox != 0, "bt-main-view", "Group Box not found" ); //*********************Testing device view START****************************// HbAction *removePairedDevices = static_cast( mLoader->findObject( "removePairedDevices" ) ); @@ -158,14 +183,14 @@ mMainFilterModel = new BtuiModelSortFilter(this); mMainFilterModel->setSourceModel( mDeviceModel ); - // filter to match only InRegistry devices - mMainFilterModel->addDeviceMajorFilter( - BtDeviceModel::InRegistry, - BtuiModelSortFilter::AtLeastMatch); + updateDeviceListFilter(BtuiPaired); + // List view item + BtCpUiMainListViewItem *prototype = new BtCpUiMainListViewItem(mDeviceList); + prototype->setModelSortFilter(mMainFilterModel); + mDeviceList->setItemPrototype(prototype); mDeviceList->setModel(mMainFilterModel); - } /*! @@ -174,13 +199,8 @@ BtCpUiMainView::~BtCpUiMainView() { delete mLoader; // Also deletes all widgets that it constructed. - mMainWindow->removeView(mSearchView); - delete mSearchView; - mMainWindow->removeView(mDeviceView); - delete mDeviceView; - if (mAbstractDelegate) { delete mAbstractDelegate; } @@ -204,11 +224,6 @@ } -void BtCpUiMainView::itemActivated(QModelIndex index) -{ - Q_UNUSED(index); -} - void BtCpUiMainView::goToDiscoveryView() { changeView( SearchView, false, 0 ); @@ -244,7 +259,7 @@ void BtCpUiMainView::setPrevBtLocalName() { //Should we notify user this as Error...? - HbNotificationDialog::launchDialog(hbTrId("Error")); + HbNotificationDialog::launchDialog(hbTrId("Error")); // ToDo: missing text id QModelIndex index = mSettingModel->index( BtSettingModel::LocalBtNameRow,0 ); mDeviceNameEdit->setText( mSettingModel->data( @@ -276,12 +291,12 @@ VisibilityMode mode = indexToVisibilityMode(index); list.append(QVariant((int)mode)); - if(BtTemporary == VisibilityMode(mode)) { + if( BtTemporary == VisibilityMode(mode) ) { //Right now hardcoded to 5 Mins. list.append(QVariant(5)); } //Error handling has to be done. - if (!mAbstractDelegate) { + if ( !mAbstractDelegate ) { mAbstractDelegate = BtDelegateFactory::newDelegate(BtDelegate::Visibility, mSettingModel, mDeviceModel); connect( mAbstractDelegate, SIGNAL(commandCompleted(int)), this, SLOT(visibilityDelegateCompleted(int)) ); @@ -295,24 +310,49 @@ void BtCpUiMainView::setPrevVisibilityMode() { - bool ret(false); - - //Should we notify this error to user..? - HbNotificationDialog::launchDialog(hbTrId("Error")); + QModelIndex index = mSettingModel->index( BtSettingModel::VisibilityRow, 0 ); - ret = disconnect(mVisibilityMode, SIGNAL(currentIndexChanged (int)), - this, SLOT(visibilityChanged (int))); - BTUI_ASSERT_X( ret, "BtCpUiMainView::setPrevVisibilityMode", "can't disconnect signal" ); - mVisibilityMode->setCurrentIndex ( visibilityModeToIndex((VisibilityMode) mSettingModel->data(index,BtSettingModel::SettingValueRole).toInt()) ); - //Handle Visibility Change User Interaction - ret = connect(mVisibilityMode, SIGNAL(currentIndexChanged (int)), - this, SLOT(visibilityChanged (int))); - BTUI_ASSERT_X( ret, "BtCpUiMainView::setPrevVisibilityMode", "can't connect signal" ); +} + + +void BtCpUiMainView::allActionTriggered() +{ + updateDeviceListFilter(BtuiAll); +} + +void BtCpUiMainView::pairActiontriggered() +{ + updateDeviceListFilter(BtuiPaired); +} +void BtCpUiMainView::updateDeviceListFilter(BtCpUiMainView::filterType filter) +{ + mMainFilterModel->clearDeviceMajorFilters(); + + switch (filter) { + case BtuiAll: + mGroupBox->setHeading(hbTrId("txt_bt_subhead_bluetooth_all_devices")); + mPairAction->setEnabled(true); + mAllAction->setEnabled(false); + mMainFilterModel->addDeviceMajorFilter( + BtuiDevProperty::InRegistry, + BtuiModelSortFilter::AtLeastMatch); + + break; + case BtuiPaired: + mGroupBox->setHeading(hbTrId("txt_bt_subhead_bluetooth_paired_devices")); + mPairAction->setEnabled(false); + mAllAction->setEnabled(true); + mMainFilterModel->addDeviceMajorFilter( + BtuiDevProperty::InRegistry | BtuiDevProperty::Bonded, + BtuiModelSortFilter::AtLeastMatch); + + break; + } } @@ -351,21 +391,14 @@ } } -void BtCpUiMainView::commandCompleted( int cmdId, int err, const QString &diagnostic ) -{ - Q_UNUSED(cmdId); - Q_UNUSED(err); - Q_UNUSED(diagnostic); - -} - /*! Slot for receiving notification of local setting changes from the model. Identify the setting changed and update the corresponding UI item. */ void BtCpUiMainView::updateSettingItems(const QModelIndex &topLeft, const QModelIndex &bottomRight) { - + bool val(false); + // update only the part of the view specified by the model's row(s) for (int i=topLeft.row(); i <= bottomRight.row(); i++) { QModelIndex index = mSettingModel->index( i, 0); @@ -376,8 +409,17 @@ mSettingModel->data(index,BtSettingModel::settingDisplayRole).toString() ); break; case BtSettingModel::PowerStateRow: - mPowerButton->setText( mSettingModel->data(index, - BtSettingModel::settingDisplayRole).toString() ); + val = mSettingModel->data(index, BtSettingModel::SettingValueRole).toBool(); + if (val) { + HbIcon icon("qtg_mono_bluetooth"); + icon.setIconName("qtg_mono_bluetooth"); + mPowerButton->setIcon(icon); + } + else { + HbIcon icon("qtg_mono_bluetooth_off"); + icon.setIconName("qtg_mono_bluetooth_off"); + mPowerButton->setIcon(icon); + } break; case BtSettingModel::VisibilityRow: mVisibilityMode->setCurrentIndex ( visibilityModeToIndex((VisibilityMode) @@ -393,15 +435,24 @@ */ void BtCpUiMainView::changePowerState() { + QModelIndex index = mSettingModel->index(BtSettingModel::PowerStateRow, 0); + PowerStateQtValue powerState = (PowerStateQtValue)mSettingModel->data(index, Qt::EditRole).toInt(); + BTUI_ASSERT_X(((powerState == BtPowerOn) || (powerState == BtPowerOff)), + "BtCpUiMainView::changePowerState()", "incorrect qt power state"); + + if (powerState == BtPowerOff) { + powerState = BtPowerOn; + } + else { + powerState = BtPowerOff; + } - QModelIndex index = mSettingModel->index(BtSettingModel::PowerStateRow, 0); - QVariant powerState = mSettingModel->data(index, Qt::EditRole); if (!mAbstractDelegate)//if there is no other delegate running { mAbstractDelegate = BtDelegateFactory::newDelegate(BtDelegate::ManagePower, mSettingModel, mDeviceModel ); connect( mAbstractDelegate, SIGNAL(commandCompleted(int)), this, SLOT(powerDelegateCompleted(int)) ); - mAbstractDelegate->exec(powerState); + mAbstractDelegate->exec(QVariant((int)powerState)); } } @@ -424,7 +475,7 @@ */ VisibilityMode BtCpUiMainView::indexToVisibilityMode(int index) { - VisibilityMode mode; + VisibilityMode mode = BtVisibilityUnknown; switch(index) { case UiRowBtHidden: mode = BtHidden; @@ -436,7 +487,7 @@ mode = BtTemporary; break; default: - mode = BtUnknown; + BTUI_ASSERT_X(false, "BtCpUiMainView::indexToVisibilityMode", "invalid mode"); } return mode; } @@ -446,7 +497,7 @@ */ int BtCpUiMainView::visibilityModeToIndex(VisibilityMode mode) { - int uiRow; + int uiRow = UiRowBtUnknown; switch(mode) { case BtHidden: uiRow = UiRowBtHidden; @@ -458,15 +509,12 @@ uiRow = UiRowBtTemporary; break; default: - uiRow = -1; // error + BTUI_ASSERT_X(false, "BtCpUiMainView::visibilityModeToIndex", "invalid mode"); } return uiRow; } -////////////////////// -// -// from view manager -// -////////////////////// + + /*! Create views(main view, device view and search view). @@ -554,21 +602,6 @@ return 0; } -/* - Jump to previous view. This function is used when back button is pressed. - */ -void BtCpUiMainView::switchToPreviousViewReally() -{ -// // jump to previous view of current view. -// if( (mCurrentViewId >= 0) && (mCurrentViewId < LastView)) { -// changeView( mPreviousViewIds[mCurrentViewId], true, 0 ); -// } -// else { -// BTUI_ASSERT_X(false, "BtCpUiMainView::switchToPreviousViewReally", "invalid view id"); -// } -} - - void BtCpUiMainView::setSoftkeyBack() { diff -r 91746b151f97 -r 997690c3397a bluetoothengine/btui/btcpplugin/btcpuimainview.h --- a/bluetoothengine/btui/btcpplugin/btcpuimainview.h Fri Jun 11 13:48:51 2010 +0300 +++ b/bluetoothengine/btui/btcpplugin/btcpuimainview.h Wed Jun 23 18:23:52 2010 +0300 @@ -1,5 +1,5 @@ /* -* Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). +* 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" @@ -31,18 +31,13 @@ class HbGridView; class BtAbstractDelegate; class HbListView; +class HbGroupBox; class BtCpUiMainView : public BtCpUiBaseView { Q_OBJECT public: -// enum ViewIndex { -// MainView, -// SearchView, -// DeviceView, -// LastView -// }; explicit BtCpUiMainView( BtSettingModel &settingModel, BtDeviceModel &deviceModel, @@ -59,9 +54,7 @@ virtual void deactivateView(); public slots: - void commandCompleted( int cmdId, int err, const QString &diagnostic ); void changeOrientation( Qt::Orientation orientation ); - void itemActivated(QModelIndex index); void changePowerState(); void updateSettingItems(const QModelIndex &topLeft, const QModelIndex &bottomRight); @@ -71,7 +64,6 @@ // from view manager void changeView(int targetViewId, bool fromBackButton, int cmdId, const QVariant& value = 0 ); - void switchToPreviousViewReally(); virtual void switchToPreviousView(); void visibilityChanged (int index); @@ -81,9 +73,16 @@ void powerDelegateCompleted(int status); void visibilityDelegateCompleted(int status); void btNameDelegateCompleted(int status, QVariant param); + void allActionTriggered(); + void pairActiontriggered(); protected: +private: + enum filterType { + BtuiAll = 0, + BtuiPaired + }; private: VisibilityMode indexToVisibilityMode(int index); @@ -94,17 +93,17 @@ void setPrevBtLocalName(); void setPrevVisibilityMode(); + void updateDeviceListFilter(BtCpUiMainView::filterType filter); + private: - QAbstractItemModel* mSubModel; + HbDocumentLoader *mLoader; + HbLineEdit *mDeviceNameEdit; HbPushButton *mPowerButton; HbComboBox *mVisibilityMode; HbListView *mDeviceList; - - // data structures for switching between views - bool mEventFilterInstalled; - int mAutoCmdId; + Qt::Orientation mOrientation; // from view manager @@ -114,12 +113,14 @@ BtCpUiBaseView* mSearchView; BtCpUiBaseView* mCurrentView; int mCurrentViewId; - HbAction *mBackAction; QList mPreviousViewIds; //poiter to abstract delegate, and it is instantiated at runtime BtAbstractDelegate* mAbstractDelegate; BtuiModelSortFilter *mMainFilterModel; + HbAction *mAllAction; + HbAction *mPairAction; + HbGroupBox *mGroupBox; }; #endif // BTCPUIMAINVIEW_H diff -r 91746b151f97 -r 997690c3397a bluetoothengine/btui/btcpplugin/btcpuisearchlistviewitem.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/bluetoothengine/btui/btcpplugin/btcpuisearchlistviewitem.cpp Wed Jun 23 18:23:52 2010 +0300 @@ -0,0 +1,115 @@ +/* +* 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: BTUISearchListViewItem implementation +* +*/ + + +#include "btcpuisearchlistviewitem.h" +#include "btdevicemodel.h" +#include "btuiiconutil.h" +#include + +BtCpUiSearchListViewItem::BtCpUiSearchListViewItem(QGraphicsItem * parent) : + HbListViewItem(parent), mParent(parent) +{ + mDeviceNameLabel = 0; + mDevTypeIconLabel = 0; + mDevTypeTextLabel = 0; + mBtuiModelSortFilter = ((BtCpUiSearchListViewItem *)parent)->mBtuiModelSortFilter; + + mRow = 0; +} + +BtCpUiSearchListViewItem::~BtCpUiSearchListViewItem() +{ + delete mDeviceNameLabel; + delete mDevTypeIconLabel; + delete mDevTypeTextLabel; +} + +/* + * This method is called by the HbListView when it needs a new + * view item element. + * + */ +HbAbstractViewItem * BtCpUiSearchListViewItem::createItem() +{ + return new BtCpUiSearchListViewItem(*this); +} + +/*! + UpdateChildItem updates the item graphics. + Screen elements are created once if not already done. This may increase the overall memory + consumption of the application, however, this is deemed inconsequential. There might be a small + performance improvement with current style. + */ +void BtCpUiSearchListViewItem::updateChildItems() +{ + QModelIndex index; + + // Get device name from model + if (mBtuiModelSortFilter) + index = mBtuiModelSortFilter->mapToSource(modelIndex()); + else + index = modelIndex(); + + + // create new icon label if needed + if (!mDevTypeIconLabel) { + mDevTypeIconLabel = new HbLabel(); + mDevTypeIconLabel->setPreferredSize(53.5260, 53.5260); //8un x 8un + mDevTypeIconLabel->setMinimumWidth(53.5260); + } + // create new label if needed + if (!mDeviceNameLabel) { + mDeviceNameLabel = new HbLabel(); + mDeviceNameLabel->setPreferredSize(250, 26.763); + } + // create new label if needed + if (!mDevTypeTextLabel) { + mDevTypeTextLabel = new HbLabel(); + mDevTypeTextLabel->setPreferredSize(250, 26.763); + } + // create layout if needed + if ( !mRow ) { + // Still need to create the actual layout + mRow = new QGraphicsGridLayout(); + mRow->addItem(mDevTypeIconLabel,0,0,2,1); + mRow->addItem(mDeviceNameLabel,0,1,1,1); + mRow->addItem(mDevTypeTextLabel,1,1,1,1); + setLayout(mRow); + } + + QString data = index.data(Qt::DisplayRole).toString(); + int cod = (index.data(BtDeviceModel::CoDRole)).toInt(); + int majorProperty = (index.data(BtDeviceModel::MajorPropertyRole)).toInt(); + + // ToDo: remove clear() once Orbit bug is fixed + mDeviceNameLabel->clear(); + mDeviceNameLabel->setPlainText(data); + mDevTypeIconLabel->clear(); + mDevTypeTextLabel->clear(); + mDevTypeTextLabel->setPlainText( getDeviceTypeString( cod )); + HbIcon icon = + getBadgedDeviceTypeIcon(cod, majorProperty, + BtuiBottomLeft | BtuiBottomRight | BtuiTopLeft | BtuiTopRight ); + mDevTypeIconLabel->setIcon(icon); +} + + +void BtCpUiSearchListViewItem::setModelSortFilter(BtuiModelSortFilter *filter) +{ + mBtuiModelSortFilter = filter; +} diff -r 91746b151f97 -r 997690c3397a bluetoothengine/btui/btcpplugin/btcpuisearchlistviewitem.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/bluetoothengine/btui/btcpplugin/btcpuisearchlistviewitem.h Wed Jun 23 18:23:52 2010 +0300 @@ -0,0 +1,51 @@ +/* +* 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: device view item +* +*/ + + +#ifndef BTCPUISEARCHLISTVIEWITEM_H +#define BTCPUISEARCHLISTVIEWITEM_H + +#include +#include +#include +#include +#include "btuimodelsortfilter.h" + +class BtCpUiSearchListViewItem : public HbListViewItem +{ + Q_OBJECT + +public: + BtCpUiSearchListViewItem(QGraphicsItem * parent = 0); + ~BtCpUiSearchListViewItem(); + + HbAbstractViewItem * createItem(); + void updateChildItems(); + + void setModelSortFilter(BtuiModelSortFilter *filter); + +private: + QGraphicsItem *mParent; + HbLabel *mDevTypeIconLabel; + HbLabel *mDeviceNameLabel; + HbLabel *mDevTypeTextLabel; + BtuiModelSortFilter* mBtuiModelSortFilter; + + QGraphicsGridLayout *mRow; +}; + +#endif /* BTCPUISEARCHLISTVIEWITEM_H */ diff -r 91746b151f97 -r 997690c3397a bluetoothengine/btui/btcpplugin/btcpuisearchview.cpp --- a/bluetoothengine/btui/btcpplugin/btcpuisearchview.cpp Fri Jun 11 13:48:51 2010 +0300 +++ b/bluetoothengine/btui/btcpplugin/btcpuisearchview.cpp Wed Jun 23 18:23:52 2010 +0300 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies). + * 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"" @@ -25,6 +25,7 @@ #include #include #include +#include #include #include #include @@ -32,7 +33,8 @@ #include "btcpuimainview.h" #include "btdelegatefactory.h" #include "btabstractdelegate.h" - +#include "btcpuisearchlistviewitem.h" +#include "btuidevtypemap.h" // docml to load @@ -46,6 +48,7 @@ { bool ret(false); + mLastSelectionIndex = 0; mMainView = (BtCpUiMainView *) parent; mMainWindow = hbInstance->allMainWindows().first(); @@ -58,11 +61,11 @@ // name in docml. setObjectName("bt_search_view"); + mLoader = new HbDocumentLoader(); + // Pass the view to documentloader. Document loader uses this view + // when docml is parsed, instead of creating new view. QObjectList objectList; objectList.append(this); - // Pass the view to documentloader. Document loader uses this view - // when docml is parsed, instead of creating new view. - mLoader = new HbDocumentLoader(); mLoader->setObjectTree(objectList); // read view info from docml file @@ -119,8 +122,8 @@ mViewBy = static_cast( mLoader->findObject( "viewByAction" ) ); BTUI_ASSERT_X( mViewBy, "bt-search-view", "view by action missing" ); // TODO - Need to implement the View by -// ret = connect(viewByAction, SIGNAL(triggered()), this, SLOT(noOp())); -// BTUI_ASSERT_X( ret, "bt-search-view", "viewByAction can't connect" ); + ret = connect(mViewBy, SIGNAL(triggered()), this, SLOT(viewByDeviceTypeDialog())); + BTUI_ASSERT_X( ret, "bt-search-view", "viewByAction can't connect" ); mStop = static_cast( mLoader->findObject( "stopAction" ) ); BTUI_ASSERT_X( mStop, "bt-search-view", "stopAction missing" ); @@ -150,21 +153,30 @@ ret = connect(mDeviceList, SIGNAL(activated(QModelIndex)), this, SLOT(deviceSelected(QModelIndex))); BTUI_ASSERT_X( ret, "bt-search-view", "deviceSelected can't connect" ); + + // initialize device type list for "view by" option + // Note: this list needs to be in the same order as enum devTypeSelectionList + mDevTypeList << hbTrId("txt_bt_list_audio_devices") + << hbTrId("txt_bt_list_computers") + << hbTrId("txt_bt_list_input_devices") + << hbTrId("txt_bt_list_phones") + << hbTrId("txt_bt_list_other_devices"); } BtCpUiSearchView::~BtCpUiSearchView() { + delete mLoader; // Also deletes all widgets that it constructed. + setNavigationAction(0); + disconnect( mSoftKeyBackAction ); delete mSoftKeyBackAction; if(mAbstractDelegate) { delete mAbstractDelegate; - mAbstractDelegate = 0; } if(mBtuiModelSortFilter) { delete mBtuiModelSortFilter; - mBtuiModelSortFilter = 0; } } @@ -183,6 +195,88 @@ } } + +void BtCpUiSearchView::viewByDeviceTypeDialog() +{ + HbSelectionDialog *query = new HbSelectionDialog; + query->setStringItems(mDevTypeList, mLastSelectionIndex); + query->setSelectionMode(HbAbstractItemView::MultiSelection); + + QList current; + current.append(QVariant(0)); + query->setSelectedItems(current); + + query->setAttribute(Qt::WA_DeleteOnClose); + + // Set the heading for the dialog. + HbLabel *headingLabel = new HbLabel(hbTrId("txt_bt_title_show"), query); + query->setHeadingWidget(headingLabel); + + + query->open(this,SLOT(viewByDialogClosed(HbAction*))); +} +/*! + Callback for dialog closing + ToDo: this API might change in the future, see e-mails in Orbit-dev list, + e.g. 27.4.2010 Raju Abhilash + */ +void BtCpUiSearchView::viewByDialogClosed(HbAction* action) +{ + HbSelectionDialog *dlg = (HbSelectionDialog*)(sender()); + bool first = true; + + if (action == dlg->actions().first()) { // user pressed "Ok" + // Get selected items. + QList selections; + selections = dlg->selectedItems(); +// QString result; + int devTypesWanted = 0; + for (int i=0; i < selections.count(); i++) { +// result += mDevTypeList.at(selections.at(i).toInt()) + " "; + if (first) { + // this will be used as default value when opening dialog again + // there is no way to specify multiple default values with HbSelectionDialog + mLastSelectionIndex = selections.at(i).toInt(); + first = false; + } + switch (selections.at(i).toInt()) { + case BtUiDevAudioDevice: + devTypesWanted |= BtuiDevProperty::AVDev; + break; + case BtUiDevComputer: + devTypesWanted |= BtuiDevProperty::Computer; + break; + case BtUiDevInputDevice: + devTypesWanted |= BtuiDevProperty::Peripheral; + break; + case BtUiDevPhone: + devTypesWanted |= BtuiDevProperty::Phone; + break; + case BtUiDevOtherDevice: + devTypesWanted |= (BtuiDevProperty::LANAccessDev | + BtuiDevProperty::Toy | + BtuiDevProperty::WearableDev | + BtuiDevProperty::ImagingDev | + BtuiDevProperty::HealthDev | + BtuiDevProperty::UncategorizedDev); + break; + default: + // should never get here + BTUI_ASSERT_X(false, "BtCpUiSearchView::viewByDialogClosed()", + "wrong device type in viewBy dialog!"); + } + } +// qDebug() << result << "bits " << devTypesWanted; + if (devTypesWanted) { + mBtuiModelSortFilter->clearDeviceMajorFilters(); + mBtuiModelSortFilter->addDeviceMajorFilter(BtuiDevProperty::InRange, + BtuiModelSortFilter::AtLeastMatch); // device must be in range + mBtuiModelSortFilter->addDeviceMajorFilter(devTypesWanted, + BtuiModelSortFilter::RoughMatch); // device can be any one of selected ones + } + } +} + void BtCpUiSearchView::stopSearching() { // Stop delegate @@ -196,6 +290,30 @@ mAbstractDelegate->cancel(); } +void BtCpUiSearchView::startSearchDelegate () +{ + bool ret(false); + + if(mAbstractDelegate) { + mAbstractDelegate->cancel(); + disconnect( mAbstractDelegate ); + delete mAbstractDelegate; + mAbstractDelegate = 0; + } + // Create the inquiry delegate. + mAbstractDelegate = BtDelegateFactory::newDelegate(BtDelegate::Inquiry, mSettingModel, mDeviceModel ); + + // Connect to the signal from the BtDelegateInquiry for completion of the search request + ret = connect(mAbstractDelegate, SIGNAL(commandCompleted(int)), this, SLOT(searchDelegateCompleted(int))); + BTUI_ASSERT_X( ret, "bt-search-view", "searchDelegateCompleted can't connect" ); + + // Connect to the signal from the BtuiModel when the search has been completed. + ret = connect(mDeviceModel, SIGNAL(deviceSearchCompleted(int)), this, SLOT(deviceSearchCompleted(int))); + BTUI_ASSERT_X( ret, "bt-search-view", "deviceSearchCompleted can't connect" ); + + mAbstractDelegate->exec(QVariant()); +} + void BtCpUiSearchView::retrySearch() { // Retry delegate @@ -205,10 +323,12 @@ mRetry->setEnabled(false); mStop->setEnabled(true); + BtCpUiSearchListViewItem *prototype = new BtCpUiSearchListViewItem(mDeviceList); + prototype->setModelSortFilter(mBtuiModelSortFilter); + mDeviceList->setItemPrototype(prototype); + // Make use of the delegate and start the search. - mAbstractDelegate->cancel(); - mDeviceList->setModel(mBtuiModelSortFilter); - mAbstractDelegate->exec(QVariant()); + startSearchDelegate (); } void BtCpUiSearchView::setSoftkeyBack() @@ -231,36 +351,29 @@ Q_UNUSED(cmdId); setSoftkeyBack(); - - bool ret(false); - - if(!mAbstractDelegate) { - // Create the inquiry delegate. - mAbstractDelegate = BtDelegateFactory::newDelegate( - BtDelegate::Inquiry, mSettingModel, mDeviceModel ); - } - - // Connect to the signal from the BtDelegateInquiry for completion of the search request - ret = connect(mAbstractDelegate, SIGNAL(commandCompleted(int)), this, SLOT(searchDelegateCompleted(int))); - BTUI_ASSERT_X( ret, "bt-search-view", "searchDelegateCompleted can't connect" ); - - // Connect to the signal from the BtuiModel when the search has been completed. - ret = connect(mDeviceModel, SIGNAL(deviceSearchCompleted(int)), this, SLOT(deviceSearchCompleted(int))); - BTUI_ASSERT_X( ret, "bt-search-view", "deviceSearchCompleted can't connect" ); - + if(!mBtuiModelSortFilter) { mBtuiModelSortFilter = new BtuiModelSortFilter(this); } mBtuiModelSortFilter->setSourceModel(mDeviceModel); - mBtuiModelSortFilter->addDeviceMajorFilter(BtDeviceModel::InRange, BtuiModelSortFilter::AtLeastMatch); + mBtuiModelSortFilter->addDeviceMajorFilter( + BtuiDevProperty::InRange, BtuiModelSortFilter::AtLeastMatch); mDeviceList->setModel(mBtuiModelSortFilter); + BtCpUiSearchListViewItem *prototype = new BtCpUiSearchListViewItem(mDeviceList); + prototype->setModelSortFilter(mBtuiModelSortFilter); + mDeviceList->setItemPrototype(prototype); + // Make use of the delegate and start the search. - mAbstractDelegate->exec(QVariant()); + startSearchDelegate (); } void BtCpUiSearchView::deactivateView() { + if( mAbstractDelegate ) { + disconnect( mAbstractDelegate ); + } + disconnect( mDeviceModel ); } void BtCpUiSearchView::searchDelegateCompleted(int error) diff -r 91746b151f97 -r 997690c3397a bluetoothengine/btui/btcpplugin/btcpuisearchview.h --- a/bluetoothengine/btui/btcpplugin/btcpuisearchview.h Fri Jun 11 13:48:51 2010 +0300 +++ b/bluetoothengine/btui/btcpplugin/btcpuisearchview.h Wed Jun 23 18:23:52 2010 +0300 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * 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"" @@ -36,6 +36,7 @@ Q_OBJECT public: + explicit BtCpUiSearchView( BtSettingModel &settingModel, BtDeviceModel &deviceModel, @@ -50,16 +51,31 @@ void changeOrientation( Qt::Orientation orientation ); void stopSearching(); void retrySearch(); + void viewByDeviceTypeDialog(); + void viewByDialogClosed(HbAction* action); void searchDelegateCompleted(int error); void deviceSearchCompleted(int error); void deviceSelected(const QModelIndex& modelIndex); - + +private: + void startSearchDelegate(); + +private: + enum devTypeSelectionList { + BtUiDevAudioDevice = 0, + BtUiDevComputer, + BtUiDevInputDevice, + BtUiDevPhone, + BtUiDevOtherDevice + }; private: HbDocumentLoader *mLoader; HbLabel *mDeviceIcon; HbLabel *mLabelFoundDevices; HbLabel *mLabelSearching; HbListView *mDeviceList; + QStringList mDevTypeList; + int mLastSelectionIndex; // data structures for switching between views bool mEventFilterInstalled; diff -r 91746b151f97 -r 997690c3397a bluetoothengine/btui/btcpplugin/btcpuisettingitem.cpp --- a/bluetoothengine/btui/btcpplugin/btcpuisettingitem.cpp Fri Jun 11 13:48:51 2010 +0300 +++ b/bluetoothengine/btui/btcpplugin/btcpuisettingitem.cpp Wed Jun 23 18:23:52 2010 +0300 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * 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"" @@ -17,36 +17,49 @@ #include "btcpuisettingitem.h" #include +#include #include +#include -BtCpUiSettingItem::BtCpUiSettingItem(CpItemDataHelper &itemDataHelper, - const QString &text /*= QString()*/, - const QString &description /*= QString()*/, - const HbIcon &icon /*= HbIcon()*/, - const HbDataFormModelItem *parent /*= 0*/) - : CpSettingFormEntryItemData(itemDataHelper, - text, - description, - icon, - parent) +BtCpUiSettingItem::BtCpUiSettingItem(CpItemDataHelper &itemDataHelper) : + CpSettingFormEntryItemData(itemDataHelper) { + bool ret(false); + loadTranslators(); + mSettingModel = new BtSettingModel(); + mDeviceModel = new BtDeviceModel(); + + ret = connect(mSettingModel, SIGNAL(dataChanged(QModelIndex,QModelIndex)), + this, SLOT(handleDataChanged(QModelIndex,QModelIndex))); + BTUI_ASSERT_X( ret, "BtCpUiSettingItem::BtCpUiSettingItem", "can't connect dataChanged" ); + + this->setDescription(hbTrId("txt_cp_dblist_bluetooth")); + updateStatus(); } BtCpUiSettingItem::~BtCpUiSettingItem() { + delete mSettingModel; + delete mDeviceModel; + + delete mViewTranslator; + delete mDialogTranslator; +} +void BtCpUiSettingItem::loadTranslators() +{ + mViewTranslator = new HbTranslator("btviews"); + mDialogTranslator = new HbTranslator("btdialogs"); } void BtCpUiSettingItem::onLaunchView() { - mSettingModel = new BtSettingModel(this); - mDeviceModel = new BtDeviceModel(this); - + mMainWindow = hbInstance->allMainWindows().first(); mBtMainView = new BtCpUiMainView(*mSettingModel, *mDeviceModel); - + mCpView = mMainWindow->currentView(); mMainWindow->addView(mBtMainView); @@ -60,8 +73,69 @@ { mBtMainView->deactivateView(); mMainWindow->setCurrentView(mCpView); + + mMainWindow->removeView(mBtMainView); + delete mBtMainView; + mBtMainView = 0; + +} + +/*! + Slot for receiving notification of local setting changes from the model. + Identify the setting changed and update the corresponding UI item. + */ +void BtCpUiSettingItem::handleDataChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight) +{ + // update only the part of the view specified by the model's row(s) + for (int i=topLeft.row(); i <= bottomRight.row(); i++) { + QModelIndex index = mSettingModel->index( i, 0); + // Distinguish which setting value is changed. + switch ( i ) { + case BtSettingModel::PowerStateRow: + case BtSettingModel::VisibilityRow: + updateStatus(); + break; + } + } } +void BtCpUiSettingItem::updateStatus() +{ + QString btStatusText; + HbIcon btStatusIcon; + + //todo: Connection status is not updated right now, which is also required as per UI Spec. + PowerStateQtValue btPower = (PowerStateQtValue)mSettingModel->data(mSettingModel->index( + BtSettingModel::PowerStateRow, 0), + BtSettingModel::SettingValueRole).toInt(); + + if(BtPowerOn == btPower) { + VisibilityMode visibilityMode = (VisibilityMode) mSettingModel->data( + mSettingModel->index(BtSettingModel::VisibilityRow, 0), + BtSettingModel::SettingValueRole).toInt(); + switch(visibilityMode) { + case BtHidden: + btStatusText = hbTrId("txt_cp_dblist_bluetooth_val_on_and_hidden"); + btStatusIcon.setIconName("qtg_large_bluetooth_hide"); + break; + case BtVisible: + case BtTemporary: + btStatusText = hbTrId("txt_cp_dblist_bluetooth_val_on_and_visible"); + btStatusIcon.setIconName("qtg_large_bluetooth"); + break; + default: + BTUI_ASSERT_X(false, "BtCpUiSettingItem::updateStatus", "invalid visibility mode"); + } + } + else { + //Bt is off. + btStatusText = hbTrId("txt_cp_dblist_bluetooth_val_off"); + btStatusIcon.setIconName("qtg_large_bluetooth_off"); + } + + this->setDescription(btStatusText); + this->setEntryItemIcon(btStatusIcon); +} CpBaseSettingView *BtCpUiSettingItem::createSettingView() const { diff -r 91746b151f97 -r 997690c3397a bluetoothengine/btui/btcpplugin/btcpuisettingitem.h --- a/bluetoothengine/btui/btcpplugin/btcpuisettingitem.h Fri Jun 11 13:48:51 2010 +0300 +++ b/bluetoothengine/btui/btcpplugin/btcpuisettingitem.h Wed Jun 23 18:23:52 2010 +0300 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * 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"" @@ -24,22 +24,22 @@ #include "btcpuimainview.h" +class HbTranslator; + class BtCpUiSettingItem : public CpSettingFormEntryItemData { Q_OBJECT public: - explicit BtCpUiSettingItem(CpItemDataHelper &itemDataHelper, - const QString &text = QString(), - const QString &description = QString(), - const HbIcon &icon = HbIcon(), - const HbDataFormModelItem *parent = 0); + explicit BtCpUiSettingItem(CpItemDataHelper &itemDataHelper); virtual ~BtCpUiSettingItem(); private slots: void onLaunchView(); void handleCloseView(); + void handleDataChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight); private: virtual CpBaseSettingView *createSettingView() const; - + void updateStatus(); + void loadTranslators(); private: HbMainWindow* mMainWindow; @@ -51,6 +51,9 @@ HbView *mCpView; + HbTranslator *mViewTranslator; + HbTranslator *mDialogTranslator; + }; #endif //BTCPUISETTINGITEM_H diff -r 91746b151f97 -r 997690c3397a bluetoothengine/btui/btcpplugin/btuiviewutil.h --- a/bluetoothengine/btui/btcpplugin/btuiviewutil.h Fri Jun 11 13:48:51 2010 +0300 +++ b/bluetoothengine/btui/btcpplugin/btuiviewutil.h Wed Jun 23 18:23:52 2010 +0300 @@ -1,23 +1,19 @@ /* -* ============================================================================ -* Name : btuiviewutil.h -* Description : utilities in the view for some often used functions, -* -* Copyright © 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: -* Nokia Corporation -* ============================================================================ -* Template version: 4.2 -*/ + * 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 BTUIVIEWUTIL_H #define BTUIVIEWUTIL_H diff -r 91746b151f97 -r 997690c3397a bluetoothengine/btui/btcpplugin/docml/bt-advanced-view.docml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/bluetoothengine/btui/btcpplugin/docml/bt-advanced-view.docml Wed Jun 23 18:23:52 2010 +0300 @@ -0,0 +1,103 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + +
diff -r 91746b151f97 -r 997690c3397a bluetoothengine/btui/btcpplugin/docml/bt-device-view.docml --- a/bluetoothengine/btui/btcpplugin/docml/bt-device-view.docml Fri Jun 11 13:48:51 2010 +0300 +++ b/bluetoothengine/btui/btcpplugin/docml/bt-device-view.docml Wed Jun 23 18:23:52 2010 +0300 @@ -1,5 +1,5 @@ - + @@ -10,7 +10,7 @@ - +
@@ -21,46 +21,48 @@ - + - + - - + + - + - - - - - - - - - + + + + - + + - - + + + + - - + + + + - - + + + + @@ -72,31 +74,28 @@ - - - - - - - - - - - - - - - + + + + + + + + + + + + - + @@ -113,31 +112,30 @@ - - + + - - - - - - - + + + + + - - - + + + - + - - + +
+ +
-
- + diff -r 91746b151f97 -r 997690c3397a bluetoothengine/btui/btcpplugin/docml/bt-main-view.docml --- a/bluetoothengine/btui/btcpplugin/docml/bt-main-view.docml Fri Jun 11 13:48:51 2010 +0300 +++ b/bluetoothengine/btui/btcpplugin/docml/bt-main-view.docml Wed Jun 23 18:23:52 2010 +0300 @@ -1,50 +1,53 @@ - + - + + - + + - + + - + - + - + - + - + - + - + - + - - - + + + - + @@ -59,13 +62,12 @@ - + - - - + + @@ -73,10 +75,10 @@ + + - - @@ -105,10 +107,11 @@ + - - + + @@ -116,34 +119,20 @@ - - - - - - + + + + + + - - - + + + - +
- - - - - - - - - - - - - - @@ -160,6 +149,10 @@ + + + + @@ -168,17 +161,18 @@ -
-
+ + + + - + - + - - - +
+
@@ -192,8 +186,17 @@ + + + + + + + + +
- + diff -r 91746b151f97 -r 997690c3397a bluetoothengine/btui/btcpplugin/docml/bt-search-view.docml --- a/bluetoothengine/btui/btcpplugin/docml/bt-search-view.docml Fri Jun 11 13:48:51 2010 +0300 +++ b/bluetoothengine/btui/btcpplugin/docml/bt-search-view.docml Wed Jun 23 18:23:52 2010 +0300 @@ -1,20 +1,23 @@ - + + - + + - + + - + - + @@ -26,7 +29,7 @@ - + @@ -40,7 +43,7 @@ - + @@ -59,9 +62,7 @@ - - - + @@ -72,7 +73,6 @@ - @@ -106,6 +106,7 @@ - + + diff -r 91746b151f97 -r 997690c3397a bluetoothengine/btui/btdevsettingframework/btdevsettingframework.pro --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/bluetoothengine/btui/btdevsettingframework/btdevsettingframework.pro Wed Jun 23 18:23:52 2010 +0300 @@ -0,0 +1,53 @@ +# +# 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: +# + +TEMPLATE = lib +TARGET = btdevsettingframework + +MOC_DIR = moc +DEFINES += BUILD_BTDEVSETTINGFRAMEWORK + +INCLUDEPATH += inc + +CONFIG += qt \ + hb \ + dll + +HEADERS += inc/btdevsettinginterface.h \ + inc/btabstractdevsetting.h \ + inc/btdevsettingpluginloader.h + +SOURCES += src/btabstractdevsetting.cpp \ + src/btdevsettingpluginloader.cpp + +symbian: { + SYMBIAN_PLATFORMS = WINSCW \ + ARMV5 + + BLD_INF_RULES.prj_exports += \ + "$${LITERAL_HASH}include" \ + "inc/btdevsettingglobal.h MW_LAYER_PLATFORM_EXPORT_PATH(btdevsettingglobal.h)" \ + "inc/btdevsettinginterface.h MW_LAYER_PLATFORM_EXPORT_PATH(btdevsettinginterface.h)" \ + "inc/btabstractdevsetting.h MW_LAYER_PLATFORM_EXPORT_PATH(btabstractdevsetting.h)" \ + "inc/btdevsettingpluginloader.h MW_LAYER_PLATFORM_EXPORT_PATH(btdevsettingpluginloader.h)" \ + "rom/btdevsettingframework.iby CORE_MW_LAYER_IBY_EXPORT_PATH(btdevsettingframework.iby)" + + TARGET.EPOCALLOWDLLDATA = 1 + TARGET.UID3 = 0xEEEEEEEE + TARGET.CAPABILITY = CAP_GENERAL_DLL + + INCLUDEPATH += $$MW_LAYER_SYSTEMINCLUDE +} diff -r 91746b151f97 -r 997690c3397a bluetoothengine/btui/btdevsettingframework/inc/btabstractdevsetting.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/bluetoothengine/btui/btdevsettingframework/inc/btabstractdevsetting.h Wed Jun 23 18:23:52 2010 +0300 @@ -0,0 +1,139 @@ +/* +* 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: The plugin interface of Bluetooth device setting ui +* +*/ + +#ifndef BTABSTRACTDEVSETTING_H +#define BTABSTRACTDEVSETTING_H + +#include +#include + +/*! + \class BtAbstractDevSetting + \brief The class BtAbstractDevSetting is the base class + for offering a UI to manage certain settings of + a remote Bluetooth device, e.g., accessory and keyboard settings. + */ +class BTDEVSETTINGINTERFACE_EXPORT BtAbstractDevSetting : public QObject +{ + Q_OBJECT + +public: + + /*! + Constructs a device setting plugin entry. + + \param address the BD_ADDR of the remote device which this setting + plugin is provided for. Its format is XXXXXXXXXXXX, where X is a + hexadecimal digit. Case is insensitive. + \parent the parent of this object. + */ + explicit BtAbstractDevSetting(const QString &address, QObject *parent = 0 ); + + /*! + Destructor of BtAbstractDeviceSetting. + */ + virtual ~BtAbstractDevSetting(); + + /*! + Gets the BD_ADDR of the remote device which this setting + plugin is provided for. + + \return the device address of the remote device in hex string + */ + const QString &getRemote() const; + + /*! + Tells if this setting plugin can provide a setting UI + for the target device. If the answer is true, this plugin may be + requested to create a setting widget by function + \code createSettingWidget() \endcode. + + \return true if a setting is currently available. false, otherwise. + + The default implementation returns false. + */ + virtual bool isSettingAvailable(); + + /*! + Gets a \code HbWidget \endcode instance which consists of the + setting UI from this specific plugin. The loader of this plugin will + add this widget into its setting view if its setting is available at + a time. + + The ownership of this widget is not transferred. That is, the plugin + is responsible to free it at plugin destruction. + + The default implementation returns 0. + + \return an \code HbWidget \endcode instance. + */ + virtual HbWidget *getSettingWidget(); + + /*! + Informs that device setting is going to foreground. This + implies that the \code HbWidget \endcode from function + \code createSettingWidget \endcode will be shown if the setting + from this plugin is available. + + The default implementation does nothing. + */ + virtual void aboutToForeground(); + + /*! + Informs that device setting is going to background. + + The default implementation does nothing. + */ + virtual void aboutToBackground(); + + /*! + Informs that device setting is going to close. + + The default implementation does nothing. + */ + virtual void aboutToClose(); + +signals: + + /*! + The signal the plugin should emit for informing that the + availability of this setting is changed. + + If the setting becomes available, the owner of this plugin may + request the plugin to create a setting widget. + + If the setting becomes unavailable, the owner of this plugin may close and + destroy the setting widget. + + \param setting the pointer of the setting whose status has changed. + + \param available true if the setting is available; false otherwise. + + \sa isSettingAvailable(). + */ + void settingAvailabilityChanged(BtAbstractDevSetting *setting, bool available); + +private: + + /*! + The remote device address in format XXXXXXXXXXXX where X is a + hexadecimal digit. + */ + QString mRemote; +}; + +#endif /* BTABSTRACTDEVSETTING_H */ diff -r 91746b151f97 -r 997690c3397a bluetoothengine/btui/btdevsettingframework/inc/btdevsettingglobal.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/bluetoothengine/btui/btdevsettingframework/inc/btdevsettingglobal.h Wed Jun 23 18:23:52 2010 +0300 @@ -0,0 +1,31 @@ +/* +* 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 BTDEVSETTINGGLOBAL_H +#define BTDEVSETTINGGLOBAL_H + +#include + +#ifdef BUILD_BTDEVSETTINGFRAMEWORK +#define BTDEVSETTINGINTERFACE_EXPORT Q_DECL_EXPORT +#else +#define BTDEVSETTINGINTERFACE_EXPORT Q_DECL_IMPORT +#endif + +#define BTDEVSETTING_PLUGIN_PATH QLatin1String("/resource/qt/plugins/btdevsetting") + +#endif /* BTDEVSETTINGGLOBAL_H */ diff -r 91746b151f97 -r 997690c3397a bluetoothengine/btui/btdevsettingframework/inc/btdevsettinginterface.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/bluetoothengine/btui/btdevsettingframework/inc/btdevsettinginterface.h Wed Jun 23 18:23:52 2010 +0300 @@ -0,0 +1,58 @@ +/* +* 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: The plugin interface of Bluetooth device setting ui +* +*/ + +#ifndef BTDEVSETTINGINTERFACE_H +#define BTDEVSETTINGINTERFACE_H + +#include +#include +#include + +/*! + \class BtDeviceSettingInterface + \brief The class BtDeviceSettingInterface is an interface + for creating a BT device setting plugin instance. + */ +class BTDEVSETTINGINTERFACE_EXPORT BtDevSettingInterface +{ +public: + + /*! + Destructor of BtDeviceSettingPlugin. + */ + virtual ~BtDevSettingInterface() {} + + /*! + Creates a \code BtDeviceSettingPlugin \endcode instance from a + specific plugin. + + \param address the BD_ADDR of the remote device which this setting + plugin is provided for. Its format is XXXXXXXXXXXX, where X is a + hexadecimal digit. Case is insensitive. + + \parent the parent of this object. + + \return an \code BtDeviceSettingPlugin \endcode instance the ownership of which is + transferred to the plugin loader. + */ + virtual BtAbstractDevSetting *createDevSetting( + const QString &address, QObject *parent = 0) = 0; +}; + +Q_DECLARE_INTERFACE(BtDevSettingInterface, "com.nokia.bt.devsettinginterface/1.0"); + +#endif /* BTDEVSETTINGINTERFACE_H */ diff -r 91746b151f97 -r 997690c3397a bluetoothengine/btui/btdevsettingframework/inc/btdevsettingpluginloader.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/bluetoothengine/btui/btdevsettingframework/inc/btdevsettingpluginloader.h Wed Jun 23 18:23:52 2010 +0300 @@ -0,0 +1,42 @@ +/* +* 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 BTDEVSETTINGPLUGINLOADER_H +#define BTDEVSETTINGPLUGINLOADER_H + +#include +#include +#include + +class QString; +class QStringList; +class BtDevSettingInterface; + +class BTDEVSETTINGINTERFACE_EXPORT BtDevSettingPluginLoader +{ +public: + + /*! + Load all setting interfaces. + + \return the list of plugin interface. + */ + static QList loadDevSettingInterfaces(); + +}; + +#endif /* BTDEVSETTINGPLUGINLOADER_H */ diff -r 91746b151f97 -r 997690c3397a bluetoothengine/btui/btdevsettingframework/rom/btdevsettingframework.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/bluetoothengine/btui/btdevsettingframework/rom/btdevsettingframework.iby Wed Jun 23 18:23:52 2010 +0300 @@ -0,0 +1,29 @@ +/* +* 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 BTDEVSETTINGFRAMEWORK_IBY +#define BTDEVSETTINGFRAMEWORK_IBY + +#include +#include +#ifdef __BT + +file=ABI_DIR/BUILD_DIR/btdevsettingframework.dll SHARED_LIB_DIR/btdevsettingframework.dll + +#endif //__BT + +#endif // BTDEVSETTINGFRAMEWORK_IBY + diff -r 91746b151f97 -r 997690c3397a bluetoothengine/btui/btdevsettingframework/src/btabstractdevsetting.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/bluetoothengine/btui/btdevsettingframework/src/btabstractdevsetting.cpp Wed Jun 23 18:23:52 2010 +0300 @@ -0,0 +1,106 @@ +/* +* 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: The plugin interface of Bluetooth device setting ui +* +*/ + +#include + +BtAbstractDevSetting::BtAbstractDevSetting( + const QString &address, QObject *parent) + : QObject( parent ) +{ + mRemote = address; +} + +/*! + Destructor of BtAbstractDevSetting. + */ +BtAbstractDevSetting::~BtAbstractDevSetting() +{ +} + +/*! + Gets the BD_ADDR of the remote device which this setting + plugin is provided for. + + \return the device address of the remote device in hex string + */ +const QString &BtAbstractDevSetting::getRemote() const +{ + return mRemote; +} + +/*! + Tells if this setting plugin can provide a setting UI + for the target device. If the answer is true, this plugin may be + requested to create a setting widget by function + \code createSettingWidget() \endcode. + + \return true if a setting is currently available. false, otherwise. + + The default implementation returns false. + */ +bool BtAbstractDevSetting::isSettingAvailable() +{ + return false; +} + +/*! + Gets a \code HbWidget \endcode instance which consists of the + setting UI from this specific plugin. The loader of this plugin will + add this widget into its setting view if its setting is available at + a time. + + The ownership of this widget is not transferred. That is, the plugin + is responsible to free it at plugin destruction. + + The default implementation returns 0. + + \return an \code HbWidget \endcode instance. + */ +HbWidget *BtAbstractDevSetting::getSettingWidget() +{ + return 0; +} + +/*! + Informs that device setting is going to foreground. This + implies that the \code HbWidget \endcode from function + \code createSettingWidget \endcode will be shown if the setting + from this plugin is available. + + The default implementation does nothing. + */ +void BtAbstractDevSetting::aboutToForeground() +{ +} + +/*! + Informs that device setting is going to background. + + The default implementation does nothing. + */ +void BtAbstractDevSetting::aboutToBackground() +{ +} + +/*! + Informs that device setting is going to close. + + The default implementation does nothing. + */ +void BtAbstractDevSetting::aboutToClose() +{ +} diff -r 91746b151f97 -r 997690c3397a bluetoothengine/btui/btdevsettingframework/src/btdevsettingpluginloader.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/bluetoothengine/btui/btdevsettingframework/src/btdevsettingpluginloader.cpp Wed Jun 23 18:23:52 2010 +0300 @@ -0,0 +1,110 @@ +/* +* 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 + +/*! + \class BtDevSettingPluginLoader + \brief The BtDevSettingPluginLoader class loads BT device setting plugins. + */ + +#ifdef WIN32 + #define PLUGINFILE_SUFFIX "dll" +#else + #define PLUGINFILE_SUFFIX "qtplugin" +#endif + + +static QStringList getDrives() +{ + static QStringList drives; + if (drives.empty()) { +#ifdef WIN32 + drives.append("C:"); +#else + QFileInfoList fileInfoList = QDir::drives(); + foreach(const QFileInfo &fileInfo,fileInfoList) { + QString str = fileInfo.filePath(); + if (str.length() > 2) { + str = str.left(2); + } + drives.append(str); + } +#endif + } + return drives; +} + +static QStringList directoriesFromAllDrives(const QString &baseDir) +{ + QStringList dirs; + QStringList drives = getDrives(); + foreach(const QString &drive,drives) { + QString dir = drive + baseDir + QDir::separator(); + if (QFileInfo(dir).exists()) { + dirs.append(dir); + } + } + return dirs; +} + +static BtDevSettingInterface* loadPluginInterface(const QFileInfo &pluginFile) +{ + QPluginLoader loader(pluginFile.absoluteFilePath()); + BtDevSettingInterface *plugin = + qobject_cast (loader.instance()); + if (!plugin) { + loader.unload(); + } + return plugin; +} + +/*! + Load all setting interfaces. + + \return the list of plugin interface. + */ +QList BtDevSettingPluginLoader::loadDevSettingInterfaces() +{ + QList interfaces; + + static QStringList pluginDirs; + if (pluginDirs.empty()) { + pluginDirs = directoriesFromAllDrives(BTDEVSETTING_PLUGIN_PATH); + } + foreach(const QString &dirStr,pluginDirs) { + QDir pluginDir( dirStr ); + QFileInfoList fileInfoList = pluginDir.entryInfoList( QDir::Files ); + foreach(const QFileInfo &fileInfo,fileInfoList) { + int diff = fileInfo.suffix().compare(PLUGINFILE_SUFFIX,Qt::CaseInsensitive); + if (!diff) { + BtDevSettingInterface* settingIf = loadPluginInterface(fileInfo); + if ( settingIf ) { + interfaces.append( settingIf ); + } + } + } + } + + return interfaces; +} + diff -r 91746b151f97 -r 997690c3397a bluetoothengine/btui/btui.pro --- a/bluetoothengine/btui/btui.pro Fri Jun 11 13:48:51 2010 +0300 +++ b/bluetoothengine/btui/btui.pro Wed Jun 23 18:23:52 2010 +0300 @@ -19,16 +19,19 @@ # Directories SUBDIRS += btuimodel \ +btdevsettingframework \ btuidelegate \ -btcpplugin \ -tsrc +btcpplugin CONFIG += ordered symbian: { SYMBIAN_PLATFORMS = WINSCW \ ARMV5 - BLD_INF_RULES.prj_exports += \ + BLD_INF_RULES.PRJ_EXPORTS += \ "$${LITERAL_HASH}include" \ - "rom/btui.iby CORE_MW_LAYER_IBY_EXPORT_PATH(btui.iby)" + "rom/btui.iby CORE_MW_LAYER_IBY_EXPORT_PATH(btui.iby)" \ + "rom/btui_resources.iby LANGUAGE_APP_LAYER_IBY_EXPORT_PATH(btui_resources.iby)" \ + "inc/btuiiconutil.h MW_LAYER_PLATFORM_EXPORT_PATH(btservices/btuiiconutil.h)" \ + "inc/btuidevtypemap.h MW_LAYER_PLATFORM_EXPORT_PATH(btservices/btuidevtypemap.h)" } \ No newline at end of file diff -r 91746b151f97 -r 997690c3397a bluetoothengine/btui/btuidelegate/btabstractdelegate.cpp --- a/bluetoothengine/btui/btuidelegate/btabstractdelegate.cpp Fri Jun 11 13:48:51 2010 +0300 +++ b/bluetoothengine/btui/btuidelegate/btabstractdelegate.cpp Wed Jun 23 18:23:52 2010 +0300 @@ -17,6 +17,8 @@ #include "btabstractdelegate.h" +#include "btqtconstants.h" + #include #include @@ -51,3 +53,13 @@ } +bool BtAbstractDelegate::isBtPowerOn() +{ + QModelIndex powerIndex = getSettingModel()->index(BtSettingModel::PowerStateRow, 0); + PowerStateQtValue powerState = (PowerStateQtValue)getSettingModel()->data(powerIndex, BtSettingModel::SettingValueRole).toInt(); + + return (BtPowerOn == powerState); +} + + + diff -r 91746b151f97 -r 997690c3397a bluetoothengine/btui/btuidelegate/btabstractdelegate.h --- a/bluetoothengine/btui/btuidelegate/btabstractdelegate.h Fri Jun 11 13:48:51 2010 +0300 +++ b/bluetoothengine/btui/btuidelegate/btabstractdelegate.h Wed Jun 23 18:23:52 2010 +0300 @@ -61,6 +61,8 @@ BtSettingModel *getSettingModel(); BtDeviceModel *getDeviceModel(); + bool isBtPowerOn(); + public slots: private: diff -r 91746b151f97 -r 997690c3397a bluetoothengine/btui/btuidelegate/btdelegateInquiry.cpp --- a/bluetoothengine/btui/btuidelegate/btdelegateInquiry.cpp Fri Jun 11 13:48:51 2010 +0300 +++ b/bluetoothengine/btui/btuidelegate/btdelegateInquiry.cpp Wed Jun 23 18:23:52 2010 +0300 @@ -17,6 +17,9 @@ #include "btdelegateinquiry.h" +#include "btdelegatefactory.h" +#include "btqtconstants.h" + #include #include #include @@ -27,6 +30,7 @@ BtDeviceModel* deviceModel, QObject* parent ) :BtAbstractDelegate( settingModel, deviceModel, parent ) { + mAbstractDelegate = NULL; } BtDelegateInquiry::~BtDelegateInquiry() @@ -38,6 +42,39 @@ { Q_UNUSED(params); + if(isBtPowerOn()) { + exec_inquiry(); + } + else { + //If Bt Power is off, switch it on and then perform pairing. + //todo: Do we ask for user confirmation here..? + if (!mAbstractDelegate) { + mAbstractDelegate = BtDelegateFactory::newDelegate(BtDelegate::ManagePower, + getSettingModel(), getDeviceModel() ); + connect( mAbstractDelegate, SIGNAL(commandCompleted(int)), this, SLOT(powerDelegateCompleted(int)) ); + mAbstractDelegate->exec(QVariant(BtPowerOn)); + } + } +} + +void BtDelegateInquiry::powerDelegateCompleted(int error) +{ + if (mAbstractDelegate) { + disconnect(mAbstractDelegate); + delete mAbstractDelegate; + mAbstractDelegate = 0; + } + if ( error == KErrNone ) { + exec_inquiry(); + } + else { + // error + emit commandCompleted(error); + } +} + +void BtDelegateInquiry::exec_inquiry() +{ bool err = getDeviceModel()->searchDevice(); if (!err) { // TODO - Verify the error code to be used. diff -r 91746b151f97 -r 997690c3397a bluetoothengine/btui/btuidelegate/btdelegateInquiry.h --- a/bluetoothengine/btui/btuidelegate/btdelegateInquiry.h Fri Jun 11 13:48:51 2010 +0300 +++ b/bluetoothengine/btui/btuidelegate/btdelegateInquiry.h Wed Jun 23 18:23:52 2010 +0300 @@ -42,7 +42,15 @@ virtual void cancel(); +public slots: + void powerDelegateCompleted(int error); + private: + void exec_inquiry(); + +private: + BtAbstractDelegate* mAbstractDelegate; + }; #endif /* BTDELEGATEINQUIRY_H_ */ diff -r 91746b151f97 -r 997690c3397a bluetoothengine/btui/btuidelegate/btdelegateconnect.cpp --- a/bluetoothengine/btui/btuidelegate/btdelegateconnect.cpp Fri Jun 11 13:48:51 2010 +0300 +++ b/bluetoothengine/btui/btuidelegate/btdelegateconnect.cpp Wed Jun 23 18:23:52 2010 +0300 @@ -16,15 +16,25 @@ */ #include "btdelegateconnect.h" +#include "btuiutil.h" +#include "btqtconstants.h" #include +#include #include #include #include +#include +#include "btuiiconutil.h" +#include "btdelegatefactory.h" +#include +#include +#include BtDelegateConnect::BtDelegateConnect( BtSettingModel* settingModel, BtDeviceModel* deviceModel, QObject *parent) : - BtAbstractDelegate(settingModel, deviceModel, parent), mBtengConnMan(0) + BtAbstractDelegate(settingModel, deviceModel, parent), mBtengConnMan(0), + mAbstractDelegate(0), mActiveHandling(false) { } @@ -36,46 +46,179 @@ void BtDelegateConnect::exec( const QVariant ¶ms ) { - int error = KErrNone; - QModelIndex index = params.value(); + if ( mActiveHandling ) { + emit commandCompleted( KErrAlreadyExists ); + return; + } + mIndex = params.value(); + mActiveHandling = true; + // save needed values from model + mDeviceName = (mIndex.data(BtDeviceModel::NameAliasRole)).toString(); + QString addrStr = (mIndex.data(BtDeviceModel::ReadableBdaddrRole)).toString(); + addrReadbleStringToSymbian( addrStr, mAddr ); + + mCod = (mIndex.data(BtDeviceModel::CoDRole)).toInt(); + mMajorProperty = (mIndex.data(BtDeviceModel::MajorPropertyRole)).toInt(); - mdeviceName = getDeviceModel()->data(index,BtDeviceModel::NameAliasRole).toString(); - - QString strBtAddr = getDeviceModel()->data(index, - BtDeviceModel::ReadableBdaddrRole).toString(); - int cod = getDeviceModel()->data(index,BtDeviceModel::CoDRole).toInt(); + // first turn on power if needed + QModelIndex powerIndex = getSettingModel()->index(BtSettingModel::PowerStateRow, 0); + PowerStateQtValue powerState = (PowerStateQtValue)getSettingModel()->data(powerIndex, Qt::EditRole).toInt(); + if (powerState == BtPowerOff) { + if (!mAbstractDelegate) //if there is no other delegate running + { + mAbstractDelegate = BtDelegateFactory::newDelegate(BtDelegate::ManagePower, + getSettingModel(), getDeviceModel() ); + connect( mAbstractDelegate, SIGNAL(commandCompleted(int)), this, SLOT(powerDelegateCompleted(int)) ); + mAbstractDelegate->exec(QVariant(BtPowerOn)); + } + } + else { + // power is already on + exec_connect(); + } +} + +void BtDelegateConnect::powerDelegateCompleted(int status) +{ + //ToDo: Error handling here + if (mAbstractDelegate) + { + disconnect(mAbstractDelegate); + delete mAbstractDelegate; + mAbstractDelegate = 0; + } + if ( status == KErrNone ) { + // continue connecting + exec_connect(); + } + else { + // error + emitCommandComplete(status); + } +} + +void BtDelegateConnect::exec_connect() +{ + int error = KErrNone; if ( ! mBtengConnMan ){ - TRAP_IGNORE( mBtengConnMan = CBTEngConnMan::NewL(this) ); + TRAP( error, mBtengConnMan = CBTEngConnMan::NewL(this) ); } - Q_CHECK_PTR( mBtengConnMan ); - - TBTDeviceClass btEngDeviceClass(cod); - TPtrC ptrName(reinterpret_cast(strBtAddr.constData())); - - RBuf16 btName; - error = btName.Create(ptrName.Length()); - - if(error == KErrNone) { - btName.Copy(ptrName); - mBtEngddr.SetReadable(btName); - error = mBtengConnMan->Connect(mBtEngddr, btEngDeviceClass); - btName.Close(); + + if ( !error ) { + TBTDeviceClass btEngDeviceClass(mCod); + error = mBtengConnMan->Connect(mAddr, btEngDeviceClass); } - - if(error) { + if( error ) { emitCommandComplete(error); } - } void BtDelegateConnect::ConnectComplete( TBTDevAddr& aAddr, TInt aErr, RBTDevAddrArray* aConflicts ) { - Q_UNUSED(aAddr); - Q_UNUSED(aConflicts); - emitCommandComplete(aErr); + // It is possible that another audio device has just connected to phone when we are + // connecting to this audio device. Or a device is connected while this command + // is idle. No handling for these cases. + if ( mAddr != aAddr || !mActiveHandling ) { + return; + } + + // bteng calls ConnectComplete even if cancelConnect is called, + // we won't signal the interested party in this case. + // ToDo: is this needed? + if ( aErr == KErrCancel ) { + mActiveHandling = false; + return; + } + + // conflict could occur as well if another audio device is already connected + // since currently we don't support multiple audio device connections. + if ( aErr && aConflicts && aConflicts->Count() ) { + // get the display name of the device that is + // causing the conflict + QString conflictDevAddr; + addrSymbianToReadbleString(conflictDevAddr, (*aConflicts)[0] ); + QModelIndex start = getDeviceModel()->index(0,0); + QModelIndexList indexList = getDeviceModel()->match(start, BtDeviceModel::ReadableBdaddrRole, conflictDevAddr); + BTUI_ASSERT_X(indexList.count(), "BtDelegateConnect::ConnectComplete()", "device missing from model!"); + mConflictDevIndex = indexList.at(0); + + // check if conflict device is being used in a call + // Note: actually only checking if *any* audio device is involved in a call, not necessarily the + // one we are concerned with here. Btaudioman does not currently support finding out the actual + // device involved in a call. + if (callOngoing()) { + HbMessageBox::warning(hbTrId("txt_bt_info_not_possible_during_a_call")); + emitCommandComplete(KErrCancel); + } + else { + // no call, check if user wants to disconnect conflict device + QString conflictDevName = (mConflictDevIndex.data(BtDeviceModel::NameAliasRole)).toString(); + + QString questionText(hbTrId("txt_bt_info_to_connect_1_2_needs_to_be_disconnec") + .arg(mDeviceName).arg(conflictDevName)); + + HbMessageBox::question( questionText, this, SLOT(handleUserAnswer(HbAction*)), + hbTrId("txt_common_button_continue"), hbTrId("txt_common_button_cancel") ); + } + } + else { + // command is finished + emitCommandComplete(aErr); + } +} + +void BtDelegateConnect::handleUserAnswer( HbAction* answer ) +{ + HbMessageBox* dlg = static_cast( sender() ); + if( dlg->actions().first() == answer ) { + // Continue, ie. disconnect conflict device and then try reconnecting again + if (!mAbstractDelegate) //if there is no other delegate running + { + QListlist; + QVariant paramFirst; + paramFirst.setValue(mConflictDevIndex); + QVariant paramSecond(ServiceLevel); + list.append(paramFirst); + list.append(paramSecond); + QVariant paramsList(list); + mAbstractDelegate = BtDelegateFactory::newDelegate(BtDelegate::Disconnect, + getSettingModel(), getDeviceModel() ); + connect( mAbstractDelegate, SIGNAL(commandCompleted(int)), this, SLOT(disconnectDelegateCompleted(int)) ); + mAbstractDelegate->exec(paramsList); + } + } + else { + // Cancel + emitCommandComplete(KErrCancel); + } +} +/*! + * returns true if call is ongoing + */ +bool BtDelegateConnect::callOngoing() +{ + int callState; + int err = RProperty::Get(KPSUidCtsyCallInformation, KCTsyCallState, callState); + if (!err && (callState == EPSCTsyCallStateNone || callState == EPSCTsyCallStateUninitialized)) { + return false; + } + else { + return true; + } +} +void BtDelegateConnect::disconnectDelegateCompleted(int status) +{ + // finished disconnecting conflict device, now reconnect to original device + if ( status == KErrNone ) { + exec_connect(); + } + else { + // disconnect failed, abort + emitCommandComplete( status ); + } } void BtDelegateConnect::DisconnectComplete( TBTDevAddr& aAddr, TInt aErr ) @@ -84,29 +227,35 @@ Q_UNUSED(aErr); } -void BtDelegateConnect::PairingComplete( TBTDevAddr& aAddr, TInt aErr ) -{ - Q_UNUSED(aAddr); - Q_UNUSED(aErr); -} void BtDelegateConnect::cancel() { - mBtengConnMan->CancelConnect(mBtEngddr); + if ( mBtengConnMan ) { + mBtengConnMan->CancelConnect(mAddr); + } } void BtDelegateConnect::emitCommandComplete(int error) { - QString str(hbTrId("Connected to %1")); - QString err(hbTrId("Connecting with %1 Failed")); - - if(error != KErrNone) { - HbNotificationDialog::launchDialog(err.arg(mdeviceName)); + if ( error == KErrNone ) { + // success, show indicator with connection status + + HbIcon icon = getBadgedDeviceTypeIcon( mCod, mMajorProperty, 0); // no badging required, only icon + QString str(hbTrId("txt_bt_dpopinfo_connected_to_1")); + HbNotificationDialog::launchDialog( icon, hbTrId("txt_bt_dpophead_connected"), + str.arg(mDeviceName) ); + } + else if ( error == KErrCancel ) { + // no user note, return success + error = KErrNone; } else { - HbNotificationDialog::launchDialog(str.arg(mdeviceName)); + // failure to connect, show user note + QString err(hbTrId("txt_bt_info_unable_to_connect_with_bluetooth")); + HbMessageBox::warning(err.arg(mDeviceName)); } - + mActiveHandling = false; + emit commandCompleted(error); } diff -r 91746b151f97 -r 997690c3397a bluetoothengine/btui/btuidelegate/btdelegateconnect.h --- a/bluetoothengine/btui/btuidelegate/btdelegateconnect.h Fri Jun 11 13:48:51 2010 +0300 +++ b/bluetoothengine/btui/btuidelegate/btdelegateconnect.h Wed Jun 23 18:23:52 2010 +0300 @@ -15,12 +15,13 @@ * */ -#ifndef BTDELEGATECONNECT_H_ -#define BTDELEGATECONNECT_H_ +#ifndef BTDELEGATECONNECT_H +#define BTDELEGATECONNECT_H #include #include #include "btabstractdelegate.h" +#include class BtuiModel; @@ -40,33 +41,42 @@ QObject *parent = 0 ); virtual ~BtDelegateConnect(); - virtual void exec( const QVariant ¶ms ); - virtual void cancel(); public slots: + protected: //From MBTEngConnObserver virtual void ConnectComplete( TBTDevAddr& aAddr, TInt aErr, RBTDevAddrArray* aConflicts ); virtual void DisconnectComplete( TBTDevAddr& aAddr, TInt aErr ); - virtual void PairingComplete( TBTDevAddr& aAddr, TInt aErr ); - - void emitCommandComplete(int error); + +private slots: + void handleUserAnswer( HbAction* answer ); + void powerDelegateCompleted(int status); + void disconnectDelegateCompleted(int status); private: - + void exec_connect(); + void emitCommandComplete(int error); + bool callOngoing(); + +private: + QModelIndex mIndex; + QModelIndex mConflictDevIndex; CBTEngConnMan *mBtengConnMan; - - TBTDevAddr mBtEngddr; - - QString mdeviceName; + QString mDeviceName; + int mMajorProperty; + int mCod; + BtAbstractDelegate* mAbstractDelegate; + bool mActiveHandling; + TBTDevAddr mAddr; Q_DISABLE_COPY(BtDelegateConnect) }; -#endif /* BTDELEGATECONNECT_H_ */ +#endif /* BTDELEGATECONNECT_H */ diff -r 91746b151f97 -r 997690c3397a bluetoothengine/btui/btuidelegate/btdelegateconsts.h --- a/bluetoothengine/btui/btuidelegate/btdelegateconsts.h Fri Jun 11 13:48:51 2010 +0300 +++ b/bluetoothengine/btui/btuidelegate/btdelegateconsts.h Wed Jun 23 18:23:52 2010 +0300 @@ -33,6 +33,7 @@ Pair, Disconnect, Unpair, + RemoteDevName }; } diff -r 91746b151f97 -r 997690c3397a bluetoothengine/btui/btuidelegate/btdelegatedevsecurity.cpp --- a/bluetoothengine/btui/btuidelegate/btdelegatedevsecurity.cpp Fri Jun 11 13:48:51 2010 +0300 +++ b/bluetoothengine/btui/btuidelegate/btdelegatedevsecurity.cpp Wed Jun 23 18:23:52 2010 +0300 @@ -17,16 +17,18 @@ #include +#include "btqtconstants.h" #include "btdelegatedevsecurity.h" #include #include +#include #include BtDelegateDevSecurity::BtDelegateDevSecurity( BtSettingModel* settingModel, BtDeviceModel* deviceModel, QObject *parent) : - BtAbstractDelegate(settingModel, deviceModel, parent), mBtEngDevMan(0) + BtAbstractDelegate(settingModel, deviceModel, parent), mBtEngDevMan(0), mBtengConnMan(0), mDisconnectDelegate(0) { } @@ -34,6 +36,8 @@ BtDelegateDevSecurity::~BtDelegateDevSecurity() { delete mBtEngDevMan; + delete mBtengConnMan; + delete mDisconnectDelegate; } @@ -50,7 +54,35 @@ TBTDevAddr symaddr; TBuf buffer(strBtAddr.utf16()); symaddr.SetReadable( buffer ); + + // Disconnect if paired device was connected + if ( ! mBtengConnMan ){ + TRAP( error, mBtengConnMan = CBTEngConnMan::NewL(this) ); + } + TBTEngConnectionStatus connstatus; + if ( !error && mBtengConnMan->IsConnected(symaddr, connstatus ) == KErrNone) { + if ( connstatus == EBTEngConnected) { + if (! mDisconnectDelegate){ + mDisconnectDelegate = BtDelegateFactory::newDelegate( + BtDelegate::Disconnect, getSettingModel(), getDeviceModel()); + connect( mDisconnectDelegate, SIGNAL(commandCompleted(int)), this, SLOT(disconnectDelegateCompleted(int)) ); + + } + QListlist; + QVariant paramFirst; + paramFirst.setValue(index); + QVariant paramSecond; + DisconnectOption discoOpt = ServiceLevel; + paramSecond.setValue((int)discoOpt); + list.append(paramFirst); + list.append(paramSecond); + QVariant paramsList; + paramsList.setValue(list); + mDisconnectDelegate->exec(paramsList); + } + } + // Set device as unpaired CBTDevice *symBtDevice = 0; TRAP( error, { symBtDevice = CBTDevice::NewL( symaddr ); @@ -78,6 +110,11 @@ } +void BtDelegateDevSecurity::disconnectDelegateCompleted( int err ) +{ + Q_UNUSED(err); +} + void BtDelegateDevSecurity::HandleDevManComplete( TInt aErr ) { emitCommandComplete(aErr); @@ -104,6 +141,19 @@ emit commandCompleted(error); } +void BtDelegateDevSecurity::ConnectComplete( TBTDevAddr& aAddr, TInt aErr, + RBTDevAddrArray* aConflicts ) +{ + Q_UNUSED(aAddr); + Q_UNUSED(aErr); + Q_UNUSED(aConflicts); +} + +void BtDelegateDevSecurity::DisconnectComplete( TBTDevAddr& aAddr, TInt aErr ) +{ + Q_UNUSED(aAddr); + Q_UNUSED(aErr); +} diff -r 91746b151f97 -r 997690c3397a bluetoothengine/btui/btuidelegate/btdelegatedevsecurity.h --- a/bluetoothengine/btui/btuidelegate/btdelegatedevsecurity.h Fri Jun 11 13:48:51 2010 +0300 +++ b/bluetoothengine/btui/btuidelegate/btdelegatedevsecurity.h Wed Jun 23 18:23:52 2010 +0300 @@ -21,16 +21,17 @@ #include #include #include +#include #include "btabstractdelegate.h" class BtuiModel; /*! - \class BtDelegateDisconnect - \brief the base class for Disconnecting Bluetooth Connection. + \class BtDelegateDevSecurity + \brief the base class for Unpairing Bluetooth Connection. */ class BtDelegateDevSecurity : public BtAbstractDelegate, - public MBTEngDevManObserver + public MBTEngDevManObserver, public MBTEngConnObserver { Q_OBJECT @@ -47,19 +48,25 @@ virtual void cancel(); public slots: + void disconnectDelegateCompleted(int err); protected: //From MBTEngDevManObserver virtual void HandleDevManComplete( TInt aErr ); virtual void HandleGetDevicesComplete( TInt aErr, CBTDeviceArray* aDeviceArray ); - + //From MBTEngConnObserver + virtual void ConnectComplete( TBTDevAddr& aAddr, TInt aErr, + RBTDevAddrArray* aConflicts ); + virtual void DisconnectComplete( TBTDevAddr& aAddr, TInt aErr ); + void emitCommandComplete(int error); private: CBTEngDevMan *mBtEngDevMan; - QString mdeviceName; + CBTEngConnMan *mBtengConnMan; + BtAbstractDelegate* mDisconnectDelegate; Q_DISABLE_COPY(BtDelegateDevSecurity) diff -r 91746b151f97 -r 997690c3397a bluetoothengine/btui/btuidelegate/btdelegatedisconnect.cpp --- a/bluetoothengine/btui/btuidelegate/btdelegatedisconnect.cpp Fri Jun 11 13:48:51 2010 +0300 +++ b/bluetoothengine/btui/btuidelegate/btdelegatedisconnect.cpp Wed Jun 23 18:23:52 2010 +0300 @@ -15,7 +15,10 @@ * */ #include "btdelegatedisconnect.h" +#include "btuiutil.h" +#include "btuiiconutil.h" #include +#include #include #include #include @@ -23,7 +26,8 @@ BtDelegateDisconnect::BtDelegateDisconnect( BtSettingModel* settingModel, BtDeviceModel* deviceModel, QObject *parent) : - BtAbstractDelegate(settingModel, deviceModel, parent), mBtengConnMan(0) + BtAbstractDelegate(settingModel, deviceModel, parent), mBtengConnMan(0), mPhyLinks(0), + mMajorRole(0), mActiveHandling(false), mAddrArrayIndex(0), mDisconOpt(DisconUnknown) { } @@ -31,41 +35,174 @@ BtDelegateDisconnect::~BtDelegateDisconnect() { delete mBtengConnMan; + delete mPhyLinks; + mSocketServ.Close(); } void BtDelegateDisconnect::exec( const QVariant ¶ms ) { - int error = KErrNone; - QModelIndex index = params.value(); - - mdeviceName = getDeviceModel()->data(index,BtDeviceModel::NameAliasRole).toString(); - - QString strBtAddr = getDeviceModel()->data(index,BtDeviceModel::ReadableBdaddrRole).toString(); - + int err; if ( ! mBtengConnMan ){ - TRAP_IGNORE( mBtengConnMan = CBTEngConnMan::NewL(this) ); + TRAP( err, mBtengConnMan = CBTEngConnMan::NewL(this) ); + } + if (params.canConvert()){ + mDisconOpt = (DisconnectOption)params.toInt(); + mActiveHandling = true; + + if (mDisconOpt == AllOngoingConnections){ + err = mBtengConnMan->GetConnectedAddresses(mDevAddrArray); + disconnectAllConnections_service(); + } + if(err) { + emit commandCompleted(err); + } } - Q_CHECK_PTR( mBtengConnMan ); - - TPtrC ptrName(reinterpret_cast(strBtAddr.constData())); + else{ + QList paramList = params.value< QList >(); + QVariant indexVariant = paramList.at(0); + QModelIndex index = indexVariant.value(); + QVariant optionVariant = paramList.at(1); + mDisconOpt = (DisconnectOption)optionVariant.toInt(); + int error = KErrNone; + + mActiveHandling = true; + mDeviceName = getDeviceModel()->data(index,BtDeviceModel::NameAliasRole).toString(); + mMajorRole = (index.data(BtDeviceModel::MajorPropertyRole)).toInt(); + + QString strBtAddr = getDeviceModel()->data(index,BtDeviceModel::ReadableBdaddrRole).toString(); + + // todo: address converting should be simplified. check other delegates for example. + + TPtrC ptrName(reinterpret_cast(strBtAddr.constData())); + + RBuf16 btName; + error = btName.Create(ptrName.Length()); + + if(error == KErrNone) { + btName.Copy(ptrName); + mBtEngAddr.SetReadable(btName); + if (mDisconOpt == ServiceLevel){ + disconnectSeviceLevel(); + } + else if (mDisconOpt == PhysicalLink){ + disconnectPhysicalLink(); + } + } + btName.Close(); - RBuf16 btName; - error = btName.Create(ptrName.Length()); + if(error) { + emit commandCompleted(error); + } + } +} + + +void BtDelegateDisconnect::disconnectAllConnections_service(){ + + TBuf addrBuf; + mDevAddrArray[mAddrArrayIndex].GetReadable(addrBuf); + QString btStringAddr= QString::fromUtf16( addrBuf.Ptr(), addrBuf.Length()); + QModelIndex start = getDeviceModel()->index(0,0); + QModelIndexList indexList = getDeviceModel()->match(start,BtDeviceModel::ReadableBdaddrRole, btStringAddr); + QModelIndex index = indexList.at(0); + + mDeviceName = getDeviceModel()->data(index,BtDeviceModel::NameAliasRole).toString(); + mBtEngAddr = mDevAddrArray[mAddrArrayIndex]; + mMajorRole = (index.data(BtDeviceModel::MajorPropertyRole)).toInt(); + + disconnectSeviceLevel(); +} + +void BtDelegateDisconnect::disconnectAllConnections_physical(){ - if(error == KErrNone) { - btName.Copy(ptrName); - mBtEngddr.SetReadable(btName); - error = mBtengConnMan->Disconnect(mBtEngddr, EBTDiscGraceful); - btName.Close(); + TBuf addrBuf; + mDevAddrArray[mAddrArrayIndex].GetReadable(addrBuf); + QString btStringAddr= QString::fromUtf16( addrBuf.Ptr(), addrBuf.Length()); + QModelIndex start = getDeviceModel()->index(0,0); + QModelIndexList indexList = getDeviceModel()->match(start,BtDeviceModel::ReadableBdaddrRole, btStringAddr); + QModelIndex index = indexList.at(0); + + mDeviceName = getDeviceModel()->data(index,BtDeviceModel::NameAliasRole).toString(); + mBtEngAddr = mDevAddrArray[mAddrArrayIndex]; + + disconnectPhysicalLink(); + +} +void BtDelegateDisconnect::disconnectSeviceLevel(){ + int err; + TBTEngConnectionStatus connStatus; + err = mBtengConnMan->IsConnected(mBtEngAddr, connStatus); + if (connStatus == EBTEngConnected){ + err = mBtengConnMan->Disconnect(mBtEngAddr, EBTDiscGraceful); } - - - if(error) { - emitCommandComplete(error); + if(err) { + emit commandCompleted(err); + } +} + +void BtDelegateDisconnect::disconnectPhysicalLink(){ + int err; + if ( !mSocketServ.Handle() ) { + err = mSocketServ.Connect(); + } + if ( !err && !mPhyLinks ) { + TRAP( err, + mPhyLinks = CBluetoothPhysicalLinks::NewL( *this, mSocketServ ) ); + Q_CHECK_PTR( mPhyLinks ); + } + err = mPhyLinks->Disconnect( mBtEngAddr ); + if(err) { + emit commandCompleted(err); } } +void BtDelegateDisconnect::disconnectServiceLevelCompleted(int err){ + if (mDisconOpt == ServiceLevel){ + //emitCommandComplete(err); + mActiveHandling = false; + emit commandCompleted(err); + } + else if (mDisconOpt == AllOngoingConnections){ + + mAddrArrayIndex++; + if ( mAddrArrayIndex < mDevAddrArray.Count()){ + disconnectAllConnections_service(); + } + else{ + mDevAddrArray.Reset(); + err = mBtengConnMan->GetConnectedAddresses(mDevAddrArray); + mAddrArrayIndex = 0; + //connect( mDisconnectDelegate, SIGNAL(commandCompleted(int)), this, SLOT(disconnectPhysicalLinkCompleted(int)) ); + disconnectAllConnections_physical(); + if(err) { + emit commandCompleted(err); + } + + } + } +} + +void BtDelegateDisconnect::disconnectPhysicalLinkCompleted(int err){ + if (mDisconOpt == PhysicalLink){ + //emitCommandComplete(err); + mActiveHandling = false; + emit commandCompleted(err); + } + else if (mDisconOpt == AllOngoingConnections){ + mAddrArrayIndex++; + if ( mAddrArrayIndex < mDevAddrArray.Count()){ + disconnectAllConnections_physical(); + } + else{ + //TODO: check if there is still ongoing connection from BTEngVonnMan. and close them again if there is any new + mActiveHandling = false; + emit commandCompleted(err); + } + + } + +} void BtDelegateDisconnect::ConnectComplete( TBTDevAddr& aAddr, TInt aErr, RBTDevAddrArray* aConflicts ) { @@ -76,34 +213,61 @@ void BtDelegateDisconnect::DisconnectComplete( TBTDevAddr& aAddr, TInt aErr ) { - Q_UNUSED(aAddr); - emitCommandComplete(aErr); + if ( mBtEngAddr != aAddr || !mActiveHandling ) { + return; + } + DisplayCommandCompleteNotif(aErr); + if(aErr) { + emit commandCompleted(aErr); + } + else{ + disconnectServiceLevelCompleted(aErr); + } } -void BtDelegateDisconnect::PairingComplete( TBTDevAddr& aAddr, TInt aErr ) -{ - Q_UNUSED(aAddr); - Q_UNUSED(aErr); -} void BtDelegateDisconnect::cancel() { } -void BtDelegateDisconnect::emitCommandComplete(int error) +void BtDelegateDisconnect::HandleCreateConnectionCompleteL( TInt err ){ + Q_UNUSED( err ); +} + +void BtDelegateDisconnect::HandleDisconnectCompleteL( TInt err ){ + if ( !mActiveHandling ) { + return; + } + if(err) { + emit commandCompleted(err); + } + else{ + disconnectPhysicalLinkCompleted(err); + } + +} + +void BtDelegateDisconnect::HandleDisconnectAllCompleteL( TInt err ){ + Q_UNUSED( err ); +} + +void BtDelegateDisconnect::DisplayCommandCompleteNotif(int error) { QString str(hbTrId("Disconnected to %1")); QString err(hbTrId("Disconnecting with %1 Failed")); if(error != KErrNone) { - HbNotificationDialog::launchDialog(err.arg(mdeviceName)); + HbNotificationDialog::launchDialog(err.arg(mDeviceName)); } else { - HbNotificationDialog::launchDialog(str.arg(mdeviceName)); + // success, show indicator with connection status + HbIcon icon = getBadgedDeviceTypeIcon( mCod, mMajorRole, 0 ); // no badging required, only icon + QString str( hbTrId("txt_bt_dpopinfo_disconnected_from_1") ); + HbNotificationDialog::launchDialog( icon, hbTrId("txt_bt_dpophead_disconnected"), + str.arg(mDeviceName) ); } - - emit commandCompleted(error); + } diff -r 91746b151f97 -r 997690c3397a bluetoothengine/btui/btuidelegate/btdelegatedisconnect.h --- a/bluetoothengine/btui/btuidelegate/btdelegatedisconnect.h Fri Jun 11 13:48:51 2010 +0300 +++ b/bluetoothengine/btui/btuidelegate/btdelegatedisconnect.h Wed Jun 23 18:23:52 2010 +0300 @@ -20,6 +20,7 @@ #include #include +#include "btqtconstants.h" #include "btabstractdelegate.h" class BtuiModel; @@ -29,7 +30,7 @@ \brief the base class for Disconnecting Bluetooth Connection. */ class BtDelegateDisconnect : public BtAbstractDelegate, - public MBTEngConnObserver + public MBTEngConnObserver, public MBluetoothPhysicalLinksNotifier { Q_OBJECT @@ -44,25 +45,59 @@ virtual void cancel(); -public slots: + protected: //From MBTEngConnObserver virtual void ConnectComplete( TBTDevAddr& aAddr, TInt aErr, RBTDevAddrArray* aConflicts ); virtual void DisconnectComplete( TBTDevAddr& aAddr, TInt aErr ); - virtual void PairingComplete( TBTDevAddr& aAddr, TInt aErr ); + + // from MBluetoothPhysicalLinksNotifier + virtual void HandleCreateConnectionCompleteL( TInt err ); + + virtual void HandleDisconnectCompleteL( TInt err ); + + virtual void HandleDisconnectAllCompleteL( TInt err ); - void emitCommandComplete(int error); + void DisplayCommandCompleteNotif(int error); + +private: + + void disconnectAllConnections_service(); + + void disconnectAllConnections_physical(); + + void disconnectSeviceLevel(); + + void disconnectPhysicalLink(); + + void disconnectServiceLevelCompleted(int err); + + void disconnectPhysicalLinkCompleted(int err); + + private: CBTEngConnMan *mBtengConnMan; - TBTDevAddr mBtEngddr; + CBluetoothPhysicalLinks *mPhyLinks; + + int mMajorRole; + bool mActiveHandling; + + int mAddrArrayIndex; + DisconnectOption mDisconOpt; + + RBTDevAddrArray mDevAddrArray; + TBTDevAddr mBtEngAddr; - QString mdeviceName; - + QString mDeviceName; + int mCod; + + RSocketServ mSocketServ; + Q_DISABLE_COPY(BtDelegateDisconnect) }; diff -r 91746b151f97 -r 997690c3397a bluetoothengine/btui/btuidelegate/btdelegatefactory.cpp --- a/bluetoothengine/btui/btuidelegate/btdelegatefactory.cpp Fri Jun 11 13:48:51 2010 +0300 +++ b/bluetoothengine/btui/btuidelegate/btdelegatefactory.cpp Wed Jun 23 18:23:52 2010 +0300 @@ -21,6 +21,7 @@ #include #include "btdelegatepower.h" #include "btdelegatedevname.h" +#include "btdelegateremotedevname.h" #include "btdelegatevisibility.h" #include "btdelegateinquiry.h" #include "btdelegateconnect.h" @@ -54,6 +55,8 @@ return new BtDelegateDisconnect( settingModel, deviceModel, parent ); case BtDelegate::Unpair: return new BtDelegateDevSecurity( settingModel, deviceModel, parent ); + case BtDelegate::RemoteDevName: + return new BtDelegateRemoteDevName( settingModel, deviceModel, parent ); } return 0; } diff -r 91746b151f97 -r 997690c3397a bluetoothengine/btui/btuidelegate/btdelegatepair.cpp --- a/bluetoothengine/btui/btuidelegate/btdelegatepair.cpp Fri Jun 11 13:48:51 2010 +0300 +++ b/bluetoothengine/btui/btuidelegate/btdelegatepair.cpp Wed Jun 23 18:23:52 2010 +0300 @@ -17,6 +17,8 @@ #include "btdelegatepair.h" #include "btuiutil.h" +#include "btdelegatefactory.h" +#include "btqtconstants.h" #include #include @@ -36,6 +38,7 @@ BtAbstractDelegate(settingModel, deviceModel, parent), mBtengConnMan(0) { mLoader = new HbDocumentLoader(); + mAbstractDelegate = NULL; } BtDelegatePair::~BtDelegatePair() @@ -46,13 +49,48 @@ void BtDelegatePair::exec( const QVariant ¶ms ) { - int error = KErrNone; - QModelIndex index = params.value(); + + deviceIndex = params.value(); + + if(isBtPowerOn()) { + exec_pair(); + } + else { + //If Bt Power is off, switch it on and then perform pairing. + //todo: Do we ask for user confirmation here..? + if (!mAbstractDelegate) { + mAbstractDelegate = BtDelegateFactory::newDelegate(BtDelegate::ManagePower, + getSettingModel(), getDeviceModel() ); + connect( mAbstractDelegate, SIGNAL(commandCompleted(int)), this, SLOT(powerDelegateCompleted(int)) ); + mAbstractDelegate->exec(QVariant(BtPowerOn)); + } + } - mdeviceName = getDeviceModel()->data(index,BtDeviceModel::NameAliasRole).toString(); +} + +void BtDelegatePair::powerDelegateCompleted(int error) +{ + if (mAbstractDelegate) { + disconnect(mAbstractDelegate); + delete mAbstractDelegate; + mAbstractDelegate = 0; + } + if ( error == KErrNone ) { + exec_pair(); + } + else { + // error + emitCommandComplete(error); + } +} + +void BtDelegatePair::exec_pair() +{ + int error = KErrNone; + mdeviceName = getDeviceModel()->data(deviceIndex,BtDeviceModel::NameAliasRole).toString(); - QString strBtAddr = getDeviceModel()->data(index,BtDeviceModel::ReadableBdaddrRole).toString(); - int cod = getDeviceModel()->data(index,BtDeviceModel::CoDRole).toInt(); + QString strBtAddr = getDeviceModel()->data(deviceIndex,BtDeviceModel::ReadableBdaddrRole).toString(); + int cod = getDeviceModel()->data(deviceIndex,BtDeviceModel::CoDRole).toInt(); if ( ! mBtengConnMan ){ TRAP( error, mBtengConnMan = CBTEngConnMan::NewL(this) ); @@ -69,9 +107,10 @@ if(error) { emitCommandComplete(error); } - + } + void BtDelegatePair::launchWaitDialog() { QString headingText(hbTrId("Pairing with %1")); @@ -126,15 +165,15 @@ void BtDelegatePair::emitCommandComplete(int error) { - QString str(hbTrId("Paired to %1")); - QString err(hbTrId("Pairing with %1 Failed")); - - if(error != KErrNone) { - HbNotificationDialog::launchDialog(err.arg(mdeviceName)); - } - else { - HbNotificationDialog::launchDialog(str.arg(mdeviceName)); - } +// QString str(hbTrId("Paired to %1")); +// QString err(hbTrId("Pairing with %1 Failed")); +// +// if(error != KErrNone) { +// HbNotificationDialog::launchDialog(err.arg(mdeviceName)); +// } +// else { +// HbNotificationDialog::launchDialog(str.arg(mdeviceName)); +// } emit commandCompleted(error); } diff -r 91746b151f97 -r 997690c3397a bluetoothengine/btui/btuidelegate/btdelegatepair.h --- a/bluetoothengine/btui/btuidelegate/btdelegatepair.h Fri Jun 11 13:48:51 2010 +0300 +++ b/bluetoothengine/btui/btuidelegate/btdelegatepair.h Wed Jun 23 18:23:52 2010 +0300 @@ -47,7 +47,7 @@ virtual void cancel(); public slots: - + void powerDelegateCompleted(int error); protected: //From MBTEngConnObserver virtual void ConnectComplete( TBTDevAddr& aAddr, TInt aErr, @@ -58,6 +58,7 @@ private: void launchWaitDialog(); void emitCommandComplete(int error); + void exec_pair(); private: @@ -66,6 +67,8 @@ QString mdeviceName; HbDocumentLoader *mLoader; + BtAbstractDelegate* mAbstractDelegate; + QModelIndex deviceIndex; Q_DISABLE_COPY(BtDelegatePair) diff -r 91746b151f97 -r 997690c3397a bluetoothengine/btui/btuidelegate/btdelegatepower.cpp --- a/bluetoothengine/btui/btuidelegate/btdelegatepower.cpp Fri Jun 11 13:48:51 2010 +0300 +++ b/bluetoothengine/btui/btuidelegate/btdelegatepower.cpp Wed Jun 23 18:23:52 2010 +0300 @@ -17,6 +17,9 @@ #include "btdelegatepower.h" +#include "btqtconstants.h" +#include +#include #include #include #include @@ -29,11 +32,12 @@ BtDelegatePower::BtDelegatePower( BtSettingModel* settingModel, BtDeviceModel* deviceModel, QObject *parent ) - : BtAbstractDelegate( settingModel, deviceModel, parent ) + : BtAbstractDelegate( settingModel, deviceModel, parent ), + mDisconnectDelegate(0) { TRAP_IGNORE( mBtengSettings = CBTEngSettings::NewL(this) ); Q_CHECK_PTR( mBtengSettings ); - + mActiveHandling = false; } /*! @@ -41,18 +45,35 @@ */ BtDelegatePower::~BtDelegatePower() { + delete mDisconnectDelegate; delete mBtengSettings; - } -void BtDelegatePower::exec( const QVariant ¶ms ) +/*! + Turns BT power on/off + param powerState is the desired power state and is of type PowerStateQtValue + */ +void BtDelegatePower::exec( const QVariant &powerState ) { - if (params.toInt()){//turn power OFF - + mReqPowerState = BtEngPowerState((PowerStateQtValue)powerState.toInt()); + BTUI_ASSERT_X( (mReqPowerState == EBTPowerOff) || (mReqPowerState == EBTPowerOn), + "BtDelegatePower::exec()", "wrong power state value" ); + + // get current power status + TBTPowerStateValue curPowerState(EBTPowerOff); + mBtengSettings->GetPowerState( curPowerState ); + + // verify requested power is not the same as current status + if ( mReqPowerState == curPowerState ) { + // no need to do anything + emit commandCompleted( KErrNone ); + } + + // perform power on/off operation + if ( mReqPowerState == EBTPowerOff ){ switchBTOff(); } - else{//turn power ON - + else if ( mReqPowerState == EBTPowerOn ) { switchBTOn(); } } @@ -64,30 +85,28 @@ int err = 0; //check if device is in OFFLINE mode first - TBTEnabledInOfflineMode enabledInOffline = EBTDisabledInOfflineMode; - if (checkOfflineMode(enabledInOffline)){ - //if (1){ - if (enabledInOffline){ - //if (1){ + bool btEnabledInOffline = false; + if (checkOfflineMode(btEnabledInOffline)){ // offline mode is active + if (btEnabledInOffline){ // BT is allowed to be enabled in offline mode, show query. - HbMessageBox::question( tr("Turn Bluetooth on in offline mode?"),this, + HbMessageBox::question( hbTrId("txt_bt_info_trun_bluetooth_on_ini_offline_mode" ),this, SLOT(btOnQuestionClose(HbAction*))); } else{ //if BT is not allowed to be enabled in offline mode, show message and complete - HbMessageBox::warning(tr("Bluetooth not allowed to be turned on in offline mode"),this, + HbMessageBox::warning( hbTrId("txt_bt_info_bluetooth_not_allowed_to_be_turned_on" ),this, SLOT(btOnWarningClose())); } } - else{ - //set BT on if the not in offline mode - err = mBtengSettings->SetPowerState((TBTPowerStateValue)(1)); + else { // offline mode is not active + mActiveHandling = true; + err = mBtengSettings->SetPowerState(EBTPowerOn); } if ( err ) { - QString info = "Unable to switch BT power ON" ; + //TODO: handle the error here emit commandCompleted(KErrGeneral); } @@ -100,7 +119,8 @@ if(action == dlg->actions().at(0)) { //user chooses "yes" for using BT in offline - err = mBtengSettings->SetPowerState((TBTPowerStateValue)(1)); + mActiveHandling = true; + err = mBtengSettings->SetPowerState(EBTPowerOn); } else { @@ -109,7 +129,7 @@ } if ( err ) { - QString info = "Unable to switch BT power ON" ; + //TODO: handle the error here emit commandCompleted(KErrGeneral); } } @@ -124,25 +144,98 @@ void BtDelegatePower::switchBTOff() { int err = 0; - err = mBtengSettings->SetPowerState((TBTPowerStateValue)(0)); - if ( err ) { - QString info = "Unable to switch BT power OFF" ; - emit commandCompleted(KErrGeneral); - } + CBTEngConnMan *btengConnMan = 0; + TRAP(err, btengConnMan = CBTEngConnMan::NewL(this)); + Q_CHECK_PTR( btengConnMan ); + RBTDevAddrArray devAddrArray; + err = btengConnMan->GetConnectedAddresses(devAddrArray); + int count = devAddrArray.Count(); + //int count =3; + devAddrArray.Close(); + delete btengConnMan; + if( !err && count> 0 ){ + HbMessageBox::question( hbTrId("Turn Bluetooth off? There is an active connection." ),this, + SLOT(btOffDialogClose(HbAction*))); + + } + else{ + mActiveHandling = true; + err = mBtengSettings->SetPowerState(EBTPowerOff); + + if ( err ) { + //TODO: handle the error here + emit commandCompleted(KErrGeneral); + } + } } void BtDelegatePower::btOffDialogClose(HbAction *action) { - Q_UNUSED( action ); + HbMessageBox *dlg = static_cast(sender()); + if(action == dlg->actions().at(0)) + { + //user chooses "yes" for closing active connection before power off + mActiveHandling = true; + disconnectOngoingConnections(); + } + else + { + //if user chooses "NO", emits the signal + emit commandCompleted(KErrNone); + + } } -void BtDelegatePower::PowerStateChanged( TBTPowerStateValue aState ) +void BtDelegatePower::disconnectOngoingConnections(){ + if (! mDisconnectDelegate){ + mDisconnectDelegate = BtDelegateFactory::newDelegate( + BtDelegate::Disconnect, getSettingModel(), getDeviceModel()); + connect( mDisconnectDelegate, SIGNAL(commandCompleted(int)), this, SLOT(disconnectDelegateCompleted(int)) ); + + + DisconnectOption discoOpt = AllOngoingConnections; + QVariant param; + param.setValue((int)discoOpt); + mDisconnectDelegate->exec(param); + } +} + +void BtDelegatePower::disconnectDelegateCompleted(int err) { - Q_UNUSED( aState ); - emit commandCompleted(KErrNone); + Q_UNUSED( err ); + //TODO: handle the return error here + + int error = mBtengSettings->SetPowerState(EBTPowerOff); + if ( error ) { + //TODO: handle the error here + emit commandCompleted(KErrGeneral); + } + + +} + + +void BtDelegatePower::PowerStateChanged( TBTPowerStateValue aPowerState ) +{ + // It is possible that others change power: no handling for these cases. + if ( !mActiveHandling ) { + return; + } + mActiveHandling = false; + + if ( mReqPowerState == aPowerState ) { + // power state changed successfully + emit commandCompleted( KErrNone ); + } + else { + // the actual power state is not the same as we requested, + // command failed: + // ToDo: show error note? + emit commandCompleted( KErrGeneral ); + } } //Method derived from MBTEngSettingsObserver, no need to be implemented here @@ -151,78 +244,38 @@ Q_UNUSED( aState ); } -bool BtDelegatePower::checkOfflineMode(TBTEnabledInOfflineMode& aEnabledInOffline) +void BtDelegatePower::ConnectComplete( TBTDevAddr& aAddr, TInt aErr, + RBTDevAddrArray* aConflicts ) { - TCoreAppUIsNetworkConnectionAllowed offline = ECoreAppUIsNetworkConnectionAllowed; - - mBtengSettings->GetOfflineModeSettings(offline, aEnabledInOffline); - return (!offline); - + Q_UNUSED(aAddr); + Q_UNUSED(aErr); + Q_UNUSED(aConflicts); + /* + if ( mBtEngAddr != aAddr ) { // callback coming for some other device + return; + } + emitCommandComplete(aErr); + */ } -/*if (params.toBool()) { // turning power on - - // find out if local device is in offline mode - QModelIndex idx = mModel->index( Btuim::OfflineMode, 0); - QVariant var = mModel->data( idx, Qt::EditRole ); - bool offlineMode = var.toBool(); - - // find out whether BT is allowed in offline mode - var = mModel->data( idx, Btuim::SettingAdditionalParam ); - bool activationAllowed = var.toBool(); - - if (offlineMode) { - // in offline mode - if (activationAllowed) { - HbMessageBox *messageBox = new HbMessageBox(); - // BT is allowed to be enabled in offline mode, show query. - if (messageBox->question( tr("Activate Bluetooth in offline mode?") )) { - ret = mModel->setData(index, value, role); - } - delete messageBox; - } - else { - // BT is not allowed to be activated in offline mode, show note. +void BtDelegatePower::DisconnectComplete( TBTDevAddr& aAddr, TInt aErr ) +{ + Q_UNUSED(aAddr); + Q_UNUSED(aErr); +} - HbDialog *mShowOnlyPopup = new HbDialog(); - mShowOnlyPopup->setAttribute(Qt::WA_DeleteOnClose); - mShowOnlyPopup->setModal(false); - mShowOnlyPopup->setBackgroundFaded(false); - mShowOnlyPopup->setDismissPolicy( HbPopup::NoDismiss ); - mShowOnlyPopup->setTimeout( 5000 ); // 5 sec - HbLabel *label = new HbLabel( tr("Bluetooth is not allowed in offline mode") ); - label->setAlignment(Qt::AlignCenter); - QSizeF popupSize(350,100); - mShowOnlyPopup->setMinimumSize(popupSize); - mShowOnlyPopup->setContentWidget(label); - mShowOnlyPopup->show(); - } - } - else { - // not in offline mode, forward the request to model. - ret = mModel->setData(index, value, role); - } - } - else { // turning power off - // first check if existing connections - QModelIndex idx = mModel->index(Btuim::BtConnections, 0); - QVariant var = mModel->data(idx, Qt::EditRole); - bool ok; - TInt connNum = var.toInt( &ok ); - BTUI_ASSERT_X( ok, "BtUiSettingsDelegate::setData", "wrong qvariant type"); - if (connNum) { - // there is at least 1 active connection, show query. - HbMessageBox *messageBox = new HbMessageBox(); - if (messageBox->question( tr("Turn Bluetooth off even though connections exist?") )) { - ret = mModel->setData(index, value, role); - } - delete messageBox; - } - else { - // no active connections exist, forward the request to model. - ret = mModel->setData(index, value, role); - } - }*/ - //emit commandCompleted(err); - //return ret; - //return false; +/*! + Returns true if offline mode is on, parameter returns true if BT is allowed + in offline mode + */ +bool BtDelegatePower::checkOfflineMode(bool& btEnabledInOffline) +{ + TCoreAppUIsNetworkConnectionAllowed offLineMode; + TBTEnabledInOfflineMode btEnabled; + + mBtengSettings->GetOfflineModeSettings(offLineMode, btEnabled); + + btEnabledInOffline = (btEnabled == EBTEnabledInOfflineMode); + return (offLineMode == ECoreAppUIsNetworkConnectionNotAllowed); +} + diff -r 91746b151f97 -r 997690c3397a bluetoothengine/btui/btuidelegate/btdelegatepower.h --- a/bluetoothengine/btui/btuidelegate/btdelegatepower.h Fri Jun 11 13:48:51 2010 +0300 +++ b/bluetoothengine/btui/btuidelegate/btdelegatepower.h Wed Jun 23 18:23:52 2010 +0300 @@ -20,6 +20,7 @@ #include #include +#include #include "btabstractdelegate.h" class BtuiModel; @@ -31,7 +32,8 @@ \\sa btuidelegate */ -class BtDelegatePower : public BtAbstractDelegate, public MBTEngSettingsObserver +class BtDelegatePower : public BtAbstractDelegate, public MBTEngSettingsObserver, + public MBTEngConnObserver { Q_OBJECT @@ -44,6 +46,8 @@ virtual void exec( const QVariant ¶ms ); + //from MBTEngSettingsObserver + virtual void PowerStateChanged( TBTPowerStateValue aState ); virtual void VisibilityModeChanged( TBTVisibilityMode aState ); @@ -55,18 +59,34 @@ void btOffDialogClose(HbAction *action); + void disconnectDelegateCompleted(int err); + + +protected: + //From MBTEngConnObserver + virtual void ConnectComplete( TBTDevAddr& aAddr, TInt aErr, + RBTDevAddrArray* aConflicts ); + virtual void DisconnectComplete( TBTDevAddr& aAddr, TInt aErr ); + + private: void switchBTOn(); void switchBTOff(); - bool checkOfflineMode(TBTEnabledInOfflineMode& aEnabledInOffline); + bool checkOfflineMode(bool& btEnabledInOffline); -public slots: + void disconnectOngoingConnections(); + private: CBTEngSettings* mBtengSettings; - + bool mActiveHandling; + TBTPowerStateValue mReqPowerState; + + BtAbstractDelegate* mDisconnectDelegate; + + private: Q_DISABLE_COPY(BtDelegatePower) diff -r 91746b151f97 -r 997690c3397a bluetoothengine/btui/btuidelegate/btdelegateremotedevname.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/bluetoothengine/btui/btuidelegate/btdelegateremotedevname.cpp Wed Jun 23 18:23:52 2010 +0300 @@ -0,0 +1,184 @@ +/* +* 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 "btdelegateremotedevname.h" +#include +#include +#include +#include +#include +#include "btuidevtypemap.h" + + +BtDelegateRemoteDevName::BtDelegateRemoteDevName(BtSettingModel* settingModel, + BtDeviceModel* deviceModel,QObject *parent ) + :BtAbstractDelegate( settingModel, deviceModel, parent ), mRegistryActive(0) +{ + +} + +BtDelegateRemoteDevName::~BtDelegateRemoteDevName() +{ + delete mRegistryActive; + mSymName.Close(); + mBtRegistry.Close(); + mBtRegServ.Close(); +} + +/*! + Validate the bluetooth device name given by the user: + Extra spaces (' ', '\n', '\t' and '\r') from the beginning, + middle and the end of the name are always removed; + the maximum lengthof a name is 30. + + TODO:Add duplicate name checking. If the new name duplicates + existing name in registry, prompt user to change the name + */ + +bool BtDelegateRemoteDevName::validateName(QString &name ) +{ + // remove spaces at the beginning and end: + name = name.trimmed(); + // regular expression of one or more consecutive spaces: + QRegExp rx("[ \n\t\r]+"); + name.replace( rx, " "); + if (name.length() > 30 ) { + name.resize( 30 ); + } + return name.length() > 0; +} + +void BtDelegateRemoteDevName::exec( const QVariant ¶ms ) +{ + QList paramList = params.value< QList >(); + QVariant indexVariant = paramList.at(0); + QModelIndex index = indexVariant.value(); + QVariant nameVariant = paramList.at(1); + QString btRemoteDevName = nameVariant.toString(); + + int error = KErrNone; + + validateName(btRemoteDevName); + mNewName = btRemoteDevName; + + TPtrC ptrName(reinterpret_cast(btRemoteDevName.constData())); + + error = mSymName.Create(ptrName.Length()); + + // todo (review comment): missing proper exception handling. + if(error == KErrNone) { + mSymName.Copy(ptrName); + } + else{ + emit commandCompleted(error,mNewName); + return; + } + + QString strBtAddr = getDeviceModel()->data(index, + BtDeviceModel::ReadableBdaddrRole).toString(); + + TBuf buffer(strBtAddr.utf16()); + mSymaddr.SetReadable( buffer ); + + error = mBtRegServ.Connect(); + if ( error != KErrNone && error != KErrAlreadyExists) { + emit commandCompleted(error,mNewName); + return; + } + + error = mBtRegistry.Open( mBtRegServ ) ; + if ( error != KErrNone && error != KErrAlreadyExists) { + emit commandCompleted(error,mNewName); + return; + } + if (!mRegistryActive){ + RequestIdentifiers requestId = Unknown; + TRAP(error, mRegistryActive = CBtSimpleActive::NewL( + *this, requestId)); + if(error!=KErrNone) { + emit commandCompleted(KErrGeneral); + return; + } + } + //first check if this device is already in the registry + + int majorRole = (getDeviceModel()->data(index,BtDeviceModel::MajorPropertyRole)).toInt(); + int cod = (getDeviceModel()->data(index,BtDeviceModel::CoDRole)).toInt(); + if (!(majorRole & BtuiDevProperty::InRegistry)) { + CBTDevice *symBtDevice; + TRAP( error, { + symBtDevice = CBTDevice::NewL( mSymaddr ); + symBtDevice->SetDeviceClass(cod); + RequestIdentifiers requestId = AddDevice; + mRegistryActive->SetRequestId(requestId); + mBtRegistry.AddDeviceL(*symBtDevice, mRegistryActive->iStatus); + mRegistryActive->GoActive(); + }); + + } + else{ + RequestIdentifiers requestId = ModifyFriendlyName; + mRegistryActive->SetRequestId(requestId); + TRAP( error, { + mBtRegistry.ModifyFriendlyDeviceNameL(mSymaddr, mSymName, mRegistryActive->iStatus); + mRegistryActive->GoActive(); + }); + } + if ( error != KErrNone ) { + emit commandCompleted(error,mNewName); + } + +} + +void BtDelegateRemoteDevName::RequestCompletedL( CBtSimpleActive* aActive, TInt aStatus ){ + + if(aStatus != KErrNone){ + emit commandCompleted(aStatus, mNewName); + return; + } + int error = KErrNone; + if ( aActive->RequestId() == AddDevice ){ + RequestIdentifiers requestId = ModifyFriendlyName; + mRegistryActive->SetRequestId(requestId); + TRAP( error, { + mBtRegistry.ModifyFriendlyDeviceNameL(mSymaddr, mSymName, mRegistryActive->iStatus); + mRegistryActive->GoActive(); + }); + if(error != KErrNone){ + emit commandCompleted(error, mNewName); + } + } + else if ( aActive->RequestId() == ModifyFriendlyName ){ + emit commandCompleted(error, mNewName); + } + +} + +void BtDelegateRemoteDevName::CancelRequest( TInt aRequestId ){ + if ( aRequestId == 1 ){ + mBtRegistry.CancelRequest(mRegistryActive->RequestStatus()); + emit commandCompleted(KErrCancel, mNewName); + } + +} + +void BtDelegateRemoteDevName::HandleError( CBtSimpleActive* aActive, TInt aError ){ + //TODO: handle the error here + Q_UNUSED( aActive ); + Q_UNUSED( aError ); + emit commandCompleted(KErrGeneral,mNewName); +} diff -r 91746b151f97 -r 997690c3397a bluetoothengine/btui/btuidelegate/btdelegateremotedevname.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/bluetoothengine/btui/btuidelegate/btdelegateremotedevname.h Wed Jun 23 18:23:52 2010 +0300 @@ -0,0 +1,82 @@ +/* +* 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 BTDELEGATEREMOTEDEVNAME_H +#define BTDELEGATEREMOTEDEVNAME_H + +#include +#include +//#include +//#include +#include +#include "btabstractdelegate.h" + +class BtuiModel; + +enum RequestIdentifiers { + Unknown = 0, // using a different number space than TBTVisibilityMode + AddDevice, + ModifyFriendlyName +}; + +/*! + \class BtDelegateRemoteDevName + \brief the base class for handling Bluetooth Local Name. + */ +class BtDelegateRemoteDevName : public BtAbstractDelegate, public MBtSimpleActiveObserver +{ + Q_OBJECT + +public: + explicit BtDelegateRemoteDevName( BtSettingModel* settingModel, + BtDeviceModel* deviceModel, QObject *parent = 0 ); + + virtual ~BtDelegateRemoteDevName(); + + virtual void exec( const QVariant ¶ms ); + + // from MBtSimpleActiveObserver + virtual void RequestCompletedL( CBtSimpleActive* aActive, TInt aStatus ); + + virtual void CancelRequest( TInt aRequestId ); + + virtual void HandleError( CBtSimpleActive* aActive, TInt aError ); + + +private: + bool validateName(QString &name ); + + RBTRegistry mBtRegistry; + + RBTRegServ mBtRegServ; + + CBtSimpleActive* mRegistryActive; + + QString mNewName; + + RBuf16 mSymName; + + TBTDevAddr mSymaddr; + + +private: + + Q_DISABLE_COPY(BtDelegateRemoteDevName) + +}; + +#endif // BTDELEGATEREMOTEDEVNAME_H diff -r 91746b151f97 -r 997690c3397a bluetoothengine/btui/btuidelegate/btdelegatevisibility.cpp --- a/bluetoothengine/btui/btuidelegate/btdelegatevisibility.cpp Fri Jun 11 13:48:51 2010 +0300 +++ b/bluetoothengine/btui/btuidelegate/btdelegatevisibility.cpp Wed Jun 23 18:23:52 2010 +0300 @@ -34,7 +34,7 @@ { TRAP_IGNORE( mBtengSettings = CBTEngSettings::NewL(this) ); Q_CHECK_PTR( mBtengSettings ); - mOperationOngoing = false; + mActiveHandling = false; } /*! @@ -54,12 +54,12 @@ { int minutes, err = 0; - if (mOperationOngoing) { + if (mActiveHandling) { // complete command with error emit commandCompleted(KErrInUse); return; } - mOperationOngoing = true; + mActiveHandling = true; // read 1st parameter BTUI_ASSERT_X(params.toList().at(0).isValid(), "BtDelegateVisibility::exec", "invalid parameter"); @@ -70,12 +70,12 @@ TBTVisibilityMode visibilityMode( EBTVisibilityModeNoScans ); err = mBtengSettings->GetVisibilityMode( visibilityMode ); if (err) { - mOperationOngoing = false; + mActiveHandling = false; emit commandCompleted(err); return; } if (visibilityMode == mOperation) { - mOperationOngoing = false; + mActiveHandling = false; emit commandCompleted(KErrNone); return; } @@ -100,7 +100,7 @@ } if (err) { // complete command with error - mOperationOngoing = false; + mActiveHandling = false; emit commandCompleted(err); } } @@ -118,9 +118,9 @@ */ void BtDelegateVisibility::VisibilityModeChanged( TBTVisibilityMode aState ) { - if (mOperationOngoing) { + if (mActiveHandling) { //Error handling has to be done, if value is not set properly. - mOperationOngoing = false; + mActiveHandling = false; if (mOperation == aState) { emit commandCompleted(KErrNone); } diff -r 91746b151f97 -r 997690c3397a bluetoothengine/btui/btuidelegate/btdelegatevisibility.h --- a/bluetoothengine/btui/btuidelegate/btdelegatevisibility.h Fri Jun 11 13:48:51 2010 +0300 +++ b/bluetoothengine/btui/btuidelegate/btdelegatevisibility.h Wed Jun 23 18:23:52 2010 +0300 @@ -52,7 +52,7 @@ private: CBTEngSettings* mBtengSettings; - bool mOperationOngoing; + bool mActiveHandling; TBTVisibilityMode mOperation; private: diff -r 91746b151f97 -r 997690c3397a bluetoothengine/btui/btuidelegate/btuidelegate.pro --- a/bluetoothengine/btui/btuidelegate/btuidelegate.pro Fri Jun 11 13:48:51 2010 +0300 +++ b/bluetoothengine/btui/btuidelegate/btuidelegate.pro Wed Jun 23 18:23:52 2010 +0300 @@ -36,7 +36,8 @@ btdelegateconnect.h \ btdelegatepair.h \ btdelegatedisconnect.h \ - btdelegatedevsecurity.h + btdelegatedevsecurity.h \ + btdelegateremotedevname.h SOURCES += btdelegatepower.cpp \ btdelegatefactory.cpp \ @@ -47,7 +48,8 @@ btdelegateconnect.cpp \ btdelegatepair.cpp \ btdelegatedisconnect.cpp \ - btdelegatedevsecurity.cpp + btdelegatedevsecurity.cpp \ + btdelegateremotedevname.cpp symbian: { SYMBIAN_PLATFORMS = WINSCW \ diff -r 91746b151f97 -r 997690c3397a bluetoothengine/btui/btuimodel/btdevicedata.cpp --- a/bluetoothengine/btui/btuimodel/btdevicedata.cpp Fri Jun 11 13:48:51 2010 +0300 +++ b/bluetoothengine/btui/btuimodel/btdevicedata.cpp Wed Jun 23 18:23:52 2010 +0300 @@ -19,46 +19,9 @@ #include #include #include "btuiutil.h" +#include "btuidevtypemap.h" #include "btqtconstants.h" -class DevTypeIconMapping { -public: - int majorDevClass; // major device class value from CoD - int minorDevClass; // minor device class value from CoD - int majorProperty; // one of major properties defined in BtDeviceModel - int minorProperty; // one of minor properties defined in BtDeviceModel - char* connectedIcon; // the icon name for connected device - char* unconnectedIcon; // the icon name for not connected device. -}; - -// mapping table from major and minor Device Classes to device types and icons -// which are specifically defined in btapplication namespace. -// (Note audio device mapping is not in this table due to its complex logic) -static const DevTypeIconMapping DeviceTypeIconMappingTable[] = -{ -{EMajorDeviceComputer, 0, BtDeviceModel::Computer, 0, - ":/icons/qgn_prop_bt_computer_connect.svg", ":/icons/qgn_prop_bt_computer.svg" }, -{EMajorDevicePhone, 0, BtDeviceModel::Phone, 0, - ":/icons/qgn_prop_bt_phone_connect.svg", ":/icons/qgn_prop_bt_phone.svg"}, -{EMajorDeviceLanAccessPoint, 0, BtDeviceModel::LANAccessDev, 0, - ":/icons/qgn_prop_bt_misc.svg", ":/icons/qgn_prop_bt_misc.svg" }, -{EMajorDevicePeripheral, EMinorDevicePeripheralKeyboard, - BtDeviceModel::Peripheral, BtDeviceModel::Keyboard, - ":/icons/qgn_prop_bt_keyboard_connect.svg", ":/icons/qgn_prop_bt_keyboard.svg"}, -{EMajorDevicePeripheral, EMinorDevicePeripheralPointer, - BtDeviceModel::Peripheral, BtDeviceModel::Mouse, - ":/icons/qgn_prop_bt_mouse_connect.svg", ":/icons/qgn_prop_bt_mouse.svg"}, -{EMajorDeviceImaging, 0, BtDeviceModel::ImagingDev, 0, - ":/icons/qgn_prop_bt_printer_connect.svg", ":/icons/qgn_prop_bt_printer.svg"}, -{EMajorDeviceWearable, 0, BtDeviceModel::WearableDev, 0, - ":/icons/qgn_prop_bt_misc.svg", ":/icons/qgn_prop_bt_misc.svg"}, -{EMajorDeviceToy, 0, BtDeviceModel::Toy, 0, - ":/icons/qgn_prop_bt_misc.svg", ":/icons/qgn_prop_bt_misc.svg"}, -}; - -static const int DeviceTypeIconMappingTableSize = - sizeof( DeviceTypeIconMappingTable ) / sizeof( DevTypeIconMapping ); - /*! Constructor. */ @@ -124,7 +87,7 @@ \param val contains the value at return. \param row the row number which the value is from \param col the column number which the value is from - \param role the role idenfier of the value. + \param role the role identifier of the value. */ void BtDeviceData::data(QVariant& val, int row, int col, int role ) const { @@ -195,7 +158,7 @@ if(isDeviceInRegistry(qtdev)) { // we cannot remove this device as it is in registry. // remove it in-range property. - setMajorProperty(mData[i], BtDeviceModel::InRange, false); + setMajorProperty(mData[i], BtuiDevProperty::InRange, false); updateRssi(mData[i], RssiInvalid); mModel.emitDataChanged( i, 0, this ); } @@ -232,7 +195,7 @@ // remore it from model now. // clear-registry related properties, so that // we get a chance to clean it after device searching later. - setMajorProperty(mData[i], BtDeviceModel::RegistryProperties, false); + setMajorProperty(mData[i], BtuiDevProperty::RegistryProperties, false); mModel.emitDataChanged( i, 0, this ); } else { @@ -268,7 +231,7 @@ updateRssi(devData, RssiInvalid); } // add device-in-registry property: - setMajorProperty(devData, BtDeviceModel::InRegistry, true); + setMajorProperty(devData, BtuiDevProperty::InRegistry, true); updateDeviceProperty(devData, dev, 0 ); mModel.beginInsertRows( QModelIndex(), mData.count(), mData.count() ); mData.append( devData ); @@ -276,7 +239,7 @@ } else { updateDeviceProperty(mData[i], dev, similarity ); - setMajorProperty(mData[i], BtDeviceModel::InRegistry, true); + setMajorProperty(mData[i], BtuiDevProperty::InRegistry, true); mModel.emitDataChanged( i, 0, this ); } } @@ -290,13 +253,13 @@ { int i = indexOf( dev.Addr() ); if ( i > -1 ) { - int preconn = BtDeviceModel::Connected + int preconn = BtuiDevProperty::Connected & mData[i][BtDeviceModel::MajorPropertyRole].toInt(); // we only update and signal if connection status is really // changed: if ( ( preconn != 0 && !connected ) || ( preconn == 0 && connected ) ) { - setMajorProperty(mData[i], BtDeviceModel::Connected, connected ); + setMajorProperty(mData[i], BtuiDevProperty::Connected, connected ); mModel.emitDataChanged( i, 0, this ); } } @@ -323,7 +286,7 @@ if ( pos == -1 ) { BtuiModelDataItem devData; - setMajorProperty(devData, BtDeviceModel::InRange, true); + setMajorProperty(devData, BtuiDevProperty::InRange, true); updateRssi(devData, rssi); CBtDevExtension* devExt(NULL); TRAP_IGNORE( { @@ -336,7 +299,7 @@ mModel.endInsertRows(); } else { - setMajorProperty(mData[pos], BtDeviceModel::InRange, true); + setMajorProperty(mData[pos], BtuiDevProperty::InRange, true); updateRssi(mData[pos], rssi); mModel.emitDataChanged( pos, 0, this ); } @@ -360,7 +323,7 @@ // If the device store is not empty, we clear // registry property from these devices first. for (int i = 0; i < mData.count(); ++i) { - setMajorProperty(mData[i], BtDeviceModel::RegistryProperties, false); + setMajorProperty(mData[i], BtuiDevProperty::RegistryProperties, false); } if ( mData.count() ) { // need to update view because we have changed device properties. @@ -374,14 +337,14 @@ int pos = indexOf( devs[i]->Addr() ); if ( pos > -1 ) { // add device-in-registry property: - setMajorProperty(mData[pos], BtDeviceModel::InRegistry, true); + setMajorProperty(mData[pos], BtuiDevProperty::InRegistry, true); updateDeviceProperty(mData[pos], *(devs[i]), 0); mModel.emitDataChanged( pos, 0, this ); } else { BtuiModelDataItem devData; // add device-in-registry property: - setMajorProperty(devData, BtDeviceModel::InRegistry, true); + setMajorProperty(devData, BtuiDevProperty::InRegistry, true); updateDeviceProperty(devData, *( devs[i] ), 0 ); mModel.beginInsertRows(QModelIndex(), mData.count(), mData.count() ); mData.append( devData ); @@ -416,65 +379,28 @@ qtdev[BtDeviceModel::LastUsedTimeRole] = QVariant(qdt); // set paired status: - setMajorProperty(qtdev, BtDeviceModel::Bonded, isBonded( dev.Device() )); + setMajorProperty(qtdev, BtuiDevProperty::Bonded, isBonded( dev.Device() )); // set blocked status: - setMajorProperty(qtdev, BtDeviceModel::Blocked, + setMajorProperty(qtdev, BtuiDevProperty::Blocked, dev.Device().GlobalSecurity().Banned() ); // set trusted status: - setMajorProperty(qtdev, BtDeviceModel::Trusted, + setMajorProperty(qtdev, BtuiDevProperty::Trusted, dev.Device().GlobalSecurity().NoAuthorise() ); //CoDRole //MinorPropertyRole int cod = static_cast( dev.Device().DeviceClass().DeviceClass() ); qtdev[BtDeviceModel::CoDRole] = QVariant(cod); - - // Initially, clear CoD related properties: - int majorProperty = qtdev[BtDeviceModel::MajorPropertyRole].toInt() & - ~BtDeviceModel::CodProperties; - - int minorProperty = BtDeviceModel::NullProperty; - - // device type must be mapped according to CoD: - int majorDevCls = dev.Device().DeviceClass().MajorDeviceClass(); - int minorDevCls = dev.Device().DeviceClass().MinorDeviceClass(); - int i; - for (i = 0; i < DeviceTypeIconMappingTableSize; ++i ) { - if ( DeviceTypeIconMappingTable[i].majorDevClass == majorDevCls && - ( DeviceTypeIconMappingTable[i].minorDevClass == 0 || - DeviceTypeIconMappingTable[i].minorDevClass == minorDevCls ) ) { - // device classes match a item in table, get the mapping: - majorProperty |= DeviceTypeIconMappingTable[i].majorProperty; - minorProperty |= DeviceTypeIconMappingTable[i].minorProperty; - break; - } - } - - // AV device mapping are not defined in the table, do mapping here if no device - // type mapped so far: - if ( i == DeviceTypeIconMappingTableSize) { - // audio device, carkit, headset or speaker: - if( ( majorDevCls == EMajorDeviceAV) - || (dev.Device().DeviceClass().MajorServiceClass() == EMajorServiceRendering - && majorDevCls != EMajorDeviceImaging) ) { - - majorProperty |= BtDeviceModel::AVDev; - - if( minorDevCls == EMinorDeviceAVCarAudio ) { - // carkit: - minorProperty |= BtDeviceModel::Carkit; - } - else { - // headset: - minorProperty |= BtDeviceModel::Headset; - } - } - } - - qtdev[BtDeviceModel::MajorPropertyRole] = QVariant( majorProperty ); - qtdev[BtDeviceModel::MinorPropertyRole] = QVariant( minorProperty ); + int majorDeviceType; + int minorDeviceType; + // device type is mapped according to CoD: + BtuiDevProperty::mapDeiveType(majorDeviceType, minorDeviceType, cod); + + qtdev[BtDeviceModel::MajorPropertyRole] = + QVariant( qtdev[BtDeviceModel::MajorPropertyRole].toInt() | majorDeviceType ); + qtdev[BtDeviceModel::MinorPropertyRole] = QVariant( minorDeviceType ); } int BtDeviceData::indexOf( const TBTDevAddr& addr ) const @@ -514,10 +440,10 @@ bool BtDeviceData::isDeviceInRange( const BtuiModelDataItem& qtdev ) { - return BtDeviceModel::InRange & qtdev[BtDeviceModel::MajorPropertyRole].toInt(); + return BtuiDevProperty::InRange & qtdev[BtDeviceModel::MajorPropertyRole].toInt(); } bool BtDeviceData::isDeviceInRegistry( const BtuiModelDataItem& qtdev ) { - return BtDeviceModel::InRegistry & qtdev[BtDeviceModel::MajorPropertyRole].toInt(); + return BtuiDevProperty::InRegistry & qtdev[BtDeviceModel::MajorPropertyRole].toInt(); } diff -r 91746b151f97 -r 997690c3397a bluetoothengine/btui/btuimodel/btlocalsetting.cpp --- a/bluetoothengine/btui/btuimodel/btlocalsetting.cpp Fri Jun 11 13:48:51 2010 +0300 +++ b/bluetoothengine/btui/btuimodel/btlocalsetting.cpp Wed Jun 23 18:23:52 2010 +0300 @@ -18,11 +18,8 @@ #include "btlocalsetting.h" #include -//#include #include #include -//#include -//#include #include "btqtconstants.h" const int KLocalDeviceNameWatcher = 10; @@ -211,18 +208,12 @@ BtuiModelDataItem& item = mData[ BtSettingModel::LocalBtNameRow ]; - if ( item.isEmpty() ) { - // Initialize with additional information on the setting - item[ BtSettingModel::SettingNameRole ] = QVariant( tr( "Local Bluetooth name" ) ); - } - bool setByUser = !name.isEmpty(); // The additional parameter is the flag indicating whether the // Bluetooth name has been set by the user. // The flag is set to true if the name has been set. - // requirement does not - //nitem[ BtSettingModel::SettingValueParamRole ] = QVariant( setByUser ); + // item[ BtSettingModel::SettingValueParamRole ] = QVariant( setByUser ); QString resolvedName( name ); if ( resolvedName.isEmpty() ) { @@ -240,38 +231,14 @@ { BtuiModelDataItem& item = mData[ BtSettingModel::PowerStateRow ]; - if ( item.isEmpty() ) { - // Initialize with additional information on the setting - item[ BtSettingModel::SettingNameRole ] = QVariant( tr( "Bluetooth power" ) ); - } - bool powerOn = ( state == EBTPowerOn ); - - item[ BtSettingModel::settingDisplayRole ] = - powerOn ? QVariant( tr( "On" ) ) : QVariant( tr( "Off" ) ); - item[ BtSettingModel::SettingValueRole ] = QVariant( powerOn ); + item[ BtSettingModel::SettingValueRole ] = QVariant( QtPowerMode(state) ); } void BtLocalSetting::setVisibilityMode( TBTVisibilityMode state ) { BtuiModelDataItem& item = mData[ BtSettingModel::VisibilityRow ]; - if ( item.isEmpty() ) { - item[ BtSettingModel::SettingNameRole ] = QVariant( tr( "Phone visibility" ) ); - } - - if ( state == EBTVisibilityModeHidden ) - { - item [ BtSettingModel::settingDisplayRole ] = QVariant( tr( "Hidden" ) ); - } - else if ( state == EBTVisibilityModeGeneral ) - { - item [ BtSettingModel::settingDisplayRole ] = QVariant( tr( "Visible" ) ); - } - else - { - item [ BtSettingModel::settingDisplayRole ] = QVariant( tr( "Temporarily visible" ) ); - } item [ BtSettingModel::SettingValueRole ] = QVariant( QtVisibilityMode(state) ); } diff -r 91746b151f97 -r 997690c3397a bluetoothengine/btui/btuimodel/btlocalsetting.h --- a/bluetoothengine/btui/btuimodel/btlocalsetting.h Fri Jun 11 13:48:51 2010 +0300 +++ b/bluetoothengine/btui/btuimodel/btlocalsetting.h Wed Jun 23 18:23:52 2010 +0300 @@ -1,25 +1,19 @@ /* -* ============================================================================ -* Name : btuimsettings.h -* Part of : BluetoothUI / bluetoothuimodel *** Info from the SWAD -* Description : Declaration of the class representing the Bluetooth -* settings source data. -* -* Copyright © 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: -* Nokia Corporation -* ============================================================================ -* Template version: 4.2 -*/ + * 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 BTLOCALSETTING_H #define BTLOCALSETTING_H diff -r 91746b151f97 -r 997690c3397a bluetoothengine/btui/btuimodel/btuimodelsortfilter.cpp --- a/bluetoothengine/btui/btuimodel/btuimodelsortfilter.cpp Fri Jun 11 13:48:51 2010 +0300 +++ b/bluetoothengine/btui/btuimodel/btuimodelsortfilter.cpp Wed Jun 23 18:23:52 2010 +0300 @@ -17,7 +17,7 @@ #include #include - +#include "btuidevtypemap.h" /*! Constructor. */ @@ -36,8 +36,7 @@ /*! Replace current filter values for filtering on major device class with - the specified. This Model will not reset itself for performance reason, - the caller shall call reset after all filters have been set. + the specified. */ void BtuiModelSortFilter::setDeviceMajorFilter( int filter, FilterMode mode ) { @@ -48,21 +47,18 @@ /*! Add the specified filter value for filtering on major device class if the specified filter doesn't exist when this function is called. - This Model will not reset itself for performance reason, - the caller shall call reset after all filters have been set. */ void BtuiModelSortFilter::addDeviceMajorFilter( int filter, FilterMode mode ) { FilterItem f(filter, mode); if ( mFilters.indexOf(f) == -1 ) { mFilters.append( f ); + invalidateFilter(); } } /*! Clear the specified filter value for filtering on major device class from this model. - This Model will not reset itself for performance reason, - the caller shall call reset after all filters have been set. */ void BtuiModelSortFilter::clearDeviceMajorFilter( int filter, FilterMode mode ) { @@ -70,23 +66,21 @@ int i = mFilters.indexOf(f); if ( i > -1 ) { mFilters.removeAt( i ); + invalidateFilter(); } } /*! clear all filters for filtering on major device class. - This Model will not reset itself for performance reason, - the caller shall call reset after all filters have been set. + This Model will reset itself. */ void BtuiModelSortFilter::clearDeviceMajorFilters() { // model reset is needed if there are filters : - bool shReset = ( mFilters.size() > 0 ); - - if ( shReset ) { - reset(); + if ( mFilters.size() > 0 ) { + mFilters.clear(); + invalidateFilter(); } - mFilters.clear(); } /*! @@ -110,7 +104,7 @@ // the row shall pass all filters: for (int i = 0; i < mFilters.size(); i++ ) { - if ( mFilters.at(i).mFilter == BtDeviceModel::NullProperty ) { + if ( mFilters.at(i).mFilter == BtuiDevProperty::NullProperty ) { accepted = true; // There is no filter, we accept all } else { @@ -122,12 +116,12 @@ accepted = majorProperty == mFilters.at(i).mFilter ; break; case AtLeastMatch: - // accept if it matches all specified filters: + // accept if it matches all specified properties: accepted = ( mFilters.at(i).mFilter == ( majorProperty & mFilters.at(i).mFilter ) ); break; case RoughMatch: - // Accept if it matches one of specified filters: + // Accept if it matches one of specified properties: accepted = (majorProperty & mFilters.at(i).mFilter) != 0; break; case Exclusive: @@ -138,6 +132,9 @@ accepted = false; } } + // Break out of the loop at first non-accepted condition + if (!accepted) + break; } if (accepted) { // emit signal to inform a row has been accepted by fitler, diff -r 91746b151f97 -r 997690c3397a bluetoothengine/btui/bwins/btdevsettingframeworku.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/bluetoothengine/btui/bwins/btdevsettingframeworku.def Wed Jun 23 18:23:52 2010 +0300 @@ -0,0 +1,24 @@ +EXPORTS + ?aboutToClose@BtAbstractDevSetting@@UAEXXZ @ 1 NONAME ; void BtAbstractDevSetting::aboutToClose(void) + ??0BtAbstractDevSetting@@QAE@ABVQString@@PAVQObject@@@Z @ 2 NONAME ; BtAbstractDevSetting::BtAbstractDevSetting(class QString const &, class QObject *) + ?tr@BtAbstractDevSetting@@SA?AVQString@@PBD0H@Z @ 3 NONAME ; class QString BtAbstractDevSetting::tr(char const *, char const *, int) + ?staticMetaObject@BtAbstractDevSetting@@2UQMetaObject@@B @ 4 NONAME ; struct QMetaObject const BtAbstractDevSetting::staticMetaObject + ?tr@BtAbstractDevSetting@@SA?AVQString@@PBD0@Z @ 5 NONAME ; class QString BtAbstractDevSetting::tr(char const *, char const *) + ?isSettingAvailable@BtAbstractDevSetting@@UAE_NXZ @ 6 NONAME ; bool BtAbstractDevSetting::isSettingAvailable(void) + ?trUtf8@BtAbstractDevSetting@@SA?AVQString@@PBD0@Z @ 7 NONAME ; class QString BtAbstractDevSetting::trUtf8(char const *, char const *) + ?getStaticMetaObject@BtAbstractDevSetting@@SAABUQMetaObject@@XZ @ 8 NONAME ; struct QMetaObject const & BtAbstractDevSetting::getStaticMetaObject(void) + ??_EBtDevSettingInterface@@UAE@I@Z @ 9 NONAME ; BtDevSettingInterface::~BtDevSettingInterface(unsigned int) + ?trUtf8@BtAbstractDevSetting@@SA?AVQString@@PBD0H@Z @ 10 NONAME ; class QString BtAbstractDevSetting::trUtf8(char const *, char const *, int) + ?aboutToBackground@BtAbstractDevSetting@@UAEXXZ @ 11 NONAME ; void BtAbstractDevSetting::aboutToBackground(void) + ??_EBtAbstractDevSetting@@UAE@I@Z @ 12 NONAME ; BtAbstractDevSetting::~BtAbstractDevSetting(unsigned int) + ?aboutToForeground@BtAbstractDevSetting@@UAEXXZ @ 13 NONAME ; void BtAbstractDevSetting::aboutToForeground(void) + ?metaObject@BtAbstractDevSetting@@UBEPBUQMetaObject@@XZ @ 14 NONAME ; struct QMetaObject const * BtAbstractDevSetting::metaObject(void) const + ?qt_metacast@BtAbstractDevSetting@@UAEPAXPBD@Z @ 15 NONAME ; void * BtAbstractDevSetting::qt_metacast(char const *) + ??1BtAbstractDevSetting@@UAE@XZ @ 16 NONAME ; BtAbstractDevSetting::~BtAbstractDevSetting(void) + ?qt_metacall@BtAbstractDevSetting@@UAEHW4Call@QMetaObject@@HPAPAX@Z @ 17 NONAME ; int BtAbstractDevSetting::qt_metacall(enum QMetaObject::Call, int, void * *) + ?getRemote@BtAbstractDevSetting@@QBEABVQString@@XZ @ 18 NONAME ; class QString const & BtAbstractDevSetting::getRemote(void) const + ?loadDevSettingInterfaces@BtDevSettingPluginLoader@@SA?AV?$QList@PAVBtDevSettingInterface@@@@XZ @ 19 NONAME ; class QList BtDevSettingPluginLoader::loadDevSettingInterfaces(void) + ?settingAvailabilityChanged@BtAbstractDevSetting@@IAEXPAV1@_N@Z @ 20 NONAME ; void BtAbstractDevSetting::settingAvailabilityChanged(class BtAbstractDevSetting *, bool) + ?getSettingWidget@BtAbstractDevSetting@@UAEPAVHbWidget@@XZ @ 21 NONAME ; class HbWidget * BtAbstractDevSetting::getSettingWidget(void) + ??1BtDevSettingInterface@@UAE@XZ @ 22 NONAME ; BtDevSettingInterface::~BtDevSettingInterface(void) + diff -r 91746b151f97 -r 997690c3397a bluetoothengine/btui/bwins/btuidelegateu.def --- a/bluetoothengine/btui/bwins/btuidelegateu.def Fri Jun 11 13:48:51 2010 +0300 +++ b/bluetoothengine/btui/bwins/btuidelegateu.def Wed Jun 23 18:23:52 2010 +0300 @@ -16,4 +16,5 @@ ?getSettingModel@BtAbstractDelegate@@IAEPAVBtSettingModel@@XZ @ 15 NONAME ; class BtSettingModel * BtAbstractDelegate::getSettingModel(void) ?getDeviceModel@BtAbstractDelegate@@IAEPAVBtDeviceModel@@XZ @ 16 NONAME ; class BtDeviceModel * BtAbstractDelegate::getDeviceModel(void) ?trUtf8@BtAbstractDelegate@@SA?AVQString@@PBD0H@Z @ 17 NONAME ; class QString BtAbstractDelegate::trUtf8(char const *, char const *, int) + ?isBtPowerOn@BtAbstractDelegate@@IAE_NXZ @ 18 NONAME ; bool BtAbstractDelegate::isBtPowerOn(void) diff -r 91746b151f97 -r 997690c3397a bluetoothengine/btui/eabi/btdevsettingframeworku.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/bluetoothengine/btui/eabi/btdevsettingframeworku.def Wed Jun 23 18:23:52 2010 +0300 @@ -0,0 +1,22 @@ +EXPORTS + _ZN20BtAbstractDevSetting11qt_metacallEN11QMetaObject4CallEiPPv @ 1 NONAME + _ZN20BtAbstractDevSetting11qt_metacastEPKc @ 2 NONAME + _ZN20BtAbstractDevSetting12aboutToCloseEv @ 3 NONAME + _ZN20BtAbstractDevSetting16getSettingWidgetEv @ 4 NONAME + _ZN20BtAbstractDevSetting16staticMetaObjectE @ 5 NONAME DATA 16 + _ZN20BtAbstractDevSetting17aboutToBackgroundEv @ 6 NONAME + _ZN20BtAbstractDevSetting17aboutToForegroundEv @ 7 NONAME + _ZN20BtAbstractDevSetting18isSettingAvailableEv @ 8 NONAME + _ZN20BtAbstractDevSetting19getStaticMetaObjectEv @ 9 NONAME + _ZN20BtAbstractDevSetting26settingAvailabilityChangedEPS_b @ 10 NONAME + _ZN20BtAbstractDevSettingC1ERK7QStringP7QObject @ 11 NONAME + _ZN20BtAbstractDevSettingC2ERK7QStringP7QObject @ 12 NONAME + _ZN20BtAbstractDevSettingD0Ev @ 13 NONAME + _ZN20BtAbstractDevSettingD1Ev @ 14 NONAME + _ZN20BtAbstractDevSettingD2Ev @ 15 NONAME + _ZN24BtDevSettingPluginLoader24loadDevSettingInterfacesEv @ 16 NONAME + _ZNK20BtAbstractDevSetting10metaObjectEv @ 17 NONAME + _ZNK20BtAbstractDevSetting9getRemoteEv @ 18 NONAME + _ZTI20BtAbstractDevSetting @ 19 NONAME + _ZTV20BtAbstractDevSetting @ 20 NONAME + diff -r 91746b151f97 -r 997690c3397a bluetoothengine/btui/eabi/btuidelegateu.def --- a/bluetoothengine/btui/eabi/btuidelegateu.def Fri Jun 11 13:48:51 2010 +0300 +++ b/bluetoothengine/btui/eabi/btuidelegateu.def Wed Jun 23 18:23:52 2010 +0300 @@ -15,4 +15,5 @@ _ZNK18BtAbstractDelegate10metaObjectEv @ 14 NONAME _ZTI18BtAbstractDelegate @ 15 NONAME _ZTV18BtAbstractDelegate @ 16 NONAME + _ZN18BtAbstractDelegate11isBtPowerOnEv @ 17 NONAME diff -r 91746b151f97 -r 997690c3397a bluetoothengine/btui/inc/bluetoothtrace.h --- a/bluetoothengine/btui/inc/bluetoothtrace.h Fri Jun 11 13:48:51 2010 +0300 +++ b/bluetoothengine/btui/inc/bluetoothtrace.h Wed Jun 23 18:23:52 2010 +0300 @@ -1,24 +1,19 @@ /* -* ============================================================================ -* Name : bluetoothtrace.h -* Part of : BluetoothUI / bluetoothuimodel *** Info from the SWAD -* Description : API declaration of run-time debug tracing -* -* Copyright © 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: -* Nokia Corporation -* ============================================================================ -* Template version: 4.2 -*/ + * 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 BLUETOOTHTRACE_H #define BLUETOOTHTRACE_H diff -r 91746b151f97 -r 997690c3397a bluetoothengine/btui/inc/bluetoothuitrace.h --- a/bluetoothengine/btui/inc/bluetoothuitrace.h Fri Jun 11 13:48:51 2010 +0300 +++ b/bluetoothengine/btui/inc/bluetoothuitrace.h Wed Jun 23 18:23:52 2010 +0300 @@ -1,24 +1,19 @@ /* -* ============================================================================ -* Name : bluetoothuitrace.h -* Part of : BluetoothUI / bluetoothuimodel *** Info from the SWAD -* Description : API declaration of run-time debug tracing in bluetoothui project -* -* Copyright © 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: -* Nokia Corporation -* ============================================================================ -* Template version: 4.2 -*/ + * 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 BLUETOOTHUITRACE_H #define BLUETOOTHUITRACE_H diff -r 91746b151f97 -r 997690c3397a bluetoothengine/btui/inc/btdevicemodel.h --- a/bluetoothengine/btui/inc/btdevicemodel.h Fri Jun 11 13:48:51 2010 +0300 +++ b/bluetoothengine/btui/inc/btdevicemodel.h Wed Jun 23 18:23:52 2010 +0300 @@ -67,65 +67,10 @@ LastUsedTimeRole, // QDateTime RssiRole, // QVariant::Int MajorPropertyRole, // QVariant::Int, bits of DevMajorProperty - MinorPropertyRole, // QVariant::Int, bits according to an item from DevMajorProperty + MinorPropertyRole, // QVariant::Int, bits of DevMinorProperty CoDRole, // QVariant::Int, the value of Class of Device }; - /* - * Major device property values. - */ - enum DevMajorProperty { - NullProperty = 0x00000000, // device without any specific filter. - Bonded = 0x00000001, // device is in registry and bonded with phone - Blocked = 0x00000002, // device is in registry and blocked by user - RecentlyUsed = 0x00000004, // device is in registry and was used in last 30 days. - Trusted = 0x00000008, // device is in registry and authorized by user. - InRegistry = 0x00000010, // device exists in registry. - - Connected = 0x00000020, // device is currently connected to one or more - // services managed by Bluetooth Engine. - Connectable = 0x00000040, // device is connectable to one or more - // services managed by Bluetooth Engine. - InRange = 0x00000100, // device is in range - - // bits re-defined according to Class of Device: - Computer = 0x00010000, // a computer - Phone = 0x00020000, // a phone - LANAccessDev = 0x00040000, // a LAN access point - AVDev = 0x00080000, // an A/V device - Peripheral = 0x00100000, // a peripheral - ImagingDev = 0x00200000, // an imaging device - WearableDev = 0x00400000, // a wearable device - Toy = 0x00800000, // a toy - HealthDev = 0x01000000, // a health device - UncategorizedDev = 0x02000000, // a generic device that is uncategorized - - // all properties derived from BT registry - RegistryProperties = Bonded | - Blocked | RecentlyUsed | Trusted | InRegistry, - - // all properties derived from CoD - CodProperties = Computer | Phone | LANAccessDev | - AVDev | Peripheral | ImagingDev | WearableDev | - Toy | HealthDev | UncategorizedDev, - }; - - /* - * Minor device filters for major property \code AVDev \endcode - */ - enum AVDevMinorProperty { - Carkit = 0x00000001, - Headset = 0x00000002, - }; - - /* - * Minor device filters for major property \code Peripheral \endcode - */ - enum PeripheralMinorProperty { - Mouse = 0x00000001, - Keyboard = 0x00000002, - }; - public: explicit BtDeviceModel( QObject *parent = 0 ); diff -r 91746b151f97 -r 997690c3397a bluetoothengine/btui/inc/btqtconstants.h --- a/bluetoothengine/btui/inc/btqtconstants.h Fri Jun 11 13:48:51 2010 +0300 +++ b/bluetoothengine/btui/inc/btqtconstants.h Wed Jun 23 18:23:52 2010 +0300 @@ -19,6 +19,7 @@ #define BTQTCONSTANTS_H #include +#include // RSSI value range: -127dB ~ +20dB @@ -32,21 +33,35 @@ const int RssiInvalid = RssiMinRange - 1; +enum PowerStateQtValue { + BtPowerOff = 0, + BtPowerOn, + BtPowerUnknown // only for error situations +}; + +enum DisconnectOption { + ServiceLevel = 0, + PhysicalLink, + AllOngoingConnections, + DisconUnknown +}; + enum VisibilityMode { BtHidden = 0x10, // using a different number space than TBTVisibilityMode BtVisible, BtTemporary, - BtUnknown - + BtVisibilityUnknown }; // used for mapping between UI row and VisibilityMode item enum VisibilityModeUiRowMapping { UiRowBtHidden = 0, UiRowBtVisible, - UiRowBtTemporary + UiRowBtTemporary, + UiRowBtUnknown }; + inline VisibilityMode QtVisibilityMode(TBTVisibilityMode btEngMode) { VisibilityMode mode; @@ -61,7 +76,7 @@ mode = BtTemporary; break; default: - mode = BtUnknown; + mode = BtVisibilityUnknown; } return mode; } @@ -85,5 +100,36 @@ return mode; } +inline PowerStateQtValue QtPowerMode(TBTPowerStateValue btEngMode) +{ + PowerStateQtValue mode; + switch(btEngMode) { + case EBTPowerOff: + mode = BtPowerOff; + break; + case EBTPowerOn: + mode = BtPowerOn; + break; + default: + mode = BtPowerUnknown; // error + } + return mode; +} + +inline TBTPowerStateValue BtEngPowerState(PowerStateQtValue qtPowerState) +{ + TBTPowerStateValue btEngPowerState; + switch (qtPowerState){ + case BtPowerOff: + btEngPowerState = EBTPowerOff; + break; + case BtPowerOn: + btEngPowerState = EBTPowerOn; + break; + default: + btEngPowerState = (TBTPowerStateValue)KErrUnknown; + } + return btEngPowerState; +} #endif // BTQTCONSTANTS_H diff -r 91746b151f97 -r 997690c3397a bluetoothengine/btui/inc/btuidevtypemap.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/bluetoothengine/btui/inc/btuidevtypemap.h Wed Jun 23 18:23:52 2010 +0300 @@ -0,0 +1,164 @@ +/* + * 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 BTUIDEVTYPEMAP_H +#define BTUIDEVTYPEMAP_H + +#include +#include + +class BtuiDevProperty +{ +public: // type definitions: + /* + * Major device property values. + */ + enum DevMajorProperty { + NullProperty = 0x00000000, // device without any specific filter. + Bonded = 0x00000001, // device is in registry and bonded with phone + Blocked = 0x00000002, // device is in registry and blocked by user + RecentlyUsed = 0x00000004, // device is in registry and was used in last 30 days. + Trusted = 0x00000008, // device is in registry and authorized by user. + InRegistry = 0x00000010, // device exists in registry. + + Connected = 0x00000020, // device is currently connected to one or more + // services managed by Bluetooth Engine. + Connectable = 0x00000040, // device is connectable to one or more + // services managed by Bluetooth Engine. + InRange = 0x00000100, // device is in range + + // bits re-defined according to Class of Device: + Computer = 0x00010000, // a computer + Phone = 0x00020000, // a phone + LANAccessDev = 0x00040000, // a LAN access point + AVDev = 0x00080000, // an A/V device + Peripheral = 0x00100000, // a peripheral (input device) + ImagingDev = 0x00200000, // an imaging device + WearableDev = 0x00400000, // a wearable device + Toy = 0x00800000, // a toy + HealthDev = 0x01000000, // a health device + UncategorizedDev = 0x02000000, // a generic device that is uncategorized + + // all properties derived from BT registry + RegistryProperties = Bonded | + Blocked | RecentlyUsed | Trusted | InRegistry, + + // all properties derived from CoD + CodProperties = Computer | Phone | LANAccessDev | + AVDev | Peripheral | ImagingDev | WearableDev | + Toy | HealthDev | UncategorizedDev, + }; + + /* + * Minor device filters for major property \code AVDev \endcode + */ + enum AVDevMinorProperty { + Carkit = 0x00000001, + Headset = 0x00000002, + }; + + /* + * Minor device filters for major property \code Peripheral \endcode + */ + enum PeripheralMinorProperty { + Mouse = 0x00000001, + Keyboard = 0x00000002, + }; + +public: + static void mapDeiveType(int &majorProperty, int &minorProperty, int cod ); + +}; + + +class DevTypeMapping +{ +public: + int majorDevClass; // major device class value from CoD + int minorDevClass; // minor device class value from CoD + int majorProperty; // one of major properties defined in BtDeviceModel + int minorProperty; // one of minor properties defined in BtDeviceModel +}; + +// mapping table from major and minor Device Classes to device types +// which are specifically defined in Bluetooth ui namespace. +// (Note audio device mapping is not in this table due to its complex logic) +static const DevTypeMapping DeviceTypeMappingTable[] = +{ +{EMajorDeviceComputer, 0, BtuiDevProperty::Computer, 0 }, +{EMajorDevicePhone, 0, BtuiDevProperty::Phone, 0 }, +{EMajorDeviceLanAccessPoint, 0, BtuiDevProperty::LANAccessDev, 0}, +{EMajorDevicePeripheral, EMinorDevicePeripheralKeyboard, + BtuiDevProperty::Peripheral, + BtuiDevProperty::Keyboard}, +{EMajorDevicePeripheral, EMinorDevicePeripheralPointer, + BtuiDevProperty::Peripheral, + BtuiDevProperty::Mouse}, +{EMajorDeviceImaging, 0, BtuiDevProperty::ImagingDev, 0}, +{EMajorDeviceWearable, 0, BtuiDevProperty::WearableDev, 0}, +{EMajorDeviceToy, 0, BtuiDevProperty::Toy, 0} +}; + +static const int DeviceTypeMappingTableSize = + sizeof( DeviceTypeMappingTable ) / sizeof( DevTypeMapping ); + +inline void BtuiDevProperty::mapDeiveType( + int &majorProperty, int &minorProperty, int cod ) +{ + // remove garbage value. + majorProperty = 0; + minorProperty = 0; + TBTDeviceClass codClass = TBTDeviceClass( cod ); + + // device type must be mapped according to CoD: + int majorServiceCls = codClass.MajorServiceClass(); + int majorDevCls = codClass.MajorDeviceClass(); + int minorDevCls = codClass.MinorDeviceClass(); + + int i; + for (i = 0; i < DeviceTypeMappingTableSize; ++i ) { + if ( DeviceTypeMappingTable[i].majorDevClass == majorDevCls && + ( DeviceTypeMappingTable[i].minorDevClass == 0 || + DeviceTypeMappingTable[i].minorDevClass == minorDevCls ) ) { + // device classes match a item in table, get the mapping: + majorProperty |= DeviceTypeMappingTable[i].majorProperty; + minorProperty |= DeviceTypeMappingTable[i].minorProperty; + break; + } + } + + // AV device mapping are not defined in the table, + // do mapping here if no device type has been mapped so far. + // This part is not reliably working with all AV devices. + if ( i == DeviceTypeMappingTableSize) { + // audio device, carkit, headset or speaker: + if( ( majorDevCls == EMajorDeviceAV) + || (majorServiceCls == EMajorServiceRendering + && majorDevCls != EMajorDeviceImaging) ) { + majorProperty |= BtuiDevProperty::AVDev; + if( minorDevCls == EMinorDeviceAVCarAudio ) { + // carkit: + minorProperty |= BtuiDevProperty::Carkit; + } + else { + // headset: + minorProperty |= BtuiDevProperty::Headset; + } + } + } +} +#endif // BTUIDEVTYPEMAP_H diff -r 91746b151f97 -r 997690c3397a bluetoothengine/btui/inc/btuiiconutil.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/bluetoothengine/btui/inc/btuiiconutil.h Wed Jun 23 18:23:52 2010 +0300 @@ -0,0 +1,152 @@ +/* + * 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 BTUIICONUTIL_H +#define BTUIICONUTIL_H + +#include +#include +#include +#include "btdevicemodel.h" +#include "btuidevtypemap.h" + +enum BtuiIconCorner { + BtuiNoCorners = 0x00, // No badge needed + BtuiBottomLeft = 0x01, // Badge for : Paired, Paired & Authorized, Blocked + BtuiBottomRight = 0x02, // Badge for : Connected + BtuiTopLeft = 0x04, // Badge for : Signal strength + BtuiTopRight = 0x08 // Badge for : Battery low +}; + +/*! + Creates a HbIcon according to the type of the CBTDevice dev, + Creates badges in the icon's 4 corners according to the parameters + passed to the function + bottom left corner: Paired, Paired & Authorized, Blocked + bottom right corner: Connected + top right corner: Battery low + top left corner: signal strength +*/ + +inline void setBadging(HbIcon &deviceIcon, int majorProperty, int corners) +{ + if (corners & BtuiBottomLeft) { + if (majorProperty & BtuiDevProperty::Trusted ) { + HbIcon badge("qtg_small_authorised"); + badge.setIconName("qtg_small_authorised"); + deviceIcon.addBadge(Qt::AlignLeft|Qt::AlignBottom, badge); + } + else if (majorProperty & BtuiDevProperty::Bonded) { + HbIcon badge("qtg_small_pair"); + badge.setIconName("qtg_small_pair"); + deviceIcon.addBadge(Qt::AlignLeft|Qt::AlignBottom, badge); + } + else if (majorProperty & BtuiDevProperty::Blocked) { + HbIcon badge("qtg_small_blocked"); + badge.setIconName("qtg_small_blocked"); + deviceIcon.addBadge(Qt::AlignLeft|Qt::AlignBottom, badge); + } + } + if (corners & BtuiBottomRight) { + if (majorProperty & BtuiDevProperty::Connected) { + HbIcon badge("qtg_small_connection"); + badge.setIconName("qtg_small_connection"); + deviceIcon.addBadge(Qt::AlignRight|Qt::AlignBottom, badge); + } + } + if (corners & BtuiTopRight) { + //ToDo: when power level added to model + } + if (corners & BtuiTopLeft) { + //ToDo: add signal strength. + } +} + + +/*! + * builds device icon based on device type, including badging with connection info, etc. + * + * \param cod the integer value of the CoD. + * \param majorProperty the major property consisting of BtuiDevProperty::DevMajorProperty bits + * \param corners specifies which corners of primary icon + * should be badged with connectivity, pairing, trust, etc information + * \return an HbIcon + * + */ +inline HbIcon getBadgedDeviceTypeIcon(int cod, int majorProperty = 0, int corners = BtuiNoCorners) +{ + int uiMajorDevice; + int uiMinorDevice; + // device type is mapped according to CoD: + BtuiDevProperty::mapDeiveType(uiMajorDevice, uiMinorDevice, cod); + + // Set icon according to the device category + QString name; + if (uiMajorDevice & BtuiDevProperty::Phone) { + name = QString("qtg_large_mobile"); + } + else if (uiMajorDevice & BtuiDevProperty::Computer) { + name = QString("qtg_large_computer"); + } + else if (uiMajorDevice & BtuiDevProperty::AVDev) { + name = QString("qtg_large_generic_audio"); + } + else if (uiMajorDevice & BtuiDevProperty::Peripheral) { + // todo: map to keyboard & mouse from uiMinorDevice + name = QString("qtg_large_input_device"); + } + else { + name = QString("qtg_large_generic_bluetooth"); + } + HbIcon icon(name); + if (corners > BtuiNoCorners) { + setBadging(icon, majorProperty, corners); + } + return icon; +} + +/* + * returns device type as a translated string based on + * Class of Device (CoD) parameter + */ +inline QString getDeviceTypeString( int cod ) +{ + int uiMajorDevice; + int uiMinorDevice; + // device type is mapped according to CoD: + BtuiDevProperty::mapDeiveType(uiMajorDevice, uiMinorDevice, cod); + + // Set icon according to the device category + if (uiMajorDevice & BtuiDevProperty::Phone) { + return hbTrId("txt_bt_list_phone"); + } + else if (uiMajorDevice & BtuiDevProperty::Computer) { + return hbTrId("txt_bt_list_computer"); + } + else if (uiMajorDevice & BtuiDevProperty::AVDev) { + return hbTrId("txt_bt_list_audio_device"); + } + else if (uiMajorDevice & BtuiDevProperty::Peripheral) { + // todo: map to keyboard & mouse + return hbTrId("txt_bt_list_input_device"); + } + else { + return hbTrId("txt_bt_list_other"); + } +} + +#endif // BTUIMODELUTIL_H diff -r 91746b151f97 -r 997690c3397a bluetoothengine/btui/inc/btuiutil.h --- a/bluetoothengine/btui/inc/btuiutil.h Fri Jun 11 13:48:51 2010 +0300 +++ b/bluetoothengine/btui/inc/btuiutil.h Wed Jun 23 18:23:52 2010 +0300 @@ -1,25 +1,19 @@ /* -* ============================================================================ -* Name : btuiutil.h -* Part of : BluetoothUI / bluetoothuimodel *** Info from the SWAD -* Description : utilities in the model for some often used functions, -* e.g. conversions between Qt and Symbian types. -* -* Copyright © 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: -* Nokia Corporation -* ============================================================================ -* Template version: 4.2 -*/ + * 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 BTUIUTIL_H #define BTUIUTIL_H diff -r 91746b151f97 -r 997690c3397a bluetoothengine/btui/inc/traceconfig.h --- a/bluetoothengine/btui/inc/traceconfig.h Fri Jun 11 13:48:51 2010 +0300 +++ b/bluetoothengine/btui/inc/traceconfig.h Wed Jun 23 18:23:52 2010 +0300 @@ -1,24 +1,19 @@ /* -* ============================================================================ -* Name : traceconfig_template.h -* Part of : BluetoothUI / bluetoothuimodel *** Info from the SWAD -* Description : Configuration of debug tracing in bluetoothuimodel -* -* Copyright © 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: -* Nokia Corporation -* ============================================================================ -* Template version: 4.2 -*/ + * 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 BLUETOOTHTRACECONFIG_H #define BLUETOOTHTRACECONFIG_H diff -r 91746b151f97 -r 997690c3397a bluetoothengine/btui/rom/btui_resources.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/bluetoothengine/btui/rom/btui_resources.iby Wed Jun 23 18:23:52 2010 +0300 @@ -0,0 +1,30 @@ +/* +* 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 __BTCPPLUGIN_RESOURCES_IBY__ +#define __BTCPPLUGIN_RESOURCES_IBY__ + +#include +#include +#ifdef __BT + +//For localization resource +data=DATAZ_/QT_TRANSLATIONS_DIR/btviews.qm QT_TRANSLATIONS_DIR/btviews.qm +data=DATAZ_/QT_TRANSLATIONS_DIR/btdialogs.qm QT_TRANSLATIONS_DIR/btdialogs.qm + +#endif //__BT +#endif // __BTCPPLUGIN_RESOURCES_IBY__ diff -r 91746b151f97 -r 997690c3397a btobexprofiles/obexreceiveservices/bip/group/obexservicebip.mmp --- a/btobexprofiles/obexreceiveservices/bip/group/obexservicebip.mmp Fri Jun 11 13:48:51 2010 +0300 +++ b/btobexprofiles/obexreceiveservices/bip/group/obexservicebip.mmp Wed Jun 23 18:23:52 2010 +0300 @@ -41,6 +41,9 @@ USERINCLUDE ../inc SYSTEMINCLUDE ../../../inc ../../../../inc MW_LAYER_SYSTEMINCLUDE +SYSTEMINCLUDE /epoc32/include/mw/hb/hbcore +SYSTEMINCLUDE /epoc32/include/mw/hb/hbwidgets +SYSTEMINCLUDE /epoc32/include/platform/mw/btservices LIBRARY euser.lib // Base library LIBRARY irobex.lib // For Object exchange @@ -62,7 +65,8 @@ LIBRARY btengdevman.lib //btengdevman.dll LIBRARY btengsettings.lib //btengsettings.dll LIBRARY btengconnman.lib //btengconnman.dll - +LIBRARY HbCore.lib +LIBRARY HbWidgets.lib DEBUGLIBRARY flogger.lib // For logging diff -r 91746b151f97 -r 997690c3397a btobexprofiles/obexreceiveservices/bip/inc/BIPController.h --- a/btobexprofiles/obexreceiveservices/bip/inc/BIPController.h Fri Jun 11 13:48:51 2010 +0300 +++ b/btobexprofiles/obexreceiveservices/bip/inc/BIPController.h Wed Jun 23 18:23:52 2010 +0300 @@ -24,22 +24,33 @@ #include #include #include -#include -#include #include "obexutilspropertynotifier.h" #include "debug.h" #include #include -#include #include #include "btengdevman.h" #include +#include +#include // FORWARD DECLARATIONS class CBIPCapabilityHandler; class CBIPImageHandler; +/** +* Backup status. +* The value is controlled by FileManager +*/ +enum TFileManagerBkupStatusType + { + EFileManagerBkupStatusUnset = 0x00000000, + EFileManagerBkupStatusBackup = 0x00000001, + EFileManagerBkupStatusRestore = 0x00000002 + }; + +const TUid KUidMsgTypeBt = {0x10009ED5}; // CLASS DECLARATION @@ -48,8 +59,9 @@ */ NONSHARABLE_CLASS (CBIPController): public CSrcsInterface, public MObexServerNotify, public MObexUtilsPropertyNotifyHandler, - public MGlobalProgressCallback, public MGlobalNoteCallback, - public MBTEngDevManObserver + public MObexUtilsDialogObserver, + public MBTEngDevManObserver, + public MHbDeviceDialogObserver { public: static CBIPController* NewL(); @@ -78,15 +90,13 @@ private: // from MObexUtilsPropertyNotifyHandler void HandleNotifyL(TMemoryPropertyCheckType aCheckType); -private: // from MGlobalProgressCallback - void HandleGlobalProgressDialogL(TInt aSoftkey); - -private: // from MGlobalNoteCallback - void HandleGlobalNoteDialogL(TInt aSoftkey); private: // from MBTEngDevManObserver void HandleGetDevicesComplete(TInt aErr, CBTDeviceArray* aDeviceArray); +private: //from MObexUtilsDialogObserver + void DialogDismissed(TInt aButtonId); + private: CBIPController(); void ConstructL(); @@ -101,10 +111,16 @@ TBool CheckCapacityL(); void LaunchReceivingIndicatorL(); - inline TBool ReceivingIndicatorActive() const { return (iProgressDialog || iWaitDialog); } - void UpdateReceivingIndicator(); + inline TBool ReceivingIndicatorActive() const { return (iDialogActive); } + void UpdateReceivingIndicatorL(); void CloseReceivingIndicator(TBool aResetDisplayedState = ETrue); TInt GetDriveWithMaximumFreeSpaceL(); + TBool IsBackupRunning(); + TBool ProcessExists( const TSecureId& aSecureId ); + +private: + void DataReceived(CHbSymbianVariantMap& aData); + void DeviceDialogClosed(TInt aCompletionCode); private: enum TBipTransferState @@ -117,6 +133,7 @@ ETransferPutCancel, }; + private: // Data CBIPCapabilityHandler* iBIPCapabilityHandler; CObexBufObject* iBTObject; @@ -138,14 +155,15 @@ CBufFlat *iBuf; TBool iLengthHeaderReceived; TInt iTotalSizeByte; - CGlobalProgressDialog* iProgressDialog; - CGlobalDialog* iWaitDialog; TBool iNoteDisplayed; CBTEngDevMan* iDevMan; CBTDeviceArray* iResultArray; TBTDeviceName iRemoteDeviceName; TFileName iReceivingFileName; TFileName iCenRepFolder; + CObexUtilsDialog* iDialog; + CHbDeviceDialogSymbian* iProgressDialog; + TBool iDialogActive; }; _LIT(KBipPanicCategory, "BIP"); diff -r 91746b151f97 -r 997690c3397a btobexprofiles/obexreceiveservices/bip/inc/BIPXMLWriter.h --- a/btobexprofiles/obexreceiveservices/bip/inc/BIPXMLWriter.h Fri Jun 11 13:48:51 2010 +0300 +++ b/btobexprofiles/obexreceiveservices/bip/inc/BIPXMLWriter.h Wed Jun 23 18:23:52 2010 +0300 @@ -22,7 +22,6 @@ //INCLUDES #include #include -#include #include "debug.h" // CONSTANTS diff -r 91746b151f97 -r 997690c3397a btobexprofiles/obexreceiveservices/bip/src/BIPController.cpp --- a/btobexprofiles/obexreceiveservices/bip/src/BIPController.cpp Fri Jun 11 13:48:51 2010 +0300 +++ b/btobexprofiles/obexreceiveservices/bip/src/BIPController.cpp Wed Jun 23 18:23:52 2010 +0300 @@ -17,35 +17,33 @@ // INCLUDE FILES -#include // AVKON components #include "BIPController.h" #include "BIPCapabilityHandler.h" #include "BIPImageHandler.h" #include -#include // Series 60 localisation stringloader #include -#include -#include -#include -#include #include #include #include -#include #include #include #include #include #include #include "debug.h" +#include +#include // CONSTANTS _LIT8(KBipCapabilityType, "x-bt/img-capabilities\0"); - +const TInt KFileManagerUID3 = 0x101F84EB; /// File Manager application UID3 +const TInt KBufferSize = 0x10000; // 64 kB +_LIT( KBTDevDialogId, "com.nokia.hb.btdevicedialog/1.0" ); +_LIT(KLocFileName, "btdialogs_"); +_LIT(KPath, "z:/resource/qt/translations/"); -const TInt KBufferSize = 0x10000; // 64 kB // ================= MEMBER FUNCTIONS ======================= @@ -80,6 +78,12 @@ iResultArray = new(ELeave) CBTDeviceArray(1); // Get default folder from CenRep TObexUtilsMessageHandler::GetCenRepKeyStringValueL(KCRUidBluetoothEngine, KLCReceiveFolder, iCenRepFolder); + iDialog = CObexUtilsDialog::NewL(this); + TBool ok = HbTextResolverSymbian::Init(KLocFileName, KPath); + if (!ok) + { + User::Leave( KErrNotFound ); + } TRACE_FUNC_EXIT } @@ -96,8 +100,6 @@ delete iLowMemoryActiveCDrive; delete iLowMemoryActiveMMC; delete iBuf; - delete iProgressDialog; - delete iWaitDialog; delete iBTObject; delete iDevMan; if (iResultArray) @@ -106,6 +108,8 @@ delete iResultArray; } iFs.Close(); + delete iDialog; + delete iProgressDialog; TRACE_FUNC_EXIT } @@ -143,8 +147,13 @@ iBTObject->Reset(); } CancelTransfer(); - TRAP_IGNORE(TObexUtilsUiLayer::ShowGlobalConfirmationQueryL( R_BT_FAILED_TO_RECEIVE)); - } + + TRAP_IGNORE( + HBufC* note = HbTextResolverSymbian::LoadLC(_L("txt_bt_dpophead_receiving_failed")); + iDialog->ShowErrorNoteL(note->Des()); + CleanupStack::PopAndDestroy(note); + ); + } delete iBuf; iBuf = NULL; @@ -197,10 +206,13 @@ // ObexConnectIndication() // --------------------------------------------------------- // -TInt CBIPController::ObexConnectIndication( const TObexConnectInfo& /*aRemoteInfo*/, const TDesC8& /*aInfo*/ ) +TInt CBIPController::ObexConnectIndication( const TObexConnectInfo& aRemoteInfo, const TDesC8& aInfo ) { TRACE_FUNC + (void) aRemoteInfo; + (void) aInfo; + // Get remote device socket address and bluetooth name // Remote bluetooth name will be displayed in the new message in inbox. // @@ -223,9 +235,10 @@ // ObexDisconnectIndication() // --------------------------------------------------------- // -void CBIPController::ObexDisconnectIndication(const TDesC8& /*aInfo*/) +void CBIPController::ObexDisconnectIndication(const TDesC8& aInfo) { TRACE_FUNC + (void) aInfo; } // --------------------------------------------------------- @@ -256,7 +269,7 @@ // Checking if backup is running now - if backup process is active, then we // need to cancel transfer - otherwise phone will freeze during receiving // data - if ( TObexUtilsUiLayer::IsBackupRunning() ) + if ( IsBackupRunning() ) { TRACE_INFO ( _L ("Backup in progress! Canceling incoming transfer.")); iBTTransferState = ETransferPutInitError; @@ -308,7 +321,11 @@ } if(!capacity) { - TRAP_IGNORE(TObexUtilsUiLayer::ShowGlobalConfirmationQueryL(R_OUT_OF_MEMORY)); + //TRAP_IGNORE(TObexUtilsUiLayer::ShowGlobalConfirmationQueryL(R_OUT_OF_MEMORY)); + //todo: Need to use Localized string. + _LIT(KText, "Not enough memory to execute operation. Delete some documents and try again."); + TRAP_IGNORE(iDialog->ShowErrorNoteL(KText)); + return KErrDiskFull; } } @@ -326,7 +343,11 @@ // Now we need to either create (in the first instance) or update the dialog on the UI. if(ReceivingIndicatorActive()) { - UpdateReceivingIndicator(); + TRAPD(err, UpdateReceivingIndicatorL()); + if(err < KErrNone) + { + return err; + } } else if(!iNoteDisplayed) { @@ -420,12 +441,15 @@ // SetPathIndication() // --------------------------------------------------------- // -TInt CBIPController::SetPathIndication( const CObex::TSetPathInfo& /*aPathInfo*/, - const TDesC8& /*aInfo*/) +TInt CBIPController::SetPathIndication( const CObex::TSetPathInfo& aPathInfo, + const TDesC8& aInfo) { TRACE_FUNC // SetPath is not implemented in BIP - so following IrOBEX guidance, return // the Forbidden response code. + (void) aPathInfo; + (void) aInfo; + return KErrIrObexRespForbidden; } @@ -504,7 +528,11 @@ // if (SysUtil::DiskSpaceBelowCriticalLevelL(&iFs, 0, iDrive)) { - TRAP_IGNORE(TObexUtilsUiLayer::ShowGlobalConfirmationQueryL(R_OUT_OF_MEMORY)); + //TRAP_IGNORE(TObexUtilsUiLayer::ShowGlobalConfirmationQueryL(R_OUT_OF_MEMORY)); + //todo: Need to use Localized string. + _LIT(KText, "Not enough memory to execute operation. Delete some documents and try again."); + TRAP_IGNORE(iDialog->ShowErrorNoteL(KText)); + User::Leave(KErrGeneral); } @@ -739,57 +767,83 @@ if(iTotalSizeByte > 0) { - iProgressDialog = CGlobalProgressDialog::NewL(this); if(iReceivingFileName.Length() > 0) { - iProgressDialog->ShowProgressDialogNameSizeL(iReceivingFileName, iTotalSizeByte); + iProgressDialog = CHbDeviceDialogSymbian::NewL(); + iProgressDialog->SetObserver(this); + + CHbSymbianVariantMap* variantMap = CHbSymbianVariantMap::NewL(); + CleanupStack::PushL(variantMap); + + TInt dialogIdx = TBluetoothDialogParams::EReceiveProgress; + CHbSymbianVariant* dialogType = CHbSymbianVariant::NewL( (TAny*) &(dialogIdx), + CHbSymbianVariant::EInt ); + CleanupStack::PushL(dialogType); + TBuf16<6> dialogTypeKey; + dialogTypeKey.Num(TBluetoothDialogParams::EDialogType); + User::LeaveIfError(variantMap->Add(dialogTypeKey, dialogType)); + CleanupStack::Pop(dialogType); + + CHbSymbianVariant* deviceName = CHbSymbianVariant::NewL( (TAny*) (&iRemoteDeviceName), + CHbSymbianVariant::EDes ); + CleanupStack::PushL(deviceName); + TBuf16<6> deviceNameKey; + deviceNameKey.Num(TBluetoothDeviceDialog::EDeviceName); + User::LeaveIfError(variantMap->Add(deviceNameKey, deviceName)); + CleanupStack::Pop(deviceName); + + CHbSymbianVariant* fileName = CHbSymbianVariant::NewL( (TAny*) (&iReceivingFileName), + CHbSymbianVariant::EDes ); + CleanupStack::PushL(fileName); + TBuf16<6> fileNameKey; + fileNameKey.Num(TBluetoothDeviceDialog::EReceivingFileName); + User::LeaveIfError(variantMap->Add(fileNameKey, fileName)); + CleanupStack::Pop(fileName); + + CHbSymbianVariant* fileSz = CHbSymbianVariant::NewL( (TAny*) &iTotalSizeByte, + CHbSymbianVariant::EInt ); + CleanupStack::PushL(fileSz); + TBuf16<6> fileSzKey; + fileSzKey.Num(TBluetoothDeviceDialog::EReceivingFileSize); + User::LeaveIfError(variantMap->Add(fileSzKey, fileSz)); + CleanupStack::Pop(fileSz); + + iDialogActive = ETrue; + iProgressDialog->Show( KBTDevDialogId(), *variantMap, this ); + CleanupStack::PopAndDestroy(variantMap); } else { - iProgressDialog->ShowProgressDialogL(R_BT_RECEIVING_DATA); + // TODO + iDialogActive = ETrue; } } else { - iWaitDialog = CGlobalDialog::NewL(this); - iWaitDialog->ShowNoteDialogL(R_BT_RECEIVING_DATA, ETrue); + iDialogActive = ETrue; + /* + * TODO - The functionality provided by CGlobalDialog will be removed + * TODO - and this will be provided by CGlobalProgressDialog. + */ + } } -void CBIPController::UpdateReceivingIndicator() +void CBIPController::UpdateReceivingIndicatorL() { if(iProgressDialog) { - iProgressDialog->UpdateProgressDialog(iBTObject->BytesReceived(), iTotalSizeByte); - } - // else we are using a wait note, so no "need" to update - } - -void CBIPController::HandleGlobalProgressDialogL( TInt aSoftkey ) - { - TRACE_FUNC - - if(aSoftkey == EAknSoftkeyCancel) - { - CancelTransfer(); - } - else if(aSoftkey == EAknSoftkeyHide) - { - CloseReceivingIndicator(EFalse); // Don't reset state as only hiding - } - } - -void CBIPController::HandleGlobalNoteDialogL( TInt aSoftkey ) - { - TRACE_FUNC - - if( aSoftkey == EAknSoftkeyCancel ) - { - CancelTransfer(); - } - else if( aSoftkey == EAknSoftkeyHide) - { - CloseReceivingIndicator(EFalse); // Don't reset state as only hiding + CHbSymbianVariantMap* variantMap = CHbSymbianVariantMap::NewL(); + CleanupStack::PushL(variantMap); + + TInt bytesReceived = iBTObject->BytesReceived(); + CHbSymbianVariant* progress = CHbSymbianVariant::NewL( (TAny*) &bytesReceived, CHbSymbianVariant::EInt ); + CleanupStack::PushL(progress); + User::LeaveIfError(variantMap->Add(_L("progress"), progress)); + CleanupStack::Pop(progress); + + iProgressDialog->Update(*variantMap); + CleanupStack::PopAndDestroy(variantMap); } } @@ -802,16 +856,11 @@ } if(iProgressDialog) { - iProgressDialog->ProcessFinished(); + iProgressDialog->Cancel(); + iDialogActive = EFalse; delete iProgressDialog; iProgressDialog = NULL; } - if(iWaitDialog) - { - iWaitDialog->ProcessFinished(); - delete iWaitDialog; - iWaitDialog = NULL; - } } // --------------------------------------------------------- @@ -869,8 +918,10 @@ // ---------------------------------------------------------- // // - void CBIPController::HandleGetDevicesComplete(TInt aErr, CBTDeviceArray* /*aDeviceArray*/) + void CBIPController::HandleGetDevicesComplete(TInt aErr, CBTDeviceArray* aDeviceArray) { + (void) aDeviceArray; + if ( aErr == KErrNone ) { if ( iResultArray->Count()) @@ -890,6 +941,78 @@ } } + TBool CBIPController::IsBackupRunning() + { + const TUint32 KFileManagerBkupStatus = 0x00000001; + + TInt status = EFileManagerBkupStatusUnset; + TBool retValue = EFalse; + TInt err = RProperty::Get( TUid::Uid(KFileManagerUID3), KFileManagerBkupStatus, + status ); + if ( err == KErrNone ) + { + if ( status == EFileManagerBkupStatusBackup || + status == EFileManagerBkupStatusRestore ) + { + TSecureId fileManagerSecureId( KFileManagerUID3 ); + //only returning ETrue if backup process is still active + retValue = ProcessExists( fileManagerSecureId ); + } + } + + return retValue; + } + + TBool CBIPController::ProcessExists( const TSecureId& aSecureId ) + { + _LIT( KFindPattern, "*" ); + TFindProcess finder(KFindPattern); + TFullName processName; + while( finder.Next( processName ) == KErrNone ) + { + RProcess process; + if ( process.Open( processName ) == KErrNone ) + { + TSecureId processId( process.SecureId() ); + process.Close(); + if( processId == aSecureId ) + { + return ETrue; + } + } + } + return EFalse; + } + + void CBIPController::DialogDismissed(TInt aButtonId) + { + (void) aButtonId; + } + + void CBIPController::DataReceived(CHbSymbianVariantMap& aData) + { + if(aData.Keys().MdcaPoint(0).Compare(_L("actionResult")) == 0) + { + TInt val = *(static_cast(aData.Get(_L("actionResult"))->Data())); + if(!val) + { + //Cancel has been clicked + CancelTransfer(); + } + else + { + //Hide has been clicked + CloseReceivingIndicator(EFalse); + } + } + } + + void CBIPController::DeviceDialogClosed(TInt aCompletionCode) + { + (void) aCompletionCode; + } + + //////////////////////////// Global part //////////////////////////// // End of File diff -r 91746b151f97 -r 997690c3397a btobexprofiles/obexreceiveservices/mtmuibluetooth/data/btmtmui.rss --- a/btobexprofiles/obexreceiveservices/mtmuibluetooth/data/btmtmui.rss Fri Jun 11 13:48:51 2010 +0300 +++ b/btobexprofiles/obexreceiveservices/mtmuibluetooth/data/btmtmui.rss Wed Jun 23 18:23:52 2010 +0300 @@ -20,7 +20,6 @@ // INCLUDES #include -#include // RESOURCE DEFINITIONS // --------------------------------------------------------- @@ -43,7 +42,8 @@ { MTM_COMPONENT_V2 { - human_readable_name = qtn_query_send_via_bt; + //todo: Need to use localized string. + human_readable_name = "Via Bluetooth"; component_uid = KUidMtmServerComponentVal; entry_point = 1; version = VERSION_V2 {}; @@ -51,7 +51,8 @@ }, MTM_COMPONENT_V2 { - human_readable_name = qtn_query_send_via_bt; + //todo: Need to use localized string. + human_readable_name = "Via Bluetooth"; component_uid = KUidMtmClientComponentVal; entry_point = 1; version = VERSION_V2 {}; @@ -59,7 +60,8 @@ }, MTM_COMPONENT_V2 { - human_readable_name = qtn_query_send_via_bt; + //todo: Need to use localized string. + human_readable_name = "Via Bluetooth"; component_uid = KUidMtmUiComponentVal; entry_point = 2; version = VERSION_V2 {}; @@ -67,7 +69,8 @@ }, MTM_COMPONENT_V2 { - human_readable_name = qtn_query_send_via_bt; + //todo: Need to use localized string. + human_readable_name = "Via Bluetooth"; component_uid = KUidMtmUiDataComponentVal; entry_point = 1; version = VERSION_V2 {}; diff -r 91746b151f97 -r 997690c3397a btobexprofiles/obexreceiveservices/mtmuibluetooth/group/btmtmui.mmp --- a/btobexprofiles/obexreceiveservices/mtmuibluetooth/group/btmtmui.mmp Fri Jun 11 13:48:51 2010 +0300 +++ b/btobexprofiles/obexreceiveservices/mtmuibluetooth/group/btmtmui.mmp Wed Jun 23 18:23:52 2010 +0300 @@ -38,6 +38,9 @@ SOURCEPATH ../src USERINCLUDE ../inc SYSTEMINCLUDE ../../../inc ../../../../inc +SYSTEMINCLUDE /epoc32/include/mw/hb/hbwidgets +SYSTEMINCLUDE /epoc32/include/mw/hb/hbcore + #ifdef NO101APPDEPFIXES APP_LAYER_SYSTEMINCLUDE #else //NO101APPDEPFIXES diff -r 91746b151f97 -r 997690c3397a btobexprofiles/obexreceiveservices/mtmuibluetooth/inc/btmtmui.h --- a/btobexprofiles/obexreceiveservices/mtmuibluetooth/inc/btmtmui.h Fri Jun 11 13:48:51 2010 +0300 +++ b/btobexprofiles/obexreceiveservices/mtmuibluetooth/inc/btmtmui.h Wed Jun 23 18:23:52 2010 +0300 @@ -25,8 +25,7 @@ #include #include #include - -#include +#include const TUint KBTSdpObjectPush = 0x1105; @@ -37,7 +36,8 @@ * CBtMtmUi * Bluetooth messaging UI Module. */ -class CBtMtmUi : public CBaseMtmUi, public MBTEngSdpResultReceiver +class CBtMtmUi : public CBaseMtmUi, public MBTEngSdpResultReceiver, + public MObexUtilsDialogObserver { public: // Constructors and destructor /** @@ -381,6 +381,11 @@ * was called; otherwise one of the system-wide error codes. */ void DeviceSearchComplete( CBTDevice* aDevice, TInt aErr ); + + /** + * Callback function from base class MObexUtilsDialogObserver. + */ + void DialogDismissed(TInt aButtonId); protected: @@ -440,7 +445,7 @@ CActiveSchedulerWait iWaiter; TInt iClientChannel; TInt iState; - + CObexUtilsDialog* iDialog; }; #endif // CBTMTMUI_H diff -r 91746b151f97 -r 997690c3397a btobexprofiles/obexreceiveservices/mtmuibluetooth/inc/btmtmuidata.h --- a/btobexprofiles/obexreceiveservices/mtmuibluetooth/inc/btmtmuidata.h Fri Jun 11 13:48:51 2010 +0300 +++ b/btobexprofiles/obexreceiveservices/mtmuibluetooth/inc/btmtmuidata.h Wed Jun 23 18:23:52 2010 +0300 @@ -23,7 +23,6 @@ // INCLUDES #include -#include // FORWARD DECLARATIONS diff -r 91746b151f97 -r 997690c3397a btobexprofiles/obexreceiveservices/mtmuibluetooth/src/btmtmui.cpp --- a/btobexprofiles/obexreceiveservices/mtmuibluetooth/src/btmtmui.cpp Fri Jun 11 13:48:51 2010 +0300 +++ b/btobexprofiles/obexreceiveservices/mtmuibluetooth/src/btmtmui.cpp Wed Jun 23 18:23:52 2010 +0300 @@ -32,8 +32,6 @@ #include #include -#include -#include #include #include #include @@ -81,6 +79,7 @@ { FLOG( _L( "[CBtMtmUi] CBtMtmUi: ~CBtMtmUi\t" ) ); delete iClientRegistry; + delete iDialog; } // Symbian OS default constructor can leave. @@ -88,6 +87,7 @@ { FLOG( _L( "[CBtMtmUi] CBtMtmUi: ConstructL\t" ) ); CBaseMtmUi::ConstructL(); + iDialog = CObexUtilsDialog::NewL(this); } // --------------------------------------------------------- @@ -98,9 +98,8 @@ void CBtMtmUi::GetResourceFileName( TFileName& aFileName ) const { FLOG( _L( "[CBtMtmUi] CBtMtmUi: GetResourceFileName\t" ) ); - aFileName = KObexUtilsFileDrive; - aFileName += KDC_RESOURCE_FILES_DIR; - aFileName += KObexUtilsResourceFileName; + (void)aFileName; + //todo: This function should be removed it is using avkon resource file. } // --------------------------------------------------------- @@ -278,8 +277,11 @@ } if ( retVal != KErrNone ||iState != KErrNone ) { - resourceId = R_BT_DEV_NOT_AVAIL; - TObexUtilsUiLayer::ShowInformationNoteL( resourceId ); + //resourceId = R_BT_DEV_NOT_AVAIL; + //TObexUtilsUiLayer::ShowInformationNoteL( resourceId ); + //todo: Need to use Localized string. + _LIT(KText, "Cannot establish Bluetooth connection"); + iDialog->ShowInformationNoteL(KText); CleanupStack::PopAndDestroy(3); // BtDevice, BtConnection, password return CMsvCompletedOperation::NewL( Session(), @@ -515,8 +517,12 @@ const TInt error = progress.iError; if ( error == KErrInUse ) { - resourceId = R_BT_DEV_NOT_AVAIL; - TObexUtilsUiLayer::ShowInformationNoteL( resourceId ); + //resourceId = R_BT_DEV_NOT_AVAIL; + //TObexUtilsUiLayer::ShowInformationNoteL( resourceId ); + //todo: Need to use Localized string. + _LIT(KText, "Cannot establish Bluetooth connection"); + iDialog->ShowInformationNoteL(KText); + return KErrNone; } @@ -526,8 +532,12 @@ { FLOG( _L( "[CBtMtmUi] CBtMtmUi:DisplayProgressSummaryL: EDisconnected\t" ) ); // Allowed to send again. - resourceId = R_BT_DATA_SENT; - TObexUtilsUiLayer::ShowInformationNoteL( resourceId ); + //resourceId = R_BT_DATA_SENT; + //TObexUtilsUiLayer::ShowInformationNoteL( resourceId ); + //todo: Need to use Localized string. + _LIT(KText, "Message sent!"); + iDialog->ShowInformationNoteL(KText); + break; } case TObexMtmProgress::ESendError: @@ -535,13 +545,21 @@ FLOG( _L( "[CBtMtmUi] CBtMtmUi:DisplayProgressSummaryL: ESendError\t" ) ); if( error == KErrIrObexClientNoDevicesFound ) { - resourceId = R_BT_DEV_NOT_AVAIL; - TObexUtilsUiLayer::ShowInformationNoteL( resourceId ); + //resourceId = R_BT_DEV_NOT_AVAIL; + //TObexUtilsUiLayer::ShowInformationNoteL( resourceId ); + //todo: Need to use Localized string. + _LIT(KText, "Cannot establish Bluetooth connection"); + iDialog->ShowInformationNoteL(KText); + } else { - resourceId = R_BT_FAILED_TO_SEND; - TObexUtilsUiLayer::ShowErrorNoteL( resourceId ); + //resourceId = R_BT_FAILED_TO_SEND; + //TObexUtilsUiLayer::ShowErrorNoteL( resourceId ); + //todo: Need to use Localized string. + _LIT(KText, "Failed to send message"); + iDialog->ShowErrorNoteL(KText); + } break; } @@ -666,9 +684,13 @@ CMsvSession& aSession) { FLOG( _L( "[CommonMtmUi] CBtMtmUi: LaunchEditorApplicationL\t" ) ); - CMsvEntry* message; - message = &iBaseMtm.Entry(); - return TObexUtilsUiLayer::LaunchEditorApplicationOperationL( aSession, message, aStatus ); + (void)aStatus; + (void)aSession; + //CMsvEntry* message; + //message = &iBaseMtm.Entry(); + //todo: need to replace this + //return TObexUtilsUiLayer::LaunchEditorApplicationOperationL( aSession, message, aStatus ); + return NULL; } // --------------------------------------------------------- @@ -805,4 +827,9 @@ iWaiter.AsyncStop(); } +void CBtMtmUi::DialogDismissed(TInt /*aButtonId*/) + { + + } + // End of File diff -r 91746b151f97 -r 997690c3397a btobexprofiles/obexreceiveservices/mtmuibluetooth/src/btmtmuidata.cpp --- a/btobexprofiles/obexreceiveservices/mtmuibluetooth/src/btmtmuidata.cpp Fri Jun 11 13:48:51 2010 +0300 +++ b/btobexprofiles/obexreceiveservices/mtmuibluetooth/src/btmtmuidata.cpp Wed Jun 23 18:23:52 2010 +0300 @@ -27,11 +27,11 @@ #include //kuidmtmquerymaxbodysizevalue etc #endif #include -#include #include -const TInt KBtMtmUiNfcContext = 2; +// todo @ QT migration: take official definition from Messaging at app layer (btmsgtypeuid.h) +const TUid KUidMsgTypeBt = {0x10009ED5}; // ================= MEMBER FUNCTIONS ======================= @@ -78,8 +78,10 @@ TInt CBtMtmUiData::OperationSupportedL( TInt /*aOperationId*/, const TMsvEntry& /*aContext*/) const { - FLOG( _L( " CBtMtmUiData: OperationSupportedL\t" ) ); - return TObexUtilsUiLayer::OperationNotSupported(); + FLOG( _L( " CBtMtmUiData: OperationSupportedL\t" ) ); + + //todo: This was returning avkon resource Id of sting "This item is not available". + return 0; } // --------------------------------------------------------- @@ -128,21 +130,13 @@ // Handles received msg icon. // --------------------------------------------------------- // -const CBaseMtmUiData::CBitmapArray& CBtMtmUiData::ContextIcon( const TMsvEntry& aContext, +const CBaseMtmUiData::CBitmapArray& CBtMtmUiData::ContextIcon( const TMsvEntry& /*aContext*/, TInt /*aStateFlags*/) const { // Check if NFC context TInt icon = 0; - if ( aContext.MtmData1() == KBtMtmUiNfcContext ) - { - icon = TObexUtilsUiLayer::ContextIcon( aContext, ENfc ); - } - else - { - icon = TObexUtilsUiLayer::ContextIcon( aContext, EBluetooth ); - } - - return *iIconArrays->At( icon/2 ); + //todo: This function will not work as iIconArrays is not populated might cause panic. + return *iIconArrays->At(icon); } // --------------------------------------------------------- @@ -153,7 +147,7 @@ void CBtMtmUiData::PopulateArraysL() { FLOG( _L( " CBtMtmUiData: PopulateArraysL\t" ) ); - TObexUtilsUiLayer::CreateIconsL( KUidMsgTypeBt, iIconArrays ); + //todo: Was populating iIconArrays which should be removed. } // --------------------------------------------------------- @@ -161,12 +155,10 @@ // Gives resource filename. // --------------------------------------------------------- // -void CBtMtmUiData::GetResourceFileName( TFileName& aFileName ) const +void CBtMtmUiData::GetResourceFileName( TFileName& /*aFileName*/ ) const { FLOG( _L( " CBtMtmUiData: GetResourceFileName\t" ) ); - aFileName = KObexUtilsFileDrive; - aFileName += KDC_RESOURCE_FILES_DIR; - aFileName += KObexUtilsResourceFileName; + //todo: This was returning avkon resource file, which is not required now. } // --------------------------------------------------------- @@ -186,7 +178,8 @@ return ( aParent.iMtm.iUid == KMsvLocalServiceIndexEntryIdValue ); } // --- Can't create other types --- - aReasonResourceId = TObexUtilsUiLayer::OperationNotSupported(); + //todo: This was using avkon resource Id of sting "This item is not available". + aReasonResourceId = 0; return EFalse; } @@ -207,7 +200,8 @@ return ETrue; } } - aReasonResourceId = TObexUtilsUiLayer::OperationNotSupported(); + //todo: This was using avkon resource Id of sting "This item is not available". + aReasonResourceId = 0; return EFalse; } @@ -228,7 +222,8 @@ return ETrue; } } - aReasonResourceId = TObexUtilsUiLayer::OperationNotSupported(); + //todo: This was using avkon resource Id of sting "This item is not available". + aReasonResourceId = 0; return EFalse; } @@ -248,8 +243,9 @@ aReasonResourceId = 0; return ETrue; } - } - aReasonResourceId = TObexUtilsUiLayer::OperationNotSupported(); + } + //todo: This was using avkon resource Id of sting "This item is not available". + aReasonResourceId = 0; return EFalse; } @@ -262,7 +258,8 @@ TInt& aReasonResourceId ) const { FLOG( _L( " CBtMtmUiData: CanEditEntryL\t" ) ); - aReasonResourceId = TObexUtilsUiLayer::OperationNotSupported(); + //todo: This was using avkon resource Id of sting "This item is not available". + aReasonResourceId = 0; if( CheckEntry( aContext ) ) { if ( ( aContext.iType.iUid == KUidMsvMessageEntryValue ) || @@ -283,8 +280,9 @@ TBool CBtMtmUiData::CanDeleteServiceL( const TMsvEntry& /*aService*/, TInt& aReasonResourceId ) const { - FLOG( _L( " CBtMtmUiData: CanDeleteServiceL\t" ) ); - aReasonResourceId = TObexUtilsUiLayer::OperationNotSupported(); + FLOG( _L( " CBtMtmUiData: CanDeleteServiceL\t" ) ); + //todo: This was using avkon resource Id of sting "This item is not available". + aReasonResourceId = 0; return EFalse; } @@ -296,7 +294,8 @@ TBool CBtMtmUiData::CanDeleteFromEntryL( const TMsvEntry& /*aContext*/, TInt& aReasonResourceId ) const { - aReasonResourceId = TObexUtilsUiLayer::OperationNotSupported(); + //todo: This was using avkon resource Id of sting "This item is not available". + aReasonResourceId = 0; return EFalse; } @@ -308,7 +307,8 @@ TBool CBtMtmUiData::CanCopyMoveToEntryL( const TMsvEntry& /*aContext*/, TInt& aReasonResourceId ) const { - aReasonResourceId = TObexUtilsUiLayer::OperationNotSupported(); + //todo: This was using avkon resource Id of sting "This item is not available". + aReasonResourceId = 0; return EFalse; } @@ -320,7 +320,8 @@ TBool CBtMtmUiData::CanCopyMoveFromEntryL( const TMsvEntry& /*aContext*/, TInt& aReasonResourceId ) const { - aReasonResourceId = TObexUtilsUiLayer::OperationNotSupported(); + //todo: This was using avkon resource Id of sting "This item is not available". + aReasonResourceId = 0; return EFalse; } @@ -332,7 +333,8 @@ TBool CBtMtmUiData::CanReplyToEntryL( const TMsvEntry& /*aContext*/, TInt& aReasonResourceId ) const { - aReasonResourceId = TObexUtilsUiLayer::OperationNotSupported(); + //todo: This was using avkon resource Id of sting "This item is not available". + aReasonResourceId = 0; return EFalse; // Not Ok to do } @@ -344,7 +346,8 @@ TBool CBtMtmUiData::CanForwardEntryL( const TMsvEntry& /*aContext*/, TInt& aReasonResourceId ) const { - aReasonResourceId = TObexUtilsUiLayer::OperationNotSupported(); + //todo: This was using avkon resource Id of sting "This item is not available". + aReasonResourceId = 0; return EFalse; // Not Ok to do } @@ -368,7 +371,8 @@ TInt& aReasonResourceId ) const { // No way of sending a message from the outbox, so no need to cancel. - aReasonResourceId = TObexUtilsUiLayer::OperationNotSupported(); + //todo: This was using avkon resource Id of sting "This item is not available". + aReasonResourceId = 0; return EFalse; } @@ -381,8 +385,9 @@ { FLOG( _L( " CBtMtmUiData: StatusTextL\t" ) ); TBuf<80> buffer; - TInt resourceId = R_BT_SEND_PROGRESS_SENDING; - TObexUtilsUiLayer::ReadResourceL( buffer, resourceId ); + //todo: Need to use localised string. + _LIT(KText, "Sending"); + buffer.Copy(KText); return buffer.AllocL(); } diff -r 91746b151f97 -r 997690c3397a btobexprofiles/obexreceiveservices/mtmuiinfrared/data/irmtmui.rss --- a/btobexprofiles/obexreceiveservices/mtmuiinfrared/data/irmtmui.rss Fri Jun 11 13:48:51 2010 +0300 +++ b/btobexprofiles/obexreceiveservices/mtmuiinfrared/data/irmtmui.rss Wed Jun 23 18:23:52 2010 +0300 @@ -20,8 +20,6 @@ // INCLUDES #include -#include - #include @@ -34,7 +32,8 @@ { MTM_COMPONENT_V2 { - human_readable_name = qtn_query_send_via_ir; + //todo: Need to use localized string. + human_readable_name = "Via Infrared "; component_uid = KUidMtmServerComponentVal; entry_point = 1; version = VERSION_V2 {}; @@ -42,7 +41,8 @@ }, MTM_COMPONENT_V2 { - human_readable_name = qtn_query_send_via_ir; + //todo: Need to use localized string. + human_readable_name = "Via Infrared "; component_uid = KUidMtmClientComponentVal; entry_point = 1; version = VERSION_V2 {}; @@ -50,7 +50,8 @@ }, MTM_COMPONENT_V2 { - human_readable_name = qtn_query_send_via_ir; + //todo: Need to use localized string. + human_readable_name = "Via Infrared "; component_uid = KUidMtmUiComponentVal; entry_point = 2; version = VERSION_V2 {}; @@ -58,7 +59,8 @@ }, MTM_COMPONENT_V2 { - human_readable_name = qtn_query_send_via_ir; + //todo: Need to use localized string. + human_readable_name = "Via Infrared "; component_uid = KUidMtmUiDataComponentVal; entry_point = 1; version = VERSION_V2 {}; diff -r 91746b151f97 -r 997690c3397a btobexprofiles/obexreceiveservices/mtmuiinfrared/inc/irmtmui.h --- a/btobexprofiles/obexreceiveservices/mtmuiinfrared/inc/irmtmui.h Fri Jun 11 13:48:51 2010 +0300 +++ b/btobexprofiles/obexreceiveservices/mtmuiinfrared/inc/irmtmui.h Wed Jun 23 18:23:52 2010 +0300 @@ -23,7 +23,6 @@ // INCLUDES #include -#include // CLASS DECLARATION // FORWARD DECLARATIONS diff -r 91746b151f97 -r 997690c3397a btobexprofiles/obexreceiveservices/mtmuiinfrared/inc/irmtmuidata.h --- a/btobexprofiles/obexreceiveservices/mtmuiinfrared/inc/irmtmuidata.h Fri Jun 11 13:48:51 2010 +0300 +++ b/btobexprofiles/obexreceiveservices/mtmuiinfrared/inc/irmtmuidata.h Wed Jun 23 18:23:52 2010 +0300 @@ -23,7 +23,6 @@ // INCLUDES #include -#include // FORWARD DECLARATIONS diff -r 91746b151f97 -r 997690c3397a btobexprofiles/obexreceiveservices/mtmuiinfrared/src/irmtmui.cpp --- a/btobexprofiles/obexreceiveservices/mtmuiinfrared/src/irmtmui.cpp Fri Jun 11 13:48:51 2010 +0300 +++ b/btobexprofiles/obexreceiveservices/mtmuiinfrared/src/irmtmui.cpp Wed Jun 23 18:23:52 2010 +0300 @@ -28,15 +28,12 @@ #include #include -#include -#include #include #include #include #include // Notifier UID's -#include //For notifier #include -#include +#include // ================= MEMBER FUNCTIONS ======================= @@ -72,8 +69,12 @@ { // --- Make sure base class correctly constructed --- CBaseMtmUi::ConstructL(); - TObexUtilsUiLayer::ReadResourceL( iConnectingText, R_IR_CONNECTING ); - TObexUtilsUiLayer::ReadResourceL( iSendingText, R_IR_SENDING_DATA ); + //todo: Need to use localised string. + _LIT(KConnectText, "Connecting via Infrared.."); + _LIT(KSendText, "Sending message via Infrared..."); + iConnectingText.Copy(KConnectText); + iSendingText.Copy(KSendText); + iCurrentlySending = EFalse; } @@ -82,12 +83,11 @@ // return progress status. // --------------------------------------------------------- // -void CIrMtmUi::GetResourceFileName( TFileName& aFileName ) const +void CIrMtmUi::GetResourceFileName( TFileName& /*aFileName*/ ) const { FLOG( _L( "[CIrMtmUi] CIrMtmUi: GetResourceFileName\t" ) ); - aFileName = KObexUtilsFileDrive; - aFileName += KDC_RESOURCE_FILES_DIR; - aFileName += KObexUtilsResourceFileName; + //todo: This function should be removed it is using avkon resource file. + } // --------------------------------------------------------- @@ -601,13 +601,14 @@ // recognition(document handler). // --------------------------------------------------------- // -CMsvOperation* CIrMtmUi::LaunchEditorApplicationL( TRequestStatus& aStatus, - CMsvSession& aSession) +CMsvOperation* CIrMtmUi::LaunchEditorApplicationL( TRequestStatus& /*aStatus*/, + CMsvSession& /*aSession*/) { FLOG( _L( "[CIrMtmUi] CIrMtmUi: LaunchEditorApplicationL\t" ) ); - CMsvEntry* message; - message = &iBaseMtm.Entry(); - return TObexUtilsUiLayer::LaunchEditorApplicationOperationL( aSession, message, aStatus ); + //CMsvEntry* message; + //message = &iBaseMtm.Entry(); + //todo: Need to use proper API for launching editor application, now returning NULL. + return NULL; } diff -r 91746b151f97 -r 997690c3397a btobexprofiles/obexreceiveservices/mtmuiinfrared/src/irmtmuidata.cpp --- a/btobexprofiles/obexreceiveservices/mtmuiinfrared/src/irmtmuidata.cpp Fri Jun 11 13:48:51 2010 +0300 +++ b/btobexprofiles/obexreceiveservices/mtmuiinfrared/src/irmtmuidata.cpp Wed Jun 23 18:23:52 2010 +0300 @@ -29,7 +29,6 @@ #include //kuidmtmquerymaxbodysizevalue etc #include //kuidmtmquerymaxbodysizevalue etc #endif -#include #include #include "debug.h" @@ -84,7 +83,8 @@ const TMsvEntry& /*aContext*/) const { FLOG( _L( "[CIrMtmUiData] CIrMtmUiData: OperationSupportedL\t" ) ); - return TObexUtilsUiLayer::OperationNotSupported(); + //todo: This was returning avkon resource Id of sting "This item is not available". + return 0; } // --------------------------------------------------------- @@ -147,12 +147,13 @@ // --------------------------------------------------------- // const CBaseMtmUiData::CBitmapArray& CIrMtmUiData::ContextIcon( - const TMsvEntry& aContext, + const TMsvEntry& /*aContext*/, TInt /*aStateFlags*/) const { - TInt icon = TObexUtilsUiLayer::ContextIcon( aContext, EInfrared ); - return *iIconArrays->At( icon/2 ); + TInt icon = 0; + //todo: This function will not work as iIconArrays is not populated might cause panic. + return *iIconArrays->At( icon ); } // --------------------------------------------------------- @@ -164,7 +165,7 @@ { FLOG( _L( "[CIrMtmUiData] CIrMtmUiData: PopulateArraysL\t" ) ); - TObexUtilsUiLayer::CreateIconsL( KUidMsgTypeIrUID, iIconArrays ); + //todo: Was populating iIconArrays which should be removed. } // --------------------------------------------------------- @@ -172,12 +173,10 @@ // Gives resource filename. // --------------------------------------------------------- // -void CIrMtmUiData::GetResourceFileName(TFileName& aFileName) const +void CIrMtmUiData::GetResourceFileName(TFileName& /*aFileName*/) const { FLOG( _L( "[CIrMtmUiData] CIrMtmUiData: GetResourceFileName\t" ) ); - aFileName = KObexUtilsFileDrive; - aFileName += KDC_RESOURCE_FILES_DIR; - aFileName += KObexUtilsResourceFileName; + //todo: This was returning avkon resource file, which is not required now. } // --------------------------------------------------------- @@ -198,7 +197,8 @@ return ( aParent.iMtm.iUid == KMsvLocalServiceIndexEntryIdValue ); } // --- Can't create other types --- - aReasonResourceId = TObexUtilsUiLayer::OperationNotSupported(); + //todo: This was using avkon resource Id of sting "This item is not available". + aReasonResourceId = 0; return EFalse; } @@ -220,7 +220,8 @@ return ETrue; } } - aReasonResourceId = TObexUtilsUiLayer::OperationNotSupported(); + //todo: This was using avkon resource Id of sting "This item is not available". + aReasonResourceId = 0; return EFalse; } @@ -242,7 +243,8 @@ return ETrue; } } - aReasonResourceId = TObexUtilsUiLayer::OperationNotSupported(); + //todo: This was using avkon resource Id of sting "This item is not available". + aReasonResourceId = 0; return EFalse; } @@ -264,7 +266,8 @@ return ETrue; } } - aReasonResourceId = TObexUtilsUiLayer::OperationNotSupported(); + //todo: This was using avkon resource Id of sting "This item is not available". + aReasonResourceId = 0; return EFalse; } @@ -278,7 +281,8 @@ TInt& aReasonResourceId ) const { FLOG( _L( "[CIrMtmUiData] CIrMtmUiData: CanEditEntryL\t" ) ); - aReasonResourceId = TObexUtilsUiLayer::OperationNotSupported(); + //todo: This was using avkon resource Id of sting "This item is not available". + aReasonResourceId = 0; if( CheckEntry( aContext ) ) { if ( ( aContext.iType.iUid == KUidMsvMessageEntryValue ) || @@ -301,7 +305,8 @@ TInt& aReasonResourceId ) const { FLOG( _L( "[CIrMtmUiData] CIrMtmUiData: CanDeleteServiceL\t" ) ); - aReasonResourceId = TObexUtilsUiLayer::OperationNotSupported(); + //todo: This was using avkon resource Id of sting "This item is not available". + aReasonResourceId = 0; return EFalse; } @@ -314,7 +319,8 @@ const TMsvEntry& /*aContext*/, TInt& aReasonResourceId ) const { - aReasonResourceId = TObexUtilsUiLayer::OperationNotSupported(); + //todo: This was using avkon resource Id of sting "This item is not available". + aReasonResourceId = 0; return EFalse; } @@ -327,7 +333,8 @@ const TMsvEntry& /*aContext*/, TInt& aReasonResourceId ) const { - aReasonResourceId = TObexUtilsUiLayer::OperationNotSupported(); + //todo: This was using avkon resource Id of sting "This item is not available". + aReasonResourceId = 0; return EFalse; } @@ -340,7 +347,8 @@ const TMsvEntry& /*aContext*/, TInt& aReasonResourceId ) const { - aReasonResourceId = TObexUtilsUiLayer::OperationNotSupported(); + //todo: This was using avkon resource Id of sting "This item is not available". + aReasonResourceId = 0; return EFalse; } @@ -353,7 +361,8 @@ const TMsvEntry& /*aContext*/, TInt& aReasonResourceId ) const { - aReasonResourceId = TObexUtilsUiLayer::OperationNotSupported(); + //todo: This was using avkon resource Id of sting "This item is not available". + aReasonResourceId = 0; return EFalse; // Not Ok to do } @@ -366,7 +375,8 @@ const TMsvEntry& /*aContext*/, TInt& aReasonResourceId ) const { - aReasonResourceId = TObexUtilsUiLayer::OperationNotSupported(); + //todo: This was using avkon resource Id of sting "This item is not available". + aReasonResourceId = 0; return EFalse; // Not Ok to do } @@ -391,7 +401,8 @@ const TMsvEntry& /*aContext*/, TInt& aReasonResourceId ) const { // No way of sending a message from the outbox, so no need to cancel. - aReasonResourceId = TObexUtilsUiLayer::OperationNotSupported(); + //todo: This was using avkon resource Id of sting "This item is not available". + aReasonResourceId = 0; return EFalse; } @@ -404,8 +415,9 @@ { FLOG( _L( "[CIrMtmUiData] CIrMtmUiData: StatusTextL\t" ) ); TBuf<80> buffer; - TInt resourceId = R_IR_SEND_PROGRESS_SENDING; - TObexUtilsUiLayer::ReadResourceL( buffer, resourceId ); + //todo: Need to use localised string. + _LIT(KText, "Sending"); + buffer.Copy(KText); HBufC* ptr; ptr = buffer.AllocL(); return ptr; diff -r 91746b151f97 -r 997690c3397a btobexprofiles/obexreceiveservices/opp/group/obexserviceopp.mmp --- a/btobexprofiles/obexreceiveservices/opp/group/obexserviceopp.mmp Fri Jun 11 13:48:51 2010 +0300 +++ b/btobexprofiles/obexreceiveservices/opp/group/obexserviceopp.mmp Wed Jun 23 18:23:52 2010 +0300 @@ -38,19 +38,21 @@ USERINCLUDE ../inc SYSTEMINCLUDE ../../../inc ../../../../inc /epoc32/include/ecom MW_LAYER_SYSTEMINCLUDE +SYSTEMINCLUDE /epoc32/include/mw/hb/hbcore +SYSTEMINCLUDE /epoc32/include/mw/hb/hbwidgets +SYSTEMINCLUDE /epoc32/include/platform/mw/btservices LIBRARY obexutils.lib LIBRARY euser.lib LIBRARY efsrv.lib LIBRARY servicehandler.lib -LIBRARY avkon.lib LIBRARY irobex.lib // For Object exchange LIBRARY imageconversion.lib LIBRARY bafl.lib LIBRARY ecom.lib LIBRARY sysutil.lib LIBRARY esock.lib -LIBRARY charconv.lib aknnotify.lib eiksrv.lib +LIBRARY charconv.lib LIBRARY platformenv.lib LIBRARY bluetooth.lib // Bluetooth libraries LIBRARY btdevice.lib // Bluetooth library @@ -60,5 +62,7 @@ LIBRARY btengdevman.lib //btengdevman.dll LIBRARY btengsettings.lib //btengsettings.dll LIBRARY btengconnman.lib //btengconnman.dll +LIBRARY HbCore.lib +LIBRARY HbWidgets.lib DEBUGLIBRARY flogger.lib diff -r 91746b151f97 -r 997690c3397a btobexprofiles/obexreceiveservices/opp/inc/oppcontroller.h --- a/btobexprofiles/obexreceiveservices/opp/inc/oppcontroller.h Fri Jun 11 13:48:51 2010 +0300 +++ b/btobexprofiles/obexreceiveservices/opp/inc/oppcontroller.h Wed Jun 23 18:23:52 2010 +0300 @@ -26,28 +26,41 @@ #include #include -#include #include "obexutilspropertynotifier.h" #include #include "btengdevman.h" #include -#include -#include // The AIW service handler +#include +#include +#include -_LIT( KUniqueTransportName, "RFCOMM" ); + const TInt KBtStartReserveChannel = 9; const TInt KBtEndReserveChannel = 30; +// todo @ QT migration: take official definition from Messaging at app layer (btmsgtypeuid.h) +const TUid KUidMsgTypeBt = {0x10009ED5}; +/** +* Backup status. +* The value is controlled by FileManager +*/ +enum TFileManagerBkupStatusType + { + EFileManagerBkupStatusUnset = 0x00000000, + EFileManagerBkupStatusBackup = 0x00000001, + EFileManagerBkupStatusRestore = 0x00000002 + }; /** * CBtListenActive * Class to implement IrObex permanent listen */ class COPPController : public CSrcsInterface, public MObexServerNotify, public MObexUtilsPropertyNotifyHandler, - public MGlobalProgressCallback, public MGlobalNoteCallback, - public MBTEngDevManObserver + public MObexUtilsDialogObserver, + public MBTEngDevManObserver, + public MHbDeviceDialogObserver { public: static COPPController* NewL(); @@ -76,15 +89,13 @@ private: // from MObexUtilsPropertyNotifyHandler void HandleNotifyL(TMemoryPropertyCheckType aCheckType); -private: // from MGlobalProgressCallback - void HandleGlobalProgressDialogL(TInt aSoftkey); - -private: // from MGlobalNoteCallback - void HandleGlobalNoteDialogL(TInt aSoftkey); private: // from MBTEngDevManObserver void HandleGetDevicesComplete(TInt aErr, CBTDeviceArray* aDeviceArray); +private: //from MObexUtilsDialogObserver + void DialogDismissed(TInt aButtonId); + private: COPPController(); void ConstructL(); @@ -96,10 +107,16 @@ TBool CheckCapacityL(); void LaunchReceivingIndicatorL(); - inline TBool ReceivingIndicatorActive() const { return (iProgressDialog || iWaitDialog); } - void UpdateReceivingIndicator(); + inline TBool ReceivingIndicatorActive() const { return (iDialogActive); } + void UpdateReceivingIndicatorL(); void CloseReceivingIndicator(TBool aResetDisplayedState = ETrue); - TInt GetDriveWithMaximumFreeSpaceL(); + TInt GetDriveWithMaximumFreeSpaceL(); + TBool IsBackupRunning(); + TBool ProcessExists( const TSecureId& aSecureId ); + +private: + void DataReceived(CHbSymbianVariantMap& aData); + void DeviceDialogClosed(TInt aCompletionCode); private: enum TObexTransferState @@ -132,12 +149,13 @@ TSrcsMediaType iMediaType; TInt iTotalSizeByte; TFileName iReceivingFileName; - CGlobalProgressDialog* iProgressDialog; - CGlobalDialog* iWaitDialog; TBool iNoteDisplayed; CBTEngDevMan* iDevMan; CBTDeviceArray* iResultArray; TBTDeviceName iRemoteDeviceName; + CObexUtilsDialog* iDialog; + CHbDeviceDialogSymbian* iProgressDialog; + TBool iDialogActive; }; #endif // OPPCONTROLLER_H diff -r 91746b151f97 -r 997690c3397a btobexprofiles/obexreceiveservices/opp/src/oppcontroller.cpp --- a/btobexprofiles/obexreceiveservices/opp/src/oppcontroller.cpp Fri Jun 11 13:48:51 2010 +0300 +++ b/btobexprofiles/obexreceiveservices/opp/src/oppcontroller.cpp Wed Jun 23 18:23:52 2010 +0300 @@ -17,27 +17,28 @@ // INCLUDE FILES -#include // AVKON components #include "oppcontroller.h" #include "btengdevman.h" #include #include "debug.h" -#include #include -#include -#include #include -#include // The AIW service handler #include #include #include -#include +#include #include #include +#include +#include // CONSTANTS const TInt KBufferSize = 0x10000; // 64 kB +const TInt KFileManagerUID3 = 0x101F84EB; /// File Manager application UID3 +_LIT( KBTDevDialogId, "com.nokia.hb.btdevicedialog/1.0" ); +_LIT(KLocFileName, "btdialogs_"); +_LIT(KPath, "z:/resource/qt/translations/"); // ================= MEMBER FUNCTIONS ======================= @@ -68,6 +69,12 @@ TObexUtilsMessageHandler::GetCenRepKeyStringValueL(KCRUidBluetoothEngine, KLCReceiveFolder, iCenRepFolder); + iDialog = CObexUtilsDialog::NewL(this); + TBool ok = HbTextResolverSymbian::Init(KLocFileName, KPath); + if (!ok) + { + User::Leave( KErrNotFound ); + } } COPPController::~COPPController() @@ -77,8 +84,6 @@ delete iBuf; delete iLowMemoryActiveCDrive; delete iLowMemoryActiveMMC; - delete iProgressDialog; - delete iWaitDialog; delete iDevMan; if (iResultArray) { @@ -86,6 +91,8 @@ delete iResultArray; } iFs.Close(); + delete iDialog; + delete iProgressDialog; } // --------------------------------------------------------- @@ -123,7 +130,11 @@ { if(iMediaType == ESrcsMediaBT) { - TRAP_IGNORE( TObexUtilsUiLayer::ShowGlobalConfirmationQueryL( R_BT_FAILED_TO_RECEIVE ) ); + TRAP_IGNORE( + HBufC* note = HbTextResolverSymbian::LoadLC(_L("txt_bt_dpophead_receiving_failed")); + iDialog->ShowErrorNoteL(note->Des()); + CleanupStack::PopAndDestroy(note); + ); } TRACE_ASSERT(iMediaType != ESrcsMediaIrDA, KErrNotSupported) } @@ -161,10 +172,13 @@ // ObexConnectIndication() // --------------------------------------------------------- // -TInt COPPController::ObexConnectIndication( const TObexConnectInfo& /*aRemoteInfo*/, - const TDesC8& /*aInfo*/) +TInt COPPController::ObexConnectIndication( const TObexConnectInfo& aRemoteInfo, + const TDesC8& aInfo) { - TRACE_FUNC + TRACE_FUNC + (void) aRemoteInfo; + (void) aInfo; + if ( iMediaType == ESrcsMediaBT ) { TRACE_INFO( _L( "[oppreceiveservice] ObexConnectIndication: BT media \t" ) ); @@ -191,10 +205,10 @@ // ObexDisconnectIndication( // --------------------------------------------------------- // -void COPPController::ObexDisconnectIndication(const TDesC8& /*aInfo*/) +void COPPController::ObexDisconnectIndication(const TDesC8& aInfo) { TRACE_FUNC - + (void) aInfo; } // --------------------------------------------------------- @@ -225,7 +239,7 @@ // Checking if backup is running now - if backup process is active, then we // need to cancel transfer - otherwise phone will freeze during receiving // data - if ( TObexUtilsUiLayer::IsBackupRunning() ) + if ( IsBackupRunning() ) { TRACE_INFO ( _L ("Backup in progress! Canceling incoming transfer.")); iObexTransferState = ETransferPutInitError; @@ -275,7 +289,11 @@ } if(!capacity) { - TRAP_IGNORE(TObexUtilsUiLayer::ShowGlobalConfirmationQueryL(R_OUT_OF_MEMORY)); + //TRAP_IGNORE(TObexUtilsUiLayer::ShowGlobalConfirmationQueryL(R_OUT_OF_MEMORY)); + //todo: Need to use Localized string. + _LIT(KText, "Not enough memory to execute operation. Delete some documents and try again."); + TRAP_IGNORE(iDialog->ShowErrorNoteL(KText)); + return KErrDiskFull; } } @@ -293,7 +311,11 @@ // Now we need to either create (in the first instance) or update the dialog on the UI. if(ReceivingIndicatorActive()) { - UpdateReceivingIndicator(); + TRAPD(err, UpdateReceivingIndicatorL()); + if(err < KErrNone) + { + return err; + } } else if(!iNoteDisplayed) { @@ -332,9 +354,10 @@ // GetRequestIndication() // --------------------------------------------------------- // -CObexBufObject* COPPController::GetRequestIndication( CObexBaseObject* /*aRequiredObject*/) +CObexBufObject* COPPController::GetRequestIndication( CObexBaseObject* aRequiredObject) { TRACE_FUNC + (void) aRequiredObject; return NULL; } @@ -362,10 +385,13 @@ // SetPathIndication() // --------------------------------------------------------- // -TInt COPPController::SetPathIndication( const CObex::TSetPathInfo& /*aPathInfo*/, - const TDesC8& /*aInfo*/) +TInt COPPController::SetPathIndication( const CObex::TSetPathInfo& aPathInfo, + const TDesC8& aInfo) { TRACE_FUNC + + (void) aPathInfo; + (void) aInfo; // SetPath is not implemented in OPP - so following IrOBEX guidance, return // the Forbidden response code. return KErrIrObexRespForbidden; @@ -429,7 +455,11 @@ // if (SysUtil::DiskSpaceBelowCriticalLevelL( &iFs, 0, iDrive )) { - TRAP_IGNORE(TObexUtilsUiLayer::ShowGlobalConfirmationQueryL(R_OUT_OF_MEMORY)); + //TRAP_IGNORE(TObexUtilsUiLayer::ShowGlobalConfirmationQueryL(R_OUT_OF_MEMORY)); + //todo: Need to use Localized string. + _LIT(KText, "Not enough memory to execute operation. Delete some documents and try again."); + TRAP_IGNORE(iDialog->ShowErrorNoteL(KText)); + User::Leave(KErrGeneral); } @@ -692,65 +722,91 @@ if(iTotalSizeByte > 0) { - iProgressDialog = CGlobalProgressDialog::NewL(this); if(iReceivingFileName.Length() > 0) { - iProgressDialog->ShowProgressDialogNameSizeL(iReceivingFileName, iTotalSizeByte); + iProgressDialog = CHbDeviceDialogSymbian::NewL(); + iProgressDialog->SetObserver(this); + + CHbSymbianVariantMap* variantMap = CHbSymbianVariantMap::NewL(); + CleanupStack::PushL(variantMap); + + TInt dialogIdx = TBluetoothDialogParams::EReceiveProgress; + CHbSymbianVariant* dialogType = CHbSymbianVariant::NewL( (TAny*) &(dialogIdx), + CHbSymbianVariant::EInt ); + CleanupStack::PushL(dialogType); + TBuf16<6> dialogTypeKey; + dialogTypeKey.Num(TBluetoothDialogParams::EDialogType); + User::LeaveIfError(variantMap->Add(dialogTypeKey, dialogType)); + CleanupStack::Pop(dialogType); + + CHbSymbianVariant* deviceName = CHbSymbianVariant::NewL( (TAny*) (&iRemoteDeviceName), + CHbSymbianVariant::EDes ); + CleanupStack::PushL(deviceName); + TBuf16<6> deviceNameKey; + deviceNameKey.Num(TBluetoothDeviceDialog::EDeviceName); + User::LeaveIfError(variantMap->Add(deviceNameKey, deviceName)); + CleanupStack::Pop(deviceName); + + CHbSymbianVariant* fileName = CHbSymbianVariant::NewL( (TAny*) (&iReceivingFileName), + CHbSymbianVariant::EDes ); + CleanupStack::PushL(fileName); + TBuf16<6> fileNameKey; + fileNameKey.Num(TBluetoothDeviceDialog::EReceivingFileName); + User::LeaveIfError(variantMap->Add(fileNameKey, fileName)); + CleanupStack::Pop(fileName); + + CHbSymbianVariant* fileSz = CHbSymbianVariant::NewL( (TAny*) &iTotalSizeByte, + CHbSymbianVariant::EInt ); + CleanupStack::PushL(fileSz); + TBuf16<6> fileSzKey; + fileSzKey.Num(TBluetoothDeviceDialog::EReceivingFileSize); + User::LeaveIfError(variantMap->Add(fileSzKey, fileSz)); + CleanupStack::Pop(fileSz); + + iDialogActive = ETrue; + iProgressDialog->Show( KBTDevDialogId(), *variantMap, this ); + CleanupStack::PopAndDestroy(variantMap); } else { if(iMediaType == ESrcsMediaBT) { - iProgressDialog->ShowProgressDialogL(R_BT_RECEIVING_DATA); + //TODO - Remove the usage of the resources. + //iProgressDialog->ShowProgressDialogL(R_BT_RECEIVING_DATA); } TRACE_ASSERT(iMediaType != ESrcsMediaIrDA, KErrNotSupported); } } else { - iWaitDialog = CGlobalDialog::NewL(this); + + /* + * TODO - The functionality provided by CGlobalDialog will be removed + * TODO - and this will be provided by CGlobalProgressDialog. + */ if(iMediaType == ESrcsMediaBT) { - iWaitDialog->ShowNoteDialogL(R_BT_RECEIVING_DATA, ETrue); + // TODO } TRACE_ASSERT(iMediaType != ESrcsMediaIrDA, KErrNotSupported); } } -void COPPController::UpdateReceivingIndicator() +void COPPController::UpdateReceivingIndicatorL() { if(iProgressDialog) { - iProgressDialog->UpdateProgressDialog(iObexObject->BytesReceived(), iTotalSizeByte); - } - // else we are using a wait note, so no "need" to update - } - -void COPPController::HandleGlobalProgressDialogL( TInt aSoftkey ) - { - TRACE_FUNC - - if(aSoftkey == EAknSoftkeyCancel) - { - CancelTransfer(); - } - else if(aSoftkey == EAknSoftkeyHide) - { - CloseReceivingIndicator(EFalse); // Don't reset state as only hiding - } - } - -void COPPController::HandleGlobalNoteDialogL( TInt aSoftkey ) - { - TRACE_FUNC - - if(aSoftkey == EAknSoftkeyCancel) - { - CancelTransfer(); - } - else if(aSoftkey == EAknSoftkeyHide) - { - CloseReceivingIndicator(EFalse); // Don't reset state as only hiding + CHbSymbianVariantMap* variantMap = CHbSymbianVariantMap::NewL(); + CleanupStack::PushL(variantMap); + + TInt bytesReceived = iObexObject->BytesReceived(); + CHbSymbianVariant* progress = CHbSymbianVariant::NewL( (TAny*) &bytesReceived, CHbSymbianVariant::EInt ); + CleanupStack::PushL(progress); + User::LeaveIfError(variantMap->Add(_L("progress"), progress)); + CleanupStack::Pop(progress); + + iProgressDialog->Update(*variantMap); + CleanupStack::PopAndDestroy(variantMap); } } @@ -761,18 +817,14 @@ { iNoteDisplayed = EFalse; } + if(iProgressDialog) { - iProgressDialog->ProcessFinished(); + iProgressDialog->Cancel(); + iDialogActive = EFalse; delete iProgressDialog; iProgressDialog = NULL; } - if(iWaitDialog) - { - iWaitDialog->ProcessFinished(); - delete iWaitDialog; - iWaitDialog = NULL; - } } // --------------------------------------------------------- @@ -830,9 +882,12 @@ // Callback from devman // ---------------------------------------------------------- // - void COPPController::HandleGetDevicesComplete(TInt aErr, CBTDeviceArray* /*aDeviceArray*/) + void COPPController::HandleGetDevicesComplete(TInt aErr, CBTDeviceArray* aDeviceArray) { TRACE_INFO( _L( "[oppreceiveservice] HandleGetDevicesComplete: enter \t" ) ); + + (void) aDeviceArray; + if ( aErr == KErrNone ) { if ( iResultArray->Count()) @@ -851,7 +906,77 @@ } } } + TBool COPPController::IsBackupRunning() + { + const TUint32 KFileManagerBkupStatus = 0x00000001; + + TInt status = EFileManagerBkupStatusUnset; + TBool retValue = EFalse; + TInt err = RProperty::Get( TUid::Uid(KFileManagerUID3), KFileManagerBkupStatus, + status ); + if ( err == KErrNone ) + { + if ( status == EFileManagerBkupStatusBackup || + status == EFileManagerBkupStatusRestore ) + { + TSecureId fileManagerSecureId( KFileManagerUID3 ); + //only returning ETrue if backup process is still active + retValue = ProcessExists( fileManagerSecureId ); + } + } + + return retValue; + } + TBool COPPController::ProcessExists( const TSecureId& aSecureId ) + { + _LIT( KFindPattern, "*" ); + TFindProcess finder(KFindPattern); + TFullName processName; + while( finder.Next( processName ) == KErrNone ) + { + RProcess process; + if ( process.Open( processName ) == KErrNone ) + { + TSecureId processId( process.SecureId() ); + process.Close(); + if( processId == aSecureId ) + { + return ETrue; + } + } + } + return EFalse; + } + + void COPPController::DialogDismissed(TInt aButtonId) + { + (void) aButtonId; + } + + void COPPController::DataReceived(CHbSymbianVariantMap& aData) + { + if(aData.Keys().MdcaPoint(0).Compare(_L("actionResult")) == 0) + { + TInt val = *(static_cast(aData.Get(_L("actionResult"))->Data())); + if(!val) + { + //Cancel has been clicked + CancelTransfer(); + } + else + { + //Hide has been clicked + CloseReceivingIndicator(EFalse); + } + } + } + + void COPPController::DeviceDialogClosed(TInt aCompletionCode) + { + (void) aCompletionCode; + } + //////////////////////////// Global part //////////////////////////// // End of File diff -r 91746b151f97 -r 997690c3397a btobexprofiles/obexsendservices/group/sendutils.mmp --- a/btobexprofiles/obexsendservices/group/sendutils.mmp Fri Jun 11 13:48:51 2010 +0300 +++ b/btobexprofiles/obexsendservices/group/sendutils.mmp Wed Jun 23 18:23:52 2010 +0300 @@ -1,5 +1,5 @@ /* -* Copyright (c) 2002 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" @@ -46,10 +46,9 @@ SOURCE BTSUXmlParser.cpp SOURCE BTConnectionTimer.cpp SOURCE BTSController.cpp -SOURCE BTSProgresstimer.cpp USERINCLUDE ../obexservicesendutils/inc -SYSTEMINCLUDE ../../inc ../../../inc /epoc32/include/libc +SYSTEMINCLUDE ../../inc /epoc32/include/libc SYSTEMINCLUDE /epoc32/include/mw/hb/hbcore SYSTEMINCLUDE /epoc32/include/mw/hb/hbwidgets MW_LAYER_SYSTEMINCLUDE diff -r 91746b151f97 -r 997690c3397a btobexprofiles/obexsendservices/obexservicesendutils/inc/BTSBIPController.h --- a/btobexprofiles/obexsendservices/obexservicesendutils/inc/BTSBIPController.h Fri Jun 11 13:48:51 2010 +0300 +++ b/btobexprofiles/obexsendservices/obexservicesendutils/inc/BTSBIPController.h Wed Jun 23 18:23:52 2010 +0300 @@ -48,6 +48,8 @@ * Destructor. */ virtual ~CBTSBIPController(); + + void SendUnSupportedFiles(); private: // Functions from base classes diff -r 91746b151f97 -r 997690c3397a btobexprofiles/obexsendservices/obexservicesendutils/inc/BTSBPPController.h --- a/btobexprofiles/obexsendservices/obexservicesendutils/inc/BTSBPPController.h Fri Jun 11 13:48:51 2010 +0300 +++ b/btobexprofiles/obexsendservices/obexservicesendutils/inc/BTSBPPController.h Wed Jun 23 18:23:52 2010 +0300 @@ -21,7 +21,6 @@ #define BT_SERVICE_BPP_CONTROLLER_H // INCLUDES -#include #include "BTServiceStarter.h" #include "BTServiceParameterList.h" #include "BTServiceClient.h" diff -r 91746b151f97 -r 997690c3397a btobexprofiles/obexsendservices/obexservicesendutils/inc/BTSController.h --- a/btobexprofiles/obexsendservices/obexservicesendutils/inc/BTSController.h Fri Jun 11 13:48:51 2010 +0300 +++ b/btobexprofiles/obexsendservices/obexservicesendutils/inc/BTSController.h Wed Jun 23 18:23:52 2010 +0300 @@ -54,6 +54,9 @@ * @return None */ void Abort( ); + + + virtual void SendUnSupportedFiles(); protected: diff -r 91746b151f97 -r 997690c3397a btobexprofiles/obexsendservices/obexservicesendutils/inc/BTServiceStarter.h --- a/btobexprofiles/obexsendservices/obexservicesendutils/inc/BTServiceStarter.h Fri Jun 11 13:48:51 2010 +0300 +++ b/btobexprofiles/obexsendservices/obexservicesendutils/inc/BTServiceStarter.h Wed Jun 23 18:23:52 2010 +0300 @@ -29,9 +29,6 @@ #include #include #include -#include -#include -#include // DATA TYPES @@ -54,7 +51,6 @@ class CObexUtilsUiLayer; class MBTServiceProgressGetter; class CBTSController; -class CBTSProgressTimer; const TUint KBTSdpObjectPush = 0x1105; @@ -83,7 +79,8 @@ * @param aGetter A pointer to a progess status getter object. * @return None. */ - virtual void LaunchProgressNoteL( MBTServiceProgressGetter* aGetter, TInt aTotalSize, TInt aFileCount ) = 0; + //todo reusing the second param aTotalsize to aFileCount as it wass no longer used check it being used in other places + virtual void LaunchProgressNoteL( MBTServiceProgressGetter* aGetter, TInt aFileCount) = 0; /** @@ -93,21 +90,12 @@ */ virtual void UpdateProgressNoteL(TInt aFileSize,TInt aFileIndex, const TDesC& aFileName ) = 0; - - /** - * Informs the observer that a progress note should be shown. - * @param aGetter A pointer to a progess status getter object. - * @return None. - */ - virtual void UpdateProgressInfoL() = 0; - - /** * Informs the observer that a confirmation query for sending - * should be shouwn for BIP sendign + * should be shouwn for BIP sending * @return */ - virtual TInt LaunchConfirmationQuery(TInt aResouceId)=0; + virtual void LaunchConfirmationQuery(const TDesC& aConfirmText)=0; /** * Informs the observer that a connect is timedout @@ -126,9 +114,7 @@ public MObexUtilsDialogObserver, public MObexUtilsProgressObserver, public MBTEngSdpResultReceiver, - public MBTEngSettingsObserver, - public MHbDeviceProgressDialogObserver, - public MHbDeviceDialogObserver + public MBTEngSettingsObserver { public: // Constructors and destructor @@ -170,9 +156,11 @@ * From MBTServiceObserver A progress note should be shown. * @param aGetter A pointer to a progess status getter object. * @param aTotalSize Max size of the progress bar. + * @param aFileCount Total Number of files to be sent * @return None. */ - void LaunchProgressNoteL( MBTServiceProgressGetter* aGetter, TInt aTotalSize, TInt aFileCount ); + //todo reuse the second param as it is no longer used check it being used in other places + void LaunchProgressNoteL( MBTServiceProgressGetter* aGetter, TInt aFileCount); /** @@ -184,32 +172,15 @@ */ void UpdateProgressNoteL(TInt aFileSize,TInt aFileIndex, const TDesC& aFileName ); - /** - * From MBTServiceObserver Updating progress note info about the progress percentage - * @return None. - */ - void UpdateProgressInfoL(); /** * From MObexUtilsWaitDialogObserver The wait note has been dismissed. * @param aButtonId The button id that was used to dismiss the dialog. * @return None. */ - void DialogDismissed( TInt aButtonId ); + void DialogDismissed(TInt aButtonId); /** - * From MHbDeviceProgressDialogObserver - * - */ - void ProgressDialogCancelled(const CHbDeviceProgressDialogSymbian * aDialog); - - /** - * From MHbDeviceProgressDialogObserver - * - */ - void ProgressDialogClosed(const CHbDeviceProgressDialogSymbian * aDialog ) ; - - /** * From MObexUtilsProgressObserver request for number of bytes sent * @Param None. * @return Number of bytes sent. @@ -223,6 +194,13 @@ */ TInt LaunchConfirmationQuery(TInt aResourceId); + + /** + * From MBTServiceObserver A confirmation query for BIP + * profile should be shown. + */ + void LaunchConfirmationQuery(const TDesC& aConfirmText); + /** * From MBTServiceObserver a connect request is timedout * @return @@ -449,9 +427,6 @@ */ void TurnBTPowerOnL( const TBTPowerStateValue aState ); - void DataReceived(CHbSymbianVariantMap& aData); - - void DeviceDialogClosed(TInt aCompletionCode); private: // Data definitions enum TBTServiceStarterState @@ -468,7 +443,7 @@ CBTDevice* iDevice; CBTEngDiscovery* iBTEngDiscovery; CBTServiceParameterList* iList; - // CObexUtilsDialog* iDialog; + CObexUtilsDialog* iDialog; CBTSController* iController; TBTServiceType iService; @@ -493,11 +468,6 @@ TBool iFeatureManagerInitialized; TBool iTriedBIP; TBool iTriedOPP; - CHbDeviceDialogSymbian *iDeviceDialog; - CHbDeviceProgressDialogSymbian *iProgressDialog; - TInt iFileCount; - TInt iFileIndex; - CBTSProgressTimer *iProgressTimer; }; #endif // BT_SERVICE_CONTROLLER_H diff -r 91746b151f97 -r 997690c3397a btobexprofiles/obexsendservices/obexservicesendutils/src/BTSBIPController.cpp --- a/btobexprofiles/obexsendservices/obexservicesendutils/src/BTSBIPController.cpp Fri Jun 11 13:48:51 2010 +0300 +++ b/btobexprofiles/obexsendservices/obexservicesendutils/src/BTSBIPController.cpp Wed Jun 23 18:23:52 2010 +0300 @@ -1,5 +1,5 @@ /* -* Copyright (c) 2002 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" @@ -22,7 +22,7 @@ #include "BTSUDebug.h" #include "BTSUImageConverter.h" #include "BTSUXmlParser.h" -#include +#include @@ -49,6 +49,10 @@ const TInt KBTSUMaxPathLenght=256; const TInt KBTSUMaxPrivatePathLenght=20; +_LIT(KBTNotSendSomeText,"txt_bt_info_receiving_device_does_not_support_all"); +_LIT(KBTNotSendOneText,"txt_bt_info_receiving_device_does_not_support_this"); + + // ============================ MEMBER FUNCTIONS =============================== @@ -235,7 +239,7 @@ } else if( aStatus != KErrAbort && aGetResponse->BytesReceived()==0 ) { - TRAPD( error,iObserverPtr->LaunchProgressNoteL( iClient, iListPtr->ImageListSize(),iListPtr->ImageCount() ) ); + TRAPD( error,iObserverPtr->LaunchProgressNoteL( iClient,iListPtr->ImageCount() ) ); error=KErrNone; TRAP(error, SendL() ); if ( error != KErrNone ) @@ -291,7 +295,7 @@ TBTSUImageParam imageparam = iListPtr->ImageAtL( iFileIndex ); RBuf filename; - filename.CreateL(256); + filename.CreateL(KMaxFileName); CleanupClosePushL(filename); imageparam.iFile.Name(filename); @@ -557,7 +561,6 @@ TBool found; TBool allSupported; TInt picindex,capindex; - TInt confirm=0; CBTSUXmlParser* xmlParser = CBTSUXmlParser::NewL(); CleanupStack::PushL( xmlParser ); GenerateTempFileNameL( iTempFileName ); @@ -631,42 +634,20 @@ if(!allSupported && iListPtr->ImageCount() > 1) { - - confirm=iObserverPtr->LaunchConfirmationQuery(R_BT_NOT_SEND_ALL_QUERY_MIXED); - - if(confirm==EAknSoftkeyYes) - { - // Everything went ok. Start sending images - // - iObserverPtr->LaunchProgressNoteL( iClient, iListPtr->ImageListSize(),iListPtr->ImageCount() ); - - // Start sending images - // - SendL(); - } - - + HBufC* sendText = HbTextResolverSymbian::LoadLC(KBTNotSendSomeText); + iObserverPtr->LaunchConfirmationQuery(sendText->Des()); + CleanupStack::PopAndDestroy( sendText ); } else if ( !allSupported && iListPtr->ImageCount() == 1) { // We allow user to choose wheather to send the image file which is not supported on target device - // Original codeline: iObserverPtr->ControllerComplete( EBTSBIPOneNotSend ); - confirm=iObserverPtr->LaunchConfirmationQuery(R_BT_NOT_SEND_ALL_QUERY_SINGLE); - - if(confirm==EAknSoftkeyYes) - { - // Everything went ok. Start sending the images - // - iObserverPtr->LaunchProgressNoteL( iClient, iListPtr->ImageListSize(),iListPtr->ImageCount() ); - - // Start sending images - // - SendL(); - } + HBufC* sendText = HbTextResolverSymbian::LoadLC(KBTNotSendOneText); + iObserverPtr->LaunchConfirmationQuery(sendText->Des()); + CleanupStack::PopAndDestroy( sendText ); } else if( allSupported ) { - iObserverPtr->LaunchProgressNoteL( iClient, iListPtr->ImageListSize() + iListPtr->ObjectListSizeL(),iListPtr->ImageCount() + iListPtr->ObjectCount()); + iObserverPtr->LaunchProgressNoteL( iClient, iListPtr->ImageCount() + iListPtr->ObjectCount()); // Start sending images // @@ -688,4 +669,23 @@ } + +void CBTSBIPController::SendUnSupportedFiles() + { + // Everything went ok. Start sending images + + // group leaving functions in one trap for better performance: + TRAPD(err, { + iObserverPtr->LaunchProgressNoteL( iClient, iListPtr->ImageCount() ); + SendL(); } ); + + if ( err != KErrNone ) + { + DeleteTempFile( iTempFileName ); + // Error on capability handling + // + iObserverPtr->ControllerComplete( EBTSGettingFailed ); + } + } + // End of File diff -r 91746b151f97 -r 997690c3397a btobexprofiles/obexsendservices/obexservicesendutils/src/BTSBPPController.cpp --- a/btobexprofiles/obexsendservices/obexservicesendutils/src/BTSBPPController.cpp Fri Jun 11 13:48:51 2010 +0300 +++ b/btobexprofiles/obexsendservices/obexservicesendutils/src/BTSBPPController.cpp Wed Jun 23 18:23:52 2010 +0300 @@ -1,5 +1,5 @@ /* -* Copyright (c) 2002 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" @@ -23,8 +23,6 @@ #include "BTSUDebug.h" #include -#include -#include // CONSTANTS _LIT8( KBTSDirectPrintingUUID, "\x00\x00\x11\x18\x00\x00\x10\x00\x80\x00\x00\x80\x5F\x9B\x34\xFB" ); diff -r 91746b151f97 -r 997690c3397a btobexprofiles/obexsendservices/obexservicesendutils/src/BTSController.cpp --- a/btobexprofiles/obexsendservices/obexservicesendutils/src/BTSController.cpp Fri Jun 11 13:48:51 2010 +0300 +++ b/btobexprofiles/obexsendservices/obexservicesendutils/src/BTSController.cpp Wed Jun 23 18:23:52 2010 +0300 @@ -58,6 +58,11 @@ FLOG(_L("[BTSU]\t CBTSController::Abort")); } +void CBTSController::SendUnSupportedFiles() + { + + } + // --------------------------------------------------------------------------- // CBTSController::Abort // --------------------------------------------------------------------------- diff -r 91746b151f97 -r 997690c3397a btobexprofiles/obexsendservices/obexservicesendutils/src/BTSOPPController.cpp --- a/btobexprofiles/obexsendservices/obexservicesendutils/src/BTSOPPController.cpp Fri Jun 11 13:48:51 2010 +0300 +++ b/btobexprofiles/obexsendservices/obexservicesendutils/src/BTSOPPController.cpp Wed Jun 23 18:23:52 2010 +0300 @@ -218,7 +218,7 @@ } } } - iObserverPtr->LaunchProgressNoteL( iClient, iListPtr->ObjectListSizeL(),iListPtr->ObjectCount() ); + iObserverPtr->LaunchProgressNoteL( iClient, iListPtr->ObjectCount() ); iFileIndex = 0; UpdateProgressNoteL(); Send(); @@ -230,7 +230,7 @@ TInt size; RBuf filename; iListPtr->ObjectAtL( iFileIndex ).Size(size); - filename.CreateL(255); + filename.CreateL(KMaxFileName); iListPtr->ObjectAtL( iFileIndex ).Name(filename); iObserverPtr->UpdateProgressNoteL(size,iFileIndex,filename); filename.Close(); diff -r 91746b151f97 -r 997690c3397a btobexprofiles/obexsendservices/obexservicesendutils/src/BTSProgresstimer.cpp --- a/btobexprofiles/obexsendservices/obexservicesendutils/src/BTSProgresstimer.cpp Fri Jun 11 13:48:51 2010 +0300 +++ b/btobexprofiles/obexsendservices/obexservicesendutils/src/BTSProgresstimer.cpp Wed Jun 23 18:23:52 2010 +0300 @@ -95,7 +95,7 @@ FLOG(_L("[OBEXUTILS]\t CBTSProgressTimer::RunL()")); if (iProgressObserverPtr) { - iProgressObserverPtr->UpdateProgressInfoL(); + // iProgressObserverPtr->UpdateProgressInfoL(); } FLOG(_L("[OBEXUTILS]\t CBTSProgressTimer::RunL() completed")); diff -r 91746b151f97 -r 997690c3397a btobexprofiles/obexsendservices/obexservicesendutils/src/BTServiceStarter.cpp --- a/btobexprofiles/obexsendservices/obexservicesendutils/src/BTServiceStarter.cpp Fri Jun 11 13:48:51 2010 +0300 +++ b/btobexprofiles/obexsendservices/obexservicesendutils/src/BTServiceStarter.cpp Wed Jun 23 18:23:52 2010 +0300 @@ -24,14 +24,10 @@ #include "BTSBIPController.h" #include "BTSBPPController.h" -#include -#include #include -#include #include -#include "BTSProgresstimer.h" #include -#include +#include // CONSTANTS @@ -42,8 +38,21 @@ const TUint KBTProgressInterval = 1000000; +const TUid KUidMsgTypeBt = {0x10009ED5}; +//todo need to find a suitable header to include. This is from obexutilslayer.h -_LIT(KSendingDialog,"com.nokia.hb.btdevicedialog/1.0"); +const TInt KMaxDesCLength = 256; + + +//_LIT(KSendingDialog,"com.nokia.hb.btdevicedialog/1.0"); + +_LIT(KLocFileName, "btdialogs_"); +_LIT(KPath, "z:/resource/qt/translations/"); + +_LIT(KFilesSentText, "txt_bt_dpophead_all_files_sent");//All files sent +_LIT(KDeviceText,"txt_bt_dpopinfo_sent_to_1"); +//_LIT(KNotConnectedText,"txt_bt_info_unable_to_connect_with_bluetooth"); +_LIT(KSendingFailedText,"txt_bt_dpophead_sending_failed"); // ============================ MEMBER FUNCTIONS =============================== @@ -78,12 +87,15 @@ { FLOG(_L("[BTSU]\t CBTServiceStarter::ConstructL()")); iDevice = CBTDevice::NewL(); -// iDialog = CObexUtilsDialog::NewL( this ); - iDeviceDialog = CHbDeviceDialogSymbian::NewL(); - iProgressDialog = CHbDeviceProgressDialogSymbian::NewL(CHbDeviceProgressDialogSymbian::EWaitDialog,this); + iDialog = CObexUtilsDialog::NewL( this ); FeatureManager::InitializeLibL(); iFeatureManagerInitialized = ETrue; + TBool ok = HbTextResolverSymbian::Init(KLocFileName, KPath); + if (!ok) + { + User::Leave( KErrNotFound ); + } FLOG(_L("[BTSU]\t CBTServiceStarter::ConstructL() completed")); } @@ -117,13 +129,7 @@ delete iController; delete iBTEngDiscovery; - // delete iDialog; - delete iDeviceDialog; - delete iProgressDialog; - if(iProgressTimer) - { - delete iProgressTimer; - } + delete iDialog; if(iWaiter && iWaiter->IsStarted() ) { @@ -262,41 +268,6 @@ } } -void CBTServiceStarter::UpdateProgressInfoL() - { - HBufC* key = HBufC::NewL(50); - CleanupStack::PushL(key); - - HBufC* value = HBufC::NewL(50); - CleanupStack::PushL(value); - - CHbSymbianVariantMap* map = CHbSymbianVariantMap::NewL(); - CleanupStack::PushL(map); - - TInt progress = GetProgressStatus(); - - key->Des().Copy(_L("progressValue")); - CHbSymbianVariant* progressvalue = CHbSymbianVariant::NewL(&progress, CHbSymbianVariant::EInt); - map->Add(*key,progressvalue); - - key->Des().Copy(_L("currentFileIdx")); - value->Des().AppendNum(iFileIndex); - CHbSymbianVariant* currentFileIdx = CHbSymbianVariant::NewL(value, CHbSymbianVariant::EDes); - map->Add(*key,currentFileIdx); - - - TInt ret = iDeviceDialog->Update(*map); - - CleanupStack::PopAndDestroy(map); - CleanupStack::PopAndDestroy(value); - CleanupStack::PopAndDestroy(key); - - - if ( iProgressTimer ) - { - iProgressTimer->Tickle(); - } - } // ----------------------------------------------------------------------------- // CBTServiceStarter::ValidParameters @@ -480,10 +451,9 @@ } else { - // iDialog->LaunchWaitDialogL( R_BT_CONNECTING_WAIT_NOTE ); + //todo need to do the localisation here _LIT(KConnectText, "Connecting..."); - iProgressDialog->SetTextL(KConnectText); - iProgressDialog->ShowL(); + iDialog->LaunchWaitDialogL(KConnectText); } FLOG(_L("[BTSU]\t CBTServiceStarter::LaunchWaitNoteL() completed")); @@ -497,15 +467,10 @@ { FLOG(_L("[BTSU]\t CBTServiceStarter::CancelWaitNote()")); - // if ( iDialog ) - // { - // TRAP_IGNORE( iDialog->CancelWaitDialogL() ); - if(iProgressDialog) - { - //This has to be tested - iProgressDialog->Close(); - } - // } + if ( iDialog ) + { + iDialog->CancelWaitDialog(); + } FLOG(_L("[BTSU]\t CBTServiceStarter::CancelWaitNote() completed")); } @@ -515,12 +480,12 @@ // CBTServiceStarter::LaunchProgressNoteL // ----------------------------------------------------------------------------- // +//todo reusing the second param aTotalSize to aFileCount as it is no longer used check it being used in other places void CBTServiceStarter::LaunchProgressNoteL( MBTServiceProgressGetter* aGetter, - TInt aTotalSize, TInt aFileCount) + TInt aFileCount) { FLOG(_L("[BTSU]\t CBTServiceStarter::LaunchProgressNoteL()")); - (void) aTotalSize; - + RBuf deviceName; if ( iService != EBTPrintingService ) { iProgressGetter = aGetter; @@ -528,33 +493,24 @@ if ( !iProgressDialogActive ) { - iFileCount = aFileCount; + // todo need to change the last parameter because we are now using the textmap id which is a string + // whether we replace it with that or remove the parameter is to be decided iMessageServerIndex = TObexUtilsMessageHandler::CreateOutboxEntryL( - KUidMsgTypeBt, R_BT_SEND_OUTBOX_SENDING ); - // iDialog->LaunchProgressDialogL( this, aTotalSize, - // R_BT_SENDING_DATA, KBTProgressInterval ); - CHbSymbianVariantMap* map = CHbSymbianVariantMap::NewL(); - CleanupStack::PushL(map); - if ( iProgressTimer ) - { - iProgressTimer->Cancel(); - delete iProgressTimer; - iProgressTimer = NULL; - } + KUidMsgTypeBt, 0 ); - iProgressTimer = CBTSProgressTimer::NewL( this ); - iProgressTimer->SetTimeout( KBTProgressInterval ); + deviceName.CreateL(KMaxDesCLength); - iProgressTimer->Tickle(); - - CHbSymbianVariant* value = NULL; - TBuf<6> key; - TInt data = TBluetoothDialogParams::ESend; - key.Num(TBluetoothDialogParams::EDialogType); - value = CHbSymbianVariant::NewL( (TAny*) &data, CHbSymbianVariant::EInt ); - User::LeaveIfError(map->Add( key, value )); // Takes ownership of value - iDeviceDialog->Show(KSendingDialog(),*map,this); - CleanupStack::PopAndDestroy(map); + if ( iDevice->IsValidFriendlyName() ) + { + deviceName.Copy( iDevice->FriendlyName() ); + } + else + { + deviceName.Copy( BTDeviceNameConverter::ToUnicodeL(iDevice->DeviceName())); + } + iDialog->LaunchProgressDialogL( this, aFileCount, + deviceName, KBTProgressInterval ); + deviceName.Close(); } iProgressDialogActive=ETrue; } @@ -564,74 +520,8 @@ void CBTServiceStarter::UpdateProgressNoteL(TInt aFileSize,TInt aFileIndex, const TDesC& aFileName ) { - HBufC* key = HBufC::NewL(50); - CleanupStack::PushL(key); - - HBufC* value = HBufC::NewL(50); - CleanupStack::PushL(value); - CHbSymbianVariantMap* map = CHbSymbianVariantMap::NewL(); - CleanupStack::PushL(map); - - iFileIndex = aFileIndex+1; - key->Des().Copy(_L("currentFileIdx")); - value->Des().AppendNum(aFileIndex+1); - CHbSymbianVariant* currentFileIdx = CHbSymbianVariant::NewL(value, CHbSymbianVariant::EDes); - map->Add(*key,currentFileIdx); - - key->Des().Copy(_L("totalFilesCnt")); - value->Des().Zero(); - value->Des().AppendNum(iFileCount); - CHbSymbianVariant* totalFilesCnt = CHbSymbianVariant::NewL(value, CHbSymbianVariant::EDes); - map->Add(*key,totalFilesCnt); - - - key->Des().Copy(_L("destinationName")); - if ( iDevice->IsValidFriendlyName() ) - { - value->Des().Copy( iDevice->FriendlyName() ); - } - else - { - value->Des().Copy( BTDeviceNameConverter::ToUnicodeL(iDevice->DeviceName())); - } - - CHbSymbianVariant* destinationName = CHbSymbianVariant::NewL(value, CHbSymbianVariant::EDes); - map->Add(*key,destinationName); - - key->Des().Copy(_L("fileName")); - value->Des().Copy(aFileName); - CHbSymbianVariant* fileName = CHbSymbianVariant::NewL(value, CHbSymbianVariant::EDes); - map->Add(*key,fileName); - - key->Des().Copy(_L("fileSzTxt")); - value->Des().Zero(); - if(aFileSize < 1024) - { - value->Des().AppendNum(aFileSize); - value->Des().Append(_L(" Bytes")); - } - else - { - TInt filesize = aFileSize/1024; - value->Des().AppendNum(filesize); - value->Des().Append(_L(" KB")); - } - - CHbSymbianVariant* fileSzTxt = CHbSymbianVariant::NewL(value, CHbSymbianVariant::EDes); - map->Add(*key,fileSzTxt); - - - key->Des().Copy(_L("fileSz")); - CHbSymbianVariant* fileSz = CHbSymbianVariant::NewL(&aFileSize, CHbSymbianVariant::EInt); - map->Add(*key,fileSz); - - - - TInt ret = iDeviceDialog->Update(*map); - CleanupStack::PopAndDestroy(map); - CleanupStack::PopAndDestroy(value); - CleanupStack::PopAndDestroy(key); + iDialog->UpdateProgressNoteL(aFileSize,aFileIndex,aFileName); } // ----------------------------------------------------------------------------- // CBTServiceStarter::CancelProgressNote @@ -641,31 +531,21 @@ { FLOG(_L("[BTSU]\t CBTServiceStarter::CancelProgressNote()")); - // if ( iDialog ) + if ( iDialog ) { - // TRAP_IGNORE( iDialog->CancelProgressDialogL() ); - if ( iProgressTimer ) - { - iProgressTimer->Cancel(); - delete iProgressTimer; - iProgressTimer = NULL; - } + iDialog->CancelProgressDialog(); } - if(iDeviceDialog) - { - iDeviceDialog->Cancel(); - } } // ----------------------------------------------------------------------------- // CBTServiceStarter::DialogDismissed // ----------------------------------------------------------------------------- // -void CBTServiceStarter::DialogDismissed( TInt aButtonId ) +void CBTServiceStarter::DialogDismissed(TInt aButtonId ) { FLOG(_L("[BTSU]\t CBTServiceStarter::DialogDismissed()")); - if( aButtonId == EAknSoftkeyCancel ) - { + if( aButtonId == ECancelButton ) + { // this condition is hit for the progress dialog and connecting dialog cancel FLOG(_L("[BTSU]\t CBTServiceStarter::DialogDissmissed(), cancelled by user")); iUserCancel=ETrue; if ( iController ) @@ -677,12 +557,17 @@ StopTransfer(KErrCancel); } } - else if ( aButtonId == EAknSoftkeyNo ) + else if ( aButtonId == ENoButton ) { // user abortion // iUserCancel = ETrue; StopTransfer( KErrCancel ); + CancelWaitNote(); + } + else //EYesButton + {// this condition is hit when user is ok with sending the unsupported images + iController->SendUnSupportedFiles(); } FLOG(_L("[BTSU]\t CBTServiceStarter::DialogDismissed() completed")); } @@ -695,130 +580,63 @@ { FLOG(_L("[BTSU]\t CBTServiceStarter::ShowNote()")); -// TInt resource = 0; - TBuf<255> buf; + TBuf buf; + TPtrC sendTextMapId; + + if ( iDevice->IsValidFriendlyName() ) + { + buf.Copy( iDevice->FriendlyName() ); + } + else + { + TRAP_IGNORE( buf.Copy( BTDeviceNameConverter::ToUnicodeL(iDevice->DeviceName()))); + } + switch ( aReason ) { case EBTSNoError: { - /* if ( iService == EBTPrintingService ) - { - // resource = R_BT_DATA_SENT2; - - _LIT(KText, "Data Sent"); - buf.Copy(KText); - } - else - { - //resource = R_BT_DATA_SENT;*/ - _LIT(KText, "All files Sent to "); - buf.Copy(KText); - if ( iDevice->IsValidFriendlyName() ) - { - buf.Append( iDevice->FriendlyName() ); - } - else - { - TRAP_IGNORE( buf.Append( BTDeviceNameConverter::ToUnicodeL(iDevice->DeviceName()))); - } - - -// } + sendTextMapId.Set(KFilesSentText()); break; } case EBTSConnectingFailed: - { - //resource = R_BT_DEV_NOT_AVAIL; - _LIT(KText, "Cannot establish Bluetooth connection"); - buf.Copy(KText); - break; - } case EBTSGettingFailed: case EBTSPuttingFailed: + case EBTSNoSuitableProfiles: +// case EBTSBIPSomeSend: +// case EBTSBIPOneNotSend: +// case EBTSBIPNoneSend: + default: { - if ( iService == EBTPrintingService ) - { - _LIT(KText, "Sending failed"); - //resource = R_BT_FAILED_TO_SEND2; - buf.Copy(KText); - } - else - { - _LIT(KText, "Failed to send Data"); - //resource = R_BT_FAILED_TO_SEND; - buf.Copy(KText); - } + sendTextMapId.Set(KSendingFailedText()); break; } - case EBTSNoSuitableProfiles: - { - if ( iService == EBTPrintingService ) - { - _LIT(KText, "Printer not supported"); - buf.Copy(KText); - // resource = R_BT_PRINTING_NOT_SUPPORTED; - } - else - { - _LIT(KText, "Failed to send Data"); - buf.Copy(KText); - // resource = R_BT_FAILED_TO_SEND; - } - break; - } - case EBTSBIPSomeSend: - { - _LIT(KText, "Failed to send Data"); - buf.Copy(KText); - //resource = R_BT_FAILED_TO_SEND; - break; - } - case EBTSBIPOneNotSend: - { - _LIT(KText, "Receiving device does not support this image format."); - buf.Copy(KText); - //resource = R_BT_NOT_RECEIVE_ONE; - break; - } - case EBTSBIPNoneSend: - { - _LIT(KText, "Receiving device does not support the needed image formats."); - buf.Copy(KText); - //resource = R_BT_NOT_RECEIVE_ANY; - break; - } - default: - { - // resource = R_BT_DEV_NOT_AVAIL; - _LIT(KText, "Cannot establish Bluetooth connection"); - buf.Copy(KText); - break; - } + //todo below three enums are not valid and it is not being used at anywhere do we need to have it + } -// TRAP_IGNORE(TObexUtilsUiLayer::ShowInformationNoteL( resource ) ); -// CHbDeviceMessageBoxSymbian::InformationL(buf); - TRAP_IGNORE(CHbDeviceNotificationDialogSymbian::NotificationL(KNullDesC, buf, KNullDesC)); + TRAP_IGNORE( + HBufC* sendText = HbTextResolverSymbian::LoadLC(sendTextMapId); + HBufC* deviceName = HbTextResolverSymbian::LoadLC(KDeviceText,buf); + CHbDeviceNotificationDialogSymbian::NotificationL(KNullDesC, deviceName->Des(), sendText->Des()); + CleanupStack::PopAndDestroy( deviceName ); + CleanupStack::PopAndDestroy( sendText ); + ); + FLOG(_L("[BTSU]\t CBTServiceStarter::ShowNote() completed")); } + + // ----------------------------------------------------------------------------- // CBTServiceStarter::LaunchConfirmationQuery // ----------------------------------------------------------------------------- // -TInt CBTServiceStarter::LaunchConfirmationQuery(TInt /*aResourceId*/) - { - TInt keypress=0; -// TRAP_IGNORE( keypress = iDialog->LaunchQueryDialogL( aResourceId )); - if ( !keypress ) - { - FLOG(_L("[BTSU]\t CBTServiceStarter::LaunchConfirmationQuery(), cancelled by user")); - DialogDismissed(EAknSoftkeyNo); - CancelWaitNote(); - } - return keypress; - } +void CBTServiceStarter::LaunchConfirmationQuery(const TDesC& aConfirmText) + { + TRAP_IGNORE(iDialog->LaunchQueryDialogL(aConfirmText )); + } // ----------------------------------------------------------------------------- // CBTServiceStarter::StopTransfer @@ -1220,61 +1038,3 @@ -void CBTServiceStarter::ProgressDialogCancelled(const CHbDeviceProgressDialogSymbian*/* aDialog*/) - { - FLOG(_L("[BTSU]\t CBTServiceStarter::ProgressDialogCancelled(), cancelled by user")); - iUserCancel=ETrue; - if ( iController ) - { - iController->Abort(); - } - else - { - StopTransfer(KErrCancel); - } - } - - -void CBTServiceStarter::ProgressDialogClosed(const CHbDeviceProgressDialogSymbian* /* aDialog*/) - { - } - - -void CBTServiceStarter::DataReceived(CHbSymbianVariantMap& /*aData*/) - { - - } - - -void CBTServiceStarter::DeviceDialogClosed(TInt /* aCompletionCode*/) - { - TBuf<255> buf; - _LIT(KText, "Sending Cancelled to "); - buf.Copy(KText); - if ( iDevice->IsValidFriendlyName() ) - { - buf.Append( iDevice->FriendlyName() ); - } - else - { - TRAP_IGNORE(buf.Append( BTDeviceNameConverter::ToUnicodeL(iDevice->DeviceName()))); - } - - iUserCancel=ETrue; - if ( iController ) - { - iController->Abort(); - } - else - { - StopTransfer(KErrCancel); - } - - if ( iProgressTimer ) - { - iProgressTimer->Cancel(); - delete iProgressTimer; - iProgressTimer = NULL; - } - TRAP_IGNORE(CHbDeviceNotificationDialogSymbian::NotificationL(KNullDesC, buf, KNullDesC)); - } diff -r 91746b151f97 -r 997690c3397a btobexprofiles/obexserviceman/group/bld.inf --- a/btobexprofiles/obexserviceman/group/bld.inf Fri Jun 11 13:48:51 2010 +0300 +++ b/btobexprofiles/obexserviceman/group/bld.inf Wed Jun 23 18:23:52 2010 +0300 @@ -48,7 +48,6 @@ ../rom/obexservicemanirda.iby CORE_MW_LAYER_IBY_EXPORT_PATH(obexservicemanirda.iby) ../rom/obexservicemanusb.iby CORE_MW_LAYER_IBY_EXPORT_PATH(obexservicemanusb.iby) ../rom/ObexUtils.iby CORE_MW_LAYER_IBY_EXPORT_PATH(ObexUtils.iby) -../rom/ObexUtilsResources.iby LANGUAGE_MW_LAYER_IBY_EXPORT_PATH(ObexUtilsResources.iby) #include "../utils/group/bld.inf" diff -r 91746b151f97 -r 997690c3397a btobexprofiles/obexserviceman/obexservicemanserver/inc/SrcsServiceManager.h --- a/btobexprofiles/obexserviceman/obexservicemanserver/inc/SrcsServiceManager.h Fri Jun 11 13:48:51 2010 +0300 +++ b/btobexprofiles/obexserviceman/obexservicemanserver/inc/SrcsServiceManager.h Wed Jun 23 18:23:52 2010 +0300 @@ -138,7 +138,7 @@ * Handling of Service array * */ - void ServiceArray(CArrayPtr &aTransport, TBool aState); + void ServiceArrayL(CArrayPtr &aTransport, TBool aState); private: diff -r 91746b151f97 -r 997690c3397a btobexprofiles/obexserviceman/obexservicemanserver/src/SrcsServiceManager.cpp --- a/btobexprofiles/obexserviceman/obexservicemanserver/src/SrcsServiceManager.cpp Fri Jun 11 13:48:51 2010 +0300 +++ b/btobexprofiles/obexserviceman/obexservicemanserver/src/SrcsServiceManager.cpp Wed Jun 23 18:23:52 2010 +0300 @@ -228,17 +228,17 @@ case ESrcsTransportBT: FLOG(_L("[SRCS]\tserver\tCSrcsServiceManager: ManageServicesL(Bluetooth)")); iTransportName.Set(KSrcsTransportBT); - ServiceArray(*iBTConnectionArray, aState); + ServiceArrayL(*iBTConnectionArray, aState); break; case ESrcsTransportUSB: FLOG(_L("[SRCS]\tserver\tCSrcsServiceManager: ManageServicesL(USB)")); iTransportName.Set(KSrcsTransportUSB); - ServiceArray(*iUSBConnectionArray, aState); + ServiceArrayL(*iUSBConnectionArray, aState); break; case ESrcsTransportIrDA: FLOG(_L("[SRCS]\tserver\tCSrcsServiceManager: ManageServicesL(IrDA)")); iTransportName.Set(KSrcsTransportIrDA); - ServiceArray(*iIrDAConnectionArray, aState); + ServiceArrayL(*iIrDAConnectionArray, aState); break; default: FTRACE(FPrint(_L("[SRCS]\tserver\tCSrcsServiceManager: ManageServicesL. Transport not supported."))); @@ -252,9 +252,9 @@ // Method to manage Service arrays // --------------------------------------------------------- // -void CSrcsServiceManager::ServiceArray(CArrayPtr &aTransport, TBool aState) +void CSrcsServiceManager::ServiceArrayL(CArrayPtr &aTransport, TBool aState) { - FLOG(_L("[SRCS]\tserver\tCSrcsServiceManager: ServiceArray")); + FLOG(_L("[SRCS]\tserver\tCSrcsServiceManager: ServiceArrayL")); // We start and stop services by aState value if ( aState ) // trun on service @@ -320,7 +320,7 @@ FTRACE(FPrint(_L("[SRCS]\tserver\tCSrcsServiceManager: ManageServicesL. Transport implementation not found."))); } - // Clean up + // Clean up. todo (from reviewing): memory leak when some func above leaves. To be fixed infoArrayTranport.ResetAndDestroy(); infoArrayServiceController.ResetAndDestroy(); CleanupStack::PopAndDestroy(2); //infoArrayServiceController diff -r 91746b151f97 -r 997690c3397a btobexprofiles/obexserviceman/rom/ObexUtils.iby --- a/btobexprofiles/obexserviceman/rom/ObexUtils.iby Fri Jun 11 13:48:51 2010 +0300 +++ b/btobexprofiles/obexserviceman/rom/ObexUtils.iby Wed Jun 23 18:23:52 2010 +0300 @@ -20,5 +20,6 @@ #define __OBEXUTILS_IBY__ file=ABI_DIR\BUILD_DIR\obexutils.dll SHARED_LIB_DIR\obexutils.dll +data=/epoc32/data/z/resource/qt/translations/btdialogs_en_GB.qm resource/qt/translations/btdialogs_en_GB.qm #endif diff -r 91746b151f97 -r 997690c3397a btobexprofiles/obexserviceman/rom/ObexUtilsResources.iby --- a/btobexprofiles/obexserviceman/rom/ObexUtilsResources.iby Fri Jun 11 13:48:51 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,27 +0,0 @@ -/* -* Copyright (c) 2002 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: IBY file for localizable elements (resources of ObexUtils -* library -* -*/ - - -#ifndef OBEXUTILSRESOURCES_IBY -#define OBEXUTILSRESOURCES_IBY - -data=DATAZ_\RESOURCE_FILES_DIR\obexutils.rsc RESOURCE_FILES_DIR\obexutils.rsc - -#endif - -// End of File diff -r 91746b151f97 -r 997690c3397a btobexprofiles/obexserviceman/utils/bmarm/OBEXUTILSU.DEF --- a/btobexprofiles/obexserviceman/utils/bmarm/OBEXUTILSU.DEF Fri Jun 11 13:48:51 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,28 +0,0 @@ -EXPORTS - UpdateProgressDialogL__16CObexUtilsDialogii @ 1 NONAME R3UNUSED ; CObexUtilsDialog::UpdateProgressDialogL(int, int) - CancelWaitDialogL__16CObexUtilsDialog @ 2 NONAME R3UNUSED ; CObexUtilsDialog::CancelWaitDialogL(void) - ContextIcon__17TObexUtilsUiLayerRC9TMsvEntry13TContextMedia @ 3 NONAME R3UNUSED ; TObexUtilsUiLayer::ContextIcon(TMsvEntry const &, TContextMedia) - CreateOutboxEntryL__24TObexUtilsMessageHandlerRC4TUidRCi @ 4 NONAME R3UNUSED ; TObexUtilsMessageHandler::CreateOutboxEntryL(TUid const &, int const &) - DeleteOutboxEntryL__24TObexUtilsMessageHandlerRCl @ 5 NONAME R3UNUSED ; TObexUtilsMessageHandler::DeleteOutboxEntryL(long const &) - GetFileSystemStatus__24TObexUtilsMessageHandler @ 6 NONAME R3UNUSED ; TObexUtilsMessageHandler::GetFileSystemStatus(void) - GetMmcFileSystemStatus__24TObexUtilsMessageHandler @ 7 NONAME R3UNUSED ; TObexUtilsMessageHandler::GetMmcFileSystemStatus(void) - LaunchEditorApplicationL__17TObexUtilsUiLayerP9CMsvEntryR11CMsvSession @ 8 NONAME R3UNUSED ; TObexUtilsUiLayer::LaunchEditorApplicationL(CMsvEntry *, CMsvSession &) - LaunchProgressDialogL__16CObexUtilsDialogP26MObexUtilsProgressObserveriii @ 9 NONAME ; CObexUtilsDialog::LaunchProgressDialogL(MObexUtilsProgressObserver *, int, int, int) - LaunchWaitDialogL__16CObexUtilsDialogi @ 10 NONAME R3UNUSED ; CObexUtilsDialog::LaunchWaitDialogL(int) - NewLC__16CObexUtilsDialogP24MObexUtilsDialogObserver @ 11 NONAME R3UNUSED ; CObexUtilsDialog::NewLC(MObexUtilsDialogObserver *) - NewL__16CObexUtilsDialogP24MObexUtilsDialogObserver @ 12 NONAME R3UNUSED ; CObexUtilsDialog::NewL(MObexUtilsDialogObserver *) - OperationNotSupported__17TObexUtilsUiLayer @ 13 NONAME R3UNUSED ; TObexUtilsUiLayer::OperationNotSupported(void) - ReadResourceL__17TObexUtilsUiLayerR6TDes16RCi @ 14 NONAME R3UNUSED ; TObexUtilsUiLayer::ReadResourceL(TDes16 &, int const &) - SaveObjToInboxL__24TObexUtilsMessageHandlerP14CObexBufObjectRC7TDesC16G4TUid @ 15 NONAME R3UNUSED ; TObexUtilsMessageHandler::SaveObjToInboxL(CObexBufObject *, TDesC16 const &, TUid) - ShowErrorNoteL__17TObexUtilsUiLayerRCi @ 16 NONAME R3UNUSED ; TObexUtilsUiLayer::ShowErrorNoteL(int const &) - ShowInformationNoteL__17TObexUtilsUiLayerRCi @ 17 NONAME R3UNUSED ; TObexUtilsUiLayer::ShowInformationNoteL(int const &) - UpdateBitmaps__17TObexUtilsUiLayerG4TUidRiRt4TBuf1i256T2T2 @ 18 NONAME ; TObexUtilsUiLayer::UpdateBitmaps(TUid, int &, TBuf<256> &, int &, int &) - CancelProgressDialogL__16CObexUtilsDialog @ 19 NONAME R3UNUSED ; CObexUtilsDialog::CancelProgressDialogL(void) - CreateIconsL__17TObexUtilsUiLayerG4TUidPt9CArrayPtr1Zt9CArrayPtr1Z10CFbsBitmap @ 20 NONAME R3UNUSED ; TObexUtilsUiLayer::CreateIconsL(TUid, CArrayPtr > *) - NewL__26CObexUtilsPropertyNotifierP31MObexUtilsPropertyNotifyHandler24TMemoryPropertyCheckType @ 21 NONAME R3UNUSED ; CObexUtilsPropertyNotifier::NewL(MObexUtilsPropertyNotifyHandler *, TMemoryPropertyCheckType) - LaunchQueryDialogL__16CObexUtilsDialogRCi @ 22 NONAME R3UNUSED ; CObexUtilsDialog::LaunchQueryDialogL(int const &) - ShowNumberOfSendFileL__16CObexUtilsDialogii @ 23 NONAME R3UNUSED ; CObexUtilsDialog::ShowNumberOfSendFileL(int, int) - CreateInboxAttachmentL__24TObexUtilsMessageHandlerP14CObexBufObjectG4TUidRlR5RFile @ 24 NONAME ; TObexUtilsMessageHandler::CreateInboxAttachmentL(CObexBufObject *, TUid, long &, RFile &) - RemoveInboxEntriesL__24TObexUtilsMessageHandlerRP14CObexBufObjectl @ 25 NONAME R3UNUSED ; TObexUtilsMessageHandler::RemoveInboxEntriesL(CObexBufObject *&, long) - SaveObjToInboxL__24TObexUtilsMessageHandlerRP14CObexBufObjectR5RFilel @ 26 NONAME R3UNUSED ; TObexUtilsMessageHandler::SaveObjToInboxL(CObexBufObject *&, RFile &, long) - diff -r 91746b151f97 -r 997690c3397a btobexprofiles/obexserviceman/utils/bwins/OBEXUTILSU.DEF --- a/btobexprofiles/obexserviceman/utils/bwins/OBEXUTILSU.DEF Fri Jun 11 13:48:51 2010 +0300 +++ b/btobexprofiles/obexserviceman/utils/bwins/OBEXUTILSU.DEF Wed Jun 23 18:23:52 2010 +0300 @@ -1,62 +1,39 @@ EXPORTS - ?ReadResourceL@TObexUtilsUiLayer@@SAXAAVTDes16@@ABH@Z @ 1 NONAME ; void TObexUtilsUiLayer::ReadResourceL(class TDes16 &, int const &) + ?GetCenRepKeyIntValueL@TObexUtilsMessageHandler@@SAHVTUid@@KAAH@Z @ 1 NONAME ; int TObexUtilsMessageHandler::GetCenRepKeyIntValueL(class TUid, unsigned long, int &) ?SaveObjToInboxL@TObexUtilsMessageHandler@@SAXPAVCObexBufObject@@ABVTDesC16@@VTUid@@@Z @ 2 NONAME ; void TObexUtilsMessageHandler::SaveObjToInboxL(class CObexBufObject *, class TDesC16 const &, class TUid) ?RemoveInboxEntriesL@TObexUtilsMessageHandler@@SAXAAPAVCObexBufObject@@J@Z @ 3 NONAME ; void TObexUtilsMessageHandler::RemoveInboxEntriesL(class CObexBufObject * &, long) - ?GetNumber@CObexUtilsOpaqueData@@QAEHAAI@Z @ 4 NONAME ; int CObexUtilsOpaqueData::GetNumber(unsigned int &) - ??0CObexUtilsOpaqueData@@QAE@ABVTDesC8@@@Z @ 5 NONAME ; CObexUtilsOpaqueData::CObexUtilsOpaqueData(class TDesC8 const &) - ?UpdateProgressDialog@CGlobalProgressDialog@@QAEXHH@Z @ 6 NONAME ; void CGlobalProgressDialog::UpdateProgressDialog(int, int) - ?AddEntryToInboxL@TObexUtilsMessageHandler@@SAXAAJAAV?$TBuf@$0BAA@@@@Z @ 7 NONAME ; void TObexUtilsMessageHandler::AddEntryToInboxL(long &, class TBuf<256> &) - ?CancelWaitDialogL@CObexUtilsDialog@@QAEXXZ @ 8 NONAME ; void CObexUtilsDialog::CancelWaitDialogL(void) - ?LaunchFileManagerL@TObexUtilsUiLayer@@SAXAAVTDesC16@@HH@Z @ 9 NONAME ; void TObexUtilsUiLayer::LaunchFileManagerL(class TDesC16 &, int, int) - ?CreateDefaultMtmServiceL@TObexUtilsMessageHandler@@SAXVTUid@@@Z @ 10 NONAME ; void TObexUtilsMessageHandler::CreateDefaultMtmServiceL(class TUid) - ?UpdateProgressDialogL@CObexUtilsDialog@@QAEXHH@Z @ 11 NONAME ; void CObexUtilsDialog::UpdateProgressDialogL(int, int) - ?GetCenRepKeyStringValueL@TObexUtilsMessageHandler@@SAHVTUid@@KAAVTDes16@@@Z @ 12 NONAME ; int TObexUtilsMessageHandler::GetCenRepKeyStringValueL(class TUid, unsigned long, class TDes16 &) - ?GetMmcFileSystemStatus@TObexUtilsMessageHandler@@SAHXZ @ 13 NONAME ; int TObexUtilsMessageHandler::GetMmcFileSystemStatus(void) - ?GetPubSubKeyIntValue@TObexUtilsMessageHandler@@SAHVTUid@@IAAH@Z @ 14 NONAME ; int TObexUtilsMessageHandler::GetPubSubKeyIntValue(class TUid, unsigned int, int &) - ?IsBackupRunning@TObexUtilsUiLayer@@SAHXZ @ 15 NONAME ; int TObexUtilsUiLayer::IsBackupRunning(void) - ?CancelProgressDialogL@CObexUtilsDialog@@QAEXXZ @ 16 NONAME ; void CObexUtilsDialog::CancelProgressDialogL(void) - ?ProcessFinished@CGlobalProgressDialog@@QAEXXZ @ 17 NONAME ; void CGlobalProgressDialog::ProcessFinished(void) - ?AddEntryToInboxL@TObexUtilsMessageHandler@@SAXAAJAAV?$TBuf@$0BAA@@@PAV?$RArray@J@@@Z @ 18 NONAME ; void TObexUtilsMessageHandler::AddEntryToInboxL(long &, class TBuf<256> &, class RArray *) - ?CreateIconsL@TObexUtilsUiLayer@@SAXVTUid@@PAV?$CArrayPtr@V?$CArrayPtr@VCFbsBitmap@@@@@@@Z @ 19 NONAME ; void TObexUtilsUiLayer::CreateIconsL(class TUid, class CArrayPtr > *) - ?ShowProgressDialogNameSizeL@CGlobalProgressDialog@@QAEXAAVTDesC16@@_J@Z @ 20 NONAME ; void CGlobalProgressDialog::ShowProgressDialogNameSizeL(class TDesC16 &, long long) - ?GetFileSystemStatus@TObexUtilsMessageHandler@@SAHXZ @ 21 NONAME ; int TObexUtilsMessageHandler::GetFileSystemStatus(void) - ?NewL@CObexUtilsDialog@@SAPAV1@PAVMObexUtilsDialogObserver@@@Z @ 22 NONAME ; class CObexUtilsDialog * CObexUtilsDialog::NewL(class MObexUtilsDialogObserver *) - ?LaunchQueryDialogL@CObexUtilsDialog@@QAEHABH@Z @ 23 NONAME ; int CObexUtilsDialog::LaunchQueryDialogL(int const &) - ?CreateOutboxEntryL@TObexUtilsMessageHandler@@SAJABVTUid@@ABH@Z @ 24 NONAME ; long TObexUtilsMessageHandler::CreateOutboxEntryL(class TUid const &, int const &) - ?ShowGlobalConfirmationQueryL@TObexUtilsUiLayer@@SAXABH@Z @ 25 NONAME ; void TObexUtilsUiLayer::ShowGlobalConfirmationQueryL(int const &) - ?CreateInboxAttachmentL@TObexUtilsMessageHandler@@SAXAAPAVCObexBufObject@@VTUid@@AAJAAVRFile@@@Z @ 26 NONAME ; void TObexUtilsMessageHandler::CreateInboxAttachmentL(class CObexBufObject * &, class TUid, long &, class RFile &) - ?GetMessageCentreDriveL@TObexUtilsMessageHandler@@SAHXZ @ 27 NONAME ; int TObexUtilsMessageHandler::GetMessageCentreDriveL(void) - ?LaunchEditorApplicationL@TObexUtilsUiLayer@@SAXAAJ@Z @ 28 NONAME ; void TObexUtilsUiLayer::LaunchEditorApplicationL(long &) - ?GetCenRepKeyIntValueL@TObexUtilsMessageHandler@@SAHVTUid@@KAAH@Z @ 29 NONAME ; int TObexUtilsMessageHandler::GetCenRepKeyIntValueL(class TUid, unsigned long, int &) - ?LaunchWaitDialogL@CObexUtilsDialog@@QAEXH@Z @ 30 NONAME ; void CObexUtilsDialog::LaunchWaitDialogL(int) - ?ShowNoteDialogL@CGlobalDialog@@QAEXHH@Z @ 31 NONAME ; void CGlobalDialog::ShowNoteDialogL(int, int) - ?ShowGlobalConfirmationQueryPlainL@TObexUtilsUiLayer@@SAHABH@Z @ 32 NONAME ; int TObexUtilsUiLayer::ShowGlobalConfirmationQueryPlainL(int const &) - ?NewLC@CGlobalProgressDialog@@SAPAV1@PAVMGlobalProgressCallback@@@Z @ 33 NONAME ; class CGlobalProgressDialog * CGlobalProgressDialog::NewLC(class MGlobalProgressCallback *) - ?IsString@CObexUtilsOpaqueData@@QAEHXZ @ 34 NONAME ; int CObexUtilsOpaqueData::IsString(void) - ?CreateReceiveBufferAndRFileL@TObexUtilsMessageHandler@@SAHAAVRFile@@ABVTDesC16@@AAV?$TBuf@$0BAA@@@AAPAVCBufFlat@@H@Z @ 35 NONAME ; int TObexUtilsMessageHandler::CreateReceiveBufferAndRFileL(class RFile &, class TDesC16 const &, class TBuf<256> &, class CBufFlat * &, int) - ?LaunchEditorApplicationOperationL@TObexUtilsUiLayer@@SAPAVCMsvOperation@@AAVCMsvSession@@PAVCMsvEntry@@AAVTRequestStatus@@@Z @ 36 NONAME ; class CMsvOperation * TObexUtilsUiLayer::LaunchEditorApplicationOperationL(class CMsvSession &, class CMsvEntry *, class TRequestStatus &) - ?OperationNotSupported@TObexUtilsUiLayer@@SAHXZ @ 37 NONAME ; int TObexUtilsUiLayer::OperationNotSupported(void) - ?ProcessFinished@CGlobalDialog@@QAEXXZ @ 38 NONAME ; void CGlobalDialog::ProcessFinished(void) - ?UpdateBitmaps@TObexUtilsUiLayer@@SAXVTUid@@AAHAAV?$TBuf@$0BAA@@@11@Z @ 39 NONAME ; void TObexUtilsUiLayer::UpdateBitmaps(class TUid, int &, class TBuf<256> &, int &, int &) - ?ShowErrorDialogL@CGlobalDialog@@QAEXH@Z @ 40 NONAME ; void CGlobalDialog::ShowErrorDialogL(int) - ?ShowProgressDialogL@CGlobalProgressDialog@@QAEXH@Z @ 41 NONAME ; void CGlobalProgressDialog::ShowProgressDialogL(int) - ?ShowNumberOfSendFileL@CObexUtilsDialog@@QAEXHH@Z @ 42 NONAME ; void CObexUtilsDialog::ShowNumberOfSendFileL(int, int) - ?ShowErrorNoteL@TObexUtilsUiLayer@@SAXABH@Z @ 43 NONAME ; void TObexUtilsUiLayer::ShowErrorNoteL(int const &) - ?NewL@CObexUtilsPropertyNotifier@@SAPAV1@PAVMObexUtilsPropertyNotifyHandler@@W4TMemoryPropertyCheckType@@@Z @ 44 NONAME ; class CObexUtilsPropertyNotifier * CObexUtilsPropertyNotifier::NewL(class MObexUtilsPropertyNotifyHandler *, enum TMemoryPropertyCheckType) - ?ShowGlobalFileOpenConfirmationQueryL@TObexUtilsUiLayer@@SAHABHABVTDesC16@@@Z @ 45 NONAME ; int TObexUtilsUiLayer::ShowGlobalFileOpenConfirmationQueryL(int const &, class TDesC16 const &) - ?GetString@CObexUtilsOpaqueData@@QAEHAAV?$TBuf8@$0BAA@@@@Z @ 46 NONAME ; int CObexUtilsOpaqueData::GetString(class TBuf8<256> &) - ?UpdateEntryAttachmentL@TObexUtilsMessageHandler@@SAXAAV?$TBuf@$0BAA@@@PAVCMsvEntry@@@Z @ 47 NONAME ; void TObexUtilsMessageHandler::UpdateEntryAttachmentL(class TBuf<256> &, class CMsvEntry *) - ?NewL@CGlobalDialog@@SAPAV1@PAVMGlobalNoteCallback@@@Z @ 48 NONAME ; class CGlobalDialog * CGlobalDialog::NewL(class MGlobalNoteCallback *) - ?CreateInboxAttachmentL@TObexUtilsMessageHandler@@SAXAAPAVCObexBufObject@@VTUid@@AAJAAVRFile@@ABVTDesC16@@@Z @ 49 NONAME ; void TObexUtilsMessageHandler::CreateInboxAttachmentL(class CObexBufObject * &, class TUid, long &, class RFile &, class TDesC16 const &) - ?NewL@CGlobalProgressDialog@@SAPAV1@PAVMGlobalProgressCallback@@@Z @ 50 NONAME ; class CGlobalProgressDialog * CGlobalProgressDialog::NewL(class MGlobalProgressCallback *) - ?RemoveTemporaryRFileL@TObexUtilsMessageHandler@@SAXABV?$TBuf@$0BAA@@@@Z @ 51 NONAME ; void TObexUtilsMessageHandler::RemoveTemporaryRFileL(class TBuf<256> const &) - ?LaunchProgressDialogL@CObexUtilsDialog@@QAEXPAVMObexUtilsProgressObserver@@HHH@Z @ 52 NONAME ; void CObexUtilsDialog::LaunchProgressDialogL(class MObexUtilsProgressObserver *, int, int, int) - ?DeleteOutboxEntryL@TObexUtilsMessageHandler@@SAXABJ@Z @ 53 NONAME ; void TObexUtilsMessageHandler::DeleteOutboxEntryL(long const &) - ?ContextIcon@TObexUtilsUiLayer@@SAHABVTMsvEntry@@W4TContextMedia@@@Z @ 54 NONAME ; int TObexUtilsUiLayer::ContextIcon(class TMsvEntry const &, enum TContextMedia) - ?SaveFileToFileSystemL@TObexUtilsMessageHandler@@SAXAAPAVCObexBufObject@@VTUid@@AAJAAV?$TBuf@$0BAA@@@AAVRFile@@ABVTDesC16@@@Z @ 55 NONAME ; void TObexUtilsMessageHandler::SaveFileToFileSystemL(class CObexBufObject * &, class TUid, long &, class TBuf<256> &, class RFile &, class TDesC16 const &) - ?ShowInformationNoteL@TObexUtilsUiLayer@@SAXABH@Z @ 56 NONAME ; void TObexUtilsUiLayer::ShowInformationNoteL(int const &) - ?NewLC@CObexUtilsDialog@@SAPAV1@PAVMObexUtilsDialogObserver@@@Z @ 57 NONAME ; class CObexUtilsDialog * CObexUtilsDialog::NewLC(class MObexUtilsDialogObserver *) - ?LaunchEditorApplicationL@TObexUtilsUiLayer@@SAHPAVCMsvEntry@@AAVCMsvSession@@@Z @ 58 NONAME ; int TObexUtilsUiLayer::LaunchEditorApplicationL(class CMsvEntry *, class CMsvSession &) - ?SaveObjToInboxL@TObexUtilsMessageHandler@@SAXAAPAVCObexBufObject@@AAVRFile@@J@Z @ 59 NONAME ; void TObexUtilsMessageHandler::SaveObjToInboxL(class CObexBufObject * &, class RFile &, long) - ?NewLC@CGlobalDialog@@SAPAV1@PAVMGlobalNoteCallback@@@Z @ 60 NONAME ; class CGlobalDialog * CGlobalDialog::NewLC(class MGlobalNoteCallback *) + ?CreateReceiveBufferAndRFileL@TObexUtilsMessageHandler@@SAHAAVRFile@@ABVTDesC16@@AAV?$TBuf@$0BAA@@@AAPAVCBufFlat@@H@Z @ 4 NONAME ; int TObexUtilsMessageHandler::CreateReceiveBufferAndRFileL(class RFile &, class TDesC16 const &, class TBuf<256> &, class CBufFlat * &, int) + ?AddEntryToInboxL@TObexUtilsMessageHandler@@SAXAAJAAV?$TBuf@$0BAA@@@@Z @ 5 NONAME ; void TObexUtilsMessageHandler::AddEntryToInboxL(long &, class TBuf<256> &) + ?CreateDefaultMtmServiceL@TObexUtilsMessageHandler@@SAXVTUid@@@Z @ 6 NONAME ; void TObexUtilsMessageHandler::CreateDefaultMtmServiceL(class TUid) + ?GetCenRepKeyStringValueL@TObexUtilsMessageHandler@@SAHVTUid@@KAAVTDes16@@@Z @ 7 NONAME ; int TObexUtilsMessageHandler::GetCenRepKeyStringValueL(class TUid, unsigned long, class TDes16 &) + ?GetMmcFileSystemStatus@TObexUtilsMessageHandler@@SAHXZ @ 8 NONAME ; int TObexUtilsMessageHandler::GetMmcFileSystemStatus(void) + ?GetPubSubKeyIntValue@TObexUtilsMessageHandler@@SAHVTUid@@IAAH@Z @ 9 NONAME ; int TObexUtilsMessageHandler::GetPubSubKeyIntValue(class TUid, unsigned int, int &) + ?UpdateEntryAttachmentL@TObexUtilsMessageHandler@@SAXAAV?$TBuf@$0BAA@@@PAVCMsvEntry@@@Z @ 10 NONAME ; void TObexUtilsMessageHandler::UpdateEntryAttachmentL(class TBuf<256> &, class CMsvEntry *) + ?CreateInboxAttachmentL@TObexUtilsMessageHandler@@SAXAAPAVCObexBufObject@@VTUid@@AAJAAVRFile@@ABVTDesC16@@@Z @ 11 NONAME ; void TObexUtilsMessageHandler::CreateInboxAttachmentL(class CObexBufObject * &, class TUid, long &, class RFile &, class TDesC16 const &) + ?AddEntryToInboxL@TObexUtilsMessageHandler@@SAXAAJAAV?$TBuf@$0BAA@@@PAV?$RArray@J@@@Z @ 12 NONAME ; void TObexUtilsMessageHandler::AddEntryToInboxL(long &, class TBuf<256> &, class RArray *) + ?RemoveTemporaryRFileL@TObexUtilsMessageHandler@@SAXABV?$TBuf@$0BAA@@@@Z @ 13 NONAME ; void TObexUtilsMessageHandler::RemoveTemporaryRFileL(class TBuf<256> const &) + ?GetFileSystemStatus@TObexUtilsMessageHandler@@SAHXZ @ 14 NONAME ; int TObexUtilsMessageHandler::GetFileSystemStatus(void) + ?DeleteOutboxEntryL@TObexUtilsMessageHandler@@SAXABJ@Z @ 15 NONAME ; void TObexUtilsMessageHandler::DeleteOutboxEntryL(long const &) + ?SaveFileToFileSystemL@TObexUtilsMessageHandler@@SAXAAPAVCObexBufObject@@VTUid@@AAJAAV?$TBuf@$0BAA@@@AAVRFile@@ABVTDesC16@@@Z @ 16 NONAME ; void TObexUtilsMessageHandler::SaveFileToFileSystemL(class CObexBufObject * &, class TUid, long &, class TBuf<256> &, class RFile &, class TDesC16 const &) + ?CreateOutboxEntryL@TObexUtilsMessageHandler@@SAJABVTUid@@ABH@Z @ 17 NONAME ; long TObexUtilsMessageHandler::CreateOutboxEntryL(class TUid const &, int const &) + ?CreateInboxAttachmentL@TObexUtilsMessageHandler@@SAXAAPAVCObexBufObject@@VTUid@@AAJAAVRFile@@@Z @ 18 NONAME ; void TObexUtilsMessageHandler::CreateInboxAttachmentL(class CObexBufObject * &, class TUid, long &, class RFile &) + ?GetMessageCentreDriveL@TObexUtilsMessageHandler@@SAHXZ @ 19 NONAME ; int TObexUtilsMessageHandler::GetMessageCentreDriveL(void) + ?SaveObjToInboxL@TObexUtilsMessageHandler@@SAXAAPAVCObexBufObject@@AAVRFile@@J@Z @ 20 NONAME ; void TObexUtilsMessageHandler::SaveObjToInboxL(class CObexBufObject * &, class RFile &, long) + ?NewL@CObexUtilsPropertyNotifier@@SAPAV1@PAVMObexUtilsPropertyNotifyHandler@@W4TMemoryPropertyCheckType@@@Z @ 21 NONAME ; class CObexUtilsPropertyNotifier * CObexUtilsPropertyNotifier::NewL(class MObexUtilsPropertyNotifyHandler *, enum TMemoryPropertyCheckType) + ?IsString@CObexUtilsOpaqueData@@QAEHXZ @ 22 NONAME ; int CObexUtilsOpaqueData::IsString(void) + ?GetNumber@CObexUtilsOpaqueData@@QAEHAAI@Z @ 23 NONAME ; int CObexUtilsOpaqueData::GetNumber(unsigned int &) + ??0CObexUtilsOpaqueData@@QAE@ABVTDesC8@@@Z @ 24 NONAME ; CObexUtilsOpaqueData::CObexUtilsOpaqueData(class TDesC8 const &) + ?GetString@CObexUtilsOpaqueData@@QAEHAAV?$TBuf8@$0BAA@@@@Z @ 25 NONAME ; int CObexUtilsOpaqueData::GetString(class TBuf8<256> &) + ?LaunchQueryDialogL@CObexUtilsDialog@@QAEXABVTDesC16@@@Z @ 26 NONAME ; void CObexUtilsDialog::LaunchQueryDialogL(class TDesC16 const &) + ?ShowErrorNoteL@CObexUtilsDialog@@QAEXABVTDesC16@@@Z @ 27 NONAME ; void CObexUtilsDialog::ShowErrorNoteL(class TDesC16 const &) + ?NewL@CObexUtilsDialog@@SAPAV1@PAVMObexUtilsDialogObserver@@@Z @ 28 NONAME ; class CObexUtilsDialog * CObexUtilsDialog::NewL(class MObexUtilsDialogObserver *) + ?UpdateProgressNoteL@CObexUtilsDialog@@QAEXHHABVTDesC16@@@Z @ 29 NONAME ; void CObexUtilsDialog::UpdateProgressNoteL(int, int, class TDesC16 const &) + ?CancelWaitDialog@CObexUtilsDialog@@QAEXXZ @ 30 NONAME ; void CObexUtilsDialog::CancelWaitDialog(void) + ?LaunchWaitDialogL@CObexUtilsDialog@@QAEXABVTDesC16@@@Z @ 31 NONAME ; void CObexUtilsDialog::LaunchWaitDialogL(class TDesC16 const &) + ?CancelProgressDialog@CObexUtilsDialog@@QAEXXZ @ 32 NONAME ; void CObexUtilsDialog::CancelProgressDialog(void) + ?LaunchProgressDialogL@CObexUtilsDialog@@QAEXPAVMObexUtilsProgressObserver@@HABVTDesC16@@H@Z @ 33 NONAME ; void CObexUtilsDialog::LaunchProgressDialogL(class MObexUtilsProgressObserver *, int, class TDesC16 const &, int) + ??1CObexUtilsDialog@@UAE@XZ @ 34 NONAME ; CObexUtilsDialog::~CObexUtilsDialog(void) + ?UpdateProgressDialogL@CObexUtilsDialog@@QAEXH@Z @ 35 NONAME ; void CObexUtilsDialog::UpdateProgressDialogL(int) + ?ShowInformationNoteL@CObexUtilsDialog@@QAEXABVTDesC16@@@Z @ 36 NONAME ; void CObexUtilsDialog::ShowInformationNoteL(class TDesC16 const &) + ?NewLC@CObexUtilsDialog@@SAPAV1@PAVMObexUtilsDialogObserver@@@Z @ 37 NONAME ; class CObexUtilsDialog * CObexUtilsDialog::NewLC(class MObexUtilsDialogObserver *) diff -r 91746b151f97 -r 997690c3397a btobexprofiles/obexserviceman/utils/data/Obexutils.hrh --- a/btobexprofiles/obexserviceman/utils/data/Obexutils.hrh Fri Jun 11 13:48:51 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,26 +0,0 @@ -/* -* Copyright (c) 2002, 2003 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: -* -*/ - - -enum -{ - ESendingProgressNote = 1, - EConnectingWaitNote, - EPrintingWaitNote -}; - -// End of File diff -r 91746b151f97 -r 997690c3397a btobexprofiles/obexserviceman/utils/data/Obexutils.rss --- a/btobexprofiles/obexserviceman/utils/data/Obexutils.rss Fri Jun 11 13:48:51 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,532 +0,0 @@ -/* -* Copyright (c) 2002 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 obexutils. -* -* -*/ - - -// RESOURCE IDENTIFIER -NAME OBUT - -// INCLUDES -#include -#include "Obexutils.hrh" -#include -#include -#include -#include -#include - -RESOURCE RSS_SIGNATURE { } - -// RESOURCE DEFINITIONS - -// Popup texts (information notes and error notes) - -// --------------------------------------------------------- -// -// r_ir_connecting -// this is the first shown when the user tries connect to other -// remote device. -// -// --------------------------------------------------------- -// -RESOURCE TBUF r_ir_connecting {buf= qtn_ir_connecting;} - -// --------------------------------------------------------- -// -// r_ir_cannot_establish -// This informs that the IR connection cannot made to other remote device -// for some reason. -// -// --------------------------------------------------------- -// -RESOURCE TBUF r_ir_cannot_establish {buf= qtn_ir_cant_establish_conn;} - -// --------------------------------------------------------- -// -// r_ir_sending_data -// This is shown after the IR connection is made succesfully and we are -// sending message over IR. -// -// --------------------------------------------------------- -// -RESOURCE TBUF r_ir_sending_data {buf= qtn_ir_sending_data;} - -// --------------------------------------------------------- -// -// r_ir_sending_failed -// This is shown when the IR connection is made and some thing goes wrong -// during connection. -// -// --------------------------------------------------------- -// -RESOURCE TBUF r_ir_sending_failed {buf= qtn_ir_sending_failed;} - -// --------------------------------------------------------- -// -// r_ir_data_sent -// This is shown to the user when the message is sended succesfully. -// -// --------------------------------------------------------- -// -RESOURCE TBUF r_ir_data_sent {buf= qtn_ir_data_sent;} - -// --------------------------------------------------------- -// -// r_bt_connecting -// Informs state of Bluetooth connection. -// this is the first shown when the user tries connect to other -// -// --------------------------------------------------------- -// -RESOURCE TBUF r_bt_connecting {buf= qtn_bt_connecting;} - -// --------------------------------------------------------- -// -// r_bt_sending_data -// This is shown after the Bluetooth connection is made succesfully -// and we are sending message over Bluetooth. -// -// --------------------------------------------------------- -// -RESOURCE TBUF r_bt_sending_data {buf= qtn_bt_sending_data;} - -// --------------------------------------------------------- -// -// r_bt_dev_not_avail -// This informs that the Bluetooth connection cannot made to other -// remote device for some reason. -// -// --------------------------------------------------------- -// -RESOURCE TBUF r_bt_dev_not_avail {buf= qtn_bt_dev_not_avail;} - -// --------------------------------------------------------- -// -// r_bt_failed_to_send -// This is shown when the BT connection is made and some thing goes wrong -// during connection. -// -// --------------------------------------------------------- -// -RESOURCE TBUF r_bt_failed_to_send {buf= qtn_bt_failed_to_send;} - -// --------------------------------------------------------- -// -// r_bt_data_sent -// This is shown to the user when the message is sended succesfully via BT. -// -// --------------------------------------------------------- -// -RESOURCE TBUF r_bt_data_sent {buf= qtn_bt_data_sent;} - -// --------------------------------------------------------- -// -// r_bt_not_receive_one -// This is shown when one image could not be sent -// -// --------------------------------------------------------- -// -RESOURCE TBUF r_bt_not_receive_one {buf= qtn_bt_bip_format_not_supported;} - -// --------------------------------------------------------- -// -// r_out_of_memory -// This is shown when not enough memory -// -// --------------------------------------------------------- -// -RESOURCE TBUF r_out_of_memory {buf= qtn_memlo_not_enough_memory;} - -// --------------------------------------------------------- -// -// r_bt_not_receive_all -// This is shown when no images could be sent -// -// --------------------------------------------------------- -// -RESOURCE TBUF r_bt_sent_image_number {buf= qtn_bt_bip_some_files_sent;} -RESOURCE TBUF r_bt_not_receive_any {buf= qtn_bt_bip_no_formats_supported;} - -// Confirmation queries - -// --------------------------------------------------------- -// -// Confirmation query -// __RD_BT_MSG_RENOVATION not flagged -// This is shown when some images could not be sent -// -// --------------------------------------------------------- -// -RESOURCE DIALOG r_bt_not_send_all_query - { - flags = EGeneralQueryFlags; - buttons = R_AVKON_SOFTKEYS_YES_NO; - items = - { - DLG_LINE - { - type = EAknCtQuery; - id = EGeneralQuery; - control = AVKON_CONFIRMATION_QUERY - { - layout = EConfirmationLayout; - label = qtn_bt_bip_not_all_formats_supported; - animation = R_QGN_NOTE_QUERY_ANIM; - }; - } - }; - } - -// --------------------------------------------------------- -// -// Confirmation query -// This is shown when some images are not supported -// -// --------------------------------------------------------- -// -RESOURCE DIALOG r_bt_not_all_supported_query - { - flags = EGeneralQueryFlags; - buttons = R_AVKON_SOFTKEYS_YES_NO; - items = - { - DLG_LINE - { - type = EAknCtQuery; - id = EGeneralQuery; - control = AVKON_CONFIRMATION_QUERY - { - layout = EConfirmationLayout; - label = qtn_bt_bip_not_all_formats_supported; - animation = R_QGN_NOTE_QUERY_ANIM; - }; - } - }; - } - -// --------------------------------------------------------- -// -// Confirmation query for mixed list -// __RD_BT_MSG_RENOVATION flagged -// This is shown when some images could not be sent -// -// --------------------------------------------------------- -// -RESOURCE DIALOG r_bt_not_send_all_query_mixed - { - flags = EGeneralQueryFlags; - buttons = R_AVKON_SOFTKEYS_YES_NO; - items = - { - DLG_LINE - { - type = EAknCtQuery; - id = EGeneralQuery; - control = AVKON_CONFIRMATION_QUERY - { - layout = EConfirmationLayout; - label = qtn_bt_bip_mixed_list; - animation = R_QGN_NOTE_QUERY_ANIM; - }; - } - }; - } - - - -// Notes - -// ----------------------------------------------------------------------------- -// -// r_bt_connecting_wait_note -// -// -// ----------------------------------------------------------------------------- -// -RESOURCE DIALOG r_bt_connecting_wait_note - { - flags = EAknProgressNoteFlags; - buttons = R_AVKON_SOFTKEYS_CANCEL; - items = - { - DLG_LINE - { - type = EAknCtNote; - id = EConnectingWaitNote; - control = AVKON_NOTE - { - layout = EProgressLayout; - singular_label = qtn_bt_connecting; - imageid = EMbmAvkonQgn_note_progress; - imagemask = EMbmAvkonQgn_note_progress_mask; - animation = R_QGN_GRAF_WAIT_BAR_ANIM; - }; - } - }; - } -// ----------------------------------------------------------------------------- -// -// r_ir_connecting_wait_note -// -// -// ----------------------------------------------------------------------------- -// -RESOURCE DIALOG r_ir_connecting_wait_note - { - flags = EAknProgressNoteFlags; - buttons = R_AVKON_SOFTKEYS_CANCEL; - items = - { - DLG_LINE - { - type = EAknCtNote; - id = EConnectingWaitNote; - control = AVKON_NOTE - { - layout = EProgressLayout; - singular_label = qtn_ir_connecting; - imageid = EMbmAvkonQgn_note_progress; - imagemask = EMbmAvkonQgn_note_progress_mask; - }; - } - }; - } - - -// ----------------------------------------------------------------------------- -// -// r_bt_printing_wait_note -// -// -// ----------------------------------------------------------------------------- -// - -// NOTE! The strings in the following resources need to be added into -// localization file, once the UI specification is approved. -// - -RESOURCE DIALOG r_bt_printing_wait_note - { - flags = EAknWaitNoteFlags; - buttons = R_AVKON_SOFTKEYS_CANCEL; - items = - { - DLG_LINE - { - type = EAknCtNote; - id = EPrintingWaitNote; - control = AVKON_NOTE - { - layout = EWaitLayout; - singular_label = "Sending data..."; - animation = R_QGN_GRAF_WAIT_BAR_ANIM; - }; - } - }; - } - -// Skeletons (resources with changing text) - -// ----------------------------------------------------------------------------- -// -// r_sending_progress_note -// -// -// ----------------------------------------------------------------------------- -// -RESOURCE DIALOG r_sending_progress_note - { - flags = EAknProgressNoteFlags; - buttons = R_AVKON_SOFTKEYS_CANCEL; - items = - { - DLG_LINE - { - type = EAknCtNote; - id = ESendingProgressNote; - control = AVKON_NOTE - { - layout = EProgressLayout; - singular_label = qtn_bt_sending_data; - imageid = EMbmAvkonQgn_note_progress; - imagemask = EMbmAvkonQgn_note_progress_mask; - }; - } - }; - } - -// --------------------------------------------------------- -// -// r_ir_failed_to_receive -// This is shown to the user when failing receive file via infrared. -// -// --------------------------------------------------------- -// -RESOURCE TBUF r_ir_failed_to_receive {buf=qtn_ir_failed_to_receive;} - -// --------------------------------------------------------- -// -// qtn_ir_receiving_data -// This is shown to the user when receiving data via IR. -// -// --------------------------------------------------------- -// -RESOURCE TBUF r_ir_receiving_data {buf=qtn_ir_receiving_data;} - -// --------------------------------------------------------- -// -// r_bt_receiving_data -// This is shown after the Bluetooth connection is made succesfully -// and we are receiving message over Bluetooth. -// -// --------------------------------------------------------- -// -RESOURCE TBUF r_bt_receiving_data {buf= qtn_bt_receiving_data;} - -// --------------------------------------------------------- -// -// qtn_bt_failed_to_receive -// This is shown when the BT connection is made and some thing goes wrong -// when receiving data. -// -// --------------------------------------------------------- -// -RESOURCE TBUF r_bt_failed_to_receive {buf= qtn_bt_failed_to_receive;} - -// Other resource texts - -// --------------------------------------------------------- -// -// r_ir_send_progress_sending -// descripes status of item that is currently sending state in the outbox. -// -// --------------------------------------------------------- -// -RESOURCE TBUF r_ir_send_progress_sending {buf= qtn_mce_outbox_status_sending;} - -// --------------------------------------------------------- -// -// r_ir_send_progress_sending -// descripes status of item that is currently sending state in the outbox. -// -// --------------------------------------------------------- -// -RESOURCE TBUF r_bt_send_progress_sending {buf= qtn_mce_outbox_status_sending;} - -// --------------------------------------------------------- -// -// r_ir_send_outbox_sending -// Displayed in the "To/From" section for Ir objects in message centre. -// -// --------------------------------------------------------- -// -RESOURCE TBUF r_ir_send_outbox_sending {buf= qtn_mce_ir_message;} - -// --------------------------------------------------------- -// -// r_bt_send_outbox_sending -// Displayed in the "To/From" section for Ir objects in message centre. -// -// --------------------------------------------------------- -// -RESOURCE TBUF r_bt_send_outbox_sending {buf= qtn_mce_bt_message;} - -// --------------------------------------------------------- -// -// r_message_not_opened -// This is shown, when the user tries open a message that is not -// supported type. -// -// --------------------------------------------------------- -// -RESOURCE TBUF r_message_not_opened {buf= qtn_mce_info_message_not_opened;} - -// --------------------------------------------------------- -// -// r_name_for_invalid_file -// Default invalid filename -// -// --------------------------------------------------------- -// -RESOURCE TBUF r_name_for_invalid_file { buf=qtn_fldr_default_doc_name; } - -// --------------------------------------------------------- -// -// r_bt_to_from_in_inbox -// Displayed in the "To/From" section for Bluetooth objects. -// -// --------------------------------------------------------- -// -RESOURCE TBUF r_bt_to_from_in_inbox { buf=qtn_mce_bt_message; } - -// --------------------------------------------------------- -// -// r_ir_to_from_in_inbox -// Displayed in the "To/From" section for Ir objects. -// -// --------------------------------------------------------- -// -RESOURCE TBUF r_ir_to_from_in_inbox { buf=qtn_mce_ir_message; } - -RESOURCE TBUF r_bt_data_sent2 { buf= "Data sent"; } -RESOURCE TBUF r_bt_failed_to_send2 { buf= "Sending failed"; } -RESOURCE TBUF r_bt_printing_not_supported { buf = "Printer not supported"; } -RESOURCE TBUF r_bt_sending_not_supported {buf = "Unsupported device";} - -RESOURCE TBUF r_bt_saved_single { buf = qtn_bt_saved_single; } -RESOURCE TBUF r_bt_saved_multiple { buf = qtn_bt_saved_multiple; } -RESOURCE TBUF r_bt_saved_search { buf = qtn_bt_saved_search; } -RESOURCE TBUF r_bt_saved_no_memory_card { buf = qtn_bt_saved_no_memory_card; } -RESOURCE TBUF r_bt_saved_link_updated { buf = qtn_bt_saved_link_updated; } -RESOURCE TBUF r_bt_saved_search_update { buf = qtn_bt_saved_search_update; } - -RESOURCE TBUF r_bt_ir_receiving_data_size_kb { buf = qtn_bt_ir_receiving_data_size_kb ; } -RESOURCE TBUF r_bt_ir_receiving_data_size_mb { buf = qtn_bt_ir_receiving_data_size_mb ; } - -RESOURCE TBUF r_bt_ir_receiving_data_no_size { buf = qtn_bt_ir_receiving_data_no_size ; } - -// --------------------------------------------------------- -// -// Confirmation query for mixed list -// __RD_BT_MSG_RENOVATION flagged -// This is shown when some images could not be sent -// -// --------------------------------------------------------- -// -RESOURCE DIALOG r_bt_not_send_all_query_single - { - flags = EGeneralQueryFlags; - buttons = R_AVKON_SOFTKEYS_YES_NO; - items = - { - DLG_LINE - { - type = EAknCtQuery; - id = EGeneralQuery; - control = AVKON_CONFIRMATION_QUERY - { - layout = EConfirmationLayout; - label = qtn_bt_bip_format_not_supported_send; - animation = R_QGN_NOTE_QUERY_ANIM; - }; - } - }; - } - - -// End of File diff -r 91746b151f97 -r 997690c3397a btobexprofiles/obexserviceman/utils/eabi/obexutilsu.DEF --- a/btobexprofiles/obexserviceman/utils/eabi/obexutilsu.DEF Fri Jun 11 13:48:51 2010 +0300 +++ b/btobexprofiles/obexserviceman/utils/eabi/obexutilsu.DEF Wed Jun 23 18:23:52 2010 +0300 @@ -1,63 +1,42 @@ EXPORTS - _ZN13CGlobalDialog15ProcessFinishedEv @ 1 NONAME - _ZN13CGlobalDialog15ShowNoteDialogLEii @ 2 NONAME - _ZN13CGlobalDialog16ShowErrorDialogLEi @ 3 NONAME - _ZN13CGlobalDialog4NewLEP19MGlobalNoteCallback @ 4 NONAME - _ZN13CGlobalDialog5NewLCEP19MGlobalNoteCallback @ 5 NONAME - _ZN16CObexUtilsDialog17CancelWaitDialogLEv @ 6 NONAME - _ZN16CObexUtilsDialog17LaunchWaitDialogLEi @ 7 NONAME - _ZN16CObexUtilsDialog18LaunchQueryDialogLERKi @ 8 NONAME - _ZN16CObexUtilsDialog21CancelProgressDialogLEv @ 9 NONAME - _ZN16CObexUtilsDialog21LaunchProgressDialogLEP26MObexUtilsProgressObserveriii @ 10 NONAME - _ZN16CObexUtilsDialog21ShowNumberOfSendFileLEii @ 11 NONAME - _ZN16CObexUtilsDialog21UpdateProgressDialogLEii @ 12 NONAME - _ZN16CObexUtilsDialog4NewLEP24MObexUtilsDialogObserver @ 13 NONAME - _ZN16CObexUtilsDialog5NewLCEP24MObexUtilsDialogObserver @ 14 NONAME - _ZN17TObexUtilsUiLayer11ContextIconERK9TMsvEntry13TContextMedia @ 15 NONAME - _ZN17TObexUtilsUiLayer12CreateIconsLE4TUidP9CArrayPtrIS1_I10CFbsBitmapEE @ 16 NONAME - _ZN17TObexUtilsUiLayer13ReadResourceLER6TDes16RKi @ 17 NONAME - _ZN17TObexUtilsUiLayer13UpdateBitmapsE4TUidRiR4TBufILi256EES1_S1_ @ 18 NONAME - _ZN17TObexUtilsUiLayer14ShowErrorNoteLERKi @ 19 NONAME - _ZN17TObexUtilsUiLayer15IsBackupRunningEv @ 20 NONAME - _ZN17TObexUtilsUiLayer18LaunchFileManagerLER7TDesC16ii @ 21 NONAME - _ZN17TObexUtilsUiLayer20ShowInformationNoteLERKi @ 22 NONAME - _ZN17TObexUtilsUiLayer21OperationNotSupportedEv @ 23 NONAME - _ZN17TObexUtilsUiLayer24LaunchEditorApplicationLEP9CMsvEntryR11CMsvSession @ 24 NONAME - _ZN17TObexUtilsUiLayer24LaunchEditorApplicationLERl @ 25 NONAME - _ZN17TObexUtilsUiLayer28ShowGlobalConfirmationQueryLERKi @ 26 NONAME - _ZN17TObexUtilsUiLayer33LaunchEditorApplicationOperationLER11CMsvSessionP9CMsvEntryR14TRequestStatus @ 27 NONAME - _ZN17TObexUtilsUiLayer33ShowGlobalConfirmationQueryPlainLERKi @ 28 NONAME - _ZN17TObexUtilsUiLayer36ShowGlobalFileOpenConfirmationQueryLERKiRK7TDesC16 @ 29 NONAME - _ZN20CObexUtilsOpaqueData8IsStringEv @ 30 NONAME - _ZN20CObexUtilsOpaqueData9GetNumberERj @ 31 NONAME - _ZN20CObexUtilsOpaqueData9GetStringER5TBuf8ILi256EE @ 32 NONAME - _ZN20CObexUtilsOpaqueDataC1ERK6TDesC8 @ 33 NONAME - _ZN20CObexUtilsOpaqueDataC2ERK6TDesC8 @ 34 NONAME - _ZN21CGlobalProgressDialog15ProcessFinishedEv @ 35 NONAME - _ZN21CGlobalProgressDialog19ShowProgressDialogLEi @ 36 NONAME - _ZN21CGlobalProgressDialog20UpdateProgressDialogEii @ 37 NONAME - _ZN21CGlobalProgressDialog27ShowProgressDialogNameSizeLER7TDesC16x @ 38 NONAME - _ZN21CGlobalProgressDialog4NewLEP23MGlobalProgressCallback @ 39 NONAME - _ZN21CGlobalProgressDialog5NewLCEP23MGlobalProgressCallback @ 40 NONAME - _ZN24TObexUtilsMessageHandler15SaveObjToInboxLEP14CObexBufObjectRK7TDesC164TUid @ 41 NONAME - _ZN24TObexUtilsMessageHandler15SaveObjToInboxLERP14CObexBufObjectR5RFilel @ 42 NONAME - _ZN24TObexUtilsMessageHandler16AddEntryToInboxLERlR4TBufILi256EE @ 43 NONAME - _ZN24TObexUtilsMessageHandler16AddEntryToInboxLERlR4TBufILi256EEP6RArrayIlE @ 44 NONAME - _ZN24TObexUtilsMessageHandler18CreateOutboxEntryLERK4TUidRKi @ 45 NONAME - _ZN24TObexUtilsMessageHandler18DeleteOutboxEntryLERKl @ 46 NONAME - _ZN24TObexUtilsMessageHandler19GetFileSystemStatusEv @ 47 NONAME - _ZN24TObexUtilsMessageHandler19RemoveInboxEntriesLERP14CObexBufObjectl @ 48 NONAME - _ZN24TObexUtilsMessageHandler20GetPubSubKeyIntValueE4TUidjRi @ 49 NONAME - _ZN24TObexUtilsMessageHandler21GetCenRepKeyIntValueLE4TUidmRi @ 50 NONAME - _ZN24TObexUtilsMessageHandler21RemoveTemporaryRFileLERK4TBufILi256EE @ 51 NONAME - _ZN24TObexUtilsMessageHandler21SaveFileToFileSystemLERP14CObexBufObject4TUidRlR4TBufILi256EER5RFileRK7TDesC16 @ 52 NONAME - _ZN24TObexUtilsMessageHandler22CreateInboxAttachmentLERP14CObexBufObject4TUidRlR5RFile @ 53 NONAME - _ZN24TObexUtilsMessageHandler22CreateInboxAttachmentLERP14CObexBufObject4TUidRlR5RFileRK7TDesC16 @ 54 NONAME - _ZN24TObexUtilsMessageHandler22GetMessageCentreDriveLEv @ 55 NONAME - _ZN24TObexUtilsMessageHandler22GetMmcFileSystemStatusEv @ 56 NONAME - _ZN24TObexUtilsMessageHandler22UpdateEntryAttachmentLER4TBufILi256EEP9CMsvEntry @ 57 NONAME - _ZN24TObexUtilsMessageHandler24CreateDefaultMtmServiceLE4TUid @ 58 NONAME - _ZN24TObexUtilsMessageHandler24GetCenRepKeyStringValueLE4TUidmR6TDes16 @ 59 NONAME - _ZN24TObexUtilsMessageHandler28CreateReceiveBufferAndRFileLER5RFileRK7TDesC16R4TBufILi256EERP8CBufFlati @ 60 NONAME - _ZN26CObexUtilsPropertyNotifier4NewLEP31MObexUtilsPropertyNotifyHandler24TMemoryPropertyCheckType @ 61 NONAME + _ZN24TObexUtilsMessageHandler15SaveObjToInboxLEP14CObexBufObjectRK7TDesC164TUid @ 1 NONAME + _ZN24TObexUtilsMessageHandler15SaveObjToInboxLERP14CObexBufObjectR5RFilel @ 2 NONAME + _ZN24TObexUtilsMessageHandler16AddEntryToInboxLERlR4TBufILi256EE @ 3 NONAME + _ZN24TObexUtilsMessageHandler16AddEntryToInboxLERlR4TBufILi256EEP6RArrayIlE @ 4 NONAME + _ZN24TObexUtilsMessageHandler18CreateOutboxEntryLERK4TUidRKi @ 5 NONAME + _ZN24TObexUtilsMessageHandler18DeleteOutboxEntryLERKl @ 6 NONAME + _ZN24TObexUtilsMessageHandler19GetFileSystemStatusEv @ 7 NONAME + _ZN24TObexUtilsMessageHandler19RemoveInboxEntriesLERP14CObexBufObjectl @ 8 NONAME + _ZN24TObexUtilsMessageHandler20GetPubSubKeyIntValueE4TUidjRi @ 9 NONAME + _ZN24TObexUtilsMessageHandler21GetCenRepKeyIntValueLE4TUidmRi @ 10 NONAME + _ZN24TObexUtilsMessageHandler21RemoveTemporaryRFileLERK4TBufILi256EE @ 11 NONAME + _ZN24TObexUtilsMessageHandler21SaveFileToFileSystemLERP14CObexBufObject4TUidRlR4TBufILi256EER5RFileRK7TDesC16 @ 12 NONAME + _ZN24TObexUtilsMessageHandler22CreateInboxAttachmentLERP14CObexBufObject4TUidRlR5RFile @ 13 NONAME + _ZN24TObexUtilsMessageHandler22CreateInboxAttachmentLERP14CObexBufObject4TUidRlR5RFileRK7TDesC16 @ 14 NONAME + _ZN24TObexUtilsMessageHandler22GetMessageCentreDriveLEv @ 15 NONAME + _ZN24TObexUtilsMessageHandler22GetMmcFileSystemStatusEv @ 16 NONAME + _ZN24TObexUtilsMessageHandler22UpdateEntryAttachmentLER4TBufILi256EEP9CMsvEntry @ 17 NONAME + _ZN24TObexUtilsMessageHandler24CreateDefaultMtmServiceLE4TUid @ 18 NONAME + _ZN24TObexUtilsMessageHandler24GetCenRepKeyStringValueLE4TUidmR6TDes16 @ 19 NONAME + _ZN24TObexUtilsMessageHandler28CreateReceiveBufferAndRFileLER5RFileRK7TDesC16R4TBufILi256EERP8CBufFlati @ 20 NONAME + _ZN26CObexUtilsPropertyNotifier4NewLEP31MObexUtilsPropertyNotifyHandler24TMemoryPropertyCheckType @ 21 NONAME + _ZN20CObexUtilsOpaqueData8IsStringEv @ 22 NONAME + _ZN20CObexUtilsOpaqueData9GetNumberERj @ 23 NONAME + _ZN20CObexUtilsOpaqueData9GetStringER5TBuf8ILi256EE @ 24 NONAME + _ZN20CObexUtilsOpaqueDataC1ERK6TDesC8 @ 25 NONAME + _ZN20CObexUtilsOpaqueDataC2ERK6TDesC8 @ 26 NONAME + _ZN16CObexUtilsDialog14ShowErrorNoteLERK7TDesC16 @ 27 NONAME + _ZN16CObexUtilsDialog16CancelWaitDialogEv @ 28 NONAME + _ZN16CObexUtilsDialog17LaunchWaitDialogLERK7TDesC16 @ 29 NONAME + _ZN16CObexUtilsDialog18LaunchQueryDialogLERK7TDesC16 @ 30 NONAME + _ZN16CObexUtilsDialog19UpdateProgressNoteLEiiRK7TDesC16 @ 31 NONAME + _ZN16CObexUtilsDialog20CancelProgressDialogEv @ 32 NONAME + _ZN16CObexUtilsDialog20ShowInformationNoteLERK7TDesC16 @ 33 NONAME + _ZN16CObexUtilsDialog21LaunchProgressDialogLEP26MObexUtilsProgressObserveriRK7TDesC16i @ 34 NONAME + _ZN16CObexUtilsDialog21UpdateProgressDialogLEi @ 35 NONAME + _ZN16CObexUtilsDialog4NewLEP24MObexUtilsDialogObserver @ 36 NONAME + _ZN16CObexUtilsDialog5NewLCEP24MObexUtilsDialogObserver @ 37 NONAME + _ZN16CObexUtilsDialogD0Ev @ 38 NONAME + _ZN16CObexUtilsDialogD1Ev @ 39 NONAME + _ZN16CObexUtilsDialogD2Ev @ 40 NONAME diff -r 91746b151f97 -r 997690c3397a btobexprofiles/obexserviceman/utils/group/bld.inf --- a/btobexprofiles/obexserviceman/utils/group/bld.inf Fri Jun 11 13:48:51 2010 +0300 +++ b/btobexprofiles/obexserviceman/utils/group/bld.inf Wed Jun 23 18:23:52 2010 +0300 @@ -1,5 +1,5 @@ /* -* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). +* 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" @@ -24,16 +24,15 @@ PRJ_EXPORTS -../inc/obexutilsuilayer.h |../../../inc/obexutilsuilayer.h ../inc/obexutilsdialog.h |../../../inc/obexutilsdialog.h ../inc/obexutilspropertynotifier.h |../../../inc/obexutilspropertynotifier.h -../inc/obexutilsglobalprogressdialog.h |../../../inc/obexutilsglobalprogressdialog.h -../loc/Obexutils.loc MW_LAYER_LOC_EXPORT_PATH(obexutils.loc) +// todo need to remove below line of code and also the loc folder +// once the localisation files are avaialble and in place in epoc32 +../loc/btdialogs_en_GB.qm /epoc32/data/z/resource/qt/translations/btdialogs_en_GB.qm PRJ_MMPFILES obexutils.mmp - // End of File diff -r 91746b151f97 -r 997690c3397a btobexprofiles/obexserviceman/utils/group/obexutils.mmp --- a/btobexprofiles/obexserviceman/utils/group/obexutils.mmp Fri Jun 11 13:48:51 2010 +0300 +++ b/btobexprofiles/obexserviceman/utils/group/obexutils.mmp Wed Jun 23 18:23:52 2010 +0300 @@ -1,5 +1,5 @@ /* -* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). +* 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" @@ -26,34 +26,25 @@ UID 0x10004262 0x101F86AF VENDORID VID_DEFAULT -START RESOURCE ../data/Obexutils.rss -TARGETPATH RESOURCE_FILES_DIR -HEADER -LANGUAGE_IDS -END - OS_LAYER_SYSTEMINCLUDE USERINCLUDE ../inc NON_FOUNDATION_ADAPT_LAYER_SYSTEMINCLUDE - SOURCEPATH ../src -SOURCE obexutilsuilayer.cpp -SOURCE obexutilslaunchwaiter.cpp SOURCE obexutilsdialogtimer.cpp SOURCE obexutilsdialog.cpp SOURCE obexutilsmessagehandler.cpp SOURCE obexutilspropertynotifier.cpp SOURCE obexutilsopaquedata.cpp -SOURCE obexutilsglobalprogressdialog.cpp -SOURCE obexutilsglobaldialog.cpp SOURCE obexutilsentryhandler.cpp SOURCE updatemusiccollection.cpp #ifdef __BT_SAP - SOURCE vMessageHandler.cpp +SOURCE vMessageHandler.cpp #endif SYSTEMINCLUDE ../../../inc ../../../../inc +SYSTEMINCLUDE /epoc32/include/mw/hb/hbwidgets +SYSTEMINCLUDE /epoc32/include/mw/hb/hbcore #ifdef NO101APPDEPFIXES APP_LAYER_SYSTEMINCLUDE #else //NO101APPDEPFIXES @@ -66,37 +57,27 @@ LIBRARY apgrfx.lib LIBRARY apmime.lib -LIBRARY avkon.lib LIBRARY bafl.lib LIBRARY bifu.lib LIBRARY biodb.lib LIBRARY charconv.lib -LIBRARY cone.lib -LIBRARY commonengine.lib -LIBRARY commonui.lib LIBRARY efsrv.lib -LIBRARY eikctl.lib LIBRARY etext.lib LIBRARY euser.lib LIBRARY irobex.lib LIBRARY msgs.lib -LIBRARY aknskins.lib LIBRARY centralrepository.lib -LIBRARY apparc.lib -LIBRARY servicehandler.lib -LIBRARY eikdlg.lib -LIBRARY featmgr.lib -LIBRARY aknnotify.lib -LIBRARY commondialogs.lib LIBRARY platformenv.lib LIBRARY mpxcollectionhelper.lib LIBRARY mpxplaybackutility.lib +LIBRARY hbcore.lib +LIBRARY HbWidgets.lib #ifdef __BT_SAP - LIBRARY smcm.lib - LIBRARY gsmu.lib +LIBRARY smcm.lib +LIBRARY gsmu.lib // SMUT Unbranch - LIBRARY ecom.lib +LIBRARY ecom.lib #endif DEBUGLIBRARY flogger.lib diff -r 91746b151f97 -r 997690c3397a btobexprofiles/obexserviceman/utils/inc/obexutilsdialog.h --- a/btobexprofiles/obexserviceman/utils/inc/obexutilsdialog.h Fri Jun 11 13:48:51 2010 +0300 +++ b/btobexprofiles/obexserviceman/utils/inc/obexutilsdialog.h Wed Jun 23 18:23:52 2010 +0300 @@ -1,5 +1,5 @@ /* -* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). +* 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" @@ -19,16 +19,21 @@ #ifndef COBEXUTILSDIALOG_H #define COBEXUTILSDIALOG_H -// INCLUDES #include -#include -// FORWARD DECLARATIONS -class CAknWaitDialog; +#include +#include +#include +#include + class CObexUtilsDialogTimer; -// CLASS DECLARATION - +enum TButtonId + { + ECancelButton = -1, + EYesButton, + ENoButton + }; /** * An observer interface for asking progress status of an operation using * a progress dialog. @@ -57,10 +62,10 @@ /** * Informs the observer that a dialog has been dismissed. * @since 2.6 + * todo check whether the parameter is required * @param aButtonId The button that was used to dismiss the dialog. - * @return None. */ - virtual void DialogDismissed( TInt aButtonId ) = 0; + virtual void DialogDismissed(TInt aButtonId) = 0; //TInt aButtonId }; @@ -69,7 +74,10 @@ /** * A class for launching and managing dialogs. */ -NONSHARABLE_CLASS( CObexUtilsDialog ) : public CBase, public MProgressDialogCallback +NONSHARABLE_CLASS( CObexUtilsDialog ) : public CBase, + public MHbDeviceProgressDialogObserver, + public MHbDeviceDialogObserver, + public MHbDeviceMessageBoxObserver { public:// Constructors and destructor @@ -89,81 +97,75 @@ public: // New functions + /** * Launches a progress dialog. - * @since 2.6 * @param aObserverPtr A pointer to progress observer. A NULL pointer if the progress dialog is updated manually. - * @param aFinalValue The final value of the operation (progress=100%). - * @param aResId A resource id for the string to be shown in the dialog. + * @param aFileCount Total number of files to be sent. + * @param aDeviceName Device Name to which files to be sent. * @param aTimeoutValue A value telling how often should the dialog be - updated. Relevant only if observer given. - * @return None. + updated. Relevant only if observer is given. */ IMPORT_C void LaunchProgressDialogL( - MObexUtilsProgressObserver* aObserverPtr, TInt aFinalValue, - TInt aResId, TInt aTimeoutValue ); + MObexUtilsProgressObserver* aObserverPtr, TInt aFileCount, + const TDesC& aDeviceName, TInt aTimeoutValue ); + + /** + * Updates the progress dialog with new file information when multiples files are sent. + * @param aFileSize Size of the file to be sent + * @param aFileIndex Index of the file to be sent + * @param aFileName Name of the file to be sent. + */ + IMPORT_C void UpdateProgressNoteL( TInt aFileSize,TInt aFileIndex, const TDesC& aFileName ); /** * Launches a wait dialog. - * @since 2.6 - * @param aResId A resource id for the string to be shown in the dialog. - * @return None. + * @param aDisplayText Text that needs to be displayed. */ - IMPORT_C void LaunchWaitDialogL( TInt aResId ); + IMPORT_C void LaunchWaitDialogL( const TDesC& aDisplayText ); /** * Cancels a wait dialog if one exists. * @since 2.6 * @return None. */ - IMPORT_C void CancelWaitDialogL(); + IMPORT_C void CancelWaitDialog(); /** * Cancels a wait progress dialog if one exists. * @since 2.6 * @return None. */ - IMPORT_C void CancelProgressDialogL(); + IMPORT_C void CancelProgressDialog(); /** - * Updates a progress dialog. Should not be used if the - * MObexUtilsDialogObserver pointer was given. - * @since 2.6 + * Updates a progress dialog with the latest progress value * @param aValue A progress value relative to final value. - * @param aResId A resource id for the string to be shown in the dialog. * @return None */ - IMPORT_C void UpdateProgressDialogL( TInt aValue, TInt aResId ); + IMPORT_C void UpdateProgressDialogL( TInt aProgressValue ); /** * Show a query note - * @param aResourceID A resource id for the note. - * @return User's input - Yes/No + * @param aConfirmText text for the note. + * @return None */ - IMPORT_C TInt LaunchQueryDialogL( const TInt& aResourceID ); - - /** - * Show how many files are sent in case not all images are supported - * @param aSentNum Number of sent files - * @param aTotlNum Number of total files - * return None. - */ - - IMPORT_C void ShowNumberOfSendFileL( TInt aSentNum, TInt aTotalNum ); + IMPORT_C void LaunchQueryDialogL( const TDesC& aConfirmText ); /** - * Prepares dialog for execution - * @param aResourceID Resource ID of the dialog - * @param aDialog Dialog + * Shows an error note. + * @param aTextId A resource id for the note. + * @return None. */ - void PrepareDialogExecuteL( const TInt& aResourceID, CEikDialog* aDialog ); + IMPORT_C void ShowErrorNoteL( const TDesC& aErrorText ); /** - * Check if cover display is enabled - * return True if enabled + * Shows an information note. + * @param aTextId A resource id for the note. + * @return None. */ - TBool IsCoverDisplayL(); + IMPORT_C void ShowInformationNoteL( const TDesC& aInfoText ); public: // New functions (not exported) @@ -174,16 +176,42 @@ void UpdateProgressDialog(); private: // Functions from base classes - + /** - * From MProgressDialogCallback A dialog has been dismissed. - * @param aButtonId The button that was used to dismiss the dialog. + * From MHbDeviceProgressDialogObserver called when dialog is closed by pressing the "cancel" button + * @param aDialog Pointer to dialog that was cancelled. + * @return None. + */ + void ProgressDialogCancelled(const CHbDeviceProgressDialogSymbian* aDialog); + + /** + * From MHbDeviceProgressDialogObserver called when a device progress dialog is has closed + * @param aDialog Pointer to dialog instance that has closed. * @return None. */ - void DialogDismissedL( TInt aButtonId ); - - private: - TInt ExecuteDialogL( const TInt& aResourceID, CEikDialog* aDialog ); + void ProgressDialogClosed(const CHbDeviceProgressDialogSymbian* aDialog ) ; + + /** + * From MHbDeviceDialogObserver called when data is received from a device dialog + * @param aDialog Pointer to dialog instance that has closed. + * @return None. + */ + void DataReceived(CHbSymbianVariantMap& aData); + + /** + * From MHbDeviceDialogObserver called when a device dialog is closed + * @param aData contains data from the dialog plugin. + * @return None. + */ + void DeviceDialogClosed(TInt aCompletionCode); + + /** + * from base class MHbDeviceMessageBoxObserver + * @param aMessageBox Pointer to dialog instance that has closed. + * @param aButton the id of the button the user pressed + */ + void MessageBoxClosed(const CHbDeviceMessageBoxSymbian *aMessageBox, + CHbDeviceMessageBoxSymbian::TButtonId aButton); private: @@ -197,14 +225,40 @@ */ void ConstructL(); + /** + * Add a data item into the given CHbSymbianVariantMap. + * @param aMap the instance to which the data item will be added. + * @param aKey the key of the data item. + * @param aData the value of the data item + * @param aDataType the data-type of the data item + */ + void AddDataL(CHbSymbianVariantMap* aMap, const TDesC& aKey, + const TAny* aData, CHbSymbianVariant::TType aDataType); + + /** + * Creates and shows a message box. + * @param aType the type of the message box to create. + * @param aText the text to be shown in the message box + * @param aObserver the observer that receives the events from the + * message box + * @param aTimeout the timeout value of the message box + */ + CHbDeviceMessageBoxSymbian* CreateAndShowMessageBoxL( + CHbDeviceMessageBoxSymbian::TType aType, + const TDesC& aText, + MHbDeviceMessageBoxObserver* aObserver, + TInt aTimeout ); + private: // Data - CAknProgressDialog* iProgressDialog; - CAknWaitDialog* iWaitDialog; + CHbDeviceDialogSymbian *iProgressDialog; + CHbDeviceProgressDialogSymbian* iWaitDialog; + CHbDeviceMessageBoxSymbian* iMessageBox; + CObexUtilsDialogTimer* iObexDialogTimer; - TInt iResourceFileId; - TInt iProgressDialogResId; - TBool iCoverDisplayEnabled; + TInt iFileIndex; + TInt iFileCount; + RBuf iDeviceName; // Not Owned // diff -r 91746b151f97 -r 997690c3397a btobexprofiles/obexserviceman/utils/inc/obexutilsglobalprogressdialog.h --- a/btobexprofiles/obexserviceman/utils/inc/obexutilsglobalprogressdialog.h Fri Jun 11 13:48:51 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,226 +0,0 @@ -/* -* Copyright (c) 2002 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: Definition of the global progress dialog class -* -*/ - - - - -#ifndef __OBEXUTILS_GLOBAL_PROGRESS_DIALOG__ -#define __OBEXUTILS_GLOBAL_PROGRESS_DIALOG__ - -// INCLUDES -#include -#include -#include -#include // R_QGN_GRAF_WAIT_BAR_ANIM -#include - -#include - -// FORWARD DECLARATIONS -class CAknGlobalProgressDialog; - - -// CLASS DECLARATION - -// Call back for progress bar -NONSHARABLE_CLASS( MGlobalProgressCallback ) - { - public: - virtual void HandleGlobalProgressDialogL( TInt aSoftkey ) = 0; - }; - - - - - -NONSHARABLE_CLASS( CGlobalProgressDialog ) : public CActive -{ - public: // Constructors and destructor - - - /** - * Two-phased constructor. - */ - IMPORT_C static CGlobalProgressDialog* NewLC(MGlobalProgressCallback* aObserver); - IMPORT_C static CGlobalProgressDialog* NewL(MGlobalProgressCallback* aObserver); - - - /** - * Destructor. - */ - virtual ~CGlobalProgressDialog(); - - public: // New functions - - /** - * Sets the icon for this dialog - * @param aIconText Text of the icon - * @param aIconFile File containing icon - * @param aIconId Icon ID - * @param aIconMaskId Icon mask ID - * @return void - */ - void SetIconL( const TDesC& aIconText, const TDesC& aIconFile, - TInt aIconId = 0, TInt aIconMaskId = -1 ); - /** - * Sets the image for the dialog - * @param aImageFile Image filename - * @param aImageId Image ID - * @param aImageMaskId Image mask ID - * @return void - */ - void SetImageL( const TDesC& aImageFile, TInt aImageId = 0, - TInt aImageMaskId = -1 ); - - /** - * Shows the progress dialog - * @return void - */ - IMPORT_C void ShowProgressDialogL(TInt aStringId); - IMPORT_C void ShowProgressDialogNameSizeL( TDesC& aFileName, - TInt64 aFileSize); - - - /** - * Updates the progress dialog - * @param aValue progress bar value - * @param aFinalValue progress bar final value - * @return void - */ - IMPORT_C void UpdateProgressDialog(TInt aValue, TInt aFinalValue); - - /** - * Called to complete the global progress dialog - * @return void - */ - IMPORT_C void ProcessFinished(); - - - protected: // Functions from base classes - - /** - * From CActive Active Object RunL() - */ - virtual void RunL(); - - /** - * From CActive Active Object DoCancel() - */ - virtual void DoCancel(); - - - private: - - /** - * By default constructor is private. - */ - void ConstructL(MGlobalProgressCallback* aObserver); - - /** - * C++ default constructor. - */ - CGlobalProgressDialog(); - - private: //data - CAknGlobalProgressDialog* iProgressDialog; - - MGlobalProgressCallback* iKeyCallback; - CStringResourceReader* iStringResourceReader; - -}; - - - -// Call back for note with animation and without animation -NONSHARABLE_CLASS( MGlobalNoteCallback ) - { - public: - virtual void HandleGlobalNoteDialogL( TInt aSoftkey ) = 0; - }; - - - -NONSHARABLE_CLASS( CGlobalDialog ) : public CActive -{ - public: // Constructors and destructor - - - /** - * Two-phased constructor. - */ - IMPORT_C static CGlobalDialog* NewLC(MGlobalNoteCallback* aObserver); - IMPORT_C static CGlobalDialog* NewL(MGlobalNoteCallback* aObserver); - - - /* - * public functions - */ - IMPORT_C void ShowNoteDialogL( TInt aResourceId, TBool anAnimation); - IMPORT_C void ShowErrorDialogL(TInt aResourceId); - IMPORT_C void ProcessFinished(); - - /** - * Destructor. - */ - virtual ~CGlobalDialog(); - - - protected: // Functions from base classes - - /** - * From CActive Active Object RunL() - */ - virtual void RunL(); - - /** - * From CActive Active Object DoCancel() - */ - virtual void DoCancel(); - - - private: - - /** - * By default constructor is private. - */ - void ConstructL(MGlobalNoteCallback* aObserver); - - /** - * C++ default constructor. - */ - CGlobalDialog(); - - private: //data - - MGlobalNoteCallback* iKeyCallback; - CStringResourceReader* iStringResourceReader; - CAknGlobalNote* iAknGlobalNote; - TInt iWaitNoteID; - -}; - - - - - - - - - - - -#endif // __OBEXUTILS_GLOBAL_PROGRESS_DIALOG__ diff -r 91746b151f97 -r 997690c3397a btobexprofiles/obexserviceman/utils/inc/obexutilslaunchwaiter.h --- a/btobexprofiles/obexserviceman/utils/inc/obexutilslaunchwaiter.h Fri Jun 11 13:48:51 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,139 +0,0 @@ -/* -* Copyright (c) 2002 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 COBEXUTILSLAUNCHWAITER_H -#define COBEXUTILSLAUNCHWAITER_H - -// INCLUDES -#include -#include - -#include -#include -#include - -class CDocumentHandler; - -// CLASS DECLARATION - -/** -* A class waiting for editing of an embedded document to complete. -*/ - -NONSHARABLE_CLASS( CObexUtilsLaunchWaiter ) : public CMsvOperation, public MAknServerAppExitObserver - { - public: // Constructors and destructor - - /** - * Two-phased constructor. - */ - static CObexUtilsLaunchWaiter* NewLC( - CMsvSession& aMsvSession, - CMsvEntry* aMessage, - TRequestStatus& aObserverRequestStatus ); - - /** - * Two-phased constructor. - */ - static CObexUtilsLaunchWaiter* NewL( - CMsvSession& aMsvSession, - CMsvEntry* aMessage, - TRequestStatus& aObserverRequestStatus ); - - /** - * Destructor. - */ - ~CObexUtilsLaunchWaiter(); - - public: // Functions from base classes - - /** - * From MAknServerAppExitObserve Editing has completed. - * @param TInt The exit mode including document state. - * @return None. - */ - void HandleServerAppExit(TInt aReason); - - /** - * From CActive A request has been completed. - * @return None. - */ - void RunL(); - - /** - * From CActive A request has been cancelled. - * @return None. - */ - void DoCancel(); - - /** - * ProgressL - * @return TDesC8&, progress - */ - virtual const TDesC8& ProgressL(); - - private: - - /** - * C++ default constructor. - */ - CObexUtilsLaunchWaiter( - CMsvSession& aMsvSession, - CMsvEntry* aMessage, - TRequestStatus& aObserverRequestStatus ); - - void ConstructL( CMsvEntry* aMessage ); - - /** - * Locate the file used to fix the broken link in Inbox - * @param aFileName the file including full path user selects ( on return ) - * @param anOldFileName old file name including full path saved in attachment. - * @return TBool - */ - TBool LocateFileL(TFileName& aFileName, const TFileName& anOldFileName); - - /** - * Launch Selection dialog for user to locate the file - * @param aFileName the file including full path user selects ( on return ) - * @param anOldFileName old file name excluding full path saved in attachment. - * @return TBool - */ - TBool LaunchFileSelectionDialogL(TFileName& aFileName, const TFileName& anOldFileName); - - /** - * Check the drive if available. - * @param aDriveNumber enum TDriveNumber defined in f32file.h - * @return Symbian error code - */ - TInt CheckDriveL(TDriveNumber aDriveNumber); - - /** - * Check if the file is saved in memory card. - * @param aFileName full path and name of the file - * @return TDriveNumber if saved in E or F drive; - * otherwise KErrNotFound. - */ - TInt CheckIfSaveInMMC(const TFileName& aFileName); - - private: - CDocumentHandler* iDocumentHandler; - }; - -#endif // COBEXUTILSLAUNCHWAITER_H - -// End of File diff -r 91746b151f97 -r 997690c3397a btobexprofiles/obexserviceman/utils/inc/obexutilsuilayer.h --- a/btobexprofiles/obexserviceman/utils/inc/obexutilsuilayer.h Fri Jun 11 13:48:51 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,246 +0,0 @@ -/* -* Copyright (c) 2002 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 COBEXUTILSUILAYER_H -#define COBEXUTILSUILAYER_H - -// INCLUDES -#include -#include -#include -#include -#include -#include - -// CONSTANTS - -const TUid KUidMsgTypeBt = {0x10009ED5}; -const TInt KObexUtilsMaxChar = 80; -const TInt KObexUtilsMaxCharToFromField = 256; - -// Literals for resource location (drive, directory, file) -_LIT( KObexUtilsFileDrive, "z:"); -_LIT( KObexUtilsResourceFileName, "obexutils.rsc" ); - -// Icon file -_LIT( KCommonUiBitmapFile, "MUIU.MBM" ); - -// Cover display -const TInt KEnumStart = 1; // start of enumerations; start after ECmdNone -const TInt KResourceNumberMask = 0x00000FFF; -const TInt KFirstResourceOffset = (R_IR_CONNECTING & KResourceNumberMask); - -class CMsvOperation; - -// DATA TYPES - -enum TContextMedia - { - EBluetooth, - EInfrared, - ENfc - }; - -/** -* Backup status. -* The value is controlled by FileManager -*/ -enum TFileManagerBkupStatusType - { - EFileManagerBkupStatusUnset = 0x00000000, - EFileManagerBkupStatusBackup = 0x00000001, - EFileManagerBkupStatusRestore = 0x00000002 - }; - -// CLASS DECLARATION - -/** -* Utility methods for UI related functionality. -* -*/ -NONSHARABLE_CLASS( TObexUtilsUiLayer ) - { - public: // New functions - - typedef CArrayPtr CBitmapArray; - - /** - * Launches an editor application for the given message. - * @param aMessage The message to be launched in an application. - * @param aSession A message server session. - * @param aObserverRequestStatus Request status of the observer. - * @return MSV operation - */ - IMPORT_C static CMsvOperation* LaunchEditorApplicationOperationL( - CMsvSession& aMsvSession, - CMsvEntry* aMessage, - TRequestStatus& aObserverRequestStatus ); - - /** - * Launches an editor application for the given message. - * @param aMessage The message to be launched in an application. - * @param aSession A message server session. - * @return Symbian OS errorcode. - */ - IMPORT_C static TInt LaunchEditorApplicationL( CMsvEntry* aMessage, - CMsvSession& aSession ); - - /** - * LaunchFileManager by specific path and sort method - * @Since S60 v5.0 - * @param aPath The directory where file manager should open - * @param aSortMethod sort method to sort the files in aPath - * @param isEmbeddedMode indicates start mode for file manager or standalone mode - * @return None - */ - IMPORT_C static void LaunchFileManagerL( TDesC& aPath, TInt aSortMethod, TBool isEmbeddedMode); - - - /** - * Open the file by Launching the suitable S60 application - * @Since S60 v5.0 - * @return None - */ - IMPORT_C static void LaunchEditorApplicationL (TMsvId& aMsvIdParent); - - /** - * Shows an error note. - * @param aResourceID A resource id for the note. - * @return None. - */ - IMPORT_C static void ShowErrorNoteL( const TInt& aResourceID ); - - /** - * Shows an information note. - * @param aResourceID A resource id for the note. - * @return None. - */ - IMPORT_C static void ShowInformationNoteL( const TInt& aResourceID ); - - /** - * Reads contents of a resource into a buffer. - * @parma aBuf The buffer. - * @param aResourceID The id of the resource - * @return None. - */ - IMPORT_C static void ReadResourceL( TDes& aBuf, - const TInt& aResourceID ); - - /** - * Shows an global information note. - * @param aResourceID A resource id for the note. - * @return None. - */ - IMPORT_C static void ShowGlobalConfirmationQueryL( const TInt& aResourceID ); - - /** - * Show global conformation query without animations or tones. - * @Since S60 5.0 - * @aResourceID aREsourceID for loc string - * @return TBool - */ - IMPORT_C static TBool ShowGlobalConfirmationQueryPlainL( const TInt& aResourceID); - - /** - * Show global conformation query - * @Since S60 5.0 - * @aResourceID aREsourceID for loc string - * @aFilePath location for those files received. - * @return TBool - */ - IMPORT_C static TBool ShowGlobalFileOpenConfirmationQueryL( const TInt& aResourceID, const TDesC& aFilePath); - - - - /** - * Returns a resource id for a not supported operation. - * @return The resource id. - */ - IMPORT_C static TInt OperationNotSupported(); - - /** - * Returns an icon for the given context. - * @param aContext The context. - * @param aMedia The used media. - * @return The resource id of the icon. - */ - IMPORT_C static TInt ContextIcon( const TMsvEntry& aContext, - TContextMedia aMedia ); - - /** - * Updates bitmaps accoding to given media. - * @param aMedia The used media. - * @param aNumberOfZoomStates The media. - * @param aBitmapFile The bitmap file. - * @param aStartBitmap The resource id of the start bitmap. - * @param aEndBitmap The resource id of the start bitmap. - * @return None. - */ - IMPORT_C static void UpdateBitmaps( TUid aMedia, - TInt& aNumberOfZoomStates, - TFileName& aBitmapFile, - TInt& aStartBitmap, - TInt& aEndBitmap ); - - /** - * Create icons according to given media - * @param aMedia The used media. - * @param aIconArray The IconArray used by the caller - */ - IMPORT_C static void CreateIconsL( TUid aMedia, CArrayPtr* aIconArrays); - - /** - * Checks if backup process is running - */ - IMPORT_C TBool static IsBackupRunning(); - - /** - * Prepares dialog for execution - * @param aResourceID Resource ID of the dialog - * @param aDialog Dialog - */ - void static PrepareDialogExecuteL( const TInt& aResourceID, CEikDialog* aDialog ); - - /** - * Check if cover display is enabled - * return True if enabled - */ - TBool static IsCoverDisplayL(); - - /** - * Check if process with given id is active now - * return True if is active - */ - TBool static ProcessExists( const TSecureId& aSecureId ); - - /** - * A dummy class for opening CMsvSession. - */ - class CDummySessionObserver : public CBase , public MMsvSessionObserver - { - public: - void HandleSessionEventL( TMsvSessionEvent/*aEvent*/, - TAny* /*aArg1*/, - TAny* /*aArg2*/, - TAny* /*aArg3*/ ) {}; - }; - }; - -#endif // COBEXUTILSUILAYER_H - -// End of File diff -r 91746b151f97 -r 997690c3397a btobexprofiles/obexserviceman/utils/loc/Obexutils.loc --- a/btobexprofiles/obexserviceman/utils/loc/Obexutils.loc Fri Jun 11 13:48:51 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,200 +0,0 @@ -/* -* Copyright (c) 2002 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 the localised strings for obexutils. -* -* -* -*/ - - -// LOCALISATION STRINGS - -// d: descripes status of item that is currently sending state in the outbox. -// l: list_double_graphic_pane_t2 -// -#define qtn_mce_outbox_status_sending "Sending" - -// d: Informs state of IR connection. -// d: this is the first shown when the user tries connect to other -// d: remote device. -// l: popup_note_wait_window -#define qtn_ir_connecting "Connecting via Infrared.." - -// d: This informs that the IR connection cannot made to other remote device -// d: for some reason. -// l: popup_note_window -#define qtn_ir_cant_establish_conn "Cannot establish Infrared connection." - -// d: This is shown after the IR connection is made succesfully and we are -// d: sending message over IR. -// l: popup_note_wait_window -#define qtn_ir_sending_data "Sending message via Infrared..." - -// d: This is shown when the IR connection is made and some thing goes wrong -// d: during connection. -// l: popup_note_window -#define qtn_ir_sending_failed "Failed to send message via Infrared." - -// d: This error note is shown when the Infrared receiving fails for some reason -// l: popup_note_window -#define qtn_ir_failed_to_receive "Receiving failed" - -// d: This is shown to the user when the message is sended succesfully. -// l: popup_note_window -#define qtn_ir_data_sent "Message sent via Infrared!" - -// d: Displayed in the "To/From" section for Ir objects in message centre. -// l: msg_header_pane_t2 -#define qtn_mce_ir_message "Infrared message" - -// d: This is shown, when the user tries open a message that is not -// d: supported type. -// l: popup_note_window -#define qtn_mce_info_message_not_opened "Invalid message, can't be opened" - -// d: Informs state of Bluetooth connection. -// d: this is the first shown when the user tries connect to other -// d: remote device. -// l: popup_note_wait_window -#define qtn_bt_connecting "Connecting..." - -// d: This is shown after the Bluetooth connection is made succesfully -// d: and we are sending message over Bluetooth. -// l: popup_note_wait_window -#define qtn_bt_sending_data "Sending message..." - -// d: This is shown after the Bluetooth connection is made succesfully -// d: and we are receiving message over Bluetooth. -// l: popup_note_wait_window -#define qtn_bt_receiving_data "Receiving message via Bluetooth" - -// d: This wait note is shown when the device is receiving something over the Infrared -// l: popup_note_wait_window -#define qtn_ir_receiving_data "Receiving message via Infrared" - -// d: This informs that the Bluetooth connection cannot made to other -// d: remote device for some reason. -// l: popup_note_window -#define qtn_bt_dev_not_avail "Cannot establish Bluetooth connection" - -// d: This is shown to the user when the message is sended succesfully via BT. -// l: popup_note_window -#define qtn_bt_data_sent "Message sent!" - -// d: This is shown when the BT connection is made and some thing goes wrong -// d: during connection. -// l: popup_note_window -#define qtn_bt_failed_to_send "Failed to send message" - -// d: This error note is shown when the BT receiving fails for some reason -// l: popup_note_window -#define qtn_bt_failed_to_receive "Receiving failed" - -// d: Displayed in the filename section for Ir objects in message centre in -// d: case of the name is corrupted. -// l: list_double_pane_t2_cp2 -// -#define qtn_fldr_default_doc_name "Document" - -// BIP usability improvement - -// d: This is shown when one could not be sent -// l: popup_note_window -#define qtn_bt_bip_format_not_supported "Receiving device does not support this image format." - -// d: This is shown when some images could not be sent -// l: popup_note_window -#define qtn_bt_bip_not_all_formats_supported "Receiving device does not support all needed image formats, Continue?" - -// d: This is shown when sending is finished in case some images are not supported. -// l: popup_note_window -#define qtn_bt_bip_some_files_sent "%0N of %1N images sent!" - -// d: This is shown when no images could be sent -// l: popup_note_window -#define qtn_bt_bip_no_formats_supported "Receiving device does not support the needed image formats." - -//d: This is shown when one could not be sent -//l: popup_note_window -//r: 3.1 -//w: -#define qtn_bt_bip_mixed_list "Receiving device does not support all needed image formats. Send anyway?" - - -// New loc strings for Req. saving file directly to file system. - -//d: This is shown after a single file received. -//l: popup_note_window -//r: 5.0 -#define qtn_bt_saved_single "File saved in %U. Open now?" - -//d: This is shown after a single file received. -//l: popup_note_window -//r: 5.0 -#define qtn_bt_saved_multiple "Files saved in %U. Open now?" - -//d: This is shown when user opens the broken link in inbox. -//l: popup_note_window -//r: 5.0 -#define qtn_bt_saved_search "File not found, would you like to locate it?" - -//d: This is shown when file is originally saved on MMC but mmc is not available. -//l: popup_note_window -//r: 5.0 -#define qtn_bt_saved_no_memory_card "File not found as memory card is not present. Locate file?" - -//d: This is shown when file link is updated. -//l: popup_note_window -//r: 5.0 -#define qtn_bt_saved_link_updated "File link updated" - -//d: This is shown when new selected filename does not match the orignal filename. -//l: popup_note_window -//r: 5.0 -#define qtn_bt_saved_search_update "File names don't match, update link anyway?" - - - -// -- New string added for CR 403-9991 show filename and size while receiving -- - - -//d: This is shown while receiving files via either bluetooth or infrared -//d: and the receiving file size is smaller than a defined limit -//l: popup_note_wait_window -//r: 5.0 -#define qtn_bt_ir_receiving_data_size_kb "Receiving \n%U\n%N kB" - -//d: This is shown while receiving files via either bluetooth or infrared -//d: and the receiving file size is larger than a defined limit -//l: popup_note_wait_window -//r: 5.0 -#define qtn_bt_ir_receiving_data_size_mb "Receiving \n%U\n%N MB" - - -//d: This is shown while receiving files via either bluetooth or infrared -//d: and the receiving file size is unknown -//l: popup_note_wait_window -//r: 5.0 -#define qtn_bt_ir_receiving_data_no_size "Receiving \n%U" - - -// -- New string added for CR 404-4716 Allow sending unsupported image over BT BIP -- - -// d: This is shown when one could not be sent -// l: popup_note_window -// r: 5.0 -#define qtn_bt_bip_format_not_supported_send "Receiving device does not support this image format. Send anyway?" - -// End of File diff -r 91746b151f97 -r 997690c3397a btobexprofiles/obexserviceman/utils/loc/btdialogs_en_GB.qm Binary file btobexprofiles/obexserviceman/utils/loc/btdialogs_en_GB.qm has changed diff -r 91746b151f97 -r 997690c3397a btobexprofiles/obexserviceman/utils/src/obexutilsdialog.cpp --- a/btobexprofiles/obexserviceman/utils/src/obexutilsdialog.cpp Fri Jun 11 13:48:51 2010 +0300 +++ b/btobexprofiles/obexserviceman/utils/src/obexutilsdialog.cpp Wed Jun 23 18:23:52 2010 +0300 @@ -1,5 +1,5 @@ /* -* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). +* 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" @@ -17,18 +17,31 @@ // INCLUDE FILES -#include "obexutilsdialog.h" -#include "obexutilsdialogtimer.h" -#include "obexutilsuilayer.h" -#include -#include -#include -#include -#include -#include -#include -#include -#include "obexutilsdebug.h" +#include "obexutilsdialog.h" +#include "obexutilsdialogtimer.h" +#include "obexutilsdebug.h" +#include +#include +#include + +_LIT(KSendingDialog, "com.nokia.hb.btdevicedialog/1.0"); +_LIT(KCurrentFileIndex,"currentFileIdx" ); +_LIT(KTotalFileCount, "totalFilesCnt"); +_LIT(KDestinationName, "destinationName"); +_LIT(KFileName,"fileName"); +_LIT(KFileSizeTxt,"fileSzTxt"); +_LIT(KFileSize,"fileSz"); +_LIT(KProgressValue,"progressValue"); + +_LIT(KSendingCancelledText, "txt_bt_dpophead_sending_cancelled"); +_LIT(KDeviceText,"txt_bt_dpopinfo_sent_to_1"); + +const TInt KMaxDescriptionLength = 256; +const TInt KMinStringSize = 10; +const TInt KMinFileSize = 1024; + +_LIT(KLocFileName, "btdialogs_"); +_LIT(KPath, "z:/resource/qt/translations/"); // ============================ MEMBER FUNCTIONS =============================== @@ -78,38 +91,29 @@ // User::Leave(KErrArgument); } - - TFileName fileName; - fileName += KObexUtilsFileDrive; - fileName += KDC_RESOURCE_FILES_DIR; - fileName += KObexUtilsResourceFileName; - BaflUtils::NearestLanguageFile( CCoeEnv::Static()->FsSession(), fileName ); - iResourceFileId = CCoeEnv::Static()->AddResourceFileL( fileName ); - - iCoverDisplayEnabled = IsCoverDisplayL(); - FLOG(_L("[OBEXUTILS]\t CObexUtilsDialog::ConstructL() completed")); } // ----------------------------------------------------------------------------- // Destructor // ----------------------------------------------------------------------------- -CObexUtilsDialog::~CObexUtilsDialog() +EXPORT_C CObexUtilsDialog::~CObexUtilsDialog() { FLOG(_L("[OBEXUTILS]\t CObexUtilsDialog::~CObexUtilsDialog()")); - - CCoeEnv::Static()->DeleteResourceFile( iResourceFileId ); + iDeviceName.Close(); + delete iWaitDialog; + delete iProgressDialog; delete iObexDialogTimer; - + delete iMessageBox; FLOG(_L("[OBEXUTILS]\t CObexUtilsDialog::~CObexUtilsDialog() completed")); } // ----------------------------------------------------------------------------- // CObexUtilsDialog::LaunchProgressDialogL // ----------------------------------------------------------------------------- -EXPORT_C void CObexUtilsDialog::LaunchProgressDialogL( - MObexUtilsProgressObserver* aObserverPtr, TInt aFinalValue, - TInt aResId, TInt aTimeoutValue ) +EXPORT_C void CObexUtilsDialog::LaunchProgressDialogL( + MObexUtilsProgressObserver* aObserverPtr, TInt aFileCount, + const TDesC& aDeviceName, TInt aTimeoutValue ) { FLOG(_L("[OBEXUTILS]\t CObexUtilsDialog::LaunchProgressDialogL()")); @@ -119,42 +123,90 @@ // iProgressObserverPtr = aObserverPtr; - if ( iObexDialogTimer ) + if ( !iObexDialogTimer ) { - iObexDialogTimer->Cancel(); - delete iObexDialogTimer; - iObexDialogTimer = NULL; + iObexDialogTimer = CObexUtilsDialogTimer::NewL( this ); } - - iObexDialogTimer = CObexUtilsDialogTimer::NewL( this ); + iObexDialogTimer->Cancel(); iObexDialogTimer->SetTimeout( aTimeoutValue ); } - iProgressDialogResId = aResId; - - iProgressDialog = new( ELeave ) CAknProgressDialog( - ( reinterpret_cast( &iProgressDialog ) ), ETrue ); - PrepareDialogExecuteL( aResId, iProgressDialog ); - iProgressDialog->ExecuteLD( R_SENDING_PROGRESS_NOTE ); + iFileCount = aFileCount; + iDeviceName.Close(); + iDeviceName.CreateL(aDeviceName); + iProgressDialog = CHbDeviceDialogSymbian::NewL(); - HBufC* buf = StringLoader::LoadLC( aResId ); - iProgressDialog->SetTextL( buf->Des() ); - CleanupStack::PopAndDestroy( buf ); + CHbSymbianVariantMap* map = CHbSymbianVariantMap::NewL(); + CleanupStack::PushL(map); + TBuf key; + TInt data = TBluetoothDialogParams::ESend; + key.Num(TBluetoothDialogParams::EDialogType); + AddDataL( map, key, &data, CHbSymbianVariant::EInt ); + iProgressDialog->Show(KSendingDialog(),*map,this); + CleanupStack::PopAndDestroy(map); - iProgressDialog->GetProgressInfoL()->SetFinalValue( aFinalValue ); - iProgressDialog->SetCallback( this ); if ( iProgressObserverPtr ) { iObexDialogTimer->Tickle(); } - FLOG(_L("[OBEXUTILS]\t CObexUtilsDialog::LaunchProgressDialogL() completed")); + FLOG(_L("[OBEXUTILS]\t CObexUtilsDialog::LaunchProgressDialogL() completed")); + } + + +EXPORT_C void CObexUtilsDialog::UpdateProgressNoteL( TInt aFileSize,TInt aFileIndex, const TDesC& aFileName ) + { + FLOG(_L("[OBEXUTILS]\t CObexUtilsDialog::UpdateProgressNoteL()")); + HBufC* key = HBufC::NewL(KMaxDescriptionLength); + CleanupStack::PushL(key); + + CHbSymbianVariantMap* map = CHbSymbianVariantMap::NewL(); + CleanupStack::PushL(map); + + iFileIndex = aFileIndex+1; + key->Des().Copy(KCurrentFileIndex()); + AddDataL( map, *key, &iFileIndex, CHbSymbianVariant::EInt ); + + key->Des().Copy(KTotalFileCount()); + AddDataL( map, *key, &iFileCount, CHbSymbianVariant::EInt ); + + key->Des().Copy(KDestinationName()); + AddDataL( map, *key, &iDeviceName, CHbSymbianVariant::EDes ); + + key->Des().Copy(KFileName()); + AddDataL( map, *key, &aFileName, CHbSymbianVariant::EDes ); + + // todo: localiation is needed for code below: + HBufC* value = HBufC::NewL(KMaxDescriptionLength); + CleanupStack::PushL(value); + key->Des().Copy(KFileSizeTxt()); + value->Des().Zero(); + if(aFileSize < KMinFileSize) + { + value->Des().AppendNum(aFileSize); + value->Des().Append(_L(" Bytes")); + } + else + { + TInt filesize = aFileSize/KMinFileSize; + value->Des().AppendNum(filesize); + value->Des().Append(_L(" KB")); + } + AddDataL( map, *key, value, CHbSymbianVariant::EDes ); + CleanupStack::PopAndDestroy( value ); + + key->Des().Copy(KFileSize()); + AddDataL( map, *key, &aFileSize, CHbSymbianVariant::EInt ); + TInt ret = iProgressDialog->Update(*map); + CleanupStack::PopAndDestroy(map); + CleanupStack::PopAndDestroy(key); + FLOG(_L("[OBEXUTILS]\t CObexUtilsDialog::UpdateProgressNoteL()Completed")); } // ----------------------------------------------------------------------------- // CObexUtilsDialog::LaunchWaitDialogL // ----------------------------------------------------------------------------- -EXPORT_C void CObexUtilsDialog::LaunchWaitDialogL( TInt aResId ) +EXPORT_C void CObexUtilsDialog::LaunchWaitDialogL( const TDesC& aDisplayText ) { FLOG(_L("[OBEXUTILS]\t CObexUtilsDialog::LaunchWaitDialogL()")); @@ -164,13 +216,9 @@ // User::Leave( KErrInUse ); } - - iWaitDialog = new( ELeave ) CAknWaitDialog( - ( reinterpret_cast( &iWaitDialog ) ), EFalse ); - - iWaitDialog->SetCallback( this ); - PrepareDialogExecuteL( aResId, iWaitDialog ); - iWaitDialog->ExecuteLD( aResId ); + iWaitDialog = CHbDeviceProgressDialogSymbian::NewL(CHbDeviceProgressDialogSymbian::EWaitDialog,this); + iWaitDialog->SetTextL(aDisplayText); + iWaitDialog->ShowL(); FLOG(_L("[OBEXUTILS]\t CObexUtilsDialog::LaunchWaitDialogL() completed")); } @@ -178,14 +226,14 @@ // ----------------------------------------------------------------------------- // CObexUtilsDialog::CancelWaitDialogL // ----------------------------------------------------------------------------- -EXPORT_C void CObexUtilsDialog::CancelWaitDialogL() +EXPORT_C void CObexUtilsDialog::CancelWaitDialog() { FLOG(_L("[OBEXUTILS]\t CObexUtilsDialog::CancelWaitDialogL()")); if( iWaitDialog ) { - iWaitDialog->SetCallback(NULL); - iWaitDialog->ProcessFinishedL(); + iWaitDialog->Close(); + delete iWaitDialog; iWaitDialog = NULL; } @@ -195,22 +243,17 @@ // ----------------------------------------------------------------------------- // CObexUtilsDialog::CancelProgressDialogL // ----------------------------------------------------------------------------- -EXPORT_C void CObexUtilsDialog::CancelProgressDialogL() +EXPORT_C void CObexUtilsDialog::CancelProgressDialog() { FLOG(_L("[OBEXUTILS]\t CObexUtilsDialog::CancelProgressDialogL()")); if( iProgressDialog ) { - iProgressDialog->SetCallback(NULL); - iProgressDialog->ProcessFinishedL(); + iProgressDialog->Cancel(); + delete iProgressDialog; iProgressDialog = NULL; - - if ( iObexDialogTimer ) - { - iObexDialogTimer->Cancel(); - delete iObexDialogTimer; - iObexDialogTimer = NULL; - } + delete iObexDialogTimer; + iObexDialogTimer = NULL; } FLOG(_L("[OBEXUTILS]\t CObexUtilsDialog::CancelProgressDialogL() completed")); @@ -219,51 +262,38 @@ // ----------------------------------------------------------------------------- // CObexUtilsDialog::UpdateProgressDialogL // ----------------------------------------------------------------------------- -EXPORT_C void CObexUtilsDialog::UpdateProgressDialogL( TInt aValue, TInt aResId ) +EXPORT_C void CObexUtilsDialog::UpdateProgressDialogL( TInt aProgressValue ) { FLOG(_L("[OBEXUTILS]\t CObexUtilsDialog::UpdateProgressDialogL()")); if ( iProgressDialog ) { - iProgressDialog->GetProgressInfoL()->SetAndDraw( aValue ); + HBufC* key = HBufC::NewL(KMaxDescriptionLength); + CleanupStack::PushL(key); + + CHbSymbianVariantMap* map = CHbSymbianVariantMap::NewL(); + CleanupStack::PushL(map); - HBufC* buf = StringLoader::LoadLC( aResId ); - iProgressDialog->SetTextL( buf->Des() ); - iProgressDialog->LayoutAndDraw(); - CleanupStack::PopAndDestroy( buf ); + key->Des().Copy(KProgressValue()); + AddDataL( map, *key, &aProgressValue, CHbSymbianVariant::EInt ); + + HBufC* value = HBufC::NewL(KMaxDescriptionLength); + CleanupStack::PushL(value); + key->Des().Copy(KCurrentFileIndex()); + value->Des().AppendNum(iFileIndex); + AddDataL( map, *key, value, CHbSymbianVariant::EDes ); + CleanupStack::PopAndDestroy(value); + + TInt ret = iProgressDialog->Update(*map); + + CleanupStack::PopAndDestroy(map); + CleanupStack::PopAndDestroy(key); } FLOG(_L("[OBEXUTILS]\t CObexUtilsDialog::UpdateProgressDialogL() completed")); } // ----------------------------------------------------------------------------- -// CObexUtilsDialog::DialogDismissedL -// ----------------------------------------------------------------------------- -void CObexUtilsDialog::DialogDismissedL( TInt aButtonId ) - { - FLOG(_L("[OBEXUTILS]\t CObexUtilsDialog::DialogDismissedL()")); - - // The dialog has already been deleted by UI framework. - // - if( aButtonId == EAknSoftkeyCancel ) - { - if ( iDialogObserverPtr ) - { - iDialogObserverPtr->DialogDismissed( aButtonId ); - } - - if ( iObexDialogTimer ) - { - iObexDialogTimer->Cancel(); - delete iObexDialogTimer; - iObexDialogTimer = NULL; - } - } - - FLOG(_L("[OBEXUTILS]\t CObexUtilsDialog::DialogDismissedL() completed")); - } - -// ----------------------------------------------------------------------------- // CObexUtilsDialog::UpdateProgressDialog // ----------------------------------------------------------------------------- void CObexUtilsDialog::UpdateProgressDialog() @@ -271,7 +301,7 @@ FLOG(_L("[OBEXUTILS]\t CObexUtilsDialog::UpdateProgressDialog()")); TRAPD( ignoredError, UpdateProgressDialogL( - iProgressObserverPtr->GetProgressStatus(), iProgressDialogResId ) ); + iProgressObserverPtr->GetProgressStatus()) ); if (ignoredError != KErrNone) { @@ -290,70 +320,150 @@ // CObexUtilsDialog::LaunchQueryDialogL // ----------------------------------------------------------------------------- // -EXPORT_C TInt CObexUtilsDialog::LaunchQueryDialogL( const TInt& aResourceID ) +EXPORT_C void CObexUtilsDialog::LaunchQueryDialogL( const TDesC& aConfirmText ) { FLOG(_L("[OBEXUTILS]\t CObexUtilsDialog::LaunchQueryDialogL()")); - - CAknQueryDialog* dlg = CAknQueryDialog::NewL(); - CleanupStack::PushL( dlg ); - PrepareDialogExecuteL( aResourceID, dlg ); - CleanupStack::Pop( dlg ); - TInt keypress = dlg->ExecuteLD( aResourceID ); - - return keypress; + if ( iMessageBox ) + { + //todo: Already one dialog is displayed, currently not supported for + //multiple dialogs at the same time. + User::Leave( KErrGeneral ); + } + iMessageBox = CreateAndShowMessageBoxL( CHbDeviceMessageBoxSymbian::EQuestion, + aConfirmText, this, 0 ); } + // ----------------------------------------------------------------------------- -// CObexUtilsDialog::ShowNumberOfSendFileL +// CObexUtilsUiDialog::ShowErrorNoteL // ----------------------------------------------------------------------------- -// - -EXPORT_C void CObexUtilsDialog::ShowNumberOfSendFileL( TInt aSentNum, TInt aTotalNum ) +EXPORT_C void CObexUtilsDialog::ShowErrorNoteL( const TDesC& aTextId ) { - FLOG(_L("[OBEXUTILS]\t CObexUtilsDialog::ShowNumberOfSendFile()")); - - CAknInformationNote* myNote = new (ELeave) CAknInformationNote(); + FLOG(_L("[OBEXUTILS]\t CObexUtilsUiDialog::ShowErrorNoteL")); + if ( iMessageBox ) + { + //todo: Already one dialog is displayed, currently not supported for + //multiple dialogs at the same time. + User::Leave( KErrGeneral ); + } + iMessageBox = CreateAndShowMessageBoxL( CHbDeviceMessageBoxSymbian::EWarning, + aTextId, this, 0 ); + FLOG(_L("[OBEXUTILS]\t CObexUtilsUiDialog::ShowErrorNoteL completed")); + } - CArrayFix* nums = new( ELeave ) CArrayFixFlat(3); - CleanupStack::PushL(nums); - nums->AppendL(aSentNum); - nums->AppendL(aTotalNum); - CleanupStack::Pop(nums); +// ----------------------------------------------------------------------------- +// CObexUtilsUiDialog::ShowInformationNoteL +// ----------------------------------------------------------------------------- +EXPORT_C void CObexUtilsDialog::ShowInformationNoteL( const TDesC& aTextId ) + { + FLOG(_L("[OBEXUTILS]\t CObexUtilsUiDialog::ShowInformationNoteL")); + if ( iMessageBox ) + { + //todo: Already one dialog is displayed, currently not supported for + //multiple dialogs at the same time. + User::Leave( KErrGeneral ); + } + iMessageBox = CreateAndShowMessageBoxL( CHbDeviceMessageBoxSymbian::EInformation, + aTextId, this, 0 ); + FLOG(_L("[OBEXUTILS]\t CObexUtilsUiDialog::ShowInformationNoteL completed")); + } - HBufC* stringholder = StringLoader::LoadLC( R_BT_SENT_IMAGE_NUMBER, *nums); - PrepareDialogExecuteL( R_BT_SENT_IMAGE_NUMBER, myNote ); - myNote->ExecuteLD( *stringholder ); - CleanupStack::PopAndDestroy( stringholder ); +void CObexUtilsDialog::ProgressDialogCancelled(const CHbDeviceProgressDialogSymbian* aDialog) + { + FLOG(_L("[BTSU]\t CObexUtilsDialog::ProgressDialogCancelled(), cancelled by user")); + (void) aDialog; + if ( iDialogObserverPtr ) + { + iDialogObserverPtr->DialogDismissed(ECancelButton); + } + delete iWaitDialog; + iWaitDialog = NULL; } // ----------------------------------------------------------------------------- -// CObexUtilsDialog::PrepareDialogExecuteL +// CObexUtilsDialog::MessageBoxClosed // ----------------------------------------------------------------------------- -// -void CObexUtilsDialog::PrepareDialogExecuteL( const TInt& aResourceID, CEikDialog* aDialog ) +void CObexUtilsDialog::MessageBoxClosed(const CHbDeviceMessageBoxSymbian *aMessageBox, + CHbDeviceMessageBoxSymbian::TButtonId aButton) + { + FLOG(_L("[OBEXUTILS]\t CObexUtilsUiDialog::MessageBoxClosed")); + (void)aMessageBox; + delete iMessageBox; + iMessageBox = NULL; + if(iDialogObserverPtr) + { + //ETrue if user selects Yes, otherwise EFalse. + iDialogObserverPtr->DialogDismissed( + (aButton == CHbDeviceMessageBoxSymbian::EAcceptButton) ? + EYesButton : ENoButton ); + } + FLOG(_L("[OBEXUTILS]\t CObexUtilsUiDialog::MessageBoxClosed completed")); + } + +void CObexUtilsDialog::ProgressDialogClosed(const CHbDeviceProgressDialogSymbian* aDialog) + { + (void) aDialog; + } + +void CObexUtilsDialog::DataReceived(CHbSymbianVariantMap& aData) { - if (iCoverDisplayEnabled) + (void) aData; + } + +void CObexUtilsDialog::DeviceDialogClosed(TInt aCompletionCode) + { + FLOG(_L("[BTSU]\t CObexUtilsDialog::DeviceDialogClosed()")); + (void) aCompletionCode; + + delete iObexDialogTimer; + iObexDialogTimer = NULL; + delete iProgressDialog; + iProgressDialog = NULL; + + TRAP_IGNORE( + TBool ok = HbTextResolverSymbian::Init(KLocFileName, KPath); + if (!ok) + { + User::Leave( KErrNotFound ); + } + HBufC* deviceName = HbTextResolverSymbian::LoadLC(KDeviceText,iDeviceName); + HBufC* sendText = HbTextResolverSymbian::LoadLC(KSendingCancelledText); + CHbDeviceNotificationDialogSymbian::NotificationL( + KNullDesC, deviceName->Des(), sendText->Des()); + CleanupStack::PopAndDestroy( sendText ); + CleanupStack::PopAndDestroy( deviceName ); + ); + + if ( iDialogObserverPtr ) { - TInt dialogIndex = - ((aResourceID & KResourceNumberMask) - KFirstResourceOffset) + KEnumStart; - aDialog->PublishDialogL( dialogIndex, KObexUtilsCategory ); + iDialogObserverPtr->DialogDismissed(ECancelButton); } } -// ----------------------------------------------------------------------------- -// CObexUtilsDialog::IsCoverDisplayL() -// ----------------------------------------------------------------------------- -// -TBool CObexUtilsDialog::IsCoverDisplayL() +void CObexUtilsDialog::AddDataL(CHbSymbianVariantMap* aMap, const TDesC& aKey, + const TAny* aData, CHbSymbianVariant::TType aDataType) { - TBool coverDisplay = EFalse; - FeatureManager::InitializeLibL(); - if ( FeatureManager::FeatureSupported( KFeatureIdCoverDisplay ) ) - { - coverDisplay = ETrue; - } - FeatureManager::UnInitializeLib(); - return coverDisplay; + CHbSymbianVariant* value = CHbSymbianVariant::NewL(aData, aDataType); + CleanupStack::PushL( value ); + User::LeaveIfError( aMap->Add( aKey, value ) ); // aMap takes the ownership of value + CleanupStack::Pop( value ); + } + +CHbDeviceMessageBoxSymbian* CObexUtilsDialog::CreateAndShowMessageBoxL( + CHbDeviceMessageBoxSymbian::TType aType, + const TDesC& aText, MHbDeviceMessageBoxObserver* aObserver, + TInt aTimeout ) + { + CHbDeviceMessageBoxSymbian* messageBox = + CHbDeviceMessageBoxSymbian::NewL( aType ); + CleanupStack::PushL(messageBox); + //ToDo: Need to use localised strings. + messageBox->SetTextL(aText); + messageBox->SetObserver(aObserver); + messageBox->SetTimeout(aTimeout); + messageBox->ShowL(); + CleanupStack::Pop(messageBox); + return messageBox; } // End of File diff -r 91746b151f97 -r 997690c3397a btobexprofiles/obexserviceman/utils/src/obexutilsglobaldialog.cpp --- a/btobexprofiles/obexserviceman/utils/src/obexutilsglobaldialog.cpp Fri Jun 11 13:48:51 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,169 +0,0 @@ -/* -* Copyright (c) 2002 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: Handles the global progress dialog for voice recognition -* -*/ - - - - - -// INCLUDE FILES - -#include "obexutilsglobalprogressdialog.h" -#include "obexutilsuilayer.h" -#include -#include -#include -#include -#include "obexutilsdebug.h" - - - -// ================= MEMBER FUNCTIONS ======================= - -// C++ default constructor can NOT contain any code, that -// might leave. -// -CGlobalDialog::CGlobalDialog() : CActive(EPriorityNormal) - { - CActiveScheduler::Add( this ); - } - -// Symbian default constructor can leave. -void CGlobalDialog::ConstructL(MGlobalNoteCallback* aObserver) - { - iKeyCallback = aObserver; - iAknGlobalNote = CAknGlobalNote::NewL(); - } - - -// Two-phased constructor. -EXPORT_C CGlobalDialog* CGlobalDialog::NewL(MGlobalNoteCallback* aObserver) - { - CGlobalDialog* self = NewLC(aObserver); - CleanupStack::Pop(); - return self; - } - -// Two-phased constructor.- stack version -EXPORT_C CGlobalDialog* CGlobalDialog::NewLC(MGlobalNoteCallback* aObserver) - { - CGlobalDialog* self=new (ELeave) CGlobalDialog(); - CleanupStack::PushL(self); - self->ConstructL(aObserver); - return self; - } - -EXPORT_C void CGlobalDialog::ShowErrorDialogL(TInt aResourceId) -{ - TFileName fileName; - fileName += KObexUtilsFileDrive; - fileName += KDC_RESOURCE_FILES_DIR; - fileName += KObexUtilsResourceFileName; - - if(!iStringResourceReader) - { - iStringResourceReader= CStringResourceReader::NewL( fileName ); - } - TPtrC buf; - buf.Set(iStringResourceReader-> ReadResourceString(aResourceId)); - iAknGlobalNote->SetSoftkeys(R_AVKON_SOFTKEYS_CLOSE); - iAknGlobalNote->ShowNoteL(iStatus,EAknGlobalInformationNote, buf); - FTRACE( FPrint(_L( "[ObexUtils] CGlobalDialog: ShowNoteDialogL buf: \t %S" ), &buf) ); - SetActive(); - -} -EXPORT_C void CGlobalDialog::ShowNoteDialogL( TInt aResourceId, TBool anAnimation) -{ - TFileName fileName; - fileName += KObexUtilsFileDrive; - fileName += KDC_RESOURCE_FILES_DIR; - fileName += KObexUtilsResourceFileName; - - if(!iStringResourceReader) - { - iStringResourceReader= CStringResourceReader::NewL( fileName ); - } - TPtrC buf; - buf.Set(iStringResourceReader-> ReadResourceString(aResourceId)); - iAknGlobalNote->SetSoftkeys(R_AVKON_SOFTKEYS_CANCEL); - if(anAnimation) - { - iAknGlobalNote->SetAnimation(R_QGN_GRAF_WAIT_BAR_ANIM); - } - iAknGlobalNote->ShowNoteL(iStatus,EAknGlobalWaitNote, buf); - FTRACE( FPrint(_L( "[ObexUtils] CGlobalDialog: ShowNoteDialogL buf: \t %S" ), &buf) ); - SetActive(); - -} - -// Destructor -CGlobalDialog::~CGlobalDialog() - { - Cancel(); - if(iAknGlobalNote) - { - delete iAknGlobalNote; - iAknGlobalNote = NULL; - } - - delete iStringResourceReader; - - } - - - -// --------------------------------------------------------- -// CGlobalDialog::DoCancel -// Active object cancel -// --------------------------------------------------------- -// -void CGlobalDialog::DoCancel() - { - ProcessFinished(); - if(iStringResourceReader) - { - delete iStringResourceReader; - iStringResourceReader = NULL; - } - } - -// --------------------------------------------------------- -// CGlobalDialog::RunL -// Active object RunL -// --------------------------------------------------------- -// -void CGlobalDialog::RunL() - { - - FTRACE( FPrint(_L( "[ObexUtils] CGlobalDialog: RunL iStatus.Int():\t %d" ), iStatus.Int() ) ); - if ( iKeyCallback != NULL ) - { - iKeyCallback->HandleGlobalNoteDialogL(iStatus.Int()); - } - } - -// --------------------------------------------------------- -// CGlobalDialog::ProcessFinished -// Stops the progress dialog -// --------------------------------------------------------- -// -EXPORT_C void CGlobalDialog::ProcessFinished() - { - FLOG( _L( "[ObexUtils] CGlobalDialog::ProcessFinished\t" ) ); - delete iAknGlobalNote; - iAknGlobalNote = NULL; - } - diff -r 91746b151f97 -r 997690c3397a btobexprofiles/obexserviceman/utils/src/obexutilsglobalprogressdialog.cpp --- a/btobexprofiles/obexserviceman/utils/src/obexutilsglobalprogressdialog.cpp Fri Jun 11 13:48:51 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,272 +0,0 @@ -/* -* Copyright (c) 2002 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: Handles the global progress dialog -* -*/ - - - - - -// INCLUDE FILES -#include -#include "obexutilsglobalprogressdialog.h" -#include "obexutilsuilayer.h" -#include -#include -#include -#include -#include -//#include // Compiled resource ids -#include - -#include // Localisation stringloader -#include - -#include "obexutilsdebug.h" - -const TInt KMaxDisplayFileName = 17; // used while showing receiving filename. - // If the filename is longer than 20 bytes, we make it show only 20 bytes. - -// ================= MEMBER FUNCTIONS ======================= - -// C++ default constructor can NOT contain any code, that -// might leave. -// -CGlobalProgressDialog::CGlobalProgressDialog() : CActive(EPriorityNormal) - { - CActiveScheduler::Add( this ); - } - - -// Symbian default constructor can leave. -void CGlobalProgressDialog::ConstructL(MGlobalProgressCallback* aObserver) - { - iProgressDialog = CAknGlobalProgressDialog::NewL(); - iKeyCallback = aObserver; - } - - -// Two-phased constructor. -EXPORT_C CGlobalProgressDialog* CGlobalProgressDialog::NewL(MGlobalProgressCallback* aObserver) - { - CGlobalProgressDialog* self = NewLC(aObserver); - CleanupStack::Pop(); - return self; - } - -// Two-phased constructor.- stack version -EXPORT_C CGlobalProgressDialog* CGlobalProgressDialog::NewLC(MGlobalProgressCallback* aObserver) - { - CGlobalProgressDialog* self=new (ELeave) CGlobalProgressDialog(); - CleanupStack::PushL(self); - self->ConstructL(aObserver); - return self; - } - - -// Destructor -CGlobalProgressDialog::~CGlobalProgressDialog() - { - Cancel(); - delete iProgressDialog; - delete iStringResourceReader; - } - - - -// --------------------------------------------------------- -// CGlobalProgressDialog::DoCancel -// Active object cancel -// --------------------------------------------------------- -// -void CGlobalProgressDialog::DoCancel() - { - if ( iProgressDialog ) - { - iProgressDialog->CancelProgressDialog(); - } - - if(iStringResourceReader) - { - delete iStringResourceReader; - iStringResourceReader = NULL; - } - } - -// --------------------------------------------------------- -// CGlobalProgressDialog::RunL -// Active object RunL -// --------------------------------------------------------- -// -void CGlobalProgressDialog::RunL() - { - if ( iKeyCallback != NULL ) - { - iKeyCallback->HandleGlobalProgressDialogL(iStatus.Int()); - } - } - -// --------------------------------------------------------- -// CGlobalProgressDialog::SetIconL -// Set icon on the dialog -// --------------------------------------------------------- -// -void CGlobalProgressDialog::SetIconL( const TDesC& aIconText, const TDesC& aIconFile, - TInt aIconId, TInt aIconMaskId ) - { - iProgressDialog->SetIconL(aIconText, aIconFile, aIconId, aIconMaskId ); - } - -// --------------------------------------------------------- -// CGlobalProgressDialog::SetImageL -// Set image on the dialog -// --------------------------------------------------------- -// -void CGlobalProgressDialog::SetImageL( const TDesC& aImageFile, TInt aImageId, - TInt aImageMaskId ) - { - iProgressDialog->SetImageL(aImageFile, aImageId, aImageMaskId); - } - - -// --------------------------------------------------------- -// CGlobalProgressDialog::ShowProgressDialogL -// Shows progress dialog and sets active object active -// --------------------------------------------------------- -// -EXPORT_C void CGlobalProgressDialog::ShowProgressDialogL(TInt aStringId) - { - TFileName fileName; - fileName += KObexUtilsFileDrive; - fileName += KDC_RESOURCE_FILES_DIR; - fileName += KObexUtilsResourceFileName; - - if(!iStringResourceReader) - { - iStringResourceReader= CStringResourceReader::NewL( fileName ); - } - TPtrC buf; - //buf.Set(iStringResourceReader-> ReadResourceString(R_BT_RECEIVING_DATA)); - buf.Set(iStringResourceReader-> ReadResourceString(aStringId)); - iProgressDialog->ShowProgressDialogL( iStatus, buf, R_AVKON_SOFTKEYS_HIDE_CANCEL__HIDE ); - //iProgressDialog->ShowProgressDialogL( iStatus, buf, R_BTUI_SOFTKEYS_OPTIONS_EXIT__CHANGE ); //R_OBEXUTILS_SOFTKEYS_HIDE_CANCEL ); - SetActive(); - } - -// --------------------------------------------------------- -// CGlobalProgressDialog::ShowProgressDialogNameSizeL -// Shows progress dialog and sets active object active -// --------------------------------------------------------- -// -EXPORT_C void CGlobalProgressDialog::ShowProgressDialogNameSizeL( - TDesC& aFileName, - TInt64 aFileSize) - { - TFileName fileName; - fileName += KObexUtilsFileDrive; - fileName += KDC_RESOURCE_FILES_DIR; - fileName += KObexUtilsResourceFileName; - - if(!iStringResourceReader) - { - iStringResourceReader= CStringResourceReader::NewL( fileName ); - } - TPtrC buf; - - - TBuf<20> sizeInString; - sizeInString.Zero(); - - if ( aFileSize >> 20 ) // size in MB - { - TReal sizeInMB = 0; - sizeInMB = ((TReal)aFileSize ) / (1024*1024); - _LIT16(KFormatTwoDecimal,"%4.2f"); // keep 2 decimals - sizeInString.Format(KFormatTwoDecimal,sizeInMB); - buf.Set(iStringResourceReader-> ReadResourceString(R_BT_IR_RECEIVING_DATA_SIZE_MB)); - } - else if( aFileSize >> 10 ) // size in KB - { - TInt64 sizeInKB = 0; - sizeInKB = aFileSize >> 10; - sizeInString.AppendNum(sizeInKB); - buf.Set(iStringResourceReader-> ReadResourceString(R_BT_IR_RECEIVING_DATA_SIZE_KB)); - } - else // size is unknown or less than 1K - { - buf.Set(iStringResourceReader-> ReadResourceString(R_BT_IR_RECEIVING_DATA_NO_SIZE)); - } - - - TBuf<100> tbuf; - tbuf.Zero(); - tbuf.Append(buf); - _LIT(KPrefix,"["); - _LIT(Ksuffix,"]"); - TInt prefixPos = tbuf.Find(KPrefix); - if (prefixPos!= KErrNotFound) - { - TInt keyLength = 0; - TInt suffixPos = tbuf.Find(Ksuffix); - keyLength =(tbuf.Mid(prefixPos)).Length()-(tbuf.Mid(suffixPos)).Length()+1; - tbuf.Delete(prefixPos, keyLength); - } - _LIT(KString,"%U"); - - - - if ( aFileName.Length() > KMaxDisplayFileName ) - { - // Filename is too long, - // We make it shorter. Hiding the chars in the middle part of filename. - // - TFileName shortname; - shortname = aFileName.Mid(0,KMaxDisplayFileName/2); - shortname.Append(_L("...")); - shortname.Append(aFileName.Mid(aFileName.Length() - KMaxDisplayFileName/2, KMaxDisplayFileName/2)); - tbuf.Replace(tbuf.Find(KString) , 2, shortname); - } - else - { - tbuf.Replace(tbuf.Find(KString) , 2, aFileName); - } - _LIT(KInt, "%N"); - if ( sizeInString.Length() > 0 ) - { - tbuf.Replace(tbuf.Find(KInt) , 2, sizeInString); - } - - iProgressDialog->ShowProgressDialogL( iStatus, tbuf, R_AVKON_SOFTKEYS_HIDE_CANCEL__HIDE ); - SetActive(); - } -// --------------------------------------------------------- -// CGlobalProgressDialog::UpdateProgressDialog -// Updates the progress dialog -// --------------------------------------------------------- -// -EXPORT_C void CGlobalProgressDialog::UpdateProgressDialog(TInt aValue, TInt aFinalValue) - { - iProgressDialog->UpdateProgressDialog(aValue, aFinalValue); - } - -// --------------------------------------------------------- -// CGlobalProgressDialog::ProcessFinished -// Stops the progress dialog -// --------------------------------------------------------- -// -EXPORT_C void CGlobalProgressDialog::ProcessFinished() - { - iProgressDialog->ProcessFinished(); - } diff -r 91746b151f97 -r 997690c3397a btobexprofiles/obexserviceman/utils/src/obexutilslaunchwaiter.cpp --- a/btobexprofiles/obexserviceman/utils/src/obexutilslaunchwaiter.cpp Fri Jun 11 13:48:51 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,414 +0,0 @@ -/* -* Copyright (c) 2002 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 FILES -#include -#include -#include -#include -#include -#include // for memory and file selection dialogs -#include -#include // for getting drive root path -#include -#include -#include -#include -#include "obexutilslaunchwaiter.h" -#include "obexutilsdebug.h" -#include "obexutilsuilayer.h" // For launching file manager -#include "obexutilsmessagehandler.h" // For updating an entry - -// ============================ MEMBER FUNCTIONS =============================== - -// ----------------------------------------------------------------------------- -// CObexUtilsLaunchWaiter::NewLC -// ----------------------------------------------------------------------------- -CObexUtilsLaunchWaiter* CObexUtilsLaunchWaiter::NewLC( - CMsvSession& aMsvSession, - CMsvEntry* aMessage, - TRequestStatus& aObserverRequestStatus ) - { - CObexUtilsLaunchWaiter* self = new( ELeave )CObexUtilsLaunchWaiter( - aMsvSession, - aMessage, - aObserverRequestStatus ); - CleanupStack::PushL( self ); - self->ConstructL( aMessage ); - return self; - } - -// ----------------------------------------------------------------------------- -// CObexUtilsLaunchWaiter::NewL -// ----------------------------------------------------------------------------- -CObexUtilsLaunchWaiter* CObexUtilsLaunchWaiter::NewL( - CMsvSession& aMsvSession, - CMsvEntry* aMessage, - TRequestStatus& aObserverRequestStatus ) - { - CObexUtilsLaunchWaiter* self = CObexUtilsLaunchWaiter::NewLC( - aMsvSession, - aMessage, - aObserverRequestStatus ); - CleanupStack::Pop( self ); - return self; - } - -// ----------------------------------------------------------------------------- -// CObexUtilsLaunchWaiter::ConstructL -// ----------------------------------------------------------------------------- -void CObexUtilsLaunchWaiter::ConstructL( CMsvEntry* aMessage ) - { - if (aMessage->Count() < 1) - { - User::Leave(KErrOverflow); - } - - CMsvEntry* attachEntry = iMsvSession.GetEntryL(((*aMessage)[0]).Id()); - CleanupStack::PushL(attachEntry); // 1st push - CMsvStore* store = attachEntry->ReadStoreL(); - CleanupStack::PushL(store); // 2nd push - - CMsvAttachment* attachInfo = store->AttachmentManagerL().GetAttachmentInfoL(0); - CleanupStack::PushL(attachInfo); // 3rd push - - TDataType dataType = attachInfo->MimeType(); - TFileName filePath; - filePath = attachInfo->FilePath(); - - TInt error = KErrNone; - TBool isCompleteSelf = EFalse; - CEikonEnv* eikEnv = CEikonEnv::Static(); - - if ( attachInfo->Type() == CMsvAttachment::EMsvFile ) - { - RFile attachFile; - TRAP( error, attachFile = store->AttachmentManagerL().GetAttachmentFileL(0)); - if ( error == KErrNone ) - { - CleanupClosePushL(attachFile); // 4th push - CAiwGenericParamList* paramList = CAiwGenericParamList::NewLC(); // 5th push - TAiwGenericParam paramSave(EGenericParamAllowSave, ETrue); - paramList->AppendL( paramSave ); - - if ( eikEnv ) - { - iDocumentHandler = CDocumentHandler::NewL( eikEnv->Process() ); - iDocumentHandler->SetExitObserver( this ); - TRAP( error, iDocumentHandler->OpenFileEmbeddedL(attachFile, dataType, *paramList)); - }// eikEnv - CleanupStack::PopAndDestroy(2); // paramList, attachFile - } - }// EMsvFile - - if ( attachInfo->Type() == CMsvAttachment::EMsvLinkedFile ) - { - CAiwGenericParamList* paramList = CAiwGenericParamList::NewLC(); // 4th push - TAiwGenericParam paramSave(EGenericParamFileSaved, ETrue); - paramList->AppendL( paramSave ); - - if ( eikEnv ) - { - iDocumentHandler = CDocumentHandler::NewL( eikEnv->Process() ); - iDocumentHandler->SetExitObserver( this ); - RFs rfs; - User::LeaveIfError( rfs.Connect() ); - if ( BaflUtils::FileExists( rfs, filePath ) ) - { - RFile64 shareableFile; - TRAP( error, iDocumentHandler->OpenTempFileL(filePath,shareableFile)); - if ( error == KErrNone) - { - TRAP( error, iDocumentHandler->OpenFileEmbeddedL( shareableFile, dataType, *paramList)); - } - shareableFile.Close(); - - if ( error == KErrNotSupported ) - { - delete iDocumentHandler; - iDocumentHandler = NULL; - - const TInt sortMethod = 2; // 0 = 'By name', 1 = 'By type', - // 2 = 'Most recent first' and 3 = 'Largest first' - TRAP (error, TObexUtilsUiLayer::LaunchFileManagerL( filePath, - sortMethod, - ETrue )); // ETrue -> launch file manager in embedded mode. - isCompleteSelf = ETrue; - } // KErrNotSupported - } - else - { - error = KErrNone; - TFileName fileName; - if (LocateFileL(fileName, filePath)) - { - // Update the entry - TRAP(error, TObexUtilsMessageHandler::UpdateEntryAttachmentL(fileName,aMessage)); - if ( error == KErrNone ) - { - // Show a confirmation note - CAknGlobalNote* note = CAknGlobalNote::NewLC(); - HBufC* stringholder = StringLoader::LoadLC( R_BT_SAVED_LINK_UPDATED ); - note->ShowNoteL(EAknGlobalConfirmationNote, *stringholder); - CleanupStack::PopAndDestroy(2); //note and stringholder - } - } - isCompleteSelf = ETrue; - } - - rfs.Close(); - } // eikEnv - - CleanupStack::PopAndDestroy(); // paramList - } // EMsvLinkedFile - - - // Set message to READ - TMsvEntry entry = aMessage->Entry(); - entry.SetUnread( EFalse ); - aMessage->ChangeL( entry ); - - User::LeaveIfError ( error ); - CleanupStack::PopAndDestroy(3); // attachInfo, store, attachEntry - - iObserverRequestStatus = KRequestPending; // CMsvOperation (observer) - iStatus = KRequestPending; // CMsvOperation - SetActive(); - - if ( isCompleteSelf ) - { - HandleServerAppExit( error ); - } - } - -// ----------------------------------------------------------------------------- -// Destructor -// ----------------------------------------------------------------------------- -CObexUtilsLaunchWaiter::~CObexUtilsLaunchWaiter() - { - Cancel(); - if (iDocumentHandler) - { - delete iDocumentHandler; - iDocumentHandler = NULL; - } - } - -// ----------------------------------------------------------------------------- -// CObexUtilsLaunchWaiter::RunL -// ----------------------------------------------------------------------------- -void CObexUtilsLaunchWaiter::RunL() - { - FLOG(_L("[OBEXUTILS]\t CObexUtilsLaunchWaiter::RunL()")); - - TRequestStatus* status = &iObserverRequestStatus; - User::RequestComplete( status, KErrNone ); - - FLOG(_L("[OBEXUTILS]\t CObexUtilsLaunchWaiter::RunL() completed")); - } - -// ----------------------------------------------------------------------------- -// CObexUtilsLaunchWaiter::DoCancel -// ----------------------------------------------------------------------------- -void CObexUtilsLaunchWaiter::DoCancel() - { - FLOG(_L("[OBEXUTILS]\t CObexUtilsLaunchWaiter::DoCancel()")); - - if ( iStatus == KRequestPending ) - { - TRequestStatus* pstat = &iStatus; - User::RequestComplete( pstat, KErrCancel ); - } - - if( iObserverRequestStatus == KRequestPending ) - { - TRequestStatus* observerStatus = &iObserverRequestStatus; - User::RequestComplete( observerStatus, KErrCancel ); - } - - - FLOG(_L("[OBEXUTILS]\t CObexUtilsLaunchWaiter::DoCancel() completed")); - } - -// ----------------------------------------------------------------------------- -// CObexUtilsLaunchWaiter::CObexUtilsLaunchWaiter -// ----------------------------------------------------------------------------- -CObexUtilsLaunchWaiter::CObexUtilsLaunchWaiter( - CMsvSession& aMsvSession, - CMsvEntry* /*aMessage*/, - TRequestStatus& aObserverRequestStatus ) - : - CMsvOperation(aMsvSession, EPriorityStandard, aObserverRequestStatus), - iDocumentHandler(NULL) - { - FLOG(_L("[OBEXUTILS]\t CObexUtilsLaunchWaiter::CObexUtilsLaunchWaiter()")); - - CActiveScheduler::Add( this ); - - FLOG(_L("[OBEXUTILS]\t CObexUtilsLaunchWaiter::CObexUtilsLaunchWaiter() completed")); - } - -// ----------------------------------------------------------------------------- -// CObexUtilsLaunchWaiter::HandleServerAppExit -// ----------------------------------------------------------------------------- -void CObexUtilsLaunchWaiter::HandleServerAppExit(TInt aReason) - { - FLOG(_L("[OBEXUTILS]\t CObexUtilsLaunchWaiter::HandleServerAppExit()")); - - if( iStatus == KRequestPending ) - { - // Complete self - // - TRequestStatus* status = &iStatus; - User::RequestComplete( status, aReason ); - } - - MAknServerAppExitObserver::HandleServerAppExit( aReason ); - FLOG(_L("[OBEXUTILS]\t CObexUtilsLaunchWaiter::HandleServerAppExit() completed")); - } - -// ----------------------------------------------------------------------------- -// CObexUtilsLaunchWaiter::ProgressL -// ----------------------------------------------------------------------------- -const TDesC8& CObexUtilsLaunchWaiter::ProgressL() - { - return KNullDesC8; - } - -// ----------------------------------------------------------------------------- -// CObexUtilsLaunchWaiter::LocateFile -// ----------------------------------------------------------------------------- -TBool CObexUtilsLaunchWaiter::LocateFileL(TFileName& aFileName, const TFileName& anOldFileName) - { - FLOG(_L("[OBEXUTILS]\t CObexUtilsLaunchWaiter::LocateFile()")); - - TBuf<200> buf; - TRequestStatus status = KRequestPending; - - TParse fileParseOld; - fileParseOld.Set(anOldFileName, NULL, NULL); - TFileName oldName = fileParseOld.NameAndExt(); - - // check old link if the file saved in mmc. If so, check if mmc available. - // if unavailable, show "is File not found as memory card is not present" - // - TInt err = CheckIfSaveInMMC( anOldFileName ); - TBool showMMCOut = EFalse; - if( err == EDriveF) - { - if( CheckDriveL(EDriveF) ) - showMMCOut = ETrue; - } - else if( err == EDriveE ) - { - if( CheckDriveL(EDriveE) ) - showMMCOut = ETrue; - } - - TBool answer = EFalse; - if( showMMCOut ) - { - answer = TObexUtilsUiLayer::ShowGlobalConfirmationQueryPlainL(R_BT_SAVED_NO_MEMORY_CARD); - } - else - { - answer = TObexUtilsUiLayer::ShowGlobalConfirmationQueryPlainL(R_BT_SAVED_SEARCH); - } - - TBool updateLink = EFalse; - if ( answer ) - { - updateLink = LaunchFileSelectionDialogL(aFileName, oldName); - } - - FLOG(_L("[OBEXUTILS]\t CObexUtilsLaunchWaiter::LocateFile() completed")); - return updateLink; - } - -// ----------------------------------------------------------------------------- -// CObexUtilsLaunchWaiter::LaunchFileSelectionDialogL -// ----------------------------------------------------------------------------- -TBool CObexUtilsLaunchWaiter::LaunchFileSelectionDialogL( - TFileName& aFileName, - const TFileName& anOldName) - { - TBuf<200> buf; - TParse fileParseNew; - TFileName nameNew; - TBool updateLink = EFalse; - - while ( !updateLink ) - { - TBool isSelected = AknCommonDialogsDynMem::RunSelectDlgLD( AknCommonDialogsDynMem::EMemoryTypeMMCExternal| - AknCommonDialogsDynMem::EMemoryTypeMMC| - AknCommonDialogsDynMem::EMemoryTypeInternalMassStorage| - AknCommonDialogsDynMem::EMemoryTypePhone, - aFileName, - R_CFD_DEFAULT_SELECT_MEMORY_SELECTION, - R_CFD_DEFAULT_SELECT_FILE_SELECTION ); - - if ( isSelected ) - { - fileParseNew.Set(aFileName, NULL, NULL); - nameNew = fileParseNew.NameAndExt(); - - if ( nameNew.Compare(anOldName)) // names do not match - { - updateLink = TObexUtilsUiLayer::ShowGlobalConfirmationQueryPlainL(R_BT_SAVED_SEARCH_UPDATE); - } - else - { - updateLink = ETrue; - } - } - else - { - break; // Exit from while loop. - } - } - - return updateLink; - } - -// ----------------------------------------------------------------------------- -// CObexUtilsLaunchWaiter::CheckDriveL -// ----------------------------------------------------------------------------- -TInt CObexUtilsLaunchWaiter::CheckDriveL(TDriveNumber aDriveNumber) - { - RFs rfs; - User::LeaveIfError(rfs.Connect()); - CleanupClosePushL( rfs ) ; - TVolumeInfo volumeInfo; - TInt err = rfs.Volume(volumeInfo, aDriveNumber); - CleanupStack::PopAndDestroy(); // rfs - - return err; - } -// ----------------------------------------------------------------------------- -// CObexUtilsLaunchWaiter::CheckIfSaveInMMC -// ----------------------------------------------------------------------------- -TInt CObexUtilsLaunchWaiter::CheckIfSaveInMMC(const TFileName& aFileName) - { - if(aFileName.Find(_L("F:")) != KErrNotFound) - return EDriveF; - if(aFileName.Find(_L("E:")) != KErrNotFound) - return EDriveE; - - return KErrNotFound; - } -// End of File diff -r 91746b151f97 -r 997690c3397a btobexprofiles/obexserviceman/utils/src/obexutilsmessagehandler.cpp --- a/btobexprofiles/obexserviceman/utils/src/obexutilsmessagehandler.cpp Fri Jun 11 13:48:51 2010 +0300 +++ b/btobexprofiles/obexserviceman/utils/src/obexutilsmessagehandler.cpp Wed Jun 23 18:23:52 2010 +0300 @@ -18,7 +18,6 @@ // INCLUDE FILES #include "obexutilsmessagehandler.h" -#include "obexutilsuilayer.h" #include "obexutilsdebug.h" #include "obexutilsentryhandler.h" @@ -28,7 +27,6 @@ #include #include -#include #include #include @@ -50,6 +48,12 @@ // CONSTANT const TInt KFFSBelowCritical = -2; const TInt KRenameOffSet = 4 ; + +// todo @ QT migration: take official definition from Messaging at app layer (btmsgtypeuid.h) +const TUid KUidMsgTypeBt = {0x10009ED5}; + +const TInt KObexUtilsMaxCharToFromField = 256; + // ============================= LOCAL FUNCTIONS =============================== // ----------------------------------------------------------------------------- @@ -468,18 +472,18 @@ // 1st, 2nd, 3rd push TBuf toFrom; - TInt resourceId; + // todo @ QT migration: load from string id for localization if (aMtmId == KUidMsgTypeBt) { - resourceId = R_BT_TO_FROM_IN_INBOX; + _LIT(KBluetoothMsg, "Bluetooth message"); + toFrom.Copy(KBluetoothMsg); } else { - resourceId = R_IR_TO_FROM_IN_INBOX; + _LIT(KInfraredMsg, "Infrared message"); + toFrom.Copy(KInfraredMsg); } - - TObexUtilsUiLayer::ReadResourceL( toFrom, resourceId ); TMsvEntry parentTEntry; parentTEntry.iMtm = aMtmId; @@ -835,19 +839,20 @@ // 1st, 2nd, 3rd push TBuf toFrom; - TInt resourceId; + // todo @ QT migration: load from string id for localization if (aMtmId == KUidMsgTypeBt) { - resourceId = R_BT_TO_FROM_IN_INBOX; + _LIT(KBluetoothMsg, "Bluetooth message"); + toFrom.Copy(KBluetoothMsg); } else { - resourceId = R_IR_TO_FROM_IN_INBOX; + _LIT(KInfraredMsg, "Infrared message"); + toFrom.Copy(KInfraredMsg); } - // NOTE: toFrom will be updated to Bluetooth sender's name - // - TObexUtilsUiLayer::ReadResourceL( toFrom, resourceId ); // read the toForm ( will be updated to sender's bt name in the future ) + + // NOTE: toFrom will be updated to Bluetooth sender's bt name in the future. TMsvEntry parentTEntry; parentTEntry.iMtm = aMtmId; @@ -1147,11 +1152,9 @@ TParse fileParse; fileParse.Set(aFileName, NULL, NULL); - TBool nameempty = ETrue; if (fileParse.NameOrExtPresent()) { aFileName = fileParse.NameAndExt(); - nameempty=EFalse; TText badChar; TInt nameLength = aFileName.Length(); @@ -1174,18 +1177,6 @@ } } } - - // Did we delete all the characters? If so then we must have some filename - if ( aFileName.Length() == 0 || nameempty ) - { - TInt resourceId = R_NAME_FOR_INVALID_FILE; - TRAPD( retVal, TObexUtilsUiLayer::ReadResourceL( aFileName, resourceId ) ); - if (retVal != KErrNone) - { - FLOG(_L("TObexUtilsMessageHandler::MakeValidFileName failed.")); - } - } - FLOG(_L("[OBEXUTILS]\t MakeValidFileName() completed")); } @@ -1195,7 +1186,8 @@ // EXPORT_C TMsvId TObexUtilsMessageHandler::CreateOutboxEntryL( const TUid& aMtm, // Message type id - const TInt& aResourceID ) // Resource id for the message entry text + //todo need to check whether to use the textmap id or send as a string here + const TInt& /*aResourceID*/ ) // Resource id for the message entry text { FLOG(_L("[OBEXUTILS]\t TObexUtilsMessageHandler::CreateOutboxEntryL()")); @@ -1206,7 +1198,9 @@ // 1st, 2nd, 3rd push TBuf toFrom; - TObexUtilsUiLayer::ReadResourceL( toFrom, aResourceID ); + // TObexUtilsUiLayer::ReadResourceL( toFrom, aResourceID ); + //todo need to change the string constant to orbit localisation file + toFrom.Copy(_L("Bluetooth message")); // Message entry fields TMsvEntry newTEntry; diff -r 91746b151f97 -r 997690c3397a btobexprofiles/obexserviceman/utils/src/obexutilsuilayer.cpp --- a/btobexprofiles/obexserviceman/utils/src/obexutilsuilayer.cpp Fri Jun 11 13:48:51 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,628 +0,0 @@ -/* -* Copyright (c) 2002 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 FILES -#include "obexutilsuilayer.h" -#include "obexutilslaunchwaiter.h" -#include "obexutilsdebug.h" - -#include -#include -#include -#include -#include -#include -#ifdef NO101APPDEPFIXES -#include -#else //NO101APPDEPFIXES -enum TMuiuConsts - { - EMbmMuiuQgn_prop_mce_ir_unread = 16402, - EMbmMuiuQgn_prop_mce_ir_unread_mask = 16403, - EMbmMuiuQgn_prop_mce_ir_read = 16404, - EMbmMuiuQgn_prop_mce_ir_read_mask = 16405, - EMbmMuiuQgn_prop_mce_bt_unread = 16406, - EMbmMuiuQgn_prop_mce_bt_unread_mask = 16407, - EMbmMuiuQgn_prop_mce_bt_read = 16408, - EMbmMuiuQgn_prop_mce_bt_read_mask = 16409 - }; -#endif //NO101APPDEPFIXES -#include -#include - -#include -#include - -// Launching file manager related header files -#include // The AIW service handler -#include -#include -#include // Used to launch file manager in embedded mode. -#include //for checking backup status - -//Constants -const TInt KFileManagerUID3 = 0x101F84EB; /// File Manager application UID3 -const TInt KUiNumberOfZoomStates = 2; // second for the mask -const TInt KSortNumMax = 2; -const TInt KNfcUnreadIconIndex = 10; -const TInt KNfcReadIconIndex = 8; - - -// ============================ MEMBER FUNCTIONS =============================== - - -// ----------------------------------------------------------------------------- -// TObexUtilsUiLayer::LaunchEditorApplicationOperationL -// ----------------------------------------------------------------------------- -// -EXPORT_C CMsvOperation* TObexUtilsUiLayer::LaunchEditorApplicationOperationL( - CMsvSession& aMsvSession, - CMsvEntry* aMessage, - TRequestStatus& aObserverRequestStatus ) - { - FLOG(_L("[OBEXUTILS]\t TObexUtilsUiLayer::LaunchEditorApplicationOperationL()")); - CObexUtilsLaunchWaiter* waiterOperation = CObexUtilsLaunchWaiter::NewL( - aMsvSession, - aMessage, - aObserverRequestStatus ); - - return waiterOperation; - } - -// ----------------------------------------------------------------------------- -// TObexUtilsUiLayer::LaunchEditorApplication -// ----------------------------------------------------------------------------- -// -EXPORT_C TInt TObexUtilsUiLayer::LaunchEditorApplicationL( CMsvEntry* /*aMessage*/, - CMsvSession& /*aSession*/ ) - { - // Obsolete - return KErrNotSupported; - } - - -// ----------------------------------------------------------------------------- -// CObexUtilsMessageHandler::LaunchFileManager -// ----------------------------------------------------------------------------- -// -EXPORT_C void TObexUtilsUiLayer::LaunchFileManagerL( - TDesC& aPath, - TInt aSortMethod, - TBool isEmbeddedMode ) - { - if ( isEmbeddedMode ) - { - FLOG(_L("[OBEXUTILS]\t TObexUtilsMessageHandler::LaunchFileManager() Embedded mode")); - - CAiwGenericParamList* inParams = CAiwGenericParamList::NewLC(); - inParams->AppendL(TAiwGenericParam( EGenericParamDir, TAiwVariant( aPath ) ) ); - inParams->AppendL(TAiwGenericParam( EGenericParamDir, TAiwVariant( aSortMethod ) ) ); - - CAknLaunchAppService* launchService = CAknLaunchAppService::NewL(TUid::Uid( KFileManagerUID3 ), // Use File Manager app UID directly - NULL, - inParams ); - CleanupStack::PopAndDestroy( inParams ); - FLOG(_L("[OBEXUTILS]\t TObexUtilsMessageHandler::LaunchFileManager() Embedded mode completed ")); - } - else - { - FLOG(_L("[OBEXUTILS]\t TObexUtilsMessageHandler::LaunchFileManager() ")); - TApaAppInfo appInfo; - RApaLsSession apaLsSession; - User::LeaveIfError( apaLsSession.Connect() ); - CleanupClosePushL( apaLsSession ); - User::LeaveIfError( apaLsSession.GetAppInfo( appInfo, TUid::Uid( KFileManagerUID3 ) ) ); // Use File Manager app UID directly - CApaCommandLine* apaCmdLine = CApaCommandLine::NewLC(); - apaCmdLine->SetExecutableNameL( appInfo.iFullName ); - apaCmdLine->SetCommandL( EApaCommandOpen ); - apaCmdLine->SetDocumentNameL( aPath ); - TBuf8 sortMode; - sortMode.AppendNum( aSortMethod ); - apaCmdLine->SetTailEndL( sortMode ); - TThreadId dummy; - User::LeaveIfError( apaLsSession.StartApp( *apaCmdLine, dummy ) ); - CleanupStack::PopAndDestroy( apaCmdLine ); - CleanupStack::PopAndDestroy( &apaLsSession ); - FLOG(_L("[OBEXUTILS]\t TObexUtilsMessageHandler::LaunchFileManager() standalone mode completed ")); - } - } - -// ----------------------------------------------------------------------------- -// CObexUtilsMessageHandler::LaunchEditorApplication -// ----------------------------------------------------------------------------- -// -EXPORT_C void TObexUtilsUiLayer::LaunchEditorApplicationL (TMsvId& aMsvIdParent) - { - FLOG(_L("[OBEXUTILS]\t TObexUtilsMessageHandler::LaunchEditorApplication() ")); - CDummySessionObserver* sessionObs = new( ELeave )CDummySessionObserver; - CleanupStack::PushL( sessionObs ); //1st push - CMsvSession* msvSession = CMsvSession::OpenSyncL( *sessionObs ); - CleanupStack::PushL( msvSession ); //2nd push - - // 1st, 2nd push? - CMsvEntry* parentEntry = msvSession->GetEntryL(aMsvIdParent); - CleanupStack::PushL(parentEntry); // 3th push - - TRequestStatus status = KRequestPending; - CObexUtilsLaunchWaiter* waiterOperation = CObexUtilsLaunchWaiter::NewL( - *msvSession, - parentEntry, - status); - CleanupStack::PopAndDestroy(3); // parentEntry, sessionObs, msvSession - - FLOG(_L("[OBEXUTILS]\t TObexUtilsMessageHandler::LaunchEditorApplication() completed ")); - } - - -// ----------------------------------------------------------------------------- -// TObexUtilsUiLayer::ShowErrorNoteL -// ----------------------------------------------------------------------------- -// -EXPORT_C void TObexUtilsUiLayer::ShowErrorNoteL( const TInt& aResourceID ) - { - FLOG(_L("[OBEXUTILS]\t TObexUtilsUiLayer::ShowErrorNoteL()")); - - TBuf textdata; - ReadResourceL( textdata, aResourceID ); - - CAknErrorNote* note = new( ELeave )CAknErrorNote( ETrue ); - CleanupStack::PushL( note ); - PrepareDialogExecuteL( aResourceID, note ); - CleanupStack::Pop( note ); - note->ExecuteLD( textdata ); - - FLOG(_L("[OBEXUTILS]\t TObexUtilsUiLayer::ShowErrorNoteL() completed")); - - } - -// ----------------------------------------------------------------------------- -// TObexUtilsUiLayer::ShowInformationNoteL -// ----------------------------------------------------------------------------- -// -EXPORT_C void TObexUtilsUiLayer::ShowInformationNoteL( const TInt& aResourceID ) - { - FLOG(_L("[OBEXUTILS]\t TObexUtilsUiLayer::ShowInformationNoteL()")); - - TBuf textdata; - ReadResourceL( textdata, aResourceID ); - - CAknInformationNote* note = new( ELeave )CAknInformationNote; - CleanupStack::PushL( note ); - PrepareDialogExecuteL( aResourceID, note ); - CleanupStack::Pop( note ); - note->ExecuteLD( textdata ); - - FLOG(_L("[OBEXUTILS]\t TObexUtilsUiLayer::ShowInformationNoteL() completed")); - } - -// ----------------------------------------------------------------------------- -// TObexUtilsUiLayer::ShowGlobalInformationNoteL -// ----------------------------------------------------------------------------- -// -EXPORT_C void TObexUtilsUiLayer::ShowGlobalConfirmationQueryL( const TInt& aResourceID ) - { - FLOG(_L("[OBEXUTILS]\t TObexUtilsUiLayer::ShowGlobalInformationNoteL()")); - - TBuf textdata; - TRequestStatus status; - - ReadResourceL( textdata, aResourceID ); - CAknGlobalConfirmationQuery* note = CAknGlobalConfirmationQuery::NewLC(); - - status=KRequestPending; - note->ShowConfirmationQueryL(status, - textdata, - R_AVKON_SOFTKEYS_OK_EMPTY, - R_QGN_NOTE_ERROR_ANIM,KNullDesC, - 0, - 0, - CAknQueryDialog::EErrorTone - ); - User::WaitForRequest(status); - - CleanupStack::PopAndDestroy(note ); - - FLOG(_L("[OBEXUTILS]\t TObexUtilsUiLayer::ShowGlobalInformationNoteL() completed")); - } - -// ----------------------------------------------------------------------------- -// TObexUtilsUiLayer::ShowGlobalConfirmationQueryPlainL -// ----------------------------------------------------------------------------- -// -EXPORT_C TBool TObexUtilsUiLayer::ShowGlobalConfirmationQueryPlainL( const TInt& aResourceID) - { - CAknGlobalConfirmationQuery* pQ = CAknGlobalConfirmationQuery::NewL(); - CleanupStack::PushL(pQ); - HBufC* stringholder = NULL; - stringholder = StringLoader::LoadLC( aResourceID); - TRequestStatus status = KRequestPending; - pQ->ShowConfirmationQueryL(status,*stringholder,R_AVKON_SOFTKEYS_YES_NO); - User::WaitForRequest(status); - CleanupStack::PopAndDestroy(2);//PQ and Stringholder - return (status.Int() == EAknSoftkeyYes); - } - - -// ----------------------------------------------------------------------------- -// TObexUtilsUiLayer::ShowGlobalFileOpenConfirmationQueryL -// ----------------------------------------------------------------------------- -// -EXPORT_C TBool TObexUtilsUiLayer::ShowGlobalFileOpenConfirmationQueryL( const TInt& aResourceID, const TDesC& aFilePath) - { - // Read string from resource file - TFileName fileName; - fileName += KObexUtilsFileDrive; - fileName += KDC_RESOURCE_FILES_DIR; - fileName += KObexUtilsResourceFileName; - - CStringResourceReader* stringResourceReader = CStringResourceReader::NewL(fileName); - CleanupStack::PushL(stringResourceReader); - const TDesC& resString = stringResourceReader->ReadResourceString(aResourceID); - RBuf manipString; - manipString.Assign(resString.AllocL()); - CleanupStack::PopAndDestroy(stringResourceReader); - manipString.CleanupClosePushL(); - - // Remove bracket section - _LIT(KPrefix, "["); - _LIT(KSuffix, "]"); - TInt prefixPos = manipString.Find(KPrefix); - if (prefixPos != KErrNotFound) - { - TInt keyLength = 0; - TInt suffixPos = manipString.Find(KSuffix); - keyLength = (manipString.Mid(prefixPos)).Length()-(manipString.Mid(suffixPos)).Length()+1; - manipString.Delete(prefixPos, keyLength); - } - - // Replace "%U" string parameter with file path - _LIT(KString, "%U"); - TInt replacePos = manipString.Find(KString); - if( replacePos == KErrNotFound ) - { - User::Leave(KErrNotFound); - } - const TInt minRequiredSize = manipString.Length() - KString().Length() + aFilePath.Length(); - // ensure that the buffer is big enough (otherwise re-alloc) - if(manipString.MaxLength() < minRequiredSize) - { - manipString.ReAllocL(minRequiredSize); - } - manipString.Replace(replacePos, KString().Length(), aFilePath); - - // Initiate query dialog - TRequestStatus status = KRequestPending; - - CAknGlobalConfirmationQuery* pQ = CAknGlobalConfirmationQuery::NewL(); - CleanupStack::PushL(pQ); - pQ->ShowConfirmationQueryL(status, manipString, R_AVKON_SOFTKEYS_YES_NO); - User::WaitForRequest(status); - CleanupStack::PopAndDestroy(2, &manipString); // pQ, manipString - return (status.Int() == EAknSoftkeyYes); - } - - -// ----------------------------------------------------------------------------- -// TObexUtilsUiLayer::ReadResourceL -// ----------------------------------------------------------------------------- -// -EXPORT_C void TObexUtilsUiLayer::ReadResourceL( TDes& aBuf, const TInt& aResourceID ) - { - FLOG(_L("[OBEXUTILS]\t TObexUtilsUiLayer::ReadResourceL()")); - - RFs fileSession; - CleanupClosePushL( fileSession ); - User::LeaveIfError( fileSession.Connect() ); - - TFileName fileName; - fileName += KObexUtilsFileDrive; - fileName += KDC_RESOURCE_FILES_DIR; - fileName += KObexUtilsResourceFileName; - - BaflUtils::NearestLanguageFile( fileSession, fileName ); - - RResourceFile resourcefile; - CleanupClosePushL( resourcefile ); - resourcefile.OpenL( fileSession, fileName ); - resourcefile.ConfirmSignatureL( 0 ); - HBufC8* readBuffer = resourcefile.AllocReadLC( aResourceID ); - - const TPtrC16 ptrReadBuffer( (TText16*) readBuffer->Ptr(),( readBuffer->Length() + 1 ) >> 1 ); - HBufC16* textBuffer=HBufC16::NewLC( ptrReadBuffer.Length() ); - *textBuffer = ptrReadBuffer; - aBuf.Copy( *textBuffer ); - - CleanupStack::PopAndDestroy( 4 ); // textBuffer, fileSession, resourcefile, readBuffer - - FLOG(_L("[OBEXUTILS]\t TObexUtilsUiLayer::ReadResourceL() completed")); - } - -// ----------------------------------------------------------------------------- -// TObexUtilsUiLayer::OperationNotSupported -// ----------------------------------------------------------------------------- -// -EXPORT_C TInt TObexUtilsUiLayer::OperationNotSupported() - { - return R_EIK_TBUF_NOT_AVAILABLE; - } - -// ----------------------------------------------------------------------------- -// TObexUtilsUiLayer::ContextIcon -// ----------------------------------------------------------------------------- -// -EXPORT_C TInt TObexUtilsUiLayer::ContextIcon( const TMsvEntry& aContext, TContextMedia aMedia ) - { - FLOG(_L("[OBEXUTILS]\t TObexUtilsUiLayer::ContextIcon()")); - - TInt icon = 0; - if( aMedia == EBluetooth ) - { - if( aContext.Unread() ) - { - icon = EMbmMuiuQgn_prop_mce_bt_unread - EMbmMuiuQgn_prop_mce_ir_unread; - } - else - { - icon = EMbmMuiuQgn_prop_mce_bt_read - EMbmMuiuQgn_prop_mce_ir_unread; - } - } - else if( aMedia == EInfrared ) - { - if( aContext.Unread() ) - { - icon = 0; - } - else - { - icon = EMbmMuiuQgn_prop_mce_ir_read - EMbmMuiuQgn_prop_mce_ir_unread; - } - } - else if( aMedia == ENfc ) - { - if( aContext.Unread() ) - { - icon = KNfcUnreadIconIndex; - } - else - { - icon = KNfcReadIconIndex; - } - } - - FLOG(_L("[OBEXUTILS]\t TObexUtilsUiLayer::ContextIcon() completed")); - - return icon; - } - -// ----------------------------------------------------------------------------- -// TObexUtilsUiLayer::UpdateBitmaps -// ----------------------------------------------------------------------------- -// -EXPORT_C void TObexUtilsUiLayer::UpdateBitmaps( TUid aMedia, - TInt& aNumberOfZoomStates, TFileName& aBitmapFile, TInt& aStartBitmap, - TInt& aEndBitmap ) - { - FLOG(_L("[OBEXUTILS]\t TObexUtilsUiLayer::UpdateBitmaps()")); - - aBitmapFile = KCommonUiBitmapFile; - aNumberOfZoomStates = KUiNumberOfZoomStates; - if( aMedia == KUidMsgTypeBt ) - { - aStartBitmap = EMbmMuiuQgn_prop_mce_ir_unread; - aEndBitmap = EMbmMuiuQgn_prop_mce_bt_read_mask; - } - else - { - aStartBitmap = EMbmMuiuQgn_prop_mce_ir_unread; - aEndBitmap = EMbmMuiuQgn_prop_mce_bt_unread_mask; - } - - FLOG(_L("[OBEXUTILS]\t TObexUtilsUiLayer::UpdateBitmaps() completed")); - } - -// ----------------------------------------------------------------------------- -// TObexUtilsUiLayer::DeleteCBitMapArray -// ----------------------------------------------------------------------------- -// -inline void DeleteCBitMapArray(TAny* aPtr) - { - if (aPtr) - { - TObexUtilsUiLayer::CBitmapArray* array = - reinterpret_cast(aPtr); - array->ResetAndDestroy(); - delete array; - } - } - -// ----------------------------------------------------------------------------- -// TObexUtilsUiLayer::CreateAndAppendBitmapL -// ----------------------------------------------------------------------------- -// -void CreateAndAppendBitmapL(const TAknsItemID& aID, - const TInt aFileBitmapId, - CArrayPtr* aIconArrays ) - { - TFileName muiubmpFilename; - muiubmpFilename += KObexUtilsFileDrive; - muiubmpFilename += KDC_APP_BITMAP_DIR; - muiubmpFilename += KCommonUiBitmapFile; - - TObexUtilsUiLayer::CBitmapArray* array=NULL; - array=new(ELeave) CArrayPtrFlat(KUiNumberOfZoomStates); - CleanupStack::PushL(TCleanupItem(DeleteCBitMapArray, array)); - - CFbsBitmap* bitmap=0, *mask=0; - - //Can not use CreateIconLC since the order in which bitmap and mask are pushed into Cleanup Stack is undefined. - AknsUtils::CreateIconL( - AknsUtils::SkinInstance(), - aID, - bitmap, - mask, - muiubmpFilename, - aFileBitmapId, - aFileBitmapId+1); - CleanupStack::PushL(mask); - CleanupStack::PushL(bitmap); - - // warning: bmp is deleted by the array CleanupItem. Immediately Pop or risk double deletion upon a Leave. - array->AppendL(bitmap); - CleanupStack::Pop(bitmap); - - // warning: bmp is deleted by the array CleanupItem. Immediately Pop or risk double deletion upon a Leave. - array->AppendL(mask); - CleanupStack::Pop(mask); - - aIconArrays->AppendL(array); - CleanupStack::Pop(array); - } - -// ----------------------------------------------------------------------------- -// TObexUtilsUiLayer::CreateIconsL -// ----------------------------------------------------------------------------- -// -EXPORT_C void TObexUtilsUiLayer::CreateIconsL( - TUid aMedia, - CArrayPtr* aIconArrays ) - { - if( aMedia == KUidMsgTypeBt ) //Bluetooth - { - CreateAndAppendBitmapL( - KAknsIIDQgnPropMceIrUnread, - EMbmMuiuQgn_prop_mce_ir_unread, - aIconArrays); - CreateAndAppendBitmapL( - KAknsIIDQgnPropMceIrRead, - EMbmMuiuQgn_prop_mce_ir_read, - aIconArrays); - CreateAndAppendBitmapL( - KAknsIIDQgnPropMceBtUnread, - EMbmMuiuQgn_prop_mce_bt_unread, - aIconArrays); - CreateAndAppendBitmapL( - KAknsIIDQgnPropMceBtRead, - EMbmMuiuQgn_prop_mce_bt_read, - aIconArrays); - CreateAndAppendBitmapL( - KAknsIIDQgnPropMceNfcRead, - 0, - aIconArrays); - CreateAndAppendBitmapL( - KAknsIIDQgnPropMceNfcUnread, - 0, - aIconArrays); - } - else //Infrared - { - CreateAndAppendBitmapL( - KAknsIIDQgnPropMceIrUnread, - EMbmMuiuQgn_prop_mce_ir_unread, - aIconArrays); - CreateAndAppendBitmapL( - KAknsIIDQgnPropMceIrRead, - EMbmMuiuQgn_prop_mce_ir_read, - aIconArrays); - CreateAndAppendBitmapL( - KAknsIIDQgnPropMceBtUnread, - EMbmMuiuQgn_prop_mce_bt_unread, - aIconArrays); - } - } - -// ----------------------------------------------------------------------------- -// TObexUtilsUiLayer::IsBackupRunning -// ----------------------------------------------------------------------------- -// -EXPORT_C TBool TObexUtilsUiLayer::IsBackupRunning() - { - const TUint32 KFileManagerBkupStatus = 0x00000001; - - TInt status = EFileManagerBkupStatusUnset; - TBool retValue = EFalse; - TInt err = RProperty::Get( TUid::Uid(KFileManagerUID3), KFileManagerBkupStatus, - status ); - if ( err == KErrNone ) - { - if ( status == EFileManagerBkupStatusBackup || - status == EFileManagerBkupStatusRestore ) - { - TSecureId fileManagerSecureId( KFileManagerUID3 ); - //only returning ETrue if backup process is still active - retValue = ProcessExists( fileManagerSecureId ); - } - } - - return retValue; - } - -// ----------------------------------------------------------------------------- -// TObexUtilsUiLayer::PrepareDialogExecuteL -// ----------------------------------------------------------------------------- -// -void TObexUtilsUiLayer::PrepareDialogExecuteL( const TInt& aResourceID, CEikDialog* aDialog ) - { - if (IsCoverDisplayL()) - { - TInt dialogIndex = - ((aResourceID & KResourceNumberMask) - KFirstResourceOffset) + KEnumStart; - aDialog->PublishDialogL( dialogIndex, KObexUtilsCategory ); - } - } - -// ----------------------------------------------------------------------------- -// TObexUtilsUiLayer::IsCoverDisplayL() -// ----------------------------------------------------------------------------- -// -TBool TObexUtilsUiLayer::IsCoverDisplayL() - { - TBool coverDisplay = EFalse; - FeatureManager::InitializeLibL(); - if ( FeatureManager::FeatureSupported( KFeatureIdCoverDisplay ) ) - { - coverDisplay = ETrue; - } - FeatureManager::UnInitializeLib(); - return coverDisplay; - } - -// ----------------------------------------------------------------------------- -// TObexUtilsUiLayer::ProcessExists -// ----------------------------------------------------------------------------- -// -TBool TObexUtilsUiLayer::ProcessExists( const TSecureId& aSecureId ) - { - _LIT( KFindPattern, "*" ); - TFindProcess finder(KFindPattern); - TFullName processName; - while( finder.Next( processName ) == KErrNone ) - { - RProcess process; - if ( process.Open( processName ) == KErrNone ) - { - TSecureId processId( process.SecureId() ); - process.Close(); - if( processId == aSecureId ) - { - return ETrue; - } - } - } - return EFalse; - } -// End of File diff -r 91746b151f97 -r 997690c3397a btobexprofiles/obexserviceman/utils/src/vMessageHandler.cpp --- a/btobexprofiles/obexserviceman/utils/src/vMessageHandler.cpp Fri Jun 11 13:48:51 2010 +0300 +++ b/btobexprofiles/obexserviceman/utils/src/vMessageHandler.cpp Wed Jun 23 18:23:52 2010 +0300 @@ -18,7 +18,6 @@ // INCLUDE FILES #include "vMessageHandler.h" -#include "obexutilsuilayer.h" #include "obexutilsdebug.h" #include "etelmm.h" #include @@ -38,6 +37,9 @@ #include #endif //NO101APPDEPFIXES_NEW +// todo @ QT migration: take official definition from Messaging at app layer (btmsgtypeuid.h) +const TUid KUidMsgTypeBt = {0x10009ED5}; + // ================= MEMBER FUNCTIONS ======================= TBool CSapVMessageParser::HandleMessageL(CObexBufObject* aReceivedObject, const TUid aMtmID, RFile& aFile, CMsvSession* aMsvSession, TTime aTime) diff -r 91746b151f97 -r 997690c3397a btservices_plat/obex_service_utils_api/tsrc/src/ObexServAPItestBlocks.cpp --- a/btservices_plat/obex_service_utils_api/tsrc/src/ObexServAPItestBlocks.cpp Fri Jun 11 13:48:51 2010 +0300 +++ b/btservices_plat/obex_service_utils_api/tsrc/src/ObexServAPItestBlocks.cpp Wed Jun 23 18:23:52 2010 +0300 @@ -23,7 +23,6 @@ #include #include #include -#include #include #include "testlogger.h" #include "ObexServAPItest.h" @@ -262,8 +261,10 @@ // ----------------------------------------------------------------------------- // TInt CObexServAPItest::CreateOutBoxEntryL( CStifItemParser& /*aItem*/ ) - { - TRAPD(error, iMessageServerIndex = TObexUtilsMessageHandler::CreateOutboxEntryL( KUidMsgTypeBt, R_BT_SEND_OUTBOX_SENDING )); + { + //todo resource is unavailable at the moment. + // need to change the string constant according to the coming new localisation file + TRAPD(error, iMessageServerIndex = TObexUtilsMessageHandler::CreateOutboxEntryL( KUidMsgTypeBt, 1 )); if( error != KErrNone) { TestCompleted( error, TLFUNCLOG, _L("CreateOutBoxEntryL leaves")); diff -r 91746b151f97 -r 997690c3397a cbsatplugin/atmisccmdplugin/src/clckcommandhandler.cpp --- a/cbsatplugin/atmisccmdplugin/src/clckcommandhandler.cpp Fri Jun 11 13:48:51 2010 +0300 +++ b/cbsatplugin/atmisccmdplugin/src/clckcommandhandler.cpp Wed Jun 23 18:23:52 2010 +0300 @@ -719,11 +719,6 @@ } break; } - default: - { - TRACE_FUNC_EXIT - return KErrArgument; - } } // if phone password is required it needs to be hashed before verification diff -r 91746b151f97 -r 997690c3397a layers.sysdef.xml --- a/layers.sysdef.xml Fri Jun 11 13:48:51 2010 +0300 +++ b/layers.sysdef.xml Wed Jun 23 18:23:52 2010 +0300 @@ -15,6 +15,9 @@ + + +