Skip to content

Commit

Permalink
On Desktop platforms, make the data directory location a clickable hy…
Browse files Browse the repository at this point in the history
…perlink
  • Loading branch information
nirvn committed Jul 30, 2024
1 parent 83066b6 commit 51873e5
Showing 1 changed file with 19 additions and 10 deletions.
29 changes: 19 additions & 10 deletions src/qml/About.qml
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ Item {

return "QField<br>" + appVersionStr + " (" + links + ")<br>Qt " + qVersion
}
onLinkActivated: Qt.openUrlExternally(link)
onLinkActivated: link => Qt.openUrlExternally(link)
}
}

Expand Down Expand Up @@ -111,7 +111,7 @@ Item {
color: Theme.light
textFormat: Text.RichText
text: qsTr( "Developed by" ) + '<br><a href="https://opengis.ch">OPENGIS.ch</a>'
onLinkActivated: Qt.openUrlExternally(link)
onLinkActivated: link => Qt.openUrlExternally(link)
}
}
}
Expand All @@ -122,21 +122,30 @@ Item {
Layout.fillWidth: true
Layout.maximumWidth: parent.width
Layout.alignment: Qt.AlignCenter
Layout.bottomMargin: 10
horizontalAlignment: Text.AlignHCenter
font: Theme.tinyFont
color: Theme.light
opacity: 0.6
color: Theme.secondaryTextColor
textFormat: Text.RichText

text: {
var dataDirs = platformUtilities.appDataDirs();
let label = '';
let isDesktopPlatform = Qt.platform.os !== "ios" && Qt.platform.os !== "android";
let dataDirs = platformUtilities.appDataDirs();
if (dataDirs.length > 0) {
return (dataDirs.length > 1
? 'QField app directories'
: 'QField app directory')
+ '\n' + dataDirs.join('\n');
label = dataDirs.length > 1 ? qsTr('QField app directories') : qsTr('QField app directory');
for (let dataDir of dataDirs) {
if (isDesktopPlatform) {
label += '<br><a href="file://' + dataDir + '">' + dataDir + '</a>';
} else {
label += '<br>' + dataDir;
}
}
}
return '';
return label;
}

onLinkActivated: link => Qt.openUrlExternally(link)
}

QfButton {
Expand Down

1 comment on commit 51873e5

@qfield-fairy
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.