]> jfr.im git - irc/weechat/qweechat.git/commitdiff
Add entry "Save connection" in File menu
authorhowaboutudance <redacted>
Sat, 27 Jul 2013 15:36:47 +0000 (17:36 +0200)
committerSebastien Helleu <redacted>
Sat, 27 Jul 2013 15:36:47 +0000 (17:36 +0200)
AUTHORS
src/qweechat/network.py
src/qweechat/qweechat.py

diff --git a/AUTHORS b/AUTHORS
index 22812993b9aefd54e821a4ed10a4854bfca040eb..7c3cb0bf3d7e0040c176873d83894118d8e319f6 100644 (file)
--- a/AUTHORS
+++ b/AUTHORS
@@ -16,6 +16,7 @@ Alphabetically:
 
 * Florian Besser (Banton)
 * Gryllida A (gry)
+* howaboutudance
 
 
 Contact
index 5f4a50d5ec134ac76f7ca0034683238637511a08..8690c5aa5921fe4c24ef173c345e44d0312bd8e9 100644 (file)
@@ -143,3 +143,9 @@ class Network(QtCore.QObject):
                 self.status_connecting: 'dialog-close.png',
                 self.status_connected: 'dialog-ok-apply.png'}
         return icon.get(status, '')
+
+    def get_options(self):
+        return {'server': self._server,
+                'port': self._port,
+                'ssl': 'on' if self._ssl else 'off',
+                'password': self._password}
index 1aac61690a368838f80149e3c698677d67acc03a..9f611c3bf4fca101d788a855005d5183d0e3595d 100755 (executable)
@@ -91,12 +91,13 @@ class MainWindow(QtGui.QMainWindow):
             self.statusBar().visible = True
 
         # actions for menu and toolbar
-        actions_def = {'connect'    : ['network-connect.png', 'Connect to WeeChat', 'Ctrl+O', self.open_connection_dialog],
-                       'disconnect' : ['network-disconnect.png', 'Disconnect from WeeChat', 'Ctrl+D', self.network.disconnect_weechat],
-                       'debug'      : ['edit-find.png', 'Debug console window', 'Ctrl+B', self.open_debug_dialog],
-                       'preferences': ['preferences-other.png', 'Preferences', 'Ctrl+P', self.open_preferences_dialog],
-                       'about'      : ['help-about.png', 'About', 'Ctrl+H', self.open_about_dialog],
-                       'quit'       : ['application-exit.png', 'Quit application', 'Ctrl+Q', self.close],
+        actions_def = {'connect'        : ['network-connect.png', 'Connect to WeeChat', 'Ctrl+O', self.open_connection_dialog],
+                       'disconnect'     : ['network-disconnect.png', 'Disconnect from WeeChat', 'Ctrl+D', self.network.disconnect_weechat],
+                       'debug'          : ['edit-find.png', 'Debug console window', 'Ctrl+B', self.open_debug_dialog],
+                       'preferences'    : ['preferences-other.png', 'Preferences', 'Ctrl+P', self.open_preferences_dialog],
+                       'about'          : ['help-about.png', 'About', 'Ctrl+H', self.open_about_dialog],
+                       'save connection': ['', 'Save connection configuration', 'Ctrl+S', self.save_connection],
+                       'quit'           : ['application-exit.png', 'Quit application', 'Ctrl+Q', self.close],
                        }
         self.actions = {}
         for name, action in list(actions_def.items()):
@@ -109,7 +110,7 @@ class MainWindow(QtGui.QMainWindow):
         self.menu = self.menuBar()
         menu_file = self.menu.addMenu('&File')
         menu_file.addActions([self.actions['connect'], self.actions['disconnect'],
-                              self.actions['preferences'], self.actions['quit']])
+                              self.actions['preferences'], self.actions['save connection'], self.actions['quit']])
         menu_window = self.menu.addMenu('&Window')
         menu_window.addAction(self.actions['debug'])
         menu_help = self.menu.addMenu('&Help')
@@ -159,6 +160,12 @@ class MainWindow(QtGui.QMainWindow):
     def open_preferences_dialog(self):
         pass # TODO
 
+    def save_connection(self):
+        if self.network:
+            options = self.network.get_options()
+            for option in options.keys():
+                self.config.set('relay', option, options[option])
+
     def debug_display(self, *args, **kwargs):
         self.debug_lines.append((args, kwargs))
         self.debug_lines = self.debug_lines[-DEBUG_NUM_LINES:]