# HG changeset patch # User Dremov Kirill (Nokia-D-MSW/Tampere) # Date 1279207866 -10800 # Node ID e5618cc85d74eec57573a730e01bac8f1689209c # Parent 4376525cdefb089cb1b83c32fe58b463c36ebda1 Revision: v2.1.32 Kit: 2010127 diff -r 4376525cdefb -r e5618cc85d74 build/buildutils/checkcopyrights.py --- a/build/buildutils/checkcopyrights.py Mon Jun 21 15:32:50 2010 +0300 +++ b/build/buildutils/checkcopyrights.py Thu Jul 15 18:31:06 2010 +0300 @@ -13,48 +13,54 @@ # Contributors: # # Description: -# Checks that all the source files have a proper copyright header. +# Checks that all the source files have a proper EPL copyright header. # Ignores number of known 3rd party source files and directories. # -# Run this script on a clean workarea in order to avoid warnings -# about exported files and qmake generated files. +# Run this script on a clean workarea in order to avoid warnings +# about exported files and qmake generated files. # -# The excluded directories should be checked every now and then -# so that there won't be other problems (like files without any -# header). +# The excluded directories should be checked every now and then +# so that there won't be other problems (like files without any header). import sys, os, re # Specify here the file types to be checked checkedFileTypes = [".cpp", ".h", ".java", ".py", ".mk"] -# Include here the directories to be ignored -ignoredDirectories = [ - "javaextensions\\bluetooth\\bluecove", # Bluecove - "javacommons\\jvms\\j9\\s60\\inc", # IBM J9 - "javauis\\eswt_akn", # eSWT checked separately - "javauis\\eswt_qt", # eSWT checked separately - "javauis\\tsrc\\fute\\eswt\\", # eSWT checked separately - "javaextensions\\webservices", # Webservices not delivered - "jrt\\tools", # Tools not delivered - "\\internal" # Internal directories not delivered - ] -# Include here any individual files to be ignored -ignoredFiles = [ - "javacommons\\jvms\\cldc_1.1.1\\javasrc\\java\\util\\Timer.java", # Apache license - "javacommons\\jvms\\cldc_1.1.1\\javasrc\\java\\util\\TimerTask.java", # Apache license - "javacommons\\jvms\\cldc_1.1.1\\tsrc\\javasrc\\com\\nokia\\mj\\test\\java\\util\\TimerTaskTest.java", # Apache license - "javacommons\\jvms\\cldc_1.1.1\\tsrc\\javasrc\\com\\nokia\\mj\\test\\java\\util\\TimerTest.java", # Apache license - "javacommons\\utils\\inc\\convertutf.h", # Unicode Inc. - "javacommons\\utils\\src\\convertutf.cpp" # Unicode Inc. -] - -# The copyright text to be checked -copyrightText = "Nokia Corporation and/or its subsidiary(-ies)" +# The copyright texts to be searched for +copyrightText1 = "Nokia Corporation and/or its subsidiary(-ies)" +copyrightText2 = "Eclipse Public License v1.0" def main(): + + root = sys.argv[1] + if root[-1] != '\\': + root = root + '\\' + + # Include here the directories to be ignored + ignoredDirectories = [ + root + "javaextensions\\bluetooth\\bluecove", # Bluecove + root + "javacommons\\jvms\\j9\\s60\\inc", # IBM J9 + root + "javauis\\eswt_akn", # eSWT checked separately + root + "javauis\\eswt_qt", # eSWT checked separately + root + "javauis\\tsrc\\fute\\eswt\\", # eSWT checked separately + root + "javaextensions\\webservices", # Webservices not delivered + root + "tools", # Tools not delivered + "\\internal" # Internal directories not delivered + ] + + # Include here any individual files to be ignored + ignoredFiles = [ + root + "javacommons\\jvms\\cldc_1.1.1\\javasrc\\java\\util\\Timer.java", # Apache license + root + "javacommons\\jvms\\cldc_1.1.1\\javasrc\\java\\util\\TimerTask.java", # Apache license + root + "javacommons\\jvms\\cldc_1.1.1\\tsrc\\javasrc\\com\\nokia\\mj\\test\\java\\util\\TimerTaskTest.java", # Apache license + root + "javacommons\\jvms\\cldc_1.1.1\\tsrc\\javasrc\\com\\nokia\\mj\\test\\java\\util\\TimerTest.java", # Apache license + root + "javacommons\\utils\\inc\\convertutf.h", # Unicode Inc. + root + "javacommons\\utils\\src\\convertutf.cpp" # Unicode Inc. + ] + def visitFun(arg, dirname, names): @@ -94,16 +100,29 @@ # print "Ignoring file", f continue - # Check if the file contains the copyright text + # Check if the file contains the copyright texts try: file = open(fname) + + # Search for the first text found = False line = file.readline() while line != "": - if copyrightText in line: + if copyrightText1 in line: found = True break; - line = file.readline() + line = file.readline() + + # Search the second copyright text as well + if found: + found = False + line = file.readline() + while line != "": + if copyrightText2 in line: + found = True + break; + line = file.readline() + file.close() except IOError: @@ -112,8 +131,8 @@ if not found: print fname continue - - os.path.walk(sys.argv[1], visitFun, None) + + os.path.walk(root, visitFun, None) if __name__ == "__main__": diff -r 4376525cdefb -r e5618cc85d74 build/makefile.javaversion --- a/build/makefile.javaversion Mon Jun 21 15:32:50 2010 +0300 +++ b/build/makefile.javaversion Thu Jul 15 18:31:06 2010 +0300 @@ -1,6 +1,6 @@ # Set Java version (must be dot separated, without spaces) ifdef RD_JAVA_S60_RELEASE_5_0_IAD - JAVA_VERSION = 2.1.30 + JAVA_VERSION = 2.1.32 else - JAVA_VERSION = 2.1.30 + JAVA_VERSION = 2.1.32 endif diff -r 4376525cdefb -r e5618cc85d74 inc/build_defines.hrh --- a/inc/build_defines.hrh Mon Jun 21 15:32:50 2010 +0300 +++ b/inc/build_defines.hrh Thu Jul 15 18:31:06 2010 +0300 @@ -15,7 +15,7 @@ * */ -#define RD_JAVA_VERSION 2,1,30 +#define RD_JAVA_VERSION 2,1,32 #define RD_JAVA_SYMBIAN_TARGET #define RD_JAVA_S60_RELEASE_9_2 #define RD_JAVA_S60_RELEASE_9_2_ONWARDS diff -r 4376525cdefb -r e5618cc85d74 inc/java.txt --- a/inc/java.txt Mon Jun 21 15:32:50 2010 +0300 +++ b/inc/java.txt Thu Jul 15 18:31:06 2010 +0300 @@ -1,1 +1,1 @@ -2.1.30 +2.1.32 diff -r 4376525cdefb -r e5618cc85d74 javacommons/gcfprotocols/http/build/javahttp.pro --- a/javacommons/gcfprotocols/http/build/javahttp.pro Mon Jun 21 15:32:50 2010 +0300 +++ b/javacommons/gcfprotocols/http/build/javahttp.pro Thu Jul 15 18:31:06 2010 +0300 @@ -13,6 +13,7 @@ # # Description: # +include(../../../../inc/build_defines.pri) TARGET=javahttp TEMPLATE=lib @@ -20,7 +21,13 @@ CONFIG -= qt symbian { - LIBS += -leuser -lhttp -lecom -lbafl -linetprotutil -lhttpfiltercommon -lx509 -lx500 -lcrypto -lesock -lcommdb -lcentralrepository -lwebutils + LIBS += -leuser -lhttp -lecom -lbafl -linetprotutil -lhttpfiltercommon -lx509 -lx500 -lcrypto -lesock -lcentralrepository -lwebutils + contains(PROJECT_DEFINES,RD_JAVA_S60_RELEASE_5_0) { + LIBS += -lcommdb + } + contains(PROJECT_DEFINES,RD_JAVA_S60_RELEASE_9_2_ONWARDS) { + LIBS += -lextendedconnpref -lnetmeta + } } diff -r 4376525cdefb -r e5618cc85d74 javacommons/gcfprotocols/http/build/javahttp_0x2002DCB1.mmp --- a/javacommons/gcfprotocols/http/build/javahttp_0x2002DCB1.mmp Mon Jun 21 15:32:50 2010 +0300 +++ b/javacommons/gcfprotocols/http/build/javahttp_0x2002DCB1.mmp Thu Jul 15 18:31:06 2010 +0300 @@ -83,9 +83,10 @@ LIBRARY x500.lib LIBRARY crypto.lib LIBRARY esock.lib -LIBRARY commdb.lib LIBRARY centralrepository.lib LIBRARY webutils.lib +LIBRARY extendedconnpref.lib +LIBRARY netmeta.lib LIBRARY javautils.lib LIBRARY libpthread.lib LIBRARY libstdcppv5.lib diff -r 4376525cdefb -r e5618cc85d74 javacommons/gcfprotocols/http/javasrc.s60/com/nokia/mj/impl/http/HttpConnectionNative.java --- a/javacommons/gcfprotocols/http/javasrc.s60/com/nokia/mj/impl/http/HttpConnectionNative.java Mon Jun 21 15:32:50 2010 +0300 +++ b/javacommons/gcfprotocols/http/javasrc.s60/com/nokia/mj/impl/http/HttpConnectionNative.java Thu Jul 15 18:31:06 2010 +0300 @@ -194,7 +194,7 @@ iTransactionBlock = new BlockingOperation(); iNativeDataReadyForRead = new BlockingOperation(); iNativeDataReadyForRead.setResult(BlockingOperation.BLOCKED); - iFinalizer = registerForFinalization(); + iFinalizer = registerForFinalization(); Logger.LOG(Logger.ESOCKET, Logger.EInfo, "- HttpConnectionNative new "); ApplicationInfo appInfo = ApplicationInfo.getInstance(); @@ -253,9 +253,9 @@ { close(); } - catch(Exception e) + catch (Exception e) { - + } Logger.LOG(Logger.ESOCKET, Logger.EInfo, "--HttpConnectionNative::doFinalize "); diff -r 4376525cdefb -r e5618cc85d74 javacommons/gcfprotocols/http/src.s60/chttpsessionclient.cpp --- a/javacommons/gcfprotocols/http/src.s60/chttpsessionclient.cpp Mon Jun 21 15:32:50 2010 +0300 +++ b/javacommons/gcfprotocols/http/src.s60/chttpsessionclient.cpp Thu Jul 15 18:31:06 2010 +0300 @@ -22,7 +22,13 @@ #include #include #include "logger.h" + +#ifdef RD_JAVA_S60_RELEASE_9_2_ONWARDS +#include // extended connection preference +#include +#else #include +#endif #include #include @@ -146,10 +152,19 @@ *apnerr = ret; return; } - +#ifdef RD_JAVA_S60_RELEASE_9_2_ONWARDS + TConnPrefList prefList; + TExtendedConnPref prefs; + prefs.SetSnapId(aAPNId); + prefList.AppendL(&prefs); + ret = iConnection.Start(prefList); +#else TCommSnapPref connPref; connPref.SetSnap(aAPNId); ret = iConnection.Start(connPref); +#endif + + LOG(ESOCKET,EInfo,"+HttpSessionClient:: using extended connection prefernce in snap case"); LOG1(ESOCKET,EInfo,"iConnection.Start returned %d",ret); if (ret < 0) { @@ -172,6 +187,7 @@ { if (aType == 3) // IAP Id { + LOG(ESOCKET,EInfo,"+HttpSessionClient:: in iap case"); if (aAPNId != -1) { // Creates connection with selected IAP ID @@ -189,18 +205,35 @@ *apnerr = ret; return; } + +#ifdef RD_JAVA_S60_RELEASE_9_2_ONWARDS + // Create connection preferences + TConnPrefList prefList; + TExtendedConnPref prefs; + prefs.SetIapId(aAPNId); + prefList.AppendL(&prefs); + ret = iConnection.Start(prefList); + LOG(ESOCKET,EInfo,"+HttpSessionClient:: using extended connection prefernce in iap case"); +#else TCommDbConnPref pref; pref.SetIapId(aAPNId); pref.SetDialogPreference(ECommDbDialogPrefDoNotPrompt); ret = iConnection.Start(pref); +#endif + if (ret < 0) { *apnerr = ret; //return; } RHTTPConnectionInfo connInfo = iHttpSession.ConnectionInfo(); + //connInfo.SetPropertyL(iHttpSession.StringPool().StringF( + // HttpFilterCommonStringsExt::EAccessPointID, HttpFilterCommonStringsExt::GetTable()), aAPNId); connInfo.SetPropertyL(iHttpSession.StringPool().StringF( - HttpFilterCommonStringsExt::EAccessPointID, HttpFilterCommonStringsExt::GetTable()), aAPNId); + HTTP::EHttpSocketServ, RHTTPSession::GetTable()), THTTPHdrVal(iSocketServ.Handle())); + TInt connPtr = REINTERPRET_CAST(TInt, &iConnection); + connInfo.SetPropertyL(iHttpSession.StringPool().StringF( + HTTP::EHttpSocketConnection, RHTTPSession::GetTable()), THTTPHdrVal(connPtr)); } // end of if ( aAPNId != -1) } // end of if(aType == 4) else @@ -210,7 +243,7 @@ } // end of else - LOG1(ESOCKET,EInfo,"apnerr = ",*apnerr); + LOG1(ESOCKET,EInfo,"apnerr = %d",*apnerr); // This is special case when that IAP/SNAP is not found // Override the http stack's feaute of using device default @@ -219,9 +252,19 @@ LOG(ESOCKET,EInfo,"ECommDbDialogPrefPrompt set for the http session"); int ret = iSocketServ.Connect(); ret = iConnection.Open(iSocketServ); +#ifdef RD_JAVA_S60_RELEASE_9_2_ONWARDS + TConnPrefList prefList; + TExtendedConnPref prefs; + prefs.SetConnSelectionDialog(ETrue); + prefList.AppendL(&prefs); + ret = iConnection.Start(prefList); + LOG(ESOCKET,EInfo,"+HttpSessionClient:: using extended connection prefernce - error case "); +#else TCommDbConnPref pref; pref.SetDialogPreference(ECommDbDialogPrefPrompt); ret = iConnection.Start(pref); + LOG(ESOCKET,EInfo,"+HttpSessionClient:: using commdb con pref - error case "); +#endif RHTTPConnectionInfo connInfo = iHttpSession.ConnectionInfo(); connInfo.SetPropertyL(iHttpSession.StringPool().StringF( @@ -296,10 +339,25 @@ iConnection.Close(); TInt ret = iConnection.Open(iSocketServ); + //TCommSnapPref connPref; +#ifdef RD_JAVA_S60_RELEASE_9_2_ONWARDS + TConnPrefList prefList; + TExtendedConnPref prefs; + + if (iApnId!=-1) + prefs.SetSnapId(iApnId); + TRAPD(err,prefList.AppendL(&prefs)); + if (err == KErrNone) + ret = iConnection.Start(prefList); + else + ret = iConnection.Start(); +#else TCommSnapPref connPref; if (iApnId!=-1) connPref.SetSnap(iApnId); ret = iConnection.Start(connPref); + +#endif LOG(ESOCKET,EInfo,"+HttpSessionClient::RestartConnection + "); } diff -r 4376525cdefb -r e5618cc85d74 javacommons/gcfprotocols/http/src.s60/chttptransactionclient.cpp --- a/javacommons/gcfprotocols/http/src.s60/chttptransactionclient.cpp Mon Jun 21 15:32:50 2010 +0300 +++ b/javacommons/gcfprotocols/http/src.s60/chttptransactionclient.cpp Thu Jul 15 18:31:06 2010 +0300 @@ -626,14 +626,14 @@ iStatus = CHttpTransactionClient::ERequestNextBodayData; break; } - + case THTTPEvent::EReceiveTimeOut: { - ELOG(ESOCKET,"MHFRunL EReceiveTimeOut"); - NotifyErrorL(KErrTimedOut); // send timeout error to java - break; - - } + ELOG(ESOCKET,"MHFRunL EReceiveTimeOut"); + NotifyErrorL(KErrTimedOut); // send timeout error to java + break; + + } /* * -j2me expects the http stack to be able to post body data with no content type * the native stack default validation filter does not allow this. diff -r 4376525cdefb -r e5618cc85d74 javacommons/gcfprotocols/http/src.s60/nativehttpsession.cpp --- a/javacommons/gcfprotocols/http/src.s60/nativehttpsession.cpp Mon Jun 21 15:32:50 2010 +0300 +++ b/javacommons/gcfprotocols/http/src.s60/nativehttpsession.cpp Thu Jul 15 18:31:06 2010 +0300 @@ -49,10 +49,10 @@ TInt NativeHttpSession::NewL(JNIEnv& aJni, jobject aPeer,/* TJavaEventServer aServer,*/ TInt aType, TInt aAPNId, TInt * aErr, TInt * apnerr) { NativeHttpSession* self = new(ELeave) NativeHttpSession(); - + *aErr = self->ConstructL(aJni, aPeer /* aServer*/, aType, aAPNId, apnerr); LOG1(ESOCKET,EInfo,"NativeHttpSession::NewL - aErr : %d",*aErr); - + self->attachToVm(aJni,aPeer); // Pop the cleanup of the object and create a handle: return reinterpret_cast(self); //selfCleanup.GetHandle(); @@ -119,17 +119,17 @@ void NativeHttpSession::doSubmitCallback(TInt aStatus,jobject &aPeer) { - LOG(ESOCKET,EInfo,"+doSubmitCallback1"); + LOG(ESOCKET,EInfo,"+doSubmitCallback1"); jobject localPeerObject = mJniEnv->NewLocalRef(aPeer); - if(localPeerObject) + if (localPeerObject) { - // java side peer object may be GC'ed when this call is being made. - mJniEnv->CallVoidMethod(aPeer,iSubmitCallbackMethodID,aStatus); + // java side peer object may be GC'ed when this call is being made. + mJniEnv->CallVoidMethod(aPeer,iSubmitCallbackMethodID,aStatus); } else { - ELOG(ESOCKET,"NativeHttpSession::doSubmitCallback: Error!! java peer object not found "); - } + ELOG(ESOCKET,"NativeHttpSession::doSubmitCallback: Error!! java peer object not found "); + } LOG(ESOCKET,EInfo,"-doSubmitCallback1"); } @@ -137,14 +137,14 @@ { LOG(ESOCKET,EInfo,"+doReadCallback1"); jobject localPeerObject = mJniEnv->NewLocalRef(aPeer); - if(localPeerObject) + if (localPeerObject) { - mJniEnv->CallVoidMethod(aPeer,iReadCallbackMethodID,aStatus); + mJniEnv->CallVoidMethod(aPeer,iReadCallbackMethodID,aStatus); } else { - ELOG(ESOCKET,"NativeHttpSession::doReadCallback: Error!! java peer object not found "); - } + ELOG(ESOCKET,"NativeHttpSession::doReadCallback: Error!! java peer object not found "); + } LOG(ESOCKET,EInfo,"-doReadCallback1"); } diff -r 4376525cdefb -r e5618cc85d74 javacommons/gcfprotocols/http/src.s60/nativehttptraansaction.cpp --- a/javacommons/gcfprotocols/http/src.s60/nativehttptraansaction.cpp Mon Jun 21 15:32:50 2010 +0300 +++ b/javacommons/gcfprotocols/http/src.s60/nativehttptraansaction.cpp Thu Jul 15 18:31:06 2010 +0300 @@ -57,7 +57,7 @@ NativeHttpTransaction::NativeHttpTransaction(HttpSessionClient& aSession, FunctionServer* aFuncServer) :iSessionClient(aSession) //, java::util::FunctionServer("MyhttpServer2") { - + iFuncServer = aFuncServer; } @@ -72,7 +72,7 @@ { NativeHttpTransaction* self = new(ELeave) NativeHttpTransaction(aSession,aFuncServer); - + self->ConstructL(aJni, aPeer, /*aServer, */ aUri, aRequestMethod); @@ -93,9 +93,9 @@ int urihandle = reinterpret_cast(aUri); int methodhandle = reinterpret_cast(aRequestMethod); //open the transaction - + CallMethodL(this, &NativeHttpTransaction::ExecuteCreateTransactionL,handle,urihandle , methodhandle, iFuncServer); - + } void NativeHttpTransaction::ExecuteCreateTransactionL(int aSelfhandle, int aUrihandle, int aMethodhandle) @@ -115,7 +115,7 @@ RPointerArray rawHeaderArray; CleanupStack::PushL(TCleanupItem(CleanUpResetAndDestroy,&rawHeaderArray)); iJniObject = aJni; - + if (aHeaders!=NULL) { @@ -173,7 +173,7 @@ void NativeHttpTransaction::ExecuteSubmitL(int aSelfhandle , int aRawHeadershandle , int aPostBufhandle, int aResponseTimeout) { - + NativeHttpTransaction *aSelf = reinterpret_cast(aSelfhandle); RPointerArray* aRawHeaders = reinterpret_cast*>(aRawHeadershandle); HBufC8* aPostBuf = reinterpret_cast(aPostBufhandle); @@ -186,12 +186,12 @@ jobjectArray objArray=NULL; RPointerArray rawHeaders(KResponseGranularity); CleanupStack::PushL(TCleanupItem(CleanUpResetAndDestroy,&rawHeaders)); - + int handle = reinterpret_cast(this); int arrayhandle = reinterpret_cast(&rawHeaders); CallMethodL(this, &NativeHttpTransaction::ExecuteGetResponseL,handle,arrayhandle , iFuncServer); - + const TInt headerCount = rawHeaders.Count(); if (headerCount>KErrNone) { @@ -232,7 +232,7 @@ */ TInt NativeHttpTransaction::ReadBytes(TUint8* aBytes, TInt aLength) { - + int handle = reinterpret_cast(this); int uinthandle = reinterpret_cast(aBytes); @@ -240,7 +240,7 @@ CallMethod(ret,this, &NativeHttpTransaction::ExecuteReadBytes,handle,uinthandle,aLength,iFuncServer); return ret; - + } TInt NativeHttpTransaction::ExecuteReadBytes(int aSelfhandle, int aByteshandle, TInt aLength) diff -r 4376525cdefb -r e5618cc85d74 javacommons/gcfprotocols/http/src.s60/nativetransaction.cpp --- a/javacommons/gcfprotocols/http/src.s60/nativetransaction.cpp Mon Jun 21 15:32:50 2010 +0300 +++ b/javacommons/gcfprotocols/http/src.s60/nativetransaction.cpp Thu Jul 15 18:31:06 2010 +0300 @@ -69,15 +69,15 @@ NativeHttpTransaction* tran = reinterpret_cast(aNativeHttpTransaction); tran->iJniPeer = aJni->NewWeakGlobalRef(aPeer); try - { + { tran->Dispose(); - } - catch(...) - { - // function server usage may throw an exception. - // ignore, called when transcation is closed - ELOG(ESOCKET,"Http JNI Error, exception caught!: _closeTransaction"); - } + } + catch (...) + { + // function server usage may throw an exception. + // ignore, called when transcation is closed + ELOG(ESOCKET,"Http JNI Error, exception caught!: _closeTransaction"); + } delete tran; } @@ -88,7 +88,7 @@ jstring aUri, jstring aRequestMethod) { - LOG(ESOCKET,EInfo,"http jni _createNativeTransaction()"); + LOG(ESOCKET,EInfo,"http jni _createNativeTransaction()"); NativeHttpSession* session = reinterpret_cast(aNativeHttpSession); //tran->iJniPeer = aJni->NewGlobalRef(aPeer); try @@ -96,13 +96,13 @@ TRAPD(handle, handle = session->CreateTransactionL(aJni, aPeer , aUri, aRequestMethod);); return handle; } - catch(...) + catch (...) { - // function server usage may throw an exception. - ELOG(ESOCKET,"Http JNI Error, exception caught!: _createTransaction"); - return -1; + // function server usage may throw an exception. + ELOG(ESOCKET,"Http JNI Error, exception caught!: _createTransaction"); + return -1; } - + } JNIEXPORT jint JNICALL Java_com_nokia_mj_impl_http_HttpConnectionNative__1submitTransaction( @@ -114,7 +114,7 @@ jint aPostDataLength, jint aResponseTimeout) { - LOG(ESOCKET,EInfo,"http jni _submitTransaction"); + LOG(ESOCKET,EInfo,"http jni _submitTransaction"); NativeHttpTransaction* tran = reinterpret_cast(aNativeHttpTransaction); int respTimeOut = aResponseTimeout; tran->iJniPeer = aJni->NewWeakGlobalRef(aPeer); @@ -123,11 +123,11 @@ TRAPD(err,tran->SubmitL(aJni, &aPeer,aHeaders, aPostData, aPostDataLength, respTimeOut)); return err; } - catch(...) + catch (...) { - ELOG(ESOCKET,"Http JNI Error, exception caught!: _submitTransaction"); - return -1; - } + ELOG(ESOCKET,"Http JNI Error, exception caught!: _submitTransaction"); + return -1; + } } JNIEXPORT jobjectArray JNICALL Java_com_nokia_mj_impl_http_HttpConnectionNative__1getResponse( @@ -135,24 +135,24 @@ jobject aPeer, jint aNativeHttpTransaction) { - LOG(ESOCKET,EInfo,"http jni _getResponse"); + LOG(ESOCKET,EInfo,"http jni _getResponse"); jobjectArray rawHeaders=NULL; NativeHttpTransaction* tran = reinterpret_cast(aNativeHttpTransaction); tran->iJniPeer = aJni->NewWeakGlobalRef(aPeer); try { - TRAPD(err, rawHeaders = tran->GetResponseL(aJni)); - if (err!=KErrNone) - { - rawHeaders=NULL; - } - } - catch(...) - { - rawHeaders=NULL; - ELOG(ESOCKET,"Http JNI Error, exception caught!: _getResponse"); - - } + TRAPD(err, rawHeaders = tran->GetResponseL(aJni)); + if (err!=KErrNone) + { + rawHeaders=NULL; + } + } + catch (...) + { + rawHeaders=NULL; + ELOG(ESOCKET,"Http JNI Error, exception caught!: _getResponse"); + + } return rawHeaders; } @@ -164,27 +164,27 @@ jbyteArray aBytes, jint aLength) { - LOG(ESOCKET,EInfo,"http jni _getBytes"); + LOG(ESOCKET,EInfo,"http jni _getBytes"); jbyte* bytes = aEnv->GetByteArrayElements(aBytes, NULL); if (bytes == NULL) { return -1; } - try - { - NativeHttpTransaction* tran = reinterpret_cast(aNativeHttpTransaction); - tran->iJniPeer = aEnv->NewWeakGlobalRef(aPeer); - TInt length = tran->ReadBytes(reinterpret_cast(bytes), aLength); - - aEnv->ReleaseByteArrayElements(aBytes, bytes, NULL); - return length; - } - catch(...) - { - ELOG(ESOCKET,"Http JNI Error, exception caught!: _getBytes"); - return -1; - } + try + { + NativeHttpTransaction* tran = reinterpret_cast(aNativeHttpTransaction); + tran->iJniPeer = aEnv->NewWeakGlobalRef(aPeer); + TInt length = tran->ReadBytes(reinterpret_cast(bytes), aLength); + + aEnv->ReleaseByteArrayElements(aBytes, bytes, NULL); + return length; + } + catch (...) + { + ELOG(ESOCKET,"Http JNI Error, exception caught!: _getBytes"); + return -1; + } } JNIEXPORT jint JNICALL Java_com_nokia_mj_impl_http_HttpConnectionNative__1available( @@ -196,12 +196,12 @@ tran->iJniPeer = aJni->NewWeakGlobalRef(aPeer); try { - return tran->Available(); + return tran->Available(); } - catch(...) + catch (...) { - ELOG(ESOCKET,"Http JNI Error, exception caught!: _available"); - return -1; + ELOG(ESOCKET,"Http JNI Error, exception caught!: _available"); + return -1; } } diff -r 4376525cdefb -r e5618cc85d74 javacommons/gcfprotocols/socket/socket/build/bld.inf --- a/javacommons/gcfprotocols/socket/socket/build/bld.inf Mon Jun 21 15:32:50 2010 +0300 +++ b/javacommons/gcfprotocols/socket/socket/build/bld.inf Thu Jul 15 18:31:06 2010 +0300 @@ -20,3 +20,4 @@ PRJ_MMPFILES javasocket_0x2002DCD4.mmp +#include "exports.inf" diff -r 4376525cdefb -r e5618cc85d74 javacommons/gcfprotocols/socket/socket/build/bwins/javasocketu.def --- a/javacommons/gcfprotocols/socket/socket/build/bwins/javasocketu.def Mon Jun 21 15:32:50 2010 +0300 +++ b/javacommons/gcfprotocols/socket/socket/build/bwins/javasocketu.def Thu Jul 15 18:31:06 2010 +0300 @@ -1,5 +1,5 @@ EXPORTS - ?jni_lookup@@YAP6AXXZPBD@Z @ 1 NONAME ; void (*)(void) jni_lookup(char const *) + ?jni_lookup@@YAP6AXXZPBD@Z @ 1 NONAME ; void (*)(void) jni_lookup(char const *) ?readBytes@NativeSocketConnection@java@@UAEHAAUJNIEnv_@@PAV_jbyteArray@@@Z @ 2 NONAME ; int java::NativeSocketConnection::readBytes(struct JNIEnv_ &, class _jbyteArray *) ?setSocketOption@NativeSocketConnection@java@@QAEHHH@Z @ 3 NONAME ; int java::NativeSocketConnection::setSocketOption(int, int) ?socketClose@NativeSocketConnection@java@@QAEHXZ @ 4 NONAME ; int java::NativeSocketConnection::socketClose(void) @@ -16,5 +16,5 @@ ?getLocalPort@NativeSocketConnection@java@@QAEHXZ @ 15 NONAME ; int java::NativeSocketConnection::getLocalPort(void) ?getPort@NativeSocketConnection@java@@QAEHXZ @ 16 NONAME ; int java::NativeSocketConnection::getPort(void) ?getSocketOption@NativeSocketConnection@java@@QAEHH@Z @ 17 NONAME ; int java::NativeSocketConnection::getSocketOption(int) - + ?getLocalAddress@SocketLocalHostInfo@@SAHHPADHH@Z @ 18 NONAME ; int SocketLocalHostInfo::getLocalAddress(int, char *, int, int) diff -r 4376525cdefb -r e5618cc85d74 javacommons/gcfprotocols/socket/socket/build/eabi/javasocketu.def --- a/javacommons/gcfprotocols/socket/socket/build/eabi/javasocketu.def Mon Jun 21 15:32:50 2010 +0300 +++ b/javacommons/gcfprotocols/socket/socket/build/eabi/javasocketu.def Thu Jul 15 18:31:06 2010 +0300 @@ -20,4 +20,5 @@ _ZN4java22NativeSocketConnectionD2Ev @ 19 NONAME _ZTIN4java22NativeSocketConnectionE @ 20 NONAME ; ## _ZTVN4java22NativeSocketConnectionE @ 21 NONAME ; ## + _ZN19SocketLocalHostInfo15getLocalAddressEiPcii @ 22 NONAME diff -r 4376525cdefb -r e5618cc85d74 javacommons/gcfprotocols/socket/socket/build/exports.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/javacommons/gcfprotocols/socket/socket/build/exports.inf Thu Jul 15 18:31:06 2010 +0300 @@ -0,0 +1,21 @@ +/* +* 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: +* +*/ + +PRJ_EXPORTS + +../inc/socketlocalhostinfo.h |../../../../../inc/socketlocalhostinfo.h + diff -r 4376525cdefb -r e5618cc85d74 javacommons/gcfprotocols/socket/socket/inc/socketlocalhostinfo.h --- a/javacommons/gcfprotocols/socket/socket/inc/socketlocalhostinfo.h Mon Jun 21 15:32:50 2010 +0300 +++ b/javacommons/gcfprotocols/socket/socket/inc/socketlocalhostinfo.h Thu Jul 15 18:31:06 2010 +0300 @@ -19,12 +19,14 @@ #ifndef SOCKETLOCALHOSTINFO_H #define SOCKETLOCALHOSTINFO_H +#include "javaosheaders.h" + class SocketLocalHostInfo { public: - static int getLocalAddress(int aSd, char *aLocalAddr, int aMidletIapId, int aApType); + OS_IMPORT static int getLocalAddress(int aSd, char *aLocalAddr, int aMidletIapId, int aApType); }; diff -r 4376525cdefb -r e5618cc85d74 javacommons/gcfprotocols/socket/socket/javasrc/com/nokia/mj/impl/socket/ServerSocketConnectionImpl.java --- a/javacommons/gcfprotocols/socket/socket/javasrc/com/nokia/mj/impl/socket/ServerSocketConnectionImpl.java Mon Jun 21 15:32:50 2010 +0300 +++ b/javacommons/gcfprotocols/socket/socket/javasrc/com/nokia/mj/impl/socket/ServerSocketConnectionImpl.java Thu Jul 15 18:31:06 2010 +0300 @@ -141,8 +141,7 @@ apId = -1; } Logger.LOG(Logger.ESOCKET, Logger.EInfo, - "+SocketServerConnectionImpl:: getApplicationDefault returned, \n"+apn.getNapId()+" type = "+apn.getType()); - System.out.println(" type = "+apn.getType()+" id = "+apId); + "+SocketServerConnectionImpl:: getApplicationDefault returned, \n"+apn.getNapId()+" type = "+apn.getType()); } } catch (Exception e) diff -r 4376525cdefb -r e5618cc85d74 javacommons/gcfprotocols/socket/socket/src.s60/socketlocalhostinfo.cpp --- a/javacommons/gcfprotocols/socket/socket/src.s60/socketlocalhostinfo.cpp Mon Jun 21 15:32:50 2010 +0300 +++ b/javacommons/gcfprotocols/socket/socket/src.s60/socketlocalhostinfo.cpp Thu Jul 15 18:31:06 2010 +0300 @@ -24,7 +24,7 @@ int GetlocalIPAdressL(char *localaddr, int aMidletIapId, int aApType); -int SocketLocalHostInfo::getLocalAddress(int /* aSd */, char *aLocalAddr, +OS_EXPORT int SocketLocalHostInfo::getLocalAddress(int /* aSd */, char *aLocalAddr, int aMidletIapId, int aApType) { TRAPD(err,GetlocalIPAdressL(aLocalAddr,aMidletIapId, aApType);); @@ -32,6 +32,77 @@ } +int getIPAddressL(const int aIapId, char *ipAddress) +{ + RSocketServ socketServ; + RSocket sock; + User::LeaveIfError(socketServ.Connect()); + User::LeaveIfError(sock.Open(socketServ, KAfInet, KSockStream, + KProtocolInetTcp)); + + // find the ip address of the active interface + TSoInetInterfaceInfo ifInfo; + TPckg ifInfoPkg(ifInfo); + TSoInetIfQuery ifQuery; + TPckg ifQueryPkg(ifQuery); + + // To find out which interfaces are using our current IAP, we must + // enumerate and go through all of them and make a query by name for each. + ILOG(ESOCKET, "Looping thru all the destinations and ap \n\n"); + User::LeaveIfError(sock.SetOpt(KSoInetEnumInterfaces, + KSolInetIfCtrl)); + + while (sock.GetOpt(KSoInetNextInterface, KSolInetIfCtrl, ifInfoPkg) + == KErrNone) + { + ifQuery.iName = ifInfo.iName; + TInt err = sock.GetOpt(KSoInetIfQueryByName, KSolInetIfQuery, + ifQueryPkg); + if ((err == KErrNone) && (ifQuery.iZone[1] == aIapId)) + { + ILOG2(ESOCKET, "Network id = %d, IAP id = %d ",(TUint32)(ifQuery.iZone[15]),(TUint32)ifQuery.iZone[1]); + + // IAP ID is index 1 of iZone + // We have found an interface using the IAP we are interested in. + if (ifInfo.iAddress.Address() > 0) + { + if (!ifInfo.iAddress.IsUnspecified() + && !ifInfo.iAddress.IsLoopback() + && !ifInfo.iAddress.IsLinkLocal()) + { + // found a IPv4 address + TBuf8<20> aIP8; + TBuf<20> aIP; + TInetAddr aAddr; + aAddr = ifInfo.iAddress; + aAddr.ConvertToV4(); + aAddr.Output(aIP); + aIP8.Copy(aIP); + + strncpy(ipAddress, (char*) aIP8.Ptr(), + aIP8.Length()); + ipAddress[aIP8.Length()] = '\0'; + ILOG1(ESOCKET, "GetlocalIPAdressLLL , ip = %s", + ipAddress); + sock.Close(); + socketServ.Close(); + ILOG(ESOCKET, "returning from getIpAddr"); + return KErrNone; + } + } // end if addr > 0 + else if (err != KErrNone) + { + sock.Close(); + return err; // return with error + } + } + } // end while + sock.Close(); + socketServ.Close(); + return KErrNone; + +} + /** *In Symbian, when a server connection is opened, it is not bound to any interface *so the openC calls returns "0.0.0.0" as the local address. @@ -43,7 +114,7 @@ int GetlocalIPAdressL(char *localaddr, int aMidletIapId, int aType) { JELOG2(ESOCKET); - + int err = KErrNone; TUint32 activeIapId = 0; TConnectionInfoBuf connectionInfo; TUint count = 0; @@ -103,66 +174,19 @@ continue; // go to the next active IAP } - // find the ip address of the active interface - - TSoInetInterfaceInfo ifInfo; - TPckg ifInfoPkg(ifInfo); - TSoInetIfQuery ifQuery; - TPckg ifQueryPkg(ifQuery); - // To find out which interfaces are using our current IAP, we must - // enumerate and go through all of them and make a query by name for each. - ILOG(ESOCKET, "Looping thru all the destinations and ap \n\n"); - User::LeaveIfError(sock.SetOpt(KSoInetEnumInterfaces, - KSolInetIfCtrl)); - while (sock.GetOpt(KSoInetNextInterface, KSolInetIfCtrl, ifInfoPkg) - == KErrNone) - { - ifQuery.iName = ifInfo.iName; - TInt err = sock.GetOpt(KSoInetIfQueryByName, KSolInetIfQuery, - ifQueryPkg); + // find the ip address of the active IAP + err = getIPAddressL(activeIapId,localaddr); + break; // once we find the IP addr, return - if ((err == KErrNone) && (ifQuery.iZone[1] == activeIapId)) - { - //TUint32 t5 = (TUint32)(ifQuery.iZone[15]); - ILOG2(ESOCKET, "Network id = %d, IAP id = %d ",(TUint32)(ifQuery.iZone[15]),(TUint32)ifQuery.iZone[1]); - - // IAP ID is index 1 of iZone - // We have found an interface using the IAP we are interested in. - if (ifInfo.iAddress.Address() > 0) - if (!ifInfo.iAddress.IsUnspecified() - && !ifInfo.iAddress.IsLoopback() - && !ifInfo.iAddress.IsLinkLocal()) - { - // found a IPv4 address - TBuf8<20> aIP8; - TBuf<20> aIP; - TInetAddr aAddr; - aAddr = ifInfo.iAddress; - aAddr.ConvertToV4(); - aAddr.Output(aIP); - aIP8.Copy(aIP); - - strncpy(localaddr, (char*) aIP8.Ptr(), - aIP8.Length()); - localaddr[aIP8.Length()] = '\0'; - ILOG1(ESOCKET, "GetlocalIPAdressL , ip = %s", - localaddr); - sock.Close(); - return KErrNone; - } - } - else if (err != KErrNone) - { - sock.Close(); - return err; // return with error - } - } // end while } // end for loop } // end else active connection - + ILOG(ESOCKET, "GetlocalIPAdressL , got ip "); + conn.Close(); sock.Close(); - return KErrNotFound; // return with KErrNotFound + socketServ.Close(); + + return err; // return with KErrNotFound } diff -r 4376525cdefb -r e5618cc85d74 javacommons/security/javasrc/com/nokia/mj/impl/security/midp/common/SecurityExtensionsReader.java --- a/javacommons/security/javasrc/com/nokia/mj/impl/security/midp/common/SecurityExtensionsReader.java Mon Jun 21 15:32:50 2010 +0300 +++ b/javacommons/security/javasrc/com/nokia/mj/impl/security/midp/common/SecurityExtensionsReader.java Thu Jul 15 18:31:06 2010 +0300 @@ -327,6 +327,7 @@ String mappingsSystemProperty) { String[] mappings = Tokenizer.split(mappingsSystemProperty, ";"); + Vector validatedPermNames = new Vector(); if (mappings != null) { for (int i=0; i(nativePeerHandle); - int retVal = datagramConn->getLocalAddress(addr); + + int err = SocketLocalHostInfo::getLocalAddress(0,addr,aMidletIapId,aApType); + PLOG2(ESOCKET, "getLocalAddress, ret = %d, addr = %s" , err, addr); jstring jnistring = aJni->NewStringUTF(addr); aJni->SetObjectArrayElement(aAddress, 0, jnistring); aJni->DeleteLocalRef(jnistring); delete[] addr; - return retVal; + + return err; } JNIEXPORT jint JNICALL Java_com_nokia_mj_impl_datagram_UDPDatagramConnectionImpl__1getLocalPort diff -r 4376525cdefb -r e5618cc85d74 javaextensions/datagram/datagram/src/nativedatagramconnection.cpp --- a/javaextensions/datagram/datagram/src/nativedatagramconnection.cpp Mon Jun 21 15:32:50 2010 +0300 +++ b/javaextensions/datagram/datagram/src/nativedatagramconnection.cpp Thu Jul 15 18:31:06 2010 +0300 @@ -98,6 +98,11 @@ LOG(ESOCKET, EInfo, "Datagram client connection"); mSockDesc = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP); + struct sockaddr_in addr; + addr.sin_family = AF_INET; + addr.sin_addr.s_addr = htonl(INADDR_ANY); + int res = bind(mSockDesc, (struct sockaddr*) &addr, sizeof(addr)); + LOG1(ESOCKET, EInfo, "Datagram client connection, bind returned %d",res); if (aApn != -1) { diff -r 4376525cdefb -r e5618cc85d74 javaextensions/wma/sms_cbs/javasrc/com/nokia/mj/impl/sms/SMSPermissionImpl.java --- a/javaextensions/wma/sms_cbs/javasrc/com/nokia/mj/impl/sms/SMSPermissionImpl.java Mon Jun 21 15:32:50 2010 +0300 +++ b/javaextensions/wma/sms_cbs/javasrc/com/nokia/mj/impl/sms/SMSPermissionImpl.java Thu Jul 15 18:31:06 2010 +0300 @@ -84,8 +84,7 @@ formattedDestination = iDestination.substring(1); prefix = "+"; } - formattedDestination = Formatter.formatDigits(formattedDestination) - + prefix; + formattedDestination = prefix + Formatter.formatDigits(formattedDestination); if (iNumberOfSegments > 1) { return (SecurityPromptMessage.getInstance()).getText( diff -r 4376525cdefb -r e5618cc85d74 javamanager/javainstaller/installerui/javasrc/com/nokia/mj/impl/installer/ui/eswt/InstallDetailsView.java --- a/javamanager/javainstaller/installerui/javasrc/com/nokia/mj/impl/installer/ui/eswt/InstallDetailsView.java Mon Jun 21 15:32:50 2010 +0300 +++ b/javamanager/javainstaller/installerui/javasrc/com/nokia/mj/impl/installer/ui/eswt/InstallDetailsView.java Thu Jul 15 18:31:06 2010 +0300 @@ -124,16 +124,11 @@ new String[] { iInstallInfo.getName() }), horizontalSpan, labelStyle); - if (identified) - { - // Vendor information must be displayed only for - // identified applications. - Label vendorLabel = createLabel - (InstallerUiTexts.get - (InstallerUiTexts.VENDOR, - new String[] { iInstallInfo.getVendor() }), - horizontalSpan, labelStyle); - } + Label vendorLabel = createLabel + (InstallerUiTexts.get + (InstallerUiTexts.VENDOR, + new String[] { iInstallInfo.getVendor() }), + horizontalSpan, labelStyle); Label versionLabel = createLabel (InstallerUiTexts.get diff -r 4376525cdefb -r e5618cc85d74 javamanager/javainstaller/installerui/javasrc/com/nokia/mj/impl/installer/ui/eswt/UninstallConfirmationView.java --- a/javamanager/javainstaller/installerui/javasrc/com/nokia/mj/impl/installer/ui/eswt/UninstallConfirmationView.java Mon Jun 21 15:32:50 2010 +0300 +++ b/javamanager/javainstaller/installerui/javasrc/com/nokia/mj/impl/installer/ui/eswt/UninstallConfirmationView.java Thu Jul 15 18:31:06 2010 +0300 @@ -119,16 +119,11 @@ new String[] { iUninstallInfo.getName() }), horizontalSpan, labelStyle); - if (identified) - { - // Vendor information must be displayed only for - // identified applications. - Label vendorLabel = createLabel - (InstallerUiTexts.get - (InstallerUiTexts.VENDOR, - new String[] { iUninstallInfo.getVendor() }), - horizontalSpan, labelStyle); - } + Label vendorLabel = createLabel + (InstallerUiTexts.get + (InstallerUiTexts.VENDOR, + new String[] { iUninstallInfo.getVendor() }), + horizontalSpan, labelStyle); Label versionLabel = createLabel (InstallerUiTexts.get diff -r 4376525cdefb -r e5618cc85d74 javamanager/javainstaller/installerui/javasrc/com/nokia/mj/impl/installer/ui/eswt2/ViewBase.java --- a/javamanager/javainstaller/installerui/javasrc/com/nokia/mj/impl/installer/ui/eswt2/ViewBase.java Mon Jun 21 15:32:50 2010 +0300 +++ b/javamanager/javainstaller/installerui/javasrc/com/nokia/mj/impl/installer/ui/eswt2/ViewBase.java Thu Jul 15 18:31:06 2010 +0300 @@ -536,15 +536,10 @@ if (aFull) { // Add vendor. - if (aInstallInfo.getCertificates() != null) - { - // Vendor information must be displayed only for - // identified applications. - createAppInfoLabel( - InstallerUiTexts.get( - InstallerUiTexts.SUITE_VENDOR, - new String[] { aInstallInfo.getVendor() })); - } + createAppInfoLabel( + InstallerUiTexts.get( + InstallerUiTexts.SUITE_VENDOR, + new String[] { aInstallInfo.getVendor() })); } // Add size. long size = 0; diff -r 4376525cdefb -r e5618cc85d74 javamanager/javaregistry/client/src/writeablejavaregistryentry.cpp --- a/javamanager/javaregistry/client/src/writeablejavaregistryentry.cpp Mon Jun 21 15:32:50 2010 +0300 +++ b/javamanager/javaregistry/client/src/writeablejavaregistryentry.cpp Thu Jul 15 18:31:06 2010 +0300 @@ -303,19 +303,15 @@ AttributesL(); } - CJavaAttribute* regAttr = NULL; for (TInt i = 0; i < iAttributes.Count(); i++) { if (0 == (iAttributes[i])->Name().Compare(aName)) { - regAttr = CJavaAttribute::NewL((iAttributes[i])->Name(), - (iAttributes[i])->Value(), - (iAttributes[i])->Trusted()); - break; + return iAttributes[i]; } } - return regAttr; + return NULL; } // --------------------------------------------------------------------------- diff -r 4376525cdefb -r e5618cc85d74 javamanager/javasettings/appmngrplugin/src/appmngr2midletappinfo.cpp --- a/javamanager/javasettings/appmngrplugin/src/appmngr2midletappinfo.cpp Mon Jun 21 15:32:50 2010 +0300 +++ b/javamanager/javasettings/appmngrplugin/src/appmngr2midletappinfo.cpp Thu Jul 15 18:31:06 2010 +0300 @@ -636,21 +636,18 @@ iDataSize = attribute->Value().AllocL(); } // Description - delete attribute; attribute = aEntry->AttributeL(KMIDletDescription()); // no ownership if (attribute) { iDescription = attribute->Value().AllocL(); } // Info URL - delete attribute; attribute = aEntry->AttributeL(KMIDletInfoURL()); // no ownership if (attribute) { iInfoUrl = attribute->Value().AllocL(); } // Update URL - delete attribute; attribute = aEntry->AttributeL(KNokiaUpdate()); // no ownership if (attribute) { @@ -664,7 +661,6 @@ iUpdateUrl = attribute->Value().AllocL(); } } - delete attribute; // Use localized midlet suite name if it exists attribute = aEntry->AttributeL(KNokiaMIDletName()); // no ownership if (attribute) @@ -676,7 +672,6 @@ // Use non-localized name iLocalizedMIDletName = aEntry->Name().AllocL(); } - delete attribute; RArray midletUids; CleanupClosePushL(midletUids); @@ -696,7 +691,6 @@ if (attribute) { contentLength += attribute->Value().Length(); - delete attribute; } else { @@ -737,7 +731,6 @@ ptrContent.Append(KListSeparatorAndSpace); ptrContent.Append(attribute->Value()); } - delete attribute; } else { @@ -795,7 +788,6 @@ iPermissions = attribute->Value().AllocL(); iPermissions->Des().TrimAll(); } - delete attribute; } LOG(EJavaAppMngrPlugin, EInfo, "- CAppMngr2MidletAppInfo::ConstructL"); diff -r 4376525cdefb -r e5618cc85d74 javaruntimes/starter/build/javamidp_installer.pkg --- a/javaruntimes/starter/build/javamidp_installer.pkg Mon Jun 21 15:32:50 2010 +0300 +++ b/javaruntimes/starter/build/javamidp_installer.pkg Thu Jul 15 18:31:06 2010 +0300 @@ -1,4 +1,4 @@ -; javamidp_installer.pkg generated by qmake at 2010-06-08T10:21:53 +; javamidp_installer.pkg generated by qmake at 2010-06-22T08:16:56 ; This file is generated by qmake and should not be modified by the user ; @@ -27,5 +27,5 @@ -"X:/sf/app/jrt/javaruntimes/starter/build/javamidp.sis" - "c:\adm\javamidp.sis" -@"X:/sf/mw/qt/smartinstaller.sis",(0x2002CCCD) +"R:/sf/app/jrt/javaruntimes/starter/build/javamidp.sis" - "c:\adm\javamidp.sis" +@"R:/sf/mw/qt/smartinstaller.sis",(0x2002CCCD) diff -r 4376525cdefb -r e5618cc85d74 javaruntimes/starter/build/javamidp_template.pkg --- a/javaruntimes/starter/build/javamidp_template.pkg Mon Jun 21 15:32:50 2010 +0300 +++ b/javaruntimes/starter/build/javamidp_template.pkg Thu Jul 15 18:31:06 2010 +0300 @@ -1,4 +1,4 @@ -; javamidp_template.pkg generated by qmake at 2010-06-08T10:21:53 +; javamidp_template.pkg generated by qmake at 2010-06-22T08:16:56 ; This file is generated by qmake and should not be modified by the user ; diff -r 4376525cdefb -r e5618cc85d74 javauis/amms_akn/mmacontrol/src/cammsaudiooutputcontrol.cpp --- a/javauis/amms_akn/mmacontrol/src/cammsaudiooutputcontrol.cpp Mon Jun 21 15:32:50 2010 +0300 +++ b/javauis/amms_akn/mmacontrol/src/cammsaudiooutputcontrol.cpp Thu Jul 15 18:31:06 2010 +0300 @@ -355,6 +355,18 @@ if (deviceType == KAccMonHeadset) { DEBUG("AMMS::CAMMSAudioOutputControl::DisconnectedL: Headset Disconnected"); + iArray.Reset(); + iAccMonitor->GetConnectedAccessoriesL(iArray); + TInt count = iArray.Count(); + if (count != 0) + { + for (TInt i = 0; i != count; i++) + { + TAccMonCapability deviceType = iArray[ i ]->AccDeviceType(); + if (deviceType == KAccMonHeadset) + return; + } + } // If audio o/p preference is default and no accessories is connected or // o/p preference is not private then set the preference as public to // volume control diff -r 4376525cdefb -r e5618cc85d74 javauis/eswt_akn/org.eclipse.ercp.swt.s60/native/inc/swtlabel.h --- a/javauis/eswt_akn/org.eclipse.ercp.swt.s60/native/inc/swtlabel.h Mon Jun 21 15:32:50 2010 +0300 +++ b/javauis/eswt_akn/org.eclipse.ercp.swt.s60/native/inc/swtlabel.h Thu Jul 15 18:31:06 2010 +0300 @@ -56,6 +56,7 @@ TInt MinimumHeight(TInt aLineCount) const; void DoSetFontL(const CFont* aFont); void SwtHandleResourceChangeL(TInt aType); + TInt GetFontHeight(const CFont* aFont) const; // From CCoeControl public: diff -r 4376525cdefb -r e5618cc85d74 javauis/eswt_akn/org.eclipse.ercp.swt.s60/native/src/swtbutton.cpp --- a/javauis/eswt_akn/org.eclipse.ercp.swt.s60/native/src/swtbutton.cpp Mon Jun 21 15:32:50 2010 +0300 +++ b/javauis/eswt_akn/org.eclipse.ercp.swt.s60/native/src/swtbutton.cpp Thu Jul 15 18:31:06 2010 +0300 @@ -213,18 +213,12 @@ iButton->SetBackground(this); // Back will be drawn by ASwtControlBase::Draw // Set default color - TRgb colorNormal; + TRgb color; AknsUtils::GetCachedColor(AknsUtils::SkinInstance(), - colorNormal, + color, KAknsIIDQsnTextColors, - EAknsCIQsnTextColorsCG13); // SK - TRgb colorPressed; - AknsUtils::GetCachedColor(AknsUtils::SkinInstance(), - colorPressed, - KAknsIIDQsnTextColors, - EAknsCIQsnTextColorsCG69); // pressed SK - iButton->OverrideColorL(EColorButtonText, colorNormal); - iButton->OverrideColorL(EColorButtonTextPressed, colorPressed); + EAknsCIQsnTextColorsCG6); + iButton->OverrideColorL(EColorButtonText, color); } // --------------------------------------------------------------------------- @@ -646,13 +640,10 @@ } else { - // Reset to default color - TRgb colorNormal; AknsUtils::GetCachedColor(AknsUtils::SkinInstance(), - colorNormal, + color, KAknsIIDQsnTextColors, - EAknsCIQsnTextColorsCG13); // SK - iButton->OverrideColorL(EColorButtonText, colorNormal); + EAknsCIQsnTextColorsCG6); } if (iButton) diff -r 4376525cdefb -r e5618cc85d74 javauis/eswt_akn/org.eclipse.ercp.swt.s60/native/src/swtcontrolbase.cpp --- a/javauis/eswt_akn/org.eclipse.ercp.swt.s60/native/src/swtcontrolbase.cpp Mon Jun 21 15:32:50 2010 +0300 +++ b/javauis/eswt_akn/org.eclipse.ercp.swt.s60/native/src/swtcontrolbase.cpp Thu Jul 15 18:31:06 2010 +0300 @@ -73,7 +73,12 @@ CSwtLafFacade::EInputFieldSkinPlacingGeneralLine5, rect, 0).Rect().iTl; iFocusFrame = CAknsFrameBackgroundControlContext::NewL( - KAknsIIDQsnFrInput, rect, innerRect, EFalse /*parent absolute*/); +#ifdef RD_JAVA_S60_RELEASE_9_2 + KAknsIIDQsnFrPopupPreview, +#else + KAknsIIDQsnFrInput, +#endif // RD_JAVA_S60_RELEASE_9_2 + rect, innerRect, EFalse /*parent absolute*/); if (iBackgrdDefaultUsed) { diff -r 4376525cdefb -r e5618cc85d74 javauis/eswt_akn/org.eclipse.ercp.swt.s60/native/src/swtlabel.cpp --- a/javauis/eswt_akn/org.eclipse.ercp.swt.s60/native/src/swtlabel.cpp Mon Jun 21 15:32:50 2010 +0300 +++ b/javauis/eswt_akn/org.eclipse.ercp.swt.s60/native/src/swtlabel.cpp Thu Jul 15 18:31:06 2010 +0300 @@ -483,8 +483,7 @@ const CFont* font = iEikLabel->Font(); // Estimate how many text rows within given rectangle - // Use HeightInPixels same as MinimumHeight - TInt textPaneHeight = font->HeightInPixels(); + TInt textPaneHeight = GetFontHeight(font); const TInt gap = iEikLabel->PixelGapBetweenLines(); // The last row in label does not add a gap after it. So... @@ -620,7 +619,7 @@ // This is to fix some fonts getting clipped from above. // Do not change this ever, as wrapping will surely brake. return aLineCount * iEikLabel->PixelGapBetweenLines() - + aLineCount * iEikLabel->Font()->HeightInPixels(); + + aLineCount * GetFontHeight(iEikLabel->Font()); } // --------------------------------------------------------------------------- @@ -649,6 +648,24 @@ } // --------------------------------------------------------------------------- +// CSwtLabel::GetFontHeight +// --------------------------------------------------------------------------- +// +TInt CSwtLabel::GetFontHeight(const CFont* aFont) const +{ + if (!aFont) + { + return 0; + } + +#ifdef RD_JAVA_S60_RELEASE_9_2 + return aFont->FontMaxHeight(); +#else + return aFont->HeightInPixels(); +#endif +} + +// --------------------------------------------------------------------------- // CSwtLabel::Draw // From CCoeControl // --------------------------------------------------------------------------- diff -r 4376525cdefb -r e5618cc85d74 javauis/lcdui_akn/javalcdui/build/build.xml --- a/javauis/lcdui_akn/javalcdui/build/build.xml Mon Jun 21 15:32:50 2010 +0300 +++ b/javauis/lcdui_akn/javalcdui/build/build.xml Thu Jul 15 18:31:06 2010 +0300 @@ -77,7 +77,6 @@ com.nokia.mid.ui.TextEditorImpl, com.nokia.mid.ui.Clipboard, com.nokia.mid.ui.S60TextEditor, - com.nokia.mid.ui.S40TextEditor, com.nokia.mid.ui.TextEditorListener, com.nokia.mid.ui.CanvasGraphicsItem, com.nokia.mid.ui.CanvasGraphicsItemPainter, @@ -96,7 +95,7 @@ com.nokia.keyboard.type=:lcduib.DynamicPropertyHandler com.nokia.key.scancode=:lcduib.DynamicPropertyHandler com.nokia.key.modifier=:lcduib.DynamicPropertyHandler - com.nokia.mid.ui.customfonts=true + com.nokia.mid.ui.customfontsize=true com.nokia.mid.ui.tactilefeedback=true com.nokia.mid.ui.screensaverprevention=true diff -r 4376525cdefb -r e5618cc85d74 javauis/lcdui_akn/javalcdui/inc/MMIDCustomComponent.h --- a/javauis/lcdui_akn/javalcdui/inc/MMIDCustomComponent.h Mon Jun 21 15:32:50 2010 +0300 +++ b/javauis/lcdui_akn/javalcdui/inc/MMIDCustomComponent.h Thu Jul 15 18:31:06 2010 +0300 @@ -40,8 +40,18 @@ */ class MMIDCustomComponent { +public: // new types + /** + * Datatype indicates what change was made. + */ + enum TChange + { + EFullscreenChange, + EResolutionChange, + EPartialVKBChange + }; + public: // New methods - /** * Returns the count of controls in this custom component. * @@ -117,11 +127,13 @@ virtual void HandleFullscreenModeChange() = 0; /** - * Handles changes of screen orientation. + * Handles system resource change messages. + * + * @param aType A message UID value. * * @since S60 5.0 */ - virtual void HandleResolutionChange() = 0; + virtual void HandleResourceChange(TInt aType) = 0; protected: // Destructor diff -r 4376525cdefb -r e5618cc85d74 javauis/lcdui_akn/javalcdui/inc/lcdui.h --- a/javauis/lcdui_akn/javalcdui/inc/lcdui.h Mon Jun 21 15:32:50 2010 +0300 +++ b/javauis/lcdui_akn/javalcdui/inc/lcdui.h Thu Jul 15 18:31:06 2010 +0300 @@ -49,6 +49,7 @@ #include #include #include +#include #ifdef RD_JAVA_NGA_ENABLED #include @@ -133,6 +134,13 @@ } +#ifdef RD_JAVA_S60_RELEASE_9_2 +const TInt KHighlightedItemTextColor = EAknsCIQsnTextColorsCG6; +#else +const TInt KHighlightedItemTextColor = EAknsCIQsnTextColorsCG8; +#endif // RD_JAVA_S60_RELEASE_9_2 +const TInt KNonHighlightedItemTextColor = EAknsCIQsnTextColorsCG6; + /** * diff -r 4376525cdefb -r e5618cc85d74 javauis/lcdui_akn/javalcdui/javasrc.nokialcdui/com/nokia/mid/ui/Clipboard.java --- a/javauis/lcdui_akn/javalcdui/javasrc.nokialcdui/com/nokia/mid/ui/Clipboard.java Mon Jun 21 15:32:50 2010 +0300 +++ b/javauis/lcdui_akn/javalcdui/javasrc.nokialcdui/com/nokia/mid/ui/Clipboard.java Thu Jul 15 18:31:06 2010 +0300 @@ -66,9 +66,7 @@ * Copies characters from the system clipboard. *

