Resolve placeholders in entry details url

This commit is contained in:
Jonathan White authored and thez3ro committed 2017-10-26 12:19:23 +02:00
1 parent 8416d69f1e
commit b9fd609bb2
3 files changed
+19 -4

No files matched your search

+2 -1
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
+9 -2
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);
}
+8 -1
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">