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 * @param aNrOfUpdates number of updates |
83 * Add a custom soft notification. If a custom soft notification with |
66 */ |
84 * exactly the same parameters already exists, |
67 void ShowNotificationL(); |
85 * its count is increased by aCount. |
68 |
86 * |
69 /** |
87 * @param aNotificationId identifier for this notification |
70 * Shows indicator. |
88 * @param aCount addition count |
71 * |
89 */ |
72 * @param aMode indicator mode (EFirstTimeMode / ENormalMode) |
90 void ShowSoftNotificationL(); |
73 */ |
91 |
74 void ShowIndicatorL(); |
92 /** |
75 |
93 * Cancels custom soft notification. |
76 /** |
94 * |
77 * Removes indicator. |
95 * @param aNotificationId identifier for this notification |
78 * |
96 */ |
79 * @param aNrOfUpdates number of updates |
97 void RemoveSoftNotificationL( TInt aNotifierID ); |
80 */ |
|
81 void RemoveIndicatorL(); |
98 |
82 |
99 /** |
83 /** |
100 * Set a text for a soft notification. |
84 * Set a text for a soft notification. |
101 * |
85 * |
102 * @param aSingularText singular text for soft notification |
86 * @param aTitle title for soft notification |
103 * @param aPluralText plural text for soft notification |
87 * @param aText text for soft notification |
104 */ |
88 */ |
105 void SetTextL( const TDesC& aText, const TDesC& aGroupText ); |
89 void SetTextL( const TDesC& aTitle, const TDesC& aText ); |
106 |
90 |
107 /** |
91 /** |
108 * Set labels for soft notification's softkeys. |
92 * Set an image path for a soft notification. |
109 * |
93 * |
110 * @param aSoftkey1Label Label for the softkey 1 |
94 * @param aImage image path for soft notification |
111 * @param aSoftkey2Label Label for the softkey 2 |
95 */ |
112 */ |
96 void SetImagePathL( const TDesC& aImage ); |
113 void SetSoftkeyLabelsL( const TDesC& aSoftkey1Label, |
97 |
114 const TDesC& aSoftkey2Label ); |
98 /** |
|
99 * Set number of updates a soft notification. |
|
100 * |
|
101 * @param aNrOfUpdates 0 - first time, >< 0 normal case |
|
102 */ |
|
103 void SetNrOfUpdates( const TInt& aNrOfUpdates); |
115 |
104 |
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 |
105 |
130 private: // Constructors |
106 private: // Constructors |
131 /** |
107 /** |
132 * C++ constructor. |
108 * C++ constructor. |
133 * |
109 * |
134 * @param aAppId View activation application id. |
110 * @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 */ |
111 */ |
139 CIAUpdateBGSoftNotification( MIAUpdateBGSoftNotificationCallBack* aCallback, CIAUpdateBGInternalFileHandler* aInternalFile ); |
112 CIAUpdateBGSoftNotification( |
|
113 MIAUpdateBGSoftNotificationCallBack* aCallback); |
140 |
114 |
141 /** |
115 /** |
142 * 2nd phase constructor. |
116 * 2nd phase constructor. |
143 */ |
117 */ |
144 void ConstructL(); |
118 void ConstructL(); |
146 private: // New methods |
120 private: // New methods |
147 |
121 |
148 /** |
122 /** |
149 * Set assigned member data to custom notification parameters |
123 * Set assigned member data to custom notification parameters |
150 * |
124 * |
151 * @param aParam custom soft notification params to fill |
|
152 */ |
125 */ |
153 void FillNotificationParams( TAknDynamicSoftNotificationParams& aParam ); |
126 void FillNotificationParams(); |
154 |
127 |
|
128 /** |
|
129 * Notification dialog activationobserver |
|
130 * |
|
131 * @param aDialog notification dialog |
|
132 */ |
|
133 virtual void NotificationDialogActivated( |
|
134 const CHbDeviceNotificationDialogSymbian* aDialog ); |
|
135 /** |
|
136 * Notification dialog activationobserver |
|
137 * |
|
138 * @param aDialog notification dialog |
|
139 * @param aCompletionCode completion code |
|
140 */ |
|
141 virtual void NotificationDialogClosed( |
|
142 const CHbDeviceNotificationDialogSymbian* aDialog, |
|
143 TInt aCompletionCode ); |
|
144 |
|
145 /** |
|
146 * Enable/disable indicator |
|
147 * |
|
148 * @param aEnabled ETrue-enabled, EFalse-disabled |
|
149 */ |
|
150 void SetIndicatorEnabled(TBool aEnabled); |
|
151 |
|
152 /** |
|
153 * Get indicator enablation state |
|
154 * |
|
155 * @return aEnabled ETrue-enabled, EFalse-disabled |
|
156 */ |
|
157 TBool IsIndicatorEnabled(); |
|
158 |
|
159 /** |
|
160 * Set number of updates |
|
161 * |
|
162 * @param aNrOfUpdates number of updates |
|
163 */ |
|
164 // void SetNrOfUpdates( const int aNrOfUpdates ); |
|
165 |
|
166 /** |
|
167 * Get number of updates |
|
168 * |
|
169 * @return number of updates |
|
170 */ |
|
171 int GetNrOfUpdates(); |
|
172 |
155 private: // Data |
173 private: // Data |
156 /// Own. AvKon custom soft notifier |
174 // Note title |
157 CAknDynamicSoftNotifier* iNotifier; |
175 HBufC* iTitle; |
158 /// View activation application id |
176 // Note text |
159 TUid iAppId; |
177 HBufC* iText; |
160 /// Notification Id |
178 /// Image data byte array |
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; |
179 HBufC8* iImageData; |
172 |
180 // Notification callback |
173 MIAUpdateBGSoftNotificationCallBack* iCallback; |
181 MIAUpdateBGSoftNotificationCallBack* iCallback; |
174 |
182 // Image path |
175 CIAUpdateBGInternalFileHandler* iInternalFile; //not owned |
183 HBufC* iImagePath; |
|
184 // Number of updates |
|
185 int iNrOfUpdates; |
|
186 // Indictor activation state |
|
187 TBool iActivateIndicator; |
|
188 //Notification dialog |
|
189 CHbDeviceNotificationDialogSymbian* iNotificationDialog; |
176 |
190 |
177 }; |
191 }; |
178 |
192 |
179 #endif // IAUPDATEBGSOFTNOTIFICATION_H |
193 #endif // IAUPDATEBGSOFTNOTIFICATION_H |
180 |
194 |