708 } |
710 } |
709 } |
711 } |
710 |
712 |
711 void CPodcastFeedView::HandleImportFeedsL() |
713 void CPodcastFeedView::HandleImportFeedsL() |
712 { |
714 { |
713 // TFileName fileName; |
715 CAknMemorySelectionDialog* memDlg = |
714 // fileName.Zero(); |
716 CAknMemorySelectionDialog::NewL(ECFDDialogTypeNormal, ETrue); |
715 // TFileName startFolder; |
717 CleanupStack::PushL(memDlg); |
716 // startFolder.Zero(); |
718 CAknMemorySelectionDialog::TMemory memory = |
717 // TInt types = AknCommonDialogsDynMem::EMemoryTypePhone | AknCommonDialogsDynMem::EMemoryTypeMMC |AknCommonDialogsDynMem::EMemoryTypeInternalMassStorage| AknCommonDialogsDynMem::EMemoryTypeRemote; |
719 CAknMemorySelectionDialog::EPhoneMemory; |
718 // |
720 |
719 // HBufC *title = iCoeEnv->AllocReadResourceLC(R_PODCAST_SELECT_OPML); |
721 if (memDlg->ExecuteL(memory)) |
720 // if (AknCommonDialogsDynMem::RunSelectDlgLD (types, fileName, |
722 { |
721 // startFolder, NULL, NULL, *title)) |
723 TFileName importName; |
722 // { |
724 |
723 // |
725 if (memory==CAknMemorySelectionDialog::EMemoryCard) |
724 // if(fileName.Length()>0) |
726 { |
725 // { |
727 importName = PathInfo:: MemoryCardRootPath(); |
726 // HBufC *waitText = iEikonEnv->AllocReadResourceLC(R_IMPORTING); |
728 } |
727 // iOpmlState = EOpmlImporting; |
729 else |
728 // ShowWaitDialogL(*waitText); |
730 { |
729 // CleanupStack::PopAndDestroy(waitText); |
731 importName = PathInfo:: PhoneMemoryRootPath(); |
730 // |
732 } |
731 // TRAPD(err, iPodcastModel.FeedEngine().ImportFeedsL(fileName)); |
733 |
732 // |
734 CAknFileSelectionDialog* dlg = CAknFileSelectionDialog::NewL(ECFDDialogTypeNormal, R_PODCAST_IMPORT_PODCAST); |
733 // if (err != KErrNone) { |
735 CleanupStack::PushL(dlg); |
734 // TBuf<KMaxMessageLength> message; |
736 |
735 // iEikonEnv->ReadResourceL(message, R_IMPORT_FEED_FAILURE); |
737 dlg->SetDefaultFolderL(importName); |
736 // ShowErrorMessageL(message); |
738 |
737 // } |
739 if(dlg->ExecuteL(importName)) |
738 // } |
740 { |
739 // |
741 if(importName.Length()>0) |
740 // } |
742 { |
741 // CleanupStack::PopAndDestroy(title); |
743 iPodcastModel.FeedEngine().ImportFeedsL(importName); |
|
744 UpdateListboxItemsL(); |
|
745 } |
|
746 } |
|
747 CleanupStack::PopAndDestroy(dlg); |
|
748 } |
|
749 CleanupStack::PopAndDestroy(memDlg); |
742 } |
750 } |
743 |
751 |
744 void CPodcastFeedView::HandleExportFeedsL() |
752 void CPodcastFeedView::HandleExportFeedsL() |
745 { |
753 { |
746 // TFileName fileName; |
754 CAknMemorySelectionDialog* memDlg = |
747 // fileName.Copy(_L("feeds.opml")); |
755 CAknMemorySelectionDialog::NewL(ECFDDialogTypeSave, ETrue); |
748 // TFileName startFolder; |
756 CleanupStack::PushL(memDlg); |
749 // startFolder.Zero(); |
757 CAknMemorySelectionDialog::TMemory memory = |
750 // TInt types = AknCommonDialogsDynMem::EMemoryTypePhone | AknCommonDialogsDynMem::EMemoryTypeMMC |AknCommonDialogsDynMem::EMemoryTypeInternalMassStorage| AknCommonDialogsDynMem::EMemoryTypeRemote; |
758 CAknMemorySelectionDialog::EPhoneMemory; |
751 // |
759 |
752 // HBufC *title = iCoeEnv->AllocReadResourceLC(R_PODCAST_SELECT_FOLDER); |
760 if (memDlg->ExecuteL(memory)) |
753 // if (AknCommonDialogsDynMem::RunSaveDlgLD (types, fileName, |
761 { |
754 // startFolder, NULL, NULL, *title)) |
762 TFileName pathName; |
755 // { |
763 |
756 // TFileName temp; |
764 if (memory==CAknMemorySelectionDialog::EMemoryCard) |
757 // TRAPD(err, iPodcastModel.FeedEngine().ExportFeedsL(temp)); |
765 { |
758 // BaflUtils::CopyFile(iEikonEnv->FsSession(), temp, fileName); |
766 pathName = PathInfo::MemoryCardRootPath(); |
759 // BaflUtils::DeleteFile(iEikonEnv->FsSession(),temp); |
767 } |
760 // if (err == KErrNone) |
768 else |
761 // { |
769 { |
762 // UpdateListboxItemsL(); |
770 pathName = PathInfo::PhoneMemoryRootPath(); |
763 // TInt numFeeds = iPodcastModel.FeedEngine().GetSortedFeeds().Count(); |
771 } |
764 // |
772 |
765 // TBuf<KMaxMessageLength> message; |
773 CAknFileSelectionDialog* dlg = CAknFileSelectionDialog::NewL(ECFDDialogTypeSave, R_PODCAST_EXPORT_FEEDS); |
766 // TBuf<KMaxMessageLength> templ; |
774 CleanupStack::PushL(dlg); |
767 // iEikonEnv->ReadResourceL(templ, R_EXPORT_FEED_SUCCESS); |
775 |
768 // message.Format(templ, numFeeds); |
776 if(dlg->ExecuteL(pathName)) |
769 // ShowOkMessageL(message); |
777 { |
770 // } |
778 CAknFileNamePromptDialog *fileDlg = CAknFileNamePromptDialog::NewL(R_PODCAST_FILENAME_PROMPT_DIALOG); |
771 // else |
779 CleanupStack::PushL(fileDlg); |
772 // { |
780 fileDlg->SetPathL(pathName); |
773 // TBuf<KMaxMessageLength> message; |
781 TFileName fileName; |
774 // iEikonEnv->ReadResourceL(message, R_EXPORT_FEED_FAILURE); |
782 if (fileDlg->ExecuteL(fileName) && fileName.Length() > 0) |
775 // ShowErrorMessageL(message); |
783 { |
776 // } |
784 pathName.Append(fileName); |
777 // } |
785 TFileName temp; |
778 // CleanupStack::PopAndDestroy(title); |
786 iPodcastModel.FeedEngine().ExportFeedsL(temp); |
|
787 RFs fs; |
|
788 fs.Connect(); |
|
789 BaflUtils::CopyFile(fs, temp, pathName); |
|
790 BaflUtils::DeleteFile(fs,temp); |
|
791 fs.Close(); |
|
792 } |
|
793 CleanupStack::PopAndDestroy(fileDlg); |
|
794 } |
|
795 CleanupStack::PopAndDestroy(dlg); |
|
796 } |
|
797 CleanupStack::PopAndDestroy(memDlg); |
779 } |
798 } |
780 |
799 |
781 void CPodcastFeedView::CheckResumeDownloadL() |
800 void CPodcastFeedView::CheckResumeDownloadL() |
782 { |
801 { |
783 // if there are shows queued for downloading, ask if we should resume now |
802 // if there are shows queued for downloading, ask if we should resume now |