Commit 31a82152 authored by Tomaz  Canabrava's avatar Tomaz Canabrava Committed by Tomaz Canabrava
Browse files

Add HotSpot::File, differentiate between Url links and Local Files

parent 04d99f7c
......@@ -52,7 +52,7 @@ FileFilterHotSpot::FileFilterHotSpot(int startLine,
, _session(session)
, _thumbnailFinished(false)
{
setType(Link);
setType(File);
}
void FileFilterHotSpot::activate(QObject *)
......
......@@ -251,7 +251,7 @@ void FilterChain::paint(TerminalDisplay *td, QPainter &painter)
for (const auto &spot : spots) {
QRegion region;
if (spot->type() == HotSpot::Link || spot->type() == HotSpot::EMailAddress || spot->type() == HotSpot::EscapedUrl) {
if (spot->type() == HotSpot::Link || spot->type() == HotSpot::EMailAddress || spot->type() == HotSpot::EscapedUrl || spot->type() == HotSpot::File) {
QPair<QRegion, QRect> spotRegion =
spot->region(td->terminalFont()->fontWidth(), td->terminalFont()->fontHeight(), td->columns(), td->contentRect());
region = spotRegion.first;
......@@ -259,7 +259,7 @@ void FilterChain::paint(TerminalDisplay *td, QPainter &painter)
// TODO: Move this paint code to HotSpot->drawHint();
// TODO: Fix the Url Hints access from the Profile.
if (_showUrlHint && spot->type() == HotSpot::Link) {
if (_showUrlHint && (spot->type() == HotSpot::Link || spot->type() == HotSpot::File)) {
if (urlNumber >= 0 && urlNumber < 10) {
// Position at the beginning of the URL
QRect hintRect(*region.begin());
......@@ -327,7 +327,7 @@ void FilterChain::paint(TerminalDisplay *td, QPainter &painter)
// TODO: Fix accessing the urlHint here.
// TODO: Move this code to UrlFilterHotSpot.
const bool hasMouse = region.contains(td->mapFromGlobal(QCursor::pos()));
if ((spot->type() == HotSpot::Link && _showUrlHint) || hasMouse) {
if (((spot->type() == HotSpot::Link || spot->type() == HotSpot::File) && _showUrlHint) || hasMouse) {
QFontMetrics metrics(td->font());
// find the baseline (which is the invisible line that the characters in the font sit on,
......
......@@ -101,7 +101,7 @@ void HotSpot::mouseMoveEvent(TerminalDisplay *td, QMouseEvent *ev)
bool HotSpot::isUrl()
{
return (_type == HotSpot::Link || _type == HotSpot::EMailAddress || _type == HotSpot::EscapedUrl);
return (_type == HotSpot::Link || _type == HotSpot::EMailAddress || _type == HotSpot::EscapedUrl || _type == HotSpot::File);
}
void HotSpot::mouseEnterEvent(TerminalDisplay *td, QMouseEvent *ev)
......
......@@ -53,7 +53,9 @@ public:
enum Type {
// the type of the hotspot is not specified
NotSpecified,
// this hotspot represents a clickable link
// this hotspot rpresents a file on the filesystem
File,
// this hotspot represents a clickable URL link
Link,
// this hotspot represents a clickable e-mail address
EMailAddress,
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment