Resolve placeholders in entry details url

This commit is contained in:
Jonathan White 2017-10-25 00:01:29 -04:00 committed by thez3ro
parent 8416d69f1e
commit b9fd609bb2
No known key found for this signature in database
GPG Key ID: F628F9E41DD7C073
3 changed files with 19 additions and 4 deletions

View File

@ -243,7 +243,8 @@ QString Entry::url() const
QString Entry::webUrl() const
{
return resolveUrl(m_attributes->value(EntryAttributes::URLKey));
QString url = resolveMultiplePlaceholders(m_attributes->value(EntryAttributes::URLKey));
return resolveUrl(url);
}
QString Entry::username() const

View File

@ -110,10 +110,17 @@ void DetailsWidget::getSelectedEntry(Entry* selectedEntry)
}
QString url = m_currentEntry->webUrl();
if (url != "") {
url = QString("<a href=\"%1\">%2</a>").arg(url).arg(shortUrl(url));
if (!url.isEmpty()) {
// URL is well formed and can be opened in a browser
// create a new display url that masks password placeholders
// the actual link will use the password
QString displayUrl = m_currentEntry->url();
displayUrl = m_currentEntry->maskPasswordPlaceholders(displayUrl);
displayUrl = m_currentEntry->resolveMultiplePlaceholders(displayUrl);
url = QString("<a href=\"%1\">%2</a>").arg(url).arg(shortUrl(displayUrl));
m_ui->urlLabel->setOpenExternalLinks(true);
} else {
// Fallback to the raw url string
url = shortUrl(m_currentEntry->resolveMultiplePlaceholders(m_currentEntry->url()));
m_ui->urlLabel->setOpenExternalLinks(false);
}

View File

@ -188,6 +188,9 @@
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="cursor">
<cursorShape>PointingHandCursor</cursorShape>
</property>
<property name="text">
<string/>
</property>
@ -289,7 +292,11 @@
</widget>
</item>
<item row="0" column="1">
<widget class="QLabel" name="usernameLabel"/>
<widget class="QLabel" name="usernameLabel">
<property name="textInteractionFlags">
<set>Qt::LinksAccessibleByMouse|Qt::TextSelectableByMouse</set>
</property>
</widget>
</item>
<item row="4" column="1">
<spacer name="verticalSpacer_2">