* Returns empty string when there is nothing in the system clipboard. - *

- * This method is not supported on S40 platform, returns null. - *

+ * * @return the content in clipboard */ public static String copyFromClipboard() diff -r 4376525cdefb -r e5618cc85d74 javauis/lcdui_akn/javalcdui/javasrc.nokialcdui/com/nokia/mid/ui/S40TextEditor.java --- a/javauis/lcdui_akn/javalcdui/javasrc.nokialcdui/com/nokia/mid/ui/S40TextEditor.java Mon Jun 21 15:32:50 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,320 +0,0 @@ -/* - * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). - * All rights reserved. - * This component and the accompanying materials are made available - * under the terms of "Eclipse Public License v1.0" - * which accompanies this distribution, and is available - * at the URL "http://www.eclipse.org/legal/epl-v10.html". - * - * Initial Contributors: - * Nokia Corporation - initial contribution. - * - * Contributors: - * - * Description: Interface for S40 Text Editor - * - */ - -package com.nokia.mid.ui; - -import javax.microedition.lcdui.Command; -import javax.microedition.lcdui.Image; - -/** - * This interfaces provides access to extended editing-related functionality, - * that is only available on s40-devices:

- * Commands:
- * Applications can use {@link TextEditor#getTextEditorCommands()} and - * {@link TextEditor#launchTextEditorCommand(Command, int)} to present - * editing-commands in a customized way. When launching such a command, - * the application has to specify a command-mode. This is because some commands - * may require information regarding the key-state that has caused this command - * to be launched. For example, calling - * launchTextEditorCommand(cmd, COMMAND_MODE_KEYPRESS) for the "Clear"-command - * will cause to editor to keep deleting characters until the application calls - * launchTextEditorCommand(cmd, COMMAND_MODE_KEYRELEASE). Since not all commands - * require keystate-information, applications can use - * {@link com.nokia.mid.ui.S40TextEditor #isCommandKeyWanted(Command)} - * If no command-key is wanted, COMMAND_MODE_SELECTED should be passed - * when launching this command

- * Indicator-icons
- * It is possible to access the indicator-icons that the platform would normally - * display as Images, using - * {@link com.nokia.mid.ui.S40TextEditor #getIndicatorIcons()}

- * Visibility
- * Applications may be in the situation where they want an editor to be visible, - * but to not process keys or be animated, e.g. while a custom options-menu - * is displayed. In those cases, it is possible to call - * {@link com.nokia.mid.ui.S40TextEditor #setVisible(int)}

- * Extra properties
- * Some properties that are not available in the com.nokia.mid.ui.TextEditor, - * like writing-direction, native emoticon support and positioning for native - * popup-windows.

- * On s40-devices this interface is implemented by the object returned by - * {@link com.nokia.mid.ui.TextEditor#createTextEditor(String, int, int, int, - * int)} if the MIDlet is manufacturer- or operator-signed - * - */ -public abstract interface S40TextEditor -{ - - /** - * command type used to indicate commands - * that should be put on the middle softkey - */ - public final static int SELECT_SOFTKEY_COMMAND = 9; - - /** - * command type used to indicate commands - * that should be put on the right softkey. - */ - public final static int RIGHT_SOFTKEY_COMMAND = 10; - - /** - * command type used to indicate commands - * that should be put as the last one in the option list. - */ - public final static int LAST_IN_OPTIONS_COMMAND = 12; - - /** - * command type used to indicate commands - * that should be put on the left softkey. - */ - public final static int LEFT_SOFTKEY_COMMAND = 13; - - - /** - * constant for left-to-right direction - */ - public static final int DIRECTION_LTR = 0; - - /** - * constant for right-to-left direction - */ - public static final int DIRECTION_RTL = 1; - - /** - * Event that indicates that the applications options-list should be closed. - * The implementation sends this even in a case where the platform - * has displayed further nested options as the result - * of a {@link TextEditor#launchTextEditorCommand(Command)}-call. - * If the user selects one of the nested options (e.g. "copy"), - * the platform will carry out the associated functionality, dismiss - * the native options-popup and send the ACTION_OPTIONS_CLOSED-event, - * in order to indicate that any options-list that the application - * might have displayed should also be closed. - * - */ - public static final int ACTION_OPTIONS_CLOSED = 0x200; - - /** - * Event that indicates a change in the position of this editor. Typically - * one (or both) of the values last returned by - * {@link com.nokia.mid.ui.TextEditor#getContentHeight()} and - * {@link com.nokia.mid.ui.TextEditor#getVisibleContentPosition()} - * will have changed after this event. - * - */ - public static final int ACTION_SCROLLBAR_CHANGED = 0x400; - - /** - * Indicates that the text in this TextEditor is masked according to the - * Oz Mobile Password Masking Scheme - */ - public static final int PASSWORD_MASKED = 0x400000; - - /** - * Indicates that the text in this TextEditor is locked according to the - * Oz Mobile Password Masking Scheme - */ - public static final int PASSWORD_LOCKED = 0x800000; - - /** - * constant value to indicate a hidden/invisible TextEditor - */ - public static final int HIDDEN=0; - - /** - * constant value to indicate partial visibility of a TextEditor. - * A partially visible TextEditor will still be displayed, but not - * receive any key-events, and not have a blinking cursor - */ - public static final int PARTIALLY_VISIBLE=0; - - /** - * constant value to indicate full visibility of a TextEditor - */ - public static final int VISIBLE=0; - - - /** - * Command-mode to indicate that a command is launched without - * keystate-information, e.g. from an options-menu - */ - public static final int COMMAND_MODE_SELECTED=0; - - /** - * Command-mode to indicate that a command is launched with a keypress, - * e.g. by pressing RSK - */ - public static final int COMMAND_MODE_KEYPRESS=0; - - /** - * Command-mode to indicate that a command has been launched - * with a keypress, and that this key has now been released, - * e.g. by releasing the RSK - */ - public static final int COMMAND_MODE_KEYRELEASE=0; - - /** - * Specifies the current input mode of this TextEditor - * @param mode the new input-mode. This should be a value returned by - * {@link TextEditor#getInputMode()} - */ - public void setInputMode(int mode) throws IllegalArgumentException; - - /** - * Gets the current input mode of this TextEditor - * @return the current input mode. This value represents a native - * input-mode, that can be passed to {@link TextEditor#setInputMode(int)} - * - */ - public int getInputMode(); - - /** - * Returns the current set of Editor-Commands - * @return the commands - */ - public Command[] getTextEditorCommands(); - - - - /** - * Executes an editor-option. This method will invoke native functionality - * according to the command. This may be an action in the editor - * (copy, delete,..) which then in turn will cause callbacks to this editors - * TextEditorListener. It may as well cause platform-controlled panels - * (nested options, touch-dialog) to cover part of or the full display.
- * This method should be called from inside the keyPressed()-method. - * @param cmd The command to launch. This has to be a command returned by - * {@link TextEditor#getTextEditorCommands()} - * @return true if launching this command has displayed a list of further - * sub-commands as a popup. if an application has displayed - * an options-menu before launching a command, this options-menu - * should normally stay on the screen after this launch, to indicate - * that the native sub-commands are nested and related to the command - * that has been launched. - * - * @throws IllegalStateException if the TextEditor is not focussed during - * this call - * @throws IllegalArgumentException if the command is not available - * in the editor. Commands that are available in the editor are only - * those that this editor has provided via - * {@link TextEditor#getTextEditorCommands()} - */ - public boolean launchTextEditorCommand(Command cmd,int mode) - throws IllegalStateException, IllegalArgumentException; - - /** - * Gets the menu-state of a Command - * @param cmd The Command to query for Menu-state. This has to be a command - * returned by {@link TextEditor#getTextEditorCommands()} - * @return true if this a Menu Command. Launching a Menu Command will show - * a popup on the display, providing further commands to the user - */ - public boolean isMenuCommand(Command cmd); - - /** - * Returns whether a command requires keystate-information to be launched. - * @param cmd The command to be queried - * @return true if cmd requires keystate-information. In this case, - * one of COMMAND_MODE_KEYPRESS or COMMAND_MODE_KEYRELEASE should be - * passed when launching this command via - * {@link com.nokia.mid.ui.S40TextEditor #launchTextEditorCommand( - * Command, int)} false if cmd does not require keystate-informationl. - * In that case, COMMAND_MODE_SELECTED should be passed - * when launching it. - */ - public boolean isCommandKeyWanted(Command cmd); - - - /** - * Specifies the amount of pixels by which the TextEditor will scroll text - * horizontally, if multiline input is disabled. - * @param offset The scrolling offset. When a cursor-movement requires - * horizontal scrolling of the text, this value indicates by how many - * pixels the text will be moved. - */ - public void setHorizontalScrollingWidth(int offset); - - /** - * Gets the current horizontal scrolling width - * @return the scrolling width - */ - public int getHorizontalScrollingWidth(); - - /** - * Gets the current writing-direction - * @return DIRECTION_LTR or DIRECTION_RTL - */ - public int getWritingDirection(); - - /** - * Gets the current indicator-icons as images - * @return the icons - */ - public Image[] getIndicatorIcons(); - - /** - * Specifies the visibility of this TextEditor. - * In some cases, for example when an application wants to display a custom - * Options-Menu, the method - * {@link com.nokia.mid.ui.TextEditor#setVisible(boolean)} - * may not be sufficient. For this purpose, this method allows to specify - * a partial visibility, which will display the TextEditor without - * e.g. animating the curosr, an in which the application can receive - * the key-events from the Canvas. - * @param visible the type of the visibility. - * Has to be one of VISIBLE,PARTIALLY_VISIBLE or HIDDEN. Calling this - * method with VISIBLE has the same effect as calling - * {@link com.nokia.mid.ui.TextEditor#setVisible(boolean)} with true, - * HIDDEN as with false. - * @throws IllegalArgumentException if visible has an unspecified value - */ - public void setVisible(int visible) throws IllegalArgumentException; - - /** - * Specifies whether emoticons should be available for this editor. - * If not enabled, the implementation will not provide any facilities - * to insert emoticons, e.g. via commands or special character-dialog, - * itself - * @param enable true to enable emoticons, false to disable - */ - public void enableEmoticons(boolean enable); - - /** - * Gets the emoticons-state of this editor - * @return true if emoticons are enabled, false if not - */ - public boolean isEnableEmoticons(); - - /** - * Specifies a position on the screen where native popups will be displayed. - * This is a hint to the implementation, that may be disregarded. - * @param x x-coordinate of the popups position - * @param y y-coordinate of the popups position - */ - public void setPopupPosition(int x,int y); - - /** - * Specifies prefix and postfix text to be displayed along with the actual - * editor-content. This text will not be part of the actual editor-buffer, - * and hence can't be edited, and will not be considered by methods like - * {@link com.nokia.mid.ui.TextEditor#size()} - * @param prefix text to be displayed before the actual content. - * May be null to disable prefix-text - * @param postfix text to be displayed after the actual content. - * May be null to disable postfix-text - */ - public void setFixedText(String prefix,String postfix); -} diff -r 4376525cdefb -r e5618cc85d74 javauis/lcdui_akn/javalcdui/javasrc.nokialcdui/com/nokia/mid/ui/S60TextEditor.java --- a/javauis/lcdui_akn/javalcdui/javasrc.nokialcdui/com/nokia/mid/ui/S60TextEditor.java Mon Jun 21 15:32:50 2010 +0300 +++ b/javauis/lcdui_akn/javalcdui/javasrc.nokialcdui/com/nokia/mid/ui/S60TextEditor.java Thu Jul 15 18:31:06 2010 +0300 @@ -70,6 +70,14 @@ * change and resize, move TextEditor to the visible area and adjust the * whole Canvas. *

