|
1 /* |
|
2 * Copyright (c) 2002 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: ImLauncher plugin implementation |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 // INCLUDE FILES |
|
21 #include "CImLauncherImplementation.h" |
|
22 #include "ChatDebugPrint.h" |
|
23 #include "CCAAudioManager.h" |
|
24 #include "iminternalpskeys.h" |
|
25 |
|
26 #include <e32base.h> |
|
27 #include <AknSoftNotifier.h> |
|
28 |
|
29 #include <e32property.h> |
|
30 |
|
31 #include "impsbuilddefinitions.h" |
|
32 #ifndef RD_30_COMPATIBILITY_MODE |
|
33 #include <coreapplicationuisdomainpskeys.h> |
|
34 #else |
|
35 #include <coreapplicationuisinternalpskeys.h> |
|
36 #endif //RD_30_COMPATIBILITY_MODE |
|
37 |
|
38 |
|
39 // ============================ MEMBER FUNCTIONS =============================== |
|
40 |
|
41 // ----------------------------------------------------------------------------- |
|
42 // CImLauncherImplementation::CImLauncherImplementation |
|
43 // C++ default constructor can NOT contain any code, that |
|
44 // might leave. |
|
45 // ----------------------------------------------------------------------------- |
|
46 // |
|
47 CImLauncherImplementation::CImLauncherImplementation() |
|
48 : iStatus( NULL ), |
|
49 iRequestErr( KErrNone ) |
|
50 { |
|
51 } |
|
52 |
|
53 // ----------------------------------------------------------------------------- |
|
54 // CImLauncherImplementation::ConstructL |
|
55 // Symbian 2nd phase constructor can leave. |
|
56 // ----------------------------------------------------------------------------- |
|
57 // |
|
58 void CImLauncherImplementation::ConstructL() |
|
59 { |
|
60 CHAT_DP_FUNC_ENTER( "ConstructL" ); |
|
61 iConnUI = CIMPSPresenceConnectionUi::NewL( EIMPSConnClientIM ); |
|
62 iAudioManager = CCAAudioManager::NewL( *iConnUI, ETrue ); |
|
63 iAudioManager->AddObserverL( this ); |
|
64 CHAT_DP_FUNC_DONE( "ConstructL" ); |
|
65 } |
|
66 |
|
67 // ----------------------------------------------------------------------------- |
|
68 // CImLauncherImplementation::NewL |
|
69 // Two-phased constructor. |
|
70 // ----------------------------------------------------------------------------- |
|
71 // |
|
72 CImLauncherImplementation* CImLauncherImplementation::NewL() |
|
73 { |
|
74 CImLauncherImplementation* self = new( ELeave ) CImLauncherImplementation; |
|
75 CleanupStack::PushL( self ); |
|
76 self->ConstructL(); |
|
77 CleanupStack::Pop( self ); |
|
78 return self; |
|
79 } |
|
80 |
|
81 |
|
82 // Destructor |
|
83 CImLauncherImplementation::~CImLauncherImplementation() |
|
84 { |
|
85 CHAT_DP_FUNC_ENTER( "~CImLauncherImplementation" ); |
|
86 delete iAudioManager; |
|
87 delete iConnUI; |
|
88 CHAT_DP_FUNC_DONE( "~CImLauncherImplementation" ); |
|
89 } |
|
90 |
|
91 |
|
92 // ----------------------------------------------------------------------------- |
|
93 // CImLauncherImplementation::StartApplicationL( TRequestStatus& aStatus ) |
|
94 // (other items were commented in a header). |
|
95 // ----------------------------------------------------------------------------- |
|
96 // |
|
97 void CImLauncherImplementation::StartApplicationL( TRequestStatus& aStatus, |
|
98 const TDesC& /* aSap */, const TDesC& /*a UserId */ ) |
|
99 { |
|
100 CHAT_DP_FUNC_ENTER( "StartApplicationL" ); |
|
101 iStatus = &aStatus; |
|
102 iRequestErr = KErrNone; |
|
103 |
|
104 // Show IM message indicator |
|
105 SetIMUIPIconL(); |
|
106 |
|
107 // Add unread message count for IM message indicator |
|
108 AddMessageCounterL(); |
|
109 |
|
110 // display soft notification for new chat messages (invitation) |
|
111 TRAP( iRequestErr, ShowSoftNotificationL() ); |
|
112 |
|
113 CHAT_DP( D_CHAT_LIT( "StartApplicationL - softnotifier left with: %d" ), |
|
114 iRequestErr ); |
|
115 |
|
116 if ( iRequestErr ) |
|
117 { |
|
118 CActiveScheduler::Current()->Error( iRequestErr ); |
|
119 } |
|
120 |
|
121 iAudioManager->PlayL(); |
|
122 |
|
123 CHAT_DP_FUNC_DONE( "StartApplicationL" ); |
|
124 } |
|
125 |
|
126 // ----------------------------------------------------------------------------- |
|
127 // CImLauncherImplementation::CancelStartApplication() |
|
128 // (other items were commented in a header). |
|
129 // ----------------------------------------------------------------------------- |
|
130 // |
|
131 void CImLauncherImplementation::CancelStartApplication() |
|
132 { |
|
133 // Do nothing as we don't use the active scheduler |
|
134 } |
|
135 |
|
136 // ----------------------------------------------------------------------------- |
|
137 // CImLauncherImplementation::PlayCompleted() |
|
138 // (other items were commented in a header). |
|
139 // ----------------------------------------------------------------------------- |
|
140 // |
|
141 void CImLauncherImplementation::PlayCompleted() |
|
142 { |
|
143 CHAT_DP_FUNC_ENTER( "PlayCompleted" ); |
|
144 |
|
145 if ( iStatus ) |
|
146 { |
|
147 CHAT_DP_TXT( "PlayCompleted - iStatus good" ); |
|
148 if ( iStatus->Int() == KRequestPending ) |
|
149 { |
|
150 CHAT_DP_TXT( "PlayCompleted - iStatus was KRequestPending, completing request" ); |
|
151 User::RequestComplete( iStatus, iRequestErr ); |
|
152 } |
|
153 } |
|
154 } |
|
155 |
|
156 // ----------------------------------------------------------------------------- |
|
157 // CImLauncherImplementation::SetIMUIPIcon() |
|
158 // (other items were commented in a header). |
|
159 // ----------------------------------------------------------------------------- |
|
160 // |
|
161 void CImLauncherImplementation::SetIMUIPIconL() |
|
162 { |
|
163 CHAT_DP_FUNC_ENTER( "SetIMUIPICon" ); |
|
164 |
|
165 TInt err = RProperty::Set( KPSUidCoreApplicationUIs, KCoreAppUIsUipInd, |
|
166 ECoreAppUIsShow ); |
|
167 |
|
168 if ( err ) |
|
169 { |
|
170 CActiveScheduler::Current()->Error( err ); |
|
171 } |
|
172 CHAT_DP_FUNC_DONE( "SetIMUIPICon" ); |
|
173 } |
|
174 |
|
175 // ----------------------------------------------------------------------------- |
|
176 // CImLauncherImplementation::ShowSoftNotificationL() |
|
177 // (other items were commented in a header). |
|
178 // ----------------------------------------------------------------------------- |
|
179 // |
|
180 void CImLauncherImplementation::ShowSoftNotificationL() |
|
181 { |
|
182 CAknSoftNotifier* softNotifier = CAknSoftNotifier::NewLC(); |
|
183 softNotifier->AddNotificationL( EChatMessageNotification ); |
|
184 CleanupStack::PopAndDestroy( softNotifier ); |
|
185 } |
|
186 |
|
187 // ----------------------------------------------------------------------------- |
|
188 // CImLauncherImplementation::AddMessageCounterL() |
|
189 // (other items were commented in a header). |
|
190 // ----------------------------------------------------------------------------- |
|
191 // |
|
192 void CImLauncherImplementation::AddMessageCounterL() |
|
193 { |
|
194 // Update unread message count to PS |
|
195 // Value is used by the ImIndicatorPlugin |
|
196 TInt err = RProperty::Define( |
|
197 KPSUidIMUI, KIMUnreadMsgKey, RProperty::EInt, |
|
198 KIMUnreadMsgReadPolicy, KIMUnreadMsgWritePolicy ); |
|
199 TInt value; |
|
200 err = RProperty::Get( KPSUidIMUI, KIMUnreadMsgKey, value ); |
|
201 if ( err == KErrNone ) |
|
202 { |
|
203 err = RProperty::Set( KPSUidIMUI, KIMUnreadMsgKey, ++value ); |
|
204 } |
|
205 } |
|
206 |
|
207 // End of File |