Add renaming to Asset qml

This commit is contained in:
Ryan Huffman 2016-03-09 16:29:17 -08:00
parent d299ce2677
commit f23057b1c0

View file

@ -33,7 +33,7 @@ Window {
HifiConstants { id: hifi } HifiConstants { id: hifi }
property var scripts: ScriptDiscoveryService; property var scripts: ScriptDiscoveryService;
property var scriptsModel: Assets.getAssetMappingModel() property var scriptsModel: Assets.mappingModel;
property var currentDirectory; property var currentDirectory;
Settings { Settings {
@ -52,6 +52,7 @@ Window {
} }
function renameFile() { function renameFile() {
var path = scriptsModel.data(treeView.currentIndex, 0x100); var path = scriptsModel.data(treeView.currentIndex, 0x100);
print(path);
if (!path) { if (!path) {
return; return;
} }
@ -63,16 +64,15 @@ Window {
}); });
object.selected.connect(function(destinationPath) { object.selected.connect(function(destinationPath) {
console.log("Renaming " + path + " to " + destinationPath); console.log("Renaming " + path + " to " + destinationPath);
Assets.renameMapping(path, destinationPath, function(err) {
print("Finished rename: ", err);
reload();
});
}); });
} }
function deleteFile() { function deleteFile() {
var path = scriptsModel.data(treeView.currentIndex, 0x100); var path = scriptsModel.data(treeView.currentIndex, 0x100);
print(path); print(treeView.currentIndex, path);
if (!path) { if (!path) {
return; return;
} }
@ -94,8 +94,6 @@ Window {
print("Finished deleting path: ", path, err); print("Finished deleting path: ", path, err);
reload(); reload();
}); });
} }
}); });
} }