libraries/iosrv/server/readwrite.cpp
changeset 100 706c7a69e448
parent 14 4ab8c027df23
--- a/libraries/iosrv/server/readwrite.cpp	Thu Nov 04 20:51:05 2010 +0000
+++ b/libraries/iosrv/server/readwrite.cpp	Thu Nov 04 23:22:39 2010 +0000
@@ -602,18 +602,31 @@
 	TInt mode(aMessage.Int0());
 	if ((mode >= RIoWriteHandle::EText) && (mode <= RIoWriteHandle::EBinary))
 		{
+		TInt err = KErrNone;
 		if (ReadEndPoint() && ReadEndPoint()->IorepIsForegroundL(*this))
 			{
 			__ASSERT_RETURN(!MessagePending(iSetModeMessage), PanicClient(aMessage, EPanicSetModeAlreadyPending));
-			ReadEndPoint()->IorepSetConsoleModeL((RIoReadWriteHandle::TMode)mode, *this);
 			iSetModeMessage = aMessage;
+			TRAP(err, ReadEndPoint()->IorepSetConsoleModeL((RIoReadWriteHandle::TMode)mode, *this));
+			if (err && MessagePending(iSetModeMessage))
+				{
+				if (err == KErrNotSupported)
+					{
+					// Ignore KErrNotSupported from the console to allow iMode to be set anyway, thereby getting at least the iosrv level behavior.
+					err = KErrNone;
+					}
+				Complete(iSetModeMessage, err);
+				}
 			}
 		else
 			{
 			Complete(aMessage, KErrNone);
 			}
 
-		iMode = static_cast<RIoWriteHandle::TMode>(mode);
+		if (err == KErrNone)
+			{
+			iMode = static_cast<RIoWriteHandle::TMode>(mode);
+			}
 		}
 	else
 		{
@@ -654,7 +667,7 @@
 	return (iBuf->Length() > 0);
 	}
 
-TBool CIoReadObject::IorIsKeyCaptured(TUint aKeyCode, TUint aModifiers)
+TBool CIoReadObject::IorIsKeyCaptured(TUint aKeyCode, TUint aModifiers) const
 	{
 	if (iCaptureAllKeys)
 		{
@@ -672,6 +685,11 @@
 	return EFalse;
 	}
 
+TBool CIoReadObject::IorAllKeysCaptured() const
+	{
+	return iCaptureAllKeys;
+	}
+
 void CIoReadObject::IorReadComplete(TInt aError)
 	{
 	if ((aError == KErrNone) || (aError==KErrEof))