|
1 /* |
|
2 * Copyright (c) 2002-2007 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: |
|
15 * |
|
16 */ |
|
17 |
|
18 #include "AknGlobalMsgQuery.h" |
|
19 #include <AknNotifyStd.h> |
|
20 #include <AknPanic.h> |
|
21 #include <AknNotifySignature.h> |
|
22 #include <aknSDData.h> |
|
23 #include <s32mem.h> |
|
24 |
|
25 const TInt KBufferGranularity = 128; |
|
26 |
|
27 EXPORT_C CAknGlobalMsgQuery* CAknGlobalMsgQuery::NewL() |
|
28 { |
|
29 CAknGlobalMsgQuery* self = NewLC(); |
|
30 CleanupStack::Pop(); // self |
|
31 return self; |
|
32 } |
|
33 |
|
34 EXPORT_C CAknGlobalMsgQuery* CAknGlobalMsgQuery::NewLC() |
|
35 { |
|
36 CAknGlobalMsgQuery* self = new(ELeave) CAknGlobalMsgQuery; |
|
37 CleanupStack::PushL(self); |
|
38 self->ConstructL(); |
|
39 return self; |
|
40 } |
|
41 |
|
42 EXPORT_C CAknGlobalMsgQuery::~CAknGlobalMsgQuery() |
|
43 { |
|
44 CancelMsgQuery(); |
|
45 iNotify.Close(); |
|
46 delete iBuffer; |
|
47 delete iAknSDData; |
|
48 } |
|
49 |
|
50 EXPORT_C void CAknGlobalMsgQuery::ShowMsgQueryL( |
|
51 TRequestStatus& aStatus, |
|
52 const TDesC& aMsgText, |
|
53 TInt aSoftkeys, |
|
54 const TDesC& aHeaderText, |
|
55 const TDesC& aHeaderImageFile, |
|
56 TInt aImageId, |
|
57 TInt aImageMaskId, |
|
58 CAknQueryDialog::TTone aTone ) |
|
59 { |
|
60 delete iBuffer; |
|
61 iBuffer = NULL; |
|
62 iBuffer = CBufFlat::NewL(KBufferGranularity); |
|
63 |
|
64 RBufWriteStream bufStream; |
|
65 bufStream.Open(*iBuffer); |
|
66 |
|
67 CleanupClosePushL(bufStream); |
|
68 |
|
69 bufStream.WriteInt32L(KAKNNOTIFIERSIGNATURE); |
|
70 |
|
71 bufStream.WriteInt32L(aSoftkeys); |
|
72 bufStream.WriteInt16L(aImageId); |
|
73 bufStream.WriteInt16L(aImageMaskId); |
|
74 bufStream.WriteInt16L(aTone); |
|
75 bufStream.WriteInt16L(aMsgText.Length()); |
|
76 bufStream << aMsgText; |
|
77 bufStream.WriteInt16L(aHeaderText.Length()); |
|
78 bufStream << aHeaderText; |
|
79 bufStream.WriteInt16L(aHeaderImageFile.Length()); |
|
80 if (aHeaderImageFile.Length()) |
|
81 { |
|
82 bufStream << aHeaderImageFile; |
|
83 } |
|
84 bufStream.WriteInt32L(iDelay); |
|
85 |
|
86 bufStream.WriteInt32L(iSkinsMajorId); |
|
87 bufStream.WriteInt32L(iSkinsMinorId); |
|
88 |
|
89 if (iAknSDData) |
|
90 { |
|
91 bufStream.WriteInt8L(ETrue); |
|
92 bufStream << *iAknSDData; |
|
93 } |
|
94 else |
|
95 { |
|
96 bufStream.WriteInt8L(EFalse); |
|
97 } |
|
98 |
|
99 iBufferPtr.Set(iBuffer->Ptr(0)); |
|
100 iNotify.StartNotifierAndGetResponse(aStatus, KAknGlobalMsgQueryUid, |
|
101 iBufferPtr, iResultBuf); |
|
102 |
|
103 CleanupStack::PopAndDestroy(); // bufStream |
|
104 } |
|
105 |
|
106 EXPORT_C void CAknGlobalMsgQuery::UpdateMsgQuery( TInt aSoftkeys ) |
|
107 { |
|
108 iSoftkeys = aSoftkeys; |
|
109 iCmd = EAknUpdateGlobalQuery; |
|
110 TPckgBuf<SAknNotifierPackage<SAknGlobalMsgQueryParams> > pckg; |
|
111 pckg().iParamData.iCmd = iCmd; |
|
112 pckg().iParamData.iSoftkeys = iSoftkeys; |
|
113 |
|
114 TPckgBuf<TInt> ret; |
|
115 iNotify.UpdateNotifier( KAknGlobalMsgQueryUid, pckg, ret); |
|
116 } |
|
117 |
|
118 |
|
119 EXPORT_C void CAknGlobalMsgQuery::CancelMsgQuery() |
|
120 { |
|
121 if (iBuffer) |
|
122 { |
|
123 iNotify.CancelNotifier(KAknGlobalMsgQueryUid); |
|
124 delete iBuffer; |
|
125 iBuffer = 0; |
|
126 } |
|
127 } |
|
128 |
|
129 |
|
130 EXPORT_C void CAknGlobalMsgQuery::SetExitDelay(TInt aDelay) |
|
131 { |
|
132 iDelay = aDelay; // basicallyt this method could be inline |
|
133 } |
|
134 |
|
135 |
|
136 CAknGlobalMsgQuery::CAknGlobalMsgQuery() |
|
137 { |
|
138 } |
|
139 |
|
140 void CAknGlobalMsgQuery::ConstructL() |
|
141 { |
|
142 User::LeaveIfError(iNotify.Connect()); |
|
143 } |
|
144 |
|
145 EXPORT_C void CAknGlobalMsgQuery::SetImageSkinId( TAknsItemID& aId ) |
|
146 { |
|
147 iSkinsMajorId = aId.iMajor; |
|
148 iSkinsMinorId = aId.iMinor; |
|
149 } |
|
150 |
|
151 EXPORT_C void CAknGlobalMsgQuery::SetSecondaryDisplayData(CAknSDData* aData) |
|
152 { |
|
153 delete iAknSDData; |
|
154 iAknSDData = aData; |
|
155 } |
|
156 |
|
157 // End of File |