--- a/bluetoothengine/btnotif/src/BTNGenericInfoNotifier.cpp Tue Feb 02 00:20:42 2010 +0200
+++ b/bluetoothengine/btnotif/src/BTNGenericInfoNotifier.cpp Fri Feb 19 22:59:18 2010 +0200
@@ -24,6 +24,7 @@
#include "btNotifDebug.h" // Debugging macros
#include <SecondaryDisplay/BTnotifSecondaryDisplayAPI.h>
#include <e32cmn.h>
+#include <bluetoothuiutil.h>
#include "btnotifnameutils.h"
// ================= MEMBER FUNCTIONS =======================
@@ -59,7 +60,7 @@
CBTGenericInfoNotifier::~CBTGenericInfoNotifier()
{
Cancel(); // Free own resources
- delete iQueryMessage;
+ iQueryMessage.Close();
}
// ----------------------------------------------------------
@@ -203,13 +204,20 @@
User::Leave(KErrNotFound);
}
- // if the logic string contains substitute indicator "%U", replace it with device name:
- iQueryMessage = StringLoader::LoadL( iMessageResourceId);
- _LIT(PU,"%U");
- if( iQueryMessage->Find(PU) != KErrNotFound)
+ // if the logic string contains substitute indicator "%U", replace it with device name:
+ HBufC* buf = StringLoader::LoadL( iMessageResourceId);
+ iQueryMessage.Assign( buf );
+
+ TInt keyLen;
+ TInt pos = BluetoothUiUtil::GetStringSubstringKeyPos(
+ iQueryMessage, 0, keyLen );
+ if( pos > KErrNotFound)
{
iBTAddr = TBTDevAddr( bPckg().iRemoteAddr );
- iDevice = CBTDevice::NewL(iBTAddr);
+ if( !iDevice )
+ {
+ iDevice = CBTDevice::NewL(iBTAddr);
+ }
GetDeviceFromRegL( iBTAddr );
}
else
@@ -225,7 +233,7 @@
//
void CBTGenericInfoNotifier::ShowNoteAndCompleteL()
{
- iNotifUiUtil->ShowInfoNoteL( *iQueryMessage, iSecondaryDisplayCommand );
+ iNotifUiUtil->ShowInfoNoteL( iQueryMessage, iSecondaryDisplayCommand );
CompleteMessage(KErrNone);
FLOG(_L("[BTNOTIF]\t CBTGenericInfoNotifier::ShowNoteAndComplete() complete"));
}
@@ -234,12 +242,11 @@
{
FLOG(_L("[BTNOTIF]\t CBTGenericInfoNotifier::HandleGetDeviceCompleted()"));
- delete iQueryMessage;
- iQueryMessage=NULL;
-
TBTDeviceName name;
BtNotifNameUtils::GetDeviceDisplayName(name, iDevice);
- iQueryMessage = StringLoader::LoadL( iMessageResourceId, name);
+ iQueryMessage.Zero();
+ BluetoothUiUtil::LoadResourceAndSubstringL(
+ iQueryMessage, iMessageResourceId, name, 0);
ShowNoteAndCompleteL();