37 #include <eikmenup.h> |
38 #include <eikmenup.h> |
38 #include <gulicon.h> |
39 #include <gulicon.h> |
39 #include <uikon.hrh> |
40 #include <uikon.hrh> |
40 #include <AknServerApp.h> |
41 #include <AknServerApp.h> |
41 #include <UriUtils.h> |
42 #include <UriUtils.h> |
|
43 |
|
44 #ifdef BRDO_APP_GALLERY_SUPPORTED_FF |
42 #include <MGXFileManagerFactory.h> |
45 #include <MGXFileManagerFactory.h> |
43 #include <CMGXFileManager.h> |
46 #include <CMGXFileManager.h> |
44 #include <MediaGalleryUID.h> //Gallery UIDs |
47 #include <MediaGalleryUID.h> //Gallery UIDs |
|
48 #endif |
|
49 |
45 #include <DocumentHandler.h> |
50 #include <DocumentHandler.h> |
46 #include "bautils.h" |
51 #include "bautils.h" |
47 #include <BrowserUiSDKCRKeys.h> |
52 #include <BrowserUiSDKCRKeys.h> |
48 #include <aknnotewrappers.h> |
53 #include <aknnotewrappers.h> |
49 #include <StringLoader.h> |
54 #include <StringLoader.h> |
703 // |
711 // |
704 CDownloadMgrUiDownloadsList::CDownloadMgrUiDownloadsList |
712 CDownloadMgrUiDownloadsList::CDownloadMgrUiDownloadsList |
705 ( CDownloadMgrUiLibRegistry& aRegistryModel ) |
713 ( CDownloadMgrUiLibRegistry& aRegistryModel ) |
706 : CDownloadMgrUiBase( aRegistryModel ), |
714 : CDownloadMgrUiBase( aRegistryModel ), |
707 iIsVisible( EFalse ), |
715 iIsVisible( EFalse ), |
708 iIsCancelInProgress( EFalse ) |
716 iIsCancelInProgress( EFalse ), |
|
717 iPlatformSupportsGallery( EFalse ) |
709 { |
718 { |
710 } |
719 } |
711 |
720 |
712 // ----------------------------------------------------------------------------- |
721 // ----------------------------------------------------------------------------- |
713 // CDownloadMgrUiDownloadsList::ConstructL |
722 // CDownloadMgrUiDownloadsList::ConstructL |
729 CLOG_WRITE(" iEventHandlerArray"); |
738 CLOG_WRITE(" iEventHandlerArray"); |
730 iIsTimerStarted = EFalse; |
739 iIsTimerStarted = EFalse; |
731 iProgressiveDownload = EFalse; |
740 iProgressiveDownload = EFalse; |
732 iRegistryModel.DownloadMgr().GetBoolAttribute(EDlMgrProgressiveDownload, iProgressiveDownload); |
741 iRegistryModel.DownloadMgr().GetBoolAttribute(EDlMgrProgressiveDownload, iProgressiveDownload); |
733 CLOG_LEAVEFN("CDownloadMgrUiDownloadsList::ConstructL"); |
742 CLOG_LEAVEFN("CDownloadMgrUiDownloadsList::ConstructL"); |
|
743 |
|
744 //whether the platform supports gallery app or not; defined in browser_platfrom_variant.hrh |
|
745 #ifdef BRDO_APP_GALLERY_SUPPORTED_FF |
|
746 iPlatformSupportsGallery = ETrue; |
|
747 #endif |
|
748 |
734 } |
749 } |
735 |
750 |
736 // ----------------------------------------------------------------------------- |
751 // ----------------------------------------------------------------------------- |
737 // CDownloadMgrUiDownloadsList::NewL |
752 // CDownloadMgrUiDownloadsList::NewL |
738 // ----------------------------------------------------------------------------- |
753 // ----------------------------------------------------------------------------- |
1872 result = BaflUtils::DeleteFile( rfs, fileNamePtr ); |
1887 result = BaflUtils::DeleteFile( rfs, fileNamePtr ); |
1873 } |
1888 } |
1874 CleanupStack::PopAndDestroy( &rfs ); |
1889 CleanupStack::PopAndDestroy( &rfs ); |
1875 |
1890 |
1876 // Notify Media Gallery about new media file |
1891 // Notify Media Gallery about new media file |
|
1892 |
|
1893 #ifdef BRDO_APP_GALLERY_SUPPORTED_FF |
|
1894 |
1877 CMGXFileManager* mgFileManager = MGXFileManagerFactory::NewFileManagerL( |
1895 CMGXFileManager* mgFileManager = MGXFileManagerFactory::NewFileManagerL( |
1878 CEikonEnv::Static()->FsSession() ); |
1896 CEikonEnv::Static()->FsSession() ); |
1879 if( fileNamePtr.Length() > 0 ) |
1897 if( fileNamePtr.Length() > 0 ) |
1880 { |
1898 { |
1881 TRAP_IGNORE( mgFileManager->UpdateL( fileNamePtr ) ); |
1899 TRAP_IGNORE( mgFileManager->UpdateL( fileNamePtr ) ); |
2013 |
2043 |
2014 CEikonEnv::Static()->EikAppUi()->ActivateViewL( |
2044 CEikonEnv::Static()->EikAppUi()->ActivateViewL( |
2015 id, |
2045 id, |
2016 TUid::Uid( KMediaGalleryCmdMoveFocusToAllFilesTab ), |
2046 TUid::Uid( KMediaGalleryCmdMoveFocusToAllFilesTab ), |
2017 customMessage ); |
2047 customMessage ); |
|
2048 #endif |
2018 break; |
2049 break; |
2019 } |
2050 } |
2020 |
2051 |
2021 case EDownloadsListCmdFileManager: |
2052 case EDownloadsListCmdFileManager: |
2022 { |
2053 { |
|
2054 |
|
2055 if ( iPlatformSupportsGallery ) |
|
2056 { |
|
2057 LaunchFileManagerApplication(); |
|
2058 } |
|
2059 else |
|
2060 { |
|
2061 CAiwServiceHandler* serviceHandler = CAiwServiceHandler::NewL(); |
|
2062 serviceHandler->AttachL( R_DMUL_FILEMANAGER_AIW_INTEREST ); |
2023 |
2063 |
2024 TApaTaskList taskList( CEikonEnv::Static()->WsSession() ); |
2064 CAiwGenericParamList* inParams = CAiwGenericParamList::NewLC(); |
2025 CRepository *repository=CRepository::NewL(KCRUidBrowser); |
2065 |
2026 TInt fileManagerId; |
2066 //get the destination file path |
2027 User::LeaveIfError(repository->Get(KFileManagerUid , fileManagerId )); |
2067 HBufC* fileName = HBufC::NewLC( KMaxPath ); |
2028 TUid id = TUid::Uid(fileManagerId); |
2068 TPtr fileNamePtr = fileName->Des(); |
2029 TApaTask task = taskList.FindApp( id ); |
2069 User::LeaveIfError ( currDownload.GetStringAttribute( EDlAttrDestFilename, fileNamePtr ) ); |
2030 if ( task.Exists() ) |
2070 |
2031 { |
2071 // Locate the last '\\' character and remove the file name so that we will get the folder name |
2032 task.BringToForeground(); |
2072 TInt len = fileNamePtr.LocateReverse('\\'); |
2033 } |
2073 TPtr ptr = fileNamePtr.LeftTPtr(len + 1); |
2034 else |
2074 |
2035 { |
2075 // Append the directory name to be opened |
2036 RApaLsSession appArcSession; |
2076 inParams->AppendL(TAiwGenericParam(EGenericParamDir, TAiwVariant( ptr ) ) ); |
2037 User::LeaveIfError( appArcSession.Connect() ); |
2077 //Append the sort method |
2038 CleanupClosePushL( appArcSession ); |
2078 inParams->AppendL(TAiwGenericParam(EGenericParamDir, TAiwVariant( KMostRecentSort ) ) ); |
2039 TThreadId id1; |
2079 //Append to define whether to open in standalone mode |
2040 User::LeaveIfError( appArcSession.StartDocument( KNullDesC, id, id1 ) ); |
2080 inParams->AppendL(TAiwGenericParam(EGenericParamDir, TAiwVariant( KLauchStandAlone ) ) ); |
2041 CleanupStack::PopAndDestroy( &appArcSession ); |
2081 |
2042 } |
2082 TRAPD( err, serviceHandler->ExecuteServiceCmdL( KAiwCmdEdit, *inParams, serviceHandler->OutParamListL() )); |
|
2083 |
|
2084 CleanupStack::PopAndDestroy( fileName ); |
|
2085 CleanupStack::PopAndDestroy( inParams ); |
|
2086 |
|
2087 delete serviceHandler; |
|
2088 |
|
2089 //if there is any error, open the file manager in root folder |
|
2090 if (err != KErrNone) |
|
2091 { |
|
2092 LaunchFileManagerApplication(); |
|
2093 } |
|
2094 } |
|
2095 |
2043 break; |
2096 break; |
2044 } |
2097 } |
2045 |
2098 |
2046 default: |
2099 default: |
2047 { |
2100 { |
2048 break; |
2101 break; |
2049 } |
2102 } |
2050 } |
2103 } |
2051 } |
2104 } |
|
2105 |
|
2106 |
|
2107 // ----------------------------------------------------------------------------- |
|
2108 // CDownloadMgrUiDownloadsList::LaunchFileManagerApplication |
|
2109 // ----------------------------------------------------------------------------- |
|
2110 // |
|
2111 |
|
2112 void CDownloadMgrUiDownloadsList::LaunchFileManagerApplication() |
|
2113 { |
|
2114 |
|
2115 TApaTaskList taskList( CEikonEnv::Static()->WsSession() ); |
|
2116 CRepository *repository=CRepository::NewL(KCRUidBrowser); |
|
2117 TInt fileManagerId; |
|
2118 User::LeaveIfError(repository->Get(KFileManagerUid , fileManagerId )); |
|
2119 TUid id = TUid::Uid(fileManagerId); |
|
2120 TApaTask task = taskList.FindApp( id ); |
|
2121 if ( task.Exists() ) |
|
2122 { |
|
2123 task.BringToForeground(); |
|
2124 } |
|
2125 else |
|
2126 { |
|
2127 RApaLsSession appArcSession; |
|
2128 User::LeaveIfError( appArcSession.Connect() ); |
|
2129 CleanupClosePushL( appArcSession ); |
|
2130 TThreadId id1; |
|
2131 User::LeaveIfError( appArcSession.StartDocument( KNullDesC, id, id1 ) ); |
|
2132 CleanupStack::PopAndDestroy( &appArcSession ); |
|
2133 } |
|
2134 |
|
2135 } |
|
2136 |
2052 |
2137 |
2053 // ----------------------------------------------------------------------------- |
2138 // ----------------------------------------------------------------------------- |
2054 // CDownloadMgrUiDownloadsList::DynInitMenuPaneL |
2139 // CDownloadMgrUiDownloadsList::DynInitMenuPaneL |
2055 // ----------------------------------------------------------------------------- |
2140 // ----------------------------------------------------------------------------- |
2056 // |
2141 // |
2282 CLOG_WRITE_FORMAT(" download count: %d",downloadCount); |
2369 CLOG_WRITE_FORMAT(" download count: %d",downloadCount); |
2283 |
2370 |
2284 if ( !( 1 < downloadCount ) ) |
2371 if ( !( 1 < downloadCount ) ) |
2285 { |
2372 { |
2286 aMenuPane->DeleteMenuItem( EDownloadsListCmdCancelAll ); |
2373 aMenuPane->DeleteMenuItem( EDownloadsListCmdCancelAll ); |
2287 } |
2374 } |
2288 |
2375 |
2289 if ( isCompleted && gallerySupported && s60Supported ) |
2376 if ( iPlatformSupportsGallery ) |
2290 { |
2377 { |
2291 aMenuPane->DeleteMenuItem( EDownloadsListCmdFileManager ); |
2378 if ( isCompleted && gallerySupported && s60Supported ) |
2292 } |
2379 { |
|
2380 aMenuPane->DeleteMenuItem( EDownloadsListCmdFileManager ); |
|
2381 } |
|
2382 } |
2293 } |
2383 } |
2294 |
2384 |
2295 if ( wasCompleted && !isThemeType ) |
2385 if ( wasCompleted && !isThemeType ) |
2296 { |
2386 { |
2297 InitializeAIWPlugInMenusL( aResourceId, aMenuPane, currDownload ); |
2387 InitializeAIWPlugInMenusL( aResourceId, aMenuPane, currDownload ); |