From d04ca56d8ae08f82032e4d33f883d499c21d0101 Mon Sep 17 00:00:00 2001 From: Robert Sesek Date: Mon, 4 Oct 2010 09:31:21 -0400 Subject: [PATCH] Both Move and Rename should use the path control. Remove our ModalDialog. --- build.py | 1 - web_frontend/actor.js | 10 +--- web_frontend/modal_dialog.js | 103 ----------------------------------- 3 files changed, 3 insertions(+), 111 deletions(-) delete mode 100644 web_frontend/modal_dialog.js diff --git a/build.py b/build.py index d5ddf76..52e2bec 100755 --- a/build.py +++ b/build.py @@ -37,7 +37,6 @@ SOURCES = [ SOURCES_FE = [ 'version.js', 'path_control.js', - 'modal_dialog.js', 'actor.js', 'file.js', 'main.js', diff --git a/web_frontend/actor.js b/web_frontend/actor.js index 94599f4..ba6cfa3 100644 --- a/web_frontend/actor.js +++ b/web_frontend/actor.js @@ -9,7 +9,6 @@ goog.provide('armadillo.Actor'); -goog.require('armadillo.ModalDialog'); goog.require('armadillo.PathControl'); goog.require('goog.array'); goog.require('goog.dom'); @@ -156,14 +155,11 @@ armadillo.Actor.prototype.tileClickHandler_ = function(e) { // TODO: assert that this.file_.isDirectory(). app.navigate(this.file_.getName()); this.hide(); - } else if (option == armadillo.Actor.options_.MOVE) { + } else if (option == armadillo.Actor.options_.MOVE || + option == armadillo.Actor.options_.RENAME) { this.performMove_(); } else if (option == armadillo.Actor.options_.DELETE) { this.performDelete_(); - } else if (option == armadillo.Actor.options_.RENAME) { - var dialog = new armadillo.ModalDialog(); - dialog.render(); - dialog.setVisible(true); } }; @@ -175,7 +171,7 @@ armadillo.Actor.prototype.performMove_ = function() { var dialog = this.createActionDialog_(); dialog.setTitle('Move File'); - var editor = new armadillo.PathControl(this.file_.getFullPath(), false); + var editor = new armadillo.PathControl(this.file_.getFullPath(), true); dialog.addChild(editor, true); dialog.setVisible(true); diff --git a/web_frontend/modal_dialog.js b/web_frontend/modal_dialog.js deleted file mode 100644 index 1a1f245..0000000 --- a/web_frontend/modal_dialog.js +++ /dev/null @@ -1,103 +0,0 @@ -// -// Armadillo File Manager -// Copyright (c) 2010, Robert Sesek -// -// This program is free software: you can redistribute it and/or modify it under -// the terms of the GNU General Public License as published by the Free Software -// Foundation, either version 3 of the License, or any later version. -// - -goog.provide('armadillo.ModalDialog'); - -goog.require('goog.dom.classes'); -goog.require('goog.events.EventHandler'); -goog.require('goog.ui.Container'); -goog.require('goog.ui.Control'); - -/** - * A modal dialog that does not use iframe masks, but instead installs a global - * event listener to prevent events. - * @param {goog.ui.DomHelper} opt_domHelper - * @constructor - */ -armadillo.ModalDialog = function(opt_domHelper) { - goog.ui.Container.call(this, null, null, opt_domHelper); - - /** - * Master EventHandler - */ - this.eh_ = new goog.events.EventHandler(); -}; -goog.inherits(armadillo.ModalDialog, goog.ui.Container); - -/** - * Disposer - * @private - */ -armadillo.ModalDialog.prototype.disposeInternal = function() { - armadillo.ModalDialog.superClass_.disposeInternal.call(this); - this.eh_.dispose(); - this.eh_ = null; -}; - -/** - * @inheritsDoc - */ -armadillo.ModalDialog.prototype.createDom = function() { - this.decorateInternal(this.dom_.createElement('div')); -}; - -/** - * @inheritsDoc - */ -armadillo.ModalDialog.prototype.decorateInternal = function(element) { - this.element_ = element; - goog.dom.classes.set(this.element_, 'modalDialog'); - - var close = new goog.ui.Control('Close Modal Dialog'); - var dialog = this; - close.handleMouseDown = function(e) { - e.stopPropagation(); - dialog.dispose(); - }; - this.addChild(close, true); -}; - -/** - * @inheritsDoc - */ -armadillo.ModalDialog.prototype.enterDocument = function() { - armadillo.ModalDialog.superClass_.enterDocument.call(this); - // Create an event sink that captures all browser event types. - var types = new Array(); - for (type in goog.events.EventType) { - types.push(goog.events.EventType[type]); - } - this.eventSinkKey_ = this.eh_.listen(this.dom_.getWindow(), - types, this.eventSink_, true, this); -}; - -/** - * @inheritsDoc - */ -armadillo.ModalDialog.prototype.exitDocument = function() { - goog.events.unlistenByKey(this.eventSinkKey_); - this.eventSinkKey_ = null; -}; - -/** - * Every event that gets dispatched to the Window will first be evaluated by - * this memeber. If the event's target is not a child of the dialog, the event - * is cancelled. - * @param {Event} event - */ -armadillo.ModalDialog.prototype.eventSink_ = function(event) { - var target = event.target; - while (target) { - if (target == this.element_) { - return; - } - target = target.parentNode; - } - event.stopPropagation(); -}; -- 2.22.5