mirror of
https://github.com/lxsang/antos-frontend.git
synced 2024-11-08 14:08:22 +01:00
fix system & context menu
This commit is contained in:
parent
de387ece25
commit
b44ef3ce0e
@ -247,7 +247,7 @@ self.OS.GUI =
|
||||
{ text: "Open", dataid: "desktop-open" },
|
||||
{ text: "Refresh", dataid: "desktop-refresh" }
|
||||
]
|
||||
menu = menu.concat _OS.setting.desktop.menu
|
||||
menu = menu.concat ( v for k, v of _OS.setting.desktop.menu)
|
||||
m.set "items", menu
|
||||
m.set "onmenuselect", (evt) ->
|
||||
switch evt.item.data.dataid
|
||||
@ -260,7 +260,7 @@ self.OS.GUI =
|
||||
when "desktop-refresh"
|
||||
desktop[0].fetch()
|
||||
else
|
||||
_GUI.launch evt.item.data.app if evt.item.data.app
|
||||
_GUI.launch evt.item.data.app, evt.item.data.args if evt.item.data.app
|
||||
m.show(e)
|
||||
|
||||
desktop[0].fetch()
|
||||
@ -290,7 +290,7 @@ self.OS.GUI =
|
||||
_GUI.launch d.item.data.app
|
||||
}
|
||||
]
|
||||
menu.child = menu.child.concat _OS.setting.system.menu
|
||||
menu.child = menu.child.concat (v for k, v of _OS.setting.system.menu)
|
||||
menu.child.push
|
||||
text: "Log out",
|
||||
dataid: "sys-logout",
|
||||
@ -329,7 +329,7 @@ self.OS.GUI =
|
||||
_OS.setting.user = conf.user
|
||||
_OS.setting.VFS = conf.VFS if conf.VFS
|
||||
_OS.setting.desktop.path = "home:///.desktop" unless _OS.setting.desktop.path
|
||||
_OS.setting.desktop.menu = [] unless _OS.setting.desktop.menu
|
||||
_OS.setting.desktop.menu = {} unless _OS.setting.desktop.menu
|
||||
_OS.setting.VFS.mountpoints = [
|
||||
#TODO: multi app try to write to this object, it neet to be cloned
|
||||
{ text: "Applications", path: 'app:///', iconclass: "fa fa-adn", type: "app" },
|
||||
@ -343,7 +343,7 @@ self.OS.GUI =
|
||||
"home:///.packages",
|
||||
"os:///packages"
|
||||
] unless _OS.setting.system.pkgpaths
|
||||
_OS.setting.system.menu = [] unless _OS.setting.system.menu
|
||||
_OS.setting.system.menu = {} unless _OS.setting.system.menu
|
||||
|
||||
_OS.setting.appearance.theme = "antos" unless _OS.setting.appearance.theme
|
||||
# load theme
|
||||
@ -367,7 +367,7 @@ self.OS.GUI =
|
||||
_GUI.pushServices [
|
||||
"CoreServices/PushNotification",
|
||||
"CoreServices/Spotlight",
|
||||
"CoreServices/Calendar"
|
||||
#"CoreServices/Calendar"
|
||||
]
|
||||
|
||||
# startup application here
|
||||
|
@ -6,4 +6,4 @@
|
||||
<afx-float-list id = "desktop" ></afx-float-list>
|
||||
<!--div id = "workingenv"></div-->
|
||||
</div>
|
||||
<afx-menu id="contextmenu" context="true" style="display:none;"></afx-menu>
|
||||
<afx-menu id="contextmenu" data-id="contextmenu" context="true" style="display:none;"></afx-menu>
|
||||
|
@ -1,13 +1,13 @@
|
||||
<afx-menu >
|
||||
<ul class={context: opts.context == "true"}>
|
||||
<li class="afx-corner-fix"></li>
|
||||
<li ref = "container" each={ data,i in items } class = {afx_submenu:data.child != null, fix_padding:data.icon} no-reorder>
|
||||
<li ref = "container" each={ data,i in items } class = {afx_submenu:data.child != null && data.child.length > 0, fix_padding:data.icon} no-reorder>
|
||||
<a href="#" onclick = {parent.onselect}>
|
||||
<afx-switch if = {data.switch || data.radio} class = {checked:parent.checkItem(data)} enable = false swon = {data.checked} ></afx-switch>
|
||||
<afx-label color = {data.color} iconclass = {data.iconclass} icon = {data.icon} text = {data.text} ></afx-label>
|
||||
</a>
|
||||
|
||||
<afx-menu if={data.child != null} child={data.child.constructor === Array?data.child:data.child()} onmenuselect = {data.onmenuselect} observable = {parent.root.observable} rootid = {parent.rid}></afx-menu>
|
||||
<afx-menu if={data.child != null && data.child.length > 0} child={data.child} onmenuselect = {data.onmenuselect} observable = {parent.root.observable} rootid = {parent.rid}></afx-menu>
|
||||
</li>
|
||||
<li class="afx-corner-fix"></li>
|
||||
</ul>
|
||||
@ -78,7 +78,7 @@
|
||||
self.root.show = function(e)
|
||||
{
|
||||
//only for menucontext
|
||||
if(opts.context != "true") return;
|
||||
if(opts.context != "true") return
|
||||
$(self.root)
|
||||
.css("top", e.clientY - 15 + "px")
|
||||
.css("left",e.clientX -5 + "px")
|
||||
|
@ -96,7 +96,7 @@
|
||||
self.update()
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
select(event)
|
||||
{
|
||||
if(istoggle)
|
||||
|
4
src/libs/riot.compiler.min.js
vendored
4
src/libs/riot.compiler.min.js
vendored
File diff suppressed because one or more lines are too long
4
src/libs/riot.min.js
vendored
4
src/libs/riot.min.js
vendored
File diff suppressed because one or more lines are too long
@ -12,8 +12,12 @@ class Files extends this.OS.GUI.BaseApplication
|
||||
@favo = @find "favouri"
|
||||
@clipboard = undefined
|
||||
|
||||
@apps = []
|
||||
|
||||
@view.contextmenuHandler = (e, m) ->
|
||||
m.set "items", [ me.mnFile(), me.mnEdit() ]
|
||||
m.set "onmenuselect", (evt) ->
|
||||
me._gui.launch evt.item.data.app, evt.item.data.args if evt.item.data.app
|
||||
m.show(e)
|
||||
#@on "fileselect", (d) -> console.log d
|
||||
@view.set "onfileopen", (e) ->
|
||||
@ -21,7 +25,7 @@ class Files extends this.OS.GUI.BaseApplication
|
||||
return if e.type is "dir"
|
||||
me._gui.openWith e
|
||||
|
||||
@favo.set "onlistselect", (e) ->
|
||||
@favo.set "onlistselect", (e) ->
|
||||
me.chdir e.data.path
|
||||
|
||||
($ @find "btback").click () ->
|
||||
@ -41,6 +45,14 @@ class Files extends this.OS.GUI.BaseApplication
|
||||
return me.error "Resource not found #{e.child.path}" if d.error
|
||||
f d.result
|
||||
|
||||
@view.set "onfileselect", (e) ->
|
||||
file = me.view.get "selectedFile"
|
||||
return unless file
|
||||
file.mime = "dir" if file.type is "dir"
|
||||
me.apps.length = 0
|
||||
for v in me._gui.appsByMime file.mime
|
||||
v.args = [ file.path ]
|
||||
me.apps.push v
|
||||
@setting.sidebar = true if @setting.sidebar is undefined
|
||||
@setting.nav = true if @setting.nav is undefined
|
||||
@setting.showhidden = false if @setting.showhidden is undefined
|
||||
@ -83,23 +95,18 @@ class Files extends this.OS.GUI.BaseApplication
|
||||
mnFile:() ->
|
||||
#console.log file
|
||||
me = @
|
||||
f = () ->
|
||||
console.log "called"
|
||||
file = me.view.get "selectedFile"
|
||||
return undefined unless file
|
||||
return me._gui.appsByMime file.mime
|
||||
|
||||
{
|
||||
arr = {
|
||||
text: "File",
|
||||
child: [
|
||||
{ text: "New file", dataid: "#{@name}-mkf" },
|
||||
{ text: "New folder", dataid: "#{@name}-mkdir" },
|
||||
{ text: "Open with", dataid: "#{@name}-open", child: f },
|
||||
{ text: "Open with", dataid: "#{@name}-open", child:@apps },
|
||||
{ text: "Upload", dataid: "#{@name}-upload" },
|
||||
{ text: "Download", dataid: "#{@name}-download" },
|
||||
{ text: "Properties", dataid: "#{@name}-info" }
|
||||
], onmenuselect: (e) -> me.actionFile e
|
||||
}
|
||||
return arr
|
||||
mnEdit: () ->
|
||||
me = @
|
||||
{
|
||||
@ -247,9 +254,6 @@ class Files extends this.OS.GUI.BaseApplication
|
||||
when "#{@name}-download"
|
||||
return unless file
|
||||
file.path.asFileHandler().download ()->
|
||||
when "#{@name}-open"
|
||||
return unless file
|
||||
@_gui.openWith file
|
||||
else
|
||||
console.log e
|
||||
|
||||
|
@ -32,7 +32,7 @@ class wTerm extends this.OS.GUI.BaseApplication
|
||||
me.term.write pastedText.substring i * 1000, end
|
||||
#self.socket.send("i"+ substr.replace(/\n/g,"\r\n"))
|
||||
# make desktop menu if not exist
|
||||
@systemsetting.desktop.menu.push { text: "Open terminal", app: "wTerm" }
|
||||
@systemsetting.desktop.menu[@name] = { text: "Open terminal", app: "wTerm" } unless @systemsetting.desktop.menu[@name]
|
||||
@openSession()
|
||||
@on "vboxchange", (e) -> me.resizeContent e.w, e.h
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user