179 delete cQuery; |
201 delete cQuery; |
180 return ret; |
202 return ret; |
181 } |
203 } |
182 |
204 |
183 bool FmDlgUtils::showTimeSettingQuery( |
205 bool FmDlgUtils::showTimeSettingQuery( |
184 const QString &title, QTime &time ) |
206 const QString &title, QTime &time, const QString &associatedDrives ) |
185 { |
207 { |
186 bool ret( false ); |
208 bool ret( false ); |
187 bool ok ( false ); // SK return (out parameter) |
209 bool ok ( false ); // SK return (out parameter) |
188 |
210 |
189 FmTimeQuery *cQuery=new FmTimeQuery; |
211 FmTimeQuery *cQuery=new FmTimeQuery; |
190 cQuery->setHeadingWidget( new HbLabel( title ) ); |
212 cQuery->setHeadingWidget( new HbLabel( title ) ); |
191 cQuery->setTime( time ); |
213 cQuery->setTime( time ); |
192 |
214 |
193 QString sk1 ( tr( "ok" ) ); |
215 QString sk1 ( hbTrId( "ok" ) ); |
194 QString sk2 ( tr( "cancel" ) ); |
216 QString sk2 ( hbTrId( "cancel" ) ); |
195 |
217 |
196 if(sk1.isEmpty() == false) { |
218 if( !sk1.isEmpty() ) { |
197 HbAction *primary = new HbAction( sk1 ); |
219 HbAction *primary = new HbAction( sk1 ); |
198 cQuery->setPrimaryAction( primary ); |
220 cQuery->setPrimaryAction( primary ); |
199 } |
221 } |
200 |
222 |
201 if( sk2.isEmpty() == false ) { |
223 if( !sk2.isEmpty() ) { |
202 HbAction *secondary = new HbAction( sk2 ); |
224 HbAction *secondary = new HbAction( sk2 ); |
203 cQuery->setSecondaryAction( secondary ); |
225 cQuery->setSecondaryAction( secondary ); |
204 } |
226 } |
205 HbAction* action = cQuery->exec(); |
227 |
206 if( action == cQuery->secondaryAction() ){ |
228 HbAction* action = executeDialog( cQuery, associatedDrives ); |
|
229 if( action == cQuery->primaryAction() ){ |
|
230 ok = true; |
|
231 } |
|
232 else{ |
207 ok = false; |
233 ok = false; |
208 } |
|
209 else{ |
|
210 ok = true; |
|
211 } |
234 } |
212 if( ok ) |
235 if( ok ) |
213 { |
236 { |
214 QTime resultTime = cQuery->getTime(); |
237 QTime resultTime = cQuery->getTime(); |
215 if ( resultTime != time ){ |
238 if ( resultTime != time ){ |
218 } |
241 } |
219 } |
242 } |
220 delete cQuery; |
243 delete cQuery; |
221 return ret; |
244 return ret; |
222 } |
245 } |
|
246 |
223 bool FmDlgUtils::showTextQuery( |
247 bool FmDlgUtils::showTextQuery( |
224 const QString& title, QString& driveName ) |
248 const QString& title, QString& text, bool isDimPrimaryActionWhenEmpty, int maxLength, |
|
249 const QString &associatedDrives ) |
225 { |
250 { |
226 bool ret( false ); |
251 bool ret( false ); |
227 bool ok ( true ); // SK return (out parameter) |
252 bool ok ( true ); // SK return (out parameter) |
228 |
253 |
229 FmSingleTextQuery *cQuery=new FmSingleTextQuery; |
254 FmSingleTextQuery::Options options( 0 ); |
230 cQuery->setHeadingWidget( new HbLabel( title ) ); |
255 if( isDimPrimaryActionWhenEmpty ) { |
231 |
256 options = FmSingleTextQuery::DimPrimereActionWhenEmpty; |
232 QString sk1 ( tr ( "ok" ) ); |
257 } |
233 QString sk2 ( tr ( "cancel" ) ); |
258 FmSingleTextQuery *cQuery = new FmSingleTextQuery( options ); |
234 |
259 if( maxLength != -1 ){ |
235 if(sk1.isEmpty() == false) { |
260 cQuery->setLineEditMaxLength( maxLength ); |
236 HbAction *primary = new HbAction( sk1 ); |
261 } |
237 cQuery->setPrimaryAction( primary ); |
262 cQuery->setHeadingWidget( new HbLabel( title ) ); |
238 } |
263 |
239 |
264 QString sk1 ( hbTrId ( "ok" ) ); |
240 if( sk2.isEmpty() == false ) { |
265 QString sk2 ( hbTrId ( "cancel" ) ); |
241 HbAction *secondary = new HbAction( sk2 ); |
266 |
242 cQuery->setSecondaryAction( secondary ); |
267 if( !sk1.isEmpty() ) { |
243 } |
268 HbAction *primary = new HbAction( sk1 ); |
244 cQuery->setLineEditText( driveName ); |
269 cQuery->setPrimaryAction( primary ); |
|
270 } |
|
271 |
|
272 if( !sk2.isEmpty() ) { |
|
273 HbAction *secondary = new HbAction( sk2 ); |
|
274 cQuery->setSecondaryAction( secondary ); |
|
275 } |
|
276 cQuery->setLineEditText( text ); |
245 cQuery->checkActions(); |
277 cQuery->checkActions(); |
246 |
278 |
247 HbAction* action = cQuery->exec(); |
279 HbAction* action = executeDialog( cQuery, associatedDrives ); |
248 if( action == cQuery->secondaryAction() ){ |
280 if( action == cQuery->primaryAction() ){ |
|
281 ok = true; |
|
282 } |
|
283 else{ |
249 ok = false; |
284 ok = false; |
250 } |
|
251 else{ |
|
252 ok = true; |
|
253 } |
285 } |
254 |
286 |
255 if( ok ){ |
287 if( ok ){ |
256 QString newName = cQuery->getLineEditText(); |
288 QString newName = cQuery->getLineEditText(); |
257 if ( newName != driveName ){ |
289 if ( newName != text ){ |
258 driveName = newName; |
290 text = newName; |
259 ret = true; |
291 ret = true; |
260 } |
292 } |
261 } |
293 } |
262 delete cQuery; |
294 delete cQuery; |
263 return ret; |
295 return ret; |
264 } |
296 } |
265 |
297 |
266 bool FmDlgUtils::showConfirmPasswordQuery( |
298 bool FmDlgUtils::showSinglePasswordQuery( const QString &title, QString &pwd, const QString &associatedDrives ) |
267 const QString &title, const QString &driveName, QString &pwd ) |
299 { |
268 { |
300 bool ret( false ); |
269 bool ret( false ); |
301 |
270 bool ok ( true ); // SK return (out parameter) |
302 FmSingleTextQuery *cQuery = new FmSingleTextQuery( FmSingleTextQuery::DimPrimereActionWhenEmpty, |
271 |
303 HbLineEdit::Password ); |
272 FmSingleTextQuery *cQuery = new FmSingleTextQuery( HbLineEdit::Password ); |
|
273 cQuery->setHeadingWidget( new HbLabel( title ) ); |
304 cQuery->setHeadingWidget( new HbLabel( title ) ); |
274 |
305 |
275 QString sk1 ( tr ("ok" ) ); |
306 QString sk1 ( tr ("ok" ) ); |
276 QString sk2 ( tr ("cancel" ) ); |
307 QString sk2 ( tr ("cancel" ) ); |
277 |
308 |
278 if(sk1.isEmpty() == false) { |
309 if( !sk1.isEmpty() ) { |
279 HbAction *primary = new HbAction( sk1 ); |
310 HbAction *primary = new HbAction( sk1 ); |
280 cQuery->setPrimaryAction( primary ); |
311 cQuery->setPrimaryAction( primary ); |
281 } |
312 } |
282 |
313 |
283 if( sk2.isEmpty() == false ) { |
314 if( !sk2.isEmpty() ) { |
284 HbAction *secondary = new HbAction( sk2 ); |
315 HbAction *secondary = new HbAction( sk2 ); |
285 cQuery->setSecondaryAction( secondary ); |
316 cQuery->setSecondaryAction( secondary ); |
286 } |
317 } |
287 cQuery->checkActions(); |
318 cQuery->checkActions(); |
288 HbAction* action = 0; |
319 |
289 |
320 HbAction* action = executeDialog( cQuery, associatedDrives ); |
290 bool pwdOk( false ); |
321 if( action == cQuery->primaryAction() ){ |
291 |
322 ret = true; |
292 while( ok && !pwdOk ){ |
323 pwd = cQuery->getLineEditText(); |
293 action = cQuery->exec(); |
324 } |
294 if( action == cQuery->secondaryAction() ){ |
325 else{ |
295 ok = false; |
326 ret = false; |
296 } |
327 } |
297 else{ |
328 |
298 ok = true; |
329 delete cQuery; |
299 } |
330 return ret; |
300 |
331 } |
301 if( ok ){ |
332 |
302 QString inputPwd = cQuery->getLineEditText(); |
333 bool FmDlgUtils::showMultiPasswordQuery( |
303 if ( FmUtils::setDrivePwd( driveName, inputPwd, inputPwd ) == 0 ){ |
334 const QString &firstLabel, const QString &secondLabel, QString &pwd, const QString &associatedDrives ) |
304 pwd = inputPwd; |
335 { |
305 pwdOk = true; |
336 bool ret( false ); |
306 ret = true; |
|
307 } |
|
308 else{ |
|
309 HbMessageBox::information( tr( "The password is incorrect, try again!" ) ); |
|
310 } |
|
311 } |
|
312 } |
|
313 delete cQuery; |
|
314 return ret; |
|
315 } |
|
316 |
|
317 bool FmDlgUtils::showChangePasswordQuery( |
|
318 const QString &firstLabel, const QString &secondLabel, QString& newPassword ) |
|
319 { |
|
320 bool ret( false ); |
|
321 bool ok ( true ); // SK return (out parameter) |
|
322 |
337 |
323 FmMultiTextQuery *cQuery = new FmMultiTextQuery( HbLineEdit::Password ); |
338 FmMultiTextQuery *cQuery = new FmMultiTextQuery( HbLineEdit::Password ); |
324 cQuery->setFirstLabelText( firstLabel ); |
339 cQuery->setFirstLabelText( firstLabel ); |
325 cQuery->setSecondLabelText( secondLabel ); |
340 cQuery->setSecondLabelText( secondLabel ); |
326 |
341 |
327 QString sk1 = ( tr( "ok" ) ); |
342 QString sk1 = ( hbTrId( "ok" ) ); |
328 QString sk2 = ( tr( "cancel" ) ); |
343 QString sk2 = ( hbTrId( "cancel" ) ); |
329 |
344 |
330 if(sk1.isEmpty() == false) { |
345 if( !sk1.isEmpty() ) { |
331 HbAction *primary = new HbAction( sk1 ); |
346 HbAction *primary = new HbAction( sk1 ); |
332 cQuery->setPrimaryAction( primary ); |
347 cQuery->setPrimaryAction( primary ); |
333 } |
348 } |
334 |
349 |
335 if( sk2.isEmpty() == false ) { |
350 if( !sk2.isEmpty() ) { |
336 HbAction *secondary = new HbAction( sk2 ); |
351 HbAction *secondary = new HbAction( sk2 ); |
337 cQuery->setSecondaryAction( secondary ); |
352 cQuery->setSecondaryAction( secondary ); |
338 } |
353 } |
339 cQuery->checkActions(); |
354 cQuery->checkActions(); |
340 HbAction* action = 0; |
|
341 |
355 |
342 bool pwdOk( false ); |
356 HbAction* action = executeDialog( cQuery, associatedDrives ); |
343 |
357 if( action == cQuery->primaryAction() ){ |
344 while( ok && !pwdOk ){ |
358 QString firstPwd = cQuery->getFirstEditText(); |
345 action = cQuery->exec(); |
359 QString secondPwd = cQuery->getSecondEditText(); |
346 if( action == cQuery->secondaryAction() ){ |
360 if ( firstPwd == secondPwd ){ |
347 ok = false; |
361 pwd = secondPwd; |
348 } |
362 ret = true; |
349 else{ |
363 } |
350 ok = true; |
364 } |
351 } |
365 else{ |
352 |
366 ret = false; |
353 if( ok ){ |
367 } |
354 QString firstPwd = cQuery->getFirstEditText(); |
368 |
355 QString secondPwd = cQuery->getSecondEditText(); |
369 delete cQuery; |
356 if ( firstPwd == secondPwd ){ |
370 return ret; |
357 newPassword = secondPwd; |
371 } |
358 pwdOk = true; |
|
359 ret = true; |
|
360 } |
|
361 else{ |
|
362 HbMessageBox::information( tr( "The passwords do not match, try again!" ) ); |
|
363 } |
|
364 } |
|
365 } |
|
366 delete cQuery; |
|
367 return ret; |
|
368 } |
|