49 // --------------------------------------------------------------------------- |
42 // --------------------------------------------------------------------------- |
50 // |
43 // |
51 void CS60BTDialog::ConstructL() |
44 void CS60BTDialog::ConstructL() |
52 { |
45 { |
53 LOG(EJavaBluetooth, EInfo, "+ CS60BTDialog::ConstructL()"); |
46 LOG(EJavaBluetooth, EInfo, "+ CS60BTDialog::ConstructL()"); |
54 #ifndef RD_JAVA_S60_RELEASE_10_1_ONWARDS |
|
55 User::LeaveIfError(mNotifier.Connect()); |
47 User::LeaveIfError(mNotifier.Connect()); |
56 #endif |
|
57 LOG(EJavaBluetooth, EInfo, "- CS60BTDialog::ConstructL()"); |
48 LOG(EJavaBluetooth, EInfo, "- CS60BTDialog::ConstructL()"); |
58 } |
49 } |
59 |
50 |
60 |
51 |
61 // --------------------------------------------------------------------------- |
52 // --------------------------------------------------------------------------- |
79 // |
68 // |
80 CS60BTDialog::~CS60BTDialog() |
69 CS60BTDialog::~CS60BTDialog() |
81 { |
70 { |
82 JELOG2(EJavaBluetooth); |
71 JELOG2(EJavaBluetooth); |
83 LOG(EJavaBluetooth, EInfo, "+ CS60BTDialog::~CS60BTDialog()"); |
72 LOG(EJavaBluetooth, EInfo, "+ CS60BTDialog::~CS60BTDialog()"); |
84 |
|
85 #ifndef RD_JAVA_S60_RELEASE_10_1_ONWARDS |
|
86 DoCancel(); |
73 DoCancel(); |
87 mNotifier.Close(); |
74 mNotifier.Close(); |
88 #endif |
|
89 LOG(EJavaBluetooth, EInfo, "- CS60BTDialog::~CS60BTDialog()"); |
75 LOG(EJavaBluetooth, EInfo, "- CS60BTDialog::~CS60BTDialog()"); |
90 } |
76 } |
91 |
77 |
92 // --------------------------------------------------------------------------- |
78 // --------------------------------------------------------------------------- |
93 // Displays BT query dialog. |
79 // Displays BT query dialog. |
99 TBTGenericQueryNoteType aQueryType) |
85 TBTGenericQueryNoteType aQueryType) |
100 { |
86 { |
101 JELOG2(EJavaBluetooth); |
87 JELOG2(EJavaBluetooth); |
102 LOG1(EJavaBluetooth, EInfo,"+ CS60BTDialog::ShowBTQueryDialog(): aQueryType = %d", aQueryType); |
88 LOG1(EJavaBluetooth, EInfo,"+ CS60BTDialog::ShowBTQueryDialog(): aQueryType = %d", aQueryType); |
103 |
89 |
104 |
|
105 #ifndef RD_JAVA_S60_RELEASE_10_1_ONWARDS |
|
106 mQueryParamsPckg().iMessageType = aQueryType; |
90 mQueryParamsPckg().iMessageType = aQueryType; |
107 mQueryParamsPckg().iNameExists = ETrue; |
91 mQueryParamsPckg().iNameExists = ETrue; |
108 mQueryParamsPckg().iName.Copy(aAppName); |
92 mQueryParamsPckg().iName.Copy(aAppName); |
109 mNotifier.StartNotifierAndGetResponse(mStatus, KBTGenericQueryNotifierUid, |
93 mNotifier.StartNotifierAndGetResponse(mStatus, KBTGenericQueryNotifierUid, |
110 mQueryParamsPckg, mQueryResult); |
94 mQueryParamsPckg, mQueryResult); |
|
95 |
111 User::WaitForRequest(mStatus); |
96 User::WaitForRequest(mStatus); |
112 |
|
113 #else |
|
114 _LIT(KAppInfo,"Application %S cannot be used when Bluetooth is off Activate Bluetooth ?"); |
|
115 _LIT(KAppInfomsg,"Change 'My phone's visibility' setting to 'Show to all'? Application '%S' cannot be used when the visibility is set as 'Hidden'."); |
|
116 |
|
117 TBuf<QUERY_BUF_LEN> queryBuf; |
|
118 TInt err = KErrNone; |
|
119 TBool userOpt; |
|
120 |
|
121 queryBuf.Zero(); |
|
122 if (aQueryType == EBTIsOffJavaQuery) |
|
123 { |
|
124 queryBuf.Format(KAppInfo,&aAppName); |
|
125 } |
|
126 else if (aQueryType == EBTIsNotShownQuery) |
|
127 { |
|
128 queryBuf.Format(KAppInfomsg,&aAppName); |
|
129 } |
|
130 |
|
131 TRAP(err, userOpt = ShowBTQueryHbDialogL(queryBuf)); |
|
132 LOG1(EJavaBluetooth, EInfo," CS60BTDialog::ShowBTQueryDialog(): mQueryResult = %d", err); |
|
133 |
|
134 if (err != KErrNone ) |
|
135 mQueryResult = EFalse; |
|
136 else |
|
137 mQueryResult = userOpt; |
|
138 #endif |
|
139 |
97 |
140 LOG1(EJavaBluetooth, EInfo,"- CS60BTDialog::ShowBTQueryDialog(): mQueryResult = %d", mQueryResult()); |
98 LOG1(EJavaBluetooth, EInfo,"- CS60BTDialog::ShowBTQueryDialog(): mQueryResult = %d", mQueryResult()); |
141 return mQueryResult(); |
99 return mQueryResult(); |
142 } |
100 } |
143 |
101 |
149 // --------------------------------------------------------------------------- |
107 // --------------------------------------------------------------------------- |
150 // |
108 // |
151 void CS60BTDialog::DoCancel() |
109 void CS60BTDialog::DoCancel() |
152 { |
110 { |
153 LOG(EJavaBluetooth, EInfo, "+ CS60BTDialog::DoCancel()"); |
111 LOG(EJavaBluetooth, EInfo, "+ CS60BTDialog::DoCancel()"); |
154 #ifndef RD_JAVA_S60_RELEASE_10_1_ONWARDS |
|
155 mNotifier.CancelNotifier(KBTGenericQueryNotifierUid); |
112 mNotifier.CancelNotifier(KBTGenericQueryNotifierUid); |
156 #endif |
|
157 LOG(EJavaBluetooth, EInfo, "- CS60BTDialog::DoCancel()"); |
113 LOG(EJavaBluetooth, EInfo, "- CS60BTDialog::DoCancel()"); |
158 } |
114 } |
159 |
|
160 #ifdef RD_JAVA_S60_RELEASE_10_1_ONWARDS |
|
161 |
|
162 TBool CS60BTDialog::ShowBTQueryHbDialogL(const TDesC& aBufData) |
|
163 { |
|
164 TBool result = EFalse; |
|
165 |
|
166 CHbDeviceMessageBoxSymbian* messageBox |
|
167 = CHbDeviceMessageBoxSymbian::NewL(CHbDeviceMessageBoxSymbian::EQuestion); |
|
168 CleanupStack::PushL(messageBox); |
|
169 |
|
170 messageBox->SetTextL(aBufData); |
|
171 messageBox->SetTimeout(HbPopup::NoTimeout); |
|
172 |
|
173 // Read localised versions instead of hard coded values. |
|
174 _LIT(KAllowButtonText, "Yes"); |
|
175 _LIT(KDenyButtonText, "No"); |
|
176 |
|
177 messageBox->SetButtonTextL(CHbDeviceMessageBoxSymbian::EAcceptButton, KAllowButtonText); |
|
178 messageBox->SetButton(CHbDeviceMessageBoxSymbian::EAcceptButton, ETrue); |
|
179 messageBox->SetButtonTextL(CHbDeviceMessageBoxSymbian::ERejectButton, KDenyButtonText); |
|
180 messageBox->SetButton(CHbDeviceMessageBoxSymbian::ERejectButton, ETrue); |
|
181 |
|
182 if (messageBox->ExecL() == CHbDeviceMessageBoxSymbian::EAcceptButton) |
|
183 result = ETrue; |
|
184 else |
|
185 result = EFalse; |
|
186 |
|
187 messageBox->Close(); |
|
188 CleanupStack::PopAndDestroy(messageBox); |
|
189 |
|
190 return result; |
|
191 } |
|
192 #endif |
|