2011-09-28 13:16:26 +00:00
|
|
|
// -*- mode: js; js-indent-level: 4; indent-tabs-mode: nil -*-
|
2010-10-21 00:46:38 +00:00
|
|
|
|
|
|
|
const Clutter = imports.gi.Clutter;
|
|
|
|
const Gdk = imports.gi.Gdk;
|
|
|
|
const Gio = imports.gi.Gio;
|
|
|
|
const GLib = imports.gi.GLib;
|
|
|
|
const Lang = imports.lang;
|
|
|
|
const Meta = imports.gi.Meta;
|
|
|
|
const Pango = imports.gi.Pango;
|
|
|
|
const St = imports.gi.St;
|
|
|
|
const Shell = imports.gi.Shell;
|
|
|
|
const Signals = imports.signals;
|
2012-03-10 01:27:19 +00:00
|
|
|
const Atk = imports.gi.Atk;
|
2010-10-21 00:46:38 +00:00
|
|
|
|
|
|
|
const Params = imports.misc.params;
|
|
|
|
|
2015-07-30 18:28:10 +00:00
|
|
|
const Animation = imports.ui.animation;
|
2012-08-16 19:37:27 +00:00
|
|
|
const Layout = imports.ui.layout;
|
2010-10-21 00:46:38 +00:00
|
|
|
const Lightbox = imports.ui.lightbox;
|
|
|
|
const Main = imports.ui.main;
|
|
|
|
const Tweener = imports.ui.tweener;
|
|
|
|
|
|
|
|
const OPEN_AND_CLOSE_TIME = 0.1;
|
|
|
|
const FADE_OUT_DIALOG_TIME = 1.0;
|
|
|
|
|
2015-07-30 18:28:10 +00:00
|
|
|
const WORK_SPINNER_ICON_SIZE = 16;
|
|
|
|
const WORK_SPINNER_ANIMATION_DELAY = 1.0;
|
|
|
|
const WORK_SPINNER_ANIMATION_TIME = 0.3;
|
|
|
|
|
2010-10-21 00:46:38 +00:00
|
|
|
const State = {
|
|
|
|
OPENED: 0,
|
|
|
|
CLOSED: 1,
|
|
|
|
OPENING: 2,
|
|
|
|
CLOSING: 3,
|
|
|
|
FADED_OUT: 4
|
|
|
|
};
|
|
|
|
|
2011-11-20 15:32:59 +00:00
|
|
|
const ModalDialog = new Lang.Class({
|
|
|
|
Name: 'ModalDialog',
|
2010-10-21 00:46:38 +00:00
|
|
|
|
|
|
|
_init: function(params) {
|
2011-08-28 03:04:56 +00:00
|
|
|
params = Params.parse(params, { shellReactive: false,
|
2012-05-24 20:47:48 +00:00
|
|
|
styleClass: null,
|
2014-12-11 14:35:40 +00:00
|
|
|
actionMode: Shell.ActionMode.SYSTEM_MODAL,
|
2013-04-06 14:53:11 +00:00
|
|
|
shouldFadeIn: true,
|
2014-05-08 22:56:23 +00:00
|
|
|
shouldFadeOut: true,
|
2013-04-06 14:53:11 +00:00
|
|
|
destroyOnClose: true });
|
2010-10-21 00:46:38 +00:00
|
|
|
|
|
|
|
this.state = State.CLOSED;
|
2011-03-18 15:28:18 +00:00
|
|
|
this._hasModal = false;
|
2014-12-11 14:35:40 +00:00
|
|
|
this._actionMode = params.actionMode;
|
2011-08-28 03:04:56 +00:00
|
|
|
this._shellReactive = params.shellReactive;
|
2012-08-22 07:27:32 +00:00
|
|
|
this._shouldFadeIn = params.shouldFadeIn;
|
2014-05-08 22:56:23 +00:00
|
|
|
this._shouldFadeOut = params.shouldFadeOut;
|
2013-04-06 14:53:11 +00:00
|
|
|
this._destroyOnClose = params.destroyOnClose;
|
2010-10-21 00:46:38 +00:00
|
|
|
|
2012-02-14 16:33:26 +00:00
|
|
|
this._group = new St.Widget({ visible: false,
|
|
|
|
x: 0,
|
2012-03-10 01:27:19 +00:00
|
|
|
y: 0,
|
|
|
|
accessible_role: Atk.Role.DIALOG });
|
2014-03-18 13:44:44 +00:00
|
|
|
Main.layoutManager.modalDialogGroup.add_actor(this._group);
|
2011-03-16 22:57:05 +00:00
|
|
|
|
|
|
|
let constraint = new Clutter.BindConstraint({ source: global.stage,
|
2012-02-15 16:58:56 +00:00
|
|
|
coordinate: Clutter.BindCoordinate.ALL });
|
2011-03-16 22:57:05 +00:00
|
|
|
this._group.add_constraint(constraint);
|
|
|
|
|
2010-10-21 00:46:38 +00:00
|
|
|
this._group.connect('destroy', Lang.bind(this, this._onGroupDestroy));
|
|
|
|
|
2013-02-13 20:57:02 +00:00
|
|
|
this._pressedKey = null;
|
2012-11-18 20:29:46 +00:00
|
|
|
this._buttonKeys = {};
|
2013-02-13 20:57:02 +00:00
|
|
|
this._group.connect('key-press-event', Lang.bind(this, this._onKeyPressEvent));
|
2012-08-03 17:26:30 +00:00
|
|
|
this._group.connect('key-release-event', Lang.bind(this, this._onKeyReleaseEvent));
|
2010-10-21 00:46:38 +00:00
|
|
|
|
2013-05-07 20:11:42 +00:00
|
|
|
this.backgroundStack = new St.Widget({ layout_manager: new Clutter.BinLayout() });
|
2013-03-22 23:39:05 +00:00
|
|
|
this._backgroundBin = new St.Bin({ child: this.backgroundStack,
|
|
|
|
x_fill: true, y_fill: true });
|
2012-08-16 19:37:27 +00:00
|
|
|
this._monitorConstraint = new Layout.MonitorConstraint();
|
|
|
|
this._backgroundBin.add_constraint(this._monitorConstraint);
|
2010-10-21 00:46:38 +00:00
|
|
|
this._group.add_actor(this._backgroundBin);
|
2011-03-18 15:28:18 +00:00
|
|
|
|
2012-08-07 18:33:46 +00:00
|
|
|
this.dialogLayout = new St.BoxLayout({ style_class: 'modal-dialog',
|
2015-07-30 18:28:10 +00:00
|
|
|
vertical: true });
|
2013-07-11 14:43:04 +00:00
|
|
|
// modal dialogs are fixed width and grow vertically; set the request
|
|
|
|
// mode accordingly so wrapped labels are handled correctly during
|
|
|
|
// size requests.
|
|
|
|
this.dialogLayout.request_mode = Clutter.RequestMode.HEIGHT_FOR_WIDTH;
|
|
|
|
|
2013-07-03 15:26:01 +00:00
|
|
|
if (params.styleClass != null)
|
2012-08-07 18:33:46 +00:00
|
|
|
this.dialogLayout.add_style_class_name(params.styleClass);
|
2011-08-28 03:04:56 +00:00
|
|
|
|
|
|
|
if (!this._shellReactive) {
|
|
|
|
this._lightbox = new Lightbox.Lightbox(this._group,
|
2012-12-15 01:41:03 +00:00
|
|
|
{ inhibitEvents: true,
|
|
|
|
radialEffect: true });
|
2011-08-28 03:04:56 +00:00
|
|
|
this._lightbox.highlight(this._backgroundBin);
|
|
|
|
|
2013-02-22 11:23:56 +00:00
|
|
|
this._eventBlocker = new Clutter.Actor({ reactive: true });
|
2013-03-22 23:39:05 +00:00
|
|
|
this.backgroundStack.add_actor(this._eventBlocker);
|
2011-08-28 03:04:56 +00:00
|
|
|
}
|
2013-03-22 23:39:05 +00:00
|
|
|
this.backgroundStack.add_actor(this.dialogLayout);
|
2011-08-28 03:04:56 +00:00
|
|
|
|
2010-10-21 00:46:38 +00:00
|
|
|
|
2015-07-30 18:28:10 +00:00
|
|
|
this.contentLayout = new St.BoxLayout({ vertical: true });
|
2012-08-07 18:33:46 +00:00
|
|
|
this.dialogLayout.add(this.contentLayout,
|
2013-08-12 18:40:46 +00:00
|
|
|
{ expand: true,
|
|
|
|
x_fill: true,
|
2012-08-07 18:33:46 +00:00
|
|
|
y_fill: true,
|
|
|
|
x_align: St.Align.MIDDLE,
|
|
|
|
y_align: St.Align.START });
|
2010-10-21 00:46:38 +00:00
|
|
|
|
2015-07-30 18:28:10 +00:00
|
|
|
this.buttonLayout = new St.BoxLayout({ style_class: 'modal-dialog-button-box',
|
|
|
|
vertical: false });
|
2012-11-01 16:07:48 +00:00
|
|
|
this.dialogLayout.add(this.buttonLayout,
|
2013-08-12 18:40:46 +00:00
|
|
|
{ x_align: St.Align.MIDDLE,
|
2012-08-07 18:33:46 +00:00
|
|
|
y_align: St.Align.END });
|
2011-04-06 16:54:47 +00:00
|
|
|
|
2012-08-07 18:33:46 +00:00
|
|
|
global.focus_manager.add_group(this.dialogLayout);
|
|
|
|
this._initialKeyFocus = this.dialogLayout;
|
2012-02-12 18:55:59 +00:00
|
|
|
this._initialKeyFocusDestroyId = 0;
|
2011-04-06 16:54:47 +00:00
|
|
|
this._savedKeyFocus = null;
|
2015-07-30 18:28:10 +00:00
|
|
|
|
|
|
|
this._workSpinner = null;
|
2010-10-21 00:46:38 +00:00
|
|
|
},
|
|
|
|
|
2011-08-19 18:29:39 +00:00
|
|
|
destroy: function() {
|
|
|
|
this._group.destroy();
|
|
|
|
},
|
|
|
|
|
2012-11-01 16:07:48 +00:00
|
|
|
clearButtons: function() {
|
|
|
|
this.buttonLayout.destroy_all_children();
|
2012-11-18 20:29:46 +00:00
|
|
|
this._buttonKeys = {};
|
2012-11-01 16:07:48 +00:00
|
|
|
},
|
2011-01-30 23:15:19 +00:00
|
|
|
|
2012-11-01 16:07:48 +00:00
|
|
|
setButtons: function(buttons) {
|
|
|
|
this.clearButtons();
|
2012-02-28 15:53:46 +00:00
|
|
|
|
2011-10-20 20:40:22 +00:00
|
|
|
for (let i = 0; i < buttons.length; i++) {
|
2011-09-19 00:40:21 +00:00
|
|
|
let buttonInfo = buttons[i];
|
2010-10-21 00:46:38 +00:00
|
|
|
|
|
|
|
let x_alignment;
|
|
|
|
if (buttons.length == 1)
|
|
|
|
x_alignment = St.Align.END;
|
|
|
|
else if (i == 0)
|
|
|
|
x_alignment = St.Align.START;
|
|
|
|
else if (i == buttons.length - 1)
|
|
|
|
x_alignment = St.Align.END;
|
|
|
|
else
|
|
|
|
x_alignment = St.Align.MIDDLE;
|
|
|
|
|
2015-07-30 18:28:10 +00:00
|
|
|
this.addButton(buttonInfo, { expand: true,
|
|
|
|
x_fill: false,
|
|
|
|
y_fill: false,
|
|
|
|
x_align: x_alignment,
|
|
|
|
y_align: St.Align.MIDDLE });
|
2012-11-01 16:07:48 +00:00
|
|
|
}
|
|
|
|
},
|
2010-10-21 00:46:38 +00:00
|
|
|
|
2015-07-30 18:28:10 +00:00
|
|
|
addButton: function(buttonInfo, layoutInfo) {
|
|
|
|
let label = buttonInfo['label'];
|
2012-11-01 16:07:48 +00:00
|
|
|
let action = buttonInfo['action'];
|
|
|
|
let key = buttonInfo['key'];
|
|
|
|
let isDefault = buttonInfo['default'];
|
2010-10-21 00:46:38 +00:00
|
|
|
|
2012-11-18 20:29:46 +00:00
|
|
|
let keys;
|
|
|
|
|
|
|
|
if (key)
|
|
|
|
keys = [key];
|
|
|
|
else if (isDefault)
|
|
|
|
keys = [Clutter.KEY_Return, Clutter.KEY_KP_Enter, Clutter.KEY_ISO_Enter];
|
|
|
|
else
|
|
|
|
keys = [];
|
2011-08-28 02:51:54 +00:00
|
|
|
|
2015-07-30 18:28:10 +00:00
|
|
|
let button = new St.Button({ style_class: 'modal-dialog-button button',
|
2013-01-11 19:05:17 +00:00
|
|
|
button_mask: St.ButtonMask.ONE | St.ButtonMask.THREE,
|
2012-11-01 16:07:48 +00:00
|
|
|
reactive: true,
|
|
|
|
can_focus: true,
|
|
|
|
label: label });
|
|
|
|
button.connect('clicked', action);
|
|
|
|
|
2012-11-18 20:29:46 +00:00
|
|
|
buttonInfo['button'] = button;
|
|
|
|
|
2012-11-01 16:07:48 +00:00
|
|
|
if (isDefault)
|
|
|
|
button.add_style_pseudo_class('default');
|
|
|
|
|
|
|
|
if (!this._initialKeyFocusDestroyId)
|
|
|
|
this._initialKeyFocus = button;
|
|
|
|
|
2012-11-18 20:29:46 +00:00
|
|
|
for (let i in keys)
|
|
|
|
this._buttonKeys[keys[i]] = buttonInfo;
|
2012-11-01 16:07:48 +00:00
|
|
|
|
2015-07-30 18:28:10 +00:00
|
|
|
this.buttonLayout.add(button, layoutInfo);
|
2012-11-01 16:07:48 +00:00
|
|
|
|
|
|
|
return button;
|
2010-10-21 00:46:38 +00:00
|
|
|
},
|
|
|
|
|
2015-07-30 18:28:10 +00:00
|
|
|
placeSpinner: function(layoutInfo) {
|
|
|
|
let spinnerIcon = Gio.File.new_for_uri('resource:///org/gnome/shell/theme/process-working.svg');
|
|
|
|
this._workSpinner = new Animation.AnimatedIcon(spinnerIcon, WORK_SPINNER_ICON_SIZE);
|
|
|
|
this._workSpinner.actor.opacity = 0;
|
|
|
|
this._workSpinner.actor.show();
|
|
|
|
|
|
|
|
this.buttonLayout.add(this._workSpinner.actor, layoutInfo);
|
|
|
|
},
|
|
|
|
|
|
|
|
setWorking: function(working) {
|
|
|
|
if (!this._workSpinner)
|
|
|
|
return;
|
|
|
|
|
|
|
|
Tweener.removeTweens(this._workSpinner.actor);
|
|
|
|
if (working) {
|
|
|
|
this._workSpinner.play();
|
|
|
|
Tweener.addTween(this._workSpinner.actor,
|
|
|
|
{ opacity: 255,
|
|
|
|
delay: WORK_SPINNER_ANIMATION_DELAY,
|
|
|
|
time: WORK_SPINNER_ANIMATION_TIME,
|
|
|
|
transition: 'linear'
|
|
|
|
});
|
|
|
|
} else {
|
|
|
|
Tweener.addTween(this._workSpinner.actor,
|
|
|
|
{ opacity: 0,
|
|
|
|
time: WORK_SPINNER_ANIMATION_TIME,
|
|
|
|
transition: 'linear',
|
|
|
|
onCompleteScope: this,
|
|
|
|
onComplete: function() {
|
|
|
|
if (this._workSpinner)
|
|
|
|
this._workSpinner.stop();
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
2013-02-13 20:57:02 +00:00
|
|
|
_onKeyPressEvent: function(object, event) {
|
|
|
|
this._pressedKey = event.get_key_symbol();
|
2013-11-29 18:17:34 +00:00
|
|
|
return Clutter.EVENT_PROPAGATE;
|
2013-02-13 20:57:02 +00:00
|
|
|
},
|
|
|
|
|
2012-08-03 17:26:30 +00:00
|
|
|
_onKeyReleaseEvent: function(object, event) {
|
2013-02-13 20:57:02 +00:00
|
|
|
let pressedKey = this._pressedKey;
|
|
|
|
this._pressedKey = null;
|
|
|
|
|
2012-08-03 17:26:30 +00:00
|
|
|
let symbol = event.get_key_symbol();
|
2013-02-13 20:57:02 +00:00
|
|
|
if (symbol != pressedKey)
|
2013-11-29 18:17:34 +00:00
|
|
|
return Clutter.EVENT_PROPAGATE;
|
2012-11-18 20:29:46 +00:00
|
|
|
|
2013-02-13 20:57:02 +00:00
|
|
|
let buttonInfo = this._buttonKeys[symbol];
|
2012-11-18 20:29:46 +00:00
|
|
|
if (!buttonInfo)
|
2013-11-29 18:17:34 +00:00
|
|
|
return Clutter.EVENT_PROPAGATE;
|
2012-11-18 20:29:46 +00:00
|
|
|
|
|
|
|
let button = buttonInfo['button'];
|
|
|
|
let action = buttonInfo['action'];
|
2010-10-21 00:46:38 +00:00
|
|
|
|
2012-11-18 20:29:46 +00:00
|
|
|
if (action && button.reactive) {
|
2010-10-21 00:46:38 +00:00
|
|
|
action();
|
2013-11-29 18:17:34 +00:00
|
|
|
return Clutter.EVENT_STOP;
|
2012-08-03 17:26:30 +00:00
|
|
|
}
|
|
|
|
|
2013-11-29 18:17:34 +00:00
|
|
|
return Clutter.EVENT_PROPAGATE;
|
2010-10-21 00:46:38 +00:00
|
|
|
},
|
|
|
|
|
|
|
|
_onGroupDestroy: function() {
|
|
|
|
this.emit('destroy');
|
|
|
|
},
|
|
|
|
|
2012-10-14 16:34:22 +00:00
|
|
|
_fadeOpen: function(onPrimary) {
|
|
|
|
if (onPrimary)
|
|
|
|
this._monitorConstraint.primary = true;
|
|
|
|
else
|
|
|
|
this._monitorConstraint.index = global.screen.get_current_monitor();
|
2010-10-21 00:46:38 +00:00
|
|
|
|
|
|
|
this.state = State.OPENING;
|
|
|
|
|
2012-08-07 18:33:46 +00:00
|
|
|
this.dialogLayout.opacity = 255;
|
2011-08-28 03:04:56 +00:00
|
|
|
if (this._lightbox)
|
|
|
|
this._lightbox.show();
|
2010-10-21 00:46:38 +00:00
|
|
|
this._group.opacity = 0;
|
|
|
|
this._group.show();
|
|
|
|
Tweener.addTween(this._group,
|
|
|
|
{ opacity: 255,
|
2012-08-22 07:27:32 +00:00
|
|
|
time: this._shouldFadeIn ? OPEN_AND_CLOSE_TIME : 0,
|
2010-10-21 00:46:38 +00:00
|
|
|
transition: 'easeOutQuad',
|
|
|
|
onComplete: Lang.bind(this,
|
|
|
|
function() {
|
|
|
|
this.state = State.OPENED;
|
|
|
|
this.emit('opened');
|
2011-03-15 20:05:40 +00:00
|
|
|
})
|
2010-10-21 00:46:38 +00:00
|
|
|
});
|
|
|
|
},
|
|
|
|
|
2011-03-15 20:05:40 +00:00
|
|
|
setInitialKeyFocus: function(actor) {
|
2012-02-12 18:55:59 +00:00
|
|
|
if (this._initialKeyFocusDestroyId)
|
|
|
|
this._initialKeyFocus.disconnect(this._initialKeyFocusDestroyId);
|
|
|
|
|
2011-03-15 20:05:40 +00:00
|
|
|
this._initialKeyFocus = actor;
|
2012-02-12 18:55:59 +00:00
|
|
|
|
|
|
|
this._initialKeyFocusDestroyId = actor.connect('destroy', Lang.bind(this, function() {
|
2012-08-07 18:33:46 +00:00
|
|
|
this._initialKeyFocus = this.dialogLayout;
|
2012-02-12 18:55:59 +00:00
|
|
|
this._initialKeyFocusDestroyId = 0;
|
|
|
|
}));
|
2011-03-15 20:05:40 +00:00
|
|
|
},
|
|
|
|
|
2012-10-14 16:34:22 +00:00
|
|
|
open: function(timestamp, onPrimary) {
|
2010-10-21 00:46:38 +00:00
|
|
|
if (this.state == State.OPENED || this.state == State.OPENING)
|
|
|
|
return true;
|
|
|
|
|
2012-08-10 15:54:39 +00:00
|
|
|
if (!this.pushModal({ timestamp: timestamp }))
|
2010-10-21 00:46:38 +00:00
|
|
|
return false;
|
|
|
|
|
2012-10-14 16:34:22 +00:00
|
|
|
this._fadeOpen(onPrimary);
|
2010-10-21 00:46:38 +00:00
|
|
|
return true;
|
|
|
|
},
|
|
|
|
|
2014-05-08 22:56:23 +00:00
|
|
|
_closeComplete: function() {
|
|
|
|
this.state = State.CLOSED;
|
|
|
|
this._group.hide();
|
|
|
|
this.emit('closed');
|
|
|
|
|
|
|
|
if (this._destroyOnClose)
|
|
|
|
this.destroy();
|
|
|
|
},
|
|
|
|
|
2010-10-21 00:46:38 +00:00
|
|
|
close: function(timestamp) {
|
|
|
|
if (this.state == State.CLOSED || this.state == State.CLOSING)
|
|
|
|
return;
|
|
|
|
|
|
|
|
this.state = State.CLOSING;
|
2011-03-18 15:28:18 +00:00
|
|
|
this.popModal(timestamp);
|
2011-04-06 16:54:47 +00:00
|
|
|
this._savedKeyFocus = null;
|
2010-10-21 00:46:38 +00:00
|
|
|
|
2014-05-08 22:56:23 +00:00
|
|
|
if (this._shouldFadeOut)
|
|
|
|
Tweener.addTween(this._group,
|
|
|
|
{ opacity: 0,
|
|
|
|
time: OPEN_AND_CLOSE_TIME,
|
|
|
|
transition: 'easeOutQuad',
|
|
|
|
onComplete: Lang.bind(this,
|
|
|
|
this._closeComplete)
|
|
|
|
})
|
|
|
|
else
|
|
|
|
this._closeComplete();
|
2010-10-21 00:46:38 +00:00
|
|
|
},
|
|
|
|
|
2011-03-18 15:28:18 +00:00
|
|
|
// Drop modal status without closing the dialog; this makes the
|
|
|
|
// dialog insensitive as well, so it needs to be followed shortly
|
|
|
|
// by either a close() or a pushModal()
|
|
|
|
popModal: function(timestamp) {
|
|
|
|
if (!this._hasModal)
|
|
|
|
return;
|
|
|
|
|
|
|
|
let focus = global.stage.key_focus;
|
|
|
|
if (focus && this._group.contains(focus))
|
|
|
|
this._savedKeyFocus = focus;
|
|
|
|
else
|
|
|
|
this._savedKeyFocus = null;
|
|
|
|
Main.popModal(this._group, timestamp);
|
|
|
|
global.gdk_screen.get_display().sync();
|
|
|
|
this._hasModal = false;
|
|
|
|
|
2011-08-28 03:04:56 +00:00
|
|
|
if (!this._shellReactive)
|
|
|
|
this._eventBlocker.raise_top();
|
2011-03-18 15:28:18 +00:00
|
|
|
},
|
|
|
|
|
|
|
|
pushModal: function (timestamp) {
|
|
|
|
if (this._hasModal)
|
|
|
|
return true;
|
2012-08-10 18:35:59 +00:00
|
|
|
if (!Main.pushModal(this._group, { timestamp: timestamp,
|
2014-12-11 14:35:40 +00:00
|
|
|
actionMode: this._actionMode }))
|
2011-03-18 15:28:18 +00:00
|
|
|
return false;
|
|
|
|
|
|
|
|
this._hasModal = true;
|
|
|
|
if (this._savedKeyFocus) {
|
|
|
|
this._savedKeyFocus.grab_key_focus();
|
|
|
|
this._savedKeyFocus = null;
|
2013-07-03 15:26:01 +00:00
|
|
|
} else {
|
2011-03-18 15:28:18 +00:00
|
|
|
this._initialKeyFocus.grab_key_focus();
|
2013-07-03 15:26:01 +00:00
|
|
|
}
|
2011-03-18 15:28:18 +00:00
|
|
|
|
2011-08-28 03:04:56 +00:00
|
|
|
if (!this._shellReactive)
|
|
|
|
this._eventBlocker.lower_bottom();
|
2011-03-18 15:28:18 +00:00
|
|
|
return true;
|
|
|
|
},
|
|
|
|
|
2010-10-21 00:46:38 +00:00
|
|
|
// This method is like close, but fades the dialog out much slower,
|
|
|
|
// and leaves the lightbox in place. Once in the faded out state,
|
|
|
|
// the dialog can be brought back by an open call, or the lightbox
|
|
|
|
// can be dismissed by a close call.
|
|
|
|
//
|
|
|
|
// The main point of this method is to give some indication to the user
|
|
|
|
// that the dialog reponse has been acknowledged but will take a few
|
|
|
|
// moments before being processed.
|
|
|
|
// e.g., if a user clicked "Log Out" then the dialog should go away
|
|
|
|
// imediately, but the lightbox should remain until the logout is
|
|
|
|
// complete.
|
|
|
|
_fadeOutDialog: function(timestamp) {
|
|
|
|
if (this.state == State.CLOSED || this.state == State.CLOSING)
|
|
|
|
return;
|
|
|
|
|
|
|
|
if (this.state == State.FADED_OUT)
|
|
|
|
return;
|
|
|
|
|
2011-03-18 15:28:18 +00:00
|
|
|
this.popModal(timestamp);
|
2012-08-07 18:33:46 +00:00
|
|
|
Tweener.addTween(this.dialogLayout,
|
2010-10-21 00:46:38 +00:00
|
|
|
{ opacity: 0,
|
|
|
|
time: FADE_OUT_DIALOG_TIME,
|
|
|
|
transition: 'easeOutQuad',
|
|
|
|
onComplete: Lang.bind(this,
|
|
|
|
function() {
|
|
|
|
this.state = State.FADED_OUT;
|
|
|
|
})
|
|
|
|
});
|
|
|
|
}
|
2011-11-20 15:32:59 +00:00
|
|
|
});
|
2010-10-21 00:46:38 +00:00
|
|
|
Signals.addSignalMethods(ModalDialog.prototype);
|