+ * + *

Touch settings

+ *

+ * The TextEditor receives touch events in touch devices. This can be + * disabled/enabled by {@link com.nokia.mid.ui.S60TextEditor#setTouchEnabled(boolean)} + * An editor with touch-event disabled won't be able to perform any + * touch-related functionality. + *

* @see TextEditor * @since 1.4 */ @@ -314,7 +322,28 @@ * The y coordinate of the wanted caret position. */ public void setCaretXY(int x, int y); + + /** + * Specifies whether or not the editor will receive touch-events. + *

+ * This is enabled by default. + * An editor with touch-event disabled won't be able to perform any + * touch-related functionality such as scrolling or positioning the + * cursor. It may however still be controlled via the + * virtual keypad/control-panel if that is enabled, or receive other + + * input e.g. via physical keys + *

+ * @param enabled + * true to enabled touch-event, false to disable + */ + public void setTouchEnabled(boolean enabled); + /** + * Gets the current touch-enabled state + *

+ * @return true if the editor is touch-enabled, false otherwise + */ + public boolean isTouchEnabled(); } // End of file diff -r 4376525cdefb -r e5618cc85d74 javauis/lcdui_akn/javalcdui/javasrc.nokialcdui/com/nokia/mid/ui/TextEditor.java --- a/javauis/lcdui_akn/javalcdui/javasrc.nokialcdui/com/nokia/mid/ui/TextEditor.java Mon Jun 21 15:32:50 2010 +0300 +++ b/javauis/lcdui_akn/javalcdui/javasrc.nokialcdui/com/nokia/mid/ui/TextEditor.java Thu Jul 15 18:31:06 2010 +0300 @@ -149,9 +149,6 @@ // The current font of this text editor component private Font iFont; - // Indicates receiving of pointer events by the editor - private boolean iTouchEnabled; - // Text editor container for handling editor focusing. private static TextEditorContainer iEditorContainer; @@ -195,9 +192,8 @@ *

