support drag and drop in file

This commit is contained in:
Xuan Sang LE
2020-05-19 23:29:31 +02:00
parent 53df50f196
commit 33eab1d30a
7 changed files with 67 additions and 6 deletions

View File

@ -1,7 +1,8 @@
{
"app":null,
"className": "CoreServices",
"services": [ "Calendar", "PushNotification" ],
"name":"CoreServices",
"name": "Core services",
"description":"This is the core services",
"info":{
"author": "Xuan Sang LE",

View File

@ -83,6 +83,19 @@ class Files extends this.OS.GUI.BaseApplication
resolve d.result
.catch (e) -> reject e
@view.set "ondragndrop", (e) =>
return unless e
src = e.data.from.get("data")
des = e.data.to.get("data")
return if des.type is "file"
file = src.path.asFileHandle()
file.move "#{des.path}/#{file.basename}"
.then () =>
@view.set "path", @view.get("path")
@view.update file.parent().path
@view.update des.path
.catch (e) => @error __("Unable to move: {0} -> {1}", src.path, des.path), e
@setting.sidebar = true if @setting.sidebar is undefined
@setting.nav = true if @setting.nav is undefined
@setting.showhidden = false if @setting.showhidden is undefined

View File

@ -54,7 +54,7 @@ class MarketPlace extends this.OS.GUI.BaseApplication
@btinstall.set "onbtclick", (e) =>
if @btinstall.get "dirty"
return @update()
return @updatePackage()
.then () => @notify __("Package updated")
.catch (e) => @error e.toString(), e
@remoteInstall()
@ -108,7 +108,7 @@ class MarketPlace extends this.OS.GUI.BaseApplication
list = []
for k, v of pkgcache
list.push {
className: v.app,
className: if v.app then v.app else v.className,
name: v.name,
text: v.name,
icon: v.icon,
@ -293,6 +293,11 @@ class MarketPlace extends this.OS.GUI.BaseApplication
if r.error
return reject @_api.throwe __("Cannot uninstall package: {0}", r.error)
@notify __("Package uninstalled")
# stop all the services if any
if app.services
for srv in app.services
@_gui.unloadApp srv
delete @systemsetting.system.packages[name]
@_gui.unloadApp name
if sel.download
@ -304,7 +309,7 @@ class MarketPlace extends this.OS.GUI.BaseApplication
.catch (e) -> reject e
.catch (e) -> reject e
update: () ->
updatePackage: () ->
new Promise (resolve, reject) =>
@uninstall().then () =>
@remoteInstall()