28 #include <hblineedit.h> |
28 #include <hblineedit.h> |
29 #include <hbaction.h> |
29 #include <hbaction.h> |
30 #include "hbinputdialogcontent_p.h" |
30 #include "hbinputdialogcontent_p.h" |
31 #include <hbstyleoptioninputdialog_p.h> |
31 #include <hbstyleoptioninputdialog_p.h> |
32 #include <hbvalidator.h> |
32 #include <hbvalidator.h> |
33 |
33 #include <hbstyletextprimitivedata.h> |
34 #include <QGraphicsScene> |
34 #include <QGraphicsScene> |
35 |
35 |
36 #ifdef HBINPUTDIALOG_DEBUG |
36 #ifdef HBINPUTDIALOG_DEBUG |
37 #include <QtDebug> |
37 #include <QtDebug> |
38 #endif |
38 #endif |
359 HbDialog::initStyleOption(option); |
359 HbDialog::initStyleOption(option); |
360 option->text = d->mPromptText; |
360 option->text = d->mPromptText; |
361 option->additionalText = d->mPromptAdditionalText; |
361 option->additionalText = d->mPromptAdditionalText; |
362 } |
362 } |
363 |
363 |
|
364 void HbInputDialog::initPrimitiveData(HbStylePrimitiveData *primitiveData, const QGraphicsObject *primitive) |
|
365 { |
|
366 HbWidgetBase::initPrimitiveData(primitiveData, primitive); |
|
367 QString itemName = HbStyle::itemName(primitive); |
|
368 if (itemName == QLatin1String("label-1")) { |
|
369 HbStyleTextPrimitiveData *data = hbstyleprimitivedata_cast<HbStyleTextPrimitiveData*>(primitiveData); |
|
370 data->text = promptText(); |
|
371 data->textWrapping = Hb::TextWordWrap; |
|
372 } |
|
373 |
|
374 if (itemName == QLatin1String("label-2")) { |
|
375 HbStyleTextPrimitiveData *data = hbstyleprimitivedata_cast<HbStyleTextPrimitiveData*>(primitiveData); |
|
376 data->text = promptText(1); |
|
377 data->textWrapping = Hb::TextWordWrap; |
|
378 } |
|
379 } |
|
380 |
364 /*! |
381 /*! |
365 \reimp |
382 \reimp |
366 */ |
383 */ |
367 void HbInputDialog::updatePrimitives() |
384 void HbInputDialog::updatePrimitives() |
368 { |
385 { |
369 Q_D(HbInputDialog); |
386 Q_D(HbInputDialog); |
370 HbDialog::updatePrimitives(); |
387 HbDialog::updatePrimitives(); |
371 HbStyleOptionInputDialog option; |
|
372 initStyleOption(&option); |
|
373 if (d->mContentWidget->mLabel1) { |
388 if (d->mContentWidget->mLabel1) { |
374 HbStylePrivate::updatePrimitive(d->mContentWidget->mLabel1, HbStylePrivate::P_InputDialog_text, &option); |
389 HbStyleTextPrimitiveData data; |
375 } |
390 initPrimitiveData(&data, d->mContentWidget->mLabel1); |
376 |
391 style()->updatePrimitive(d->mContentWidget->mLabel1, &data, this); |
377 if (d->mContentWidget->mLabel2 && d->mContentWidget->mAdditionalRowVisible) { |
392 } |
378 HbStylePrivate::updatePrimitive(d->mContentWidget->mLabel2, HbStylePrivate::P_InputDialog_additionaltext, &option); |
393 |
379 } |
394 if (d->mContentWidget->mLabel2) { |
380 } |
395 HbStyleTextPrimitiveData data; |
381 |
396 initPrimitiveData(&data, d->mContentWidget->mLabel2); |
|
397 style()->updatePrimitive(d->mContentWidget->mLabel2, &data, this); |
|
398 } |
|
399 } |
|
400 |
|
401 |
|
402 /*! |
|
403 Recreaction of all the primitives. |
|
404 */ |
|
405 void HbInputDialog::recreatePrimitives() |
|
406 { |
|
407 Q_D(HbInputDialog); |
|
408 if (d->mContentWidget->mLabel1) { |
|
409 delete d->mContentWidget->mLabel1; |
|
410 d->mContentWidget->mLabel1 = 0; |
|
411 d->mContentWidget->mLabel1 = style()->createPrimitive(HbStyle::PT_IconItem, "label-1",d->mContentWidget); |
|
412 } |
|
413 if (d->mContentWidget->mLabel2) { |
|
414 delete d->mContentWidget->mLabel2; |
|
415 d->mContentWidget->mLabel2 = 0; |
|
416 d->mContentWidget->mLabel2 = style()->createPrimitive(HbStyle::PT_IconItem, "label-2",d->mContentWidget); |
|
417 } |
|
418 } |
382 void HbInputDialog::done(int code) |
419 void HbInputDialog::done(int code) |
383 { |
420 { |
384 Q_D(HbInputDialog); |
421 Q_D(HbInputDialog); |
385 if(code==Accepted) { |
422 if(code==Accepted) { |
386 QString text; |
423 QString text; |