[Sailfish] contextMenus for Feeds and FeedItems Views
This commit is contained in:
parent
0f730f3993
commit
d06dfb84bf
3 changed files with 45 additions and 32 deletions
|
|
@ -15,9 +15,6 @@ import Sailfish.Silica 1.0
|
|||
ListItem {
|
||||
id: listItem
|
||||
|
||||
signal clicked
|
||||
property alias pressed: mouseArea.pressed
|
||||
|
||||
contentHeight: Theme.itemSizeMedium
|
||||
width: parent.width
|
||||
|
||||
|
|
@ -44,10 +41,4 @@ ListItem {
|
|||
(listItem.highlighted ? Theme.highlightColor : Theme.primaryColor) :
|
||||
(listItem.highlighted ? Theme.secondaryHighlightColor : Theme.secondaryColor)
|
||||
}
|
||||
|
||||
MouseArea {
|
||||
id: mouseArea
|
||||
anchors.fill: parent
|
||||
onClicked: listItem.clicked()
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -15,9 +15,6 @@ import Sailfish.Silica 1.0
|
|||
ListItem {
|
||||
id: listItem
|
||||
|
||||
signal clicked
|
||||
property alias pressed: mouseArea.pressed
|
||||
|
||||
contentHeight: Theme.itemSizeSmall
|
||||
width: parent.width
|
||||
menu: contextMenu
|
||||
|
|
@ -66,12 +63,6 @@ ListItem {
|
|||
(listItem.highlighted ? Theme.secondaryHighlightColor : Theme.secondaryColor)
|
||||
}
|
||||
|
||||
MouseArea {
|
||||
id: mouseArea
|
||||
anchors.fill: parent
|
||||
onClicked: listItem.clicked()
|
||||
}
|
||||
|
||||
Component {
|
||||
id: contextMenu
|
||||
ContextMenu {
|
||||
|
|
@ -80,13 +71,16 @@ ListItem {
|
|||
onClicked: {
|
||||
feeds.catchUp()
|
||||
} }
|
||||
// MenuItem {
|
||||
// text: qsTr("Unsubscribe")
|
||||
// enabled: feedMenu.feedId >= 0
|
||||
// onClicked: {
|
||||
// var ttrss = rootWindow.getTTRSS()
|
||||
// ttrss.unsubscribe(feedMenu.feedId, function() { feeds.update() })
|
||||
// } }
|
||||
MenuItem {
|
||||
text: qsTr("Unsubscribe")
|
||||
visible: model.feedId >= 0
|
||||
onClicked: {
|
||||
var ttrss = rootWindow.getTTRSS()
|
||||
ttrss.unsubscribe(model.feedId, function() { feeds.update() })
|
||||
} }
|
||||
Component.onCompleted: {
|
||||
feeds.selectedIndex = index
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -15,11 +15,9 @@ import Sailfish.Silica 1.0
|
|||
ListItem {
|
||||
id: listItem
|
||||
|
||||
signal clicked
|
||||
property alias pressed: mouseArea.pressed
|
||||
|
||||
contentHeight: Theme.itemSizeExtraLarge
|
||||
width: parent.width
|
||||
menu: contextMenu
|
||||
|
||||
Row {
|
||||
spacing: Theme.paddingMedium
|
||||
|
|
@ -104,10 +102,40 @@ ListItem {
|
|||
// }
|
||||
}
|
||||
}
|
||||
Component {
|
||||
id: contextMenu
|
||||
ContextMenu {
|
||||
MenuItem {
|
||||
id: toggleStarMenuItem
|
||||
text: model.marked ? qsTr("Unstar") : qsTr("Star")
|
||||
onClicked: {
|
||||
feedItems.toggleStar()
|
||||
} }
|
||||
MenuItem {
|
||||
id: togglePublishedMenuItem
|
||||
text: model.rss ? qsTr("Unpublish") : qsTr("Publish")
|
||||
onClicked: {
|
||||
feedItems.togglePublished()
|
||||
} }
|
||||
MenuItem {
|
||||
id: toggleReadMenuItem
|
||||
text: model.unread ? qsTr("Mark read") : qsTr("Mark Unread")
|
||||
onClicked: {
|
||||
feedItems.toggleRead()
|
||||
} }
|
||||
MenuItem {
|
||||
id: openInBrowserMenuItem
|
||||
text: qsTr("Open in Web Browser")
|
||||
visible: model.url && model.url != ""
|
||||
onClicked: {
|
||||
var item = feedItems.getSelectedItem()
|
||||
Qt.openUrlExternally(item.url)
|
||||
}
|
||||
|
||||
MouseArea {
|
||||
id: mouseArea
|
||||
anchors.fill: parent
|
||||
onClicked: listItem.clicked()
|
||||
}
|
||||
Component.onCompleted: {
|
||||
feedItems.selectedIndex = index
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue