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 |
25 #include <AknDynamicSoftNotifier.h> |
26 #include <hbdevicenotificationdialogsymbian.h> |
|
27 #include "iaupdatebgcheckermode.h" |
26 #include "iaupdatebgcheckermode.h" |
28 |
27 |
|
28 // FORWARD DECLARATION |
|
29 class TAknDynamicSoftNotificationParams; |
|
30 class CIAUpdateBGInternalFileHandler; |
29 |
31 |
30 // FORWARD DECLARATION |
|
31 class MIAUpdateBGSoftNotificationCallBack |
32 class MIAUpdateBGSoftNotificationCallBack |
32 { |
33 { |
33 public: |
34 public: |
34 virtual void SoftNotificationCallBack( TBool aIsAccepted ) = 0; |
35 virtual void SoftNotificationCallBack( TBool aIsAccepted ) = 0; |
35 virtual TIAUpdateBGMode CurrentMode() = 0; |
36 virtual TIAUpdateBGMode CurrentMode() = 0; |
36 }; |
37 }; |
37 |
38 |
38 |
39 |
39 // CLASS DECLARATION |
40 // CLASS DECLARATION |
40 /** |
41 /** |
41 * Controls the background indicator notifications. |
42 * Controls the native soft notifications. |
|
43 * This class delegates method calls to AvKon soft notification. |
42 * |
44 * |
|
45 * @since 3.2 |
43 */ |
46 */ |
44 class CIAUpdateBGSoftNotification : public CBase, |
47 class CIAUpdateBGSoftNotification : public CBase, public MAknDynamicSoftNoteObserver |
45 public MHbDeviceNotificationDialogObserver |
|
46 { |
48 { |
47 public: // Constructors and destructor |
49 public: // Constructors and destructor |
48 |
50 |
49 /** |
51 /** |
50 * Static constructor |
52 * Static constructor |
51 */ |
53 */ |
52 static CIAUpdateBGSoftNotification* NewL( |
54 static CIAUpdateBGSoftNotification* NewL( MIAUpdateBGSoftNotificationCallBack* aCallback, CIAUpdateBGInternalFileHandler* aInternalFile ); |
53 MIAUpdateBGSoftNotificationCallBack* aCallback ); |
|
54 |
55 |
55 /** |
56 /** |
56 * Destructor. |
57 * Destructor. |
57 */ |
58 */ |
58 virtual ~CIAUpdateBGSoftNotification(); |
59 virtual ~CIAUpdateBGSoftNotification(); |
59 |
60 |
|
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 |
60 public: // New functions |
77 public: // New functions |
61 |
78 |
62 /** |
79 void StartObservingIfNeededL(); |
63 * Shows notification and indicator. |
80 |
64 */ |
81 |
65 void ShowNotificationL(); |
82 /** |
66 |
83 * Add a custom soft notification. If a custom soft notification with |
67 /** |
84 * exactly the same parameters already exists, |
68 * Shows indicator. |
85 * its count is increased by aCount. |
69 */ |
86 * |
70 void ShowIndicatorL(); |
87 * @param aNotificationId identifier for this notification |
71 |
88 * @param aCount addition count |
72 /** |
89 */ |
73 * Removes indicator. |
90 void ShowSoftNotificationL(); |
74 */ |
91 |
75 void RemoveIndicatorL(); |
92 /** |
|
93 * Cancels custom soft notification. |
|
94 * |
|
95 * @param aNotificationId identifier for this notification |
|
96 */ |
|
97 void RemoveSoftNotificationL( TInt aNotifierID ); |
76 |
98 |
77 /** |
99 /** |
78 * Set a text for a soft notification. |
100 * Set a text for a soft notification. |
79 * |
101 * |
80 * @param aTitle title for soft notification |
102 * @param aSingularText singular text for soft notification |
81 * @param aText text for soft notification |
103 * @param aPluralText plural text for soft notification |
82 */ |
104 */ |
83 void SetTextL( const TDesC& aTitle, const TDesC& aText ); |
105 void SetTextL( const TDesC& aText, const TDesC& aGroupText ); |
84 |
106 |
85 /** |
107 /** |
86 * Set number of updates a soft notification. |
108 * Set labels for soft notification's softkeys. |
87 * |
109 * |
88 * @param aNrOfUpdates 0 - first time, >< 0 normal case |
110 * @param aSoftkey1Label Label for the softkey 1 |
89 */ |
111 * @param aSoftkey2Label Label for the softkey 2 |
90 void SetNrOfUpdates( const TInt& aNrOfUpdates); |
112 */ |
|
113 void SetSoftkeyLabelsL( const TDesC& aSoftkey1Label, |
|
114 const TDesC& aSoftkey2Label ); |
91 |
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(); |
92 |
129 |
93 private: // Constructors |
130 private: // Constructors |
94 /** |
131 /** |
95 * C++ constructor. |
132 * C++ constructor. |
96 * |
133 * |
97 * @param aCallback notification callback |
134 * @param aAppId View activation application id. |
|
135 * @param aNotificationId Notification id. |
|
136 * @param aEventSource Event source used for posting events from |
|
137 * native to Java side. |
98 */ |
138 */ |
99 CIAUpdateBGSoftNotification( |
139 CIAUpdateBGSoftNotification( MIAUpdateBGSoftNotificationCallBack* aCallback, CIAUpdateBGInternalFileHandler* aInternalFile ); |
100 MIAUpdateBGSoftNotificationCallBack* aCallback); |
|
101 |
140 |
102 /** |
141 /** |
103 * 2nd phase constructor. |
142 * 2nd phase constructor. |
104 */ |
143 */ |
105 void ConstructL(); |
144 void ConstructL(); |
107 private: // New methods |
146 private: // New methods |
108 |
147 |
109 /** |
148 /** |
110 * Set assigned member data to custom notification parameters |
149 * Set assigned member data to custom notification parameters |
111 * |
150 * |
|
151 * @param aParam custom soft notification params to fill |
112 */ |
152 */ |
113 void FillNotificationParams(); |
153 void FillNotificationParams( TAknDynamicSoftNotificationParams& aParam ); |
|
154 |
|
155 private: // Data |
|
156 /// Own. AvKon custom soft notifier |
|
157 CAknDynamicSoftNotifier* iNotifier; |
|
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; |
114 |
172 |
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 |
|
148 private: // Data |
|
149 // Note title |
|
150 HBufC* iTitle; |
|
151 |
|
152 // Note text |
|
153 HBufC* iText; |
|
154 |
|
155 // Notification callback |
|
156 MIAUpdateBGSoftNotificationCallBack* iCallback; |
173 MIAUpdateBGSoftNotificationCallBack* iCallback; |
157 |
174 |
158 // Number of updates |
175 CIAUpdateBGInternalFileHandler* iInternalFile; //not owned |
159 int iNrOfUpdates; |
|
160 |
|
161 // Indictor activation state |
|
162 TBool iActivateIndicator; |
|
163 |
|
164 //Notification dialog |
|
165 CHbDeviceNotificationDialogSymbian* iNotificationDialog; |
|
166 |
176 |
167 }; |
177 }; |
168 |
178 |
169 #endif // IAUPDATEBGSOFTNOTIFICATION_H |
179 #endif // IAUPDATEBGSOFTNOTIFICATION_H |
170 |
180 |