From 649d47b1cf9cadbecd1e868933c4aad102b14bbe Mon Sep 17 00:00:00 2001 From: chinons098 Date: Tue, 21 Nov 2023 17:31:00 -0500 Subject: [PATCH] filemanager v0.6.19 --- src/app/shared/system-service/file.service.ts | 37 +++++++++++++++++++ .../system-apps/desktop/colorutil/colors.ts | 8 +--- .../filemanager/filemanager.component.html | 9 ++++- .../filemanager/filemanager.component.ts | 18 ++++++++- 4 files changed, 62 insertions(+), 10 deletions(-) diff --git a/src/app/shared/system-service/file.service.ts b/src/app/shared/system-service/file.service.ts index 1c36182d..d8c58024 100644 --- a/src/app/shared/system-service/file.service.ts +++ b/src/app/shared/system-service/file.service.ts @@ -293,6 +293,43 @@ export class FileService{ }); } + public async renameFileAsync(path:string, newFileName:string): Promise { + await this.initBrowserFsAsync(); + + new Promise((resolve, reject) =>{ + + this._fileSystem.unlink(path,(err) =>{ + if(err){ + console.log('deleteFileAsync error:',err) + reject(err) + } + + resolve(console.log('successfully deleted')); + }); + }).then(()=>{ + //Send update notification + this.dirFilesUpdateNotify.next(); + }); + } + + public async deleteFileAsync(path:string): Promise { + await this.initBrowserFsAsync(); + + new Promise((resolve, reject) =>{ + this._fileSystem.unlink(path,(err) =>{ + if(err){ + console.log('deleteFileAsync error:',err) + reject(err) + } + + resolve(console.log('successfully deleted')); + }); + }).then(()=>{ + //Send update notification + this.dirFilesUpdateNotify.next(); + }); + } + public getFileEntriesFromDirectory(fileList:string[], directory:string):FileEntry[]{ for(let i = 0; i < fileList.length; i++){ diff --git a/src/app/system-apps/desktop/colorutil/colors.ts b/src/app/system-apps/desktop/colorutil/colors.ts index b459b2f1..c125835b 100644 --- a/src/app/system-apps/desktop/colorutil/colors.ts +++ b/src/app/system-apps/desktop/colorutil/colors.ts @@ -102,11 +102,5 @@ export class Colors{ }; return toHex(r) + toHex(g) + toHex(b); - } - -// // Example usage: -// const originalColor = '#3498db'; -// const modifiedColor = changeHue(originalColor, 45); // Shift hue by 45 degrees -// console.log(modifiedColor); - + } } \ No newline at end of file diff --git a/src/app/system-apps/filemanager/filemanager.component.html b/src/app/system-apps/filemanager/filemanager.component.html index e526cf4c..d725404b 100644 --- a/src/app/system-apps/filemanager/filemanager.component.html +++ b/src/app/system-apps/filemanager/filemanager.component.html @@ -40,11 +40,18 @@
-
+
Delete
+ +
+
+ Rename +
+
+
diff --git a/src/app/system-apps/filemanager/filemanager.component.ts b/src/app/system-apps/filemanager/filemanager.component.ts index 0767c551..5c11e56c 100644 --- a/src/app/system-apps/filemanager/filemanager.component.ts +++ b/src/app/system-apps/filemanager/filemanager.component.ts @@ -47,7 +47,6 @@ export class FilemanagerComponent implements OnInit, AfterViewInit, OnDestroy { directory ='/osdrive/desktop'; files:FileInfo[] = []; - gridSize = 90; private autoAlign = true; private autoArrange = false; @@ -132,7 +131,7 @@ export class FilemanagerComponent implements OnInit, AfterViewInit, OnDestroy { console.log('runProcess:',file) // console.log('what was clicked:',file.getFileName +'-----' + file.getOpensWith +'---'+ file.getCurrentPath +'----'+ file.getIcon) TBD - if((file.getOpensWith == 'fileexplorer' && file.getFileName != 'File Explorer') && file.getFileType =='folder'){ + if((file.getOpensWith === 'fileexplorer' && file.getFileName !== 'File Explorer') && file.getFileType ==='folder'){ this.updateExplorerIconAndName.emit(file); this.directory = file.getCurrentPath; @@ -274,6 +273,21 @@ export class FilemanagerComponent implements OnInit, AfterViewInit, OnDestroy { 1 } + deleteFile():void{ + //this.deletedFiles.push(this.selectedFile); + this._fileService.deleteFileAsync(this.selectedFile.getCurrentPath) + + // this.files = this.files.filter((files_el) =>{ + // return this.deletedFiles.filter(function(delFiles_el){ + // return delFiles_el.getCurrentPath !== files_el.getCurrentPath; + // }).length == 0 + // }); + } + + renameFile():void{ +1 + } + private getComponentDetail():Process{ return new Process(this.processId, this.name, this.icon, this.hasWindow, this.type);