mirror of
https://github.com/lxsang/antos-frontend.git
synced 2024-11-16 17:48:21 +01:00
add more docs
This commit is contained in:
parent
023e61c01e
commit
4a941f0467
@ -1,9 +1,3 @@
|
|||||||
/*
|
|
||||||
* decaffeinate suggestions:
|
|
||||||
* DS102: Remove unnecessary code created because of implicit returns
|
|
||||||
* DS208: Avoid top-level this
|
|
||||||
* Full docs: https://github.com/decaffeinate/decaffeinate/blob/master/docs/suggestions.md
|
|
||||||
*/
|
|
||||||
// Copyright 2017-2018 Xuan Sang LE <xsang.le AT gmail DOT com>
|
// Copyright 2017-2018 Xuan Sang LE <xsang.le AT gmail DOT com>
|
||||||
|
|
||||||
// AnTOS Web desktop is is licensed under the GNU General Public
|
// AnTOS Web desktop is is licensed under the GNU General Public
|
||||||
@ -22,7 +16,7 @@
|
|||||||
// You should have received a copy of the GNU General Public License
|
// You should have received a copy of the GNU General Public License
|
||||||
//along with this program. If not, see https://www.gnu.org/licenses/.
|
//along with this program. If not, see https://www.gnu.org/licenses/.
|
||||||
|
|
||||||
this.onload = function () {
|
Ant.onload = function () {
|
||||||
$(document).on(
|
$(document).on(
|
||||||
"webkitfullscreenchange mozfullscreenchange fullscreenchange MSFullscreenChange",
|
"webkitfullscreenchange mozfullscreenchange fullscreenchange MSFullscreenChange",
|
||||||
() => (Ant.OS.GUI.fullscreen = !Ant.OS.GUI.fullscreen)
|
() => (Ant.OS.GUI.fullscreen = !Ant.OS.GUI.fullscreen)
|
||||||
|
@ -448,14 +448,6 @@ namespace OS {
|
|||||||
/**
|
/**
|
||||||
* A Calendar dialog allows user to select a date
|
* A Calendar dialog allows user to select a date
|
||||||
*
|
*
|
||||||
* @export
|
|
||||||
* @class CalendarDialog
|
|
||||||
* @extends {BasicDialog}
|
|
||||||
*/
|
|
||||||
export class CalendarDialog extends BasicDialog {
|
|
||||||
/**
|
|
||||||
* Creates an instance of CalendarDialog.
|
|
||||||
*
|
|
||||||
* Input data:
|
* Input data:
|
||||||
*
|
*
|
||||||
* ```typescript
|
* ```typescript
|
||||||
@ -464,6 +456,14 @@ namespace OS {
|
|||||||
* }
|
* }
|
||||||
* ```
|
* ```
|
||||||
*
|
*
|
||||||
|
* @export
|
||||||
|
* @class CalendarDialog
|
||||||
|
* @extends {BasicDialog}
|
||||||
|
*/
|
||||||
|
export class CalendarDialog extends BasicDialog {
|
||||||
|
/**
|
||||||
|
* Creates an instance of CalendarDialog.
|
||||||
|
*
|
||||||
* Callback data: a Date object represent the selected date
|
* Callback data: a Date object represent the selected date
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
|
@ -27,6 +27,9 @@ namespace OS {
|
|||||||
* to access to service visual contents such as: options,
|
* to access to service visual contents such as: options,
|
||||||
* task performing based on user interaction, etc.
|
* task performing based on user interaction, etc.
|
||||||
*
|
*
|
||||||
|
* Services are singleton processes, there is only
|
||||||
|
* one process of a service at a time
|
||||||
|
*
|
||||||
* @export
|
* @export
|
||||||
* @abstract
|
* @abstract
|
||||||
* @class BaseService
|
* @class BaseService
|
||||||
|
307
src/core/gui.ts
307
src/core/gui.ts
@ -17,41 +17,118 @@
|
|||||||
// along with this program. If not, see https://www.gnu.org/licenses/.
|
// along with this program. If not, see https://www.gnu.org/licenses/.
|
||||||
namespace OS {
|
namespace OS {
|
||||||
/**
|
/**
|
||||||
*
|
* This namespace is dedicated to all APIs related to AntOS UI system,
|
||||||
|
* these API are called AFX APIs which handle:
|
||||||
|
* - The mouse and keyboard interaction with the UI system
|
||||||
|
* - UI rendering
|
||||||
|
* - Custom tags definition
|
||||||
|
* - Load/unload system, applications and services UI
|
||||||
|
* - System dialogs definition
|
||||||
*/
|
*/
|
||||||
export namespace GUI {
|
export namespace GUI {
|
||||||
/**
|
/**
|
||||||
*
|
* AntOS keyboard shortcut type definition
|
||||||
*
|
*
|
||||||
* @export
|
* @export
|
||||||
* @interface ShortcutType
|
* @interface ShortcutType
|
||||||
*/
|
*/
|
||||||
export interface ShortcutType {
|
export interface ShortcutType {
|
||||||
|
/**
|
||||||
|
* Placeholder for all shortcut callbacks attached to `ALT` key, eg.
|
||||||
|
* ```typescript
|
||||||
|
* ALT.c = function() {..}
|
||||||
|
* // this function will be called when the hotkey `ALT-C` is triggered
|
||||||
|
* ```
|
||||||
|
*
|
||||||
|
* @memberof ShortcutType
|
||||||
|
*/
|
||||||
ALT: GenericObject<(e: JQuery.MouseDownEvent) => void>;
|
ALT: GenericObject<(e: JQuery.MouseDownEvent) => void>;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Placeholder for all shortcut callbacks attached to `CTRL` key, eg.
|
||||||
|
* ```typescript
|
||||||
|
* CTRL.c = function() {..}
|
||||||
|
* // this function will be called when the hotkey `CTRL-C` is triggered
|
||||||
|
* ```
|
||||||
|
*
|
||||||
|
* @memberof ShortcutType
|
||||||
|
*/
|
||||||
CTRL: GenericObject<(e: JQuery.MouseDownEvent) => void>;
|
CTRL: GenericObject<(e: JQuery.MouseDownEvent) => void>;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Placeholder for all shortcut callbacks attached to `SHIFT` key, eg.
|
||||||
|
* ```typescript
|
||||||
|
* SHIFT.c = function() {..}
|
||||||
|
* // this function will be called when the hotkey `SHIFT-C` is triggered
|
||||||
|
* ```
|
||||||
|
*
|
||||||
|
* @memberof ShortcutType
|
||||||
|
*/
|
||||||
SHIFT: GenericObject<(e: JQuery.MouseDownEvent) => void>;
|
SHIFT: GenericObject<(e: JQuery.MouseDownEvent) => void>;
|
||||||
|
/**
|
||||||
|
* Placeholder for all shortcut callbacks attached to `META` key, eg.
|
||||||
|
* ```typescript
|
||||||
|
* META[" "] = function() {..}
|
||||||
|
* // this function will be called when the hotkey `META-[space]` is triggered
|
||||||
|
* ```
|
||||||
|
*
|
||||||
|
* @memberof ShortcutType
|
||||||
|
*/
|
||||||
META: GenericObject<(e: JQuery.MouseDownEvent) => void>;
|
META: GenericObject<(e: JQuery.MouseDownEvent) => void>;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Basic item type definition which is usually used by some UI element
|
||||||
|
* such as list view, tree view, menu and grid view
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
* @export
|
* @export
|
||||||
* @interface BasicItemType
|
* @interface BasicItemType
|
||||||
*/
|
*/
|
||||||
export interface BasicItemType {
|
export interface BasicItemType {
|
||||||
|
/**
|
||||||
|
* Item text
|
||||||
|
*
|
||||||
|
* @type {(string | FormattedString)}
|
||||||
|
* @memberof BasicItemType
|
||||||
|
*/
|
||||||
text: string | FormattedString;
|
text: string | FormattedString;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Item children, usually used by tree view or menu item
|
||||||
|
* This property is keep for compatibility purposes only.
|
||||||
|
* Otherwise, the [[nodes]] property should be used
|
||||||
|
*
|
||||||
|
* @type {BasicItemType[]}
|
||||||
|
* @memberof BasicItemType
|
||||||
|
*/
|
||||||
children?: BasicItemType[];
|
children?: BasicItemType[];
|
||||||
|
/**
|
||||||
|
* Item children, usually used by tree view or menu item
|
||||||
|
*
|
||||||
|
* @type {BasicItemType[]}
|
||||||
|
* @memberof BasicItemType
|
||||||
|
*/
|
||||||
nodes?: BasicItemType[];
|
nodes?: BasicItemType[];
|
||||||
[propName: string]: any;
|
[propName: string]: any;
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* Element id of the virtual desktop, used by JQuery
|
||||||
|
*/
|
||||||
export var workspace: string = "#desktop";
|
export var workspace: string = "#desktop";
|
||||||
|
/**
|
||||||
|
* Indicate whether the system is in fullscreen mode
|
||||||
|
*/
|
||||||
export var fullscreen = false;
|
export var fullscreen = false;
|
||||||
|
/**
|
||||||
|
* Reference to the current system dialog, only one dialog
|
||||||
|
* is allowed at a time. A dialog may have sub dialog
|
||||||
|
*/
|
||||||
export var dialog: BaseDialog;
|
export var dialog: BaseDialog;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Placeholder for system shortcuts
|
||||||
|
*/
|
||||||
var shortcut: ShortcutType = {
|
var shortcut: ShortcutType = {
|
||||||
ALT: {},
|
ALT: {},
|
||||||
CTRL: {},
|
CTRL: {},
|
||||||
@ -60,12 +137,18 @@ namespace OS {
|
|||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Convert an application html scheme to
|
||||||
|
* UI elements, then insert this UI scheme to the DOM tree.
|
||||||
*
|
*
|
||||||
|
* This function renders the UI of the application before calling the
|
||||||
|
* application's [[main]] function
|
||||||
*
|
*
|
||||||
* @export
|
* @export
|
||||||
* @param {string} html
|
* @param {string} html html scheme string
|
||||||
* @param {BaseModel} app
|
* @param {BaseModel} app reference to the target application
|
||||||
* @param {(Element | string)} parent
|
* @param {(Element | string)} parent
|
||||||
|
* The parent HTML element where the application is rendered.
|
||||||
|
* This is usually the reference to the virtual desktop element.
|
||||||
*/
|
*/
|
||||||
export function htmlToScheme(
|
export function htmlToScheme(
|
||||||
html: string,
|
html: string,
|
||||||
@ -85,12 +168,13 @@ namespace OS {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
* Load an application scheme file then render
|
||||||
|
* it with [[htmlToScheme]]
|
||||||
*
|
*
|
||||||
* @export
|
* @export
|
||||||
* @param {string} path
|
* @param {string} path VFS path to the scheme file
|
||||||
* @param {BaseModel} app
|
* @param {BaseModel} app the target application
|
||||||
* @param {(HTMLElement | string)} parent
|
* @param {(HTMLElement | string)} parent The parent HTML element where the application is rendered.
|
||||||
*/
|
*/
|
||||||
export function loadScheme(
|
export function loadScheme(
|
||||||
path: string,
|
path: string,
|
||||||
@ -111,7 +195,7 @@ namespace OS {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
* Clear the current system theme
|
||||||
*
|
*
|
||||||
* @export
|
* @export
|
||||||
*/
|
*/
|
||||||
@ -120,11 +204,12 @@ namespace OS {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
* Load a theme based on its name, then refresh the
|
||||||
|
* system UI theme
|
||||||
*
|
*
|
||||||
* @export
|
* @export
|
||||||
* @param {string} name
|
* @param {string} name name of the theme e.g. `antos_dark`
|
||||||
* @param {boolean} force
|
* @param {boolean} force force to clear the system theme before applying the new one
|
||||||
*/
|
*/
|
||||||
export function loadTheme(name: string, force: boolean): void {
|
export function loadTheme(name: string, force: boolean): void {
|
||||||
if (force) {
|
if (force) {
|
||||||
@ -135,11 +220,14 @@ namespace OS {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
* Open a system dialog.
|
||||||
*
|
*
|
||||||
* @export
|
* @export
|
||||||
* @param {(string | BaseDialog)} d
|
* @param {(BaseDialog | string)} d a dialog object or a dialog class name
|
||||||
* @param {GenericObject<any>} data
|
* @param {GenericObject<any>} [data] input data of the dialog, refer to each
|
||||||
|
* dialog definition for the format of the input data
|
||||||
|
* @returns {Promise<any>} A promise on the callback data of the dialog, refer
|
||||||
|
* to each dialog definition for the format of the callback data
|
||||||
* @returns {Promise<any>}
|
* @returns {Promise<any>}
|
||||||
*/
|
*/
|
||||||
export function openDialog(
|
export function openDialog(
|
||||||
@ -170,10 +258,11 @@ namespace OS {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
* Find a list of applications that support a specific mime
|
||||||
|
* type in the system packages meta-data
|
||||||
*
|
*
|
||||||
* @export
|
* @export
|
||||||
* @param {string} mime
|
* @param {string} mime the mime type
|
||||||
* @returns {API.PackageMetaType[]}
|
* @returns {API.PackageMetaType[]}
|
||||||
*/
|
*/
|
||||||
export function appsByMime(mime: string): API.PackageMetaType[] {
|
export function appsByMime(mime: string): API.PackageMetaType[] {
|
||||||
@ -223,17 +312,16 @@ namespace OS {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
* Find all applications that have services attached to it.
|
||||||
|
* This function allows to collect all the services available
|
||||||
|
* on the system. These services may or may not be running.
|
||||||
*
|
*
|
||||||
* @export
|
* @export
|
||||||
* @returns {{
|
* @returns {GenericObject<API.PackageMetaType>} result in forme of:
|
||||||
* [index: string]: API.PackageMetaType;
|
* `service_name:service-meta-data` key-value pairs
|
||||||
* }}
|
|
||||||
*/
|
*/
|
||||||
export function appsWithServices(): {
|
export function appsWithServices(): GenericObject<API.PackageMetaType> {
|
||||||
[index: string]: API.PackageMetaType;
|
const o: GenericObject<API.PackageMetaType> = {};
|
||||||
} {
|
|
||||||
const o: { [index: string]: API.PackageMetaType } = {};
|
|
||||||
for (let k in setting.system.packages) {
|
for (let k in setting.system.packages) {
|
||||||
const v = setting.system.packages[k];
|
const v = setting.system.packages[k];
|
||||||
if (v && v.services && v.services.length > 0) {
|
if (v && v.services && v.services.length > 0) {
|
||||||
@ -244,10 +332,21 @@ namespace OS {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Find an launch an application using input application argument
|
||||||
|
* such as VFS file meta-data.
|
||||||
*
|
*
|
||||||
|
* Based on the input application argument, the function will try
|
||||||
|
* to find all applications that is compatible with that argument.
|
||||||
|
* Three cases possible:
|
||||||
|
* - There is no application that can handle the argument, a message will
|
||||||
|
* be notified to user.
|
||||||
|
* - There is one application that can handle the argument, the application
|
||||||
|
* will be launched with the argument
|
||||||
|
* - There are many applications that can handle the arguments, a selection
|
||||||
|
* dialog will be popped up and allows user to select an application to launch.
|
||||||
*
|
*
|
||||||
* @export
|
* @export
|
||||||
* @param {AppArgumentsType} it
|
* @param {AppArgumentsType} it application argument
|
||||||
* @returns {void}
|
* @returns {void}
|
||||||
*/
|
*/
|
||||||
export function openWith(it: AppArgumentsType): void {
|
export function openWith(it: AppArgumentsType): void {
|
||||||
@ -283,11 +382,15 @@ namespace OS {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Kil all processes related to an application, reload the application
|
||||||
|
* prototype definition and launch a new process of this application.
|
||||||
*
|
*
|
||||||
|
* This function is used only for debug purpose or used by
|
||||||
|
* AntOSDK during in-browser application development
|
||||||
*
|
*
|
||||||
* @export
|
* @export
|
||||||
* @param {string} app
|
* @param {string} app the application class name
|
||||||
* @param {AppArgumentsType[]} args
|
* @param {AppArgumentsType[]} args application arguments
|
||||||
* @returns {void}
|
* @returns {void}
|
||||||
*/
|
*/
|
||||||
export function forceLaunch(
|
export function forceLaunch(
|
||||||
@ -301,9 +404,13 @@ namespace OS {
|
|||||||
return launch(app, args);
|
return launch(app, args);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Kill an running processes of an application, then
|
||||||
|
* unregister the application prototype definition
|
||||||
|
* from the [[application]] namespace.
|
||||||
*
|
*
|
||||||
|
* This process is similar to uninstall the application
|
||||||
|
* from the current system state
|
||||||
*
|
*
|
||||||
* @export
|
* @export
|
||||||
* @param {string} app
|
* @param {string} app
|
||||||
@ -317,9 +424,14 @@ namespace OS {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Load an application if the application is not registered yet
|
||||||
|
* in the system.
|
||||||
*
|
*
|
||||||
|
* This function fist loads and registers the application prototype
|
||||||
|
* definition in the [[application]] namespace, then update
|
||||||
|
* the system packages meta-data
|
||||||
*
|
*
|
||||||
* @param {string} app
|
* @param {string} app application class name
|
||||||
* @returns {Promise<string>}
|
* @returns {Promise<string>}
|
||||||
*/
|
*/
|
||||||
function loadApp(app: string): Promise<string> {
|
function loadApp(app: string): Promise<string> {
|
||||||
@ -371,7 +483,10 @@ namespace OS {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Create a service process.
|
||||||
*
|
*
|
||||||
|
* Services are singleton processes, there is only
|
||||||
|
* one process of a service at a time
|
||||||
*
|
*
|
||||||
* @export
|
* @export
|
||||||
* @param {string} ph
|
* @param {string} ph
|
||||||
@ -417,10 +532,10 @@ namespace OS {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
* Synchronously start a list of services
|
||||||
*
|
*
|
||||||
* @export
|
* @export
|
||||||
* @param {string[]} srvs
|
* @param {string[]} srvs list of service class names
|
||||||
* @returns {Promise<any>}
|
* @returns {Promise<any>}
|
||||||
*/
|
*/
|
||||||
export function pushServices(srvs: string[]): Promise<any> {
|
export function pushServices(srvs: string[]): Promise<any> {
|
||||||
@ -445,19 +560,22 @@ namespace OS {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
* Launch an application with arguments
|
||||||
*
|
*
|
||||||
* @export
|
* @export
|
||||||
* @param {string} app
|
* @param {string} app application class name
|
||||||
* @param {AppArgumentsType[]} args
|
* @param {AppArgumentsType[]} args application arguments
|
||||||
*/
|
*/
|
||||||
export function launch(app: string, args: AppArgumentsType[]): void {
|
export function launch(app: string, args: AppArgumentsType[]): void {
|
||||||
if (!application[app]) {
|
if (!application[app]) {
|
||||||
// first load it
|
// first load it
|
||||||
loadApp(app)
|
loadApp(app)
|
||||||
.then((a) =>
|
.then((a) =>
|
||||||
PM.createProcess(app, application[app], args)
|
PM.createProcess(
|
||||||
.catch((e) =>
|
app,
|
||||||
|
application[app],
|
||||||
|
args
|
||||||
|
).catch((e) =>
|
||||||
announcer.osfail(
|
announcer.osfail(
|
||||||
__("Unable to launch: {0}", app),
|
__("Unable to launch: {0}", app),
|
||||||
e
|
e
|
||||||
@ -487,11 +605,11 @@ namespace OS {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
* Dock an application to the system application dock
|
||||||
*
|
*
|
||||||
* @export
|
* @export
|
||||||
* @param {BaseApplication} app
|
* @param {BaseApplication} app reference to the application process
|
||||||
* @param {API.PackageMetaType} meta
|
* @param {API.PackageMetaType} meta Application meta-data
|
||||||
* @returns {void}
|
* @returns {void}
|
||||||
*/
|
*/
|
||||||
export function dock(
|
export function dock(
|
||||||
@ -530,7 +648,7 @@ namespace OS {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
* Toggle system fullscreen
|
||||||
*
|
*
|
||||||
* @export
|
* @export
|
||||||
*/
|
*/
|
||||||
@ -566,7 +684,8 @@ namespace OS {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
* Remove an application process from the system application
|
||||||
|
* dock. This action will also exit the process
|
||||||
*
|
*
|
||||||
* @export
|
* @export
|
||||||
* @param {BaseApplication} app
|
* @param {BaseApplication} app
|
||||||
@ -577,10 +696,10 @@ namespace OS {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
* Attach a running service process to the system tray
|
||||||
*
|
*
|
||||||
* @export
|
* @export
|
||||||
* @param {BaseService} srv
|
* @param {BaseService} srv reference to the running service process
|
||||||
* @returns {void}
|
* @returns {void}
|
||||||
*/
|
*/
|
||||||
export function attachservice(srv: application.BaseService): void {
|
export function attachservice(srv: application.BaseService): void {
|
||||||
@ -589,10 +708,10 @@ namespace OS {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
* Detach a running process from the system tray
|
||||||
*
|
*
|
||||||
* @export
|
* @export
|
||||||
* @param {BaseService} srv
|
* @param {BaseService} srv reference to the running service process
|
||||||
* @returns {void}
|
* @returns {void}
|
||||||
*/
|
*/
|
||||||
export function detachservice(srv: application.BaseService): void {
|
export function detachservice(srv: application.BaseService): void {
|
||||||
@ -600,20 +719,21 @@ namespace OS {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Bind a context menu event to an AntOS element.
|
||||||
*
|
*
|
||||||
|
* This will find the fist element which defines a handle
|
||||||
|
* named [[contextMenuHandle]] and bind the context menu
|
||||||
|
* event to it.
|
||||||
*
|
*
|
||||||
* @param {JQuery.MouseEventBase} event
|
* @param {JQuery.MouseEventBase} event mouse event
|
||||||
* @returns {void}
|
* @returns {void}
|
||||||
*/
|
*/
|
||||||
function bindContextMenu(event: JQuery.MouseEventBase): void {
|
function bindContextMenu(event: JQuery.MouseEventBase): void {
|
||||||
var handle = function (e: HTMLElement) {
|
var handle = function (e: HTMLElement) {
|
||||||
if (e.contextmenuHandle) {
|
if (e.contextmenuHandle) {
|
||||||
const m = $("#contextmenu")[0] as tag.MenuTag;
|
const m = $("#contextmenu")[0] as tag.MenuTag;
|
||||||
m.onmenuselect = () => {}
|
m.onmenuselect = () => {};
|
||||||
return e.contextmenuHandle(
|
return e.contextmenuHandle(event, m);
|
||||||
event,
|
|
||||||
m
|
|
||||||
);
|
|
||||||
} else {
|
} else {
|
||||||
const p = $(e).parent().get(0);
|
const p = $(e).parent().get(0);
|
||||||
if (p !== $("#workspace").get(0)) {
|
if (p !== $("#workspace").get(0)) {
|
||||||
@ -626,11 +746,12 @@ namespace OS {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
* Register a hot key and its handle in the
|
||||||
|
* system shortcut
|
||||||
*
|
*
|
||||||
* @export
|
* @export
|
||||||
* @param {string} k
|
* @param {string} k the hotkey e.g. `ALT-C`
|
||||||
* @param {(e: JQuery.MouseDownEvent) => void} f
|
* @param {(e: JQuery.MouseDownEvent) => void} f handle function
|
||||||
* @returns {void}
|
* @returns {void}
|
||||||
*/
|
*/
|
||||||
export function bindKey(
|
export function bindKey(
|
||||||
@ -650,10 +771,10 @@ namespace OS {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
* Load and apply system wallpaper from the setting object
|
||||||
*
|
*
|
||||||
* @export
|
* @export
|
||||||
* @param {setting.WPSettingType} obj
|
* @param {setting.WPSettingType} obj wallpaper setting object
|
||||||
*/
|
*/
|
||||||
export function wallpaper(obj?: setting.WPSettingType): void {
|
export function wallpaper(obj?: setting.WPSettingType): void {
|
||||||
if (obj) {
|
if (obj) {
|
||||||
@ -667,11 +788,11 @@ namespace OS {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Show tooltip at the current mouse position
|
||||||
*
|
*
|
||||||
*
|
* @param {JQuery<HTMLElement>} el The target element that has the tooltip attribute
|
||||||
* @param {JQuery<HTMLElement>} el
|
* @param {string} text The text to be displayed
|
||||||
* @param {string} text
|
* @param {JQuery.MouseEventBase} e mouse event
|
||||||
* @param {JQuery.MouseEventBase} e
|
|
||||||
* @returns {void}
|
* @returns {void}
|
||||||
*/
|
*/
|
||||||
function showTooltip(
|
function showTooltip(
|
||||||
@ -720,7 +841,7 @@ namespace OS {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
* Refresh the content of the virtual desktop
|
||||||
*
|
*
|
||||||
* @param {tag.FloatListTag} desktop
|
* @param {tag.FloatListTag} desktop
|
||||||
*/
|
*/
|
||||||
@ -764,8 +885,12 @@ namespace OS {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Init the virtual desktop on boot:
|
||||||
*
|
*
|
||||||
*
|
* - Register listener for system hotkey
|
||||||
|
* - Bind the system context menu handle
|
||||||
|
* - Init and load the content of the virtual desktop
|
||||||
|
* - Init the system tooltip event handle
|
||||||
*/
|
*/
|
||||||
function initDM(): void {
|
function initDM(): void {
|
||||||
const scheme = $.parseHTML(schemes.ws);
|
const scheme = $.parseHTML(schemes.ws);
|
||||||
@ -806,9 +931,8 @@ namespace OS {
|
|||||||
}
|
}
|
||||||
shortcut[fnk][c](event);
|
shortcut[fnk][c](event);
|
||||||
return event.preventDefault();
|
return event.preventDefault();
|
||||||
})
|
});
|
||||||
}
|
});
|
||||||
);
|
|
||||||
// system menu and dock
|
// system menu and dock
|
||||||
$("#syspanel")[0].uify(undefined);
|
$("#syspanel")[0].uify(undefined);
|
||||||
$("#sysdock")[0].uify(undefined);
|
$("#sysdock")[0].uify(undefined);
|
||||||
@ -840,11 +964,15 @@ namespace OS {
|
|||||||
return e.calibrate();
|
return e.calibrate();
|
||||||
};
|
};
|
||||||
|
|
||||||
desktop.onlistselect = function (d: TagEventType<tag.ListItemEventData>) {
|
desktop.onlistselect = function (
|
||||||
|
d: TagEventType<tag.ListItemEventData>
|
||||||
|
) {
|
||||||
($("#sysdock")[0] as tag.AppDockTag).selectedApp = null;
|
($("#sysdock")[0] as tag.AppDockTag).selectedApp = null;
|
||||||
};
|
};
|
||||||
|
|
||||||
desktop.onlistdbclick = function (d: TagEventType<tag.ListItemEventData>) {
|
desktop.onlistdbclick = function (
|
||||||
|
d: TagEventType<tag.ListItemEventData>
|
||||||
|
) {
|
||||||
($("#sysdock")[0] as tag.AppDockTag).selectedApp = null;
|
($("#sysdock")[0] as tag.AppDockTag).selectedApp = null;
|
||||||
const it = desktop.selectedItem;
|
const it = desktop.selectedItem;
|
||||||
return openWith(it.data as AppArgumentsType);
|
return openWith(it.data as AppArgumentsType);
|
||||||
@ -889,7 +1017,9 @@ namespace OS {
|
|||||||
})()
|
})()
|
||||||
);
|
);
|
||||||
m.items = menu;
|
m.items = menu;
|
||||||
m.onmenuselect = function (evt: TagEventType<tag.MenuEventData>) {
|
m.onmenuselect = function (
|
||||||
|
evt: TagEventType<tag.MenuEventData>
|
||||||
|
) {
|
||||||
if (!evt.data || !evt.data.item) return;
|
if (!evt.data || !evt.data.item) return;
|
||||||
const item = evt.data.item.data;
|
const item = evt.data.item.data;
|
||||||
switch (item.dataid) {
|
switch (item.dataid) {
|
||||||
@ -934,7 +1064,7 @@ namespace OS {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
* Refresh the virtual desktop
|
||||||
*
|
*
|
||||||
* @export
|
* @export
|
||||||
*/
|
*/
|
||||||
@ -943,7 +1073,9 @@ namespace OS {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Show the login screen and perform the login operation.
|
||||||
*
|
*
|
||||||
|
* Once login successfully, the [[startAntOS]] will be called
|
||||||
*
|
*
|
||||||
* @export
|
* @export
|
||||||
*/
|
*/
|
||||||
@ -978,6 +1110,15 @@ namespace OS {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Start AntOS after a successful login.
|
||||||
|
*
|
||||||
|
* This function performs the following operations:
|
||||||
|
*
|
||||||
|
* - System cleanup
|
||||||
|
* - Apply system setting
|
||||||
|
* - Load desktop wallpaper and the current theme from the system setting
|
||||||
|
* - Load system package meta-data
|
||||||
|
* - Load and apply system locale and language
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
* @export
|
* @export
|
||||||
@ -1029,9 +1170,7 @@ namespace OS {
|
|||||||
pushServices(
|
pushServices(
|
||||||
(() => {
|
(() => {
|
||||||
const result = [];
|
const result = [];
|
||||||
for (let v of
|
for (let v of setting.system.startup.services) {
|
||||||
setting.system.startup.services
|
|
||||||
) {
|
|
||||||
result.push(v);
|
result.push(v);
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
@ -1040,7 +1179,7 @@ namespace OS {
|
|||||||
setting.system.startup.apps.map((a) => {
|
setting.system.startup.apps.map((a) => {
|
||||||
launch(a, []);
|
launch(a, []);
|
||||||
});
|
});
|
||||||
})
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -1048,13 +1187,21 @@ namespace OS {
|
|||||||
// initDM
|
// initDM
|
||||||
API.setLocale(setting.system.locale).then(() => initDM());
|
API.setLocale(setting.system.locale).then(() => initDM());
|
||||||
Ant.OS.announcer.observable.on("error", function (d) {
|
Ant.OS.announcer.observable.on("error", function (d) {
|
||||||
console.log(d.data.e)
|
console.log(d.data.e);
|
||||||
});
|
});
|
||||||
Ant.OS.announcer.observable.on("fail", function (d) {
|
Ant.OS.announcer.observable.on("fail", function (d) {
|
||||||
console.log(d.data.e)
|
console.log(d.data.e);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* HTML schemes used by the system:
|
||||||
|
* - The login screen scheme
|
||||||
|
* - The workspace including:
|
||||||
|
* - System panel
|
||||||
|
* - Virtual desktop
|
||||||
|
* - Context menu
|
||||||
|
* - System tooltip
|
||||||
|
*/
|
||||||
export const schemes: GenericObject<string> = {};
|
export const schemes: GenericObject<string> = {};
|
||||||
schemes.ws = `\
|
schemes.ws = `\
|
||||||
<afx-sys-panel id = "syspanel"></afx-sys-panel>
|
<afx-sys-panel id = "syspanel"></afx-sys-panel>
|
||||||
|
@ -217,7 +217,7 @@ namespace OS {
|
|||||||
* @param {string} t return data type:
|
* @param {string} t return data type:
|
||||||
* - jsonp: the response is an json object
|
* - jsonp: the response is an json object
|
||||||
* - script: the response is a javascript code
|
* - script: the response is a javascript code
|
||||||
* - xm, html: the response is a XML/HTML object
|
* - xml, html: the response is a XML/HTML object
|
||||||
* - text: plain text
|
* - text: plain text
|
||||||
*
|
*
|
||||||
* @returns {Promise<any>} A promise on a [[RequestResult]]
|
* @returns {Promise<any>} A promise on a [[RequestResult]]
|
||||||
|
@ -1,19 +1,38 @@
|
|||||||
namespace OS {
|
namespace OS {
|
||||||
|
/**
|
||||||
|
* This namespace dedicated to all operations related to system
|
||||||
|
* process management
|
||||||
|
*/
|
||||||
export namespace PM {
|
export namespace PM {
|
||||||
export type ProcessType = application.BaseApplication | application.BaseService;
|
/**
|
||||||
|
* A process is either an instance of an application or a service
|
||||||
|
*/
|
||||||
|
export type ProcessType =
|
||||||
|
| application.BaseApplication
|
||||||
|
| application.BaseService;
|
||||||
|
/**
|
||||||
|
* Alias to all classes that extends [[BaseModel]]
|
||||||
|
*/
|
||||||
export type ModelTypeClass = {
|
export type ModelTypeClass = {
|
||||||
new <T extends BaseModel>(args: AppArgumentsType[]): T;
|
new <T extends BaseModel>(args: AppArgumentsType[]): T;
|
||||||
};
|
};
|
||||||
|
/**
|
||||||
|
* Process id allocator, when a new process is created, the value of
|
||||||
|
* this variable is increased
|
||||||
|
*/
|
||||||
export var pidalloc: number = 0;
|
export var pidalloc: number = 0;
|
||||||
|
/**
|
||||||
|
* All running processes is stored in this variables
|
||||||
|
*/
|
||||||
export var processes: GenericObject<BaseModel[]> = {};
|
export var processes: GenericObject<BaseModel[]> = {};
|
||||||
/**
|
/**
|
||||||
*
|
* Create a new process of application or service
|
||||||
*
|
*
|
||||||
* @export
|
* @export
|
||||||
* @param {string} app
|
* @param {string} app class name string
|
||||||
* @param {ProcessTypeClass} cls
|
* @param {ProcessTypeClass} cls prototype class
|
||||||
* @param {GUI.AppArgumentsType[]} [args]
|
* @param {GUI.AppArgumentsType[]} [args] process arguments
|
||||||
* @returns {Promise<ProcessType>}
|
* @returns {Promise<ProcessType>} a promise on the created process
|
||||||
*/
|
*/
|
||||||
export function createProcess(
|
export function createProcess(
|
||||||
app: string,
|
app: string,
|
||||||
@ -68,7 +87,7 @@ namespace OS {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
* Get the reference to a process using its id
|
||||||
*
|
*
|
||||||
* @export
|
* @export
|
||||||
* @param {number} pid
|
* @param {number} pid
|
||||||
@ -94,10 +113,10 @@ namespace OS {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
* Kill a process
|
||||||
*
|
*
|
||||||
* @export
|
* @export
|
||||||
* @param {OS.GUI.BaseModel} app
|
* @param {OS.GUI.BaseModel} app reference to the process
|
||||||
* @returns {void}
|
* @returns {void}
|
||||||
*/
|
*/
|
||||||
export function kill(app: BaseModel): void {
|
export function kill(app: BaseModel): void {
|
||||||
@ -119,11 +138,11 @@ namespace OS {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
* Kill all process of an application or service
|
||||||
*
|
*
|
||||||
* @export
|
* @export
|
||||||
* @param {string} app
|
* @param {string} app process class name
|
||||||
* @param {boolean} force
|
* @param {boolean} force force exit all process
|
||||||
* @returns {void}
|
* @returns {void}
|
||||||
*/
|
*/
|
||||||
export function killAll(app: string, force: boolean): void {
|
export function killAll(app: string, force: boolean): void {
|
||||||
|
@ -1,9 +1,3 @@
|
|||||||
/*
|
|
||||||
* decaffeinate suggestions:
|
|
||||||
* DS101: Remove unnecessary use of Array.from
|
|
||||||
* DS102: Remove unnecessary code created because of implicit returns
|
|
||||||
* Full docs: https://github.com/decaffeinate/decaffeinate/blob/master/docs/suggestions.md
|
|
||||||
*/
|
|
||||||
// Copyright 2017-2018 Xuan Sang LE <xsang.le AT gmail DOT com>
|
// Copyright 2017-2018 Xuan Sang LE <xsang.le AT gmail DOT com>
|
||||||
|
|
||||||
// AnTOS Web desktop is is licensed under the GNU General Public
|
// AnTOS Web desktop is is licensed under the GNU General Public
|
||||||
@ -23,134 +17,375 @@
|
|||||||
//along with this program. If not, see https://www.gnu.org/licenses/.
|
//along with this program. If not, see https://www.gnu.org/licenses/.
|
||||||
|
|
||||||
namespace OS {
|
namespace OS {
|
||||||
export namespace setting {
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
* This namespace is dedicated to everything related to the
|
||||||
|
* global system settings
|
||||||
|
*/
|
||||||
|
export namespace setting {
|
||||||
|
/**
|
||||||
|
* User setting type definition
|
||||||
*
|
*
|
||||||
* @export
|
* @export
|
||||||
* @interface UserSettingType
|
* @interface UserSettingType
|
||||||
*/
|
*/
|
||||||
export interface UserSettingType {
|
export interface UserSettingType {
|
||||||
|
/**
|
||||||
|
* User full name
|
||||||
|
*
|
||||||
|
* @type {string}
|
||||||
|
* @memberof UserSettingType
|
||||||
|
*/
|
||||||
name: string;
|
name: string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* User name
|
||||||
|
*
|
||||||
|
* @type {string}
|
||||||
|
* @memberof UserSettingType
|
||||||
|
*/
|
||||||
username: string;
|
username: string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* User id
|
||||||
|
*
|
||||||
|
* @type {number}
|
||||||
|
* @memberof UserSettingType
|
||||||
|
*/
|
||||||
id: number;
|
id: number;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* User groups
|
||||||
|
*
|
||||||
|
* @type {{ [index: number]: string }}
|
||||||
|
* @memberof UserSettingType
|
||||||
|
*/
|
||||||
group?: { [index: number]: string };
|
group?: { [index: number]: string };
|
||||||
[propName: string]: any;
|
[propName: string]: any;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
* Virtual desktop setting data type
|
||||||
*
|
*
|
||||||
* @export
|
* @export
|
||||||
* @interface DesktopSettingType
|
* @interface DesktopSettingType
|
||||||
*/
|
*/
|
||||||
export interface DesktopSettingType {
|
export interface DesktopSettingType {
|
||||||
|
/**
|
||||||
|
* Desktop VFS path
|
||||||
|
*
|
||||||
|
* @type {string}
|
||||||
|
* @memberof DesktopSettingType
|
||||||
|
*/
|
||||||
path: string;
|
path: string;
|
||||||
menu: any[];
|
|
||||||
|
/**
|
||||||
|
* Desktop menu, can be added automatically by applications
|
||||||
|
*
|
||||||
|
* @type {GUI.BasicItemType[]}
|
||||||
|
* @memberof DesktopSettingType
|
||||||
|
*/
|
||||||
|
menu: GUI.BasicItemType[];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Show desktop hidden files
|
||||||
|
*
|
||||||
|
* @type {boolean}
|
||||||
|
* @memberof DesktopSettingType
|
||||||
|
*/
|
||||||
showhidden: boolean;
|
showhidden: boolean;
|
||||||
[propName: string]: any;
|
[propName: string]: any;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
* Wallpaper setting data type
|
||||||
*
|
*
|
||||||
* @export
|
* @export
|
||||||
* @interface WPSettingType
|
* @interface WPSettingType
|
||||||
*/
|
*/
|
||||||
export interface WPSettingType {
|
export interface WPSettingType {
|
||||||
|
/**
|
||||||
|
* Repeat wallpaper:
|
||||||
|
* - `repeat`
|
||||||
|
* - `repeat-x`
|
||||||
|
* - `repeat-y`
|
||||||
|
* - `no-repeat`
|
||||||
|
*
|
||||||
|
* @type {string}
|
||||||
|
* @memberof WPSettingType
|
||||||
|
*/
|
||||||
repeat: string;
|
repeat: string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Wallpaper size
|
||||||
|
* - `contain`
|
||||||
|
* - `cover`
|
||||||
|
* - `auto`
|
||||||
|
*
|
||||||
|
* @type {string}
|
||||||
|
* @memberof WPSettingType
|
||||||
|
*/
|
||||||
size: string;
|
size: string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* VFS path to the wallpaper image
|
||||||
|
*
|
||||||
|
* @type {string}
|
||||||
|
* @memberof WPSettingType
|
||||||
|
*/
|
||||||
url: string;
|
url: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
* Theme setting data type
|
||||||
*
|
*
|
||||||
* @export
|
* @export
|
||||||
* @interface ThemeSettingType
|
* @interface ThemeSettingType
|
||||||
*/
|
*/
|
||||||
export interface ThemeSettingType {
|
export interface ThemeSettingType {
|
||||||
|
/**
|
||||||
|
* Theme name, this value is used for looking
|
||||||
|
* theme file in system asset
|
||||||
|
*
|
||||||
|
* @type {string}
|
||||||
|
* @memberof ThemeSettingType
|
||||||
|
*/
|
||||||
name: string;
|
name: string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Theme user-friendly text
|
||||||
|
*
|
||||||
|
* @type {string}
|
||||||
|
* @memberof ThemeSettingType
|
||||||
|
*/
|
||||||
text: string;
|
text: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
* Appearance setting data type
|
||||||
*
|
*
|
||||||
* @export
|
* @export
|
||||||
* @interface AppearanceSettingType
|
* @interface AppearanceSettingType
|
||||||
*/
|
*/
|
||||||
export interface AppearanceSettingType {
|
export interface AppearanceSettingType {
|
||||||
|
/**
|
||||||
|
* Current theme name
|
||||||
|
*
|
||||||
|
* @type {string}
|
||||||
|
* @memberof AppearanceSettingType
|
||||||
|
*/
|
||||||
theme: string;
|
theme: string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* All themes available in the system
|
||||||
|
*
|
||||||
|
* @type {ThemeSettingType[]}
|
||||||
|
* @memberof AppearanceSettingType
|
||||||
|
*/
|
||||||
themes: ThemeSettingType[];
|
themes: ThemeSettingType[];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Current wallpaper setting
|
||||||
|
*
|
||||||
|
* @type {WPSettingType}
|
||||||
|
* @memberof AppearanceSettingType
|
||||||
|
*/
|
||||||
wp: WPSettingType;
|
wp: WPSettingType;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* All wallpapers available in the system
|
||||||
|
*
|
||||||
|
* @type {string[]}
|
||||||
|
* @memberof AppearanceSettingType
|
||||||
|
*/
|
||||||
wps: string[];
|
wps: string[];
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
* VFS Mount points setting data type
|
||||||
*
|
*
|
||||||
* @export
|
* @export
|
||||||
* @interface VFSMountPointSettingType
|
* @interface VFSMountPointSettingType
|
||||||
*/
|
*/
|
||||||
export interface VFSMountPointSettingType {
|
export interface VFSMountPointSettingType {
|
||||||
|
/**
|
||||||
|
* Path to the mount point
|
||||||
|
*
|
||||||
|
* @type {string}
|
||||||
|
* @memberof VFSMountPointSettingType
|
||||||
|
*/
|
||||||
path: string;
|
path: string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* User friendly mount point name
|
||||||
|
*
|
||||||
|
* @type {string}
|
||||||
|
* @memberof VFSMountPointSettingType
|
||||||
|
*/
|
||||||
text: string;
|
text: string;
|
||||||
[propName: string]: any;
|
[propName: string]: any;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
* VFS setting data type
|
||||||
*
|
*
|
||||||
* @export
|
* @export
|
||||||
* @interface VFSSettingType
|
* @interface VFSSettingType
|
||||||
*/
|
*/
|
||||||
export interface VFSSettingType {
|
export interface VFSSettingType {
|
||||||
|
/**
|
||||||
|
* mount points setting
|
||||||
|
*
|
||||||
|
* @type {VFSMountPointSettingType[]}
|
||||||
|
* @memberof VFSSettingType
|
||||||
|
*/
|
||||||
mountpoints: VFSMountPointSettingType[];
|
mountpoints: VFSMountPointSettingType[];
|
||||||
[propName: string]: any;
|
[propName: string]: any;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
* Global system setting data type
|
||||||
*
|
*
|
||||||
* @export
|
* @export
|
||||||
* @interface SystemSettingType
|
* @interface SystemSettingType
|
||||||
*/
|
*/
|
||||||
export interface SystemSettingType {
|
export interface SystemSettingType {
|
||||||
|
/**
|
||||||
|
* System error report URL
|
||||||
|
*
|
||||||
|
* @type {string}
|
||||||
|
* @memberof SystemSettingType
|
||||||
|
*/
|
||||||
error_report: string;
|
error_report: string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Current system locale e.g. `en_GB`
|
||||||
|
*
|
||||||
|
* @type {string}
|
||||||
|
* @memberof SystemSettingType
|
||||||
|
*/
|
||||||
locale: string;
|
locale: string;
|
||||||
menu: any[];
|
|
||||||
|
/**
|
||||||
|
* System menus
|
||||||
|
*
|
||||||
|
* @type {API.PackageMetaType[]}
|
||||||
|
* @memberof API.PackageMetaType
|
||||||
|
*/
|
||||||
|
menu: API.PackageMetaType[];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Packages meta-data
|
||||||
|
*
|
||||||
|
* @type {{ [index: string]: API.PackageMetaType }}
|
||||||
|
* @memberof SystemSettingType
|
||||||
|
*/
|
||||||
packages: { [index: string]: API.PackageMetaType };
|
packages: { [index: string]: API.PackageMetaType };
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Path to the installed packages
|
||||||
|
*
|
||||||
|
* @type {{
|
||||||
|
* user: string;
|
||||||
|
* system: string;
|
||||||
|
* }}
|
||||||
|
* @memberof SystemSettingType
|
||||||
|
*/
|
||||||
pkgpaths: {
|
pkgpaths: {
|
||||||
|
/**
|
||||||
|
* User specific packages install location
|
||||||
|
*
|
||||||
|
* @type {string}
|
||||||
|
*/
|
||||||
user: string;
|
user: string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* System packages install location
|
||||||
|
*
|
||||||
|
* @type {string}
|
||||||
|
*/
|
||||||
system: string;
|
system: string;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Package repositories setting.
|
||||||
|
* This configuration is used by [[MarketPlace]]
|
||||||
|
* for package management
|
||||||
|
*
|
||||||
|
* @type {{
|
||||||
|
* text: string;
|
||||||
|
* url: string;
|
||||||
|
* }[]}
|
||||||
|
* @memberof SystemSettingType
|
||||||
|
*/
|
||||||
repositories: {
|
repositories: {
|
||||||
|
/**
|
||||||
|
* Repository name
|
||||||
|
*
|
||||||
|
* @type {string}
|
||||||
|
*/
|
||||||
text: string;
|
text: string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Repository uri
|
||||||
|
*
|
||||||
|
* @type {string}
|
||||||
|
*/
|
||||||
url: string;
|
url: string;
|
||||||
}[];
|
}[];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Startup applications and services
|
||||||
|
*
|
||||||
|
* @type {{
|
||||||
|
* apps: string[];
|
||||||
|
* services: string[];
|
||||||
|
* }}
|
||||||
|
* @memberof SystemSettingType
|
||||||
|
*/
|
||||||
startup: {
|
startup: {
|
||||||
|
/**
|
||||||
|
* List of application names
|
||||||
|
*
|
||||||
|
* @type {string[]}
|
||||||
|
*/
|
||||||
apps: string[];
|
apps: string[];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* List of service names
|
||||||
|
*
|
||||||
|
* @type {string[]}
|
||||||
|
*/
|
||||||
services: string[];
|
services: string[];
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* User settings
|
||||||
|
*/
|
||||||
export var user: UserSettingType;
|
export var user: UserSettingType;
|
||||||
|
/**
|
||||||
|
* Application settings
|
||||||
|
*/
|
||||||
export var applications: GenericObject<any> = {};
|
export var applications: GenericObject<any> = {};
|
||||||
|
/**
|
||||||
|
* Desktop settings
|
||||||
|
*/
|
||||||
export var desktop: DesktopSettingType;
|
export var desktop: DesktopSettingType;
|
||||||
|
/**
|
||||||
|
* Appearance settings
|
||||||
|
*/
|
||||||
export var appearance: AppearanceSettingType;
|
export var appearance: AppearanceSettingType;
|
||||||
|
/**
|
||||||
|
* VFS settings
|
||||||
|
*/
|
||||||
export var VFS: VFSSettingType;
|
export var VFS: VFSSettingType;
|
||||||
|
/**
|
||||||
|
* System settings
|
||||||
|
*/
|
||||||
export var system: SystemSettingType;
|
export var system: SystemSettingType;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
* Reset the system settings to default values
|
||||||
*
|
*
|
||||||
* @export
|
* @export
|
||||||
*/
|
*/
|
||||||
@ -158,7 +393,7 @@ namespace OS {
|
|||||||
setting.desktop = {
|
setting.desktop = {
|
||||||
path: "home://.desktop",
|
path: "home://.desktop",
|
||||||
menu: [],
|
menu: [],
|
||||||
showhidden: false
|
showhidden: false,
|
||||||
};
|
};
|
||||||
setting.user = {
|
setting.user = {
|
||||||
name: undefined,
|
name: undefined,
|
||||||
@ -240,15 +475,15 @@ namespace OS {
|
|||||||
repositories: [],
|
repositories: [],
|
||||||
startup: {
|
startup: {
|
||||||
apps: [],
|
apps: [],
|
||||||
services: [
|
services: ["Syslog/PushNotification", "Syslog/Calendar"],
|
||||||
"Syslog/PushNotification", "Syslog/Calendar"
|
|
||||||
],
|
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
* Apply the input parameter object to system settings.
|
||||||
|
* This object could be an object loaded from
|
||||||
|
* setting JSON file saved on the server.
|
||||||
*
|
*
|
||||||
* @export
|
* @export
|
||||||
* @param {*} conf
|
* @param {*} conf
|
||||||
@ -288,7 +523,7 @@ namespace OS {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//search for app
|
// Register handle for application search
|
||||||
API.onsearch("__(Applications)", function (t) {
|
API.onsearch("__(Applications)", function (t) {
|
||||||
const ar = [];
|
const ar = [];
|
||||||
const term = new RegExp(t, "i");
|
const term = new RegExp(t, "i");
|
||||||
|
637
src/core/vfs.ts
637
src/core/vfs.ts
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user