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 <droidmonkey@users.noreply.github.com>2018-11-16 18:00:59 +0300
committerGitHub <noreply@github.com>2018-11-16 18:00:59 +0300
commitee9c71e11e96073c6dc77e543ee51e62f97e07b1 (patch)
treea2266a1e019f7626783b88eb9a78130401bcc8fa /src/gui/EntryPreviewWidget.cpp
parentf06742cf41151417154b54f41d43d0db45c4812c (diff)
Fix multiple issues with entries and keyboard shortcuts (#2431)
* Cleanup entry change notification with entryview focus in/out * Change Open URL shortcut to CTRL+SHIFT+U to conform with an "action" including SHIFT * Change Copy URL shortcut to CTRL+U to conform with "copy" without SHIFT * Entry specific toolbar and menu items are disabled unless the entry row has focus (prevents unintended actions) * Reword security setting for password visibility in entry edit view * Add shortcut to hide/unhide usernames (CTRL+SHIFT+B) * Organize entry menu * Fix #1588 - show keyboard shortcuts in context menu * Fix #2403 - Change auto-type shortcut to CTRL + SHIFT + V * Fix #2096 - Add (CTRL+F) to search bar background * Fix #2031 & Fix #2266 - add shortcut to hide/unhide passwords (CTRL+SHIFT+C) * Fix #2166 - Add reveal password button to entry preview
Diffstat (limited to 'src/gui/EntryPreviewWidget.cpp')
-rw-r--r--src/gui/EntryPreviewWidget.cpp36
1 files changed, 30 insertions, 6 deletions
diff --git a/src/gui/EntryPreviewWidget.cpp b/src/gui/EntryPreviewWidget.cpp
index af6ffac33..b9fa26383 100644
--- a/src/gui/EntryPreviewWidget.cpp
+++ b/src/gui/EntryPreviewWidget.cpp
@@ -47,12 +47,14 @@ EntryPreviewWidget::EntryPreviewWidget(QWidget* parent)
// Entry
m_ui->entryTotpButton->setIcon(filePath()->icon("actions", "chronometer"));
m_ui->entryCloseButton->setIcon(filePath()->icon("actions", "dialog-close"));
+ m_ui->togglePasswordButton->setIcon(filePath()->onOffIcon("actions", "password-show"));
m_ui->entryAttachmentsWidget->setReadOnly(true);
m_ui->entryAttachmentsWidget->setButtonsVisible(false);
connect(m_ui->entryTotpButton, SIGNAL(toggled(bool)), m_ui->entryTotpWidget, SLOT(setVisible(bool)));
connect(m_ui->entryCloseButton, SIGNAL(clicked()), SLOT(hide()));
+ connect(m_ui->togglePasswordButton, SIGNAL(clicked(bool)), SLOT(setPasswordVisible(bool)));
connect(m_ui->entryTabWidget, SIGNAL(tabBarClicked(int)), SLOT(updateTabIndexes()), Qt::QueuedConnection);
connect(&m_totpTimer, SIGNAL(timeout()), this, SLOT(updateTotpLabel()));
@@ -152,18 +154,40 @@ void EntryPreviewWidget::updateEntryTotp()
}
}
+void EntryPreviewWidget::setPasswordVisible(bool state)
+{
+ const QString password = m_currentEntry->resolveMultiplePlaceholders(m_currentEntry->password());
+ auto flags = m_ui->entryPasswordLabel->textInteractionFlags();
+ if (state) {
+ m_ui->entryPasswordLabel->setRawText(password);
+ m_ui->entryPasswordLabel->setToolTip(password);
+ m_ui->entryPasswordLabel->setTextInteractionFlags(flags | Qt::TextSelectableByMouse);
+ } else {
+ m_ui->entryPasswordLabel->setTextInteractionFlags(flags & ~Qt::TextSelectableByMouse);
+ m_ui->entryPasswordLabel->setToolTip({});
+ if (password.isEmpty() && config()->get("security/passwordemptynodots").toBool()) {
+ m_ui->entryPasswordLabel->setRawText("");
+ } else {
+ m_ui->entryPasswordLabel->setRawText(QString("\u25cf").repeated(6));
+ }
+ }
+}
+
void EntryPreviewWidget::updateEntryGeneralTab()
{
Q_ASSERT(m_currentEntry);
m_ui->entryUsernameLabel->setText(m_currentEntry->resolveMultiplePlaceholders(m_currentEntry->username()));
- if (!config()->get("security/HidePasswordPreviewPanel").toBool()) {
- const QString password = m_currentEntry->resolveMultiplePlaceholders(m_currentEntry->password());
- m_ui->entryPasswordLabel->setRawText(password);
- m_ui->entryPasswordLabel->setToolTip(password);
+ if (config()->get("security/HidePasswordPreviewPanel").toBool()) {
+ // Hide password
+ setPasswordVisible(false);
+ // Show the password toggle button if there are dots in the label
+ m_ui->togglePasswordButton->setVisible(!m_ui->entryPasswordLabel->rawText().isEmpty());
+ m_ui->togglePasswordButton->setChecked(false);
} else {
- m_ui->entryPasswordLabel->setRawText(QString("\u25cf").repeated(6));
- m_ui->entryPasswordLabel->setToolTip({});
+ // Show password
+ setPasswordVisible(true);
+ m_ui->togglePasswordButton->setVisible(false);
}
m_ui->entryUrlLabel->setRawText(m_currentEntry->displayUrl());