74 q->setRange(0,100); |
74 q->setRange(0,100); |
75 q->setAutoClose(true); |
75 q->setAutoClose(true); |
76 } |
76 } |
77 q->setProgressValue(0); |
77 q->setProgressValue(0); |
78 q->setText(text); |
78 q->setText(text); |
79 q->setTextAlignment(Qt::AlignLeft|Qt::AlignVCenter); |
|
80 q->setIconName(text); |
79 q->setIconName(text); |
81 q->setIconAlignment(Qt::AlignCenter); |
|
82 q->setAnimationDefinition(text); |
80 q->setAnimationDefinition(text); |
83 } |
81 } |
84 |
82 |
85 // Send properties to server |
83 // Send properties to server |
86 void HbDeviceProgressDialogPrivate::sendToServer(bool show) |
84 void HbDeviceProgressDialogPrivate::sendToServer(bool show) |
120 } |
116 } |
121 } |
117 } |
122 } |
118 } |
123 |
119 |
124 static const char * const actionNames[] = { |
120 static const char * const actionNames[] = { |
125 "primaryActionText" |
121 "cancelAction" |
126 }; |
|
127 static const char * const nullActionNames[] = { |
|
128 "primaryActionNull" |
|
129 }; |
122 }; |
130 |
123 |
131 for(int i = 0; i < NumActions; i++) { |
124 for(int i = 0; i < NumActions; i++) { |
132 if (mActions[i].mFlags & Modified) { |
125 if (mActions[i].mFlags & Modified) { |
133 if (show || !(mActions[i].mFlags & SentToServer)) { |
126 if (show || !(mActions[i].mFlags & SentToServer)) { |
|
127 QString actionData; // empty removes action at the plugin |
134 if (mActions[i].mAction) { |
128 if (mActions[i].mAction) { |
135 parameters.insert(actionNames[i], mActions[i].mAction->text()); |
129 actionData.append("t:").append(mActions[i].mAction->text()); |
136 } else { |
|
137 parameters.insert(nullActionNames[i], true); |
|
138 } |
130 } |
|
131 parameters.insert(actionNames[i], actionData); |
139 mActions[i].mFlags |= SentToServer; |
132 mActions[i].mFlags |= SentToServer; |
140 } |
133 } |
141 } |
134 } |
142 } |
135 } |
143 |
136 |
268 void HbDeviceProgressDialogPrivate::dataReceived(QVariantMap data) |
261 void HbDeviceProgressDialogPrivate::dataReceived(QVariantMap data) |
269 { |
262 { |
270 const char *key = "act"; |
263 const char *key = "act"; |
271 QVariantMap::const_iterator i = data.find(key); |
264 QVariantMap::const_iterator i = data.find(key); |
272 if (i != data.constEnd()) { |
265 if (i != data.constEnd()) { |
273 if (i.value().toString() == "p") { |
266 if (i.value().toString() == "c") { |
274 // Client has pressed button. Signal action if one is set. Otherwise emit |
267 // Client has pressed button. Signal action if one is set. Otherwise emit |
275 // cancelled() signal. |
268 // cancelled() signal. |
276 mActions[CancelButton].mTriggered = true; |
269 mActions[CancelButton].mTriggered = true; |
277 QAction *action = mActions[CancelButton].mAction; |
270 QAction *action = mActions[CancelButton].mAction; |
278 if (action) { |
271 if (action) { |
656 { |
635 { |
657 return d->mProperties[HbDeviceProgressDialogPrivate::Text].mValue.toString(); |
636 return d->mProperties[HbDeviceProgressDialogPrivate::Text].mValue.toString(); |
658 } |
637 } |
659 |
638 |
660 /*! |
639 /*! |
661 Sets the text alignment. |
|
662 |
|
663 \param align Qt defined alignment options can used. |
|
664 |
|
665 \sa textAlignment() |
|
666 */ |
|
667 void HbDeviceProgressDialog::setTextAlignment(Qt::Alignment align) |
|
668 { |
|
669 TRACE_ENTRY |
|
670 d->setProperty(HbDeviceProgressDialogPrivate::TextAlignment, align); |
|
671 TRACE_EXIT |
|
672 } |
|
673 |
|
674 /*! |
|
675 Returns the text alignment. |
|
676 |
|
677 The default value is Qt::AlignLeft|Qt::AlignVCenter |
|
678 |
|
679 \sa setTextAlignment() |
|
680 */ |
|
681 Qt::Alignment HbDeviceProgressDialog::textAlignment() const |
|
682 { |
|
683 return static_cast<Qt::Alignment> |
|
684 (d->mProperties[HbDeviceProgressDialogPrivate::TextAlignment].mValue.toInt()); |
|
685 } |
|
686 |
|
687 /*! |
|
688 Sets the text wrapping. |
|
689 |
|
690 \param wrap When set, the text is drawn with Qt::TextWordWrap enabled meaning that |
|
691 lines breaks are at appropriate point, e.g. at word boundaries. |
|
692 |
|
693 \sa textWrapping() |
|
694 |
|
695 \deprecated HbDeviceProgressDialog::setTextWrapping(bool) |
|
696 is deprecated. Will be removed. |
|
697 */ |
|
698 void HbDeviceProgressDialog::setTextWrapping(bool wrap) |
|
699 { |
|
700 TRACE_ENTRY |
|
701 Q_UNUSED(wrap) |
|
702 TRACE_EXIT |
|
703 } |
|
704 |
|
705 /*! |
|
706 Returns the text wrapping setting. Default value is true. |
|
707 |
|
708 \sa setTextWrapping() |
|
709 |
|
710 \deprecated HbDeviceProgressDialog::textWrapping() const |
|
711 is deprecated. Will be removed. |
|
712 */ |
|
713 bool HbDeviceProgressDialog::textWrapping() const |
|
714 { |
|
715 return true; |
|
716 } |
|
717 |
|
718 /*! |
|
719 Sets message box icon name or animation logical name. |
640 Sets message box icon name or animation logical name. |
720 |
641 |
721 \param aIconName Icon name. Icon can be from Hb resources or themes. Or can be a file in |
642 \param aIconName Icon name. Icon can be from Hb resources or themes. Or can be a file in |
722 a file system. |
643 a file system. |
723 |
644 |
736 \sa setIconName() |
657 \sa setIconName() |
737 */ |
658 */ |
738 QString HbDeviceProgressDialog::iconName() const |
659 QString HbDeviceProgressDialog::iconName() const |
739 { |
660 { |
740 return d->mProperties[HbDeviceProgressDialogPrivate::IconName].mValue.toString(); |
661 return d->mProperties[HbDeviceProgressDialogPrivate::IconName].mValue.toString(); |
741 } |
|
742 |
|
743 /*! |
|
744 Sets the icon alignment. |
|
745 |
|
746 \param align Qt defined alignment options can used. |
|
747 |
|
748 \sa iconAlignment() |
|
749 */ |
|
750 void HbDeviceProgressDialog::setIconAlignment(Qt::Alignment align) |
|
751 { |
|
752 TRACE_ENTRY |
|
753 d->setProperty(HbDeviceProgressDialogPrivate::IconAlignment, align); |
|
754 TRACE_EXIT |
|
755 } |
|
756 |
|
757 /*! |
|
758 Returns the icon alignment. Default value is Qt::AlignCenter. |
|
759 |
|
760 \sa setIconAlignment() |
|
761 */ |
|
762 Qt::Alignment HbDeviceProgressDialog::iconAlignment() const |
|
763 { |
|
764 return static_cast<Qt::Alignment> |
|
765 (d->mProperties[HbDeviceProgressDialogPrivate::IconAlignment].mValue.toInt()); |
|
766 } |
662 } |
767 |
663 |
768 /*! |
664 /*! |
769 Sets animation definition to a dialog. Animation's logical name has to be set |
665 Sets animation definition to a dialog. Animation's logical name has to be set |
770 using setIcon(). Animation definition files must be stored to a place where they |
666 using setIcon(). Animation definition files must be stored to a place where they |