From a576150b64921f0f3d9d7d6700d0f26836f32b12 Mon Sep 17 00:00:00 2001 From: ente Date: Sat, 4 Dec 2010 17:36:52 +0100 Subject: replaced fileActions[this.mime] by fileActions[this.mime1 + this.mime2], since an object name cannot contain slashes. (correct me if I'm wrong) --- js/lib_files.js | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'js') diff --git a/js/lib_files.js b/js/lib_files.js index 8f7f9035585..177d8a51c06 100644 --- a/js/lib_files.js +++ b/js/lib_files.js @@ -355,10 +355,13 @@ OC_FILES.file=function(dir,file,type,mime){ } } } - if(OC_FILES.fileActions[this.mime]){ - for(index in OC_FILES.fileActions[this.mime]){ - if(OC_FILES.fileActions[this.mime][index].call){ - this.actions[index]=OC_FILES.fileActions[this.mime][index]; + // replaced fileActions[this.mime] by fileActions[this.mime1 + this.mime2] + // since an object name cannot contain slashes. + // (correct me if I'm wrong) + if(OC_FILES.fileActions[this.mime1 + this.mime2]){ + for(index in OC_FILES.fileActions[this.mime1 + this.mime2]){ + if(OC_FILES.fileActions[this.mime1 + this.mime2][index].call){ + this.actions[index]=OC_FILES.fileActions[this.mime1 + this.mime2][index]; } } } -- cgit v1.2.3 From db5cac3b3fa64af74353ae121e75d2182a211327 Mon Sep 17 00:00:00 2001 From: ente Date: Sun, 5 Dec 2010 17:45:17 +0100 Subject: reverted a576150b Seems we don't really need this, since calling e.g. fileActions['audio/x-wav'] is no problem. It should be also more clear to use and read than e.g. fileActions.audioxwav --- js/lib_files.js | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) (limited to 'js') diff --git a/js/lib_files.js b/js/lib_files.js index 177d8a51c06..8f7f9035585 100644 --- a/js/lib_files.js +++ b/js/lib_files.js @@ -355,13 +355,10 @@ OC_FILES.file=function(dir,file,type,mime){ } } } - // replaced fileActions[this.mime] by fileActions[this.mime1 + this.mime2] - // since an object name cannot contain slashes. - // (correct me if I'm wrong) - if(OC_FILES.fileActions[this.mime1 + this.mime2]){ - for(index in OC_FILES.fileActions[this.mime1 + this.mime2]){ - if(OC_FILES.fileActions[this.mime1 + this.mime2][index].call){ - this.actions[index]=OC_FILES.fileActions[this.mime1 + this.mime2][index]; + if(OC_FILES.fileActions[this.mime]){ + for(index in OC_FILES.fileActions[this.mime]){ + if(OC_FILES.fileActions[this.mime][index].call){ + this.actions[index]=OC_FILES.fileActions[this.mime][index]; } } } -- cgit v1.2.3 From 654387ff05e84c51a4c85854abe1843bb65ed412 Mon Sep 17 00:00:00 2001 From: Robin Appelman Date: Sun, 12 Dec 2010 22:34:17 +0100 Subject: Show error when trying to create a file or folder that already exists fixes https://bugs.kde.org/show_bug.cgi?id=259616 --- js/lib_files.js | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'js') diff --git a/js/lib_files.js b/js/lib_files.js index 8f7f9035585..54af643272a 100644 --- a/js/lib_files.js +++ b/js/lib_files.js @@ -225,6 +225,10 @@ OC_FILES.newFile=function(type,name,dir){ arg=new Object; arg.name=name; arg.dir=dir; + if(OC_FILES.cache.files[name]){//check if the file already exists + alert(((type=='dir')?'folder ':'file ')+name+' already exists.'); + return; + } arg.type=type; OC_API.run('new',{dir:dir,name:name,type:type},OC_FILES.new_callback,arg) if(!OC_FILES.cache.incomplete[dir]){ -- cgit v1.2.3