iaupdate/IAD/backgroundchecker/inc/iaupdatebgsoftnotification.h
branchRCL_3
changeset 25 7333d7932ef7
parent 0 ba25891c3a9e
child 26 8b7f4e561641
equal deleted inserted replaced
24:5cc91383ab1e 25:7333d7932ef7
     1 /*
     1 /*
     2 * Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
     2 * Copyright (c) 2008-2010 Nokia Corporation and/or its subsidiary(-ies).
     3 * All rights reserved.
     3 * All rights reserved.
     4 * This component and the accompanying materials are made available
     4 * This component and the accompanying materials are made available
     5 * under the terms of "Eclipse Public License v1.0"
     5 * under the terms of "Eclipse Public License v1.0"
     6 * which accompanies this distribution, and is available
     6 * which accompanies this distribution, and is available
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
    20 #ifndef IAUPDATEBGSOFTNOTIFICATION_H
    20 #ifndef IAUPDATEBGSOFTNOTIFICATION_H
    21 #define IAUPDATEBGSOFTNOTIFICATION_H
    21 #define IAUPDATEBGSOFTNOTIFICATION_H
    22 
    22 
    23 // INCLUDES
    23 // INCLUDES
    24 #include <e32base.h>
    24 #include <e32base.h>
    25 #include <AknDynamicSoftNotifier.h>
    25 
       
    26 #include <hbdevicenotificationdialogsymbian.h>
    26 #include "iaupdatebgcheckermode.h"
    27 #include "iaupdatebgcheckermode.h"
    27 
    28 
       
    29 
    28 // FORWARD DECLARATION
    30 // FORWARD DECLARATION
    29 class TAknDynamicSoftNotificationParams;
       
    30 class CIAUpdateBGInternalFileHandler;
       
    31 
       
    32 class MIAUpdateBGSoftNotificationCallBack
    31 class MIAUpdateBGSoftNotificationCallBack
    33     {
    32     {
    34     public:
    33     public:
    35         virtual void SoftNotificationCallBack( TBool aIsAccepted ) = 0;
    34         virtual void SoftNotificationCallBack( TBool aIsAccepted ) = 0;
    36         virtual TIAUpdateBGMode CurrentMode() = 0;
    35         virtual TIAUpdateBGMode CurrentMode() = 0;
    37     };
    36     };
    38 
    37 
    39 
    38 
    40 // CLASS DECLARATION
    39 // CLASS DECLARATION
    41 /**
    40 /**
    42  *  Controls the native soft notifications.
    41  *  Controls the background indicator notifications. 
    43  *  This class delegates method calls to AvKon soft notification.
       
    44  *
    42  *
    45  *  @since 3.2
       
    46  */
    43  */
    47 class CIAUpdateBGSoftNotification : public CBase, public MAknDynamicSoftNoteObserver
    44 class CIAUpdateBGSoftNotification : public CBase, 
       
    45                                     public MHbDeviceNotificationDialogObserver
    48     {
    46     {
    49     public:  // Constructors and destructor
    47     public:  // Constructors and destructor
    50 
    48 
    51         /**
    49         /**
    52          * Static constructor
    50          * Static constructor
    53          */
    51          */
    54         static CIAUpdateBGSoftNotification* NewL( MIAUpdateBGSoftNotificationCallBack* aCallback, CIAUpdateBGInternalFileHandler* aInternalFile );
    52         static CIAUpdateBGSoftNotification* NewL( 
       
    53                 MIAUpdateBGSoftNotificationCallBack* aCallback ); 
    55 
    54 
    56         /**
    55         /**
    57          * Destructor.
    56          * Destructor.
    58          */
    57          */
    59         virtual ~CIAUpdateBGSoftNotification();
    58         virtual ~CIAUpdateBGSoftNotification();
    60 
    59         
    61     public: // From MAknDynamicSoftNotifierObserver
       
    62 
       
    63         /**
       
    64          * Dynamic soft notification was accepted by user.
       
    65          *
       
    66          * @param aNoteId Identification of notification.
       
    67          */
       
    68         void NotificationAccepted( TInt aIdentifier );
       
    69 
       
    70         /**
       
    71          * Dynamic soft notification was canceled by user.
       
    72          *
       
    73          * @param aNoteId Identification of notification.
       
    74          */
       
    75         void NotificationCanceled( TInt aIdentifier );
       
    76 
       
    77     public: // New functions
    60     public: // New functions
    78         
    61         
    79         void StartObservingIfNeededL();
    62          /**
    80         
    63           * Shows notification and  indicator. 
    81         
    64           */
    82         /**
    65          void ShowNotificationL();
    83          * Add a custom soft notification. If a custom soft notification with
    66          
    84          * exactly the same parameters already exists,
    67          /**
    85          * its count is increased by aCount.
    68           * Shows indicator. 
    86          *
    69           */
    87          * @param aNotificationId identifier for this notification
    70          void ShowIndicatorL();
    88          * @param aCount addition count
    71          
    89          */
    72          /**
    90         void ShowSoftNotificationL();
    73           * Removes indicator. 
    91 
    74           */
    92         /**
    75          void RemoveIndicatorL();
    93          * Cancels custom soft notification.
       
    94          *
       
    95          * @param aNotificationId identifier for this notification
       
    96          */
       
    97         void RemoveSoftNotificationL( TInt aNotifierID );
       
    98 
    76 
    99         /**
    77         /**
   100          * Set a text for a soft notification.
    78          * Set a text for a soft notification.
   101          *
    79          *
   102          * @param aSingularText singular text for soft notification
    80          * @param aTitle title for soft notification
   103          * @param aPluralText plural text for soft notification
    81          * @param aText  text for soft notification
   104          */
    82          */
   105         void SetTextL( const TDesC& aText, const TDesC& aGroupText );
    83         void SetTextL( const TDesC& aTitle, const TDesC& aText ); 
       
    84         
       
    85         /**
       
    86         * Set number of updates a soft notification.
       
    87         *
       
    88         * @param aNrOfUpdates 0 - first time, >< 0 normal case
       
    89         */
       
    90         void SetNrOfUpdates( const TInt& aNrOfUpdates);
   106 
    91 
   107         /**
       
   108          * Set labels for soft notification's softkeys.
       
   109          *
       
   110          * @param aSoftkey1Label Label for the softkey 1
       
   111          * @param aSoftkey2Label Label for the softkey 2
       
   112          */
       
   113         void SetSoftkeyLabelsL( const TDesC& aSoftkey1Label,
       
   114             const TDesC& aSoftkey2Label );
       
   115 
       
   116         /**
       
   117          * Set an image for a soft notification.
       
   118          *
       
   119          * @param aImage image for soft notification
       
   120          */
       
   121         void SetImageL( const TDesC8& aImage );
       
   122 
       
   123         /**
       
   124          * Returns the notification id.
       
   125          *
       
   126          * @return notification id
       
   127          */
       
   128         TInt Id();
       
   129 
    92 
   130     private:  // Constructors
    93     private:  // Constructors
   131         /**
    94         /**
   132          * C++ constructor.
    95          * C++ constructor.
   133          *
    96          *
   134          * @param aAppId View activation application id.
    97          * @param aCallback notification callback
   135          * @param aNotificationId Notification id.
       
   136          * @param aEventSource Event source used for posting events from
       
   137          *        native to Java side.
       
   138          */
    98          */
   139         CIAUpdateBGSoftNotification( MIAUpdateBGSoftNotificationCallBack* aCallback, CIAUpdateBGInternalFileHandler* aInternalFile );
    99         CIAUpdateBGSoftNotification( 
       
   100                 MIAUpdateBGSoftNotificationCallBack* aCallback); 
   140 
   101 
   141         /**
   102         /**
   142          * 2nd phase constructor.
   103          * 2nd phase constructor.
   143          */
   104          */
   144         void ConstructL();
   105         void ConstructL();
   146     private:  // New methods
   107     private:  // New methods
   147    
   108    
   148         /**
   109         /**
   149          * Set assigned member data to custom notification parameters
   110          * Set assigned member data to custom notification parameters
   150          *
   111          *
   151          * @param aParam custom soft notification params to fill
       
   152          */
   112          */
   153         void FillNotificationParams( TAknDynamicSoftNotificationParams& aParam );
   113         void FillNotificationParams();
   154 
   114         
       
   115         /**
       
   116          * Notification dialog activationobserver
       
   117          *
       
   118          * @param aDialog notification dialog
       
   119          */
       
   120         virtual void NotificationDialogActivated(
       
   121                 const CHbDeviceNotificationDialogSymbian* aDialog );
       
   122         /**
       
   123          * Notification dialog activationobserver
       
   124          *
       
   125          * @param aDialog notification dialog
       
   126          * @param aCompletionCode completion code
       
   127          */
       
   128         virtual void NotificationDialogClosed( 
       
   129                 const CHbDeviceNotificationDialogSymbian* aDialog, 
       
   130                 TInt aCompletionCode );
       
   131         
       
   132         /**
       
   133          * Enable/disable indicator
       
   134          *
       
   135          * @param aEnabled ETrue-enabled, EFalse-disabled
       
   136          */        
       
   137         void SetIndicatorEnabled(TBool aEnabled);
       
   138         
       
   139         /**
       
   140          * Get indicator enablation state
       
   141          *
       
   142          * @return ETrue-enabled, EFalse-disabled
       
   143          */ 
       
   144         TBool IsIndicatorEnabled();
       
   145         
       
   146         int GetNrOfUpdates();
       
   147         
   155     private:  // Data
   148     private:  // Data
   156         /// Own. AvKon custom soft notifier
   149         // Note title
   157         CAknDynamicSoftNotifier* iNotifier;
   150         HBufC* iTitle; 
   158         /// View activation application id
       
   159         TUid iAppId;
       
   160         /// Notification Id
       
   161         TInt iNotificationId;
       
   162         /// Own. Softkey 1 label
       
   163         HBufC* iSoftkey1;
       
   164         /// Own. Softkey 2 label
       
   165         HBufC* iSoftkey2;
       
   166         /// Own. Note label when single dialog is shown
       
   167         HBufC* iLabel;
       
   168         /// Own. Note label when notifications are groupped
       
   169         HBufC* iGroupLabel;
       
   170         /// Own. Image data byte array
       
   171         HBufC8* iImageData;
       
   172         
   151         
       
   152         // Note text
       
   153         HBufC* iText; 
       
   154         
       
   155         // Notification callback
   173         MIAUpdateBGSoftNotificationCallBack* iCallback;
   156         MIAUpdateBGSoftNotificationCallBack* iCallback;
   174         
   157         
   175         CIAUpdateBGInternalFileHandler* iInternalFile; //not owned
   158         // Number of updates
       
   159         int iNrOfUpdates;
       
   160         
       
   161         // Indictor activation state
       
   162         TBool iActivateIndicator;
       
   163         
       
   164         //Notification dialog
       
   165         CHbDeviceNotificationDialogSymbian* iNotificationDialog;
   176 
   166 
   177     };
   167     };
   178 
   168 
   179 #endif // IAUPDATEBGSOFTNOTIFICATION_H
   169 #endif // IAUPDATEBGSOFTNOTIFICATION_H
   180 
   170