536 if (mActiveSchedulerWait.IsStarted()) { |
538 if (mActiveSchedulerWait.IsStarted()) { |
537 mActiveSchedulerWait.AsyncStop(); |
539 mActiveSchedulerWait.AsyncStop(); |
538 } |
540 } |
539 } |
541 } |
540 |
542 |
541 /*! |
543 // Set dialog show level |
|
544 void SetShowLevel(CHbDeviceMessageBoxPrivate *aBox, TInt aLevel) |
|
545 { |
|
546 aBox->SetPropertyValue(CHbDeviceMessageBoxPrivate::EShowLevel, aLevel); |
|
547 } |
|
548 |
|
549 /*! |
|
550 @stable |
|
551 @hbwidgets |
|
552 |
542 \class CHbDeviceMessageBoxSymbian |
553 \class CHbDeviceMessageBoxSymbian |
543 \brief CHbDeviceMessageBoxSymbian is a Symbian implementation of HbDeviceMessageBox. |
554 \brief CHbDeviceMessageBoxSymbian is a Symbian implementation of HbDeviceMessageBox. |
|
555 |
|
556 <b>This class is Symbian only. Not available on other platforms.</b> |
544 |
557 |
545 CHbDeviceMessageBoxSymbian is intended for use by servers that don't run Qt event loop |
558 CHbDeviceMessageBoxSymbian is intended for use by servers that don't run Qt event loop |
546 and cannot use HbDeviceMessageBox. |
559 and cannot use HbDeviceMessageBox. |
547 |
560 |
548 It displays a message box with text, icon or animation and two optional buttons, |
561 It displays a message box with text, icon or animation and two optional buttons, |
549 accept and reject. |
562 accept and reject. |
550 |
563 |
551 It provides a similar interface as HbDeviceMessageBox. The main |
564 It provides a similar interface as HbDeviceMessageBox. The main |
552 differences are: |
565 differences are: |
553 - Signals are replaced by an observer interface |
566 - Signals are replaced by an observer interface |
554 - HbAction/QAction is replaced by button information. |
567 - HbAction/QAction is replaced by button text. |
555 - Function parameters whose type is a Qt or Hb enumeration are replaced by an integer. |
568 - Function parameters whose type is a Qt or Hb enumeration are replaced by an integer. |
556 As suitable default values are set at construction, it is assumed that application rarely |
569 As suitable default values are set at construction, it is assumed that application rarely |
557 needs to use these. |
570 needs to use these. |
558 |
571 |
559 Device message box is a modal dialog. It is shown on top of applications by device dialog |
572 Device message box is a modal dialog. It is shown on top of applications by device dialog |
560 server. CHbDeviceMessageBoxSymbian is a client of the server. |
573 server. CHbDeviceMessageBoxSymbian is a client of the server. |
561 |
574 |
562 Three predefined message boxes are provided or a custom one can be constructed using the API. |
575 Four types of message boxes are predefined. The type determines a set of default properties that |
563 Predefined message boxes are: |
576 are set on construction. Below is a table listing types and their default properties. |
564 - Information |
577 |
565 - Question |
578 <table border="1"> |
566 - Warning |
579 <caption><b>HbDeviceMessageBox types and default properties</b></caption> |
567 |
580 <tr><th>Type</th><th>Icon</th><th>Buttons</th><th>Timeout</th><th>Dismiss policy</th><th>Sound</th></tr> |
568 ShowL() displays a message box asynchronously. The function returns immediately. The launched |
581 <tr><td>ENone</td><td>No icon</td><td>"Ok" button</td><td>Standard timeout</td><td>Tap anywhere</td><td>No sound</td></tr> |
|
582 <tr><td>EInformation</td><td>Info icon</td><td>"Ok" button</td><td>Standard timeout</td><td>Tap anywhere</td><td>Info sound</td></tr> |
|
583 <tr><td>EWarning</td><td>Warning icon</td><td>"Ok" button</td><td>Standard timeout</td><td>Tap anywhere</td><td>Warn sound</td></tr> |
|
584 <tr><td>EQuestion</td><td>Question icon</td><td>"Yes" and "No" buttons</td><td>No timeout</td><td>Button press</td><td>Question sound</td></tr> |
|
585 </table> |
|
586 |
|
587 ShowL() displays a message box asynchronously. The function returns immediately. |
|
588 A new message box is lauched every time ShowL() is called. The launched |
569 dialog can be updated by setters and then calling UpdateL(). Closing can be observed by a |
589 dialog can be updated by setters and then calling UpdateL(). Closing can be observed by a |
570 callback. Because each UpdateL() after the ShowL() requires interprocess communication, |
590 callback. Because each UpdateL() after the ShowL() requires interprocess communication, |
571 it's advisable to fully construct the device message box before displaying it. |
591 it's advisable to fully construct the device message box before displaying it. |
572 |
592 |
573 A device message box is launched synchronously by ExecL() function. The function returns when |
593 A device message box is launched synchronously by ExecL() function. The function returns when |
727 \param aButton Button that was pressed. |
751 \param aButton Button that was pressed. |
728 |
752 |
729 \sa CHbDeviceMessageBoxSymbian::SetObserver() |
753 \sa CHbDeviceMessageBoxSymbian::SetObserver() |
730 */ |
754 */ |
731 |
755 |
732 // Constructor |
756 /*! |
|
757 Constructs CHbDeviceMessageBoxSymbian. |
|
758 */ |
733 CHbDeviceMessageBoxSymbian::CHbDeviceMessageBoxSymbian() |
759 CHbDeviceMessageBoxSymbian::CHbDeviceMessageBoxSymbian() |
734 { |
760 { |
735 } |
761 } |
736 |
762 |
737 // Destructor |
763 /*! |
|
764 Destructs CHbDeviceMessageBoxSymbian. The message box launched by ShowL() |
|
765 is closed if observer is set. If there is no observer, it is |
|
766 left executing and closes itself by timeout. |
|
767 */ |
738 EXPORT_C CHbDeviceMessageBoxSymbian::~CHbDeviceMessageBoxSymbian() |
768 EXPORT_C CHbDeviceMessageBoxSymbian::~CHbDeviceMessageBoxSymbian() |
739 { |
769 { |
740 delete d; |
770 delete d; |
741 } |
771 } |
742 |
772 |
743 /*! |
773 /*! |
744 Factory function. Returns pointer to a device message box. |
774 Constructs a new CHbDeviceMessageBoxSymbian and returns a pointer it. |
745 |
775 |
746 \param aType Selects a template for the message box. Information, question or warning. |
776 \param aType Selects a template for the message box. None, information, question or warning. |
747 \param aObserver Observer for message box close event |
777 \param aObserver Observer for message box close event. 0 if no observer. |
748 */ |
778 */ |
749 EXPORT_C CHbDeviceMessageBoxSymbian* CHbDeviceMessageBoxSymbian::NewL(TType aType, |
779 EXPORT_C CHbDeviceMessageBoxSymbian* CHbDeviceMessageBoxSymbian::NewL(TType aType, |
750 MHbDeviceMessageBoxObserver *aObserver) |
780 MHbDeviceMessageBoxObserver *aObserver) |
751 { |
781 { |
752 ARG_UNUSED(aObserver) |
782 ARG_UNUSED(aObserver) |
975 { |
1007 { |
976 return d->mProperties[CHbDeviceMessageBoxPrivate::EIconName].StringValue(); |
1008 return d->mProperties[CHbDeviceMessageBoxPrivate::EIconName].StringValue(); |
977 } |
1009 } |
978 |
1010 |
979 /*! |
1011 /*! |
980 Sets message box animation definition name. The message box gets updated next time ShowL() or UpdateL() |
1012 Sets message box animation definition name. |
981 is called. |
1013 |
982 |
1014 Supported icon animation formats are following: |
983 Supported animation formats are following: |
|
984 - GIF (.gif) |
1015 - GIF (.gif) |
985 - MNG (.mng) |
1016 - MNG (.mng) |
986 - Frame animations |
1017 - Frame animations |
987 |
1018 |
988 \param aAnimationDefinition Animation definition file name. Definition can be from Hb resources or themes. |
1019 \param aAnimationDefinition Animation definition file name. Definition can be from Hb resources or themes. |
989 Or can be a file in a file system. The definition must be stored to a place where it can be accessed by |
1020 Or can be a file in a file system. The definition must be stored to a place where it can be accessed by |
990 device dialog service. |
1021 device dialog service. |
991 |
1022 |
992 \sa AnimationDefinition() SetIconNameL() HbIconAnimationManager::addDefinitionFile() |
1023 \sa AnimationDefinition() SetIconNameL() HbIconAnimationManager::addDefinitionFile(), ShowL(), UpdateL() |
993 */ |
1024 */ |
994 EXPORT_C void CHbDeviceMessageBoxSymbian::SetAnimationDefinitionL(const TDesC& aAnimationDefinition) |
1025 EXPORT_C void CHbDeviceMessageBoxSymbian::SetAnimationDefinitionL(const TDesC& aAnimationDefinition) |
995 { |
1026 { |
996 d->SetPropertyValueL(CHbDeviceMessageBoxPrivate::EAnimationDefinition, aAnimationDefinition); |
1027 d->SetPropertyValueL(CHbDeviceMessageBoxPrivate::EAnimationDefinition, aAnimationDefinition); |
997 } |
1028 } |
998 |
1029 |
999 /*! |
1030 /*! |
1000 Returns device message box animation definition name. |
1031 Returns device message box animation definition name. |
1001 |
1032 |
1002 \sa SetAnimationDefinitionL() |
1033 \sa SetAnimationDefinitionL() |
1003 */ |
1034 */ |
1004 EXPORT_C TPtrC CHbDeviceMessageBoxSymbian::AnimationDefinition() const |
1035 EXPORT_C TPtrC CHbDeviceMessageBoxSymbian::AnimationDefinition() const |
1005 { |
1036 { |
1006 return d->mProperties[CHbDeviceMessageBoxPrivate::EAnimationDefinition].StringValue(); |
1037 return d->mProperties[CHbDeviceMessageBoxPrivate::EAnimationDefinition].StringValue(); |
1007 } |
1038 } |
1008 |
1039 |
1009 /*! |
1040 /*! |
1010 Sets message box icon visibility. The message box gets updated next time ShowL() or UpdateL() |
1041 Sets message box icon visibility. |
1011 is called. |
|
1012 |
1042 |
1013 \param aVisible Icon visibility. |
1043 \param aVisible Icon visibility. |
1014 |
1044 |
1015 \sa IconVisible() |
1045 \sa IconVisible(), ShowL(), UpdateL() |
1016 */ |
1046 */ |
1017 EXPORT_C void CHbDeviceMessageBoxSymbian::SetIconVisible(TBool aVisible) |
1047 EXPORT_C void CHbDeviceMessageBoxSymbian::SetIconVisible(TBool aVisible) |
1018 { |
1048 { |
1019 d->SetPropertyValue(CHbDeviceMessageBoxPrivate::EIconVisible, aVisible); |
1049 d->SetPropertyValue(CHbDeviceMessageBoxPrivate::EIconVisible, aVisible); |
1020 } |
1050 } |
1021 |
1051 |
1022 /*! |
1052 /*! |
1023 Returns message box icon visibility. |
1053 Returns message box icon visibility. Default value is true for message box |
|
1054 types other than ENone. |
1024 |
1055 |
1025 \sa SetIconVisible() |
1056 \sa SetIconVisible() |
1026 */ |
1057 */ |
1027 EXPORT_C TBool CHbDeviceMessageBoxSymbian::IconVisible() const |
1058 EXPORT_C TBool CHbDeviceMessageBoxSymbian::IconVisible() const |
1028 { |
1059 { |
1029 return d->mProperties[CHbDeviceMessageBoxPrivate::EIconVisible].IntValue(); |
1060 return d->mProperties[CHbDeviceMessageBoxPrivate::EIconVisible].IntValue(); |
1030 } |
1061 } |
1031 |
1062 |
1032 /*! |
1063 /*! |
1033 Sets message box timeout. The message box gets updated next time ShowL() or UpdateL() |
1064 Sets message box timeout. |
1034 is called. |
|
1035 |
1065 |
1036 \param aTimeout Timeout in milliseconds. Zero denotes no timeout. |
1066 \param aTimeout Timeout in milliseconds. Zero denotes no timeout. |
1037 |
1067 |
1038 \sa Timeout() |
1068 \sa Timeout(), ShowL(), UpdateL() |
1039 */ |
1069 */ |
1040 EXPORT_C void CHbDeviceMessageBoxSymbian::SetTimeout(TInt aTimeout) |
1070 EXPORT_C void CHbDeviceMessageBoxSymbian::SetTimeout(TInt aTimeout) |
1041 { |
1071 { |
1042 d->SetPropertyValue(CHbDeviceMessageBoxPrivate::ETimeout, aTimeout); |
1072 d->SetPropertyValue(CHbDeviceMessageBoxPrivate::ETimeout, aTimeout); |
1043 } |
1073 } |
1044 |
1074 |
1045 /*! |
1075 /*! |
1046 Returns message box timeout value in milliseconds. |
1076 Returns message box timeout value in milliseconds. Default value depends on message box type. |
|
1077 Question message box has a default of HbPopup::NoTimeout. All other boxes, the default is |
|
1078 HbPopup::StandardTimeout. |
1047 |
1079 |
1048 \sa SetTimeout() |
1080 \sa SetTimeout() |
1049 */ |
1081 */ |
1050 EXPORT_C TInt CHbDeviceMessageBoxSymbian::Timeout() const |
1082 EXPORT_C TInt CHbDeviceMessageBoxSymbian::Timeout() const |
1051 { |
1083 { |
1052 return d->mProperties[CHbDeviceMessageBoxPrivate::ETimeout].IntValue(); |
1084 return d->mProperties[CHbDeviceMessageBoxPrivate::ETimeout].IntValue(); |
1053 } |
1085 } |
1054 |
1086 |
1055 /*! |
1087 /*! |
1056 Sets message box dismiss policy. The message box gets updated next time ShowL() or UpdateL() |
1088 Sets message box dismiss policy. |
1057 is called. |
|
1058 |
1089 |
1059 \param aHbPopupDismissPolicy Dismiss policy. Values are HbPopup::DismissPolicy flags. |
1090 \param aHbPopupDismissPolicy Dismiss policy. Values are HbPopup::DismissPolicy flags. |
1060 |
1091 |
1061 \sa HbPopup::DismissPolicy, DismissPolicy() |
1092 \sa HbPopup::DismissPolicy, DismissPolicy(), ShowL(), UpdateL() |
1062 */ |
1093 */ |
1063 EXPORT_C void CHbDeviceMessageBoxSymbian::SetDismissPolicy(TInt aHbPopupDismissPolicy) |
1094 EXPORT_C void CHbDeviceMessageBoxSymbian::SetDismissPolicy(TInt aHbPopupDismissPolicy) |
1064 { |
1095 { |
1065 d->SetPropertyValue(CHbDeviceMessageBoxPrivate::EDismissPolicy, |
1096 d->SetPropertyValue(CHbDeviceMessageBoxPrivate::EDismissPolicy, |
1066 aHbPopupDismissPolicy); |
1097 aHbPopupDismissPolicy); |
1067 } |
1098 } |
1068 |
1099 |
1069 /*! |
1100 /*! |
1070 Returns message box dismiss policy. Returned values are HbPopup::DismissPolicy flags. |
1101 Returns message box dismiss policy. Returned values are HbPopup::DismissPolicy flags. |
|
1102 Default depends on message box type. Question box has default HbPopup::NoDismiss and |
|
1103 all other boxes HbPopup::TapAnywhere. |
1071 |
1104 |
1072 \sa HbPopup::DismissPolicy, SetDismissPolicy() |
1105 \sa HbPopup::DismissPolicy, SetDismissPolicy() |
1073 */ |
1106 */ |
1074 EXPORT_C TInt CHbDeviceMessageBoxSymbian::DismissPolicy() const |
1107 EXPORT_C TInt CHbDeviceMessageBoxSymbian::DismissPolicy() const |
1075 { |
1108 { |
1076 return d->mProperties[CHbDeviceMessageBoxPrivate::EDismissPolicy].IntValue(); |
1109 return d->mProperties[CHbDeviceMessageBoxPrivate::EDismissPolicy].IntValue(); |
1077 } |
1110 } |
1078 |
1111 |
1079 /*! |
1112 /*! |
1080 Sets message box button text. The message box gets updated next time ShowL() or UpdateL() |
1113 Sets message box button text. |
1081 is called. |
|
1082 |
1114 |
1083 \param aButton Selects the button. |
1115 \param aButton Selects the button. |
1084 \param aText Button text. |
1116 \param aText Button text. |
1085 |
1117 |
1086 \sa ButtonText() |
1118 \sa ButtonText(), SetButton(), ShowL(), UpdateL() |
1087 */ |
1119 */ |
1088 EXPORT_C void CHbDeviceMessageBoxSymbian::SetButtonTextL(TButtonId aButton, const TDesC& aText) |
1120 EXPORT_C void CHbDeviceMessageBoxSymbian::SetButtonTextL(TButtonId aButton, const TDesC& aText) |
1089 { |
1121 { |
1090 d->SetButtonTextL(aButton, aText); |
1122 d->SetButtonTextL(aButton, aText); |
1091 } |
1123 } |
1092 |
1124 |
1093 /*! |
1125 /*! |
1094 Returns message box button text. |
1126 Returns message box button text. Question message box by default has "Yes" and "No" buttons. |
|
1127 Other message boxes have a single "Ok" button. |
1095 |
1128 |
1096 \param aButton Selects the button. |
1129 \param aButton Selects the button. |
1097 |
1130 |
1098 \sa SetButtonTextL() |
1131 \sa SetButtonTextL() |
1099 */ |
1132 */ |
1104 CHbDeviceMessageBoxPrivate::EAcceptText, aButton); |
1137 CHbDeviceMessageBoxPrivate::EAcceptText, aButton); |
1105 return d->mProperties[id].StringValue(); |
1138 return d->mProperties[id].StringValue(); |
1106 } |
1139 } |
1107 |
1140 |
1108 /*! |
1141 /*! |
1109 Sets message box button presence. The message box gets updated next time ShowL() or UpdateL() |
1142 Sets message box button presence. |
1110 is called. |
|
1111 |
1143 |
1112 \param aButton Selects the button. |
1144 \param aButton Selects the button. |
1113 \param aEnable True enables (makes visible) message box button. |
1145 \param aEnable True enables (makes visible) message box button. |
1114 |
1146 |
1115 \sa HasButton() |
1147 \sa HasButton(), SetButtonTextL(), ShowL(), UpdateL() |
1116 */ |
1148 */ |
1117 EXPORT_C void CHbDeviceMessageBoxSymbian::SetButton(TButtonId aButton, TBool aEnable) |
1149 EXPORT_C void CHbDeviceMessageBoxSymbian::SetButton(TButtonId aButton, TBool aEnable) |
1118 { |
1150 { |
1119 d->SetButtonNull(aButton, !aEnable); |
1151 d->SetButtonNull(aButton, !aEnable); |
1120 } |
1152 } |
1121 |
1153 |
1122 /*! |
1154 /*! |
1123 Returns message box button presence. |
1155 Returns message box button presence. Question message box by default has accept and reject |
|
1156 buttons. Other message boxes have a single accept button. |
1124 |
1157 |
1125 \param aButton Selects the button. |
1158 \param aButton Selects the button. |
1126 |
1159 |
1127 \sa SetButton() |
1160 \sa SetButton(), ButtonText() |
1128 */ |
1161 */ |
1129 EXPORT_C TBool CHbDeviceMessageBoxSymbian::HasButton(TButtonId aButton) const |
1162 EXPORT_C TBool CHbDeviceMessageBoxSymbian::HasButton(TButtonId aButton) const |
1130 { |
1163 { |
1131 CHbDeviceMessageBoxPrivate::TPropertyId id = |
1164 CHbDeviceMessageBoxPrivate::TPropertyId id = |
1132 CHbDeviceMessageBoxPrivate::ButtonPropertyId( |
1165 CHbDeviceMessageBoxPrivate::ButtonPropertyId( |
1135 } |
1168 } |
1136 |
1169 |
1137 /*! |
1170 /*! |
1138 Sets message box buttons to standard buttons. |
1171 Sets message box buttons to standard buttons. |
1139 |
1172 |
1140 \param aButtons Message box buttons. A combination of flags, |
1173 \param aButtons Message box buttons. A combination of flags, eg. |
1141 eg. HbMessageBox::Yes | HbMessageBox::No. Button flags are scanned starting from lsb. |
1174 HbMessageBox::Yes | HbMessageBox::No. |
1142 First button found goes to accept position and so forth. |
1175 Button flags are scanned starting from lsb. First button found goes to accept position |
1143 |
1176 and so forth. |
1144 \sa StandardButtons() |
1177 |
|
1178 \sa HbMessageBox::StandardButton, StandardButtons(), ShowL(), UpdateL() |
1145 */ |
1179 */ |
1146 EXPORT_C void CHbDeviceMessageBoxSymbian::SetStandardButtons(TUint aButtons) |
1180 EXPORT_C void CHbDeviceMessageBoxSymbian::SetStandardButtons(TUint aButtons) |
1147 { |
1181 { |
1148 return d->SetStandardButtons(aButtons); |
1182 return d->SetStandardButtons(aButtons); |
1149 } |
1183 } |
1150 |
1184 |
1151 /*! |
1185 /*! |
1152 Returns standard buttons set to a message box. A default value for question message box is |
1186 Returns standard buttons set to a message box. A default value for question message box is |
1153 HbMessageBox::Yes|HbMessageBox::No. For all other message box types the default is |
1187 HbMessageBox::Yes | HbMessageBox::No. For all other message box types the default is |
1154 HbMessageBox::Ok. |
1188 HbMessageBox::Ok. |
1155 |
1189 |
1156 \sa SetStandardButtons() |
1190 \sa HbMessageBox::StandardButton, SetStandardButtons() |
1157 */ |
1191 */ |
1158 EXPORT_C TUint CHbDeviceMessageBoxSymbian::StandardButtons() const |
1192 EXPORT_C TUint CHbDeviceMessageBoxSymbian::StandardButtons() const |
1159 { |
1193 { |
1160 return d->mProperties[CHbDeviceMessageBoxPrivate::EStandardButtons].IntValue(); |
1194 return d->mProperties[CHbDeviceMessageBoxPrivate::EStandardButtons].IntValue(); |
1161 } |
1195 } |