diff --git a/src/gui/EntryPreviewWidget.cpp b/src/gui/EntryPreviewWidget.cpp
index 0e2e18ee9..5050aedec 100644
--- a/src/gui/EntryPreviewWidget.cpp
+++ b/src/gui/EntryPreviewWidget.cpp
@@ -49,6 +49,7 @@ EntryPreviewWidget::EntryPreviewWidget(QWidget* parent)
// Entry
m_ui->entryTotpButton->setIcon(icons()->icon("totp"));
m_ui->entryCloseButton->setIcon(icons()->icon("dialog-close"));
+ m_ui->toggleUsernameButton->setIcon(icons()->onOffIcon("password-show", true));
m_ui->togglePasswordButton->setIcon(icons()->onOffIcon("password-show", true));
m_ui->toggleEntryNotesButton->setIcon(icons()->onOffIcon("password-show", true));
m_ui->toggleGroupNotesButton->setIcon(icons()->onOffIcon("password-show", true));
@@ -70,6 +71,7 @@ EntryPreviewWidget::EntryPreviewWidget(QWidget* parent)
connect(m_ui->entryTotpButton, SIGNAL(toggled(bool)), m_ui->entryTotpLabel, SLOT(setVisible(bool)));
connect(m_ui->entryTotpButton, SIGNAL(toggled(bool)), m_ui->entryTotpProgress, SLOT(setVisible(bool)));
connect(m_ui->entryCloseButton, SIGNAL(clicked()), SLOT(hide()));
+ connect(m_ui->toggleUsernameButton, SIGNAL(clicked(bool)), SLOT(setUsernameVisible(bool)));
connect(m_ui->togglePasswordButton, SIGNAL(clicked(bool)), SLOT(setPasswordVisible(bool)));
connect(m_ui->toggleEntryNotesButton, SIGNAL(clicked(bool)), SLOT(setEntryNotesVisible(bool)));
connect(m_ui->toggleGroupNotesButton, SIGNAL(clicked(bool)), SLOT(setGroupNotesVisible(bool)));
@@ -89,6 +91,7 @@ EntryPreviewWidget::EntryPreviewWidget(QWidget* parent)
if (key == Config::GUI_HidePreviewPanel) {
setVisible(!config()->get(Config::GUI_HidePreviewPanel).toBool());
}
+ refresh();
});
// Group
@@ -230,6 +233,21 @@ void EntryPreviewWidget::updateEntryTotp()
}
}
+void EntryPreviewWidget::setUsernameVisible(bool state)
+{
+ if (state) {
+ auto username = m_currentEntry->resolveMultiplePlaceholders(m_currentEntry->username());
+ m_ui->entryUsernameLabel->setText(username);
+ m_ui->entryUsernameLabel->setFont(Font::defaultFont());
+ m_ui->entryUsernameLabel->setCursorPosition(0);
+ } else {
+ m_ui->entryUsernameLabel->setText(QString("\u25cf").repeated(6));
+ m_ui->entryUsernameLabel->setFont(Font::fixedFont());
+ }
+
+ m_ui->toggleUsernameButton->setIcon(icons()->onOffIcon("password-show", state));
+}
+
void EntryPreviewWidget::setPasswordVisible(bool state)
{
const QString password = m_currentEntry->resolveMultiplePlaceholders(m_currentEntry->password());
@@ -292,8 +310,16 @@ void EntryPreviewWidget::setNotesVisible(QTextEdit* notesWidget, const QString&
void EntryPreviewWidget::updateEntryGeneralTab()
{
Q_ASSERT(m_currentEntry);
- m_ui->entryUsernameLabel->setText(m_currentEntry->resolveMultiplePlaceholders(m_currentEntry->username()));
- m_ui->entryUsernameLabel->setCursorPosition(0);
+
+ if (config()->get(Config::GUI_HideUsernames).toBool()) {
+ setUsernameVisible(false);
+ // Show the username toggle button
+ m_ui->toggleUsernameButton->setVisible(!m_currentEntry->username().isEmpty());
+ m_ui->toggleUsernameButton->setChecked(false);
+ } else {
+ setUsernameVisible(true);
+ m_ui->toggleUsernameButton->setVisible(false);
+ }
if (config()->get(Config::Security_HidePasswordPreviewPanel).toBool()) {
// Hide password
diff --git a/src/gui/EntryPreviewWidget.h b/src/gui/EntryPreviewWidget.h
index a6a8d0ca4..b7a71aa02 100644
--- a/src/gui/EntryPreviewWidget.h
+++ b/src/gui/EntryPreviewWidget.h
@@ -53,6 +53,7 @@ private slots:
void updateEntryGeneralTab();
void updateEntryAdvancedTab();
void updateEntryAutotypeTab();
+ void setUsernameVisible(bool state);
void setPasswordVisible(bool state);
void setEntryNotesVisible(bool state);
void setGroupNotesVisible(bool state);
diff --git a/src/gui/EntryPreviewWidget.ui b/src/gui/EntryPreviewWidget.ui
index 89d072059..6e0ce5ec9 100644
--- a/src/gui/EntryPreviewWidget.ui
+++ b/src/gui/EntryPreviewWidget.ui
@@ -214,62 +214,50 @@
6
- -
-
-
-
- 0
- 0
-
+
-
+
+
+ 6
-
-
- 75
- true
-
-
-
- Qt::LeftToRight
-
-
- Username
-
-
- Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter
-
-
-
- -
-
-
-
- 0
- 0
-
-
-
-
- 75
- true
-
-
-
- Notes
-
-
- Qt::AlignRight|Qt::AlignTop|Qt::AlignTrailing
-
-
-
- -
-
-
- Qt::ClickFocus
-
-
- Tags list
-
-
+
-
+
+
+
+
+
+
+ 14
+ 14
+
+
+
+ true
+
+
+
+ -
+
+
+ Qt::ClickFocus
+
+
+ QFrame::NoFrame
+
+
+ QFrame::Plain
+
+
+ 0
+
+
+ true
+
+
+ true
+
+
+
+
-
@@ -293,6 +281,85 @@
+ -
+
+
+
+ 0
+ 0
+
+
+
+
+ 75
+ true
+
+
+
+ URL
+
+
+ Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter
+
+
+
+ -
+
+
+
+ 0
+ 0
+
+
+
+ Qt::ClickFocus
+
+
+ expired
+
+
+ Qt::LinksAccessibleByMouse|Qt::TextSelectableByMouse
+
+
+
+ -
+
+
+ Qt::Horizontal
+
+
+ QSizePolicy::Fixed
+
+
+
+ 10
+ 20
+
+
+
+
+ -
+
+
+
+ 0
+ 0
+
+
+
+
+ 75
+ true
+
+
+
+ Expiration
+
+
+ Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter
+
+
+
-
@@ -359,53 +426,8 @@
- -
-
-
- 6
-
-
-
-
-
-
-
-
-
- 14
- 14
-
-
-
- true
-
-
-
- -
-
-
- Qt::ClickFocus
-
-
- QFrame::NoFrame
-
-
- QFrame::Plain
-
-
- 0
-
-
- true
-
-
- true
-
-
-
-
-
- -
-
+
-
+
0
@@ -419,64 +441,23 @@
- URL
+ Tags
Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter
- -
-
-
- Qt::Horizontal
-
-
- QSizePolicy::Fixed
-
-
-
- 10
- 20
-
-
-
-
- -
-
-
-
- 0
- 0
-
-
+
-
+
Qt::ClickFocus
-
- expired
-
-
- Qt::LinksAccessibleByMouse|Qt::TextSelectableByMouse
+
+ Tags list
- -
-
-
- Qt::Horizontal
-
-
- QSizePolicy::Fixed
-
-
-
- 10
- 20
-
-
-
-
-
@@ -505,58 +486,49 @@
- -
-
-
-
- 0
- 0
-
+
-
+
+
+ Qt::Horizontal
-
-
- 75
- true
-
+
+ QSizePolicy::Fixed
-
- Expiration
-
-
- Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter
-
-
-
- -
-
-
+
- 150
- 0
+ 10
+ 20
-
- Qt::ClickFocus
+
+
+ -
+
+
+
+ 0
+ 0
+
+
+
+
+ 75
+ true
+
+
+
+ Qt::LeftToRight
- username
+ Username
-
- false
-
-
- 8
-
-
- true
-
-
- true
+
+ Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter
- -
-
+
-
+
0
@@ -570,13 +542,64 @@
- Tags
+ Notes
- Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter
+ Qt::AlignRight|Qt::AlignTop|Qt::AlignTrailing
+ -
+
+
+ 8
+
+
-
+
+
+
+
+
+
+ 14
+ 14
+
+
+
+ true
+
+
+
+ -
+
+
+
+ 150
+ 0
+
+
+
+ Qt::ClickFocus
+
+
+ username
+
+
+ false
+
+
+ 8
+
+
+ true
+
+
+ true
+
+
+
+
+