Skip to content

Commit bb705e8

Browse files
committed
Show all url schemas in entry view
1 parent e92d5e8 commit bb705e8

File tree

4 files changed

+18
-21
lines changed

4 files changed

+18
-21
lines changed

src/core/Entry.cpp

+1-2
Original file line numberDiff line numberDiff line change
@@ -287,8 +287,7 @@ QString Entry::webUrl() const
287287
QString Entry::displayUrl() const
288288
{
289289
QString url = maskPasswordPlaceholders(m_attributes->value(EntryAttributes::URLKey));
290-
url = resolveMultiplePlaceholders(url);
291-
return resolveUrl(url);
290+
return resolveMultiplePlaceholders(url);
292291
}
293292

294293
QString Entry::username() const

src/gui/DatabaseWidget.cpp

+11-14
Original file line numberDiff line numberDiff line change
@@ -629,23 +629,19 @@ void DatabaseWidget::openUrl()
629629

630630
void DatabaseWidget::openUrlForEntry(Entry* entry)
631631
{
632-
QString urlString = entry->resolveMultiplePlaceholders(entry->url());
633-
if (urlString.isEmpty()) {
634-
return;
635-
}
636-
637-
if (urlString.startsWith("cmd://")) {
632+
if (entry->url().startsWith("cmd://")) {
633+
QString cmdString = entry->resolveMultiplePlaceholders(entry->url());
638634
// check if decision to execute command was stored
639635
if (entry->attributes()->hasKey(EntryAttributes::RememberCmdExecAttr)) {
640636
if (entry->attributes()->value(EntryAttributes::RememberCmdExecAttr) == "1") {
641-
QProcess::startDetached(urlString.mid(6));
637+
QProcess::startDetached(cmdString.mid(6));
642638
}
643639
return;
644640
}
645641

646642
// otherwise ask user
647-
if (urlString.length() > 6) {
648-
QString cmdTruncated = urlString.mid(6);
643+
if (cmdString.length() > 6) {
644+
QString cmdTruncated = cmdString.mid(6);
649645
if (cmdTruncated.length() > 400)
650646
cmdTruncated = cmdTruncated.left(400) + " […]";
651647
QMessageBox msgbox(QMessageBox::Icon::Question,
@@ -668,18 +664,19 @@ void DatabaseWidget::openUrlForEntry(Entry* entry)
668664

669665
int result = msgbox.exec();
670666
if (result == QMessageBox::Yes) {
671-
QProcess::startDetached(urlString.mid(6));
667+
QProcess::startDetached(cmdString.mid(6));
672668
}
673669

674670
if (remember) {
675671
entry->attributes()->set(EntryAttributes::RememberCmdExecAttr,
676672
result == QMessageBox::Yes ? "1" : "0");
677673
}
678674
}
679-
}
680-
else {
681-
QUrl url = QUrl::fromUserInput(urlString);
682-
QDesktopServices::openUrl(url);
675+
} else {
676+
QString urlString = entry->webUrl();
677+
if (!urlString.isEmpty()) {
678+
QDesktopServices::openUrl(urlString);
679+
}
683680
}
684681
}
685682

src/gui/DetailsWidget.cpp

+3-5
Original file line numberDiff line numberDiff line change
@@ -174,17 +174,15 @@ void DetailsWidget::updateEntryGeneralTab()
174174
m_ui->entryPasswordLabel->setToolTip({});
175175
}
176176

177+
m_ui->entryUrlLabel->setRawText(m_currentEntry->displayUrl());
177178
const QString url = m_currentEntry->webUrl();
178179
if (!url.isEmpty()) {
179180
// URL is well formed and can be opened in a browser
180-
// create a new display url that masks password placeholders
181-
// the actual link will use the password
182-
m_ui->entryUrlLabel->setRawText(m_currentEntry->displayUrl());
183181
m_ui->entryUrlLabel->setUrl(url);
182+
m_ui->entryUrlLabel->setCursor(Qt::PointingHandCursor);
184183
} else {
185-
// Fallback to the raw url string
186-
m_ui->entryUrlLabel->setRawText(m_currentEntry->resolveMultiplePlaceholders(m_currentEntry->url()));
187184
m_ui->entryUrlLabel->setUrl({});
185+
m_ui->entryUrlLabel->setCursor(Qt::ArrowCursor);
188186
}
189187

190188
const TimeInfo entryTime = m_currentEntry->timeInfo();

src/gui/DetailsWidget.ui

+3
Original file line numberDiff line numberDiff line change
@@ -203,6 +203,9 @@
203203
<property name="text">
204204
<string/>
205205
</property>
206+
<property name="textInteractionFlags">
207+
<set>Qt::LinksAccessibleByKeyboard|Qt::LinksAccessibleByMouse</set>
208+
</property>
206209
</widget>
207210
</item>
208211
<item row="0" column="2">

0 commit comments

Comments
 (0)