var editor = new armadillo.PathControl(this.file_.getFullPath(), true);
dialog.addChild(editor, true);
+ var closeCallback = function(e) {
+ if (e.key != goog.ui.Dialog.DefaultButtonKeys.CANCEL) {
+ var newPath = editor.getPath();
+ this.file_.move(newPath);
+ }
+ dialog.dispose();
+ this.dispose();
+ };
+ // Will be removed when the event source closes.
+ goog.events.listen(dialog, goog.ui.Dialog.SELECT_EVENT,
+ closeCallback, false, this);
+
dialog.setVisible(true);
var position = goog.style.getPosition(dialog.getElement());
goog.style.setPosition(dialog.getElement(), position.x, '10%');
var closeCallback = function(e) {
if (e.key != goog.ui.Dialog.DefaultButtonKeys.CANCEL) {
this.file_.remove();
+ confirm.dispose();
+ this.dispose();
}
};
// Will be removed when the event source closes.
app.sendRequest('remove', {'path':this.path_ + this.name_}, callback);
};
+/**
+ * Moves a file from one absolute path to another. On success, it will navigate
+ * to the new path.
+ * @param {string} dest The destination path.
+ */
+armadillo.File.prototype.move = function(dest) {
+ var file = this;
+ var callback = function(data) {
+ if (data['error']) {
+ app.showError(data['message']);
+ } else {
+ app.clearError();
+ app.list(app.stripLastPathComponent(dest));
+ }
+ };
+ app.sendRequest('move', {'source':this.getFullPath(), 'target':dest}, callback);
+};
+
/**
* Click handler for the list element.
* @param {Event} e
console.log(this.path_ + ' = ' + this.name_);
};
+/**
+ * Gets the new path.
+ * @returns {string}
+ */
+armadillo.PathControl.prototype.getPath = function() {
+ return app.joinPath(this.path_, this.name_);
+};
+
/**
* Creates a new path control object.
*/