|
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: |
|
15 * Logs application "App List" view class implementation |
|
16 * |
|
17 */ |
|
18 |
|
19 |
|
20 // INCLUDE FILES |
|
21 #include <Logs.rsg> |
|
22 #include <w32std.h> |
|
23 #include <apgtask.h> |
|
24 |
|
25 #include "CLogsAppListView.h" |
|
26 #include "CLogsAppListControlContainer.h" |
|
27 #include "CLogsAppUi.h" |
|
28 #include "CLogsEngine.h" |
|
29 |
|
30 // EXTERNAL DATA STRUCTURES |
|
31 |
|
32 // EXTERNAL FUNCTION PROTOTYPES |
|
33 |
|
34 // CONSTANTS |
|
35 |
|
36 // MACROS |
|
37 |
|
38 // LOCAL CONSTANTS AND MACROS |
|
39 |
|
40 // MODULE DATA STRUCTURES |
|
41 |
|
42 // LOCAL FUNCTION PROTOTYPES |
|
43 |
|
44 // ==================== LOCAL FUNCTIONS ==================== |
|
45 |
|
46 // ================= MEMBER FUNCTIONS ======================= |
|
47 |
|
48 // ---------------------------------------------------------------------------- |
|
49 // CLogsAppListView::NewL |
|
50 // ---------------------------------------------------------------------------- |
|
51 // |
|
52 CLogsAppListView* CLogsAppListView::NewL() |
|
53 { |
|
54 CLogsAppListView* self = new ( ELeave ) CLogsAppListView; |
|
55 CleanupStack::PushL( self ); |
|
56 self->ConstructL(); |
|
57 CleanupStack::Pop(); |
|
58 return self; |
|
59 } |
|
60 |
|
61 // ---------------------------------------------------------------------------- |
|
62 // CLogsAppListView::~CLogsAppListView |
|
63 // ---------------------------------------------------------------------------- |
|
64 // |
|
65 CLogsAppListView::~CLogsAppListView() |
|
66 { |
|
67 if( iContainer ) |
|
68 { |
|
69 AppUi()->RemoveFromViewStack( *this, iContainer ); |
|
70 delete iContainer; |
|
71 } |
|
72 } |
|
73 |
|
74 // ---------------------------------------------------------------------------- |
|
75 // CLogsAppListView::HandleCommandL |
|
76 // ---------------------------------------------------------------------------- |
|
77 // |
|
78 void CLogsAppListView::HandleCommandL( TInt aCommandId ) |
|
79 { |
|
80 switch( aCommandId ) |
|
81 { |
|
82 case ELogsCmdMenuOpen: |
|
83 LogsAppUi()->CmdOkL( iContainer->ListBox()->CurrentItemIndex() ); |
|
84 break; |
|
85 |
|
86 default: |
|
87 CLogsBaseView::HandleCommandL( aCommandId ); |
|
88 } |
|
89 } |
|
90 |
|
91 // ---------------------------------------------------------------------------- |
|
92 // CLogsAppListView::Id |
|
93 // ---------------------------------------------------------------------------- |
|
94 // |
|
95 TUid CLogsAppListView::Id() const |
|
96 { |
|
97 return TUid::Uid( ELogAppListViewId ); |
|
98 } |
|
99 |
|
100 // ---------------------------------------------------------------------------- |
|
101 // CLogsAppListView::HandleClientRectChange |
|
102 // ---------------------------------------------------------------------------- |
|
103 // |
|
104 void CLogsAppListView::HandleClientRectChange() |
|
105 { |
|
106 if (iContainer) |
|
107 { |
|
108 iContainer->SetRect( ClientRect() ); |
|
109 } |
|
110 } |
|
111 |
|
112 // ---------------------------------------------------------------------------- |
|
113 // CLogsAppListView::DoActivateL |
|
114 // ---------------------------------------------------------------------------- |
|
115 // |
|
116 void CLogsAppListView::DoActivateL( const TVwsViewId& aPrevViewId, |
|
117 TUid aCustomMessageId, const TDesC8& /* aCustomMessage */ ) |
|
118 { |
|
119 //Reset ProvideOnlyRecentViews always when other than CLogsRecentListView is activated. |
|
120 LogsAppUi()->SetProvideOnlyRecentViews( EFalse ); |
|
121 |
|
122 if( ! iContainer ) |
|
123 { |
|
124 iContainer = CLogsAppListControlContainer::NewL( this, ClientRect() ); |
|
125 AppUi()->AddToViewStackL( *this, iContainer ); |
|
126 } |
|
127 |
|
128 //Set focus to correct row if we return from subselection view |
|
129 switch( aPrevViewId.iViewUid.iUid ) |
|
130 { |
|
131 case ECtViewId: |
|
132 iSelectedLine = 1; |
|
133 break; |
|
134 case EGprsCounterViewId: |
|
135 iSelectedLine = 2; |
|
136 break; |
|
137 case ELogSubAppListViewId: |
|
138 default: |
|
139 iSelectedLine = 0; |
|
140 } |
|
141 |
|
142 // See Error ELJG-7PKAC8 |
|
143 iContainer->ListBox()->SetCurrentItemIndex( iSelectedLine ); |
|
144 iContainer->ListBox()->SetListBoxObserver( this ); |
|
145 |
|
146 LogsAppUi()->SetPreviousViewId( aPrevViewId.iViewUid ); |
|
147 LogsAppUi()->SetCurrentViewId( Id() ); |
|
148 |
|
149 Engine()->DeleteSMSEventUpdater(); // <>StartSMSEventUpdaterL() |
|
150 |
|
151 if( aCustomMessageId.iUid == ELogsViewActivationBackground ) |
|
152 { |
|
153 // We have activated this view because we are hiding Logs into |
|
154 // background (faking exit) so this view is waiting when Logs is |
|
155 // again foregrounded. |
|
156 // Now we can enable bring-to-foreground on view activation: |
|
157 AppUi()->SetCustomControl(0); |
|
158 AppUi()->HideInBackground(); |
|
159 } |
|
160 |
|
161 // Just to make sure the inputblocker is not on |
|
162 RemoveInputBlocker(); |
|
163 |
|
164 // Avoid the flicking when transfer to foreground from background. |
|
165 if(LogsAppUi()->IsBackground()) |
|
166 { |
|
167 iContainer->DrawNow(); |
|
168 iEikonEnv->AppUiFactory()->StatusPane()->DrawNow(); |
|
169 LogsAppUi()->SetCustomControl(0); |
|
170 |
|
171 CCoeEnv * env = CCoeEnv::Static(); |
|
172 env->WsSession().SetWindowGroupOrdinalPosition(env->RootWin().Identifier(),0); |
|
173 } |
|
174 } |
|
175 |
|
176 // ---------------------------------------------------------------------------- |
|
177 // CLogsAppListView::DoDeactivate |
|
178 // ---------------------------------------------------------------------------- |
|
179 // |
|
180 void CLogsAppListView::DoDeactivate() |
|
181 { |
|
182 if( iContainer ) |
|
183 { |
|
184 iSelectedLine = iContainer->ListBox()->CurrentItemIndex(); |
|
185 // Remove view and its control from the view stack |
|
186 AppUi()->RemoveFromViewStack( *this, iContainer ); |
|
187 |
|
188 // Destroy the container control |
|
189 delete iContainer; |
|
190 iContainer = NULL; |
|
191 } |
|
192 } |
|
193 |
|
194 // ---------------------------------------------------------------------------- |
|
195 // CLogsAppListView::ConstructL |
|
196 // ---------------------------------------------------------------------------- |
|
197 // |
|
198 void CLogsAppListView::ConstructL() |
|
199 { |
|
200 BaseConstructL( R_LOGS_APP_LIST_VIEW ); |
|
201 } |
|
202 |
|
203 // ---------------------------------------------------------------------------- |
|
204 // CLogsAppListView::CLogsAppListView |
|
205 // ---------------------------------------------------------------------------- |
|
206 // |
|
207 CLogsAppListView::CLogsAppListView() |
|
208 { |
|
209 } |
|
210 |
|
211 |
|
212 void CLogsAppListView::ViewActivatedL(const TVwsViewId& aPrevViewId,TUid aCustomMessageId,const TDesC8& aCustomMessage) |
|
213 { |
|
214 // To avoid the flicking when transfer to foreground from background,we control the view show manually. |
|
215 if(LogsAppUi()->IsBackground() && |
|
216 LogsAppUi()->ActiveViewId() != ELogAppListViewId) |
|
217 { |
|
218 LogsAppUi()->SetCustomControl(1); |
|
219 } |
|
220 CLogsBaseView::ViewActivatedL(aPrevViewId,aCustomMessageId,aCustomMessage); |
|
221 } |
|
222 |
|
223 |
|
224 // End of File |
|
225 |