feature(buffer) move -> cut

This commit is contained in:
coderaiser 2014-08-27 10:23:47 -04:00
parent b5a1bac0cd
commit 638c0bab6f
4 changed files with 16 additions and 16 deletions

View file

@ -203,7 +203,7 @@ Right mouse click button shows context menu with items:
- Edit
- Rename
- Copy
- Move
- Cut
- Paste
- Delete
- Zip file

View file

@ -11,7 +11,7 @@ var Util, DOM;
Info = DOM.CurrentInfo,
COPY = 'copy',
MOVE = 'move';
CUT = 'cut';
function getNames() {
var name = Info.name,
@ -26,20 +26,20 @@ var Util, DOM;
names = getNames(),
from = Info.dirPath;
Storage.remove(MOVE)
Storage.remove(CUT)
.set(COPY, {
from : from,
names: names
});
};
this.move = function() {
this.cut = function() {
var Storage = DOM.Storage,
names = getNames(),
from = Info.dirPath;
Storage.remove(COPY)
.set(MOVE, {
.set(CUT, {
from : from,
names: names
});
@ -47,30 +47,30 @@ var Util, DOM;
this.paste = function() {
var copy = Storage.get.bind(Storage, COPY),
move = Storage.get.bind(Storage, MOVE);
cut = Storage.get.bind(Storage, CUT);
Util.exec.parallel([copy, move], function(error, cp, mv) {
Util.exec.parallel([copy, cut], function(error, cp, ct) {
var data = {},
msg = 'Path is same!',
path = Info.dirPath;
if (!error && !cp && !mv)
if (!error && !cp && !ct)
error = 'No files selected!';
if (error) {
DOM.Dialog.alert(error);
} else if (cp) {
data = Util.parseJSON(cp);
data.to = path;
data = Util.parseJSON(cp);
data.to = path;
if (data.from === path)
Dialog.alert(msg);
else
DOM.copyFiles(data);
} else if (mv) {
data = Util.parseJSON(mv);
data.to = path;
} else if (ct) {
data = Util.parseJSON(ct);
data.to = path;
if (data.from === path)
Dialog.alert(msg);
@ -79,7 +79,7 @@ var Util, DOM;
}
Storage.remove(COPY)
.remove(MOVE);
.remove(CUT);
});
};
}

View file

@ -429,7 +429,7 @@ var CloudCmd, Util, DOM;
case Key.X:
if (ctrl)
Buffer.move();
Buffer.cut();
break;
case Key.V:

View file

@ -141,7 +141,7 @@ var CloudCmd, Util, DOM, CloudFunc, MenuIO;
setTimeout(DOM.renameCurrent, 100);
},
'Copy' : Buffer.copy,
'Move' : Buffer.move,
'Cut' : Buffer.cut,
'Paste' : Buffer.paste,
'Delete' : DOM.promptDelete,
'Zip file' : DOM.zipFile,