mirror of
https://github.com/lxsang/antos-frontend.git
synced 2024-12-27 09:48:21 +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: "Open", dataid: "desktop-open" },
|
||||||
{ text: "Refresh", dataid: "desktop-refresh" }
|
{ 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 "items", menu
|
||||||
m.set "onmenuselect", (evt) ->
|
m.set "onmenuselect", (evt) ->
|
||||||
switch evt.item.data.dataid
|
switch evt.item.data.dataid
|
||||||
@ -260,7 +260,7 @@ self.OS.GUI =
|
|||||||
when "desktop-refresh"
|
when "desktop-refresh"
|
||||||
desktop[0].fetch()
|
desktop[0].fetch()
|
||||||
else
|
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)
|
m.show(e)
|
||||||
|
|
||||||
desktop[0].fetch()
|
desktop[0].fetch()
|
||||||
@ -290,7 +290,7 @@ self.OS.GUI =
|
|||||||
_GUI.launch d.item.data.app
|
_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
|
menu.child.push
|
||||||
text: "Log out",
|
text: "Log out",
|
||||||
dataid: "sys-logout",
|
dataid: "sys-logout",
|
||||||
@ -329,7 +329,7 @@ self.OS.GUI =
|
|||||||
_OS.setting.user = conf.user
|
_OS.setting.user = conf.user
|
||||||
_OS.setting.VFS = conf.VFS if conf.VFS
|
_OS.setting.VFS = conf.VFS if conf.VFS
|
||||||
_OS.setting.desktop.path = "home:///.desktop" unless _OS.setting.desktop.path
|
_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 = [
|
_OS.setting.VFS.mountpoints = [
|
||||||
#TODO: multi app try to write to this object, it neet to be cloned
|
#TODO: multi app try to write to this object, it neet to be cloned
|
||||||
{ text: "Applications", path: 'app:///', iconclass: "fa fa-adn", type: "app" },
|
{ text: "Applications", path: 'app:///', iconclass: "fa fa-adn", type: "app" },
|
||||||
@ -343,7 +343,7 @@ self.OS.GUI =
|
|||||||
"home:///.packages",
|
"home:///.packages",
|
||||||
"os:///packages"
|
"os:///packages"
|
||||||
] unless _OS.setting.system.pkgpaths
|
] 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
|
_OS.setting.appearance.theme = "antos" unless _OS.setting.appearance.theme
|
||||||
# load theme
|
# load theme
|
||||||
@ -367,7 +367,7 @@ self.OS.GUI =
|
|||||||
_GUI.pushServices [
|
_GUI.pushServices [
|
||||||
"CoreServices/PushNotification",
|
"CoreServices/PushNotification",
|
||||||
"CoreServices/Spotlight",
|
"CoreServices/Spotlight",
|
||||||
"CoreServices/Calendar"
|
#"CoreServices/Calendar"
|
||||||
]
|
]
|
||||||
|
|
||||||
# startup application here
|
# startup application here
|
||||||
|
@ -6,4 +6,4 @@
|
|||||||
<afx-float-list id = "desktop" ></afx-float-list>
|
<afx-float-list id = "desktop" ></afx-float-list>
|
||||||
<!--div id = "workingenv"></div-->
|
<!--div id = "workingenv"></div-->
|
||||||
</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 >
|
<afx-menu >
|
||||||
<ul class={context: opts.context == "true"}>
|
<ul class={context: opts.context == "true"}>
|
||||||
<li class="afx-corner-fix"></li>
|
<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}>
|
<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-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>
|
<afx-label color = {data.color} iconclass = {data.iconclass} icon = {data.icon} text = {data.text} ></afx-label>
|
||||||
</a>
|
</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>
|
||||||
<li class="afx-corner-fix"></li>
|
<li class="afx-corner-fix"></li>
|
||||||
</ul>
|
</ul>
|
||||||
@ -78,7 +78,7 @@
|
|||||||
self.root.show = function(e)
|
self.root.show = function(e)
|
||||||
{
|
{
|
||||||
//only for menucontext
|
//only for menucontext
|
||||||
if(opts.context != "true") return;
|
if(opts.context != "true") return
|
||||||
$(self.root)
|
$(self.root)
|
||||||
.css("top", e.clientY - 15 + "px")
|
.css("top", e.clientY - 15 + "px")
|
||||||
.css("left",e.clientX -5 + "px")
|
.css("left",e.clientX -5 + "px")
|
||||||
|
@ -96,7 +96,7 @@
|
|||||||
self.update()
|
self.update()
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
select(event)
|
select(event)
|
||||||
{
|
{
|
||||||
if(istoggle)
|
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"
|
@favo = @find "favouri"
|
||||||
@clipboard = undefined
|
@clipboard = undefined
|
||||||
|
|
||||||
|
@apps = []
|
||||||
|
|
||||||
@view.contextmenuHandler = (e, m) ->
|
@view.contextmenuHandler = (e, m) ->
|
||||||
m.set "items", [ me.mnFile(), me.mnEdit() ]
|
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)
|
m.show(e)
|
||||||
#@on "fileselect", (d) -> console.log d
|
#@on "fileselect", (d) -> console.log d
|
||||||
@view.set "onfileopen", (e) ->
|
@view.set "onfileopen", (e) ->
|
||||||
@ -21,7 +25,7 @@ class Files extends this.OS.GUI.BaseApplication
|
|||||||
return if e.type is "dir"
|
return if e.type is "dir"
|
||||||
me._gui.openWith e
|
me._gui.openWith e
|
||||||
|
|
||||||
@favo.set "onlistselect", (e) ->
|
@favo.set "onlistselect", (e) ->
|
||||||
me.chdir e.data.path
|
me.chdir e.data.path
|
||||||
|
|
||||||
($ @find "btback").click () ->
|
($ @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
|
return me.error "Resource not found #{e.child.path}" if d.error
|
||||||
f d.result
|
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.sidebar = true if @setting.sidebar is undefined
|
||||||
@setting.nav = true if @setting.nav is undefined
|
@setting.nav = true if @setting.nav is undefined
|
||||||
@setting.showhidden = false if @setting.showhidden is undefined
|
@setting.showhidden = false if @setting.showhidden is undefined
|
||||||
@ -83,23 +95,18 @@ class Files extends this.OS.GUI.BaseApplication
|
|||||||
mnFile:() ->
|
mnFile:() ->
|
||||||
#console.log file
|
#console.log file
|
||||||
me = @
|
me = @
|
||||||
f = () ->
|
arr = {
|
||||||
console.log "called"
|
|
||||||
file = me.view.get "selectedFile"
|
|
||||||
return undefined unless file
|
|
||||||
return me._gui.appsByMime file.mime
|
|
||||||
|
|
||||||
{
|
|
||||||
text: "File",
|
text: "File",
|
||||||
child: [
|
child: [
|
||||||
{ text: "New file", dataid: "#{@name}-mkf" },
|
{ text: "New file", dataid: "#{@name}-mkf" },
|
||||||
{ text: "New folder", dataid: "#{@name}-mkdir" },
|
{ 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: "Upload", dataid: "#{@name}-upload" },
|
||||||
{ text: "Download", dataid: "#{@name}-download" },
|
{ text: "Download", dataid: "#{@name}-download" },
|
||||||
{ text: "Properties", dataid: "#{@name}-info" }
|
{ text: "Properties", dataid: "#{@name}-info" }
|
||||||
], onmenuselect: (e) -> me.actionFile e
|
], onmenuselect: (e) -> me.actionFile e
|
||||||
}
|
}
|
||||||
|
return arr
|
||||||
mnEdit: () ->
|
mnEdit: () ->
|
||||||
me = @
|
me = @
|
||||||
{
|
{
|
||||||
@ -247,9 +254,6 @@ class Files extends this.OS.GUI.BaseApplication
|
|||||||
when "#{@name}-download"
|
when "#{@name}-download"
|
||||||
return unless file
|
return unless file
|
||||||
file.path.asFileHandler().download ()->
|
file.path.asFileHandler().download ()->
|
||||||
when "#{@name}-open"
|
|
||||||
return unless file
|
|
||||||
@_gui.openWith file
|
|
||||||
else
|
else
|
||||||
console.log e
|
console.log e
|
||||||
|
|
||||||
|
@ -32,7 +32,7 @@ class wTerm extends this.OS.GUI.BaseApplication
|
|||||||
me.term.write pastedText.substring i * 1000, end
|
me.term.write pastedText.substring i * 1000, end
|
||||||
#self.socket.send("i"+ substr.replace(/\n/g,"\r\n"))
|
#self.socket.send("i"+ substr.replace(/\n/g,"\r\n"))
|
||||||
# make desktop menu if not exist
|
# 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()
|
@openSession()
|
||||||
@on "vboxchange", (e) -> me.resizeContent e.w, e.h
|
@on "vboxchange", (e) -> me.resizeContent e.w, e.h
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user