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