* *

- * On Series60-devices, if the MIDlet is manufacturer or operator-signed, - * the object returned by this method will also implement the - * com.nokia.mid.ui.s60.TextEditor + * On Series60-devices the object returned by this method will also + * implement the com.nokia.mid.ui.S60TextEditor. *

* * @param text @@ -259,9 +255,8 @@ *

* *

- * On Series60-devices, if the MIDlet is manufacturer or operator-signed, - * the object returned by this method will also implement the - * com.nokia.mid.ui.s60.TextEditor + * On Series60-devices the object returned by this method will also + * implement the com.nokia.mid.ui.S60TextEditor. *

* * @param maxSize @@ -619,41 +614,6 @@ } /** - * Specifies whether or not the editor will receive touch-events. - *

- * This is enabled by default. - * An editor with touch-event disabled won't be able to perform any - * touch-related functionality such as scrolling or positioning the - * cursor. It may however still be controlled via the - * virtual keypad/control-panel if that is enabled, or receive other + - * input e.g. via physical keys - *

- * @param enabled - * true to enabled touch-event, false to disable - */ - public void setTouchEnabled(boolean enabled) - { - if (iTouchEnabled != enabled) - { - synchronized (iToolkit) - { - _setTouchEnabled(getToolkitHandle(), iHandle, enabled); - iTouchEnabled = enabled; - } - } - } - - /** - * Gets the current touch-enabled state - *

- * @return true if the editor is touch-enabled, false otherwise - */ - public boolean isTouchEnabled() - { - return iTouchEnabled; - } - - /** *

* Returns the Z-position, or the elevation, of the item. The Z-position * decides the stacking order of neighboring items. @@ -885,17 +845,12 @@ font = Font.getDefaultFont(); } - int[] newSize = new int[2]; - synchronized (iToolkit) { - NativeError.check(_setFont(getToolkitHandle(), iHandle, - iLCDUIPackageInvoker.getFontHandle(font), newSize)); - + NativeError.check(_setFont(getToolkitHandle(), + iHandle, + iLCDUIPackageInvoker.getFontHandle(font))); iFont = font; - - iWidth = newSize[0]; - iHeight = newSize[1]; } } @@ -976,8 +931,6 @@ * rendered using given color value. The default highlight background * color is fully opaque black. * - * This method is not supported on S40 platform. - * * @param color * the color */ @@ -998,8 +951,6 @@ * using given color value. The default highlight foreground color is fully * opaque white. * - * This method is not supported on S40 platform. - * * @param color * the color */ @@ -1442,6 +1393,42 @@ } } + /** + * Gets the height of this TextEditor in pixels. + * + * @return height in pixels + */ + public int getHeight() + { + int[] size = doGetSize(); + return size[1]; + } + + /** + * Gets the width of this TextEditor in pixels. + * + * @return width in pixels + */ + public int getWidth() + { + int[] size = doGetSize(); + return size[0]; + } + + /* + * Gets TextEditor size in pixels - width, height. + */ + private int[] doGetSize() + { + int[] size = new int[2]; + synchronized (iToolkit) + { + NativeError.check(_getSize(getToolkitHandle(), iHandle, + size)); + } + return size; + } + /* * Disposes the Landmark native peer object, if the handles are valid. * Invalid (negative) handles indicate that their creation failed in the @@ -1529,17 +1516,12 @@ int handle = 0; - // The size of the editor must be known after construction. Use return - // values to store the height and width of the editor after - // construction. - int[] size = new int[2]; - synchronized (iToolkit) { // Create native peer object for this Java object. handle = _createNativePeer(getToolkitHandle(), maxSize, aWidth, aHeight, - aHeightInRows, size); + aHeightInRows); } // Check if construction failed and throw out of memory error. @@ -1548,14 +1530,6 @@ throw new OutOfMemoryError(); } - // Operation was a success, store size. - iWidth = size[0]; - iHeight = size[1]; - iMaxSize = maxSize; - - // Enabling receiving pointer events - iTouchEnabled = true; - // Sets parent to null iParent = null; @@ -1573,12 +1547,15 @@ // Set the constraints of the editor. The content is now empty. setConstraints(constraints); - // Set font to Java default font. - setFont(Font.getDefaultFont()); - + // Store the maxSize of the editor + iMaxSize = maxSize; + // Set the text. This now throws an exception if the content is not // valid for the current set of constraints. setContent(aContent); + + // Set font to Java default font. + setFont(Font.getDefaultFont()); } // Private methods. @@ -1678,8 +1655,7 @@ int maxSize, int aWidth, int aHeight, - boolean aHeightInRows, - int[] aSize); + boolean aHeightInRows); /* * Disposes the native side peer object. @@ -2114,16 +2090,13 @@ * @param aFont The application preferred font to be used in this * TextEditor. * - * @param aNewSize On return, contains the new size of the editor. - * * @return NativeError.KErrNone if the operation was successful. Otherwise, * a system-wide error code is returned. */ private native int _setFont( int aToolkitHandle, int aNativePeerHandle, - int aFont, - int[] aNewSize); + int aFont); /* * Sets a listener for this text editor. @@ -2172,21 +2145,16 @@ private native int _getZPosition(int aToolkitHandle, int aNativePeerHandle); /* - * Specifies whether or not the editor will receive touch-events. + * Gets the size of the text editor. + * + * @param aToolkitHandle A handle to the LCDUI toolkit. * - * This is enabled by default. - * An editor with touch-event disabled won't be able to perform any - * touch-related functionality such as scrolling or positioning the - * cursor. It may however still be controlled via the - * virtual keypad/control-panel if that is enabled, or receive other + - * input e.g. via physical keys + * @param aNativePeerHandle A handle to the native side peer object. * - * @param aEnabled - * true to enabled touch-event, false to disable + * @return The size of the TextEditor in pixels. */ - private native int _setTouchEnabled(int aToolkitHandle, - int aNativePeerHandle, boolean aEnabled); - + private native int _getSize(int aToolkitHandle, int aNativePeerHandle, + int[] aSize); } // End of file diff -r 4376525cdefb -r e5618cc85d74 javauis/lcdui_akn/javalcdui/javasrc.nokialcdui/com/nokia/mid/ui/TextEditorExtensionAccess.java --- a/javauis/lcdui_akn/javalcdui/javasrc.nokialcdui/com/nokia/mid/ui/TextEditorExtensionAccess.java Mon Jun 21 15:32:50 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,38 +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: Touch-support for TextEditor-API -* -*/ - -package com.nokia.mid.ui; - -import com.nokia.mid.ui.TextEditorTouchControl; - -/** - * This interface provides access to extended functionality related to the TextEditor-API - * The object returned by the method {@link com.nokia.mid.ui.TextEditor#createTextEditor(int, int, int, int)} and - * {@link com.nokia.mid.ui.TextEditor#createTextEditor(int, int, int, int)} implements this interface. - * It depends on the capabilities of the device whether the extensions provided via this interface are - * supported or not. For unsupported extensions, the getter-methods of this interface will return null. - */ -public interface TextEditorExtensionAccess -{ - - /** - * Gets the Touch-extensions of the TextEditor-API. See also {@link TextEditorTouchControl} - * @return the extension, or null if the device does not support touch. - */ - public TextEditorTouchControl getTouchControl(); - -} diff -r 4376525cdefb -r e5618cc85d74 javauis/lcdui_akn/javalcdui/javasrc.nokialcdui/com/nokia/mid/ui/TextEditorImpl.java --- a/javauis/lcdui_akn/javalcdui/javasrc.nokialcdui/com/nokia/mid/ui/TextEditorImpl.java Mon Jun 21 15:32:50 2010 +0300 +++ b/javauis/lcdui_akn/javalcdui/javasrc.nokialcdui/com/nokia/mid/ui/TextEditorImpl.java Thu Jul 15 18:31:06 2010 +0300 @@ -82,6 +82,9 @@ TOUCH_INPUT_HWR | TOUCH_INPUT_VKB | TOUCH_INPUT_FSQ | TOUCH_INPUT_ITUT | TOUCH_INPUT_FSC | TOUCH_INPUT_MINI_ITUT; + // Indicates receiving of pointer events by the editor + private boolean iTouchEnabled; + /* *

