Merge lp:~stefan-schwarzburg/qreator/fix_bug_1208033 into lp:qreator

Proposed by Schwarzburg
Status: Merged
Merged at revision: 177
Proposed branch: lp:~stefan-schwarzburg/qreator/fix_bug_1208033
Merge into: lp:qreator
Diff against target: 31 lines (+12/-2)
1 file modified
qreator/qrcodes/QRCodeWifiGtk.py (+12/-2)
To merge this branch: bzr merge lp:~stefan-schwarzburg/qreator/fix_bug_1208033
Reviewer Review Type Date Requested Status
David Planella Approve
Review via email: mp+178663@code.launchpad.net

Description of the change

This branch tries to fix bug 1208033.

The problem reported in this bug comes from the fact that the Wifi QR code type uses special characters to separate the ssid, the password and so on. Those characters have to be replaced.

To post a comment you must log in.
Revision history for this message
David Planella (dpm) wrote :

Looks good to me, thanks for the fix!

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'qreator/qrcodes/QRCodeWifiGtk.py'
--- qreator/qrcodes/QRCodeWifiGtk.py 2012-12-30 14:48:29 +0000
+++ qreator/qrcodes/QRCodeWifiGtk.py 2013-08-06 06:52:27 +0000
@@ -20,6 +20,16 @@
20from gi.repository import Gtk, NetworkManager, NMClient, GLib, GdkPixbuf20from gi.repository import Gtk, NetworkManager, NMClient, GLib, GdkPixbuf
2121
2222
23def _escape(st):
24 """Replace problematic characters with the escaped versions.
25
26 Note that the backslash must be the first character to replace"""
27 esc_string = st
28 for c in ["\\", ",", ":", ";"]:
29 esc_string = esc_string.replace(c, "\\" + c)
30 return esc_string
31
32
23class QRCodeWifiGtk(object):33class QRCodeWifiGtk(object):
24 def __init__(self, qr_code_update_func):34 def __init__(self, qr_code_update_func):
25 self.qr_code_update_func = qr_code_update_func35 self.qr_code_update_func = qr_code_update_func
@@ -94,8 +104,8 @@
94 if not security or ssid == '' or password == '':104 if not security or ssid == '' or password == '':
95 return105 return
96106
97 wifi_qr_code = 'WIFI:T:{0};S:{1};P:{2};;'.format(security, ssid,107 wifi_qr_code = 'WIFI:T:{0};S:{1};P:{2};;'.format(_escape(security), _escape(ssid),
98 password)108 _escape(password))
99 self.qr_code_update_func(wifi_qr_code)109 self.qr_code_update_func(wifi_qr_code)
100110
101 def on_comboboxtextSecurity_changed(self, widget, data=None):111 def on_comboboxtextSecurity_changed(self, widget, data=None):

Subscribers

People subscribed via source and target branches

to all changes: