72
|
1 |
/*******************************************************************************
|
|
2 |
* Copyright (c) 2009, 2010 Nokia Corporation and/or its subsidiary(-ies).
|
|
3 |
* All rights reserved. This program and the accompanying materials
|
|
4 |
* are made available under the terms of the Eclipse Public License v1.0
|
|
5 |
* which accompanies this distribution, and is available at
|
|
6 |
* http://www.eclipse.org/legal/epl-v10.html
|
|
7 |
*
|
|
8 |
* Contributors:
|
|
9 |
* Nokia Corporation - initial implementation
|
|
10 |
*******************************************************************************/
|
|
11 |
|
|
12 |
#ifndef CSOFTNOTIFICATION_H
|
|
13 |
#define CSOFTNOTIFICATION_H
|
|
14 |
|
|
15 |
#include <e32base.h>
|
|
16 |
#include <jni.h>
|
87
|
17 |
#include <hbindicatorsymbian.h>
|
78
|
18 |
#include <HbDeviceNotificationDialogsymbian.h>
|
72
|
19 |
|
|
20 |
NONSHARABLE_CLASS(CSoftNotification) : public CBase,
|
78
|
21 |
MHbIndicatorSymbianObserver, MHbDeviceNotificationDialogObserver
|
72
|
22 |
{
|
|
23 |
public:
|
|
24 |
|
|
25 |
/**
|
|
26 |
* Static constructor
|
|
27 |
*/
|
|
28 |
static CSoftNotification* NewL(TInt aAppId, TInt aNotificationId);
|
|
29 |
|
|
30 |
/**
|
|
31 |
* Destructor.
|
|
32 |
*/
|
|
33 |
virtual ~CSoftNotification();
|
|
34 |
|
|
35 |
public:
|
|
36 |
// From MHbIndicatorSymbianObserver
|
|
37 |
|
|
38 |
/**
|
|
39 |
* Dynamic soft notification was activated by user.
|
|
40 |
*/
|
|
41 |
void IndicatorUserActivated(const TDesC &aType,
|
|
42 |
CHbSymbianVariantMap &aData);
|
78
|
43 |
|
|
44 |
/**
|
|
45 |
* Notification dialog is touched by the user.
|
|
46 |
*
|
|
47 |
* @param aDialog Notification dialog
|
|
48 |
*/
|
|
49 |
void NotificationDialogActivated(const CHbDeviceNotificationDialogSymbian* aDialog);
|
|
50 |
|
|
51 |
/**
|
|
52 |
* Notification dialog is closed.
|
|
53 |
*
|
|
54 |
* @param aDialog Notification dialog
|
|
55 |
* @param aCompletionCode Notification dialog completion code
|
|
56 |
*/
|
|
57 |
void NotificationDialogClosed(const CHbDeviceNotificationDialogSymbian* aDialog, TInt aCompletionCode);
|
72
|
58 |
|
|
59 |
public:
|
|
60 |
// New functions
|
|
61 |
|
|
62 |
/**
|
|
63 |
* Add a custom soft notification.
|
|
64 |
*/
|
|
65 |
bool ShowSoftNotificationL();
|
|
66 |
|
|
67 |
/**
|
|
68 |
* Cancels custom soft notification.
|
|
69 |
*/
|
|
70 |
void RemoveSoftNotificationL();
|
|
71 |
|
|
72 |
/**
|
|
73 |
* Set a text for a soft notification.
|
|
74 |
*
|
|
75 |
* @param aSingularText singular text for soft notification
|
|
76 |
* @param aPluralText plural text for soft notification
|
|
77 |
*/
|
|
78 |
void SetTextL(const TDesC& aPrimaryText, const TDesC& aSecondaryText);
|
|
79 |
|
|
80 |
/**
|
|
81 |
* Set an image path for a soft notification.
|
|
82 |
*
|
|
83 |
* @param aImagePath image path for soft notification
|
|
84 |
*/
|
|
85 |
void SetImagePathL(const TDesC& aImagePath);
|
|
86 |
|
|
87 |
/**
|
|
88 |
* Returns the notification id.
|
|
89 |
*
|
|
90 |
* @return notification id
|
|
91 |
*/
|
|
92 |
TInt Id();
|
|
93 |
|
|
94 |
/**
|
|
95 |
* Set Java peer observer instance for event callbacks.
|
|
96 |
* Note: the observer has to be a global weak reference.
|
|
97 |
*
|
|
98 |
* @param aPeer Java peer observer
|
|
99 |
* @param aMethodId Callback method identifier.
|
|
100 |
* @param aJniEnv JNI environment
|
|
101 |
*/
|
|
102 |
void SetPeerObserver(jobject aPeer, jmethodID aMethodId, JNIEnv* aJniEnv);
|
|
103 |
|
|
104 |
private:
|
|
105 |
// Constructors
|
|
106 |
/**
|
|
107 |
* C++ constructor.
|
|
108 |
*
|
|
109 |
* @param aAppId View activation application id.
|
|
110 |
* @param aNotificationId Notification id.
|
|
111 |
*/
|
|
112 |
CSoftNotification(TInt aAppId, TInt aNotificationId);
|
|
113 |
|
|
114 |
/**
|
|
115 |
* 2nd phase constructor.
|
|
116 |
*/
|
|
117 |
void ConstructL();
|
|
118 |
|
|
119 |
private:
|
|
120 |
// New methods
|
|
121 |
|
|
122 |
/**
|
|
123 |
* Set assigned member data to custom notification parameters
|
|
124 |
*
|
78
|
125 |
* @return aParam custom soft notification params to fill
|
72
|
126 |
*/
|
|
127 |
CHbSymbianVariant* NotificationParamsL();
|
78
|
128 |
|
|
129 |
/**
|
|
130 |
* Storing softnotification to database
|
|
131 |
*/
|
|
132 |
void AddorUpdateSoftNotificationToStorage();
|
72
|
133 |
|
|
134 |
private:
|
|
135 |
// Data
|
|
136 |
|
|
137 |
CHbIndicatorSymbian* iIndicator;
|
78
|
138 |
CHbDeviceNotificationDialogSymbian* iNotificationDialog;
|
72
|
139 |
TUid iMidletId;
|
|
140 |
TInt iNotificationId;
|
|
141 |
HBufC* iPrimaryText;
|
|
142 |
HBufC* iSecondaryText;
|
|
143 |
HBufC* iImagePath;
|
|
144 |
jobject iPeer;
|
|
145 |
jmethodID iMethodId;
|
|
146 |
JNIEnv* iJniEnv;
|
78
|
147 |
bool iIsNoteExist;
|
72
|
148 |
};
|
|
149 |
|
|
150 |
#endif // CSOFTNOTIFICATION_H
|
|
151 |
|