* Creates a new TextEditor object with the given initial contents, @@ -132,6 +135,8 @@ int aHeight) { super(aText, aMaxSize, aConstraints, aWidth, aHeight, false); + // Enabling receiving pointer events + iTouchEnabled = true; } /* @@ -176,6 +181,8 @@ TextEditorImpl(int aMaxSize, int aConstraints, int aWidth, int aRows) { super(null, aMaxSize, aConstraints, aWidth, aRows, true); + // Enabling receiving pointer events + iTouchEnabled = true; } /* @@ -490,6 +497,41 @@ } /* + * Specifies whether or not the editor will receive touch-events. + *

+ * This is enabled by default. + * An editor with touch-event disabled won't be able to perform any + * touch-related functionality such as scrolling or positioning the + * cursor. It may however still be controlled via the + * virtual keypad/control-panel if that is enabled, or receive other + + * input e.g. via physical keys + *

+ * @param enabled + * true to enabled touch-event, false to disable + */ + public void setTouchEnabled(boolean enabled) + { + if (iTouchEnabled != enabled) + { + synchronized (iToolkit) + { + _setTouchEnabled(getToolkitHandle(), iHandle, enabled); + iTouchEnabled = enabled; + } + } + } + + /* + * Gets the current touch-enabled state + *

+ * @return true if the editor is touch-enabled, false otherwise + */ + public boolean isTouchEnabled() + { + return iTouchEnabled; + } + + /* * Hidden default constructor. */ private TextEditorImpl() @@ -652,6 +694,22 @@ int aNativePeerHandle, int x, int y); + + /* + * Specifies whether or not the editor will receive touch-events. + * + * This is enabled by default. + * An editor with touch-event disabled won't be able to perform any + * touch-related functionality such as scrolling or positioning the + * cursor. It may however still be controlled via the + * virtual keypad/control-panel if that is enabled, or receive other + + * input e.g. via physical keys + * + * @param aEnabled + * true to enabled touch-event, false to disable + */ + private native int _setTouchEnabled(int aToolkitHandle, + int aNativePeerHandle, boolean aEnabled); } // End of file diff -r 4376525cdefb -r e5618cc85d74 javauis/lcdui_akn/javalcdui/javasrc.nokialcdui/com/nokia/mid/ui/TextEditorTouchControl.java --- a/javauis/lcdui_akn/javalcdui/javasrc.nokialcdui/com/nokia/mid/ui/TextEditorTouchControl.java Mon Jun 21 15:32:50 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,164 +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: TextEditor-API alignment for Nokia-UI -* -*/ -package com.nokia.mid.ui; - -import com.nokia.mid.ui.TextEditorListener; - -/** - * Touch-devices can use a virtual control-panel to replace physical keys, and to facilitate - * textual input. The purpose of this interface is to provide some level of access and control over such a panel, when - * using the TextEditor-API.

- * - * MIDlets can obtain an instance of this interface via the {@link TextEditorExtensionAccess} in the - * following way: - *

- * TextEditor editor = com.nokia.mid.ui.TextEditor.createTextEditor("hello world", 50, TextField.ANY, 100, 100);
- * TextEditorTouchControl touchControl = ((TextEditorExtensionAccess)editor).getTouchControl();
- * if(touchControl!=null){
- *   // this is a touch-device
- * }
- * else{
- *   // this is a non-touch-device
- * }
- * 
- * The instance is associated with the editor it has been obtained from, and controls only this editor.

