Merge ubiquity:kde-show-passwords into ubiquity:master

Proposed by Łukasz Zemczak
Status: Merged
Merged at revision: 8cc5fc72c6ed6f501d9ce6e4ea96280f8e9f097a
Proposed branch: ubiquity:kde-show-passwords
Merge into: ubiquity:master
Diff against target: 135 lines (+59/-2)
4 files modified
debian/changelog (+7/-0)
gui/qt/stepUserSetup.ui (+26/-1)
ubiquity/frontend/kde_components/PartAuto.py (+12/-0)
ubiquity/plugins/ubi-usersetup.py (+14/-1)
Reviewer Review Type Date Requested Status
Rik Mills Pending
Ubuntu Installer Team Pending
Review via email: mp+414453@code.launchpad.net

Commit message

Add the ability to show passwords for KDE as well.

Description of the change

Add the ability to show passwords for KDE as well.

Please note that I am lacking some experience in Qt stuff, so it might be suboptimal. But I tested it and it works. I couldn't decide on the icon state appearance (what icon should it be when it's checked and when it's not..?!) but I think it's okayish - I can change that if needed.

To post a comment you must log in.
Revision history for this message
Rik Mills (rikmills) wrote :

My pyqt5 foo is not really up to the task, so IMO perhaps merge this and fine tune later with feedback?

Revision history for this message
Łukasz Zemczak (sil2100) wrote :

Makes sense! Let me do that and release a new ubiquity version for jammy.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/debian/changelog b/debian/changelog
2index e986077..2f71351 100644
3--- a/debian/changelog
4+++ b/debian/changelog
5@@ -1,3 +1,10 @@
6+ubiquity (22.04.5) UNRELEASED; urgency=medium
7+
8+ * Add the ability to unhide passwords for the KDE frontend as well (follow
9+ up to the GTK changes released before).
10+
11+ -- Łukasz 'sil2100' Zemczak <lukasz.zemczak@ubuntu.com> Thu, 03 Feb 2022 12:41:46 +0100
12+
13 ubiquity (22.04.4) jammy; urgency=medium
14
15 [ Brian Murray ]
16diff --git a/gui/qt/stepUserSetup.ui b/gui/qt/stepUserSetup.ui
17index 8bce7df..28eb76e 100644
18--- a/gui/qt/stepUserSetup.ui
19+++ b/gui/qt/stepUserSetup.ui
20@@ -304,7 +304,7 @@
21 </property>
22 </widget>
23 </item>
24- <item row="0" column="2">
25+ <item row="0" column="3">
26 <widget class="QLabel" name="password_error_image">
27 <property name="sizePolicy">
28 <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
29@@ -329,6 +329,31 @@
30 </property>
31 </widget>
32 </item>
33+ <item row="0" column="2">
34+ <widget class="QToolButton" name="show_password">
35+ <property name="sizePolicy">
36+ <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
37+ <horstretch>0</horstretch>
38+ <verstretch>0</verstretch>
39+ </sizepolicy>
40+ </property>
41+ <property name="minimumSize">
42+ <size>
43+ <width>32</width>
44+ <height>32</height>
45+ </size>
46+ </property>
47+ <property name="maximumSize">
48+ <size>
49+ <width>32</width>
50+ <height>32</height>
51+ </size>
52+ </property>
53+ <property name="checkable">
54+ <bool>true</bool>
55+ </property>
56+ </widget>
57+ </item>
58 <item row="0" column="3">
59 <widget class="QLabel" name="password_error_reason">
60 <property name="sizePolicy">
61diff --git a/ubiquity/frontend/kde_components/PartAuto.py b/ubiquity/frontend/kde_components/PartAuto.py
62index 624f6e5..81f7957 100644
63--- a/ubiquity/frontend/kde_components/PartAuto.py
64+++ b/ubiquity/frontend/kde_components/PartAuto.py
65@@ -214,6 +214,11 @@ class PartAuto(QtWidgets.QWidget):
66 self.verified_password.setEchoMode(QtWidgets.QLineEdit.Password)
67 self.verified_password.textChanged.connect(self.verify_password)
68 box.addWidget(self.verified_password)
69+ self.show_password = QtWidgets.QToolButton()
70+ self.show_password.setIcon(QtGui.QIcon.fromTheme("password-show-off"))
71+ self.show_password.setCheckable(True)
72+ self.show_password.toggled.connect(self.on_show_password)
73+ box.addWidget(self.show_password)
74 self.badPassword = QtWidgets.QLabel()
75 self.badPassword.setPixmap(QtGui.QPixmap(
76 "/usr/share/icons/oxygen/16x16/status/dialog-warning.png"))
77@@ -234,6 +239,13 @@ class PartAuto(QtWidgets.QWidget):
78 b = self.autopartition_buttongroup.button(0)
79 b and b.click()
80
81+ def on_show_password(self, state):
82+ modes = (QtWidgets.QLineEdit.Password, QtWidgets.QLineEdit.Normal)
83+ icons = ("password-show-off", "password-show-on")
84+ self.password.setEchoMode(modes[state])
85+ self.verified_password.setEchoMode(modes[state])
86+ self.show_password.setIcon(QtGui.QIcon.fromTheme(icons[state]))
87+
88 # slot for when partition is resized on the bar
89 def on_partitionResized(self, unused, size):
90 self.resizeSize = size
91diff --git a/ubiquity/plugins/ubi-usersetup.py b/ubiquity/plugins/ubi-usersetup.py
92index ceb067f..b97af12 100644
93--- a/ubiquity/plugins/ubi-usersetup.py
94+++ b/ubiquity/plugins/ubi-usersetup.py
95@@ -562,7 +562,7 @@ class PageKde(PageBase):
96 self.controller = controller
97
98 from PyQt5 import uic
99- from PyQt5.QtGui import QPixmap
100+ from PyQt5.QtGui import QPixmap, QIcon
101
102 self.plugin_widgets = uic.loadUi(
103 '/usr/share/ubiquity/qt/stepUserSetup.ui')
104@@ -595,11 +595,14 @@ class PageKde(PageBase):
105 self.page.password_error_image.setPixmap(warningIcon)
106 self.page.hostname_error_image.setPixmap(warningIcon)
107
108+ self.page.show_password.setIcon(QIcon.fromTheme("password-show-off"))
109+
110 self.clear_errors()
111
112 self.page.fullname.textChanged[str].connect(self.on_fullname_changed)
113 self.page.username.textChanged[str].connect(self.on_username_changed)
114 self.page.hostname.textChanged[str].connect(self.on_hostname_changed)
115+ self.page.show_password.toggled.connect(self.on_show_password)
116 # self.page.password.textChanged[str].connect(self.on_password_changed)
117 # self.page.verified_password.textChanged[str].connect(
118 # self.on_verified_password_changed)
119@@ -607,6 +610,16 @@ class PageKde(PageBase):
120 self.page.password_debug_warning_label.setVisible(
121 'UBIQUITY_DEBUG' in os.environ)
122
123+ def on_show_password(self, state):
124+ from PyQt5 import QtWidgets
125+ from PyQt5.QtGui import QIcon
126+
127+ modes = (QtWidgets.QLineEdit.Password, QtWidgets.QLineEdit.Normal)
128+ icons = ("password-show-off", "password-show-on")
129+ self.page.password.setEchoMode(modes[state])
130+ self.page.verified_password.setEchoMode(modes[state])
131+ self.page.show_password.setIcon(QIcon.fromTheme(icons[state]))
132+
133 def on_fullname_changed(self):
134 # If the user did not manually enter a username create one for him.
135 if not self.username_edited:

Subscribers

People subscribed via source and target branches