From 4116573c71a519b0d42d02b287da869900b750cb Mon Sep 17 00:00:00 2001 From: Xuan Sang LE Date: Wed, 28 Feb 2018 16:25:07 +0100 Subject: [PATCH] add user service --- src/core/gui.coffee | 1 + src/packages/CoreServices/Makefile | 2 +- src/packages/CoreServices/UserService.coffee | 26 ++++++++++++++++++++ src/packages/CoreServices/package.json | 2 +- 4 files changed, 29 insertions(+), 2 deletions(-) create mode 100644 src/packages/CoreServices/UserService.coffee diff --git a/src/core/gui.coffee b/src/core/gui.coffee index 5f232a1..2e1c1f7 100644 --- a/src/core/gui.coffee +++ b/src/core/gui.coffee @@ -376,6 +376,7 @@ self.OS.GUI = # TODO: get services list from user setting _GUI.pushServices [ "CoreServices/PushNotification", + "CoreServices/UserService", "CoreServices/Spotlight", "CoreServices/Calendar" ] diff --git a/src/packages/CoreServices/Makefile b/src/packages/CoreServices/Makefile index 83ea632..3ef8910 100644 --- a/src/packages/CoreServices/Makefile +++ b/src/packages/CoreServices/Makefile @@ -1,4 +1,4 @@ -coffee_files = Calendar.coffee PushNotification.coffee Spotlight.coffee +coffee_files = Calendar.coffee PushNotification.coffee Spotlight.coffee UserService.coffee jsfiles = diff --git a/src/packages/CoreServices/UserService.coffee b/src/packages/CoreServices/UserService.coffee new file mode 100644 index 0000000..5c92f00 --- /dev/null +++ b/src/packages/CoreServices/UserService.coffee @@ -0,0 +1,26 @@ +class UserService extends this.OS.GUI.BaseService + constructor: (args) -> + super "UserService", args + @text =@systemsetting.user.username + @iconclass = undefined + init: -> + me = @ + @child = [ + { + text: "About", dataid: "user-about", + iconclass: "fa fa-user-circle-o" + }, + { + text: "Logout", dataid: "sys-logout", + iconclass: "fa fa-user-times" + } + ] + @onmenuselect = (d) -> + return me._api.handler.logout() if d.item.data.dataid is "sys-logout" + me.notify "This feature is not implemented yet" + awake: (e) -> + + cleanup: (evt) -> + + +this.OS.register "UserService",UserService \ No newline at end of file diff --git a/src/packages/CoreServices/package.json b/src/packages/CoreServices/package.json index 65e8fd1..222eb85 100644 --- a/src/packages/CoreServices/package.json +++ b/src/packages/CoreServices/package.json @@ -1,6 +1,6 @@ { "app":null, - "services": [ "Calendar", "PushNotification", "Spotlight" ], + "services": [ "Calendar", "PushNotification", "Spotlight", "UserService" ], "name":"CoreServices", "description":"This is the core services", "info":{