Merge pull request #6964 from ericrius1/editHref

Validate href entity property (hifi:// only)
This commit is contained in:
Howard Stearns 2016-01-28 12:29:18 -08:00
commit 33226796ff
3 changed files with 10 additions and 2 deletions

View file

@ -982,7 +982,7 @@
</div> </div>
<div class="property"> <div class="property">
<div class="label">Href</div> <div class="label">Href - Hifi://address</div>
<div class="value"> <div class="value">
<input id="property-hyperlink-href" class="url"> <input id="property-hyperlink-href" class="url">
</div> </div>

View file

@ -812,6 +812,14 @@ void EntityItem::setMass(float mass) {
} }
} }
void EntityItem::setHref(QString value) {
auto href = value.toLower();
if (! (value.toLower().startsWith("hifi://")) ) {
return;
}
_href = value;
}
void EntityItem::simulate(const quint64& now) { void EntityItem::simulate(const quint64& now) {
if (_lastSimulated == 0) { if (_lastSimulated == 0) {
_lastSimulated = now; _lastSimulated = now;

View file

@ -172,7 +172,7 @@ public:
// Hyperlink related getters and setters // Hyperlink related getters and setters
QString getHref() const { return _href; } QString getHref() const { return _href; }
void setHref(QString value) { _href = value; } void setHref(QString value);
QString getDescription() const { return _description; } QString getDescription() const { return _description; }
void setDescription(QString value) { _description = value; } void setDescription(QString value) { _description = value; }