[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 {
|
ListItem {
|
||||||
id: listItem
|
id: listItem
|
||||||
|
|
||||||
signal clicked
|
|
||||||
property alias pressed: mouseArea.pressed
|
|
||||||
|
|
||||||
contentHeight: Theme.itemSizeMedium
|
contentHeight: Theme.itemSizeMedium
|
||||||
width: parent.width
|
width: parent.width
|
||||||
|
|
||||||
|
|
@ -44,10 +41,4 @@ ListItem {
|
||||||
(listItem.highlighted ? Theme.highlightColor : Theme.primaryColor) :
|
(listItem.highlighted ? Theme.highlightColor : Theme.primaryColor) :
|
||||||
(listItem.highlighted ? Theme.secondaryHighlightColor : Theme.secondaryColor)
|
(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 {
|
ListItem {
|
||||||
id: listItem
|
id: listItem
|
||||||
|
|
||||||
signal clicked
|
|
||||||
property alias pressed: mouseArea.pressed
|
|
||||||
|
|
||||||
contentHeight: Theme.itemSizeSmall
|
contentHeight: Theme.itemSizeSmall
|
||||||
width: parent.width
|
width: parent.width
|
||||||
menu: contextMenu
|
menu: contextMenu
|
||||||
|
|
@ -66,12 +63,6 @@ ListItem {
|
||||||
(listItem.highlighted ? Theme.secondaryHighlightColor : Theme.secondaryColor)
|
(listItem.highlighted ? Theme.secondaryHighlightColor : Theme.secondaryColor)
|
||||||
}
|
}
|
||||||
|
|
||||||
MouseArea {
|
|
||||||
id: mouseArea
|
|
||||||
anchors.fill: parent
|
|
||||||
onClicked: listItem.clicked()
|
|
||||||
}
|
|
||||||
|
|
||||||
Component {
|
Component {
|
||||||
id: contextMenu
|
id: contextMenu
|
||||||
ContextMenu {
|
ContextMenu {
|
||||||
|
|
@ -80,13 +71,16 @@ ListItem {
|
||||||
onClicked: {
|
onClicked: {
|
||||||
feeds.catchUp()
|
feeds.catchUp()
|
||||||
} }
|
} }
|
||||||
// MenuItem {
|
MenuItem {
|
||||||
// text: qsTr("Unsubscribe")
|
text: qsTr("Unsubscribe")
|
||||||
// enabled: feedMenu.feedId >= 0
|
visible: model.feedId >= 0
|
||||||
// onClicked: {
|
onClicked: {
|
||||||
// var ttrss = rootWindow.getTTRSS()
|
var ttrss = rootWindow.getTTRSS()
|
||||||
// ttrss.unsubscribe(feedMenu.feedId, function() { feeds.update() })
|
ttrss.unsubscribe(model.feedId, function() { feeds.update() })
|
||||||
// } }
|
} }
|
||||||
|
Component.onCompleted: {
|
||||||
|
feeds.selectedIndex = index
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -15,11 +15,9 @@ import Sailfish.Silica 1.0
|
||||||
ListItem {
|
ListItem {
|
||||||
id: listItem
|
id: listItem
|
||||||
|
|
||||||
signal clicked
|
|
||||||
property alias pressed: mouseArea.pressed
|
|
||||||
|
|
||||||
contentHeight: Theme.itemSizeExtraLarge
|
contentHeight: Theme.itemSizeExtraLarge
|
||||||
width: parent.width
|
width: parent.width
|
||||||
|
menu: contextMenu
|
||||||
|
|
||||||
Row {
|
Row {
|
||||||
spacing: Theme.paddingMedium
|
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
|
Component.onCompleted: {
|
||||||
anchors.fill: parent
|
feedItems.selectedIndex = index
|
||||||
onClicked: listItem.clicked()
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue