diff --git a/src/gui/EntryPreviewWidget.cpp b/src/gui/EntryPreviewWidget.cpp index 7395f380d..c20c85be9 100644 --- a/src/gui/EntryPreviewWidget.cpp +++ b/src/gui/EntryPreviewWidget.cpp @@ -168,13 +168,12 @@ 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); + m_ui->entryPasswordLabel->setTextInteractionFlags(Qt::TextSelectableByMouse); } else { - m_ui->entryPasswordLabel->setTextInteractionFlags(flags & ~Qt::TextSelectableByMouse); + m_ui->entryPasswordLabel->setTextInteractionFlags(Qt::NoTextInteraction); m_ui->entryPasswordLabel->setToolTip({}); if (password.isEmpty() && config()->get("security/passwordemptynodots").toBool()) { m_ui->entryPasswordLabel->setRawText(""); @@ -194,21 +193,20 @@ void EntryPreviewWidget::setGroupNotesVisible(bool state) setNotesVisible(m_ui->groupNotesLabel, m_currentGroup->notes(), state); } -void EntryPreviewWidget::setNotesVisible(QLabel* notesLabel, const QString notes, bool state) +void EntryPreviewWidget::setNotesVisible(QLabel* notesLabel, const QString& notes, bool state) { - auto flags = notesLabel->textInteractionFlags(); if (state) { - notesLabel->setText(notes); - notesLabel->setToolTip(notes); - notesLabel->setTextInteractionFlags(flags | Qt::TextSelectableByMouse); + // Add html hyperlinks to notes that start with XXXX:// + QString hyperlinkNotes = notes; + notesLabel->setText(hyperlinkNotes.replace(QRegExp("(\\w+:\\/\\/\\S+)"), "\\1")); + notesLabel->setTextInteractionFlags(Qt::TextBrowserInteraction); } else { if (notes.isEmpty()) { notesLabel->setText(""); } else { notesLabel->setText(QString("\u25cf").repeated(6)); } - notesLabel->setToolTip({}); - notesLabel->setTextInteractionFlags(flags & ~Qt::TextSelectableByMouse); + notesLabel->setTextInteractionFlags(Qt::NoTextInteraction); } } diff --git a/src/gui/EntryPreviewWidget.h b/src/gui/EntryPreviewWidget.h index 205b3cbbf..ddf17b295 100644 --- a/src/gui/EntryPreviewWidget.h +++ b/src/gui/EntryPreviewWidget.h @@ -54,7 +54,7 @@ private slots: void setPasswordVisible(bool state); void setEntryNotesVisible(bool state); void setGroupNotesVisible(bool state); - void setNotesVisible(QLabel* notesLabel, const QString notes, bool state); + void setNotesVisible(QLabel* notesLabel, const QString& notes, bool state); void updateGroupHeaderLine(); void updateGroupGeneralTab(); diff --git a/src/gui/EntryPreviewWidget.ui b/src/gui/EntryPreviewWidget.ui index b620da659..4d1941fbc 100644 --- a/src/gui/EntryPreviewWidget.ui +++ b/src/gui/EntryPreviewWidget.ui @@ -463,7 +463,7 @@ Notes - Qt::AlignTop|Qt::AlignRight + Qt::AlignRight|Qt::AlignTop|Qt::AlignTrailing @@ -502,12 +502,21 @@ notes + + Qt::RichText + Qt::AlignTop true + + true + + + Qt::NoTextInteraction + @@ -828,7 +837,7 @@ - + 0 @@ -971,7 +980,7 @@ Notes - Qt::AlignTop|Qt::AlignRight + Qt::AlignRight|Qt::AlignTop|Qt::AlignTrailing