src/hbwidgets/devicedialogs/hbdeviceprogressdialogsymbian.cpp
changeset 34 ed14f46c0e55
parent 5 627c4a0fd0e7
equal deleted inserted replaced
31:7516d6d86cf5 34:ed14f46c0e55
    36 _LIT(KDialogText, "text");
    36 _LIT(KDialogText, "text");
    37 _LIT(KDialogIconName, "iconName");
    37 _LIT(KDialogIconName, "iconName");
    38 _LIT(KCancelAction, "cancelAction");
    38 _LIT(KCancelAction, "cancelAction");
    39 _LIT(KPluginIdentifier, "com.nokia.hb.deviceprogressdialog/1.0");
    39 _LIT(KPluginIdentifier, "com.nokia.hb.deviceprogressdialog/1.0");
    40 _LIT(KAnimationDefinition, "animationDefinition");
    40 _LIT(KAnimationDefinition, "animationDefinition");
       
    41 _LIT(KShowLevel, "showLevel");
    41 
    42 
    42 NONSHARABLE_CLASS(CHbDeviceProgressDialogSymbianPrivate) : public CBase,
    43 NONSHARABLE_CLASS(CHbDeviceProgressDialogSymbianPrivate) : public CBase,
    43                                                            public MHbDeviceDialogObserver
    44                                                            public MHbDeviceDialogObserver
    44 {
    45 {
    45 public:
    46 public:
    78     TInt iType;
    79     TInt iType;
    79     TInt iProgressValue;
    80     TInt iProgressValue;
    80     RBuf iText;
    81     RBuf iText;
    81     RBuf iIconName;
    82     RBuf iIconName;
    82     RBuf iAnimationDefinition;
    83     RBuf iAnimationDefinition;
       
    84     TInt iShowLevel;
    83     struct {
    85     struct {
    84         RBuf iText;
    86         RBuf iText;
    85         struct {
    87         struct {
    86             bool iTextValid:1; // property value has has been set
    88             bool iTextValid:1; // property value has has been set
    87             bool iTextModified:1; // property has been modified
    89             bool iTextModified:1; // property has been modified
   132     AddVariantL(KDialogType, &iType, CHbSymbianVariant::EInt, iVariantMap);
   134     AddVariantL(KDialogType, &iType, CHbSymbianVariant::EInt, iVariantMap);
   133     AddVariantL(KDialogMaximum, &iMaximum, CHbSymbianVariant::EInt, iVariantMap);
   135     AddVariantL(KDialogMaximum, &iMaximum, CHbSymbianVariant::EInt, iVariantMap);
   134     AddVariantL(KDialogMinimum, &iMinimum, CHbSymbianVariant::EInt, iVariantMap);
   136     AddVariantL(KDialogMinimum, &iMinimum, CHbSymbianVariant::EInt, iVariantMap);
   135     AddVariantL(KDialogAutoClose, &iAutoClose, CHbSymbianVariant::EBool, iVariantMap);
   137     AddVariantL(KDialogAutoClose, &iAutoClose, CHbSymbianVariant::EBool, iVariantMap);
   136     AddVariantL(KDialogValue, &iProgressValue, CHbSymbianVariant::EInt, iVariantMap);
   138     AddVariantL(KDialogValue, &iProgressValue, CHbSymbianVariant::EInt, iVariantMap);
       
   139     if (iShowLevel) { // send only if non-default
       
   140         AddVariantL(KShowLevel, &iShowLevel, CHbSymbianVariant::EInt, iVariantMap);
       
   141     }
   137 
   142 
   138     if (iText.Length() > 0)
   143     if (iText.Length() > 0)
   139         {
   144         {
   140         AddVariantL(KDialogText, &iText, CHbSymbianVariant::EDes, iVariantMap);
   145         AddVariantL(KDialogText, &iText, CHbSymbianVariant::EDes, iVariantMap);
   141         }
   146         }
   169     }
   174     }
   170 
   175 
   171 void CHbDeviceProgressDialogSymbianPrivate::UpdateL()
   176 void CHbDeviceProgressDialogSymbianPrivate::UpdateL()
   172     {
   177     {
   173     CHbSymbianVariantMap* map = CHbSymbianVariantMap::NewL();
   178     CHbSymbianVariantMap* map = CHbSymbianVariantMap::NewL();
       
   179     CleanupStack::PushL(map);
   174 
   180 
   175     const CHbSymbianVariant* variant = Variant(KDialogMaximum);
   181     const CHbSymbianVariant* variant = Variant(KDialogMaximum);
   176     if (variant && *variant->Value<TInt>() != iMaximum)
   182     if (variant && *variant->Value<TInt>() != iMaximum)
   177         {
   183         {
   178         AddVariantL(KDialogMaximum, &iMaximum, CHbSymbianVariant::EInt, iVariantMap);
   184         AddVariantL(KDialogMaximum, &iMaximum, CHbSymbianVariant::EInt, iVariantMap);
   236         AddVariantL(KCancelAction, actionData, CHbSymbianVariant::EDes, iVariantMap);
   242         AddVariantL(KCancelAction, actionData, CHbSymbianVariant::EDes, iVariantMap);
   237         CleanupStack::PopAndDestroy(); // actionData
   243         CleanupStack::PopAndDestroy(); // actionData
   238         }
   244         }
   239 
   245 
   240     TInt error = iDeviceDialog->Update(*map);
   246     TInt error = iDeviceDialog->Update(*map);
   241     delete map; map = 0;
   247     CleanupStack::PopAndDestroy(map);
       
   248     map = 0;
   242     if (error != KErrNone) {
   249     if (error != KErrNone) {
   243         User::Leave(error); // error can be positive or negative
   250         User::Leave(error); // error can be positive or negative
   244     }
   251     }
   245     }
   252     }
   246 
   253 
   315         }
   322         }
   316     CleanupStack::PushL(actionData);
   323     CleanupStack::PushL(actionData);
   317     return actionData;
   324     return actionData;
   318 }
   325 }
   319 
   326 
       
   327 // Set dialog show level
       
   328 void SetShowLevel(CHbDeviceProgressDialogSymbianPrivate *aDialog, TInt aLevel)
       
   329 {
       
   330     aDialog->iShowLevel = aLevel;
       
   331 }
       
   332 
   320 /*!
   333 /*!
   321     \class MHbDeviceProgressDialogObserver
   334     \class MHbDeviceProgressDialogObserver
   322     \brief MHbDeviceProgressDialogObserver is an observer interface for observing CHbDeviceProgressDialogSymbian.
   335     \brief MHbDeviceProgressDialogObserver is an observer interface for CHbDeviceProgressDialogSymbian.
       
   336 
       
   337     \sa CHbDeviceProgressDialogSymbian
   323 */
   338 */
   324 
   339 
   325 /*!
   340 /*!
   326     \fn void MHbDeviceProgressDialogObserver::ProgressDialogCancelled(const CHbDeviceProgressDialogSymbian* aDialog) = 0
   341     \fn void MHbDeviceProgressDialogObserver::ProgressDialogCancelled(const CHbDeviceProgressDialogSymbian* aDialog) = 0
   327 
   342 
   328     This callback is called when the device progress dialog is closed by user pressing the "cancel" button.
   343     This callback is called when the device progress dialog is closed by user pressing the "cancel" button.
   329 
   344 
   330     \a aDialog - Pointer to dialog that was cancelled.
   345     \param aDialog Pointer to dialog that was cancelled.
   331 */
   346 */
   332 
   347 
   333 /*!
   348 /*!
   334    \fn void MHbDeviceProgressDialogObserver::ProgressDialogClosed(const CHbDeviceProgressDialogSymbian* aDialog) = 0
   349    \fn void MHbDeviceProgressDialogObserver::ProgressDialogClosed(const CHbDeviceProgressDialogSymbian* aDialog) = 0
   335 
   350 
   336     This callback is called when a device progress dialog is has closed. The closing may
   351     This callback is called when a device progress dialog is has closed. The closing may
   337     be a result of Close() being called, a dialog with autoClose property has reached
   352     be a result of Close() being called, a auto-closing dialog has reached
   338     its maximum value or user pressing cancel button. It is not called if Close() is
   353     its maximum value or user pressing cancel button. It is not called if Close() is
   339     called before ShowL().
   354     called before ShowL().
   340 
   355 
   341     \a aDialog - Pointer to dialog instance that has closed.
   356     \param aDialog Pointer to dialog instance that has closed.
   342 */
   357 */
   343 
   358 
   344 /*!
   359 /*!
       
   360     \stable
       
   361     \hbwidgets
       
   362 
   345     \class CHbDeviceProgressDialogSymbian
   363     \class CHbDeviceProgressDialogSymbian
   346     \brief CHbDeviceProgressDialogSymbian is a Symbian implementation of HbDeviceProgressDialog.
   364     \brief CHbDeviceProgressDialogSymbian is a Symbian implementation of HbDeviceProgressDialog.
   347 
   365 
   348     It is a client interface for s60 native application to notify user with a text message, icon
   366     <b>This class is Symbian only. Not available on other platforms.</b>
   349     and progress bar, when HbDeviceProgressDialog can not be used.
   367 
   350 
   368     CHbDeviceProgressDialogSymbian is intended for use by servers that don't run Qt event loop
   351     CHbDeviceProgressDialogSymbian provides similar interface and functionality as HbDeviceProgressDialog.
   369     and cannot use HbDeviceProgressDialog.
   352     Main difference is that signals are replaced by observer interface. Also the parameters of methods using Qt enumerations are changed to TInt.
   370 
   353 
   371     Device progress dialog is a modal dialog. It is shown on top of applications by device dialog
   354     Two progress dialog types are supported: wait and progress dialog.
   372     server. CHbDeviceProgressDialogSymbian is a client of the server.
   355 
   373 
   356     Wait dialog can be used when the progress of operation cannot be determined.
   374     To learn more about usage of device progress dialogs see HbDeviceProgressDialog
   357     As the delay is unknown, the waiting progress bar will be shown until either a user
   375     documentation.
   358     cancels the dialog by pressing the "cancel" button or the application showing the device
   376 
   359     wait dialog closes the dialog after the operation has finished or in case of timeout.
   377     CHbDeviceProgressDialogSymbian provides similar interface and functionality as
   360 
   378     HbDeviceProgressDialog. Main difference is that signals are replaced by observer
   361     Progress dialog can be used when the progress of operation is known. For example
   379     interface MHbDeviceProgressDialogObserver. Also parameters of methods using
   362     when deleting a number of files, the progress of the operation could be shown as a
   380     Qt enumerations are changed to TInt.
   363     percentage of the files deleted. Application sets the progress value during the
   381 
   364     operation and the dialog will be shown until either a user cancels the dialog by pressing
   382     Showing of a progress dialog is always asynchronous as an application needs to update the dialog
   365     the "cancel" button or the application showing the device progress dialog closes the
   383     according to current progress.
   366     dialog after the operation is finished or in case of error.
   384 
   367 
   385     ShowL() displays a progress dialog asynchronously. The function returns immediately.
   368     Progress dialogs are always asynchronous by nature as the client is responsible of updating the dialog
   386     A new dialog is lauched every time ShowL() is called. The launched
   369     according to current progress status.
   387     dialog can be updated by setters and then calling UpdateL(). Closing and cancellation
   370 
   388     can be observed by a callbacks. Because each UpdateL() after the ShowL() requires
   371     The device dialog is only shown when ShowL() is called. Because each dialog update requires
   389     interprocess communication, it's advisable to fully construct the dialog before displaying it.
   372     IPC calls to be made, it's advisable to fully construct the device dialog before calling
   390 
   373     ShowL() or UpdateL().
   391     Below is an example of using a device wait dialog:
   374 
       
   375     Here is an example of using the infinite wait note:
       
   376 
   392 
   377     \code
   393     \code
   378     _LIT(KConnectText, "Connecting...");
   394     _LIT(KConnectText, "Connecting...");
   379     CHbDeviceProgressDialogSymbian *iDialog = CHbDeviceProgressDialogSymbian::NewL(CHbDeviceProgressDialogSymbian::EWaitDialog);
   395     CHbDeviceProgressDialogSymbian *iDialog = CHbDeviceProgressDialogSymbian::NewL(CHbDeviceProgressDialogSymbian::EWaitDialog);
   380     iDialog->SetTextL(KConnectText);
   396     iDialog->SetTextL(KConnectText);
   381     iDialog->ShowL();
   397     iDialog->ShowL();
   382     \endcode
   398     \endcode
   383 
   399 
   384     Below is an example of using the device progress dialog:
   400     Below is an example of using a device progress dialog:
   385 
   401 
   386     \code
   402     \code
   387     CHbDeviceProgressDialogSymbian* iDialog = CHbDeviceProgressDialogSymbian::NewL();
   403     CHbDeviceProgressDialogSymbian* iDialog = CHbDeviceProgressDialogSymbian::NewL();
   388     _LIT(KUpdatingText, "Updating...");
   404     _LIT(KUpdatingText, "Updating...");
   389     iDialog->SetTextL(KUpdatingText);
   405     iDialog->SetTextL(KUpdatingText);
   393     iDialog->SetMaximum(76);
   409     iDialog->SetMaximum(76);
   394     iDialog->SetProgressValue(25);
   410     iDialog->SetProgressValue(25);
   395     iDialog->UpdateL();
   411     iDialog->UpdateL();
   396     \endcode
   412     \endcode
   397 
   413 
   398     CHbDeviceProgressDialogSymbian supports animations.
   414     An example of showing an icon animation:
   399     Supported formats are the following:
   415 
   400 
   416     \code
   401     - GIF (.gif)
   417     Create an animation definition file.
   402     - MNG (.mng)
   418 
   403 	- Frame animations
   419     <animations>
   404 
   420         <icon name="frame_anim_looping" playmode="loop">
   405 	There is a built-in support for GIF and MNG animations.
   421             <frame duration="100">c:\icon1.svg</frame>
   406 
   422             <frame duration="200">c:\icon2.svg</frame>
   407 	Frame animations can be created by following way:
   423             <frame duration="300">c:\icon3.svg</frame>
   408 
   424         </icon>
   409 	\code
   425     </animations>
   410 	Create an animation definition file.
   426 
   411 
   427     Create CHbDeviceProgressDialogSymbian in a way described before and
   412 	<animations>
   428     set definition file and animation's logical name.
   413 		<icon name="frame_anim_looping" playmode="loop">
   429 
   414 			<frame duration="100">c:\icon1.svg</frame>
   430     _LIT(KAnimationDefinitionXML, "C:\animation.axml");
   415 			<frame duration="200">c:\icon2.svg</frame>
   431     _LITK(KLogicalIconName, "frame_anim_looping");
   416 			<frame duration="300">c:\icon3.svg</frame>
   432 
   417 		</icon>
   433     iDialog->SetAnimationDefinitionL(KAnimationDefinitionXML);
   418 	</animations>
   434     iDialog->SetIconNameL(KIconName);
   419 
   435     iDialog->ShowL();
   420 	Create CHbDeviceProgressDialogSymbian in a way described before and
   436     \endcode
   421 	set definition file and animation's logical name.
   437 
   422 
   438     \sa MHbDeviceProgressDialogObserver, HbDeviceProgressDialog, HbDeviceDialog
   423 	_LIT(KAnimationDefinitionXML, "C:\animation.axml");
       
   424 	_LITK(KLogicalIconName, "frame_anim_looping");
       
   425 
       
   426 	iDialog->SetAnimationDefinitionL(KAnimationDefinitionXML);
       
   427 	iDialog->SetIconNameL(KIconName);
       
   428 	iDialog->ShowL();
       
   429 	\endcode
       
   430 	\sa HbIconAnimationManager::addDefinitionFile
       
   431 	\note Animation definition files must be stored to a place where they
       
   432 	can be accessed.
       
   433 
       
   434     \sa HbDeviceProgressDialog, HbDeviceDialog
       
   435     \stable
       
   436     \hbwidgets
       
   437 */
   439 */
   438 /*!
   440 /*!
   439     \enum CHbDeviceProgressDialogSymbian::TType
   441     \enum CHbDeviceProgressDialogSymbian::TType
   440     Progress dialog types.
   442     Progress dialog types.
       
   443 
       
   444     \sa HbProgressDialog::ProgressDialogType
   441 */
   445 */
   442 /*!
   446 /*!
   443     \var CHbDeviceProgressDialogSymbian::TType CHbDeviceProgressDialogSymbian::EProgressDialog
   447     \var CHbDeviceProgressDialogSymbian::TType CHbDeviceProgressDialogSymbian::EProgressDialog
   444     Progress dialog.
   448     Progress dialog.
   445 */
   449 */
   447     \var CHbDeviceProgressDialogSymbian::TType CHbDeviceProgressDialogSymbian::EWaitDialog
   451     \var CHbDeviceProgressDialogSymbian::TType CHbDeviceProgressDialogSymbian::EWaitDialog
   448     Wait dialog.
   452     Wait dialog.
   449 */
   453 */
   450 
   454 
   451 /*!
   455 /*!
   452     Symbian two phase constructor. Returns a pointer to CHbDeviceNotificationDialogSymbian instance.
   456     Constructs a new CHbDeviceNotificationDialogSymbian and returns a pointer it. 
       
   457 
   453     \param aType Must be one of the defined CHbDeviceProgressDialogSymbian::TType enumerations.
   458     \param aType Must be one of the defined CHbDeviceProgressDialogSymbian::TType enumerations.
   454     \param aObserver Pointer to observer.
       
   455 
       
   456     Default value is CHbDeviceProgressDialogSymbian::EProgressDialog.
   459     Default value is CHbDeviceProgressDialogSymbian::EProgressDialog.
       
   460     \param aObserver Pointer to event observer. 0 if no observer.
   457 */
   461 */
   458 EXPORT_C CHbDeviceProgressDialogSymbian* CHbDeviceProgressDialogSymbian::NewL(
   462 EXPORT_C CHbDeviceProgressDialogSymbian* CHbDeviceProgressDialogSymbian::NewL(
   459     TType aType,
   463     TType aType,
   460     MHbDeviceProgressDialogObserver* aObserver)
   464     MHbDeviceProgressDialogObserver* aObserver)
   461     {
   465     {
   466     CleanupStack::Pop(self);
   470     CleanupStack::Pop(self);
   467     return self;
   471     return self;
   468     }
   472     }
   469 
   473 
   470 /*!
   474 /*!
   471     Destructs the class.
   475     Destructs CHbDeviceProgressDialogSymbian. Closes also the dialog widget launched by
       
   476     ShowL().
   472 */
   477 */
   473 EXPORT_C CHbDeviceProgressDialogSymbian::~CHbDeviceProgressDialogSymbian()
   478 EXPORT_C CHbDeviceProgressDialogSymbian::~CHbDeviceProgressDialogSymbian()
   474     {
   479     {
   475     delete d;
   480     delete d;
   476     }
   481     }
   477 
   482 
   478 /*!
   483 /*!
   479     Executes the dialog asynchronously.
   484     Shows a device progress dialog asyncronously. Function launches the dialog and returns
       
   485     immediately. Closing of the dialog can be observer with MHbDeviceProgressDialogObserver.
       
   486     CHbDeviceProgressDialogSymbian object can be used to launch several dialogs. A new one
       
   487     is launched every time ShowL() is called. Observer receives events for the latest dialog
       
   488     launched.
       
   489 
       
   490     \sa SetObserver(), UpdateL()
   480 */
   491 */
   481 EXPORT_C void CHbDeviceProgressDialogSymbian::ShowL()
   492 EXPORT_C void CHbDeviceProgressDialogSymbian::ShowL()
   482     {
   493     {
   483     d->ShowL();
   494     d->ShowL();
   484     }
   495     }
   485 
   496 
   486 /*!
   497 /*!
   487     Updates the dialog asynchronously.
   498     Updates a device progress dialog asyncronously. Dialog that was launched with a lates ShowL()
       
   499     is updated. Properties that were modified since the last ShowL() or UpdateL() are sent to
       
   500     device dialog server.
       
   501 
       
   502     \sa ShowL()
   488 */
   503 */
   489 EXPORT_C void CHbDeviceProgressDialogSymbian::UpdateL()
   504 EXPORT_C void CHbDeviceProgressDialogSymbian::UpdateL()
   490     {
   505     {
   491     d->UpdateL();
   506     d->UpdateL();
   492     }
   507     }
   493 
   508 
   494 /*!
   509 /*!
   495     Closes the dialog.
   510     Closes a device progress dialog.
   496 */
   511 */
   497 EXPORT_C void CHbDeviceProgressDialogSymbian::Close()
   512 EXPORT_C void CHbDeviceProgressDialogSymbian::Close()
   498     {
   513     {
   499     d->Close();
   514     d->Close();
   500     }
   515     }
   501 
   516 
   502 /*!
   517 /*!
   503     Sets the minimum and maximum value of the progress bar within the dialog.
   518     Sets progress bar minimum and maximum values.
   504     \param aMin minimum value of the progress bar.
   519 
   505     \param aMax maximum value of the progress bar.
   520     \param aMin Progress bar minimum value.
   506 
   521     \param aMax Progress bar maximum value.
   507     \sa Minimum(), Maximum()
   522 
       
   523     \sa Minimum(), Maximum(), ShowL(), UpdateL()
   508 */
   524 */
   509 EXPORT_C void CHbDeviceProgressDialogSymbian::SetRange(TInt aMin, TInt aMax)
   525 EXPORT_C void CHbDeviceProgressDialogSymbian::SetRange(TInt aMin, TInt aMax)
   510     {
   526     {
   511     SetMinimum(aMin);
   527     SetMinimum(aMin);
   512     SetMaximum(aMax);
   528     SetMaximum(aMax);
   513     }
   529     }
   514 
   530 
   515 /*!
   531 /*!
   516     Sets the maximum value of the progress bar within the dialog.
   532     Sets progress bar maximum value.
   517     \param aMax maximum value of the progress bar.
   533 
   518     \sa Maximum()
   534     \param aMax Progress bar maximum value.
       
   535 
       
   536     \sa Maximum(), ShowL(), UpdateL()
   519 */
   537 */
   520 EXPORT_C void CHbDeviceProgressDialogSymbian::SetMaximum(TInt aMax)
   538 EXPORT_C void CHbDeviceProgressDialogSymbian::SetMaximum(TInt aMax)
   521     {
   539     {
   522     // Don't allow wait dialog to set max/min other than zero as wait
   540     // Don't allow wait dialog to set max/min other than zero as wait
   523     // animation bar doesn't work in that case.
   541     // animation bar doesn't work in that case.
   524     d->iMaximum = d->iType == EWaitDialog ? 0 : aMax;
   542     d->iMaximum = d->iType == EWaitDialog ? 0 : aMax;
   525     }
   543     }
   526 
   544 
   527 /*!
   545 /*!
   528     Returns the maximum value of the progress bar within the dialog.
   546     Returns progress bar maximum value. Default value is 100.
   529 
   547 
   530     The default value is 100.
       
   531     \sa SetMaximum()
   548     \sa SetMaximum()
   532 */
   549 */
   533 EXPORT_C TInt CHbDeviceProgressDialogSymbian::Maximum() const
   550 EXPORT_C TInt CHbDeviceProgressDialogSymbian::Maximum() const
   534     {
   551     {
   535     return d->iMaximum;
   552     return d->iMaximum;
   536     }
   553     }
   537 
   554 
   538 /*!
   555 /*!
   539     Sets the minimum value of the progress bar within the dialog.
   556     Sets progress bar minimum value.
   540     \param aMin minimum value of the progress bar.
   557 
   541     \sa Minimum()
   558     \param aMin Progress bar minimum value.
       
   559 
       
   560     \sa Minimum(), ShowL(), UpdateL()
   542 */
   561 */
   543 EXPORT_C void CHbDeviceProgressDialogSymbian::SetMinimum(TInt aMin)
   562 EXPORT_C void CHbDeviceProgressDialogSymbian::SetMinimum(TInt aMin)
   544     {
   563     {
   545     // Don't allow wait dialog to set max/min other than zero as wait
   564     // Don't allow wait dialog to set max/min other than zero as wait
   546     // animation bar doesn't work in that case.
   565     // animation bar doesn't work in that case.
   547     d->iMinimum = d->iType == EWaitDialog ? 0 : aMin;
   566     d->iMinimum = d->iType == EWaitDialog ? 0 : aMin;
   548     }
   567     }
   549 
   568 
   550 /*!
   569 /*!
   551     Returns the minimum value of the progress bar within the dialog.
   570     Returns progress bar minimum value. Default value is 0.
   552 
   571 
   553     The default value is 0.
       
   554     \sa SetMinimumL()
   572     \sa SetMinimumL()
   555 */
   573 */
   556 EXPORT_C TInt CHbDeviceProgressDialogSymbian::Minimum() const
   574 EXPORT_C TInt CHbDeviceProgressDialogSymbian::Minimum() const
   557     {
   575     {
   558     return d->iMinimum;
   576     return d->iMinimum;
   559     }
   577     }
   560 
   578 
   561 /*!
   579 /*!
   562     Sets the autoClose property value of the dialog.
   580     Sets dialog auto-closing.
       
   581 
   563     \param aAutoClose When set, the dialog is closed when value of the progress bar reaches
   582     \param aAutoClose When set, the dialog is closed when value of the progress bar reaches
   564     the maximum value of the progress bar.
   583     the maximum value of the progress bar.
   565     \sa AutoClose()
   584 
       
   585     \sa AutoClose(), ShowL(), UpdateL()
   566 */
   586 */
   567 EXPORT_C void CHbDeviceProgressDialogSymbian::SetAutoClose(TBool aAutoClose)
   587 EXPORT_C void CHbDeviceProgressDialogSymbian::SetAutoClose(TBool aAutoClose)
   568     {
   588     {
   569     d->iAutoClose = aAutoClose;
   589     d->iAutoClose = aAutoClose;
   570     }
   590     }
   571 
   591 
   572 /*!
   592 /*!
   573     Returns the value of the autoClose property of the dialog.
   593     Returns dialog auto-closing property. Default value is true for progress dialog and false
   574 
   594     for wait dialog.
   575     The default value is true for CHbDeviceProgressDialogSymbian::ProgressDialod and false
   595 
   576     for CHbDeviceProgressDialogSymbian::WaitDialog.
       
   577     \sa SetAutoCloseL()
   596     \sa SetAutoCloseL()
   578 */
   597 */
   579 EXPORT_C TBool CHbDeviceProgressDialogSymbian::AutoClose() const
   598 EXPORT_C TBool CHbDeviceProgressDialogSymbian::AutoClose() const
   580     {
   599     {
   581     return d->iAutoClose;
   600     return d->iAutoClose;
   582     }
   601     }
   583 
   602 
   584 /*!
   603 /*!
   585     Sets dialog type.
   604     Sets dialog type. Dialog properties are set to default values. After setting type,
   586     \param aType defines the type of the dialog.
   605     ShowL() must be called to launch a new dialog.
   587     \sa ProgressType()
   606 
       
   607     \param aType Dialog type, wait or progress,
       
   608 
       
   609     \sa ProgressType(), ShowL()
   588 */
   610 */
   589 EXPORT_C void CHbDeviceProgressDialogSymbian::SetProgressType(
   611 EXPORT_C void CHbDeviceProgressDialogSymbian::SetProgressType(
   590     CHbDeviceProgressDialogSymbian::TType aType)
   612     CHbDeviceProgressDialogSymbian::TType aType)
   591     {
   613     {
   592     d->iType = aType;
   614     d->iType = aType;
   603         }
   625         }
   604     }
   626     }
   605 
   627 
   606 /*!
   628 /*!
   607     Returns dialog's type.
   629     Returns dialog's type.
       
   630 
   608     \sa SetProgressType()
   631     \sa SetProgressType()
   609 */
   632 */
   610 EXPORT_C CHbDeviceProgressDialogSymbian::TType CHbDeviceProgressDialogSymbian::ProgressType() const
   633 EXPORT_C CHbDeviceProgressDialogSymbian::TType CHbDeviceProgressDialogSymbian::ProgressType() const
   611     {
   634     {
   612     return static_cast<TType>(d->iType);
   635     return static_cast<TType>(d->iType);
   613     }
   636     }
   614 
   637 
   615 /*!
   638 /*!
   616     Sets the value of the progress bar within the dialog.
   639     Sets progress bar value.
   617     \param aProgressValue value of the progress bar.
   640 
   618     \sa ProgressValue()
   641     \param aProgressValue Progress bar value.
       
   642 
       
   643     \sa ProgressValue(), ShowL(), UpdateL()
   619 */
   644 */
   620 EXPORT_C void CHbDeviceProgressDialogSymbian::SetProgressValue(TInt aProgressValue)
   645 EXPORT_C void CHbDeviceProgressDialogSymbian::SetProgressValue(TInt aProgressValue)
   621     {
   646     {
   622     d->iProgressValue = aProgressValue;
   647     d->iProgressValue = aProgressValue;
   623     }
   648     }
   624 
   649 
   625 /*!
   650 /*!
   626     Returns the value of the progress bar within the dialog.
   651     Returns progress bar value.
       
   652 
   627     \sa SetProgressValue()
   653     \sa SetProgressValue()
   628 */
   654 */
   629 EXPORT_C TInt CHbDeviceProgressDialogSymbian::ProgressValue() const
   655 EXPORT_C TInt CHbDeviceProgressDialogSymbian::ProgressValue() const
   630     {
   656     {
   631     return d->iProgressValue;
   657     return d->iProgressValue;
   632     }
   658     }
   633 
   659 
   634 /*!
   660 /*!
   635     Sets text of the dialog.
   661     Sets dialog text.
   636     \param aText dialog text.
   662 
   637     \sa Text()
   663     \param aText Dialog text.
       
   664 
       
   665     \sa Text(), ShowL(), UpdateL()
   638 */
   666 */
   639 EXPORT_C void CHbDeviceProgressDialogSymbian::SetTextL(const TDesC& aText)
   667 EXPORT_C void CHbDeviceProgressDialogSymbian::SetTextL(const TDesC& aText)
   640     {
   668     {
   641     TInt length = aText.Length();
   669     TInt length = aText.Length();
   642     if (length > d->iText.MaxLength())
   670     if (length > d->iText.MaxLength())
   645         }
   673         }
   646     d->iText.Copy(aText);
   674     d->iText.Copy(aText);
   647     }
   675     }
   648 
   676 
   649 /*!
   677 /*!
   650     Returns text of the note.
   678     Returns dialog text.
       
   679 
   651     \sa SetTextL()
   680     \sa SetTextL()
   652 */
   681 */
   653 EXPORT_C const TPtrC CHbDeviceProgressDialogSymbian::Text() const
   682 EXPORT_C const TPtrC CHbDeviceProgressDialogSymbian::Text() const
   654     {
   683     {
   655     return d->iText;
   684     return d->iText;
   656     }
   685     }
   657 
   686 
   658 /*!
   687 /*!
   659     Sets message box icon name or animation logical name. The message box gets updated next time ShowL() or UpdateL()
   688     Sets dialog icon name or animation logical name.
   660     is called.
   689 
   661 
   690     \param aIconName Icon or animation name. Icon can be from Hb resources or themes. Or it can be a file in
   662     \param aIconName Icon name. Icon can be from Hb resources or themes. Or it can be a file in
       
   663     a file system.
   691     a file system.
   664 
   692 
   665     \sa IconName()
   693     \sa IconName(), ShowL(), UpdateL()
   666 */
   694 */
   667 EXPORT_C void CHbDeviceProgressDialogSymbian::SetIconNameL(const TDesC& aIconName)
   695 EXPORT_C void CHbDeviceProgressDialogSymbian::SetIconNameL(const TDesC& aIconName)
   668     {
   696     {
   669     TInt length = aIconName.Length();
   697     TInt length = aIconName.Length();
   670     if (length > d->iIconName.MaxLength())
   698     if (length > d->iIconName.MaxLength())
   673         }
   701         }
   674     d->iIconName.Copy(aIconName);
   702     d->iIconName.Copy(aIconName);
   675     }
   703     }
   676 
   704 
   677 /*!
   705 /*!
   678     Returns name and path of the icon shown on dialog or animation's logical name.
   706     Returns name and path of icon or animation.
   679 
   707 
   680     \sa SetIconNameL()
   708     \sa SetIconNameL()
   681 */
   709 */
   682 EXPORT_C const TPtrC CHbDeviceProgressDialogSymbian::IconName() const
   710 EXPORT_C const TPtrC CHbDeviceProgressDialogSymbian::IconName() const
   683     {
   711     {
   684     return d->iIconName;
   712     return d->iIconName;
   685     }
   713     }
   686 
   714 
   687 /*!
   715 /*!
   688     Sets notification dialog's animation definition name.  The dialogs get updated next when time ShowL() or UpdateL()
   716     Sets dialog animation definition name.
   689     is called.
   717 
       
   718     Supported icon animation formats are following:
       
   719     - GIF (.gif)
       
   720     - MNG (.mng)
       
   721     - Frame animations
   690 
   722 
   691     \param aAnimationDefinition Animation definition file name. Definition can be from Hb resources or themes.
   723     \param aAnimationDefinition Animation definition file name. Definition can be from Hb resources or themes.
   692     Or can be a file in a file system.
   724     Or can be a file in a file system. The definition must be stored to a place where it can be accessed by
   693 
   725     device dialog service.
   694     \sa AnimationDefinition()
   726 
       
   727     \sa AnimationDefinition() SetIconNameL() HbIconAnimationManager::addDefinitionFile(), ShowL(), UpdateL()
   695 */
   728 */
   696 EXPORT_C void CHbDeviceProgressDialogSymbian::SetAnimationDefinitionL(const TDesC& aAnimationDefinition)
   729 EXPORT_C void CHbDeviceProgressDialogSymbian::SetAnimationDefinitionL(const TDesC& aAnimationDefinition)
   697     {
   730     {
   698     TInt length = aAnimationDefinition.Length();
   731     TInt length = aAnimationDefinition.Length();
   699     if (length > d->iAnimationDefinition.MaxLength())
   732     if (length > d->iAnimationDefinition.MaxLength())
   702         }
   735         }
   703     d->iAnimationDefinition.Copy(aAnimationDefinition);
   736     d->iAnimationDefinition.Copy(aAnimationDefinition);
   704     }
   737     }
   705 
   738 
   706 /*!
   739 /*!
   707     Returns an animation definition set for a dialog. If not set, return string.
   740     Returns dialog icon animation definition name.
   708 
   741 
   709     \sa SetAnimationDefinitionL()
   742     \sa SetAnimationDefinitionL()
   710 */
   743 */
   711 EXPORT_C TPtrC CHbDeviceProgressDialogSymbian::AnimationDefinition() const
   744 EXPORT_C TPtrC CHbDeviceProgressDialogSymbian::AnimationDefinition() const
   712 	{
   745     {
   713 	return d->iAnimationDefinition;
   746     return d->iAnimationDefinition;
   714 	}
   747     }
   715 
   748 
   716 /*!
   749 /*!
   717     Sets progress dialog box button text. The dialog gets updated next time ShowL() or UpdateL()
   750     Sets dialog button text.
   718     is called.
       
   719 
   751 
   720     \param aText Button text.
   752     \param aText Button text.
   721 
   753 
   722     \sa ButtonText()
   754     \sa ButtonText(), ShowL(), UpdateL()
   723 */
   755 */
   724 EXPORT_C void CHbDeviceProgressDialogSymbian::SetButtonTextL(const TDesC& aText)
   756 EXPORT_C void CHbDeviceProgressDialogSymbian::SetButtonTextL(const TDesC& aText)
   725 {
   757 {
   726     TInt length = aText.Length();
   758     TInt length = aText.Length();
   727     if (length > d->iButton.iText.MaxLength()) {
   759     if (length > d->iButton.iText.MaxLength()) {
   731     d->iButton.iFlags.iTextValid = true;
   763     d->iButton.iFlags.iTextValid = true;
   732     d->iButton.iFlags.iTextModified = true;
   764     d->iButton.iFlags.iTextModified = true;
   733 }
   765 }
   734 
   766 
   735 /*!
   767 /*!
   736     Returns progress dialog button text.
   768     Returns dialog button text.
   737 
   769 
   738     \sa SetButtonTextL()
   770     \sa SetButtonTextL()
   739 */
   771 */
   740 EXPORT_C const TPtrC CHbDeviceProgressDialogSymbian::ButtonText() const
   772 EXPORT_C const TPtrC CHbDeviceProgressDialogSymbian::ButtonText() const
   741 {
   773 {
   742     return d->iButton.iText;
   774     return d->iButton.iText;
   743 }
   775 }
   744 
   776 
   745 /*!
   777 /*!
   746     Sets progress dialog button presence. The dialog updated next time ShowL() or UpdateL()
   778     Sets progress dialog button presence.
   747     is called.
       
   748 
   779 
   749     \param aEnable True enables (makes visible) the dialog button.
   780     \param aEnable True enables (makes visible) the dialog button.
   750 
   781 
   751     \sa HasButton()
   782     \sa HasButton(), ShowL(), UpdateL()
   752 */
   783 */
   753 EXPORT_C void CHbDeviceProgressDialogSymbian::SetButton(TBool aEnable)
   784 EXPORT_C void CHbDeviceProgressDialogSymbian::SetButton(TBool aEnable)
   754 {
   785 {
   755     d->iButton.iFlags.iIsNull = !aEnable;
   786     d->iButton.iFlags.iIsNull = !aEnable;
   756     d->iButton.iFlags.iIsNullValid = true;
   787     d->iButton.iFlags.iIsNullValid = true;
   757     d->iButton.iFlags.iIsNullModified = true;
   788     d->iButton.iFlags.iIsNullModified = true;
   758 }
   789 }
   759 
   790 
   760 /*!
   791 /*!
   761     Returns progress dialog button presence.
   792     Returns dialog button presence.
   762 
       
   763     \param aButton Selects the button.
       
   764 
   793 
   765     \sa SetButton()
   794     \sa SetButton()
   766 */
   795 */
   767 EXPORT_C TBool CHbDeviceProgressDialogSymbian::HasButton() const
   796 EXPORT_C TBool CHbDeviceProgressDialogSymbian::HasButton() const
   768 {
   797 {
   769     return !d->iButton.iFlags.iIsNull;
   798     return !d->iButton.iFlags.iIsNull;
   770 }
   799 }
   771 
   800 
   772 /*!
   801 /*!
   773     Sets progress dialog observer. The observer is called when progress dialog is closed.
   802     Sets dialog observer. The observer is called when the dialog is closed or cancelled.
       
   803 
   774     \param aObserver Pointer to observer.
   804     \param aObserver Pointer to observer.
   775 
   805 
   776     \sa MHbDeviceProgressDialogObserver
   806     \sa MHbDeviceProgressDialogObserver
   777 */
   807 */
   778 EXPORT_C void CHbDeviceProgressDialogSymbian::SetObserver(MHbDeviceProgressDialogObserver* aObserver)
   808 EXPORT_C void CHbDeviceProgressDialogSymbian::SetObserver(MHbDeviceProgressDialogObserver* aObserver)
   779     {
   809     {
   780     d->iObserver = aObserver;
   810     d->iObserver = aObserver;
   781     }
   811     }
   782 
   812 
   783 /*
   813 /*!
   784     Constructor.
   814     Constructs CHbDeviceProgressDialogSymbian.
   785 */
   815 */
   786 CHbDeviceProgressDialogSymbian::CHbDeviceProgressDialogSymbian()
   816 CHbDeviceProgressDialogSymbian::CHbDeviceProgressDialogSymbian()
   787     {
   817     {
   788     }
   818     }
   789 
   819