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: Implementation for RProperty where conversation view event handled. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 // INCLUDE FILES |
|
20 |
|
21 #include "cvimpstuicveventlistener.h" |
|
22 #include "cvimpstuitabbedview.h" |
|
23 #include "imcvuiliterals.h" |
|
24 #include "vimpstui.hrh" |
|
25 #include "uiservicetabtracer.h" |
|
26 |
|
27 //system includes |
|
28 #include <avkon.hrh> |
|
29 |
|
30 // ================= MEMBER FUNCTIONS ======================= |
|
31 |
|
32 // -------------------------------------------------------------------------- |
|
33 // CVIMPSTUiSearchView::CVIMPSTUiSearchView |
|
34 // -------------------------------------------------------------------------- |
|
35 // |
|
36 CVIMPSTUICvEventListener::CVIMPSTUICvEventListener( CVIMPSTUiTabbedView& aTabbedView ) |
|
37 : CActive( CActive::EPriorityStandard ), |
|
38 iTabbedView( aTabbedView ) |
|
39 { |
|
40 CActiveScheduler::Add( this ); |
|
41 } |
|
42 |
|
43 // -------------------------------------------------------------------------- |
|
44 // CVIMPSTUICvEventListener::ConstructL |
|
45 // -------------------------------------------------------------------------- |
|
46 // |
|
47 void CVIMPSTUICvEventListener::ConstructL() |
|
48 { |
|
49 TRACER_AUTO; |
|
50 RProperty::Define(KIMCVPropertyUid, KIMCVConnectedKey, RProperty::EInt ); |
|
51 RProperty::Set(KIMCVPropertyUid, KIMCVConnectedKey, EIMCVUiEventNone ); //0 reset property |
|
52 User::LeaveIfError( iProperty.Attach(KIMCVPropertyUid, KIMCVConnectedKey) ); |
|
53 iProperty.Subscribe(iStatus); |
|
54 SetActive(); |
|
55 } |
|
56 |
|
57 |
|
58 // -------------------------------------------------------------------------- |
|
59 // CVIMPSTUICvEventListener::NewL |
|
60 // -------------------------------------------------------------------------- |
|
61 // |
|
62 CVIMPSTUICvEventListener* CVIMPSTUICvEventListener::NewL(CVIMPSTUiTabbedView& aTabbedView ) |
|
63 { |
|
64 TRACER_AUTO; |
|
65 CVIMPSTUICvEventListener* self = new(ELeave) CVIMPSTUICvEventListener( aTabbedView ); |
|
66 CleanupStack::PushL(self); |
|
67 self->ConstructL(); |
|
68 CleanupStack::Pop(self); |
|
69 return self; |
|
70 } |
|
71 // --------------------------------------------------------- |
|
72 // CVIMPSTUICvEventListener::~CVIMPSTUICvEventListener() |
|
73 // C++ Destructor |
|
74 // --------------------------------------------------------- |
|
75 // |
|
76 CVIMPSTUICvEventListener::~CVIMPSTUICvEventListener() |
|
77 { |
|
78 Cancel (); // Cancel any request, if outstanding |
|
79 iProperty.Close (); // Destroy the property object |
|
80 } |
|
81 // --------------------------------------------------------- |
|
82 // CVIMPSTUICvEventListener::RunL() |
|
83 // --------------------------------------------------------- |
|
84 // |
|
85 void CVIMPSTUICvEventListener::RunL() |
|
86 { |
|
87 TRACER_AUTO; |
|
88 TInt eventValue = KErrNone; |
|
89 |
|
90 TInt error = RProperty::Get(KIMCVPropertyUid,KIMCVConnectedKey, eventValue ); |
|
91 |
|
92 if( eventValue == static_cast<TInt>( EIMCVUiEventExitOnly ) ) |
|
93 { |
|
94 // do service tab exit and keep connection open |
|
95 iTabbedView.HandleCommandL( EAknCmdExit ); |
|
96 } |
|
97 else if( eventValue == static_cast<TInt>( EIMCVUiEventLogoutExit ) ) |
|
98 { |
|
99 // do logout and exit |
|
100 iTabbedView.HandleCommandL( EIMCmdLogoutExit ); |
|
101 } |
|
102 // reset property to zero |
|
103 RProperty::Set(KIMCVPropertyUid, KIMCVConnectedKey, EIMCVUiEventNone ); |
|
104 } |
|
105 // --------------------------------------------------------- |
|
106 // CVIMPSTUICvEventListener::RunL() |
|
107 // --------------------------------------------------------- |
|
108 // |
|
109 void CVIMPSTUICvEventListener::DoCancel() |
|
110 { |
|
111 iProperty.Cancel(); |
|
112 } |
|
113 // --------------------------------------------------------- |
|
114 // CVIMPSTUICvEventListener::StartListening() |
|
115 // --------------------------------------------------------- |
|
116 // |
|
117 void CVIMPSTUICvEventListener::StartListening() |
|
118 { |
|
119 if(!IsActive() ) |
|
120 { |
|
121 iProperty.Subscribe(iStatus); |
|
122 SetActive(); // Tell scheduler a request is active |
|
123 } |
|
124 } |
|
125 |
|
126 // End of File |
|
127 |
|