- * - * Because a control-panel covers parts of the display which would otherwise be available to the application, MIDlets may - * choose to only display the panel at certain times, e.g. when the editor is focussed. This is possible with - * {@link TextEditorTouchControl#setPanelMode(int)}. Furthermore, a panel can be positioned anywhere an the display via - * {@link TextEditorTouchControl#setPanelPosition(int, int)}. This interface also allows to query the size of the panel, so - * that applications can integrate it into the Canvas.

- * - * On touch-devices, the platform can make use of pointer-input to let the user interact with a TextEditor on a Canvas, without - * that the application knows about this. For example, if the user taps with his stylus or finger somewhere inside a visible - * and focussed TextEditor, the MIDlet might not receive any notification about this via the Canvas-methods pointerPressed, - * pointerDragged or pointerReleased. Instead, the platform could change the position of the cursor and generate the - * according event for the editors {@link TextEditorListener}. Or it may even just ignore this event completely. In general, - * an application should not expect to receive any pointer-events after a "press" inside a focussed TextEditor. - * Under certain circumstances however, for example as a response to the {@link TextEditorTouchControl#ACTION_TRAVERSE_OUT_SCROLL_UP} - * or {@link TextEditorTouchControl#ACTION_TRAVERSE_OUT_SCROLL_DOWN} event, an application can decide at any time to override this - * behaviour, and force the platform to deliver all subsequent pointer-events to the Canvas. - * This can be done with {@link TextEditorTouchControl#setTouchEnabled(boolean)}. Note that a TextEditor which has been touch-disabled - * this way will not be able to perform any interaction like cursor-positioning or scrolling via touch-input, until is has been - * enabled again. - */ -public interface TextEditorTouchControl -{ - - - //native_const(JAVA_TEXTEDITOR) - //{ - - /** - * Constant to disable the display of a keypad/control-panel - */ - public static final int PANEL_OFF = 1; - - /** - * Constant to enable the display of a keypad/control-panel. - * In this mode the user cannot change the position of the panel, however - * the MIDlet can still do so via {@link TextEditorTouchControl#setPanelPosition(int, int)} - */ - public static final int PANEL_FIXED_POSITION = 2; - - /** - * Constant to enable the display of a keypad/control-panel. - * In this mode, the user can change the position of the panel of the display e.g. by - * dragging, if this is supported by the device. Changes to the position will generate the - * {@link TextEditorTouchControl#ACTION_PANEL_MOVED}-event. The current panel-position is - * provided via {@link TextEditorTouchControl#getPanelX()} and {@link TextEditorTouchControl#getPanelY()} - */ - public static final int PANEL_FLOATING = 3; - //} - - /** - * Event to indicate that the keypad/control-panel has been moved by the user - */ - public static final int ACTION_PANEL_MOVED = 0x10000000; - - - /** - * Controls the behaviour of the virtual keypad/control-panel, if the device provides one. - * This is a hint which may be disregarded if the device does not support a virtual keypad/control-panel. - * @param mode One of {@link TextEditorTouchControl#PANEL_OFF} {@link TextEditorTouchControl#PANEL_FIXED_POSITION} - * or {@link TextEditorTouchControl#PANEL_FLOATING} - */ - public void setPanelMode(int mode); - - /** - * Gets the current panel-mode - * @return the mode, see {@link TextEditorTouchControl#setPanelMode(int)} - */ - public int getPanelMode(); - - /** - * Sets the position of the panel on the display. - * @param x x-position of the keypad - * @param y y-position of the keypad - */ - public void setPanelPosition(int x, int y); - - /** - * Gets the width of the panel - * @return the width - */ - public int getPanelWidth(); - - /** - * Gets the height of the panel - * @return the height - */ - public int getPanelHeight(); - - /** - * Gets the current x-position of the panel on the display - * @return the x-coordinate - */ - public int getPanelX(); - - /** - * Gets the current y-position of the panel on the display - * @return the y-coordinate - */ - public int getPanelY(); - - /** - * Specifies whether or not the editor will receive touch-events. This is enabled by default. - * An editor with touch-event disabled won't be able to perform any touch-related functionality - * such as scrolling or positioning the cursor. It may however still be controlled via the - * virtual keypad/control-panel if that is enabled, or receive other input e.g. via physical - * keys - * @param enabled true to enabled touch-event, false to disable - */ - public void setTouchEnabled(boolean enabled); - - /** - * Gets the current touch-enabled state - * @return true if the editor is touch-enabled, false otherwise - */ - public boolean isTouchEnabled(); - - /** - * Sets the caret as close as possible to a given x/y location. This is a hint to the implementation - * that may be disregarded. - * @param x new x-coordinate for the caret, relative to the editors origin - * @param y new y-coordinate for the caret, relative to the editors origin - */ - public void setCaret(int x, int y); - - -} diff -r 4376525cdefb -r e5618cc85d74 javauis/lcdui_akn/javalcdui/javasrc/javax/microedition/lcdui/Toolkit.java --- a/javauis/lcdui_akn/javalcdui/javasrc/javax/microedition/lcdui/Toolkit.java Mon Jun 21 15:32:50 2010 +0300 +++ b/javauis/lcdui_akn/javalcdui/javasrc/javax/microedition/lcdui/Toolkit.java Thu Jul 15 18:31:06 2010 +0300 @@ -95,7 +95,7 @@ // NGA specific change private int iFlags = FLAG_NONE; - + // // Event source : must keep in sync with TSourceType in lcdui.h // @@ -128,14 +128,14 @@ static final int EVENT_TRAVERSE = 26; static final int EVENT_SET_CURRENT = 29; static final int EVENT_SERIAL = 30; - + static final int EVET_CANVAS_GRAPHICS_ITEM_REPAINT = 31; static final int EVENT_M3G_DRAW = 32 ; // IMPLICIT EVENT TYPES static final int EVENT_DISMISS = 0; // ALERT static final int EVENT_ITEM_CHANGED = 0; // ITEM(S) static final int EVENT_SELECT = 0; // LIST - + // // Op codes for syncing to screen @@ -147,7 +147,7 @@ // NGA specific change. // Op code indicating M3G content start private static final int M3G_CONTENT_START = 2; - + Toolkit(ToolkitInvoker aInvoker) { iInvoker = aInvoker; @@ -582,8 +582,8 @@ { if (iObservers.elementAt(ii) instanceof ToolkitObserverNGAExtension) { - final ToolkitObserverNGAExtension observer = - (ToolkitObserverNGAExtension)iObservers.elementAt(ii); + final ToolkitObserverNGAExtension observer = + (ToolkitObserverNGAExtension)iObservers.elementAt(ii); observer.foregroundEvent(foreground); } } diff -r 4376525cdefb -r e5618cc85d74 javauis/lcdui_akn/javalcdui/javasrc/javax/microedition/lcdui/ToolkitInvoker.java --- a/javauis/lcdui_akn/javalcdui/javasrc/javax/microedition/lcdui/ToolkitInvoker.java Mon Jun 21 15:32:50 2010 +0300 +++ b/javauis/lcdui_akn/javalcdui/javasrc/javax/microedition/lcdui/ToolkitInvoker.java Thu Jul 15 18:31:06 2010 +0300 @@ -287,17 +287,17 @@ } return ((Graphics)aGraphics).iHandle; } - + /* * @see com.nokia.mj.impl.rt.legacy.ToolkitInvoker#isForeground() - */ + */ public boolean isForeground() { Toolkit toolkit = getCurrentToolkit(); - if (toolkit != null) + if (toolkit != null) { Display display = toolkit.getDisplay(); - if (display != null) + if (display != null) { return display.IsForeground(); } diff -r 4376525cdefb -r e5618cc85d74 javauis/lcdui_akn/javalcdui/src.nokialcdui/TextEditor.cpp --- a/javauis/lcdui_akn/javalcdui/src.nokialcdui/TextEditor.cpp Mon Jun 21 15:32:50 2010 +0300 +++ b/javauis/lcdui_akn/javalcdui/src.nokialcdui/TextEditor.cpp Thu Jul 15 18:31:06 2010 +0300 @@ -92,8 +92,7 @@ TInt aMaxSize, TInt aWidth, TInt aHeight, - TBool aHeightInRows, - TSize* aSize) + TBool aHeightInRows) { // Get LCDUI component factory. MMIDComponentFactory* factory = aToolkit->ComponentFactory(); @@ -110,9 +109,6 @@ // Component can be popped from the cleanup stack. CleanupPopComponent(textEditor); - - // Store the size of the text editor. - *aSize = textEditor->EditorSize(); } /* @@ -127,8 +123,7 @@ jint aMaxSize, jint aWidth, jint aHeight, - jboolean aHeightInRows, - jintArray aSize) + jboolean aHeightInRows) { DEBUG("TextEditor.cpp - createNativePeer +"); @@ -136,7 +131,6 @@ jobject peer = aJniEnv->NewWeakGlobalRef(aPeer); TInt handle = -1; - TSize size; TInt error = toolkit->ExecuteTrap( &CreateNativePeerL, @@ -146,19 +140,9 @@ aMaxSize, aWidth, aHeight, - (TBool)aHeightInRows, - &size); + (TBool)aHeightInRows); - // Store returned size. - if (error == KErrNone) - { - jint sizeArray[ 2 ] = { size.iWidth, size.iHeight }; - aJniEnv->SetIntArrayRegion(aSize, 0, 2, sizeArray); - - DEBUG_INT2("TextEditor.cpp - createNativePeer -, width=%d height=%d", - size.iWidth, size.iHeight); - } - else + if (error != KErrNone) { // Global reference must be removed at this point if construction // failed for some reason. @@ -436,45 +420,6 @@ } /** - * Local helper function for setting the touch enabled state of a text editor - * - * @param aTextEditor The text editor object to be modified. - * @param aEnabled The touch enabled status of the text editor to be set. - */ -LOCAL_C void SetTouchEnabled( - MMIDTextEditor* aTextEditor, - TBool aEnabled) -{ - aTextEditor->SetTouchEnabled(aEnabled); -} - -/* - * Class: com_nokia_mid_ui_TextEditor - * Method: _setTouchEnabled - * Signature: (IIZ)I - */ -JNIEXPORT jint JNICALL Java_com_nokia_mid_ui_TextEditor__1setTouchEnabled( - JNIEnv* /* aJniEnv */, - jobject /* aPeer */, - jint aToolkitHandle, - jint aNativePeerHandle, - jboolean aEnabled) -{ - DEBUG("TextEditor.cpp - setTouchEnabled +"); - - CMIDToolkit* toolkit = JavaUnhand< CMIDToolkit >(aToolkitHandle); - - MMIDTextEditor* editor = - MIDUnhandObject< MMIDTextEditor >(aNativePeerHandle); - - toolkit->ExecuteV(&SetTouchEnabled, editor, (TBool)aEnabled); - - DEBUG("TextEditor.cpp - setTouchEnabled -"); - - return KErrNone; -} - -/** * Local helper function for setting the focus state of a text editor * * @param aTextEditor The text editor object to be modified. @@ -1310,17 +1255,12 @@ * * @param aEditor The editor. * @param aFont The font to be set. - * @param aSize On return, contains the new size of the editor. */ LOCAL_C void SetFontL( MMIDTextEditor* aEditor, - MMIDFont* aFont, - TSize* aSize) + MMIDFont* aFont) { aEditor->SetFontL(aFont); - - // Store the size of the text editor. - *aSize = aEditor->EditorSize(); } /* @@ -1329,12 +1269,11 @@ * Signature: (III)I */ JNIEXPORT jint JNICALL Java_com_nokia_mid_ui_TextEditor__1setFont( - JNIEnv* aJniEnv, + JNIEnv* /* aJniEnv */, jobject /* aPeer */, jint aToolkitHandle, jint aNativePeerHandle, - jint aFontHandle, - jintArray aNewSize) + jint aFontHandle) { DEBUG("TextEditor.cpp - setFont +"); @@ -1344,22 +1283,11 @@ MIDUnhandObject< MMIDTextEditor >(aNativePeerHandle); MMIDFont* font = MIDUnhandObject< MMIDFont >(aFontHandle); - TSize size; TInt error = toolkit->ExecuteTrap( &SetFontL, editor, - font, - &size); - - if (error == KErrNone) - { - jint sizeArray[ 2 ] = { size.iWidth, size.iHeight }; - aJniEnv->SetIntArrayRegion(aNewSize, 0, 2, sizeArray); - - DEBUG_INT2("TextEditor.cpp - setFont -, width=%d height=%d", - size.iWidth, size.iHeight); - } + font); DEBUG_INT("TextEditor.cpp - setFont -, error=%d", error); @@ -1525,4 +1453,47 @@ DEBUG("TextEditor.cpp - dispose -"); } +/** + * Local helper function for getting the size of the text editor. + * + * @param aEditor The editor. + * @param aSize On return, contains the new size of the editor. + */ +LOCAL_C void EditorSize( + MMIDTextEditor* aEditor, + TSize* aSize) +{ + // Store the size of the text editor. + *aSize = aEditor->EditorSize(); +} + +/* + * Class: com_nokia_mid_ui_TextEditor + * Method: _getSize + * Signature: (III)V + */ +JNIEXPORT jint JNICALL Java_com_nokia_mid_ui_TextEditor__1getSize( + JNIEnv* aJniEnv, + jobject /* aPeer */, + jint aToolkitHandle, + jint aNativePeerHandle, + jintArray aNewSize) +{ + DEBUG("TextEditor.cpp - getSize +"); + + CMIDToolkit* toolkit = JavaUnhand< CMIDToolkit >(aToolkitHandle); + + MMIDTextEditor* editor = + MIDUnhandObject< MMIDTextEditor >(aNativePeerHandle); + + TSize size; + + toolkit->ExecuteV(&EditorSize, editor, &size); + + jint sizeArray[2] = {size.iWidth, size.iHeight}; + aJniEnv->SetIntArrayRegion(aNewSize, 0, 2, sizeArray); + + DEBUG("TextEditor.cpp - getSize"); + return KErrNone; +} // End of file diff -r 4376525cdefb -r e5618cc85d74 javauis/lcdui_akn/javalcdui/src.nokialcdui/TextEditorImpl.cpp --- a/javauis/lcdui_akn/javalcdui/src.nokialcdui/TextEditorImpl.cpp Mon Jun 21 15:32:50 2010 +0300 +++ b/javauis/lcdui_akn/javalcdui/src.nokialcdui/TextEditorImpl.cpp Thu Jul 15 18:31:06 2010 +0300 @@ -386,4 +386,43 @@ return error; } +/** + * Local helper function for setting the touch enabled state of a text editor + * + * @param aTextEditor The text editor object to be modified. + * @param aEnabled The touch enabled status of the text editor to be set. + */ +LOCAL_C void SetTouchEnabled( + MMIDTextEditor* aTextEditor, + TBool aEnabled) +{ + aTextEditor->SetTouchEnabled(aEnabled); +} + +/* + * Class: com_nokia_mid_ui_TextEditorImpl + * Method: _setTouchEnabled + * Signature: (IIZ)I + */ +JNIEXPORT jint JNICALL Java_com_nokia_mid_ui_TextEditorImpl__1setTouchEnabled( + JNIEnv* /* aJniEnv */, + jobject /* aPeer */, + jint aToolkitHandle, + jint aNativePeerHandle, + jboolean aEnabled) +{ + DEBUG("TextEditor.cpp - setTouchEnabled +"); + + CMIDToolkit* toolkit = JavaUnhand< CMIDToolkit >(aToolkitHandle); + + MMIDTextEditor* editor = + MIDUnhandObject< MMIDTextEditor >(aNativePeerHandle); + + toolkit->ExecuteV(&SetTouchEnabled, editor, (TBool)aEnabled); + + DEBUG("TextEditor.cpp - setTouchEnabled -"); + + return KErrNone; +} + // End of file diff -r 4376525cdefb -r e5618cc85d74 javauis/lcdui_akn/javalcdui/src/CMIDToolkit.cpp --- a/javauis/lcdui_akn/javalcdui/src/CMIDToolkit.cpp Mon Jun 21 15:32:50 2010 +0300 +++ b/javauis/lcdui_akn/javalcdui/src/CMIDToolkit.cpp Thu Jul 15 18:31:06 2010 +0300 @@ -569,7 +569,7 @@ mFirst = EFalse; } } - + // Stop the start screen if it is still active. java::ui::CoreUiAvkonAppUi* appUi = java::ui::CoreUiAvkonLcdui::getInstance().getJavaUiAppUi(); if (appUi && appUi->hasStartScreen()) diff -r 4376525cdefb -r e5618cc85d74 javauis/lcdui_akn/lcdgd/src/lcdgdev.cpp --- a/javauis/lcdui_akn/lcdgd/src/lcdgdev.cpp Mon Jun 21 15:32:50 2010 +0300 +++ b/javauis/lcdui_akn/lcdgd/src/lcdgdev.cpp Thu Jul 15 18:31:06 2010 +0300 @@ -514,10 +514,9 @@ TUint32 srcColor = *(TUint32*)colorAddr; TUint32 mask = (TUint32)(((TInt32)srcColor) >> 24); // Sign extend down. - ASSERT(mask == 0 || mask == (TUint32)-1); #ifdef RD_JAVA_NGA_ENABLED - if (mask) + if (mask == (TUint32)-1) { // Note that the target is not always opaque anymore dstColor = srcColor; diff -r 4376525cdefb -r e5618cc85d74 javauis/lcdui_akn/lcdui/inc/CMIDCanvas.h --- a/javauis/lcdui_akn/lcdui/inc/CMIDCanvas.h Mon Jun 21 15:32:50 2010 +0300 +++ b/javauis/lcdui_akn/lcdui/inc/CMIDCanvas.h Thu Jul 15 18:31:06 2010 +0300 @@ -1290,9 +1290,10 @@ /** * Pixel source is activated when canvas has a frame ready to be passed * to Alf composition. + * @param aDrawingOngoing Flag if system drawing is on now. * @since S60 9.2 */ - void ActivatePixelSourceL(); + void ActivatePixelSourceL(TBool aDrawingOngoing); /** * Suspending pixel source releases its resources on graphics HW. @@ -1584,6 +1585,11 @@ */ TBool iForeground; +#ifdef RD_JAVA_S60_RELEASE_9_2 + // Indicates state of partial VKB + TBool iPartialVKBOpen; +#endif + #ifdef RD_JAVA_NGA_ENABLED /** diff -r 4376525cdefb -r e5618cc85d74 javauis/lcdui_akn/lcdui/inc/CMIDCanvasGraphicsItem.h --- a/javauis/lcdui_akn/lcdui/inc/CMIDCanvasGraphicsItem.h Mon Jun 21 15:32:50 2010 +0300 +++ b/javauis/lcdui_akn/lcdui/inc/CMIDCanvasGraphicsItem.h Thu Jul 15 18:31:06 2010 +0300 @@ -155,11 +155,13 @@ void HandleFullscreenModeChange(); /** - * Handles changes of screen orientation. + * Handles system resource change messages. + * + * @param aType A message UID value. * * @since S60 5.0 */ - void HandleResolutionChange(); + void HandleResourceChange(TInt aType); public: // From MMIDScalable @@ -268,6 +270,16 @@ */ void Dispose(); +private: // own methods + /** + * This method is called when some change which can affect scaling + * of CanvasGraphicsItem. + * + * @param aChange Indicator what change was occurred. + * @since S60 5.0 + */ + void HandleChangeForScaling(TChange aChange); + private: // Construtors /** @@ -298,6 +310,11 @@ // A non-scaled position of item. Needed by scaling. TPoint iNonScaledPosition; + +#ifdef RD_JAVA_S60_RELEASE_9_2 + // Indicates state of partial VKB + TBool iPartialVKBOpen; +#endif }; #endif // CMIDCANVASGRAPHICSITEM_H diff -r 4376525cdefb -r e5618cc85d74 javauis/lcdui_akn/lcdui/inc/CMIDControlItem.h --- a/javauis/lcdui_akn/lcdui/inc/CMIDControlItem.h Mon Jun 21 15:32:50 2010 +0300 +++ b/javauis/lcdui_akn/lcdui/inc/CMIDControlItem.h Thu Jul 15 18:31:06 2010 +0300 @@ -120,14 +120,29 @@ inline TBool GetVisibilityInForm(); inline void SetVisibilityInForm(const TBool aVisibility); + /** + * Sets the iHighlighted flag. Used by CMIDForm. + */ + inline void SetHighlight(const TBool aHighlight); + + /** + * Returns ETrue, if item is highlighted on Form. + */ + inline TBool IsHighlighted(); + protected: CCoeEnv* iCoeEnv; CMIDItemLabel* iLabelControl; // The label for the control - //The background control context for when the item is highlighted + // The background control context for when the item is highlighted CAknsFrameBackgroundControlContext* iHighlightedBackgroundCc; TBool iVisibilityInForm; + + // This flag is true, if item on Form is currently highlighted. + // Flag is used for returning correct background content + // (see MopSupplyObject). + TBool iHighlighted; }; inline void CMIDControlItem::SetSizeQuiet(const TSize& aSize) @@ -155,4 +170,14 @@ iVisibilityInForm = aVisibility; } +inline void CMIDControlItem::SetHighlight(const TBool aHighlight) +{ + iHighlighted = aHighlight; +} + +inline TBool CMIDControlItem::IsHighlighted() +{ + return iHighlighted; +} + #endif // CMIDCONTROLITEM_H diff -r 4376525cdefb -r e5618cc85d74 javauis/lcdui_akn/lcdui/inc/CMIDDateFieldItem.h --- a/javauis/lcdui_akn/lcdui/inc/CMIDDateFieldItem.h Mon Jun 21 15:32:50 2010 +0300 +++ b/javauis/lcdui_akn/lcdui/inc/CMIDDateFieldItem.h Thu Jul 15 18:31:06 2010 +0300 @@ -139,6 +139,11 @@ **/ void UpdateMemberVariables(); + /** + * Updates color for text in date editor when focus is changed. + */ + void UpdateTextColorsL(); + private: // data CEikTTimeEditor* iEditor; diff -r 4376525cdefb -r e5618cc85d74 javauis/lcdui_akn/lcdui/inc/CMIDTextBoxQueryDialog.h --- a/javauis/lcdui_akn/lcdui/inc/CMIDTextBoxQueryDialog.h Mon Jun 21 15:32:50 2010 +0300 +++ b/javauis/lcdui_akn/lcdui/inc/CMIDTextBoxQueryDialog.h Thu Jul 15 18:31:06 2010 +0300 @@ -314,7 +314,7 @@ TTypeUid::Ptr MopSupplyObject(TTypeUid aId); - void CMIDTextBoxQueryDialog::SetRightScrollBarPosition(); + void UpdateScrollBarPositionL(); private: inline TUint GetConstraints() const; @@ -394,14 +394,6 @@ * Used key event */ const TKeyEvent* iusedKeyEvent; - /** - * Count line of text in iEditor - */ - TInt iLastCountLine; - /** - * Rect of Editor - */ - TRect iEditorRect; /** * Used when ConstraintsValidForText decide diff -r 4376525cdefb -r e5618cc85d74 javauis/lcdui_akn/lcdui/inc/CMIDTextEditor.h --- a/javauis/lcdui_akn/lcdui/inc/CMIDTextEditor.h Mon Jun 21 15:32:50 2010 +0300 +++ b/javauis/lcdui_akn/lcdui/inc/CMIDTextEditor.h Thu Jul 15 18:31:06 2010 +0300 @@ -672,6 +672,15 @@ void HandleResolutionChange(); /** + * Handles system resource change messages. + * + * @param aType A message UID value. + * + * @since S60 5.0 + */ + void HandleResourceChange(TInt aType); + + /** * Sets the caret in the Editor at x, y location. * * @param x @@ -803,6 +812,15 @@ */ HBufC* ConvertedContentLC(const TDesC& aContent); + /** + * This method is called when some change affects scaling + * of CanvasGraphicsItem. + * + * @param aChange Indicator what change was occurred. + * @since S60 5.0 + */ + void HandleChangeForScaling(TChange aChange); + private: // Construtors /** @@ -858,6 +876,11 @@ // Nonscaled editor size. This is needed for correct scaling. TSize iNonScaledEditorSize; +#ifdef RD_JAVA_S60_RELEASE_9_2 + // Indicates state of partial VKB + TBool iPartialVKBOpen; +#endif + #ifdef RD_TACTILE_FEEDBACK // True if editor is already connected to the pen input server TBool iPenInputServerConnected; diff -r 4376525cdefb -r e5618cc85d74 javauis/lcdui_akn/lcdui/inc/CMIDTextFieldItem.h --- a/javauis/lcdui_akn/lcdui/inc/CMIDTextFieldItem.h Mon Jun 21 15:32:50 2010 +0300 +++ b/javauis/lcdui_akn/lcdui/inc/CMIDTextFieldItem.h Thu Jul 15 18:31:06 2010 +0300 @@ -146,6 +146,11 @@ void ConstructL(const TDesC& aLabel,const TDesC& aText,TInt aConstraints,TInt aMaxSize); CMIDEdwin* TextComponent() const; + /** + * Updates color for text in editor when focus is changed. + */ + void UpdateTextColorsL(); + public: /** * Sets the cursor visiblity for the text field (=edwin) when this item is focused. diff -r 4376525cdefb -r e5618cc85d74 javauis/lcdui_akn/lcdui/src/CMIDCanvas.cpp --- a/javauis/lcdui_akn/lcdui/src/CMIDCanvas.cpp Mon Jun 21 15:32:50 2010 +0300 +++ b/javauis/lcdui_akn/lcdui/src/CMIDCanvas.cpp Thu Jul 15 18:31:06 2010 +0300 @@ -50,7 +50,7 @@ #include #ifdef RD_JAVA_S60_RELEASE_9_2 // Used with partial VKB -#include +#include #endif // RD_JAVA_S60_RELEASE_9_2 #include "javaoslayer.h" @@ -1089,6 +1089,13 @@ PostEvent(EPaint, posPacked, sizePacked); } + + // If is added first direct content, then NGA is switched off + // and move of iViewRect is needed. + if (iFullScreen && iScalingOn && iDirectContents.Count() == 1) + { + iViewRect.Move(-iPositionRelativeToScreen); + } #endif // RD_JAVA_NGA_ENABLED } @@ -1110,6 +1117,14 @@ if (iDirectContents.Count() == 0) { iRestoreContentWhenUnfaded = EFalse; +#ifdef RD_JAVA_NGA_ENABLED + // If is removed last direct content, then NGA is switched on + // and move of iViewRect is needed. + if (iScalingOn && iFullScreen) + { + iViewRect.Move(iPositionRelativeToScreen); + } +#endif // RD_JAVA_NGA_ENABLED } } } @@ -1461,6 +1476,7 @@ return iDisplayable; } #endif // RD_JAVA_S60_RELEASE_9_2 + // --------------------------------------------------------------------------- // CMIDCanvas::SetComponentIndexL // Changes the index of the specified custom component. @@ -1758,7 +1774,7 @@ if (!IsEglAvailable()) { // No M3G content, use pixel source - ActivatePixelSourceL(); + ActivatePixelSourceL(EFalse); DEBUG("CMIDCanvas::Draw - Pixel Source activated"); } else // M3G content, use EGL surface @@ -2097,22 +2113,38 @@ void CMIDCanvas::HandleResourceChange(TInt aType) { #ifdef RD_JAVA_S60_RELEASE_9_2 - if ((aType == KEikInputLanguageChange) | - (aType == KAknSplitInputEnabled) | + if ((aType == KAknSplitInputEnabled) | (aType == KAknSplitInputDisabled)) + { + // We need inform CanvasItems that partial virtual keyboard + // is open or closed. This is needed only when partial VKB changes + // its state. + TBool partialVKBOpen = (aType == KAknSplitInputEnabled); + if (partialVKBOpen != iPartialVKBOpen) + { + iPartialVKBOpen = partialVKBOpen; + for (int i = 0; i < iCustomComponents.Count(); i++) + { + iCustomComponents[i]->HandleResourceChange(aType); + } + } + } + else if (aType == KEikInputLanguageChange) #else if (aType == KEikInputLanguageChange) #endif // RD_JAVA_S60_RELEASE_9_2 { + // We need inform TextEditor that input language is changed. if ((iFocusedComponent != KComponentFocusedNone) && - (iFocusedComponent < iCustomComponents.Count())) + (iFocusedComponent < iCustomComponents.Count())) { iCustomComponents[iFocusedComponent]-> CustomComponentControl(KComponentMainControl)-> HandleResourceChange(aType); } - } - if (aType == KEikDynamicLayoutVariantSwitch) + + } + else if (aType == KEikDynamicLayoutVariantSwitch) { // If orientation change is done, // then we have to inform all components about it. @@ -2120,7 +2152,7 @@ { for (int i = 0; i < iCustomComponents.Count(); i++) { - iCustomComponents[i]->HandleResolutionChange(); + iCustomComponents[i]->HandleResourceChange(aType); } } } @@ -2288,9 +2320,11 @@ // iViewRect.iBr - TSize(1, 1) -> (iContentSize.iWidth - 1, // iContentSize.iHeight - 1) point -= iViewRect.iTl; - + #ifdef RD_JAVA_NGA_ENABLED - if (iFullScreen && iScalingOn) + // If NGA is started and scaling is on then the drawing rectangle + // is moved. Them we need move pointer events too. + if (iFullScreen && iScalingOn && iDirectContents.Count() == 0) { // Fix coordinates point += iPositionRelativeToScreen; @@ -2432,7 +2466,9 @@ // To have cursor on focused control. if ((iFocusedComponent != KComponentFocusedNone) && - (iFocusedComponent < iCustomComponents.Count())) + (iFocusedComponent < iCustomComponents.Count()) && + iCustomComponents[iFocusedComponent]-> + CustomComponentControl(KComponentMainControl)->IsVisible()) { iCustomComponents[iFocusedComponent]-> CustomComponentControl(KComponentMainControl)-> @@ -2443,7 +2479,7 @@ // To avoid situation when Canvas is redrawn but black area remains if (iAlfCompositionPixelSource) { - TRAPD(err, ActivatePixelSourceL()); + TRAPD(err, ActivatePixelSourceL(EFalse)); if (err != KErrNone) { DEBUG_INT("CMIDCanvas::FocusChanged - ActivatePixelSourceL error %d", err); @@ -2474,9 +2510,11 @@ } } - // To cursor on focused control. + // To remove cursor on focused control. if ((iFocusedComponent != KComponentFocusedNone) && - (iFocusedComponent < iCustomComponents.Count())) + (iFocusedComponent < iCustomComponents.Count()) && + iCustomComponents[iFocusedComponent]-> + CustomComponentControl(KComponentMainControl)->IsVisible()) { iCustomComponents[iFocusedComponent]-> CustomComponentControl(KComponentMainControl)-> @@ -2524,7 +2562,12 @@ TSize contentSize; +#ifdef RD_JAVA_S60_RELEASE_9_2 + if (iFullScreen && (orientedOrgMIDletScrSize != controlSize) + && !iPartialVKBOpen) +#else if (iFullScreen && (orientedOrgMIDletScrSize != controlSize)) +#endif // RD_JAVA_S60_RELEASE_9_2 { contentSize = orientedOrgMIDletScrSize; } @@ -2621,7 +2664,7 @@ myself->ClearUiSurface(ETrue); if (iAlfCompositionPixelSource) { - TRAP_IGNORE(myself->ActivatePixelSourceL()); + TRAP_IGNORE(myself->ActivatePixelSourceL(ETrue)); } } iWndUpdate = EFalse; @@ -2910,6 +2953,10 @@ InitPixelSourceL(); #endif // RD_JAVA_NGA_ENABLED + +#ifdef RD_JAVA_S60_RELEASE_9_2 + iPartialVKBOpen = EFalse; +#endif // RD_JAVA_S60_RELEASE_9_2 } @@ -3142,7 +3189,9 @@ if (iFullScreen) { #ifdef RD_JAVA_NGA_ENABLED - if (iScalingOn) + // If both NGA and scaling are on, then iViewRect is needed move + // for preverifing wrong position of Canvas. + if (iScalingOn && (!iFullScreen || iDirectContents.Count() == 0)) { // Translate to screen coordinates. rect.Move(iPositionRelativeToScreen); @@ -3166,6 +3215,15 @@ viewSize = iTargetMIDletScrSize; } +#ifdef RD_JAVA_S60_RELEASE_9_2 + // If partial VKB is open then MIDlet is not scaled. + // That we need set iViewRect to whole size of Canvas. + if (iPartialVKBOpen) + { + viewSize = Size(); + } +#endif //RD_JAVA_S60_RELEASE_9_2 + // If optional JAD parameter Nokia-MIDlet-Target-Display-Size is NOT // defined and Nokia-MIDlet-Original-Display-Size is defined to // smaller size than the device's screen size, we will scale the @@ -3601,7 +3659,7 @@ // In scaling case need to call SetExtent() again if pixel source was suspended. // --------------------------------------------------------------------------- // -void CMIDCanvas::ActivatePixelSourceL() +void CMIDCanvas::ActivatePixelSourceL(TBool aDrawingOngoing) { ASSERT(iAlfCompositionPixelSource); @@ -3623,7 +3681,7 @@ if (iPixelSourceSuspended) { - ClearUiSurface(EFalse); + ClearUiSurface(aDrawingOngoing); iPixelSourceSuspended = EFalse; if (iFullScreen && iScalingOn) { diff -r 4376525cdefb -r e5618cc85d74 javauis/lcdui_akn/lcdui/src/CMIDCanvasGraphicsItem.cpp --- a/javauis/lcdui_akn/lcdui/src/CMIDCanvasGraphicsItem.cpp Mon Jun 21 15:32:50 2010 +0300 +++ b/javauis/lcdui_akn/lcdui/src/CMIDCanvasGraphicsItem.cpp Thu Jul 15 18:31:06 2010 +0300 @@ -22,6 +22,11 @@ #include #include #include +#ifdef RD_JAVA_S60_RELEASE_9_2 +// Used with partial VKB +#include +#endif // RD_JAVA_S60_RELEASE_9_2 +#include // INTERNAL INCLUDES #include "CMIDCanvasGraphicsItem.h" @@ -82,6 +87,9 @@ iComponentContainer->UnregisterComponent(this); } + iComponentContainer = NULL; + iUtils = NULL; + DEBUG("CMIDCanvasGraphicsItem::~CMIDCanvasGraphicsItem -"); } @@ -152,18 +160,20 @@ // Store container. NULL is ok. iComponentContainer = aComponentContainer; - // Set item size and position is needed here. - TSize size = iItemPainter->Size(); - SetSizeL(size.iWidth, size.iHeight); - TPoint position = iItemPainter->Position(); - SetPosition(position.iX, position.iY); - - if (iUtils) + if (iComponentContainer) { - // Set canvas fullscreen size is needed here. - iItemPainter->SetOnScreenCanvasRect(iUtils->GetOnScreenCanvasRect()); + // Set item size and position is needed here. + TSize size = iItemPainter->Size(); + SetSizeL(size.iWidth, size.iHeight); + TPoint position = iItemPainter->Position(); + SetPosition(position.iX, position.iY); + + if (iUtils) + { + // Set canvas fullscreen size is needed here. + iItemPainter->SetOnScreenCanvasRect(iUtils->GetOnScreenCanvasRect()); + } } - DEBUG("CMIDCanvasGraphicsItem::SetParentL -"); } @@ -316,7 +326,53 @@ // void CMIDCanvasGraphicsItem::HandleFullscreenModeChange() { - // Calling all functions which set size and position. + if (iUtils && iUtils->IsScalingEnabled()) + { + // We need reposition text editor. + HandleChangeForScaling(EFullscreenChange); + } +} + +TBool CMIDCanvasGraphicsItem::IsScalingOn() const +{ + return iUtils && iComponentContainer && iUtils->IsScalingEnabled() +#ifdef RD_JAVA_S60_RELEASE_9_2 + && !iPartialVKBOpen +#endif // RD_JAVA_S60_RELEASE_9_2 + && iComponentContainer->IsFullScreen(); +} + +void CMIDCanvasGraphicsItem::HandleResourceChange(TInt aType) +{ +#ifdef RD_JAVA_S60_RELEASE_9_2 + if ((aType == KAknSplitInputEnabled) || + (aType == KAknSplitInputDisabled)) + { + iPartialVKBOpen = (aType == KAknSplitInputEnabled); + + if (iUtils && iComponentContainer && iUtils->IsScalingEnabled() && + iComponentContainer->IsFullScreen()) + { + // We need reposition text editor. + HandleChangeForScaling(EPartialVKBChange); + } + } +#endif // RD_JAVA_S60_RELEASE_9_2 + + if (KEikDynamicLayoutVariantSwitch) + { + if (iUtils && iComponentContainer && iUtils->IsScalingEnabled() && + iComponentContainer->IsFullScreen()) + { + // We need reposition text editor. + HandleChangeForScaling(EResolutionChange); + } + } +} + +void CMIDCanvasGraphicsItem::HandleChangeForScaling(TChange aChange) +{ + // Calling functions which set size and position. TRAPD(err, SetSizeL(iNonScaledSize.iWidth, iNonScaledSize.iHeight)); if (err != KErrNone) { @@ -324,38 +380,30 @@ } SetPosition(iNonScaledPosition.iX, iNonScaledPosition.iY); - if (iUtils) + if (aChange == EResolutionChange || aChange == EFullscreenChange) { - // Setting of fullscreen canvas rect. - iItemPainter->SetOnScreenCanvasRect(iUtils->GetOnScreenCanvasRect()); + if (iUtils) + { + // Setting of fullscreen canvas rect. + iItemPainter->SetOnScreenCanvasRect(iUtils->GetOnScreenCanvasRect()); + } } -} -// --------------------------------------------------------------------------- -// CMIDCanvasGraphicsItem::HandleResolutionChange -// (other items are commented in the header file) -// --------------------------------------------------------------------------- -// -void CMIDCanvasGraphicsItem::HandleResolutionChange() -{ - // Calling all functions which set size and position. - TRAPD(err, SetSizeL(iNonScaledSize.iWidth, iNonScaledSize.iHeight)); - if (err != KErrNone) +#ifdef RD_JAVA_S60_RELEASE_9_2 + if (aChange == EPartialVKBChange) { - DEBUG_INT("CMIDCanvasGraphicsItem::HandleFullscreenModeChange: SetSizeL method leave with %d code", err); + if (iPartialVKBOpen) + { + // When partial VKB is opening, stop scaling. + iItemPainter->SetOnScreenCanvasRect(iComponentContainer->Control().Rect()); + } + else if (iUtils) + { + // When partial VKB is closing, restore scaling. + iItemPainter->SetOnScreenCanvasRect(iUtils->GetOnScreenCanvasRect()); + } } - SetPosition(iNonScaledPosition.iX, iNonScaledPosition.iY); - if (iUtils) - { - // Setting of fullscreen canvas rect. - iItemPainter->SetOnScreenCanvasRect(iUtils->GetOnScreenCanvasRect()); - } -} - -TBool CMIDCanvasGraphicsItem::IsScalingOn() const -{ - return iUtils && iComponentContainer && iUtils->IsScalingEnabled() && - iComponentContainer->IsFullScreen(); +#endif // RD_JAVA_S60_RELEASE_9_2 } // End of file diff -r 4376525cdefb -r e5618cc85d74 javauis/lcdui_akn/lcdui/src/CMIDCanvasGraphicsItemPainter.cpp --- a/javauis/lcdui_akn/lcdui/src/CMIDCanvasGraphicsItemPainter.cpp Mon Jun 21 15:32:50 2010 +0300 +++ b/javauis/lcdui_akn/lcdui/src/CMIDCanvasGraphicsItemPainter.cpp Thu Jul 15 18:31:06 2010 +0300 @@ -118,7 +118,13 @@ { case ESync: // We redraw the proper drawing rect. - DrawNow(TRect(iPosition, iViewSize)); + // The top-left point is set to PositionRelativeToScreen + // in case that scaling is on. + DrawNow( + TRect( + iContentRect.Size() != iViewSize ? + PositionRelativeToScreen() : iPosition, + iViewSize)); break; case ESyncRect: diff -r 4376525cdefb -r e5618cc85d74 javauis/lcdui_akn/lcdui/src/CMIDChoiceGroupControl.cpp --- a/javauis/lcdui_akn/lcdui/src/CMIDChoiceGroupControl.cpp Mon Jun 21 15:32:50 2010 +0300 +++ b/javauis/lcdui_akn/lcdui/src/CMIDChoiceGroupControl.cpp Thu Jul 15 18:31:06 2010 +0300 @@ -1172,10 +1172,21 @@ { // Get color from skin TRgb rgb = AKN_LAF_COLOR(215); - TInt textColor = IsFocused() ? EAknsCIQsnTextColorsCG8 : EAknsCIQsnTextColorsCG6; + TInt textColor; + + // Set color for text according to item highlight + // (logical color constants are defined in lcdui.h) + if (iItem && iItem->IsHighlighted()) + { + textColor = KHighlightedItemTextColor; + } + else + { + textColor = KNonHighlightedItemTextColor; + } AknsUtils::GetCachedColor(AknsUtils::SkinInstance(), - rgb,KAknsIIDQsnTextColors, textColor); + rgb, KAknsIIDQsnTextColors, textColor); iPopupTextLayout.DrawText(SystemGc(), aText, ETrue, rgb); } } diff -r 4376525cdefb -r e5618cc85d74 javauis/lcdui_akn/lcdui/src/CMIDControlItem.cpp --- a/javauis/lcdui_akn/lcdui/src/CMIDControlItem.cpp Mon Jun 21 15:32:50 2010 +0300 +++ b/javauis/lcdui_akn/lcdui/src/CMIDControlItem.cpp Thu Jul 15 18:31:06 2010 +0300 @@ -52,8 +52,9 @@ /////////////////////////////////////////////////////////////////////////////////////////////////// CMIDControlItem::CMIDControlItem(MMIDItem::TLayout aLayout, CMIDUIManager* aUIManager) - : CMIDItem(aLayout, aUIManager), - iCoeEnv(CCoeEnv::Static()) + : CMIDItem(aLayout, aUIManager) + , iCoeEnv(CCoeEnv::Static()) + , iHighlighted(EFalse) { } @@ -217,10 +218,20 @@ { if (aId.iUid == MAknsControlContext::ETypeId && iForm) { - return IsFocused() ? - MAknsControlContext::SupplyMopObject(aId, iForm->GetHighlightBackgroundCc()) : - MAknsControlContext::SupplyMopObject(aId, - iForm->CurrentDisplayable().BackGroundControlContext()); + if (iHighlighted) + { + // Highlighted background control context must be returned + // no matter if item is focused or not. Only then highlighted item + // will be displayed correctly, if Form is faded + // (e.g. Menu is shown). + return MAknsControlContext::SupplyMopObject(aId, + iForm->GetHighlightBackgroundCc()); + } + else + { + return MAknsControlContext::SupplyMopObject(aId, + iForm->CurrentDisplayable().BackGroundControlContext()); + } } return SupplyMopObject(aId, iMenuHandler->Cba(), iMenuHandler->MenuBar()); } @@ -249,10 +260,13 @@ void CMIDControlItem::SetLabelColor(CMIDItemLabel* aLabelControl) { TRgb color; - - TInt labelColor = (IsFocused() && - Type() != MMIDComponent::ECustomItem && - Type() != MMIDComponent::EImageItem) ? EAknsCIQsnTextColorsCG8 : EAknsCIQsnTextColorsCG6; + + // Set color for label text according to item highlight + // (logical color constants are defined in lcdui.h) + TInt labelColor = (iHighlighted + && Type() != MMIDComponent::ECustomItem + && Type() != MMIDComponent::EImageItem) + ? KHighlightedItemTextColor : KNonHighlightedItemTextColor; // Get color from skin if ((AknsUtils::GetCachedColor(AknsUtils::SkinInstance(), color, diff -r 4376525cdefb -r e5618cc85d74 javauis/lcdui_akn/lcdui/src/CMIDDateFieldItem.cpp --- a/javauis/lcdui_akn/lcdui/src/CMIDDateFieldItem.cpp Mon Jun 21 15:32:50 2010 +0300 +++ b/javauis/lcdui_akn/lcdui/src/CMIDDateFieldItem.cpp Thu Jul 15 18:31:06 2010 +0300 @@ -70,7 +70,9 @@ } if (iEditor) { +#ifndef RD_JAVA_S60_RELEASE_9_2 iEditor->SetFocus(ETrue); // needed to notify observers about editor destruction +#endif // RD_JAVA_S60_RELEASE_9_2 delete iEditor; iEditor = NULL; } @@ -817,15 +819,11 @@ iEditor->SetFocus(focus); if (focus) { - // Text colour from skin - focused - iEditor->SetSkinTextColorL(EAknsCIQsnTextColorsCG8); TRAP_IGNORE(iUIManager->OpenNaviPaneControllerL()->PauseTickerL( TICKER_PAUSE_INTERVAL, this)); } else { - // Text colour from skin - unfocused - iEditor->SetSkinTextColorL(EAknsCIQsnTextColorsCG6); TRAP_IGNORE(iUIManager->OpenNaviPaneControllerL()->PauseTickerL( 0, this)); #ifdef RD_SCALABLE_UI_V2 @@ -833,6 +831,8 @@ #endif } + TRAP_IGNORE(UpdateTextColorsL()); + CMIDControlItem::FocusChanged(aDrawNow); DoSafeDraw(); @@ -952,4 +952,20 @@ } } +void CMIDDateFieldItem::UpdateTextColorsL() +{ + // Set color for content text according to item highlight + // (logical color constants are defined in lcdui.h) + if (iHighlighted) + { + // Text colour from skin - highlighted + iEditor->SetSkinTextColorL(KHighlightedItemTextColor); + } + else + { + // Text colour from skin - unfocused + iEditor->SetSkinTextColorL(KNonHighlightedItemTextColor); + } +} + // End of File diff -r 4376525cdefb -r e5618cc85d74 javauis/lcdui_akn/lcdui/src/CMIDDisplayable.cpp --- a/javauis/lcdui_akn/lcdui/src/CMIDDisplayable.cpp Mon Jun 21 15:32:50 2010 +0300 +++ b/javauis/lcdui_akn/lcdui/src/CMIDDisplayable.cpp Thu Jul 15 18:31:06 2010 +0300 @@ -276,11 +276,12 @@ iSKPositionWithQwerty = ESoftkeysRight; } + // initialization of keypad information + ReadOnScreenKeypadTypeFromSuiteSettings(); + DEBUG("- CMIDDisplayable::ConstructL"); } - - CMIDDisplayable::CMIDDisplayable(MMIDEnv& aEnv,CMIDUIManager& aUIManager) :CEikBorderedControl(TGulBorder(KMIDLetBorder)), iUIManager(&aUIManager),iEnv(aEnv), diff -r 4376525cdefb -r e5618cc85d74 javauis/lcdui_akn/lcdui/src/CMIDEdwin.cpp --- a/javauis/lcdui_akn/lcdui/src/CMIDEdwin.cpp Mon Jun 21 15:32:50 2010 +0300 +++ b/javauis/lcdui_akn/lcdui/src/CMIDEdwin.cpp Thu Jul 15 18:31:06 2010 +0300 @@ -734,7 +734,8 @@ #else if (IsConstraintSet(MMIDTextField::ENumeric) && (aType == EEventKeyUp) && !IsReadOnly() && #endif // RD_SCALABLE_UI_V2 - ((scanCode==EStdKeyNkpAsterisk) || (scanCode == EStdKeyMinus) || (scanCode==EStdKeyNkpMinus) || (scanCode == 0x2A) || (scanCode == 0x2D))) + ((scanCode==EStdKeyNkpAsterisk) || (scanCode == EStdKeyMinus) || (scanCode==EStdKeyNkpMinus) || (scanCode == 0x2A) || (scanCode == 0x2D) || + (TChar(aKeyEvent.iCode) == TChar('-') && scanCode != EStdKeyMinus))) { HandleMinusCharEventL(EEventTextUpdate); CEikEdwin::ReportEdwinEventL(EEventTextUpdate); @@ -752,20 +753,26 @@ { CPlainText* res = CEikEdwin::Text(); TInt textLength = CEikEdwin::TextLength(); - if (scanCode == EStdKeyMinus) + if (scanCode == EStdKeyMinus && textLength < iMaxSize) { res->InsertL(CEikEdwin::CursorPos(), KMinusChar); } - else if (scanCode == EStdKeyFullStop) + else if (scanCode == EStdKeyFullStop && textLength < iMaxSize) { res->InsertL(CEikEdwin::CursorPos(), KFullStopChar); } HandleTextChangedL(); // notify editor about the text changes CEikEdwin::ReportEdwinEventL(EEventTextUpdate); + TInt cursorPos = CEikEdwin::CursorPos(); + if (CEikEdwin::TextLength() < iMaxSize) { - CEikEdwin::SetCursorPosL(CEikEdwin::CursorPos() + 1, EFalse); + CEikEdwin::SetCursorPosL(cursorPos + 1, EFalse); + } + else if (cursorPos == (iMaxSize - 1) && cursorPos == textLength && scanCode==EStdKeyFullStop) + { + CEikEdwin::SetCursorPosL(iMaxSize, EFalse); } } //Error tone playing case1: @@ -903,6 +910,30 @@ response = CEikEdwin::OfferKeyEventL(aKeyEvent,aType); UpdateTextCapacityIndicatorValueL(); } + else + { + // If minus char was entered in full querty editor mode + if (IsConstraintSet(MMIDTextField::EDecimal) && + (aType == EEventKey) && !IsReadOnly() && + (TChar(aKeyEvent.iCode) == TChar('-') && scanCode != EStdKeyMinus)) + { + CPlainText* res = CEikEdwin::Text(); + + if (res && TChar(aKeyEvent.iCode) == TChar('-') && + TextLength() < iMaxSize) + { + res->InsertL(GetCaretPosition(), KMinusChar); + HandleTextChangedL(); // notify editor about the text changes + CEikEdwin::ReportEdwinEventL(EEventTextUpdate); + + if (TextLength() < iMaxSize) + { + CEikEdwin::SetCursorPosL(GetCaretPosition() + 1, EFalse); + } + } + } + + } return response; } } @@ -1047,6 +1078,7 @@ TInt illegalCharPos = -1; TPtr16 ptr = res->Des(); TInt minusPos = ptr.LocateReverse(TChar('-')); + TInt endCursorPos = CEikEdwin::CursorPos(); // check if minus sign is inserted on incorrect place // (not at the beginning) @@ -1094,9 +1126,10 @@ { cursorPos--; } - CEikEdwin::SetCursorPosL(cursorPos, EFalse); + endCursorPos = cursorPos; } } + CEikEdwin::SetCursorPosL(endCursorPos, EFalse); CleanupStack::Pop(res); delete res; } diff -r 4376525cdefb -r e5618cc85d74 javauis/lcdui_akn/lcdui/src/CMIDEdwinUtils.cpp --- a/javauis/lcdui_akn/lcdui/src/CMIDEdwinUtils.cpp Mon Jun 21 15:32:50 2010 +0300 +++ b/javauis/lcdui_akn/lcdui/src/CMIDEdwinUtils.cpp Thu Jul 15 18:31:06 2010 +0300 @@ -1221,9 +1221,9 @@ TInt totalLength = ptr.Length() + aBuf.Length(); if (totalLength > ptr.MaxLength()) - { - iClearText = iClearText->ReAllocL(totalLength); - ptr = iClearText->Des(); + { + iClearText = iClearText->ReAllocL(totalLength); + ptr.Set(iClearText->Des()); } ptr.Insert(aPos,aBuf); diff -r 4376525cdefb -r e5618cc85d74 javauis/lcdui_akn/lcdui/src/CMIDForm.cpp --- a/javauis/lcdui_akn/lcdui/src/CMIDForm.cpp Mon Jun 21 15:32:50 2010 +0300 +++ b/javauis/lcdui_akn/lcdui/src/CMIDForm.cpp Thu Jul 15 18:31:06 2010 +0300 @@ -181,6 +181,12 @@ { SetFocusedItem(ci.IsSelectable() ? aIndex : KErrNotFound); } + else if (aIndex <= iFocused) + { + // If new item is inserted to Form above the current item, + // index must increase + iFocused++; + } RequestLayoutL(); } @@ -1977,6 +1983,8 @@ { // actions for the item loosing focus CMIDControlItem& control = ControlItem(iFocused); control.PostFocusTransferEvent(EFalse, aDirection); + // setting highlight must be called before setting focus + control.SetHighlight(EFalse); control.SetFocus(EFalse); UpdateItemCommands(NULL, NULL); } @@ -2009,6 +2017,7 @@ SetHighlightBackgroundRects(); control.PostFocusTransferEvent(ETrue, aDirection); + control.SetHighlight(ETrue); control.SetFocus(ETrue); // msk: deliver also the possible MSK command to displayable UpdateItemCommands(control.CommandList(), control.GetMSKCommand()); @@ -2305,7 +2314,11 @@ // Background for highlighted item, frame rects are set later iHighlightedBackgroundCc = CAknsFrameBackgroundControlContext::NewL( +#ifdef RD_JAVA_S60_RELEASE_9_2 + KAknsIIDQsnFrPopupPreview, +#else KAknsIIDQsnFrInput, +#endif // RD_JAVA_S60_RELEASE_9_2 TRect(), TRect(), ETrue); iDisplayable.SetComponentL(*this); diff -r 4376525cdefb -r e5618cc85d74 javauis/lcdui_akn/lcdui/src/CMIDTextBoxQueryDialog.cpp --- a/javauis/lcdui_akn/lcdui/src/CMIDTextBoxQueryDialog.cpp Mon Jun 21 15:32:50 2010 +0300 +++ b/javauis/lcdui_akn/lcdui/src/CMIDTextBoxQueryDialog.cpp Thu Jul 15 18:31:06 2010 +0300 @@ -87,7 +87,6 @@ iEdwinUtils = CMIDEdwinUtils::NewL(this, iDecimalSeparator); iConstraints = aConstraints; - iLastCountLine = 0; iStrict = ETrue; // if text is invalid according to constraints, throw IllegalArgumentException, @@ -456,7 +455,7 @@ void CMIDTextBoxQueryDialog::FocusChanged(TDrawNow aDrawNow) { CAknTextQueryDialog::FocusChanged(aDrawNow); - SetRightScrollBarPosition(); + TRAP_IGNORE(UpdateScrollBarPositionL()); } // // We do not want to become visible if we are not showing @@ -485,12 +484,7 @@ { CAknTextQueryDialog::SizeChanged(); } - if (iEditor && iEditor->ScrollBarFrame() && iEditor->ScrollBarFrame()->VerticalScrollBar()) - { - iEditorRect = iEditor->Rect(); - iEditorRect.SetWidth(iEditorRect.Width() - iEditor->ScrollBarFrame()->VerticalScrollBar()->Rect().Width()); - SetRightScrollBarPosition(); - } + TRAP_IGNORE(UpdateScrollBarPositionL()); } TKeyResponse CMIDTextBoxQueryDialog::OfferKeyEventL(const TKeyEvent& aKeyEvent,TEventCode aType) @@ -662,7 +656,8 @@ #else if (IsConstraintSet(MMIDTextField::ENumeric) && (aType == EEventKeyUp) && !iEditor->IsReadOnly() && #endif // RD_SCALABLE_UI_V2 - ((scanCode==EStdKeyNkpAsterisk) || (scanCode == EStdKeyMinus) || (scanCode==EStdKeyNkpMinus) || (scanCode == 0x2A) || (scanCode == 0x2D))) + ((scanCode==EStdKeyNkpAsterisk) || (scanCode == EStdKeyMinus) || (scanCode==EStdKeyNkpMinus) || (scanCode == 0x2A) || (scanCode == 0x2D) || + (TChar(aKeyEvent.iCode) == TChar('-') && scanCode != EStdKeyMinus))) { HandleMinusCharEventL(MEikEdwinObserver::EEventTextUpdate); return EKeyWasConsumed; @@ -688,10 +683,15 @@ } iEditor->HandleTextChangedL(); // notify editor about the text changes + TInt cursorPos = GetCaretPosition(); if (Size() < iMaxSize) { - SetCursorPositionL(GetCaretPosition() + 1); + SetCursorPositionL(cursorPos + 1); + } + else if (cursorPos == (iMaxSize - 1) && cursorPos == textLength && scanCode==EStdKeyFullStop) + { + SetCursorPositionL(iMaxSize); } HandleTextUpdateL(MEikEdwinObserver::EEventTextUpdate); @@ -900,14 +900,6 @@ HandleTextUpdateL(MEikEdwinObserver::EEventTextUpdate); - if (iEditor && iEditor->TextLayout()) - { - if (iLastCountLine != iEditor->TextLayout()->GetLineNumber(iEditor->TextLength() - 1)) - { - iLastCountLine = iEditor->TextLayout()->GetLineNumber(iEditor->TextLength() - 1); - SetRightScrollBarPosition(); - } - } } } @@ -937,6 +929,7 @@ TInt pointPosL = ptr.Locate(iDecimalSeparator); TInt pointPosR = ptr.LocateReverse(iDecimalSeparator); TInt cursorPos = GetCaretPosition(); + TInt endCursorPos = cursorPos; // check if minus sign is inserted on incorrect place // (not at the beginning) @@ -975,7 +968,7 @@ // Set correct cusros possition if (pointPosL == 0 && minusPos == pointPosL) { - SetCursorPositionL(pointPosL + 1); + endCursorPos = (pointPosL + 1); } } } @@ -983,7 +976,6 @@ // Locate decimal separator again pointPosL = ptr.Locate(iDecimalSeparator); pointPosR = ptr.LocateReverse(iDecimalSeparator); - cursorPos = GetCaretPosition(); if ((minusPos != KErrNotFound) && (pointPosL == 0)) { @@ -1009,9 +1001,11 @@ { cursorPos--; } - SetCursorPositionL(cursorPos); + + endCursorPos = cursorPos; } } + SetCursorPositionL(endCursorPos); } else if (((iConstraints & MMIDTextField::EConstraintMask) == MMIDTextField::EMailAddr) || @@ -1560,17 +1554,40 @@ aType == KEikColorResourceChange || aType == KAknsMessageSkinChange || aType == KUidValueCoeColorSchemeChangeEvent) { - SetRightScrollBarPosition(); + TRAP_IGNORE(UpdateScrollBarPositionL()); } - } -void CMIDTextBoxQueryDialog::SetRightScrollBarPosition() +/* UpdateScrollBarPositionL + * + * This method is called for placing scrollbar to correct place in edwin + */ +void CMIDTextBoxQueryDialog::UpdateScrollBarPositionL() { - // Editor Rect should not be set with empty values - if (iEditor && iEditorRect.Height() != 0 && iEditorRect.Width() != 0) + if(iEditor && iEditor->TextLayout()) { - iEditor->SetRect(iEditorRect); + TInt numLines = iEditor->TextLayout()->NumFormattedLines(); + if(numLines == iEditor->MaximumHeightInLines()) + { + if(iEditor->ScrollBarFrame()) + { + iEditor->ScrollBarFrame()->SetScrollBarVisibilityL(CEikScrollBarFrame::EOff, CEikScrollBarFrame::EOff); + } + } + else if(numLines > iEditor->MaximumHeightInLines()) + { + if(!iEditor->ScrollBarFrame()) + { + iEditor->CreatePreAllocatedScrollBarFrameL(); + iEditor->ScrollBarFrame()->SetScrollBarVisibilityL(CEikScrollBarFrame::EOff, CEikScrollBarFrame::EAuto); + } + TRect editorRect = iEditor->Rect(); + if(iEditor->ScrollBarFrame()->VerticalScrollBar()) + { + editorRect.SetWidth(editorRect.Width() - iEditor->ScrollBarFrame()->VerticalScrollBar()->ScrollBarBreadth()); + iEditor->SetRect(editorRect); + } + } } } // End of file diff -r 4376525cdefb -r e5618cc85d74 javauis/lcdui_akn/lcdui/src/CMIDTextEditor.cpp --- a/javauis/lcdui_akn/lcdui/src/CMIDTextEditor.cpp Mon Jun 21 15:32:50 2010 +0300 +++ b/javauis/lcdui_akn/lcdui/src/CMIDTextEditor.cpp Thu Jul 15 18:31:06 2010 +0300 @@ -21,6 +21,10 @@ #include #include #include +#ifdef RD_JAVA_S60_RELEASE_9_2 +// Used with partial VKB +#include +#endif // RD_JAVA_S60_RELEASE_9_2 // INTERNAL INCLUDES #include "CMIDTextEditor.h" @@ -109,6 +113,8 @@ delete iEditingStateIndicator; iUtils = NULL; + iComponentContainer = NULL; + iDirectContainer = NULL; DEBUG("CMIDTextEditor::~CMIDTextEditor -"); } @@ -158,12 +164,25 @@ { DEBUG("CMIDTextEditor::CustomComponentContainerDisposing +"); - // Remove container association. - iComponentContainer = NULL; +#ifdef RD_JAVA_S60_RELEASE_9_2 + if (iFocusState) + { + iTextEdwin->CloseVKB(); + } +#endif // RD_JAVA_S60_RELEASE_9_2 - // Uninitialize the text editor window. + // Call SetFocus on edwin + iTextEdwin->SetFocus(EFalse); + // Disable the custom indicators as in Avkon if not controlled by + // the client application. + if (iEditingStateIndicator->EnabledState() == + CMIDEditingStateIndicator::EIndicatorStateRelative) + { + iEditingStateIndicator->MakeVisible(EFalse); + } + // Set editor window uninitialized iTextEdwin->Uninitialize(); - + iComponentContainer = NULL; DEBUG("CMIDTextEditor::CustomComponentContainerDisposing -"); } @@ -332,19 +351,19 @@ iNonScaledEditorSize = iTextEdwin->Size(); } SetFontL(iNonScaledFont); + + if (iUtils) + { + // It sets edwin variables necessary for correct clipping. + iTextEdwin->SetOnScreenCanvasRect(iUtils->GetOnScreenCanvasRect()); + iTextEdwin->SetScaling(IsScalingOn()); + + // It sets indicator variables necessary for correct clipping. + iEditingStateIndicator->SetScalingOn(IsScalingOn()); + iEditingStateIndicator->SetCanvasRect(iUtils->GetOnScreenCanvasRect()); + } } - - if (iUtils) - { - // It sets edwin variables necessary for correct clipping. - iTextEdwin->SetOnScreenCanvasRect(iUtils->GetOnScreenCanvasRect()); - iTextEdwin->SetScaling(IsScalingOn()); - - // It sets indicator variables necessary for correct clipping. - iEditingStateIndicator->SetScalingOn(IsScalingOn()); - iEditingStateIndicator->SetCanvasRect(iUtils->GetOnScreenCanvasRect()); - } - + DEBUG("CMIDTextEditor::SetParentL -"); } @@ -464,7 +483,6 @@ // Cursor is not shown automatically if the editor has focus. // So, set cursor visible. iTextEdwin->SetCursorVisible(ETrue); - } else { @@ -472,6 +490,7 @@ // Remove the selection at this point. The selection can be // set again with the API. SetCursorPositionL(iTextEdwin->CursorPos()); + iTextEdwin->Redraw(); } } else if (!aVisible && iTextEdwin->IsVisible()) @@ -490,10 +509,9 @@ // Always disable indicator if the editor is hidden. iEditingStateIndicator->MakeVisible(EFalse); + iTextEdwin->Redraw(); } - iTextEdwin->Redraw(); - DEBUG("CMIDTextEditor::SetVisibleL -"); } @@ -582,29 +600,29 @@ { // Set focus if the text editor is not focused iFocusState = ETrue; - // Call SetFocus on edwin - iTextEdwin->SetFocus(ETrue); + // Send the information about new focused component to parent iComponentContainer->SetFocusedComponent(this); - // Set focus automatically selects the editor's content - // Remove the selection at this point. The selection can be - // set again with the API. - SetCursorPositionL(iTextEdwin->CursorPos()); - - // If the editor is not visible. do not show the cursor either. - if (!iTextEdwin->IsVisible()) + // If the editor is visible, give him focus. + if (iTextEdwin->IsVisible()) { - DEBUG("CMIDTextEditor::SetFocusStateL, hiding cursor"); - - iTextEdwin->SetCursorVisible(EFalse); - } - else if (iEditingStateIndicator->EnabledState() == - CMIDEditingStateIndicator::EIndicatorStateRelative) - { - // Enable the custom indicators as in Avkon if not controlled - // by the client application - iEditingStateIndicator->MakeVisible(ETrue); + DEBUG("CMIDTextEditor::SetFocusStateL, visible - iTextEdwin->setFocus(true)"); + // Call SetFocus on edwin + iTextEdwin->SetFocus(ETrue); + // Set focus automatically selects the editor's content + // Remove the selection at this point. The selection can be + // set again with the API. + SetCursorPositionL(iTextEdwin->CursorPos()); + + if (iEditingStateIndicator->EnabledState() == + CMIDEditingStateIndicator::EIndicatorStateRelative) + { + // Enable the custom indicators as in Avkon if not controlled + // by the client application + iEditingStateIndicator->MakeVisible(ETrue); + } + iTextEdwin->Redraw(); } } else if (!(aFocusState) && (iFocusState)) @@ -632,10 +650,9 @@ { iEditingStateIndicator->MakeVisible(EFalse); } + iTextEdwin->Redraw(); } - iTextEdwin->Redraw(); - DEBUG("CMIDTextEditor::SetFocusStateL -"); } @@ -2121,42 +2138,56 @@ // void CMIDTextEditor::HandleFullscreenModeChange() { - // It is needed to store iRowCountActive, because SetEditorSize resets it. - TBool rowCountActive = iRowCountActive; - - // Calling all functions which sets sizes and position of TextEditor. - SetEditorSize(iNonScaledEditorSize.iWidth, iNonScaledEditorSize.iHeight); - SetPosition(iNonScaledPosition.iX, iNonScaledPosition.iY); - if (iNonScaledFont) + if (iUtils && iUtils->IsScalingEnabled()) { - TRAPD(err, SetFontL(iNonScaledFont)); - if (err != KErrNone) - { - DEBUG_INT("CMIDTextEditor::HandleFullscreenModeChange - error %d", err); - } - } - - // restoring of iRowCountActive - iRowCountActive = rowCountActive; - - if (iUtils) - { - // It sets edwin variables necessary for correct clipping. - iTextEdwin->SetOnScreenCanvasRect(iUtils->GetOnScreenCanvasRect()); - iTextEdwin->SetScaling(IsScalingOn()); - - // It sets indicator variables necessary for correct clipping. - iEditingStateIndicator->SetScalingOn(IsScalingOn()); - iEditingStateIndicator->SetCanvasRect(iUtils->GetOnScreenCanvasRect()); + // We need reposition text editor. + HandleChangeForScaling(EFullscreenChange); } } -// --------------------------------------------------------------------------- -// CMIDTextEditor::HandleResolutionChange -// (other items were commented in a header -// --------------------------------------------------------------------------- -// -void CMIDTextEditor::HandleResolutionChange() +TBool CMIDTextEditor::IsScalingOn() const +{ + return iUtils && iComponentContainer && iUtils->IsScalingEnabled() +#ifdef RD_JAVA_S60_RELEASE_9_2 + && !iPartialVKBOpen +#endif // RD_JAVA_S60_RELEASE_9_2 + && iComponentContainer->IsFullScreen(); +} + +void CMIDTextEditor::HandleResourceChange(TInt aType) +{ +#ifdef RD_JAVA_S60_RELEASE_9_2 + if ((aType == KAknSplitInputEnabled) || + (aType == KAknSplitInputDisabled)) + { + iPartialVKBOpen = (aType == KAknSplitInputEnabled); + if (iTextEdwin && iTextEdwin->IsFocused()) + { + // Inform edwin about the event. + iTextEdwin->HandleResourceChange(aType); + } + + if (iUtils && iComponentContainer && iUtils->IsScalingEnabled() && + iComponentContainer->IsFullScreen()) + { + // Reposition the text editor. + HandleChangeForScaling(EPartialVKBChange); + } + } +#endif // RD_JAVA_S60_RELEASE_9_2 + + if (aType == KEikDynamicLayoutVariantSwitch) + { + if (iUtils && iComponentContainer && iUtils->IsScalingEnabled() && + iComponentContainer->IsFullScreen()) + { + // Reposition the text editor. + HandleChangeForScaling(EResolutionChange); + } + } +} + +void CMIDTextEditor::HandleChangeForScaling(TChange aChange) { // It is needed to store iRowCountActive, because SetEditorSize resets it. TBool rowCountActive = iRowCountActive; @@ -2176,20 +2207,52 @@ // restoring of iRowCountActive iRowCountActive = rowCountActive; - if (iUtils) + if ((aChange == EFullscreenChange) || (aChange == EResolutionChange)) { - // It sets edwin variable necessary for correct clipping. - iTextEdwin->SetOnScreenCanvasRect(iUtils->GetOnScreenCanvasRect()); + if (iUtils) + { + // It sets edwin variable necessary for correct clipping. + iTextEdwin->SetOnScreenCanvasRect(iUtils->GetOnScreenCanvasRect()); + + // It sets indicator variable necessary for correct clipping. + iEditingStateIndicator->SetCanvasRect(iUtils->GetOnScreenCanvasRect()); + } + if (aChange == EFullscreenChange) + { + // If scaling is turn on or off, we need to inform edwin + // and indicator about that. + iTextEdwin->SetScaling(IsScalingOn()); + iEditingStateIndicator->SetScalingOn(IsScalingOn()); + } + } - // It sets indicator variable necessary for correct clipping. - iEditingStateIndicator->SetCanvasRect(iUtils->GetOnScreenCanvasRect()); - } -} +#ifdef RD_JAVA_S60_RELEASE_9_2 + if (aChange == EPartialVKBChange) + { + if (iPartialVKBOpen) + { + // When partial keyboard is opening, the scalingmust be stoped. + // Setting edwin's variables, it is necessary for correct clipping. + iTextEdwin->SetOnScreenCanvasRect(iComponentContainer->Control().Rect()); + iTextEdwin->SetScaling(EFalse); -TBool CMIDTextEditor::IsScalingOn() const -{ - return iUtils && iComponentContainer && iUtils->IsScalingEnabled() && - iComponentContainer->IsFullScreen(); + // Setting indicator's variables, it is necessary for correct clipping. + iEditingStateIndicator->SetScalingOn(EFalse); + iEditingStateIndicator->SetCanvasRect(iComponentContainer->Control().Rect()); + } + else if (iUtils) + { + // When partial keybord is closing, the scaling needs to be restored. + // Setting edwin's variables, it is necessary for correct clipping. + iTextEdwin->SetOnScreenCanvasRect(iUtils->GetOnScreenCanvasRect()); + iTextEdwin->SetScaling(IsScalingOn()); + + // Setting indicator's variables, it is necessary for correct clipping. + iEditingStateIndicator->SetScalingOn(IsScalingOn()); + iEditingStateIndicator->SetCanvasRect(iUtils->GetOnScreenCanvasRect()); + } + } +#endif // RD_JAVA_S60_RELEASE_9_2 } // End of file diff -r 4376525cdefb -r e5618cc85d74 javauis/lcdui_akn/lcdui/src/CMIDTextEditorEdwin.cpp --- a/javauis/lcdui_akn/lcdui/src/CMIDTextEditorEdwin.cpp Mon Jun 21 15:32:50 2010 +0300 +++ b/javauis/lcdui_akn/lcdui/src/CMIDTextEditorEdwin.cpp Thu Jul 15 18:31:06 2010 +0300 @@ -156,7 +156,14 @@ response = HandleSpecialKeyEventsL(aKeyEvent, aType); // Not handled, try with CEikEdwin - if (response == EKeyWasNotConsumed) + // Consume down and up type of keyevents + if ((response == EKeyWasConsumed) || + (aType != EEventKey && aKeyEvent.iScanCode != + EStdKeyApplication0)) + { + response = EKeyWasConsumed; + } + else { // Old text is needed if the new content is not valid for the // given set of constraints. This validation is made because @@ -171,16 +178,31 @@ CleanupStack::PushL(oldContent); response = CEikEdwin::OfferKeyEventL(aKeyEvent, aType); - - // Validate new content and undo if not valid. - if (!iEdwinUtils.ConstraintsValidForText( - Read(), iConstraints, EFalse)) - { - CEikEdwin::SetTextL(oldContent); - // Notify about text change. - HandleTextChangedL(); - // Restore cursor's original position. - SetCursorPosL(iCursorPosForAction, EFalse); + + if (response == EKeyWasConsumed) { + // Validate new content and undo if not valid. + if (!iEdwinUtils.ConstraintsValidForText( + Read(), iConstraints, EFalse)) + { + CEikEdwin::SetTextL(oldContent); + // Notify about text change. + HandleTextChangedL(); + // Restore cursor's original position. + SetCursorPosL(iCursorPosForAction, EFalse); + } + } + else + { + // Consuming the up/down arrows, because edwin does not + // consume them if at first/last line. + if ((aType == EEventKey) && + (((aKeyEvent.iCode == EKeyUpArrow) || + (aKeyEvent.iCode == EKeyDownArrow)) || + ((aKeyEvent.iScanCode == EStdKeyUpArrow) || + (aKeyEvent.iScanCode == EStdKeyDownArrow)))) + { + response = EKeyWasConsumed; + } } CleanupStack::PopAndDestroy(oldContent); } @@ -548,7 +570,7 @@ // void CMIDTextEditorEdwin::HandleResourceChange(TInt aType) { - CCoeControl::HandleResourceChange(aType); + CEikEdwin::HandleResourceChange(aType); // Notification about language change if (aType == KEikInputLanguageChange) { diff -r 4376525cdefb -r e5618cc85d74 javauis/lcdui_akn/lcdui/src/CMIDTextEditorEdwinCustomDraw.cpp --- a/javauis/lcdui_akn/lcdui/src/CMIDTextEditorEdwinCustomDraw.cpp Mon Jun 21 15:32:50 2010 +0300 +++ b/javauis/lcdui_akn/lcdui/src/CMIDTextEditorEdwinCustomDraw.cpp Thu Jul 15 18:31:06 2010 +0300 @@ -252,6 +252,10 @@ { iEdwin.GetColor(EColorControlHighlightBackground, ret); } + else if (aColorIndex == TLogicalRgb::ESystemSelectionForegroundIndex) + { + iEdwin.GetColor(EColorControlHighlightText, ret); + } else { // Other colors use parent's SystemColor. diff -r 4376525cdefb -r e5618cc85d74 javauis/lcdui_akn/lcdui/src/CMIDTextFieldEdwin.cpp --- a/javauis/lcdui_akn/lcdui/src/CMIDTextFieldEdwin.cpp Mon Jun 21 15:32:50 2010 +0300 +++ b/javauis/lcdui_akn/lcdui/src/CMIDTextFieldEdwin.cpp Thu Jul 15 18:31:06 2010 +0300 @@ -123,7 +123,11 @@ } else { // skinning colour groups for editable text - skinTextColor = IsFocused() ? EAknsCIQsnTextColorsCG8 : EAknsCIQsnTextColorsCG6; + // Set color for content text (logical color constants + // are defined in lcdui.h) + skinTextColor = IsFocused() ? + TAknsQsnTextColorsIndex(KHighlightedItemTextColor) + : TAknsQsnTextColorsIndex(KNonHighlightedItemTextColor); } TRect parentRect = aRect; diff -r 4376525cdefb -r e5618cc85d74 javauis/lcdui_akn/lcdui/src/CMIDTextFieldItem.cpp --- a/javauis/lcdui_akn/lcdui/src/CMIDTextFieldItem.cpp Mon Jun 21 15:32:50 2010 +0300 +++ b/javauis/lcdui_akn/lcdui/src/CMIDTextFieldItem.cpp Thu Jul 15 18:31:06 2010 +0300 @@ -345,6 +345,7 @@ CMIDControlItem::FocusChanged(aDrawNow); // DoLayout and change text color when focused SizeChanged(); + TRAP_IGNORE(UpdateTextColorsL()); } void CMIDTextFieldItem::HandleCurrentL(TBool aCurrent) @@ -672,3 +673,21 @@ } } +void CMIDTextFieldItem::UpdateTextColorsL() +{ + if (iTextField) + { + // Set color for content text according to item highlight + // (logical color constants are defined in lcdui.h) + if (iHighlighted) + { + // Text colour from skin - highlighted + iTextField->SetTextSkinColorIdL(KHighlightedItemTextColor); + } + else + { + // Text colour from skin - unfocused + iTextField->SetTextSkinColorIdL(KNonHighlightedItemTextColor); + } + } +}