mirror of
https://github.com/lxsang/antos-frontend.git
synced 2024-12-26 09:28:21 +01:00
add draggable treeview
This commit is contained in:
parent
ff6f480f08
commit
53df50f196
@ -117,7 +117,7 @@ Ant.OS.GUI =
|
||||
return Ant.OS.announcer.osinfo __("Application {0} is not executable", it.text) if it.type is "app"
|
||||
apps = Ant.OS.GUI.appsByMime ( if it.type is "dir" then "dir" else it.mime )
|
||||
return Ant.OS.announcer.osinfo __("No application available to open {0}", it.filename) if apps.length is 0
|
||||
return Ant.OS.GUI.launch apps[0].app, [it.path] if apps.length is 1
|
||||
return Ant.OS.GUI.launch apps[0].app, [it] if apps.length is 1
|
||||
list = ( { text: e.app, icon: e.icon, iconclass: e.iconclass } for e in apps )
|
||||
Ant.OS.GUI.openDialog("SelectionDialog", {
|
||||
title: __("Open with"),
|
||||
@ -360,7 +360,11 @@ Ant.OS.GUI =
|
||||
# desktop[0].set "selected", -1
|
||||
|
||||
desktop.on "click", (e) ->
|
||||
return unless e.target.tagName.toUpperCase() is "UL"
|
||||
el = $(e.target).parent()
|
||||
return unless el.length > 0
|
||||
el = el.parent()
|
||||
return unless el.length > 0
|
||||
return unless el[0] is desktop[0]
|
||||
desktop[0].unselect()
|
||||
($ "#sysdock").get(0).set "selectedApp", null
|
||||
|
||||
@ -418,6 +422,8 @@ Ant.OS.GUI =
|
||||
($ "#login_error").html "Login: server error"
|
||||
($ "#txtpass").keyup (e) ->
|
||||
($ "#btlogin").click() if e.which is 13
|
||||
($ "#txtuser").keyup (e) ->
|
||||
($ "#btlogin").click() if e.which is 13
|
||||
|
||||
startAntOS: (conf) ->
|
||||
# clean up things
|
||||
@ -471,7 +477,7 @@ Ant.OS.GUI.schemes.ws = """
|
||||
|
||||
Ant.OS.GUI.schemes.login = """
|
||||
<div id = "login_form">
|
||||
<p>Welcome to AntOS, please identify</p>
|
||||
<p>Welcome to AntOS, please login</p>
|
||||
<input id = "txtuser" type = "text" value = "demo" />
|
||||
<input id = "txtpass" type = "password" value = "demo" />
|
||||
<button id = "btlogin">Login</button>
|
||||
|
@ -3,6 +3,7 @@ class FileViewTag extends Ant.OS.GUI.BaseTag
|
||||
super r, o
|
||||
@setopt "onfileselect", ()->
|
||||
@setopt "onfileopen", () ->
|
||||
@setopt "ondragndrop", () ->
|
||||
@setopt "selectedFile", undefined
|
||||
@setopt "data", []
|
||||
@setopt "status", true
|
||||
@ -41,12 +42,15 @@ class FileViewTag extends Ant.OS.GUI.BaseTag
|
||||
@refs.status.set("text", " ") if @get "status"
|
||||
.catch (e) ->
|
||||
# this should be handled by the OS
|
||||
Ant.OS.announcer.oserror e
|
||||
Ant.OS.announcer.oserror e.toString(), e
|
||||
|
||||
__data__: (v) ->
|
||||
return unless v
|
||||
@refreshData()
|
||||
|
||||
__ondragndrop__: (v) ->
|
||||
@refs.treeview.set "ondragndrop", v
|
||||
|
||||
sortByType: (a, b) ->
|
||||
if a.type < b.type
|
||||
-1
|
||||
@ -182,6 +186,7 @@ class FileViewTag extends Ant.OS.GUI.BaseTag
|
||||
.then (d) => resolve @getTreeData(d.sort @sortByType)
|
||||
.catch (e) -> reject e
|
||||
@refs.gridview.set "header", @header
|
||||
@refs.treeview.set "dragndrop", true
|
||||
# even handles
|
||||
@refs.listview.set "onlistselect", (e) =>
|
||||
@fileselect e.data.item.get("data")
|
||||
|
@ -112,7 +112,9 @@ class GridViewTag extends Ant.OS.GUI.BaseTag
|
||||
row.domel = rowel[0]
|
||||
|
||||
for cell in row
|
||||
el = $("<#{@get("cellitem")}>").appendTo rowel
|
||||
tag = @get "cellitem"
|
||||
tag = cell.tag if cell.tag
|
||||
el = $("<#{tag}>").appendTo rowel
|
||||
cell.domel = el[0]
|
||||
el[0].uify undefined
|
||||
el[0].set "oncellselect", (e) => @cellselect e, false
|
||||
|
@ -103,7 +103,9 @@ class ListViewTag extends Ant.OS.GUI.BaseTag
|
||||
@get("data").includes v
|
||||
|
||||
push: (item, flag) ->
|
||||
el = $("<#{@get "itemtag"}>")
|
||||
tag = @get "itemtag"
|
||||
tag = item.tag if item.tag
|
||||
el = $("<#{tag}>")
|
||||
if flag
|
||||
@get("data").unshift item if not @has_data item
|
||||
$(@refs.mlist).prepend el[0]
|
||||
|
@ -208,7 +208,9 @@ class MenuTag extends Ant.OS.GUI.BaseTag
|
||||
$(item).remove()
|
||||
|
||||
push: (item, flag) ->
|
||||
el = $("<#{@get("contentag")}>")
|
||||
tag = @get "contentag"
|
||||
tag = item.tag if item.tag
|
||||
el = $("<#{tag}>")
|
||||
if flag
|
||||
$(@refs.container).prepend el[0]
|
||||
@get("items").unshift item
|
||||
|
@ -13,12 +13,14 @@ class ResizerTag extends Ant.OS.GUI.BaseTag
|
||||
if tagname is "AFX-HBOX"
|
||||
@dir = "hz"
|
||||
$(@root).css "cursor", "col-resize"
|
||||
$(@root).addClass "horizontal"
|
||||
if @resizable_el
|
||||
att = $(@resizable_el).attr "min-width"
|
||||
@minsize = parseInt(att) if att
|
||||
else if tagname is "AFX-VBOX"
|
||||
@dir = "ve"
|
||||
$(@root).css "cursor", "row-resize"
|
||||
$(@root).addClass "vertical"
|
||||
if @resizable_el
|
||||
att = $(@resizable_el).attr "min-height"
|
||||
@minsize = parseInt(att) if att
|
||||
|
@ -3,7 +3,7 @@ class SystemPanelTag extends Ant.OS.GUI.BaseTag
|
||||
super r, o
|
||||
@setopt "osmenu", {
|
||||
text: __("Start"),
|
||||
iconclass: "fa fa-eercast"
|
||||
iconclass: "fa fa-circle"
|
||||
}
|
||||
@setopt "appmenu", []
|
||||
@setopt "systray", []
|
||||
|
@ -9,6 +9,7 @@ class TreeViewItemPrototype extends Ant.OS.GUI.BaseTag
|
||||
@setopt "fetch", undefined
|
||||
@setopt "open", true
|
||||
@setopt "itemindex", 0
|
||||
@setopt "parent", undefined
|
||||
@setopt "selected", false
|
||||
@setopt "treepath", @aid()
|
||||
|
||||
@ -37,7 +38,10 @@ class TreeViewItemPrototype extends Ant.OS.GUI.BaseTag
|
||||
.then (d) =>
|
||||
return unless d
|
||||
@.set "nodes", d
|
||||
.catch (e) -> Ant.OS.announcer.oserror e
|
||||
.catch (e) ->
|
||||
Ant.OS.announcer.oserror e.toString(), e
|
||||
else
|
||||
@.set "nodes", @__("nodes")
|
||||
$(@refs.childnodes).show()
|
||||
else
|
||||
$(@refs.childnodes).hide()
|
||||
@ -71,9 +75,10 @@ class TreeViewItemPrototype extends Ant.OS.GUI.BaseTag
|
||||
for v in nodes
|
||||
el = $("<afx-tree-view>").appendTo @refs.childnodes
|
||||
el[0].uify undefined
|
||||
el[0].set "treeroot", @get("treeroot")
|
||||
el[0].set "treeroot", root
|
||||
el[0].set "indent", (@get("indent") + 1)
|
||||
root.indexcounter++
|
||||
el[0].set "parent", @get("parent")
|
||||
el[0].set "itemindex", root.indexcounter
|
||||
el[0].set "treepath", "#{@get("treepath")}/#{el[0].aid()}"
|
||||
el[0].set "fetch", @get("fetch")
|
||||
@ -154,9 +159,12 @@ class TreeViewTag extends Ant.OS.GUI.BaseTag
|
||||
@setopt "itemindex", 0
|
||||
@setopt "ontreeselect", () ->
|
||||
@setopt "ontreedbclick", () ->
|
||||
@setopt "ondragndrop", () ->
|
||||
@setopt "selectedItem", undefined
|
||||
@setopt "fetch", undefined
|
||||
@setopt "dragndrop", false
|
||||
@setopt "treepath", @aid()
|
||||
@root.is_left = () => @is_left()
|
||||
@indexcounter = 0
|
||||
|
||||
__selectedItem: (v) ->
|
||||
@ -164,6 +172,7 @@ class TreeViewTag extends Ant.OS.GUI.BaseTag
|
||||
@get("selectedItem").set "selected", false if @get("selectedItem")
|
||||
v.set "selected", true
|
||||
|
||||
|
||||
itemclick: (e, flag) ->
|
||||
return unless e and e.item
|
||||
return if e.item is @get("selectedItem") and not flag
|
||||
@ -179,11 +188,18 @@ class TreeViewTag extends Ant.OS.GUI.BaseTag
|
||||
is_root: () ->
|
||||
return @get("treeroot") is undefined
|
||||
|
||||
is_left: () ->
|
||||
data = @get "data"
|
||||
return true unless data
|
||||
return if data.nodes then false else true
|
||||
|
||||
__data__: (v) ->
|
||||
return unless v
|
||||
$(@root).empty()
|
||||
@set "treepath", v.path if v.path
|
||||
el = $("<#{@get "itemtag"}>").appendTo @root
|
||||
tag = @get "itemtag"
|
||||
tag = v.tag if v.tag
|
||||
el = $("<#{tag}>").appendTo @root
|
||||
el[0].uify undefined
|
||||
el[0].set "treeroot", if @is_root() then @ else @get "treeroot"
|
||||
el[0].set "indent", @get("indent")
|
||||
@ -191,7 +207,52 @@ class TreeViewTag extends Ant.OS.GUI.BaseTag
|
||||
el[0].set "treepath", @get("treepath")
|
||||
el[0].set "open", @get("open")
|
||||
el[0].set "fetch", @get("fetch")
|
||||
el[0].set "parent", @root
|
||||
el[0].set "data", v
|
||||
if @is_root()
|
||||
$(@root).off "mousedown", @treemousedown
|
||||
$(@root).on "mousedown", @treemousedown if @get("dragndrop")
|
||||
|
||||
mount: () ->
|
||||
@dnd = {}
|
||||
@treemousedown = (e) =>
|
||||
el = $(e.target).closest("afx-tree-view")
|
||||
return if el.length is 0
|
||||
el = el[0]
|
||||
return if el is @root
|
||||
e.source = el
|
||||
@dnd.from = el
|
||||
@dnd.to = undefined
|
||||
$(window).on "mouseup", @treemouseup
|
||||
$(window).on "mousemove", @treemousemove
|
||||
|
||||
@treemouseup = (e) =>
|
||||
$(window).off "mouseup", @treemouseup
|
||||
$(window).off "mousemove", @treemousemove
|
||||
($ "#systooltip").hide()
|
||||
el = $(e.target).closest("afx-tree-view")
|
||||
return if el.length is 0
|
||||
el = el[0]
|
||||
el = el.get("parent") if el.is_left()
|
||||
return if el is @dnd.from or el is @dnd.from.get("parent")
|
||||
@dnd.to = el
|
||||
@__("ondragndrop") { id: @aid(), data: @dnd }
|
||||
@dnd = {}
|
||||
|
||||
@treemousemove = (e) =>
|
||||
return unless e
|
||||
return unless @dnd.from
|
||||
data = @dnd.from.get("data")
|
||||
$label = $("#systooltip")
|
||||
top = e.clientY + 5
|
||||
left = e.clientX + 5
|
||||
$label.show()
|
||||
$label[0].set "text", data.name
|
||||
$label[0].set "icon", data.icon if data.icon
|
||||
$label[0].set "iconclass", data.iconclass if data.iconclass
|
||||
$label
|
||||
.css "top", top + "px"
|
||||
.css "left", left + "px"
|
||||
|
||||
Ant.OS.GUI.define "afx-tree-view", TreeViewTag
|
||||
Ant.OS.GUI.define "afx-tree-view-item-proto", TreeViewItemPrototype
|
||||
|
@ -104,7 +104,7 @@ class BaseFileHandle
|
||||
return resolve(@info) if @ready
|
||||
@meta()
|
||||
.then (d) =>
|
||||
return reject d if d.errors
|
||||
return reject Ant.OS.API.throwe d.error if d.errors
|
||||
@info = d.result
|
||||
@ready = true
|
||||
resolve(d.result)
|
||||
@ -190,7 +190,7 @@ class BaseFileHandle
|
||||
.then (r) =>
|
||||
@_mv(d)
|
||||
.then (data) =>
|
||||
Ant.OS.announcer.ostrigger "VFS", { m: "move", file: @ }
|
||||
Ant.OS.announcer.ostrigger "VFS", { m: "move", file: d.asFileHandle() }
|
||||
resolve data
|
||||
.catch (e) -> reject e
|
||||
.catch (e) -> reject e
|
||||
@ -210,7 +210,7 @@ class BaseFileHandle
|
||||
|
||||
unsupported: (t) ->
|
||||
new Promise (resolve, reject) =>
|
||||
reject { error: __("Action {0} is unsupported on: {1}", t, @path) }
|
||||
reject Ant.OS.API.throwe __("Action {0} is unsupported on: {1}", t, @path)
|
||||
# actions must be implemented by subclasses
|
||||
|
||||
_rd: (t) -> @unsupported "read"
|
||||
@ -232,7 +232,13 @@ class RemoteFileHandle extends Ant.OS.API.VFS.BaseFileHandle
|
||||
super path
|
||||
|
||||
meta: () ->
|
||||
Ant.OS.API.handle.fileinfo @path
|
||||
new Promise (resolve, reject) =>
|
||||
Ant.OS.API.handle.fileinfo @path
|
||||
.then (d) ->
|
||||
return reject Ant.OS.API.throwe d.error if d.error
|
||||
resolve d
|
||||
.catch (e) -> reject e
|
||||
|
||||
|
||||
getlink: () ->
|
||||
Ant.OS.API.handle.get + "/" + @path
|
||||
@ -250,38 +256,62 @@ class RemoteFileHandle extends Ant.OS.API.VFS.BaseFileHandle
|
||||
|
||||
_wr: (t) ->
|
||||
# t is base64 or undefined
|
||||
return Ant.OS.API.handle.write @path, @cache if t is "base64"
|
||||
new Promise (resolve, reject) =>
|
||||
@b64(t)
|
||||
.then (r) =>
|
||||
Ant.OS.API.handle.write @path, r
|
||||
.then (result) ->
|
||||
resolve result
|
||||
.catch (e) -> reject e
|
||||
if t is "base64"
|
||||
Ant.OS.API.handle.write(@path, @cache).then (d) ->
|
||||
return reject Ant.OS.API.throwe d.error if d.error
|
||||
resolve d
|
||||
.catch (e) -> reject e
|
||||
else
|
||||
@b64(t)
|
||||
.then (r) =>
|
||||
Ant.OS.API.handle.write @path, r
|
||||
.then (result) ->
|
||||
return reject Ant.OS.API.throwe result.error if result.error
|
||||
resolve result
|
||||
.catch (e) -> reject e
|
||||
.catch (e) -> reject e
|
||||
|
||||
_mk: (d) ->
|
||||
if not @info
|
||||
return new Promise (resolve, reject) =>
|
||||
reject Ant.OS.API.throwe __(
|
||||
new Promise (resolve, reject) =>
|
||||
if not @info
|
||||
return reject Ant.OS.API.throwe __(
|
||||
"file meta-data not found: {0}", @path)
|
||||
if @info.type is "file"
|
||||
return new Promise (resolve, reject) =>
|
||||
reject Ant.OS.API.throwe __("{0} is not a directory", @path)
|
||||
Ant.OS.API.handle.mkdir "#{@path}/#{d}"
|
||||
if @info.type is "file"
|
||||
return reject Ant.OS.API.throwe __("{0} is not a directory", @path)
|
||||
Ant.OS.API.handle.mkdir "#{@path}/#{d}"
|
||||
.then (d) ->
|
||||
return reject Ant.OS.API.throwe d.error if d.error
|
||||
resolve d
|
||||
.catch (e) -> reject e
|
||||
|
||||
_rm: () ->
|
||||
Ant.OS.API.handle.delete @path
|
||||
new Promise (resolve, reject) =>
|
||||
Ant.OS.API.handle.delete @path
|
||||
.then (d) ->
|
||||
return reject Ant.OS.API.throwe d.error if d.error
|
||||
resolve d
|
||||
.catch (e) -> reject e
|
||||
|
||||
|
||||
_mv: (d) ->
|
||||
Ant.OS.API.handle.move @path, d
|
||||
new Promise (resolve, reject) =>
|
||||
Ant.OS.API.handle.move @path, d
|
||||
.then (d) ->
|
||||
return reject Ant.OS.API.throwe d.error if d.error
|
||||
resolve d
|
||||
.catch (e) -> reject e
|
||||
|
||||
|
||||
_up: () ->
|
||||
if @info.type isnt "dir"
|
||||
return new Promise (resolve, reject) =>
|
||||
reject Ant.OS.API.throwe __("{0} is not a file", @path)
|
||||
Ant.OS.API.handle.upload @path
|
||||
new Promise (resolve, reject) =>
|
||||
if @info.type isnt "dir"
|
||||
return reject Ant.OS.API.throwe __("{0} is not a file", @path)
|
||||
Ant.OS.API.handle.upload @path
|
||||
.then (d) ->
|
||||
return reject Ant.OS.API.throwe d.error if d.error
|
||||
resolve d
|
||||
.catch (e) -> reject e
|
||||
|
||||
_down: () ->
|
||||
new Promise (resolve, reject) =>
|
||||
@ -296,7 +326,12 @@ class RemoteFileHandle extends Ant.OS.API.VFS.BaseFileHandle
|
||||
reject e
|
||||
|
||||
_pub: () ->
|
||||
Ant.OS.API.handle.sharefile @path, true
|
||||
new Promise (resolve, reject) =>
|
||||
Ant.OS.API.handle.sharefile @path, true
|
||||
.then (d) ->
|
||||
return reject Ant.OS.API.throwe d.error if d.error
|
||||
resolve d
|
||||
.catch (e) -> reject e
|
||||
|
||||
Ant.OS.API.VFS.register "^(home|desktop|os|Untitled)$", RemoteFileHandle
|
||||
|
||||
@ -374,10 +409,20 @@ class SharedFileHandle extends Ant.OS.API.VFS.BaseFileHandle
|
||||
Ant.OS.API.handle.readfile @path, if t then t else "text"
|
||||
|
||||
_wr: (d, t) ->
|
||||
Ant.OS.API.handle.write @path, d
|
||||
new Promise (resolve, reject) =>
|
||||
Ant.OS.API.handle.write @path, d
|
||||
.then (d) ->
|
||||
return reject Ant.OS.API.throwe d.error if d.error
|
||||
resolve d
|
||||
.catch (e) -> reject e
|
||||
|
||||
_rm: () ->
|
||||
Ant.OS.API.handle.sharefile @basename, false
|
||||
new Promise (resolve, reject) =>
|
||||
Ant.OS.API.handle.sharefile @basename, false
|
||||
.then (d) ->
|
||||
return reject Ant.OS.API.throwe d.error if d.error
|
||||
resolve d
|
||||
.catch (e) -> reject e
|
||||
|
||||
_down: () ->
|
||||
new Promise (resolve, reject) =>
|
||||
|
@ -77,7 +77,6 @@ class CodePad.BaseExtension
|
||||
dest.asFileHandle()
|
||||
.setCache('data:application/zip;base64,' + data)
|
||||
.write("base64").then (r) =>
|
||||
return reject r.error if r.error
|
||||
@notify __("Package is generated in release folder")
|
||||
.catch (e) -> reject e
|
||||
.catch (e) -> reject e
|
||||
|
@ -112,7 +112,6 @@ class App.extensions.AntOSDK extends App.BaseExtension
|
||||
.setCache jsrc
|
||||
.write("text/plain")
|
||||
.then (d) ->
|
||||
return e d.error if d.error
|
||||
r()
|
||||
.catch (ex) -> e ex
|
||||
.then () =>
|
||||
@ -125,7 +124,6 @@ class App.extensions.AntOSDK extends App.BaseExtension
|
||||
.setCache txt
|
||||
.write("text/plain")
|
||||
.then (d) ->
|
||||
return e d.error if d.error
|
||||
r()
|
||||
.catch (ex) -> e ex
|
||||
.then () =>
|
||||
|
@ -107,7 +107,6 @@ class App.extensions.ExtensionMaker extends App.BaseExtension
|
||||
.setCache jsrc
|
||||
.write("text/plain")
|
||||
.then (d) ->
|
||||
return e d.error if d.error
|
||||
r()
|
||||
.catch (ex) -> e ex
|
||||
.then () ->
|
||||
@ -117,7 +116,6 @@ class App.extensions.ExtensionMaker extends App.BaseExtension
|
||||
.setCache meta.meta
|
||||
.write("object")
|
||||
.then (data) ->
|
||||
return e data.error if data.error
|
||||
r data
|
||||
.catch (ex) -> e ex
|
||||
.then () =>
|
||||
|
@ -109,11 +109,19 @@ class CodePad extends this.OS.GUI.BaseApplication
|
||||
@bindKey "CTRL-S", () => @menuAction "save"
|
||||
@bindKey "ALT-W", () => @menuAction "saveas"
|
||||
|
||||
@fileview.set "ondragndrop", (e) =>
|
||||
src = e.data.from.get("data").path.asFileHandle()
|
||||
des = e.data.to.get("data").path
|
||||
src.move "#{des}/#{src.basename}"
|
||||
.then (d) ->
|
||||
e.data.to.update des
|
||||
e.data.from.get("parent").update src.parent().path
|
||||
.catch (e) => @error __("Unable to move file/folder"), e
|
||||
|
||||
@loadExtensionMetaData()
|
||||
@initCommandPalete()
|
||||
@initSideBar()
|
||||
@openFile @currfile
|
||||
|
||||
|
||||
openFile: (file) ->
|
||||
#find tab
|
||||
@ -303,10 +311,9 @@ class CodePad extends this.OS.GUI.BaseApplication
|
||||
fp = "#{dir.path}/#{d}".asFileHandle()
|
||||
fp.write("text/plain")
|
||||
.then (r) =>
|
||||
return @error __("Fail to create {0}: {1}", d, r.error) if r.error
|
||||
@fileview.update dir.path
|
||||
.catch (e) =>
|
||||
@error __("Fail to create: {0}", e.stack), e
|
||||
.catch (e) =>
|
||||
@error __("Fail to create: {0}", e.stack), e
|
||||
|
||||
when "newdir"
|
||||
return unless dir
|
||||
@ -317,10 +324,9 @@ class CodePad extends this.OS.GUI.BaseApplication
|
||||
.then (d) =>
|
||||
dir.mk(d)
|
||||
.then (r) =>
|
||||
return @error __("Fail to create {0}: {1}", d, r.error) if r.error
|
||||
@fileview.update dir.path
|
||||
.catch (e) =>
|
||||
@error __("Fail to create: {0}", dir.path), e
|
||||
.catch (e) =>
|
||||
@error __("Fail to create: {0}", dir.path), e
|
||||
|
||||
when "rename"
|
||||
return unless file
|
||||
@ -335,10 +341,9 @@ class CodePad extends this.OS.GUI.BaseApplication
|
||||
dir = file.parent()
|
||||
file.move "#{dir.path}/#{d}"
|
||||
.then (r) =>
|
||||
return @error __("Fail to rename to {0}: {1}", d, r.error) if r.error
|
||||
@fileview.update dir.path
|
||||
.catch (e) =>
|
||||
@error __("Fail to rename: {0}", file.path), e
|
||||
.catch (e) =>
|
||||
@error __("Fail to rename: {0}", file.path), e
|
||||
|
||||
when "delete"
|
||||
return unless file
|
||||
@ -353,10 +358,9 @@ class CodePad extends this.OS.GUI.BaseApplication
|
||||
dir = file.parent()
|
||||
file.remove()
|
||||
.then (r) =>
|
||||
return @error __("Fail to delete {0}: {1}", file.filename, r.error) if r.error
|
||||
@fileview.update dir.path
|
||||
.catch (e) =>
|
||||
@error __("Fail to delete: {0}", file.path), e
|
||||
.catch (e) =>
|
||||
@error __("Fail to delete: {0}", file.path), e
|
||||
|
||||
else
|
||||
|
||||
@ -364,7 +368,6 @@ class CodePad extends this.OS.GUI.BaseApplication
|
||||
save: (file) ->
|
||||
file.write("text/plain")
|
||||
.then (d) =>
|
||||
return @error __("Error saving file {0}: {1}", file.basename, d.error) if d.error
|
||||
file.dirty = false
|
||||
file.text = file.basename
|
||||
@tabbar.update()
|
||||
|
@ -155,6 +155,7 @@ class PushNotification extends this.OS.GUI.BaseService
|
||||
error: o.data.e,
|
||||
time: logtime
|
||||
}
|
||||
@dialog.loglist.set "data", @dialog.data.logs if @dialog
|
||||
|
||||
pushout: (s, o) ->
|
||||
d = {
|
||||
|
@ -81,6 +81,7 @@ class Files extends this.OS.GUI.BaseApplication
|
||||
@currdir = dir
|
||||
($ @navinput).val dir.path
|
||||
resolve d.result
|
||||
.catch (e) -> reject e
|
||||
|
||||
@setting.sidebar = true if @setting.sidebar is undefined
|
||||
@setting.nav = true if @setting.nav is undefined
|
||||
@ -214,8 +215,6 @@ class Files extends this.OS.GUI.BaseApplication
|
||||
.then (d) =>
|
||||
return if d is file.filename
|
||||
file.path.asFileHandle().move "#{@currdir.path}/#{d}"
|
||||
.then (r) =>
|
||||
@error __("Fail to rename to {0}: {1}", d, r.error) if r.error
|
||||
.catch (e) =>
|
||||
@error __("Fail to rename: {0}", file.path), e
|
||||
|
||||
@ -229,8 +228,6 @@ class Files extends this.OS.GUI.BaseApplication
|
||||
.then (d) =>
|
||||
return unless d
|
||||
file.path.asFileHandle().remove()
|
||||
.then (r) =>
|
||||
@error __("Fail to delete {0}: {1}", file.filename, r.error) if r.error
|
||||
.catch (e) =>
|
||||
@error __("Fail to delete: {0}", file.path), e
|
||||
|
||||
@ -254,7 +251,6 @@ class Files extends this.OS.GUI.BaseApplication
|
||||
@clipboard.file.move "#{@currdir.path}/#{@clipboard.file.basename}"
|
||||
.then (r) =>
|
||||
@clipboard = undefined
|
||||
@error __("Fail to paste: {0}", r.error) if r.error
|
||||
.catch (e) =>
|
||||
@error __("Fail to paste: {0}", @clipboard.file.path), e
|
||||
else
|
||||
@ -266,7 +262,6 @@ class Files extends this.OS.GUI.BaseApplication
|
||||
fp.write(@clipboard.file.info.mime)
|
||||
.then (r) =>
|
||||
@clipboard = undefined
|
||||
@error __("Fail to paste: {0}", r.error) if r.error
|
||||
.catch (e) =>
|
||||
@error __("Fail to paste: {0}", @clipboard.file.path), e
|
||||
.catch (e) =>
|
||||
@ -284,8 +279,6 @@ class Files extends this.OS.GUI.BaseApplication
|
||||
})
|
||||
.then (d) =>
|
||||
@currdir.mk(d)
|
||||
.then (r) =>
|
||||
@error __("Fail to create {0}: {1}", d, r.error) if r.error
|
||||
.catch (e) =>
|
||||
@error __("Fail to create: {0}", d), e
|
||||
|
||||
@ -297,8 +290,6 @@ class Files extends this.OS.GUI.BaseApplication
|
||||
.then (d) =>
|
||||
fp = "#{@currdir.path}/#{d}".asFileHandle()
|
||||
fp.write("text/plain")
|
||||
.then (r) =>
|
||||
@error __("Fail to create {0}: {1}", d, r.error) if r.error
|
||||
.catch (e) =>
|
||||
@error __("Fail to create: {0}", fp.path)
|
||||
|
||||
@ -308,8 +299,6 @@ class Files extends this.OS.GUI.BaseApplication
|
||||
|
||||
when "#{@name}-upload"
|
||||
@currdir.upload()
|
||||
.then (r) =>
|
||||
@error __("Fail to upload to {0}: {1}", @currdir.path, r.error) if r.error
|
||||
.catch (e) =>
|
||||
@error __("Fail to upload: {0}", e.toString()), e
|
||||
|
||||
@ -317,8 +306,7 @@ class Files extends this.OS.GUI.BaseApplication
|
||||
return unless file and file.type is "file"
|
||||
file.path.asFileHandle().publish()
|
||||
.then (r) =>
|
||||
return @error __("Cannot share file: {0}", r.error) if r.error
|
||||
return @notify __("Shared url: {0}", r.result)
|
||||
@notify __("Shared url: {0}", r.result)
|
||||
.catch (e) =>
|
||||
@error __("Fail to publish: {0}", file.path), e
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
afx-grid-view afx-grid-row:nth-child(even) afx-grid-cell
|
||||
{
|
||||
background-color: #464646;
|
||||
background-color: #3b3b3b;
|
||||
}
|
||||
|
||||
afx-grid-view afx-grid-row.afx-grid-row-selected afx-grid-cell
|
||||
|
@ -6,7 +6,7 @@ afx-list-view > div.list-container > ul li{
|
||||
background-color: #363636;
|
||||
}
|
||||
afx-list-view > div.list-container > ul afx-list-item:nth-child(even) li{
|
||||
background-color:#464646;
|
||||
background-color:#3b3b3b;
|
||||
}
|
||||
afx-list-view i.closable{
|
||||
width: 16px;
|
||||
|
@ -1,4 +1,8 @@
|
||||
afx-resizer {
|
||||
afx-resizer.vertical {
|
||||
background-color: transparent;
|
||||
border-top: 1px solid #262626;
|
||||
}
|
||||
afx-resizer.horizontal {
|
||||
background-color: transparent;
|
||||
border-left: 1px solid #262626;
|
||||
}
|
@ -21,7 +21,7 @@ afx-tree-view div.afx_tree_item_selected:hover{
|
||||
afx-tree-view .afx_folder_item{
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
/*
|
||||
afx-tree-view .afx_tree_item_odd{
|
||||
background-color: #464646;
|
||||
}
|
||||
}*/
|
@ -1,4 +1,8 @@
|
||||
afx-resizer {
|
||||
afx-resizer.vertical {
|
||||
background-color: transparent;
|
||||
border-left: 1px solid #868686;
|
||||
border-top: 1px solid #868686;
|
||||
}
|
||||
afx-resizer.horizontal {
|
||||
background-color: transparent;
|
||||
border-left: 1px solid #868686;
|
||||
}
|
@ -21,7 +21,8 @@ afx-tree-view div.afx_tree_item_selected:hover{
|
||||
afx-tree-view .afx_folder_item{
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
/*
|
||||
afx-tree-view .afx_tree_item_odd{
|
||||
background-color: #f5F5F5;
|
||||
}
|
||||
}
|
||||
*/
|
@ -62,11 +62,11 @@ body
|
||||
|
||||
#login_form{
|
||||
width:300px;
|
||||
height: 200px;
|
||||
height: 180px;
|
||||
display: block;
|
||||
border:1px solid #a6a6a6;
|
||||
border:1px solid #262626;
|
||||
border-radius: 6px;
|
||||
box-shadow: 1px 1px 1px #9f9F9F;
|
||||
box-shadow: 0px 3px 6px 0px rgba(0,0,0,0.65);
|
||||
position: absolute;
|
||||
margin: auto;
|
||||
top:0;
|
||||
@ -76,14 +76,14 @@ body
|
||||
font-family:Verdana, Geneva, Tahoma, sans-serif;
|
||||
font-size: 13px;
|
||||
text-align: center;
|
||||
background-color: white;
|
||||
color: #414339;
|
||||
background-color: #363636;
|
||||
color: white;
|
||||
}
|
||||
|
||||
#login_form p{
|
||||
display: inline-block;
|
||||
background-color:#dfdfdf;
|
||||
border-bottom: 1px solid #a6a6a6;
|
||||
/* background-color:#dfdfdf; */
|
||||
border-bottom: 1px solid #262626;
|
||||
padding:10px;
|
||||
width: calc(100% - 20px);
|
||||
border-top-left-radius: 6px;
|
||||
@ -100,24 +100,25 @@ body
|
||||
box-sizing: border-box;
|
||||
font-size: 13px;
|
||||
padding: 5px;
|
||||
border: 1px solid #a6a6a6;
|
||||
background-color: white;
|
||||
color: #414339;
|
||||
color: white;
|
||||
border: 1px solid #262626;
|
||||
background-color: #464646;
|
||||
}
|
||||
#login_form button{
|
||||
margin-top:10px;
|
||||
width: 250px;
|
||||
height: 30px;
|
||||
background-color: #2786F3;
|
||||
background-color: #464646;
|
||||
border: 1px solid #262626;
|
||||
color: white;
|
||||
border: 1px solid #dedede;
|
||||
border-radius: 6px;
|
||||
font-family: Verdana, Geneva, Tahoma, sans-serif;
|
||||
font-size: 13px;
|
||||
padding:5px;
|
||||
outline: none;
|
||||
}
|
||||
#login_error{
|
||||
padding:3px;
|
||||
color:red;
|
||||
color:chocolate;
|
||||
font-weight: normal;
|
||||
}
|
Loading…
Reference in New Issue
Block a user