--- a/src/hbcore/devicedialogbase/devicedialogserver/hbindicatorsessionhandler.cpp Mon Apr 19 14:02:13 2010 +0300
+++ b/src/hbcore/devicedialogbase/devicedialogserver/hbindicatorsessionhandler.cpp Mon May 03 12:48:33 2010 +0300
@@ -124,6 +124,10 @@
aMessage.Complete( KErrNone );
break;
}
+ case EHbSrvActivatedIndicatorData: {
+ WriteIndicatorDataL(aMessage);
+ break;
+ }
default: {
break;
}
@@ -167,6 +171,16 @@
TRACE_EXIT
}
+void HbIndicatorSessionHandler::IndicatorUserActivated(const QVariantMap& data)
+{
+ QString type = data.value("type").toString();
+
+ if (indicatorTypes.contains(type) && iIndicatorChannelOpen) {
+ indicatorDataMap = data;
+ TRAP_IGNORE(WriteIndicatorDataL(iIndicatorChannel));
+ }
+}
+
HbDeviceDialogServerPrivate& HbIndicatorSessionHandler::Server()
{
return iSession->Server();
@@ -181,6 +195,9 @@
TRACE_ENTRY
QVariant parameter;
QString type = indicatorTypeFromMessageL(aMessage, parameter);
+ if (!indicatorTypes.contains(type)) {
+ indicatorTypes.append(type);
+ }
HbDeviceDialogServer::IndicatorParameters indicatorParameters(type, aMessage, parameter);
TInt result = Server().activateIndicator(indicatorParameters);
aMessage.Complete(result);
@@ -196,6 +213,14 @@
TRACE_ENTRY
QVariant parameter;
QString type = indicatorTypeFromMessageL(aMessage, parameter);
+ indicatorTypes.removeAll(type);
+
+ if (indicatorTypes.isEmpty() && iIndicatorChannelOpen) {
+ indicatorDataMap.clear();
+ iIndicatorChannelOpen = false;
+ iIndicatorChannel.Complete(KErrCancel);
+ }
+
HbDeviceDialogServer::IndicatorParameters indicatorParameters(type, aMessage, parameter);
TInt result = Server().deactivateIndicator(indicatorParameters);
aMessage.Complete(result);
@@ -218,6 +243,11 @@
}
WriteIndicatorInfoL();
+
+ // check whether there is buffered indicator data also present.
+ if (iIndicatorChannelOpen && !indicatorDataMap.isEmpty()) {
+ WriteIndicatorDataL(iIndicatorChannel);
+ }
TRACE_EXIT
}
@@ -332,6 +362,31 @@
return clientInfoCount - clientInfoStoreCount;
}
+void HbIndicatorSessionHandler::WriteIndicatorDataL(const RMessage2& aMessage)
+{
+ iIndicatorChannelOpen = EFalse;
+ QByteArray array;
+ QDataStream stream( &array, QIODevice::WriteOnly );
+
+ QVariant var(indicatorDataMap);
+ stream << var;
+
+ // Get client data buffer size
+ TInt size = aMessage.GetDesMaxLength( KSlot0 );
+
+ TPckgBuf<TInt> buf( EHbIndicatorUserActivated );
+ User::LeaveIfError(aMessage.Write(KSlot1, buf));
+
+ if (size >= array.size()) {
+ // Buffer ok. Write data.
+ TPtr8 ptr( reinterpret_cast<TUint8*>(array.data()), array.size(), array.size());
+ TInt error = aMessage.Write( KSlot0, ptr );
+ aMessage.Complete(error);
+ indicatorDataMap.clear();
+ } else {
+ aMessage.Complete(array.size());
+ }
+}
/*!
\internal
get the indicator type and parameter from the message.