Don't ignore tag clicks in the tooltips

Summary:
Now that we can use the metadata widgets in the tooltips, we can also
open the tags:// url if the user clicks some tag in a tooltip.

The behavior is now consistent with the metadata widget in the information panel.

Test Plan: Click a tag when the metadata tooltip shows up.

Reviewers: emmanuelp

Subscribers: #konqueror, #dolphin

Differential Revision: https://phabricator.kde.org/D5658
This commit is contained in:
Elvis Angelaccio 2017-04-29 18:47:13 +02:00
parent e74910cfdf
commit 73f885f9d3
7 changed files with 28 additions and 0 deletions

View file

@ -1453,6 +1453,8 @@ void DolphinMainWindow::connectViewSignals(DolphinViewContainer* container)
this, static_cast<void(DolphinMainWindow::*)()>(&DolphinMainWindow::goBack));
connect(view, &DolphinView::goForwardRequested,
this, static_cast<void(DolphinMainWindow::*)()>(&DolphinMainWindow::goForward));
connect(view, &DolphinView::urlActivated,
this, &DolphinMainWindow::handleUrl);
const KUrlNavigator* navigator = container->urlNavigator();
connect(navigator, &KUrlNavigator::urlChanged,

View file

@ -182,6 +182,7 @@ DolphinView::DolphinView(const QUrl& url, QWidget* parent) :
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);

View file

@ -544,6 +544,12 @@ signals:
*/
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;

View file

@ -67,10 +67,14 @@ DolphinFileMetaDataWidget::DolphinFileMetaDataWidget(QWidget* parent) :
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);

View file

@ -69,6 +69,12 @@ signals:
*/
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;

View file

@ -86,6 +86,8 @@ void ToolTipManager::showToolTip(const KFileItem& item, const QRectF& itemRect,
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();

View file

@ -58,6 +58,13 @@ public:
*/
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);