Skip to content

Commit

Permalink
filemanager v0.6.19
Browse files Browse the repository at this point in the history
  • Loading branch information
chinonso098 committed Nov 21, 2023
1 parent 21db5dd commit 649d47b
Show file tree
Hide file tree
Showing 4 changed files with 62 additions and 10 deletions.
37 changes: 37 additions & 0 deletions src/app/shared/system-service/file.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -293,6 +293,43 @@ export class FileService{
});
}

public async renameFileAsync(path:string, newFileName:string): Promise<void> {
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<void> {
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++){
Expand Down
8 changes: 1 addition & 7 deletions src/app/system-apps/desktop/colorutil/colors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);

}
}
9 changes: 8 additions & 1 deletion src/app/system-apps/filemanager/filemanager.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,18 @@
<div class="line-container"><div class="line"></div></div>
<div class="empty-line-container"></div>

<div class="icon-vertical-menu-item">
<div class="icon-vertical-menu-item"(click)="deleteFile()">
<span class="span head"> <figure class="figure-cntxt-menu" > </figure></span>
<span class="span mid">Delete</span>
<span class="span tail"> <figure class="figure-cntxt-menu"> </figure> </span>
</div>

<div class="icon-vertical-menu-item" (click)="renameFile()">
<span class="span head"> <figure class="figure-cntxt-menu" > </figure></span>
<span class="span mid">Rename</span>
<span class="span tail"> <figure class="figure-cntxt-menu"> </figure> </span>
</div>

<div class="empty-line-container"></div>
</div>
</ol>
18 changes: 16 additions & 2 deletions src/app/system-apps/filemanager/filemanager.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ export class FilemanagerComponent implements OnInit, AfterViewInit, OnDestroy {
directory ='/osdrive/desktop';
files:FileInfo[] = [];


gridSize = 90;
private autoAlign = true;
private autoArrange = false;
Expand Down Expand Up @@ -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;

Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit 649d47b

Please sign in to comment.