this.favicon = new _kiwi.view.Favicon();
this.initSound();
+
+ this.monitorPanelFallback();
},
setTimeout(function() {
(notification.cancel || notification.close).call(notification);
}, 5000);
+ },
+
+ monitorPanelFallback: function() {
+ var panel_access = [];
+
+ this.model.panels.on('active', function() {
+ var panel = _kiwi.app.panels().active,
+ panel_index;
+
+ // If the panel is already open, remove it so we can put it back in first place
+ panel_index = _.indexOf(panel_access, panel.cid);
+
+ if (panel_index > -1) {
+ panel_access.splice(panel_index, 1);
+ }
+
+ //Make this panel the most recently accessed
+ panel_access.unshift(panel.cid);
+ });
+
+ this.model.panels.on('close', function(panel) {
+ // If closing the active panel, switch to the last-accessed panel
+ if (panel_access[0] === panel.cid) {
+ panel_access.shift();
+
+ //Get the last-accessed panel model now that we removed the closed one
+ var model = kiwi.connections.active_connection.panels.getByCid(panel_access[0]);
+
+ if (model) {
+ model.view.show();
+ } else {
+ // This is a workaround because PanelList does not contain applets
+ kiwi.panels()[0].view.show();
+ }
+ }
+ });
}
});
$('span', this.model.server.tab).text(new_val);
}, this);
}
-
- this.panel_access = new Array();
},
render: function () {
panel.bind('change:title', this.updateTabTitle);
panel.bind('change:name', this.updateTabTitle);
- //Adding a panel
- this.panel_access.unshift(panel.cid);
-
_kiwi.app.view.doLayout();
},
panelRemoved: function (panel) {
panel.tab.remove();
- // If closing the active panel, switch to the last-accessed panel
- if (this.panel_access[0] === _kiwi.app.panels().active.cid) {
- this.panel_access.shift();
-
- //Get the last-accessed panel model now that we removed the closed one
- var model = connection.panels.getByCid(this.panel_access[0]);
-
- if (model) {
- model.view.show();
- }
- }
-
delete panel.tab;
_kiwi.app.view.doLayout();
},
panelActive: function (panel, previously_active_panel) {
- var panel_index = _.indexOf(this.panel_access, panel.cid);
-
// Remove any existing tabs or part images
_kiwi.app.view.$el.find('.panellist .part').remove();
_kiwi.app.view.$el.find('.panellist .active').removeClass('active');
if (!panel.isServer()) {
panel.tab.append('<span class="part fa fa-nonexistant"></span>');
}
-
- if (panel_index > -1) {
- this.panel_access.splice(panel_index, 1);
- }
-
- //Make this panel the most recently accessed
- this.panel_access.unshift(panel.cid);
},
tabClick: function (e) {