67 } |
66 } |
68 } |
67 } |
69 |
68 |
70 // --------------------------------------------------------------------------- |
69 // --------------------------------------------------------------------------- |
71 |
70 |
|
71 QList<MemoryDetails> EngineWrapper::GetMemoryDetailsList() |
|
72 { |
|
73 RPointerArray<TMemoryDetails> tMemDetList = iEngine->GetMemoryDetailsList(); |
|
74 QList<MemoryDetails> memDetList; |
|
75 MemoryDetails memDet; |
|
76 for(int i=0; i<tMemDetList.Count(); i++) |
|
77 { |
|
78 TMemoryDetails* temp = tMemDetList.operator [](i); |
|
79 QString free = QString::fromUtf16(tMemDetList.operator [](i)->iFree.Ptr(), tMemDetList.operator [](i)->iFree.Length());//QString((QChar*) temp->iFree.Ptr(), temp->iFree.Length()); |
|
80 QString size = QString::fromUtf16(tMemDetList.operator [](i)->iSize.Ptr(), tMemDetList.operator [](i)->iSize.Length());//QString((QChar*) temp->iSize.Ptr(), temp->iSize.Length()); |
|
81 QString driveLetter = QString::fromUtf8((const char*) &tMemDetList.operator [](i)->iDriveLetter, (int) sizeof(char) );//QString((QChar*) &temp->iDriveLetter, (int) sizeof( char ) ); |
|
82 memDet.mFree = free; //QString((QChar*)tMemDetList[i]->iFree.Ptr(), tMemDetList[i]->iFree.Length()); |
|
83 memDet.mSize = size; //QString((QChar*) tMemDetList[i]->iSize.Ptr(), tMemDetList[i]->iSize.Length()); |
|
84 memDet.mDriveLetter = driveLetter; |
|
85 |
|
86 //memDetList[i].mDriveLetter = QString::fromUtf8( (char *) &tMemDetList[i]->iDriveLetter, (int) sizeof( char ) ); |
|
87 memDetList.append( memDet ); |
|
88 } |
|
89 return memDetList; |
|
90 } |
|
91 |
72 MemoryDetails EngineWrapper::GetMemoryDetails() |
92 MemoryDetails EngineWrapper::GetMemoryDetails() |
73 { |
93 { |
|
94 |
74 TMemoryDetails tMemoryDetails = iEngine->GetMemoryDetails(); |
95 TMemoryDetails tMemoryDetails = iEngine->GetMemoryDetails(); |
75 MemoryDetails memoryDetails; |
96 MemoryDetails memoryDetails; |
76 |
97 |
77 // Convert TMemoryDetails to MemoryDetails |
98 // Convert TMemoryDetails to MemoryDetails |
78 memoryDetails.mCFree = QString((QChar*)tMemoryDetails.iCFree.Ptr(), tMemoryDetails.iCFree.Length()); |
99 memoryDetails.mRamFree = QString((QChar*)tMemoryDetails.iRamFree.Ptr(), tMemoryDetails.iRamFree.Length()); |
79 memoryDetails.mDFree = QString((QChar*)tMemoryDetails.iDFree.Ptr(), tMemoryDetails.iDFree.Length()); |
100 memoryDetails.mRamSize = QString((QChar*)tMemoryDetails.iRamSize.Ptr(), tMemoryDetails.iRamSize.Length()); |
80 memoryDetails.mEFree = QString((QChar*)tMemoryDetails.iEFree.Ptr(), tMemoryDetails.iEFree.Length()); |
101 |
81 memoryDetails.mHFree = QString((QChar*)tMemoryDetails.iHFree.Ptr(), tMemoryDetails.iHFree.Length()); |
|
82 |
|
83 memoryDetails.mCSize = QString((QChar*)tMemoryDetails.iCSize.Ptr(), tMemoryDetails.iCSize.Length()); |
|
84 memoryDetails.mDSize = QString((QChar*)tMemoryDetails.iDSize.Ptr(), tMemoryDetails.iDSize.Length()); |
|
85 memoryDetails.mHSize = QString((QChar*)tMemoryDetails.iHSize.Ptr(), tMemoryDetails.iHSize.Length()); |
|
86 |
|
87 if (tMemoryDetails.iENotAvailable == EFalse) { |
|
88 memoryDetails.mESize = QString((QChar*)tMemoryDetails.iESize.Ptr(), tMemoryDetails.iESize.Length()); |
|
89 memoryDetails.mENotAvailable = false; |
|
90 } |
|
91 else { |
|
92 memoryDetails.mENotAvailable = true; |
|
93 } |
|
94 return memoryDetails; |
102 return memoryDetails; |
95 } |
103 } |
96 |
104 |
97 |
105 |
98 // --------------------------------------------------------------------------- |
106 // --------------------------------------------------------------------------- |
104 |
112 |
105 } |
113 } |
106 |
114 |
107 // --------------------------------------------------------------------------- |
115 // --------------------------------------------------------------------------- |
108 |
116 |
109 void EngineWrapper::ShowNote(const TDesC& aNoteMessage, TInt aResourceId) |
117 void EngineWrapper::ShowNote(const TDesC& aNoteMessage, TInt /*aResourceId*/) |
110 { |
118 { |
111 QString note((QChar*)aNoteMessage.Ptr(),aNoteMessage.Length()); |
119 QString note((QChar*)aNoteMessage.Ptr(),aNoteMessage.Length()); |
112 Notifications::showGlobalNote(note, HbMessageBox::MessageTypeInformation, HbPopup::ConfirmationNoteTimeout); |
120 Notifications::showGlobalNote(note, HbMessageBox::MessageTypeInformation, HbPopup::ConfirmationNoteTimeout); |
113 } |
121 } |
114 |
122 |
115 // --------------------------------------------------------------------------- |
123 // --------------------------------------------------------------------------- |
116 |
124 |
117 void EngineWrapper::ShowProgressBar(const TDesC& aPrompt, int aMax) |
125 void EngineWrapper::ShowProgressBar(const TDesC& aPrompt, int aMax) |
118 { |
126 { |
119 QString text((QChar*)aPrompt.Ptr(), aPrompt.Length()); |
127 QString text((QChar*)aPrompt.Ptr(), aPrompt.Length()); |
|
128 if(iProgressDialog){ |
|
129 delete iProgressDialog; |
|
130 iProgressDialog = NULL; |
|
131 } |
120 iProgressDialog = Notifications::showProgressBar(text, aMax); |
132 iProgressDialog = Notifications::showProgressBar(text, aMax); |
121 connect(iProgressDialog, SIGNAL(cancelled()), this, SLOT(ProgressDialogCancelled())); |
133 connect(iProgressDialog, SIGNAL(cancelled()), this, SLOT(ProgressDialogCancelled())); |
122 } |
134 } |
123 |
135 |
124 // --------------------------------------------------------------------------- |
136 // --------------------------------------------------------------------------- |
125 |
137 |
126 void EngineWrapper::IncrementProgressbarValue() |
138 void EngineWrapper::IncrementProgressbarValue() |
127 { |
139 { |
128 iProgressDialog->setProgressValue(iProgressDialog->progressValue() + 1); |
140 if(iProgressDialog) |
|
141 iProgressDialog->setProgressValue(iProgressDialog->progressValue() + 1); |
129 } |
142 } |
130 |
143 |
131 // --------------------------------------------------------------------------- |
144 // --------------------------------------------------------------------------- |
132 |
145 |
133 void EngineWrapper::CloseProgressbar() |
146 void EngineWrapper::CloseProgressbar() |
134 { |
147 { |
135 delete iProgressDialog; |
148 if(iProgressDialog){ |
136 iProgressDialog = 0; |
149 disconnect(iProgressDialog, SIGNAL(cancelled()), this, SLOT(ProgressDialogCancelled())); |
137 } |
150 delete iProgressDialog; |
138 |
151 iProgressDialog = NULL; |
139 // --------------------------------------------------------------------------- |
152 } |
140 |
153 } |
141 TBool EngineWrapper::EntriesQueryDialog(TInt& aNumberOfEntries, const TDesC& aPrompt, TBool aAcceptsZero) |
154 |
|
155 // --------------------------------------------------------------------------- |
|
156 |
|
157 TBool EngineWrapper::EntriesQueryDialog(TInt* aNumberOfEntries, const TDesC& aPrompt, TBool aAcceptsZero, MUIObserver* observer, int userData) |
142 { |
158 { |
143 QString text((QChar*)aPrompt.Ptr(), aPrompt.Length()); |
159 QString text((QChar*)aPrompt.Ptr(), aPrompt.Length()); |
144 bool err = Notifications::entriesQueryDialog(aNumberOfEntries, text, aAcceptsZero); |
160 TBool success(EFalse); |
145 return err; |
161 try{ |
|
162 CreatorInputDialog::launch(text, aNumberOfEntries, aAcceptsZero ? true : false, observer, userData); |
|
163 success = ETrue; |
|
164 } |
|
165 catch (std::exception& e) |
|
166 { |
|
167 Notifications::error( QString("exception: ")+e.what() ); |
|
168 } |
|
169 return success; |
146 } |
170 } |
147 |
171 |
148 // --------------------------------------------------------------------------- |
172 // --------------------------------------------------------------------------- |
149 |
173 |
150 TBool EngineWrapper::TimeQueryDialog(TTime aTime, const TDesC& aPrompt) |
174 TBool EngineWrapper::TimeQueryDialog(TTime* aTime, const TDesC& aPrompt, MUIObserver* observer, int userData) |
151 { |
175 { |
152 // TTime to QDate |
176 QString text((QChar*)aPrompt.Ptr(), aPrompt.Length()); |
153 TBuf<20> timeString; |
177 TBool success(EFalse); |
154 _LIT(KDateString,"%D%M%Y%/0%1%/1%2%/2%3%/3"); |
178 try{ |
155 TRAP_IGNORE( aTime.FormatL(timeString, KDateString) ); |
179 CreatorDateTimeDialog::launch(text, aTime, observer, userData); |
156 QString temp = QString::fromUtf16(timeString.Ptr(), timeString.Length()); |
180 success = ETrue; |
157 temp.replace(QChar('/'), QChar('-')); |
181 } |
158 QDate date = QDate::fromString(temp, "dd-MM-yyyy"); |
182 catch (std::exception& e) |
159 |
183 { |
160 QString text((QChar*)aPrompt.Ptr(), aPrompt.Length()); |
184 Notifications::error( QString("exception: ")+e.what() ); |
161 bool err = Notifications::timeQueryDialog(date, text); |
185 } |
162 return err; |
186 return success; |
163 } |
187 } |
164 |
188 |
165 TBool EngineWrapper::YesNoQueryDialog(const TDesC& aPrompt) |
189 TBool EngineWrapper::YesNoQueryDialog(const TDesC& aPrompt, MUIObserver* observer, int userData) |
166 { |
190 { |
167 QString text((QChar*)aPrompt.Ptr(), aPrompt.Length()); |
191 QString text((QChar*)aPrompt.Ptr(), aPrompt.Length()); |
168 return Notifications::yesNoQueryDialog(text); |
192 TBool success(EFalse); |
|
193 try{ |
|
194 CreatorYesNoDialog::launch(text, "", observer, userData); |
|
195 success = ETrue; |
|
196 } |
|
197 catch (std::exception& e) |
|
198 { |
|
199 Notifications::error( QString("exception: ")+e.what() ); |
|
200 } |
|
201 return success; |
169 } |
202 } |
170 |
203 |
171 // --------------------------------------------------------------------------- |
204 // --------------------------------------------------------------------------- |
172 |
205 |
173 bool EngineWrapper::ExecuteOptionsMenuCommand(int commandId) |
206 bool EngineWrapper::ExecuteOptionsMenuCommand(int commandId) |
200 } |
229 } |
201 } |
230 } |
202 |
231 |
203 // --------------------------------------------------------------------------- |
232 // --------------------------------------------------------------------------- |
204 |
233 |
205 bool EngineWrapper::PopupListDialog(const TDesC& aPrompt, CDesCArray* aFileNameArray, TInt& aIndex) |
234 TBool EngineWrapper::PopupListDialog(const TDesC& aPrompt, const CDesCArray* aFileNameArray, TInt* aIndex, MUIObserver* aObserver, TInt aUserData) |
206 { |
235 { |
207 QString text((QChar*)aPrompt.Ptr(), aPrompt.Length()); |
236 QString text((QChar*)aPrompt.Ptr(), aPrompt.Length()); |
208 QStringList itemList; |
237 QStringList itemList; |
209 |
238 |
210 for (int i = 0; i < aFileNameArray->Count(); i++) { |
239 for (int i = 0; i < aFileNameArray->Count(); i++) { |
211 itemList.append(QString::fromUtf16( |
240 itemList.append(QString::fromUtf16( |
212 aFileNameArray->MdcaPoint(i).Ptr(), |
241 aFileNameArray->MdcaPoint(i).Ptr(), |
213 aFileNameArray->MdcaPoint(i).Length())); |
242 aFileNameArray->MdcaPoint(i).Length())); |
214 } |
243 } |
215 // TODO: HbSelectionDialog handle close & user choice |
244 TBool success(EFalse); |
216 Notifications::popupListDialog(text, itemList, HbAbstractItemView::SingleSelection); |
245 try{ |
217 return false; |
246 CreatorSelectionDialog::launch(text, itemList, aIndex, aObserver, aUserData); |
|
247 success = ETrue; |
|
248 } |
|
249 catch (std::exception& e) |
|
250 { |
|
251 Notifications::error( QString("exception: ")+e.what() ); |
|
252 } |
|
253 return success; |
218 } |
254 } |
219 |
255 |
220 // --------------------------------------------------------------------------- |
256 // --------------------------------------------------------------------------- |
221 |
257 |
222 bool EngineWrapper::DirectoryQueryDialog(const TDesC& aPrompt, TFileName& aDirectory) |
258 TBool EngineWrapper::DirectoryQueryDialog(const TDesC& aPrompt, TDes& aDirectory, MUIObserver* aObserver, TInt aUserData) |
223 { |
259 { |
224 QString text((QChar*)aPrompt.Ptr(), aPrompt.Length()); |
260 QString text((QChar*)aPrompt.Ptr(), aPrompt.Length()); |
225 QString directory = QString((QChar*)aDirectory.Ptr(), aDirectory.Length()); |
261 TBool success(EFalse); |
226 bool ret = Notifications::directoryQueryDialog(text, directory); |
262 try{ |
227 if (ret == true) { |
263 CreatorInputDialog::launch(text, aDirectory, aObserver, aUserData); |
228 aDirectory = TFileName(directory.utf16()); |
264 success = ETrue; |
229 } |
265 } |
230 return ret; |
266 catch (std::exception& e) |
231 |
267 { |
|
268 Notifications::error( QString("exception: ")+e.what() ); |
|
269 } |
|
270 return success; |
232 } |
271 } |
233 |
272 |
234 |
273 |
235 // --------------------------------------------------------------------------- |
274 // --------------------------------------------------------------------------- |
236 |
275 |
290 default: { |
329 default: { |
291 Notifications::error("Error in resource id."); |
330 Notifications::error("Error in resource id."); |
292 return ret; |
331 return ret; |
293 } |
332 } |
294 } |
333 } |
295 // TODO: HbSelectionDialog handle close & user choice |
334 TBool success(EFalse); |
296 Notifications::popupListDialog(text, itemList, HbAbstractItemView::SingleSelection); |
335 try{ |
297 return false; |
336 CreatorSelectionDialog::launch(text, itemList, aIndex, aObserver, aUserData); |
298 |
337 success = ETrue; |
299 } |
338 } |
300 |
339 catch (std::exception& e) |
301 bool EngineWrapper::ListQueryDialog(const TDesC& aPrompt, TListQueryId aId, CArrayFixFlat<TInt>* aIndexes) |
340 { |
302 { |
341 Notifications::error( QString("exception: ")+e.what() ); |
303 bool ret = false; |
342 } |
304 QString text((QChar*)aPrompt.Ptr(), aPrompt.Length()); |
343 return success; |
|
344 } |
|
345 |
|
346 TBool EngineWrapper::ListQueryDialog(const TDesC& aPrompt, TListQueryId aId, CArrayFixFlat<TInt>* aSelectedItems, MUIObserver* aObserver, TInt aUserData) |
|
347 { |
|
348 TBool success(EFalse); |
305 QStringList itemList; |
349 QStringList itemList; |
306 QList<int> indexes; |
350 QString text((QChar*)aPrompt.Ptr(), aPrompt.Length()); |
307 if (aId == R_ATTACHMENT_MULTI_SELECTION_QUERY) { |
351 if (aId == R_ATTACHMENT_MULTI_SELECTION_QUERY) { |
308 itemList << "None" << "JPEG 25kB" << "JPEG 300kB" << "JPEG 500kB" << "PNG 15kB" << "GIF 2kB" << "RNG 1kB" |
352 itemList << "None" << "JPEG 25kB" << "JPEG 300kB" << "JPEG 500kB" << "PNG 15kB" << "GIF 2kB" << "RNG 1kB" |
309 << "MIDI 10kB" << "WAVE 20kB" << "AMR 20kB" << "Excel 15kB" << "Word 20kB" << "PowerPoint 40kB" |
353 << "MIDI 10kB" << "WAVE 20kB" << "AMR 20kB" << "Excel 15kB" << "Word 20kB" << "PowerPoint 40kB" |
310 << "Text 10kB" << "Text 70kB" << "3GPP 70kB" << "MP3 250kB" << "AAC 100kB" << "RM 95kB"; |
354 << "Text 10kB" << "Text 70kB" << "3GPP 70kB" << "MP3 250kB" << "AAC 100kB" << "RM 95kB"; |
311 |
355 } |
312 //ret = Notifications::popupListDialog(text, itemList, indexes); |
356 else{ |
313 // TODO: HbSelectionDialog handle close & user choice |
357 Notifications::error("Error in resource id."); |
314 Notifications::popupListDialog(text, itemList, HbAbstractItemView::MultiSelection); |
358 return EFalse; |
315 |
359 } |
316 if (ret == true) { |
360 |
317 aIndexes->Reset(); |
361 try{ |
318 for (int i = 0; i < indexes.count(); i++) { |
362 CreatorSelectionDialog::launch(text, itemList, aSelectedItems, aObserver, aUserData); |
319 aIndexes->AppendL(indexes.at(i)); |
363 success = ETrue; |
320 } |
364 } |
321 } |
365 catch (std::exception& e) |
322 } |
366 { |
323 return ret; |
367 Notifications::error( QString("exception: ")+e.what() ); |
|
368 } |
|
369 return success; |
324 } |
370 } |
325 |
371 |
326 void EngineWrapper::CloseCreatorApp() |
372 void EngineWrapper::CloseCreatorApp() |
327 { |
373 { |
328 MainView::closeApp(); |
374 MainView::closeApp(); |