23 #include <aknsettingitemlist.h> |
23 #include <aknsettingitemlist.h> |
24 #include <aknnavide.h> |
24 #include <aknnavide.h> |
25 #include <podcast.rsg> |
25 #include <podcast.rsg> |
26 #include "SettingsEngine.h" |
26 #include "SettingsEngine.h" |
27 |
27 |
28 #include <caknfileselectiondialog.h> |
28 #include <akncommondialogsdynmem.h> |
29 #include <caknmemoryselectiondialog.h> |
|
30 #include <pathinfo.h> |
29 #include <pathinfo.h> |
|
30 #include <aknquerydialog.h> |
31 |
31 |
32 |
32 |
33 class CIapSetting: public CAknEnumeratedTextPopupSettingItem |
33 class CIapSetting: public CAknEnumeratedTextPopupSettingItem |
34 { |
34 { |
35 public: |
35 public: |
287 |
287 |
288 void EditItemL (TInt aIndex, TBool aCalledFromMenu) |
288 void EditItemL (TInt aIndex, TBool aCalledFromMenu) |
289 { |
289 { |
290 DP("EditItemL BEGIN"); |
290 DP("EditItemL BEGIN"); |
291 if (aIndex == 0) { |
291 if (aIndex == 0) { |
292 CAknMemorySelectionDialog* memDlg = |
292 TFileName selectedFolder; |
293 CAknMemorySelectionDialog::NewL(ECFDDialogTypeNormal, ETrue); |
293 selectedFolder.Copy(iShowDir); |
294 CleanupStack::PushL(memDlg); |
294 TFileName startFolder; |
295 CAknMemorySelectionDialog::TMemory memory = |
295 startFolder.Zero(); |
296 CAknMemorySelectionDialog::EPhoneMemory; |
296 TInt types = AknCommonDialogsDynMem::EMemoryTypePhone | AknCommonDialogsDynMem::EMemoryTypeMMC |AknCommonDialogsDynMem::EMemoryTypeInternalMassStorage| AknCommonDialogsDynMem::EMemoryTypeRemote; |
297 |
|
298 if (memDlg->ExecuteL(memory)) |
|
299 { |
|
300 TFileName importName; |
|
301 |
297 |
302 if (memory==CAknMemorySelectionDialog::EMemoryCard) |
298 HBufC *title = iCoeEnv->AllocReadResourceLC(R_PODCAST_SELECT_FOLDER); |
303 { |
299 if (AknCommonDialogsDynMem::RunFolderSelectDlgLD (types, selectedFolder, |
304 importName = PathInfo:: MemoryCardRootPath(); |
300 startFolder, NULL, NULL, *title)) |
|
301 { |
|
302 _LIT(KPodcastsDir, "Podcasts"); |
|
303 TInt pos = selectedFolder.Find(KPodcastsDir); |
|
304 if (pos == KErrNotFound || pos != selectedFolder.Length()-9) |
|
305 { |
|
306 // append "Podcasts" if the folder isn't already called this |
|
307 selectedFolder.Append(KPodcastsDir); |
|
308 } |
|
309 |
|
310 if (selectedFolder[selectedFolder.Length()-1] != '\\') |
|
311 { |
|
312 selectedFolder.Append(_L("\\")); |
|
313 } |
|
314 |
|
315 iShowDir.Copy(selectedFolder); |
|
316 LoadSettingsL(); |
305 } |
317 } |
306 else |
318 CleanupStack::PopAndDestroy(title); |
307 { |
|
308 importName = PathInfo:: PhoneMemoryRootPath(); |
|
309 } |
|
310 |
|
311 CAknFileSelectionDialog* dlg = CAknFileSelectionDialog::NewL(ECFDDialogTypeSave, R_PODCAST_SHOWDIR_SELECTOR); |
|
312 HBufC* select = iEikonEnv->AllocReadResourceLC(R_PODCAST_SOFTKEY_SELECT); |
|
313 dlg->SetLeftSoftkeyFileL(*select); |
|
314 CleanupStack::PopAndDestroy(select); |
|
315 CleanupStack::PushL(dlg); |
|
316 |
|
317 dlg->SetDefaultFolderL(importName); |
|
318 |
|
319 if(dlg->ExecuteL(importName)) |
|
320 { |
|
321 importName.Append(_L("Podcasts")); |
|
322 iShowDir.Copy(importName); |
|
323 LoadSettingsL(); |
|
324 } |
|
325 CleanupStack::PopAndDestroy(dlg); |
|
326 } |
|
327 CleanupStack::PopAndDestroy(memDlg); |
|
328 } |
319 } |
329 else { |
320 else { |
330 CAknSettingItemList::EditItemL(aIndex,aCalledFromMenu); |
321 CAknSettingItemList::EditItemL(aIndex,aCalledFromMenu); |
331 } |
322 } |
332 StoreSettingsL(); |
323 StoreSettingsL(); |
547 case EAknSoftkeyBack: |
539 case EAknSoftkeyBack: |
548 { |
540 { |
549 iListbox->StoreSettings(); |
541 iListbox->StoreSettings(); |
550 AppUi()->ActivateViewL(iPreviousView); |
542 AppUi()->ActivateViewL(iPreviousView); |
551 } |
543 } |
552 break; |
544 break; |
|
545 case EPodcastResetDb: |
|
546 CAknQueryDialog* dlg= new(ELeave) CAknQueryDialog(); |
|
547 |
|
548 CleanupStack::PushL(dlg); |
|
549 HBufC *text = iCoeEnv->AllocReadResourceLC(R_RESET_DB_QUERY); |
|
550 dlg->SetPromptL(*text); |
|
551 CleanupStack::PopAndDestroy(text); |
|
552 CleanupStack::Pop(dlg); |
|
553 if(dlg->ExecuteLD(R_QUERYDLG)) |
|
554 { |
|
555 iPodcastModel.DropDB(); |
|
556 AppUi()->Exit(); |
|
557 } |
|
558 break; |
553 default: |
559 default: |
554 AppUi()->HandleCommandL(aCommand); |
560 AppUi()->HandleCommandL(aCommand); |
555 break; |
561 break; |
556 } |
562 } |
557 } |
563 } |