|
1 /* |
|
2 * Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: Parameter container class for dynamic soft notifications |
|
15 * |
|
16 */ |
|
17 |
|
18 #ifdef SYMBIAN_ENABLE_SPLIT_HEADERS |
|
19 #include <vwsdefpartner.h> |
|
20 #endif |
|
21 #include "AknDynamicSoftNotificationParams.h" |
|
22 |
|
23 /// Maximum allowed priority for dynamic soft notification |
|
24 const TInt KMaxAllowedPriority = 3000; |
|
25 /// Minimum allowed priority for dynamic soft notification |
|
26 const TInt KMinAllowedPriority = 1000; |
|
27 |
|
28 //----------------------------------------------------------------------------- |
|
29 // TAknDynamicSoftNotificationParams::TAknDynamicSoftNotificationParams |
|
30 //----------------------------------------------------------------------------- |
|
31 // |
|
32 EXPORT_C TAknDynamicSoftNotificationParams::TAknDynamicSoftNotificationParams( |
|
33 TInt aPriority, |
|
34 CAknNoteDialog::TTone aTone ) : // = CAknNoteDialog::ENoTone |
|
35 iPriority( aPriority ), |
|
36 iTone( aTone ), |
|
37 // default values |
|
38 iCustomMessageId( KNullUid ), |
|
39 iEnableObserver( EFalse ) |
|
40 { |
|
41 __ASSERT_ALWAYS( aPriority >= KMinAllowedPriority && |
|
42 aPriority <= KMaxAllowedPriority, User::Invariant() ); |
|
43 } |
|
44 |
|
45 //----------------------------------------------------------------------------- |
|
46 // TAknDynamicSoftNotificationParams::SetViewActivationParams |
|
47 //----------------------------------------------------------------------------- |
|
48 // |
|
49 EXPORT_C void TAknDynamicSoftNotificationParams::SetViewActivationParams( |
|
50 TVwsViewId aViewId, |
|
51 TVwsViewId aPluralViewId, // = KNullViewId |
|
52 TUid aCustomMsgId, // = KNullUid |
|
53 const TDesC8& aCustomMsg ) // = KNullDesC8 |
|
54 { |
|
55 iViewId = aViewId; |
|
56 iPluralViewId = aPluralViewId; |
|
57 iCustomMessageId = aCustomMsgId; |
|
58 iCustomMessage.Set( aCustomMsg ); |
|
59 } |
|
60 |
|
61 //----------------------------------------------------------------------------- |
|
62 // TAknDynamicSoftNotificationParams::SetSoftkeys |
|
63 //----------------------------------------------------------------------------- |
|
64 // |
|
65 EXPORT_C void TAknDynamicSoftNotificationParams::SetSoftkeys( |
|
66 const TDesC& aLeftSoftkey, |
|
67 const TDesC& aRightSoftkey ) |
|
68 { |
|
69 iLeftSoftkey.Set( aLeftSoftkey ); |
|
70 iRightSoftkey.Set( aRightSoftkey ); |
|
71 } |
|
72 |
|
73 //----------------------------------------------------------------------------- |
|
74 // TAknDynamicSoftNotificationParams::SetNoteLabels |
|
75 //----------------------------------------------------------------------------- |
|
76 // |
|
77 EXPORT_C void TAknDynamicSoftNotificationParams::SetNoteLabels( |
|
78 const TDesC& aSingularLabel, |
|
79 const TDesC& aPluralLabel ) |
|
80 { |
|
81 iNoteSingularLabel.Set( aSingularLabel ); |
|
82 iNotePluralLabel.Set( aPluralLabel ); |
|
83 } |
|
84 |
|
85 //----------------------------------------------------------------------------- |
|
86 // TAknDynamicSoftNotificationParams::SetImageData |
|
87 //----------------------------------------------------------------------------- |
|
88 // |
|
89 EXPORT_C void TAknDynamicSoftNotificationParams::SetGroupLabels( |
|
90 const TDesC& aSingularLabel, |
|
91 const TDesC& aPluralLabel ) |
|
92 { |
|
93 iGroupSingularLabel.Set( aSingularLabel ); |
|
94 iGroupPluralLabel.Set( aPluralLabel ); |
|
95 } |
|
96 |
|
97 //----------------------------------------------------------------------------- |
|
98 // TAknDynamicSoftNotificationParams::SetImageData |
|
99 //----------------------------------------------------------------------------- |
|
100 // |
|
101 EXPORT_C void TAknDynamicSoftNotificationParams::SetImageData( |
|
102 const TDesC8& aImageData ) |
|
103 { |
|
104 iImageData.Set( aImageData ); |
|
105 } |
|
106 |
|
107 //----------------------------------------------------------------------------- |
|
108 // TAknDynamicSoftNotificationParams::EnableObserver |
|
109 //----------------------------------------------------------------------------- |
|
110 // |
|
111 EXPORT_C void TAknDynamicSoftNotificationParams::EnableObserver() |
|
112 { |
|
113 iEnableObserver = ETrue; |
|
114 } |
|
115 |
|
116 //----------------------------------------------------------------------------- |
|
117 // TAknDynamicSoftNotificationParams::ExternalizeL |
|
118 //----------------------------------------------------------------------------- |
|
119 // |
|
120 void TAknDynamicSoftNotificationParams::ExternalizeL( |
|
121 RWriteStream& aStream ) const |
|
122 { |
|
123 aStream.WriteInt32L( iPriority ); |
|
124 aStream.WriteInt32L( iTone ); |
|
125 |
|
126 // view activation data |
|
127 aStream.WriteUint32L( iViewId.iAppUid.iUid ); |
|
128 aStream.WriteUint32L( iViewId.iViewUid.iUid ); |
|
129 aStream.WriteUint32L( iPluralViewId.iAppUid.iUid ); |
|
130 aStream.WriteUint32L( iPluralViewId.iViewUid.iUid ); |
|
131 |
|
132 if( iViewId != KNullViewId ) |
|
133 { |
|
134 aStream.WriteInt32L( iCustomMessageId.iUid ); |
|
135 ExternalizeTextL( aStream, iCustomMessage ); |
|
136 } |
|
137 else |
|
138 { |
|
139 aStream.WriteInt32L( KErrNotFound ); |
|
140 } |
|
141 |
|
142 // softkeys |
|
143 ExternalizeTextL( aStream, iLeftSoftkey ); |
|
144 ExternalizeTextL( aStream, iRightSoftkey ); |
|
145 |
|
146 // text labels |
|
147 ExternalizeTextL( aStream, iNoteSingularLabel ); |
|
148 ExternalizeTextL( aStream, iNotePluralLabel ); |
|
149 ExternalizeTextL( aStream, iGroupSingularLabel ); |
|
150 ExternalizeTextL( aStream, iGroupPluralLabel ); |
|
151 |
|
152 aStream.WriteUint8L( iEnableObserver ? ETrue : EFalse ); |
|
153 |
|
154 // image |
|
155 ExternalizeTextL( aStream, iImageData ); |
|
156 } |
|
157 |
|
158 //----------------------------------------------------------------------------- |
|
159 // TAknDynamicSoftNotificationParams::ExternalizeTextL |
|
160 //----------------------------------------------------------------------------- |
|
161 // |
|
162 void TAknDynamicSoftNotificationParams::ExternalizeTextL( |
|
163 RWriteStream& aStream, |
|
164 const TDesC16& aText ) const |
|
165 { |
|
166 TInt length = aText.Length(); |
|
167 if( length > 0 ) |
|
168 { |
|
169 aStream.WriteInt32L( aText.Length() ); |
|
170 aStream << aText; |
|
171 } |
|
172 else |
|
173 { |
|
174 aStream.WriteInt32L( KErrNotFound ); |
|
175 } |
|
176 } |
|
177 |
|
178 //----------------------------------------------------------------------------- |
|
179 // TAknDynamicSoftNotificationParams::ExternalizeTextL |
|
180 //----------------------------------------------------------------------------- |
|
181 // |
|
182 void TAknDynamicSoftNotificationParams::ExternalizeTextL( |
|
183 RWriteStream& aStream, |
|
184 const TDesC8& aText ) const |
|
185 { |
|
186 TInt length = aText.Length(); |
|
187 if( length > 0 ) |
|
188 { |
|
189 aStream.WriteInt32L( aText.Length() ); |
|
190 aStream << aText; |
|
191 } |
|
192 else |
|
193 { |
|
194 aStream.WriteInt32L( KErrNotFound ); |
|
195 } |
|
196 } |
|
197 |
|
198 // End of File |