From 2d182ab48e83a3077719edef8299f3c9c0a180c1 Mon Sep 17 00:00:00 2001 From: Balazs Gyurak Date: Fri, 28 Jun 2019 21:50:18 +0100 Subject: [PATCH 1/2] Move notes to General tab on Group Preview Panel --- src/cli/Analyze.cpp | 3 +- src/gui/EntryPreviewWidget.cpp | 61 +++++++----- src/gui/EntryPreviewWidget.h | 5 +- src/gui/EntryPreviewWidget.ui | 171 ++++++++++++++++++++------------- 4 files changed, 146 insertions(+), 94 deletions(-) diff --git a/src/cli/Analyze.cpp b/src/cli/Analyze.cpp index 41f9910c51..b600c3c3f0 100644 --- a/src/cli/Analyze.cpp +++ b/src/cli/Analyze.cpp @@ -50,7 +50,8 @@ int Analyze::executeWithDatabase(QSharedPointer database, QSharedPoint QString hibpDatabase = parser->value(Analyze::HIBPDatabaseOption); QFile hibpFile(hibpDatabase); if (!hibpFile.open(QFile::ReadOnly)) { - errorTextStream << QObject::tr("Failed to open HIBP file %1: %2").arg(hibpDatabase).arg(hibpFile.errorString()) << endl; + errorTextStream << QObject::tr("Failed to open HIBP file %1: %2").arg(hibpDatabase).arg(hibpFile.errorString()) + << endl; return EXIT_FAILURE; } diff --git a/src/gui/EntryPreviewWidget.cpp b/src/gui/EntryPreviewWidget.cpp index 1e29d2fa04..7ccd544749 100644 --- a/src/gui/EntryPreviewWidget.cpp +++ b/src/gui/EntryPreviewWidget.cpp @@ -50,7 +50,8 @@ EntryPreviewWidget::EntryPreviewWidget(QWidget* parent) 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->toggleNotesButton->setIcon(filePath()->onOffIcon("actions", "password-show")); + m_ui->toggleEntryNotesButton->setIcon(filePath()->onOffIcon("actions", "password-show")); + m_ui->toggleGroupNotesButton->setIcon(filePath()->onOffIcon("actions", "password-show")); m_ui->entryAttachmentsWidget->setReadOnly(true); m_ui->entryAttachmentsWidget->setButtonsVisible(false); @@ -60,7 +61,8 @@ EntryPreviewWidget::EntryPreviewWidget(QWidget* parent) connect(m_ui->entryTotpButton, SIGNAL(toggled(bool)), m_ui->entryTotpLabel, SLOT(setVisible(bool))); connect(m_ui->entryCloseButton, SIGNAL(clicked()), SLOT(hide())); connect(m_ui->togglePasswordButton, SIGNAL(clicked(bool)), SLOT(setPasswordVisible(bool))); - connect(m_ui->toggleNotesButton, SIGNAL(clicked(bool)), SLOT(setNotesVisible(bool))); + connect(m_ui->toggleEntryNotesButton, SIGNAL(clicked(bool)), SLOT(setEntryNotesVisible(bool))); + connect(m_ui->toggleGroupNotesButton, SIGNAL(clicked(bool)), SLOT(setGroupNotesVisible(bool))); connect(m_ui->entryTabWidget, SIGNAL(tabBarClicked(int)), SLOT(updateTabIndexes()), Qt::QueuedConnection); connect(&m_totpTimer, SIGNAL(timeout()), SLOT(updateTotpLabel())); @@ -107,7 +109,6 @@ void EntryPreviewWidget::setGroup(Group* selectedGroup) m_currentGroup = selectedGroup; updateGroupHeaderLine(); updateGroupGeneralTab(); - updateGroupNotesTab(); #if defined(WITH_XC_KEESHARE) updateGroupSharingTab(); @@ -181,23 +182,31 @@ void EntryPreviewWidget::setPasswordVisible(bool state) } } -void EntryPreviewWidget::setNotesVisible(bool state) +void EntryPreviewWidget::setEntryNotesVisible(bool state) { - const QString notes = m_currentEntry->notes(); + setNotesVisible(m_ui->entryNotesLabel, m_currentEntry->notes(), state); +} + +void EntryPreviewWidget::setGroupNotesVisible(bool state) +{ + setNotesVisible(m_ui->groupNotesLabel, m_currentGroup->notes(), state); +} - auto flags = m_ui->entryNotesLabel->textInteractionFlags(); +void EntryPreviewWidget::setNotesVisible(QLabel* notesLabel, const QString notes, bool state) +{ + auto flags = notesLabel->textInteractionFlags(); if (state) { - m_ui->entryNotesLabel->setText(notes); - m_ui->entryNotesLabel->setToolTip(notes); - m_ui->entryNotesLabel->setTextInteractionFlags(flags | Qt::TextSelectableByMouse); + notesLabel->setText(notes); + notesLabel->setToolTip(notes); + notesLabel->setTextInteractionFlags(flags | Qt::TextSelectableByMouse); } else { if (notes.isEmpty()) { - m_ui->entryNotesLabel->setText(""); + notesLabel->setText(""); } else { - m_ui->entryNotesLabel->setText(QString("\u25cf").repeated(6)); + notesLabel->setText(QString("\u25cf").repeated(6)); } - m_ui->entryNotesLabel->setToolTip({}); - m_ui->entryNotesLabel->setTextInteractionFlags(flags & ~Qt::TextSelectableByMouse); + notesLabel->setToolTip({}); + notesLabel->setTextInteractionFlags(flags & ~Qt::TextSelectableByMouse); } } @@ -219,12 +228,12 @@ void EntryPreviewWidget::updateEntryGeneralTab() } if (config()->get("security/hidenotes").toBool()) { - setNotesVisible(false); - m_ui->toggleNotesButton->setVisible(!m_ui->entryNotesLabel->text().isEmpty()); - m_ui->toggleNotesButton->setChecked(false); + setEntryNotesVisible(false); + m_ui->toggleEntryNotesButton->setVisible(!m_ui->entryNotesLabel->text().isEmpty()); + m_ui->toggleEntryNotesButton->setChecked(false); } else { - setNotesVisible(true); - m_ui->toggleNotesButton->setVisible(false); + setEntryNotesVisible(true); + m_ui->toggleEntryNotesButton->setVisible(false); } m_ui->entryUrlLabel->setRawText(m_currentEntry->displayUrl()); @@ -307,14 +316,18 @@ void EntryPreviewWidget::updateGroupGeneralTab() const QString expiresText = groupTime.expires() ? groupTime.expiryTime().toString(Qt::DefaultLocaleShortDate) : tr("Never"); m_ui->groupExpirationLabel->setText(expiresText); -} -void EntryPreviewWidget::updateGroupNotesTab() -{ - Q_ASSERT(m_currentGroup); const QString notes = m_currentGroup->notes(); - setTabEnabled(m_ui->groupTabWidget, m_ui->groupNotesTab, !notes.isEmpty()); - m_ui->groupNotesEdit->setText(notes); + m_ui->groupNotesLabel->setText(notes); + + if (config()->get("security/hidenotes").toBool()) { + setGroupNotesVisible(false); + m_ui->toggleGroupNotesButton->setVisible(!m_ui->groupNotesLabel->text().isEmpty()); + m_ui->toggleGroupNotesButton->setChecked(false); + } else { + setGroupNotesVisible(true); + m_ui->toggleGroupNotesButton->setVisible(false); + } } #if defined(WITH_XC_KEESHARE) diff --git a/src/gui/EntryPreviewWidget.h b/src/gui/EntryPreviewWidget.h index c381715242..205b3cbbfd 100644 --- a/src/gui/EntryPreviewWidget.h +++ b/src/gui/EntryPreviewWidget.h @@ -52,11 +52,12 @@ private slots: void updateEntryAdvancedTab(); void updateEntryAutotypeTab(); void setPasswordVisible(bool state); - void setNotesVisible(bool state); + void setEntryNotesVisible(bool state); + void setGroupNotesVisible(bool state); + void setNotesVisible(QLabel* notesLabel, const QString notes, bool state); void updateGroupHeaderLine(); void updateGroupGeneralTab(); - void updateGroupNotesTab(); #if defined(WITH_XC_KEESHARE) void updateGroupSharingTab(); #endif diff --git a/src/gui/EntryPreviewWidget.ui b/src/gui/EntryPreviewWidget.ui index 3453de1f8d..b2c8c28bfb 100644 --- a/src/gui/EntryPreviewWidget.ui +++ b/src/gui/EntryPreviewWidget.ui @@ -463,7 +463,7 @@ Notes - Qt::AlignRight + Qt::AlignTop|Qt::AlignRight @@ -476,7 +476,7 @@ 4 - + @@ -841,18 +841,24 @@ 0 - - - - - 0 - 0 - + + + + Qt::Horizontal - + + QSizePolicy::Fixed + + + + 20 + 20 + + + - - + + 0 @@ -866,15 +872,25 @@ - Expiration + Autotype Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - + + + + + 0 + 0 + + + + + + 0 @@ -888,15 +904,15 @@ - Autotype + Searching Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - + + 0 @@ -905,34 +921,40 @@ - - + + - + 0 0 - - - - - - Qt::Horizontal + + + 75 + true + - - QSizePolicy::Fixed + + Expiration - - - 20 - 20 - + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - + - - + + + + + 0 + 0 + + + + + + 0 @@ -946,48 +968,63 @@ - Searching + Notes - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + Qt::AlignTop|Qt::AlignRight - - - - Qt::Vertical + + + + 6 - - - 0 - 0 - + + 4 - + + + + + + + true + + + + + + + + 0 + 0 + + + + + 100 + 30 + + + + notes + + + Qt::AlignTop + + + true + + + + - - - Notes - - - - - - Qt::ClickFocus - - - true - - - - - Share @@ -1106,7 +1143,7 @@ entryCloseButton entryTotpButton togglePasswordButton - toggleNotesButton + toggleEntryNotesButton entryAutotypeTree groupCloseButton groupTabWidget From 9bdb80c9574fdcae892ec31fab9555518e8aaa61 Mon Sep 17 00:00:00 2001 From: Balazs Gyurak Date: Fri, 28 Jun 2019 21:56:17 +0100 Subject: [PATCH 2/2] Add CHANGELOG entry --- CHANGELOG | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG b/CHANGELOG index 3e8f21ff35..54330a63a8 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -3,6 +3,7 @@ - Group sorting feature [#3282] - CLI: Add 'flatten' option to the 'ls' command [#3276] - Rework the Entry Preview panel [#3306] +- Move notes to General tab on Group Preview Panel [#3336] 2.4.3 (2019-06-12) =========================