Fix clicking links in entry preview panel

* Fixes #8636
This commit is contained in:
Jonathan White 2022-10-24 23:46:44 -04:00
parent 2583cc4aa4
commit 03f11ce516
3 changed files with 16 additions and 9 deletions

View File

@ -197,7 +197,6 @@ DatabaseWidget::DatabaseWidget(QSharedPointer<Database> db, QWidget* parent)
connect(m_groupSplitter, SIGNAL(splitterMoved(int,int)), SIGNAL(splitterSizesChanged()));
connect(m_previewSplitter, SIGNAL(splitterMoved(int,int)), SIGNAL(splitterSizesChanged()));
connect(this, SIGNAL(currentModeChanged(DatabaseWidget::Mode)), m_previewView, SLOT(setDatabaseMode(DatabaseWidget::Mode)));
connect(m_previewView, SIGNAL(errorOccurred(QString)), SLOT(showErrorMessage(QString)));
connect(m_previewView, SIGNAL(entryUrlActivated(Entry*)), SLOT(openUrlForEntry(Entry*)));
connect(m_entryView, SIGNAL(viewStateChanged()), SIGNAL(entryViewStateChanged()));
connect(m_groupView, SIGNAL(groupSelectionChanged()), SLOT(onGroupChanged()));

View File

@ -66,8 +66,6 @@ EntryPreviewWidget::EntryPreviewWidget(QWidget* parent)
m_ui->entryNotesTextEdit->document()->setDocumentMargin(0);
m_ui->groupNotesTextEdit->document()->setDocumentMargin(0);
connect(m_ui->entryUrlLabel, SIGNAL(linkActivated(QString)), SLOT(openEntryUrl()));
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()));
@ -77,7 +75,10 @@ EntryPreviewWidget::EntryPreviewWidget(QWidget* parent)
connect(m_ui->toggleGroupNotesButton, SIGNAL(clicked(bool)), SLOT(setGroupNotesVisible(bool)));
connect(m_ui->entryTabWidget, SIGNAL(tabBarClicked(int)), SLOT(updateTabIndexes()), Qt::QueuedConnection);
// Prevent the url from being focused after clicked to allow the Copy Password button to work properly
connect(m_ui->entryUrlLabel, &QLabel::linkActivated, this, [this] { m_ui->entryTabWidget->setFocus(); });
connect(m_ui->entryUrlLabel, &QLabel::linkActivated, this, [this] {
openEntryUrl();
m_ui->entryTabWidget->setFocus();
});
connect(&m_totpTimer, SIGNAL(timeout()), SLOT(updateTotpLabel()));
connect(m_ui->entryAttributesTable, &QTableWidget::itemDoubleClicked, this, [](QTableWidgetItem* item) {
@ -120,8 +121,12 @@ void EntryPreviewWidget::clear()
void EntryPreviewWidget::setEntry(Entry* selectedEntry)
{
if (m_currentEntry) {
disconnect(m_currentEntry);
}
if (m_currentGroup) {
disconnect(m_currentGroup);
}
m_currentEntry = selectedEntry;
m_currentGroup = nullptr;
@ -137,8 +142,12 @@ void EntryPreviewWidget::setEntry(Entry* selectedEntry)
void EntryPreviewWidget::setGroup(Group* selectedGroup)
{
if (m_currentEntry) {
disconnect(m_currentEntry);
}
if (m_currentGroup) {
disconnect(m_currentGroup);
}
m_currentEntry = nullptr;
m_currentGroup = selectedGroup;

View File

@ -44,7 +44,6 @@ public slots:
void clear();
signals:
void errorOccurred(const QString& error);
void entryUrlActivated(Entry* entry);
private slots: