global settting

This commit is contained in:
Xuan Sang LE
2018-01-22 19:59:08 +01:00
parent 338dca02b9
commit 46e50b191f
15 changed files with 133 additions and 176 deletions

View File

@ -0,0 +1,23 @@
class Calendar extends this.OS.GUI.BaseService
constructor: (args) ->
super "Calendar", args
#@iconclass = "fa fa-commenting"
@text = ""
@iconclass = "fa fa-calendar"
init: ->
#update time each second
me = @
@watch 1000, () ->
now = new Date
me.text = "#{now.getDate()}/#{(now.getMonth()+1)}/#{now.getFullYear()} " +
"#{now.getHours()}:#{now.getMinutes()}:#{now.getSeconds()}"
me.update()
awake: (e) ->
@.openDialog "CalendarDialog", (d) -> console.log d
# do nothing
cleanup: (evt) ->
console.log "cleanup for quit"
# do nothing
this.OS.register "Calendar",Calendar

View File

@ -0,0 +1,11 @@
coffee_files = Calendar.coffee PushNotification.coffee Spotlight.coffee
jsfiles =
cssfiles =
copyfiles = package.json
PKG_NAME=CoreServices
include ../pkg.mk

View File

@ -0,0 +1,93 @@
class PushNotification extends this.OS.GUI.BaseService
constructor: (args) ->
super "PushNotification", args
@iconclass = "fa fa-bars"
@onmenuselect = (e) -> console.log e
@cb = undefined
@pending = []
init: ->
@view = false
path = "resources/schemes/notifications.html"
@render path
spin: (b) ->
if b and @iconclass is "fa fa-bars"
@iconclass = "fa fa-spinner fa-spin"
@color = "#f90e00"
@update()
else if not b and @iconclass is "fa fa-spinner fa-spin"
@iconclass = "fa fa-bars"
@color = "#414339"
@update()
main: ->
me = @
@mlist = @find "notifylist"
@mfeed = @find "notifeed"
@nzone = @find "notifyzone"
@fzone = @find "feedzone"
(@find "btclear").set "onbtclick", (e) -> me.mlist.set "items", []
#mlist.set "onlistselect", (e) -> console.log e
@subscribe "notification", (o) -> me.pushout 'INFO', o
@subscribe "fail", (o) -> me.pushout 'FAIL', o
@subscribe "error", (o) -> me.pushout 'ERROR', o
@subscribe "loading", (o) ->
me.pending.push o.id
me.spin true
@subscribe "loaded", (o) ->
i = me.pending.indexOf o.id
me.pending.splice i, 1 if i >= 0
me.spin false if me.pending.length is 0
($ @nzone).css "right", 0
.css "top", "-3px"
.css "height", ""
.css "bottom", "0"
.css "z-index", 1000000
.hide()
($ @fzone)
#.css("z-index", 99999)
.css("bottom", "0")
.css("height", "")
.hide()
pushout: (s, o, mfeed) ->
d = {
text: "[#{s}] #{o.name} (#{o.id}): #{o.data.m}",
icon: o.data.icon,
iconclass: o.data.iconclass,
closable: true }
@mlist.unshift d, true
@notifeed d
notifeed: (d) ->
me = @
@mfeed.unshift d, true
($ @fzone).show()
timer = setTimeout () ->
me.mfeed.remove d, true
clearTimeout timer
, 3000
awake: (e) ->
if @view then ($ @nzone).hide() else ($ @nzone).show()
@view = not @view
me = @
if not @cb
@cb = (e) ->
return if e.originalEvent.item and e.originalEvent.item.i isnt undefined
if not ($ e.target).closest($ me.nzone).length and not ($ e.target).closest($ me.holder.root).length
($ me.nzone).hide()
$(document).unbind "click", me.cb
me.view = not me.view
if @view
$(document).on "click", @cb
else
$(document).unbind "click", @cb
cleanup: (evt) ->
# do nothing
this.OS.register "PushNotification",PushNotification

View File

@ -0,0 +1,20 @@
class Spotlight extends this.OS.GUI.BaseService
constructor: (args) ->
super "Spotlight", args
@iconclass = "fa fa-search"
init: ->
@child = [
{
text: "#{@.name} (#{@.pid}): dummy notif",
child: [ { text: "submenu" } ]
}
]
# do nothing
main: ->
awake: (e) ->
console.log @name ,@pid
cleanup: (evt) ->
# do nothing
this.OS.register "Spotlight",Spotlight

View File

@ -0,0 +1,14 @@
{
"app":"CoreServices",
"name":"CoreServices",
"description":"This is the core services",
"info":{
"author": "Xuan Sang LE",
"email": "xsang.le@gmail.com",
"credit": "dedicated to some one here",
"licences": "MIT"
},
"version":"0.1a",
"category":"System",
"mimes":["*"]
}