Terminal: HyperLink: Remove base address, add text property

* The base address is no longer used (it was in a an earlier, never
  committed version), so we can as remove it.
* Introduce a text property.
This commit is contained in:
Ingo Weinhold 2013-05-12 14:35:01 +02:00
parent 3f3ade6223
commit 7daf375812
3 changed files with 17 additions and 9 deletions

View File

@ -20,11 +20,19 @@ HyperLink::HyperLink()
}
HyperLink::HyperLink(const BString& address, Type type,
const BString& baseAddress)
HyperLink::HyperLink(const BString& address, Type type)
:
fText(address),
fAddress(address),
fType(type)
{
}
HyperLink::HyperLink(const BString& text, const BString& address, Type type)
:
fText(text),
fAddress(address),
fBaseAddress(baseAddress.IsEmpty() ? address : baseAddress),
fType(type)
{
}

View File

@ -20,20 +20,21 @@ public:
public:
HyperLink();
HyperLink(const BString& address, Type type,
const BString& baseAddress = BString());
HyperLink(const BString& address, Type type);
HyperLink(const BString& text,
const BString& address, Type type);
bool IsValid() const { return !fAddress.IsEmpty(); }
const BString& Text() const { return fText; }
const BString& Address() const { return fAddress; }
const BString& BaseAddress() const { return fBaseAddress; }
Type GetType() const { return fType; }
status_t Open();
private:
BString fText;
BString fAddress;
BString fBaseAddress;
Type fType;
};

View File

@ -836,8 +836,7 @@ TermView::HyperLinkState::_GetHyperLinkAt(BPoint where, bool pathPrefixOnly,
_link = HyperLink(text,
i == 0
? HyperLink::TYPE_PATH_WITH_LINE
: HyperLink::TYPE_PATH_WITH_LINE_AND_COLUMN,
path);
: HyperLink::TYPE_PATH_WITH_LINE_AND_COLUMN);
return true;
}
}