diff --git a/src/dolphinmainwindow.cpp b/src/dolphinmainwindow.cpp --- a/src/dolphinmainwindow.cpp +++ b/src/dolphinmainwindow.cpp @@ -1453,6 +1453,8 @@ this, static_cast(&DolphinMainWindow::goBack)); connect(view, &DolphinView::goForwardRequested, this, static_cast(&DolphinMainWindow::goForward)); + connect(view, &DolphinView::urlActivated, + this, &DolphinMainWindow::handleUrl); const KUrlNavigator* navigator = container->urlNavigator(); connect(navigator, &KUrlNavigator::urlChanged, diff --git a/src/views/dolphinview.h b/src/views/dolphinview.h --- a/src/views/dolphinview.h +++ b/src/views/dolphinview.h @@ -544,6 +544,12 @@ */ void toggleActiveViewRequested(); + /** + * Is emitted when the user clicks a tag or a link + * in the metadata widget of a tooltip. + */ + void urlActivated(const QUrl& url); + protected: /** Changes the zoom level if Control is pressed during a wheel event. */ virtual void wheelEvent(QWheelEvent* event) Q_DECL_OVERRIDE; diff --git a/src/views/dolphinview.cpp b/src/views/dolphinview.cpp --- a/src/views/dolphinview.cpp +++ b/src/views/dolphinview.cpp @@ -182,6 +182,7 @@ this, &DolphinView::slotSelectionChanged); m_toolTipManager = new ToolTipManager(this); + connect(m_toolTipManager, &ToolTipManager::urlActivated, this, &DolphinView::urlActivated); m_versionControlObserver = new VersionControlObserver(this); m_versionControlObserver->setModel(m_model); diff --git a/src/views/tooltips/dolphinfilemetadatawidget.h b/src/views/tooltips/dolphinfilemetadatawidget.h --- a/src/views/tooltips/dolphinfilemetadatawidget.h +++ b/src/views/tooltips/dolphinfilemetadatawidget.h @@ -69,6 +69,12 @@ */ void metaDataRequestFinished(const KFileItemList& items); + /** + * Is emitted when the user clicks a tag or a link + * in the metadata widget. + */ + void urlActivated(const QUrl& url); + private: QLabel* m_preview; QLabel* m_name; diff --git a/src/views/tooltips/dolphinfilemetadatawidget.cpp b/src/views/tooltips/dolphinfilemetadatawidget.cpp --- a/src/views/tooltips/dolphinfilemetadatawidget.cpp +++ b/src/views/tooltips/dolphinfilemetadatawidget.cpp @@ -67,10 +67,14 @@ m_fileMetaDataWidget = new KFileMetaDataWidget(this); connect(m_fileMetaDataWidget, &KFileMetaDataWidget::metaDataRequestFinished, this, &DolphinFileMetaDataWidget::metaDataRequestFinished); + connect(m_fileMetaDataWidget, &KFileMetaDataWidget::urlActivated, + this, &DolphinFileMetaDataWidget::urlActivated); #else m_fileMetaDataWidget = new Baloo::FileMetaDataWidget(this); connect(m_fileMetaDataWidget, &Baloo::FileMetaDataWidget::metaDataRequestFinished, this, &DolphinFileMetaDataWidget::metaDataRequestFinished); + connect(m_fileMetaDataWidget, &Baloo::FileMetaDataWidget::urlActivated, + this, &DolphinFileMetaDataWidget::urlActivated); #endif m_fileMetaDataWidget->setForegroundRole(QPalette::ToolTipText); m_fileMetaDataWidget->setReadOnly(true); diff --git a/src/views/tooltips/tooltipmanager.h b/src/views/tooltips/tooltipmanager.h --- a/src/views/tooltips/tooltipmanager.h +++ b/src/views/tooltips/tooltipmanager.h @@ -58,6 +58,13 @@ */ void hideToolTip(); +signals: + /** + * Is emitted when the user clicks a tag or a link + * in the metadata widget. + */ + void urlActivated(const QUrl& url); + private slots: void startContentRetrieval(); void setPreviewPix(const KFileItem& item, const QPixmap& pix); diff --git a/src/views/tooltips/tooltipmanager.cpp b/src/views/tooltips/tooltipmanager.cpp --- a/src/views/tooltips/tooltipmanager.cpp +++ b/src/views/tooltips/tooltipmanager.cpp @@ -86,6 +86,8 @@ m_fileMetaDataWidget = new DolphinFileMetaDataWidget(); connect(m_fileMetaDataWidget, &DolphinFileMetaDataWidget::metaDataRequestFinished, this, &ToolTipManager::slotMetaDataRequestFinished); + connect(m_fileMetaDataWidget, &DolphinFileMetaDataWidget::urlActivated, + this, &ToolTipManager::urlActivated); m_contentRetrievalTimer->start(); m_showToolTipTimer->start();