|
1 /* |
|
2 * Copyright (c) 2005 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: The MUS application's UI class. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #include "musuiinvitationquery.h" |
|
20 #include "musuiinvitationqueryobserver.h" |
|
21 #include "musuidefinitions.h" |
|
22 #include "musuiactivetimer.h" |
|
23 #include "muslogger.h" |
|
24 #include "musunittesting.h" |
|
25 |
|
26 #include <AknGlobalConfirmationQuery.h> |
|
27 #include <avkon.rsg> |
|
28 #include <musui.rsg> |
|
29 #include <StringLoader.h> |
|
30 |
|
31 |
|
32 // ----------------------------------------------------------------------------- |
|
33 // Two phase constructor |
|
34 // ----------------------------------------------------------------------------- |
|
35 // |
|
36 CMusUiInvitationQuery* CMusUiInvitationQuery::NewL( |
|
37 MMusUiInvitationQueryObserver& aView ) |
|
38 { |
|
39 CMusUiInvitationQuery* self |
|
40 = new( ELeave ) CMusUiInvitationQuery( aView ); |
|
41 |
|
42 CleanupStack::PushL( self ); |
|
43 self->ConstructL(); |
|
44 CleanupStack::Pop( self ); |
|
45 |
|
46 return self; |
|
47 } |
|
48 |
|
49 |
|
50 // ----------------------------------------------------------------------------- |
|
51 // Destructor |
|
52 // ----------------------------------------------------------------------------- |
|
53 // |
|
54 CMusUiInvitationQuery::~CMusUiInvitationQuery() |
|
55 { |
|
56 MUS_LOG( "mus: [MUSUI ] -> CMusUiInvitationQuery::~CMusUiInvitationQuery" ); |
|
57 |
|
58 delete iGlobalQuery; |
|
59 delete iPrompt; |
|
60 |
|
61 delete iActiveTimer; |
|
62 |
|
63 MUS_LOG( "mus: [MUSUI ] <- CMusUiInvitationQuery::~CMusUiInvitationQuery" ); |
|
64 } |
|
65 |
|
66 |
|
67 // ----------------------------------------------------------------------------- |
|
68 // Constructor |
|
69 // ----------------------------------------------------------------------------- |
|
70 // |
|
71 CMusUiInvitationQuery::CMusUiInvitationQuery( MMusUiInvitationQueryObserver& aView ) |
|
72 : CActive( EPriorityNormal ), iObserver( aView ) |
|
73 { |
|
74 CActiveScheduler::Add( this ); |
|
75 } |
|
76 |
|
77 |
|
78 // ----------------------------------------------------------------------------- |
|
79 // Second phase constructor |
|
80 // ----------------------------------------------------------------------------- |
|
81 // |
|
82 void CMusUiInvitationQuery::ConstructL() |
|
83 { |
|
84 MUS_LOG( "mus: [MUSUI ] -> CMusUiInvitationQuery::ConstructL" ); |
|
85 |
|
86 iGlobalQuery = CAknGlobalConfirmationQuery::NewL(); |
|
87 iPrompt = NULL; |
|
88 |
|
89 iActiveTimer = CMusUiActiveTimer::NewL( this ); |
|
90 |
|
91 MUS_LOG( "mus: [MUSUI ] <- CMusUiInvitationQuery::ConstructL" ); |
|
92 } |
|
93 |
|
94 |
|
95 // ----------------------------------------------------------------------------- |
|
96 // Shows the confirmation query dialog |
|
97 // ----------------------------------------------------------------------------- |
|
98 // |
|
99 void CMusUiInvitationQuery::ShowL( const TDesC& aContact ) |
|
100 { |
|
101 MUS_LOG( "mus: [MUSUI ] -> CMusUiInvitationQuery::ShowL" ); |
|
102 if ( iPrompt ) |
|
103 { |
|
104 delete iPrompt; |
|
105 iPrompt = NULL; |
|
106 } |
|
107 |
|
108 iPrompt = StringLoader::LoadL( |
|
109 R_MUS_RECEIVE_VIEW_NOTE_INCOMING_VIDEO_REQUEST, |
|
110 aContact ); |
|
111 if ( iActiveTimer->IsActive() ) |
|
112 { |
|
113 // If Timer is active already , dont know what to do |
|
114 // It might mean a invitation ongoing. |
|
115 } |
|
116 else |
|
117 { |
|
118 iActiveTimer->After( KMusInviteExpireTimeout * KMusOneSecond ); |
|
119 iGlobalQuery->ShowConfirmationQueryL( |
|
120 iStatus, |
|
121 *iPrompt, |
|
122 R_AVKON_SOFTKEYS_YES_NO ); |
|
123 SetActive(); |
|
124 } |
|
125 |
|
126 MUS_LOG( "mus: [MUSUI ] <- CMusUiInvitationQuery::ShowL" ); |
|
127 } |
|
128 |
|
129 |
|
130 // ----------------------------------------------------------------------------- |
|
131 // Timer Expiry event. |
|
132 // ----------------------------------------------------------------------------- |
|
133 // |
|
134 void CMusUiInvitationQuery::TimerComplete( CMusUiActiveTimer* /*aTimer*/ ) |
|
135 { |
|
136 Cancel(); |
|
137 TRAP_IGNORE( iObserver.InvitationRejectedL() ); |
|
138 } |
|
139 |
|
140 |
|
141 // ----------------------------------------------------------------------------- |
|
142 // CActive RunL implementation. |
|
143 // ----------------------------------------------------------------------------- |
|
144 // |
|
145 void CMusUiInvitationQuery::RunL() |
|
146 { |
|
147 MUS_LOG1( "mus: [MUSUI ] -> CMusUiInvitationQuery::RunL [%d]", iStatus.Int() ); |
|
148 iActiveTimer->Cancel(); |
|
149 if ( iStatus == EAknSoftkeyYes ) |
|
150 { |
|
151 MUS_LOG( "mus: [MUSUI ] CMusUiInvitationQuery::RunL: if" ); |
|
152 iObserver.InvitationAcceptedL(); |
|
153 } |
|
154 else // EAknSoftkeyNo |
|
155 { |
|
156 MUS_LOG( "mus: [MUSUI ] CMusUiInvitationQuery::RunL: else" ); |
|
157 iObserver.InvitationRejectedL(); |
|
158 } |
|
159 Cancel(); |
|
160 MUS_LOG( "mus: [MUSUI ] <- CMusUiInvitationQuery::RunL" ); |
|
161 } |
|
162 |
|
163 |
|
164 // ----------------------------------------------------------------------------- |
|
165 // Cancel() will call this |
|
166 // ----------------------------------------------------------------------------- |
|
167 // |
|
168 void CMusUiInvitationQuery::DoCancel() |
|
169 { |
|
170 MUS_LOG( "mus: [MUSUI ] -> CMusUiInvitationQuery::DoCancel" ); |
|
171 iGlobalQuery->CancelConfirmationQuery(); |
|
172 MUS_LOG( "mus: [MUSUI ] <- CMusUiInvitationQuery::DoCancel" ); |
|
173 } |
|
174 |
|
175 |
|
176 // ----------------------------------------------------------------------------- |
|
177 // If RunL() leaves should be handled here. |
|
178 // ----------------------------------------------------------------------------- |
|
179 // |
|
180 TInt CMusUiInvitationQuery::RunError( TInt aError ) |
|
181 { |
|
182 MUS_LOG1( "mus: [MUSUI ] -> CMusUiInvitationQuery::RunError [%d]", aError ); |
|
183 |
|
184 // Handle the error fully here. No cleanup needed in this case. |
|
185 // default active scheduler will panic by calling Error() if |
|
186 // it not handled here. so return KErrNone. |
|
187 aError = KErrNone; |
|
188 |
|
189 return aError; |
|
190 } |
|
191 |
|
192 |
|
193 // end of file |