From 9122ea61455ddc92bba5ebd86ed7fb5aa099960e Mon Sep 17 00:00:00 2001 From: chinonso098 Date: Sat, 21 Sep 2024 22:57:21 -0400 Subject: [PATCH] minor changes --- .../system-component/menu/menu.component.html | 6 ++++ .../system-component/menu/menu.component.ts | 2 +- .../audioplayer/audioplayer.component.ts | 4 ++- .../fileexplorer/fileexplorer.component.ts | 20 +++++++++--- .../filemanager/filemanager.component.ts | 32 +++++++++++++++++-- .../photoviewer/photoviewer.component.ts | 7 ++-- 6 files changed, 59 insertions(+), 12 deletions(-) diff --git a/src/app/shared/system-component/menu/menu.component.html b/src/app/shared/system-component/menu/menu.component.html index f57171a..a5d621b 100644 --- a/src/app/shared/system-component/menu/menu.component.html +++ b/src/app/shared/system-component/menu/menu.component.html @@ -37,6 +37,12 @@
+ +
+
+
+
+
diff --git a/src/app/shared/system-component/menu/menu.component.ts b/src/app/shared/system-component/menu/menu.component.ts index 3936914..e1566b0 100644 --- a/src/app/shared/system-component/menu/menu.component.ts +++ b/src/app/shared/system-component/menu/menu.component.ts @@ -25,7 +25,7 @@ export class MenuComponent implements OnChanges, OnDestroy{ readonly fileExplrMngrMenuOption = this._consts.FILE_EXPLORER_FILE_MANAGER_MENU_OPTION; readonly tskBarMenuOption = this._consts.TASK_BAR_MENU_OPTION; readonly defaultFileMenuOrder = this._consts.DEFAULT_FILE_MENU_ORDER; - readonly defaultFolderMenuOrder = this._consts.DEFAULT_FILE_MENU_ORDER; + readonly defaultFolderMenuOrder = this._consts.DEFAULT_FOLDER_MENU_ORDER; readonly fileExplrFolderMenuOrder = this._consts.FILE_EXPLORER_FOLDER_MENU_ORDER; readonly fileExplrFileMenuOrder = this._consts.FILE_EXPLORER_FILE_MENU_ORDER; readonly fileExplrUniqueMenuOrder = this._consts.FILE_EXPLORER_UNIQUE_MENU_ORDER; diff --git a/src/app/system-apps/audioplayer/audioplayer.component.ts b/src/app/system-apps/audioplayer/audioplayer.component.ts index d909deb..8f3ff4f 100644 --- a/src/app/system-apps/audioplayer/audioplayer.component.ts +++ b/src/app/system-apps/audioplayer/audioplayer.component.ts @@ -16,6 +16,7 @@ import { Subscription } from 'rxjs'; import { ScriptService } from 'src/app/shared/system-service/script.services'; import * as htmlToImage from 'html-to-image'; import { TaskBarPreviewImage } from '../taskbarpreview/taskbar.preview'; + // eslint-disable-next-line no-var declare const Howl:any; declare const SiriWave:any; @@ -69,7 +70,8 @@ export class AudioPlayerComponent implements BaseComponent, OnInit, OnDestroy, A name= 'audioplayer'; hasWindow = true; - icon = '/osdrive/Cheetah/System/Imageres/audioplayer.png'; + + icon = `${this._consts.IMAGE_BASE_PATH}audioplayer.png`; processId = 0; type = ComponentType.User; displayName = 'Howlerjs'; diff --git a/src/app/system-apps/fileexplorer/fileexplorer.component.ts b/src/app/system-apps/fileexplorer/fileexplorer.component.ts index 6c490b7..2db5378 100644 --- a/src/app/system-apps/fileexplorer/fileexplorer.component.ts +++ b/src/app/system-apps/fileexplorer/fileexplorer.component.ts @@ -1323,13 +1323,25 @@ export class FileExplorerComponent implements BaseComponent, OnInit, AfterViewIn let horizontalShift = false; let verticalShift = false; - if((horizontalDiff) >= 0 && (horizontalDiff) <= 10){ - this.isShiftSubMenuLeft = true; - horizontalShift = true; + const menuWidth = 210; + const subMenuWidth = 205; + + // if((horizontalDiff) >= 0 && (horizontalDiff) <= 10){ + // this.isShiftSubMenuLeft = true; + // horizontalShift = true; + + // xAxis = evt.clientX - rect.left - horizontalDiff; + // } - xAxis = evt.clientX - rect.left - horizontalDiff; + if((horizontalDiff) < menuWidth){ + horizontalShift = true; + this.isShiftSubMenuLeft = true; + const diff = menuWidth - horizontalDiff; + xAxis = evt.clientX - rect.left - diff; } + + if((verticalDiff) >= 40 && (verticalDiff) <= menuHeight){ const shifMenuUpBy = menuHeight - verticalDiff; verticalShift = true; diff --git a/src/app/system-apps/filemanager/filemanager.component.ts b/src/app/system-apps/filemanager/filemanager.component.ts index 8aef25f..9473d0d 100644 --- a/src/app/system-apps/filemanager/filemanager.component.ts +++ b/src/app/system-apps/filemanager/filemanager.component.ts @@ -13,6 +13,7 @@ import { FileManagerService } from 'src/app/shared/system-service/file.manager.s import { FormGroup, FormBuilder } from '@angular/forms'; import { MenuService } from 'src/app/shared/system-service/menu.services'; import { Constants } from 'src/app/system-files/constants'; +import { GeneralMenu } from 'src/app/shared/system-component/menu/menu.item'; @Component({ @@ -76,19 +77,24 @@ export class FileManagerComponent implements BaseComponent, OnInit, AfterViewIni directory ='/Users/Desktop'; files:FileInfo[] = []; - menuData = [ + sourceData:GeneralMenu[] = [ {icon:'', label: 'Open', action: this.onTriggerRunProcess.bind(this) }, + {icon:'', label: 'Pin to Quick access', action: this.doNothing.bind(this) }, + {icon:'', label: 'Open in Terminal', action: this.doNothing.bind(this) }, {icon:'', label: 'Pin to Start', action: this.doNothing.bind(this) }, {icon:'', label: 'Pin to Taskbar', action: this.pinIconToTaskBar.bind(this) }, {icon:'', label: 'Cut', action: this.onCut.bind(this) }, - {icon:'', label: 'Copy', action: this.onCopy.bind(this) }, + {icon:'', label: 'Copy', action: this.onCopy.bind(this)}, + {icon:'', label: 'Create shortcut', action: this.doNothing.bind(this)}, {icon:'', label: 'Delete', action: this.onDeleteFile.bind(this) }, {icon:'', label: 'Rename', action: this.onRenameFileTxtBoxShow.bind(this) }, {icon:'', label: 'Properties', action: this.doNothing.bind(this) } ]; + + menuData:GeneralMenu[] =[]; fileExplrMngrMenuOption = this._consts.FILE_EXPLORER_FILE_MANAGER_MENU_OPTION; - menuOrder = this._consts.DEFAULT_FILE_MENU_ORDER; + menuOrder = ''; constructor( processIdService:ProcessIDService, runningProcessService:RunningProcessService, fileInfoService:FileService, triggerProcessService:TriggerProcessService, fileManagerService:FileManagerService, formBuilder: FormBuilder, menuService:MenuService) { @@ -210,6 +216,7 @@ export class FileManagerComponent implements BaseComponent, OnInit, AfterViewIni this._runningProcessService.addEventOriginator(uid); this._menuService.hideContextMenus.next(); + this.adjustContextMenuData(file); this.selectedFile = file; this.showCntxtMenu = !this.showCntxtMenu; @@ -225,6 +232,25 @@ export class FileManagerComponent implements BaseComponent, OnInit, AfterViewIni evt.preventDefault(); } + adjustContextMenuData(file:FileInfo):void{ + this.menuData = []; + + console.log('adjustContextMenuData - filename:',file.getCurrentPath); + if(file.getIsFile){ + //files can not be opened in terminal, pinned to start, opened in new window, pin to Quick access + this.menuOrder = this._consts.DEFAULT_FILE_MENU_ORDER; + for(const x of this.sourceData) { + if(x.label === 'Open in Terminal' || x.label === 'Pin to Quick access' || x.label === 'Pin to Start'){ /*nothing*/} + else{ + this.menuData.push(x); + } + } + }else{ + this.menuOrder = this._consts.DEFAULT_FOLDER_MENU_ORDER; + this.menuData = this.sourceData; + } + } + doNothing():void{ console.log('do nothing called'); } diff --git a/src/app/system-apps/photoviewer/photoviewer.component.ts b/src/app/system-apps/photoviewer/photoviewer.component.ts index 9e094db..ec3d5db 100644 --- a/src/app/system-apps/photoviewer/photoviewer.component.ts +++ b/src/app/system-apps/photoviewer/photoviewer.component.ts @@ -16,6 +16,7 @@ import { Constants } from 'src/app/system-files/constants'; import * as htmlToImage from 'html-to-image'; import { TaskBarPreviewImage } from '../taskbarpreview/taskbar.preview'; + @Component({ selector: 'cos-photoviewer', templateUrl: './photoviewer.component.html', @@ -39,14 +40,14 @@ export class PhotoViewerComponent implements BaseComponent, OnInit, OnDestroy, A SECONDS_DELAY = 250; name= 'photoviewer'; hasWindow = true; - icon = '/osdrive/Cheetah/System/Imageres/photoviewer.png'; + icon = `${this._consts.IMAGE_BASE_PATH}photoviewer.png`; isMaximizable = false; processId = 0; type = ComponentType.System; displayName = 'PhotoViewer'; private defaultImg = '/osdrive/Pictures/Samples/no_img.jpeg'; - private tst_imageList:string[] = ['/osdrive/Pictures/Samples/Chill on the Moon.jpg', '/osdrive/Pictures/Samples/Mystical.jpg', - '/osdrive/Pictures/Samples/Sparkling Water.jpg'] + private tst_imageList:string[] = [`${this._consts.IMAGE_BASE_PATH}Chill on the Moon.jpg`, `${this._consts.IMAGE_BASE_PATH}Mystical.jpg`, + `${this._consts.IMAGE_BASE_PATH}Sparkling Water.jpg`] imageList:string[] = []