Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/pr/265'
Browse files Browse the repository at this point in the history
* origin/pr/265:
  Added show password button to Backup/Restore
  • Loading branch information
marmarek committed Oct 1, 2020
2 parents 29da891 + 1276459 commit 70b8f0c
Show file tree
Hide file tree
Showing 7 changed files with 70 additions and 23 deletions.
1 change: 1 addition & 0 deletions icons/eye-off.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions icons/eye.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
11 changes: 11 additions & 0 deletions qubesmanager/backup.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,9 @@ def __init__(self, qt_app, qubes_app, dispatcher, parent=None):
self.unrecognized_config_label.setVisible(False)
self.load_settings()

self.show_passwd_button.pressed.connect(self.show_password)
self.show_passwd_button.released.connect(self.hide_password)

selected = self.vms_to_include()
self.__fill_vms_list__(selected)

Expand All @@ -130,6 +133,14 @@ def __init__(self, qt_app, qubes_app, dispatcher, parent=None):
self.dispatcher = dispatcher
dispatcher.add_handler('backup-progress', self.on_backup_progress)

def show_password(self):
self.passphrase_line_edit.setEchoMode(QtWidgets.QLineEdit.Normal)
self.show_passwd_button.setIcon(QtGui.QIcon(':/eye.svg'))

def hide_password(self):
self.passphrase_line_edit.setEchoMode(QtWidgets.QLineEdit.Password)
self.show_passwd_button.setIcon(QtGui.QIcon(':/eye-off.svg'))

def setup_application(self):
self.qt_app.setApplicationName(self.tr("Qubes Backup VMs"))
self.qt_app.setWindowIcon(QtGui.QIcon.fromTheme("qubes-manager"))
Expand Down
11 changes: 11 additions & 0 deletions qubesmanager/restore.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,17 @@ def __init__(self, qt_app, qubes_app, parent=None):

backup_utils.fill_appvms_list(self)

self.passwd_show_button.pressed.connect(self.show_password)
self.passwd_show_button.released.connect(self.hide_password)

def show_password(self):
self.passphrase_line_edit.setEchoMode(QtWidgets.QLineEdit.Normal)
self.passwd_show_button.setIcon(QtGui.QIcon(':/eye.svg'))

def hide_password(self):
self.passphrase_line_edit.setEchoMode(QtWidgets.QLineEdit.Password)
self.passwd_show_button.setIcon(QtGui.QIcon(':/eye-off.svg'))

def setup_application(self):
self.qt_app.setApplicationName(self.tr("Qubes Restore VMs"))
self.qt_app.setWindowIcon(QtGui.QIcon.fromTheme("qubes-manager"))
Expand Down
2 changes: 2 additions & 0 deletions resources.qrc
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<RCC>
<qresource>
<file alias='eye.svg'>icons/eye.svg</file>
<file alias='eye-off.svg'>icons/eye-off.svg</file>
<file alias="apps.png">icons/apps.png</file>
<file alias="settings.png">icons/settings.png</file>
<file alias="firewall.png">icons/wall.png</file>
Expand Down
36 changes: 22 additions & 14 deletions ui/backupdlg.ui
Original file line number Diff line number Diff line change
Expand Up @@ -256,38 +256,46 @@
<property name="title">
<string>Backup security</string>
</property>
<layout class="QFormLayout" name="formLayout">
<property name="fieldGrowthPolicy">
<enum>QFormLayout::AllNonFixedFieldsGrow</enum>
</property>
<item row="1" column="0">
<layout class="QGridLayout" name="gridLayout">
<item row="2" column="0">
<widget class="QLabel" name="label_11">
<property name="text">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Reenter passphrase:&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QLabel" name="label_12">
<property name="text">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Encryption / Verification&lt;br/&gt;passphrase:&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
</widget>
</item>
<item row="1" column="1">
<item row="0" column="1">
<widget class="QLineEdit" name="passphrase_line_edit">
<property name="echoMode">
<enum>QLineEdit::Password</enum>
</property>
</widget>
</item>
<item row="4" column="0">
<widget class="QLabel" name="label_11">
<property name="text">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Reenter passphrase:&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
</widget>
</item>
<item row="4" column="1">
<item row="2" column="1">
<widget class="QLineEdit" name="passphrase_line_edit_verify">
<property name="echoMode">
<enum>QLineEdit::Password</enum>
</property>
</widget>
</item>
<item row="0" column="2">
<widget class="QPushButton" name="show_passwd_button">
<property name="text">
<string/>
</property>
<property name="icon">
<iconset resource="../resources.qrc">
<normaloff>:/eye-off</normaloff>:/eye-off</iconset>
</property>
</widget>
</item>
</layout>
</widget>
</item>
Expand Down
31 changes: 22 additions & 9 deletions ui/restoredlg.ui
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,13 @@
<string>Security options</string>
</property>
<layout class="QGridLayout" name="gridLayout_4">
<item row="0" column="0">
<widget class="QLabel" name="label_4">
<property name="text">
<string>Encrypted backup:</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QCheckBox" name="encryption_checkbox">
<property name="text">
Expand All @@ -152,10 +159,10 @@
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QLabel" name="label_4">
<property name="text">
<string>Encrypted backup:</string>
<item row="1" column="1">
<widget class="QLineEdit" name="passphrase_line_edit">
<property name="echoMode">
<enum>QLineEdit::Password</enum>
</property>
</widget>
</item>
Expand All @@ -166,10 +173,14 @@
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QLineEdit" name="passphrase_line_edit">
<property name="echoMode">
<enum>QLineEdit::Password</enum>
<item row="1" column="2">
<widget class="QPushButton" name="passwd_show_button">
<property name="text">
<string/>
</property>
<property name="icon">
<iconset resource="../resources.qrc">
<normaloff>:/eye-off</normaloff>:/eye-off</iconset>
</property>
</widget>
</item>
Expand Down Expand Up @@ -288,6 +299,8 @@ p, li { white-space: pre-wrap; }
<tabstop>commit_text_edit</tabstop>
<tabstop>showFileDialog</tabstop>
</tabstops>
<resources/>
<resources>
<include location="../resources.qrc"/>
</resources>
<connections/>
</ui>

0 comments on commit 70b8f0c

Please sign in to comment.