From fa27a34e542fcdb4cb847e121569b4c5db5b8f3e Mon Sep 17 00:00:00 2001 From: Darren Date: Sat, 20 Dec 2014 17:28:52 +0000 Subject: [PATCH] Disconnect message to locales; No need to confirm disconnect when already disconnected --- client/src/models/network.js | 4 ++++ client/src/translations/en-gb.po | 3 +++ client/src/views/tabs.js | 14 +++++--------- 3 files changed, 12 insertions(+), 9 deletions(-) diff --git a/client/src/models/network.js b/client/src/models/network.js index 68792bf..bdc8a69 100644 --- a/client/src/models/network.js +++ b/client/src/models/network.js @@ -262,6 +262,8 @@ function onDisconnect(event) { + this.set('connected', false); + $.each(this.panels.models, function (index, panel) { if (!panel.isApplet()) { panel.addMsg('', styleText('network_disconnected', {text: translateText('client_models_network_disconnected', [])}), 'action quit'); @@ -277,6 +279,8 @@ // Update our nick with what the network gave us this.set('nick', event.nick); + this.set('connected', true); + // If this is a re-connection then we may have some channels to re-join this.rejoinAllChannels(); diff --git a/client/src/translations/en-gb.po b/client/src/translations/en-gb.po index 3299f97..f6e4d92 100755 --- a/client/src/translations/en-gb.po +++ b/client/src/translations/en-gb.po @@ -712,3 +712,6 @@ msgstr "Toggle Banlist" msgid "client_views_controlbox_message" msgstr "Send message..." +#: +msgid "disconnect_from_server" +msgstr "This will disconnect from the IRC network. Are you sure?" diff --git a/client/src/views/tabs.js b/client/src/views/tabs.js index 4719562..92e84d3 100644 --- a/client/src/views/tabs.js +++ b/client/src/views/tabs.js @@ -106,7 +106,7 @@ _kiwi.view.Tabs = Backbone.View.extend({ _kiwi.app.view.$el.find('.panellist .active').removeClass('active'); panel.tab.addClass('active'); - + panel.tab.append(''); }, @@ -133,18 +133,14 @@ _kiwi.view.Tabs = Backbone.View.extend({ // close server tab, then bring client back to homepage if (panel.isChannel() && panel.get('members').models.length > 0) { this.model.network.gateway.part(panel.get('name')); + } else if(panel.isServer()) { - if(_kiwi.app.connections.length < 2) { - var confirmed = confirm("Closing your final connection will redirect you back to the homepage. Is this OK?"); - if(confirmed) { - this.model.network.gateway.quit("Leaving"); - _kiwi.app.connections.remove(this.model.network); - _kiwi.app.startup_applet.view.show(); - } - } else { + if (!this.model.network.get('connected') || confirm(translateText('disconnect_from_server'))) { this.model.network.gateway.quit("Leaving"); _kiwi.app.connections.remove(this.model.network); + _kiwi.app.startup_applet.view.show(); } + } else { panel.close(); } -- 2.25.1