Disconnect message to locales; No need to confirm disconnect when already disconnected
authorDarren <darren@darrenwhitlen.com>
Sat, 20 Dec 2014 17:28:52 +0000 (17:28 +0000)
committerDarren <darren@darrenwhitlen.com>
Sat, 20 Dec 2014 17:28:52 +0000 (17:28 +0000)
client/src/models/network.js
client/src/translations/en-gb.po
client/src/views/tabs.js

index 68792bf56540803a908bf6c89afe22c99acf6a4c..bdc8a693bc54ab4cb994036aa9ee6ae26ff761fe 100644 (file)
 
 
     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');
         // 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();
 
index 3299f9763772342c091a67bda5592a27b0315cf1..f6e4d92ee1dfe2cf49320ed944a06f00ab9ff775 100755 (executable)
@@ -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?"
index 471956210251d01d0c3383ffb1f1b579fbb90104..92e84d360451d3970a9f5841e99b27b63c1db480 100644 (file)
@@ -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('<span class="part fa fa-nonexistant"></span>');
     },
 
@@ -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();
         }