Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/keepassxreboot/keepassxc.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonathan White <support@dmapps.us>2022-10-19 02:00:12 +0300
committerJonathan White <support@dmapps.us>2022-10-19 17:16:08 +0300
commit71b1df39ebe2b1d88d3bbbbd7d2ae71c87426478 (patch)
treef40429bdc960f37acbb832ebb048a254fc5cbccf
parent82f056e5d02791c4155f74664a18ab19e9514bd7 (diff)
Hide usernames in preview panel when hidden in entry view
* Fix #6306
-rw-r--r--src/gui/EntryPreviewWidget.cpp30
-rw-r--r--src/gui/EntryPreviewWidget.h1
-rw-r--r--src/gui/EntryPreviewWidget.ui313
3 files changed, 197 insertions, 147 deletions
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,8 +214,53 @@
<property name="verticalSpacing">
<number>6</number>
</property>
- <item row="0" column="0">
- <widget class="QLabel" name="entryUsernameTitleLabel">
+ <item row="3" column="1" colspan="5">
+ <layout class="QHBoxLayout" name="horizontalLayout_3" stretch="0,0">
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <item alignment="Qt::AlignTop">
+ <widget class="QToolButton" name="toggleEntryNotesButton">
+ <property name="text">
+ <string/>
+ </property>
+ <property name="iconSize">
+ <size>
+ <width>14</width>
+ <height>14</height>
+ </size>
+ </property>
+ <property name="checkable">
+ <bool>true</bool>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QTextEdit" name="entryNotesTextEdit">
+ <property name="focusPolicy">
+ <enum>Qt::ClickFocus</enum>
+ </property>
+ <property name="frameShape">
+ <enum>QFrame::NoFrame</enum>
+ </property>
+ <property name="frameShadow">
+ <enum>QFrame::Plain</enum>
+ </property>
+ <property name="lineWidth">
+ <number>0</number>
+ </property>
+ <property name="tabChangesFocus">
+ <bool>true</bool>
+ </property>
+ <property name="readOnly">
+ <bool>true</bool>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ <item row="1" column="0">
+ <widget class="QLabel" name="entryPasswordTitleLabel">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Preferred">
<horstretch>0</horstretch>
@@ -228,19 +273,16 @@
<bold>true</bold>
</font>
</property>
- <property name="layoutDirection">
- <enum>Qt::LeftToRight</enum>
- </property>
<property name="text">
- <string>Username</string>
+ <string>Password</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
- <item row="3" column="0">
- <widget class="QLabel" name="entryNotesTitleLabel">
+ <item row="0" column="4">
+ <widget class="QLabel" name="entryUrlTitleLabel">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Preferred">
<horstretch>0</horstretch>
@@ -254,25 +296,50 @@
</font>
</property>
<property name="text">
- <string>Notes</string>
+ <string>URL</string>
</property>
<property name="alignment">
- <set>Qt::AlignRight|Qt::AlignTop|Qt::AlignTrailing</set>
+ <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
- <item row="2" column="1" colspan="5">
- <widget class="TagsEdit" name="entryTagsList" native="true">
+ <item row="1" column="5">
+ <widget class="QLabel" name="entryExpirationLabel">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Expanding" vsizetype="Preferred">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
<property name="focusPolicy">
<enum>Qt::ClickFocus</enum>
</property>
- <property name="accessibleName">
- <string>Tags list</string>
+ <property name="text">
+ <string notr="true">expired</string>
+ </property>
+ <property name="textInteractionFlags">
+ <set>Qt::LinksAccessibleByMouse|Qt::TextSelectableByMouse</set>
</property>
</widget>
</item>
- <item row="1" column="0">
- <widget class="QLabel" name="entryPasswordTitleLabel">
+ <item row="0" column="3">
+ <spacer name="entryMiddleHorizontalSpacer">
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>QSizePolicy::Fixed</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>10</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ <item row="1" column="4">
+ <widget class="QLabel" name="entryExpirationTitleLabel">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Preferred">
<horstretch>0</horstretch>
@@ -286,7 +353,7 @@
</font>
</property>
<property name="text">
- <string>Password</string>
+ <string>Expiration</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
@@ -359,53 +426,8 @@
</item>
</layout>
</item>
- <item row="3" column="1" colspan="5">
- <layout class="QHBoxLayout" name="horizontalLayout_3" stretch="0,0">
- <property name="spacing">
- <number>6</number>
- </property>
- <item alignment="Qt::AlignTop">
- <widget class="QToolButton" name="toggleEntryNotesButton">
- <property name="text">
- <string/>
- </property>
- <property name="iconSize">
- <size>
- <width>14</width>
- <height>14</height>
- </size>
- </property>
- <property name="checkable">
- <bool>true</bool>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QTextEdit" name="entryNotesTextEdit">
- <property name="focusPolicy">
- <enum>Qt::ClickFocus</enum>
- </property>
- <property name="frameShape">
- <enum>QFrame::NoFrame</enum>
- </property>
- <property name="frameShadow">
- <enum>QFrame::Plain</enum>
- </property>
- <property name="lineWidth">
- <number>0</number>
- </property>
- <property name="tabChangesFocus">
- <bool>true</bool>
- </property>
- <property name="readOnly">
- <bool>true</bool>
- </property>
- </widget>
- </item>
- </layout>
- </item>
- <item row="0" column="4">
- <widget class="QLabel" name="entryUrlTitleLabel">
+ <item row="2" column="0">
+ <widget class="QLabel" name="entryTagsTitleLabel">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Preferred">
<horstretch>0</horstretch>
@@ -419,64 +441,23 @@
</font>
</property>
<property name="text">
- <string>URL</string>
+ <string>Tags</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
- <item row="1" column="3">
- <spacer name="entryMiddleHorizontalSpacer_3">
- <property name="orientation">
- <enum>Qt::Horizontal</enum>
- </property>
- <property name="sizeType">
- <enum>QSizePolicy::Fixed</enum>
- </property>
- <property name="sizeHint" stdset="0">
- <size>
- <width>10</width>
- <height>20</height>
- </size>
- </property>
- </spacer>
- </item>
- <item row="1" column="5">
- <widget class="QLabel" name="entryExpirationLabel">
- <property name="sizePolicy">
- <sizepolicy hsizetype="Expanding" vsizetype="Preferred">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
+ <item row="2" column="1" colspan="5">
+ <widget class="TagsEdit" name="entryTagsList" native="true">
<property name="focusPolicy">
<enum>Qt::ClickFocus</enum>
</property>
- <property name="text">
- <string notr="true">expired</string>
- </property>
- <property name="textInteractionFlags">
- <set>Qt::LinksAccessibleByMouse|Qt::TextSelectableByMouse</set>
+ <property name="accessibleName">
+ <string>Tags list</string>
</property>
</widget>
</item>
- <item row="0" column="3">
- <spacer name="entryMiddleHorizontalSpacer">
- <property name="orientation">
- <enum>Qt::Horizontal</enum>
- </property>
- <property name="sizeType">
- <enum>QSizePolicy::Fixed</enum>
- </property>
- <property name="sizeHint" stdset="0">
- <size>
- <width>10</width>
- <height>20</height>
- </size>
- </property>
- </spacer>
- </item>
<item row="0" column="5">
<widget class="ElidedLabel" name="entryUrlLabel">
<property name="sizePolicy">
@@ -505,8 +486,24 @@
</property>
</widget>
</item>
- <item row="1" column="4">
- <widget class="QLabel" name="entryExpirationTitleLabel">
+ <item row="1" column="3">
+ <spacer name="entryMiddleHorizontalSpacer_3">
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>QSizePolicy::Fixed</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>10</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ <item row="0" column="0">
+ <widget class="QLabel" name="entryUsernameTitleLabel">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Preferred">
<horstretch>0</horstretch>
@@ -519,44 +516,19 @@
<bold>true</bold>
</font>
</property>
+ <property name="layoutDirection">
+ <enum>Qt::LeftToRight</enum>
+ </property>
<property name="text">
- <string>Expiration</string>
+ <string>Username</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
- <item row="0" column="1">
- <widget class="QLineEdit" name="entryUsernameLabel">
- <property name="minimumSize">
- <size>
- <width>150</width>
- <height>0</height>
- </size>
- </property>
- <property name="focusPolicy">
- <enum>Qt::ClickFocus</enum>
- </property>
- <property name="text">
- <string notr="true">username</string>
- </property>
- <property name="frame">
- <bool>false</bool>
- </property>
- <property name="cursorPosition">
- <number>8</number>
- </property>
- <property name="dragEnabled">
- <bool>true</bool>
- </property>
- <property name="readOnly">
- <bool>true</bool>
- </property>
- </widget>
- </item>
- <item row="2" column="0">
- <widget class="QLabel" name="entryTagsTitleLabel">
+ <item row="3" column="0">
+ <widget class="QLabel" name="entryNotesTitleLabel">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Preferred">
<horstretch>0</horstretch>
@@ -570,13 +542,64 @@
</font>
</property>
<property name="text">
- <string>Tags</string>
+ <string>Notes</string>
</property>
<property name="alignment">
- <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
+ <set>Qt::AlignRight|Qt::AlignTop|Qt::AlignTrailing</set>
</property>
</widget>
</item>
+ <item row="0" column="1" colspan="2">
+ <layout class="QHBoxLayout" name="horizontalLayout_6">
+ <property name="spacing">
+ <number>8</number>
+ </property>
+ <item>
+ <widget class="QToolButton" name="toggleUsernameButton">
+ <property name="text">
+ <string/>
+ </property>
+ <property name="iconSize">
+ <size>
+ <width>14</width>
+ <height>14</height>
+ </size>
+ </property>
+ <property name="checkable">
+ <bool>true</bool>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QLineEdit" name="entryUsernameLabel">
+ <property name="minimumSize">
+ <size>
+ <width>150</width>
+ <height>0</height>
+ </size>
+ </property>
+ <property name="focusPolicy">
+ <enum>Qt::ClickFocus</enum>
+ </property>
+ <property name="text">
+ <string notr="true">username</string>
+ </property>
+ <property name="frame">
+ <bool>false</bool>
+ </property>
+ <property name="cursorPosition">
+ <number>8</number>
+ </property>
+ <property name="dragEnabled">
+ <bool>true</bool>
+ </property>
+ <property name="readOnly">
+ <bool>true</bool>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
</layout>
</widget>
</item>