116 Take parameter values and generate relevant property of this widget |
117 Take parameter values and generate relevant property of this widget |
117 */ |
118 */ |
118 void BtDeviceDialogQueryWidget::processParam(const QVariantMap ¶meters) |
119 void BtDeviceDialogQueryWidget::processParam(const QVariantMap ¶meters) |
119 { |
120 { |
120 TRACE_ENTRY |
121 TRACE_ENTRY |
121 QString keyStr, prompt; |
122 QString keyStr, prompt,title; |
|
123 QVariant name,param,addval; |
122 keyStr.setNum( TBluetoothDialogParams::EResource ); |
124 keyStr.setNum( TBluetoothDialogParams::EResource ); |
123 // Validate if the resource item exists. |
125 // Validate if the resource item exists. |
124 QVariantMap::const_iterator i = parameters.constFind( keyStr ); |
126 QVariantMap::const_iterator i = parameters.constFind( keyStr ); |
125 // item of ResourceId is not found, can't continue. |
127 // item of ResourceId is not found, can't continue. |
126 if ( i == parameters.constEnd() ) { |
128 if ( i == parameters.constEnd() ) { |
127 mLastError = UnknownDeviceDialogError; |
129 mLastError = UnknownDeviceDialogError; |
128 return; |
130 return; |
129 } |
131 } |
130 |
132 title = QString(hbTrId("txt_bt_title_pairing_with_1")); |
131 QVariant param = parameters.value( keyStr ); |
133 param = parameters.value( keyStr ); |
132 int key = param.toInt(); |
134 int key = param.toInt(); |
133 switch ( key ) { |
135 switch ( key ) { |
134 // Query dialogs: |
|
135 case EAuthorization: |
|
136 prompt = QString( tr( "Accept connection request from:\n%1" ) ); |
|
137 break; |
|
138 case EIncomingPairing: |
|
139 prompt = QString( tr( "Device '%1' is trying to pair with you. Allow pairing?" ) ); |
|
140 break; |
|
141 case ENumericComparison: |
136 case ENumericComparison: |
142 prompt = QString( tr( "Does this code match the one on %1?\n\n%2" ) ); |
137 prompt = QString( hbTrId( "txt_bt_info_does_this_code_match_the_code_on_1" ) ); |
143 break; |
138 break; |
144 case EPasskeyDisplay: |
139 case EPasskeyDisplay: |
145 prompt = QString( tr( "Enter on %1:\n\n%2" ) ); |
140 prompt = QString( hbTrId( "txt_bt_info_enter_the_following_code_to_the_1" ) ); |
146 break; |
|
147 case ESetTrusted: |
|
148 prompt = QString( tr( "Authorise this device to make connections automatically?" ) ); |
|
149 break; |
|
150 case EBlockUnpairedDevice: |
|
151 prompt = QString( tr( "Do you want to block all future connection attempts from device %1?" ) ); |
|
152 break; |
|
153 case EBlockPairedDevice: |
|
154 prompt = QString( tr( "Do you want to block all future connection attempts from paired device %1? \nThis will delete your pairing with the device." ) ); |
|
155 break; |
141 break; |
156 // Note dialogs, but not Notification dialogs |
142 // Note dialogs, but not Notification dialogs |
157 // Input dialogs |
143 // Input dialogs |
158 case EPinInput: |
144 case EPinInput: |
159 case EObexPasskeyInput: |
145 case EObexPasskeyInput: |
162 case EUnusedResource: |
148 case EUnusedResource: |
163 default: |
149 default: |
164 mLastError = ParameterError; |
150 mLastError = ParameterError; |
165 break; |
151 break; |
166 } |
152 } |
167 // Could use QChar with ReplacementCharacter? |
|
168 int repls = prompt.count( QString( "%" ) ); |
153 int repls = prompt.count( QString( "%" ) ); |
169 if ( repls > 0 ) { |
154 if ( repls > 0 ) { |
170 QVariant name = parameters.value( QString::number( TBluetoothDeviceDialog::EDeviceName ) ); |
155 name = parameters.value( QString::number( TBluetoothDeviceDialog::EDeviceName ) ); |
171 prompt = prompt.arg( name.toString() ); |
156 prompt = prompt.arg( name.toString() ); |
172 if ( repls > 1 ) { |
157 addval = parameters.value( QString::number( TBluetoothDeviceDialog::EAdditionalDesc ) ); |
173 QVariant addval = parameters.value( QString::number( TBluetoothDeviceDialog::EAdditionalDesc ) ); |
158 // todo: Formating the prompt need to be discussed with UI designer |
174 prompt = prompt.arg( addval.toString() ); |
159 // The passcode could be displayed on a separate row if it the label did support |
175 } |
160 // the use of newline escape character. |
176 } |
161 prompt.append(tr(" ")); |
|
162 prompt.append(addval.toString()); |
|
163 } |
|
164 title = title.arg(name.toString()); |
177 // set property value to this dialog widget |
165 // set property value to this dialog widget |
|
166 mMessageBox->setHeadingWidget(new HbLabel(title)); |
178 mMessageBox->setText( prompt ); |
167 mMessageBox->setText( prompt ); |
|
168 mMessageBox->setIconVisible(false); |
179 TRACE_EXIT |
169 TRACE_EXIT |
180 } |
170 } |
181 |
171 |
182 /*! |
172 /*! |
183 Reset properties to default values |
173 Reset properties to default values |