Add copy buttons for feed and episode download URLs

BUG: 443282
This commit is contained in:
Bart De Vries 2021-10-22 22:22:14 +02:00
parent c28739efeb
commit d4b5103c2b
3 changed files with 91 additions and 14 deletions

View File

@ -164,6 +164,7 @@ if(ANDROID)
edit-clear-all
edit-select-all
edit-select-none
edit-copy
download
media-playlist-append
media-seek-backward

View File

@ -89,6 +89,7 @@ Kirigami.ScrollablePage {
font.pointSize: SettingsManager && !(SettingsManager.articleFontUseSystem) ? SettingsManager.articleFontSize : Kirigami.Theme.defaultFont.pointSize
}
ListView {
visible: count !== 0
Layout.fillWidth: true
height: contentHeight
interactive: false
@ -103,6 +104,36 @@ Kirigami.ScrollablePage {
entry: page.entry
}
}
RowLayout {
Layout.leftMargin: Kirigami.Units.gridUnit
Layout.rightMargin: Kirigami.Units.gridUnit
Layout.bottomMargin: Kirigami.Units.gridUnit
visible: entry.hasEnclosure
spacing: Kirigami.Units.smallSpacing
TextEdit {
readOnly: true
textFormat:TextEdit.RichText
text: i18n("Episode Download URL:")
wrapMode: TextEdit.Wrap
}
TextEdit {
id: enclosureUrl
visible: false
readOnly: true
textFormat:TextEdit.RichText
text: entry.hasEnclosure ? entry.enclosure.url : ""
}
Controls.Button {
height: enclosureUrl.height
width: enclosureUrl.height
icon.name: "edit-copy"
onClicked: {
enclosureUrl.selectAll();
enclosureUrl.copy();
enclosureUrl.deselect();
}
}
}
}
actions.main: Kirigami.Action {

View File

@ -44,6 +44,7 @@ Kirigami.ScrollablePage {
}
ColumnLayout {
width: parent.width
TextEdit {
readOnly: true
selectByMouse: !Kirigami.Settings.isMobile
@ -62,22 +63,66 @@ Kirigami.ScrollablePage {
wrapMode: Text.WordWrap
Layout.fillWidth: true
}
TextEdit {
readOnly: true
selectByMouse: true
textFormat:TextEdit.RichText
text: i18n("Podcast URL") + ": <a href='%1'>%1</a>".arg(feed.url)
wrapMode: Text.WordWrap
Item {
Layout.fillWidth: true
Layout.preferredHeight: Math.max(feedUrlLayout.height, feedUrlCopyButton.width)
RowLayout {
id: feedUrlLayout
anchors.left: parent.left
anchors.right: feedUrlCopyButton.left
anchors.verticalCenter: parent.verticalCenter
spacing: Kirigami.Units.smallSpacing
TextEdit {
Layout.alignment: Qt.AlignTop
readOnly: true
textFormat:TextEdit.RichText
text: i18n("Podcast URL:")
wrapMode: TextEdit.Wrap
}
TextEdit {
id: feedUrl
Layout.alignment: Qt.AlignTop
readOnly: true
selectByMouse: !Kirigami.Settings.isMobile
textFormat:TextEdit.RichText
text: "<a href='%1'>%1</a>".arg(feed.url)
wrapMode: TextEdit.Wrap
Layout.fillWidth: true
}
}
Controls.Button {
anchors.right: parent.right
anchors.top: parent.top
anchors.leftMargin: Kirigami.Units.smallSpacing
id: feedUrlCopyButton
icon.name: "edit-copy"
onClicked: {
feedUrl.selectAll();
feedUrl.copy();
feedUrl.deselect();
}
}
}
TextEdit {
readOnly: true
selectByMouse: !Kirigami.Settings.isMobile
textFormat:TextEdit.RichText
text: i18n("Weblink") + ": <a href='%1'>%1</a>".arg(feed.link)
onLinkActivated: Qt.openUrlExternally(link)
wrapMode: Text.WordWrap
Layout.fillWidth: true
RowLayout {
spacing: Kirigami.Units.smallSpacing
TextEdit {
Layout.alignment: Qt.AlignTop
readOnly: true
textFormat:TextEdit.RichText
text: i18n("Weblink:")
wrapMode: TextEdit.Wrap
}
TextEdit {
readOnly: true
Layout.alignment: Qt.AlignTop
selectByMouse: !Kirigami.Settings.isMobile
textFormat:TextEdit.RichText
text: "<a href='%1'>%1</a>".arg(feed.link)
onLinkActivated: Qt.openUrlExternally(link)
wrapMode: Text.WordWrap
Layout.fillWidth: true
}
}
TextEdit {
readOnly: true