1 /* |
|
2 * Copyright (c) 2007-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: This module contains the implementation of CIAUpdateHistoryView |
|
15 * class member functions. |
|
16 * |
|
17 */ |
|
18 |
|
19 |
|
20 |
|
21 #include <aknViewAppUi.h> |
|
22 #include <eikmenup.h> |
|
23 #include <eikspane.h> |
|
24 #include <akntitle.h> |
|
25 #include <akncontext.h> |
|
26 #include <StringLoader.h> |
|
27 #include <iaupdate.rsg> |
|
28 |
|
29 #include "iaupdatehistoryview.h" |
|
30 #include "iaupdatehistorycontainer.h" |
|
31 #include "iaupdatehistory.h" |
|
32 #include "iaupdateappui.h" |
|
33 #include "iaupdate.hrh" |
|
34 |
|
35 |
|
36 // Standard construction sequence |
|
37 CIAUpdateHistoryView* CIAUpdateHistoryView::NewL( MIAUpdateHistory& aHistory ) |
|
38 { |
|
39 CIAUpdateHistoryView* self = |
|
40 CIAUpdateHistoryView::NewLC( aHistory ); |
|
41 CleanupStack::Pop(self); |
|
42 return self; |
|
43 } |
|
44 |
|
45 CIAUpdateHistoryView* CIAUpdateHistoryView::NewLC( MIAUpdateHistory& aHistory ) |
|
46 { |
|
47 CIAUpdateHistoryView* self = |
|
48 new( ELeave ) CIAUpdateHistoryView( aHistory ); |
|
49 CleanupStack::PushL(self); |
|
50 self->ConstructL(); |
|
51 return self; |
|
52 } |
|
53 |
|
54 CIAUpdateHistoryView::CIAUpdateHistoryView( MIAUpdateHistory& aHistory ) |
|
55 : CAknView(), |
|
56 iHistory( aHistory ) |
|
57 { |
|
58 // no implementation required |
|
59 } |
|
60 |
|
61 CIAUpdateHistoryView::~CIAUpdateHistoryView() |
|
62 { |
|
63 delete iContainer; |
|
64 } |
|
65 |
|
66 void CIAUpdateHistoryView::ConstructL() |
|
67 { |
|
68 // Initializes the view with the given resources |
|
69 BaseConstructL( R_IAUPDATE_HISTORY_VIEW ); |
|
70 } |
|
71 |
|
72 |
|
73 void CIAUpdateHistoryView::RefreshL() |
|
74 { |
|
75 if( !iContainer ) |
|
76 { |
|
77 // Create the container if it does not already exist. |
|
78 // Also, add it to the app ui control stack |
|
79 iContainer = CIAUpdateHistoryContainer::NewL( ClientRect() ); |
|
80 AppUi()->AddToStackL( iContainer ); |
|
81 } |
|
82 |
|
83 UpdateStatusPaneL(); |
|
84 |
|
85 // Container does the actual refreshing by using the current history |
|
86 // information. |
|
87 // Also, refresh the history first, because it may have changed since |
|
88 // last time. |
|
89 History().RefreshL(); |
|
90 iContainer->RefreshL( History() ); |
|
91 } |
|
92 |
|
93 |
|
94 TUid CIAUpdateHistoryView::Id() const |
|
95 { |
|
96 return TUid::Uid( EIAUpdateHistoryViewId ); |
|
97 } |
|
98 |
|
99 |
|
100 void CIAUpdateHistoryView::HandleCommandL( TInt aCommand ) |
|
101 { |
|
102 switch( aCommand ) |
|
103 { |
|
104 // All the exit type of softkey commands will be interpret as |
|
105 // the exit from the history view. |
|
106 case EAknSoftkeyBack: |
|
107 case EAknSoftkeyExit: |
|
108 case EAknSoftkeyClose: |
|
109 aCommand = EIAUpdateCmdHistoryViewExit; |
|
110 break; |
|
111 |
|
112 default: |
|
113 break; |
|
114 } |
|
115 |
|
116 // Let the app ui handle all the commands |
|
117 AppUi()->HandleCommandL( aCommand ); |
|
118 } |
|
119 |
|
120 |
|
121 void CIAUpdateHistoryView::DoActivateL( const TVwsViewId& /*aPrevViewId*/, |
|
122 TUid /*aCustomMessageId*/, |
|
123 const TDesC8& /*aCustomMessage*/ ) |
|
124 { |
|
125 // Refresh everything. |
|
126 RefreshL(); |
|
127 } |
|
128 |
|
129 void CIAUpdateHistoryView::DoDeactivate() |
|
130 { |
|
131 if ( iContainer ) |
|
132 { |
|
133 // Remove container from the control stack and delete |
|
134 // the container. |
|
135 AppUi()->RemoveFromStack( iContainer ); |
|
136 delete iContainer; |
|
137 iContainer = NULL; |
|
138 } |
|
139 if ( static_cast<CIAUpdateAppUi*>(AppUi())->ShowStatusDialogAgain() ) |
|
140 { |
|
141 TRAP_IGNORE( static_cast<CIAUpdateAppUi*>(AppUi())->ShowStatusDialogDeferredL() ); |
|
142 } |
|
143 } |
|
144 |
|
145 |
|
146 MIAUpdateHistory& CIAUpdateHistoryView::History() const |
|
147 { |
|
148 return iHistory; |
|
149 } |
|
150 |
|
151 |
|
152 void CIAUpdateHistoryView::UpdateStatusPaneL() |
|
153 { |
|
154 // Also update title pane text |
|
155 // Gets a pointer to the status pane. |
|
156 // Notice, that the ownership is not transferred here. |
|
157 CEikStatusPane* statusPane = |
|
158 static_cast< CAknAppUi* >( AppUi() )->StatusPane(); |
|
159 |
|
160 // Check if title pane is in current layout. |
|
161 TBool isTitlePaneInLayout( |
|
162 statusPane-> |
|
163 PaneCapabilities( |
|
164 TUid::Uid( EEikStatusPaneUidTitle ) ). |
|
165 IsInCurrentLayout() ); |
|
166 |
|
167 // Change title text if title pane is in the curent layout. |
|
168 if ( isTitlePaneInLayout ) |
|
169 { |
|
170 // Fetch pointer to the title pane control. Notice, that the ownership is not |
|
171 // transferred here. |
|
172 CAknTitlePane* titlePane = |
|
173 static_cast< CAknTitlePane* >( statusPane->ControlL( |
|
174 TUid::Uid( EEikStatusPaneUidTitle ) ) ); |
|
175 HBufC* text = StringLoader::LoadLC( R_IAUPDATE_TEXT_TITLE_PANE_HISTORY ); |
|
176 titlePane->SetTextL( *text ); |
|
177 CleanupStack::PopAndDestroy( text ); |
|
178 } |
|
179 } |
|
180 |
|