20 #include "iaupdaterdialog.h" |
20 #include "iaupdaterdialog.h" |
21 #include "iaupdaterdefs.h" |
21 #include "iaupdaterdefs.h" |
22 #include "iaupdatercancelobserver.h" |
22 #include "iaupdatercancelobserver.h" |
23 #include "iaupdatedebug.h" |
23 #include "iaupdatedebug.h" |
24 |
24 |
|
25 #include <hbtextresolversymbian.h> |
|
26 |
|
27 |
|
28 _LIT(KFilename, "iaupdate.ts"); |
|
29 _LIT(KPath, "z://data"); |
|
30 _LIT(KInstalling, "txt_software_info_installing_1"); |
25 |
31 |
26 // ======== LOCAL FUNCTIONS ======== |
32 // ======== LOCAL FUNCTIONS ======== |
27 |
33 |
28 // ======== MEMBER FUNCTIONS ======== |
34 // ======== MEMBER FUNCTIONS ======== |
29 |
35 |
31 // ----------------------------------------------------------------------------- |
37 // ----------------------------------------------------------------------------- |
32 // CIAUpdaterDialog::CIAUpdaterDialog |
38 // CIAUpdaterDialog::CIAUpdaterDialog |
33 // C++ default constructor |
39 // C++ default constructor |
34 // ----------------------------------------------------------------------------- |
40 // ----------------------------------------------------------------------------- |
35 // |
41 // |
36 CIAUpdaterDialog::CIAUpdaterDialog( RFs& aFs, |
42 CIAUpdaterDialog::CIAUpdaterDialog( MIAUpdaterCancelObserver& aObserver ) |
37 MIAUpdaterCancelObserver& aObserver ) |
43 : iObserver ( &aObserver ) |
38 : CActive( CActive::EPriorityStandard ), |
|
39 iFs( aFs ), |
|
40 iObserver ( &aObserver ) |
|
41 { |
44 { |
42 CActiveScheduler::Add( this ); |
45 |
43 } |
46 } |
|
47 |
44 |
48 |
45 |
49 |
46 // ----------------------------------------------------------------------------- |
50 // ----------------------------------------------------------------------------- |
47 // CIAUpdaterDialog::NewL |
51 // CIAUpdaterDialog::NewL |
48 // Two-phased constructor. |
52 // Two-phased constructor. |
49 // ----------------------------------------------------------------------------- |
53 // ----------------------------------------------------------------------------- |
50 // |
54 // |
51 CIAUpdaterDialog* CIAUpdaterDialog::NewL( RFs& aFs, |
55 CIAUpdaterDialog* CIAUpdaterDialog::NewL( MIAUpdaterCancelObserver& aObserver ) |
52 MIAUpdaterCancelObserver& aObserver ) |
|
53 { |
56 { |
54 CIAUpdaterDialog* self = |
57 CIAUpdaterDialog* self = |
55 CIAUpdaterDialog::NewLC( aFs, aObserver ); |
58 CIAUpdaterDialog::NewLC( aObserver ); |
56 CleanupStack::Pop( self ); |
59 CleanupStack::Pop( self ); |
57 return self; |
60 return self; |
58 } |
61 } |
59 |
62 |
60 |
63 |
61 // ----------------------------------------------------------------------------- |
64 // ----------------------------------------------------------------------------- |
62 // CIAUpdaterDialog::NewLC |
65 // CIAUpdaterDialog::NewLC |
63 // Two-phased constructor. |
66 // Two-phased constructor. |
64 // ----------------------------------------------------------------------------- |
67 // ----------------------------------------------------------------------------- |
65 // |
68 // |
66 CIAUpdaterDialog* CIAUpdaterDialog::NewLC( RFs& aFs, |
69 CIAUpdaterDialog* CIAUpdaterDialog::NewLC( MIAUpdaterCancelObserver& aObserver ) |
67 MIAUpdaterCancelObserver& aObserver ) |
|
68 { |
70 { |
69 CIAUpdaterDialog* self = |
71 CIAUpdaterDialog* self = |
70 new( ELeave ) CIAUpdaterDialog( aFs, aObserver ); |
72 new( ELeave ) CIAUpdaterDialog( aObserver ); |
71 CleanupStack::PushL( self ); |
73 CleanupStack::PushL( self ); |
72 self->ConstructL(); |
74 self->ConstructL(); |
73 return self; |
75 return self; |
74 } |
76 } |
75 |
77 |
82 void CIAUpdaterDialog::ConstructL() |
84 void CIAUpdaterDialog::ConstructL() |
83 { |
85 { |
84 IAUPDATE_TRACE("[IAUpdater] CIAUpdaterDialog::ConstructL begin"); |
86 IAUPDATE_TRACE("[IAUpdater] CIAUpdaterDialog::ConstructL begin"); |
85 |
87 |
86 // Get resource file path |
88 // Get resource file path |
87 /*TFileName fileName; |
89 iIsResolverSuccess = HbTextResolverSymbian::Init(KFilename, KPath); |
88 fileName.Copy( TParsePtrC( RProcess().FileName() ).Drive() ); |
|
89 fileName.Append( KDC_APP_RESOURCE_DIR ); |
|
90 fileName.Append( IAUpdaterDefs::KIAUpdaterResourceFile ); |
|
91 |
90 |
92 // Get language of resource file |
|
93 BaflUtils::NearestLanguageFile( iFs, fileName ); |
|
94 |
|
95 // Open resource file |
|
96 iResourceFile.OpenL( iFs, fileName ); |
|
97 iResourceFile.ConfirmSignatureL(); */ |
|
98 |
|
99 IAUPDATE_TRACE("[IAUpdater] CIAUpdaterDialog::ConstructL end"); |
91 IAUPDATE_TRACE("[IAUpdater] CIAUpdaterDialog::ConstructL end"); |
100 } |
92 } |
101 |
93 |
102 |
94 |
103 // ----------------------------------------------------------------------------- |
95 // ----------------------------------------------------------------------------- |
105 // C++ Destructor |
97 // C++ Destructor |
106 // ----------------------------------------------------------------------------- |
98 // ----------------------------------------------------------------------------- |
107 // |
99 // |
108 CIAUpdaterDialog::~CIAUpdaterDialog() |
100 CIAUpdaterDialog::~CIAUpdaterDialog() |
109 { |
101 { |
110 Cancel(); |
102 DestroyGlobalWaitNote(); |
111 //delete iNote; |
|
112 //iResourceFile.Close(); |
|
113 } |
103 } |
114 |
104 |
115 |
105 |
116 // ----------------------------------------------------------------------------- |
106 // ----------------------------------------------------------------------------- |
117 // CIAUpdaterDialog::ShowWaitingNoteL |
107 // CIAUpdaterDialog::ShowWaitingNoteL |
118 // Show global waiting note during installing. |
108 // Show global waiting note during installing. |
119 // ----------------------------------------------------------------------------- |
109 // ----------------------------------------------------------------------------- |
120 // |
110 // |
121 void CIAUpdaterDialog::ShowWaitingNoteL( const TDesC& /*aName*/, TInt /*aIndex*/, TInt /*aTotalCount*/ ) |
111 void CIAUpdaterDialog::ShowWaitingNoteL( const TDesC& aName, TInt /*aIndex*/, TInt /*aTotalCount*/ ) |
122 { |
112 { |
123 IAUPDATE_TRACE("[IAUpdater] CIAUpdaterDialog::ShowWaitingNoteL begin"); |
113 IAUPDATE_TRACE("[IAUpdater] CIAUpdaterDialog::ShowWaitingNoteL begin"); |
124 if ( iNoteId == 0 ) |
|
125 { |
|
126 IAUPDATE_TRACE("[IAUpdater] Creating global waiting note."); |
|
127 |
114 |
128 // Get localiced string from resc. file. |
115 DestroyGlobalWaitNote(); |
129 //HBufC* string = ReadResourceLC( R_IAUPDATER_INSTALLING ); |
116 |
130 |
117 iGlobalWaitNote = CHbDeviceProgressDialogSymbian::NewL( |
131 //HBufC* temp1 = HBufC::NewLC( string->Length() + aName.Length() ); |
118 CHbDeviceProgressDialogSymbian::EWaitDialog ); |
132 //TPtr temp1Ptr = temp1->Des(); |
119 |
133 |
120 // loc: Load string |
134 // Add pkg's name to string (U0). |
121 iGlobalResource = HbTextResolverSymbian::LoadL( KInstalling, aName ); |
135 //StringLoader::Format( temp1Ptr, *string, 0, aName ); |
122 if ( iGlobalResource ) |
136 |
123 iGlobalWaitNote->SetTextL( iGlobalResource->Des() ); |
137 // Increase buffer length for the number. |
124 |
138 //HBufC* temp2 = |
125 // Icon ? |
139 // HBufC::NewLC( temp1->Length() + IAUpdaterDefs::KIAUpdaterParamLen ); |
126 //iGlobalWaitNote->SetIconNameL(const TDesC& aIconName); |
140 //TPtr temp2Ptr = temp2->Des(); |
127 |
141 |
128 // Button ? |
142 // Add index number to string (N1) |
129 iGlobalWaitNote->SetButton(ETrue); |
143 //StringLoader::Format( temp2Ptr, *temp1, 1, aIndex ); |
130 |
144 |
131 iGlobalWaitNote->SetObserver( this ); |
145 // Increase buffer length for the number. |
132 iGlobalWaitNote->SetAutoClose(EFalse); |
146 //HBufC* finalString = |
133 iGlobalWaitNote->ShowL(); |
147 // HBufC::NewLC( temp2->Length() + IAUpdaterDefs::KIAUpdaterParamLen ); |
134 |
148 //TPtr finalPtr = finalString->Des(); |
|
149 |
|
150 // Add max count number to string (N2) |
|
151 //StringLoader::Format( finalPtr, *temp2, 2, aTotalCount ); |
|
152 |
|
153 //AknTextUtils::DisplayTextLanguageSpecificNumberConversion( finalPtr ); |
|
154 //if ( !iNote ) |
|
155 // { |
|
156 // iNote = CAknGlobalNote::NewL(); |
|
157 // iNote->SetSoftkeys( R_AVKON_SOFTKEYS_CANCEL ); |
|
158 // } |
|
159 |
|
160 // IAUPDATE_TRACE("[IAUpdater] Showing global waiting note."); |
|
161 //iNoteId = iNote->ShowNoteL( iStatus, EAknGlobalWaitNote, *finalString ); |
|
162 SetActive(); |
|
163 |
|
164 //CleanupStack::PopAndDestroy( finalString ); |
|
165 //CleanupStack::PopAndDestroy( temp2 ); |
|
166 //CleanupStack::PopAndDestroy( temp1 ); |
|
167 //CleanupStack::PopAndDestroy( string ); |
|
168 } |
|
169 IAUPDATE_TRACE("[IAUpdater] CIAUpdaterDialog::ShowWaitingNoteL end"); |
135 IAUPDATE_TRACE("[IAUpdater] CIAUpdaterDialog::ShowWaitingNoteL end"); |
170 } |
136 } |
171 |
137 |
172 |
138 |
173 // ----------------------------------------------------------------------------- |
139 // ----------------------------------------------------------------------------- |
176 // ----------------------------------------------------------------------------- |
142 // ----------------------------------------------------------------------------- |
177 // |
143 // |
178 void CIAUpdaterDialog::CancelWaitingNoteL() |
144 void CIAUpdaterDialog::CancelWaitingNoteL() |
179 { |
145 { |
180 IAUPDATE_TRACE("[IAUpdater] CIAUpdaterDialog::CancelWaitingNoteL begin"); |
146 IAUPDATE_TRACE("[IAUpdater] CIAUpdaterDialog::CancelWaitingNoteL begin"); |
181 |
147 |
182 /*if ( iNoteId != 0 ) |
148 DestroyGlobalWaitNote(); |
183 { |
149 |
184 IAUPDATE_TRACE("[IAUpdater] Cancel waiting note."); |
|
185 iNote->CancelNoteL( iNoteId ); |
|
186 iNoteId = 0; |
|
187 }*/ |
|
188 |
|
189 IAUPDATE_TRACE("[IAUpdater] CIAUpdaterDialog::CancelWaitingNoteL end"); |
150 IAUPDATE_TRACE("[IAUpdater] CIAUpdaterDialog::CancelWaitingNoteL end"); |
190 } |
151 } |
191 |
152 |
192 |
153 void CIAUpdaterDialog::ProgressDialogCancelled( |
193 |
154 const CHbDeviceProgressDialogSymbian* /*aProgressDialog*/ ) |
|
155 { |
194 |
156 |
|
157 iObserver->UserCancel(); |
195 |
158 |
196 // --------------------------------------------------------------------------- |
|
197 // CIAUpdaterDialog:::DoCancel |
|
198 // |
|
199 // --------------------------------------------------------------------------- |
|
200 // |
|
201 void CIAUpdaterDialog::DoCancel() |
|
202 { |
|
203 TRAP_IGNORE( CancelWaitingNoteL() ); |
|
204 } |
159 } |
205 |
160 |
206 // --------------------------------------------------------------------------- |
161 void CIAUpdaterDialog::ProgressDialogClosed( |
207 // CIAUpdateNetworkRegistration::RunL() |
162 const CHbDeviceProgressDialogSymbian* /*aProgressDialog*/ ) |
208 // |
|
209 // --------------------------------------------------------------------------- |
|
210 // |
|
211 void CIAUpdaterDialog::RunL() |
|
212 { |
163 { |
213 IAUPDATE_TRACE_1("[IAUpdater] CIAUpdaterDialog::RunL() iStatus : %d", iStatus.Int() ); |
164 |
214 iNoteId = 0; |
|
215 /*if ( iStatus.Int() == EAknSoftkeyCancel ) |
|
216 { |
|
217 iObserver->UserCancel(); |
|
218 } |
|
219 else |
|
220 { |
|
221 iObserver->UserExit(); |
|
222 }*/ |
|
223 } |
165 } |
224 |
166 |
225 // ======== GLOBAL FUNCTIONS ======== |
167 // ----------------------------------------------------------------------------- |
226 |
168 // CIAUpdaterDialog::DestroyGlobalWaitNote |
|
169 // ----------------------------------------------------------------------------- |
|
170 void CIAUpdaterDialog::DestroyGlobalWaitNote() |
|
171 { |
|
172 if ( iGlobalWaitNote ) |
|
173 { |
|
174 iGlobalWaitNote->Close(); |
|
175 delete iGlobalWaitNote; |
|
176 iGlobalWaitNote = NULL; |
|
177 delete iGlobalResource; |
|
178 iGlobalResource = NULL; |
|
179 } |
|
180 } |
|
181 |
227 // EOF |
182 // EOF |