744 TDesC8& trustedSubject = attributeValue->Data()->Value(); |
751 TDesC8& trustedSubject = attributeValue->Data()->Value(); |
745 |
752 |
746 //resolve name and fingerprint |
753 //resolve name and fingerprint |
747 const TDesC8& name = iTrustedSession->CommonNameForSubjectL( trustedSubject, iUseEditedElements); |
754 const TDesC8& name = iTrustedSession->CommonNameForSubjectL( trustedSubject, iUseEditedElements); |
748 const TDesC8& fingerPrint = iTrustedSession->FingerPrintForSubjectL( trustedSubject, iUseEditedElements); |
755 const TDesC8& fingerPrint = iTrustedSession->FingerPrintForSubjectL( trustedSubject, iUseEditedElements); |
749 |
756 TPtrC8 ptr = fingerPrint.Left(4); // send only first 4 digits. |
|
757 |
|
758 RDEBUG_2("CPolicyProcessor::fingerPrint: %S", &fingerPrint); |
|
759 RDEBUG_2("CPolicyProcessor::fingerPrint: %S", &ptr); |
|
760 |
|
761 RDEBUG8_2("CPolicyProcessor::fingerPrint: %S", &fingerPrint); |
|
762 RDEBUG8_2("CPolicyProcessor::fingerPrint: %S", &ptr); |
|
763 |
750 TUserResponse response = EUserDeny; |
764 TUserResponse response = EUserDeny; |
751 |
765 |
752 if ( name.Length() && fingerPrint.Length()) |
766 CProcessorClient *client = new CProcessorClient(); |
753 { |
767 TInt res = client->LaunchDialog(ptr, name); |
754 //create notifier |
768 |
755 /* RNotifier notifier; |
769 if(res == 0) |
756 CleanupClosePushL( notifier); |
770 response = EUserAccept; |
757 User::LeaveIfError( notifier.Connect() ); |
771 else |
758 */ |
772 response = EUserDeny; |
759 //create parameter descriptor |
773 |
760 TBuf8<100> responseBuf; |
|
761 HBufC8 * data = HBufC8::NewLC( name.Length() + fingerPrint.Length() + 1); |
|
762 TPtr8 ptr = data->Des(); |
|
763 ptr.Append(name); |
|
764 ptr.Append(KDelimeterChar); |
|
765 ptr.Append(fingerPrint.Left(4)); |
|
766 |
|
767 //create CAsyncHandler to Auto start/stop CActiveScheduler |
|
768 CASyncHandler * async = CASyncHandler::NewLC(); |
|
769 // notifier.StartNotifierAndGetResponse( async->GetRequestStatus(), KUidPolicyEngineUi, ptr, responseBuf); |
|
770 |
|
771 //Start CActiveScheduler and execute stop when request is completed |
|
772 async->WaitForRequest(); |
|
773 CPolicyEngineServer::SetActiveSubSession( this); |
|
774 |
|
775 |
|
776 if ( async->GetRequestStatus() > 0) //request pending... |
|
777 { |
|
778 // notifier.CancelNotifier( KUidPolicyEngineUi); |
|
779 } |
|
780 else |
|
781 { |
|
782 //Check response |
|
783 if ( responseBuf == KUserAcceptMark) |
|
784 { |
|
785 RDEBUG("PolicyEngineServer: CPolicyProcessor user accept corporate policy!"); |
|
786 response = EUserAccept; |
|
787 } |
|
788 } |
|
789 |
|
790 // CleanupStack::PopAndDestroy( 3, ¬ifier); //notifier, data, CASyncHandler |
|
791 CleanupStack::PopAndDestroy( 2); |
|
792 |
|
793 |
|
794 } |
|
795 |
774 |
796 MakeBooleanResponseL( response == EUserAccept, aResponseElement); |
775 MakeBooleanResponseL( response == EUserAccept, aResponseElement); |
797 } |
776 } |
798 |
777 |
799 // ----------------------------------------------------------------------------- |
778 // ----------------------------------------------------------------------------- |
978 |
957 |
979 MakeBooleanResponseL( iTrustedSession->CertificatedSession(), aResponseElement); |
958 MakeBooleanResponseL( iTrustedSession->CertificatedSession(), aResponseElement); |
980 } |
959 } |
981 |
960 |
982 |
961 |
|
962 // ----------------------------------------------------------------------------- |
|
963 // CProcessorClient::CProcessorClient() |
|
964 // ----------------------------------------------------------------------------- |
|
965 // |
|
966 |
|
967 CProcessorClient::CProcessorClient() |
|
968 : CActive(EPriorityNormal) |
|
969 { |
|
970 CActiveScheduler::Add( this ); |
|
971 iWait = new( ELeave ) CActiveSchedulerWait; |
|
972 iCompletionCode = KErrNone; |
|
973 } |
|
974 |
|
975 |
|
976 // ----------------------------------------------------------------------------- |
|
977 // CProcessorClient::~CProcessorClient() |
|
978 // ----------------------------------------------------------------------------- |
|
979 CProcessorClient::~CProcessorClient() |
|
980 { |
|
981 delete iWait; |
|
982 } |
|
983 |
|
984 |
|
985 // ----------------------------------------------------------------------------- |
|
986 // CProcessorClient::DataReceived() |
|
987 // ----------------------------------------------------------------------------- |
|
988 void CProcessorClient::DataReceived(CHbSymbianVariantMap& aData) |
|
989 { |
|
990 _LIT(KResponse, "keyResponse"); |
|
991 const CHbSymbianVariant* key = aData.Get(KResponse); |
|
992 |
|
993 if(key) |
|
994 { |
|
995 TInt *res = key->Value<TInt>(); |
|
996 iCompletionCode = *res; |
|
997 iUserResponse = *res; |
|
998 } |
|
999 } |
|
1000 |
|
1001 |
|
1002 // ----------------------------------------------------------------------------- |
|
1003 // CProcessorClient::DeviceDialogClosed() |
|
1004 // ----------------------------------------------------------------------------- |
|
1005 void CProcessorClient::DeviceDialogClosed(TInt aCompletionCode) |
|
1006 { |
|
1007 iCompletionCode = aCompletionCode; |
|
1008 //iDevDialog->Cancel(); |
|
1009 TRequestStatus* status(&iStatus); |
|
1010 User::RequestComplete(status, KErrNone); |
|
1011 } |
|
1012 |
|
1013 |
|
1014 // ----------------------------------------------------------------------------- |
|
1015 // CProcessorClient::DoCancel() |
|
1016 // ----------------------------------------------------------------------------- |
|
1017 void CProcessorClient::DoCancel() |
|
1018 { |
|
1019 if (iWait && iWait->IsStarted() && iWait->CanStopNow()) |
|
1020 { |
|
1021 iCompletionCode = KErrCancel; |
|
1022 iWait->AsyncStop(); |
|
1023 } |
|
1024 } |
|
1025 |
|
1026 |
|
1027 // ----------------------------------------------------------------------------- |
|
1028 // CProcessorClient::RunL() |
|
1029 // ----------------------------------------------------------------------------- |
|
1030 void CProcessorClient::RunL() |
|
1031 { |
|
1032 if (iWait) |
|
1033 { |
|
1034 iWait->AsyncStop(); |
|
1035 } |
|
1036 } |
|
1037 |
|
1038 |
|
1039 // ----------------------------------------------------------------------------- |
|
1040 // CProcessorClient::LaunchDialog() |
|
1041 // ----------------------------------------------------------------------------- |
|
1042 TInt CProcessorClient::LaunchDialog(const TDesC8& aFringerPrint, |
|
1043 const TDesC8& aServerName) |
|
1044 { |
|
1045 _LIT(KHbNotifier,"com.nokia.hb.policymanagementdialog/1.0"); |
|
1046 _LIT(KFingerPrint, "fingerprint"); |
|
1047 _LIT(KServerdisplayname, "serverdisplayname"); |
|
1048 |
|
1049 RDEBUG_2("CPolicyProcessor::fingerPrint: %S", &aFringerPrint); |
|
1050 RDEBUG_2("CPolicyProcessor::fingerPrint: %S", &aServerName); |
|
1051 |
|
1052 CHbSymbianVariantMap* varMap = CHbSymbianVariantMap::NewL(); |
|
1053 CleanupStack::PushL(varMap); |
|
1054 |
|
1055 TBuf<10> fingerBuf; |
|
1056 fingerBuf.Copy(aFringerPrint); |
|
1057 |
|
1058 TInt serverNameLen = aServerName.Length(); |
|
1059 TBuf<50> serverName; |
|
1060 serverName.Copy(aServerName); |
|
1061 |
|
1062 RDEBUG_2("CPolicyProcessor::16 fingerPrint: %S", &fingerBuf); |
|
1063 RDEBUG_2("CPolicyProcessor::16 serverName : %S", &serverName); |
|
1064 |
|
1065 CHbSymbianVariant* fingerprintid = CHbSymbianVariant::NewL(&fingerBuf, |
|
1066 CHbSymbianVariant::EDes); |
|
1067 |
|
1068 CHbSymbianVariant* serverdisplayname = CHbSymbianVariant::NewL( |
|
1069 &serverName, CHbSymbianVariant::EDes); |
|
1070 |
|
1071 RDEBUG_2("CPolicyProcessor::fingerPrint: %S", &fingerprintid); |
|
1072 RDEBUG_2("CPolicyProcessor::fingerPrint: %S", &serverdisplayname); |
|
1073 |
|
1074 varMap->Add(KFingerPrint, fingerprintid); |
|
1075 varMap->Add(KServerdisplayname, serverdisplayname); |
|
1076 |
|
1077 iDevDialog = CHbDeviceDialogSymbian::NewL(); |
|
1078 TInt err1 = iDevDialog->Show(KHbNotifier, *varMap, this); |
|
1079 TInt err = WaitUntilDeviceDialogClosed(); |
|
1080 |
|
1081 CleanupStack::PopAndDestroy(); |
|
1082 |
|
1083 if (iDevDialog) |
|
1084 { |
|
1085 iDevDialog->Cancel(); |
|
1086 delete iDevDialog; |
|
1087 iDevDialog = NULL; |
|
1088 } |
|
1089 |
|
1090 if (err == 0) |
|
1091 { |
|
1092 LaunchTrustNotificationDialog(aServerName); |
|
1093 } |
|
1094 |
|
1095 return iUserResponse; |
|
1096 } |
|
1097 |
|
1098 |
|
1099 // ----------------------------------------------------------------------------- |
|
1100 // CProcessorClient::WaitUntilDeviceDialogClosed() |
|
1101 // ----------------------------------------------------------------------------- |
|
1102 TInt CProcessorClient::WaitUntilDeviceDialogClosed() |
|
1103 { |
|
1104 iCompletionCode = KErrInUse; |
|
1105 if (!IsActive() && iWait && !iWait->IsStarted()) |
|
1106 { |
|
1107 iStatus = KRequestPending; |
|
1108 SetActive(); |
|
1109 iWait->Start(); |
|
1110 } |
|
1111 return iCompletionCode; |
|
1112 } |
|
1113 |
|
1114 void CProcessorClient::LaunchTrustNotificationDialog(const TDesC8& aServerName) |
|
1115 { |
|
1116 _LIT(KFileName, "deviceupdates_"); |
|
1117 _LIT(KPath, "z:/resource/qt/translations/"); |
|
1118 _LIT(KDialogIcon, "note_info.svg"); |
|
1119 |
|
1120 TBool result = HbTextResolverSymbian::Init(KFileName, KPath); |
|
1121 |
|
1122 if (result) { |
|
1123 _LIT(KTrustEstablished,"txt_device_update_dpophead_trust_established"); |
|
1124 _LIT(KServerID,"txt_deviceupdate_dpopinfo_trust_establised_with_1"); |
|
1125 |
|
1126 HBufC* trustEstablishedText = HbTextResolverSymbian::LoadL(KTrustEstablished); |
|
1127 CleanupStack::PushL(trustEstablishedText); |
|
1128 |
|
1129 HBufC* serveridbuf = HBufC::NewLC(aServerName.Length()); |
|
1130 TPtr serveridbufptr = serveridbuf->Des(); |
|
1131 serveridbufptr.Copy(aServerName); |
|
1132 |
|
1133 HBufC* serverid = HbTextResolverSymbian::LoadL(KServerID,*serveridbuf); |
|
1134 CleanupStack::PushL(serverid); |
|
1135 |
|
1136 CHbDeviceNotificationDialogSymbian::NotificationL(KDialogIcon, *trustEstablishedText, *serverid); |
|
1137 |
|
1138 CleanupStack::PopAndDestroy(3); //trustEstablishedText,serveridbuf,serverid |
|
1139 } |
|
1140 } |
983 |
1141 |
984 // ----------------------------------------------------------------------------- |
1142 // ----------------------------------------------------------------------------- |
985 // TCombiningAlgorith::TCombiningAlgorith() |
1143 // TCombiningAlgorith::TCombiningAlgorith() |
986 // ----------------------------------------------------------------------------- |
1144 // ----------------------------------------------------------------------------- |
987 // |
1145 // |