diff options
author | Jonathan White <support@dmapps.us> | 2019-05-18 17:55:57 +0300 |
---|---|---|
committer | Jonathan White <support@dmapps.us> | 2019-05-19 07:20:43 +0300 |
commit | ecaa4fd6ce917c9b2dabf780d59503503ec55769 (patch) | |
tree | 00ccc2ad44bde050f4de0961d249ad8146ce49ae /src/gui/EntryPreviewWidget.cpp | |
parent | baa55d15971d9213bae0f7dc0b6aeb3059463c99 (diff) |
Fix opening url's with non-http schema
* Fix #2427
* Changed the openUrl() function to use a QUrl object, which has the appropriate scheme set.
* Preview widget now passes url handling back to DatabaseWidget
Diffstat (limited to 'src/gui/EntryPreviewWidget.cpp')
-rw-r--r-- | src/gui/EntryPreviewWidget.cpp | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/src/gui/EntryPreviewWidget.cpp b/src/gui/EntryPreviewWidget.cpp index 0fd8826c8..c90d0aa67 100644 --- a/src/gui/EntryPreviewWidget.cpp +++ b/src/gui/EntryPreviewWidget.cpp @@ -54,11 +54,13 @@ EntryPreviewWidget::EntryPreviewWidget(QWidget* parent) m_ui->entryAttachmentsWidget->setReadOnly(true); m_ui->entryAttachmentsWidget->setButtonsVisible(false); + connect(m_ui->entryUrlLabel, SIGNAL(linkActivated(QString)), SLOT(openEntryUrl())); + 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())); + connect(&m_totpTimer, SIGNAL(timeout()), SLOT(updateTotpLabel())); // Group m_ui->groupCloseButton->setIcon(filePath()->icon("actions", "dialog-close")); @@ -197,11 +199,12 @@ void EntryPreviewWidget::updateEntryGeneralTab() } m_ui->entryUrlLabel->setRawText(m_currentEntry->displayUrl()); - const QString url = m_currentEntry->webUrl(); + const QString url = m_currentEntry->url(); if (!url.isEmpty()) { // URL is well formed and can be opened in a browser m_ui->entryUrlLabel->setUrl(url); m_ui->entryUrlLabel->setCursor(Qt::PointingHandCursor); + m_ui->entryUrlLabel->setOpenExternalLinks(false); } else { m_ui->entryUrlLabel->setUrl({}); m_ui->entryUrlLabel->setCursor(Qt::ArrowCursor); @@ -327,6 +330,13 @@ void EntryPreviewWidget::updateTabIndexes() m_selectedTabGroup = m_ui->groupTabWidget->currentIndex(); } +void EntryPreviewWidget::openEntryUrl() +{ + if (m_currentEntry) { + emit entryUrlActivated(m_currentEntry); + } +} + void EntryPreviewWidget::setTabEnabled(QTabWidget* tabWidget, QWidget* widget, bool enabled) { const int tabIndex = tabWidget->indexOf(widget); |