diff --git a/src/app/shared/system-component/filetreeview/filetreeview.component.ts b/src/app/shared/system-component/filetreeview/filetreeview.component.ts index fc88cd3..12fbd3e 100644 --- a/src/app/shared/system-component/filetreeview/filetreeview.component.ts +++ b/src/app/shared/system-component/filetreeview/filetreeview.component.ts @@ -12,9 +12,11 @@ export class FileTreeViewComponent implements OnInit, OnChanges { @Input() showRoot = true; @Input() isHoverActive = false; @Output() updateFileTreeData = new EventEmitter(); + @Output() navigateToPath = new EventEmitter(); chevronBtnStyle:Record = {}; expandedViews:string[]= []; + selectedElementId = 0; constructor( ){ // @@ -173,11 +175,11 @@ export class FileTreeViewComponent implements OnInit, OnChanges { } } - showCurrentSelection(path:string):void{ - 1 + navigateToSelectedPath(name:string, path:string):void{ + const data:string[] = [name, path] + this.navigateToPath.emit(data); } - setcolorChevron(isHoverActive:boolean):void{ if(!isHoverActive){ this.chevronBtnStyle ={ diff --git a/src/app/system-apps/fileexplorer/fileexplorer.component.html b/src/app/system-apps/fileexplorer/fileexplorer.component.html index ae41295..a96d4bb 100644 --- a/src/app/system-apps/fileexplorer/fileexplorer.component.html +++ b/src/app/system-apps/fileexplorer/fileexplorer.component.html @@ -227,7 +227,7 @@
diff --git a/src/app/system-apps/fileexplorer/fileexplorer.component.ts b/src/app/system-apps/fileexplorer/fileexplorer.component.ts index af15cdb..759d033 100644 --- a/src/app/system-apps/fileexplorer/fileexplorer.component.ts +++ b/src/app/system-apps/fileexplorer/fileexplorer.component.ts @@ -109,6 +109,7 @@ export class FileExplorerComponent implements BaseComponent, OnInit, AfterViewIn recentPathEntries:string[] = []; upPathEntries:string[] = ['/Desktop']; _directoryHops:string[] = ['This PC']; + fileTreeHistory:string[] = []; SECONDS_DELAY:number[] = [100, 1500, 6000, 12000, 250]; defaultviewOption = ViewOptions.MEDIUM_ICON_VIEW; @@ -675,7 +676,7 @@ export class FileExplorerComponent implements BaseComponent, OnInit, AfterViewIn } } - private async loadFilesInfoAsync(path?:string, showUrl=true):Promise{ + private async loadFilesInfoAsync(showUrlFiles=true):Promise{ this.files = []; this._fileService.resetDirectoryFiles(); let directoryEntries = await this._fileService.getEntriesFromDirectoryAsync(this.directory); @@ -683,7 +684,7 @@ export class FileExplorerComponent implements BaseComponent, OnInit, AfterViewIn console.log('directoryEntries:',directoryEntries); if(this.directory === '/'){ - if(!showUrl){ + if(!showUrlFiles){ const filteredDirectoryEntries = directoryEntries.filter(x => !x.includes('.url')); directoryEntries = filteredDirectoryEntries; this._directoryFilesEntires = this._fileService.getFileEntriesFromDirectory(filteredDirectoryEntries,this.directory); @@ -738,32 +739,34 @@ export class FileExplorerComponent implements BaseComponent, OnInit, AfterViewIn console.log('updateFileTreeAsync called', path); - const tmpFileTreeNode:FileTreeNode[] = []; - this._fileService.resetDirectoryFiles(); - const directoryEntries = await this._fileService.getEntriesFromDirectoryAsync(path); - - // this.directory, will not be correct for all cases. Make sure to check - for(const dirEntry of directoryEntries){ - - const isFile = await this._fileService.checkIfDirectory(`${path}/${dirEntry}`); - const ftn:FileTreeNode = { - name : dirEntry, - path: `${path}/${dirEntry}`, - isFolder: isFile, - children: [] + if(!this.fileTreeHistory.includes(path)){ + const tmpFileTreeNode:FileTreeNode[] = []; + this._fileService.resetDirectoryFiles(); + const directoryEntries = await this._fileService.getEntriesFromDirectoryAsync(path); + + // this.directory, will not be correct for all cases. Make sure to check + for(const dirEntry of directoryEntries){ + + const isFile = await this._fileService.checkIfDirectory(`${path}/${dirEntry}`); + const ftn:FileTreeNode = { + name : dirEntry, + path: `${path}/${dirEntry}`, + isFolder: isFile, + children: [] + } + + console.log('update-ftn:', ftn); + tmpFileTreeNode.push(ftn); } - - console.log('update-ftn:', ftn); - tmpFileTreeNode.push(ftn); + + const res = this.addChildrenToNode(this.fileTreeNode, path, tmpFileTreeNode); + console.log('updatedTreeData:', res); + this.fileTreeNode = res; + this.fileTreeHistory.push(path); } - - const res = this.addChildrenToNode(this.fileTreeNode, path, tmpFileTreeNode); - console.log('updatedTreeData:', res); - this.fileTreeNode = res; } private addChildrenToNode(treeData: FileTreeNode[], nodePath: string, newChildren: FileTreeNode[] ): FileTreeNode[] { - // Create a new array for the updated treeData const updatedTreeData: FileTreeNode[] = []; @@ -795,38 +798,6 @@ export class FileExplorerComponent implements BaseComponent, OnInit, AfterViewIn return updatedTreeData; } - // public addChildrenToNode(treeData: FileTreeNode[], nodeName: string, newChildren: string[] ): FileTreeNode[] { - - // // Create a new array for the updated treeData - // const updatedTreeData: FileTreeNode[] = []; - - // for (let i = 0; i < treeData.length; i++) { - // const node = treeData[i]; - // const updatedNode: FileTreeNode = { - // name: node.name, - // isFile: node.isFile, - // children: node.children ? [] : undefined - // }; - - // // If the current node matches the nodeName, add the new children - // if (node.name === nodeName) { - // updatedNode.children = (node.children || []).concat( - // newChildren.map(childName => ({ name: childName, isFile: node.isFile})) - // ); - // } - - // // If the node has children, recursively call this function on the children - // if (node.children) { - // updatedNode.children = this.addChildrenToNode(node.children, nodeName, newChildren); - // } - - // // Add the updated node to the new treeData array - // updatedTreeData.push(updatedNode); - // } - - // return updatedTreeData; - // } - async runProcess(file:FileInfo):Promise{ console.log('fileexplorer-runProcess:',file) @@ -862,6 +833,43 @@ export class FileExplorerComponent implements BaseComponent, OnInit, AfterViewIn } } + async navigateToFolder(data:string[]):Promise{ + const thisPC = 'This-PC'; + const fileName = data[0]; + const path = data[1]; + + if(!this.isNavigatedBefore){ + this.prevPathEntries.push(this.directory); + this.upPathEntries.push(this.directory); + this.isNavigatedBefore = true; + } + + this.isPrevBtnActive = true; + this.displayName = fileName; + this.directory = (path === thisPC)? '/' : path; + + if(path === `/Users/${fileName}`) + this.icon = `osdrive/Cheetah/System/Imageres/${fileName.toLocaleLowerCase()}_folder.png`; + else + this.icon = `osdrive/Cheetah/System/Imageres/folder.png`; + + this.prevPathEntries.push(this.directory); + this.upPathEntries.push(this.directory); + + if(this.recentPathEntries.indexOf(this.directory) == -1){ + this.recentPathEntries.push(this.directory); + } + + this.populateHopsList(); + this.setNavPathIcon(fileName, path); + this.storeAppState(path); + + if(path === thisPC || path !== '/') + await this.loadFilesInfoAsync(); + else if(path === '/') + await this.loadFilesInfoAsync(false); + } + setNavPathIcon(fileName:string, directory:string){ console.log(`fileexplorer - setNavPathIcon: fileName:${fileName} ----- directory:${directory}`) diff --git a/src/osdrive.json b/src/osdrive.json index 0497508..6ef60ec 100644 --- a/src/osdrive.json +++ b/src/osdrive.json @@ -1 +1 @@ -{"3d-objects.url":null,"Cheetah":{"System":{"Imageres":{"3d-objects_folder.png":null,"3d_objects_folder_small.png":null,"arrow_down.png":null,"arrow_next.png":null,"arrow_next_1.png":null,"arrow_up.png":null,"audioplayer.png":null,"camera_48.png":null,"chkmark26.png":null,"chkmark32.png":null,"chkmark32_blk.png":null,"circle.png":null,"circle_blk.png":null,"cmd.png":null,"code-editor-2_48.png":null,"config.png":null,"content_view.ico":null,"content_view.png":null,"cross_mark_32.png":null,"desktop_folder.png":null,"desktop_folder_small.png":null,"details_pane.png":null,"details_view.ico":null,"details_view.png":null,"documents.png":null,"documents_24.png":null,"documents_folder.png":null,"documents_folder_small.png":null,"downloads_folder.png":null,"downloads_folder_small.png":null,"econo.png":null,"empty_folder.png":null,"empty_recycle.ico":null,"emulator_1.png":null,"emulator_2.png":null,"extra_large_image.png":null,"file.png":null,"file_explorer.png":null,"folder.png":null,"folder_folder_small.png":null,"games.png":null,"games_folder.png":null,"games_folder_small.png":null,"generic_program.png":null,"grey_history_32.png":null,"grey_nav_expand_32.png":null,"grey_nav_forward_32.png":null,"grey_nav_refresh_32.png":null,"images.png":null,"info.png":null,"js-dos-logo.png":null,"large_image.png":null,"lightning_flash.png":null,"list_of_thumbnails_view.png":null,"markdown-2_50.png":null,"markdown-50.png":null,"markdown-file_50.png":null,"medium_icons_view.png":null,"music_file.png":null,"music_folder.png":null,"music_folder_small.png":null,"my_computer.png":null,"nav_expand_32.png":null,"nav_left_32.png":null,"nav_right_32.png":null,"nav_up-32.png":null,"navigation_pane.png":null,"os_disk.png":null,"pdf-48.png":null,"photos_48.png":null,"picture_16.png":null,"pictures.png":null,"pictures_folder.png":null,"pictures_folder_small.png":null,"pin_24.png":null,"preview_pane.png":null,"red_x.png":null,"search_32.png":null,"small_icons_view.ico":null,"small_icons_view.png":null,"taskmanger.png":null,"taskmanger_2.png":null,"terminal-2_48.png":null,"terminal_48.png":null,"text-editor_48.png":null,"this_pc.png":null,"tiles_view.png":null,"unknown.png":null,"unpin_24.png":null,"unpin_32.png":null,"video_file.ico":null,"video_file.png":null,"videoplayer-2_48.png":null,"videoplayer.png":null,"videos.png":null,"videos_folder.png":null,"videos_folder_small.png":null,"vs-code_48.png":null,"white_history_32.png":null,"x_32.png":null}}},"Program-Files":{"simple.txt":null},"Users":{"3D-Objects":{},"Desktop":{"fileexplorer.url":null,"heat.url":null,"hello.url":null,"surfs.url":null,"taskmanager.url":null,"terminal.url":null,"titanium.url":null},"Documents":{"Credits.md":null,"Dynamic Programming.txt":null,"PDFs":{"CyberPower_UM_EC650LCD 2.pdf":null,"MotherBoard":{"PRO-B650-P-WIFI.pdf":null}},"Screen-Shots":{"Sample ScreenShot.png":null},"simple.txt":null,"starting a new proj in VSCode.txt":null},"Downloads":{"anothertest.txt":null},"Games":{"D3D.url":null,"Data":{"D3D.jsdos":null,"Digger.jsdos":null,"Doom.jsdos":null,"Jill of the Jungle.jsdos":null,"Machine Nation.jsdos":null,"Shadow Knight.jsdos":null},"Diggers.url":null,"Doom.url":null,"Flash-Games ":{"logo-anim.swf":null},"icons":{"d3d.png":null,"diggers.png":null,"doom.png":null,"doom1.png":null}},"Music":{"jazz-club-in-new-orleans.mp3":null,"titanium.mp3":null,"watr-fluid.mp3":null},"Pictures":{"Samples":{"Chill on the Moon.jpg":null,"Sparkling Water.jpg":null,"Sunset Car.jpg":null,"Sunset.jpg":null,"mystical.jpg":null,"no_img.jpeg":null},"favicon.ico":null,"favicon1.ico":null,"favicon_nice.png":null,"heat.png":null},"Videos":{"nuts.mp4":null,"surfs.mp4":null}},"desktop.url":null,"documents.url":null,"downloads.url":null,"games.url":null,"music.url":null,"pictures.url":null,"videos.url":null} +{"3d-objects.url":null,"Cheetah":{"System":{"Imageres":{"3d-objects_folder.png":null,"3d-objects_folder_small.png":null,"arrow_down.png":null,"arrow_next.png":null,"arrow_next_1.png":null,"arrow_up.png":null,"audioplayer.png":null,"camera_48.png":null,"chkmark26.png":null,"chkmark32.png":null,"chkmark32_blk.png":null,"circle.png":null,"circle_blk.png":null,"cmd.png":null,"code-editor-2_48.png":null,"config.png":null,"content_view.png":null,"cross_mark_32.png":null,"desktop_folder.png":null,"desktop_folder_small.png":null,"details_pane.png":null,"details_view.ico":null,"details_view.png":null,"documents.png":null,"documents_folder.png":null,"documents_folder_small.png":null,"downloads_folder.png":null,"downloads_folder_small.png":null,"econo.png":null,"empty_folder.png":null,"empty_recycle.ico":null,"emulator_1.png":null,"emulator_2.png":null,"extra_large_image.png":null,"file.png":null,"file_explorer.png":null,"folder.png":null,"folder_folder_small.png":null,"games.png":null,"games_folder.png":null,"games_folder_small.png":null,"generic_program.png":null,"grey_history_32.png":null,"grey_nav_expand_32.png":null,"grey_nav_forward_32.png":null,"grey_nav_refresh_32.png":null,"images.png":null,"info.png":null,"js-dos-logo.png":null,"large_image.png":null,"lightning_flash.png":null,"list_of_thumbnails_view.png":null,"markdown-2_50.png":null,"markdown-50.png":null,"markdown-file_50.png":null,"medium_icons_view.png":null,"music_file.png":null,"music_folder.png":null,"music_folder_small.png":null,"my_computer.png":null,"nav_expand_32.png":null,"nav_left_32.png":null,"nav_right_32.png":null,"nav_up-32.png":null,"navigation_pane.png":null,"os_disk.png":null,"pdf-48.png":null,"photos_48.png":null,"picture_16.png":null,"pictures.png":null,"pictures_folder.png":null,"pictures_folder_small.png":null,"pin_24.png":null,"preview_pane.png":null,"red_x.png":null,"search_32.png":null,"small_icons_view.png":null,"taskmanger.png":null,"taskmanger_2.png":null,"terminal-2_48.png":null,"terminal_48.png":null,"text-editor_48.png":null,"this_pc.png":null,"tiles_view.png":null,"unknown.png":null,"unpin_24.png":null,"unpin_32.png":null,"video_file.png":null,"videoplayer-2_48.png":null,"videoplayer.png":null,"videos.png":null,"videos_folder.png":null,"videos_folder_small.png":null,"vs-code_48.png":null,"white_history_32.png":null,"x_32.png":null}}},"Program-Files":{"simple.txt":null},"Users":{"3D-Objects":{},"Desktop":{"fileexplorer.url":null,"heat.url":null,"hello.url":null,"surfs.url":null,"taskmanager.url":null,"terminal.url":null,"titanium.url":null},"Documents":{"Credits.md":null,"Dynamic Programming.txt":null,"PDFs":{"CyberPower_UM_EC650LCD 2.pdf":null,"MotherBoard":{"PRO-B650-P-WIFI.pdf":null}},"Screen-Shots":{"Sample ScreenShot.png":null},"simple.txt":null,"starting a new proj in VSCode.txt":null},"Downloads":{"anothertest.txt":null},"Games":{"D3D.url":null,"Data":{"D3D.jsdos":null,"Digger.jsdos":null,"Doom.jsdos":null,"Jill of the Jungle.jsdos":null,"Machine Nation.jsdos":null,"Shadow Knight.jsdos":null},"Diggers.url":null,"Doom.url":null,"Flash-Games ":{"logo-anim.swf":null},"icons":{"d3d.png":null,"diggers.png":null,"doom.png":null,"doom1.png":null}},"Music":{"jazz-club-in-new-orleans.mp3":null,"titanium.mp3":null,"watr-fluid.mp3":null},"Pictures":{"Samples":{"Chill on the Moon.jpg":null,"Sparkling Water.jpg":null,"Sunset Car.jpg":null,"Sunset.jpg":null,"mystical.jpg":null,"no_img.jpeg":null},"favicon.ico":null,"favicon1.ico":null,"favicon_nice.png":null,"heat.png":null},"Videos":{"nuts.mp4":null,"surfs.mp4":null}},"desktop.url":null,"documents.url":null,"downloads.url":null,"games.url":null,"music.url":null,"pictures.url":null,"videos.url":null} diff --git a/src/osdrive/Cheetah/System/Imageres/3d_objects_folder_small.png b/src/osdrive/Cheetah/System/Imageres/3d-objects_folder_small.png similarity index 100% rename from src/osdrive/Cheetah/System/Imageres/3d_objects_folder_small.png rename to src/osdrive/Cheetah/System/Imageres/3d-objects_folder_small.png diff --git a/src/osdrive/Cheetah/System/Imageres/content_view.ico b/src/osdrive/Cheetah/System/Imageres/content_view.ico deleted file mode 100644 index 524762c..0000000 Binary files a/src/osdrive/Cheetah/System/Imageres/content_view.ico and /dev/null differ diff --git a/src/osdrive/Cheetah/System/Imageres/documents_24.png b/src/osdrive/Cheetah/System/Imageres/documents_24.png deleted file mode 100644 index e7c61cc..0000000 Binary files a/src/osdrive/Cheetah/System/Imageres/documents_24.png and /dev/null differ diff --git a/src/osdrive/Cheetah/System/Imageres/documents_folder_small.png b/src/osdrive/Cheetah/System/Imageres/documents_folder_small.png index 65d7e29..e7c61cc 100644 Binary files a/src/osdrive/Cheetah/System/Imageres/documents_folder_small.png and b/src/osdrive/Cheetah/System/Imageres/documents_folder_small.png differ diff --git a/src/osdrive/Cheetah/System/Imageres/small_icons_view.ico b/src/osdrive/Cheetah/System/Imageres/small_icons_view.ico deleted file mode 100644 index 3b9cb91..0000000 Binary files a/src/osdrive/Cheetah/System/Imageres/small_icons_view.ico and /dev/null differ diff --git a/src/osdrive/Cheetah/System/Imageres/video_file.ico b/src/osdrive/Cheetah/System/Imageres/video_file.ico deleted file mode 100644 index ee5f28a..0000000 Binary files a/src/osdrive/Cheetah/System/Imageres/video_file.ico and /dev/null differ