# HG changeset patch # User hgs # Date 1287575483 -10800 # Node ID 67b3e3c1fc87934fe74d694117e75d441e689fa9 # Parent 989397f9511c8e58360447f698c9beeaaa5b9ae7 201041 diff -r 989397f9511c -r 67b3e3c1fc87 gba/gbaserver/src/bootstrap.cpp --- a/gba/gbaserver/src/bootstrap.cpp Thu Oct 14 13:56:11 2010 +0300 +++ b/gba/gbaserver/src/bootstrap.cpp Wed Oct 20 14:51:23 2010 +0300 @@ -332,7 +332,7 @@ void C3GPPBootstrap::GetBootstrappingMaterialL( const TDesC8& aBSFAddress, const TDesC8& aNAFURL, - const TDesC8& aUICC_LABEL, + const TDesC8& /*aUICC_LABEL*/, const TUint8& aFlags, const TDesC8& aKeyUsage, TDes8 &aKsNAF, @@ -384,10 +384,9 @@ GBA_TRACE_DEBUG(("NAF ID =")); GBA_TRACE_DEBUG(*iNAFID); - - - GBA_TRACE_DEBUG(("UICC label is:")); - GBA_TRACE_DEBUG(aUICC_LABEL); + + //GBA_TRACE_DEBUG(("UICC label is:")); + //GBA_TRACE_DEBUG(aUICC_LABEL); // Get IMPI TPtr8 ptrIdentity = iIdentity->Des(); diff -r 989397f9511c -r 67b3e3c1fc87 gba/gbaserver/src/dataretriever.cpp --- a/gba/gbaserver/src/dataretriever.cpp Thu Oct 14 13:56:11 2010 +0300 +++ b/gba/gbaserver/src/dataretriever.cpp Wed Oct 20 14:51:23 2010 +0300 @@ -683,10 +683,10 @@ // C3GPPBootstrapHttpHandler::MHFRunError() // ----------------------------------------------------------------------------- // -TInt C3GPPBootstrapHttpHandler::MHFRunError(TInt aError, RHTTPTransaction /*aTransaction*/, const THTTPEvent& aEvent) +TInt C3GPPBootstrapHttpHandler::MHFRunError(TInt aError, RHTTPTransaction /*aTransaction*/, const THTTPEvent& /*aEvent*/) { GBA_TRACE_DEBUG_NUM(("MHFRunError called with error code = %d"), aError); - GBA_TRACE_DEBUG_NUM(("MHFRunError called with http event = %d"),aEvent.iStatus ); + //GBA_TRACE_DEBUG_NUM(("MHFRunError called with http event = %d"),aEvent.iStatus ); // tell caller that there was an error TRAPD(err, iEventSink->EventRequestCompletedL(aError)); return err; @@ -959,7 +959,7 @@ // ----------------------------------------------------------------------------- // void C3GPPBootstrapHttpHandler::EncodeDigestAuthL( const RString& aUsername, - const RString& aPW, + const RString& /*aPW*/, RHTTPTransaction& aTransaction, TInt aHeaderPart, const THTTPHdrVal& aRequestUri ) @@ -972,8 +972,8 @@ GBA_TRACE_DEBUG(("Username:")); GBA_TRACE_DEBUG(aUsername.DesC()); - GBA_TRACE_DEBUG(("Passwd:")); - GBA_TRACE_DEBUG_BINARY(aPW.DesC()); + //GBA_TRACE_DEBUG(("Passwd:")); + //GBA_TRACE_DEBUG_BINARY(aPW.DesC()); TBuf8 hash; TBuf8 cnonce; diff -r 989397f9511c -r 67b3e3c1fc87 pkiutilities/DeviceToken/Src/Shared/DevTokenCertInfo.cpp --- a/pkiutilities/DeviceToken/Src/Shared/DevTokenCertInfo.cpp Thu Oct 14 13:56:11 2010 +0300 +++ b/pkiutilities/DeviceToken/Src/Shared/DevTokenCertInfo.cpp Wed Oct 20 14:51:23 2010 +0300 @@ -73,8 +73,10 @@ aSize, aSubjectKeyId, aIssuerKeyId, - aCertificateId); + aCertificateId); + CleanupStack::PushL( self ); self->ConstructL(NULL); + CleanupStack::Pop( self ); return self; } @@ -101,7 +103,9 @@ aIssuerKeyId, aCertificateId, aDeletable); + CleanupStack::PushL( self ); self->ConstructL(NULL); + CleanupStack::Pop( self ); return self; } diff -r 989397f9511c -r 67b3e3c1fc87 pkiutilities/securitydialognotifiersrv/src/securitydialogoperbasicpinquery.cpp --- a/pkiutilities/securitydialognotifiersrv/src/securitydialogoperbasicpinquery.cpp Thu Oct 14 13:56:11 2010 +0300 +++ b/pkiutilities/securitydialognotifiersrv/src/securitydialogoperbasicpinquery.cpp Wed Oct 20 14:51:23 2010 +0300 @@ -106,7 +106,7 @@ HBufC* caption = NULL; TInt minLength = 0; - TInt maxLength = 0; + TInt maxLength = KPINLabelMaxLength; TInt mode = ESecUiAlphaSupported | ESecUiSecretSupported | ESecUiCancelSupported | ESecUiEmergencyNotSupported; if( iPinInput->iPIN.iPINLabel == KBasicPinQueryKeyStorePassphrase ) diff -r 989397f9511c -r 67b3e3c1fc87 remotelock/RemoteLockEngine/Src/RemoteLock.cpp --- a/remotelock/RemoteLockEngine/Src/RemoteLock.cpp Thu Oct 14 13:56:11 2010 +0300 +++ b/remotelock/RemoteLockEngine/Src/RemoteLock.cpp Wed Oct 20 14:51:23 2010 +0300 @@ -593,7 +593,13 @@ void CRemoteLock::CheckSettingsL() { RL_TRACE_PRINT(" [ rl.exe ] CheckSettingsL () "); - iRemoteLockSetting->GetEnabled( iIsEnabled ); + TBool remoteLockStatus( EFalse ); + + remoteLockStatus = iRemoteLockSetting->GetEnabled( iIsEnabled ); + if(!remoteLockStatus) + { + RL_TRACE_PRINT(" [ rl.exe ] !remoteLockStatus "); + } delete iStoredCode; iStoredCode = NULL; diff -r 989397f9511c -r 67b3e3c1fc87 secsrv_plat/keyguard_access_api/inc/keyguardaccessapi.h --- a/secsrv_plat/keyguard_access_api/inc/keyguardaccessapi.h Thu Oct 14 13:56:11 2010 +0300 +++ b/secsrv_plat/keyguard_access_api/inc/keyguardaccessapi.h Wed Oct 20 14:51:23 2010 +0300 @@ -119,6 +119,11 @@ IMPORT_C TInt TestPanicClient( ); + /** + * Confirms that the server is running + * @return KErrNone if succeeded + */ + IMPORT_C TInt AutolockStatus( TInt aCommand, TInt aParam); private: diff -r 989397f9511c -r 67b3e3c1fc87 secsrv_plat/security_code_ui_api/inc/SecUiSecurityHandler.h --- a/secsrv_plat/security_code_ui_api/inc/SecUiSecurityHandler.h Thu Oct 14 13:56:11 2010 +0300 +++ b/secsrv_plat/security_code_ui_api/inc/SecUiSecurityHandler.h Wed Oct 20 14:51:23 2010 +0300 @@ -25,9 +25,9 @@ #include #include -#include -#include - +#include +#define EErrorTone 1 +#define EConfirmationTone 2 // FORWARD DECLARATIONS class RTASecuritySession; @@ -120,6 +120,7 @@ * CancelOpenQuery */ TInt CancelOpenQuery(TInt aStatus); + HBufC* TranslateLC(const TDesC& aMessageId, TInt aFlags); private: // DATA /***************************************************** @@ -129,7 +130,6 @@ RMobilePhone& iPhone; TBool iQueryCanceled; CCodeQueryDialog* iSecurityDlg; - CAknNoteDialog* iNoteDlg; TBool* iDestroyedPtr; RMmCustomAPI iCustomPhone; RTASecuritySession* iSecuritySession; diff -r 989397f9511c -r 67b3e3c1fc87 secsrv_plat/security_code_ui_api/inc/SecUiSecuritySettings.h --- a/secsrv_plat/security_code_ui_api/inc/SecUiSecuritySettings.h Thu Oct 14 13:56:11 2010 +0300 +++ b/secsrv_plat/security_code_ui_api/inc/SecUiSecuritySettings.h Wed Oct 20 14:51:23 2010 +0300 @@ -24,7 +24,6 @@ // INCLUDES #include #include -#include #define KSecUiAskNever 1 #define KSecUiAskOnlyIfInvalid 2 @@ -172,7 +171,7 @@ * * @return Void */ - static void ShowResultNoteL(TInt aResourceID, CAknNoteDialog::TTone aTone); + static void ShowResultNoteL(TInt aResourceID, TInt aTone); IMPORT_C TInt ChangeRemoteLockStatusL( TBool& aRemoteLockStatus, TDes& aRemoteLockCode, TInt aAutoLockPeriod ); @@ -198,6 +197,7 @@ */ IMPORT_C TInt AskSecCodeParamsL(RMobilePhone::TMobilePassword &aOldPassword, TInt aFlags, TDes& aCaption, TInt aShowError); IMPORT_C TInt ChangePinRequestParamsL(TInt aEnable, RMobilePhone::TMobilePassword aOldPassword, TInt aFlags, TDes& aCaption, TInt aShowError); + IMPORT_C static HBufC* TranslateLC(const TDesC& aMessageId, TInt aFlags); private: diff -r 989397f9511c -r 67b3e3c1fc87 securitydialogs/Autolock/PubSub/SecurityUIsPrivatePSKeys.h --- a/securitydialogs/Autolock/PubSub/SecurityUIsPrivatePSKeys.h Thu Oct 14 13:56:11 2010 +0300 +++ b/securitydialogs/Autolock/PubSub/SecurityUIsPrivatePSKeys.h Wed Oct 20 14:51:23 2010 +0300 @@ -72,12 +72,15 @@ const TUint32 KSecurityUIsScreenSaverStatus = 0x00000306; enum TSecurityUIsScreenSaverValues { - ESecurityUIsScreenSaverUninitialized = 0, - ESecurityUIsScreenSaverOn, - ESecurityUIsScreenSaverOff, - ESecurityUIsScreenSaverOffWhileUnguardQuery, - ESecurityUIsScreenSaverOffWhileUnlockQuery, - ESecurityUIsScreenSaverLastValue + EDeviceDialogUninitialized = -1, + EDeviceDialogDestroyed = 0, + EDeviceDialogCreated = 1, + EDeviceDialogRaised = 2, + EDeviceDialogScreenSaverHidden = 0x10, + EDeviceDialogScreenSaverReDisplay = 0x11, + EDeviceDialogScreenSaver = 0x12, + EDeviceDialogLockIcon= 0x20, + EDeviceDialogLastValue }; /** diff -r 989397f9511c -r 67b3e3c1fc87 securitydialogs/Autolock/src/Autolock.cpp --- a/securitydialogs/Autolock/src/Autolock.cpp Thu Oct 14 13:56:11 2010 +0300 +++ b/securitydialogs/Autolock/src/Autolock.cpp Wed Oct 20 14:51:23 2010 +0300 @@ -35,6 +35,7 @@ #include #include +#include #include "Autolock.h" #include @@ -87,6 +88,7 @@ static const char *KSnsrCmdUnlock = "unlock"; static const char *KSnsrCmdSwitchLights = "switch_lights"; static const char *KSnsrCmdSwitchLowPower = "switch_low_power"; +static const char *KSnsrCmdResetActiveModeTimer = "resetActiveModeTimer"; Autolock::Autolock(QWidget *parent, Qt::WFlags f) : QWidget(parent, f), @@ -123,7 +125,7 @@ RDEBUG("autolockState", autolockState); if (autolockState == EAutolockStatusUninitialized) { - autolockState = EAutolockOff; // not-initialized means taht the unlock-query hasn't been displayed. Therefore the device should not stay locked. + autolockState = EAutolockOff; // not-initialized means that the unlock-query hasn't been displayed. Therefore the device should not stay locked. } ret = RProperty::Set(KPSUidCoreApplicationUIs, KCoreAppUIsAutolockStatus, autolockState); // this might re-set it. That's not bad. It will re-notify all listeners. RDEBUG("Set KCoreAppUIsAutolockStatus", ret); @@ -146,22 +148,13 @@ TSecurityPolicy::EAlwaysPass)); RDEBUG("defined KSecurityUIsDismissDialog", ret); - // call TARM so that it verifies that configuration is in sync. This might internally accept the (default) lock code, but doesn't dismiss the query. - // Note: this is fast : 0.02 seconds - RSCPClient scpClientConfiguration; - User::LeaveIfError( scpClientConfiguration.Connect() ); - CleanupClosePushL( scpClientConfiguration ); - RDEBUG("call CheckConfiguration KSCPComplete", KSCPComplete); - TInt finalConfStatus = scpClientConfiguration.CheckConfiguration( KSCPComplete ); - RDEBUG("finalConfStatus", finalConfStatus); - CleanupStack::PopAndDestroy(); // scpClientConfiguration + ret = RProperty::Define(KPSUidSecurityUIs, KSecurityUIsScreenSaverStatus, RProperty::EInt, TSecurityPolicy(TSecurityPolicy::EAlwaysPass), writePolicy); + RDEBUG("defined KSecurityUIsScreenSaverStatus", ret); mService = new AutolockService(this); /* Adjust the palette */ -#if defined(Q_WS_S60) - // this is defined. - RDEBUG( "Q_WS_S60", 1 ); + RDEBUG( "Palette", 1 ); QPalette p = qApp->palette(); QColor color(192,192,192); QColor bg(201,250,250); @@ -175,14 +168,13 @@ p.setColor(QPalette::Link, QColor(240,40,40)); qApp->setPalette(p); -#endif RDEBUG("connect", 1); #if defined(Q_WS_X11) || defined(Q_WS_WIN) RDEBUG( "Q_WS_X11", 1 ); setFixedSize(QSize(360,640)); // nHD -#elif defined(Q_WS_S60) +#else // this doesn't work well // showMaximized(); showFullScreen(); @@ -198,10 +190,12 @@ iLockCodeQueryInDisplay = EFalse; Q_UNUSED(cRresult); TInt err = 0; + err = err; iProcessingEvent = -1; iLockStatusPrev = ELockNotActive; iLockStatus = ELockNotActive; + iSCPConfigured = 0; QT_TRAP_THROWING(repository = CRepository::NewL(KCRUidSecuritySettings)); cRresult = repository->Get(KSettingsAutolockStatus, lockValue); RDEBUG("KSettingsAutolockStatus", KSettingsAutolockStatus); @@ -323,6 +317,7 @@ void Autolock::adjustInactivityTimers(int aReason) { RDEBUG("aReason", aReason); + aReason = aReason; TInt keyguardTime = 0; TInt lockTime = 0; CRepository* repository = NULL; @@ -403,7 +398,9 @@ { RDEBUG("aMode", aMode); RDEBUG("aReason", aReason); + aReason = aReason; RDEBUG("aCaller", aCaller); + aCaller = aCaller; TInt err = 0; if(aMode!=ESecurityUIsLightsLockOffRequest && aMode!=ELockAppDisableKeyguard) { @@ -582,6 +579,8 @@ void Autolock::setLabelNumber(QString label, QString number) { RDEBUG("0", 0); + label = label; + number = number; } // Used on debug environment for printing the Request in understandable format @@ -875,7 +874,7 @@ } else { - RDEBUG("not set KCoreAppUIsAutolockStatus because already ", EAutolockOff); + RDEBUG("not set KCoreAppUIsAutolockStatus because already EAutolockOff", EAutolockOff); } // Not needed. SysAp turns the lights when keyguard is disabled // TurnLights(ESecurityUIsLightsLockOnRequest, aReason, 0x14); @@ -897,7 +896,7 @@ } else { - RDEBUG("not set KCoreAppUIsAutolockStatus because already ", EAutolockOff); + RDEBUG("not set KCoreAppUIsAutolockStatus because already EAutolockOff", EAutolockOff); } TurnLights(ESecurityUIsLightsLockOffRequest, aReason, 0x16); // same for keyguard and devicelock // cRresult = repositoryDevicelock->Set(KSettingsAutolockStatus, 0); @@ -915,7 +914,7 @@ } else { - RDEBUG("not set KCoreAppUIsAutolockStatus because already ", EManualLocked); + RDEBUG("not set KCoreAppUIsAutolockStatus because already EManualLocked", EManualLocked); } TurnLights(ESecurityUIsLightsQueryOnRequest, aReason, 0x18); // cRresult = repositoryDevicelock->Set(KSettingsAutolockStatus, 1); @@ -927,6 +926,7 @@ delete repositoryDevicelock; delete repositoryKeyguard; // this is the real point where everything is done. + RDEBUG("iLockStatusPrev", iLockStatusPrev); iLockStatusPrev = iLockStatus; iLockStatus = aReason; RDEBUG("setting iLockStatus", iLockStatus); @@ -1178,6 +1178,52 @@ } } break; + case 0x100: // Start/confirm server + { + // call TARM so that it verifies that configuration is in sync. This might internally accept the (default) lock code, but doesn't dismiss the query. + // Note: this is fast : 0.02 seconds + TInt secuiOperation=mParam1; + TInt iStartup=0; // this comes as a flag, part of secuiOperation + iStartup = iStartup; + RDEBUG("secuiOperation", secuiOperation); + RDEBUG("iSCPConfigured", iSCPConfigured); + errorInProcess = KErrNone; + if(secuiOperation>=0x1000) + { + iStartup=1; + secuiOperation-=0x1000; + } + if(secuiOperation==0 /*unknown*/ || secuiOperation==2 /*PIN*/) + { + // nothing to do. SCP should not be verified on PIN ; only on lock-query at boot + RDEBUG("nothing to do because secuiOperation", secuiOperation); + RDEBUG("KErrCompletion", KErrCompletion); + errorInProcess = KErrCompletion; + } + else + { + // usually secuiOperation=6 + if(!iSCPConfigured) + { + RSCPClient scpClientConfiguration; + User::LeaveIfError( scpClientConfiguration.Connect() ); + CleanupClosePushL( scpClientConfiguration ); + RDEBUG("call CheckConfiguration KSCPComplete", KSCPComplete); + TInt finalConfStatus = scpClientConfiguration.CheckConfiguration( KSCPComplete ); + RDEBUG("finalConfStatus", finalConfStatus); + CleanupStack::PopAndDestroy(); // scpClientConfiguration + iSCPConfigured=1; + errorInProcess = KErrNone; + } + else + { + RDEBUG("nothing to do because iSCPConfigured", iSCPConfigured); + RDEBUG("KErrAlreadyExists", KErrAlreadyExists); + errorInProcess = KErrAlreadyExists; + } + } + } + break; default: { RDEBUG("default", ret); @@ -1204,11 +1250,14 @@ if (target == EDeviceDialogDestroyed || target == EDeviceDialogScreenSaverHidden) // hide { + /* + This doesn't work since Avkon deprecations RDEBUG("ReleaseContext", R_AVKON_DEFAULT_SKEY_LIST); static_cast(CEikonEnv::Static()->EikAppUi())->KeySounds()->ReleaseContext(); RDEBUG("PopContext", 0x90); static_cast(CEikonEnv::Static()->EikAppUi())->KeySounds()->PopContext(); RDEBUG("ReleaseContext done", 0x92); + */ // aReason is not important here, but let's check nevertheless if (aReason != ELockAppDisableKeyguard && aReason != ELockAppDisableDevicelock && aReason != ELockAppOfferDevicelock) @@ -1277,6 +1326,9 @@ } else if (target == EDeviceDialogCreated || target == EDeviceDialogScreenSaverReDisplay) // show { + /* + This doesn't work since Avkon deprecations + RDEBUG("PushContextL", R_AVKON_DEFAULT_SKEY_LIST); static_cast(CEikonEnv::Static()->EikAppUi())->KeySounds()->PushContextL(R_AVKON_SILENT_SKEY_LIST); RDEBUG("BringToForeground", 0x90); @@ -1284,10 +1336,12 @@ RDEBUG("LockContext", 0x91); static_cast(CEikonEnv::Static()->EikAppUi())->KeySounds()->LockContext(); RDEBUG("PushContextL Done", 0x92); + */ // secUiOriginatedQuery should be ESecurityUIsSecUIOriginatedUninitialized . If not, the validation is not correctly filtering it QVariantMap params; TBool err=EFalse; + err = err; if (aReason == ELockAppEnableKeyguard) params.insert("type", ESecUiTypeKeyguard); @@ -1538,8 +1592,8 @@ void Autolock::switchScreensaverToPowerSaveMode() { RDEBUG("0", 0); - // This crashes IVE3. TODO : restore when it works again. - //switchScreensaverMode( ESnsrViewTypeStandby); + // This works again and doesn't crash IVE3 + switchScreensaverMode( ESnsrViewTypeStandby); RDEBUG("99", 0x99); } @@ -1563,6 +1617,14 @@ RDEBUG("err", err); } + it = data.find(KSnsrCmdResetActiveModeTimer); + if (it != data.end() && iLockStatus != ELockNotActive) + { + RDEBUG("calling switchScreensaverMode ESnsrViewTypeActive", ESnsrViewTypeActive); + switchScreensaverMode( ESnsrViewTypeActive ); + RDEBUG("done", 1); + } + it = data.find(KSnsrCmdSwitchLowPower); if (it != data.end()) { @@ -1604,6 +1666,7 @@ { RDEBUG("0", 0); int err(0); + err = err; // Screensaver (usually) cannot send anymore any commands when // it's being closed. Thus, we need to ensure here that screen has lights and // full-power mode once screensaver is closed. @@ -1949,6 +2012,7 @@ { RDEBUG("0", 0); TInt err = KErrNone; + err = err; RDEBUG("number", number.toInt()); RDEBUG("aParam1", aParam1.toInt()); RDEBUG("aParam2", aParam2.toInt()); diff -r 989397f9511c -r 67b3e3c1fc87 securitydialogs/Autolock/src/Autolock.h --- a/securitydialogs/Autolock/src/Autolock.h Thu Oct 14 13:56:11 2010 +0300 +++ b/securitydialogs/Autolock/src/Autolock.h Wed Oct 20 14:51:23 2010 +0300 @@ -64,19 +64,6 @@ EDevicelockTimer }; -enum TDeviceDialogCreated - { - EDeviceDialogUninitialized = -1, - EDeviceDialogDestroyed = 0, - EDeviceDialogCreated = 1, - EDeviceDialogRaised = 2, - EDeviceDialogScreenSaverHidden = 0x10, - EDeviceDialogScreenSaverReDisplay = 0x11, - EDeviceDialogScreenSaver = 0x12, - EDeviceDialogLockIcon= 0x20, - EDeviceDialogLastValue - }; - class QTimer; class AutolockService; @@ -181,6 +168,7 @@ // HBufC16 *mScreensaverPowerSavePixelBuffer; TInt32 iProcessingEvent; int iTempDisableOnlyKeyguardBecauseIncomingCall; + int iSCPConfigured; }; class AutolockService : public XQServiceProvider diff -r 989397f9511c -r 67b3e3c1fc87 securitydialogs/SecUi/BWinsCw/SECUI_EKA2U.def --- a/securitydialogs/SecUi/BWinsCw/SECUI_EKA2U.def Thu Oct 14 13:56:11 2010 +0300 +++ b/securitydialogs/SecUi/BWinsCw/SECUI_EKA2U.def Wed Oct 20 14:51:23 2010 +0300 @@ -69,4 +69,5 @@ ?ChangeAutoLockPeriodParamsL@CSecuritySettings@@QAEHHV?$TBuf@$09@@HAAVTDes16@@H@Z @ 68 NONAME ; int CSecuritySettings::ChangeAutoLockPeriodParamsL(int, class TBuf<10>, int, class TDes16 &, int) ?LaunchHelpL@CSecQueryUi@@QAEXABVTDesC16@@ABVTUid@@@Z @ 69 NONAME ; void CSecQueryUi::LaunchHelpL(class TDesC16 const &, class TUid const &) ?AskSecCodeParamsL@CSecuritySettings@@QAEHAAV?$TBuf@$09@@HAAVTDes16@@H@Z @ 70 NONAME ; int CSecuritySettings::AskSecCodeParamsL(class TBuf<10> &, int, class TDes16 &, int) + ?TranslateLC@CSecuritySettings@@SAPAVHBufC16@@ABVTDesC16@@H@Z @ 71 NONAME ; class HBufC16 * CSecuritySettings::TranslateLC(class TDesC16 const &, int) diff -r 989397f9511c -r 67b3e3c1fc87 securitydialogs/SecUi/EABI/Secuiu.def --- a/securitydialogs/SecUi/EABI/Secuiu.def Thu Oct 14 13:56:11 2010 +0300 +++ b/securitydialogs/SecUi/EABI/Secuiu.def Wed Oct 20 14:51:23 2010 +0300 @@ -100,4 +100,5 @@ _ZTI11CSecQueryUi @ 99 NONAME _ZTV11CSecQueryUi @ 100 NONAME _ZN17CSecuritySettings17AskSecCodeParamsLER4TBufILi10EEiR6TDes16i @ 101 NONAME + _ZN17CSecuritySettings11TranslateLCERK7TDesC16i @ 102 NONAME diff -r 989397f9511c -r 67b3e3c1fc87 securitydialogs/SecUi/Inc/SecUiAutoLockSettingPage.h --- a/securitydialogs/SecUi/Inc/SecUiAutoLockSettingPage.h Thu Oct 14 13:56:11 2010 +0300 +++ b/securitydialogs/SecUi/Inc/SecUiAutoLockSettingPage.h Wed Oct 20 14:51:23 2010 +0300 @@ -20,8 +20,8 @@ #ifndef __CAUTOLOCKSETTINGPAHGE_H #define __CAUTOLOCKSETTINGPAHGE_H -#include #include +#include class CAutoLockSettingPage : public CBase { diff -r 989397f9511c -r 67b3e3c1fc87 securitydialogs/SecUi/SecUiTestQt/SecUiTestQt.pri --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/securitydialogs/SecUi/SecUiTestQt/SecUiTestQt.pri Wed Oct 20 14:51:23 2010 +0300 @@ -0,0 +1,153 @@ +###################################################################### +# hbtest.pri +###################################################################### + +isEmpty(TEMPLATE):TEMPLATE = app + +contains(TEMPLATE, .*subdirs$) { + + !contains(_PRO_FILE_PWD_, .*/fute$) { + # recurse into subdirs + test.CONFIG += recursive + autotest.CONFIG += recursive + citest.CONFIG += recursive + } + + root { + # compile all tests first at the root level + !win32|CONFIG(debug, debug|release):test.depends = first + !win32|CONFIG(debug, debug|release):autotest.depends = first + !win32|CONFIG(debug, debug|release):citest.depends = first + } + +} else { + + # Flag all the test binaries SMP-safe in Symbian + symbian:MMP_RULES += SMPSAFE + + INCLUDEPATH += $$_PRO_FILE_PWD_ + DEPENDPATH += $$_PRO_FILE_PWD_ + + QMAKE_RPATHDIR += $${HB_BUILD_DIR}/lib + + HB_TEST_INSTALL_DIR = $${HB_INSTALL_DIR}/tsrc/bin + DEFINES += HB_BUILD_DIR=\"\\\"$${HB_BUILD_DIR}\\\"\" + + hbtestresources { + LIBS += -L$${HB_BUILD_DIR}/lib -lHbTestResources + } + + HB = $$lower($$unique(HB)) + isEmpty(HB):HB = hbcore hbwidgets + !contains(HB, "hbcore"):!contains(HB_NOMAKE_PARTS, hbcore): HB += hbcore + contains(HB, "hbutils")|contains(HB, "hbinput")|contains(HB, "hbfeedback"): HB *= hbwidgets + + for(COLLECTION, HB) { + isEqual(COLLECTION, hbcore) { + !contains(HB_NOMAKE_PARTS, hbcore):hbAddLibrary(hbcore/HbCore) + } else:isEqual(COLLECTION, hbwidgets) { + !contains(HB_NOMAKE_PARTS, hbwidgets):hbAddLibrary(hbwidgets/HbWidgets) + } else:isEqual(COLLECTION, hbutils) { + !contains(HB_NOMAKE_PARTS, hbutils):hbAddLibrary(hbutils/HbUtils) + } else:isEqual(COLLECTION, hbinput) { + !contains(HB_NOMAKE_PARTS, hbinput):hbAddLibrary(hbinput/HbInput) + } else:isEqual(COLLECTION, hbfeedback) { + !contains(HB_NOMAKE_PARTS, hbfeedback):hbAddLibrary(hbfeedback/HbFeedback) + } else { + message(Unknown COLLECTION: $$COLLECTION) + next() + } + } + + plugin { + + # nothing to do for plugins + + } else { + + unit_test = false + perf_test = false + loc_test = false + contains(_PRO_FILE_PWD_, .*/tsrc/unit/.*):unit_test = true + contains(_PRO_FILE_PWD_, .*/tsrc/performance/.*):perf_test = true + contains(_PRO_FILE_PWD_, .*/tsrc/loc/.*):loc_test = true + + $$unit_test|$$perf_test|$$loc_test { + + # a runnable test + HEADERS += hbtest.h + CONFIG -= app_bundle + CONFIG += qtestlib console + + $$perf_test:include($${HB_SOURCE_DIR}/tsrc/performance/shared/shared.pri) + + # TODO: cleanup test execution + win32:DESTDIR = debug + # only Makefile.Debug on win32: + !win32|CONFIG(debug, debug|release):build_pass:!isEmpty(DESTDIR) { + test.commands += cd $$DESTDIR && + autotest.commands += cd $$DESTDIR && + citest.commands += cd $$DESTDIR && + } + unix { + exists( /usr/local/bin/launcher ) { + test.commands += /usr/local/bin/launcher ./$(TARGET) + autotest.commands += /usr/local/bin/launcher ./$(TARGET) -style plastique -xml -o $${HB_BUILD_DIR}/autotest/$(QMAKE_TARGET).xml + citest.commands += /usr/local/bin/launcher ./$(TARGET) -style plastique -xunitxml -o $${HB_BUILD_DIR}/autotest/$(QMAKE_TARGET).xml + } else { + test.commands += ./$(TARGET) + autotest.commands += ./$(TARGET) -style plastique -xml -o $${HB_BUILD_DIR}/autotest/$(QMAKE_TARGET).xml + citest.commands += ./$(TARGET) -style plastique -xunitxml -o $${HB_BUILD_DIR}/autotest/$(QMAKE_TARGET).xml + } + } else:win32 { + test.CONFIG += recursive + autotest.CONFIG += recursive + citest.CONFIG += recursive + # only Makefile.Debug: + win32-g++:!isEmpty(QMAKE_SH) { + CONFIG(debug, debug|release):build_pass { + test.commands += ./$(TARGET) + autotest.commands += ./$(TARGET) -xml -o $${HB_BUILD_DIR}/autotest/$(QMAKE_TARGET).xml + citest.commands += ./$(TARGET) -xunitxml -o $${HB_BUILD_DIR}/autotest/$(QMAKE_TARGET).xml + } + } else { + CONFIG(debug, debug|release):build_pass { + test.commands += $(TARGET) + autotest.commands += $(TARGET) -xml -o $${HB_BUILD_DIR}/autotest/$(QMAKE_TARGET).xml + citest.commands += $(TARGET) -xunitxml -o $${HB_BUILD_DIR}/autotest/$(QMAKE_TARGET).xml + } + } + } + + $$unit_test { + symbian:RSS_RULES = "group_name=\"HbUnitTests\";" + else:target.path = $${HB_TEST_INSTALL_DIR}/unit + } else:$$loc_test { + symbian:RSS_RULES = "group_name=\"HbLocTests\";" + else:target.path = $${HB_TEST_INSTALL_DIR}/loc + } else:$$perf_test { + symbian:RSS_RULES = "group_name=\"HbPerfApps\";" + else:target.path = $${HB_TEST_INSTALL_DIR}/perf + } else { + symbian:RSS_RULES = "group_name=\"HbUnknown\";" + else:target.path = $${HB_TEST_INSTALL_DIR}/unknown + } + !symbian:INSTALLS += target + + } else:contains(_PRO_FILE_PWD_, .*/fute/.*) { + + # a fute app + target.path = $${HB_TEST_INSTALL_DIR}/fute + INSTALLS += target + symbian { + RSS_RULES = "group_name=\"HbTestApps\";" + } + + } + } +} + +!contains(QMAKE_EXTRA_TARGETS, test):QMAKE_EXTRA_TARGETS += test +!contains(QMAKE_EXTRA_TARGETS, autotest)::QMAKE_EXTRA_TARGETS += autotest +!contains(QMAKE_EXTRA_TARGETS, citest)::QMAKE_EXTRA_TARGETS += citest + diff -r 989397f9511c -r 67b3e3c1fc87 securitydialogs/SecUi/SecUiTestQt/SecUiTestQt.pro --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/securitydialogs/SecUi/SecUiTestQt/SecUiTestQt.pro Wed Oct 20 14:51:23 2010 +0300 @@ -0,0 +1,30 @@ +HEADERS += contentwidget.h dirviewitem.h modelfactory.h viewfutedataform.h treedataform.h mailtreeviewitem.h brownevenviewitem.h greenoddviewitem.h +SOURCES += contentwidget.cpp main.cpp dirviewitem.cpp modelfactory.cpp viewfutedataform.cpp treedataform.cpp mailtreeviewitem.cpp brownevenviewitem.cpp greenoddviewitem.cpp +RESOURCES += SecUiTestQt.qrc shared.qrc + +LIBS += -lsecui -letelmm -letel -lcustomapi -lcentralrepository +LIBS += -lcone -lws32 -lkeylockpolicyapi +LIBS += -lpower_save_display_mode +LIBS += -ltstaskmonitorclient # for TsTaskSettings +LIBS += -lavkon # for KeySounds +LIBS += -lapgrfx # for CApaWindowGroupName +LIBS += -lscpclient # SCP server +LIBS += -llockclient +LIBS += -letelmm +LIBS += -letel +LIBS += -lcustomapi +LIBS += -letel3rdparty + +symbian*: { + TARGET.CAPABILITY = CAP_APPLICATION NetworkControl + TARGET.UID3 = 0xEE89E3CE + TARGET.EPOCHEAPSIZE = 0x20000 0x1000000 + } +HB_NOMAKE_PARTS += tests performance localization +CONFIG += Hb + +INCLUDEPATH += /sf/mw/hb/include/hbcore/private + +include(SecUiTestQt.pri) + +BLD_INF_RULES.prj_exports += "./rom/SecUiTestQt.iby CORE_APP_LAYER_IBY_EXPORT_PATH(SecUiTestQt.iby)" diff -r 989397f9511c -r 67b3e3c1fc87 securitydialogs/SecUi/SecUiTestQt/SecUiTestQt.qrc --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/securitydialogs/SecUi/SecUiTestQt/SecUiTestQt.qrc Wed Oct 20 14:51:23 2010 +0300 @@ -0,0 +1,10 @@ + + + + resources/qtg_fr_list_new_item_b.svg + resources/qtg_fr_list_new_item_c.svg + resources/qtg_fr_list_new_item_t.svg + resources/qtg_nmailui_minus_sign.svg + resources/qtg_nmailui_plus_sign.svg + + diff -r 989397f9511c -r 67b3e3c1fc87 securitydialogs/SecUi/SecUiTestQt/brownevenviewitem.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/securitydialogs/SecUi/SecUiTestQt/brownevenviewitem.cpp Wed Oct 20 14:51:23 2010 +0300 @@ -0,0 +1,70 @@ +#include "brownevenviewitem.h" + +#include "QPainter" +#include "QStyleOptionGraphicsItem" +#include "QWidget" +#include "QDebug" + +BrownEvenViewItem::BrownEvenViewItem(QGraphicsItem* parent) : + HbListViewItem(parent) +{ +} + +BrownEvenViewItem::~BrownEvenViewItem() +{ +} + + +HbAbstractViewItem* BrownEvenViewItem::createItem() +{ + return new BrownEvenViewItem(*this); +} + +bool BrownEvenViewItem::canSetModelIndex(const QModelIndex &index) const +{ + int itemType(index.data(Hb::ItemTypeRole).toInt()); + if (itemType == Hb::StandardItem) { + QVariant displayRole = index.data(Qt::DisplayRole); + QString firstValue; + QStringList stringList; + if (displayRole.isValid()) { + if (displayRole.canConvert()) { + firstValue = displayRole.toString(); + } else if ( displayRole.canConvert() + && displayRole.toStringList().count()) { + firstValue = displayRole.toStringList().at(0); + } + } + + //qDebug() << "BrownEvenViewItem::canSetModelIndex: value" << firstValue; + //int value = index.row(); + int value = firstValue.toInt(); + if ( value > 0 + && value % 2 == 0) { + return true; + } + } + return false; +} + +void BrownEvenViewItem::paint( QPainter *painter, + const QStyleOptionGraphicsItem *option, + QWidget *widget) +{ + HbAbstractViewItem::paint( painter, option, widget ); + if (painter){ + QRectF drawRect = boundingRect(); + drawRect.adjust(1,1,-1,-1); + //QColor brown(141,92,7); + //QColor brown(106,57,10); + QColor brown(87,45,11); + painter->fillRect( drawRect, brown); + } +} + +int BrownEvenViewItem::type() const +{ + return BrownEvenViewItem::Type; +} + + diff -r 989397f9511c -r 67b3e3c1fc87 securitydialogs/SecUi/SecUiTestQt/brownevenviewitem.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/securitydialogs/SecUi/SecUiTestQt/brownevenviewitem.h Wed Oct 20 14:51:23 2010 +0300 @@ -0,0 +1,28 @@ +#ifndef BROWNEVENVIEWITEM_H +#define BROWNEVENVIEWITEM_H + +#include + +class QGraphicsItem; +class QPainter; +class QStyleOptionGraphicsItem; +class QWidget; +class QModelIndex; + +class BrownEvenViewItem : public HbListViewItem +{ + public: + explicit BrownEvenViewItem(QGraphicsItem* parent=0); + virtual ~BrownEvenViewItem(); + + enum { Type = Hb::ItemType_Last + 1002 }; + virtual int type() const; + + virtual HbAbstractViewItem* createItem(); + virtual bool canSetModelIndex(const QModelIndex &index) const; + virtual void paint( QPainter *painter, + const QStyleOptionGraphicsItem *option, + QWidget *widget); +}; + +#endif // BROWNEVENVIEWITEM_H diff -r 989397f9511c -r 67b3e3c1fc87 securitydialogs/SecUi/SecUiTestQt/contentwidget.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/securitydialogs/SecUi/SecUiTestQt/contentwidget.cpp Wed Oct 20 14:51:23 2010 +0300 @@ -0,0 +1,2728 @@ +#include + +#ifdef _DEBUG +#define RDEBUG( x, y ) RDebug::Printf( "%s %s (%u) %s=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, x, y ); +#else +#define RDEBUG( x, y ) +#endif + +#include +#include +#include +#include +#include +#include +#include +#include // KPSUidAvkonDomain, KAknKeyguardStatus, TAknKeyguardStatus +#include // KStartupSecurityCodeQueryStatus +#include // KCoreAppUIsAutolockStatus +#include +#include +#include +#include +#include +#include +#include + +const TInt KPhoneIndex(0); +const TInt KTriesToConnectServer(2); +const TInt KTimeBeforeRetryingServerConnection(50000); +const TUid KAutolockUid = + { + 0x100059B5 + }; +#include + +_LIT( KMmTsyModuleName, "PhoneTsy"); + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#ifdef HB_EFFECTS +#include +#endif // HB_EFFECTS +#include +#include +#include +#include +#include +#include + +#include "../../Autolock/PubSub/securityuisprivatepskeys.h" + +#include "contentwidget.h" +#include "dirviewitem.h" +#include "mailtreeviewitem.h" +#include "modelfactory.h" +#include "treedataform.h" +#include "greenoddviewitem.h" +#include "brownevenviewitem.h" + +// model names for submenu +const QStringList KModelNames = (QStringList() << "Default" << "Simple" << "Deep" << "Flat" << /*"Mail" <<*/"Mixed" << "QDirModel" << "QFileSystemModel" << "GreenOddBrownEven"); + +// orientation submenu items +const QStringList TextStyles = (QStringList() << "Primary" << "Secondary"); +const QStringList CustomWidgets = (QStringList() << "Empty" << "Zoom slider" << "Volume Slider" << "Progress bar" << "Button" << "Text Editor"); +const QStringList LeftColumnWidgets = (QStringList() << "Empty" << "Icon" << "Text"); +const QStringList RightColumnWidgets = (QStringList() << "Empty" << "Icon" << "Text"); +const QStringList MiddleColumnWidgets = (QStringList() << "Empty" << "Four Small Icons" << "Three Large Icons" << "Label" << "Zoom slider" << "Volume Slider" << "Progress bar" + << "Button" << "Text Editor"); + +// Custom role for storing the tree item depth. +const int KMyCustomDepthRole = Qt::UserRole + 18; + +class BannerLabel : public HbLabel + { +public: + BannerLabel(QGraphicsItem *parent) : + HbLabel(parent) + { + QFont currentfont(font()); + currentfont.setBold(true); + currentfont.setPixelSize(18); + setFont(currentfont); + setAlignment(Qt::AlignCenter); + setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed); + } + +protected: + void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) + { + QPen oldPen = painter->pen(); + painter->setPen(QPen(QColor(200, 200, 200, 150))); + painter->setBrush(QBrush(QColor(200, 200, 200, 150), Qt::SolidPattern)); + painter->drawRect(option->rect); + painter->setPen(oldPen); + HbLabel::paint(painter, option, widget); + } + }; + +class HbFileSystemTreeView : public HbTreeView + { + +public: + explicit HbFileSystemTreeView(QGraphicsItem *parent = 0) : + HbTreeView(parent) + { + } + + virtual ~HbFileSystemTreeView() + { + } + +protected: + virtual void emitActivated(const QModelIndex &modelIndex); + +protected slots: +virtual void modelLayoutChanged(); + +private: + QPersistentModelIndex mTopIndex; + + }; + +void HbFileSystemTreeView::emitActivated(const QModelIndex &modelIndex) + { + QList visibleItems = this->visibleItems(); + int count = visibleItems.count(); + if (count > 0) + { + mTopIndex = visibleItems.at(0)->modelIndex(); + } + else + { + mTopIndex = QPersistentModelIndex(); + } + emit activated(modelIndex); + } + +void HbFileSystemTreeView::modelLayoutChanged() + { + if (!mTopIndex.isValid()) + { + mTopIndex = modelIterator()->nextIndex(rootIndex()); + } + scrollTo(mTopIndex, HbAbstractItemView::PositionAtTop); + } + +// ======== MEMBER FUNCTIONS ======== +ContentWidget::ContentWidget(QString& imagesDir, HbMainWindow *mainWindow) : + HbView(0), mImagesDir(imagesDir), mWindow(mainWindow), mTreeView(0), mRemoveModelAction(0), mFileWatcher(0), mModelType(noModel), mMainMenu(0), mCountAdded(0), mMute(false), + mSoftKeyQuitAction(new HbAction(Hb::QuitNaviAction, this)), mSoftKeyConfirmAction(new HbAction(Hb::ConfirmNaviAction, this)), mSoftKeyBackAction(new HbAction( + Hb::BackNaviAction, this)), mSoftKeyDoneAction(new HbAction(Hb::DoneNaviAction, this)), mInfoLabel(new BannerLabel(this)), mMainlayout(0), mForm(0), + mDetailView(0), mTextOfNewItem("Added item"), mScrollHint(HbAbstractItemView::EnsureVisible), mDepth(1), mPopupModel(0), mTimer(0), mItemsToAdd(0) + { + mSoftKeyQuitAction->setText("Quit"); + connect(mSoftKeyQuitAction, SIGNAL(triggered()), this, SLOT(backButtonClicked())); + connect(mSoftKeyConfirmAction, SIGNAL(triggered()), this, SLOT(confirmDelete())); + mSoftKeyBackAction->setText("Back"); + connect(mSoftKeyBackAction, SIGNAL(triggered()), this, SLOT(backButtonClicked())); + + setNavigationAction( mSoftKeyQuitAction); + + mMainlayout = new QGraphicsLinearLayout(Qt::Vertical); + mMainlayout->setContentsMargins(0, 0, 0, 0); + setLayout( mMainlayout); + + updateTextLabel(0); + mInfoLabel->hide(); + + // parameter can be whatever at initialisation phase except, if populateFileSystemModel is populated + createAndInitTreeView( treeModelSimple); + populateTreeModelSimple(); + + setMainMenu(); + +#ifdef HB_EFFECTS + HbEffect::add("listItem", ":RadioButtonList/resources/animation.xml"); +#endif // HB_EFFECTS + } + +ContentWidget::~ContentWidget() + { + if (mModelType == dirModel) + { + // Model is owned by ContentWidget. + delete mTreeView->model(); + } + } + +void ContentWidget::changeMirroring() + { + if (HbApplication::layoutDirection() == Qt::LeftToRight) + { + HbApplication::setLayoutDirection(Qt::RightToLeft); + mMirroring->setText("Turn mirroring off"); + } + else + { + HbApplication::setLayoutDirection(Qt::LeftToRight); + mMirroring->setText("Turn mirroring on"); + } + } + +void ContentWidget::scrollToTarget() + { + if (mTreeView) + { + mTreeView->scrollTo(mTarget, mScrollHint); + } + } + +void ContentWidget::changeOrientation() + { + if (mainWindow()->orientation() == Qt::Vertical) + { + mWindow->setOrientation(Qt::Horizontal); + mOrientationSwitch->setText("Change to portrait"); + } + else + { + mWindow->setOrientation(Qt::Vertical); + mOrientationSwitch->setText("Change to landscape"); + } + } + +void ContentWidget::showSettings() + { + mWindow->removeView(this); + + mForm = new TreeDataForm(*mTreeView, this); + mForm->setHeading("Tree Settings"); + + HbView *newView = mWindow->addView(mForm); + newView->setNavigationAction(mSoftKeyBackAction); + postEvents(); + + mForm->setInputData(ViewFuteDataForm::Settings, ViewFuteDataForm::ScrollHint, mScrollHint); + mForm->setDepth(mDepth); + mForm->setDirViewItemEnabled(mModelType == dirModel); + + mForm->setIndentation(mTreeView->indentation()); + + mForm->populateSettings(); + HbDataFormModel *settingsFormModel = mForm->dataModel(); + mForm->setModel(settingsFormModel); + } + +void ContentWidget::keyPressEvent(QKeyEvent *event) + { + if (event->key() == Qt::Key_H) + { + mWindow->setOrientation(Qt::Horizontal); + event->accept(); + } + else if (event->key() == Qt::Key_V) + { + mWindow->setOrientation(Qt::Vertical); + event->accept(); + } + else if (event->key() == Qt::Key_S) + { + mTreeView->scrollTo(mTreeView->model()->index(0, 0), mScrollHint); + } + else if (event->key() == Qt::Key_R) + { + qreal left, top, right, bottom = 0; + mMainlayout->getContentsMargins(&left, &top, &right, &bottom); + if (left != 0) + { + mMainlayout->setContentsMargins(0, 0, 0, 0); + } + else + { + mMainlayout->setContentsMargins(9, 9, 9, 9); + } + } + else + { + HbView::keyPressEvent(event); + } + } + +void ContentWidget::refresh() + { + if (mTreeView && qobject_cast (mTreeView->model())) + { + qobject_cast (mTreeView->model())->refresh(); + } + } + +void ContentWidget::removeModel() + { + mRemoveModelAction->setEnabled(false); + + if (mModelType != noModel) + { + delete mTreeView->model(); + mTreeView->setModel(0); + } + mModelType = noModel; + mTarget = QModelIndex(); + } + +void ContentWidget::launchInPopup() + { + mPopupModel = ModelFactory::populateTreeModelMixed(); + + HbTreeView *popupTree = new HbTreeView(); + popupTree->setItemPixmapCacheEnabled(true); + + popupTree->setIndentation(0); + popupTree->setModel(mPopupModel); + + // inherit some properties from view + if (mTreeView) + { + popupTree->setSelectionMode(mTreeView->selectionMode()); + } + + HbDialog *popup = new HbDialog(); + connect(popup, SIGNAL(aboutToClose()), this, SLOT(aboutToClose())); + popup->setAttribute(Qt::WA_DeleteOnClose); + popup->setDismissPolicy(HbPopup::TapOutside); + popup->setTimeout(HbPopup::NoTimeout); + HbLabel *label = new HbLabel(tr("View in popup")); + popup->setHeadingWidget(label); + popup->setContentWidget(popupTree); + if (mWindow->orientation() == Qt::Vertical) + { + popup->setMinimumWidth(2 * mWindow->layoutRect().width() / 3); + } + else + { + popup->setMinimumWidth(mWindow->layoutRect().width() / 2); + } + + popup->show(); + } + +void ContentWidget::changeModel(HbAction* action) + { + // removeModel resets mModelType + removeModel(); + int modelType = action->data().toInt(); + if (modelType != noModel) + { + createAndInitTreeView(modelType); + + mRemoveModelAction->setEnabled(true); + + switch (modelType) + { + case treeModelDefault: + populateTreeModelDefault(); + break; + case treeModelSimple: + populateTreeModelSimple(); + break; + case treeModelDeep: + populateTreeModelDeep(); + break; + case treeModelFlat: + populateTreeModelFlat(); + break; + /*case treeModelMail: + populateTreeModelMail(); + break;*/ + case treeModelMixed: + populateTreeModelMixed(); + break; + case dirModel: + populateDirModel(); + break; + case fileSystemModel: + populateFileSystemModel(); + break; + case greenOddBrownEvenModel: + populateGreenOddBrownEvenModel(); + break; + default: + // error + break; + } + expand(mTreeView->model(), mTreeView->rootIndex(), mDepth); + } + resetItemManagementMenu(); + } + +void ContentWidget::editItem(HbAction* action) + { + int itemOperation = action->data().toInt(); + + switch (itemOperation) + { + case addItemOperation: + addItem(); + break; + case changeItemOperation: + changeItem(); + break; + case removeItemOperation: + removeItems(); + break; + case removeAllItemsOperation: + removeAllItems(); + break; + case expandAllOperation: + expandAll(); + break; + case collapseAllOperation: + collapseAll(); + break; + case autoInsertOneOperation: + autoInsertOne(); + break; + case autoRemoveOneOperation: + autoRemoveOne(); + break; + case simulateVisible: + // just checkable item - nothing to do + break; + case resetDuringSimulation: + // just checkable item - nothing to do + break; + case simulateMultipleFastInsertsOperation: + simulateMultipleFastInserts(); + break; + case simulateMultipleFastRemovalsOperation: + simulateMultipleFastRemovals(); + break; + case selectAll: + mTreeView->selectAll(); + break; + case unselect: + mTreeView->clearSelection(); + break; + default: + // error + break; + } + } + +void ContentWidget::insertItemAboveTarget() + { + if (mTarget.isValid()) + { + //bool ok = false; + //QString text = HbInputDialog::getText("Enter item text:", mTextOfNewItem, &ok); +HbInputDialog ::queryText("Enter item text:",this ,SLOT(insertItemAboveTargetClosed(int)),mTextOfNewItem); + //if (ok) { + // mTextOfNewItem = text; + + // QStandardItemModel* model = qobject_cast(mTreeView->model()); + // int row = mTarget.row(); + // model->insertRow(row, mTarget.parent()); + + // Set text. + // if (mTextOfNewItem != QString()) { + // QModelIndex index = model->index(row, 0, mTarget.parent()); + // QStandardItem* newItem = model->itemFromIndex(index); + // newItem->setText(mTextOfNewItem); + // } + //} + } + } + +void ContentWidget::insertItemBelowTarget() + { + if (mTarget.isValid()) + { + //bool ok = false; + //QString text = HbInputDialog::getText("Enter item text:", mTextOfNewItem, &ok); +HbInputDialog ::queryText("Enter item text:",this ,SLOT(insertItemBelowTargetClosed(int)),mTextOfNewItem); + //if (ok) { + // mTextOfNewItem = text; + + // QStandardItemModel* model = qobject_cast(mTreeView->model()); + // int row = mTarget.row() + 1; + // model->insertRow(row, mTarget.parent()); + + // Set text. + // if (mTextOfNewItem != QString()) { + // QModelIndex index = model->index(row, 0, mTarget.parent()); + // QStandardItem* newItem = model->itemFromIndex(index); + // newItem->setText(mTextOfNewItem); + // } + //} + } + } + +void ContentWidget::populateTreeModelDefault() + { + if (mTreeView) + { + delete mTreeView->model(); + + QStandardItemModel* model = ModelFactory::populateTreeModelDefault(); + mTreeView->setModel(model, new HbTreeViewItem); + mTreeView->setIndentation(-1); + + connect(mTreeView->selectionModel(), SIGNAL(selectionChanged(QItemSelection, QItemSelection)), this, SLOT(selectionChanged(QItemSelection, QItemSelection))); + + mModelType = treeModelDefault; + } + } + +void ContentWidget::populateTreeModelSimple() + { + if (mTreeView) + { + delete mTreeView->model(); + + // Keeps following line here: it is easiest debugable model + //QStandardItemModel* model = ModelFactory::populateTreeModelSimpleOfSimplest(); + QStandardItemModel* model = ModelFactory::populateTreeModelSimple(); + mTreeView->setModel(model, new HbTreeViewItem); + mTreeView->setIndentation(-1); + + connect(mTreeView->selectionModel(), SIGNAL(selectionChanged(QItemSelection, QItemSelection)), this, SLOT(selectionChanged(QItemSelection, QItemSelection))); + + mModelType = treeModelSimple; + } + } + +void ContentWidget::populateGreenOddBrownEvenModel() + { + if (mTreeView) + { + delete mTreeView->model(); + + QStandardItemModel* model = ModelFactory::populateGreenOddBrownEvenModel(); + + QList prototypes; + HbListViewItem *prototype1 = new HbTreeViewItem(mTreeView); + prototype1->resize(0, 0); + prototypes.append(prototype1); + + GreenOddViewItem *prototype2 = new GreenOddViewItem(mTreeView); + prototype2->resize(0, 0); + prototypes.append(prototype2); + + BrownEvenViewItem *prototype3 = new BrownEvenViewItem(mTreeView); + prototype3->resize(0, 0); + prototypes.append(prototype3); + + mTreeView->setItemPrototypes(prototypes); + mTreeView->setIndentation(-1); + + mTreeView->setModel(model); + + connect(mTreeView->selectionModel(), SIGNAL(selectionChanged(QItemSelection, QItemSelection)), this, SLOT(selectionChanged(QItemSelection, QItemSelection))); + + mModelType = greenOddBrownEvenModel; + } + } + +void ContentWidget::populateTreeModelDeep() + { + if (mTreeView) + { + delete mTreeView->model(); + + QStandardItemModel* model = ModelFactory::populateTreeModelDeep(); + mTreeView->setModel(model, new HbTreeViewItem); + mTreeView->setIndentation(-1); + + connect(mTreeView->selectionModel(), SIGNAL(selectionChanged(QItemSelection, QItemSelection)), this, SLOT(selectionChanged(QItemSelection, QItemSelection))); + + mModelType = treeModelDeep; + } + } + +void ContentWidget::populateTreeModelFlat() + { + if (mTreeView) + { + delete mTreeView->model(); + mTreeView->setItemRecycling(true); + + QStandardItemModel* model = ModelFactory::populateTreeModelFlat(); + mTreeView->setModel(model, new HbTreeViewItem); + mTreeView->setIndentation(-1); + + connect(mTreeView->selectionModel(), SIGNAL(selectionChanged(QItemSelection, QItemSelection)), this, SLOT(selectionChanged(QItemSelection, QItemSelection))); + + mModelType = treeModelFlat; + } + } + +/*void ContentWidget::populateTreeModelMail() + { + if (mTreeView) { + delete mTreeView->model(); + mTreeView->setItemRecycling(true); + + QStandardItemModel* model = ModelFactory::populateTreeModelMail(); + mTreeView->setModel(model, new MailTreeViewItem); + mTreeView->setIndentation(0); + + connect(mTreeView->selectionModel(), + SIGNAL(selectionChanged(QItemSelection, QItemSelection)), + this, + SLOT(selectionChanged(QItemSelection, QItemSelection))); + + mModelType = treeModelMail; + } + }*/ + +void ContentWidget::populateDirModel() + { + if (mTreeView) + { + delete mTreeView->model(); + + QDirModel* model = new QDirModel(); + model->setSorting(QDir::DirsFirst); + + mTreeView->setModel(model, new HbTreeViewItem); + mTreeView->setIndentation(-1); + + connect(mTreeView->selectionModel(), SIGNAL(selectionChanged(QItemSelection, QItemSelection)), this, SLOT(selectionChanged(QItemSelection, QItemSelection))); + + if (!mFileWatcher) + { + mFileWatcher = new QFileSystemWatcher(); + mFileWatcher->addPath(mImagesDir); + connect(mFileWatcher, SIGNAL(directoryChanged(QString)), this, SLOT(refresh())); + connect(mFileWatcher, SIGNAL(fileChanged(QString)), this, SLOT(refresh())); + } + mModelType = dirModel; + } + } + +void ContentWidget::populateFileSystemModel() + { + if (mTreeView) + { + delete mTreeView->model(); + + QFileSystemModel* model = new QFileSystemModel(); + QString myComputer = model->myComputer().toString(); + model->setRootPath(myComputer); + mTreeView->setModel(model, new HbTreeViewItem); + mTreeView->setIndentation(-1); + + QDir dir(""); + QStringList dirs = dir.entryList(QDir::Dirs | QDir::NoDotAndDotDot); + int count = 0; + for (int i = 0; i < count; i++) + { + model->setRootPath(dirs.at(i)); + } + + connect(mTreeView->selectionModel(), SIGNAL(selectionChanged(QItemSelection, QItemSelection)), this, SLOT(selectionChanged(QItemSelection, QItemSelection))); + + mModelType = fileSystemModel; + } + } + +void ContentWidget::populateTreeModelMixed() + { + if (mTreeView) + { + delete mTreeView->model(); + mTreeView->setItemRecycling(true); + + QStandardItemModel* model = ModelFactory::populateTreeModelMixed(); + mTreeView->setModel(model, new HbTreeViewItem); + + connect(mTreeView->selectionModel(), SIGNAL(selectionChanged(QItemSelection, QItemSelection)), this, SLOT(selectionChanged(QItemSelection, QItemSelection))); + + mModelType = treeModelMixed; + } + } + +void ContentWidget::setMainMenu() + { + if (!mMainMenu) + { + mMainMenu = new HbMenu(); + + // ----------------------------------------- + // Submenu for selecting/removing the model. + // ----------------------------------------- + HbMenu *subMenu = mMainMenu->addMenu("Model"); + connect(subMenu, SIGNAL(triggered(HbAction*)),this, SLOT(changeModel(HbAction*))); + + int i(noModel); + HbAction *action = subMenu->addAction("Remove Model"); + action->setData(QVariant(i)); + mRemoveModelAction = action; + + QString temporaryString; + foreach (temporaryString , KModelNames) + { + HbAction *subAction = subMenu->addAction(temporaryString); + i++; + subAction->setData ( QVariant(i) ); + } + + // Settings menuitem. + HbAction *settingsAction = mMainMenu->addAction("Settings"); + connect(settingsAction, SIGNAL(triggered()), this, SLOT(showSettings())); + + // ------------------------- + // Submenu for editing item. + // ------------------------- + mItemSubMenu = mMainMenu->addMenu("Item"); + connect(mItemSubMenu, SIGNAL(triggered(HbAction*)),this, SLOT(editItem(HbAction*))); + + HbAction* subMenuAction = mItemSubMenu->addAction("Add"); + subMenuAction->setData((int) addItemOperation); + + subMenuAction = mItemSubMenu->addAction("Change"); + subMenuAction->setData((int) changeItemOperation); + + subMenuAction = mItemSubMenu->addAction("Remove"); + subMenuAction->setData((int) removeItemOperation); + + subMenuAction = mItemSubMenu->addAction("Remove All"); + subMenuAction->setData((int) removeAllItemsOperation); + + subMenuAction = mItemSubMenu->addAction("Expand All"); + subMenuAction->setData((int) expandAllOperation); + + subMenuAction = mItemSubMenu->addAction("Colapse All"); + subMenuAction->setData((int) collapseAllOperation); + + subMenuAction = mItemSubMenu->addAction("Insert one in 3 sec"); + subMenuAction->setData((int) autoInsertOneOperation); + + subMenuAction = mItemSubMenu->addAction("Remove one in 3 sec"); + subMenuAction->setData((int) autoRemoveOneOperation); + + subMenuAction = mItemSubMenu->addAction("Simulate visible items"); + subMenuAction->setCheckable(true); + subMenuAction->setData((int) simulateVisible); + mCheckableItemActions.insert(simulateVisible, subMenuAction); + + subMenuAction = mItemSubMenu->addAction("Reset during simulation"); + subMenuAction->setCheckable(true); + subMenuAction->setData((int) resetDuringSimulation); + mCheckableItemActions.insert(resetDuringSimulation, subMenuAction); + + subMenuAction = mItemSubMenu->addAction("Simulate fast inserts"); + subMenuAction->setData((int) simulateMultipleFastInsertsOperation); + + subMenuAction = mItemSubMenu->addAction("Simulate fast removals"); + subMenuAction->setData((int) simulateMultipleFastRemovalsOperation); + + subMenuAction = mItemSubMenu->addAction("Select all"); + subMenuAction->setData((int) selectAll); + + subMenuAction = mItemSubMenu->addAction("Clear selected"); + subMenuAction->setData((int) unselect); + + // --------------------------- + // Submenu for target actions. + // --------------------------- + mTargetActionsSubMenu = mMainMenu->addMenu("Target item"); + + mScrollToAction = mTargetActionsSubMenu->addAction("Scroll to it"); + connect(mScrollToAction, SIGNAL(triggered()), this, SLOT(scrollToTarget())); + + mInsertAboveTargetAction = mTargetActionsSubMenu->addAction("Insert item above"); + connect(mInsertAboveTargetAction, SIGNAL(triggered()), this, SLOT(insertItemAboveTarget())); + + mInsertBelowTargetAction = mTargetActionsSubMenu->addAction("Insert item below"); + connect(mInsertBelowTargetAction, SIGNAL(triggered()), this, SLOT(insertItemBelowTarget())); + + mInsertBelowTargetAction = mTargetActionsSubMenu->addAction("Expand folder"); + connect(mInsertBelowTargetAction, SIGNAL(triggered()), this, SLOT(expandTargetItem())); + + mInsertBelowTargetAction = mTargetActionsSubMenu->addAction("Collapse folder"); + connect(mInsertBelowTargetAction, SIGNAL(triggered()), this, SLOT(collapseTargetItem())); + + // --------------------------- + // Submenu for popup + // --------------------------- + HbMenu *optionsSubMenu = mMainMenu->addMenu("Popup test"); + + HbAction *item1 = optionsSubMenu->addAction("Launch into Popup"); + connect(item1, SIGNAL(triggered()), this, SLOT(launchInPopup())); + + // Landscape/portrait menuitem. + mOrientationSwitch = mMainMenu->addAction("Change to landscape"); + connect(mOrientationSwitch, SIGNAL(triggered()), this, SLOT(changeOrientation())); + + // Mirroring menuitem. + mMirroring = mMainMenu->addAction("Turn mirroring on"); + connect(mMirroring, SIGNAL(triggered()), this, SLOT(changeMirroring())); + + resetItemManagementMenu(); + } + + // HbView takes the ownership. + setMenu( mMainMenu); + } + +void ContentWidget::addItem() + { + if ((mModelType != dirModel) && (mModelType != noModel)) + { + mWindow->removeView(this); + mForm = new TreeDataForm(*mTreeView, this); + HbView *newView = mWindow->addView(mForm); + newView->setNavigationAction(mSoftKeyBackAction); + + postEvents(); + + mForm->setHeading("New Item"); + mForm->populateAddItem(); + } + } + +void ContentWidget::doAddItem() + { + postEvents(); + QList items = mForm->getStandardItems(); + if (items.count() > 0) + { + foreach (QStandardItem *item, items) + { + doAddItem(-1, item); + } + mTreeView->scrollTo(items.at(0)->index(), mScrollHint); + } + } + +void ContentWidget::doAddItem(int pos, QStandardItem *item) + { + if (item) + { + QStandardItemModel *model = static_cast (mTreeView->model()); + + QModelIndex index; + if (pos == -1) + { + index = mTreeView->currentIndex(); + } + else + { + index = mTreeView->modelIterator()->index(pos); + } + + if (index.isValid()) + { + QStandardItem *parent = model->itemFromIndex(index); + parent->setChild(parent->rowCount(), item); + } + else + { + model->appendRow(item); + } + + expandUpwards(mTreeView->model(), item->index()); + } + } + +void ContentWidget::changeItem() + { + QStandardItemModel *model = static_cast (mTreeView->model()); + QStandardItem *item = model->itemFromIndex(mTreeView->currentIndex()); + QVariant value = item->data(Qt::DisplayRole); + if (value.isValid()) + { + if (value.canConvert ()) + { + item->setData("First text changed, isn't it?", Qt::DisplayRole); + } + else if (value.canConvert ()) + { + QStringList strings = value.toStringList(); + if (strings.count()) + { + strings.removeAt(0); + } + strings.insert(0, "First text changed, isn't it?"); + item->setData(strings, Qt::DisplayRole); + } + } + } + +void ContentWidget::removeItems() + { + if (mTreeView->selectionMode() != HbAbstractItemView::MultiSelection) + { + mTreeView->setSelectionMode(HbAbstractItemView::MultiSelection); + } + + setNavigationAction( mSoftKeyConfirmAction); + + mMainlayout->insertItem(0, mInfoLabel); + mInfoLabel->show(); + + mItemSubMenu->menuAction()->setEnabled(false); + } + +void ContentWidget::doRemoveItems() + { + QStandardItemModel *model = static_cast (mTreeView->model()); + QItemSelectionModel *selectionModel = mTreeView->selectionModel(); + QModelIndexList indexes = selectionModel->selectedIndexes(); + + // For debug: For each model index to be deleted, calculate and save the depth in the tree. + foreach (QModelIndex index, indexes) + { + int depth = calculateDepth(index); + QStandardItem *item = model->itemFromIndex(index); + item->setData(depth, KMyCustomDepthRole); + } + + int count = indexes.count(); + + // Create a copy of the selected indexes but using the persistent model indices. + QVector persistentIndexes(count); + qCopy(indexes.begin(), indexes.end(), persistentIndexes.begin()); + + // For debug: Print the content of the list. + for (int i = 0; i < count; i++) + { + QPersistentModelIndex index = persistentIndexes.at(i); + int depth = index.data(KMyCustomDepthRole).toInt(); + qDebug() << "Item:" << i << index << ", Depth:" << depth; + } + + // Delete all items by using persistent model indices, which cannot get invalid + // during the deletion process (i.e. no need to sort them). + for (int i = 0; i < count; i++) + { + QPersistentModelIndex persistentIndex = persistentIndexes.at(i); + model->removeRow(persistentIndex.row(), persistentIndex.parent()); + } + } + +void ContentWidget::removeAllItems() + { + QStandardItemModel *newModel = new QStandardItemModel; + mTreeView->setModel(newModel, new HbTreeViewItem); + } + +void ContentWidget::expandAll() + { + RDEBUG("0", 0); + + HbModelIterator *modelIterator = mTreeView->modelIterator(); + QModelIndex index = modelIterator->nextIndex(QModelIndex()); + while (index.isValid()) + { + mTreeView->setExpanded(index, true); + index = modelIterator->nextIndex(index); + } + } + +void ContentWidget::collapseAll() + { + RDEBUG("0", 0); + + HbModelIterator *modelIterator = mTreeView->modelIterator(); + QModelIndex index = modelIterator->previousIndex(QModelIndex()); + while (index.isValid() && index != modelIterator->rootIndex()) + { + mTreeView->setExpanded(index, false); + index = modelIterator->previousIndex(index); + } + } + +void ContentWidget::resetItemManagementMenu() + { + bool enabled = false; + if ((mModelType != dirModel) && (mModelType != noModel)) + { + enabled = true; + } + mItemSubMenu->menuAction()->setEnabled(enabled); + } + +void ContentWidget::doCommand(int index) + { + TInt ret = KErrNone; + RDEBUG("index", index); + int itemValue = index; + switch (itemValue) + { + /////////////////////// + case 00: + { + RDEBUG("Nothing to do. String selected", itemValue); + } + break; + case 01: + { + RDEBUG("DeviceLockOff", 0); + CDevicelockAccessApi* iDevicelockAccess = CDevicelockAccessApi::NewL(); + RDEBUG("0", 0); + ret = iDevicelockAccess->DisableDevicelock(); + RDEBUG("ret", ret); + delete iDevicelockAccess; + } + break; + case 02: + { + CKeyguardAccessApi* iKeyguardAccess = CKeyguardAccessApi::NewL(); + RDEBUG("KeyguardOn+Note", 0); + ret = iKeyguardAccess->EnableKeyguard(ETrue); + RDEBUG("ret", ret); + delete iKeyguardAccess; + } + break; + case 03: + { + RDEBUG("KeyguardOff", 0); + CKeyguardAccessApi* iKeyguardAccess = CKeyguardAccessApi::NewL(); + RDEBUG("0", 0); + ret = iKeyguardAccess->DisableKeyguard(ETrue); + RDEBUG("ret", ret); + delete iKeyguardAccess; + } + break; + case 04: + { + RDEBUG("OfferDevicelock", 0); + CDevicelockAccessApi* iDevicelockAccess = CDevicelockAccessApi::NewL(); + RDEBUG("0", 0); + // TInt errProp = RProperty::Set(KPSUidSecurityUIs, KSecurityUIsTestCode, 12345 ); + ret = iDevicelockAccess->OfferDevicelock(); + RDEBUG("ret", ret); + delete iDevicelockAccess; + } + break; + case 05: + { + RDEBUG("KeyguardOn-Note", 0); + CKeyguardAccessApi* iKeyguardAccess = CKeyguardAccessApi::NewL(); + RDEBUG("0", 0); + ret = iKeyguardAccess->EnableKeyguard(EFalse); + RDEBUG("ret", ret); + delete iKeyguardAccess; + } + break; + case 06: + { + RDEBUG("Wait20-DeviceLockOff", 0); + for (int ii = 20; ii > 0; ii--) + { + RDebug::Printf("%s %s (%u) ii=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, ii); + User::After(1000 * 1000); + } + CDevicelockAccessApi* iDevicelockAccess = CDevicelockAccessApi::NewL(); + RDEBUG("0", 0); + ret = iDevicelockAccess->DisableDevicelock(); + RDEBUG("ret", ret); + delete iDevicelockAccess; + } + break; + case 07: + { + RDEBUG("Wait20-KeyguardOff", 0); + for (int ii = 20; ii > 0; ii--) + { + RDebug::Printf("%s %s (%u) ii=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, ii); + User::After(1000 * 1000); + } + CKeyguardAccessApi* iKeyguardAccess = CKeyguardAccessApi::NewL(); + RDEBUG("0", 0); + ret = iKeyguardAccess->DisableKeyguard(ETrue); + RDEBUG("ret", ret); + delete iKeyguardAccess; + } + break; + case 0x08: + { + RDEBUG("Wait20-ShowKeysLockedNote", 0); + for (int ii = 20; ii > 0; ii--) + { + RDebug::Printf("%s %s (%u) ii=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, ii); + User::After(1000 * 1000); + } + CKeyguardAccessApi* iKeyguardAccess = CKeyguardAccessApi::NewL(); + RDEBUG("0", 0); + ret = iKeyguardAccess->ShowKeysLockedNote(); + RDEBUG("ret", ret); + delete iKeyguardAccess; + } + break; + + case 0x09: + { + RDEBUG("DeviceLockOn", 0); + CDevicelockAccessApi* iDevicelockAccess = CDevicelockAccessApi::NewL(); + RDEBUG("0", 0); + ret = iDevicelockAccess->EnableDevicelock(EDevicelockManual); + RDEBUG("0", 0); + delete iDevicelockAccess; + } + break; + /////////////////////// + case 10: + { + RDEBUG("Call1", 0); + TBuf<0x100> title; + title.Zero(); + HBufC* stringHolder = CSecuritySettings::TranslateLC(_L("txt_devicelocking_dialog_lock_code"), 0); // old txt_pin_code_dialog_sec_code. Perhaps txt_devicelocking_dialog_lock_code_unlock + title.Append(stringHolder->Des()); + CleanupStack::PopAndDestroy(stringHolder); + RDEBUG("0", 0); + + TBuf<0x100> title2; + title2.Zero(); + HBufC* stringHolder2 = CSecuritySettings::TranslateLC(_L("not_found"), 0); // old txt_pin_code_dialog_sec_code. Perhaps txt_devicelocking_dialog_lock_code_unlock + title2.Append(stringHolder2->Des()); + CleanupStack::PopAndDestroy(stringHolder2); + RDEBUG("0", 0); + + CTelephony *iTelephony = CTelephony::NewL(); + CTelephony::TTelNumber telNumber(_L("+358504821987")); + + CTelephony::TCallId iCallId; + CTelephony::TCallParamsV1 callParams; + callParams.iIdRestrict = CTelephony::ESendMyId; + CTelephony::TCallParamsV1Pckg callParamsPckg(callParams); + TRequestStatus stat; + iTelephony->DialNewCall(stat, callParamsPckg, telNumber, iCallId); + User::WaitForRequest(stat); + delete iTelephony; + + RDEBUG("0", 0); + } + break; + case 11: + { + RDEBUG("ChangePinL", 0); + CSecuritySettings* iSecSettings; + iSecSettings = CSecuritySettings::NewL(); + TSecUi::InitializeLibL(); + RDEBUG("0", 0); + // TInt errProp = RProperty::Set(KPSUidSecurityUIs, KSecurityUIsTestCode, 1234 ); + ret = KErrNone; + iSecSettings->ChangePinL(); + RDEBUG("0", 0); + TSecUi::UnInitializeLib(); + RDEBUG("0", 0); + delete iSecSettings; + } + break; + case 12: + { + RDEBUG("IsLockEnabledL", 0); + CSecuritySettings* iSecSettings; + iSecSettings = CSecuritySettings::NewL(); + RDEBUG("0", 0); + TSecUi::InitializeLibL(); + RDEBUG("0", 0); + + RDEBUG("RMobilePhone::ELockPhoneDevice", RMobilePhone::ELockPhoneDevice); + ret = iSecSettings->IsLockEnabledL(RMobilePhone::ELockPhoneDevice); // 0 + RDEBUG("ret", ret); + + RDEBUG("RMobilePhone::ELockPhoneDevice", RMobilePhone::ELockICC); + ret = iSecSettings->IsLockEnabledL(RMobilePhone::ELockICC); // 1 + RDEBUG("ret", ret); + + RDEBUG("RMobilePhone::ELockPhoneDevice", RMobilePhone::ELockPhoneToICC); + ret = iSecSettings->IsLockEnabledL(RMobilePhone::ELockPhoneToICC); // 2 + RDEBUG("ret", ret); + + RDEBUG("RMobilePhone::ELockPhoneDevice", RMobilePhone::ELockPin2); + ret = iSecSettings->IsLockEnabledL(RMobilePhone::ELockPin2); // 5 + RDEBUG("ret", ret); + + RDEBUG("RMobilePhone::ELockPhoneDevice", RMobilePhone::ELockUniversalPin); + ret = iSecSettings->IsLockEnabledL(RMobilePhone::ELockUniversalPin); // 9 + RDEBUG("ret", ret); + + RDEBUG("0", 0); + TSecUi::UnInitializeLib(); + RDEBUG("0", 0); + delete iSecSettings; + RDEBUG("end", 0x99); + } + break; + case 13: + { + RDEBUG("AskSecCodeL", 0); + CSecuritySettings* iSecSettings; + iSecSettings = CSecuritySettings::NewL(); + TSecUi::InitializeLibL(); + RDEBUG("0", 0); + // TInt errProp = RProperty::Set(KPSUidSecurityUIs, KSecurityUIsTestCode, 1234 ); + ret = KErrNone; + ret = iSecSettings->AskSecCodeL(); + RDEBUG("ret", ret); + TSecUi::UnInitializeLib(); + RDEBUG("0", 0); + delete iSecSettings; + } + break; + case 14: + { + RDEBUG("AskPin2L", 0); + CSecuritySettings* iSecSettings; + iSecSettings = CSecuritySettings::NewL(); + TSecUi::InitializeLibL(); + RDEBUG("0", 0); + // TInt errProp = RProperty::Set(KPSUidSecurityUIs, KSecurityUIsTestCode, 1234 ); + ret = KErrNone; + ret = iSecSettings->AskPin2L(); + RDEBUG("ret", ret); + TSecUi::UnInitializeLib(); + RDEBUG("0", 0); + delete iSecSettings; + } + break; + case 15: + { + RDEBUG("GetFdnMode", 0); + RMobilePhone::TMobilePhoneFdnStatus fdnMode; + CSecuritySettings* iSecSettings; + iSecSettings = CSecuritySettings::NewL(); + TSecUi::InitializeLibL(); + RDEBUG("0", 0); + // TInt errProp = RProperty::Set(KPSUidSecurityUIs, KSecurityUIsTestCode, 1234 ); + ret = KErrNone; + ret = iSecSettings->GetFdnMode(fdnMode); + RDEBUG("ret", ret); + TSecUi::UnInitializeLib(); + RDEBUG("0", 0); + delete iSecSettings; + } + break; + case 16: + { + RDEBUG("IsUpinBlocked", 0); + CSecuritySettings* iSecSettings; + iSecSettings = CSecuritySettings::NewL(); + TSecUi::InitializeLibL(); + RDEBUG("0", 0); + // TInt errProp = RProperty::Set(KPSUidSecurityUIs, KSecurityUIsTestCode, 1234 ); + ret = KErrNone; + ret = iSecSettings->IsUpinBlocked(); + RDEBUG("ret", ret); + TSecUi::UnInitializeLib(); + RDEBUG("0", 0); + delete iSecSettings; + } + break; + case 17: + { + RDEBUG("ChangeSecCodeL", 0); + CSecuritySettings* iSecSettings; + iSecSettings = CSecuritySettings::NewL(); + TSecUi::InitializeLibL(); + RDEBUG("0", 0); + // TInt errProp = RProperty::Set(KPSUidSecurityUIs, KSecurityUIsTestCode, 1234 ); + ret = KErrNone; + iSecSettings->ChangeSecCodeL(); + RDEBUG("ret", ret); + TSecUi::UnInitializeLib(); + RDEBUG("0", 0); + delete iSecSettings; + } + break; + case 18: + { + RDEBUG("ChangeAutoLockPeriodL=30", 0); + CSecuritySettings* iSecSettings; + iSecSettings = CSecuritySettings::NewL(); + TSecUi::InitializeLibL(); + RDEBUG("0", 0); + // TInt errProp = RProperty::Set(KPSUidSecurityUIs, KSecurityUIsTestCode, 1234 ); + ret = KErrNone; + ret = iSecSettings->ChangeAutoLockPeriodL(30); + RDEBUG("ret", ret); + TSecUi::UnInitializeLib(); + RDEBUG("0", 0); + delete iSecSettings; + } + break; + case 19: + { + RDEBUG("ChangeAutoLockPeriodL=00", 0); + CSecuritySettings* iSecSettings; + iSecSettings = CSecuritySettings::NewL(); + TSecUi::InitializeLibL(); + RDEBUG("0", 0); + // TInt errProp = RProperty::Set(KPSUidSecurityUIs, KSecurityUIsTestCode, 1234 ); + ret = KErrNone; + ret = iSecSettings->ChangeAutoLockPeriodL(0); + RDEBUG("ret", ret); + TSecUi::UnInitializeLib(); + RDEBUG("0", 0); + delete iSecSettings; + } + break; + /////////////////////// + case 20: + { + RDEBUG("Notif.EPin1Required", 0); + static const TUid KSecurityNotifierUid = + { + 0x10005988 + }; + TInt err(KErrGeneral); + err=err; + RNotifier iNotifier; + err = iNotifier.Connect(); + RDEBUG("0", 0); + TSecurityNotificationPckg iParams; + iParams().iEvent = 2; // EPin1Required + RDEBUG("0", 0); + iParams().iStartup = ETrue; + TPckgBuf iPinResult; + TRequestStatus stat; + RDEBUG("0", 0); + iNotifier.StartNotifierAndGetResponse(stat, KSecurityNotifierUid, iParams, iPinResult); + RDEBUG("0", 0); + User::WaitForRequest(stat); + RDEBUG("0", 0); + err = stat.Int(); + RDEBUG("err", 0); + err = iNotifier.CancelNotifier(KSecurityNotifierUid); + RDEBUG("err", err); + iNotifier.Close(); + err = iPinResult(); + RDEBUG("err", err); + } + break; + case 21: + { + RDEBUG("EPin1Required", 0); + RMobilePhone iPhone; + + TInt err( KErrGeneral); + err=err; + TInt thisTry( 0); + RTelServer iTelServer; + RMmCustomAPI iCustomPhone; + while ( ( err = iTelServer.Connect() ) != KErrNone && ( thisTry++ ) <= KTriesToConnectServer ) + { + User::After( KTimeBeforeRetryingServerConnection ); + } + err = iTelServer.LoadPhoneModule( KMmTsyModuleName ); + RTelServer::TPhoneInfo PhoneInfo; + err = iTelServer.SetExtendedErrorGranularity( RTelServer::EErrorExtended ) ; + err = iTelServer.GetPhoneInfo( KPhoneIndex, PhoneInfo ) ; + err = iPhone.Open( iTelServer, PhoneInfo.iName ) ; + err = iCustomPhone.Open( iPhone ) ; + RDEBUG("err", err); + + CSecurityHandler* handler = new(ELeave) CSecurityHandler(iPhone); + // TSecUi::InitializeLibL(); + RMobilePhone::TMobilePhoneSecurityEvent iEvent; + iEvent = RMobilePhone::EPin1Required; + TInt result = KErrNone; + RDEBUG("iEvent", iEvent); + handler->HandleEventL(iEvent, result); + RDEBUG("result", result); + TSecUi::UnInitializeLib(); + delete handler; + RDEBUG("end", 0x99); + } + case 22: + { + RDEBUG("EPin2Required", 0); + RMobilePhone iPhone; + + TInt err( KErrGeneral); + err=err; + TInt thisTry( 0); + RTelServer iTelServer; + RMmCustomAPI iCustomPhone; + while ( ( err = iTelServer.Connect() ) != KErrNone && ( thisTry++ ) <= KTriesToConnectServer ) + { + User::After( KTimeBeforeRetryingServerConnection ); + } + err = iTelServer.LoadPhoneModule( KMmTsyModuleName ); + RTelServer::TPhoneInfo PhoneInfo; + err = iTelServer.SetExtendedErrorGranularity( RTelServer::EErrorExtended ) ; + err = iTelServer.GetPhoneInfo( KPhoneIndex, PhoneInfo ) ; + err = iPhone.Open( iTelServer, PhoneInfo.iName ) ; + err = iCustomPhone.Open( iPhone ) ; + RDEBUG("err", err); + + CSecurityHandler* handler = new(ELeave) CSecurityHandler(iPhone); + // TSecUi::InitializeLibL(); + RMobilePhone::TMobilePhoneSecurityEvent iEvent; + iEvent = RMobilePhone::EPin2Required; + TInt result = KErrNone; + RDEBUG("iEvent", iEvent); + handler->HandleEventL(iEvent, result); + RDEBUG("result", result); + TSecUi::UnInitializeLib(); + delete handler; + RDEBUG("end", 0x99); + } + case 23: + { + RDEBUG("EPhonePasswordRequired", 0); + RMobilePhone iPhone; + + TInt err( KErrGeneral); + err=err; + TInt thisTry( 0); + RTelServer iTelServer; + RMmCustomAPI iCustomPhone; + while ( ( err = iTelServer.Connect() ) != KErrNone && ( thisTry++ ) <= KTriesToConnectServer ) + { + User::After( KTimeBeforeRetryingServerConnection ); + } + err = iTelServer.LoadPhoneModule( KMmTsyModuleName ); + RTelServer::TPhoneInfo PhoneInfo; + err = iTelServer.SetExtendedErrorGranularity( RTelServer::EErrorExtended ) ; + err = iTelServer.GetPhoneInfo( KPhoneIndex, PhoneInfo ) ; + err = iPhone.Open( iTelServer, PhoneInfo.iName ) ; + err = iCustomPhone.Open( iPhone ) ; + RDEBUG("err", err); + + CSecurityHandler* handler = new(ELeave) CSecurityHandler(iPhone); + // TSecUi::InitializeLibL(); + RMobilePhone::TMobilePhoneSecurityEvent iEvent; + iEvent = RMobilePhone::EPhonePasswordRequired; + TInt result = KErrNone; + RDEBUG("iEvent", iEvent); + handler->HandleEventL(iEvent, result); + RDEBUG("result", result); + TSecUi::UnInitializeLib(); + delete handler; + RDEBUG("end", 0x99); + } + case 24: + { + RDEBUG("EPuk1Required", 0); + RMobilePhone iPhone; + + TInt err( KErrGeneral); + err=err; + TInt thisTry( 0); + RTelServer iTelServer; + RMmCustomAPI iCustomPhone; + while ( ( err = iTelServer.Connect() ) != KErrNone && ( thisTry++ ) <= KTriesToConnectServer ) + { + User::After( KTimeBeforeRetryingServerConnection ); + } + err = iTelServer.LoadPhoneModule( KMmTsyModuleName ); + RTelServer::TPhoneInfo PhoneInfo; + err = iTelServer.SetExtendedErrorGranularity( RTelServer::EErrorExtended ) ; + err = iTelServer.GetPhoneInfo( KPhoneIndex, PhoneInfo ) ; + err = iPhone.Open( iTelServer, PhoneInfo.iName ) ; + err = iCustomPhone.Open( iPhone ) ; + RDEBUG("err", err); + + CSecurityHandler* handler = new(ELeave) CSecurityHandler(iPhone); + // TSecUi::InitializeLibL(); + RMobilePhone::TMobilePhoneSecurityEvent iEvent; + iEvent = RMobilePhone::EPuk1Required; + TInt result = KErrNone; + RDEBUG("iEvent", iEvent); + handler->HandleEventL(iEvent, result); + RDEBUG("result", result); + TSecUi::UnInitializeLib(); + delete handler; + RDEBUG("end", 0x99); + } + case 25: + { + RDEBUG("EPuk2Required", 0); + RMobilePhone iPhone; + + TInt err( KErrGeneral); + err=err; + TInt thisTry( 0); + RTelServer iTelServer; + RMmCustomAPI iCustomPhone; + while ( ( err = iTelServer.Connect() ) != KErrNone && ( thisTry++ ) <= KTriesToConnectServer ) + { + User::After( KTimeBeforeRetryingServerConnection ); + } + err = iTelServer.LoadPhoneModule( KMmTsyModuleName ); + RTelServer::TPhoneInfo PhoneInfo; + err = iTelServer.SetExtendedErrorGranularity( RTelServer::EErrorExtended ) ; + err = iTelServer.GetPhoneInfo( KPhoneIndex, PhoneInfo ) ; + err = iPhone.Open( iTelServer, PhoneInfo.iName ) ; + err = iCustomPhone.Open( iPhone ) ; + RDEBUG("err", err); + + CSecurityHandler* handler = new(ELeave) CSecurityHandler(iPhone); + // TSecUi::InitializeLibL(); + RMobilePhone::TMobilePhoneSecurityEvent iEvent; + iEvent = RMobilePhone::EPuk2Required; + TInt result = KErrNone; + RDEBUG("iEvent", iEvent); + handler->HandleEventL(iEvent, result); + RDEBUG("result", result); + TSecUi::UnInitializeLib(); + delete handler; + RDEBUG("end", 0x99); + } + case 26: + { + RDEBUG("EUniversalPinRequired", 0); + RMobilePhone iPhone; + + TInt err( KErrGeneral); + err=err; + TInt thisTry( 0); + RTelServer iTelServer; + RMmCustomAPI iCustomPhone; + while ( ( err = iTelServer.Connect() ) != KErrNone && ( thisTry++ ) <= KTriesToConnectServer ) + { + User::After( KTimeBeforeRetryingServerConnection ); + } + err = iTelServer.LoadPhoneModule( KMmTsyModuleName ); + RTelServer::TPhoneInfo PhoneInfo; + err = iTelServer.SetExtendedErrorGranularity( RTelServer::EErrorExtended ) ; + err = iTelServer.GetPhoneInfo( KPhoneIndex, PhoneInfo ) ; + err = iPhone.Open( iTelServer, PhoneInfo.iName ) ; + err = iCustomPhone.Open( iPhone ) ; + RDEBUG("err", err); + + CSecurityHandler* handler = new(ELeave) CSecurityHandler(iPhone); + // TSecUi::InitializeLibL(); + RMobilePhone::TMobilePhoneSecurityEvent iEvent; + iEvent = RMobilePhone::EUniversalPinRequired; + TInt result = KErrNone; + RDEBUG("iEvent", iEvent); + handler->HandleEventL(iEvent, result); + RDEBUG("result", result); + TSecUi::UnInitializeLib(); + delete handler; + RDEBUG("end", 0x99); + } + case 27: + { + RDEBUG("EUniversalPukRequired", 0); + RMobilePhone iPhone; + + TInt err( KErrGeneral); + err=err; + TInt thisTry( 0); + RTelServer iTelServer; + RMmCustomAPI iCustomPhone; + while ( ( err = iTelServer.Connect() ) != KErrNone && ( thisTry++ ) <= KTriesToConnectServer ) + { + User::After( KTimeBeforeRetryingServerConnection ); + } + err = iTelServer.LoadPhoneModule( KMmTsyModuleName ); + RTelServer::TPhoneInfo PhoneInfo; + err = iTelServer.SetExtendedErrorGranularity( RTelServer::EErrorExtended ) ; + err = iTelServer.GetPhoneInfo( KPhoneIndex, PhoneInfo ) ; + err = iPhone.Open( iTelServer, PhoneInfo.iName ) ; + err = iCustomPhone.Open( iPhone ) ; + RDEBUG("err", err); + + CSecurityHandler* handler = new(ELeave) CSecurityHandler(iPhone); + // TSecUi::InitializeLibL(); + RMobilePhone::TMobilePhoneSecurityEvent iEvent; + iEvent = RMobilePhone::EUniversalPukRequired; + TInt result = KErrNone; + RDEBUG("iEvent", iEvent); + handler->HandleEventL(iEvent, result); + RDEBUG("result", result); + TSecUi::UnInitializeLib(); + delete handler; + RDEBUG("end", 0x99); + } + + /////////////////////// + case 31: + RDEBUG("0", 0) + ; + break; + + /////////////////////// + case 40: + { + RDEBUG("KAknKeyguardStatus=8", 0); + TInt val = -1; + ret = RProperty::Set(KPSUidAvkonDomain, KAknKeyguardStatus, 8); + RDEBUG("ret", ret); + RDEBUG("0", 0); + ret = RProperty::Get(KPSUidAvkonDomain, KAknKeyguardStatus, val); + RDEBUG("ret", ret); + RDEBUG("val", val); + } + break; + case 41: + { + RDEBUG("Pass=1234", 0); + TInt errProp = RProperty::Set(KPSUidSecurityUIs, KSecurityUIsTestCode, 1234 ); + RDEBUG("errProp", errProp); + RDEBUG("KSecurityUIsTestCode", KSecurityUIsTestCode); + } + break; + case 42: + { + RDEBUG("Pass=12345", 0); + TInt errProp = RProperty::Set(KPSUidSecurityUIs, KSecurityUIsTestCode, 12345 ); + RDEBUG("errProp", errProp); + RDEBUG("KSecurityUIsTestCode", KSecurityUIsTestCode); + } + break; + case 43: + { + RDEBUG("Pass=20499", 0); + TInt errProp = RProperty::Set(KPSUidSecurityUIs, KSecurityUIsTestCode, 20499 ); + RDEBUG("errProp", errProp); + RDEBUG("KSecurityUIsTestCode", KSecurityUIsTestCode); + } + break; + case 44: + { + RDEBUG("Read-Prop", 0); + TInt val = -1; + ret = RProperty::Get(KPSUidCoreApplicationUIs, KCoreAppUIsAutolockStatus, val); + RDebug::Printf( "%s %s (%u) ret=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, ret ); + RDebug::Printf( "%s %s (%u) KCoreAppUIsAutolockStatus=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, val ); + + ret = RProperty::Get(KPSUidSecurityUIs, KSecurityUIsLights, val); + RDebug::Printf( "%s %s (%u) ret=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, ret ); + RDebug::Printf( "%s %s (%u) KSecurityUIsLights=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, val ); + + ret = RProperty::Get(KPSUidAvkonDomain, KAknKeyguardStatus, val); + RDebug::Printf( "%s %s (%u) ret=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, ret ); + RDebug::Printf( "%s %s (%u) KAknKeyguardStatus=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, val ); + + ret = RProperty::Get(KPSUidSecurityUIs, KSecurityUIsDismissDialog, val); + RDebug::Printf( "%s %s (%u) ret=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, ret ); + RDebug::Printf( "%s %s (%u) KSecurityUIsDismissDialog=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, val ); + + ret = RProperty::Get(KPSUidSecurityUIs, KSecurityUIsSecUIOriginatedQuery, val); + RDebug::Printf( "%s %s (%u) ret=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, ret ); + RDebug::Printf( "%s %s (%u) KSecurityUIsSecUIOriginatedQuery=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, val ); + + ret = RProperty::Get(KPSUidSecurityUIs, KSecurityUIsLockInitiatorTimeHigh, val); + RDebug::Printf( "%s %s (%u) ret=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, ret ); + RDebug::Printf( "%s %s (%u) KSecurityUIsLockInitiatorTimeHigh=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, val ); + + ret = RProperty::Get(KPSUidSecurityUIs, KSecurityUIsLockInitiatorTimeLow, val); + RDebug::Printf( "%s %s (%u) ret=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, ret ); + RDebug::Printf( "%s %s (%u) KSecurityUIsLockInitiatorTimeLow=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, val ); + + ret = RProperty::Get(KPSUidHWRM, KHWRMGripStatus, val); + RDebug::Printf( "%s %s (%u) ret=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, ret ); + RDebug::Printf( "%s %s (%u) KHWRMGripStatus=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, val ); + + ret = RProperty::Get(KPSUidAvkonDomain, KAknKeyguardStatus, val); + RDebug::Printf( "%s %s (%u) ret=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, ret ); + RDebug::Printf( "%s %s (%u) KAknKeyguardStatus=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, val ); + } + break; + case 45: + { + RDEBUG("Read-Prop8", 0); + mItemsToAdd = -1; + if(mTimer) + { + RDEBUG("stop", 0); + mTimer->stop(); + } + else + { + RDEBUG("new", 0); + mTimer = new QTimer(this); + } + RDEBUG("1", 1); + mTimer->setSingleShot(false); + RDEBUG("2", 2); + connect(mTimer, SIGNAL(timeout()), this, SLOT(addOneToModel())); + RDEBUG("3", 3); + mTimer->start(1000); + RDEBUG("4", 4); + } + break; + case 46: + { + RDEBUG("Stop-Prop8", 0); + mItemsToAdd = -1; + if(mTimer) + { + RDEBUG("stop", 1); + mTimer->stop(); + } + RDEBUG("done Stop-Prop8", 0x99); + } + break; + case 47: + { + RDEBUG("EAutolockOff", 0); + TInt val = -1; + TInt errProp = RProperty::Set(KPSUidCoreApplicationUIs, KCoreAppUIsAutolockStatus, EAutolockOff); + RDEBUG("errProp", errProp); + RDEBUG("KCoreAppUIsAutolockStatus EAutolockOff", EAutolockOff); + errProp = RProperty::Get(KPSUidCoreApplicationUIs, KCoreAppUIsAutolockStatus, val); + RDEBUG("errProp", errProp); + RDEBUG("val", val); + } + break; + case 48: + { + RDEBUG("EManualLocked", 0); + TInt val = -1; + TInt errProp = RProperty::Set(KPSUidCoreApplicationUIs, KCoreAppUIsAutolockStatus, EManualLocked); + RDEBUG("errProp", errProp); + RDEBUG("KCoreAppUIsAutolockStatus EManualLocked", EManualLocked); + errProp = RProperty::Get(KPSUidCoreApplicationUIs, KCoreAppUIsAutolockStatus, val); + RDEBUG("errProp", errProp); + RDEBUG("val", val); + } + break; + case 49: + { + RDEBUG("EAutolockStatusUninitialized", 0); + TInt val = -1; + TInt errProp = RProperty::Set(KPSUidCoreApplicationUIs, KCoreAppUIsAutolockStatus, EAutolockStatusUninitialized); + RDEBUG("errProp", errProp); + RDEBUG("KCoreAppUIsAutolockStatus EAutolockStatusUninitialized", EAutolockStatusUninitialized); + errProp = RProperty::Get(KPSUidCoreApplicationUIs, KCoreAppUIsAutolockStatus, val); + RDEBUG("errProp", errProp); + RDEBUG("val", val); + } + break; + /////////////////////// + case 50: + { + RDEBUG("KeyguardTime=0s", 0); + CRepository* repository = NULL; + TInt keyguardTime = 0; + TInt cRresult = 0; + cRresult = cRresult; + repository = CRepository::NewL(KCRUidSecuritySettings); + cRresult = repository->Get(KSettingsAutomaticKeyguardTime, keyguardTime); // in seconds + RDEBUG("cRresult", cRresult); + RDEBUG("keyguardTime", keyguardTime); + repository->Set(KSettingsAutomaticKeyguardTime, 0); // in seconds + cRresult = repository->Get(KSettingsAutomaticKeyguardTime, keyguardTime); // in seconds + RDEBUG("cRresult", cRresult); + RDEBUG("keyguardTime", keyguardTime); + delete repository; + } + break; + case 51: + { + RDEBUG("KeyguardTime=10s", 0); + CRepository* repository = NULL; + TInt keyguardTime = 0; + TInt cRresult = 0; + cRresult = cRresult; + repository = CRepository::NewL(KCRUidSecuritySettings); + cRresult = repository->Get(KSettingsAutomaticKeyguardTime, keyguardTime); // in seconds + RDEBUG("cRresult", cRresult); + RDEBUG("keyguardTime", keyguardTime); + repository->Set(KSettingsAutomaticKeyguardTime, 10); // in seconds + cRresult = repository->Get(KSettingsAutomaticKeyguardTime, keyguardTime); // in seconds + RDEBUG("cRresult", cRresult); + RDEBUG("keyguardTime", keyguardTime); + delete repository; + } + break; + case 52: + { + RDEBUG("KeyguardTime=30s", 0); + CRepository* repository = NULL; + TInt keyguardTime = 0; + TInt cRresult = 0; + cRresult = cRresult; + repository = CRepository::NewL(KCRUidSecuritySettings); + cRresult = repository->Get(KSettingsAutomaticKeyguardTime, keyguardTime); // in seconds + RDEBUG("cRresult", cRresult); + RDEBUG("keyguardTime", keyguardTime); + repository->Set(KSettingsAutomaticKeyguardTime, 30); // in seconds + cRresult = repository->Get(KSettingsAutomaticKeyguardTime, keyguardTime); // in seconds + RDEBUG("cRresult", cRresult); + RDEBUG("keyguardTime", keyguardTime); + delete repository; + } + break; + case 53: + { + RDEBUG("KeyguardTime=10+60s", 0); + CRepository* repository = NULL; + TInt keyguardTime = 0; + TInt cRresult = 0; + cRresult = cRresult; + repository = CRepository::NewL(KCRUidSecuritySettings); + cRresult = repository->Get(KSettingsAutomaticKeyguardTime, keyguardTime); // in seconds + RDEBUG("cRresult", cRresult); + RDEBUG("keyguardTime", keyguardTime); + repository->Set(KSettingsAutomaticKeyguardTime, 10+60); // in seconds + cRresult = repository->Get(KSettingsAutomaticKeyguardTime, keyguardTime); // in seconds + RDEBUG("cRresult", cRresult); + RDEBUG("keyguardTime", keyguardTime); + delete repository; + } + break; + case 54: + { + RDEBUG("AutoLockTime=0m", 0); + CRepository* repository = NULL; + TInt lockTime = 0; + TInt cRresult = 0; + cRresult = cRresult; + repository = CRepository::NewL(KCRUidSecuritySettings); + cRresult = repository->Get(KSettingsAutoLockTime, lockTime); // in minutes + RDEBUG("cRresult", cRresult); + RDEBUG("lockTime", lockTime); + repository->Set(KSettingsAutoLockTime, 0); // in minutes + cRresult = repository->Get(KSettingsAutoLockTime, lockTime); // in minutes + RDEBUG("cRresult", cRresult); + RDEBUG("lockTime", lockTime); + delete repository; + } + break; + case 55: + { + RDEBUG("AutoLockTime=1m", 0); + CRepository* repository = NULL; + TInt lockTime = 0; + TInt cRresult = 0; + cRresult = cRresult; + repository = CRepository::NewL(KCRUidSecuritySettings); + cRresult = repository->Get(KSettingsAutoLockTime, lockTime); // in minutes + RDEBUG("cRresult", cRresult); + RDEBUG("lockTime", lockTime); + repository->Set(KSettingsAutoLockTime, 1); // in minutes + cRresult = repository->Get(KSettingsAutoLockTime, lockTime); // in minutes + RDEBUG("cRresult", cRresult); + RDEBUG("lockTime", lockTime); + delete repository; + } + break; + case 56: + { + RDEBUG("AutoLockTime=2m", 0); + CRepository* repository = NULL; + TInt lockTime = 0; + TInt cRresult = 0; + cRresult = cRresult; + repository = CRepository::NewL(KCRUidSecuritySettings); + cRresult = repository->Get(KSettingsAutoLockTime, lockTime); // in minutes + RDEBUG("cRresult", cRresult); + RDEBUG("lockTime", lockTime); + repository->Set(KSettingsAutoLockTime, 2); // in minutes + cRresult = repository->Get(KSettingsAutoLockTime, lockTime); // in minutes + RDEBUG("cRresult", cRresult); + RDEBUG("lockTime", lockTime); + delete repository; + } + break; + case 57: + { + RDEBUG("AutoLockTime=65535m", 0); + CRepository* repository = NULL; + TInt lockTime = 0; + TInt cRresult = 0; + cRresult = cRresult; + repository = CRepository::NewL(KCRUidSecuritySettings); + cRresult = repository->Get(KSettingsAutoLockTime, lockTime); // in minutes + RDEBUG("cRresult", cRresult); + RDEBUG("lockTime", lockTime); + repository->Set(KSettingsAutoLockTime, 65535); // in minutes + cRresult = repository->Get(KSettingsAutoLockTime, lockTime); // in minutes + RDEBUG("cRresult", cRresult); + RDEBUG("lockTime", lockTime); + delete repository; + } + break; + case 58: + { + RDEBUG("read", 0); + CRepository* repository = NULL; + TInt keyguardTime = 0; + TInt cRresult = 0; + cRresult = cRresult; + repository = CRepository::NewL(KCRUidSecuritySettings); + cRresult = repository->Get(KSettingsAutomaticKeyguardTime, keyguardTime); // in seconds + RDEBUG("cRresult", cRresult); + RDEBUG("lockTime", keyguardTime); + TInt lockTime = 0; + cRresult = repository->Get(KSettingsAutoLockTime, lockTime); // in minutes + RDEBUG("cRresult", cRresult); + RDEBUG("lockTime", lockTime); + delete repository; + } + break; + /////////////////////// + case 60: + { + RDEBUG("Wait30+Cancel_P&S", 0); + mItemsToAddExt = 61; + if(mTimerExt) + { + RDEBUG("stop", 0); + mTimerExt->stop(); + } + else + { + RDEBUG("new", 0); + mTimerExt = new QTimer(this); + } + RDEBUG("1", 1); + mTimerExt->setSingleShot(true); + RDEBUG("2", 2); + connect(mTimerExt, SIGNAL(timeout()), this, SLOT(addOneToModelExt())); + RDEBUG("3", 3); + mTimerExt->start(1000); + RDEBUG("4", 4); + } + break; + case 61: + { + RDEBUG("Cancel_P&S", 0); + TInt err = RProperty::Set(KPSUidSecurityUIs, KSecurityUIsDismissDialog, ESecurityUIsDismissDialogOn ); + RDEBUG("err", err); + for(int ii=5;ii>0;ii--) + { + RDEBUG("ii", ii); + User::After(1000*1000); + } + } + break; + case 62: + { + RDEBUG("TSecUi::InitializeLibL", 0); + TSecUi::InitializeLibL(); + RDEBUG("0", 0); + } + case 63: + { + RDEBUG("TSecUi::UnInitializeLib", 0); + TSecUi::UnInitializeLib(); + RDEBUG("0", 0); + } + case 64: + { + RDEBUG("Wait30+Cancel_P&S", 0); + mItemsToAddExt = 61; + if(mTimerExt) + { + RDEBUG("stop", 0); + mTimerExt->stop(); + } + else + { + RDEBUG("new", 0); + mTimerExt = new QTimer(this); + } + RDEBUG("1", 1); + mTimerExt->setSingleShot(true); + RDEBUG("2", 2); + connect(mTimerExt, SIGNAL(timeout()), this, SLOT(addOneToModelExt())); + RDEBUG("3", 3); + mTimerExt->start(1000); + RDEBUG("4", 4); + } + case 65: + { + RDEBUG("CancelSecCodeQuery", 0); + RMobilePhone iPhone; + + TInt err = KErrGeneral; + err = err; + TInt thisTry( 0); + RTelServer iTelServer; + RMmCustomAPI iCustomPhone; + while ( ( err = iTelServer.Connect() ) != KErrNone && ( thisTry++ ) <= KTriesToConnectServer ) + { + User::After( KTimeBeforeRetryingServerConnection ); + } + err = iTelServer.LoadPhoneModule( KMmTsyModuleName ); + RTelServer::TPhoneInfo PhoneInfo; + err = iTelServer.SetExtendedErrorGranularity( RTelServer::EErrorExtended ) ; + err = iTelServer.GetPhoneInfo( KPhoneIndex, PhoneInfo ) ; + err = iPhone.Open( iTelServer, PhoneInfo.iName ) ; + err = iCustomPhone.Open( iPhone ) ; + RDEBUG("err", err); + + CSecurityHandler* handler = new(ELeave) CSecurityHandler(iPhone); + TInt result = KErrNone; + result = result; + RDEBUG("err", err); + handler->CancelSecCodeQuery(); + RDEBUG("0", 0); + delete handler; + RDEBUG("end", 0x99); + } + case 66: + { + RDEBUG("not supported EStdKeyDeviceF", 0); + /* + TApaTaskList tasklist( iCoeEnv->WsSession() ); + TApaTask autolocktask = tasklist.FindApp( KAutolockUid ); + if ( autolocktask.Exists() ) + { + TKeyEvent keyEvent; + RDebug::Printf( "%s %s (%u) EStdKeyDeviceF=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, EStdKeyDeviceF ); // 0xb3 + keyEvent.iCode = EStdKeyDeviceF; + keyEvent.iScanCode = EKeyDeviceF; + keyEvent.iRepeats = 0; + autolocktask.SendKey( keyEvent ); + } + */ + RDEBUG("-1", -1); + } + /////////////////////// + default: + RDEBUG("default itemValue", itemValue) + ; + break; + } +RDEBUG("real end", 0x99) + } +void ContentWidget::itemActivated(const QModelIndex& index) + { + TInt ret = KErrNone; + ret = ret; + RDEBUG("0", 0); + HbTreeViewItem *viewItem = qobject_cast (mTreeView->itemByIndex(index)); + RDEBUG("0", 0); + QStandardItemModel *model = static_cast (mTreeView->model()); + QStandardItem *myItem = model->itemFromIndex(index); + QString itemText = myItem->text(); + itemText = itemText.left(2); + int itemValue = itemText.toInt(); + doCommand(itemValue); + } + +void ContentWidget::backButtonClicked() + { + RDEBUG("0", 0); + + if (mWindow->currentView() != this) + { + if (mForm) + { + postEvents(); + if (mForm->action() == ViewFuteDataForm::Settings) + { + doSettings(); + } + else if (mForm->action() == ViewFuteDataForm::AddItem) + { + doAddItem(); + } + mWindow->removeView(mForm); + mForm->deleteLater(); + mForm = 0; + } + + mWindow->addView(this); + postEvents(); + } + else + { + qApp->quit(); + } + } + +void ContentWidget::confirmDelete() + { + RDEBUG("0", 0); + + doRemoveItems(); + + mInfoLabel->hide(); + mMainlayout->removeItem(mInfoLabel); + mTreeView->setSelectionMode(HbAbstractItemView::NoSelection); + setNavigationAction( mSoftKeyQuitAction); + + mItemSubMenu->menuAction()->setEnabled(true); + } + +void ContentWidget::createAndInitTreeView(int newModelType) + { + RDEBUG("0", 0); + + bool treeViewChange = false; + if (mModelType == fileSystemModel || newModelType == fileSystemModel) + { + treeViewChange = true; + } + if (!mTreeView || treeViewChange) + { + if (mTreeView) + { + resetTreeView(); + } + if (newModelType == fileSystemModel) + { + mTreeView = new HbFileSystemTreeView(this); + } + else + { + mTreeView = new HbTreeView(this); + } + initTreeView(); + } + } + +void ContentWidget::initTreeView() + { + RDEBUG("0", 0); + + connect(mTreeView, SIGNAL(activated(QModelIndex)), this, SLOT(itemActivated(QModelIndex))); + + connect(mTreeView, + SIGNAL(longPressed(HbAbstractViewItem*, QPointF)), + this, + SLOT(onLongPressed(HbAbstractViewItem*, QPointF))); + + if (mTreeView->selectionModel()) + { + connect(mTreeView->selectionModel(), SIGNAL(selectionChanged(QItemSelection, QItemSelection)), this, SLOT(selectionChanged(QItemSelection, QItemSelection))); + } + + setMenu( mMainMenu); + + mTreeView->setFocus(); + mTreeView->setLongPressEnabled(true); + mTreeView->setItemPixmapCacheEnabled(true); + + if (mMainlayout) + { + mMainlayout->addItem(mTreeView); + } + } + +void ContentWidget::resetTreeView() + { + RDEBUG("0", 0); + + delete mTreeView->model(); + + disconnect(mTreeView, SIGNAL(activated(QModelIndex)), this, SLOT(itemActivated())); + + mMainlayout->removeItem(mTreeView); + + delete mTreeView; + mTreeView = 0; + mTarget = QModelIndex(); + } + +Q_DECLARE_METATYPE( QModelIndex) +void ContentWidget::setTargetItemActionTriggered() + { + RDEBUG("0", 0); + + QAction *action = qobject_cast (sender()); + if (action) + { + mTarget = action->data().value (); + if (mTarget.isValid()) + { + HbNotificationDialog *popup = new HbNotificationDialog; + popup->setText("Target set successfully."); + popup->setTimeout(700); + popup->setAttribute(Qt::WA_DeleteOnClose); + popup->show(); + } + } + } + +void ContentWidget::setRootItemActionTriggered() + { + RDEBUG("0", 0); + + QAction *action = qobject_cast (sender()); + if (action) + { + QModelIndex index = action->data().value (); + mTreeView->setRootIndex(index); + if (index.isValid()) + { + HbNotificationDialog *popup = new HbNotificationDialog; + popup->setText("Root item set successfully."); + popup->setTimeout(700); + popup->setAttribute(Qt::WA_DeleteOnClose); + popup->show(); + } + mTarget = QModelIndex(); + } + } + +void ContentWidget::onLongPressed(HbAbstractViewItem* listViewItem, const QPointF& coords) + { + RDEBUG("0", 0); + + Q_UNUSED(listViewItem); + + HbMenu *contextMenu = new HbMenu(); + HbAction *contextAction1 = contextMenu->addAction("Set as target item"); + HbAction *contextAction2 = contextMenu->addAction("Set as root item"); + + QVariant modelIndex = qVariantFromValue(listViewItem->modelIndex()); + contextAction1->setData(modelIndex); + contextAction2->setData(modelIndex); + + connect(contextAction1, SIGNAL(triggered()), SLOT(setTargetItemActionTriggered())); + connect(contextAction2, SIGNAL(triggered()), SLOT(setRootItemActionTriggered())); + + contextMenu->setAttribute(Qt::WA_DeleteOnClose); + contextMenu->setPreferredPos(coords); + contextMenu->show(); + } + +void ContentWidget::selectionChanged(const QItemSelection & selected, const QItemSelection & deselected) + { + Q_UNUSED(selected) + Q_UNUSED(deselected) + QItemSelectionModel *selectionModel = mTreeView->selectionModel(); + QModelIndexList indexes = selectionModel->selectedIndexes(); + updateTextLabel(indexes.count()); + } + +void ContentWidget::updateTextLabel(int count) + { + RDEBUG("0", 0); + + if (count == 0) + { + mInfoLabel->setPlainText("No items selected"); + } + else + { + QString text = QString::number(count); + text.append(" items selected"); + mInfoLabel->setPlainText(text); + } + } + +void ContentWidget::doSettings() + { + RDEBUG("0", 0); + + mForm->resolveSettingsResults(); + mScrollHint = mForm->getScrollHint(); + + int mDepthTemp = mDepth; + mDepth = mForm->getDepth(); + if (mDepthTemp != mDepth) + { + collapse(mTreeView->model(), mTreeView->rootIndex(), mDepth); + expand(mTreeView->model(), mTreeView->rootIndex(), mDepth); + } + } + +int ContentWidget::calculateDepth(QModelIndex m) const + { + int depth = 1; + RDEBUG("0", 0); + + while (m.parent() != QModelIndex()) + { + depth++; + m = m.parent(); + } + return depth; + } + +void ContentWidget::expand(const QAbstractItemModel *model, const QModelIndex &parent, int depth) + { + RDEBUG("0", 0); + + if (model && depth > 1 && (parent == mTreeView->rootIndex() || parent.isValid())) + { + int rows = model->rowCount(parent); + for (int j = 0; j < rows; j++) + { + QModelIndex index = model->index(j, 0, parent); + if (index.isValid() && model->rowCount(index) > 0) + { + if (!mTreeView->isExpanded(index)) + { + mTreeView->setExpanded(index, true); + } + expand(model, index, depth - 1); + } + } + } + } + +void ContentWidget::expandUpwards(const QAbstractItemModel *model, const QModelIndex &index) + { + RDEBUG("0", 0); + + if (model && index != mTreeView->rootIndex() && index.isValid()) + { + if (!mTreeView->isExpanded(index)) + { + mTreeView->setExpanded(index, true); + } + expandUpwards(model, index.parent()); + } + } + +void ContentWidget::collapse(const QAbstractItemModel *model, const QModelIndex &parent, int depth) + { + RDEBUG("0", 0); + + if (model && depth >= 1 && (parent == mTreeView->rootIndex() || parent.isValid())) + { + int rows = model->rowCount(parent); + for (int j = 0; j < rows; j++) + { + QModelIndex index = model->index(j, 0, parent); + if (index.isValid() && model->rowCount(index) > 0) + { + if (calculateDepth(index) >= depth && mTreeView->isExpanded(index)) + { + mTreeView->setExpanded(index, false); + } + collapse(model, index, depth); + } + } + } + } + +void ContentWidget::postEvents() + { + RDEBUG("0", 0); + + // When widgets are added or removed from main window text items + // get font change event, which layout everything again. + // Use case add item & scroll hint PositionAtBottom fails, + // if those posted events are not flushed first. + + //TODO: to be wholly when proved that problmes putting following into comments are not too big + //QCoreApplication::sendPostedEvents(); + //QCoreApplication::sendPostedEvents(); + //QCoreApplication::sendPostedEvents(); + } + +void ContentWidget::aboutToClose() + { + delete mPopupModel; + mPopupModel = 0; + } + +void ContentWidget::autoInsertOne() + { + RDEBUG("0", 0); + + // add item to model after three seconds + QTimer *timer = new QTimer(this); + timer->setSingleShot(true); + connect(timer, SIGNAL(timeout()), this, SLOT(addOneToModel())); + timer->start(3000); + } +void ContentWidget::autoRemoveOne() + { + // remove item from model after three seconds + QModelIndex index = mTreeView->currentIndex(); + if (!index.isValid()) + { + QAbstractItemModel *model = mTreeView->model(); + index = model->index((model->rowCount() / 2), 0, mTreeView->rootIndex()); + } + + mItemsToRemove.clear(); + mItemsToRemove.append(index); + + QTimer *timer = new QTimer(this); + timer->setSingleShot(true); + connect(timer, SIGNAL(timeout()), this, SLOT(removeFromModel())); + timer->start(3000); + } + +void ContentWidget::addOneToModel() + { + RDEBUG("mItemsToAdd", mItemsToAdd); + if(mItemsToAdd>0) + mItemsToAdd--; + if(mItemsToAdd==0) + return; + + TInt ret=KErrNone; + ret = ret; + TInt val=-1; + ret = RProperty::Get(KPSUidCoreApplicationUIs, KCoreAppUIsAutolockStatus, val); + RDEBUG("KCoreAppUIsAutolockStatus", val); + ret = RProperty::Get(KPSUidAvkonDomain, KAknKeyguardStatus, val); + RDEBUG("KAknKeyguardStatus", val); + ret = RProperty::Get(KPSUidSecurityUIs, KSecurityUIsLights, val); + RDEBUG("KSecurityUIsLights", val); + ret = RProperty::Get(KPSUidSecurityUIs, KSecurityUIsSecUIOriginatedQuery, val); + RDEBUG("KSecurityUIsSecUIOriginatedQuery", val); + } + +void ContentWidget::addOneToModelExt() + { + RDEBUG("mItemsToAddExt", mItemsToAddExt); + if(mItemsToAddExt>0) + mItemsToAddExt--; + if(mItemsToAddExt==0) + return; + + TInt ret=KErrNone; + ret=ret; + TInt val=-1; + val=val; + doCommand(mItemsToAddExt); + } + +void ContentWidget::removeFromModel() + { + if (mItemsToRemove.count() > 0) + { + int count = mItemsToRemove.count(); + + for (int i = 0; i < count; ++i) + { + mTreeView->model()->removeRow(mItemsToRemove.takeLast().row()); + } + } + } + +void ContentWidget::simulateMultipleFastInserts() + { + RDEBUG("0", 0); + + if (!mTimer) + { + mTimer = new QTimer(this); + connect(mTimer, SIGNAL(timeout()), this, SLOT(timerReadyForInsert())); + } + mItemsToAdd = 50; + mTimer->start(100); + + } + +void ContentWidget::simulateMultipleFastRemovals() + { + if (!mTimer) + { + mTimer = new QTimer(this); + connect(mTimer, SIGNAL(timeout()), this, SLOT(timerReadyForRemoval())); + } + mItemsToAdd = 50; + + mTimer->start(100); + + } + +void ContentWidget::timerReadyForRemoval() + { + RDEBUG("0", 0); + + if (mItemsToAdd == 10) + { + HbAction *action = mCheckableItemActions.value(resetDuringSimulation); + if (action) + { + if (action->isChecked() && mTreeView->model()) + { + mItemsToAdd--; + mTreeView->reset(); + return; + } + } + } + + if (mItemsToAdd > 0 && mTreeView->model() && mTreeView->model()->rowCount() > 0) + { + int pos = 0; + bool removeVisible = false; + HbAction *action = mCheckableItemActions.value(simulateVisible); + if (action) + { + removeVisible = action->isChecked(); + } + + if (removeVisible) + { + QList visibleItems = mTreeView->visibleItems(); + if (visibleItems.count()) + { + pos = rand() % visibleItems.count(); + pos = visibleItems.at(pos)->modelIndex().row(); + } + } + else if (mTreeView->model()->rowCount() > 0) + { + pos = rand() % mTreeView->model()->rowCount(); + } + + mTimer->setInterval(2 + rand() % 10); + mTreeView->model()->removeRows(pos, 1); + mItemsToAdd--; + } + else + { + mTimer->stop(); + delete mTimer; + mTimer = 0; + } + } + +void ContentWidget::timerReadyForInsert() + { + RDEBUG("0", 0); + + if (mItemsToAdd == 10) + { + HbAction *action = mCheckableItemActions.value(resetDuringSimulation); + if (action) + { + if (action->isChecked() && mTreeView->model()) + { + mItemsToAdd--; + mTreeView->reset(); + return; + } + } + } + + if (mItemsToAdd > 0 && mTreeView->model()) + { + int pos = 0; + + bool insertAsVisible = false; + HbAction *action = mCheckableItemActions.value(simulateVisible); + if (action) + { + insertAsVisible = action->isChecked(); + } + + if (insertAsVisible) + { + QList visibleItems = mTreeView->visibleItems(); + if (visibleItems.count()) + { + pos = rand() % visibleItems.count(); + pos = visibleItems.at(pos)->modelIndex().row(); + } + } + else if (mTreeView->model()->rowCount() > 0) + { + pos = rand() % mTreeView->model()->rowCount(); + } + + mTimer->setInterval(2 + rand() % 10); + + if (mModelType == treeModelMixed) + { + QStandardItem *item = new QStandardItem; + + if (rand() % 7) + { + QString text; + QVariantList strings; + HbIcon icon(QString(":/demo/remixevent")); + if (rand() % 10) + { + text = "text " + QString::number(strings.size() + 1); + for (int i = rand() % 5; i > 0; i--) + { + text.append(" and"); + }; + strings << text; + } + if (rand() % 5) + { + text = "text " + QString::number(strings.size() + 1); + for (int i = rand() % 20; i > 0; i--) + { + text.append(" and"); + }; + strings << text; + } + if (rand() % 3) + { + text = "text " + QString::number(strings.size() + 1); + for (int i = rand() % 30; i > 0; i--) + { + text.append(" and"); + }; + strings << text; + } + QVariantList icons; + + if (rand() % 15) + { + icons << icon; + } + else + { + icons << QVariant(); + } + + if (rand() % 5) + { + icons << icon; + } + item->setData(icons, Qt::DecorationRole); + item->setData(strings, Qt::DisplayRole); + } + else + { + // separator + item->setData(Hb::SeparatorItem, Hb::ItemTypeRole); + item->setData(QVariant("Separator"), Qt::DisplayRole); + } + mItemsToAdd--; + doAddItem(pos, item); + } + else if (mModelType != dirModel) + { + QStandardItem *item = new QStandardItem(); + item->setData(mItemsToAdd == 1 ? QString("Simulated item %1 - last item!!!").arg(mItemsToAdd--) : QString("Simulated item %1").arg(mItemsToAdd--), Qt::DisplayRole); + doAddItem(pos, item); + } + } + else + { + mTimer->stop(); + delete mTimer; + mTimer = 0; + } + } + +void ContentWidget::insertItemAboveTargetClosed(int action) + { + RDEBUG("0", 0); + + HbInputDialog *dlg = static_cast (sender()); + QString text = dlg->value().toString(); + //if(dlg->actions().first() == action) { + if (action == HbDialog::Accepted) + { + mTextOfNewItem = text; + + QStandardItemModel* model = qobject_cast (mTreeView->model()); + int row = mTarget.row(); + model->insertRow(row, mTarget.parent()); + + // Set text. + if (mTextOfNewItem != QString()) + { + QModelIndex index = model->index(row, 0, mTarget.parent()); + QStandardItem* newItem = model->itemFromIndex(index); + newItem->setText(mTextOfNewItem); + } + } + else if (action == HbDialog::Rejected) + { + return; + } + } + +void ContentWidget::insertItemBelowTargetClosed(int action) + { + HbInputDialog *dlg = static_cast (sender()); + QString text = dlg->value().toString(); + // if(dlg->actions().first() == action) { + if (action == HbDialog::Accepted) + { + mTextOfNewItem = text; + + QStandardItemModel* model = qobject_cast (mTreeView->model()); + int row = mTarget.row() + 1; + model->insertRow(row, mTarget.parent()); + + // Set text. + if (mTextOfNewItem != QString()) + { + QModelIndex index = model->index(row, 0, mTarget.parent()); + QStandardItem* newItem = model->itemFromIndex(index); + newItem->setText(mTextOfNewItem); + } + } + else if (action == HbDialog::Rejected) + return; + + } + +void ContentWidget::expandTargetItem() + { + if (!mTreeView->isExpanded(mTarget)) + { + mTreeView->setExpanded(mTarget, true); + } + expand(mTreeView->model(), mTarget, 999); + + } + +void ContentWidget::collapseTargetItem() + { + if (mTreeView->isExpanded(mTarget)) + { + mTreeView->setExpanded(mTarget, false); + } + collapse(mTreeView->model(), mTarget, 999); + } + +// TODO +/* + verify Autolock is running + + + */ diff -r 989397f9511c -r 67b3e3c1fc87 securitydialogs/SecUi/SecUiTestQt/contentwidget.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/securitydialogs/SecUi/SecUiTestQt/contentwidget.h Wed Oct 20 14:51:23 2010 +0300 @@ -0,0 +1,221 @@ +#ifndef CONTENTWIDGET_H +#define CONTENTWIDGET_H + +#include +#include + +#include + +QT_BEGIN_NAMESPACE + +class QFileSystemWatcher; +class QGraphicsTextItem; +class QGraphicsLinearLayout; +class QItemSelection; +class QStandardItem; + +QT_END_NAMESPACE + +class HbMenuItem; +class HbMainWindow; +class HbListView; +class HbMenu; +class HbAction; +class HbIcon; +class HbAbstractViewItem; +class HbLabel; +class HbListViewItem; +class HbTreeView; +class TreeDataForm; + +class ContentWidget : public HbView +{ + Q_OBJECT + +public: + ContentWidget(QString& imagesDir, HbMainWindow *mainWindow); + virtual ~ContentWidget(); + +public slots: + void selectionChanged(const QItemSelection &selected, const QItemSelection &deselected); + void onLongPressed(HbAbstractViewItem *index, const QPointF &coords); + void aboutToClose(); + void launchInPopup(); + void setRootItemActionTriggered(); + void setTargetItemActionTriggered(); + + void addOneToModel(); + void addOneToModelExt(); + void removeFromModel(); + +protected: + void keyPressEvent(QKeyEvent *event); + +private slots: + // refreshes model + void refresh(); + void populateDirModel(); + void populateFileSystemModel(); + void populateGreenOddBrownEvenModel(); + void showSettings(); + void removeModel(); + void changeModel(HbAction* action); + void editItem(HbAction* action); + + void insertItemAboveTarget(); + void insertItemBelowTarget(); + + void setMainMenu(); + void resetItemManagementMenu(); + void doCommand(int index); + void itemActivated(const QModelIndex& index); + void backButtonClicked(); + void confirmDelete(); + + void addItem(); + void changeItem(); + + void removeItems(); + void removeAllItems(); + + void expandAll(); + void collapseAll(); + + void changeMirroring(); + void scrollToTarget(); + void changeOrientation(); + + void populateTreeModelDefault(); + void populateTreeModelSimple(); + void populateTreeModelDeep(); + void populateTreeModelFlat(); + //void populateTreeModelMail(); + void populateTreeModelMixed(); + + void autoInsertOne(); + void autoRemoveOne(); + void simulateMultipleFastInserts(); + void simulateMultipleFastRemovals(); + void timerReadyForInsert(); + void timerReadyForRemoval(); + + void insertItemAboveTargetClosed(int action); + void insertItemBelowTargetClosed(int action); + void expandTargetItem(); + void collapseTargetItem(); + +private: + void doAddItem(); + void doAddItem(int pos, QStandardItem *item); + void doSettings(); + void doRemoveItems(); + + void createAndInitTreeView(int newModelType); + void initTreeView(); + void resetTreeView(); + + void updateTextLabel(int count); + + // Calculates the item's depth in the tree. Topmost items are on depth 1. + // This information is needed only for debug purposes. + int calculateDepth(QModelIndex m) const; + void expand(const QAbstractItemModel *model, + const QModelIndex &parent, + int level ); + void expandUpwards( const QAbstractItemModel *model, + const QModelIndex &parent ); + void collapse( const QAbstractItemModel *model, + const QModelIndex &parent, + int depth ); + void postEvents(); + +private: + // submenu items for selecting model + enum modelType { + noModel = 0, + treeModelDefault, + treeModelSimple, + treeModelDeep, + treeModelFlat, + //treeModelMail, + treeModelMixed, + dirModel, + fileSystemModel, + greenOddBrownEvenModel, + }; + + // submenu items for list item operation + enum itemOperation { + addItemOperation, + changeItemOperation, + removeItemOperation, + removeAllItemsOperation, + expandAllOperation, + collapseAllOperation, + autoInsertOneOperation, + autoRemoveOneOperation, + simulateVisible, + resetDuringSimulation, + simulateMultipleFastInsertsOperation, + simulateMultipleFastRemovalsOperation, + selectAll, + unselect + }; + + // submenu items for list item operation + enum orientationOperation { + toggleOrientationOperation, + customOrientationOperation + }; + + // submenu items for list item operation + enum optionsOperation { + optionsOperationLast // not in use + }; + + QString& mImagesDir; + HbMainWindow *mWindow; + HbTreeView *mTreeView; + + HbAction *mRemoveModelAction; + HbAction *mOrientationSwitch; + HbAction *mMirroring; + + HbAction *mScrollToAction; + HbAction *mInsertAboveTargetAction; + HbAction *mInsertBelowTargetAction; + + HbMenu *mItemSubMenu; + HbMenu *mTargetActionsSubMenu; + + QFileSystemWatcher *mFileWatcher; + int mModelType; + + HbMenu *mMainMenu; + int mCountAdded; + bool mMute; + HbAction *mSoftKeyQuitAction; + HbAction *mSoftKeyConfirmAction; + HbAction *mSoftKeyBackAction; + HbAction *mSoftKeyDoneAction; + HbLabel *mInfoLabel; + QGraphicsLinearLayout *mMainlayout; + TreeDataForm *mForm; + HbView *mDetailView; + QPersistentModelIndex mTarget; + + QString mTextOfNewItem; + HbAbstractItemView::ScrollHint mScrollHint; + int mDepth; + QAbstractItemModel *mPopupModel; + + QModelIndexList mItemsToRemove; + QTimer *mTimer; + int mItemsToAdd; + QTimer *mTimerExt; + int mItemsToAddExt; + + QMap mCheckableItemActions; +}; + +#endif // CONTENTWIDGET_H diff -r 989397f9511c -r 67b3e3c1fc87 securitydialogs/SecUi/SecUiTestQt/dirviewitem.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/securitydialogs/SecUi/SecUiTestQt/dirviewitem.cpp Wed Oct 20 14:51:23 2010 +0300 @@ -0,0 +1,55 @@ +#include "dirviewitem.h" + +#include +#include +#include +#include + +const QString KExpandButtonItemName = "subitem-button"; + +DirViewItem::DirViewItem(QGraphicsItem* parent) : + HbTreeViewItem(parent), + mExpandButton(0) +{ +} + +DirViewItem::~DirViewItem() +{ +} + +int DirViewItem::type() const +{ + return DirViewItem::Type; +} + +HbAbstractViewItem *DirViewItem::createItem() +{ + return new DirViewItem(*this); +} + +void DirViewItem::buttonReleased() +{ + if (isExpanded()) { + setExpanded(false); + } else { + setExpanded(true); + } +} + +HbWidgetBase *DirViewItem::updateExpandItem() +{ + if (!mExpandButton) { + mExpandButton = new HbPushButton(this); + connect(mExpandButton, SIGNAL(released()), this, SLOT(buttonReleased())); + HbStyle::setItemName(mExpandButton, KExpandButtonItemName); + } + + if (isExpanded()) { + mExpandButton->setText("Close"); + } else { + mExpandButton->setText("Open"); + } + + return mExpandButton; +} + diff -r 989397f9511c -r 67b3e3c1fc87 securitydialogs/SecUi/SecUiTestQt/dirviewitem.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/securitydialogs/SecUi/SecUiTestQt/dirviewitem.h Wed Oct 20 14:51:23 2010 +0300 @@ -0,0 +1,36 @@ +#ifndef DIRVIEWITEM_H +#define DIRVIEWITEM_H + +#include +#include + +#include + +class DirViewItem : public HbTreeViewItem +{ + Q_OBJECT + +public: + + explicit DirViewItem(QGraphicsItem *parent = 0); + virtual ~DirViewItem(); + + enum { Type = Hb::ItemType_Last + 10 }; + virtual int type() const; + + virtual HbAbstractViewItem* createItem(); + +protected slots: + + void buttonReleased(); + +protected: + + virtual HbWidgetBase *updateExpandItem(); + +private: + + QPointer mExpandButton; +}; + +#endif // DIRVIEWITEM_H diff -r 989397f9511c -r 67b3e3c1fc87 securitydialogs/SecUi/SecUiTestQt/greenoddviewitem.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/securitydialogs/SecUi/SecUiTestQt/greenoddviewitem.cpp Wed Oct 20 14:51:23 2010 +0300 @@ -0,0 +1,71 @@ +#include "greenoddviewitem.h" + +#include "QPainter" +#include "QStyleOptionGraphicsItem" +#include "QWidget" +#include "QDebug" + +GreenOddViewItem::GreenOddViewItem(QGraphicsItem* parent) : + HbListViewItem(parent) +{ +} + +GreenOddViewItem::~GreenOddViewItem() +{ +} + + +HbAbstractViewItem* GreenOddViewItem::createItem() +{ + return new GreenOddViewItem(*this); +} + +bool GreenOddViewItem::canSetModelIndex(const QModelIndex &index) const +{ + int itemType(index.data(Hb::ItemTypeRole).toInt()); + if (itemType == Hb::StandardItem) { + QVariant displayRole = index.data(Qt::DisplayRole); + QString firstValue; + QStringList stringList; + if (displayRole.isValid()) { + if (displayRole.canConvert()) { + firstValue = displayRole.toString(); + } else if ( displayRole.canConvert() + && displayRole.toStringList().count()) { + firstValue = displayRole.toStringList().at(0); + } + } + + //qDebug() << "GreenOddViewItem::canSetModelIndex: value" << firstValue; + int value = firstValue.toInt(); + //int value = index.row(); + if ( value > 0 + && value % 2) { + return true; + } + } + return false; +} + +void GreenOddViewItem::paint( QPainter *painter, + const QStyleOptionGraphicsItem *option, + QWidget *widget) +{ + HbAbstractViewItem::paint( painter, option, widget ); + if (painter){ + QRectF drawRect = boundingRect(); + drawRect.adjust(1,1,-1,-1); + //QColor brown(141,92,7); + //QColor brown(106,57,10); + QColor brown(87,45,11); + painter->fillRect( drawRect, Qt::darkGreen); + } +} + +int GreenOddViewItem::type() const +{ + return GreenOddViewItem::Type; +} + + + diff -r 989397f9511c -r 67b3e3c1fc87 securitydialogs/SecUi/SecUiTestQt/greenoddviewitem.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/securitydialogs/SecUi/SecUiTestQt/greenoddviewitem.h Wed Oct 20 14:51:23 2010 +0300 @@ -0,0 +1,28 @@ +#ifndef GREENODDVIEWITEM_H +#define GREENODDVIEWITEM_H + +#include + +class QGraphicsItem; +class QPainter; +class QStyleOptionGraphicsItem; +class QWidget; +class QModelIndex; + +class GreenOddViewItem : public HbListViewItem +{ + public: + explicit GreenOddViewItem(QGraphicsItem* parent=0); + virtual ~GreenOddViewItem(); + + enum { Type = Hb::ItemType_Last + 1001 }; + virtual int type() const; + + virtual HbAbstractViewItem* createItem(); + virtual bool canSetModelIndex(const QModelIndex &index) const; + virtual void paint( QPainter *painter, + const QStyleOptionGraphicsItem *option, + QWidget *widget); +}; + +#endif // GREENODDVIEWITEM_H diff -r 989397f9511c -r 67b3e3c1fc87 securitydialogs/SecUi/SecUiTestQt/mailtreeviewitem.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/securitydialogs/SecUi/SecUiTestQt/mailtreeviewitem.cpp Wed Oct 20 14:51:23 2010 +0300 @@ -0,0 +1,274 @@ +#include "mailtreeviewitem.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +/*! + \class NmMessageListViewItem + \brief list view item for message list view +*/ + +/*! + Constructor +*/ +MailTreeViewItem::MailTreeViewItem(QGraphicsItem *parent): + HbTreeViewItem(parent), + mSender(0), + mSubject(0), + mTime(0), + mDividerTitle(0), + mNewMsgIcon(0), + mFrom(0) +{ +} + +MailTreeViewItem::~MailTreeViewItem() +{ +} + + +int MailTreeViewItem::type() const +{ + return MailTreeViewItem::Type; +} + +HbAbstractViewItem *MailTreeViewItem::createItem() +{ + return new MailTreeViewItem(*this); +} + +/*! + boolean value indicating model index availability +*/ +bool MailTreeViewItem::canSetModelIndex(const QModelIndex &index) const +{ + Q_UNUSED(index); + // This item class can handle all items in message list + return true; +} + +/*! + update child items +*/ +void MailTreeViewItem::updateChildItems() +{ + // to create expand icon, if it doesn't exist + HbTreeViewItem::updateChildItems(); + + // Shared data with ModelFactory. + int messageRole = Qt::UserRole+1; + int dateRole = Qt::UserRole+2; + + mLayout = 0; + setLayout(0); + + // Create layout + mLayout = new HbAnchorLayout(); + setLayout(mLayout); // mLayout ownership is passed to QGraphicsWidget + + QVariant dateData = modelIndex().data(dateRole); + QVariant messageData = modelIndex().data(messageRole); + + // Create fonts + HbFontSpec primaryFont = HbFontSpec(HbFontSpec::Primary); + HbFontSpec secondaryFont = HbFontSpec(HbFontSpec::Secondary); + + // Check whether item is message item or title divider + // and set the layout accordingly + if (messageData.isValid()) { + QStringList stringList; + if ( messageData.canConvert()) { + stringList = messageData.toStringList(); + } + + if (stringList.count() < 3) { + // to avoid crash + return; + } + + delete mDividerTitle; + mDividerTitle = 0; + + if (!mTime) { + mTime = new HbLabel(); + } + mTime->setObjectName("ListViewItemMessageTime"); + mTime->setFontSpec(HbFontSpec(HbFontSpec::Primary)); + // Create subject label + if (!mSubject) { + mSubject = new HbLabel(); + } + mSubject->setObjectName("ListViewItemMessageSubject"); + mSubject->setFontSpec(HbFontSpec(HbFontSpec::Secondary)); + + if (!mFrom) { + mFrom = new HbLabel(stringList.at(0)); + } + mFrom->setObjectName("ListViewItemMessageSender"); + mFrom->setFontSpec(primaryFont); + + // Create default locale + /*QLocale locale; + mTime->setText(locale.toString( + msgModelItem->metaData().sentTime().toLocalTime().time(), + QLocale::ShortFormat));*/ + mTime->setPlainText(stringList.at(1)); + + // mTime->setAlignment(Qt::AlignVCenter | Qt::AlignRight); + mSubject->setPlainText(stringList.at(2)); + + // Create new message icon + if (!mNewMsgIcon) { + HbFrameDrawer *drawer = new HbFrameDrawer(":/resources/qtg_fr_list_new_item", HbFrameDrawer::ThreePiecesVertical); + drawer->setFillWholeRect(false); + mNewMsgIcon = new HbFrameItem(drawer, this); + } + mNewMsgIcon->setObjectName("ListViewItemMessageIcon"); + + static const int iconWidth = 8; + + // Set message item layout + // Place new message icon to layout + mLayout->setAnchor(mLayout, Hb::TopEdge, mNewMsgIcon, Hb::TopEdge, 0); + mLayout->setAnchor(mLayout, Hb::LeftEdge, mNewMsgIcon, Hb::LeftEdge, 0); + mLayout->setAnchor(mNewMsgIcon, Hb::RightEdge, mFrom, Hb::LeftEdge, 0); + + // Set from & subject 10 pixels from left + mLayout->setAnchor(mLayout, Hb::TopEdge, mFrom, Hb::TopEdge, 0); + mLayout->setAnchor(mLayout, Hb::LeftEdge, mFrom, Hb::LeftEdge, iconWidth); + mLayout->setAnchor(mLayout, Hb::RightEdge, mSubject, Hb::RightEdge, iconWidth); + + mLayout->setAnchor(mLayout, Hb::LeftEdge, mSubject, Hb::LeftEdge, iconWidth); + mLayout->setAnchor(mFrom, Hb::BottomEdge, mSubject, Hb::TopEdge, 0); + // Set Time label to correct place + mLayout->setAnchor(mTime, Hb::LeftEdge, mLayout, Hb::RightEdge, 100); + mLayout->setAnchor(mFrom, Hb::RightEdge, mTime, Hb::LeftEdge, 0); + // Set subject right edge alignment + mLayout->setAnchor(mSubject, Hb::RightEdge, mLayout, Hb::RightEdge, iconWidth); + + mLayout->setPreferredHeight(50); + setObjectName("ListViewItemMessage"); + } + else if (dateData.isValid()) { + QString date; + if (dateData.canConvert()) { + date = dateData.toString(); + } + else { + return; + } + + // NOTE: Layout data will be read from xml once orbit supports it + // Create divider icon + delete mTime; + mTime = 0; + + delete mSubject; + mSubject = 0; + + delete mNewMsgIcon; + mNewMsgIcon = 0; + + delete mFrom; + mFrom = 0; + + // Create divider title + if (!mDividerTitle) { + mDividerTitle = new HbLabel(); + } + mDividerTitle->setObjectName("ListViewItemDividerTitle"); + + mDividerTitle->setPlainText(date); + mDividerTitle->setFontSpec(primaryFont); + mDividerTitle->setAlignment(Qt::AlignVCenter | Qt::AlignLeft); + + // Add title divider text + mLayout->setAnchor(mLayout, Hb::TopEdge, mDividerTitle, Hb::TopEdge, 1); + mLayout->setAnchor(mLayout, Hb::LeftEdge, mDividerTitle, Hb::LeftEdge, 0); + + QGraphicsItem *graphicsItem = primitive(QLatin1String("subitem-indicator")); + if ( graphicsItem + && graphicsItem->isWidget()) { + HbLabel *dividerIcon = qobject_cast(static_cast(graphicsItem)); + if (dividerIcon) { + mLayout->setAnchor(mLayout, Hb::TopEdge, dividerIcon, Hb::TopEdge, 5); + mLayout->setAnchor(dividerIcon, Hb::RightEdge, mLayout, Hb::RightEdge, 20); + } + } + + mLayout->setPreferredHeight(32); + setObjectName("ListViewItemDivider"); + } + else { + qDebug() <<"MailTreeViewItem: Invalid message meta data when drawing message list"; + } + + const QSizeF reso = HbDeviceProfile::current().logicalSize(); + mLayout->setPreferredWidth(reso.width()-20); +} + +void MailTreeViewItem::polishEvent() +{ + QGraphicsWidget::polishEvent(); +} + + +HbWidgetBase *MailTreeViewItem::updateExpandItem() +{ + HbLabel *dividerIcon = 0; + QGraphicsItem *graphicsItem = primitive(QLatin1String("subitem-indicator")); + if ( graphicsItem + && graphicsItem->isWidget()) { + dividerIcon = qobject_cast(static_cast(graphicsItem)); + } + + if (!dividerIcon) { + dividerIcon = new HbLabel(); + HbIcon icon; + icon.setIconName(":/resources/qtg_nmailui_minus_sign", QIcon::Normal, QIcon::On); + icon.setIconName(":/resources/qtg_nmailui_plus_sign", QIcon::Normal, QIcon::Off); + dividerIcon->setIcon(icon); + } + + if (isExpanded()) { + dividerIcon->setObjectName("ListViewItemDividerIconMinus"); + } + else { + dividerIcon->setObjectName("ListViewItemDividerIconPlus"); + } + return dividerIcon; +} + +void MailTreeViewItem::paint( + QPainter *painter, + const QStyleOptionGraphicsItem *option, + QWidget *widget) +{ + Q_UNUSED(option); + Q_UNUSED(widget); + if (painter){ + painter->save(); + painter->setOpacity(0.15); + QLineF line1( rect().topLeft().x(), rect().bottomRight().y(), + rect().bottomRight().x(), rect().bottomRight().y()); + painter->drawLine(line1); + // Draw line before each item + QLineF line2( rect().topLeft().x(), rect().topLeft().y(), + rect().bottomRight().x(), rect().topLeft().y()); + painter->drawLine(line2); + painter->restore(); + } +} + + diff -r 989397f9511c -r 67b3e3c1fc87 securitydialogs/SecUi/SecUiTestQt/mailtreeviewitem.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/securitydialogs/SecUi/SecUiTestQt/mailtreeviewitem.h Wed Oct 20 14:51:23 2010 +0300 @@ -0,0 +1,50 @@ +#ifndef MAILVIEWITEM_H +#define MAILVIEWITEM_H + +#include +#include + +class HbLabel; +class HbFrameItem; +class HbAnchorLayout; +class HbWidgetBase; + +#include +#include + +class MailTreeViewItem : public HbTreeViewItem +{ + Q_OBJECT + +public: + + explicit MailTreeViewItem(QGraphicsItem *parent = 0); + virtual ~MailTreeViewItem(); + + enum { Type = Hb::ItemType_Last + 11 }; + virtual int type() const; + + void updateChildItems(); + + HbAbstractViewItem *createItem(); + bool canSetModelIndex(const QModelIndex &index) const; + + HbWidgetBase *updateExpandItem(); + +protected: + + void polishEvent(); + void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget); + +private: + HbLabel *mSender; // Not owned + HbLabel *mSubject; // Not owned + HbLabel *mTime; // Not owned + HbLabel *mDividerTitle; // Not owned + //HbLabel *mDividerIcon; // Not owned + HbFrameItem *mNewMsgIcon; // + HbLabel *mFrom; + HbAnchorLayout* mLayout; // Not owned +}; + +#endif // MAILVIEWITEM_H diff -r 989397f9511c -r 67b3e3c1fc87 securitydialogs/SecUi/SecUiTestQt/main.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/securitydialogs/SecUi/SecUiTestQt/main.cpp Wed Oct 20 14:51:23 2010 +0300 @@ -0,0 +1,74 @@ +#include +#include + +#include "contentwidget.h" + +//#define DEBUG_TO_FILE + +#ifdef DEBUG_TO_FILE +#include +#include + +const int maxPathIndex = 1; +const char *paths[/*maxPathIndex*/] = {"f:\\SecUiTestQt-log.txt"}; + +FILE* file = 0; + +void myMessageOutput(QtMsgType type, const char *msg) { + switch (type) { + case QtDebugMsg: { + fprintf(file, "Debug: %s\n", msg); + } + break; + case QtWarningMsg: { + //fprintf(file, "Warning: %s\n", msg); + } + break; + case QtCriticalMsg: { + fprintf(file, "Critical: %s\n", msg); + } + break; + case QtFatalMsg: { + fprintf(file, "Fatal: %s\n", msg); + abort(); + } + } +} +#endif + + +int main(int argc, char *argv[]) +{ +#ifdef DEBUG_TO_FILE + int pathIndex = 0; + while (!file && pathIndex < maxPathIndex) { + file = fopen(paths[pathIndex], "a"); + if (!file) ++pathIndex; + } + if (file) qInstallMsgHandler(myMessageOutput); + qDebug("============================================================" + "==========================================================="); + qDebug("============================================================" + "==========================================================="); +#endif + HbApplication app(argc, argv); + app.setApplicationName( "SecUiTestQt" ); + + QString appDir = app.applicationDirPath(); + + HbMainWindow* window = new HbMainWindow(); + + ContentWidget *view = new ContentWidget(appDir, window); + window->addView(view); + + window->show(); + int closeCode = app.exec(); + window->deleteLater(); + +#ifdef DEBUG_TO_FILE + if (file) { + fclose(file); + } +#endif + return closeCode; +} diff -r 989397f9511c -r 67b3e3c1fc87 securitydialogs/SecUi/SecUiTestQt/modelfactory.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/securitydialogs/SecUi/SecUiTestQt/modelfactory.cpp Wed Oct 20 14:51:23 2010 +0300 @@ -0,0 +1,1284 @@ +#include + +#include "modelfactory.h" + +#include +#include + +#include + +void insertMixedItems(QStandardItem *parent) +{ + QString longSecondaryText; + for (int i = 0; i < 20; ++i) { + longSecondaryText.append("Second text "); + } + + HbIcon icon(QString(":/demo/generic")); + + QVariantList strings; + QVariantList icons; + + // text + QStandardItem *child = new QStandardItem(); + strings << "text-1"; + child->setData(strings, Qt::DisplayRole); + parent->appendRow(child); + + strings.clear(); + icons.clear(); + + // text + icon + child = new QStandardItem(); + strings << "text-1+icon-2"; + icons << QVariant() << icon; + child->setData(strings, Qt::DisplayRole); + child->setData(icons, Qt::DecorationRole); + parent->appendRow(child); + + strings.clear(); + icons.clear(); + + // icon + text + child = new QStandardItem(); + strings << "icon-1+text-1"; + icons << icon; + child->setData(strings, Qt::DisplayRole); + child->setData(icons, Qt::DecorationRole); + parent->appendRow(child); + + strings.clear(); + icons.clear(); + + // icon + text + icon + child = new QStandardItem(); + strings << "icon-1+text-1+icon-2"; + icons << icon << icon; + child->setData(strings, Qt::DisplayRole); + child->setData(icons, Qt::DecorationRole); + parent->appendRow(child); + + strings.clear(); + icons.clear(); + + // text + text + child = new QStandardItem(); + strings << "text-1+text-3" << QVariant() << "third text"; + child->setData(strings, Qt::DisplayRole); + child->setData(icons, Qt::DecorationRole); + parent->appendRow(child); + + strings.clear(); + icons.clear(); + + // text + text + icon + child = new QStandardItem(); + strings << "text-1+text-3+icon-2" << QVariant() << "third text"; + icons << QVariant() << icon; + child->setData(strings, Qt::DisplayRole); + child->setData(icons, Qt::DecorationRole); + parent->appendRow(child); + + strings.clear(); + icons.clear(); + + // icon + text + text + child = new QStandardItem(); + strings << "icon-1+text-1+text-3" << QVariant() << "third text"; + icons << icon; + child->setData(strings, Qt::DisplayRole); + child->setData(icons, Qt::DecorationRole); + parent->appendRow(child); + + strings.clear(); + icons.clear(); + + // icon + text + text + icon + child = new QStandardItem(); + strings << "icon-1+text-1+text-3+icon-2" << QVariant() << "third text"; + icons << icon << icon; + child->setData(strings, Qt::DisplayRole); + child->setData(icons, Qt::DecorationRole); + parent->appendRow(child); + + strings.clear(); + icons.clear(); + + // 2 texts + child = new QStandardItem(); + strings << "text-1+text-2" << longSecondaryText; + child->setData(strings, Qt::DisplayRole); + child->setData(icons, Qt::DecorationRole); + parent->appendRow(child); + + strings.clear(); + icons.clear(); + + // 2 texts + icon + child = new QStandardItem(); + strings << "text-1+text-2+icon-2" << longSecondaryText; + icons << QVariant() << icon; + child->setData(strings, Qt::DisplayRole); + child->setData(icons, Qt::DecorationRole); + parent->appendRow(child); + + strings.clear(); + icons.clear(); + + // icon + 2 texts + child = new QStandardItem(); + strings << "icon-1+text-1+text-2" << longSecondaryText; + icons << icon; + child->setData(strings, Qt::DisplayRole); + child->setData(icons, Qt::DecorationRole); + parent->appendRow(child); + + strings.clear(); + icons.clear(); + + // icon + 2 texts + icon + child = new QStandardItem(); + strings << "icon-1+text-1+text-2+icon-2" << longSecondaryText; + icons << icon << icon; + child->setData(strings, Qt::DisplayRole); + child->setData(icons, Qt::DecorationRole); + parent->appendRow(child); + + strings.clear(); + icons.clear(); + + // 3 texts + child = new QStandardItem(); + strings << "text-1+text-2+text-3" << longSecondaryText << "third text"; + child->setData(strings, Qt::DisplayRole); + child->setData(icons, Qt::DecorationRole); + parent->appendRow(child); + + strings.clear(); + icons.clear(); + + // 3 texts + icon + child = new QStandardItem(); + strings << "text-1+text-2+text-3+icon-2" << longSecondaryText << "third text"; + icons << QVariant() << icon; + child->setData(strings, Qt::DisplayRole); + child->setData(icons, Qt::DecorationRole); + parent->appendRow(child); + + strings.clear(); + icons.clear(); + + // icon + 3 texts + child = new QStandardItem(); + strings << "icon-1+text-1+text-2+text-3" << longSecondaryText << "third text"; + icons << icon; + child->setData(strings, Qt::DisplayRole); + child->setData(icons, Qt::DecorationRole); + parent->appendRow(child); + + strings.clear(); + icons.clear(); + + // icon + 3 texts + icon + child = new QStandardItem(); + strings << "icon-1+text-1+text-2+text-3+icon-2" << longSecondaryText << "third text"; + icons << icon << icon; + child->setData(strings, Qt::DisplayRole); + child->setData(icons, Qt::DecorationRole); + parent->appendRow(child); + + strings.clear(); + icons.clear(); + + // separator + child = new QStandardItem(); + strings << "Separator"; + child->setData(strings, Qt::DisplayRole); + child->setData(icons, Qt::DecorationRole); + child->setData(Hb::SeparatorItem, Hb::ItemTypeRole); + child->setEnabled(false); + parent->appendRow(child); + + strings.clear(); + icons.clear(); + + // disabled + child = new QStandardItem(); + strings << "Disabled item" << longSecondaryText << "third text"; + icons << icon << icon; + child->setData(strings, Qt::DisplayRole); + child->setData(icons, Qt::DecorationRole); + child->setEnabled(false); + parent->appendRow(child); + + strings.clear(); + icons.clear(); + + // disabled parent item + child = new QStandardItem(); + strings << "Disabled parent item"; + child->setData(strings, Qt::DisplayRole); + child->setData(Hb::ParentItem, Hb::ItemTypeRole); + child->setEnabled(false); + parent->appendRow(child); + + strings.clear(); + icons.clear(); + + // disabled parent item's child + QStandardItem *child2 = new QStandardItem(); + strings << "Disabled parent item's child"; + child2->setData(strings, Qt::DisplayRole); + child2->setEnabled(false); + child->appendRow(child2); + +} + +QStandardItemModel *ModelFactory::populateTreeModelMail() +{ + QStandardItemModel* model = new QStandardItemModel(); + + //________________________________________ + int messageRole = Qt::UserRole+1; + int dateRole = Qt::UserRole+2; + + QStandardItem *date = new QStandardItem; + date->setData(QString("27. lokakuuta 2009"), dateRole); + model->appendRow(date); + + QStandardItem *message = new QStandardItem; + QStringList data; + data << "Fotonetti.com" << "19:51:14" << "Fotonetti Pro"; + message->setData(data, messageRole); + date->appendRow(message); + + date = new QStandardItem; + date->setData(QString("25. lokakuuta 2009"), dateRole); + model->appendRow(date); + + message = new QStandardItem; + data.clear(); + data << "Amazon.co.uk" << "5:51:52" << "Your Amazon Order # 123-3456789-0123 "; + message->setData(data, messageRole); + date->appendRow(message); + + date = new QStandardItem; + date->setData(QString("23. lokakuuta 2009"), dateRole); + model->appendRow(date); + + message = new QStandardItem; + data.clear(); + data << "MBnet" << "12:12:12" << "MBnetin pullopostia 43/2009: Aurinkoa odotellessa... "; + message->setData(data, messageRole); + date->appendRow(message); + + date = new QStandardItem; + date->setData(QString("21. lokakuuta 2009"), dateRole); + model->appendRow(date); + + message = new QStandardItem; + data.clear(); + data << "Skype" << "21:59:20" << "Skype 4.1 - Too late"; + message->setData(data, messageRole); + date->appendRow(message); + + message = new QStandardItem; + data.clear(); + data << "Skype" << "20:58:19" << "Skype 4.1 - Act now"; + message->setData(data, messageRole); + date->appendRow(message); + + message = new QStandardItem; + data.clear(); + data << "Skype" << "19:57:18" << "Skype 4.1 - Time to act"; + message->setData(data, messageRole); + date->appendRow(message); + + message = new QStandardItem; + data.clear(); + data << "Skype" << "18:56:17" << "Skype 4.1 - New release"; + message->setData(data, messageRole); + date->appendRow(message); + + date = new QStandardItem; + date->setData(QString("5. lokakuuta 2009"), dateRole); + model->appendRow(date); + + message = new QStandardItem; + data.clear(); + data << "Hit Booster" << "21:12:00" << "Have your own website traffic generator "; + message->setData(data, messageRole); + date->appendRow(message); + + message = new QStandardItem; + data.clear(); + data << "noreply@helsinkiexpert.fi" << "11:08:01" << "Terveisiä Helsinki Expertiltä"; + message->setData(data, messageRole); + date->appendRow(message); + + + return model; +} + + +QStandardItemModel *ModelFactory::populateTreeModelDefault() +{ + QStandardItemModel* model = new QStandardItemModel(); + + //________________________________________ + + QStandardItem *paintDevice = new QStandardItem; + paintDevice->setText(QString("QPaintDevice")); + model->appendRow(paintDevice); + + QStandardItem *pixmap = new QStandardItem; + pixmap->setText(QString("QPixmap")); + paintDevice->appendRow(pixmap); + + QStandardItem *bitmap = new QStandardItem; + bitmap->setText(QString("QBitmap")); + pixmap->appendRow(bitmap); + + QStandardItem *customRasterPaintDevice = new QStandardItem; + customRasterPaintDevice->setText(QString("QCustomRasterPaintDevice")); + paintDevice->appendRow(customRasterPaintDevice); + + QStandardItem *glPixelBuffer = new QStandardItem; + glPixelBuffer->setText(QString("QGLPixelBuffer")); + paintDevice->appendRow(glPixelBuffer); + + QStandardItem *image = new QStandardItem; + image->setText(QString("QImage")); + paintDevice->appendRow(image); + + QStandardItem *picture = new QStandardItem; + picture->setText(QString("QPicture")); + paintDevice->appendRow(picture); + + QStandardItem *printer = new QStandardItem; + printer->setText(QString("QPrinter")); + paintDevice->appendRow(printer); + + QStandardItem *svgGenerator = new QStandardItem; + svgGenerator->setText(QString("QSvgGenerator")); + paintDevice->appendRow(svgGenerator); + + //________________________________________ + + QStandardItem *object = new QStandardItem; + object->setText(QString("QObject")); + model->appendRow(object); + + QStandardItem *widget = new QStandardItem; + widget->setText(QString("QWidget")); + object->appendRow(widget); + + QStandardItem *absItemModel = new QStandardItem; + absItemModel->setText(QString("QAbstractItemModel")); + object->appendRow(absItemModel); + + QStandardItem *absListModel = new QStandardItem; + absListModel->setText(QString("QAbstractListModel")); + absItemModel->appendRow(absListModel); + + QStandardItem *strListModel = new QStandardItem; + strListModel->setText(QString("QStringListModel")); + absListModel->appendRow(strListModel); + + QStandardItem *absProxyModel = new QStandardItem; + absProxyModel->setText(QString("QAbstractProxyModel")); + absItemModel->appendRow(absProxyModel); + + QStandardItem *sFilterProxyModel = new QStandardItem; + sFilterProxyModel->setText(QString("QSortFilterProxyModel")); + absProxyModel->appendRow(sFilterProxyModel); + + QStandardItem *absTableModel = new QStandardItem; + absTableModel->setText(QString("QAbstractTableModel")); + absItemModel->appendRow(absTableModel); + + QStandardItem *sqlQueryModel = new QStandardItem; + sqlQueryModel->setText(QString("QSqlQueryModel")); + absTableModel->appendRow(sqlQueryModel); + + QStandardItem *sqlTableModel = new QStandardItem; + sqlTableModel->setText(QString("QSqlTableModel")); + sqlQueryModel->appendRow(sqlTableModel); + + QStandardItem *sqlRTableModel = new QStandardItem; + sqlRTableModel->setText(QString("QSqlRelationalTableModel")); + sqlTableModel->appendRow(sqlRTableModel); + + QStandardItem *dirModel = new QStandardItem; + dirModel->setText(QString("QDirModel")); + absItemModel->appendRow(dirModel); + + QStandardItem *proxyModel = new QStandardItem; + proxyModel->setText(QString("QProxyModel")); + absItemModel->appendRow(proxyModel); + + QStandardItem *stanItemModel = new QStandardItem; + stanItemModel->setText(QString("QStandardItemModel")); + absItemModel->appendRow(stanItemModel); + + QStandardItem *ioDevice = new QStandardItem; + ioDevice->setText(QString("QIODevice")); + object->appendRow(ioDevice); + + QStandardItem *absSocket = new QStandardItem; + absSocket->setText(QString("QAbstractSocket")); + ioDevice->appendRow(absSocket); + + QStandardItem *topSocket = new QStandardItem; + topSocket->setText(QString("QTopSocket")); + absSocket->appendRow(topSocket); + + QStandardItem *sslSocket = new QStandardItem; + sslSocket->setText(QString("QSslSocket")); + topSocket->appendRow(sslSocket); + + QStandardItem *udpSocket = new QStandardItem; + udpSocket->setText(QString("QUdpSocket")); + absSocket->appendRow(udpSocket); + + QStandardItem *file = new QStandardItem; + file->setText(QString("QFile")); + ioDevice->appendRow(file); + + QStandardItem *tmpFile = new QStandardItem; + tmpFile->setText(QString("QTemporaryFile")); + file->appendRow(tmpFile); + + QStandardItem *buffer = new QStandardItem; + buffer->setText(QString("QBuffer")); + ioDevice->appendRow(buffer); + + QStandardItem *process = new QStandardItem; + process->setText(QString("QProcess")); + ioDevice->appendRow(process); + + QStandardItem *validator = new QStandardItem; + validator->setText(QString("QValidator")); + object->appendRow(validator); + + QStandardItem *dValidator = new QStandardItem; + dValidator->setText(QString("QDoubleValidator")); + validator->appendRow(dValidator); + + QStandardItem *intValidator = new QStandardItem; + intValidator->setText(QString("QIntValidator")); + validator->appendRow(intValidator); + + QStandardItem *rgValidator = new QStandardItem; + rgValidator->setText(QString("QRegExpValidator")); + validator->appendRow(rgValidator); + + QStandardItem *action = new QStandardItem; + action->setText(QString("QAction")); + object->appendRow(action); + + QStandardItem *menuItem = new QStandardItem; + menuItem->setText(QString("QMenuItem")); + action->appendRow(menuItem); + + QStandardItem *widgetAction = new QStandardItem; + widgetAction->setText(QString("QWidgetAction")); + action->appendRow(widgetAction); + + QStandardItem *dBusAbsInterface = new QStandardItem; + dBusAbsInterface->setText(QString("QDBusAbstractInterface")); + object->appendRow(dBusAbsInterface); + + QStandardItem *dBusConInterface = new QStandardItem; + dBusConInterface->setText(QString("QDBusConnectionInterface")); + dBusAbsInterface->appendRow(dBusConInterface); + + QStandardItem *dBusInterface = new QStandardItem; + dBusInterface->setText(QString("QDBusInterface")); + dBusAbsInterface->appendRow(dBusInterface); + + QStandardItem *textObject = new QStandardItem; + textObject->setText(QString("QTextObject")); + object->appendRow(textObject); + + QStandardItem *textBlockGroup = new QStandardItem; + textBlockGroup->setText(QString("QTextBlockGroup")); + textObject->appendRow(textBlockGroup); + + QStandardItem *textList = new QStandardItem; + textList->setText(QString("QTextList")); + textBlockGroup->appendRow(textList); + + QStandardItem *textFrame = new QStandardItem; + textFrame->setText(QString("QTextFrame")); + textObject->appendRow(textFrame); + + QStandardItem *textTable = new QStandardItem; + textTable->setText(QString("QTextTable")); + textFrame->appendRow(textTable); + + QStandardItem *absItemDelegate = new QStandardItem; + absItemDelegate->setText(QString("QAbstractItemDelegate")); + object->appendRow(absItemDelegate); + + QStandardItem *itemDelegate = new QStandardItem; + itemDelegate->setText(QString("QItemDelegate")); + absItemDelegate->appendRow(itemDelegate); + + QStandardItem *sqlRelationalDelegate = new QStandardItem; + sqlRelationalDelegate->setText(QString("QSqlRelationalDelegate")); + itemDelegate->appendRow(sqlRelationalDelegate); + + //________________________________________ + + QStandardItem *layoutItem = new QStandardItem; + layoutItem->setText(QString("QLayoutItem")); + model->appendRow(layoutItem); + + QStandardItem *layout = new QStandardItem; + layout->setText(QString("QLayout")); + layoutItem->appendRow(layout); + + QStandardItem *boxLayout = new QStandardItem; + boxLayout->setText(QString("QBoxLayout")); + layout->appendRow(boxLayout); + + QStandardItem *hBoxLayout = new QStandardItem; + hBoxLayout->setText(QString("QHBoxLayout")); + boxLayout->appendRow(hBoxLayout); + + QStandardItem *vBoxLayout = new QStandardItem; + vBoxLayout->setText(QString("QVBoxLayout")); + boxLayout->appendRow(vBoxLayout); + + QStandardItem *gridLayout = new QStandardItem; + gridLayout->setText(QString("QGridLayout")); + layout->appendRow(gridLayout); + + QStandardItem *stackedLayout = new QStandardItem; + stackedLayout->setText(QString("QStackedLayout")); + layout->appendRow(stackedLayout); + + QStandardItem *spacerItem = new QStandardItem; + spacerItem->setText(QString("QSpacerItem")); + layoutItem->appendRow(spacerItem); + + QStandardItem *widgetItem = new QStandardItem; + widgetItem->setText(QString("QWidgetItem")); + layoutItem->appendRow(widgetItem); + + //________________________________________ + + QStandardItem *axBase = new QStandardItem; + axBase->setText(QString("QAxBase")); + model->appendRow(axBase); + + QStandardItem *axWidget = new QStandardItem; + axWidget->setText(QString("QAxWidget")); + axBase->appendRow(axWidget); + + QStandardItem *axObject = new QStandardItem; + axObject->setText(QString("QAxObject")); + axBase->appendRow(axObject); + + QStandardItem *axScriptEngine = new QStandardItem; + axScriptEngine->setText(QString("QAxScriptEngine")); + axObject->appendRow(axScriptEngine); + + //________________________________________ + + QStandardItem *absFormBuilder = new QStandardItem; + absFormBuilder->setText(QString("QAbstractFormBuilder")); + model->appendRow(absFormBuilder); + + QStandardItem *formBuilder = new QStandardItem; + formBuilder->setText(QString("QFormBuilder")); + absFormBuilder->appendRow(formBuilder); + + //________________________________________ + + QStandardItem *domNote = new QStandardItem; + domNote->setText(QString("QDomNote")); + model->appendRow(domNote); + + QStandardItem *domCharData = new QStandardItem; + domCharData->setText(QString("QDomCharacterData")); + domNote->appendRow(domCharData); + + QStandardItem *domText = new QStandardItem; + domText->setText(QString("QDomText")); + domCharData->appendRow(domText); + + QStandardItem *domCDATASection = new QStandardItem; + domCDATASection->setText(QString("QDomCDATASection")); + domText->appendRow(domCDATASection); + + QStandardItem *domComment = new QStandardItem; + domComment->setText(QString("QDomComment")); + domCharData->appendRow(domComment); + + QStandardItem *domAttr = new QStandardItem; + domAttr->setText(QString("QDomAttr")); + domNote->appendRow(domAttr); + + QStandardItem *domDoc = new QStandardItem; + domDoc->setText(QString("QDomDocument")); + domNote->appendRow(domDoc); + + QStandardItem *domDocFrag = new QStandardItem; + domDocFrag->setText(QString("QDomDocumentFragment")); + domNote->appendRow(domDocFrag); + + QStandardItem *domDocType = new QStandardItem; + domDocType->setText(QString("QDomDocumentType")); + domNote->appendRow(domDocType); + + QStandardItem *domElement = new QStandardItem; + domElement->setText(QString("QDomElement")); + domNote->appendRow(domElement); + + QStandardItem *domEntity = new QStandardItem; + domEntity->setText(QString("QDomEntity")); + domNote->appendRow(domEntity); + + QStandardItem *domEntityRef = new QStandardItem; + domEntityRef->setText(QString("QDomEntityReference")); + domNote->appendRow(domEntityRef); + + QStandardItem *domNotation = new QStandardItem; + domNotation->setText(QString("QDomNotation")); + domNote->appendRow(domNotation); + + QStandardItem *domProcInst = new QStandardItem; + domProcInst->setText(QString("QDomProcessingInstruction")); + domNote->appendRow(domProcInst); + + //________________________________________ + + QStandardItem *xmlContentHandler = new QStandardItem; + xmlContentHandler->setText(QString("QXmlContentHandler")); + model->appendRow(xmlContentHandler); + + QStandardItem *xmlDTDHandler = new QStandardItem; + xmlDTDHandler->setText(QString("QXmlDTDHandler")); + model->appendRow(xmlDTDHandler); + + QStandardItem *xmlDecHandler = new QStandardItem; + xmlDecHandler->setText(QString("QXmlDecHandler")); + model->appendRow(xmlDecHandler); + + QStandardItem *xmlEntityHandler = new QStandardItem; + xmlEntityHandler->setText(QString("QXmlEntityHandler")); + model->appendRow(xmlEntityHandler); + + QStandardItem *xmlErrorHandler = new QStandardItem; + xmlErrorHandler->setText(QString("QXmlErrorHandler")); + model->appendRow(xmlErrorHandler); + + QStandardItem *xmlLexicalHandler = new QStandardItem; + xmlLexicalHandler->setText(QString("QXmlLexicalHandler")); + model->appendRow(xmlLexicalHandler); + + QStandardItem *xmlDefaultHandler = new QStandardItem; + xmlDefaultHandler->setText(QString("QXmlDefaultHandler")); + xmlContentHandler->appendRow(xmlDefaultHandler); + + //________________________________________ + + QStandardItem *xmlReader = new QStandardItem; + xmlReader->setText(QString("QXmlReader")); + model->appendRow(xmlReader); + + QStandardItem *xmlSimpleReader = new QStandardItem; + xmlSimpleReader->setText(QString("QXmlSimpleReader")); + xmlReader->appendRow(xmlSimpleReader); + + //________________________________________ + + QStandardItem *absFileEngine = new QStandardItem; + absFileEngine->setText(QString("QAbstractFileEngine")); + model->appendRow(absFileEngine); + + QStandardItem *fsFileEngine = new QStandardItem; + fsFileEngine->setText(QString("QFSFileEngine")); + absFileEngine->appendRow(fsFileEngine); + + //________________________________________ + + QStandardItem *genArg = new QStandardItem; + genArg->setText(QString("QGenericArgument")); + model->appendRow(genArg); + + QStandardItem *genRetArg = new QStandardItem; + genRetArg->setText(QString("QGenericReturnArgument")); + genArg->appendRow(genRetArg); + + //________________________________________ + + QStandardItem *textStream = new QStandardItem; + textStream->setText(QString("QTextStream")); + model->appendRow(textStream); + + QStandardItem *textIStream = new QStandardItem; + textIStream->setText(QString("QTextIStream")); + textStream->appendRow(textIStream); + + QStandardItem *textOStream = new QStandardItem; + textOStream->setText(QString("QTextOStream")); + textStream->appendRow(textOStream); + + //________________________________________ + + QStandardItem *screen = new QStandardItem; + screen->setText(QString("QScreen")); + model->appendRow(screen); + + QStandardItem *vncScreen = new QStandardItem; + vncScreen->setText(QString("QVNCScreen")); + screen->appendRow(vncScreen); + + //________________________________________ + + QStandardItem *wsMouseHandler = new QStandardItem; + wsMouseHandler->setText(QString("QWSMouseHandler")); + model->appendRow(wsMouseHandler); + + QStandardItem *calWsMouseHandler = new QStandardItem; + calWsMouseHandler->setText(QString("QWSCalibratedMouseHandler")); + wsMouseHandler->appendRow(calWsMouseHandler); + + //________________________________________ + + QStandardItem *painter = new QStandardItem; + painter->setText(QString("QPainter")); + model->appendRow(painter); + + QStandardItem *sPainter = new QStandardItem; + sPainter->setText(QString("QStylePainter")); + painter->appendRow(sPainter); + + //________________________________________ + + QStandardItem *paintEngine = new QStandardItem; + paintEngine->setText(QString("QPaintEngine")); + model->appendRow(paintEngine); + + + QStandardItem *paintREngine = new QStandardItem; + paintREngine->setText(QString("QRasterPaintEngine")); + paintEngine->appendRow(paintREngine); + + //________________________________________ + + QStandardItem *palette = new QStandardItem; + palette->setText(QString("QPalette")); + model->appendRow(palette); + + QStandardItem *colorGroup = new QStandardItem; + colorGroup->setText(QString("QColorGroup")); + palette->appendRow(colorGroup); + + //________________________________________ + + QStandardItem *qevent = new QStandardItem; + qevent->setText(QString("QEvent")); + model->appendRow(qevent); + + return model; +} + +QStandardItemModel *ModelFactory::populateTreeModelSimple() +{ + QStandardItemModel* model = new QStandardItemModel(); + + // ===================================================================== + // Depth 1 + // ===================================================================== + QStandardItem *depth1_parent0 = new QStandardItem(QString("Lock")); + QStandardItem *depth1_parent1 = new QStandardItem(QString("Settings")); + QStandardItem *depth1_parent2 = new QStandardItem(QString("Handler")); + QStandardItem *depth1_parent3 = new QStandardItem(QString("Notifier")); + QStandardItem *depth1_parent4 = new QStandardItem(QString("Properties")); + QStandardItem *depth1_parent5 = new QStandardItem(QString("Repository")); + QStandardItem *depth1_parent6 = new QStandardItem(QString("Other")); + QStandardItem *depth1_parent7 = new QStandardItem(QString("KeyLockPolicy")); + QStandardItem *depth1_parent8 = new QStandardItem(QString("Schedule")); + QStandardItem *depth1_parent9 = new QStandardItem(QString("Settings2")); + + depth1_parent0->setData(Hb::ParentItem, Hb::ItemTypeRole); + depth1_parent1->setData(Hb::ParentItem, Hb::ItemTypeRole); + depth1_parent2->setData(Hb::ParentItem, Hb::ItemTypeRole); + depth1_parent3->setData(Hb::ParentItem, Hb::ItemTypeRole); + depth1_parent4->setData(Hb::ParentItem, Hb::ItemTypeRole); + depth1_parent5->setData(Hb::ParentItem, Hb::ItemTypeRole); + depth1_parent6->setData(Hb::ParentItem, Hb::ItemTypeRole); + depth1_parent7->setData(Hb::ParentItem, Hb::ItemTypeRole); + depth1_parent8->setData(Hb::ParentItem, Hb::ItemTypeRole); + depth1_parent9->setData(Hb::ParentItem, Hb::ItemTypeRole); + + model->setItem(0,0,depth1_parent0); + model->setItem(1,0,depth1_parent1); + model->setItem(2,0,depth1_parent2); + model->setItem(3,0,depth1_parent3); + model->setItem(4,0,depth1_parent4); + model->setItem(5,0,depth1_parent5); + model->setItem(6,0,depth1_parent6); + model->setItem(7,0,depth1_parent7); + model->setItem(8,0,depth1_parent8); + model->setItem(9,0,depth1_parent9); + + + RDebug::Printf( "%s %s (%u) Lock depth2-0=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, 0 ); + QStandardItem *depth2_item00 = new QStandardItem(QString("00:xxx")); + QStandardItem *depth2_item01 = new QStandardItem(QString("01:DeviceLockOff")); + QStandardItem *depth2_item02 = new QStandardItem(QString("02:KeyguardOn+Note")); + QStandardItem *depth2_item03 = new QStandardItem(QString("03:KeyguardOff")); + QStandardItem *depth2_item04 = new QStandardItem(QString("04:OfferDevicelock")); + QStandardItem *depth2_item05 = new QStandardItem(QString("05:KeyguardOn-Note")); + QStandardItem *depth2_item06 = new QStandardItem(QString("06:Wait20-DeviceLockOff")); + QStandardItem *depth2_item07 = new QStandardItem(QString("07:Wait20-KeyguardOff")); + QStandardItem *depth2_item08 = new QStandardItem(QString("08:Wait20-ShowKeysLockedNote")); + QStandardItem *depth2_item09 = new QStandardItem(QString("09:DeviceLockOn")); + + depth1_parent0->setChild(0, 0, depth2_item00); + depth1_parent0->setChild(1, 0, depth2_item01); + depth1_parent0->setChild(2, 0, depth2_item02); + depth1_parent0->setChild(3, 0, depth2_item03); + depth1_parent0->setChild(4, 0, depth2_item04); + depth1_parent0->setChild(5, 0, depth2_item05); + depth1_parent0->setChild(6, 0, depth2_item06); + depth1_parent0->setChild(7, 0, depth2_item07); + depth1_parent0->setChild(8, 0, depth2_item08); + depth1_parent0->setChild(9, 0, depth2_item09); + + RDebug::Printf( "%s %s (%u) Settings depth2-1=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, 0 ); + QStandardItem *depth2_item10 = new QStandardItem(QString("10:Call1")); + QStandardItem *depth2_item11 = new QStandardItem(QString("11:ChangePinL")); + QStandardItem *depth2_item12 = new QStandardItem(QString("12:IsLockEnabledL")); + QStandardItem *depth2_item13 = new QStandardItem(QString("13:AskSecCodeL")); + QStandardItem *depth2_item14 = new QStandardItem(QString("14:AskPin2L")); + QStandardItem *depth2_item15 = new QStandardItem(QString("15:GetFdnMode")); + QStandardItem *depth2_item16 = new QStandardItem(QString("16:IsUpinBlocked")); + QStandardItem *depth2_item17 = new QStandardItem(QString("17:ChangeSecCodeL")); + QStandardItem *depth2_item18 = new QStandardItem(QString("18:ChangeAutoLockPeriodL=30")); + QStandardItem *depth2_item19 = new QStandardItem(QString("19:ChangeAutoLockPeriodL=0")); + + depth1_parent1->setChild(0, 0, depth2_item10); + depth1_parent1->setChild(1, 0, depth2_item11); + depth1_parent1->setChild(2, 0, depth2_item12); + depth1_parent1->setChild(3, 0, depth2_item13); + depth1_parent1->setChild(4, 0, depth2_item14); + depth1_parent1->setChild(5, 0, depth2_item15); + depth1_parent1->setChild(6, 0, depth2_item16); + depth1_parent1->setChild(7, 0, depth2_item17); + depth1_parent1->setChild(8, 0, depth2_item18); + depth1_parent1->setChild(9, 0, depth2_item19); + + RDebug::Printf( "%s %s (%u) Handler depth2-2=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, 0 ); + QStandardItem *depth2_item20 = new QStandardItem(QString("20:Notif.EPin1Required")); + QStandardItem *depth2_item21 = new QStandardItem(QString("21:EPin1Required")); + QStandardItem *depth2_item22 = new QStandardItem(QString("22:EPin2Required")); + QStandardItem *depth2_item23 = new QStandardItem(QString("23:EPhonePasswordRequired")); + QStandardItem *depth2_item24 = new QStandardItem(QString("24:EPuk1Required")); + QStandardItem *depth2_item25 = new QStandardItem(QString("25:EPuk2Required")); + QStandardItem *depth2_item26 = new QStandardItem(QString("26:EUniversalPinRequired")); + QStandardItem *depth2_item27 = new QStandardItem(QString("27:EUniversalPukRequired")); + QStandardItem *depth2_item28 = new QStandardItem(QString("28:xxx")); + QStandardItem *depth2_item29 = new QStandardItem(QString("29:xxx")); + + depth1_parent2->setChild(0, 0, depth2_item20); + depth1_parent2->setChild(1, 0, depth2_item21); + depth1_parent2->setChild(2, 0, depth2_item22); + depth1_parent2->setChild(3, 0, depth2_item23); + depth1_parent2->setChild(4, 0, depth2_item24); + depth1_parent2->setChild(5, 0, depth2_item25); + depth1_parent2->setChild(6, 0, depth2_item26); + depth1_parent2->setChild(7, 0, depth2_item27); + depth1_parent2->setChild(8, 0, depth2_item28); + depth1_parent2->setChild(9, 0, depth2_item29); + + RDebug::Printf( "%s %s (%u) Notifier depth2-3=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, 0 ); + QStandardItem *depth2_item30 = new QStandardItem(QString("30:Op.0")); + QStandardItem *depth2_item31 = new QStandardItem(QString("31:EPin1Required")); + QStandardItem *depth2_item32 = new QStandardItem(QString("32:EPin2Required")); + QStandardItem *depth2_item33 = new QStandardItem(QString("33:EPhonePasswordRequired")); + QStandardItem *depth2_item34 = new QStandardItem(QString("34:EPuk1Required")); + QStandardItem *depth2_item35 = new QStandardItem(QString("35:EPuk2Required")); + QStandardItem *depth2_item36 = new QStandardItem(QString("36:EUniversalPinRequired")); + QStandardItem *depth2_item37 = new QStandardItem(QString("37:EUniversalPukRequired")); + QStandardItem *depth2_item38 = new QStandardItem(QString("38:Op.0x222")); + QStandardItem *depth2_item39 = new QStandardItem(QString("39:Op.0")); + + depth1_parent3->setChild(0, 0, depth2_item30); + depth1_parent3->setChild(1, 0, depth2_item31); + depth1_parent3->setChild(2, 0, depth2_item32); + depth1_parent3->setChild(3, 0, depth2_item33); + depth1_parent3->setChild(4, 0, depth2_item34); + depth1_parent3->setChild(5, 0, depth2_item35); + depth1_parent3->setChild(6, 0, depth2_item36); + depth1_parent3->setChild(7, 0, depth2_item37); + depth1_parent3->setChild(8, 0, depth2_item38); + depth1_parent3->setChild(9, 0, depth2_item39); + + RDebug::Printf( "%s %s (%u) Properties depth2-4=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, 0 ); + QStandardItem *depth2_item40 = new QStandardItem(QString("40:KAknKeyguardStatus=8")); + QStandardItem *depth2_item41 = new QStandardItem(QString("41:Pass=1234")); + QStandardItem *depth2_item42 = new QStandardItem(QString("42:Pass=12345")); + QStandardItem *depth2_item43 = new QStandardItem(QString("43:Pass=20499")); + QStandardItem *depth2_item44 = new QStandardItem(QString("44:Read-Prop")); + QStandardItem *depth2_item45 = new QStandardItem(QString("45:Read-Prop8")); + QStandardItem *depth2_item46 = new QStandardItem(QString("46:Stop-Prop8")); + QStandardItem *depth2_item47 = new QStandardItem(QString("47:EAutolockOff")); + QStandardItem *depth2_item48 = new QStandardItem(QString("48:EManualLocked")); + QStandardItem *depth2_item49 = new QStandardItem(QString("49:Uninitialized")); + + depth1_parent4->setChild(0, 0, depth2_item40); + depth1_parent4->setChild(1, 0, depth2_item41); + depth1_parent4->setChild(2, 0, depth2_item42); + depth1_parent4->setChild(3, 0, depth2_item43); + depth1_parent4->setChild(4, 0, depth2_item44); + depth1_parent4->setChild(5, 0, depth2_item45); + depth1_parent4->setChild(6, 0, depth2_item46); + depth1_parent4->setChild(7, 0, depth2_item47); + depth1_parent4->setChild(8, 0, depth2_item48); + depth1_parent4->setChild(9, 0, depth2_item49); + + RDebug::Printf( "%s %s (%u) Repository depth2-5=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, 0 ); + QStandardItem *depth2_item50 = new QStandardItem(QString("50:KeyguardTime=0s")); + QStandardItem *depth2_item51 = new QStandardItem(QString("51:KeyguardTime=10s")); + QStandardItem *depth2_item52 = new QStandardItem(QString("52:KeyguardTime=30s")); + QStandardItem *depth2_item53 = new QStandardItem(QString("53:KeyguardT=10+60s")); + QStandardItem *depth2_item54 = new QStandardItem(QString("54:AutoLockTime=0m")); + QStandardItem *depth2_item55 = new QStandardItem(QString("55:AutoLockTime=1m")); + QStandardItem *depth2_item56 = new QStandardItem(QString("56:AutoLockTime=2m")); + QStandardItem *depth2_item57 = new QStandardItem(QString("57:AutoLockT=65535m")); + QStandardItem *depth2_item58 = new QStandardItem(QString("58:read")); + QStandardItem *depth2_item59 = new QStandardItem(QString("59:xxx")); + + depth1_parent5->setChild(0, 0, depth2_item50); + depth1_parent5->setChild(1, 0, depth2_item51); + depth1_parent5->setChild(2, 0, depth2_item52); + depth1_parent5->setChild(3, 0, depth2_item53); + depth1_parent5->setChild(4, 0, depth2_item54); + depth1_parent5->setChild(5, 0, depth2_item55); + depth1_parent5->setChild(6, 0, depth2_item56); + depth1_parent5->setChild(7, 0, depth2_item57); + depth1_parent5->setChild(8, 0, depth2_item58); + depth1_parent5->setChild(9, 0, depth2_item59); + + RDebug::Printf( "%s %s (%u) Other depth2-6=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, 0 ); + QStandardItem *depth2_item60 = new QStandardItem(QString("60:Wait30+Cancel_P&S")); + QStandardItem *depth2_item61 = new QStandardItem(QString("61:Cancel_P&S")); + QStandardItem *depth2_item62 = new QStandardItem(QString("62:TSecUi::InitializeLibL")); + QStandardItem *depth2_item63 = new QStandardItem(QString("63:TSecUi::UnInitializeLib")); + QStandardItem *depth2_item64 = new QStandardItem(QString("64:Wait30+CancelSecCodeQuery")); + QStandardItem *depth2_item65 = new QStandardItem(QString("65:CancelSecCodeQuery")); + QStandardItem *depth2_item66 = new QStandardItem(QString("66:EStdKeyDeviceF")); + QStandardItem *depth2_item67 = new QStandardItem(QString("67:EKeyDeviceF")); + QStandardItem *depth2_item68 = new QStandardItem(QString("68:EKeyBell")); + QStandardItem *depth2_item69 = new QStandardItem(QString("69:Stop-iPeriodicExt")); + + depth1_parent6->setChild(0, 0, depth2_item60); + depth1_parent6->setChild(1, 0, depth2_item61); + depth1_parent6->setChild(2, 0, depth2_item62); + depth1_parent6->setChild(3, 0, depth2_item63); + depth1_parent6->setChild(4, 0, depth2_item64); + depth1_parent6->setChild(5, 0, depth2_item65); + depth1_parent6->setChild(6, 0, depth2_item66); + depth1_parent6->setChild(7, 0, depth2_item67); + depth1_parent6->setChild(8, 0, depth2_item68); + depth1_parent6->setChild(9, 0, depth2_item69); + + RDebug::Printf( "%s %s (%u) KeyLockPolicy depth2-7=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, 0 ); + QStandardItem *depth2_item70 = new QStandardItem(QString("70:KeyguardAllowed?")); + QStandardItem *depth2_item71 = new QStandardItem(QString("71:EnableKeyguardFeature")); + QStandardItem *depth2_item72 = new QStandardItem(QString("72:DisableKeyguardFeature")); + QStandardItem *depth2_item73 = new QStandardItem(QString("73:ShowErrorCodes")); + QStandardItem *depth2_item74 = new QStandardItem(QString("74:Expiration+Consecutive")); + QStandardItem *depth2_item75 = new QStandardItem(QString("75:Minlength+SpecificStrings")); + QStandardItem *depth2_item76 = new QStandardItem(QString("76:Chars_Numbers")); + QStandardItem *depth2_item77 = new QStandardItem(QString("77:xxx")); + QStandardItem *depth2_item78 = new QStandardItem(QString("78:xxx")); + QStandardItem *depth2_item79 = new QStandardItem(QString("79:xxx")); + + depth1_parent7->setChild(0, 0, depth2_item70); + depth1_parent7->setChild(1, 0, depth2_item71); + depth1_parent7->setChild(2, 0, depth2_item72); + depth1_parent7->setChild(3, 0, depth2_item73); + depth1_parent7->setChild(4, 0, depth2_item74); + depth1_parent7->setChild(5, 0, depth2_item75); + depth1_parent7->setChild(6, 0, depth2_item76); + depth1_parent7->setChild(7, 0, depth2_item77); + depth1_parent7->setChild(8, 0, depth2_item78); + depth1_parent7->setChild(9, 0, depth2_item79); + + RDebug::Printf( "%s %s (%u) Schedule depth2-8=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, 0 ); + QStandardItem *depth2_item80 = new QStandardItem(QString("80:xxxx")); + QStandardItem *depth2_item81 = new QStandardItem(QString("81:xxx")); + QStandardItem *depth2_item82 = new QStandardItem(QString("82:xxx")); + QStandardItem *depth2_item83 = new QStandardItem(QString("83:xxx")); + QStandardItem *depth2_item84 = new QStandardItem(QString("84:xxx")); + QStandardItem *depth2_item85 = new QStandardItem(QString("85:xxx")); + QStandardItem *depth2_item86 = new QStandardItem(QString("86:xxx")); + QStandardItem *depth2_item87 = new QStandardItem(QString("87:xxx")); + QStandardItem *depth2_item88 = new QStandardItem(QString("88:xxx")); + QStandardItem *depth2_item89 = new QStandardItem(QString("89:xxx")); + + depth1_parent8->setChild(0, 0, depth2_item80); + depth1_parent8->setChild(1, 0, depth2_item81); + depth1_parent8->setChild(2, 0, depth2_item82); + depth1_parent8->setChild(3, 0, depth2_item83); + depth1_parent8->setChild(4, 0, depth2_item84); + depth1_parent8->setChild(5, 0, depth2_item85); + depth1_parent8->setChild(6, 0, depth2_item86); + depth1_parent8->setChild(7, 0, depth2_item87); + depth1_parent8->setChild(8, 0, depth2_item88); + depth1_parent8->setChild(9, 0, depth2_item89); + + RDebug::Printf( "%s %s (%u) Settings2 depth2-9=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, 0 ); + QStandardItem *depth2_item90 = new QStandardItem(QString("90:ChangeSimSecurityL")); + QStandardItem *depth2_item91 = new QStandardItem(QString("91:ChangePinRequestL")); + QStandardItem *depth2_item92 = new QStandardItem(QString("92:ChangeUPinRequestL")); + QStandardItem *depth2_item93 = new QStandardItem(QString("93:SwitchPinCodesL")); + QStandardItem *depth2_item94 = new QStandardItem(QString("94:ChangePin2L")); + QStandardItem *depth2_item95 = new QStandardItem(QString("95:SwitchPinCodesL")); + QStandardItem *depth2_item96 = new QStandardItem(QString("96:ChangeRemoteLockStatusL")); + QStandardItem *depth2_item97 = new QStandardItem(QString("97:ChangeRLStat-0")); + QStandardItem *depth2_item98 = new QStandardItem(QString("98:ChangeRLStat-Off")); + QStandardItem *depth2_item99 = new QStandardItem(QString("99:xxx")); + + depth1_parent9->setChild(0, 0, depth2_item90); + depth1_parent9->setChild(1, 0, depth2_item91); + depth1_parent9->setChild(2, 0, depth2_item92); + depth1_parent9->setChild(3, 0, depth2_item93); + depth1_parent9->setChild(4, 0, depth2_item94); + depth1_parent9->setChild(5, 0, depth2_item95); + depth1_parent9->setChild(6, 0, depth2_item96); + depth1_parent9->setChild(7, 0, depth2_item97); + depth1_parent9->setChild(8, 0, depth2_item98); + depth1_parent9->setChild(9, 0, depth2_item99); + + return model; +} + +QStandardItemModel *ModelFactory::populateTreeModelSimpleOfSimplest() +{ + QStandardItemModel* model = new QStandardItemModel(); + + // ===================================================================== + // Depth 1 + // ===================================================================== + QStandardItem *depth1_item0 = new QStandardItem(QString("Leaf 0")); + //QStandardItem *depth1_item1 = new QStandardItem(QString("Leaf A-1")); + QStandardItem *depth1_parent0 = new QStandardItem(QString("Node A")); + QStandardItem *depth1_parent1 = new QStandardItem(QString("Node B")); + + depth1_parent0->setData(Hb::ParentItem, Hb::ItemTypeRole); + depth1_parent1->setData(Hb::ParentItem, Hb::ItemTypeRole); + + model->setItem(0,0,depth1_item0); + model->setItem(1,0,depth1_parent0); + model->setItem(2,0,depth1_parent1); + + // ===================================================================== + // Depth 2 + // ===================================================================== + QStandardItem *depth2_item0 = new QStandardItem(QString("Leaf A-1")); + QStandardItem *depth2_item1 = new QStandardItem(QString("Leaf A-2")); + QStandardItem *depth2_item2 = new QStandardItem(QString("Leaf B-1")); + /*QStandardItem *depth2_parent0 = new QStandardItem(QString("Node B-0")); + QStandardItem *depth2_parent1 = new QStandardItem(QString("Node B-1")); + QStandardItem *depth2_parent2 = new QStandardItem(QString("Node B-2")); + + depth2_parent0->setData(Hb::ParentItem, Hb::ItemTypeRole); + depth2_parent1->setData(Hb::ParentItem, Hb::ItemTypeRole); + depth2_parent2->setData(Hb::ParentItem, Hb::ItemTypeRole); +*/ + depth1_parent0->setChild(0,0,depth2_item0); + depth1_parent0->setChild(1, 0, depth2_item1); + depth1_parent1->setChild(0, 0, depth2_item2); +/* depth1_parent1->setChild(0, 0, depth2_parent1); + depth1_parent1->setChild(1, 0, depth2_parent2); + + // ===================================================================== + // Depth 3 + // ===================================================================== + QStandardItem *depth3_item0 = new QStandardItem(QString("Leaf C-0")); + QStandardItem *depth3_item1 = new QStandardItem(QString("Leaf C-1")); + QStandardItem *depth3_item2 = new QStandardItem(QString("Leaf C-2")); + QStandardItem *depth3_item3 = new QStandardItem(QString("Leaf C-3")); + QStandardItem *depth3_item4 = new QStandardItem(QString("Leaf C-4")); + QStandardItem *depth3_item5 = new QStandardItem(QString("Leaf C-5")); + + depth2_parent0->setChild(0, 0, depth3_item0); + depth2_parent0->setChild(1, 0, depth3_item1); + depth2_parent1->setChild(0, 0, depth3_item2); + depth2_parent2->setChild(0, 0, depth3_item3); + depth2_parent2->setChild(1, 0, depth3_item4); + depth2_parent2->setChild(2, 0, depth3_item5); +*/ + return model; +} + +QStandardItemModel *ModelFactory::populateGreenOddBrownEvenModel() +{ + QStandardItemModel* model = new QStandardItemModel(); + + // ===================================================================== + // Depth 1 + // ===================================================================== + + QStandardItem *depth1_item0 = new QStandardItem(); + QStringList data; + data << "Odd numbered items are green" << "Even numbered items are brown"; + depth1_item0->setData(QVariant(data), Qt::DisplayRole); + + QStandardItem *depth1_item1 = new QStandardItem(QString("1")); + QStandardItem *depth1_item2 = new QStandardItem(QString("Item 2")); + QStandardItem *depth1_item3 = new QStandardItem(QString("Item 3")); + QStandardItem *depth1_item4 = new QStandardItem(QString("4")); + QStandardItem *depth1_item5 = new QStandardItem(QString("5")); + QStandardItem *depth1_parent0 = new QStandardItem(QString("Parent 1")); + QStandardItem *depth1_parent1 = new QStandardItem(QString("Parent 2")); + + depth1_parent0->setData(Hb::ParentItem, Hb::ItemTypeRole); + depth1_parent1->setData(Hb::ParentItem, Hb::ItemTypeRole); + + model->setItem(0,0,depth1_item0); + model->setItem(1,0,depth1_item1); + model->setItem(2,0,depth1_item2); + model->setItem(3,0,depth1_item3); + model->setItem(4,0,depth1_parent0); + model->setItem(5,0,depth1_parent1); + model->setItem(6,0,depth1_item4); + model->setItem(7,0,depth1_item5); + + // ===================================================================== + // Depth 2 + // ===================================================================== + QStandardItem *depth2_item0 = new QStandardItem(QString("11")); + QStandardItem *depth2_item1 = new QStandardItem(QString("12")); + QStandardItem *depth2_item2 = new QStandardItem(QString("Item 13")); + QStandardItem *depth2_item4 = new QStandardItem(QString("Item 14")); + QStandardItem *depth2_item5 = new QStandardItem(QString("15")); + QStandardItem *depth2_item6 = new QStandardItem(QString("16")); + QStandardItem *depth2_item7 = new QStandardItem(QString("17")); + QStandardItem *depth2_parent0 = new QStandardItem(QString("Parent 11")); + + depth2_parent0->setData(Hb::ParentItem, Hb::ItemTypeRole); + + depth1_parent0->setChild(0, 0, depth2_item0); + depth1_parent0->setChild(1, 0, depth2_item1); + depth1_parent0->setChild(2, 0, depth2_item2); + depth1_parent0->setChild(3, 0, depth2_parent0); + + depth1_parent1->setChild(0, 0, depth2_item4); + depth1_parent1->setChild(1, 0, depth2_item5); + depth1_parent1->setChild(2, 0, depth2_item6); + depth1_parent1->setChild(3, 0, depth2_item7); + + // ===================================================================== + // Depth 3 + // ===================================================================== + QStandardItem *depth3_item0 = new QStandardItem(QString("21")); + QStandardItem *depth3_item1 = new QStandardItem(QString("22")); + QStandardItem *depth3_item2 = new QStandardItem(QString("Item 23")); + QStandardItem *depth3_item3 = new QStandardItem(QString("Item 24")); + QStandardItem *depth3_item4 = new QStandardItem(QString("25")); + QStandardItem *depth3_item5 = new QStandardItem(QString("26")); + + depth2_parent0->setChild(0, 0, depth3_item0); + depth2_parent0->setChild(1, 0, depth3_item1); + depth2_parent0->setChild(2, 0, depth3_item2); + depth2_parent0->setChild(3, 0, depth3_item3); + depth2_parent0->setChild(4, 0, depth3_item4); + depth2_parent0->setChild(5, 0, depth3_item5); + + return model; +} + + +QStandardItemModel *ModelFactory::populateTreeModelDeep() +{ + QStandardItemModel* model = new QStandardItemModel(); + + QStandardItem *root = new QStandardItem; + model->setItem(0,0,root); + + QStandardItem *parent = root; + const int maxDeep = 50; + for (int current = 1; current <= maxDeep; ++current) { + parent->setData(Hb::ParentItem, Hb::ItemTypeRole); + parent->setText(QString("Parent %0").arg(current)); + + for (int current2 = 0; current2 < 5; ++current2) { + QStandardItem *item = new QStandardItem; + item->setText(QString("Item %0").arg(current2)); + parent->setChild(current2, 0, item); + } + for (int current2 = 5; current2 < 10; ++current2) { + QStandardItem *item = new QStandardItem; + item->setText(QString("Item %0").arg(current2)); + parent->setChild(current2, 0, item); + + QStandardItem *itemPrevious = item; + for (int current3 = current+1; current3 < maxDeep - (current2-5)*maxDeep/5; ++current3) { + itemPrevious->setData(Hb::ParentItem, Hb::ItemTypeRole); + QStandardItem *item2 = new QStandardItem; + item2->setText(QString("Folder %0").arg(current3)); + itemPrevious->setChild(0, 0, item2); + + QStandardItem *itemTemp = new QStandardItem; + itemTemp->setText(QString("Folder %0 item").arg(current3)); + itemPrevious->setChild(1, 0, itemTemp); + + itemPrevious = item2; + } + itemPrevious->setData(Hb::ParentItem, Hb::ItemTypeRole); + QStandardItem *itemTemp = new QStandardItem; + itemTemp->setText(QString("Folder 9 item")); + itemPrevious->setChild(0, 0, itemTemp); + } + + if(current < maxDeep) { + QStandardItem *item = new QStandardItem; + parent->setChild(10, 0, item); + parent = item; + } + } + return model; +} + +QStandardItemModel *ModelFactory::populateTreeModelFlat() +{ + QStandardItemModel* model = new QStandardItemModel(); + for (int i = 0; i < 1000; ++i) { + QStandardItem* item = new QStandardItem(QString("Item number %1").arg(i)); + model->appendRow(item); + } + return model; +} + +QStandardItemModel *ModelFactory::populateTreeModelMixed() +{ + QStandardItemModel* model = new QStandardItemModel(); + + QStandardItem *parent = model->invisibleRootItem(); + insertMixedItems(parent); + + for (int current = 1; current <= 10; ++current) { + QStandardItem *newParent = new QStandardItem; + parent->appendRow(newParent); + parent = newParent; + + parent->setData(Hb::ParentItem, Hb::ItemTypeRole); + parent->setText(QString("Parent %0").arg(current)); + + insertMixedItems(parent); + } + + return model; +} + + + diff -r 989397f9511c -r 67b3e3c1fc87 securitydialogs/SecUi/SecUiTestQt/modelfactory.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/securitydialogs/SecUi/SecUiTestQt/modelfactory.h Wed Oct 20 14:51:23 2010 +0300 @@ -0,0 +1,20 @@ +#ifndef MODELFACTORY_H +#define MODELFACTORY_H + +class QStandardItemModel; + +class ModelFactory +{ +public: + static QStandardItemModel *populateTreeModelDefault(); + static QStandardItemModel *populateTreeModelSimple(); + // for debugging: + static QStandardItemModel *populateTreeModelSimpleOfSimplest(); + static QStandardItemModel *populateTreeModelDeep(); + static QStandardItemModel *populateTreeModelFlat(); + static QStandardItemModel *populateTreeModelMail(); + static QStandardItemModel *populateTreeModelMixed(); + static QStandardItemModel *populateGreenOddBrownEvenModel(); +}; + +#endif // MODELFACTORY_H diff -r 989397f9511c -r 67b3e3c1fc87 securitydialogs/SecUi/SecUiTestQt/resources/empty.png Binary file securitydialogs/SecUi/SecUiTestQt/resources/empty.png has changed diff -r 989397f9511c -r 67b3e3c1fc87 securitydialogs/SecUi/SecUiTestQt/resources/generic.png Binary file securitydialogs/SecUi/SecUiTestQt/resources/generic.png has changed diff -r 989397f9511c -r 67b3e3c1fc87 securitydialogs/SecUi/SecUiTestQt/resources/list1.png Binary file securitydialogs/SecUi/SecUiTestQt/resources/list1.png has changed diff -r 989397f9511c -r 67b3e3c1fc87 securitydialogs/SecUi/SecUiTestQt/resources/qtg_fr_list_new_item_b.svg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/securitydialogs/SecUi/SecUiTestQt/resources/qtg_fr_list_new_item_b.svg Wed Oct 20 14:51:23 2010 +0300 @@ -0,0 +1,23 @@ + + + +]> + + + + + + + + + + + + + + + + diff -r 989397f9511c -r 67b3e3c1fc87 securitydialogs/SecUi/SecUiTestQt/resources/qtg_fr_list_new_item_c.svg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/securitydialogs/SecUi/SecUiTestQt/resources/qtg_fr_list_new_item_c.svg Wed Oct 20 14:51:23 2010 +0300 @@ -0,0 +1,25 @@ + + + +]> + + + + + + + + + + + + + + + + + + diff -r 989397f9511c -r 67b3e3c1fc87 securitydialogs/SecUi/SecUiTestQt/resources/qtg_fr_list_new_item_t.svg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/securitydialogs/SecUi/SecUiTestQt/resources/qtg_fr_list_new_item_t.svg Wed Oct 20 14:51:23 2010 +0300 @@ -0,0 +1,24 @@ + + + +]> + + + + + + + + + + + + + + + + + diff -r 989397f9511c -r 67b3e3c1fc87 securitydialogs/SecUi/SecUiTestQt/resources/qtg_nmailui_minus_sign.svg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/securitydialogs/SecUi/SecUiTestQt/resources/qtg_nmailui_minus_sign.svg Wed Oct 20 14:51:23 2010 +0300 @@ -0,0 +1,19 @@ + + + + + + + + + + + + + + + + + diff -r 989397f9511c -r 67b3e3c1fc87 securitydialogs/SecUi/SecUiTestQt/resources/qtg_nmailui_plus_sign.svg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/securitydialogs/SecUi/SecUiTestQt/resources/qtg_nmailui_plus_sign.svg Wed Oct 20 14:51:23 2010 +0300 @@ -0,0 +1,20 @@ + + + + + + + + + + + + + + + + + diff -r 989397f9511c -r 67b3e3c1fc87 securitydialogs/SecUi/SecUiTestQt/rom/SecUiTestQt.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/securitydialogs/SecUi/SecUiTestQt/rom/SecUiTestQt.iby Wed Oct 20 14:51:23 2010 +0300 @@ -0,0 +1,29 @@ +/* +* 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: +* +*/ +#ifndef __SECUITESTQT_IBY__ +#define __SECUITESTQT_IBY__ + +#include + +#define HB_UPGRADABLE_APP_REG_RSC(NAME) data=DATAZ_\PRIVATE\10003A3F\IMPORT\APPS\ ## NAME ## _reg.rsc Private\10003a3f\import\apps\ ## NAME ## _reg.rsc +#define HB_PLUGIN_STUB(NAME, SUBDIR) data=\epoc32\data\z\resource\plugins\##SUBDIR##\##NAME##.qtplugin RESOURCE_FILES_DIR\plugins\##SUBDIR##\##NAME##.qtplugin + +file=ABI_DIR\BUILD_DIR\SecUiTestQt.exe SHARED_LIB_DIR\SecUiTestQt.exe +HB_UPGRADABLE_APP_REG_RSC(SecUiTestQt) +S60_APP_RESOURCE(SecUiTestQt) + +#endif // __SECUITESTQT_IBY__ diff -r 989397f9511c -r 67b3e3c1fc87 securitydialogs/SecUi/SecUiTestQt/sceneitemlisthelper.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/securitydialogs/SecUi/SecUiTestQt/sceneitemlisthelper.h Wed Oct 20 14:51:23 2010 +0300 @@ -0,0 +1,57 @@ +// +// Little helper class for populating lists with Hb::SceneItems +// + +#ifndef SCENEITEMLISTHELPER_H +#define SCENEITEMLISTHELPER_H + +#include + +Q_DECLARE_METATYPE(Hb::SceneItem); + +static struct { Hb::SceneItem sceneItem; QString name; } listHelperSceneItems[] = + { + {Hb::NoItem, "NoItem"}, + {Hb::ToolBarItem, "ToolBarItem"}, + {Hb::AllItems, "AllItems"}, + }; + + +// +// SceneItemListHelper +// +class SceneItemListHelper +{ +public: + + static int sceneItemStringsCount(){ + return sizeof(listHelperSceneItems) / sizeof(listHelperSceneItems[0]); + } + + static void initListWidget(QListWidget *listWidget){ + for(int i = 0; i < SceneItemListHelper::sceneItemStringsCount(); i++ ) { + // create list widget item and store the sceneItem with the sceneItem name + QListWidgetItem* item = new QListWidgetItem(listHelperSceneItems[i].name); + item->setData(Qt::UserRole,QVariant::fromValue(listHelperSceneItems[i].sceneItem)); + item->setSelected( + listHelperSceneItems[i].sceneItem == Hb::NoItem ? + true : false); + + listWidget->addItem (item); + } + } + + static Hb::SceneItems sceneItems(const QListWidget *listwidget){ + Hb::SceneItems sceneItems = Hb::NoItem; + + for (int i = 0; i < listwidget->count(); i++) { + if (listwidget->item(i)->isSelected()) { + sceneItems |= listwidget->item(i)->data(Qt::UserRole).value(); + } + } + return sceneItems; + } +}; + +#endif //SCENEITEMLISTHELPER_H + diff -r 989397f9511c -r 67b3e3c1fc87 securitydialogs/SecUi/SecUiTestQt/shared.qrc --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/securitydialogs/SecUi/SecUiTestQt/shared.qrc Wed Oct 20 14:51:23 2010 +0300 @@ -0,0 +1,8 @@ + + + + resources/empty.png + resources/generic.png + resources/list1.png + + diff -r 989397f9511c -r 67b3e3c1fc87 securitydialogs/SecUi/SecUiTestQt/treedataform.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/securitydialogs/SecUi/SecUiTestQt/treedataform.cpp Wed Oct 20 14:51:23 2010 +0300 @@ -0,0 +1,184 @@ +/* +* ==================================================== +* Name : treedataform.cpp +* Part of : fute/SecUiTestQt +* Description : Data form for SecUiTestQt +* Version : %version: 1 % +* +* Copyright (c) 2009 Nokia. All rights reserved. +* This material, including documentation and any related computer +* programs, is protected by copyright controlled by Nokia. All +* rights are reserved. Copying, including reproducing, storing, +* adapting or translating, any or all of this material requires the +* prior written consent of Nokia. This material also contains +* confidential information which may not be disclosed to others +* without the prior written consent of Nokia. +* ==================================================== +*/ + +#include "treedataform.h" +#include "dirviewitem.h" +#include +#include +#include + +const QStringList KDepths = ( QStringList() << "1" << "3" << "5" << "all" ); +const QStringList ViewItems = (QStringList() << "Default" << "DirItem"); + +// ======== MEMBER FUNCTIONS ======== + +TreeDataForm::TreeDataForm( HbAbstractItemView &view, + QGraphicsItem *parent): + ViewFuteDataForm(view, parent), + depth(1), + indentation(-1), + dirViewItemEnabled(false) +{ +} + +TreeDataForm::~TreeDataForm() +{ +} + +void TreeDataForm::initialise() +{ + depth = 1; + dirViewItemEnabled = false; + for (int i=0; i< TreeCustomLast; i++) { + customTreeSettingsIndexes[i] = -1; + } + ViewFuteDataForm::initialise(); +} + +int TreeDataForm::populateCustomSettingsItem(int previousItem) +{ + HbTreeView *tree = qobject_cast(view); + HbTreeViewItem *prototype = qobject_cast(tree->itemPrototypes().first()); + + if (tree) { + if (previousItem == ViewFuteDataForm::ScrollHint) { + customTreeSettingsIndexes[Depth] = counter; + HbDataFormModelItem *item = settingsFormModel->appendDataFormItem( + HbDataFormModelItem::RadioButtonListItem, QString("Depth of visible tree:")); + item->setContentWidgetData("items", KDepths); + if (depth == 1) { + item->setContentWidgetData("selected", 0); + } else if (depth == 3) { + item->setContentWidgetData("selected", 1); + } else if (depth == 5) { + item->setContentWidgetData("selected", 2); + } else { + item->setContentWidgetData("selected", 3); + } + + customTreeSettingsIndexes[Indentation] = counter+1; + item = settingsFormModel->appendDataFormItem( + HbDataFormModelItem::TextItem, QString("Indentation: (negative sets default)")); + QString indentationString; + indentationString.setNum(indentation); + item->setContentWidgetData("text", indentationString); + + customTreeSettingsIndexes[ItemUserExpandable] = counter + 2; + item = settingsFormModel->appendDataFormItem( + HbDataFormModelItem::ToggleValueItem, QString("Items user expandable:")); + if (prototype->isUserExpandable()) { + item->setContentWidgetData("text", "On"); + item->setContentWidgetData("additionalText", "Off"); + } else { + item->setContentWidgetData("text", "Off"); + item->setContentWidgetData("additionalText", "On"); + } + return 3; + } else if ( previousItem == ViewFuteDataForm::FrictionEnabled + && dirViewItemEnabled) { + customTreeSettingsIndexes[ViewItemType] = counter; + HbDataFormModelItem *item = settingsFormModel->appendDataFormItem( + HbDataFormModelItem::RadioButtonListItem, QString("View item type:")); + item->setContentWidgetData("items", ViewItems); + if (qobject_cast(tree->itemPrototypes().first())) { + item->setContentWidgetData("selected", 1); + } else { + item->setContentWidgetData("selected", 0); + } + return 1; + } + } + return 0; +} + +void TreeDataForm::resolveSettingsResults() +{ + HbTreeView *tree = qobject_cast(view); + HbTreeViewItem *prototype = qobject_cast(tree->itemPrototypes().first()); + + if (tree) { + if (dirViewItemEnabled) { + if ( static_cast(itemByIndex(settingsFormModel->index(customTreeSettingsIndexes[ViewItemType],0)))-> + dataItemContentWidget()->property("selected").toInt() == 1) { + if (!qgraphicsitem_cast(tree->itemPrototypes().first())) { + DirViewItem *prototype = new DirViewItem; + tree->setItemPrototype(prototype); + tree->setLayoutName("treeviewitem_dir_button"); + } + } + else { + HbTreeViewItem *prototype = new HbTreeViewItem; + tree->setItemPrototype(prototype); + tree->setLayoutName("default"); + } + } + QString indentationString = static_cast(itemByIndex(settingsFormModel->index( + customTreeSettingsIndexes[Indentation],0)))->dataItemContentWidget()->property("text").toString(); + bool ok = false; + int newIndentation = indentationString.toInt(&ok); + if (ok) { + indentation = newIndentation; + } + tree->setIndentation(indentation); + + if (prototype) { + if (static_cast(itemByIndex(settingsFormModel->index( + customTreeSettingsIndexes[ItemUserExpandable],0)))->dataItemContentWidget()->property("text").toString() == "On") { + prototype->setUserExpandable(true); + } else { + prototype->setUserExpandable(false); + } + } + } + ViewFuteDataForm::resolveSettingsResults(); +} + + + +void TreeDataForm::setIndentation(int indentation) +{ + this->indentation = indentation; +} + + +void TreeDataForm::setDepth(int depth) +{ + this->depth = depth; +} + +void TreeDataForm::setDirViewItemEnabled(bool enable) +{ + dirViewItemEnabled = enable; +} + +int TreeDataForm::getDepth() const +{ + int selected = static_cast(itemByIndex(settingsFormModel->index(customTreeSettingsIndexes[Depth],0)))-> + dataItemContentWidget()->property("selected").toInt(); + if ( selected >= 0 + && selected < KDepths.count()) { + if (KDepths[selected] == KDepths[KDepths.count()-1]) { + return 999; + } else { + return KDepths[selected].toInt(); + } + } else { + return depth; + } +} + diff -r 989397f9511c -r 67b3e3c1fc87 securitydialogs/SecUi/SecUiTestQt/treedataform.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/securitydialogs/SecUi/SecUiTestQt/treedataform.h Wed Oct 20 14:51:23 2010 +0300 @@ -0,0 +1,63 @@ +/* +* ==================================================== +* Name : treedataform.h +* Part of : fute/SecUiTestQt +* Description : Provides DataForm for Tree +* Version : %version: 1 % +* +* Copyright (c) 2009 Nokia. All rights reserved. +* This material, including documentation and any related computer +* programs, is protected by copyright controlled by Nokia. All +* rights are reserved. Copying, including reproducing, storing, +* adapting or translating, any or all of this material requires the +* prior written consent of Nokia. This material also contains +* confidential information which may not be disclosed to others +* without the prior written consent of Nokia. +* ==================================================== +*/ + +#ifndef TREEDATAFORM_H +#define TREEDATAFORM_H + +#include "viewfutedataform.h" +#include + +class TreeDataForm : public ViewFuteDataForm +{ + Q_OBJECT + +public: + + enum CustomIndex { + ViewItemType = ViewFuteDataForm::SettingsIndexLast+1, + Depth, + Indentation, + ItemUserExpandable, + TreeCustomLast + }; + + explicit TreeDataForm(HbAbstractItemView &view, + QGraphicsItem *parent = 0); + virtual ~TreeDataForm(); + + virtual int populateCustomSettingsItem(int previousItem); + virtual void initialise(); + + virtual void resolveSettingsResults(); + void setDirViewItemEnabled(bool enable); + + void setDepth(int depth); + int getDepth() const; + + void setIndentation(int indentation); + + void setItemUserExpandable(bool value); + +private: + int customTreeSettingsIndexes[TreeCustomLast]; + int depth; + int indentation; + bool dirViewItemEnabled; +}; + +#endif // TREEDATAFORM_H diff -r 989397f9511c -r 67b3e3c1fc87 securitydialogs/SecUi/SecUiTestQt/viewfutedataform.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/securitydialogs/SecUi/SecUiTestQt/viewfutedataform.cpp Wed Oct 20 14:51:23 2010 +0300 @@ -0,0 +1,1390 @@ +/* +* ==================================================== +* Name : viewfutedataform.cpp +* Part of : fute/listdemo +* Description : Settings for listdemo, treedemo, griddemo +* Version : %version: 1 % +* +* Copyright (c) 2009 Nokia. All rights reserved. +* This material, including documentation and any related computer +* programs, is protected by copyright controlled by Nokia. All +* rights are reserved. Copying, including reproducing, storing, +* adapting or translating, any or all of this material requires the +* prior written consent of Nokia. This material also contains +* confidential information which may not be disclosed to others +* without the prior written consent of Nokia. +* ==================================================== +*/ + +#include "viewfutedataform.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +Q_DECLARE_METATYPE(QList) + +// Settings +const QStringList TextStyles = (QStringList() << "Primary" << "Secondary"); +const QStringList CustomWidgets = (QStringList() << "Empty" << "Zoom slider" << "Volume Slider" << "Progress bar" << "Button" << "Text Editor" ); +const QStringList OnOff = (QStringList() << "On" << "Off"); +const QStringList LaunchInPopups = (QStringList() << "Launch into popup" << "Launch into view") ; +const QStringList SelectionModes = (QStringList() << "Single selection" << "Multiple selection" << "No selection"); +const QStringList ScrollModes = (QStringList() << "Pan" << "Pan with follow on"); +const QStringList GraphicsSizes = (QStringList() << "Small icon" << "Medium icon" << "Large icon" << "Thumbnail" << "Wide thumbnail"); +const QStringList LandscapeModes = (QStringList() << "Normal" << "Stretched"); +const QStringList OrientationTypes = (QStringList() << "Portrait" << "Landscape"); +const QStringList ScrollHints = (QStringList() << "Just visible" << "At top" << "At bottom" << "At center" ); +const QStringList IndexFeedbackPolicies = (QStringList() << "None" << "One Char" << "Three Char" << "String" << "detatch" ); +const QStringList IconLoadPolicies = (QStringList() << "Synchronous" << "Asynchronous when scrolling" << "Asynchronous" ); + +// Add item +const QStringList LeftColumnWidgets = (QStringList() << "Empty" << "Icon"); +const QStringList RightColumnWidgets = (QStringList() << "Empty" << "Icon"); +const QStringList ItemBackgrounds = (QStringList() << "None" << "Red" << "Green" << "Blue" << "Bitmap" << "Frame"); +const QStringList ItemTypes = (QStringList() << "Normal" << "Separator"); +const QStringList AnimationList = (QStringList() << "Appear" << "Disappear" << "TouchDown"); + +const QStringList KConvenienceIcons = (QStringList() + << ":/demo/list1" +); + +ViewFuteDataForm::ViewFuteDataForm( HbAbstractItemView &view, + QGraphicsItem *parent): + HbDataForm(parent), + activity(None), + view(&view), + item(0), + mIndexFeedback(0) +{ + settingsFormModel = new HbDataFormModel(); + initialise(); +} + +ViewFuteDataForm::~ViewFuteDataForm() +{ + delete settingsFormModel; +} + +void ViewFuteDataForm::populateSettings() +{ + activity = Settings; + settingsFormModel->clear(); + + counter += populateCustomSettingsItem(-1); + + //populateLaunchInPopup(); + //counter += populateCustomSettingsItem(LaunchInPopup); + + populateSelectionMode(); + counter += populateCustomSettingsItem(SelectionMode); + + populateScrollHint(); + counter += populateCustomSettingsItem(ScrollHint); + + populateRecycling(); + counter += populateCustomSettingsItem(Recycling); + + populateArrangeMode(); + counter += populateCustomSettingsItem(ArrangeMode); + + populateUniformItem(); + counter += populateCustomSettingsItem(UniformItem); + + populateFrame(); + counter += populateCustomSettingsItem(Frame); + + populateRichText(); + counter += populateCustomSettingsItem(RichText); + + populateScrollingStyle(); + counter += populateCustomSettingsItem(ScrollingStyle); + + populateInteractiveScrollBar(); + counter += populateCustomSettingsItem(InteractiveScrollBar); + + populateClampingStyle(); + counter += populateCustomSettingsItem(ClampingStyle); + + populateFrictionEnabled(); + counter += populateCustomSettingsItem(FrictionEnabled); + + populateGraphicsSize(); + counter += populateCustomSettingsItem(GraphicsSize); + + populateStretchingStyle(); + counter += populateCustomSettingsItem(StretchingStyle); + + populateMaximumRowCount(); + counter += populateCustomSettingsItem(MaximumRowCount); + + populateMinimumRowCount(); + counter += populateCustomSettingsItem(MinimumRowCount); + + //populateMirroring(); + //counter += populateCustomSettingsItem(Mirroring); + + populateIndexFeedbackPolicy(); + counter += populateCustomSettingsItem(IndexFeedbackPolicy); +/* + populateEnabledAnimations(); + counter += populateCustomSettingsItem(Animations); +*/ + populatePixmapCacheEnabled(); + counter += populateCustomSettingsItem(PixmapCache); + + populateIconLoadPolicy(); + counter += populateCustomSettingsItem(IconLoadPolicy); + + setModel(settingsFormModel); +} + +void ViewFuteDataForm::setInputData( Activity action, + int item, + QVariant data) +{ + if ( item < 0 + || action == None + || ( ( action == Settings + && item >= SettingsIndexLast) + || ( action == AddItem + && item >= AddItemIndexLast))) { + return; + } + + if (action == Settings) { + settingsData[item] = data; + data.isValid(); + } + else if (action == AddItem) { + addItemData[item] = data; + } +} + + +int ViewFuteDataForm::populateCustomSettingsItem(int previousItem) +{ + Q_UNUSED(previousItem); + return 0; +} + +void ViewFuteDataForm::initialise() +{ + settingsFormModel->clear(); + counter=0; + for (int i=0; i< SettingsIndexLast; i++) { + settingsIndexes[i] = -1; + } + for (int i=0; i< AddItemIndexLast; i++) { + addItemIndexes[i] = -1; + } + for (int i=0; i< SettingsIndexLast; i++) { + settingsData[i] = QVariant(); + } + for (int i=0; i< AddItemIndexLast; i++) { + addItemData[i] = QVariant(); + } +} + +int ViewFuteDataForm::nextIndex() const +{ + return counter; +} + +ViewFuteDataForm::Activity ViewFuteDataForm::action() const +{ + return activity; +} + + +HbDataFormModel *ViewFuteDataForm::dataModel() const +{ + return settingsFormModel; +} + +void ViewFuteDataForm::populateGraphicsSize() +{ + HbListViewItem *prototype = qobject_cast(view->itemPrototypes().first()); + if ( prototype ) { + settingsIndexes[GraphicsSize] = counter++; + + HbDataFormModelItem *item = settingsFormModel->appendDataFormItem(HbDataFormModelItem::RadioButtonListItem, + QString("Graphics size:")); + + item->setContentWidgetData("items", GraphicsSizes); + + HbListViewItem::GraphicsSize graphicsSize = prototype->graphicsSize(); + if (graphicsSize == HbListViewItem::SmallIcon) { + item->setContentWidgetData("selected", 0); + } else if (graphicsSize == HbListViewItem::MediumIcon) { + item->setContentWidgetData("selected", 1); + } else if (graphicsSize == HbListViewItem::LargeIcon) { + item->setContentWidgetData("selected", 2); + } else if (graphicsSize == HbListViewItem::Thumbnail) { + item->setContentWidgetData("selected", 3); + } else { + item->setContentWidgetData("selected", 4); + } + } +} + +void ViewFuteDataForm::populateStretchingStyle() +{ + HbListViewItem *prototype = qobject_cast(view->itemPrototypes().first()); + if ( prototype ) { + settingsIndexes[StretchingStyle] = counter++; + + HbDataFormModelItem *item = settingsFormModel->appendDataFormItem(HbDataFormModelItem::RadioButtonListItem, + QString("Landscape mode:")); + + item->setContentWidgetData("items", LandscapeModes); + if (prototype->stretchingStyle() == HbListViewItem::StretchLandscape) { + item->setContentWidgetData("selected", 1); + } else { + item->setContentWidgetData("selected", 0); + } + } +} + +void ViewFuteDataForm::populateMaximumRowCount() +{ + HbListViewItem *prototype = qobject_cast(view->itemPrototypes().first()); + if ( prototype ) { + settingsIndexes[MaximumRowCount] = counter++; + + HbDataFormModelItem *item = settingsFormModel->appendDataFormItem(HbDataFormModelItem::SliderItem, + QString("Max secondary text rows:")); + + int maximum = 0; + int minimum = 0; + prototype->getSecondaryTextRowCount(minimum, maximum); + + item->setContentWidgetData("value", maximum); + item->setContentWidgetData("maximum", 10); + item->setContentWidgetData("minimum", 1); + item->setContentWidgetData("tickPosition", Hb::SliderTicksBelow); + item->setContentWidgetData("majorTickInterval",1); + + // does not work + /*QStringList values; + values << "1" << "2" << "3" << "4" << "5" << "6" << "7" << "8" << "9" << "10"; + item->setContentWidgetData("majorTickLabels",values);*/ + } +} + +void ViewFuteDataForm::populateMinimumRowCount() +{ + HbListViewItem *prototype = qobject_cast(view->itemPrototypes().first()); + if ( prototype ) { + settingsIndexes[MinimumRowCount] = counter++; + + HbDataFormModelItem *item = settingsFormModel->appendDataFormItem(HbDataFormModelItem::SliderItem, + QString("Min secondary text rows:")); + + int maximum = 0; + int minimum = 0; + prototype->getSecondaryTextRowCount(minimum, maximum); + + item->setContentWidgetData("value", minimum); + item->setContentWidgetData("maximum", 10); + item->setContentWidgetData("minimum", 1); + item->setContentWidgetData("tickPosition", Hb::SliderTicksBelow); + item->setContentWidgetData("majorTickInterval",1); + } +} + +void ViewFuteDataForm::populateFrame() +{ + settingsIndexes[Frame] = counter++; + HbAbstractViewItem *prototype = qobject_cast(view->itemPrototypes().first()); + const HbFrameBackground &frameBackground = prototype->defaultFrame(); + + HbDataFormModelItem *item = settingsFormModel->appendDataFormItem( + HbDataFormModelItem::ToggleValueItem, QString("Default frame:")); + if (frameBackground.isNull()) { + item->setContentWidgetData("text", "On"); + item->setContentWidgetData("additionalText", "Off"); + } else { + item->setContentWidgetData("text", "Off"); + item->setContentWidgetData("additionalText", "On"); + } +} + +void ViewFuteDataForm::populateRecycling() +{ + settingsIndexes[Recycling] = counter++; + HbDataFormModelItem *item = settingsFormModel->appendDataFormItem( + HbDataFormModelItem::ToggleValueItem, QString("Item recycling:")); + if (view->itemRecycling()) { + item->setContentWidgetData("text", "On"); + item->setContentWidgetData("additionalText", "Off"); + } else { + item->setContentWidgetData("text", "Off"); + item->setContentWidgetData("additionalText", "On"); + } +} + +void ViewFuteDataForm::populateUniformItem() +{ + HbListView *listView = qobject_cast(view); + if (listView) { + settingsIndexes[UniformItem] = counter++; + HbDataFormModelItem *item = settingsFormModel->appendDataFormItem( + HbDataFormModelItem::ToggleValueItem, QString("Uniform Items:")); + if (view->uniformItemSizes()) { + item->setContentWidgetData("text", "On"); + item->setContentWidgetData("additionalText", "Off"); + } else { + item->setContentWidgetData("text", "Off"); + item->setContentWidgetData("additionalText", "On"); + } + } +} + +void ViewFuteDataForm::populateRichText() +{ + HbListViewItem *prototype = qobject_cast(view->itemPrototypes().first()); + if (prototype) { + settingsIndexes[RichText] = counter++; + HbDataFormModelItem *item = settingsFormModel->appendDataFormItem( + HbDataFormModelItem::ToggleValueItem, QString("Rich text support:")); + if (prototype->textFormat() == Qt::RichText) { + item->setContentWidgetData("text", "On"); + item->setContentWidgetData("additionalText", "Off"); + } else { + item->setContentWidgetData("text", "Off"); + item->setContentWidgetData("additionalText", "On"); + } + } +} + +void ViewFuteDataForm::populateSelectionMode() +{ + settingsIndexes[SelectionMode] = counter++; + HbDataFormModelItem *item = settingsFormModel->appendDataFormItem( + HbDataFormModelItem::RadioButtonListItem, QString("Selection mode:")); + item->setContentWidgetData("items", SelectionModes); + if (view->selectionMode() == HbAbstractItemView::SingleSelection) { + item->setContentWidgetData("selected", 0); + } else if (view->selectionMode() == HbAbstractItemView::MultiSelection) { + item->setContentWidgetData("selected", 1); + } else { + item->setContentWidgetData("selected", 2); + } +} + + +void ViewFuteDataForm::populateLaunchInPopup() +{ + settingsIndexes[LaunchInPopup] = counter++; + HbDataFormModelItem *item = settingsFormModel->appendDataFormItem( + HbDataFormModelItem::RadioButtonListItem, QString("Launch target of next model:")); + item->setContentWidgetData("items", LaunchInPopups); + if ( settingsData[LaunchInPopup].isValid() + && settingsData[LaunchInPopup].canConvert(QVariant::Bool) + && settingsData[LaunchInPopup].toBool()) { + item->setContentWidgetData("selected", 0); + } else { + item->setContentWidgetData("selected", 1); + } +} + +void ViewFuteDataForm::populateArrangeMode() +{ + HbListView *listView = qobject_cast(view); + if (listView) { + settingsIndexes[ArrangeMode] = counter++; + HbDataFormModelItem *item = settingsFormModel->appendDataFormItem( + HbDataFormModelItem::ToggleValueItem, QString("Arrange mode:")); + if (listView->arrangeMode()) { + item->setContentWidgetData("text", "On"); + item->setContentWidgetData("additionalText", "Off"); + } else { + item->setContentWidgetData("text", "Off"); + item->setContentWidgetData("additionalText", "On"); + } + } +} + +void ViewFuteDataForm::populateScrollingStyle() +{ + settingsIndexes[ScrollingStyle] = counter++; + HbDataFormModelItem *item = settingsFormModel->appendDataFormItem( + HbDataFormModelItem::RadioButtonListItem, QString("Scroll mode:")); + item->setContentWidgetData("items", ScrollModes); + if (view->scrollingStyle() == HbScrollArea::Pan) { + item->setContentWidgetData("selected", 0); + } else { + item->setContentWidgetData("selected", 1); + } +} + +void ViewFuteDataForm::populateClampingStyle() +{ + settingsIndexes[ClampingStyle] = counter++; + HbDataFormModelItem *item = settingsFormModel->appendDataFormItem( + HbDataFormModelItem::ToggleValueItem, QString("List bounce clamping:")); + if (view->clampingStyle() == HbScrollArea::BounceBackClamping) { + item->setContentWidgetData("text", "On"); + item->setContentWidgetData("additionalText", "Off"); + } else { + item->setContentWidgetData("text", "Off"); + item->setContentWidgetData("additionalText", "On"); + } +} + +void ViewFuteDataForm::populateInteractiveScrollBar() +{ + settingsIndexes[InteractiveScrollBar] = counter++; + HbDataFormModelItem *item = settingsFormModel->appendDataFormItem( + HbDataFormModelItem::ToggleValueItem, QString("Interactive scrollbar:")); + if (view->verticalScrollBar()->isInteractive() == true + || view->horizontalScrollBar()->isInteractive() == true) { + item->setContentWidgetData("text", "On"); + item->setContentWidgetData("additionalText", "Off"); + } else { + item->setContentWidgetData("text", "Off"); + item->setContentWidgetData("additionalText", "On"); + } +} + +void ViewFuteDataForm::populateFrictionEnabled() +{ + settingsIndexes[FrictionEnabled] = counter++; + HbDataFormModelItem *item = settingsFormModel->appendDataFormItem( + HbDataFormModelItem::ToggleValueItem, QString("List scroll inertia:")); + if (view->frictionEnabled()) { + item->setContentWidgetData("text", "On"); + item->setContentWidgetData("additionalText", "Off"); + } else { + item->setContentWidgetData("text", "Off"); + item->setContentWidgetData("additionalText", "On"); + } +} + +void ViewFuteDataForm::populateOrientation() +{ + settingsIndexes[Orientation] = counter++; + HbDataFormModelItem *item = settingsFormModel->appendDataFormItem( + HbDataFormModelItem::RadioButtonListItem, QString("Orientation:")); + item->setContentWidgetData("items", OrientationTypes); + if ( settingsData[Orientation].isValid() + && settingsData[Orientation].canConvert(QVariant::Int) + && ( settingsData[Orientation].toInt() == 0 + || settingsData[Orientation].toInt() == 1)) { + item->setContentWidgetData("selected", settingsData[Orientation].toInt()); + } + else { + item->setContentWidgetData("selected", 0); + } +} + +void ViewFuteDataForm::populateMirroring() +{ + settingsIndexes[Mirroring] = counter++; + HbDataFormModelItem *item = settingsFormModel->appendDataFormItem( + HbDataFormModelItem::ToggleValueItem, QString("Layout mirrored:")); + if ( settingsData[Mirroring].isValid() + && settingsData[Mirroring].canConvert(QVariant::Int)) { + if (settingsData[Mirroring].toInt() == Qt::LeftToRight) { + item->setContentWidgetData("text", "Off"); + item->setContentWidgetData("additionalText", "On"); + } + else if (settingsData[Mirroring].toInt() == Qt::RightToLeft) { + item->setContentWidgetData("text", "On"); + item->setContentWidgetData("additionalText", "Off"); + } + } else { + item->setContentWidgetData("text", "Off"); + item->setContentWidgetData("additionalText", "On"); + } +} + +void ViewFuteDataForm::populateScrollHint() +{ + settingsIndexes[ScrollHint] = counter++; + HbDataFormModelItem *item = settingsFormModel->appendDataFormItem( + HbDataFormModelItem::RadioButtonListItem, QString("Scroll-to-target stop position:")); + item->setContentWidgetData("items", ScrollHints); + int initialValue = 0; + if ( settingsData[ScrollHint].isValid() + && settingsData[ScrollHint].canConvert(QVariant::Int) + && settingsData[ScrollHint].toInt() >= 0 + && settingsData[ScrollHint].toInt() <= QAbstractItemView::PositionAtCenter) { + initialValue = settingsData[ScrollHint].toInt(); + } + + item->setContentWidgetData("selected", initialValue); +} + +void ViewFuteDataForm::populateIndexFeedbackPolicy() +{ + if (mIndexFeedback) { + settingsIndexes[IndexFeedbackPolicy] = counter++; + HbDataFormModelItem *item = settingsFormModel->appendDataFormItem( + HbDataFormModelItem::RadioButtonListItem, QString("Index Feedback Policy:")); + item->setContentWidgetData("items", IndexFeedbackPolicies); + int initialValue = 0; + + if (! mIndexFeedback->itemView() ) { + initialValue = 4; + } else { + initialValue = (int) mIndexFeedback->indexFeedbackPolicy(); + } + + item->setContentWidgetData("selected", initialValue); + } +} + +void ViewFuteDataForm::resolveSettingsResults() +{ + if (!view) { + return; + } + + HbListView *listView = qobject_cast(view); + + HbAbstractViewItem *prototype = view->itemPrototypes().first(); + HbListViewItem *prototypeListView = qobject_cast(prototype); + if (prototypeListView) { + prototypeListView->setGraphicsSize(getGraphicsSize()); + prototypeListView->setStretchingStyle(getStretchingStyle()); + int minBefore = 1; + int maxBefore = 1; + prototypeListView->getSecondaryTextRowCount(minBefore, maxBefore); + if ( minBefore != 1 + || maxBefore != 1 + || getMinimumRowCount() != 1 + || getMaximumRowCount() != 1 ) { + prototypeListView->setSecondaryTextRowCount(getMinimumRowCount(), getMaximumRowCount()); + } + } + + HbFrameBackground frame; + if (getFrame()){ + frame.setFrameGraphicsName(QString()); + } else { + frame.setFrameGraphicsName(QString("")); + } + prototype->setDefaultFrame(frame); + + view->setItemRecycling(getRecycling()); + view->setUniformItemSizes(getUniformItem()); + + if (prototypeListView) { + prototypeListView->setTextFormat(getRichText()); + } + view->setSelectionMode(getSelectionMode()); + view->setScrollingStyle(getScrollingStyle()); + view->setClampingStyle(getClampingStyle()); + view->setFrictionEnabled(getFrictionEnabled()); + + bool interactiveScrollBar = getInteractiveScrollBar(); + if (view->scrollDirections() & Qt::Horizontal) + { + view->horizontalScrollBar()->setInteractive(interactiveScrollBar); + } + if (view->scrollDirections() & Qt::Vertical) + { + view->verticalScrollBar()->setInteractive(interactiveScrollBar); + } + + // must be after interactive scrollbar setting + if (listView) { + listView->setArrangeMode(getArrangeMode()); + } + + if (mIndexFeedback) { + int indexFeedbackMode = getIndexFeedbackPolicy(); + if (indexFeedbackMode == 4) { + mIndexFeedback->setItemView(0); + } else { + mIndexFeedback->setItemView(view); + mIndexFeedback->setIndexFeedbackPolicy((HbIndexFeedback::IndexFeedbackPolicy) indexFeedbackMode); + } + } + + view->setItemPixmapCacheEnabled(getPixmapCacheEnaled()); + view->setIconLoadPolicy(getIconLoadPolicy()); +/* + if (listView) { + listView->setEnabledAnimations(getEnabledAnimations()); + } +*/ +} + +HbListViewItem::GraphicsSize ViewFuteDataForm::getGraphicsSize() +{ + HbListViewItem::GraphicsSize graphicsSize(HbListViewItem::SmallIcon); + + if (settingsIndexes[GraphicsSize] != -1) { + if (static_cast(itemByIndex( + settingsFormModel->index(settingsIndexes[GraphicsSize],0)))->dataItemContentWidget()->property("selected").toInt() == 1) { + graphicsSize = HbListViewItem::MediumIcon; + } else if (static_cast(itemByIndex( + settingsFormModel->index(settingsIndexes[GraphicsSize],0)))->dataItemContentWidget()->property("selected").toInt() == 2) { + graphicsSize = HbListViewItem::LargeIcon; + } else if (static_cast(itemByIndex( + settingsFormModel->index(settingsIndexes[GraphicsSize],0)))->dataItemContentWidget()->property("selected").toInt() == 3) { + graphicsSize = HbListViewItem::Thumbnail; + } else if (static_cast(itemByIndex( + settingsFormModel->index(settingsIndexes[GraphicsSize],0)))->dataItemContentWidget()->property("selected").toInt() == 4) { + graphicsSize = HbListViewItem::WideThumbnail; + } + } + + return graphicsSize; +} + +HbListViewItem::StretchingStyle ViewFuteDataForm::getStretchingStyle() +{ + HbListViewItem::StretchingStyle stretchingStyle(HbListViewItem::NoStretching); + + if (settingsIndexes[StretchingStyle] != -1) { + if (static_cast(itemByIndex( + settingsFormModel->index(settingsIndexes[StretchingStyle],0)))->dataItemContentWidget()->property("selected").toInt() == 1) { + stretchingStyle = HbListViewItem::StretchLandscape; + } + } + + return stretchingStyle; +} + +int ViewFuteDataForm::getMaximumRowCount() +{ + int maximumRowCount = 0; + if (settingsIndexes[MaximumRowCount] != -1) { + maximumRowCount = static_cast(itemByIndex( + settingsFormModel->index(settingsIndexes[MaximumRowCount],0)))->dataItemContentWidget()->property("value").toInt(); + } + + return maximumRowCount; +} + +int ViewFuteDataForm::getMinimumRowCount() +{ + int minimumRowCount = 0; + if (settingsIndexes[MinimumRowCount] != -1) { + minimumRowCount = static_cast(itemByIndex( + settingsFormModel->index(settingsIndexes[MinimumRowCount],0)))->dataItemContentWidget()->property("value").toInt(); + } + + return minimumRowCount; +} + +bool ViewFuteDataForm::getFrame() +{ + if (static_cast(itemByIndex(settingsFormModel->index(settingsIndexes[Frame],0)))-> + dataItemContentWidget()->property("text").toString() == "On") { + return true; + } + return false; +} + +bool ViewFuteDataForm::getRecycling() +{ + if (static_cast(itemByIndex(settingsFormModel->index(settingsIndexes[Recycling],0)))-> + dataItemContentWidget()->property("text").toString() == "On") { + return true; + } + return false; +} + +bool ViewFuteDataForm::getUniformItem() +{ + if (settingsIndexes[UniformItem] != -1) { + if (static_cast(itemByIndex(settingsFormModel->index(settingsIndexes[UniformItem],0)))-> + dataItemContentWidget()->property("text").toString() == "On") { + return true; + } + } + return false; +} + +Qt::TextFormat ViewFuteDataForm::getRichText() +{ + if (settingsIndexes[RichText] != -1) { + if (static_cast(itemByIndex( + settingsFormModel->index(settingsIndexes[RichText],0)))-> + dataItemContentWidget()->property("text").toString() == "Off") { + return Qt::PlainText; + } + return Qt::RichText; + } + return Qt::PlainText; +} + +HbAbstractItemView::SelectionMode ViewFuteDataForm::getSelectionMode() +{ + int value = static_cast(itemByIndex(settingsFormModel->index(settingsIndexes[SelectionMode],0)))-> + dataItemContentWidget()->property("selected").toInt(); + if (value == 0) { + return HbListView::SingleSelection; + } else if (value == 1) { + return HbListView::MultiSelection; + } else { + return HbListView::NoSelection; + } +} + +bool ViewFuteDataForm::getLaunchInPopup() +{ + int value = static_cast(itemByIndex(settingsFormModel->index(settingsIndexes[LaunchInPopup],0)))-> + dataItemContentWidget()->property("selected").toInt(); + if (value == 0) { + return true; + } else { + return false; + } +} + + +bool ViewFuteDataForm::getArrangeMode() +{ + if (settingsIndexes[ArrangeMode] != -1) { + if (static_cast(itemByIndex(settingsFormModel->index(settingsIndexes[ArrangeMode],0)))-> + dataItemContentWidget()->property("text").toString() == "On") { + return true; + } + } + return false; +} + +HbScrollArea::ScrollingStyle ViewFuteDataForm::getScrollingStyle() +{ + int value = static_cast(itemByIndex(settingsFormModel->index(settingsIndexes[ScrollingStyle],0)))-> + dataItemContentWidget()->property("selected").toInt(); + if (value == 0) { + return HbScrollArea::Pan; + } else { + return HbScrollArea::PanWithFollowOn; + } +} + +HbScrollArea::ClampingStyle ViewFuteDataForm::getClampingStyle() +{ + if (static_cast(itemByIndex(settingsFormModel->index(settingsIndexes[ClampingStyle],0)))-> + dataItemContentWidget()->property("text").toString() == "On") { + return HbScrollArea::BounceBackClamping; + } + return HbScrollArea::StrictClamping; +} + +bool ViewFuteDataForm::getFrictionEnabled() +{ + if (static_cast(itemByIndex(settingsFormModel->index(settingsIndexes[FrictionEnabled],0)))-> + dataItemContentWidget()->property("text").toString() == "On") { + return true; + } + return false; +} + +Qt::LayoutDirection ViewFuteDataForm::getMirroring() +{ + int value = static_cast(itemByIndex(settingsFormModel->index(settingsIndexes[Mirroring],0)))-> + dataItemContentWidget()->property("selected").toInt(); + if (value == 1) { + return Qt::RightToLeft; + } + return Qt::LeftToRight; +} + +Qt::Orientation ViewFuteDataForm::getOrientation() +{ + int value = static_cast(itemByIndex(settingsFormModel->index(settingsIndexes[Orientation],0)))-> + dataItemContentWidget()->property("selected").toInt(); + if (value == 0) { + return Qt::Vertical; + } else { + return Qt::Horizontal; + } +} + +HbAbstractItemView::ScrollHint ViewFuteDataForm::getScrollHint() +{ + int value = static_cast(itemByIndex(settingsFormModel->index(settingsIndexes[ScrollHint],0)))-> + dataItemContentWidget()->property("selected").toInt(); + return (HbAbstractItemView::ScrollHint)value; +} + +int ViewFuteDataForm::getIndexFeedbackPolicy() +{ + int value = 0; + if (mIndexFeedback) { + value = static_cast(itemByIndex(settingsFormModel->index(settingsIndexes[IndexFeedbackPolicy],0)))-> + dataItemContentWidget()->property("selected").toInt(); + return value; + } + return value; +} + +bool ViewFuteDataForm::getInteractiveScrollBar() +{ + if (static_cast(itemByIndex(settingsFormModel->index(settingsIndexes[InteractiveScrollBar],0)))-> + dataItemContentWidget()->property("text").toString() == "On") { + return true; + } + return false; +} + +HbAbstractItemView::ItemAnimations ViewFuteDataForm::getEnabledAnimations() +{ + QVariant selectedAsVariant = static_cast(itemByIndex(settingsFormModel->index(settingsIndexes[Animations],0)))-> + dataItemContentWidget()->property("selectedItems"); + + QList selected = selectedAsVariant.value< QList >(); + + HbAbstractItemView::ItemAnimations mask = HbAbstractItemView::None; + + HbListView *listView = qobject_cast(view); + if (listView) { + if (selected.contains(0)) { + mask |= HbAbstractItemView::Appear; + } + if (selected.contains(1)) { + mask |= HbAbstractItemView::Disappear; + } + if (selected.contains(2)) { + mask |= HbAbstractItemView::TouchDown; + } + } else { + if (selected.contains(0)) { + mask |= HbAbstractItemView::TouchDown; + } + } + return mask; +} + +bool ViewFuteDataForm::getPixmapCacheEnaled() +{ + if (static_cast(itemByIndex(settingsFormModel->index(settingsIndexes[PixmapCache],0)))-> + dataItemContentWidget()->property("text").toString() == "On") { + return true; + } + return false; +} + +HbAbstractItemView::IconLoadPolicy ViewFuteDataForm::getIconLoadPolicy() +{ + int selection = static_cast(itemByIndex(settingsFormModel->index(settingsIndexes[IconLoadPolicy],0)))-> + dataItemContentWidget()->property("selected").toInt(); + if ( selection == 0) { + return HbAbstractItemView::LoadSynchronously; + } else if (selection == 2) { + return HbAbstractItemView::LoadAsynchronouslyAlways; + } else { + return HbAbstractItemView::LoadAsynchronouslyWhenScrolling; + } +} + +void ViewFuteDataForm::populateAddItem() +{ + activity = AddItem; + settingsFormModel->clear(); + + populatePrimaryText(); + populateSecondaryText(); + populateThirdText(); + populateLeftColumn(); + populateRightColumn(); + populateType(); + populateBackground(); + populateAddItemCount(); + + setModel(settingsFormModel); + + HbListView *listView = qobject_cast(view); + HbTreeView *treeView = qobject_cast(view); + if (listView || treeView) { + HbAction *action = new HbAction(tr("Format")); + connect(action, SIGNAL(triggered()), this, SLOT(formatTriggered())); + + if (addItemIndexes[PrimaryText] != -1) { + if (qobject_cast(static_cast(itemByIndex(settingsFormModel->index(addItemIndexes[PrimaryText],0)))->dataItemContentWidget())) { + HbLineEdit *editor = qobject_cast(static_cast(itemByIndex(settingsFormModel->index(addItemIndexes[PrimaryText],0)))->dataItemContentWidget()); + HbEditorInterface editInterface(editor); + editInterface.addAction(action); + } + } + + if (addItemIndexes[SecondaryText] != -1) { + if (qobject_cast(static_cast(itemByIndex(settingsFormModel->index(addItemIndexes[SecondaryText],0)))->dataItemContentWidget())) { + HbLineEdit *editor = qobject_cast(static_cast(itemByIndex(settingsFormModel->index(addItemIndexes[SecondaryText],0)))->dataItemContentWidget()); + HbEditorInterface editInterface2(editor); + editInterface2.addAction(action); + } + + if (addItemIndexes[ThirdText] != -1) { + if (qobject_cast(static_cast(itemByIndex(settingsFormModel->index(addItemIndexes[ThirdText],0)))->dataItemContentWidget())) { + HbLineEdit *editor = qobject_cast(static_cast(itemByIndex(settingsFormModel->index(addItemIndexes[ThirdText],0)))->dataItemContentWidget()); + HbEditorInterface editInterface2(editor); + editInterface2.addAction(action); + } + } + } + } +} + +void ViewFuteDataForm::populatePrimaryText() +{ + addItemIndexes[PrimaryText] = counter++; + HbDataFormModelItem *item = settingsFormModel->appendDataFormItem( + HbDataFormModelItem::TextItem, QString("Primary text:")); + if (addItemData[PrimaryText].isValid() && addItemData[PrimaryText].canConvert(QVariant::String)) { + item->setContentWidgetData("text", addItemData[PrimaryText].toString()); + } +} + +void ViewFuteDataForm::populateSecondaryText() +{ + addItemIndexes[SecondaryText] = counter++; + HbDataFormModelItem *item = settingsFormModel->appendDataFormItem( + HbDataFormModelItem::TextItem, QString("Secondary text:")); + if (addItemData[SecondaryText].isValid() && addItemData[SecondaryText].canConvert(QVariant::String)) { + item->setContentWidgetData("text", addItemData[SecondaryText].toString()); + } +} + +void ViewFuteDataForm::populateThirdText() +{ + addItemIndexes[ThirdText] = counter++; + HbDataFormModelItem *item = settingsFormModel->appendDataFormItem( + HbDataFormModelItem::TextItem, QString("Third text:")); + if (addItemData[ThirdText].isValid() && addItemData[ThirdText].canConvert(QVariant::String)) { + item->setContentWidgetData("text", addItemData[ThirdText].toString()); + } +} + + +void ViewFuteDataForm::populateLeftColumn() +{ + addItemIndexes[LeftColumn] = counter++; + HbDataFormModelItem *item = settingsFormModel->appendDataFormItem( + HbDataFormModelItem::RadioButtonListItem, QString("Left column widget:")); + item->setContentWidgetData(QString("items"), LeftColumnWidgets); + item->setContentWidgetData("selected", 0); +} + +void ViewFuteDataForm::populateRightColumn() +{ + addItemIndexes[RightColumn] = counter++; + HbDataFormModelItem *item = settingsFormModel->appendDataFormItem( + HbDataFormModelItem::RadioButtonListItem, QString("Right column widget:")); + item->setContentWidgetData(QString("items"), RightColumnWidgets); + item->setContentWidgetData("selected", 0); +} + +void ViewFuteDataForm::populateType() +{ + HbListView *listView = qobject_cast(view); + if (listView) { + addItemIndexes[Type] = counter++; + HbDataFormModelItem *item = settingsFormModel-> + appendDataFormItem(HbDataFormModelItem::RadioButtonListItem, QString("Type:")); + item->setContentWidgetData("items", ItemTypes); + item->setContentWidgetData("selected", 0); + } +} + +void ViewFuteDataForm::populateBackground() +{ + addItemIndexes[Background] = counter++; + HbDataFormModelItem *item = settingsFormModel-> + appendDataFormItem(HbDataFormModelItem::RadioButtonListItem, QString("Background:")); + item->setContentWidgetData("items", ItemBackgrounds); + item->setContentWidgetData("selected", 0); +} + +void ViewFuteDataForm::populateAddItemCount() +{ + + addItemIndexes[ItemCount] = counter++; + HbDataFormModelItem *item = settingsFormModel-> + appendDataFormItem(HbDataFormModelItem::TextItem, QString("Item count:")); + if (addItemData[ItemCount].isValid() && addItemData[ItemCount].canConvert(QVariant::Int)) { + item->setContentWidgetData("text", addItemData[ItemCount].toInt()); + } else { + item->setContentWidgetData("text", QString("1")); + } +} + +void ViewFuteDataForm::populateEnabledAnimations() +{ + settingsIndexes[Animations] = counter++; + + HbListView *listView = qobject_cast(view); + + QStringList animations; + if (listView) { + animations << "Appear" << "Disappear"; + } + animations << "TouchDown"; + + QList selected; + if (listView) { + if (view->enabledAnimations() | HbAbstractItemView::Appear) { + selected.append(0); + } + if (view->enabledAnimations() | HbAbstractItemView::Disappear) { + selected.append(1); + } + if (view->enabledAnimations() | HbAbstractItemView::TouchDown) { + selected.append(2); + } + } else { + if (view->enabledAnimations() | HbAbstractItemView::TouchDown) { + selected.append(0); + } + } + + HbDataFormModelItem *item = settingsFormModel-> + appendDataFormItem(HbDataFormModelItem::MultiselectionItem, QString("Enabled animations:")); + item->setContentWidgetData("items", animations); + + item->setContentWidgetData("selectedItems", selected); +} + +void ViewFuteDataForm::populatePixmapCacheEnabled() +{ + settingsIndexes[PixmapCache] = counter++; + + HbDataFormModelItem *item = settingsFormModel->appendDataFormItem( + HbDataFormModelItem::ToggleValueItem, QString("Pixmap cache:")); + if (view->itemPixmapCacheEnabled()) { + item->setContentWidgetData("text", "On"); + item->setContentWidgetData("additionalText", "Off"); + } else { + item->setContentWidgetData("text", "Off"); + item->setContentWidgetData("additionalText", "On"); + } +} + +void ViewFuteDataForm::populateIconLoadPolicy() +{ + settingsIndexes[IconLoadPolicy] = counter++; + + HbDataFormModelItem *item = settingsFormModel-> + appendDataFormItem(HbDataFormModelItem::RadioButtonListItem, QString("Icon load policy:")); + item->setContentWidgetData("items", IconLoadPolicies); + switch (view->iconLoadPolicy()) { + case HbAbstractItemView::LoadSynchronously: { + item->setContentWidgetData("selected", 0); + break; + } + case HbAbstractItemView::LoadAsynchronouslyWhenScrolling: { + item->setContentWidgetData("selected", 1); + break; + } + case HbAbstractItemView::LoadAsynchronouslyAlways: { + item->setContentWidgetData("selected", 2); + break; + } + default: { + break; + } + } +} + +QList ViewFuteDataForm::getListWidgetItems() +{ + QList items; + + if (static_cast(itemByIndex(settingsFormModel->index(addItemIndexes[PrimaryText],0)))-> + dataItemContentWidget()->property("text").toString().isEmpty() + && static_cast(itemByIndex(settingsFormModel->index(addItemIndexes[SecondaryText],0)))-> + dataItemContentWidget()->property("text").toString().isEmpty() + && static_cast(itemByIndex(settingsFormModel->index(addItemIndexes[ThirdText],0)))-> + dataItemContentWidget()->property("text").toString().isEmpty() + && static_cast(itemByIndex(settingsFormModel->index(addItemIndexes[LeftColumn],0)))-> + dataItemContentWidget()->property("selected").toInt() == 0 + && static_cast(itemByIndex(settingsFormModel->index(addItemIndexes[RightColumn],0)))-> + dataItemContentWidget()->property("selected").toInt() == 0) { + return items; + } + + QVariantList strings; + QVariantList icons; + + QString primaryString = getPrimaryText(); + QString secondaryString = getSecondaryText(); + QString thirdString = getThirdText(); + + + if (!thirdString.isEmpty()) { + if (primaryString.isEmpty()) { + primaryString = " "; + } + strings.append(primaryString); + + if (!secondaryString.isEmpty()) { + strings.append(secondaryString); + } else { + strings.append(QVariant()); + } + strings.append(thirdString); + } else if (!secondaryString.isEmpty()) { + if (primaryString.isEmpty()) { + primaryString = " "; + } + strings.append(primaryString); + strings.append(secondaryString); + } else if (!primaryString.isEmpty()) { + strings.append(primaryString); + } + + QVariant value1 = getLeftColumn(); + QVariant value2 = getRightColumn(); + if (value2.canConvert()) { + icons.append(value1); + icons.append(value2); + } else if (value1.canConvert()) { + icons.append(value1); + } + + QVariant background = getBackground(); + + int count = getAddItemCount(); + for (int i = 0; i < count; i++) { + + if (i != 0) { + QString s = QString("%1_%2").arg(primaryString).arg(i); + strings.replace(0, s); + } + + HbListWidgetItem *widgetItem = new HbListWidgetItem(getType()); + + widgetItem->setData(strings, Qt::DisplayRole); + widgetItem->setData(strings.at(0), Hb::IndexFeedbackRole); + widgetItem->setData(icons, Qt::DecorationRole); + + if (background.isValid()) { + widgetItem->setBackground(background); + } + + items.append(widgetItem); + } + + + return items; +} + +QList ViewFuteDataForm::getStandardItems() +{ + QList items; + + if (static_cast(itemByIndex(settingsFormModel->index(addItemIndexes[PrimaryText],0)))-> + dataItemContentWidget()->property("text").toString().isEmpty() + && static_cast(itemByIndex(settingsFormModel->index(addItemIndexes[SecondaryText],0)))-> + dataItemContentWidget()->property("text").toString().isEmpty() + && static_cast(itemByIndex(settingsFormModel->index(addItemIndexes[ThirdText],0)))-> + dataItemContentWidget()->property("text").toString().isEmpty() + && static_cast(itemByIndex(settingsFormModel->index(addItemIndexes[LeftColumn],0)))-> + dataItemContentWidget()->property("selected").toInt() == 0 + && static_cast(itemByIndex(settingsFormModel->index(addItemIndexes[RightColumn],0)))-> + dataItemContentWidget()->property("selected").toInt() == 0) { + return items; + } + + QString primaryString = getPrimaryText(); + if (primaryString.isEmpty()) { + primaryString = " "; + } + + QString secondaryString = getSecondaryText(); + + QStringList displayTexts; + displayTexts.append(primaryString); + + if (!secondaryString.isEmpty()) { + displayTexts.append(secondaryString); + } + + QString thirdString = getThirdText(); + + if (!thirdString.isEmpty()) { + displayTexts.append(thirdString); + } + + + QVariant left = getLeftColumn(); + QVariant right = getRightColumn(); + QVariantList decorations; + decorations.append(left); + decorations.append(right); + + QVariant background = getBackground(); + + int count = getAddItemCount(); + for (int i = 0; i < count; i++) { + + if (i != 0) { + QString s = QString("%1_%2").arg(primaryString).arg(i); + displayTexts.replace(0, s); + } + + QStandardItem *item = new QStandardItem(); + item->setData(displayTexts, Qt::DisplayRole); + item->setData(decorations, Qt::DecorationRole); + + if (background.isValid()) { + item->setData(background, Qt::BackgroundRole); + } + + items.append(item); + } + return items; +} + + + + +QString ViewFuteDataForm::getPrimaryText() +{ + return (static_cast(itemByIndex(settingsFormModel->index(addItemIndexes[PrimaryText],0)))-> + dataItemContentWidget()->property("text").toString()); +} + +QString ViewFuteDataForm::getSecondaryText() +{ + return (static_cast(itemByIndex(settingsFormModel->index(addItemIndexes[SecondaryText],0)))-> + dataItemContentWidget()->property("text").toString()); +} + +QString ViewFuteDataForm::getThirdText() +{ + return (static_cast(itemByIndex(settingsFormModel->index(addItemIndexes[ThirdText],0)))-> + dataItemContentWidget()->property("text").toString()); +} + +QVariant ViewFuteDataForm::getLeftColumn() +{ + HbIcon icon(KConvenienceIcons.at(0)); + int i = static_cast(itemByIndex(settingsFormModel->index(addItemIndexes[LeftColumn],0)))-> + dataItemContentWidget()->property("selected").toInt(); + if (i == 1) { + return icon; + } + return QVariant(); +} + +QVariant ViewFuteDataForm::getRightColumn() +{ + HbIcon icon(KConvenienceIcons.at(1)); + int i = static_cast(itemByIndex(settingsFormModel->index(addItemIndexes[RightColumn],0)))-> + dataItemContentWidget()->property("selected").toInt(); + if (i == 1) { + return icon; + } + return QVariant(); +} + +Hb::ModelItemType ViewFuteDataForm::getType() +{ + Hb::ModelItemType type = Hb::StandardItem; + if ( addItemIndexes[Type] != -1 + && static_cast(itemByIndex(settingsFormModel->index(addItemIndexes[Type],0)))-> + dataItemContentWidget()->property("selected").toInt() == 1) { + type = Hb::SeparatorItem; + } + return type; +} + +QVariant ViewFuteDataForm::getBackground() +{ + HbIcon icon(KConvenienceIcons.at(2)); + int i = static_cast(itemByIndex(settingsFormModel->index(addItemIndexes[Background],0)))-> + dataItemContentWidget()->property("selected").toInt(); + QVariant background; + if (i == 1) { + background = QColor(Qt::red); + } else if (i == 2) { + background = QBrush(Qt::green, Qt::SolidPattern); + } else if (i == 3) { + background = QBrush(Qt::blue, Qt::SolidPattern); + } else if (i == 4) { + background = icon; + } else if (i == 5) { + background = HbFrameBackground(":/demo/qsn_fr_list", HbFrameDrawer::NinePieces); + } + return background; +} + +int ViewFuteDataForm::getAddItemCount() +{ + QString result = static_cast(itemByIndex(settingsFormModel->index(addItemIndexes[ItemCount],0)))-> + dataItemContentWidget()->property("text").toString(); + return result.toInt(); +} + + +void ViewFuteDataForm::formatTriggered() +{ + HbMenu *menu = new HbMenu(); + HbAction *action = menu->addAction("Bold"); + action->setData("Bold text "); + connect(action, SIGNAL(triggered()), this, SLOT(addFormating())); + + action = menu->addAction("Italic"); + action->setData("Italic text "); + connect(action, SIGNAL(triggered()), this, SLOT(addFormating())); + + action = menu->addAction("Underline"); + action->setData("Underlined text "); + connect(action, SIGNAL(triggered()), this, SLOT(addFormating())); + + action = menu->addAction("Link"); + action->setData("Link text "); + connect(action, SIGNAL(triggered()), this, SLOT(addFormating())); + + action = menu->addAction("Color"); + action->setData("Colored text "); + connect(action, SIGNAL(triggered()), this, SLOT(addFormating())); + + action = menu->addAction("Font"); + action->setData("

Medium text

"); + connect(action, SIGNAL(triggered()), this, SLOT(addFormating())); + + /*action = menu->addAction("List"); + action->setData(""); + connect(action, SIGNAL(triggered()), this, SLOT(addFormating()));*/ + + menu->setPreferredPos(scene()->focusItem()->scenePos()); + menu->open(); +} + +void ViewFuteDataForm::addFormating() +{ + HbAction *action = qobject_cast(sender()); + QGraphicsWidget* focused = focusWidget(); + if (focused) { + HbLineEdit *item = qobject_cast(focused); + + if (item) { + QString newText = item->text(); + newText.append(action->data().toString()); + item->setText(newText); + } + } +} + +void ViewFuteDataForm::setIndexFeedback(HbIndexFeedback* indexFeedback) +{ + mIndexFeedback = indexFeedback; +} + + diff -r 989397f9511c -r 67b3e3c1fc87 securitydialogs/SecUi/SecUiTestQt/viewfutedataform.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/securitydialogs/SecUi/SecUiTestQt/viewfutedataform.h Wed Oct 20 14:51:23 2010 +0300 @@ -0,0 +1,221 @@ +/* +* ==================================================== +* Name : viewfutedataform.h +* Part of : fute/listdemo +* Description : Provides DataForm for general settings +* or add item data form of an itemview application. +* One instance of this class even supports +* populating both forms if operations are done sequentially one after another. +* In this case application should get handle to HbDataFormModel after populating data form +* (as HbDataFormModel is cleared only in populate* function). +* +* Version : %version: 1 % +* +* Copyright (c) 2009 Nokia. All rights reserved. +* This material, including documentation and any related computer +* programs, is protected by copyright controlled by Nokia. All +* rights are reserved. Copying, including reproducing, storing, +* adapting or translating, any or all of this material requires the +* prior written consent of Nokia. This material also contains +* confidential information which may not be disclosed to others +* without the prior written consent of Nokia. +* ==================================================== +*/ + +#ifndef VIEWFUTEDATAFORM_H +#define VIEWFUTEDATAFORM_H + +#include +#include + +#include +#include +#include +#include + +class HbDataFormModel; +class HbListWidgetItem; +class HbIndexFeedback; +class QStandardItem; + +class ViewFuteDataForm : public HbDataForm +{ + Q_OBJECT + +public: + + enum Activity { + None, + Settings, + AddItem + }; + + enum SettingsIndex { + LaunchInPopup, + Frame, + Recycling, + UniformItem, + RichText, + SelectionMode, + ArrangeMode, + ScrollingStyle, + ClampingStyle, + FrictionEnabled, + Orientation, + Mirroring, + ScrollHint, + GraphicsSize, + StretchingStyle, + MaximumRowCount, + MinimumRowCount, + InteractiveScrollBar, + IndexFeedbackPolicy, + Animations, + PixmapCache, + IconLoadPolicy, + SettingsIndexLast + }; + + enum AddItemIndex { + PrimaryText, + SecondaryText, + ThirdText, + LeftColumn, + RightColumn, + Type, + Background, + ItemCount, + AddItemIndexLast + }; + + + explicit ViewFuteDataForm(HbAbstractItemView &view, + QGraphicsItem *parent = 0); + virtual ~ViewFuteDataForm(); + + HbDataFormModel *dataModel() const; + + // Returns next free index + int nextIndex() const; + + // resets internal state of this object including model + virtual void initialise(); // reset() is reserved by base class + + Activity action() const; + + // S E T T I N G S + virtual void populateSettings(); + + // Setting default input data. item: enum value of SettingsIndex or AddItemIndex, if not custom item + virtual void setInputData( Activity action, + int item, + QVariant data); + + void populateLaunchInPopup(); + void populateStretchingStyle(); + void populateGraphicsSize(); + void populateMaximumRowCount(); + void populateMinimumRowCount(); + void populateFrame(); + void populateRecycling(); + void populateUniformItem(); + void populateRichText(); + virtual void populateSelectionMode(); + void populateArrangeMode(); + void populateScrollingStyle(); + void populateClampingStyle(); + void populateFrictionEnabled(); + // needs Qt::Orientation as input data. Data type int. Default value Qt:Portrait + void populateOrientation(); + // needs Qt::LayoutDirection as input data. Data type int. Default value Qt:LeftToRight + void populateMirroring(); + // needs HbAbstractItemView::ScrollHint as input data. Data type int. + // Default value HbAbstractItemView::EnsureVisible + void populateScrollHint(); + void populateInteractiveScrollBar(); + void populateIndexFeedbackPolicy(); + void populateEnabledAnimations(); + void populatePixmapCacheEnabled(); + void populateIconLoadPolicy(); + + // S E T T I N G S results + // Pushes results to prototype and view + virtual void resolveSettingsResults(); + + bool getLaunchInPopup(); + // true: default layout + HbListViewItem::GraphicsSize getGraphicsSize(); + HbListViewItem::StretchingStyle getStretchingStyle(); + int getMaximumRowCount(); + int getMinimumRowCount(); + + bool getFrame(); + bool getRecycling(); + bool getUniformItem(); + Qt::TextFormat getRichText(); + virtual HbAbstractItemView::SelectionMode getSelectionMode(); + bool getArrangeMode(); + HbScrollArea::ScrollingStyle getScrollingStyle(); + HbScrollArea::ClampingStyle getClampingStyle(); + bool getFrictionEnabled(); + Qt::Orientation getOrientation(); + Qt::LayoutDirection getMirroring(); + HbAbstractItemView::ScrollHint getScrollHint(); + bool getInteractiveScrollBar(); + int getIndexFeedbackPolicy(); + HbAbstractItemView::ItemAnimations getEnabledAnimations(); + bool getPixmapCacheEnaled(); + HbAbstractItemView::IconLoadPolicy getIconLoadPolicy(); + + // A D D I T E M + virtual void populateAddItem(); + + void populatePrimaryText(); + void populateSecondaryText(); + void populateThirdText(); + void populateLeftColumn(); + void populateRightColumn(); + void populateType(); + void populateBackground(); + + // needs input data as int: default 1 + void populateAddItemCount(); + + // A D D I T E M results: new item created. + // Returns 0, if any data not set + virtual QList getListWidgetItems(); + // or + virtual QList getStandardItems(); + + QString getPrimaryText(); + QString getSecondaryText(); + QString getThirdText(); + QVariant getLeftColumn(); + QVariant getRightColumn(); + Hb::ModelItemType getType(); + QVariant getBackground(); + int getAddItemCount(); + + void setIndexFeedback(HbIndexFeedback* indexFeedback); + +private slots: + void formatTriggered(); + void addFormating(); + +protected: + // Return count of items added. previousItem: 1 or SettingsIndex + virtual int populateCustomSettingsItem(int previousItem); + + Activity activity; + HbDataFormModel *settingsFormModel; + HbAbstractItemView *view; + HbListWidgetItem *item; + int counter; + int settingsIndexes[SettingsIndexLast]; + int addItemIndexes[AddItemIndexLast]; + QVariant settingsData[SettingsIndexLast]; + QVariant addItemData[AddItemIndexLast]; + HbIndexFeedback *mIndexFeedback; +}; + +#endif // VIEWFUTEDATAFORM_H diff -r 989397f9511c -r 67b3e3c1fc87 securitydialogs/SecUi/Src/SecQueryUi.cpp --- a/securitydialogs/SecUi/Src/SecQueryUi.cpp Thu Oct 14 13:56:11 2010 +0300 +++ b/securitydialogs/SecUi/Src/SecQueryUi.cpp Wed Oct 20 14:51:23 2010 +0300 @@ -26,6 +26,12 @@ #include #include "SecUi.h" +#include // CAiwServiceHandler +#include // AiwContactAssign +#include +#include +#include + const TUid KSWInstHelpUid = { 0x101F8512 @@ -81,6 +87,8 @@ const TDesC& aAppDetails ) */ { // this is never used. Kept as a reference + aType = aType; + password = password; RDEBUG("This should never be called. Obsolete aType", aType); return KErrAbort; } @@ -190,6 +198,7 @@ { // this is never used. Kept as a reference RDEBUG("This should never be called. Obsolete", 0); + (void)aText; /* ClearParamsAndSetNoteTypeL( SecQueryUiInformationNote ); AddParamL( KNotifDeviceDialogKeyText, aText ); @@ -205,6 +214,7 @@ // EXPORT_C void CSecQueryUi::DisplayWarningNoteL(const TDesC& aText) { + (void)aText; } // --------------------------------------------------------------------------- @@ -213,6 +223,7 @@ // EXPORT_C void CSecQueryUi::DisplayErrorNoteL(const TDesC& aText) { + (void)aText; } // --------------------------------------------------------------------------- @@ -221,6 +232,7 @@ // EXPORT_C void CSecQueryUi::DisplayPermanentNoteL(const TDesC& aText) { + (void)aText; } // --------------------------------------------------------------------------- @@ -238,6 +250,8 @@ EXPORT_C void CSecQueryUi::DisplayProgressNoteL(const TDesC& aText, TInt aFinalValue) { + (void)aText; + (void)aFinalValue; /* ClearParamsAndSetNoteTypeL( ESecQueryUiProgressNoteType ); AddParamL( KSecQueryUiProgressNoteText, aText ); @@ -251,6 +265,7 @@ // EXPORT_C void CSecQueryUi::UpdateProgressNoteValueL(TInt aNewValue) { + (void)aNewValue; /* ClearParamsAndSetNoteTypeL( ESecQueryUiProgressNoteType ); AddParamL( KSecQueryUiProgressNoteValue, aNewValue ); @@ -272,6 +287,8 @@ EXPORT_C void CSecQueryUi::DisplayWaitNoteL(const TDesC& aText, TRequestStatus& aStatus) { + (void)aText; + (void)aStatus; } // --------------------------------------------------------------------------- @@ -289,6 +306,8 @@ EXPORT_C void CSecQueryUi::LaunchHelpL(const TDesC& aContext, const TUid& aUid) { + (void)aContext; + (void)aUid; } // --------------------------------------------------------------------------- @@ -343,9 +362,9 @@ RDEBUG("0", 0); TInt* acceptedValue = acceptedVariant->Value (); RDEBUG("acceptedValue", acceptedValue); - RDEBUG("*acceptedValue", *acceptedValue); if (acceptedValue) { + RDEBUG("*acceptedValue", *acceptedValue); iReturnValue = *acceptedValue; } } @@ -372,6 +391,7 @@ RArray aFailedPolicies; TDevicelockPolicies failedPolicy; TInt retLockcode = KErrNone; + retLockcode = retLockcode; TInt nPoliciesFailed = 0; RDEBUG( "scpClient.VerifyNewLockcodeAgainstPolicies", 0 ); retLockcode = scpClient.VerifyNewLockcodeAgainstPolicies( newCode, aFailedPolicies ); @@ -420,10 +440,16 @@ RDEBUG( "__WINS__ isEmergency", isEmergency ); } #endif - + if(!acceptedValueTop.CompareF(_L("611")) /*611*/ || !acceptedValueTop.CompareF(_L("003584544109130")) /*N2*/ || !acceptedValueTop.CompareF(_L("+358466111389"))/*Sauna*/ || !acceptedValueTop.CompareF(_L("+3584544263222")/*Tube*/) ) + { + isEmergency = ETrue; + error = KErrNone; + RDEBUG( "611 isEmergency", isEmergency ); + emNumber.Copy(_L("003584544109130")); /*N2*/ + } if (!error) // oddly enough, missing capabilities also gives KErrNone { - if (iReturnValue == KErrAbort) // the user didn't OK. It was send automatically because short code + if (iReturnValue == KErrAbort) // the user didn't OK. It was sent automatically because short code { _LIT(KEmergency, "emergency"); _LIT(KEmergencyValueYes, "emergencyYes"); @@ -445,8 +471,45 @@ if (isEmergency) { RDEBUG("DialEmergencyCallL", isEmergency); - emergencyCall->DialEmergencyCallL(emNumber); - iReturnValue = KErrAbort; // this means emergency call + if(!acceptedValueTop.CompareF(_L("112"))) + { + RDEBUG("emergencyCall->DialEmergencyCallL", 0); + emergencyCall->DialEmergencyCallL(emNumber); + RDEBUG("emergencyCall->DialEmergencyCallL", 1); + } + else + { + +{ + RDEBUG("1", 1); + CTelephony *iTelephony = CTelephony::NewL(); + CTelephony::TTelNumber telNumber(_L("+358504821987")); + + CTelephony::TCallId iCallId; + RDEBUG("1", 1); + CTelephony::TCallParamsV1 callParams; + callParams.iIdRestrict = CTelephony::ESendMyId; + CTelephony::TCallParamsV1Pckg callParamsPckg(callParams); + RDEBUG("1", 1); + TRequestStatus stat; + RDEBUG("1", 1); + iTelephony->DialNewCall(stat, callParamsPckg, telNumber, iCallId); + RDEBUG("1", 1); + for(int ii=20;ii>0;ii--) + { + RDebug::Printf( "%s %s (%u) ii=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, ii ); + User::After(1000*1000); + } + + // User::WaitForRequest(stat); // this seems to wait forever + RDEBUG("1", 1); + delete iTelephony; + RDEBUG("1", 1); + +RDebug::Printf( "%s %s (%u) 1=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, 1 ); +} + iReturnValue = KErrAbort; // this means emergency call + } } } } // if !error @@ -553,6 +616,7 @@ { RDEBUG("0", 0); TInt err = KErrNone; + err = err; RDEBUG("iIsDisplayingDialog", iIsDisplayingDialog); if (iDeviceDialog && iIsDisplayingDialog) { diff -r 989397f9511c -r 67b3e3c1fc87 securitydialogs/SecUi/Src/SecUiAutoLockSettingPage.cpp --- a/securitydialogs/SecUi/Src/SecUiAutoLockSettingPage.cpp Thu Oct 14 13:56:11 2010 +0300 +++ b/securitydialogs/SecUi/Src/SecUiAutoLockSettingPage.cpp Wed Oct 20 14:51:23 2010 +0300 @@ -17,9 +17,7 @@ */ #include -#include #include -#include #include "SecUiAutoLockSettingPage.h" #include "secui.hrh" #include @@ -35,6 +33,10 @@ CBase(),iAutoLockValue(aAutoLockValue) { + aResourceId = aResourceId; + aCurrentSelectionItem = aCurrentSelectionItem; + aItemArray = aItemArray; + aAutoLockValue = aAutoLockValue; } // @@ -65,7 +67,7 @@ // void CAutoLockSettingPage::ProcessCommandL(TInt aCommandId) { - + aCommandId = aCommandId; } // // ---------------------------------------------------------- @@ -75,6 +77,7 @@ // void CAutoLockSettingPage::SetPeriodMaximumValue(TInt aMaximumValue) { + aMaximumValue = aMaximumValue; } //--------------------------------------------------------------------------------------- @@ -86,6 +89,7 @@ void CAutoLockSettingPage::HandlePointerEventL(const TPointerEvent& aPointerEvent) { + (void)aPointerEvent; } // End of file diff -r 989397f9511c -r 67b3e3c1fc87 securitydialogs/SecUi/Src/SecUiCodeQueryDialog.cpp --- a/securitydialogs/SecUi/Src/SecUiCodeQueryDialog.cpp Thu Oct 14 13:56:11 2010 +0300 +++ b/securitydialogs/SecUi/Src/SecUiCodeQueryDialog.cpp Wed Oct 20 14:51:23 2010 +0300 @@ -16,7 +16,7 @@ * */ -#include +// #include #include "secuicodequerydialog.h" // ================= MEMBER FUNCTIONS ======================= @@ -28,6 +28,11 @@ // EXPORT_C CCodeQueryDialog::CCodeQueryDialog(TDes& aDataText,TInt aMinLength,TInt aMaxLength,TInt aMode, TBool aIsRemoteLockQuery) : CBase() { + aDataText = aDataText; + aMinLength = aMinLength; + aMaxLength = aMaxLength; + aMode = aMode; + aIsRemoteLockQuery = aIsRemoteLockQuery; } // // ---------------------------------------------------------- diff -r 989397f9511c -r 67b3e3c1fc87 securitydialogs/SecUi/Src/SecUiManualSecuritySettings.cpp --- a/securitydialogs/SecUi/Src/SecUiManualSecuritySettings.cpp Thu Oct 14 13:56:11 2010 +0300 +++ b/securitydialogs/SecUi/Src/SecUiManualSecuritySettings.cpp Wed Oct 20 14:51:23 2010 +0300 @@ -374,45 +374,48 @@ RMmCustomAPI::TLockNumber aLockType; TInt ret = KErrGsm0707IncorrectPassword; TInt length = aLockCode.Length(); + aLockType = RMmCustomAPI::EOperator; + aLockType = aLockType; RDEBUG("length", length); // from now on, it accepts restricted lengths, although some locks are 20, others are 13 + // On 07/10/2010, this API is non-existent. Temporarilly remove the offendig code until a solution is found. if(aLockCode.Length() <= KSimLockMaxPasswordSize) { if (aType.CompareF(Operator) == 0) { aLockType = RMmCustomAPI::EOperator; - ret = iCustomPhone.ActivateSimLock( aLockCode,aLockType ); + // ret = iCustomPhone.ActivateSimLock( aLockCode,aLockType ); } if (aType.CompareF(Gid1) == 0) { aLockType = RMmCustomAPI::EGid1; - ret = iCustomPhone.ActivateSimLock( aLockCode,aLockType ); + // ret = iCustomPhone.ActivateSimLock( aLockCode,aLockType ); } if (aType.CompareF(Gid2) == 0) { aLockType = RMmCustomAPI::EGid2; - ret = iCustomPhone.ActivateSimLock( aLockCode,aLockType ); + // ret = iCustomPhone.ActivateSimLock( aLockCode,aLockType ); } if (aType.CompareF(Imsi) == 0) { aLockType = RMmCustomAPI::EImsi; - ret = iCustomPhone.ActivateSimLock( aLockCode,aLockType ); + // ret = iCustomPhone.ActivateSimLock( aLockCode,aLockType ); } if (aType.CompareF(Operator_Gid1) == 0) { aLockType = RMmCustomAPI::EOperator_Gid1; - ret = iCustomPhone.ActivateSimLock( aLockCode,aLockType ); + // ret = iCustomPhone.ActivateSimLock( aLockCode,aLockType ); } if (aType.CompareF(Operator_Gid2) == 0) { aLockType = RMmCustomAPI::EOperator_Gid2; - ret = iCustomPhone.ActivateSimLock( aLockCode,aLockType ); + // ret = iCustomPhone.ActivateSimLock( aLockCode,aLockType ); } } @@ -469,52 +472,55 @@ *****************************************************/ RDEBUG("0", 0); RMmCustomAPI::TLockNumber aLockType; + aLockType = RMmCustomAPI::EOperator; + aLockType = aLockType; TInt ret = KErrGsm0707IncorrectPassword; TInt length = aUnlockCode.Length(); RDEBUG("length", length); // from now on, it accepts restricted lengths, although some locks are 20, others are 13 + // On 07/10/2010, this API is non-existent. Temporarilly remove the offendig code until a solution is found. if(aUnlockCode.Length() <= KSimLockMaxPasswordSize) { if (aType.CompareF(Operator) == 0) { aLockType = RMmCustomAPI::EOperator; - ret = iCustomPhone.DeActivateSimLock( aUnlockCode,aLockType ); + // ret = iCustomPhone.DeActivateSimLock( aUnlockCode,aLockType ); } if (aType.CompareF(Gid1) == 0) { aLockType = RMmCustomAPI::EGid1; - ret = iCustomPhone.DeActivateSimLock( aUnlockCode,aLockType ); + // ret = iCustomPhone.DeActivateSimLock( aUnlockCode,aLockType ); } if (aType.CompareF(Gid2) == 0) { aLockType = RMmCustomAPI::EGid2; - ret = iCustomPhone.DeActivateSimLock( aUnlockCode,aLockType ); + // ret = iCustomPhone.DeActivateSimLock( aUnlockCode,aLockType ); } if (aType.CompareF(Imsi) == 0) { aLockType = RMmCustomAPI::EImsi; - ret = iCustomPhone.DeActivateSimLock( aUnlockCode,aLockType ); + // ret = iCustomPhone.DeActivateSimLock( aUnlockCode,aLockType ); } if (aType.CompareF(Operator_Gid1) == 0) { aLockType = RMmCustomAPI::EOperator_Gid1; - ret = iCustomPhone.DeActivateSimLock( aUnlockCode,aLockType ); + // ret = iCustomPhone.DeActivateSimLock( aUnlockCode,aLockType ); } if (aType.CompareF(Operator_Gid2) == 0) { aLockType = RMmCustomAPI::EOperator_Gid2; - ret = iCustomPhone.DeActivateSimLock( aUnlockCode,aLockType ); + // ret = iCustomPhone.DeActivateSimLock( aUnlockCode,aLockType ); } if (aType.CompareF(GlobalUnlock) == 0) { aLockType = RMmCustomAPI::EGlobalUnlock; - ret = iCustomPhone.DeActivateSimLock( aUnlockCode,aLockType ); + // ret = iCustomPhone.DeActivateSimLock( aUnlockCode,aLockType ); } } diff -r 989397f9511c -r 67b3e3c1fc87 securitydialogs/SecUi/Src/SecUiSecurityHandler.cpp --- a/securitydialogs/SecUi/Src/SecUiSecurityHandler.cpp Thu Oct 14 13:56:11 2010 +0300 +++ b/securitydialogs/SecUi/Src/SecUiSecurityHandler.cpp Wed Oct 20 14:51:23 2010 +0300 @@ -16,15 +16,12 @@ * */ #include -#include +// #include #include // #include #include #include -#ifdef __COVER_DISPLAY -#include -#endif //__COVER_DISPLAY #include #include @@ -34,7 +31,6 @@ // #include #include #include -// #include #include #include @@ -69,7 +65,7 @@ // ---------------------------------------------------------- // qtdone EXPORT_C CSecurityHandler::CSecurityHandler(RMobilePhone& aPhone) : - iPhone(aPhone), iQueryCanceled(ETrue), iSecurityDlg(NULL), iNoteDlg(NULL) + iPhone(aPhone), iQueryCanceled(ETrue), iSecurityDlg(NULL) { RDEBUG("0", 0); @@ -80,8 +76,10 @@ _LIT(KFileName, "secui_"); _LIT(KPath, "z:/resource/qt/translations/"); RDEBUG("HbTextResolverSymbian", 0); - result = HbTextResolverSymbian::Init(KFileName, KPath); - RDEBUG("result", result); + TBool resultResolver = HbTextResolverSymbian::Init(KFileName, KPath); + RDEBUG("resultResolver", resultResolver); + + RDEBUG("0x99", 0x99); } // @@ -263,7 +261,7 @@ lCancelSupported = ESecUiCancelSupported; TBuf<0x100> title; title.Zero(); - HBufC* stringHolder = HbTextResolverSymbian::LoadLC(_L("txt_pin_code_dialog_sec_code")); + HBufC* stringHolder = TranslateLC(_L("txt_devicelocking_dialog_lock_code"),0); // old txt_pin_code_dialog_sec_code. Perhaps txt_devicelocking_dialog_lock_code_unlock title.Append(stringHolder->Des()); CleanupStack::PopAndDestroy(stringHolder); title.Append(_L("$")); @@ -294,6 +292,7 @@ RArray aFailedPolicies; TInt retLockcode = KErrNone; + retLockcode = retLockcode; RMobilePhone::TMobilePassword aISACode; TInt scpFlags = 0; RDEBUG("scpClient.VerifyCurrentLockcode", 0); @@ -363,19 +362,19 @@ case KErrLocked: { // security code blocked! - CSecuritySettings::ShowResultNoteL(R_SEC_BLOCKED, CAknNoteDialog::EErrorTone); + CSecuritySettings::ShowResultNoteL(R_SEC_BLOCKED, EErrorTone); break; } case KErrGsm0707IncorrectPassword: case KErrAccessDenied: { // code was entered erroneusly - CSecuritySettings::ShowResultNoteL(R_CODE_ERROR, CAknNoteDialog::EErrorTone); + CSecuritySettings::ShowResultNoteL(R_CODE_ERROR, EErrorTone); break; } default: { - CSecuritySettings::ShowResultNoteL(status, CAknNoteDialog::EErrorTone); + CSecuritySettings::ShowResultNoteL(status, EErrorTone); } } RDEBUG("while AskSecCodeL", 1); @@ -421,13 +420,6 @@ res += 0x100; delete iSecurityDlg; } - if (iNoteDlg != NULL) - { - RDEBUG("deleting iNoteDlg", 0); - res += 0x1000; - delete iNoteDlg; - } - iNoteDlg = NULL; iSecurityDlg = NULL; } res += 0x10000; @@ -756,7 +748,7 @@ RDEBUG("lType", lType); TBuf<0x100> title; title.Zero(); - HBufC* stringHolder = HbTextResolverSymbian::LoadLC(_L("txt_pin_code_dialog_sec_code")); + HBufC* stringHolder = TranslateLC(_L("txt_devicelocking_dialog_lock_code_unlock"),0); // old txt_pin_code_dialog_sec_code title.Append(stringHolder->Des()); CleanupStack::PopAndDestroy(stringHolder); queryAccepted = iSecQueryUi->SecQueryDialog(title, iSecUi_password, SEC_C_SECURITY_CODE_MIN_LENGTH, SEC_C_SECURITY_CODE_MAX_LENGTH, lType); @@ -800,6 +792,7 @@ RArray aFailedPolicies; TDevicelockPolicies failedPolicy; TInt retLockcode = KErrNone; + retLockcode = retLockcode; RMobilePhone::TMobilePassword aISACode; TInt scpFlags = 0; RDEBUG("scpClient.VerifyCurrentLockcode", 0); @@ -897,9 +890,11 @@ } else { - CSecuritySettings::ShowResultNoteL(R_CONFIRMATION_NOTE, CAknNoteDialog::EConfirmationTone); + RDEBUG("no R_CONFIRMATION_NOTE", R_CONFIRMATION_NOTE); + // there's no need to show the note. Not when it's changed. Not when it becomes unlocked. Not on boot. Not on manual locking. not after *#7370# + // + // CSecuritySettings::ShowResultNoteL(R_CONFIRMATION_NOTE, EConfirmationTone); } - RDEBUG("R_CONFIRMATION_NOTE", R_CONFIRMATION_NOTE); if (FeatureManager::FeatureSupported(KFeatureIdSapTerminalControlFw)) { RDEBUG("KFeatureIdSapTerminalControlFw", @@ -1054,14 +1049,14 @@ // security code blocked! RDEBUG("KErrLocked", KErrLocked) ; - CSecuritySettings::ShowResultNoteL(R_SEC_BLOCKED, CAknNoteDialog::EErrorTone); + CSecuritySettings::ShowResultNoteL(R_SEC_BLOCKED, EErrorTone); } break; case KErrGsm0707IncorrectPassword: { RDEBUG("KErrGsm0707IncorrectPassword", KErrGsm0707IncorrectPassword); // The Settings caller might retry - CSecuritySettings::ShowResultNoteL(R_CODE_ERROR, CAknNoteDialog::EErrorTone); + CSecuritySettings::ShowResultNoteL(R_CODE_ERROR, EErrorTone); if(StartUp) goto askPassPhraseRequiredL; } @@ -1071,7 +1066,7 @@ { RDEBUG("KErrAccessDenied", KErrAccessDenied); // The Settings caller might retry - CSecuritySettings::ShowResultNoteL(R_CODE_ERROR, CAknNoteDialog::EErrorTone); + CSecuritySettings::ShowResultNoteL(R_CODE_ERROR, EErrorTone); } break; case R_CODES_DONT_MATCH: // if password was supposed to be changed, but it failed (the initial verification) @@ -1179,7 +1174,7 @@ lAlphaSupported = ESecUiAlphaNotSupported; TBuf<0x100> title; title.Zero(); - HBufC* stringHolder = HbTextResolverSymbian::LoadLC(_L("txt_pin_code_dialog_pin_code")); + HBufC* stringHolder = TranslateLC(_L("txt_pin_code_dialog_pin_code"),0); title.Append(stringHolder->Des()); CleanupStack::PopAndDestroy(stringHolder); title.Append(_L("$")); @@ -1194,7 +1189,7 @@ RDEBUG("queryAccepted", queryAccepted); /* end request PIN using QT */ - if (queryAccepted == KErrAbort) // emergency call + if (queryAccepted == KErrAbort || queryAccepted == KErrArgument) // emergency call { RDEBUG("queryAccepted", queryAccepted); CleanupStack::PopAndDestroy(wait); // this is needed @@ -1228,13 +1223,13 @@ ; if (lCancelSupported == ESecUiCancelNotSupported) { // OK note is not displayed in boot-up, to make things faster - CSecuritySettings::ShowResultNoteL(R_CONFIRMATION_NOTE, CAknNoteDialog::EConfirmationTone); + CSecuritySettings::ShowResultNoteL(R_CONFIRMATION_NOTE, EConfirmationTone); } break; case KErrGsm0707IncorrectPassword: case KErrAccessDenied: // code was entered erroneously - CSecuritySettings::ShowResultNoteL(R_CODE_ERROR, CAknNoteDialog::EErrorTone); + CSecuritySettings::ShowResultNoteL(R_CODE_ERROR, EErrorTone); RDEBUG("StartUp", StartUp); if (StartUp) { @@ -1247,7 +1242,7 @@ // what if not during Startup? Probably it's Ok since the SIM would had also failed at StartUp RDEBUG("StartUp", StartUp); if (StartUp) - CSecuritySettings::ShowResultNoteL(R_CODE_ERROR, CAknNoteDialog::EErrorTone); + CSecuritySettings::ShowResultNoteL(R_CODE_ERROR, EErrorTone); break; case KErrGsm0707SimWrong: // sim lock active @@ -1321,7 +1316,7 @@ RDEBUG("attempts", attempts); // show the last "Code Error" note of PIN verify result here so it won't be left under the PUK1 dialog if (!StartUp && (attempts == KMaxNumberOfPUKAttempts)) - CSecuritySettings::ShowResultNoteL(R_CODE_ERROR, CAknNoteDialog::EErrorTone); + CSecuritySettings::ShowResultNoteL(R_CODE_ERROR, EErrorTone); if (attempts == KMaxNumberOfPINAttempts) attempts = -1; @@ -1334,7 +1329,7 @@ // ESecUiCodeEtelReqest/ESecUiNone might be useful TBuf<0x100> title; title.Zero(); - HBufC* stringHolder = HbTextResolverSymbian::LoadLC(_L("txt_pin_code_dialog_puk_code")); + HBufC* stringHolder = TranslateLC(_L("txt_pin_code_dialog_puk_code"),0); title.Append(stringHolder->Des()); CleanupStack::PopAndDestroy(stringHolder); title.Append(_L("$")); @@ -1375,12 +1370,12 @@ { case KErrNone: // code approved -> note . The process continue and new-pin is requested - CSecuritySettings::ShowResultNoteL(res, CAknNoteDialog::EConfirmationTone); + CSecuritySettings::ShowResultNoteL(res, EConfirmationTone); break; case KErrGsm0707IncorrectPassword: case KErrAccessDenied: // wrong PUK code -> note -> ask PUK code again - CSecuritySettings::ShowResultNoteL(R_CODE_ERROR, CAknNoteDialog::EErrorTone); + CSecuritySettings::ShowResultNoteL(R_CODE_ERROR, EErrorTone); RDEBUG("goto askPuk1RequiredL", 0); goto askPuk1RequiredL; // break; @@ -1412,11 +1407,11 @@ RDEBUG("SecQueryDialog", 1); TBuf<0x100> title; title.Zero(); - HBufC* stringHolder = HbTextResolverSymbian::LoadLC(_L("txt_pin_code_dialog_new_pin_code")); + HBufC* stringHolder = TranslateLC(_L("txt_pin_code_dialog_new_pin_code"),0); title.Append(stringHolder->Des()); CleanupStack::PopAndDestroy(stringHolder); title.Append(_L("|")); - HBufC* stringHolder2 = HbTextResolverSymbian::LoadLC(_L("txt_pin_code_dialog_verify_new_pin_code")); + HBufC* stringHolder2 = TranslateLC(_L("txt_pin_code_dialog_verify_new_pin_code"),0); title.Append(stringHolder2->Des()); CleanupStack::PopAndDestroy(stringHolder2); lSecUiCancelSupported = ESecUiCancelNotSupported; // initialy it was ESecUiCancelSupported , but an error said "Becaouse, if it is can be canceled, why desigh this step about newpincode confirm" @@ -1456,12 +1451,12 @@ { case KErrNone: // code approved -> note - CSecuritySettings::ShowResultNoteL(R_PIN_CODE_CHANGED_NOTE, CAknNoteDialog::EConfirmationTone); + CSecuritySettings::ShowResultNoteL(R_PIN_CODE_CHANGED_NOTE, EConfirmationTone); break; case KErrGsm0707IncorrectPassword: case KErrAccessDenied: // wrong PUK code -> note -> ask PUK code again - CSecuritySettings::ShowResultNoteL(R_CODE_ERROR, CAknNoteDialog::EErrorTone); + CSecuritySettings::ShowResultNoteL(R_CODE_ERROR, EErrorTone); returnValue = Puk1RequiredL(); break; case KErrGsm0707SimWrong: @@ -1526,7 +1521,7 @@ TBuf<0x100> title; title.Zero(); - HBufC* stringHolder = HbTextResolverSymbian::LoadLC(_L("txt_pin_code_dialog_pin2_code")); + HBufC* stringHolder = TranslateLC(_L("txt_pin_code_dialog_pin2_code"),0); title.Append(stringHolder->Des()); CleanupStack::PopAndDestroy(stringHolder); title.Append(_L("$")); @@ -1563,12 +1558,12 @@ case KErrGsm0707IncorrectPassword: case KErrAccessDenied: // code was entered erroneously - CSecuritySettings::ShowResultNoteL(R_CODE_ERROR, CAknNoteDialog::EErrorTone); + CSecuritySettings::ShowResultNoteL(R_CODE_ERROR, EErrorTone); break; case KErrGsmSSPasswordAttemptsViolation: case KErrLocked: // blocked - CSecuritySettings::ShowResultNoteL(R_CODE_ERROR, CAknNoteDialog::EErrorTone); + CSecuritySettings::ShowResultNoteL(R_CODE_ERROR, EErrorTone); break; default: CSecuritySettings::ShowErrorNoteL(status); @@ -1626,7 +1621,7 @@ TBuf<0x100> title; title.Zero(); - HBufC* stringHolder = HbTextResolverSymbian::LoadLC(_L("txt_pin_code_dialog_puk2_code")); + HBufC* stringHolder = TranslateLC(_L("txt_pin_code_dialog_puk2_code"),0); title.Append(stringHolder->Des()); CleanupStack::PopAndDestroy(stringHolder); title.Append(_L("$")); @@ -1661,19 +1656,19 @@ { case KErrNone: // code approved -> note - CSecuritySettings::ShowResultNoteL(res, CAknNoteDialog::EConfirmationTone); + CSecuritySettings::ShowResultNoteL(res, EConfirmationTone); break; case KErrGsm0707IncorrectPassword: case KErrAccessDenied: // wrong PUK2 code -> note -> ask PUK2 code again - CSecuritySettings::ShowResultNoteL(R_CODE_ERROR, CAknNoteDialog::EErrorTone); + CSecuritySettings::ShowResultNoteL(R_CODE_ERROR, EErrorTone); RDEBUG("goto askPuk2RequiredL", 0); goto askPuk2RequiredL; // break; case KErrGsmSSPasswordAttemptsViolation: case KErrLocked: // Pin2 features blocked permanently! - CSecuritySettings::ShowResultNoteL(R_PIN2_REJECTED, CAknNoteDialog::EConfirmationTone); + CSecuritySettings::ShowResultNoteL(R_PIN2_REJECTED, EConfirmationTone); break; default: CSecuritySettings::ShowErrorNoteL(res); @@ -1693,11 +1688,11 @@ iQueryCanceled = EFalse; TBuf<0x100> title; title.Zero(); - HBufC* stringHolder = HbTextResolverSymbian::LoadLC(_L("txt_pin_code_dialog_new_pin2_code")); + HBufC* stringHolder = TranslateLC(_L("txt_pin_code_dialog_new_pin2_code"),0); title.Append(stringHolder->Des()); CleanupStack::PopAndDestroy(stringHolder); title.Append(_L("|")); - HBufC* stringHolder2 = HbTextResolverSymbian::LoadLC(_L("Verify")); + HBufC* stringHolder2 = TranslateLC(_L("Verify"),0); title.Append(stringHolder2->Des()); CleanupStack::PopAndDestroy(stringHolder2); // ESecUiCodeEtelReqest/ESecUiNone might be useful @@ -1731,18 +1726,18 @@ { case KErrNone: // code approved -> note - CSecuritySettings::ShowResultNoteL(R_PIN2_CODE_CHANGED_NOTE, CAknNoteDialog::EConfirmationTone); + CSecuritySettings::ShowResultNoteL(R_PIN2_CODE_CHANGED_NOTE, EConfirmationTone); break; case KErrGsm0707IncorrectPassword: case KErrAccessDenied: // wrong PUK2 code -> note -> ask PUK2 code again - CSecuritySettings::ShowResultNoteL(R_CODE_ERROR, CAknNoteDialog::EErrorTone); + CSecuritySettings::ShowResultNoteL(R_CODE_ERROR, EErrorTone); Puk2RequiredL(); break; case KErrGsmSSPasswordAttemptsViolation: case KErrLocked: // Pin2 features blocked permanently! - CSecuritySettings::ShowResultNoteL(R_PIN2_REJECTED, CAknNoteDialog::EConfirmationTone); + CSecuritySettings::ShowResultNoteL(R_PIN2_REJECTED, EConfirmationTone); break; default: CSecuritySettings::ShowErrorNoteL(res); @@ -1814,7 +1809,7 @@ TBuf<0x100> title; title.Zero(); - HBufC* stringHolder = HbTextResolverSymbian::LoadLC(_L("txt_pin_code_dialog_upin_code")); + HBufC* stringHolder = TranslateLC(_L("txt_pin_code_dialog_upin_code"),0); title.Append(stringHolder->Des()); CleanupStack::PopAndDestroy(stringHolder); title.Append(_L("$")); @@ -1849,12 +1844,12 @@ // code approved RDEBUG("code approved ", 0) ; - CSecuritySettings::ShowResultNoteL(R_CONFIRMATION_NOTE, CAknNoteDialog::EConfirmationTone); + CSecuritySettings::ShowResultNoteL(R_CONFIRMATION_NOTE, EConfirmationTone); break; case KErrGsm0707IncorrectPassword: case KErrAccessDenied: // code was entered erroneously - CSecuritySettings::ShowResultNoteL(R_CODE_ERROR, CAknNoteDialog::EErrorTone); + CSecuritySettings::ShowResultNoteL(R_CODE_ERROR, EErrorTone); if (StartUp) { returnValue = UPinRequiredL(); @@ -1864,7 +1859,7 @@ case KErrLocked: // code blocked; show error note and terminate. if (StartUp) - CSecuritySettings::ShowResultNoteL(res, CAknNoteDialog::EErrorTone); + CSecuritySettings::ShowResultNoteL(res, EErrorTone); break; case KErrGsm0707SimWrong: // sim lock active @@ -1920,7 +1915,7 @@ User::LeaveIfError(res); //show last "Code Error" note for UPIN verify result so it won't be left under the PUK1 dialog if (!StartUp && (codeInfo.iRemainingEntryAttempts == KMaxNumberOfPUKAttempts)) - CSecuritySettings::ShowResultNoteL(R_CODE_ERROR, CAknNoteDialog::EErrorTone); + CSecuritySettings::ShowResultNoteL(R_CODE_ERROR, EErrorTone); // ask UPUK code /* request PIN using QT */ @@ -1934,7 +1929,7 @@ TBuf<0x100> title; title.Zero(); - HBufC* stringHolder = HbTextResolverSymbian::LoadLC(_L("txt_pin_code_dialog_puk_code")); + HBufC* stringHolder = TranslateLC(_L("txt_pin_code_dialog_puk_code"),0); title.Append(stringHolder->Des()); CleanupStack::PopAndDestroy(stringHolder); title.Append(_L("$")); @@ -1964,11 +1959,11 @@ // TODO also support Emergency TBuf<0x100> title; title.Zero(); - HBufC* stringHolder = HbTextResolverSymbian::LoadLC(_L("txt_pin_code_dialog_new_upin_code")); + HBufC* stringHolder = TranslateLC(_L("txt_pin_code_dialog_new_upin_code"),0); title.Append(stringHolder->Des()); CleanupStack::PopAndDestroy(stringHolder); title.Append(_L("|")); - HBufC* stringHolder2 = HbTextResolverSymbian::LoadLC(_L("Verify")); + HBufC* stringHolder2 = TranslateLC(_L("Verify"),0); title.Append(stringHolder2->Des()); CleanupStack::PopAndDestroy(stringHolder2); queryAccepted = iSecQueryUi->SecQueryDialog(title, aNewPassword, SEC_C_PUK_CODE_MIN_LENGTH, SEC_C_PUK_CODE_MAX_LENGTH, ESecUiAlphaNotSupported | ESecUiCancelSupported @@ -1998,12 +1993,12 @@ { case KErrNone: // code approved -> note - CSecuritySettings::ShowResultNoteL(R_UPIN_CODE_CHANGED_NOTE, CAknNoteDialog::EConfirmationTone); + CSecuritySettings::ShowResultNoteL(R_UPIN_CODE_CHANGED_NOTE, EConfirmationTone); break; case KErrGsm0707IncorrectPassword: case KErrAccessDenied: // wrong PUK code -> note -> ask UPUK code again - CSecuritySettings::ShowResultNoteL(R_CODE_ERROR, CAknNoteDialog::EErrorTone); + CSecuritySettings::ShowResultNoteL(R_CODE_ERROR, EErrorTone); returnValue = UPukRequiredL(); break; case KErrGsm0707SimWrong: @@ -2035,7 +2030,7 @@ void CSecurityHandler::SimLockEventL() { RDEBUG("0", 0); - CSecuritySettings::ShowResultNoteL(R_SIM_ON, CAknNoteDialog::EConfirmationTone); + CSecuritySettings::ShowResultNoteL(R_SIM_ON, EConfirmationTone); } // --------------------------------------------------------- // CSecurityHandler::RemoveSplashScreenL() @@ -2057,7 +2052,96 @@ RDEBUG("aStatus", aStatus); RDEBUG("!!!!! this should never be called !!!!", 0); - CSecuritySettings::ShowResultNoteL(aStatus, CAknNoteDialog::EErrorTone); + CSecuritySettings::ShowResultNoteL(aStatus, EErrorTone); + } +// +// ---------------------------------------------------------- +// CSecuritySettings::TranslateLC() +// ---------------------------------------------------------- +// qtdone +HBufC* CSecurityHandler::TranslateLC(const TDesC& aMessageId, TInt aFlags) + { + RDEBUG("aFlags", aFlags); + RDEBUG("aMessageId", 1); + (void)aFlags; + + _LIT(KPath, "z:/resource/qt/translations/"); + + TBool result=EFalse; + result=result; + TBuf<0x100> title; + title.Zero(); + HBufC* stringHolder; + RDEBUG("before stringHolder", 0); + stringHolder = HbTextResolverSymbian::LoadLC(aMessageId); + RDEBUG("got stringHolder", 1); + title.Append(stringHolder->Des()); + RDEBUG("title", 0); + RDEBUGSTR(title); + RDEBUG("searched in default", 1); + // this doesn't work because and error in HbTextResolverSymbian::Init + int doDoubleTranslations = 0; + RDEBUG("doDoubleTranslations", doDoubleTranslations); + if(doDoubleTranslations && !title.CompareF(aMessageId)) + { + // not translated. Now check in common + CleanupStack::PopAndDestroy(stringHolder); + RDEBUG("1", 1); + title.Zero(); + RDEBUG("1", 1); + _LIT(KFileNameSecUi, "secui_"); + RDEBUG("1", 1); + result = HbTextResolverSymbian::Init(KFileNameSecUi, KPath); + RDEBUG("1", 1); + RDEBUG("bool result", result); + RDEBUG("1", 1); + stringHolder = HbTextResolverSymbian::LoadLC(aMessageId); + RDEBUG("1", 1); + title.Append(stringHolder->Des()); + RDEBUG("1", 1); + RDEBUG("searched in KFileNameSecUi", 1); + // RDEBUGSTR(aMessageId); + } + RDEBUG("1", 1); + if(doDoubleTranslations && !title.CompareF(aMessageId)) + { + RDEBUG("1", 1); + // not translated. Now check in common + CleanupStack::PopAndDestroy(stringHolder); + RDEBUG("1", 1); + title.Zero(); + RDEBUG("1", 1); + _LIT(KFileNameCommon, "common_"); + RDEBUG("1", 1); + result = HbTextResolverSymbian::Init(KFileNameCommon, KPath); + RDEBUG("bool result", result); + stringHolder = HbTextResolverSymbian::LoadLC(aMessageId); + RDEBUG("1", 1); + title.Append(stringHolder->Des()); + RDEBUG("searched in KFileNameCommon", 1); + // RDEBUGSTR(aMessageId); + } + if(doDoubleTranslations && !title.CompareF(aMessageId)) + { + // not translated. Now check in devicelocking + RDEBUG("1", 1); + CleanupStack::PopAndDestroy(stringHolder); + RDEBUG("1", 1); + title.Zero(); + RDEBUG("1", 1); + _LIT(KFileNameDevicelocking, "devicelocking_"); + RDEBUG("1", 1); + result = HbTextResolverSymbian::Init(KFileNameDevicelocking, KPath); + RDEBUG("bool result", result); + stringHolder = HbTextResolverSymbian::LoadLC(aMessageId); + RDEBUG("1", 1); + title.Append(stringHolder->Des()); + RDEBUG("searched in KFileNameDevicelocking", 1); + // RDEBUGSTR(aMessageId); + } + // this is done by the caller: CleanupStack::PopAndDestroy(stringHolder); + RDEBUG("0x99", 0x99); + return stringHolder; } // End of file diff -r 989397f9511c -r 67b3e3c1fc87 securitydialogs/SecUi/Src/SecUiSecuritySettings.cpp --- a/securitydialogs/SecUi/Src/SecUiSecuritySettings.cpp Thu Oct 14 13:56:11 2010 +0300 +++ b/securitydialogs/SecUi/Src/SecUiSecuritySettings.cpp Wed Oct 20 14:51:23 2010 +0300 @@ -19,7 +19,6 @@ #include #include #include -#include #include #include #include @@ -36,7 +35,6 @@ #include "secuicodequerydialog.h" #include "SecUiWait.h" #include -#include #include #include #include @@ -132,12 +130,12 @@ User::LeaveIfError(iCustomPhone.Open(iPhone)); iSecurityHandler = new (ELeave) CSecurityHandler(iPhone); + _LIT(KFileName, "secui_"); _LIT(KPath, "z:/resource/qt/translations/"); RDEBUG("HbTextResolverSymbian", 0); TBool result = HbTextResolverSymbian::Init(KFileName, KPath); RDEBUG("result", result); - } // // ---------------------------------------------------------- @@ -377,11 +375,11 @@ // this queries both, and verifies itself TBuf<0x100> title; title.Zero(); - HBufC* stringHolder = HbTextResolverSymbian::LoadLC(_L("txt_pin_code_dialog_new_rem_code")); + HBufC* stringHolder = TranslateLC(_L("txt_device_dialog_new_locking_message"),0); // old txt_pin_code_dialog_new_rem_code title.Append(stringHolder->Des()); CleanupStack::PopAndDestroy(stringHolder); title.Append(_L("|")); - HBufC* stringHolder2 = HbTextResolverSymbian::LoadLC(_L("Verify")); + HBufC* stringHolder2 = TranslateLC(_L("txt_device_dialog_retype_locking_message"),0); title.Append(stringHolder2->Des()); CleanupStack::PopAndDestroy(stringHolder2); queryAccepted = iSecQueryUi->SecQueryDialog(title, aRemoteLockCode, SEC_REMOTELOCK_CODE_MIN_LENGTH, SEC_REMOTELOCK_CODE_MAX_LENGTH, ESecUiAlphaSupported @@ -411,6 +409,7 @@ RDEBUG("ret", ret); retLockcode = scpClient.VerifyCurrentLockcode(aRemoteLockCode, aISACode, aFailedPolicies, scpFlags); RDEBUG("retLockcode", retLockcode); + retLockcode=retLockcode; scpClient.Close(); RDEBUG("aISACode", 0); @@ -435,7 +434,7 @@ // remote lock code matches the security code // and that is not allowed RDEBUG( "return KErrCancel because msg matches code", KErrCancel ); - ShowResultNoteL(R_REMOTELOCK_INVALID_CODE, CAknNoteDialog::EErrorTone); + ShowResultNoteL(R_REMOTELOCK_INVALID_CODE, EErrorTone); return KErrCancel; } @@ -521,7 +520,7 @@ default: break; } - + // This doesn't loop RDEBUG( "retValue", retValue ); return retValue; } @@ -583,22 +582,10 @@ newWait = CWait::NewL(); RDEBUG("newWait SetLockSetting", 0); iPhone.SetLockSetting(newWait->iStatus, lockType, lockChangeSetting); // this invokes the handler - RDEBUG("newWait WaitForRequestL", - 0); + RDEBUG("newWait WaitForRequestL", 0); status = newWait->WaitForRequestL(); - RDEBUG("newWait WaitForRequestL status", - status); + RDEBUG("newWait WaitForRequestL status", status); delete newWait; - -/* - iWait->SetRequestType(EMobilePhoneSetLockSetting); - RProperty::Set(KPSUidSecurityUIs, KSecurityUIsQueryRequestCancel, ESecurityUIsQueryRequestOk); - RDEBUG("SetLockSetting", 0); - iPhone.SetLockSetting(iWait->iStatus, lockType, lockChangeSetting); // this invokes the handler - RDEBUG("WaitForRequestL", 0); - status = iWait->WaitForRequestL(); - RDEBUG("WaitForRequestL status", status); -*/ #ifdef __WINS__ if (status == KErrNotSupported || status == KErrTimedOut) status = KErrNone; @@ -692,7 +679,7 @@ if (simRemoved) { - ShowResultNoteL(R_INSERT_SIM, CAknNoteDialog::EErrorTone); + ShowResultNoteL(R_INSERT_SIM, EErrorTone); return EFalse; } @@ -759,7 +746,7 @@ case KErrGsm0707OperationNotAllowed: { // not allowed with this sim - ShowResultNoteL(R_OPERATION_NOT_ALLOWED, CAknNoteDialog::EErrorTone); + ShowResultNoteL(R_OPERATION_NOT_ALLOWED, EErrorTone); return EFalse; } case KErrGsm0707IncorrectPassword: @@ -814,7 +801,7 @@ if (simRemoved) { - ShowResultNoteL(R_INSERT_SIM, CAknNoteDialog::EErrorTone); + ShowResultNoteL(R_INSERT_SIM, EErrorTone); return EFalse; } @@ -863,11 +850,11 @@ if (activeCode != RMobilePhone::ESecurityUniversalPin) { - ShowResultNoteL(R_UPIN_NOT_ALLOWED, CAknNoteDialog::EErrorTone); + ShowResultNoteL(R_UPIN_NOT_ALLOWED, EErrorTone); } else { - ShowResultNoteL(R_PIN_NOT_ALLOWED, CAknNoteDialog::EErrorTone); + ShowResultNoteL(R_PIN_NOT_ALLOWED, EErrorTone); } return EFalse; } @@ -918,7 +905,7 @@ case KErrGsm0707OperationNotAllowed: { // not allowed with this sim - ShowResultNoteL(R_OPERATION_NOT_ALLOWED, CAknNoteDialog::EErrorTone); + ShowResultNoteL(R_OPERATION_NOT_ALLOWED, EErrorTone); return EFalse; } case KErrGsm0707IncorrectPassword: @@ -1032,11 +1019,11 @@ case KErrGsmSSPasswordAttemptsViolation: case KErrLocked: // Pin2 features blocked permanently! - ShowResultNoteL(R_PIN2_REJECTED, CAknNoteDialog::EConfirmationTone); + ShowResultNoteL(R_PIN2_REJECTED, EConfirmationTone); break; case KErrGsm0707SimNotInserted: // not allowed with this sim - ShowResultNoteL(R_OPERATION_NOT_ALLOWED, CAknNoteDialog::EErrorTone); + ShowResultNoteL(R_OPERATION_NOT_ALLOWED, EErrorTone); break; default: ShowErrorNoteL(retPhone); @@ -1071,7 +1058,7 @@ iSecQueryUi = CSecQueryUi::NewL(); TBuf<0x100> title; title.Zero(); - HBufC* stringHolder = HbTextResolverSymbian::LoadLC(_L("txt_pin_code_dialog_pin2_code")); + HBufC* stringHolder = TranslateLC(_L("txt_pin_code_dialog_pin2_code"),0); title.Append(stringHolder->Des()); CleanupStack::PopAndDestroy(stringHolder); title.Append(_L("$")); @@ -1105,16 +1092,16 @@ case KErrGsm0707IncorrectPassword: case KErrAccessDenied: // code was entered erroneously - ShowResultNoteL(R_CODE_ERROR, CAknNoteDialog::EErrorTone); + ShowResultNoteL(R_CODE_ERROR, EErrorTone); return AskPin2L(); case KErrGsm0707OperationNotAllowed: // not allowed with this sim - ShowResultNoteL(R_OPERATION_NOT_ALLOWED, CAknNoteDialog::EErrorTone); + ShowResultNoteL(R_OPERATION_NOT_ALLOWED, EErrorTone); return EFalse; case KErrGsmSSPasswordAttemptsViolation: case KErrLocked: // code was blocked - ShowResultNoteL(R_CODE_ERROR, CAknNoteDialog::EErrorTone); + ShowResultNoteL(R_CODE_ERROR, EErrorTone); return EFalse; default: ShowErrorNoteL(retPhone); @@ -1155,11 +1142,11 @@ case KErrGsmSSPasswordAttemptsViolation: case KErrLocked: // Pin2 features blocked permanently! - ShowResultNoteL(R_PIN2_REJECTED, CAknNoteDialog::EConfirmationTone); + ShowResultNoteL(R_PIN2_REJECTED, EConfirmationTone); break; case KErrGsm0707SimNotInserted: // not allowed with this sim - ShowResultNoteL(R_OPERATION_NOT_ALLOWED, CAknNoteDialog::EErrorTone); + ShowResultNoteL(R_OPERATION_NOT_ALLOWED, EErrorTone); break; default: ShowErrorNoteL(ret); @@ -1214,7 +1201,7 @@ break; case KErrGsm0707OperationNotAllowed: // not allowed with this sim - ShowResultNoteL(R_OPERATION_NOT_ALLOWED, CAknNoteDialog::EErrorTone); + ShowResultNoteL(R_OPERATION_NOT_ALLOWED, EErrorTone); break; default: ShowErrorNoteL(status); @@ -1247,7 +1234,7 @@ { RDEBUG("aError", aError); - ShowResultNoteL(aError, CAknNoteDialog::EErrorTone); + ShowResultNoteL(aError, EErrorTone); } // @@ -1256,7 +1243,7 @@ // Shows result note // ---------------------------------------------------------- // qtdone -void CSecuritySettings::ShowResultNoteL(TInt aResourceID, CAknNoteDialog::TTone aTone) +void CSecuritySettings::ShowResultNoteL(TInt aResourceID, TInt aTone) { RDEBUG("aResourceID", aResourceID); @@ -1312,7 +1299,7 @@ title.Append(_L("Not Supported")); break; case R_SEC_BLOCKED: - titleTr.Append(_L("txt_pin_code_dpopinfo_security_blocked")); + titleTr.Append(_L("txt_devicelocking_dpophead_lock_code_is_blocked")); // txt_pin_code_dpopinfo_security_blocked title.Append(_L("BLOCKED")); break; case R_CODE_ERROR: @@ -1329,7 +1316,7 @@ satisfactoryIcon = 1; break; case R_CODES_DONT_MATCH: - titleTr.Append(_L("R_CODES_DONT_MATCH")); + titleTr.Append(_L("txt_devicelocking_dpophead_codes_do_not_match")); title.Append(_L("CODES DONT MATCH")); break; case R_PIN_CODE_CHANGED_NOTE: @@ -1496,11 +1483,21 @@ HBufC* stringHolder; RDEBUG("titleTr", 1); - stringHolder = HbTextResolverSymbian::LoadLC(titleTr); // titleTr should I TRAP( err, ? - RDEBUG("got stringHolder", 1); + stringHolder = TranslateLC(titleTr,0); // titleTr should I TRAP( err, ? + if(!stringHolder) + { + RDEBUG("not got stringHolder", 0); + } + else + { + RDEBUG("got stringHolder", 1); + } messageBox->SetTextL(stringHolder->Des()); // title RDEBUG("aResourceID", aResourceID); + RDEBUG("titleTr", 0); RDEBUGSTR(titleTr); + RDEBUG("stringHolder->Des()", 0); + RDEBUGSTR(stringHolder->Des()); _LIT(KIconNameWondering, "qtg_small_smiley_wondering"); _LIT(KIconNameSmile, "qtg_small_smiley_smile"); if (satisfactoryIcon==1) @@ -1508,7 +1505,7 @@ else messageBox->SetIconNameL(KIconNameWondering); - if (aTone == CAknNoteDialog::EErrorTone) // another case is EConfirmationTone + if (aTone == EErrorTone) // another case is EConfirmationTone { messageBox->SetTimeout(messageBox->Timeout() * 2); // errors are displayed double time } @@ -1516,9 +1513,11 @@ RDEBUG("calling ExecL", 0); CHbDeviceMessageBoxSymbian::TButtonId selection = messageBox->ExecL(); // this guarantees that it waits for the dismiss/timeout RDEBUG("called ExecL.selection", selection); + CleanupStack::PopAndDestroy(stringHolder); CleanupStack::PopAndDestroy(); // messageBox + RDEBUG("0x99", 0x99); } // @@ -1628,6 +1627,9 @@ RDEBUG("aCaption", 0); RDEBUGSTR(aCaption); RDEBUG("aShowError", aShowError); + (void)aFlags; + (void)aCaption; + (void)aShowError; /***************************************************** * Series 60 Customer / ETel @@ -1643,7 +1645,7 @@ RDEBUG("simRemoved", simRemoved); if (simRemoved) { - ShowResultNoteL(R_INSERT_SIM, CAknNoteDialog::EErrorTone); + ShowResultNoteL(R_INSERT_SIM, EErrorTone); return KErrAccessDenied; } RMobilePhone::TMobilePhoneSecurityCode secCodeType; @@ -1693,7 +1695,7 @@ { RDEBUG("RMobilePhone::ELockSetDisabled", RMobilePhone::ELockSetDisabled); - ShowResultNoteL(R_PIN_NOT_ALLOWED, CAknNoteDialog::EErrorTone); + ShowResultNoteL(R_PIN_NOT_ALLOWED, EErrorTone); return KErrAccessDenied; } @@ -1728,7 +1730,7 @@ iSecQueryUi = CSecQueryUi::NewL(); TBuf<0x100> title; title.Zero(); - HBufC* stringHolder = HbTextResolverSymbian::LoadLC(_L("txt_pin_code_dialog_pin_code")); + HBufC* stringHolder = TranslateLC(_L("txt_pin_code_dialog_pin_code"),0); title.Append(stringHolder->Des()); CleanupStack::PopAndDestroy(stringHolder); title.Append(_L("$")); @@ -1755,7 +1757,7 @@ #endif if (res != KErrNone) { - ShowResultNoteL(res, CAknNoteDialog::EErrorTone); + ShowResultNoteL(res, EErrorTone); newPassword = _L(""); oldPassword = _L(""); goto askChangePinParamsL; @@ -1775,7 +1777,7 @@ // this is not needed because the dialog won't allow to close, unless codes match // codes do not match -> note -> ask new pin and verification codes again // if(newPassword.Length()>0) - // ShowResultNoteL(R_CODES_DONT_MATCH, CAknNoteDialog::EErrorTone); + // ShowResultNoteL(R_CODES_DONT_MATCH, EErrorTone); newPassword = _L(""); @@ -1788,11 +1790,11 @@ // this queries both, and verifies itself TBuf<0x100> title; title.Zero(); - HBufC* stringHolder = HbTextResolverSymbian::LoadLC(_L("txt_pin_code_dialog_new_pin_code")); + HBufC* stringHolder = TranslateLC(_L("txt_pin_code_dialog_new_pin_code"),0); title.Append(stringHolder->Des()); CleanupStack::PopAndDestroy(stringHolder); title.Append(_L("|")); - HBufC* stringHolder2 = HbTextResolverSymbian::LoadLC(_L("txt_pin_code_dialog_verify_new_pin_code")); + HBufC* stringHolder2 = TranslateLC(_L("txt_pin_code_dialog_verify_new_pin_code"),0); title.Append(stringHolder2->Des()); CleanupStack::PopAndDestroy(stringHolder2); queryAccepted = iSecQueryUi->SecQueryDialog(title, newPassword, SEC_C_PIN_CODE_MIN_LENGTH, SEC_C_PIN_CODE_MAX_LENGTH, ESecUiAlphaNotSupported | ESecUiCancelSupported @@ -1830,14 +1832,14 @@ case KErrNone: { // code changed - ShowResultNoteL(R_PIN_CODE_CHANGED_NOTE, CAknNoteDialog::EConfirmationTone); + ShowResultNoteL(R_PIN_CODE_CHANGED_NOTE, EConfirmationTone); break; } case KErrGsm0707IncorrectPassword: case KErrAccessDenied: { // code was entered erroneously. This is strange, because it was verified before - ShowResultNoteL(R_CODE_ERROR, CAknNoteDialog::EErrorTone); + ShowResultNoteL(R_CODE_ERROR, EErrorTone); goto askChangePinParamsL; } case KErrGsmSSPasswordAttemptsViolation: @@ -1849,7 +1851,7 @@ case KErrGsm0707OperationNotAllowed: { // not allowed with this sim - ShowResultNoteL(R_OPERATION_NOT_ALLOWED, CAknNoteDialog::EErrorTone); + ShowResultNoteL(R_OPERATION_NOT_ALLOWED, EErrorTone); return KErrGsm0707OperationNotAllowed; } case KErrAbort: @@ -1897,7 +1899,7 @@ if (simRemoved) { - ShowResultNoteL(R_INSERT_SIM, CAknNoteDialog::EErrorTone); + ShowResultNoteL(R_INSERT_SIM, EErrorTone); return KErrAccessDenied; } @@ -1936,7 +1938,7 @@ RDEBUG("RMobilePhone::ELockSetDisabled", RMobilePhone::ELockSetDisabled); if (lockInfo.iSetting == RMobilePhone::ELockSetDisabled) { - ShowResultNoteL(R_UPIN_NOT_ALLOWED, CAknNoteDialog::EErrorTone); + ShowResultNoteL(R_UPIN_NOT_ALLOWED, EErrorTone); return KErrAccessDenied; } @@ -1965,7 +1967,7 @@ iSecQueryUi = CSecQueryUi::NewL(); TBuf<0x100> title; title.Zero(); - HBufC* stringHolder = HbTextResolverSymbian::LoadLC(_L("txt_pin_code_dialog_upin_code")); + HBufC* stringHolder = TranslateLC(_L("txt_pin_code_dialog_upin_code"),0); title.Append(stringHolder->Des()); CleanupStack::PopAndDestroy(stringHolder); title.Append(_L("$")); @@ -1988,11 +1990,11 @@ TBuf<0x100> title; title.Zero(); - HBufC* stringHolder = HbTextResolverSymbian::LoadLC(_L("txt_pin_code_dialog_new_upin_code")); + HBufC* stringHolder = TranslateLC(_L("txt_pin_code_dialog_new_upin_code"),0); title.Append(stringHolder->Des()); CleanupStack::PopAndDestroy(stringHolder); title.Append(_L("|")); - HBufC* stringHolder2 = HbTextResolverSymbian::LoadLC(_L("txt_pin_code_dialog_retype_upin_code")); + HBufC* stringHolder2 = TranslateLC(_L("txt_pin_code_dialog_retype_upin_code"),0); title.Append(stringHolder2->Des()); CleanupStack::PopAndDestroy(stringHolder2); queryAccepted = iSecQueryUi->SecQueryDialog(title, newPassword, SEC_C_PIN_CODE_MIN_LENGTH, SEC_C_PIN_CODE_MAX_LENGTH, ESecUiAlphaNotSupported | ESecUiCancelSupported @@ -2022,14 +2024,14 @@ case KErrNone: { // code changed - ShowResultNoteL(R_UPIN_CODE_CHANGED_NOTE, CAknNoteDialog::EConfirmationTone); + ShowResultNoteL(R_UPIN_CODE_CHANGED_NOTE, EConfirmationTone); break; } case KErrGsm0707IncorrectPassword: case KErrAccessDenied: { // code was entered erroneously - ShowResultNoteL(R_CODE_ERROR, CAknNoteDialog::EErrorTone); + ShowResultNoteL(R_CODE_ERROR, EErrorTone); ChangeUPinParamsL(_L(""), _L(""), aFlags, aCaption, aShowError); break; } @@ -2041,7 +2043,7 @@ case KErrGsm0707OperationNotAllowed: { // not allowed with this sim - ShowResultNoteL(R_OPERATION_NOT_ALLOWED, CAknNoteDialog::EErrorTone); + ShowResultNoteL(R_OPERATION_NOT_ALLOWED, EErrorTone); return KErrGsm0707OperationNotAllowed; } case KErrAbort: @@ -2080,7 +2082,7 @@ if (simRemoved) { - ShowResultNoteL(R_INSERT_SIM, CAknNoteDialog::EErrorTone); + ShowResultNoteL(R_INSERT_SIM, EErrorTone); return KErrAccessDenied; } @@ -2118,11 +2120,11 @@ case KErrGsmSSPasswordAttemptsViolation: case KErrLocked: // Pin2 features blocked permanently! - ShowResultNoteL(R_PIN2_REJECTED, CAknNoteDialog::EConfirmationTone); + ShowResultNoteL(R_PIN2_REJECTED, EConfirmationTone); break; case KErrGsm0707SimNotInserted: // not allowed with this sim - ShowResultNoteL(R_OPERATION_NOT_ALLOWED, CAknNoteDialog::EErrorTone); + ShowResultNoteL(R_OPERATION_NOT_ALLOWED, EErrorTone); break; default: ShowErrorNoteL(ret); @@ -2160,7 +2162,7 @@ iSecQueryUi = CSecQueryUi::NewL(); TBuf<0x100> title; title.Zero(); - HBufC* stringHolder = HbTextResolverSymbian::LoadLC(_L("txt_pin_code_dialog_pin2_code")); + HBufC* stringHolder = TranslateLC(_L("txt_pin_code_dialog_pin2_code"),0); title.Append(stringHolder->Des()); CleanupStack::PopAndDestroy(stringHolder); title.Append(_L("$")); @@ -2183,11 +2185,11 @@ // this queries both, and verifies itself TBuf<0x100> title; title.Zero(); - HBufC* stringHolder = HbTextResolverSymbian::LoadLC(_L("txt_pin_code_dialog_new_pin2_code")); + HBufC* stringHolder = TranslateLC(_L("txt_pin_code_dialog_new_pin2_code"),0); title.Append(stringHolder->Des()); CleanupStack::PopAndDestroy(stringHolder); title.Append(_L("|")); - HBufC* stringHolder2 = HbTextResolverSymbian::LoadLC(_L("Verify")); + HBufC* stringHolder2 = TranslateLC(_L("Verify"),0); title.Append(stringHolder2->Des()); CleanupStack::PopAndDestroy(stringHolder2); queryAccepted = iSecQueryUi->SecQueryDialog(title, newPassword, SEC_C_PIN2_CODE_MIN_LENGTH, SEC_C_PIN2_CODE_MAX_LENGTH, ESecUiAlphaNotSupported | ESecUiCancelSupported @@ -2218,13 +2220,13 @@ case KErrNone: { // code changed - ShowResultNoteL(R_PIN2_CODE_CHANGED_NOTE, CAknNoteDialog::EConfirmationTone); + ShowResultNoteL(R_PIN2_CODE_CHANGED_NOTE, EConfirmationTone); break; } case KErrGsm0707IncorrectPassword: case KErrAccessDenied: { - ShowResultNoteL(R_CODE_ERROR, CAknNoteDialog::EErrorTone); + ShowResultNoteL(R_CODE_ERROR, EErrorTone); ChangePin2ParamsL(_L(""), _L(""), aFlags, aCaption, aShowError); break; } @@ -2232,7 +2234,7 @@ case KErrLocked: { // Pin2 blocked! - ShowResultNoteL(KErrLocked, CAknNoteDialog::EErrorTone); + ShowResultNoteL(KErrLocked, EErrorTone); CSecurityHandler* handler = new (ELeave) CSecurityHandler(iPhone); CleanupStack::PushL(handler); handler->HandleEventL(RMobilePhone::EPuk2Required); @@ -2242,7 +2244,7 @@ case KErrGsm0707OperationNotAllowed: { // not allowed with this sim - ShowResultNoteL(R_OPERATION_NOT_ALLOWED, CAknNoteDialog::EErrorTone); + ShowResultNoteL(R_OPERATION_NOT_ALLOWED, EErrorTone); return KErrGsm0707OperationNotAllowed; } case KErrAbort: @@ -2266,6 +2268,9 @@ askChangeSecCodeParamsL: RDEBUG("aFlags", aFlags); RDEBUG("aShowError", aShowError); + (void)aCaption; + (void)aFlags; + (void)aShowError; /***************************************************** * Series 60 Customer / ETel * Series 60 ETel API @@ -2307,7 +2312,7 @@ scpClient.Close(); if(res!=KErrNone) { - ShowResultNoteL(res, CAknNoteDialog::EErrorTone); + ShowResultNoteL(res, EErrorTone); return res; } } @@ -2327,7 +2332,7 @@ iSecQueryUi = CSecQueryUi::NewL(); TBuf<0x100> title; title.Zero(); - HBufC* stringHolder = HbTextResolverSymbian::LoadLC(_L("txt_pin_code_dialog_sec_code")); + HBufC* stringHolder = TranslateLC(_L("txt_devicelocking_dialog_lock_code"),0); title.Append(stringHolder->Des()); CleanupStack::PopAndDestroy(stringHolder); queryAccepted = iSecQueryUi->SecQueryDialog(title, oldPassword, SEC_C_SECURITY_CODE_MIN_LENGTH, SEC_C_SECURITY_CODE_MAX_LENGTH, ESecUiAlphaSupported @@ -2360,7 +2365,7 @@ // this validate on ISA . No need to do iPhone.VerifySecurityCode retCurrLockcode = scpCurrClient.VerifyCurrentLockcode(oldPassword, aCurrISACode, aCurrFailedPolicies, scpCurrFlags); RDEBUG("retCurrLockcode", retCurrLockcode); - + retCurrLockcode=retCurrLockcode; RDEBUG("aCurrISACode", 0); RDEBUGSTR(aCurrISACode); scpCurrClient.Close(); @@ -2381,7 +2386,7 @@ if (res != KErrNone) { - ShowResultNoteL(res, CAknNoteDialog::EErrorTone); + ShowResultNoteL(res, EErrorTone); return res; } @@ -2390,7 +2395,7 @@ // codes do not match -> note -> ask new pin and verification codes again // note that this never happens because the dialog doesn't dismiss until both codes match if (newPassword.Length() > 0) - ShowResultNoteL(R_CODES_DONT_MATCH, CAknNoteDialog::EErrorTone); + ShowResultNoteL(R_CODES_DONT_MATCH, EErrorTone); { queryAccepted = KErrCancel; @@ -2402,11 +2407,11 @@ RDEBUG("lType", lType); TBuf<0x100> title; title.Zero(); - HBufC* stringHolder = HbTextResolverSymbian::LoadLC(_L("txt_pin_code_dialog_new_sec_code")); + HBufC* stringHolder = TranslateLC(_L("txt_devicelocking_dialog_new_lock_code"),0); title.Append(stringHolder->Des()); CleanupStack::PopAndDestroy(stringHolder); title.Append(_L("|")); - HBufC* stringHolder2 = HbTextResolverSymbian::LoadLC(_L("Verify")); + HBufC* stringHolder2 = TranslateLC(_L("txt_devicelocking_dialog_retype_new_lock_code"),0); title.Append(stringHolder2->Des()); CleanupStack::PopAndDestroy(stringHolder2); queryAccepted = iSecQueryUi->SecQueryDialog(title, newPassword, SEC_C_SECURITY_CODE_MIN_LENGTH, SEC_C_SECURITY_CODE_MAX_LENGTH, lType); @@ -2469,6 +2474,7 @@ // scpClient.StoreCode( newCode ); RArray aFailedPolicies; TDevicelockPolicies failedPolicy; + failedPolicy = failedPolicy; RDEBUG("newScpCode", 0); RDEBUGSTR( newScpCode ); RDEBUG("oldScpCode", 0); @@ -2494,14 +2500,14 @@ case KErrNone: { RDEBUG( "showing R_SECURITY_CODE_CHANGED_NOTE", R_SECURITY_CODE_CHANGED_NOTE ); - ShowResultNoteL(R_SECURITY_CODE_CHANGED_NOTE, CAknNoteDialog::EConfirmationTone); + ShowResultNoteL(R_SECURITY_CODE_CHANGED_NOTE, EConfirmationTone); break; } case KErrAccessDenied: // TARM has wrong UID { res = KErrTDevicelockPolicies+EDevicelockTotalPolicies+1; RDEBUG( "res", res ); - ShowResultNoteL(res, CAknNoteDialog::EConfirmationTone); + ShowResultNoteL(res, EConfirmationTone); res = KErrAccessDenied; // no reason for retry, as it will fail again and again break; } @@ -2509,7 +2515,7 @@ case KErrLocked: { RDEBUG( "KErrLocked", KErrLocked ); - ShowResultNoteL(R_SEC_BLOCKED, CAknNoteDialog::EErrorTone); + ShowResultNoteL(R_SEC_BLOCKED, EErrorTone); goto askChangeSecCodeParamsL; // break; } @@ -2517,7 +2523,7 @@ { // code was entered erroneously RDEBUG( "KErrGsm0707IncorrectPassword", KErrGsm0707IncorrectPassword ); - ShowResultNoteL(R_CODE_ERROR, CAknNoteDialog::EErrorTone); + ShowResultNoteL(R_CODE_ERROR, EErrorTone); goto askChangeSecCodeParamsL; // break; } @@ -2548,6 +2554,10 @@ askChangeAutoLockPeriodParamsL: RDEBUG("aPeriod", aPeriod); RDEBUG("aFlags", aFlags); + (void)aOldPassword; + (void)aCaption; + (void)aShowError; + (void)aFlags; /***************************************************** * Series 60 Customer / ETel * Series 60 ETel API @@ -2556,6 +2566,7 @@ RMobilePhone::TMobilePhoneLockSetting lockChange(RMobilePhone::ELockSetDisabled); RMobilePhone::TMobilePhoneLock lockType = RMobilePhone::ELockPhoneDevice; TInt oldPeriod = aPeriod; + oldPeriod=oldPeriod; TInt maxPeriod = 0; if (FeatureManager::FeatureSupported(KFeatureIdSapTerminalControlFw)) @@ -2600,7 +2611,7 @@ { RDEBUG("The period is not allowed by TARM", aPeriod); RDEBUG( "maxPeriod", maxPeriod ); - ShowResultNoteL(R_SECUI_TEXT_AUTOLOCK_MUST_BE_ACTIVE, CAknNoteDialog::EErrorTone); + ShowResultNoteL(R_SECUI_TEXT_AUTOLOCK_MUST_BE_ACTIVE, EErrorTone); return R_SECUI_TEXT_AUTOLOCK_MUST_BE_ACTIVE; // don't ask again. Settings will roll-back } } @@ -2665,19 +2676,18 @@ break; case KErrGsmSSPasswordAttemptsViolation: case KErrLocked: - RDEBUG("KErrLocked", KErrLocked) - ; - ShowResultNoteL(KErrLocked, CAknNoteDialog::EErrorTone); // the old code didn't show messages + RDEBUG("KErrLocked", KErrLocked); + // ShowResultNoteL(KErrLocked, EErrorTone); // the old code didn't show messages. PassPhraseRequiredL does it. goto askChangeAutoLockPeriodParamsL; // ask again case KErrGsm0707IncorrectPassword: RDEBUG("KErrGsm0707IncorrectPassword", KErrGsm0707IncorrectPassword) - ShowResultNoteL(R_CODE_ERROR, CAknNoteDialog::EErrorTone); // the old code didn't show messages + // ShowResultNoteL(R_CODE_ERROR, EErrorTone); // the old code didn't show messages. PassPhraseRequiredL does it. goto askChangeAutoLockPeriodParamsL; // ask again case KErrAccessDenied: RDEBUG("KErrAccessDenied", KErrAccessDenied) ; // code was entered erroneously - ShowResultNoteL(KErrAccessDenied, CAknNoteDialog::EErrorTone); // the old code didn't show messages + // ShowResultNoteL(KErrAccessDenied, EErrorTone); // the old code didn't show messages. PassPhraseRequiredL does it. goto askChangeAutoLockPeriodParamsL; // ask again case KErrAbort: // User pressed "cancel" in the code query dialog. @@ -2686,7 +2696,7 @@ default: RDEBUG("default", status) ; - ShowResultNoteL(status, CAknNoteDialog::EErrorTone); // the old code didn't show messages + // ShowResultNoteL(status, EErrorTone); // the old code didn't show messages. PassPhraseRequiredL does it. goto askChangeAutoLockPeriodParamsL; // ask again } RDEBUG("aPeriod", aPeriod); @@ -2707,7 +2717,7 @@ if (simRemoved) { - ShowResultNoteL(R_INSERT_SIM, CAknNoteDialog::EErrorTone); + ShowResultNoteL(R_INSERT_SIM, EErrorTone); return KErrAccessDenied; } @@ -2782,7 +2792,7 @@ case KErrGsm0707OperationNotAllowed: { // not allowed with this sim - ShowResultNoteL(R_OPERATION_NOT_ALLOWED, CAknNoteDialog::EErrorTone); + ShowResultNoteL(R_OPERATION_NOT_ALLOWED, EErrorTone); return KErrGsm0707OperationNotAllowed; } case KErrGsm0707IncorrectPassword: @@ -2821,6 +2831,9 @@ RDEBUG("aShowError", aShowError); RDEBUG("This doesn't do anything", 0); RDEBUG("aFlags", aFlags); + (void)aCaption; + (void)aFlags; + (void)aShowError; // the password parameters are not used if (aOldPassword.Length() > 0) @@ -2828,5 +2841,94 @@ return EFalse; } +// +// ---------------------------------------------------------- +// CSecuritySettings::TranslateLC() +// ---------------------------------------------------------- +// qtdone +HBufC* CSecuritySettings::TranslateLC(const TDesC& aMessageId, TInt aFlags) + { + RDEBUG("aFlags", aFlags); + RDEBUG("aMessageId", 1); + (void)aFlags; + + _LIT(KPath, "z:/resource/qt/translations/"); + + TBool result=EFalse; + result=result; + TBuf<0x100> title; + title.Zero(); + HBufC* stringHolder; + RDEBUG("before stringHolder", 0); + stringHolder = HbTextResolverSymbian::LoadLC(aMessageId); + RDEBUG("got stringHolder", 1); + title.Append(stringHolder->Des()); + RDEBUG("title", 0); + RDEBUGSTR(title); + RDEBUG("searched in default", 1); + // this doesn't work because an error in HbTextResolverSymbian::Init + int doDoubleTranslations = 0; + RDEBUG("doDoubleTranslations", doDoubleTranslations); + if(doDoubleTranslations && !title.CompareF(aMessageId)) + { + // not translated. Now check in common + // CleanupStack::PopAndDestroy(stringHolder); + RDEBUG("1", 1); + title.Zero(); + RDEBUG("1", 1); + _LIT(KFileNameSecUi, "secui_"); + RDEBUG("1", 1); + result = HbTextResolverSymbian::Init(KFileNameSecUi, KPath); + RDEBUG("1", 1); + RDEBUG("bool result", result); + RDEBUG("1", 1); + stringHolder = HbTextResolverSymbian::LoadLC(aMessageId); + RDEBUG("1", 1); + title.Append(stringHolder->Des()); + RDEBUG("1", 1); + RDEBUG("searched in KFileNameSecUi", 1); + // RDEBUGSTR(aMessageId); + } + RDEBUG("1", 1); + if(doDoubleTranslations && !title.CompareF(aMessageId)) + { + RDEBUG("1", 1); + // not translated. Now check in common + // CleanupStack::PopAndDestroy(stringHolder); + RDEBUG("1", 1); + title.Zero(); + RDEBUG("1", 1); + _LIT(KFileNameCommon, "common_"); + RDEBUG("1", 1); + result = HbTextResolverSymbian::Init(KFileNameCommon, KPath); + RDEBUG("bool result", result); + stringHolder = HbTextResolverSymbian::LoadLC(aMessageId); + RDEBUG("1", 1); + title.Append(stringHolder->Des()); + RDEBUG("searched in KFileNameCommon", 1); + // RDEBUGSTR(aMessageId); + } + if(doDoubleTranslations && !title.CompareF(aMessageId)) + { + // not translated. Now check in devicelocking + RDEBUG("1", 1); + CleanupStack::PopAndDestroy(stringHolder); + RDEBUG("1", 1); + title.Zero(); + RDEBUG("1", 1); + _LIT(KFileNameDevicelocking, "devicelocking_"); + RDEBUG("1", 1); + result = HbTextResolverSymbian::Init(KFileNameDevicelocking, KPath); + RDEBUG("bool result", result); + stringHolder = HbTextResolverSymbian::LoadLC(aMessageId); + RDEBUG("1", 1); + title.Append(stringHolder->Des()); + RDEBUG("searched in KFileNameDevicelocking", 1); + // RDEBUGSTR(aMessageId); + } + // this is done by the caller: CleanupStack::PopAndDestroy(stringHolder); + RDEBUG("0x99", 0x99); + return stringHolder; + } // End of file diff -r 989397f9511c -r 67b3e3c1fc87 securitydialogs/SecUi/group/SecUi.mmp --- a/securitydialogs/SecUi/group/SecUi.mmp Thu Oct 14 13:56:11 2010 +0300 +++ b/securitydialogs/SecUi/group/SecUi.mmp Wed Oct 20 14:51:23 2010 +0300 @@ -30,14 +30,6 @@ SOURCEPATH . -SOURCEPATH ../Data - -START RESOURCE SecUi.rss -HEADER -TARGETPATH RESOURCE_FILES_DIR -LANGUAGE_IDS -END - USERINCLUDE . ../Inc MW_LAYER_SYSTEMINCLUDE ../../../inc @@ -55,7 +47,6 @@ SOURCE ../Src/SecUiWait.cpp SOURCE ../Src/SecQueryUi.cpp -// library avkon.lib eikdlg.lib library euser.lib library etel.lib etelmm.lib library commonengine.lib @@ -69,12 +60,14 @@ DEFFILE ../BWinsCw/SECUI_EKA2.def #endif LIBRARY featmgr.lib -LIBRARY aknnotify.lib LIBRARY HbCore.lib LIBRARY HbWidgets.lib LIBRARY lockclient.lib LIBRARY phoneclient.lib +LIBRARY aiwdialdata.lib +LIBRARY servicehandler.lib +LIBRARY etel3rdparty.lib SMPSAFE diff -r 989397f9511c -r 67b3e3c1fc87 securitydialogs/lockclient/bwins/lockclientu.def --- a/securitydialogs/lockclient/bwins/lockclientu.def Thu Oct 14 13:56:11 2010 +0300 +++ b/securitydialogs/lockclient/bwins/lockclientu.def Wed Oct 20 14:51:23 2010 +0300 @@ -17,4 +17,5 @@ ??1CDevicelockAccessApi@@UAE@XZ @ 16 NONAME ; CDevicelockAccessApi::~CDevicelockAccessApi(void) ?OfferDevicelock@CDevicelockAccessApi@@QAEHXZ @ 17 NONAME ; int CDevicelockAccessApi::OfferDevicelock(void) ?NewL@CKeyguardAccessApi@@SAPAV1@XZ @ 18 NONAME ; class CKeyguardAccessApi * CKeyguardAccessApi::NewL(void) + ?AutolockStatus@CKeyguardAccessApi@@QAEHHH@Z @ 19 NONAME ; int CKeyguardAccessApi::AutolockStatus(int, int) diff -r 989397f9511c -r 67b3e3c1fc87 securitydialogs/lockclient/eabi/lockclientu.def --- a/securitydialogs/lockclient/eabi/lockclientu.def Thu Oct 14 13:56:11 2010 +0300 +++ b/securitydialogs/lockclient/eabi/lockclientu.def Wed Oct 20 14:51:23 2010 +0300 @@ -21,4 +21,5 @@ _ZN20CDevicelockAccessApiD0Ev @ 20 NONAME _ZN20CDevicelockAccessApiD1Ev @ 21 NONAME _ZN20CDevicelockAccessApiD2Ev @ 22 NONAME + _ZN18CKeyguardAccessApi14AutolockStatusEii @ 23 NONAME diff -r 989397f9511c -r 67b3e3c1fc87 securitydialogs/lockclient/group/bwins/lockclientu.def --- a/securitydialogs/lockclient/group/bwins/lockclientu.def Thu Oct 14 13:56:11 2010 +0300 +++ b/securitydialogs/lockclient/group/bwins/lockclientu.def Wed Oct 20 14:51:23 2010 +0300 @@ -17,4 +17,5 @@ ??1CDevicelockAccessApi@@UAE@XZ @ 16 NONAME ; CDevicelockAccessApi::~CDevicelockAccessApi(void) ?OfferDevicelock@CDevicelockAccessApi@@QAEHXZ @ 17 NONAME ; int CDevicelockAccessApi::OfferDevicelock(void) ?NewL@CKeyguardAccessApi@@SAPAV1@XZ @ 18 NONAME ; class CKeyguardAccessApi * CKeyguardAccessApi::NewL(void) + ?AutolockStatus@CKeyguardAccessApi@@QAEHHH@Z @ 19 NONAME ; int CKeyguardAccessApi::AutolockStatus(int, int) diff -r 989397f9511c -r 67b3e3c1fc87 securitydialogs/lockclient/group/eabi/lockclientu.def --- a/securitydialogs/lockclient/group/eabi/lockclientu.def Thu Oct 14 13:56:11 2010 +0300 +++ b/securitydialogs/lockclient/group/eabi/lockclientu.def Wed Oct 20 14:51:23 2010 +0300 @@ -21,4 +21,5 @@ _ZN20CDevicelockAccessApiD0Ev @ 20 NONAME _ZN20CDevicelockAccessApiD1Ev @ 21 NONAME _ZN20CDevicelockAccessApiD2Ev @ 22 NONAME + _ZN18CKeyguardAccessApi14AutolockStatusEii @ 23 NONAME diff -r 989397f9511c -r 67b3e3c1fc87 securitydialogs/lockclient/src/keyguardaccessapi.cpp --- a/securitydialogs/lockclient/src/keyguardaccessapi.cpp Thu Oct 14 13:56:11 2010 +0300 +++ b/securitydialogs/lockclient/src/keyguardaccessapi.cpp Wed Oct 20 14:51:23 2010 +0300 @@ -89,6 +89,7 @@ case EKeyguardLocked: case EKeyguardAutolockEmulation: ret = ETrue; + break; case EKeyguardNotActive: default: ret = EFalse; @@ -119,6 +120,7 @@ { case EKeyguardLocked: ret = ETrue; + break; case EKeyguardAutolockEmulation: case EKeyguardNotActive: default: @@ -257,5 +259,22 @@ #endif } +// --------------------------------------------------------------------------- +// Confirms that the server is running. +// Returns KErrNone / Error +// --------------------------------------------------------------------------- +EXPORT_C TInt CKeyguardAccessApi::AutolockStatus( TInt aCommand, TInt aParam) + { + RDEBUG("aCommand", aCommand); + RDEBUG("aParam", aParam); + if ( iLockAccessExtension ) + { + return iLockAccessExtension->SendMessage( aCommand, aParam ); + } + else + { + return KErrNotFound; + } + } // End of File diff -r 989397f9511c -r 67b3e3c1fc87 securitydialogs/lockclient/src/lockaccessextension.cpp --- a/securitydialogs/lockclient/src/lockaccessextension.cpp Thu Oct 14 13:56:11 2010 +0300 +++ b/securitydialogs/lockclient/src/lockaccessextension.cpp Wed Oct 20 14:51:23 2010 +0300 @@ -43,6 +43,7 @@ // --------------------------------------------------------------------------- TInt RLockAccessExtension::TryConnect( RWsSession& aWsSession ) { + (void)aWsSession; TInt ret(KErrNone); /* this is the old methd. Now we use QtHighway @@ -83,6 +84,7 @@ // This is done because Autolock.exe should start at the beginning, but it might not be ready yet. // As Qthighway will start it, it's better to give time for the first one to prepare itself. TInt err = KErrNone; + err = err; TInt numAttempts = 0; TInt numberOfInstances = 0; do @@ -130,7 +132,7 @@ err = RProperty::Get(KPSUidSecurityUIs, KSecurityUIsLockInitiatorUID, value); RDEBUG("err", err); RDEBUG("value", value); - if(value<1) + if(value==0 || value==-1) { RDEBUG("Autolock.exe has started but it's not fully running", value); User::After(5*100*1000); // half a second diff -r 989397f9511c -r 67b3e3c1fc87 securitydialogs/secuidialognotifiersrv/src/secuidialognotifiersession.cpp --- a/securitydialogs/secuidialognotifiersrv/src/secuidialognotifiersession.cpp Thu Oct 14 13:56:11 2010 +0300 +++ b/securitydialogs/secuidialognotifiersrv/src/secuidialognotifiersession.cpp Wed Oct 20 14:51:23 2010 +0300 @@ -143,7 +143,7 @@ { CKeyguardAccessApi* iKeyguardAccess = CKeyguardAccessApi::NewL( ); RDEBUG("0", 0); - TInt err = iKeyguardAccess->ShowKeysLockedNote( ); + TInt err = iKeyguardAccess->AutolockStatus( 0x100, lOperation ); // start server, if needed RDEBUG("err", err); delete iKeyguardAccess; } diff -r 989397f9511c -r 67b3e3c1fc87 securitydialogs/secuinotifications/secuinotificationdialogplugin/inc/secuinotificationdialog.h --- a/securitydialogs/secuinotifications/secuinotificationdialogplugin/inc/secuinotificationdialog.h Thu Oct 14 13:56:11 2010 +0300 +++ b/securitydialogs/secuinotifications/secuinotificationdialogplugin/inc/secuinotificationdialog.h Wed Oct 20 14:51:23 2010 +0300 @@ -104,6 +104,7 @@ int lEmergencySupported; int isEmergency; QValueSpaceSubscriber *subscriberKSecurityUIsDismissDialog; + QString codeTopTextPrev; }; #endif // SECUINOTIFICATIONDIALOG_H diff -r 989397f9511c -r 67b3e3c1fc87 securitydialogs/secuinotifications/secuinotificationdialogplugin/src/secuinotificationcontentwidget.cpp --- a/securitydialogs/secuinotifications/secuinotificationdialogplugin/src/secuinotificationcontentwidget.cpp Thu Oct 14 13:56:11 2010 +0300 +++ b/securitydialogs/secuinotifications/secuinotificationdialogplugin/src/secuinotificationcontentwidget.cpp Wed Oct 20 14:51:23 2010 +0300 @@ -186,7 +186,7 @@ if (queryType & ESecUiAlphaSupported) { RDEBUG("ESecUiAlphaSupported", ESecUiAlphaSupported); - codeTop->setInputMethodHints(Qt::ImhNone); + codeTop->setInputMethodHints(Qt::ImhPreferNumbers); // all queries start with numbers, even if allow alpha. (old value was ImhNone) } if (queryType & ESecUiSecretSupported) { @@ -281,7 +281,7 @@ if (queryType & ESecUiAlphaSupported) { RDEBUG("setInputMethodHints", 0); - codeBottom->setInputMethodHints(Qt::ImhNone); + codeBottom->setInputMethodHints(Qt::ImhPreferNumbers); // all queries start with numbers, even if allow alpha. (old value was ImhNone) } if (queryType & ESecUiSecretSupported) { diff -r 989397f9511c -r 67b3e3c1fc87 securitydialogs/secuinotifications/secuinotificationdialogplugin/src/secuinotificationdialog.cpp --- a/securitydialogs/secuinotifications/secuinotificationdialogplugin/src/secuinotificationdialog.cpp Thu Oct 14 13:56:11 2010 +0300 +++ b/securitydialogs/secuinotifications/secuinotificationdialogplugin/src/secuinotificationdialog.cpp Wed Oct 20 14:51:23 2010 +0300 @@ -255,6 +255,7 @@ // ---------------------------------------------------------------------------- // SecUiNotificationDialog::constructDialog() +// This is be called many times, because every key is sent (for checking Emergency and TARM repeat-characters policy). In these cases, the dialog is not created. It returns half-way. // ---------------------------------------------------------------------------- // bool SecUiNotificationDialog::constructDialog(const QVariantMap ¶meters) @@ -265,21 +266,7 @@ setDismissPolicy(HbPopup::NoDismiss); setModal(true); mShowEventReceived = false; - subscriberKSecurityUIsDismissDialog = NULL; titleWidget = NULL; - RDEBUG("subscriberKSecurityUIsDismissDialog NULL", 0); - - subscriberKSecurityUIsDismissDialog = new QValueSpaceSubscriber("/KPSUidSecurityUIs/KSecurityUIsDismissDialog", this); - if(subscriberKSecurityUIsDismissDialog) - { - RDEBUG("subscriberKSecurityUIsDismissDialog created", 1); - } - else - { - RDEBUG("subscriberKSecurityUIsDismissDialog not created", 0); - } - connect(subscriberKSecurityUIsDismissDialog, SIGNAL(contentsChanged()), this, SLOT(subscriberKSecurityUIsDismissDialogChanged())); - RDEBUG("subscriberKSecurityUIsDismissDialog", 1); // Title // this is also done later in the widget @@ -305,7 +292,7 @@ // This is created only if needed (i.e. errors for NewLockCode) // titleWidget = new HbLabel(titleText); // setHeadingWidget(titleWidget); - } + } // KDialogTitle if (parameters.contains(KEmergency)) { RDEBUG("KEmergency", 1); @@ -317,6 +304,15 @@ isEmergency = 1; okAction->setEnabled(true); okAction->setText(hbTrId("Call")); + if (queryType & ESecUiSecretSupported) + { + RDEBUG("ESecUiSecretSupported", ESecUiSecretSupported); + codeTop->setEchoMode(HbLineEdit::Normal); + QString codeTopText = codeTop->text(); + RDEBUGQT("codeTop->text()", codeTop->text()); + codeTop->setText(codeTopText); // this time, display the characters . Not use "Emergency" because 1123 will need to restore from 112. + // note that this is not needed. 112 will soh. However, this will move the cursor to the end, as expected. + } return true; } if(!emergencyText.compare("emergencyNo")) @@ -325,9 +321,19 @@ isEmergency = 0; okAction->setEnabled(false); // 112 -> 1122 (=password) . This is handled by < lMinLength okAction->setText(hbTrId("Ok")); + if (queryType & ESecUiSecretSupported) + { + RDEBUG("ESecUiSecretSupported", ESecUiSecretSupported); + codeTop->setEchoMode(HbLineEdit::Password); + } + else + { + RDEBUG("ESecUiSecretNotSupported", ESecUiSecretNotSupported); + codeTop->setEchoMode(HbLineEdit::Normal); + } return true; } - } + } // KEmergency // after TARM validation. if (parameters.contains(KInvalidNewLockCode)) { RDEBUG("KInvalidNewLockCode", 0); @@ -457,8 +463,23 @@ } // need to return because all objects are already created return true; - } + } // KInvalidNewLockCode + subscriberKSecurityUIsDismissDialog = NULL; + RDEBUG("subscriberKSecurityUIsDismissDialog NULL", 0); + + subscriberKSecurityUIsDismissDialog = new QValueSpaceSubscriber("/KPSUidSecurityUIs/KSecurityUIsDismissDialog", this); + if(subscriberKSecurityUIsDismissDialog) + { + RDEBUG("subscriberKSecurityUIsDismissDialog created", 1); + } + else + { + RDEBUG("subscriberKSecurityUIsDismissDialog not created", 0); + } + connect(subscriberKSecurityUIsDismissDialog, SIGNAL(contentsChanged()), this, SLOT(subscriberKSecurityUIsDismissDialogChanged())); + RDEBUG("subscriberKSecurityUIsDismissDialog", 1); + // Content SecUiNotificationContentWidget *content = new SecUiNotificationContentWidget(); content->constructFromParameters(parameters); @@ -654,6 +675,14 @@ { RDEBUG("0", 0); RDEBUGQT("text", text); + RDEBUGQT("codeTop->text()", codeTop->text()); + RDEBUGQT("codeTopTextPrev", codeTopTextPrev); + if(!codeTopTextPrev.compare(text)) + { + RDEBUG("Strings are same. Nothing to do. return", 0); + return; + } + codeTopTextPrev = text; if(queryDual) { codeBottom->setText(""); // any change resets the verification. @@ -669,7 +698,15 @@ RDEBUGQT("too short text", text); okAction->setEnabled(false); RDEBUG("lEmergencySupported", lEmergencySupported); - if( lEmergencySupported && text.length() > 2 ) // emergency numbers need at least 3 digits + if( lEmergencySupported && text.length() <= 2 ) + { + if (queryType & ESecUiSecretSupported) + { + RDEBUG("ESecUiSecretSupported", ESecUiSecretSupported); + codeTop->setEchoMode(HbLineEdit::Password); + } + } + else if( lEmergencySupported && text.length() > 2 ) // emergency numbers need at least 3 digits { // check whether it's a emergency number QVariant codeTopVar(text); mResultMap.insert(KCodeTopIndex, codeTopVar); @@ -681,8 +718,28 @@ // might use a flag to avoid re-setting. But this complicates things if there's another initial verification RDEBUGQT("long enough text", text); okAction->setText(hbTrId("Ok")); + RDEBUG("queryDual", queryDual); + RDEBUG("isEmergency", isEmergency); if(queryDual==0) // only if Bottom is not used - okAction->setEnabled(true); + { + if (isEmergency == 1) // transition emergencyYes->emergencyNo + { + RDEBUG("new isEmergency", isEmergency); + if (queryType & ESecUiSecretSupported) + { + RDEBUG("ESecUiSecretSupported", ESecUiSecretSupported); + codeTop->setEchoMode(HbLineEdit::Password); + } + else + { + RDEBUG("ESecUiSecretNotSupported", ESecUiSecretNotSupported); + codeTop->setEchoMode(HbLineEdit::Normal); + } + } + isEmergency = 0; + okAction->setEnabled(true); // 112 -> 1122 (=password) . This is handled by < lMinLength + okAction->setText(hbTrId("Ok")); + } } QVariant codeTopVar(text); mResultMap.insert(KCodeTopIndex, codeTopVar); @@ -787,7 +844,7 @@ RDEBUGQT("codeTopText", codeTopText); codeTopText = codeTopText + "5" ; RDEBUGQT("codeTopText+5", codeTopText); - codeTop->setEchoMode(HbLineEdit::PasswordEchoOnEdit); + codeTop->setEchoMode(HbLineEdit::Password); RDEBUGQT("codeTopText", codeTopText); codeTop->setText(codeTopText); RDEBUG("setFocus", 0);