src/hbwidgets/devicedialogs/hbdevicemessageboxsymbian.cpp
changeset 21 4633027730f5
parent 7 923ff622b8b9
child 23 e6ad4ef83b23
equal deleted inserted replaced
7:923ff622b8b9 21:4633027730f5
   383         if (sendProperty) {
   383         if (sendProperty) {
   384             CHbSymbianVariant* parameter;
   384             CHbSymbianVariant* parameter;
   385             if (i == EAcceptText || i == ERejectText) {
   385             if (i == EAcceptText || i == ERejectText) {
   386                 HBufC *actionData = CreateActionDataLC(property.IsNullAction(), property.StringValue());
   386                 HBufC *actionData = CreateActionDataLC(property.IsNullAction(), property.StringValue());
   387                 parameter = CHbSymbianVariant::NewL(actionData, CHbSymbianVariant::EDes);
   387                 parameter = CHbSymbianVariant::NewL(actionData, CHbSymbianVariant::EDes);
   388                 CleanupStack::PopAndDestroy(); // actionData
   388                 CleanupStack::PopAndDestroy(actionData);
   389             } else if (property.Type() == TMessageBoxProperty::EIntProperty) {
   389             } else if (property.Type() == TMessageBoxProperty::EIntProperty) {
   390                 TInt value = property.IntValue();
   390                 TInt value = property.IntValue();
   391                 parameter = CHbSymbianVariant::NewL(&value, CHbSymbianVariant::EInt);
   391                 parameter = CHbSymbianVariant::NewL(&value, CHbSymbianVariant::EInt);
   392             } else {
   392             } else {
   393                 TPtrC value = property.StringValue();
   393                 TPtrC value = property.StringValue();
   394                 parameter = CHbSymbianVariant::NewL(&value, CHbSymbianVariant::EDes);
   394                 parameter = CHbSymbianVariant::NewL(&value, CHbSymbianVariant::EDes);
   395             }
   395             }
   396             CleanupStack::PushL(parameter);
   396             CleanupStack::PushL(parameter);
   397             User::LeaveIfError(parameters->Add(
   397             User::LeaveIfError(parameters->Add(
   398                 PropertyName(static_cast<TPropertyId>(i)), parameter));
   398                 PropertyName(static_cast<TPropertyId>(i)), parameter));
   399             CleanupStack::Pop(); // parameter
   399             CleanupStack::Pop(parameter);
   400             property.SetModified(false);
   400             property.SetModified(false);
   401         }
   401         }
   402     }
   402     }
   403 
   403 
   404     _LIT(KDeviceDialogType, "com.nokia.hb.devicemessagebox/1.0");
   404     _LIT(KDeviceDialogType, "com.nokia.hb.devicemessagebox/1.0");
   414         error = mDeviceDialog->Update(*parameters);
   414         error = mDeviceDialog->Update(*parameters);
   415         if (error != KErrNone) {
   415         if (error != KErrNone) {
   416             User::Leave(error); // error can be positive or negative
   416             User::Leave(error); // error can be positive or negative
   417         }
   417         }
   418     }
   418     }
   419     CleanupStack::PopAndDestroy(); // parameters
   419     CleanupStack::PopAndDestroy(parameters);
   420 }
   420 }
   421 
   421 
   422 // Close message box
   422 // Close message box
   423 void CHbDeviceMessageBoxPrivate::Close()
   423 void CHbDeviceMessageBoxPrivate::Close()
   424 {
   424 {
   549     accept and reject.
   549     accept and reject.
   550 
   550 
   551     It provides a similar interface as HbDeviceMessageBox. The main
   551     It provides a similar interface as HbDeviceMessageBox. The main
   552     differences are:
   552     differences are:
   553     - Signals are replaced by an observer interface
   553     - Signals are replaced by an observer interface
   554     - HbAction/QAction is replaced by button information.
   554     - HbAction/QAction is replaced by button text.
   555     - Function parameters whose type is a Qt or Hb enumeration are replaced by an integer.
   555     - 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
   556       As suitable default values are set at construction, it is assumed that application rarely
   557       needs to use these.
   557       needs to use these.
   558 
   558 
   559     Device message box is a modal dialog. It is shown on top of applications by device dialog
   559     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.
   560     server. CHbDeviceMessageBoxSymbian is a client of the server.
   561 
   561 
   562     Three predefined message boxes are provided or a custom one can be constructed using the API.
   562     Four types of message boxes are predefined. The type determines a set of default properties that
   563     Predefined message boxes are:
   563     are set on construction. Below is a table listing types and their default properties.
   564     - Information
   564 
   565     - Question
   565     <table border="1">
   566     - Warning
   566         <caption><b>HbDeviceMessageBox types and default properties</b></caption>
       
   567         <tr><th>Type</th><th>Icon</th><th>Buttons</th><th>Timeout</th><th>Dismiss policy</th><th>Sound</th></tr>
       
   568         <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>
       
   569         <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>
       
   570         <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>
       
   571         <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>
       
   572     </table>
   567 
   573 
   568     ShowL() displays a message box asynchronously. The function returns immediately. The launched
   574     ShowL() displays a message box asynchronously. The function returns immediately. The launched
   569     dialog can be updated by setters and then calling UpdateL(). Closing can be observed by a
   575     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,
   576     callback. Because each UpdateL() after the ShowL() requires interprocess communication,
   571     it's advisable to fully construct the device message box before displaying it.
   577     it's advisable to fully construct the device message box before displaying it.
   583 
   589 
   584     Static convenience functions are provided for ease of use. Message boxes created by these
   590     Static convenience functions are provided for ease of use. Message boxes created by these
   585     static functions contain a default set of properties depending on the message box type and their
   591     static functions contain a default set of properties depending on the message box type and their
   586     contents cannot be updated while the message box executes.
   592     contents cannot be updated while the message box executes.
   587 
   593 
   588     Supported animation formats are following:
   594     Supported icon animation formats are following:
   589     - GIF (.gif)
   595     - GIF (.gif)
   590     - MNG (.mng)
   596     - MNG (.mng)
   591         - Frame animations
   597         - Frame animations
   592 
   598 
   593     Sample code:
   599     Sample code:
   671     @hbwidgets
   677     @hbwidgets
   672 */
   678 */
   673 
   679 
   674 /*!
   680 /*!
   675     \enum CHbDeviceMessageBoxSymbian::TType
   681     \enum CHbDeviceMessageBoxSymbian::TType
   676     Predefined device message boxes.
   682     Message box type. Determines a set of default properties for the message box.
   677 */
   683 */
   678 /*!
   684 /*!
   679     \var CHbDeviceMessageBoxSymbian::TType CHbDeviceMessageBoxSymbian::ENone
   685     \var CHbDeviceMessageBoxSymbian::TType CHbDeviceMessageBoxSymbian::ENone
   680     Message box with no icon and audio defined by default.
   686     Message box with no icon and audio defined.
   681 */
   687 */
   682 /*!
   688 /*!
   683     \var CHbDeviceMessageBoxSymbian::TType CHbDeviceMessageBoxSymbian::EInformation
   689     \var CHbDeviceMessageBoxSymbian::TType CHbDeviceMessageBoxSymbian::EInformation
   684     Information message box.
   690     Information message box.
   685 */
   691 */
   741 }
   747 }
   742 
   748 
   743 /*!
   749 /*!
   744     Factory function. Returns pointer to a device message box.
   750     Factory function. Returns pointer to a device message box.
   745 
   751 
   746     \param aType Selects a template for the message box. Information, question or warning.
   752     \param aType Selects a template for the message box. None, information, question or warning.
   747     \param aObserver Observer for message box close event
   753     \param aObserver Observer for message box close event
   748 */
   754 */
   749 EXPORT_C CHbDeviceMessageBoxSymbian* CHbDeviceMessageBoxSymbian::NewL(TType aType,
   755 EXPORT_C CHbDeviceMessageBoxSymbian* CHbDeviceMessageBoxSymbian::NewL(TType aType,
   750     MHbDeviceMessageBoxObserver *aObserver)
   756     MHbDeviceMessageBoxObserver *aObserver)
   751 {
   757 {
   755     CHbDeviceMessageBoxPrivate *mboxPrivate = new (ELeave) CHbDeviceMessageBoxPrivate;
   761     CHbDeviceMessageBoxPrivate *mboxPrivate = new (ELeave) CHbDeviceMessageBoxPrivate;
   756     mboxPrivate->q = messageBox;
   762     mboxPrivate->q = messageBox;
   757     CleanupStack::PushL(mboxPrivate);
   763     CleanupStack::PushL(mboxPrivate);
   758     mboxPrivate->ConstructL(aType, aObserver);
   764     mboxPrivate->ConstructL(aType, aObserver);
   759     messageBox->d = mboxPrivate;
   765     messageBox->d = mboxPrivate;
   760     CleanupStack::Pop(2); // messageBox, mboxPrivate
   766     CleanupStack::Pop(2, messageBox); // mboxPrivate, messageBox
   761     messageBox->SetObserver(aObserver);
   767     messageBox->SetObserver(aObserver);
   762     return messageBox;
   768     return messageBox;
   763 }
   769 }
   764 
   770 
   765 /*!
   771 /*!
   766     Static convenience function to create and show a question device message box. Waits for
   772     Static convenience function to create and show a question device message box. Waits for
   767     the message box to close and returns button selected. If message box was closed for other
   773     the message box to close and returns button selected. If message box was closed for other
   768     reason than button press, returns EInvalidButton.
   774     reason than button press, returns CHbDeviceMessageBoxSymbian::EInvalidButton.
   769 
   775 
   770     <b> Beware that Symbian event processing is running while the function executes. For example
   776     <b> Beware that Symbian event processing is running while the function executes. For example
   771     application may have exited when the function returns.</b>
   777     application may have exited when the function returns.</b>
   772 
   778 
   773     \param aText Message box text.
   779     \param aText Message box text.
   786     }
   792     }
   787     if (aRejectButtonText.Length()) {
   793     if (aRejectButtonText.Length()) {
   788         messageBox->SetButtonTextL(ERejectButton, aRejectButtonText);
   794         messageBox->SetButtonTextL(ERejectButton, aRejectButtonText);
   789     }
   795     }
   790     TButtonId buttonId = messageBox->ExecL();
   796     TButtonId buttonId = messageBox->ExecL();
   791     CleanupStack::PopAndDestroy(); // messageBox
   797     CleanupStack::PopAndDestroy(messageBox);
   792     return buttonId;
   798     return buttonId;
   793 }
   799 }
   794 
   800 
   795 /*!
   801 /*!
   796     Static convenience function to create and show a question device message box. Waits for
   802     Static convenience function to create and show a question device message box. Waits for
   797     the message box to close and returns button selected. If message box was closed for other
   803     the message box to close and returns button selected. If message box was closed for other
   798     reason than button press, returns EInvalidButton.
   804     reason than button press, returns CHbDeviceMessageBoxSymbian::EInvalidButton.
   799 
   805 
   800     <b> Beware that Symbian event processing is running while the function executes. For example
   806     <b> Beware that Symbian event processing is running while the function executes. For example
   801     application may have exited when the function returns.</b>
   807     application may have exited when the function returns.</b>
   802 
   808 
   803     \param aText Message box text.
   809     \param aText Message box text.
   813     if (!aStandardButtons) {
   819     if (!aStandardButtons) {
   814         aStandardButtons = 0x00002000|0x00010000; // Yes|No
   820         aStandardButtons = 0x00002000|0x00010000; // Yes|No
   815     }
   821     }
   816     messageBox->SetStandardButtons(aStandardButtons);
   822     messageBox->SetStandardButtons(aStandardButtons);
   817     TButtonId buttonId = messageBox->ExecL();
   823     TButtonId buttonId = messageBox->ExecL();
   818     CleanupStack::PopAndDestroy(); // messageBox
   824     CleanupStack::PopAndDestroy(messageBox);
   819     return buttonId;
   825     return buttonId;
   820 }
   826 }
   821 
   827 
   822 /*!
   828 /*!
   823     Static convenience function to create and show an information device message box.
   829     Static convenience function to create and show an information device message box. Returns
       
   830     immediately (doesn't wait for the box to close).
   824 
   831 
   825     \param aText Message box text.
   832     \param aText Message box text.
   826 */
   833 */
   827 EXPORT_C void CHbDeviceMessageBoxSymbian::InformationL(const TDesC& aText)
   834 EXPORT_C void CHbDeviceMessageBoxSymbian::InformationL(const TDesC& aText)
   828 {
   835 {
   829     CHbDeviceMessageBoxSymbian* messageBox = NewL(EInformation);
   836     CHbDeviceMessageBoxSymbian* messageBox = NewL(EInformation);
   830     CleanupStack::PushL(messageBox);
   837     CleanupStack::PushL(messageBox);
   831     messageBox->SetTextL(aText);
   838     messageBox->SetTextL(aText);
   832     messageBox->ShowL();
   839     messageBox->ShowL();
   833     CleanupStack::PopAndDestroy(); // messageBox
   840     CleanupStack::PopAndDestroy(messageBox);
   834 }
   841 }
   835 
   842 
   836 /*!
   843 /*!
   837     Static convenience function to create and show a warning device message box.
   844     Static convenience function to create and show a warning device message box. Returns
       
   845     immediately (doesn't wait for the box to close).
   838 
   846 
   839     \param aText Message box text.
   847     \param aText Message box text.
   840 */
   848 */
   841 EXPORT_C void CHbDeviceMessageBoxSymbian::WarningL(const TDesC& aText)
   849 EXPORT_C void CHbDeviceMessageBoxSymbian::WarningL(const TDesC& aText)
   842 {
   850 {
   843     CHbDeviceMessageBoxSymbian* messageBox = NewL(EWarning);
   851     CHbDeviceMessageBoxSymbian* messageBox = NewL(EWarning);
   844     CleanupStack::PushL(messageBox);
   852     CleanupStack::PushL(messageBox);
   845     messageBox->SetTextL(aText);
   853     messageBox->SetTextL(aText);
   846     messageBox->ShowL();
   854     messageBox->ShowL();
   847     CleanupStack::PopAndDestroy(); // messageBox
   855     CleanupStack::PopAndDestroy(messageBox);
   848 }
   856 }
   849 
   857 
   850 /*!
   858 /*!
   851     Shows a device message box asyncronously. Function launches the message box and returns immediately.
   859     Shows a device message box asyncronously. Function launches the message box and returns immediately.
   852     Closing of the message box can be observer with MHbDeviceMessageBoxObserver.
   860     Closing of the message box can be observer with MHbDeviceMessageBoxObserver.
   871 {
   879 {
   872     d->SendToServerL(false);
   880     d->SendToServerL(false);
   873 }
   881 }
   874 
   882 
   875 /*!
   883 /*!
   876     Closes a device message box.
   884     Closes a device message box. Closing of the message box can be observer with
   877 
   885     MHbDeviceMessageBoxObserver.
   878     \sa ShowL()
   886 
       
   887     \sa ShowL(),  SetObserver()
   879 */
   888 */
   880 EXPORT_C void CHbDeviceMessageBoxSymbian::Close()
   889 EXPORT_C void CHbDeviceMessageBoxSymbian::Close()
   881 {
   890 {
   882     d->Close();
   891     d->Close();
   883 }
   892 }
   884 
   893 
   885 /*!
   894 /*!
   886     Shows a device message box synchronously. Function launches the message box and waits for it
   895     Shows a device message box synchronously. Function launches the message box and waits for it
   887     to close. Returns a button that was selected. If message box was closed for other reason
   896     to close. Returns a button that was selected. If message box was closed for other reason
   888     than button press, returns EInvalidButton.
   897     than button press, returns CHbDeviceMessageBoxSymbian::EInvalidButton.
   889 
   898 
   890     <b> Beware that Symbian event processing is running while the function executes. For example
   899     <b> Beware that Symbian event processing is running while the function executes. For example
   891     application may have exited when the function returns.</b>
   900     application may have exited when the function returns.</b>
   892 
   901 
   893     \sa ShowL()
   902     \sa ShowL()
   904     return buttonId;
   913     return buttonId;
   905 }
   914 }
   906 
   915 
   907 /*!
   916 /*!
   908     Sets message box type. All message box properties are reset to a default values for the type.
   917     Sets message box type. All message box properties are reset to a default values for the type.
   909     A ShowL() must be called to launch a message box after SetTypeL() has been called.
   918     Type of a showing message box cannot be changed on the fly. A ShowL() must be called to launch
       
   919     a new message box after SetTypeL() has been called.
   910 
   920 
   911     \param aType Message box type.
   921     \param aType Message box type.
   912 
   922 
   913     \sa Type()
   923     \sa Type(), ShowL()
   914 */
   924 */
   915 EXPORT_C void CHbDeviceMessageBoxSymbian::SetTypeL(TType aType)
   925 EXPORT_C void CHbDeviceMessageBoxSymbian::SetTypeL(TType aType)
   916 {
   926 {
   917     d->InitProperties(aType);
   927     d->InitProperties(aType);
   918     d->mShowCalled = false;
   928     d->mShowCalled = false;
   928     return static_cast<TType>(
   938     return static_cast<TType>(
   929         d->mProperties[CHbDeviceMessageBoxPrivate::EType].IntValue());
   939         d->mProperties[CHbDeviceMessageBoxPrivate::EType].IntValue());
   930 }
   940 }
   931 
   941 
   932 /*!
   942 /*!
   933     Sets message box text. The message box gets updated next time ShowL() or UpdateL()
   943     Sets message box text.
   934     is called.
       
   935 
   944 
   936     \param aText Message box text.
   945     \param aText Message box text.
   937 
   946 
   938     \sa Text()
   947     \sa Text(), ShowL(), UpdateL()
   939 */
   948 */
   940 EXPORT_C void CHbDeviceMessageBoxSymbian::SetTextL(const TDesC& aText)
   949 EXPORT_C void CHbDeviceMessageBoxSymbian::SetTextL(const TDesC& aText)
   941 {
   950 {
   942     d->SetPropertyValueL(CHbDeviceMessageBoxPrivate::EText, aText);
   951     d->SetPropertyValueL(CHbDeviceMessageBoxPrivate::EText, aText);
   943 }
   952 }
   951 {
   960 {
   952     return d->mProperties[CHbDeviceMessageBoxPrivate::EText].StringValue();
   961     return d->mProperties[CHbDeviceMessageBoxPrivate::EText].StringValue();
   953 }
   962 }
   954 
   963 
   955 /*!
   964 /*!
   956     Sets message box icon name or animation logical name. The message box gets updated next time ShowL() or UpdateL()
   965     Sets message box icon name or animation logical name.
   957     is called.
       
   958 
   966 
   959     \param aIconName Icon name. Icon can be from Hb resources or themes. Or can be a file in
   967     \param aIconName Icon name. Icon can be from Hb resources or themes. Or can be a file in
   960     a file system.
   968     a file system.
   961 
   969 
   962     \sa IconName()
   970     \sa IconName(), ShowL(), UpdateL()
   963 */
   971 */
   964 EXPORT_C void CHbDeviceMessageBoxSymbian::SetIconNameL(const TDesC& aIconName)
   972 EXPORT_C void CHbDeviceMessageBoxSymbian::SetIconNameL(const TDesC& aIconName)
   965 {
   973 {
   966     d->SetPropertyValueL(CHbDeviceMessageBoxPrivate::EIconName, aIconName);
   974     d->SetPropertyValueL(CHbDeviceMessageBoxPrivate::EIconName, aIconName);
   967 }
   975 }
   975 {
   983 {
   976     return d->mProperties[CHbDeviceMessageBoxPrivate::EIconName].StringValue();
   984     return d->mProperties[CHbDeviceMessageBoxPrivate::EIconName].StringValue();
   977 }
   985 }
   978 
   986 
   979 /*!
   987 /*!
   980     Sets message box animation definition name.  The message box gets updated next time ShowL() or UpdateL()
   988     Sets message box animation definition name.
   981     is called.
   989 
   982 
   990     Supported icon animation formats are following:
   983     Supported animation formats are following:
       
   984     - GIF (.gif)
   991     - GIF (.gif)
   985     - MNG (.mng)
   992     - MNG (.mng)
   986         - Frame animations
   993     - Frame animations
   987 
   994 
   988     \param aAnimationDefinition Animation definition file name. Definition can be from Hb resources or themes.
   995     \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
   996     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.
   997     device dialog service.
   991 
   998 
   992     \sa AnimationDefinition() SetIconNameL() HbIconAnimationManager::addDefinitionFile()
   999     \sa AnimationDefinition() SetIconNameL() HbIconAnimationManager::addDefinitionFile(), ShowL(), UpdateL()
   993 */
  1000 */
   994 EXPORT_C void CHbDeviceMessageBoxSymbian::SetAnimationDefinitionL(const TDesC& aAnimationDefinition)
  1001 EXPORT_C void CHbDeviceMessageBoxSymbian::SetAnimationDefinitionL(const TDesC& aAnimationDefinition)
   995 {
  1002 {
   996 	d->SetPropertyValueL(CHbDeviceMessageBoxPrivate::EAnimationDefinition, aAnimationDefinition);
  1003 	d->SetPropertyValueL(CHbDeviceMessageBoxPrivate::EAnimationDefinition, aAnimationDefinition);
   997 }
  1004 }
  1005 {
  1012 {
  1006 	return d->mProperties[CHbDeviceMessageBoxPrivate::EAnimationDefinition].StringValue();
  1013 	return d->mProperties[CHbDeviceMessageBoxPrivate::EAnimationDefinition].StringValue();
  1007 }
  1014 }
  1008 
  1015 
  1009 /*!
  1016 /*!
  1010     Sets message box icon visibility. The message box gets updated next time ShowL() or UpdateL()
  1017     Sets message box icon visibility.
  1011     is called.
       
  1012 
  1018 
  1013     \param aVisible Icon visibility.
  1019     \param aVisible Icon visibility.
  1014 
  1020 
  1015     \sa IconVisible()
  1021     \sa IconVisible(), ShowL(), UpdateL()
  1016 */
  1022 */
  1017 EXPORT_C void CHbDeviceMessageBoxSymbian::SetIconVisible(TBool aVisible)
  1023 EXPORT_C void CHbDeviceMessageBoxSymbian::SetIconVisible(TBool aVisible)
  1018 {
  1024 {
  1019     d->SetPropertyValue(CHbDeviceMessageBoxPrivate::EIconVisible, aVisible);
  1025     d->SetPropertyValue(CHbDeviceMessageBoxPrivate::EIconVisible, aVisible);
  1020 }
  1026 }
  1021 
  1027 
  1022 /*!
  1028 /*!
  1023     Returns message box icon visibility.
  1029     Returns message box icon visibility. Default value is true for message box
       
  1030     types other than ENone.
  1024 
  1031 
  1025     \sa SetIconVisible()
  1032     \sa SetIconVisible()
  1026 */
  1033 */
  1027 EXPORT_C TBool CHbDeviceMessageBoxSymbian::IconVisible() const
  1034 EXPORT_C TBool CHbDeviceMessageBoxSymbian::IconVisible() const
  1028 {
  1035 {
  1029     return d->mProperties[CHbDeviceMessageBoxPrivate::EIconVisible].IntValue();
  1036     return d->mProperties[CHbDeviceMessageBoxPrivate::EIconVisible].IntValue();
  1030 }
  1037 }
  1031 
  1038 
  1032 /*!
  1039 /*!
  1033     Sets message box timeout. The message box gets updated next time ShowL() or UpdateL()
  1040     Sets message box timeout.
  1034     is called.
       
  1035 
  1041 
  1036     \param aTimeout Timeout in milliseconds. Zero denotes no timeout.
  1042     \param aTimeout Timeout in milliseconds. Zero denotes no timeout.
  1037 
  1043 
  1038     \sa Timeout()
  1044     \sa Timeout(), ShowL(), UpdateL()
  1039 */
  1045 */
  1040 EXPORT_C void CHbDeviceMessageBoxSymbian::SetTimeout(TInt aTimeout)
  1046 EXPORT_C void CHbDeviceMessageBoxSymbian::SetTimeout(TInt aTimeout)
  1041 {
  1047 {
  1042     d->SetPropertyValue(CHbDeviceMessageBoxPrivate::ETimeout, aTimeout);
  1048     d->SetPropertyValue(CHbDeviceMessageBoxPrivate::ETimeout, aTimeout);
  1043 }
  1049 }
  1044 
  1050 
  1045 /*!
  1051 /*!
  1046     Returns message box timeout value in milliseconds.
  1052     Returns message box timeout value in milliseconds. Default value depends on message box type.
       
  1053     Question message box has a default of HbPopup::NoTimeout. All other boxes, the default is
       
  1054     HbPopup::StandardTimeout.
  1047 
  1055 
  1048     \sa SetTimeout()
  1056     \sa SetTimeout()
  1049 */
  1057 */
  1050 EXPORT_C TInt CHbDeviceMessageBoxSymbian::Timeout() const
  1058 EXPORT_C TInt CHbDeviceMessageBoxSymbian::Timeout() const
  1051 {
  1059 {
  1052     return d->mProperties[CHbDeviceMessageBoxPrivate::ETimeout].IntValue();
  1060     return d->mProperties[CHbDeviceMessageBoxPrivate::ETimeout].IntValue();
  1053 }
  1061 }
  1054 
  1062 
  1055 /*!
  1063 /*!
  1056     Sets message box dismiss policy. The message box gets updated next time ShowL() or UpdateL()
  1064     Sets message box dismiss policy.
  1057     is called.
       
  1058 
  1065 
  1059     \param aHbPopupDismissPolicy Dismiss policy. Values are HbPopup::DismissPolicy flags.
  1066     \param aHbPopupDismissPolicy Dismiss policy. Values are HbPopup::DismissPolicy flags.
  1060 
  1067 
  1061     \sa HbPopup::DismissPolicy, DismissPolicy()
  1068     \sa HbPopup::DismissPolicy, DismissPolicy(), ShowL(), UpdateL()
  1062 */
  1069 */
  1063 EXPORT_C void CHbDeviceMessageBoxSymbian::SetDismissPolicy(TInt aHbPopupDismissPolicy)
  1070 EXPORT_C void CHbDeviceMessageBoxSymbian::SetDismissPolicy(TInt aHbPopupDismissPolicy)
  1064 {
  1071 {
  1065     d->SetPropertyValue(CHbDeviceMessageBoxPrivate::EDismissPolicy,
  1072     d->SetPropertyValue(CHbDeviceMessageBoxPrivate::EDismissPolicy,
  1066         aHbPopupDismissPolicy);
  1073         aHbPopupDismissPolicy);
  1067 }
  1074 }
  1068 
  1075 
  1069 /*!
  1076 /*!
  1070     Returns message box dismiss policy. Returned values are HbPopup::DismissPolicy flags.
  1077     Returns message box dismiss policy. Returned values are HbPopup::DismissPolicy flags.
       
  1078     Default depends on message box type. Question box has default HbPopup::NoDismiss and
       
  1079     all other boxes HbPopup::TapAnywhere.
  1071 
  1080 
  1072     \sa HbPopup::DismissPolicy, SetDismissPolicy()
  1081     \sa HbPopup::DismissPolicy, SetDismissPolicy()
  1073 */
  1082 */
  1074 EXPORT_C TInt CHbDeviceMessageBoxSymbian::DismissPolicy() const
  1083 EXPORT_C TInt CHbDeviceMessageBoxSymbian::DismissPolicy() const
  1075 {
  1084 {
  1076     return d->mProperties[CHbDeviceMessageBoxPrivate::EDismissPolicy].IntValue();
  1085     return d->mProperties[CHbDeviceMessageBoxPrivate::EDismissPolicy].IntValue();
  1077 }
  1086 }
  1078 
  1087 
  1079 /*!
  1088 /*!
  1080     Sets message box button text. The message box gets updated next time ShowL() or UpdateL()
  1089     Sets message box button text.
  1081     is called.
       
  1082 
  1090 
  1083     \param aButton Selects the button.
  1091     \param aButton Selects the button.
  1084     \param aText Button text.
  1092     \param aText Button text.
  1085 
  1093 
  1086     \sa ButtonText()
  1094     \sa ButtonText(), SetButton(), ShowL(), UpdateL()
  1087 */
  1095 */
  1088 EXPORT_C void CHbDeviceMessageBoxSymbian::SetButtonTextL(TButtonId aButton, const TDesC& aText)
  1096 EXPORT_C void CHbDeviceMessageBoxSymbian::SetButtonTextL(TButtonId aButton, const TDesC& aText)
  1089 {
  1097 {
  1090     d->SetButtonTextL(aButton, aText);
  1098     d->SetButtonTextL(aButton, aText);
  1091 }
  1099 }
  1092 
  1100 
  1093 /*!
  1101 /*!
  1094     Returns message box button text.
  1102     Returns message box button text. Question message box by default has "Yes" and "No" buttons.
       
  1103     Other message boxes have a single "Ok" button.
  1095 
  1104 
  1096     \param aButton Selects the button.
  1105     \param aButton Selects the button.
  1097 
  1106 
  1098     \sa SetButtonTextL()
  1107     \sa SetButtonTextL()
  1099 */
  1108 */
  1104             CHbDeviceMessageBoxPrivate::EAcceptText, aButton);
  1113             CHbDeviceMessageBoxPrivate::EAcceptText, aButton);
  1105     return d->mProperties[id].StringValue();
  1114     return d->mProperties[id].StringValue();
  1106 }
  1115 }
  1107 
  1116 
  1108 /*!
  1117 /*!
  1109     Sets message box button presence. The message box gets updated next time ShowL() or UpdateL()
  1118     Sets message box button presence.
  1110     is called.
       
  1111 
  1119 
  1112     \param aButton Selects the button.
  1120     \param aButton Selects the button.
  1113     \param aEnable True enables (makes visible) message box button.
  1121     \param aEnable True enables (makes visible) message box button.
  1114 
  1122 
  1115     \sa HasButton()
  1123     \sa HasButton(), SetButtonTextL(), ShowL(), UpdateL()
  1116 */
  1124 */
  1117 EXPORT_C void CHbDeviceMessageBoxSymbian::SetButton(TButtonId aButton, TBool aEnable)
  1125 EXPORT_C void CHbDeviceMessageBoxSymbian::SetButton(TButtonId aButton, TBool aEnable)
  1118 {
  1126 {
  1119     d->SetButtonNull(aButton, !aEnable);
  1127     d->SetButtonNull(aButton, !aEnable);
  1120 }
  1128 }
  1121 
  1129 
  1122 /*!
  1130 /*!
  1123     Returns message box button presence.
  1131     Returns message box button presence. Question message box by default has accept and reject
       
  1132     buttons. Other message boxes have a single accept button.
  1124 
  1133 
  1125     \param aButton Selects the button.
  1134     \param aButton Selects the button.
  1126 
  1135 
  1127     \sa SetButton()
  1136     \sa SetButton(), ButtonText()
  1128 */
  1137 */
  1129 EXPORT_C TBool CHbDeviceMessageBoxSymbian::HasButton(TButtonId aButton) const
  1138 EXPORT_C TBool CHbDeviceMessageBoxSymbian::HasButton(TButtonId aButton) const
  1130 {
  1139 {
  1131     CHbDeviceMessageBoxPrivate::TPropertyId id =
  1140     CHbDeviceMessageBoxPrivate::TPropertyId id =
  1132         CHbDeviceMessageBoxPrivate::ButtonPropertyId(
  1141         CHbDeviceMessageBoxPrivate::ButtonPropertyId(
  1135 }
  1144 }
  1136 
  1145 
  1137 /*!
  1146 /*!
  1138     Sets message box buttons to standard buttons.
  1147     Sets message box buttons to standard buttons.
  1139 
  1148 
  1140     \param aButtons Message box buttons. A combination of flags,
  1149     \param aButtons Message box buttons. A combination of flags, eg.
  1141     eg. HbMessageBox::Yes | HbMessageBox::No. Button flags are scanned starting from lsb.
  1150     HbMessageBox::Yes | HbMessageBox::No.
  1142     First button found goes to accept position and so forth.
  1151     Button flags are scanned starting from lsb. First button found goes to accept position
  1143 
  1152     and so forth.
  1144     \sa StandardButtons()
  1153 
       
  1154     \sa HbMessageBox::StandardButton, StandardButtons(), ShowL(), UpdateL()
  1145 */
  1155 */
  1146 EXPORT_C void CHbDeviceMessageBoxSymbian::SetStandardButtons(TUint aButtons)
  1156 EXPORT_C void CHbDeviceMessageBoxSymbian::SetStandardButtons(TUint aButtons)
  1147 {
  1157 {
  1148     return d->SetStandardButtons(aButtons);
  1158     return d->SetStandardButtons(aButtons);
  1149 }
  1159 }
  1150 
  1160 
  1151 /*!
  1161 /*!
  1152     Returns standard buttons set to a message box. A default value for question message box is
  1162     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
  1163     HbMessageBox::Yes | HbMessageBox::No. For all other message box types the default is
  1154     HbMessageBox::Ok.
  1164     HbMessageBox::Ok.
  1155 
  1165 
  1156     \sa SetStandardButtons()
  1166     \sa HbMessageBox::StandardButton, SetStandardButtons()
  1157 */
  1167 */
  1158 EXPORT_C TUint CHbDeviceMessageBoxSymbian::StandardButtons() const
  1168 EXPORT_C TUint CHbDeviceMessageBoxSymbian::StandardButtons() const
  1159 {
  1169 {
  1160     return d->mProperties[CHbDeviceMessageBoxPrivate::EStandardButtons].IntValue();
  1170     return d->mProperties[CHbDeviceMessageBoxPrivate::EStandardButtons].IntValue();
  1161 }
  1171 }