src/hbwidgets/devicedialogs/hbdevicenotificationdialogsymbian.cpp
changeset 28 b7da29130b0e
parent 23 e6ad4ef83b23
child 30 80e4d18b72f5
equal deleted inserted replaced
23:e6ad4ef83b23 28:b7da29130b0e
    41 
    41 
    42 NONSHARABLE_CLASS(CHbDeviceNotificationDialogSymbianPrivate) : public CBase,
    42 NONSHARABLE_CLASS(CHbDeviceNotificationDialogSymbianPrivate) : public CBase,
    43                                                   public MHbDeviceDialogObserver
    43                                                   public MHbDeviceDialogObserver
    44 {
    44 {
    45 public:
    45 public:
       
    46     struct TIntProperty{
       
    47         TInt iValue;
       
    48         TBool iChanged;
       
    49     };
       
    50 
       
    51 public:
    46     CHbDeviceNotificationDialogSymbianPrivate();
    52     CHbDeviceNotificationDialogSymbianPrivate();
    47     virtual ~CHbDeviceNotificationDialogSymbianPrivate();
    53     virtual ~CHbDeviceNotificationDialogSymbianPrivate();
    48     
    54     
    49 public:
    55 public:
    50     void ShowL();
    56     void ShowL();
    65     MHbDeviceNotificationDialogObserver* iObserver;
    71     MHbDeviceNotificationDialogObserver* iObserver;
    66     CHbDeviceDialogSymbian *iDeviceDialog;
    72     CHbDeviceDialogSymbian *iDeviceDialog;
    67     CHbSymbianVariantMap* iVariantMap;
    73     CHbSymbianVariantMap* iVariantMap;
    68     CHbDeviceNotificationDialogSymbian* q; 
    74     CHbDeviceNotificationDialogSymbian* q; 
    69     
    75     
    70     TBool iEnable;
    76     TIntProperty iEnable;
    71     TInt iTimeout;
    77     TIntProperty iTimeout;
    72     TInt iShowLevel;
    78     TIntProperty iShowLevel;
    73     CHbDeviceNotificationDialogSymbian::TextWrapping iWrap;
    79     TIntProperty iWrap;
    74 };
    80 };
    75 
    81 
    76 CHbDeviceNotificationDialogSymbianPrivate::CHbDeviceNotificationDialogSymbianPrivate()
    82 CHbDeviceNotificationDialogSymbianPrivate::CHbDeviceNotificationDialogSymbianPrivate()
    77     { 
    83     {
       
    84     iTimeout.iValue = 3000; // HbPopup::StandardTimeout
    78     }
    85     }
    79 
    86 
    80 CHbDeviceNotificationDialogSymbianPrivate::~CHbDeviceNotificationDialogSymbianPrivate()
    87 CHbDeviceNotificationDialogSymbianPrivate::~CHbDeviceNotificationDialogSymbianPrivate()
    81     {
    88     {
    82     if (!iObserver && q->Timeout() != 0) {
    89     if (!iObserver && q->Timeout() != 0) {
    96     iVariantMap = CHbSymbianVariantMap::NewL(); 
   103     iVariantMap = CHbSymbianVariantMap::NewL(); 
    97     }
   104     }
    98 
   105 
    99 void CHbDeviceNotificationDialogSymbianPrivate::ShowL()
   106 void CHbDeviceNotificationDialogSymbianPrivate::ShowL()
   100     {
   107     {
   101     AddVariantL(KKeyTouchActivation, &iEnable, CHbSymbianVariant::EBool);
   108     if (iEnable.iChanged) {
   102     AddVariantL(KKeyTimeOut, &iTimeout, CHbSymbianVariant::EInt);
   109         AddVariantL(KKeyTouchActivation, &iEnable.iValue, CHbSymbianVariant::EBool);
   103     AddVariantL(KKeyTitleTextWrapping, &iWrap, CHbSymbianVariant::EInt);
   110     }
   104     if (iShowLevel) { // send only if non-default
   111     if (iTimeout.iChanged) {
   105         AddVariantL(KKeyShowLevel, &iShowLevel, CHbSymbianVariant::EInt);
   112         AddVariantL(KKeyTimeOut, &iTimeout.iValue, CHbSymbianVariant::EInt);
       
   113     }
       
   114     if (iWrap.iChanged) {
       
   115         AddVariantL(KKeyTitleTextWrapping, &iWrap.iValue, CHbSymbianVariant::EInt);
       
   116     }
       
   117     if (iShowLevel.iChanged) {
       
   118         AddVariantL(KKeyShowLevel, &iShowLevel.iValue, CHbSymbianVariant::EInt);
   106     }
   119     }
   107 
   120 
   108     TInt error = iDeviceDialog->Show(KPluginIdentifier, *iVariantMap, this);
   121     TInt error = iDeviceDialog->Show(KPluginIdentifier, *iVariantMap, this);
   109     if (error != KErrNone) {
   122     if (error != KErrNone) {
   110         User::Leave(error); // error can be positive or negative
   123         User::Leave(error); // error can be positive or negative
   111     }
   124     }
   112     }
   125     }
   113 
   126 
   114 void CHbDeviceNotificationDialogSymbianPrivate::UpdateL()
   127 void CHbDeviceNotificationDialogSymbianPrivate::UpdateL()
   115     {
   128     {
   116     AddVariantL(KKeyTouchActivation, &iEnable, CHbSymbianVariant::EBool);
   129     if (iEnable.iChanged) {
   117     AddVariantL(KKeyTimeOut, &iTimeout, CHbSymbianVariant::EInt);
   130         AddVariantL(KKeyTouchActivation, &iEnable, CHbSymbianVariant::EBool);
   118     AddVariantL(KKeyTitleTextWrapping, &iWrap, CHbSymbianVariant::EInt);
   131     }
       
   132     if (iTimeout.iChanged) {
       
   133         AddVariantL(KKeyTimeOut, &iTimeout, CHbSymbianVariant::EInt);
       
   134     }
       
   135     if (iWrap.iChanged) {
       
   136         AddVariantL(KKeyTitleTextWrapping, &iWrap, CHbSymbianVariant::EInt);
       
   137     }
   119     TInt error = iDeviceDialog->Update(*iVariantMap);
   138     TInt error = iDeviceDialog->Update(*iVariantMap);
   120     if (error != KErrNone) {
   139     if (error != KErrNone) {
   121         User::Leave(error); // error can be positive or negative
   140         User::Leave(error); // error can be positive or negative
   122     }
   141     }
   123     }
   142     }
   169     }
   188     }
   170 
   189 
   171 // Set dialog show level
   190 // Set dialog show level
   172 void SetShowLevel(CHbDeviceNotificationDialogSymbianPrivate *aDialog, TInt aLevel)
   191 void SetShowLevel(CHbDeviceNotificationDialogSymbianPrivate *aDialog, TInt aLevel)
   173 {
   192 {
   174     aDialog->iShowLevel = aLevel;
   193     aDialog->iShowLevel.iValue = aLevel;
       
   194     aDialog->iShowLevel.iChanged = ETrue;
   175 }
   195 }
   176 
   196 
   177 /*!
   197 /*!
   178     \class MHbDeviceNotificationDialogObserver
   198     \class MHbDeviceNotificationDialogObserver
   179     \brief MHbDeviceNotificationDialogObserver is an observer interface for observing CHbDeviceNotificationDialogSymbian.
   199     \brief MHbDeviceNotificationDialogObserver is an observer interface for observing CHbDeviceNotificationDialogSymbian.
   180 */
   200 */
   181 
       
   182 /*!
   201 /*!
   183     \fn void MHbDeviceNotificationDialogObserver::NotificationDialogActivated(const CHbDeviceNotificationDialogSymbian* aDialog) = 0;
   202     \fn void MHbDeviceNotificationDialogObserver::NotificationDialogActivated(const CHbDeviceNotificationDialogSymbian* aDialog) = 0;
   184 
   203 
   185     This callback is called when notification dialog is activated.
   204     This callback is called when notification dialog is activated.
   186     \a aDialog - Pointer to dialog instance which received activation event.
   205     \a aDialog is a pointer to a dialog instance which received activation event.
   187 */
   206 
   188 
   207     \sa CHbDeviceNotificationDialogSymbian::EnableTouchActivation()
       
   208 */
   189 /*!
   209 /*!
   190    \fn void MHbDeviceNotificationDialogObserver::NotificationDialogClosed(const CHbDeviceNotificationDialogSymbian* aDialog, TInt aCompletionCode) = 0;
   210    \fn void MHbDeviceNotificationDialogObserver::NotificationDialogClosed(const CHbDeviceNotificationDialogSymbian* aDialog, TInt aCompletionCode) = 0;
   191 
   211 
   192     This callback is called when notification dialog is closed.
   212     This callback is called when notification dialog has closed.
   193     \a aDialog - Pointer to dialog instance which received closed event.
   213     \a aDialog is a pointer to a dialog instance which received closed event.
   194     \a aCompletionCode - Result of the dialog completion.
   214     \a aCompletionCode can be either Symbian error code or device dialog error code.
   195 */
   215 */
   196 
   216 
   197 /*!
   217 /*!
   198    \fn void MHbDeviceNotificationDialogObserver::NotificationDialogError(const CHbDeviceNotificationDialogSymbian* aDialog, TInt aError) = 0;
   218     \stable
   199 
   219     \hbwidgets
   200     This callback is called when an error has occurred.
   220 
   201     \a aDialog - Pointer to dialog instance which received closed event.
       
   202     \a aError - Error code.
       
   203 */
       
   204 
       
   205 /*!
       
   206     \class CHbDeviceNotificationDialogSymbian
   221     \class CHbDeviceNotificationDialogSymbian
   207     \brief CHbDeviceNotificationDialogSymbian is a Symbian implementation of HbDeviceNotificationDialog.
   222     \brief CHbDeviceNotificationDialogSymbian is a Symbian implementation of HbDeviceNotificationDialog.
   208 
   223 
   209     It is a client interface for s60 native application to show a non-modal dialog on top of applications when
   224     <b>This class is Symbian only. Not available on other platforms.</b>
   210     HbDeviceNotificationDialog can not be used.
   225 
   211 
   226     CHbDeviceNotificationDialogSymbian is intended for use by servers that don't run Qt event loop
   212     CHbDeviceNotificationDialogSymbian provides similar interface and functionality as HbDeviceNotificationDialog.
   227     and cannot use HbDeviceNotificationDialog.
   213     Main difference is that signals are replaced by an observer interface CHbDeviceNotificationDialogSymbianObserver.
   228 
   214 
   229     See HbDeviceNotificationDialog documentation to find out more about device notification
   215     For the content CHbDeviceNotificationDialogSymbian provides two rows of text, an image or an animation and for the usage
   230     dialogs.
   216     same rules as for the HbDeviceNotificationDialog apply. Dialog is shown when show() is called. It is recommended that 
   231 
   217     the dialog data is initialized before calling ShowL() or UpdateL() methods, because those methods use interprocess communication.
   232     CHbDeviceNotificationDialogSymbian provides similar interface and functionality as
   218 
   233     HbDeviceNotificationDialog. Main difference is that signals are replaced by an observer
   219     Two timeout constants are provided for setting the dialog timeout: KHbShortNotificationDialogTimeout and 
   234     interface CHbDeviceNotificationDialogSymbianObserver.
   220     KHbLongNotificationDialogTimeout. The first is equivalent to HbPopup::ConfirmationNoteTimeout and the latter 
   235 
   221     is equivalent to HbPopup::StandardTimeout.
   236     An asynchronous ShowL() method launches a dialog. Device dialog framework decides when the
   222     
   237     dialog is actually shown. There may be a delay untill dialog appears on display. Close()
       
   238     closes a dialog.
       
   239 
       
   240     After dialog has been lauched, properties may be updated by setters and calling UpdateL().
       
   241     It is recommended that dialog properties are set before calling ShowL() as updating them after
       
   242     causes interprocess communication.
       
   243 
       
   244     If there is no need to update or receive activation from a launched dialog,
       
   245     CHbDeviceNotificationDialogSymbian object can be deleted after ShowL() returns. Device
       
   246     dialog framework takes care of displaying the dialog.
       
   247 
       
   248     For maintaining consistent look and feel, two timeout constants are provided for setting
       
   249     dialog timeout: KHbShortNotificationDialogTimeout and KHbLongNotificationDialogTimeout.
       
   250     The first one is equivalent to HbPopup::ConfirmationNoteTimeout and the latter 
       
   251     to HbPopup::StandardTimeout.
       
   252 
   223     \code
   253     \code
   224     Following code snippet creates a device notification dialog containing title, text and icon.
   254     Following code snippet creates a device notification dialog containing title, text and icon.
   225 
   255 
   226     _LIT(KDialogText, "Dialog text");
   256     _LIT(KDialogText, "Dialog text");
   227     _LIT(KDialogTitle, "Dialog title");
   257     _LIT(KDialogTitle, "Dialog title");
   228     _LIT(KDialogIcon, "note_info.svg");
   258     _LIT(KDialogIcon, "qtg_large_info");
   229 
   259 
   230     CHbDeviceNotificationDialogSymbian* dialog = CHbDeviceNotificationDialogSymbian::NewL();
   260     CHbDeviceNotificationDialogSymbian* dialog = CHbDeviceNotificationDialogSymbian::NewL();
   231     CleanupStack::PushL(dialog);
   261     CleanupStack::PushL(dialog);
   232     dialog->SetTextL(KDialogText);
   262     dialog->SetTextL(KDialogText);
   233     dialog->SetTitleL(KDialogTitle);
   263     dialog->SetTitleL(KDialogTitle);
   234     dialog->SetIconNameL(KDialogIcon);
   264     dialog->SetIconNameL(KDialogIcon);
   235     dialog->Show();
   265     dialog->ShowL();
   236     CleanupStack::PopAndDestroy(dialog);
   266     CleanupStack::PopAndDestroy(dialog);
   237     \endcode
   267     \endcode
   238 
   268 
   239     or equivalent dialog can be created using one of the provided convenience methods:
   269     or equivalent dialog can be created using one of the provided convenience methods:
   240 
   270 
   241     \code
   271     \code
   242     _LIT(KDialogText, "Dialog text");
   272     _LIT(KDialogText, "Dialog text");
   243     _LIT(KDialogTitle, "Dialog title");
   273     _LIT(KDialogTitle, "Dialog title");
   244     _LIT(KDialogIcon, "note_info.svg");
   274     _LIT(KDialogIcon, "qtg_large_info");
   245     
   275     
   246     CHbDeviceNotificationDialogSymbian::Notification(KDialogIcon, KDialogText, KDialogTitle);
   276     CHbDeviceNotificationDialogSymbian::Notification(KDialogIcon, KDialogText, KDialogTitle);
   247     \endcode
   277     \endcode
   248 
   278 
   249     When using convenience methods, it is not possible to receive user interaction events, because the 
   279     When using convenience methods, it is not possible to receive user interaction events,
   250     HbDeviceNotificationDialog instance is destroyed when the call returns. Ownership and handling of the
   280     because the HbDeviceNotificationDialog instance is destroyed when the call returns.
   251     dialog is transferred to HbDeviceDialog framework. Also dialog can not be closed nor updated.
   281 
   252 
   282     Below is an example of receiving user interaction events from device notification dialog.
   253     Below is an example of receiving user interaction events from device notification dialog. With following example 
   283     With following example user is able to receive activated and close events.
   254     user is able to receive activated and close events. Note that dialog is cancelled, if it goes out of scope.
   284     Note that in this case the dialog is closed by device dialog framework if
       
   285     CHbDeviceNotificationDialogSymbian object is deleted.
   255 
   286 
   256     \code
   287     \code
   257     _LIT(KDialogText, "Dialog text");
   288     _LIT(KDialogText, "Dialog text");
   258     _LIT(KDialogTitle, "Dialog title");
   289     _LIT(KDialogTitle, "Dialog title");
   259     _LIT(KDialogIcon, "note_info.svg");
   290     _LIT(KDialogIcon, "qtg_large_info");
   260 
   291 
   261     class DialogObserver : public MHbDeviceNotificationDialogObserver
   292     class DialogObserver : public MHbDeviceNotificationDialogObserver
   262     {
   293     {
   263     public:
   294     public:
   264         DialogObserver() {}
   295         DialogObserver() {}
   293         iDialog->SetTitleL(KDialogTitle);
   324         iDialog->SetTitleL(KDialogTitle);
   294         iDialog->SetIconNameL(KDialogIcon);
   325         iDialog->SetIconNameL(KDialogIcon);
   295         iDialog->ShowL();
   326         iDialog->ShowL();
   296     }
   327     }
   297     \endcode
   328     \endcode
   298     
   329 
   299     CHbDeviceNotificationDialogSymbian supports. 
   330     Following example sets an icon animation into a notification dialog.
   300     Supported formats are the following.
       
   301 
       
   302     - GIF (.gif)
       
   303     - MNG (.mng)
       
   304     - Frame animations
       
   305     
       
   306     There is a built-in support for GIF and MNG animations. 
       
   307     
       
   308     Frame animations can be created by following way:
       
   309         
   331         
   310     \code
   332     \code
   311     Create an animation definition file.    
   333     Create an animation definition file.    
   312     
   334     
   313     <animations>
   335     <animations>
   326         
   348         
   327     iDialog->SetAnimationDefinitionL(KAnimationDefinitionXML);
   349     iDialog->SetAnimationDefinitionL(KAnimationDefinitionXML);
   328     iDialog->SetIconNameL(KLogicalIconName);
   350     iDialog->SetIconNameL(KLogicalIconName);
   329     iDialog->ShowL();       
   351     iDialog->ShowL();       
   330     \endcode
   352     \endcode
   331     \sa HbIconAnimationManager::addDefinitionFile
   353 
   332     \note Animation definition files must be stored to a place where they
   354     \sa HbDeviceNotificationDialog, MHbDeviceNotificationDialogObserver 
   333     can be accessed.    
   355 */
   334     
   356 
   335     \stable
   357 /*!
   336     \hbwidgets
   358     \enum CHbDeviceNotificationDialogSymbian::TextWrapping
       
   359     Title text wrapping.
       
   360 
       
   361     \sa Hb::TextWrapping
       
   362 */
       
   363 /*!
       
   364     \var CHbDeviceNotificationDialogSymbian::TextWrapping CHbDeviceNotificationDialogSymbian::TextNoWrap
       
   365     No wrapping.
       
   366 */
       
   367 /*!
       
   368     \var CHbDeviceNotificationDialogSymbian::TextWrapping CHbDeviceNotificationDialogSymbian::TextWordWrap
       
   369     Word wrapping.
       
   370 */
       
   371 /*!
       
   372     \var CHbDeviceNotificationDialogSymbian::TextWrapping CHbDeviceNotificationDialogSymbian::TextWrapAnywhere
       
   373     Wrap anywhere.
   337 */
   374 */
   338 
   375 
   339 /*!
   376 /*!
   340     Symbian two phase constructor. Returns a pointer to CHbDeviceNotificationDialogSymbian instance.
   377     Symbian two phase constructor. Returns a pointer to CHbDeviceNotificationDialogSymbian instance.
   341     \a aObserver Pointer to the observer.
   378     \a aObserver Pointer to the observer.
   358     delete d;
   395     delete d;
   359     }
   396     }
   360 
   397 
   361 /*!
   398 /*!
   362     Convenience method for showing notification dialog with icon and title.
   399     Convenience method for showing notification dialog with icon and title.
   363     \param aIconName - path and name of the icon shown on dialog.
   400 
   364     \param aTitle - title shown on dialog.
   401     \param aIconName Path and name of the icon to show on dialog.
       
   402     \param aTitle Title text.
   365 */
   403 */
   366 EXPORT_C void CHbDeviceNotificationDialogSymbian::NotificationL(const TDesC& aIconName, const TDesC& aTitle)
   404 EXPORT_C void CHbDeviceNotificationDialogSymbian::NotificationL(const TDesC& aIconName, const TDesC& aTitle)
   367     {
   405     {
   368     CHbDeviceNotificationDialogSymbian* self = CHbDeviceNotificationDialogSymbian::NewL();
   406     CHbDeviceNotificationDialogSymbian* self = CHbDeviceNotificationDialogSymbian::NewL();
   369     CleanupStack::PushL(self);
   407     CleanupStack::PushL(self);
   373     CleanupStack::PopAndDestroy(self);
   411     CleanupStack::PopAndDestroy(self);
   374     }
   412     }
   375 
   413 
   376 /*!
   414 /*!
   377     Convenience method for showing notification dialog with icon, text and title.
   415     Convenience method for showing notification dialog with icon, text and title.
   378     \param aIconName - path and name of the icon shown on dialog.
   416 
   379     \param aText - text shown on dialog.
   417     \param aIconName Path and name of icon to show on dialog.
   380     \param aTitle - title shown on dialog.
   418     \param aText Dialog text.
       
   419     \param aTitle Title text.
   381 */
   420 */
   382 EXPORT_C void CHbDeviceNotificationDialogSymbian::NotificationL(const TDesC &aIconName, const TDesC& aText, const TDesC& aTitle)
   421 EXPORT_C void CHbDeviceNotificationDialogSymbian::NotificationL(const TDesC &aIconName, const TDesC& aText, const TDesC& aTitle)
   383     {
   422     {
   384     CHbDeviceNotificationDialogSymbian* self = CHbDeviceNotificationDialogSymbian::NewL();
   423     CHbDeviceNotificationDialogSymbian* self = CHbDeviceNotificationDialogSymbian::NewL();
   385     CleanupStack::PushL(self);
   424     CleanupStack::PushL(self);
   389     self->ShowL();
   428     self->ShowL();
   390     CleanupStack::PopAndDestroy(self);
   429     CleanupStack::PopAndDestroy(self);
   391     }
   430     }
   392 
   431 
   393 /*!
   432 /*!
   394     Sets message box icon name or animation logical name. The dialog gets updated when method is called.
   433     Sets dialog icon name or animation logical name.
   395 
   434 
   396     \param aIconName Icon name. Icon can be from Hb resources or themes. Or can be a file in
   435     \param aIconName Icon name. Icon can be from Hb resources or themes. Or can be a file in
   397     a file system.
   436     a file system.
   398 
   437 
   399     \sa IconName()
   438     \sa IconName(), ShowL(), UpdateL()
   400 */
   439 */
   401 EXPORT_C void CHbDeviceNotificationDialogSymbian::SetIconNameL(const TDesC& aIconName)
   440 EXPORT_C void CHbDeviceNotificationDialogSymbian::SetIconNameL(const TDesC& aIconName)
   402     {
   441     {
   403     d->AddVariantL(KKeyIconName, &aIconName, CHbSymbianVariant::EDes);
   442     d->AddVariantL(KKeyIconName, &aIconName, CHbSymbianVariant::EDes);
   404     }
   443     }
   405 
   444 
   406 
   445 
   407 /*!
   446 /*!
   408     Get name and path of the icon shown on dialog or animation's logical name. 
   447     Returns icon or animation name. Default is empty.
   409     If not set, returns empty iconName.
       
   410 
   448 
   411     \sa SetIconNameL
   449     \sa SetIconNameL
   412 */
   450 */
   413 EXPORT_C const TPtrC CHbDeviceNotificationDialogSymbian::IconName() const
   451 EXPORT_C const TPtrC CHbDeviceNotificationDialogSymbian::IconName() const
   414     {    
   452     {    
   419         }
   457         }
   420     return TPtrC(KNullDesC());    
   458     return TPtrC(KNullDesC());    
   421     }
   459     }
   422 
   460 
   423 /*!
   461 /*!
   424     Sets notification dialog's animation definition name.  The dialogs get updated next when time ShowL() or UpdateL()
   462     Sets dialog animation definition file name.
   425     is called.
   463 
   426 
   464     Supported icon animation formats are following:
   427     \param aAnimationDefinition Animation definition file name. Definition can be from Hb resources or themes. 
   465     - GIF (.gif)
   428     Or can be a file in a file system.
   466     - MNG (.mng)
   429 
   467     - Frame animations
   430     \sa AnimationDefinition()
   468 
       
   469     \param aAnimationDefinition Animation definition file name. Definition can be from Hb resources or themes.
       
   470     Or can be a file in a file system. The definition must be stored to a place where it can be accessed by
       
   471     device dialog service.
       
   472 
       
   473     \sa AnimationDefinition() SetIconNameL() HbIconAnimationManager::addDefinitionFile(), ShowL(), UpdateL()
   431 */
   474 */
   432 EXPORT_C void CHbDeviceNotificationDialogSymbian::SetAnimationDefinitionL(const TDesC& aAnimationDefinition)
   475 EXPORT_C void CHbDeviceNotificationDialogSymbian::SetAnimationDefinitionL(const TDesC& aAnimationDefinition)
   433 {
   476 {
   434     d->AddVariantL(KKeyAnimationDefinition, &aAnimationDefinition, CHbSymbianVariant::EDes);
   477     d->AddVariantL(KKeyAnimationDefinition, &aAnimationDefinition, CHbSymbianVariant::EDes);
   435 }
   478 }
   436 
   479 
   437 /*!
   480 /*!
   438     Returns an animation definition set for a dialog. If not set, return string.
   481     Returns dialog animation definition file name.
   439 
   482 
   440     \sa SetAnimationDefinitionL()
   483     \sa SetAnimationDefinitionL()
   441 */
   484 */
   442 EXPORT_C TPtrC CHbDeviceNotificationDialogSymbian::AnimationDefinition() const
   485 EXPORT_C TPtrC CHbDeviceNotificationDialogSymbian::AnimationDefinition() const
   443 {
   486 {
   449     return TPtrC(KNullDesC());
   492     return TPtrC(KNullDesC());
   450 }
   493 }
   451 
   494 
   452 
   495 
   453 /*!
   496 /*!
   454     Set and update text on dialog. Text is not set, if Show() or Update()
   497     Sets dialog text.
   455     is not called.
   498 
   456     \param aText - text shown on dialog.
   499     \param aText Dialog text.
   457     \sa ShowL(), UpdateL()
   500 
       
   501     \sa Text(), ShowL(), UpdateL()
   458 */
   502 */
   459 EXPORT_C void CHbDeviceNotificationDialogSymbian::SetTextL(const TDesC& aText)
   503 EXPORT_C void CHbDeviceNotificationDialogSymbian::SetTextL(const TDesC& aText)
   460     {
   504     {
   461     d->AddVariantL(KKeyText, &aText, CHbSymbianVariant::EDes);
   505     d->AddVariantL(KKeyText, &aText, CHbSymbianVariant::EDes);
   462     }
   506     }
   463 
   507 
   464 /*!
   508 /*!
   465     Get text shown on dialog. If not set, returns empty string.
   509     Returns dialog text.
   466 
   510 
   467     \sa SetTextL()
   511     \sa SetTextL()
   468 */
   512 */
   469 EXPORT_C const TPtrC CHbDeviceNotificationDialogSymbian::Text() const
   513 EXPORT_C const TPtrC CHbDeviceNotificationDialogSymbian::Text() const
   470     {
   514     {
   475         }
   519         }
   476     return TPtrC(KNullDesC());    
   520     return TPtrC(KNullDesC());    
   477     }    
   521     }    
   478 
   522 
   479 /*!
   523 /*!
   480     Set and update title on dialog. Title is not set, if Show() or Update()
   524     Sets title text.
   481     is not called.
   525 
   482     \param aTitle - title shown on dialog.
   526     \param aTitle Title text.
   483     \sa ShowL(), UpdateL()
   527 
       
   528     \sa Title(), ShowL(), UpdateL()
   484 */
   529 */
   485 EXPORT_C void CHbDeviceNotificationDialogSymbian::SetTitleL(const TDesC& aTitle)
   530 EXPORT_C void CHbDeviceNotificationDialogSymbian::SetTitleL(const TDesC& aTitle)
   486     {
   531     {
   487     d->AddVariantL(KKeyTitle, &aTitle, CHbSymbianVariant::EDes);
   532     d->AddVariantL(KKeyTitle, &aTitle, CHbSymbianVariant::EDes);
   488     }
   533     }
   489 
   534 
   490 /*!
   535 /*!
   491     Get title shown on dialog. If not set, returns empty string.
   536     Returns title text.
   492 
   537 
   493     \sa SetTitleL()
   538     \sa SetTitleL()
   494 */
   539 */
   495 EXPORT_C const TPtrC CHbDeviceNotificationDialogSymbian::Title() const
   540 EXPORT_C const TPtrC CHbDeviceNotificationDialogSymbian::Title() const
   496     {
   541     {
   502         }
   547         }
   503     return TPtrC(KNullDesC());
   548     return TPtrC(KNullDesC());
   504     }
   549     }
   505     
   550     
   506 /*!
   551 /*!
   507     Enable user interaction on dialog. Setting is not set, if Show() or Update()
   552     Enables user interaction on dialog.
   508     is not called.
   553 
   509     \param aEnable - When enabled, activation event is notified via observer interface.
   554     \param aEnable True enables activation event notification via observer interface.
   510 
   555 
   511     Default value is false.
   556     \sa IsTouchActivating(), ShowL(), UpdateL(), MCHbDeviceNotificationDialogSymbianObserver
   512     \sa ShowL(), UpdateL(), MCHbDeviceNotificationDialogSymbianObserver.
       
   513 */
   557 */
   514 EXPORT_C void CHbDeviceNotificationDialogSymbian::EnableTouchActivation(TBool aEnable)
   558 EXPORT_C void CHbDeviceNotificationDialogSymbian::EnableTouchActivation(TBool aEnable)
   515     {
   559     {
   516     d->iEnable = aEnable;    
   560     d->iEnable.iValue = aEnable;
   517     }
   561     d->iEnable.iChanged = ETrue;
   518 
   562     }
   519 /*!
   563 
   520     Get touch activation setting.
   564 /*!
       
   565     Returns touch activation setting.  Default value is false.
   521 
   566 
   522     \sa EnableTouchActivation()
   567     \sa EnableTouchActivation()
   523 */
   568 */
   524 EXPORT_C TBool CHbDeviceNotificationDialogSymbian::IsTouchActivating() const
   569 EXPORT_C TBool CHbDeviceNotificationDialogSymbian::IsTouchActivating() const
   525     {        
   570     {        
   526     return d->iEnable; 
   571     return d->iEnable.iValue; 
   527     }
   572     }
   528 
   573 
   529 /*!
   574 /*!
   530     Set dialog timeout. Timeout is not set, if Show() or Update()
   575     Set dialog timeout. 
   531     is not called.
   576 
   532     \param aTimeout - Set timeout for dialog.
   577     \param aTimeout Dialog timeout in milliseconds.
   533 
   578 
   534     Default value is KHbLongNotificationDialogTimeout (3000 ms).
   579     \sa Timeout(), ShowL(), UpdateL()
   535     \sa ShowL(), UpdateL()
       
   536 */
   580 */
   537 EXPORT_C void CHbDeviceNotificationDialogSymbian::SetTimeout(TInt aTimeout)
   581 EXPORT_C void CHbDeviceNotificationDialogSymbian::SetTimeout(TInt aTimeout)
   538     {
   582     {
   539     d->iTimeout = aTimeout;
   583     d->iTimeout.iValue = aTimeout;
   540     }
   584     d->iTimeout.iChanged = ETrue;
   541 
   585     }
   542 /*!
   586 
   543     Get timeout setting.
   587 /*!
       
   588     Returns timeout. Default value is KHbLongNotificationDialogTimeout (3000 ms).
   544 
   589 
   545     \sa SetTimeout()
   590     \sa SetTimeout()
   546 */
   591 */
   547 EXPORT_C TInt CHbDeviceNotificationDialogSymbian::Timeout() const
   592 EXPORT_C TInt CHbDeviceNotificationDialogSymbian::Timeout() const
   548     {    
   593     {    
   549     return d->iTimeout;
   594     return d->iTimeout.iValue;
   550     }
   595     }
   551 
   596 
   552 /*!
   597 /*!
   553     Set dialog title text wrapping. Text wrapping is not set, if Show() or Update()
   598     Sets title text wrapping. The title can wrap only if there is no text for the dialog.
   554     is not called.
   599     The title can wrap to a maximum of two lines. SetTextL() also changes title text wrapping.
   555     \param aWrapping - Defines title text wrapping.
   600 
   556 
   601 
   557     Default value is CHbDeviceNotificationDialogSymbian::TextNoWrap.
   602     \param aWrapping Title text wrapping.
   558     \sa ShowL(), UpdateL()
   603 
       
   604     \sa TitleTextWrapping(), SetTextL(), ShowL(), UpdateL()
   559 */
   605 */
   560 EXPORT_C void CHbDeviceNotificationDialogSymbian::SetTitleTextWrapping(
   606 EXPORT_C void CHbDeviceNotificationDialogSymbian::SetTitleTextWrapping(
   561     TextWrapping aWrapping)
   607     TextWrapping aWrapping)
   562     {
   608     {
   563     d->iWrap = aWrapping;    
   609     d->iWrap.iValue = aWrapping;
   564     }
   610     d->iWrap.iChanged = ETrue;
   565 
   611     }
   566 /*!
   612 
   567     Get title text wrapping setting.
   613 /*!
       
   614     Returns title text wrapping.
       
   615 
       
   616     The title can wrap only if dialog text is empty. The title can wrap to a maximum of two lines.
       
   617     The default is CHbDeviceNotificationDialogSymbian::TextWordWrap.
   568 
   618 
   569     \sa SetTitleTextWrapping()
   619     \sa SetTitleTextWrapping()
   570 */
   620 */
   571 EXPORT_C CHbDeviceNotificationDialogSymbian::TextWrapping CHbDeviceNotificationDialogSymbian::TitleTextWrapping() const
   621 EXPORT_C CHbDeviceNotificationDialogSymbian::TextWrapping CHbDeviceNotificationDialogSymbian::TitleTextWrapping() const
   572     {    
   622     {
   573     return d->iWrap;
   623     if (d->iWrap.iChanged) {
   574     }
   624         return static_cast<TextWrapping>(d->iWrap.iValue);
   575     
   625     } else {
   576 /*!
   626         return Text().Length() == 0 ? TextWordWrap : TextNoWrap;
   577     Show the dialog.
   627     }
   578     \code
   628     }
   579     // example to show dialog.
   629     
   580     iNotificationDialog->SetTitleL("Dialog title text");
   630 /*!
   581     iNotificationDialog->ShowL();
   631     Shows a notification dialog and returns immediately without waiting for it to close.
   582     \endcode
   632     Closing of the dialog and tapping of dialog is indicated by MHbDeviceNotificationDialogObserver
       
   633     callback interface. Dialog can be updated while showing by property setters and then calling
       
   634     UpdateL().
       
   635 
       
   636     \sa UpdateL(), Close(), MHbDeviceNotificationDialogObserver
   583 */
   637 */
   584 EXPORT_C void CHbDeviceNotificationDialogSymbian::ShowL()
   638 EXPORT_C void CHbDeviceNotificationDialogSymbian::ShowL()
   585     {
   639     {
   586     d->ShowL();
   640     d->ShowL();
   587     }
   641     }
   588 
   642 
   589 /*!
   643 /*!
   590     Update the dialog. Show must be called before update can be used.
   644     Updates changed properties to a showing notification dialog via interprocess
   591     \code
   645     communication. Has no effect if ShowL() has not been called or the dialog has
   592     // example to update already showing dialog.
   646     closed already.
   593     iNotificationDialog->SetTitleL("Update title");
   647 
   594     iNotificationDialog->UpdateL();
   648     \sa ShowL()
   595     \endcode
       
   596 */
   649 */
   597 
   650 
   598 EXPORT_C void CHbDeviceNotificationDialogSymbian::UpdateL()
   651 EXPORT_C void CHbDeviceNotificationDialogSymbian::UpdateL()
   599     {
   652     {
   600     d->UpdateL();
   653     d->UpdateL();
   601     }
   654     }
   602 
   655 
   603 /*!
   656 /*!
   604     Close the dialog. Method has no effect if convenience methods
   657     Closes a device notification dialog.
   605     are used to show device notification dialog.
       
   606 */
   658 */
   607 EXPORT_C void CHbDeviceNotificationDialogSymbian::Close()
   659 EXPORT_C void CHbDeviceNotificationDialogSymbian::Close()
   608     {
   660     {
   609     d->Close();
   661     d->Close();
   610     }
   662     }
   623     MHbDeviceNotificationDialogObserver* aObserver)
   675     MHbDeviceNotificationDialogObserver* aObserver)
   624     {
   676     {
   625     d = new (ELeave) CHbDeviceNotificationDialogSymbianPrivate;
   677     d = new (ELeave) CHbDeviceNotificationDialogSymbianPrivate;
   626     d->ConstructL(this);
   678     d->ConstructL(this);
   627     d->iObserver = aObserver;
   679     d->iObserver = aObserver;
   628     EnableTouchActivation(EFalse);
   680     }
   629     SetTimeout(KHbLongNotificationDialogTimeout);
       
   630     SetTitleTextWrapping(CHbDeviceNotificationDialogSymbian::TextWordWrap);
       
   631     }